baldart 4.0.4 → 4.1.1

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 (44) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/VERSION +1 -1
  3. package/framework/.claude/agents/REGISTRY.md +5 -5
  4. package/framework/.claude/agents/api-perf-cost-auditor.md +4 -4
  5. package/framework/.claude/agents/code-reviewer.md +2 -2
  6. package/framework/.claude/agents/codebase-architect.md +24 -24
  7. package/framework/.claude/agents/coder.md +6 -6
  8. package/framework/.claude/agents/doc-reviewer.md +16 -16
  9. package/framework/.claude/agents/hybrid-ml-architect.md +1 -1
  10. package/framework/.claude/agents/legal-counsel-gdpr.md +1 -1
  11. package/framework/.claude/agents/motion-expert.md +3 -3
  12. package/framework/.claude/agents/plan-auditor.md +4 -4
  13. package/framework/.claude/agents/prd-card-writer.md +14 -14
  14. package/framework/.claude/agents/prd.md +17 -17
  15. package/framework/.claude/agents/security-reviewer.md +1 -1
  16. package/framework/.claude/agents/senior-researcher.md +1 -1
  17. package/framework/.claude/agents/skill-improver.md +1 -1
  18. package/framework/.claude/agents/visual-designer.md +6 -6
  19. package/framework/.claude/agents/wiki-curator.md +6 -6
  20. package/framework/.claude/commands/check.md +1 -1
  21. package/framework/.claude/commands/codexreview.md +2 -2
  22. package/framework/.claude/commands/qa.md +1 -1
  23. package/framework/.claude/skills/bug/SKILL.md +2 -2
  24. package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +2 -0
  25. package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +2 -0
  26. package/framework/.claude/skills/new/SKILL.md +7 -7
  27. package/framework/.claude/skills/prd/assets/card-template.yml +3 -3
  28. package/framework/.claude/skills/prd/assets/epic-template.yml +6 -6
  29. package/framework/.claude/skills/prd/assets/prd-template.md +2 -2
  30. package/framework/.claude/skills/prd/assets/state-template.md +1 -1
  31. package/framework/.claude/skills/prd/references/audit-phase.md +1 -1
  32. package/framework/.claude/skills/prd/references/backlog-phase.md +3 -3
  33. package/framework/.claude/skills/prd/references/discovery-phase.md +11 -6
  34. package/framework/.claude/skills/prd/references/prd-writing-phase.md +2 -2
  35. package/framework/.claude/skills/worktree-manager/SKILL.md +37 -8
  36. package/framework/agents/project-context.md +1 -0
  37. package/framework/docs/PROJECT-CONFIGURATION.md +1 -0
  38. package/framework/routines/ds-drift.routine.yml +6 -6
  39. package/framework/routines/wiki-review.routine.yml +4 -4
  40. package/framework/templates/baldart.config.template.yml +1 -0
  41. package/framework/templates/overlays/commands/codexreview.example.md +2 -0
  42. package/package.json +1 -1
  43. package/src/commands/configure.js +2 -0
  44. package/src/commands/update.js +5 -0
@@ -110,14 +110,30 @@ if [ ! -f "$MAIN_ROOT/.gitignore" ] || ! grep -qE '^\.worktrees/?$' "$MAIN_ROOT/
110
110
  exit 1
111
111
  fi
112
112
 
113
- # 0b. Resolve the trunk branch from config (R7) no bare 'develop' literal.
114
- # TRUNK MUST be non-empty before any fetch/branch.
113
+ # 0b. Resolve the trunk branch (R7). Prefer the config key; if the consumer
114
+ # updated to >=4.0.0 without re-running `configure`, `git.trunk_branch` may
115
+ # be absent — in that case AUTODETECT the repo's real default branch
116
+ # (origin/HEAD → local develop/main/master) instead of hard-failing. This is
117
+ # NOT "assume develop": it resolves the branch the repo actually uses, the
118
+ # same logic configure.js applies. Only abort when even autodetection finds
119
+ # nothing (bare repo / no branches). Without this fallback a config missing
120
+ # the v4.0.0 key silently blocked every `/prd` worktree (regression v4.0.0).
115
121
  TRUNK=$(grep -A40 '^git:' "$MAIN_ROOT/baldart.config.yml" 2>/dev/null \
116
122
  | grep 'trunk_branch:' | head -1 \
117
123
  | sed -E 's/.*trunk_branch:[[:space:]]*([A-Za-z0-9._\/-]+).*/\1/' || true)
