codex-genesis-harness 0.1.6 → 0.1.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 (136) hide show
  1. package/.codebase/COMPRESSED_CONTEXT.md +80 -0
  2. package/.codebase/CURRENT_STATE.md +35 -8
  3. package/.codebase/DEPENDENCY_GRAPH.md +14 -1
  4. package/.codebase/IMPLEMENTATION_HANDOFF.md +34 -336
  5. package/.codebase/KNOWN_PROBLEMS.md +54 -3
  6. package/.codebase/MODULE_INDEX.md +8 -0
  7. package/.codebase/PIPELINE_FLOW.md +7 -5
  8. package/.codebase/RECOVERY_POINTS.md +15 -431
  9. package/.codebase/TECH_DEBT.md +6 -0
  10. package/.codebase/TEST_MATRIX.md +4 -3
  11. package/.codebase/VISUAL_GRAPH.md +127 -0
  12. package/.codebase/beads.json +16 -0
  13. package/.codebase/context-policy.json +68 -0
  14. package/.codebase/memories/lessons_learned.md +21 -0
  15. package/.codebase/memories/preferences.md +17 -0
  16. package/.codebase/state.json +45 -24
  17. package/.codex/skills/genesis-ai-provider/SKILL.md +1 -1
  18. package/.codex/skills/genesis-api-contract/SKILL.md +1 -1
  19. package/.codex/skills/genesis-api-sync/SKILL.md +1 -1
  20. package/.codex/skills/genesis-architecture/SKILL.md +6 -1
  21. package/.codex/skills/genesis-codebase-map/SKILL.md +1 -1
  22. package/.codex/skills/genesis-debug-guide/SKILL.md +11 -5
  23. package/.codex/skills/genesis-design-spec/SKILL.md +3 -3
  24. package/.codex/skills/genesis-docs-automation/SKILL.md +52 -973
  25. package/.codex/skills/genesis-executing-plans/SKILL.md +54 -0
  26. package/.codex/skills/genesis-executing-plans/agents/openai.yaml +6 -0
  27. package/.codex/skills/genesis-executing-plans/checklists/.gitkeep +0 -0
  28. package/.codex/skills/genesis-executing-plans/examples/.gitkeep +0 -0
  29. package/.codex/skills/genesis-executing-plans/templates/.gitkeep +0 -0
  30. package/.codex/skills/genesis-harness/SKILL.md +64 -1384
  31. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +3 -3
  32. package/.codex/skills/genesis-harness/scripts/init-planning.sh +1 -1
  33. package/.codex/skills/genesis-harness-engineering/SKILL.md +1 -1
  34. package/.codex/skills/genesis-new-design/SKILL.md +6 -2
  35. package/.codex/skills/genesis-new-design/agents/openai.yaml +2 -0
  36. package/.codex/skills/genesis-observability-automation/SKILL.md +69 -303
  37. package/.codex/skills/genesis-observability-automation/references/common-mistakes-and-recovery.md +84 -0
  38. package/.codex/skills/genesis-observability-automation/references/workflow-phases.md +78 -0
  39. package/.codex/skills/genesis-performance-profiling/SKILL.md +1 -22
  40. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +1 -1
  41. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +1 -1
  42. package/.codex/skills/genesis-planning/SKILL.md +31 -1
  43. package/.codex/skills/genesis-release/SKILL.md +29 -1
  44. package/.codex/skills/genesis-research-first/SKILL.md +6 -0
  45. package/.codex/skills/genesis-spec-propagation/SKILL.md +52 -504
  46. package/.codex/skills/genesis-test-driven-development/SKILL.md +55 -0
  47. package/.codex/skills/genesis-test-driven-development/agents/openai.yaml +6 -0
  48. package/.codex/skills/genesis-test-driven-development/checklists/.gitkeep +0 -0
  49. package/.codex/skills/genesis-test-driven-development/examples/.gitkeep +0 -0
  50. package/.codex/skills/genesis-test-driven-development/templates/.gitkeep +0 -0
  51. package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/SKILL.md +1 -1
  52. package/.codex/skills/genesis-upgrade-design/SKILL.md +4 -2
  53. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +2 -0
  54. package/.codex/skills/genesis-using-git-worktrees/SKILL.md +54 -0
  55. package/.codex/skills/genesis-using-git-worktrees/agents/openai.yaml +6 -0
  56. package/.codex/skills/genesis-using-git-worktrees/checklists/.gitkeep +0 -0
  57. package/.codex/skills/genesis-using-git-worktrees/examples/.gitkeep +0 -0
  58. package/.codex/skills/genesis-using-git-worktrees/templates/.gitkeep +0 -0
  59. package/.codex/skills/genesis-verification-before-completion/SKILL.md +53 -0
  60. package/.codex/skills/genesis-verification-before-completion/agents/openai.yaml +6 -0
  61. package/.codex/skills/genesis-verification-before-completion/checklists/.gitkeep +0 -0
  62. package/.codex/skills/genesis-verification-before-completion/examples/.gitkeep +0 -0
  63. package/.codex/skills/genesis-verification-before-completion/templates/.gitkeep +0 -0
  64. package/.codex/skills/spec-impact-engine/SKILL.md +77 -500
  65. package/.codex/skills/spec-impact-engine/checklists/checklist.md +10 -0
  66. package/.codex-plugin/plugin.json +3 -4
  67. package/CHANGELOG.md +17 -0
  68. package/README.EN.md +33 -22
  69. package/README.VI.md +36 -24
  70. package/README.md +46 -8
  71. package/VERSION +1 -1
  72. package/bin/genesis-harness.js +1337 -7
  73. package/contracts/features/registry-schema.json +15 -0
  74. package/contracts/observability/agent-run-schema.json +34 -0
  75. package/contracts/observability/failure-schema.json +35 -0
  76. package/contracts/ui/auth/login-screen-contract.json +43 -0
  77. package/features/REGISTRY.md +63 -0
  78. package/features/SCOPE-template.md +65 -0
  79. package/fixtures/planning/MOCKUP_PROMPT_TEMPLATE.md +16 -0
  80. package/observability/agent-runs/sample-run.json +13 -0
  81. package/observability/decision-logs/sample-decision.md +43 -0
  82. package/observability/failures/sample-failure.json +12 -0
  83. package/package.json +9 -3
  84. package/playwright/e2e/app-template.spec.js +37 -0
  85. package/playwright/e2e/auth/login-screen.spec.js +65 -0
  86. package/playwright/e2e/web-template.spec.js +28 -0
  87. package/scripts/check-scope.sh +100 -0
  88. package/scripts/cold-start-check.js +133 -0
  89. package/scripts/install.sh +6 -6
  90. package/scripts/prompt_sentinel.js +35 -4
  91. package/scripts/run-evals.sh +137 -26
  92. package/scripts/scratch_parser.js +49 -0
  93. package/scripts/spec_visual_sync.js +1 -1
  94. package/scripts/test_generator.js +2 -2
  95. package/scripts/uninstall.sh +6 -6
  96. package/scripts/verify.sh +21 -66
  97. package/tests/integration/cli-smoke.test.js +103 -0
  98. package/tests/unit/feature_registry.test.js +152 -0
  99. package/tests/unit/prompt_sentinel.test.js +1 -1
  100. package/tests/unit/spec_visual_sync.test.js +1 -1
  101. package/tests/unit/test_generator.test.js +1 -1
  102. package/.codex/skills/genesis-docs/SKILL.md +0 -46
  103. package/.codex/skills/genesis-docs/agents/openai.yaml +0 -7
  104. package/.codex/skills/genesis-mvp-planning/SKILL.md +0 -114
  105. package/.codex/skills/genesis-mvp-planning/agents/openai.yaml +0 -6
  106. package/.codex/skills/genesis-release-orchestration/SKILL.md +0 -653
  107. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +0 -7
  108. package/.codex/skills/genesis-research/SKILL.md +0 -46
  109. package/.codex/skills/genesis-research/agents/openai.yaml +0 -7
  110. package/playwright/e2e/e2e-template.md +0 -4
  111. /package/.codex/skills/{genesis-docs/checklists/checklist.md → genesis-docs-automation/checklists/manual-docs-checklist.md} +0 -0
  112. /package/.codex/skills/{genesis-docs/examples/example.md → genesis-docs-automation/examples/manual-docs-example.md} +0 -0
  113. /package/.codex/skills/{genesis-docs → genesis-docs-automation}/templates/docs-update-template.md +0 -0
  114. /package/.codex/skills/{genesis-state-machine/SKILL.md → genesis-harness/references/state-machine.md} +0 -0
  115. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/checklists/mvp-readiness.md +0 -0
  116. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/examples/5-phase-roadmap-example.md +0 -0
  117. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/templates/phase-1-core.md +0 -0
  118. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/templates/phase-2-auth.md +0 -0
  119. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/templates/phase-3-features.md +0 -0
  120. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/templates/phase-4-integrations.md +0 -0
  121. /package/.codex/skills/{genesis-mvp-planning → genesis-planning}/templates/phase-5-readiness.md +0 -0
  122. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/post-deployment-verification.md +0 -0
  123. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/pre-release-validation.md +0 -0
  124. /package/.codex/skills/{genesis-release-orchestration/examples/example.md → genesis-release/examples/orchestration-example.md} +0 -0
  125. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/observability/release-tracking.md +0 -0
  126. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/canary-deployment-orchestration.md +0 -0
  127. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/semantic-versioning-automation.md +0 -0
  128. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/deployment-strategy-template.md +0 -0
  129. /package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/release-runbook-template.md +0 -0
  130. /package/.codex/skills/{genesis-research → genesis-research-first}/checklists/checklist.md +0 -0
  131. /package/.codex/skills/{genesis-research/examples/example.md → genesis-research-first/examples/manual-research-example.md} +0 -0
  132. /package/.codex/skills/{genesis-research → genesis-research-first}/templates/research-note-template.md +0 -0
  133. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/agents/openai.yaml +0 -0
  134. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/checklists/checklist.md +0 -0
  135. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/examples/example.md +0 -0
  136. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/templates/playwright-test-template.md +0 -0
package/scripts/verify.sh CHANGED
@@ -9,26 +9,26 @@ skill_names=(
9
9
  genesis-upgrade-design
10
10
  genesis-architecture
11
11
  genesis-planning
12
- genesis-mvp-planning
13
12
  genesis-codebase-map
14
13
  genesis-design-spec
15
14
  genesis-api-contract
16
- ui-ux-test-skill
15
+ genesis-ui-ux-test
17
16
  genesis-harness-engineering
18
17
  genesis-ai-provider
19
18
  genesis-pipeline-orchestration
20
- genesis-research
21
- genesis-docs
22
- genesis-release
23
19
  genesis-api-sync
24
20
  genesis-debug-guide
25
21
  genesis-docs-automation
26
22
  genesis-spec-propagation
27
- genesis-release-orchestration
28
23
  genesis-performance-profiling
29
24
  genesis-observability-automation
30
25
  genesis-research-first
26
+ genesis-release
31
27
  spec-impact-engine
28
+ genesis-executing-plans
29
+ genesis-test-driven-development
30
+ genesis-verification-before-completion
31
+ genesis-using-git-worktrees
32
32
  )
33
33
 
34
34
  required_memory_files=(
@@ -121,7 +121,14 @@ required_scripts=(
121
121
  run-verify-loop.sh
122
122
  )
123
123
 
124
+ max_skill_lines=500
125
+
124
126
  fail() {
127
+ if [ "${VIBE_MODE:-0}" = "1" ]; then
128
+ echo "verify WARN (VIBE_MODE): $*" >&2
129
+ echo "- [$(date -u +"%Y-%m-%dT%H:%M:%SZ")] VIBE_MODE Bypass: Verify check failed - $*" >> "$repo_root/.codebase/TECH_DEBT.md"
130
+ return 0
131
+ fi
125
132
  echo "verify failed: $*" >&2
126
133
  exit 1
127
134
  }
@@ -176,9 +183,12 @@ verify_repository_harness
176
183
  verify_skill_metadata() {
177
184
  local skill_dir="$1"
178
185
  local expected_name="$2"
186
+ local skill_lines
179
187
 
180
188
  [ -f "$skill_dir/SKILL.md" ] || fail "missing SKILL.md: $skill_dir"
181
189
  [ -f "$skill_dir/agents/openai.yaml" ] || fail "missing agents/openai.yaml: $skill_dir"
190
+ skill_lines="$(wc -l < "$skill_dir/SKILL.md" | tr -d ' ')"
191
+ [ "$skill_lines" -le "$max_skill_lines" ] || fail "SKILL.md exceeds ${max_skill_lines} lines ($skill_lines): $skill_dir"
182
192
  grep -q "^name: $expected_name[[:space:]]*$" "$skill_dir/SKILL.md" || fail "invalid skill name frontmatter (expected 'name: $expected_name'): $skill_dir"
183
193
  grep -q '^description:' "$skill_dir/SKILL.md" || fail "missing description frontmatter: $skill_dir"
184
194
  grep -q 'default_prompt:' "$skill_dir/agents/openai.yaml" || fail "missing default_prompt: $skill_dir"
@@ -195,7 +205,7 @@ verify_harness_skill() {
195
205
  grep -q 'Definition Of Done' "$skill_dir/SKILL.md" || fail "missing Definition Of Done"
196
206
  grep -q 'Quality Rubric' "$skill_dir/SKILL.md" || fail "missing Quality Rubric"
197
207
 
198
- for ref in workflows.md planning-schema.md research-rubric.md quality-rubric.md; do
208
+ for ref in workflows.md planning-schema.md research-rubric.md quality-rubric.md state-machine.md; do
199
209
  [ -f "$skill_dir/references/$ref" ] || fail "missing reference: $ref"
200
210
  grep -q "references/$ref" "$skill_dir/SKILL.md" || fail "SKILL.md does not mention reference: $ref"
201
211
  done
@@ -250,6 +260,7 @@ verify_minimal_skill() {
250
260
  local skill_dir="$1"
251
261
 
252
262
  [ -d "$skill_dir/templates" ] || fail "missing templates/: $skill_dir"
263
+ [ -d "$skill_dir/checklists" ] || fail "missing checklists/: $skill_dir"
253
264
  [ -d "$skill_dir/examples" ] || fail "missing examples/: $skill_dir"
254
265
  }
255
266
 
@@ -268,67 +279,11 @@ verify_one() {
268
279
  genesis-new-design|genesis-upgrade-design)
269
280
  verify_design_skill "$skill_dir" "$dir_name"
270
281
  ;;
271
- genesis-architecture)
272
- verify_skill_metadata "$skill_dir" "architecture-skill"
273
- verify_skill_protocol "$skill_dir"
274
- ;;
275
- genesis-planning)
276
- verify_skill_metadata "$skill_dir" "planning-skill"
277
- verify_skill_protocol "$skill_dir"
278
- ;;
279
- genesis-mvp-planning)
280
- verify_skill_metadata "$skill_dir" "genesis-mvp-planning"
281
- verify_minimal_skill "$skill_dir"
282
- ;;
283
- genesis-codebase-map)
284
- verify_skill_metadata "$skill_dir" "codebase-map-skill"
285
- verify_skill_protocol "$skill_dir"
286
- ;;
287
- genesis-design-spec)
288
- verify_skill_metadata "$skill_dir" "design-spec-skill"
289
- verify_skill_protocol "$skill_dir"
290
- ;;
291
- genesis-api-contract)
292
- verify_skill_metadata "$skill_dir" "api-contract-skill"
293
- verify_skill_protocol "$skill_dir"
294
- ;;
295
- ui-ux-test-skill)
296
- verify_skill_metadata "$skill_dir" "ui-ux-test-skill"
297
- verify_skill_protocol "$skill_dir"
298
- ;;
299
- genesis-harness-engineering)
300
- verify_skill_metadata "$skill_dir" "harness-engineering-skill"
301
- verify_skill_protocol "$skill_dir"
302
- ;;
303
- genesis-ai-provider)
304
- verify_skill_metadata "$skill_dir" "ai-provider-skill"
305
- verify_skill_protocol "$skill_dir"
306
- ;;
307
- genesis-pipeline-orchestration)
308
- verify_skill_metadata "$skill_dir" "pipeline-orchestration-skill"
309
- verify_skill_protocol "$skill_dir"
310
- ;;
311
- genesis-research)
312
- verify_skill_metadata "$skill_dir" "research-skill"
313
- verify_skill_protocol "$skill_dir"
314
- ;;
315
- genesis-docs)
316
- verify_skill_metadata "$skill_dir" "docs-skill"
317
- verify_skill_protocol "$skill_dir"
318
- ;;
319
- genesis-release)
320
- verify_skill_metadata "$skill_dir" "release-skill"
321
- verify_skill_protocol "$skill_dir"
322
- ;;
323
- genesis-api-sync)
324
- verify_skill_metadata "$skill_dir" "api-sync-skill"
282
+ genesis-architecture|genesis-planning|genesis-codebase-map|genesis-design-spec|genesis-api-contract|genesis-ui-ux-test|genesis-harness-engineering|genesis-ai-provider|genesis-pipeline-orchestration|genesis-api-sync|genesis-executing-plans|genesis-test-driven-development|genesis-verification-before-completion|genesis-using-git-worktrees)
283
+ verify_skill_metadata "$skill_dir" "$dir_name"
325
284
  verify_skill_protocol "$skill_dir"
