@hopla/claude-setup 1.0.7 → 1.0.8

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 +52 -0
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -154,6 +154,58 @@ async function install() {
154
154
  log(` ${CYAN}/${name}${RESET}`);
155
155
  }
156
156
  log(`\nRun with ${BOLD}--force${RESET} to overwrite all files without prompting.\n`);
157
+
158
+ await setupPermissions();
159
+ }
160
+
161
+ const HOPLA_PERMISSIONS = [
162
+ "Bash(git *)",
163
+ "Bash(ls *)",
164
+ "Bash(find *)",
165
+ "Bash(cat *)",
166
+ "Bash(head *)",
167
+ "Bash(tail *)",
168
+ ];
169
+
170
+ async function setupPermissions() {
171
+ const settingsPath = path.join(CLAUDE_DIR, "settings.json");
172
+
173
+ // Read existing settings
174
+ let settings = { permissions: { allow: [] } };
175
+ if (fs.existsSync(settingsPath)) {
176
+ try {
177
+ settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
178
+ } catch {
179
+ // If parsing fails, keep defaults
180
+ }
181
+ }
182
+ if (!settings.permissions) settings.permissions = {};
183
+ if (!settings.permissions.allow) settings.permissions.allow = [];
184
+
185
+ // Find permissions not yet added
186
+ const existing = new Set(settings.permissions.allow);
187
+ const toAdd = HOPLA_PERMISSIONS.filter((p) => !existing.has(p));
188
+
189
+ if (toAdd.length === 0) {
190
+ log(`${GREEN}✓${RESET} Permissions already configured.\n`);
191
+ return;
192
+ }
193
+
194
+ log(`${CYAN}Configuring permissions...${RESET}`);
195
+ log(` The following will be added to ~/.claude/settings.json:\n`);
196
+ for (const p of toAdd) {
197
+ log(` ${CYAN}+${RESET} ${p}`);
198
+ }
199
+
200
+ const ok = await confirm(`\n Add these permissions? (y/N) `);
201
+ if (!ok) {
202
+ log(` ${YELLOW}↷${RESET} Skipped — you can add them manually to ~/.claude/settings.json\n`);
203
+ return;
204
+ }
205
+
206
+ settings.permissions.allow = [...settings.permissions.allow, ...toAdd];
207
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
208
+ log(` ${GREEN}✓${RESET} Permissions added.\n`);
157
209
  }
158
210
 
159
211
  const run = UNINSTALL ? uninstall : install;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hopla/claude-setup",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Hopla team agentic coding system for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {