/* jscpd:ignore-start */
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import c from "chalk";
import { clearCache } from '../../../common/cache/index.js';
import { uxLog } from '../../../common/utils/index.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('sfdx-hardis', 'org');
export default class CacheClear extends SfCommand {
    static title = 'Clear sfdx-hardis cache';
    static description = `
## Command Behavior

**Clears the local cache generated by the sfdx-hardis plugin.**

This command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:

- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.
- **Disk Space Management:** Freeing up storage on your local machine.
- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.

## Technical explanations

The command's technical implementation is straightforward:

- **Direct Function Call:** It directly invokes the \`clearCache()\` function, which is imported from uri../../../common/cache/index.jsuri.
- **Cache Management Logic:** The uriclearCache()\` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.
`;
    static examples = ['$ sf hardis:cache:clear'];
    static uiConfig = { hide: true };
    static flags = {
        debug: Flags.boolean({
            char: 'd',
            default: false,
            description: messages.getMessage('debugMode'),
        }),
        websocket: Flags.string({
            description: messages.getMessage('websocket'),
        }),
        skipauth: Flags.boolean({
            description: 'Skip authentication check when a default username is required',
        }),
    }; // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
    static requiresProject = false;
    /* jscpd:ignore-end */
    async run() {
        await clearCache();
        uxLog("action", this, c.cyan('sfdx-hardis cache cleared'));
        return {
            message: 'sfdx-hardis cache cleared',
        };
    }
}
//# sourceMappingURL=clear.js.map