codex-genesis-harness 0.1.7 → 0.1.9

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 (115) hide show
  1. package/.codebase/COMPRESSED_CONTEXT.md +80 -0
  2. package/.codebase/CURRENT_STATE.md +10 -10
  3. package/.codebase/DEPENDENCY_GRAPH.md +14 -1
  4. package/.codebase/IMPLEMENTATION_HANDOFF.md +34 -336
  5. package/.codebase/KNOWN_PROBLEMS.md +73 -3
  6. package/.codebase/MODULE_INDEX.md +23 -2
  7. package/.codebase/PIPELINE_FLOW.md +16 -6
  8. package/.codebase/RECOVERY_POINTS.md +80 -78
  9. package/.codebase/TECH_DEBT.md +6 -0
  10. package/.codebase/TEST_MATRIX.md +8 -3
  11. package/.codebase/VISUAL_GRAPH.md +127 -0
  12. package/.codebase/context-policy.json +68 -0
  13. package/.codebase/memories/lessons_learned.md +63 -0
  14. package/.codebase/memories/preferences.md +17 -0
  15. package/.codebase/state.json +156 -17
  16. package/.codex/skills/genesis-architecture/SKILL.md +5 -0
  17. package/.codex/skills/genesis-debug-guide/SKILL.md +10 -4
  18. package/.codex/skills/genesis-docs-automation/SKILL.md +52 -973
  19. package/.codex/skills/genesis-executing-plans/SKILL.md +54 -0
  20. package/.codex/skills/genesis-executing-plans/agents/openai.yaml +6 -0
  21. package/.codex/skills/genesis-executing-plans/checklists/.gitkeep +0 -0
  22. package/.codex/skills/genesis-executing-plans/examples/.gitkeep +0 -0
  23. package/.codex/skills/genesis-executing-plans/templates/.gitkeep +0 -0
  24. package/.codex/skills/genesis-harness/SKILL.md +73 -1385
  25. package/.codex/skills/genesis-harness/agents/openai.yaml +1 -2
  26. package/.codex/skills/genesis-harness/references/state-machine.md +4 -1
  27. package/.codex/skills/genesis-harness/references/workflows.md +7 -1
  28. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +3 -3
  29. package/.codex/skills/genesis-harness/scripts/init-planning.sh +246 -14
  30. package/.codex/skills/genesis-new-design/SKILL.md +4 -1
  31. package/.codex/skills/genesis-new-design/agents/openai.yaml +2 -0
  32. package/.codex/skills/genesis-observability-automation/SKILL.md +69 -303
  33. package/.codex/skills/genesis-observability-automation/references/common-mistakes-and-recovery.md +84 -0
  34. package/.codex/skills/genesis-observability-automation/references/workflow-phases.md +78 -0
  35. package/.codex/skills/genesis-performance-profiling/SKILL.md +1 -22
  36. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +1 -1
  37. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +15 -3
  38. package/.codex/skills/genesis-planning/SKILL.md +6 -1
  39. package/.codex/skills/genesis-release/SKILL.md +5 -0
  40. package/.codex/skills/genesis-research-first/SKILL.md +6 -0
  41. package/.codex/skills/genesis-spec-propagation/SKILL.md +52 -504
  42. package/.codex/skills/genesis-test-driven-development/SKILL.md +55 -0
  43. package/.codex/skills/genesis-test-driven-development/agents/openai.yaml +6 -0
  44. package/.codex/skills/genesis-test-driven-development/checklists/.gitkeep +0 -0
  45. package/.codex/skills/genesis-test-driven-development/examples/.gitkeep +0 -0
  46. package/.codex/skills/genesis-test-driven-development/templates/.gitkeep +0 -0
  47. package/.codex/skills/genesis-upgrade-design/SKILL.md +4 -2
  48. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +2 -0
  49. package/.codex/skills/genesis-using-git-worktrees/SKILL.md +54 -0
  50. package/.codex/skills/genesis-using-git-worktrees/agents/openai.yaml +6 -0
  51. package/.codex/skills/genesis-using-git-worktrees/checklists/.gitkeep +0 -0
  52. package/.codex/skills/genesis-using-git-worktrees/examples/.gitkeep +0 -0
  53. package/.codex/skills/genesis-using-git-worktrees/templates/.gitkeep +0 -0
  54. package/.codex/skills/genesis-verification-before-completion/SKILL.md +53 -0
  55. package/.codex/skills/genesis-verification-before-completion/agents/openai.yaml +6 -0
  56. package/.codex/skills/genesis-verification-before-completion/checklists/.gitkeep +0 -0
  57. package/.codex/skills/genesis-verification-before-completion/examples/.gitkeep +0 -0
  58. package/.codex/skills/genesis-verification-before-completion/templates/.gitkeep +0 -0
  59. package/.codex/skills/spec-impact-engine/SKILL.md +77 -500
  60. package/.codex/skills/spec-impact-engine/checklists/checklist.md +10 -0
  61. package/.codex-plugin/plugin.json +6 -5
  62. package/CHANGELOG.md +25 -1
  63. package/README.EN.md +74 -17
  64. package/README.VI.md +77 -19
  65. package/README.md +126 -10
  66. package/VERSION +1 -2
  67. package/bin/genesis-harness.js +2979 -149
  68. package/contracts/features/project-registry-schema.json +37 -0
  69. package/contracts/features/registry-schema.json +15 -0
  70. package/contracts/observability/agent-run-schema.json +39 -0
  71. package/contracts/observability/failure-schema.json +35 -0
  72. package/contracts/ui/auth/login-screen-contract.json +43 -0
  73. package/features/REGISTRY.md +65 -0
  74. package/features/SCOPE-template.md +65 -0
  75. package/fixtures/pipeline/end-to-end-project-lifecycle-fixture.md +39 -0
  76. package/fixtures/pipeline/feature-completion-fixture.md +26 -0
  77. package/fixtures/pipeline/run-to-feature-execution-fixture.md +20 -0
  78. package/fixtures/planning/MOCKUP_PROMPT_TEMPLATE.md +16 -0
  79. package/observability/agent-runs/sample-run.json +13 -0
  80. package/observability/decision-logs/sample-decision.md +43 -0
  81. package/observability/failures/sample-failure.json +12 -0
  82. package/package.json +15 -4
  83. package/playwright/e2e/app-template.spec.js +37 -0
  84. package/playwright/e2e/auth/login-screen.spec.js +65 -0
  85. package/playwright/e2e/web-template.spec.js +28 -0
  86. package/scripts/check-repository-hygiene.js +48 -0
  87. package/scripts/check-scope.sh +100 -0
  88. package/scripts/cold-start-check.js +133 -0
  89. package/scripts/install.sh +4 -0
  90. package/scripts/prompt_sentinel.js +35 -4
  91. package/scripts/run-evals.sh +152 -3
  92. package/scripts/schema/001-init.sql +129 -0
  93. package/scripts/schema/002-story-verify.sql +9 -0
  94. package/scripts/schema/003-tool-registry.sql +15 -0
  95. package/scripts/schema/004-intervention.sql +15 -0
  96. package/scripts/scratch_parser.js +49 -0
  97. package/scripts/spec_visual_sync.js +1 -1
  98. package/scripts/test_generator.js +2 -2
  99. package/scripts/transition_state.sh +32 -8
  100. package/scripts/uninstall.sh +4 -0
  101. package/scripts/validation_gates.sh +2 -80
  102. package/scripts/verify.sh +19 -2
  103. package/tests/fixtures/fixture-index.md +5 -0
  104. package/tests/integration/cli-smoke.test.js +506 -0
  105. package/tests/unit/feature_registry.test.js +152 -0
  106. package/tests/unit/prompt_sentinel.test.js +1 -1
  107. package/tests/unit/repository_hygiene.test.js +17 -0
  108. package/tests/unit/spec_visual_sync.test.js +1 -1
  109. package/tests/unit/state_metadata.test.js +76 -0
  110. package/tests/unit/test_generator.test.js +1 -1
  111. package/tests/unit/verify_gate.test.js +25 -0
  112. package/tests/unit/workflow_contracts.test.js +90 -0
  113. package/fixtures/tts/tts-fixture-template.md +0 -14
  114. package/fixtures/videos/video-fixture-template.md +0 -14
  115. package/playwright/e2e/e2e-template.md +0 -4
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: genesis-test-driven-development
3
+ description: Đảm bảo viết Test trước, Implement sau (Red -> Green -> Refactor). Bắt buộc phải có verification cycle ở mọi bước thay đổi logic.
4
+ ---
5
+
6
+ # Genesis Test Driven Development
7
+
8
+ ## Purpose
9
+ Bắt buộc tuân thủ nguyên tắc TDD (Test-Driven Development) nhằm giữ cho chất lượng codebase luôn ở mức cao nhất. Cụ thể, Agent phải chứng minh được test fail (Red) trước khi sửa code, sau đó pass (Green) sau khi implement, và cuối cùng là dọn dẹp mã (Refactor) để duy trì cấu trúc sạch sẽ.
10
+
11
+ ## When to use
12
+ Bất cứ khi nào thêm tính năng mới (feature), sửa lỗi logic (bug fix), hoặc thay đổi luồng nghiệp vụ của ứng dụng/API.
13
+
14
+ ## When NOT to use
15
+ Khi chỉ thay đổi tài liệu (README, docs), thay đổi cấu trúc thư mục không ảnh hưởng logic (như move file), cấu hình CI/CD, hoặc thuần tuý design UI không có logic nghiệp vụ phức tạp.
16
+
17
+ ## Inputs required
18
+ - Lỗi cụ thể từ người dùng hoặc requirement chi tiết từ bản kế hoạch.
19
+ - Khung test framework của dự án (Jest, Mocha, Playwright, v.v.).
20
+
21
+ ## Outputs required
22
+ - Test file mới hoặc được cập nhật.
23
+ - Kết quả chạy test báo lỗi (Red phase) phản ánh đúng phần logic chưa có hoặc bị hỏng.
24
+ - Source code được implement hoặc chỉnh sửa.
25
+ - Kết quả chạy test pass (Green phase).
26
+
27
+ ## Required tests
28
+ Mọi chức năng, API endpoint hoặc module mới phải được bao phủ bởi Unit Test (và Integration Test nếu có tương tác giữa các service) trước khi code chính được hoàn thiện.
29
+
30
+ ## Required fixtures
31
+ Các bài test bắt buộc phải sử dụng dữ liệu từ mục `fixtures/` thay vì hardcode trực tiếp trong nội dung test, nhằm đảm bảo tính tái sử dụng và dễ theo dõi.
32
+
33
+ ## Required contract updates
34
+ Trong quá trình TDD, nếu nhận thấy cần thay đổi đầu vào (request) hoặc đầu ra (response) của API, hãy cập nhật ngay lập tức các file trong mục `contracts/` rồi mới tiến hành sửa test.
35
+
36
+ ## Required codebase map updates
37
+ Đảm bảo thêm module test mới vào file `TEST_MATRIX.md` để hệ thống nắm được phạm vi kiểm thử (coverage).
38
+
39
+ ## Token saving rules
40
+ Hạn chế chạy toàn bộ test suite lớn của dự án nhiều lần liên tiếp. Thay vào đó, hãy chạy riêng lẻ file test hoặc block test đang được implement (`npm test -- path/to/file.test.js`).
41
+
42
+ ## Acceptance criteria
43
+ 1. Quá trình Red -> Green -> Refactor được chứng minh bằng lịch sử dòng lệnh (CLI output).
44
+ 2. Codebase sau khi Refactor không bị trùng lặp mã (DRY).
45
+ 3. Test phải pass 100% khi chạy lẻ và chạy chung với toàn hệ thống.
46
+
47
+ ## Common mistakes
48
+ - **Viết code trước, viết test sau**: Đi ngược lại với triết lý TDD, dẫn đến test thiếu chính xác hoặc "test để pass".
49
+ - **Test không ý nghĩa (Trivial Tests)**: Viết test chỉ kiểm tra biến bằng chính nó (vd: `expect(true).toBe(true)`), không có giá trị bảo vệ logic.
50
+ - **Bỏ quên Refactor**: Đạt được Green (test pass) nhưng bỏ lại source code rối rắm, lộn xộn.
51
+
52
+ ## Recovery workflow
53
+ 1. Nếu quá trình Refactor làm test đỏ (fail) trở lại, tuyệt đối KHÔNG đổi mã của bài test.
54
+ 2. Hãy khôi phục source code về trạng thái Green gần nhất bằng `git restore` hoặc undo các thay đổi.
55
+ 3. Tiến hành Refactor lại từng bước nhỏ hơn (baby steps).
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Genesis TDD"
3
+ short_description: "Đảm bảo tuân thủ TDD loop"
4
+ default_prompt: "Viết test (Red), implement (Green) và Refactor. Phải có test fail trước khi sửa code."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -74,8 +74,10 @@ If behavior changes unintentionally, restore the contract expectation, add a reg
74
74
  5. Verify and compare:
