@codedrifters/configulator 0.0.166 → 0.0.167

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.
package/lib/index.mjs CHANGED
@@ -628,6 +628,17 @@ var baseBundle = {
628
628
  "| `release:` | Release preparation, version bumps |",
629
629
  "| `hotfix:` | Urgent production fixes |",
630
630
  "",
631
+ "## GitHub Issue Type",
632
+ "",
633
+ "When creating issues, always assign the appropriate **GitHub issue type** based on the title prefix:",
634
+ "",
635
+ "| Prefix | GitHub Issue Type |",
636
+ "|--------|------------------|",
637
+ "| `epic:` | Epic |",
638
+ "| `feat:` | Feature |",
639
+ "| `fix:` | Bug |",
640
+ "| `chore:`, `docs:`, `refactor:`, `release:`, `hotfix:` | Task |",
641
+ "",
631
642
  "## Prerequisite Issues",
632
643
  "",
633
644
  "Include any prerequisite (blocking) issues in the issue body when they exist.",
@@ -656,18 +667,20 @@ var githubWorkflowBundle = {
656
667
  "",
657
668
  "When the user says **work on issue X** (or similar), follow these steps exactly:",
658
669
  "",
659
- "1. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
660
- "2. **Determine branch type** from the issue title prefix:",
670
+ "1. **Ensure you have the latest code** \u2014 switch to the default branch and pull:",
671
+ " - `git checkout {{repository.defaultBranch}} && git pull origin {{repository.defaultBranch}}`",
672
+ "2. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
673
+ "3. **Determine branch type** from the issue title prefix:",
661
674
  " - `feat:` / `feature:` \u2192 `feat/`",
662
675
  " - `fix:` / `bug:` \u2192 `fix/`",
663
676
  " - `docs:` \u2192 `docs/`",
664
677
  " - `chore:` / `refactor:` \u2192 `chore/`",
665
678
  " - `test:` \u2192 `test/`",
666
679
  " - No prefix \u2192 `feat/`",
667
- "3. **Create a branch** following the naming convention: `<type>/<short-slug>-<issue-number>` (e.g., `feat/add-login-42`)",
668
- "4. **Checkout the branch** locally",
669
- "5. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
670
- "6. **Stop and wait** for user instructions \u2014 do **NOT** start implementing",
680
+ "4. **Create a branch** following the naming convention: `<type>/<short-slug>-<issue-number>` (e.g., `feat/add-login-42`)",
681
+ "5. **Checkout the branch** locally",
682
+ "6. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
683
+ "7. **Stop and wait** for user instructions \u2014 do **NOT** start implementing",
671
684
  "",
672
685
  "### Important",
673
686
  "",
@@ -784,7 +797,10 @@ var jestBundle = {
784
797
  ].join("\n"),
785
798
  tags: ["testing"]
786
799
  }
787
- ]
800
+ ],
801
+ claudePermissions: {
802
+ allow: ["Bash(npx jest:*)"]
803
+ }
788
804
  };
789
805
 
790
806
  // src/pnpm/pnpm-workspace.ts
@@ -1287,7 +1303,10 @@ var turborepoBundle = {
1287
1303
  ].join("\n"),
1288
1304
  tags: ["workflow"]
1289
1305
  }
1290
- ]
1306
+ ],
1307
+ claudePermissions: {
1308
+ allow: ["Bash(npx turbo:*)"]
1309
+ }
1291
1310
  };
1292
1311
 
1293
1312
  // src/agent/bundles/typescript.ts
@@ -1362,7 +1381,10 @@ var typescriptBundle = {
1362
1381
  ].join("\n"),
1363
1382
  tags: ["coding"]
1364
1383
  }
1365
- ]
1384
+ ],
1385
+ claudePermissions: {
1386
+ allow: ["Bash(npx tsc:*)"]
1387
+ }
1366
1388
  };
1367
1389
 
1368
1390
  // src/vitest/vitest-component.ts
@@ -1554,7 +1576,10 @@ var vitestBundle = {
1554
1576
  ].join("\n"),
1555
1577
  tags: ["testing"]
1556
1578
  }
1557
- ]
1579
+ ],
1580
+ claudePermissions: {
1581
+ allow: ["Bash(npx vitest:*)"]
1582
+ }
1558
1583
  };
1559
1584
 
1560
1585
  // src/agent/bundles/index.ts
@@ -2179,6 +2204,110 @@ function resolveTemplateVariables(template, metadata) {
2179
2204
  }
2180
2205
 
2181
2206
  // src/agent/agent-config.ts
