godpowers 1.6.19 → 1.6.21

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/AGENTS.md CHANGED
@@ -37,11 +37,34 @@ projects from raw idea to hardened production.
37
37
  - Every claim must fail the substitution test (swap in a competitor, sentence must break)
38
38
 
39
39
  <!-- pillars:begin -->
40
- ## Godpowers Pillars Protocol
40
+ # Godpowers Project Context
41
41
 
42
- - [DECISION] Load `agents/context.md` and `agents/repo.md` before Godpowers commands make durable project decisions.
43
- - [DECISION] Load additional `agents/*.md` pillar files only when their frontmatter matches the task.
44
- - [DECISION] Treat `.godpowers/state.json`, `.godpowers/PROGRESS.md`, and `.godpowers/CHECKPOINT.md` as workflow state.
45
- - [DECISION] Treat Pillars files as portable project context for any coding agent that opens this repository.
46
- - [DECISION] Disk state wins over conversation memory when these sources disagree.
42
+ This is a Godpowers project. Godpowers uses the Pillars standard as its native project context layer.
43
+ Coding agents read project context from `./agents/*.md` before changing code, while `.godpowers/` remains the Godpowers workflow state and artifact layer.
44
+
45
+ ## At the start of any task
46
+
47
+ 1. Load every pillar whose frontmatter has `always_load: true`.
48
+ 2. Scan remaining pillar frontmatter and select task-relevant primaries from `triggers` and `covers`.
49
+ 3. Add each primary pillar direct `must_read_with` dependencies, depth 1 only.
50
+ 4. Read every pillar body in the computed load set.
51
+ 5. Read `see_also` pillars only when the task explicitly touches that area.
52
+ 6. Follow Rules, apply Workflows, heed Watchouts, and ask before deciding open Gaps.
53
+
54
+ ## Handling missing pillars
55
+
56
+ | State | Action |
57
+ |---|---|
58
+ | `status: present` | Load and comply. |
59
+ | `status: stub` | Treat the concern as acknowledged but undecided. Ask before making domain decisions. |
60
+ | Name in `excluded:` | Treat as intentionally not applicable. |
61
+ | Relevant but absent | Infer from code, state the assumption, and recommend authoring the pillar. |
62
+
63
+ If `context.md` or `repo.md` is missing, pause and create stubs before continuing.
64
+
65
+ ## Excluded pillars
66
+
67
+ ```yaml
68
+ excluded: []
69
+ ```
47
70
  <!-- pillars:end -->
package/CHANGELOG.md CHANGED
@@ -5,6 +5,66 @@ All notable changes to Godpowers will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [1.6.21] - 2026-05-16
11
+
12
+ Dashboard compression, trace guardrails, and suite release readiness.
13
+
14
+ ### Added
15
+ - Added dashboard action briefs so `/god-status`, `/god-next`, and CLI status
16
+ output show the recommended command, reason, readiness, and top blockers
17
+ before the detailed check list.
18
+ - Added release-surface checks that verify dogfood, extension publish, Mode D
19
+ suite, and installer smoke tests remain wired into the release gate.
20
+ - Added repo-surface suite readiness checks for Mode D helper, docs, tests,
21
+ and suite command route coverage.
22
+
23
+ ### Changed
24
+ - Route-quality sync now requires every agent-spawning route to declare both
25
+ `agent.start` and `agent.end` trace events.
26
+ - `/god-init`, `/god-roadmap-update`, and `/god-sync` route metadata now
27
+ declare the missing `agent.start` trace event.
28
+
29
+ ### Guardrails
30
+ - Spawn observability, release dogfooding, extension readiness, suite
31
+ readiness, and onboarding compression are now checked by executable tests
32
+ instead of remaining documentation-only goals.
33
+
34
+ ## [1.6.20] - 2026-05-16
35
+
36
+ Automation surface closeout and release guardrails.
37
+
38
+ ### Added
39
+ - Added `lib/route-quality-sync.js` to detect symbolic route spawns,
40
+ unresolved agent targets, and unapproved contextual route exits.
41
+ - Added `lib/recipe-coverage-sync.js` to detect missing high-frequency intent
42
+ recipes for release maintenance, docs drift, context refresh, story work, and
43
+ automation setup.
44
+ - Added `lib/release-surface-sync.js` to detect release-facing drift across
45
+ badges, changelog, release notes, package guards, release checklist policy,
46
+ and package lock version.
47
+ - Added recipe routes for release maintenance, context refresh, story work, and
48
+ automation setup.
49
+
50
+ ### Changed
51
+ - `/god-party` routing now uses `built-in` as the primary owner and declares
52
+ selectable specialist personas under `parallel-spawns`.
53
+ - `/god-story-build` routing now uses `god-planner` as primary and declares
54
+ executor plus reviewer agents as secondary spawns.
55
+ - `lib/router.js` now includes conditional `parallel-spawns` in spawned-agent
56
+ resolution.
57
+ - Repo surface sync now includes route-quality, recipe-coverage, and
58
+ release-surface checks.
59
+
60
+ ### Guardrails
61
+ - Route quality checks now block symbolic spawn tokens, unresolved specialist
62
+ targets, unapproved contextual exits, and durable-writing routes without
63
+ standards coverage.
64
+ - Release surface checks now require package, lockfile, README badge,
65
+ changelog, release notes, release checklist, and package payload guards to
66
+ agree before publish.
67
+
8
68
  ## [1.6.19] - 2026-05-16
