ccguard
Version:
Automated enforcement of net-negative LOC, complexity constraints, and quality standards for Claude code
45 lines • 1.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LockCommand = void 0;
exports.LockCommand = {
name: 'lock',
description: 'Lock a file from modifications',
execute: async (guardManager, args) => {
if (args.length === 0) {
return {
decision: 'block',
reason: 'Usage: ccguard lock @<file-path>\n\nExample: ccguard lock @src/index.ts',
};
}
const filePath = args[0];
// Check if file path has @ prefix
if (!filePath.startsWith('@')) {
return {
decision: 'block',
reason: 'File path must start with @ prefix.\n\nExample: ccguard lock @src/index.ts',
};
}
// Remove @ prefix
const cleanPath = filePath.substring(1);
if (!cleanPath) {
return {
decision: 'block',
reason: 'Invalid file path. Please provide a valid path after @.',
};
}
try {
await guardManager.lockFile(cleanPath);
return {
decision: 'block',
reason: `File locked successfully: ${cleanPath}`,
};
}
catch (error) {
return {
decision: 'block',
reason: error instanceof Error ? error.message : 'Failed to lock file',
};
}
}
};
//# sourceMappingURL=LockCommand.js.map