75
75
  - Run lint/typecheck/tests/build that are available for the project.
76
76
  - Start the dev server when visual validation requires it.
77
- - Capture screenshots after changes and inspect important states and viewports.
78
- - If reference screenshots or a target design are provided, compare against them before claiming completion.
77
+ - **Automated Visual Verification Loop**:
78
+ 1. Use the `@modelcontextprotocol/server-puppeteer` tool to automatically navigate to the local dev server (e.g., `http://localhost:3000`) and capture a screenshot of the current UI.
79
+ 2. **Target Matching**: If a reference design is provided, use your Vision capabilities to compare your screenshot against the target. Iterate and update the code until the UI matches 100%.
80
+ 3. **Aesthetic Audit**: If no target design exists, analyze your screenshot for aesthetic flaws (alignment, spacing, typography, bad AI-generated slop, inconsistent styles) and autonomously update the code to fix them. Repeat the screenshot capture until the UI looks premium.
79
81
 
80
82
  ## Upgrade Heuristics
81
83
 
@@ -2,3 +2,5 @@ interface:
2
2
  display_name: "Genesis Upgrade Design"
3
3
  short_description: "— Nâng cấp UI/UX của giao diện Web có sẵn"
4
4
  default_prompt: "Use $genesis-upgrade-design to improve the existing frontend UI without changing behavior."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: genesis-using-git-worktrees