2207
+ var DEFAULT_CLAUDE_ALLOW = [
2208
+ // ── Git ──────────────────────────────────────────────────────────────
2209
+ "Bash(git add *)",
2210
+ "Bash(git branch *)",
2211
+ "Bash(git checkout *)",
2212
+ "Bash(git commit *)",
2213
+ "Bash(git diff *)",
2214
+ "Bash(git fetch *)",
2215
+ "Bash(git log *)",
2216
+ "Bash(git merge *)",
2217
+ "Bash(git mv *)",
2218
+ "Bash(git pull *)",
2219
+ "Bash(git push *)",
2220
+ "Bash(git rebase *)",
2221
+ "Bash(git rm *)",
2222
+ "Bash(git stash *)",
2223
+ "Bash(git status *)",
2224
+ "Bash(git show *)",
2225
+ "Bash(git rev-parse *)",
2226
+ // ── GitHub CLI ───────────────────────────────────────────────────────
2227
+ "Bash(gh issue *)",
2228
+ "Bash(gh pr *)",
2229
+ "Bash(gh repo *)",
2230
+ "Bash(gh api *)",
2231
+ "Bash(gh label *)",
2232
+ "Bash(gh run *)",
2233
+ "Bash(gh search *)",
2234
+ "Bash(gh browse *)",
2235
+ "Bash(gh status *)",
2236
+ // ── Package manager ──────────────────────────────────────────────────
2237
+ "Bash(pnpm *)",
2238
+ // ── Read-only shell utilities ────────────────────────────────────────
2239
+ "Bash(ls *)",
2240
+ "Bash(find *)",
2241
+ "Bash(cat *)",
2242
+ "Bash(head *)",
2243
+ "Bash(tail *)",
2244
+ "Bash(wc *)",
2245
+ "Bash(grep *)",
2246
+ "Bash(sort *)",
2247
+ "Bash(uniq *)",
2248
+ "Bash(dirname *)",
2249
+ "Bash(basename *)",
2250
+ "Bash(which *)",
2251
+ "Bash(diff *)",
2252
+ "Bash(jq *)",
2253
+ "Bash(date *)",
2254
+ // ── Safe output / test utilities ─────────────────────────────────────
2255
+ "Bash(echo *)",
2256
+ "Bash(printf *)",
2257
+ "Bash(test *)",
2258
+ "Bash([ *)",
2259
+ "Bash(true *)",
2260
+ "Bash(false *)",
2261
+ // ── Safe directory operations ────────────────────────────────────────
2262
+ "Bash(mkdir *)",
2263
+ "Bash(rmdir *)",
2264
+ // ── Built-in tools ───────────────────────────────────────────────────
2265
+ "Read(/**)",
2266
+ "Edit(/**)",
2267
+ "Write(/**)",
2268
+ "WebFetch",
2269
+ "WebSearch"
2270
+ ];
2271
+ var DEFAULT_CLAUDE_DENY = [
2272
+ // ── Destructive git ──────────────────────────────────────────────────
2273
+ "Bash(git push --force *)",
2274
+ "Bash(git push -f *)",
2275
+ "Bash(git push origin --force *)",
2276
+ "Bash(git push origin -f *)",
2277
+ "Bash(git reset --hard *)",
2278
+ "Bash(git clean -f *)",
2279
+ "Bash(git remote *)",
2280
+ // ── Destructive file operations ──────────────────────────────────────
2281
+ "Bash(rm -rf *)",
2282
+ "Bash(rm -r *)",
2283
+ "Bash(rm *)",
2284
+ // ── Network / remote access ──────────────────────────────────────────
2285
+ "Bash(curl *)",
2286
+ "Bash(wget *)",
2287
+ "Bash(ssh *)",
2288
+ "Bash(scp *)",
2289
+ // ── System administration ────────────────────────────────────────────
2290
+ "Bash(sudo *)",
2291
+ "Bash(chmod *)",
2292
+ "Bash(chown *)",
2293
+ "Bash(kill *)",
2294
+ "Bash(killall *)",
2295
+ "Bash(pkill *)",
2296
+ // ── Code execution / shell spawning ──────────────────────────────────
2297
+ "Bash(eval *)",
2298
+ "Bash(exec *)",
2299
+ "Bash(source *)",
2300
+ "Bash(. *)",
2301
+ "Bash(bash *)",
2302
+ "Bash(sh *)",
2303
+ "Bash(zsh *)",
2304
+ // ── App launching ────────────────────────────────────────────────────
2305
+ "Bash(open *)",
2306
+ "Bash(xdg-open *)",
2307
+ // ── Environment manipulation ─────────────────────────────────────────
2308
+ "Bash(export *)",
2309
+ "Bash(env *)"
2310
+ ];
2182
2311
  var AgentConfig = class _AgentConfig extends Component8 {
2183
2312
  /**
2184
2313
  * Find the AgentConfig component on a project.
@@ -2187,6 +2316,27 @@ var AgentConfig = class _AgentConfig extends Component8 {
2187
2316
  const isAgentConfig = (c) => c instanceof _AgentConfig;
2188
2317
  return project.components.find(isAgentConfig);
2189
2318
  }
2319
+ /**
2320
+ * Merges default Claude permissions with bundle and user-supplied settings.
2321
+ *
2322
+ * Merge order: defaults → bundle permissions → user-supplied entries.
2323
+ * `defaultMode` defaults to `"dontAsk"` unless overridden.
2324
+ */
2325
+ static mergeClaudeDefaults(userSettings, bundlePermissions) {
2326
+ const bundleAllow = bundlePermissions?.allow ?? [];
2327
+ const bundleDeny = bundlePermissions?.deny ?? [];
2328
+ const userAllow = userSettings?.permissions?.allow ?? [];
2329
+ const userDeny = userSettings?.permissions?.deny ?? [];
2330
+ return {
2331
+ ...userSettings,
2332
+ defaultMode: userSettings?.defaultMode ?? "dontAsk",
2333
+ permissions: {
2334
+ ...userSettings?.permissions,
2335
+ allow: [...DEFAULT_CLAUDE_ALLOW, ...bundleAllow, ...userAllow],
2336
+ deny: [...DEFAULT_CLAUDE_DENY, ...bundleDeny, ...userDeny]
2337
+ }
2338
+ };
2339
+ }
2190
2340
  constructor(project, options = {}) {
2191
2341
  super(project);
2192
2342
  this.options = options;
@@ -2217,13 +2367,17 @@ var AgentConfig = class _AgentConfig extends Component8 {
2217
2367
  );
2218
2368
  }
2219
2369
  if (platforms.includes(AGENT_PLATFORM.CLAUDE)) {
2370
+ const bundlePermissions = this.resolveBundlePermissions();
2220
2371
  ClaudeRenderer.render(
2221
2372
  this,
2222
2373
  resolvedRules,
2223
2374
  resolvedSkills,
2224
2375
  resolvedSubAgents,
2225
2376
  mcpServers,
2226
- this.options.claudeSettings
2377
+ _AgentConfig.mergeClaudeDefaults(
2378
+ this.options.claudeSettings,
2379
+ bundlePermissions
2380
+ )
2227
2381
  );
2228
2382
  }
2229
2383
  if (platforms.includes(AGENT_PLATFORM.CODEX)) {
@@ -2395,6 +2549,40 @@ ${extra}`
2395
2549
  return resolved !== agent.prompt ? { ...agent, prompt: resolved } : agent;
2396
2550
  });
2397
2551
  }
2552
+ /**
2553
+ * Collects Claude permission entries from all active bundles.
2554
+ */
2555
+ resolveBundlePermissions() {
2556
+ const allow = [];
2557
+ const deny = [];
2558
+ if (this.options.autoDetectBundles !== false) {
2559
+ for (const bundle of BUILT_IN_BUNDLES) {
2560
+ if (this.options.excludeBundles?.includes(bundle.name)) continue;
2561
+ if (bundle.appliesWhen(this.project) && bundle.claudePermissions) {
2562
+ if (bundle.claudePermissions.allow) {
2563
+ allow.push(...bundle.claudePermissions.allow);
2564
+ }
2565
+ if (bundle.claudePermissions.deny) {
2566
+ deny.push(...bundle.claudePermissions.deny);
2567
+ }
2568
+ }
2569
+ }
2570
+ }
2571
+ if (this.options.includeBundles) {
2572
+ for (const bundleName of this.options.includeBundles) {
2573
+ const bundle = BUILT_IN_BUNDLES.find((b) => b.name === bundleName);
2574
+ if (bundle?.claudePermissions) {
2575
+ if (bundle.claudePermissions.allow) {
2576
+ allow.push(...bundle.claudePermissions.allow);
2577
+ }
2578
+ if (bundle.claudePermissions.deny) {
2579
+ deny.push(...bundle.claudePermissions.deny);
2580
+ }
2581
+ }
2582
+ }
2583
+ }
2584
+ return { allow, deny };
2585
+ }
2398
2586
  };
2399
2587
 
2400
2588
  // src/aws/aws-deployment-config.ts