@hopla/claude-setup 1.3.1 → 1.3.2

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/cli.js +58 -18
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -218,6 +218,14 @@ const HOPLA_PERMISSIONS = [
218
218
  "Bash(echo *)",
219
219
  ];
220
220
 
221
+ const PLANNING_PERMISSIONS = [
222
+ "Bash(git branch*)",
223
+ "Bash(git log*)",
224
+ "Bash(git status*)",
225
+ ];
226
+
227
+ const ALL_HOPLA_PERMISSIONS = new Set([...HOPLA_PERMISSIONS, ...PLANNING_PERMISSIONS]);
228
+
221
229
  async function setupPermissions() {
222
230
  const settingsPath = path.join(CLAUDE_DIR, "settings.json");
223
231
 
@@ -233,30 +241,62 @@ async function setupPermissions() {
233
241
  if (!settings.permissions) settings.permissions = {};
234
242
  if (!settings.permissions.allow) settings.permissions.allow = [];
235
243
 
236
- // Find permissions not yet added
237
- const existing = new Set(settings.permissions.allow);
238
- const toAdd = HOPLA_PERMISSIONS.filter((p) => !existing.has(p));
244
+ const targetPermissions = PLANNING ? PLANNING_PERMISSIONS : HOPLA_PERMISSIONS;
239
245
 
240
- if (toAdd.length === 0) {
241
- log(`${GREEN}✓${RESET} Permissions already configured.\n`);
242
- return;
243
- }
246
+ if (PLANNING) {
247
+ // Replace: remove all hopla-owned permissions, then add planning-only ones
248
+ const cleaned = settings.permissions.allow.filter((p) => !ALL_HOPLA_PERMISSIONS.has(p));
249
+ const toAdd = targetPermissions.filter((p) => !cleaned.includes(p));
250
+ const toRemove = settings.permissions.allow.filter((p) => ALL_HOPLA_PERMISSIONS.has(p) && !targetPermissions.includes(p));
244
251
 
245
- log(`${CYAN}Configuring permissions...${RESET}`);
246
- log(` The following will be added to ~/.claude/settings.json:\n`);
247
- for (const p of toAdd) {
248
- log(` ${CYAN}+${RESET} ${p}`);
249
- }
252
+ if (toAdd.length === 0 && toRemove.length === 0) {
253
+ log(`${GREEN}✓${RESET} Permissions already configured.\n`);
254
+ return;
255
+ }
250
256
 
251
- const ok = await confirm(`\n Add these permissions? (y/N) `);
252
- if (!ok) {
253
- log(` ${YELLOW}↷${RESET} Skipped you can add them manually to ~/.claude/settings.json\n`);
254
- return;
257
+ log(`${CYAN}Configuring permissions (planning mode)...${RESET}`);
258
+ log(` The following changes will be made to ~/.claude/settings.json:\n`);
259
+ for (const p of toRemove) {
260
+ log(` ${RED}-${RESET} ${p}`);
261
+ }
262
+ for (const p of toAdd) {
263
+ log(` ${CYAN}+${RESET} ${p}`);
264
+ }
265
+
266
+ const ok = await confirm(`\n Apply these permission changes? (y/N) `);
267
+ if (!ok) {
268
+ log(` ${YELLOW}↷${RESET} Skipped — you can edit ~/.claude/settings.json manually\n`);
269
+ return;
270
+ }
271
+
272
+ settings.permissions.allow = [...cleaned, ...targetPermissions];
273
+ } else {
274
+ // Merge: add missing ones
275
+ const existing = new Set(settings.permissions.allow);
276
+ const toAdd = targetPermissions.filter((p) => !existing.has(p));
277
+
278
+ if (toAdd.length === 0) {
279
+ log(`${GREEN}✓${RESET} Permissions already configured.\n`);
280
+ return;
281
+ }
282
+
283
+ log(`${CYAN}Configuring permissions...${RESET}`);
284
+ log(` The following will be added to ~/.claude/settings.json:\n`);
285
+ for (const p of toAdd) {
286
+ log(` ${CYAN}+${RESET} ${p}`);
287
+ }
288
+
289
+ const ok = await confirm(`\n Add these permissions? (y/N) `);
290
+ if (!ok) {
291
+ log(` ${YELLOW}↷${RESET} Skipped — you can add them manually to ~/.claude/settings.json\n`);
292
+ return;
293
+ }
294
+
295
+ settings.permissions.allow = [...settings.permissions.allow, ...toAdd];
255
296
  }
256
297
 
257
- settings.permissions.allow = [...settings.permissions.allow, ...toAdd];
258
298
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
259
- log(` ${GREEN}✓${RESET} Permissions added.\n`);
299
+ log(` ${GREEN}✓${RESET} Permissions configured.\n`);
260
300
  }
261
301
 
262
302
  const run = UNINSTALL ? uninstall : install;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hopla/claude-setup",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Hopla team agentic coding system for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {