cc-safe-setup 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +42 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -58,6 +58,7 @@ const HOOKS = {
58
58
  };
59
59
 
60
60
  const HELP = process.argv.includes('--help') || process.argv.includes('-h');
61
+ const STATUS = process.argv.includes('--status') || process.argv.includes('-s');
61
62
 
62
63
  if (HELP) {
63
64
  console.log(`
@@ -65,6 +66,7 @@ if (HELP) {
65
66
 
66
67
  Usage:
67
68
  npx cc-safe-setup Install 7 safety hooks
69
+ npx cc-safe-setup --status Check installed hooks
68
70
  npx cc-safe-setup --dry-run Preview without installing
69
71
  npx cc-safe-setup --uninstall Remove all installed hooks
70
72
  npx cc-safe-setup --help Show this help
@@ -135,8 +137,48 @@ async function uninstall() {
135
137
  console.log();
136
138
  }
137
139
 
140
+ function status() {
141
+ console.log();
142
+ console.log(c.bold + ' cc-safe-setup --status' + c.reset);
143
+ console.log();
144
+
145
+ let installed = 0;
146
+ let missing = 0;
147
+ for (const [id, hook] of Object.entries(HOOKS)) {
148
+ const hookPath = join(HOOKS_DIR, id + '.sh');
149
+ if (existsSync(hookPath)) {
150
+ console.log(' ' + c.green + '✓' + c.reset + ' ' + hook.name + c.dim + ' → ' + hookPath + c.reset);
151
+ installed++;
152
+ } else {
153
+ console.log(' ' + c.red + '✗' + c.reset + ' ' + hook.name + c.dim + ' (not installed)' + c.reset);
154
+ missing++;
155
+ }
156
+ }
157
+
158
+ // Check settings.json
159
+ let settingsOk = false;
160
+ if (existsSync(SETTINGS_PATH)) {
161
+ try {
162
+ const settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8'));
163
+ if (settings.hooks) settingsOk = true;
164
+ } catch(e) {}
165
+ }
166
+ console.log();
167
+ console.log(' ' + (settingsOk ? c.green + '✓' : c.red + '✗') + c.reset + ' settings.json ' + (settingsOk ? 'has hooks configured' : 'missing hook configuration'));
168
+
169
+ console.log();
170
+ if (missing === 0) {
171
+ console.log(c.bold + ' All ' + installed + ' hooks installed.' + c.reset);
172
+ } else {
173
+ console.log(c.bold + ' ' + installed + '/' + Object.keys(HOOKS).length + ' hooks installed.' + c.reset);
174
+ console.log(' ' + c.dim + 'Run: npx cc-safe-setup' + c.reset);
175
+ }
176
+ console.log();
177
+ }
178
+
138
179
  async function main() {
139
180
  if (UNINSTALL) return uninstall();
181
+ if (STATUS) return status();
140
182
 
141
183
  console.log();
142
184
  console.log(c.bold + ' cc-safe-setup' + c.reset);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "One command to make Claude Code safe for autonomous operation. 7 hooks: destructive blocker, branch guard, force-push protection, secret leak prevention, syntax checks, and more.",
5
5
  "main": "index.mjs",
6
6
  "bin": {