326
285
  ;;
327
- genesis-debug-guide)
328
- verify_skill_metadata "$skill_dir" "debug-guide-skill"
329
- verify_playbook_skill "$skill_dir"
330
- ;;
331
- genesis-docs-automation|genesis-spec-propagation|genesis-release-orchestration|genesis-performance-profiling|genesis-observability-automation)
286
+ genesis-debug-guide|genesis-docs-automation|genesis-spec-propagation|genesis-performance-profiling|genesis-observability-automation|genesis-release)
332
287
  verify_skill_metadata "$skill_dir" "$dir_name"
333
288
  verify_playbook_skill "$skill_dir"
334
289
  ;;
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const assert = require("assert");
5
+ const fs = require("fs");
6
+ const os = require("os");
7
+ const path = require("path");
8
+ const { execFileSync } = require("child_process");
9
+
10
+ const repoRoot = path.resolve(__dirname, "..", "..");
11
+ const cli = path.join(repoRoot, "bin", "genesis-harness.js");
12
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "genesis-cli-smoke-"));
13
+
14
+ function run(args, cwd = tmp) {
15
+ return execFileSync(process.execPath, [cli, ...args], {
16
+ cwd,
17
+ env: {
18
+ ...process.env,
19
+ CODEX_HOME: path.join(tmp, "codex-home"),
20
+ GENESIS_HARNESS_HOME: path.join(tmp, "agents-home"),
21
+ GENESIS_HARNESS_SKIP_POSTINSTALL: "1"
22
+ },
23
+ encoding: "utf8"
24
+ });
25
+ }
26
+
27
+ function runPostinstall(initCwd) {
28
+ return execFileSync(process.execPath, [cli, "postinstall"], {
29
+ cwd: repoRoot,
30
+ env: {
31
+ ...process.env,
32
+ CODEX_HOME: path.join(initCwd, "codex-postinstall-home"),
33
+ GENESIS_HARNESS_HOME: path.join(initCwd, "agents-postinstall-home"),
34
+ INIT_CWD: initCwd
35
+ },
36
+ encoding: "utf8"
37
+ });
38
+ }
39
+
40
+ fs.mkdirSync(path.join(tmp, ".codebase"), { recursive: true });
41
+ fs.mkdirSync(path.join(tmp, ".planning"), { recursive: true });
42
+ fs.writeFileSync(path.join(tmp, ".codebase", "CURRENT_STATE.md"), "# Current State: TEST\n");
43
+ fs.writeFileSync(path.join(tmp, ".codebase", "API_CONTRACTS.md"), "# API Contracts\n");
44
+ fs.writeFileSync(path.join(tmp, ".planning", "SPEC_CHANGELOG.md"), "# Spec Changelog\n");
45
+ fs.writeFileSync(path.join(tmp, "package.json"), JSON.stringify({ name: "smoke-fixture" }, null, 2));
46
+
47
+ run(["install", "--target", "agents"]);
48
+ const seededPolicyPath = path.join(tmp, ".codebase", "context-policy.json");
49
+ assert(fs.existsSync(seededPolicyPath), "install should seed LeanCTX policy into project .codebase");
50
+ const seededPolicy = JSON.parse(fs.readFileSync(seededPolicyPath, "utf8"));
51
+ assert.strictEqual(seededPolicy.token_budget, 12000, "seeded LeanCTX policy should use package default");
52
+
53
+ fs.writeFileSync(
54
+ seededPolicyPath,
55
+ JSON.stringify({ token_budget: 8000, compact_at: 0.7, hard_stop_at: 0.9 }, null, 2)
56
+ );
57
+ run(["install", "--target", "agents"]);
58
+ const preservedPolicy = JSON.parse(fs.readFileSync(seededPolicyPath, "utf8"));
59
+ assert.strictEqual(preservedPolicy.token_budget, 8000, "install must not overwrite customized LeanCTX policy");
60
+
61
+ const postinstallTmp = fs.mkdtempSync(path.join(os.tmpdir(), "genesis-postinstall-smoke-"));
62
+ fs.writeFileSync(path.join(postinstallTmp, "package.json"), JSON.stringify({ name: "postinstall-fixture" }, null, 2));
63
+ runPostinstall(postinstallTmp);
64
+ assert(
65
+ fs.existsSync(path.join(postinstallTmp, ".codebase", "context-policy.json")),
66
+ "postinstall should seed LeanCTX policy when npm exposes INIT_CWD"
67
+ );
68
+
69
+ const pathOutput = run(["path"]);
70
+ assert(pathOutput.includes("genesis-harness"), "path should include installed skill paths");
71
+
72
+ const statusOutput = run(["status"]);
73
+ assert(statusOutput.includes("GENESIS HARNESS - STATUS REPORT"), "status should render status report");
74
+
75
+ const docsOutput = run(["docs"]);
76
+ assert(docsOutput.includes("GENESIS HARNESS - DOCUMENTATION REPORT"), "docs should render docs report");
77
+
78
+ const leanCtxOutput = run(["leanctx"]);
79
+ assert(leanCtxOutput.includes("LeanCTX Policy"), "leanctx should render policy report");
80
+ assert(leanCtxOutput.includes("Token budget: 8000"), "leanctx should read project policy");
81
+ assert(leanCtxOutput.includes("Command wrapper:"), "leanctx should report command wrapper detection");
82
+ assert(leanCtxOutput.includes("rtk optional"), "leanctx should treat rtk as optional");
83
+ assert(leanCtxOutput.includes("genesis-harness sync"), "leanctx should include portable sync command");
84
+
85
+ const primeOutput = run(["prime"]);
86
+ assert(primeOutput.includes("LeanCTX Policy"), "prime should include LeanCTX policy");
87
+ assert(primeOutput.includes("rtk optional"), "prime should document optional wrapper behavior");
88
+
89
+ const gateOutput = run(["docs-gate"]);
90
+ assert(
91
+ gateOutput.includes("Docs sync check passed") || gateOutput.includes("docs sync check is limited"),
92
+ "docs-gate should pass in fixture"
93
+ );
94
+
95
+ run(["sync"]);
96
+ const visual = fs.readFileSync(path.join(tmp, ".codebase", "VISUAL_GRAPH.md"), "utf8");
97
+ assert(visual.includes("Harness Relationship Map"), "sync should generate harness relationship map");
98
+ assert(visual.includes("genesis-harness docs-gate"), "sync graph should include docs-gate");
99
+ assert(!visual.includes("Đăng nhập"), "sync graph must not emit stale sample roadmap");
100
+ assert(!visual.includes("src/auth.js"), "sync graph must not emit stale sample source path");
101
+ assert(visual.includes("```mermaid"), "sync graph should contain mermaid fences");
102
+
103
+ console.log("cli smoke passed");
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ /**
5
+ * feature_registry.test.js
6
+ * L08 – Feature List as Harness Primitive
7
+ * L11 – Observability Bên Trong Harness
8
+ *
9
+ * Tests must FAIL before implementation (Red phase).
10
+ * Run: node tests/unit/feature_registry.test.js
11
+ */
12
+
13
+ const assert = require("assert");
14
+ const fs = require("fs");
15
+ const path = require("path");
16
+
17
+ const repoRoot = path.resolve(__dirname, "..", "..");
18
+
19
+ // ─────────────────────────────────────────────────────────────────────────────
20
+ // L08 — Feature Registry checks
21
+ // ─────────────────────────────────────────────────────────────────────────────
22
+
23
+ const REGISTRY_PATH = path.join(repoRoot, "features", "REGISTRY.md");
24
+ const REGISTRY_SCHEMA_PATH = path.join(repoRoot, "contracts", "features", "registry-schema.json");
25
+
26
+ // Test 1: features/REGISTRY.md phải tồn tại
27
+ assert(
28
+ fs.existsSync(REGISTRY_PATH),
29
+ "L08: features/REGISTRY.md must exist as machine-readable feature primitive"
30
+ );
31
+
32
+ // Test 2: REGISTRY.md phải chứa section machine-readable features table
33
+ const registryContent = fs.readFileSync(REGISTRY_PATH, "utf8");
34
+ assert(
35
+ registryContent.includes("| id |"),
36
+ "L08: REGISTRY.md must have a machine-readable table with 'id' column"
37
+ );
38
+ assert(
39
+ registryContent.includes("| status |"),
40
+ "L08: REGISTRY.md must have a 'status' column"
41
+ );
42
+ assert(
43
+ registryContent.includes("| verify_cmd |"),
44
+ "L08: REGISTRY.md must have a 'verify_cmd' column per feature"
45
+ );
46
+
47
+ // Test 3: Mỗi feature phải có trạng thái hợp lệ
48
+ const validStatuses = ["planned", "in-progress", "done", "verified", "deprecated"];
49
+ const tableRows = registryContent
50
+ .split("\n")
51
+ .filter(line => /^\|\s*F\d+\s*\|/.test(line)); // Only data rows from Feature Table (id starts with F)
52
+ assert(
53
+ tableRows.length > 0,
54
+ "L08: REGISTRY.md must have at least one feature entry (id must start with F, e.g. F001)"
55
+ );
56
+ for (const row of tableRows) {
57
+ const cols = row.split("|").map(c => c.trim()).filter(Boolean);
58
+ if (cols.length < 2) continue;
59
+ const status = cols[1];
60
+ assert(
61
+ validStatuses.includes(status),
62
+ `L08: Invalid status '${status}' in REGISTRY.md — must be one of: ${validStatuses.join(", ")}`
63
+ );
64
+ }
65
+
66
+ // Test 4: contracts/features/registry-schema.json phải tồn tại
67
+ assert(
68
+ fs.existsSync(REGISTRY_SCHEMA_PATH),
69
+ "L08: contracts/features/registry-schema.json must exist"
70
+ );
71
+ const schema = JSON.parse(fs.readFileSync(REGISTRY_SCHEMA_PATH, "utf8"));
72
+ assert(schema.version, "L08: registry-schema.json must have a version field");
73
+ assert(schema.required_columns, "L08: registry-schema.json must define required_columns");
74
+ assert(
75
+ Array.isArray(schema.required_columns) && schema.required_columns.includes("id"),
76
+ "L08: required_columns must include 'id'"
77
+ );
78
+
79
+ // Test 5: REGISTRY.md phải được đề cập trong MODULE_INDEX.md
80
+ const moduleIndex = fs.readFileSync(
81
+ path.join(repoRoot, ".codebase", "MODULE_INDEX.md"),
82
+ "utf8"
83
+ );
84
+ assert(
85
+ moduleIndex.includes("features/REGISTRY.md"),
86
+ "L08: features/REGISTRY.md must be listed in .codebase/MODULE_INDEX.md"
87
+ );
88
+
89
+ // ─────────────────────────────────────────────────────────────────────────────
90
+ // L11 — Observability Live Data checks
91
+ // ─────────────────────────────────────────────────────────────────────────────
92
+
93
+ const OBS_SCHEMA_PATH = path.join(repoRoot, "contracts", "observability", "agent-run-schema.json");
94
+ const OBS_SAMPLE_PATH = path.join(repoRoot, "observability", "agent-runs", "sample-run.json");
95
+ const OBS_FAILURE_SCHEMA_PATH = path.join(repoRoot, "contracts", "observability", "failure-schema.json");
96
+ const OBS_FAILURE_SAMPLE_PATH = path.join(repoRoot, "observability", "failures", "sample-failure.json");
97
+ const OBS_DECISION_SAMPLE_PATH = path.join(repoRoot, "observability", "decision-logs", "sample-decision.md");
98
+
99
+ // Test 6: contracts/observability/ phải có agent-run-schema.json
100
+ assert(
101
+ fs.existsSync(OBS_SCHEMA_PATH),
102
+ "L11: contracts/observability/agent-run-schema.json must exist"
103
+ );
104
+ const agentRunSchema = JSON.parse(fs.readFileSync(OBS_SCHEMA_PATH, "utf8"));
105
+ assert(agentRunSchema.required_fields, "L11: agent-run-schema.json must define required_fields");
106
+ const requiredRunFields = ["session_id", "timestamp", "skill", "phase", "outcome", "evidence"];
107
+ for (const field of requiredRunFields) {
108
+ assert(
109
+ agentRunSchema.required_fields.includes(field),
110
+ `L11: agent-run-schema.json must require field '${field}'`
111
+ );
112
+ }
113
+
114
+ // Test 7: observability/agent-runs/ phải có ít nhất 1 sample entry
115
+ assert(
116
+ fs.existsSync(OBS_SAMPLE_PATH),
117
+ "L11: observability/agent-runs/sample-run.json must exist as live sample"
118
+ );
119
+ const sampleRun = JSON.parse(fs.readFileSync(OBS_SAMPLE_PATH, "utf8"));
120
+ for (const field of requiredRunFields) {
121
+ assert(
122
+ sampleRun[field] !== undefined,
123
+ `L11: sample-run.json is missing required field '${field}'`
124
+ );
125
+ }
126
+
127
+ // Test 8: contracts/observability/failure-schema.json phải tồn tại
128
+ assert(
129
+ fs.existsSync(OBS_FAILURE_SCHEMA_PATH),
130
+ "L11: contracts/observability/failure-schema.json must exist"
131
+ );
132
+ const failureSchema = JSON.parse(fs.readFileSync(OBS_FAILURE_SCHEMA_PATH, "utf8"));
133
+ assert(failureSchema.required_fields, "L11: failure-schema.json must define required_fields");
134
+
135
+ // Test 9: observability/failures/ phải có sample failure entry
136
+ assert(
137
+ fs.existsSync(OBS_FAILURE_SAMPLE_PATH),
138
+ "L11: observability/failures/sample-failure.json must exist"
139
+ );
140
+
141
+ // Test 10: observability/decision-logs/ phải có sample thực tế (không chỉ template)
142
+ assert(
143
+ fs.existsSync(OBS_DECISION_SAMPLE_PATH),
144
+ "L11: observability/decision-logs/sample-decision.md must exist as actual decision record"
145
+ );
146
+ const decisionContent = fs.readFileSync(OBS_DECISION_SAMPLE_PATH, "utf8");
147
+ assert(
148
+ !decisionContent.includes("What changed."),
149
+ "L11: sample-decision.md must be a real decision record, not just the blank template"
150
+ );
151
+
152
+ console.log("feature_registry tests passed");
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Unit Test for prompt_sentinel.js
3
- * Part of Genesis Codex Harness v0.1.7
3
+ * Part of Genesis Codex Harness v0.1.8
4
4
  */