118
124
  if [ -z "$TRUNK" ]; then
119
- echo "ERROR: git.trunk_branch not set in baldart.config.yml ASK the user (never assume 'develop')." >&2
120
- exit 1
125
+ TRUNK=$(git -C "$MAIN_ROOT" symbolic-ref --quiet refs/remotes/origin/HEAD 2>/dev/null \
126
+ | sed -E 's#^refs/remotes/origin/##' || true)
127
+ if [ -z "$TRUNK" ]; then
128
+ for cand in develop main master; do
129
+ if git -C "$MAIN_ROOT" show-ref --verify --quiet "refs/heads/$cand"; then TRUNK="$cand"; break; fi
130
+ done
131
+ fi
132
+ if [ -z "$TRUNK" ]; then
133
+ echo "ERROR: git.trunk_branch not set in baldart.config.yml and no trunk branch could be autodetected (origin/HEAD / develop / main / master). Run 'npx baldart configure' to set git.trunk_branch, or create the trunk branch first." >&2
134
+ exit 1
135
+ fi
136
+ echo "WARN: git.trunk_branch missing from baldart.config.yml — autodetected '$TRUNK'. Run 'npx baldart configure' to persist it and silence this warning." >&2
121
137
  fi
122
138
 
123
139
  # 1. Pre-flight — read-only fetch, NEVER touches main repo HEAD
@@ -344,12 +360,25 @@ Supports three modes:
344
360
  # persist both onto the registry entry created in step 6 (R6). Every later step
345
361
  # reads them from the registry with a presence guard — never from in-context state.
346
362
  MAIN="$(git rev-parse --show-toplevel)"
363
+ # Prefer git.trunk_branch; autodetect the repo's real default branch if the
364
+ # config key is absent (consumer updated to >=4.0.0 without re-running
365
+ # `configure`). Same fallback as nw-docs — never hard-fail on a resolvable repo.
347
366
  TRUNK=$(grep -A40 '^git:' "$MAIN/baldart.config.yml" 2>/dev/null \
348
367
  | grep 'trunk_branch:' | head -1 \
349
368
  | sed -E 's/.*trunk_branch:[[:space:]]*([A-Za-z0-9._\/-]+).*/\1/' || true)
350
369
  if [ -z "$TRUNK" ]; then
351
- echo "ERROR: git.trunk_branch not set in baldart.config.yml ASK the user (never assume 'develop')." >&2
352
- exit 1
370
+ TRUNK=$(git -C "$MAIN" symbolic-ref --quiet refs/remotes/origin/HEAD 2>/dev/null \
371
+ | sed -E 's#^refs/remotes/origin/##' || true)
372
+ if [ -z "$TRUNK" ]; then
373
+ for cand in develop main master; do
374
+ if git -C "$MAIN" show-ref --verify --quiet "refs/heads/$cand"; then TRUNK="$cand"; break; fi
375
+ done
376
+ fi
377
+ if [ -z "$TRUNK" ]; then
378
+ echo "ERROR: git.trunk_branch not set in baldart.config.yml and no trunk branch could be autodetected (origin/HEAD / develop / main / master). Run 'npx baldart configure' to set git.trunk_branch, or create the trunk branch first." >&2
379
+ exit 1
380
+ fi
381
+ echo "WARN: git.trunk_branch missing from baldart.config.yml — autodetected '$TRUNK'. Run 'npx baldart configure' to persist it." >&2
353
382
  fi
354
383
 