9
69
 
10
70
  Repository surface sync and status truth closeout.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/aihxp/godpowers/actions/workflows/ci.yml/badge.svg)](https://github.com/aihxp/godpowers/actions/workflows/ci.yml)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
- [![Version](https://img.shields.io/badge/version-1.6.19-blue)](CHANGELOG.md)
5
+ [![Version](https://img.shields.io/badge/version-1.6.21-blue)](CHANGELOG.md)
6
6
  [![npm](https://img.shields.io/npm/v/godpowers.svg)](https://www.npmjs.com/package/godpowers)
7
7
 
8
8
  **Ship fast. Ship right. Ship everything. Ship accountably.**
@@ -12,11 +12,14 @@ idea to hardened production. It runs as **slash commands inside your AI coding
12
12
  tool** (Claude Code, Codex, Cursor, etc.) that orchestrate **specialist agents**
13
13
  in fresh contexts to do the work.
14
14
 
15
- Version 1.6.19 sharpens Godpowers status truth and adds repository surface
16
- sync. Dashboards now name whether they came from `lib/dashboard.js` or a manual
17
- fallback, and Godpowers checks routing gaps, package payload drift, agent
18
- handoff drift, workflow metadata drift, recipe route drift, extension pack
19
- drift, and release-policy drift before closeout.
15
+ Version 1.6.21 sharpens the daily operating loop. Godpowers now shows a compact
16
+ action brief in dashboard output, enforces trace events for every
17
+ agent-spawning route, and keeps dogfood, extension publish, Mode D suite, and
18
+ installer smoke gates wired into release readiness.
19
+
20
+ The dashboard now starts with an action brief: the next command, why it is
21
+ recommended, whether the project is ready, and the first blockers that need
22
+ attention. Detailed proactive checks remain below the brief for auditability.
20
23
 
21
24
  It fuses four disciplines into one unified workflow:
22
25
 
@@ -107,8 +110,8 @@ You can also ask any time:
107
110
  ```
108
111
 
109
112
  This reads `.godpowers/PROGRESS.md`, scans disk, reconciles any drift, and
110
- suggests the next logical command. The SessionStart hook does the same thing
111
- when you open a new session in a Godpowers project.
113
+ suggests the next logical command with a compact action brief. The SessionStart
114
+ hook does the same thing when you open a new session in a Godpowers project.
112
115
 
113
116
  The same status engine is available from the installer CLI for humans, CI,
114
117
  Codex, Claude, Cursor, Gemini, OpenCode, Windsurf, Antigravity, and any host
package/RELEASE.md CHANGED
@@ -1,19 +1,18 @@
1
- # Godpowers 1.6.19 Release
1
+ # Godpowers 1.6.21 Release
2
2
 
3
3
  Date: 2026-05-16
4
4
 
5
- Godpowers 1.6.19 adds repository surface sync and clarifies status truth across
6
- `/god-status`, `/god-next`, God Mode closeouts, and installer CLI status
7
- helpers. Godpowers can now detect structural drift across routes, package
8
- payload rules, agent handoffs, workflow metadata, recipe routes, extension
9
- packs, and release policy before declaring a project run current.
5
+ Godpowers 1.6.21 sharpens the daily operating loop after the automation
6
+ surface closeout. It adds dashboard action briefs, requires agent-spawning
7
+ routes to declare trace events, and expands release readiness checks across
8
+ dogfood, extension publish, Mode D suite, and installer smoke gates.
10
9
 
11
10
  ## What is stable
12
11
 
13
12
  - 109 slash commands
14
13
  - 40 specialist agents
15
14
  - 13 executable workflows
16
- - 36 intent recipes
15
+ - 40 intent recipes
17
16
  - 15-runtime installer
18
17
  - Codex installs with generated `god-*.toml` agent metadata files
19
18
  - Markdown specialist agent contracts at `<runtime>/agents/god-*.md`
@@ -27,35 +26,42 @@ packs, and release policy before declaring a project run current.
27
26
  - Feature awareness for existing Godpowers projects
28
27
  - Repository documentation sync checks
29
28
  - Repository surface sync checks
29
+ - Route quality, recipe coverage, and release surface sync checks
30
+ - Dashboard action briefs for next-step compression
31
+ - Agent-spawn trace event guardrails
32
+ - Mode D suite readiness checks
30
33
 
31
34
  ## What is new
32
35
 
33
- - Added `lib/repo-surface-sync.js`.
34
- - Added `docs/repo-surface-sync.md`.
35
- - Added `scripts/test-repo-surface-sync.js`.
36
- - `/god-sync`, `/god-docs`, `/god-doctor`, `/god-status`, and `/god-mode` now
37
- document repo surface sync integration.
38
- - Dashboard proactive checks now include a repo surface status line.
39
- - Package contents checks now require `lib/repo-surface-sync.js`.
40
- - Feature awareness now records `repo-surface-sync` as a known runtime feature.
41
- - Dashboard output keeps workflow progress distinct from audit, hygiene,
42
- remediation, and launch-readiness scores.
36
+ - Added `Action brief` output to `lib/dashboard.js` and CLI status rendering.
37
+ - Added route-quality enforcement for `agent.start` and `agent.end` trace
38
+ event declarations on agent-spawning routes.
39
+ - Added repo-surface Mode D suite readiness checks for suite helper presence,
40
+ suite command skill and routing coverage, roadmap documentation, and release
41
+ test wiring.
42
+ - Added release-surface checks for dogfood, extension publish, Mode D suite,
43
+ and installer smoke tests.
44
+ - Updated `/god-init`, `/god-roadmap-update`, and `/god-sync` route metadata
45
+ to declare `agent.start`.
43
46
 
44
- ## Surface sync behavior
47
+ ## Automation surface behavior
45
48
 
46
49
  For a Godpowers repository, the helper checks:
47
50
 
48
- - every `skills/god-*.md` command has matching `routing/god-*.yaml` metadata
49
- - required package payload entries exist in `package.json`
51
+ - every routed specialist spawn resolves to a real agent or built-in runtime
52
+ owner
53
+ - every agent-spawning route declares `agent.start` and `agent.end`
54
+ - every durable-writing route declares standards coverage or an approved
55
+ exemption
56
+ - high-frequency work has discoverable intent recipes
57
+ - release-facing version surfaces agree with `package.json`
50
58
  - package content checks require load-bearing runtime helper files
51
- - routed specialist spawns resolve to real agent files
52
- - workflows have parseable metadata
53
- - recipes contain slash-command routes
54
- - extension manifests, package metadata, peer dependencies, and provided files agree
55
- - release docs and release policy checks name repo documentation and repo surface sync
59
+ - release checklist policy names the current sync guards
60
+ - release gates include dogfood, extension publish, Mode D suite, and installer
61
+ smoke checks
56
62
 
57
- Detection is read-only by default. Applying sync only writes a log and may
58
- create missing routing stubs when `fixRouting` is explicitly enabled.
63
+ Detection is read-only by default. Applying sync writes logs and leaves
64
+ judgment-heavy rewrites to scoped specialists.
59
65
 
60
66
  ## Auto-invoke and auto-spawn policy
61
67
 
@@ -77,9 +83,13 @@ Godpowers recommends scoped specialists only when judgment is needed:
77
83
  Release validation includes:
78
84
 
79
85
  - `node scripts/test-repo-surface-sync.js`
86
+ - `node scripts/test-automation-surface-sync.js`
80
87
  - `node scripts/test-repo-doc-sync.js`
81
88
  - `node scripts/test-feature-awareness.js`
82
89
  - `node scripts/test-dashboard.js`
90
+ - `node scripts/test-mode-d.js`
91
+ - `node scripts/test-extensions-publish.js`
92
+ - `node scripts/test-install-smoke.js`
83
93
  - `node scripts/test-context-writer.js`
84
94
  - `node scripts/test-planning-systems.js`
85
95
  - `node scripts/test-doc-surface-counts.js`
@@ -87,5 +97,5 @@ Release validation includes:
87
97
  - `git diff --check`
88
98
  - `npm run release:check`
89
99
 
90
- The `v1.6.19` tag should point to the release commit that matches the npm
91
- `godpowers@1.6.19` package.
100
+ The `v1.6.21` tag should point to the release commit that matches the npm
101
+ `godpowers@1.6.21` package.
package/SKILL.md CHANGED
@@ -215,7 +215,7 @@ Auto-invoked:
215
215
  Trigger: <what caused this automatic step>
216
216
  Agent: <god-updater | god-context-writer | none, local runtime only>
217
217
  Local syncs:
218
- + <feature-awareness | planning-system-import | reverse-sync | source-sync | repo-doc-sync | repo-surface-sync | pillars-sync | checkpoint-sync | context-refresh>: <result or skipped reason>
218
+ + <feature-awareness | planning-system-import | reverse-sync | source-sync | repo-doc-sync | repo-surface-sync | route-quality-sync | recipe-coverage-sync | release-surface-sync | pillars-sync | checkpoint-sync | context-refresh>: <result or skipped reason>
219
219
  Artifacts: <changed files, no-op, or deferred>
220
220
  Log: <SYNC-LOG.md, CHECKPOINT.md, REVIEW-REQUIRED.md, or none>
221
221
  ```
@@ -247,6 +247,9 @@ Automatic steps that especially need visible reporting:
247
247
  `/god-status`, or `/god-mode`
248
248
  - repo surface sync during `/god-sync`, `/god-docs`, `/god-doctor`,
249
249
  `/god-status`, or `/god-mode`
250
+ - route-quality sync, recipe-coverage sync, and release-surface sync through
251
+ repo-surface sync during `/god-sync`, `/god-docs`, `/god-doctor`,
252
+ `/god-status`, or `/god-mode`
250
253
 
251
254
  ### 13. Proactive Auto-Invoke Policy
252
255
  Godpowers should be proactive from disk evidence, not from guesswork. Before
@@ -291,6 +294,9 @@ Run these local runtime helpers automatically when their trigger is present:
291
294
  `lib/repo-surface-sync.run` during `/god-sync`, `/god-docs`, or
292
295
  `/god-mode` when command routing, package payload, agent handoffs, workflow
293
296
  metadata, recipe routes, extension packs, or release policy may have drifted.
297
+ - `lib/route-quality-sync.detect`, `lib/recipe-coverage-sync.detect`, and
298
+ `lib/release-surface-sync.detect` through repo-surface sync when route
299
+ spawns, high-frequency recipes, or release-facing surfaces may have drifted.
294
300
  - Context refresh dry-run after `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`,
295
301
  `.cursor/rules/`, `.windsurfrules`, `.github/copilot-instructions.md`,
296
302
  `.clinerules`, `.roo/`, or `.continue/` changes.
package/lib/README.md CHANGED
@@ -15,6 +15,9 @@ package-level integrations.
15
15
  | `feature-awareness.js` | Detect and refresh existing-project awareness after runtime upgrades. |
16
16
  | `repo-doc-sync.js` | Detect and refresh mechanical repository documentation surfaces. |
17
17
  | `repo-surface-sync.js` | Detect structural drift across commands, routes, packages, agents, workflows, recipes, extensions, and release policy. |
18
+ | `route-quality-sync.js` | Detect symbolic route spawns, unresolved agent targets, and unapproved contextual route exits. |
19
+ | `recipe-coverage-sync.js` | Detect missing high-frequency intent recipe coverage. |
20
+ | `release-surface-sync.js` | Detect release-facing drift across badges, release notes, changelog, package checks, and release checklist policy. |
18
21
  | `budget.js` | Read and enforce configured budget controls. |
19
22
  | `cost-tracker.js` | Track token and cost estimates from event streams. |
20
23
 
package/lib/dashboard.js CHANGED
@@ -217,7 +217,7 @@ function compute(projectRoot, opts = {}) {
217
217
 
218
218
  if (!s) {
219
219
  const next = { command: '/god-init', reason: 'No Godpowers project initialized' };
220
- return {
220
+ const result = {
221
221
  source: 'runtime dashboard (lib/dashboard.js)',
222
222
  state: 'not initialized',
223
223
  mode: null,
@@ -237,6 +237,8 @@ function compute(projectRoot, opts = {}) {
237
237
  next,
238
238
  openItems: ['No .godpowers/state.json found']
239
239
  };
240
+ result.actionBrief = actionBrief(result);
241
+ return result;
240
242
  }
241
243
 
242
244
  const progress = state.progressSummary(s);
@@ -250,7 +252,7 @@ function compute(projectRoot, opts = {}) {
250
252
  if (reviewCount(projectRoot) > 0) openItems.push('pending review items');
251
253
  if (openItems.length === 0) openItems.push('none');
252
254
 
253
- return {
255
+ const result = {
254
256
  source: 'runtime dashboard (lib/dashboard.js)',
255
257
  state: progress.remaining === 0 ? 'complete' : 'in progress',
256
258
  mode: s.mode || s['mode-announced-as'] || null,
@@ -264,6 +266,37 @@ function compute(projectRoot, opts = {}) {
264
266
  next,
265
267
  openItems
266
268
  };
269
+ result.actionBrief = actionBrief(result);
270
+ return result;
271
+ }
272
+
273
+ function actionBrief(dashboard) {
274
+ const proactive = dashboard.proactive || {};
275
+ const next = dashboard.next || {};
276
+ const blockers = [];
277
+ for (const [label, value] of [
278
+ ['Repo surface', proactive.repoSurface],
279
+ ['Docs', proactive.docs],
280
+ ['Reviews', proactive.reviews],
281
+ ['Sync', proactive.sync],
282
+ ['Security', proactive.security],
283
+ ['Dependencies', proactive.dependencies],
284
+ ['Hygiene', proactive.hygiene]
285
+ ]) {
286
+ if (!value) continue;
287
+ if (value === 'fresh' || value === 'none' || value === 'clear' || value === 'not-applicable') continue;
288
+ if (/^available via /.test(value)) continue;
289
+ blockers.push(`${label}: ${value}`);
290
+ }
291
+
292
+ const recommended = next.command || 'describe the next intent';
293
+ return {
294
+ recommended,
295
+ reason: next.reason || 'No route was computed.',
296
+ confidence: blockers.length === 0 ? 'ready' : 'needs attention',
297
+ blockers: blockers.slice(0, 3),
298
+ overflow: Math.max(0, blockers.length - 3)
299
+ };
267
300
  }
268
301
 
269
302
  function render(dashboard) {
@@ -277,6 +310,7 @@ function render(dashboard) {
277
310
  const openItems = dashboard.openItems && dashboard.openItems.length > 0
278
311
  ? dashboard.openItems
279
312
  : ['none'];
313
+ const brief = dashboard.actionBrief || actionBrief(dashboard);
280
314
 
281
315
  return [
282
316
  'Godpowers Dashboard',
@@ -291,6 +325,12 @@ function render(dashboard) {
291
325
  ` Worktree: ${dashboard.worktree}`,
292
326
  ` Index: ${dashboard.index}`,
293
327
  '',
328
+ 'Action brief:',
329
+ ` Next: ${brief.recommended}`,
330
+ ` Why: ${brief.reason}`,
331
+ ` Readiness: ${brief.confidence}`,
332
+ ` Attention: ${brief.blockers && brief.blockers.length > 0 ? brief.blockers.join('; ') : 'none'}${brief.overflow ? `; ${brief.overflow} more` : ''}`,
333
+ '',
294
334
  'Planning visibility:',
295
335
  ` PRD: ${prd.status || 'missing'}${prd.path ? ` ${prd.path}` : ''}`,
296
336
  ` Roadmap: ${roadmap.status || 'missing'}${roadmap.path ? ` ${roadmap.path}` : ''}`,
@@ -325,5 +365,6 @@ module.exports = {
325
365
  parseGitStatus,
326
366
  proactiveChecks,
327
367
  automationSummary,
368
+ actionBrief,
328
369
  planningVisibility
329
370
  };
@@ -46,6 +46,24 @@ const FEATURES = [
46
46
  since: '1.6.19',
47
47
  commands: ['/god-sync', '/god-docs', '/god-doctor', '/god-status', '/god-mode'],
48
48
  description: 'Detect structural drift across routing, packages, agents, workflows, recipes, extensions, and release policy.'
49
+ },
50
+ {
51
+ id: 'route-quality-sync',
52
+ since: '1.6.19',
53
+ commands: ['/god-sync', '/god-doctor', '/god-status', '/god-mode'],
54
+ description: 'Detect symbolic route spawns, unresolved agent targets, and unapproved contextual route exits.'
55
+ },
56
+ {
57
+ id: 'recipe-coverage-sync',
58
+ since: '1.6.19',
59
+ commands: ['/god-sync', '/god-doctor', '/god-status', '/god-mode'],
60
+ description: 'Detect missing intent recipes for release, docs, context refresh, story work, and automation setup.'
61
+ },
62
+ {
63
+ id: 'release-surface-sync',
64
+ since: '1.6.19',
65
+ commands: ['/god-sync', '/god-docs', '/god-doctor', '/god-status', '/god-mode'],
66
+ description: 'Detect release-facing drift across badges, release notes, changelog, package checks, and release checklist policy.'
49
67
  }
50
68
  ];
51
69
 
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Recipe coverage sync.
3
+ *
4
+ * Keeps fuzzy user intent connected to shipped command routes for the
5
+ * high-frequency areas that users naturally ask for in prose.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+
11
+ const recipes = require('./recipes');
12
+
13
+ const LOG_PATH = '.godpowers/surface/RECIPE-COVERAGE-SYNC.md';
14
+
15
+ const REQUIRED_COVERAGE = [
16
+ {
17
+ id: 'release-maintenance',
18
+ description: 'release maintenance',
19
+ commands: ['/god-sync', '/god-docs', '/god-version']
20
+ },
21
+ {
22
+ id: 'docs-drift',
23
+ description: 'documentation drift',
24
+ commands: ['/god-docs']
25
+ },
26
+ {
27
+ id: 'context-refresh',
28
+ description: 'context refresh and feature awareness',
29
+ commands: ['/god-context', '/god-sync', '/god-status']
30
+ },
31
+ {
32
+ id: 'story-work',
33
+ description: 'story creation, build, verify, and close',
34
+ commands: ['/god-story', '/god-story-build', '/god-story-verify', '/god-story-close']
35
+ },
36
+ {
37
+ id: 'automation-setup',
38
+ description: 'automation setup and status',
39
+ commands: ['/god-automation-setup', '/god-automation-status']
40
+ }
41
+ ];
42
+
43
+ function read(projectRoot, relPath) {
44
+ const file = path.join(projectRoot, relPath);
45
+ if (!fs.existsSync(file)) return '';
46
+ return fs.readFileSync(file, 'utf8');
47
+ }
48
+
49
+ function write(projectRoot, relPath, content) {
50
+ const file = path.join(projectRoot, relPath);
51
+ fs.mkdirSync(path.dirname(file), { recursive: true });
52
+ fs.writeFileSync(file, content);
53
+ }
54
+
55
+ function addCheck(checks, id, status, relPath, message, opts = {}) {
56
+ checks.push({
57
+ area: 'recipe-coverage',
58
+ id,
59
+ status,
60
+ path: relPath,
61
+ message,
62
+ severity: opts.severity || (status === 'fresh' ? 'info' : 'warning'),
63
+ spawn: opts.spawn || null
64
+ });
65
+ }
66
+
67
+ function recipePath(projectRoot, name) {
68
+ const rel = `routing/recipes/${name}.yaml`;
69
+ return fs.existsSync(path.join(projectRoot, rel)) ? rel : 'routing/recipes/';
70
+ }
71
+
72
+ function detect(projectRoot) {
73
+ recipes.clearCache();
74
+ const checks = [];
75
+ const all = recipes.loadAll();
76
+ const recipeTexts = new Map();
77
+ for (const recipe of all) {
78
+ const name = recipe.metadata && recipe.metadata.name;
79
+ if (!name) continue;
80
+ recipeTexts.set(name, read(projectRoot, `routing/recipes/${name}.yaml`));
81
+ }
82
+
83
+ for (const required of REQUIRED_COVERAGE) {
84
+ const matched = [...recipeTexts.entries()].filter(([, text]) =>
85
+ required.commands.every((command) => text.includes(command))
86
+ );
87
+ addCheck(
88
+ checks,
89
+ `coverage-${required.id}`,
90
+ matched.length > 0 ? 'fresh' : 'stale',
91
+ matched.length > 0 ? `routing/recipes/${matched[0][0]}.yaml` : recipePath(projectRoot, required.id),
92
+ matched.length > 0
93
+ ? `Recipe coverage exists for ${required.description}.`
94
+ : `No recipe covers ${required.description} with ${required.commands.join(', ')}.`,
95
+ { spawn: matched.length > 0 ? null : 'god-roadmap-reconciler' }
96
+ );
97
+ }
98
+
99
+ const stale = checks.filter((check) => check.status !== 'fresh');
100
+ return {
101
+ status: stale.length === 0 ? 'fresh' : 'stale',
102
+ checks,
103
+ stale
104
+ };
105
+ }
106
+
107
+ function appendLog(projectRoot, before, after) {
108
+ const now = new Date().toISOString();
109
+ const lines = [];
110
+ if (fs.existsSync(path.join(projectRoot, LOG_PATH))) {
111
+ lines.push(read(projectRoot, LOG_PATH).replace(/\s*$/, ''));
112
+ lines.push('');
113
+ } else {
114
+ lines.push('# Recipe Coverage Sync Log');
115
+ lines.push('');
116
+ lines.push('- [DECISION] This file records recipe-coverage sync checks run by Godpowers.');
117
+ lines.push('');
118
+ }
119
+ lines.push(`## ${now}`);
120
+ lines.push('');
121
+ lines.push(`- [DECISION] Recipe coverage status before apply was ${before.status}.`);
122
+ lines.push(`- [DECISION] Recipe coverage status after apply is ${after.status}.`);
123
+ lines.push('');
124
+ write(projectRoot, LOG_PATH, lines.join('\n'));
125
+ }
126
+
127
+ function run(projectRoot, opts = {}) {
128
+ const before = detect(projectRoot);
129
+ const after = detect(projectRoot);
130
+ if (opts.log !== false) appendLog(projectRoot, before, after);
131
+ return {
132
+ before,
133
+ after,
134
+ applied: [],
135
+ logPath: opts.log === false ? null : LOG_PATH
136
+ };
137
+ }
138
+
139
+ function summary(report) {
140
+ return report.status === 'fresh' ? 'fresh' : `${report.stale.length} stale`;
141
+ }
142
+
143
+ module.exports = {
144
+ LOG_PATH,
145
+ REQUIRED_COVERAGE,
146
+ detect,
147
+ run,
148
+ summary
149
+ };