5
5
 
6
6
  const assert = require('assert');
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Unit Test for spec_visual_sync.js
3
- * Part of Genesis Codex Harness v0.1.7
3
+ * Part of Genesis Codex Harness v0.1.8
4
4
  */
5
5
 
6
6
  const assert = require('assert');
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Unit Test for test_generator.js
3
- * Part of Genesis Codex Harness v0.1.7
3
+ * Part of Genesis Codex Harness v0.1.8
4
4
  */
5
5
 
6
6
  const assert = require('assert');
@@ -1,46 +0,0 @@
1
- ---
2
- name: docs-skill
3
- description: Keep Codex harness docs synchronized with skills, contracts, tests, memory, and release behavior. Use after any workflow, public interface, install, verification, or package behavior change.
4
- ---
5
-
6
- # Docs Skill
7
-
8
- ## Purpose
9
- Keep docs short, accurate, and linked to source-of-truth artifacts.
10
-
11
- ## When to use
12
- Use after changing skills, CLI behavior, contracts, fixtures, tests, repository memory, or publish flow.
13
-
14
- ## When NOT to use
15
- Do not use to duplicate full architecture manuals in `AGENTS.md`.
16
-
17
- ## Inputs required
18
- Changed files, public behavior, verification results, and affected users.
19
-
20
- ## Outputs required
21
- Updated README, AGENTS map, codebase memory, changelog-style summary, and changed docs list.
22
-
23
- ## Required tests
24
- Run docs-related verification and package dry-run when docs affect packaging or install instructions.
25
-
26
- ## Required fixtures
27
- Update templates/examples when docs describe reusable workflows.
28
-
29
- ## Required contract updates
30
- Update contracts when docs describe new interface behavior.
31
-
32
- ## Required codebase map updates
33
- Update `.codebase/CURRENT_STATE.md`, `MODULE_INDEX.md`, or summaries as needed.
34
-
35
- ## Token saving rules
36
- Keep docs concise. Link to templates and contracts instead of repeating them.
37
-
38
- ## Acceptance criteria
39
- Docs match behavior and do not duplicate large internal manuals.
40
-
41
- ## Common mistakes
42
- Letting AGENTS.md grow too large, documenting unverified behavior, and missing install docs.
43
-
44
- ## Recovery workflow
45
- If docs drift, add verify assertions or checklist items that catch the drift next time.
46
-
@@ -1,7 +0,0 @@
1
- interface:
2
- display_name: "Docs Skill"
3
- short_description: "Synchronize harness documentation"
4
- default_prompt: "Use $docs-skill to update concise docs and repository memory after changes."
5
- policy:
6
- allow_implicit_invocation: true
7
-
@@ -1,114 +0,0 @@
1
- ---
2
- name: genesis-mvp-planning
3
- description: "Define, structure, and automate the creation of a standard 5-Phase MVP Roadmap right after project initialization. Guarantees a decision-complete path to production-ready launch."
4
- ---
5
-
6
- # Genesis MVP 5-Phase Planning Skill
7
-
8
- ## Purpose
9
-
10
- The `genesis-mvp-planning` skill is designed to transition a newly initialized project into a structured, decision-complete **5-Phase MVP Roadmap**. Instead of leaving the repository with only a blank generic Phase 0 (Foundation) folder, this skill maps out the entire lifecycle of a production-ready Minimum Viable Product across exactly 5 logical, sequential phases.
11
-
12
- ---
13
-
14
- ## When to use
15
-
16
- Use the `genesis-mvp-planning` skill when:
17
- - You have just run `/genesis-init` (or `/init`) and need to map out the implementation timeline.
18
- - You want to scope an application specifically to its MVP (Minimum Viable Product) boundaries.
19
- - You want to establish clear gates and milestones for each stage of the project lifecycle.
20
-
21
- ---
22
-
23
- ## When NOT to use
24
-
25
- Do NOT use the `genesis-mvp-planning` skill when:
26
- - The project is already midway through development with a pre-existing mature roadmap.
27
- - The task is a minor, single-file bug fix or simple refactoring that doesn't affect the project timeline.
28
- - The roadmap has already been fully approved and is currently active.
29
-
30
- ---
31
-
32
- ## Inputs required
33
-
34
- Before running this planning skill, ensure the following inputs are gathered:
35
- - **Project Brief / Intent**: Clear understanding of what application is being built and target users.
36
- - **Technology Stack**: Backend, frontend, database, auth provider, and deployment target.
37
- - **Core MVP Features List**: The primary business value proposition that must be delivered.
38
-
39
- ---
40
-
41
- ## Outputs required
42
-
43
- Executing this skill creates the following structured deliverables:
44
- - `.planning/ROADMAP.md`: Updated roadmap with 5 distinct phases defined.
45
- - `.planning/phases/PHASE_1_CORE/`: Planning directory for Phase 1 (Foundation & API Core).
46
- - `.planning/phases/PHASE_2_AUTH/`: Planning directory for Phase 2 (Authentication & Security).
47
- - `.planning/phases/PHASE_3_FEATURES/`: Planning directory for Phase 3 (Core MVP Features).
48
- - `.planning/phases/PHASE_4_INTEGRATIONS/`: Planning directory for Phase 4 (Third-Party Integrations).
49
- - `.planning/phases/PHASE_5_READINESS/`: Planning directory for Phase 5 (Production Readiness & Observability).
50
-
51
- ---
52
-
53
- ## Required tests
54
-
55
- The planning deliverables are validated using:
56
- - [ ] `test/planning/roadmap-structure.test.js`: Verifies `ROADMAP.md` contains all 5 phases with valid status checkboxes.
57
- - [ ] `test/planning/phase-completeness.test.js`: Verifies each phase directory contains standard `SPEC.md`, `PLAN.md`, and `TASKS.md`.
58
-
59
- ---
60
-
61
- ## Required fixtures
62
-
63
- - `fixtures/planning/roadmap-expected.md`: The canonical structure of a 5-Phase MVP roadmap.
64
- - `fixtures/planning/phase-config-expected.json`: Complete configuration template mapping out the 5 phases.
65
-
66
- ---
67
-
68
- ## Required contract updates
69
-
70
- Update the following files if phase boundary standards change:
71
- - `contracts/planning/roadmap.schema.json`: Schema validator for `ROADMAP.md` files.
72
- - `contracts/planning/phase.schema.json`: Schema validator for individual phase directories.
73
-
74
- ---
75
-
76
- ## Required codebase map updates
77
-
78
- After mapping out the 5-Phase MVP:
79
- - **`.codebase/CURRENT_STATE.md`**: Update current phase to Phase 1, and add the full 5-phase overview.
80
- - **`.codebase/MODULE_INDEX.md`**: Add references to each of the 5 phase directories.
81
-
82
- ---
83
-
84
- ## Token saving rules
85
-
86
- 1. **Reuse templates**: Do not rewrite the basic structure of the phases. Use the provided phase templates in `templates/`.
87
- 2. **Summarize context**: Do not read every detail of the repository. Use `SUMMARY.md` and module index.
88
- 3. **Draft sequentially**: Plan one phase at a time to keep prompt sizes small.
89
-
90
- ---
91
-
92
- ## Acceptance criteria
93
-
94
- The 5-Phase MVP roadmap is ACCEPTED when:
95
- - [ ] `ROADMAP.md` is updated with 5 clearly defined phases, dates, and success criteria.
96
- - [ ] All 5 phase planning folders (`PHASE_1_CORE` to `PHASE_5_READINESS`) are created and populated.
97
- - [ ] No feature code is written before the 5 phase boundaries are validated.
98
-
99
- ---
100
-
101
- ## Common mistakes
102
-
103
- ### Mistake 1: Starting Phase 3 (Core Features) before Phase 1 (API Core)
104
- - **Problem**: Writing UI screens without verified backend models and schemas leads to massive rework.
105
- - **Fix**: Complete Phase 1 and 2 to establish a solid database and API contract first.
106
-
107
- ---
108
-
109
- ## Recovery workflow
110
-
111
- ### Recovery 1: Phase drift or timeline changes
112
- 1. Mark the affected phase as `[!] blocked` in `ROADMAP.md`.
113
- 2. Document the change in `SPEC_CHANGELOG.md`.
114
- 3. Adjust downstream phase boundaries accordingly.
@@ -1,6 +0,0 @@
1
- interface:
2
- display_name: "Genesis MVP Planning"
3
- short_description: "— Xây dựng lộ trình 5 Phase phát triển sản phẩm MVP"
4
- default_prompt: "Use $genesis-mvp-planning to map out the 5 essential phases of a production-ready MVP."
5
- policy:
6
- allow_implicit_invocation: true