355
384
  # Fetch latest trunk from remote — read-only, does NOT touch the main repo's HEAD.
@@ -709,7 +738,7 @@ internal structure (tables, key/value blocks, code).
709
738
  | **Structured registries** | `project-status.md`, `ssot-registry.md`, `field-registry.*`, `traceability-matrix.md`, `REGISTRY.md` | Strip markers, then **structural validation** — if valid, accept; if invalid, abort | The auto-strip "keep both sides" usually produces an additive result (new bullet rows appended to a table or section). The validation step catches the rare case where the two sides modified the same row. See `validate_structured_md` below. |
710
739
  | **JSONL logs under `${paths.metrics}/`** | `${paths.metrics}/*.jsonl`, `${paths.metrics}/**/*.jsonl` | Auto-resolve: strip markers, keep both sides | JSONL is line-oriented and additive — duplicating both branches' lines yields a valid file. (`paths.metrics` default `docs/metrics`.) |
711
740
  | **Other `.jsonl`** | `*.jsonl` outside `${paths.metrics}/` | STOP — abort and report | Fixtures, seeds, training data: auto-strip can corrupt them. The user must inspect. |
712
- | **Docs/config** | `docs/**/*.md`, `backlog/*.yml`, `*.md` outside `src/`, `*.json`/`*.yml` outside `src/` (excluding rows above) | Auto-resolve: strip markers, keep both sides | The canonical additive case. |
741
+ | **Docs/config** | `${paths.docs_dir}/**/*.md`, `${paths.backlog_dir}/*.yml`, `*.md` outside `src/`, `*.json`/`*.yml` outside `src/` (excluding rows above) | Auto-resolve: strip markers, keep both sides | The canonical additive case. |
713
742
  | **Code** | `src/**/*.ts`, `*.tsx`, `*.js`, `*.jsx` | STOP — abort rebase, report to user | |
714
743
  | **Tests** | `*.test.*`, `*.spec.*` | Manual only — report to user | |
715
744
 
@@ -784,7 +813,7 @@ for FILE in $CONFLICTED; do
784
813
 
785
814
  # 4. Generic docs/config — additive merge
786
815
  case "$FILE" in
