@codedrifters/configulator 0.0.166 → 0.0.168

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,13 +797,16 @@ 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
791
807
  import { relative } from "path";
792
808
  import { Component, YamlFile } from "projen";
793
- var MIMIMUM_RELEASE_AGE = {
809
+ var MINIMUM_RELEASE_AGE = {
794
810
  ZERO_DAYS: 0,
795
811
  ONE_HOUR: 60,
796
812
  SIX_HOURS: 360,
@@ -819,7 +835,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component {
819
835
  super(project);
820
836
  project.tryFindObjectFile("package.json")?.addDeletionOverride("pnpm");
821
837
  this.fileName = options.fileName ?? "pnpm-workspace.yaml";
822
- this.minimumReleaseAge = options.minimumReleaseAge ?? MIMIMUM_RELEASE_AGE.ONE_DAY;
838
+ this.minimumReleaseAge = options.minimumReleaseAge ?? MINIMUM_RELEASE_AGE.ONE_DAY;
823
839
  this.minimumReleaseAgeExclude = options.minimumReleaseAgeExclude ? ["@codedrifters/*", ...options.minimumReleaseAgeExclude] : ["@codedrifters/*"];
824
840
  this.onlyBuiltDependencies = options.onlyBuiltDependencies ? options.onlyBuiltDependencies : [];
825
841
  this.ignoredBuiltDependencies = options.ignoredBuiltDependencies ? options.ignoredBuiltDependencies : [];
@@ -866,6 +882,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component {
866
882
  });
867
883
  }
868
884
  };
885
+ var MIMIMUM_RELEASE_AGE = MINIMUM_RELEASE_AGE;
869
886
 
870
887
  // src/agent/bundles/pnpm.ts
871
888
  var pnpmBundle = {
@@ -1287,7 +1304,10 @@ var turborepoBundle = {
1287
1304
  ].join("\n"),
1288
1305
  tags: ["workflow"]
1289
1306
  }
1290
- ]
1307
+ ],
1308
+ claudePermissions: {
1309
+ allow: ["Bash(npx turbo:*)"]
1310
+ }
1291
1311
  };
1292
1312
 
1293
1313
  // src/agent/bundles/typescript.ts
@@ -1362,7 +1382,10 @@ var typescriptBundle = {
1362
1382
  ].join("\n"),
1363
1383
  tags: ["coding"]
1364
1384
  }
1365
- ]
1385
+ ],
1386
+ claudePermissions: {
1387
+ allow: ["Bash(npx tsc:*)"]
1388
+ }
1366
1389
  };
1367
1390
 
1368
1391
  // src/vitest/vitest-component.ts
@@ -1554,7 +1577,10 @@ var vitestBundle = {
1554
1577
  ].join("\n"),
1555
1578
  tags: ["testing"]
1556
1579
  }
1557
- ]
1580
+ ],
1581
+ claudePermissions: {
1582
+ allow: ["Bash(npx vitest:*)"]
1583
+ }
1558
1584
  };
1559
1585
 
1560
1586
  // src/agent/bundles/index.ts
@@ -2179,6 +2205,110 @@ function resolveTemplateVariables(template, metadata) {
2179
2205
  }
2180
2206
 
2181
2207
  // src/agent/agent-config.ts