3
+ description: Tạo và quản lý môi trường phân lập an toàn qua git worktrees khi thực hiện các thay đổi kiến trúc mang tính rủi ro cao.
4
+ ---
5
+
6
+ # Genesis Using Git Worktrees
7
+
8
+ ## Purpose
9
+ Đảm bảo an toàn tuyệt đối cho nhánh làm việc chính bằng cách thử nghiệm và refactor hệ thống ở một thư mục làm việc phụ (git worktree) được cách ly hoàn toàn. Kỹ năng này giúp developer hoặc AI không sợ làm hỏng repo gốc, dễ dàng xoá bỏ nếu kế hoạch thất bại.
10
+
11
+ ## When to use
12
+ Khi tiến hành refactor lớn, thay đổi thư viện cốt lõi, nâng cấp kiến trúc diện rộng, thử nghiệm framework mới, hoặc khi cần giữ nguyên bối cảnh (context) repo hiện tại để thực hiện một hotfix khẩn cấp sang một branch khác.
13
+
14
+ ## When NOT to use
15
+ Khi chỉ thay đổi nhỏ cục bộ (minor changes, typos, text updates, unit test fixes) không đe doạ đến kiến trúc hoặc sự ổn định toàn hệ thống.
16
+
17
+ ## Inputs required
18
+ - Yêu cầu thay đổi kiến trúc rủi ro cao từ `implementation_plan.md`.
19
+ - Vị trí an toàn để tạo worktree (ví dụ: một cấp bên ngoài thư mục project hiện tại như `../project-refactor`).
20
+
21
+ ## Outputs required
22
+ - Lệnh tạo worktree thành công (`git worktree add -b refactor-branch ../project-refactor`).
23
+ - Chuyển hướng context của AI sang thư mục worktree mới để làm việc.
24
+ - Dọn dẹp/xoá worktree sau khi hoàn tất hoặc merge thành công (`git worktree remove ...`).
25
+
26
+ ## Required tests
27
+ Chạy toàn bộ Regression Tests và Smoke Tests trên worktree để chứng minh tính đúng đắn trước khi xem xét tích hợp (merge) lại vào nhánh chính của repository gốc.
28
+
29
+ ## Required fixtures
30
+ N/A - Worktree dùng chung codebase repo gốc nhưng chia sẻ node_modules riêng rẽ hoặc tuỳ cấu hình.
31
+
32
+ ## Required contract updates
33
+ Trong môi trường worktree, hãy tuỳ ý chỉnh sửa hợp đồng (contracts) để thử nghiệm. Tuy nhiên trước khi merge, phải thông báo sự tương thích chéo.
34
+
35
+ ## Required codebase map updates
36
+ Đừng quên đồng bộ `CURRENT_STATE.md` để phản ánh nhánh/worktree đang thao tác nhằm tránh lạc đường.
37
+
38
+ ## Token saving rules
39
+ Quản lý tốt đường dẫn tương đối và tuyệt đối khi làm việc trong worktree để tránh nhầm lẫn với repo gốc, gây nhiễu cho luồng đọc file.
40
+
41
+ ## Acceptance criteria
42
+ 1. Không được phép chỉnh sửa các file thuộc cấu trúc nhánh chính khi mục tiêu là rủi ro. Mọi thay đổi đều phải thực hiện trên branch của worktree.
43
+ 2. Thử nghiệm trên worktree không được phá hỏng git index của repo gốc.
44
+ 3. Có quy trình merge an toàn hoặc gỡ bỏ (prune) sạch sẽ khi không còn sử dụng.
45
+
46
+ ## Common mistakes
47
+ - **Tạo worktree sai chỗ**: Tạo worktree *bên trong* thư mục làm việc gốc (ví dụ: `./my-worktree`) dẫn đến việc hệ thống git bị bối rối hoặc bị scan bởi linter/watcher. Phải luôn tạo ở cấp thư mục cha (ví dụ: `../my-worktree`).
48
+ - **Quên xoá worktree**: Làm rác hệ thống máy chủ, gây xung đột tài nguyên đĩa.
49
+ - **Thực thi lệnh nhầm thư mục**: Quên đổi thư mục làm việc (CWD) sang thư mục worktree mới, tiếp tục đập phá nhánh gốc.
50
+
51
+ ## Recovery workflow
52
+ 1. Nếu worktree gặp lỗi nghiêm trọng không thể cứu vãn: Chạy lệnh `git worktree remove -f <path>` và `git worktree prune`.
53
+ 2. Trở lại repository gốc với trạng thái nguyên vẹn 100%.
54
+ 3. Tạo worktree mới và bắt đầu lại.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Genesis Git Worktrees"
3
+ short_description: "Làm việc an toàn qua worktree"
4
+ default_prompt: "Tạo và sử dụng git worktrees để cách ly rủi ro khi thực hiện các thay đổi kiến trúc lớn."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: genesis-verification-before-completion
3
+ description: Bắt buộc cung cấp bằng chứng (evidence) của quá trình kiểm định trước khi tuyên bố hoàn thành task.
4
+ ---
5
+
6
+ # Genesis Verification Before Completion
7
+
8
+ ## Purpose
9
+ Chấm dứt triệt để việc AI "ảo giác" (hallucinate) kết quả làm việc hoặc tuyên bố xong việc khi chưa chạy test thực tế trên hệ thống. Kỹ năng này đảm bảo chất lượng mã nguồn bằng cách yêu cầu đưa ra bằng chứng (evidence) cụ thể, có thể xác minh được.
10
+
11
+ ## When to use
12
+ Sử dụng mỗi khi kết thúc một đầu mục công việc trong `task.md` hoặc trước khi thông báo với người dùng rằng toàn bộ kế hoạch (Implementation Plan) đã hoàn tất.
13
+
14
+ ## When NOT to use
15
+ Không sử dụng khi task chỉ đơn thuần là trả lời câu hỏi lý thuyết, vẽ sơ đồ, hoặc hướng dẫn cấu trúc mà không hề chạm vào code/hệ thống thực tế.
16
+
17
+ ## Inputs required
18
+ - Trạng thái công việc vừa thực hiện xong.
19
+ - Scripts kiểm tra có sẵn của dự án (`verify.sh`, `npm test`, `run-evals.sh`, linter, v.v.).
20
+
21
+ ## Outputs required
22
+ - Bằng chứng chạy lệnh (CLI output hoặc logs).
23
+ - Trạng thái cụ thể của các bài test (Pass/Fail) và giải thích ngắn gọn ý nghĩa của output đó (vd: "Toàn bộ 45 unit tests đã pass").
24
+
25
+ ## Required tests
26
+ Không tự ý viết thêm test ở bước này nếu không được yêu cầu. Tập trung vào việc **thực thi** (execute) các test suite đã được thiết lập bởi TDD ở các bước trước.
27
+
28
+ ## Required fixtures
29
+ Xác nhận rằng mọi script kiểm thử đã tiêu thụ (consume) đúng các mock data hoặc fixtures được quy định trong cấu trúc dự án.
30
+
31
+ ## Required contract updates
32
+ Nếu script verify phát hiện sự sai lệch giữa code và contract (ví dụ: JSON schema bị lỗi), báo cáo ngay lập tức để người dùng quyết định thay đổi code hay cập nhật contract.
33
+
34
+ ## Required codebase map updates
35
+ N/A - Việc cập nhật map nên được thực hiện trong quá trình code, kiểm định chỉ đóng vai trò xác thực.
36
+
37
+ ## Token saving rules
38
+ Nếu output của quá trình test hoặc linter quá dài (hàng nghìn dòng do log lỗi), hãy dùng các cờ (flags) để chỉ in ra summary (như `--silent` hoặc `tail -n 50`) để tránh tràn context.
39
+
40
+ ## Acceptance criteria
41
+ 1. Phải có bằng chứng rõ ràng (CLI stdout/stderr) chứng minh lệnh kiểm định đã thực sự được gọi trên Terminal.
42
+ 2. Không còn bất kỳ error hay warning nghiêm trọng nào bị bỏ sót chưa xử lý.
43
+ 3. Toàn bộ kịch bản kiểm thử (smoke, unit, integration) đã đạt chỉ tiêu 100% xanh (Green).
44
+
45
+ ## Common mistakes
46
+ - **Báo cáo suông**: Viết dòng chữ "Đã kiểm tra và mã hoạt động tốt" nhưng không hề đính kèm CLI output hoặc không cung cấp bằng chứng đã chạy script nào.
47
+ - **Bỏ qua Warning**: Chỉ nhìn thấy chữ "Pass" nhưng phớt lờ hàng loạt warning tiềm ẩn từ trình biên dịch (compiler) hoặc linter.
48
+ - **Kiểm định sai thư mục**: Chạy test ở thư mục root trong khi package nằm ở thư mục con.
49
+
50
+ ## Recovery workflow
51
+ 1. Nếu verify thất bại ở những phút cuối: Đánh dấu lại tiến độ vào `task.md` (chưa xong).
52
+ 2. Tái sử dụng TDD loop (skill: `genesis-test-driven-development`) để khoanh vùng và xử lý lỗi.
53
+ 3. Không cố gắng che giấu lỗi bằng cách phớt lờ thông báo thất bại.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Genesis Verification"
3
+ short_description: "Bắt buộc kiểm định trước khi hoàn tất"
4
+ default_prompt: "Chạy các script kiểm định, smoke test và evaluation để đưa ra bằng chứng trước khi báo cáo hoàn tất."
5
+ policy:
6
+ allow_implicit_invocation: true