787
- docs/*|backlog/*|*.md|*.json|*.yml)
816
+ ${paths.docs_dir}/*|${paths.backlog_dir}/*|*.md|*.json|*.yml)
788
817
  sed -i '' '/^<<<<<<< /d; /^=======/d; /^>>>>>>> /d' "$FILE"
789
818
  git add "$FILE" ;;
790
819
  esac
@@ -174,6 +174,7 @@ When `base_agent_version` in the overlay is older than the installed framework v
174
174
  | Backlog | `backlog/*.yml` count > 0 | `paths.backlog_dir: backlog`, `features.has_backlog: true` |
175
175
  | ADR | `docs/decisions/ADR-*.md` count > 0 | `paths.adrs_dir: docs/decisions`, `features.has_adrs: true` |
176
176
  | PRD | `docs/prd/` exists | `paths.prd_dir: docs/prd`, `features.has_prd_workflow: true` |
177
+ | Docs root | `docs/` exists | `paths.docs_dir: docs` |
177
178
  | References dir | `docs/references/` exists | `paths.references_dir: docs/references` |
178
179
  | LLM wiki | `docs/wiki/` exists | `paths.wiki_dir: docs/wiki`, `features.has_wiki_overlay: true` |
179
180
  | E2E tests | first match of `tests/e2e`, `e2e`, `tests/playwright`, `tests/cypress` | `paths.e2e_tests_dir: <found>` |
@@ -105,6 +105,7 @@ Empty string `""` means the concept doesn't exist in your project. Skills gated
105
105
  | `backlog_dir` | `backlog` | new, prd, context-primer |
106
106
  | `adrs_dir` | `docs/decisions` | prd, prd-add |
107
107
  | `prd_dir` | `docs/prd` | prd, prd-add, ui-design |
108
+ | `docs_dir` | `docs` | code-reviewer, senior-researcher, worktree-manager (rg-search fallback root) |
108
109
  | `references_dir` | `docs/references` | new, prd, context-primer, doc-writing-for-rag, simplify |
109
110
  | `wiki_dir` | `docs/wiki` | capture, context-primer |
110
111
  | `e2e_tests_dir` | `tests/e2e` | playwright-skill, e2e-review (v3.18.0) |
@@ -11,21 +11,21 @@ schedule:
11
11
  agent: doc-reviewer
12
12
 
13
13
  prompt: |
14
- Run the weekly design-system drift check (only if `docs/design-system/`
14
+ Run the weekly design-system drift check (only if `${paths.design_system}/`
15
15
  exists in the project — exit cleanly if absent):
16
16
 
17
- 1. **INDEX coverage**: compare `docs/design-system/INDEX.md` component
17
+ 1. **INDEX coverage**: compare `${paths.design_system}/INDEX.md` component
18
18
  index against the actual shared-component inventory. Flag
19
19
  `DS_INDEX_DRIFT` for any mismatch.
20
- 2. **Per-component accuracy**: for each `docs/design-system/components/<Name>.md`,
20
+ 2. **Per-component accuracy**: for each `${paths.design_system}/components/<Name>.md`,
21
21
  verify it lines up with the source file (variants, props, exported
22
22
  constants). Flag `DS_COMPONENT_STALE` for docs not re-verified in >7
23
23
  days where the source has changed in git.
24
- 3. **Animations reconciliation**: `docs/design-system/patterns/animations.md`
24
+ 3. **Animations reconciliation**: `${paths.design_system}/patterns/animations.md`
25
25
  must match keyframes in the project's global styles. Flag
26
26
  `DS_ANIMATIONS_DRIFT`.
27
27
  4. **Tokens reconciliation**: when tokens source files changed, verify
28
- `docs/design-system/tokens-reference.md` is in sync and the relevant
28
+ `${paths.design_system}/tokens-reference.md` is in sync and the relevant
29
29
  CSS custom properties still exist. Flag `DS_TOKENS_DRIFT`.
30
30
  5. Emit a consolidated report under
31
31
  `docs/reports/{{YYYYMMDD}}-ds-drift.md`.
@@ -41,7 +41,7 @@ output:
41
41
  branch: main
42
42
 
43
43
  required_artifacts:
44
- - docs/design-system/
44
+ - ${paths.design_system}/
45
45
  - .claude/agents/doc-reviewer.md
46
46
 
47
47
  optional: true # routine is silently skipped when artifacts missing
@@ -1,5 +1,5 @@
1
1
  name: wiki-review
2
- description: Nightly review of the derived LLM wiki overlay (docs/wiki/) — synthesis candidates, anchor validation, drift detection.
2
+ description: Nightly review of the derived LLM wiki overlay (${paths.wiki_dir}/) — synthesis candidates, anchor validation, drift detection.
3
3
  since_version: 2.1.0
4
4
 
5
5
  schedule:
@@ -16,8 +16,8 @@ prompt: |
16
16
  1. Scan ADRs and PRDs from the last 14 days. For each architectural pivot
17
17
  (provider swap, schema change, auth change, API contract, multi-card
18
18
  epic) propose a synthesis page candidate and append it to
19
- `docs/wiki/log.md` with `entry_type: synthesis_candidate`.
20
- 2. Read `docs/wiki/log.md` for RAG queries with verdict=weak|empty
19
+ `${paths.wiki_dir}/log.md` with `entry_type: synthesis_candidate`.
20
+ 2. Read `${paths.wiki_dir}/log.md` for RAG queries with verdict=weak|empty
21
21
  repeated ≥3 times. These are documentation gaps — propose a synthesis.
22
22
  3. Validate anchor slugs across all wiki pages (internal and cross-file).
23
23
  Flag `WIKI_ANCHOR_BROKEN` and fix in-place when possible.
@@ -36,7 +36,7 @@ output:
36
36
 
37
37
  required_artifacts:
38
38
  # Routine is silently skipped if these are missing.
39
- - docs/wiki/
39
+ - ${paths.wiki_dir}/
40
40
  - .claude/agents/wiki-curator.md
41
41
 
42
42
  backend_hints:
@@ -39,6 +39,7 @@ paths:
39
39
  backlog_dir: "" # e.g. backlog
40
40
  adrs_dir: "" # e.g. docs/decisions
41
41
  prd_dir: "" # e.g. docs/prd
42
+ docs_dir: "" # e.g. docs (umbrella docs root; rg-search fallback used by code-reviewer / senior-researcher / worktree-manager)
42
43
  references_dir: "" # e.g. docs/references
43
44
  wiki_dir: "" # e.g. docs/wiki (LLM-wiki overlay)
44
45
 
@@ -4,6 +4,8 @@ base_command_version: 3.8.0
4
4
  mode: extend
5
5
  ---
6
6
 
7
+ <!-- contamination-scan: skip — starter overlay EXAMPLE the user copies and rewrites; ships intentional sample literals (project build names, CTP-NNNN ids, backlog/, src/lib/...) by design. Overlays hold verbatim user opinions and are NOT runtime-resolved against baldart.config.yml. -->
8
+
7
9
  > Copy to `.baldart/overlays/commands/codexreview.md` and adapt freely.
8
10
  > Same merge model as agent overlays: `[OVERRIDE]` / `[APPEND]` / `[PREPEND]`
9
11
  > with H2 heading matching, plus untagged H2 sections appended at the end.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baldart",
3
- "version": "4.0.4",
3
+ "version": "4.1.1",
4
4
  "description": "Claude Agent Framework - Reusable framework for coordinating AI agents and humans in software projects",
5
5
  "bin": {
6
6
  "baldart": "./bin/baldart.js"
@@ -370,6 +370,7 @@ function detect(cwd = process.cwd()) {
370
370
  backlog_dir: exists('backlog') ? 'backlog' : '',
371
371
  adrs_dir: countMatches('docs/decisions', /^ADR-.*\.md$/) > 0 ? 'docs/decisions' : '',
372
372
  prd_dir: exists('docs/prd') ? 'docs/prd' : '',
373
+ docs_dir: exists('docs') ? 'docs' : '',
373
374
  references_dir: exists('docs/references') ? 'docs/references' : '',
374
375
  wiki_dir: exists('docs/wiki') ? 'docs/wiki' : '',
375
376
  e2e_tests_dir: e2eTestsDir,
@@ -640,6 +641,7 @@ async function interactivePrompts(merged, detected) {
640
641
  ['backlog_dir', 'Backlog directory', () => merged.features.has_backlog],
641
642
  ['adrs_dir', 'ADR directory', () => merged.features.has_adrs],
642
643
  ['prd_dir', 'PRD directory', () => merged.features.has_prd_workflow],
644
+ ['docs_dir', 'Docs root directory (rg-search umbrella)', () => true],
643
645
  ['references_dir', 'References docs root', () => true],
644
646
  ['wiki_dir', 'Wiki overlay directory', () => merged.features.has_wiki_overlay],
645
647
  ['e2e_tests_dir', 'E2E tests directory', () => true],
@@ -1172,6 +1172,11 @@ async function update(options = {}, unknownArgs = []) {
1172
1172
  await configureCmd(autoYes ? { nonInteractive: true } : undefined);
1173
1173
  } else {
1174
1174
  UI.info('Skipped. Skills will prompt for the missing keys on first use.');
1175
+ if (allMissing.includes('git.trunk_branch')) {
1176
+ UI.warning('`git.trunk_branch` drives worktree creation in `/prd` and `/new`. '
1177
+ + 'Until it is set, those skills autodetect the trunk (origin/HEAD → develop/main/master) '
1178
+ + 'and warn on each run; run `npx baldart configure` to persist it and make it deterministic.');
1179
+ }
1175
1180
  }
1176
1181
  }
1177
1182
  } catch (_) {