2208
+ var DEFAULT_CLAUDE_ALLOW = [
2209
+ // ── Git ──────────────────────────────────────────────────────────────
2210
+ "Bash(git add *)",
2211
+ "Bash(git branch *)",
2212
+ "Bash(git checkout *)",
2213
+ "Bash(git commit *)",
2214
+ "Bash(git diff *)",
2215
+ "Bash(git fetch *)",
2216
+ "Bash(git log *)",
2217
+ "Bash(git merge *)",
2218
+ "Bash(git mv *)",
2219
+ "Bash(git pull *)",
2220
+ "Bash(git push *)",
2221
+ "Bash(git rebase *)",
2222
+ "Bash(git rm *)",
2223
+ "Bash(git stash *)",
2224
+ "Bash(git status *)",
2225
+ "Bash(git show *)",
2226
+ "Bash(git rev-parse *)",
2227
+ // ── GitHub CLI ───────────────────────────────────────────────────────
2228
+ "Bash(gh issue *)",
2229
+ "Bash(gh pr *)",
2230
+ "Bash(gh repo *)",
2231
+ "Bash(gh api *)",
2232
+ "Bash(gh label *)",
2233
+ "Bash(gh run *)",
2234
+ "Bash(gh search *)",
2235
+ "Bash(gh browse *)",
2236
+ "Bash(gh status *)",
2237
+ // ── Package manager ──────────────────────────────────────────────────
2238
+ "Bash(pnpm *)",
2239
+ // ── Read-only shell utilities ────────────────────────────────────────
2240
+ "Bash(ls *)",
2241
+ "Bash(find *)",
2242
+ "Bash(cat *)",
2243
+ "Bash(head *)",
2244
+ "Bash(tail *)",
2245
+ "Bash(wc *)",
2246
+ "Bash(grep *)",
2247
+ "Bash(sort *)",
2248
+ "Bash(uniq *)",
2249
+ "Bash(dirname *)",
2250
+ "Bash(basename *)",
2251
+ "Bash(which *)",
2252
+ "Bash(diff *)",
2253
+ "Bash(jq *)",
2254
+ "Bash(date *)",
2255
+ // ── Safe output / test utilities ─────────────────────────────────────
2256
+ "Bash(echo *)",
2257
+ "Bash(printf *)",
2258
+ "Bash(test *)",
2259
+ "Bash([ *)",
2260
+ "Bash(true *)",
2261
+ "Bash(false *)",
2262
+ // ── Safe directory operations ────────────────────────────────────────
2263
+ "Bash(mkdir *)",
2264
+ "Bash(rmdir *)",
2265
+ // ── Built-in tools ───────────────────────────────────────────────────
2266
+ "Read(/**)",
2267
+ "Edit(/**)",
2268
+ "Write(/**)",
2269
+ "WebFetch",
2270
+ "WebSearch"
2271
+ ];
2272
+ var DEFAULT_CLAUDE_DENY = [
2273
+ // ── Destructive git ──────────────────────────────────────────────────
2274
+ "Bash(git push --force *)",
2275
+ "Bash(git push -f *)",
2276
+ "Bash(git push origin --force *)",
2277
+ "Bash(git push origin -f *)",
2278
+ "Bash(git reset --hard *)",
2279
+ "Bash(git clean -f *)",
2280
+ "Bash(git remote *)",
2281
+ // ── Destructive file operations ──────────────────────────────────────
2282
+ "Bash(rm -rf *)",
2283
+ "Bash(rm -r *)",
2284
+ "Bash(rm *)",
2285
+ // ── Network / remote access ──────────────────────────────────────────
2286
+ "Bash(curl *)",
2287
+ "Bash(wget *)",
2288
+ "Bash(ssh *)",
2289
+ "Bash(scp *)",
2290
+ // ── System administration ────────────────────────────────────────────
2291
+ "Bash(sudo *)",
2292
+ "Bash(chmod *)",
2293
+ "Bash(chown *)",
2294
+ "Bash(kill *)",
2295
+ "Bash(killall *)",
2296
+ "Bash(pkill *)",
2297
+ // ── Code execution / shell spawning ──────────────────────────────────
2298
+ "Bash(eval *)",
2299
+ "Bash(exec *)",
2300
+ "Bash(source *)",
2301
+ "Bash(. *)",
2302
+ "Bash(bash *)",
2303
+ "Bash(sh *)",
2304
+ "Bash(zsh *)",
2305
+ // ── App launching ────────────────────────────────────────────────────
2306
+ "Bash(open *)",
2307
+ "Bash(xdg-open *)",
2308
+ // ── Environment manipulation ─────────────────────────────────────────
2309
+ "Bash(export *)",
2310
+ "Bash(env *)"
2311
+ ];
2182
2312
  var AgentConfig = class _AgentConfig extends Component8 {
2183
2313
  /**
2184
2314
  * Find the AgentConfig component on a project.
@@ -2187,6 +2317,27 @@ var AgentConfig = class _AgentConfig extends Component8 {
2187
2317
  const isAgentConfig = (c) => c instanceof _AgentConfig;
2188
2318
  return project.components.find(isAgentConfig);
2189
2319
  }
2320
+ /**
2321
+ * Merges default Claude permissions with bundle and user-supplied settings.
2322
+ *
2323
+ * Merge order: defaults → bundle permissions → user-supplied entries.
2324
+ * `defaultMode` defaults to `"dontAsk"` unless overridden.
2325
+ */
2326
+ static mergeClaudeDefaults(userSettings, bundlePermissions) {
2327
+ const bundleAllow = bundlePermissions?.allow ?? [];
2328
+ const bundleDeny = bundlePermissions?.deny ?? [];
2329
+ const userAllow = userSettings?.permissions?.allow ?? [];
2330
+ const userDeny = userSettings?.permissions?.deny ?? [];
2331
+ return {
2332
+ ...userSettings,
2333
+ defaultMode: userSettings?.defaultMode ?? "dontAsk",
2334
+ permissions: {
2335
+ ...userSettings?.permissions,
2336
+ allow: [...DEFAULT_CLAUDE_ALLOW, ...bundleAllow, ...userAllow],
2337
+ deny: [...DEFAULT_CLAUDE_DENY, ...bundleDeny, ...userDeny]
2338
+ }
2339
+ };
2340
+ }
2190
2341
  constructor(project, options = {}) {
2191
2342
  super(project);
2192
2343
  this.options = options;
@@ -2217,13 +2368,17 @@ var AgentConfig = class _AgentConfig extends Component8 {
2217
2368
  );
2218
2369
  }
2219
2370
  if (platforms.includes(AGENT_PLATFORM.CLAUDE)) {
2371
+ const bundlePermissions = this.resolveBundlePermissions();
2220
2372
  ClaudeRenderer.render(
2221
2373
  this,
2222
2374
  resolvedRules,
2223
2375
  resolvedSkills,
2224
2376
  resolvedSubAgents,
2225
2377
  mcpServers,
2226
- this.options.claudeSettings
2378
+ _AgentConfig.mergeClaudeDefaults(
2379
+ this.options.claudeSettings,
2380
+ bundlePermissions
2381
+ )
2227
2382
  );
2228
2383
  }
2229
2384
  if (platforms.includes(AGENT_PLATFORM.CODEX)) {
@@ -2395,6 +2550,40 @@ ${extra}`
2395
2550
  return resolved !== agent.prompt ? { ...agent, prompt: resolved } : agent;
2396
2551
  });
2397
2552
  }
2553
+ /**
2554
+ * Collects Claude permission entries from all active bundles.
2555
+ */
2556
+ resolveBundlePermissions() {
2557
+ const allow = [];
2558
+ const deny = [];
2559
+ if (this.options.autoDetectBundles !== false) {
2560
+ for (const bundle of BUILT_IN_BUNDLES) {
2561
+ if (this.options.excludeBundles?.includes(bundle.name)) continue;
2562
+ if (bundle.appliesWhen(this.project) && bundle.claudePermissions) {
2563
+ if (bundle.claudePermissions.allow) {
2564
+ allow.push(...bundle.claudePermissions.allow);
2565
+ }
2566
+ if (bundle.claudePermissions.deny) {
2567
+ deny.push(...bundle.claudePermissions.deny);
2568
+ }
2569
+ }
2570
+ }
2571
+ }
2572
+ if (this.options.includeBundles) {
2573
+ for (const bundleName of this.options.includeBundles) {
2574
+ const bundle = BUILT_IN_BUNDLES.find((b) => b.name === bundleName);
2575
+ if (bundle?.claudePermissions) {
2576
+ if (bundle.claudePermissions.allow) {
2577
+ allow.push(...bundle.claudePermissions.allow);
2578
+ }
2579
+ if (bundle.claudePermissions.deny) {
2580
+ deny.push(...bundle.claudePermissions.deny);
2581
+ }
2582
+ }
2583
+ }
2584
+ }
2585
+ return { allow, deny };
2586
+ }
2398
2587
  };
2399
2588
 
2400
2589
  // src/aws/aws-deployment-config.ts
@@ -3816,6 +4005,7 @@ export {
3816
4005
  MCP_TRANSPORT,
3817
4006
  MERGE_METHODS,
3818
4007
  MIMIMUM_RELEASE_AGE,
4008
+ MINIMUM_RELEASE_AGE,
3819
4009
  MonorepoProject,
3820
4010
  PROD_DEPLOY_NAME,
3821
4011
  PnpmWorkspace,