frontend-harness 0.7.10 → 0.8.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 (69) hide show
  1. package/README.md +18 -10
  2. package/dist/cli/index.js +399 -65
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/runtime/builtin-skills.js +2 -1
  5. package/dist/runtime/builtin-skills.js.map +1 -1
  6. package/dist/runtime/clean.js +1 -0
  7. package/dist/runtime/clean.js.map +1 -1
  8. package/dist/runtime/command-taxonomy.js +7 -1
  9. package/dist/runtime/command-taxonomy.js.map +1 -1
  10. package/dist/runtime/context.d.ts +33 -2
  11. package/dist/runtime/context.js +63 -8
  12. package/dist/runtime/context.js.map +1 -1
  13. package/dist/runtime/evidence.d.ts +27 -0
  14. package/dist/runtime/evidence.js +240 -12
  15. package/dist/runtime/evidence.js.map +1 -1
  16. package/dist/runtime/ingest.d.ts +38 -0
  17. package/dist/runtime/ingest.js +157 -0
  18. package/dist/runtime/ingest.js.map +1 -0
  19. package/dist/runtime/knowledge/constants.js +1 -0
  20. package/dist/runtime/knowledge/constants.js.map +1 -1
  21. package/dist/runtime/knowledge/core.d.ts +10 -1
  22. package/dist/runtime/knowledge/core.js +582 -24
  23. package/dist/runtime/knowledge/core.js.map +1 -1
  24. package/dist/runtime/knowledge/types.d.ts +125 -1
  25. package/dist/runtime/knowledge.d.ts +2 -2
  26. package/dist/runtime/knowledge.js +1 -1
  27. package/dist/runtime/knowledge.js.map +1 -1
  28. package/dist/runtime/plan/guidance.d.ts +1 -1
  29. package/dist/runtime/plan/guidance.js +88 -25
  30. package/dist/runtime/plan/guidance.js.map +1 -1
  31. package/dist/runtime/plan/workflow.d.ts +1 -0
  32. package/dist/runtime/plan/workflow.js +32 -1
  33. package/dist/runtime/plan/workflow.js.map +1 -1
  34. package/dist/runtime/plan.d.ts +13 -0
  35. package/dist/runtime/plan.js +132 -79
  36. package/dist/runtime/plan.js.map +1 -1
  37. package/dist/runtime/policy-provenance.d.ts +17 -1
  38. package/dist/runtime/policy-provenance.js +42 -12
  39. package/dist/runtime/policy-provenance.js.map +1 -1
  40. package/dist/runtime/protocol-init.js +12 -7
  41. package/dist/runtime/protocol-init.js.map +1 -1
  42. package/dist/runtime/repair-packet.js +86 -4
  43. package/dist/runtime/repair-packet.js.map +1 -1
  44. package/dist/runtime/skills.d.ts +9 -0
  45. package/dist/runtime/skills.js +13 -0
  46. package/dist/runtime/skills.js.map +1 -1
  47. package/dist/runtime/state-explain.js +39 -7
  48. package/dist/runtime/state-explain.js.map +1 -1
  49. package/dist/runtime/state.js +36 -2
  50. package/dist/runtime/state.js.map +1 -1
  51. package/dist/runtime/task-context.d.ts +122 -0
  52. package/dist/runtime/task-context.js +1322 -0
  53. package/dist/runtime/task-context.js.map +1 -0
  54. package/dist/runtime/task-signals.d.ts +1 -0
  55. package/dist/runtime/task-signals.js +1 -1
  56. package/dist/runtime/task-signals.js.map +1 -1
  57. package/dist/runtime/ui-restoration.d.ts +3 -3
  58. package/dist/runtime/ui-restoration.js +3 -3
  59. package/dist/runtime/ui-restoration.js.map +1 -1
  60. package/dist/runtime/ui-source.d.ts +6 -0
  61. package/dist/runtime/ui-source.js +66 -0
  62. package/dist/runtime/ui-source.js.map +1 -0
  63. package/dist/runtime/verify.js +65 -25
  64. package/dist/runtime/verify.js.map +1 -1
  65. package/dist/schemas/types.d.ts +75 -2
  66. package/dist/schemas/validation.js +42 -7
  67. package/dist/schemas/validation.js.map +1 -1
  68. package/docs/DIRECTION.md +13 -11
  69. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # frontend-harness
2
2
 
3
- `frontend-harness` is an Execution Policy Layer for frontend teams using Codex or Claude Code.
3
+ `frontend-harness` is a context and evidence policy layer for frontend teams using Codex or Claude Code.
4
4
 
5
5
  It does not replace the agent runtime. Codex and Claude Code already provide the loop, tool execution, context handling, permissions, retries, subagents, and skill loading. `frontend-harness` adds the project-level rules those agents should follow inside a frontend repository.
6
6
 
@@ -10,16 +10,18 @@ The product goal is simple:
10
10
  install once -> inject AGENTS.md / CLAUDE.md -> work normally with AI
11
11
  ```
12
12
 
13
- After initialization, team members should not need to manually run the harness loop. They keep asking Codex or Claude Code for frontend work in plain language. The injected project protocol and built-in project skills tell the agent how to plan, edit, verify, and repair.
13
+ After initialization, team members should not need to manually run a heavy harness workflow for every task. They keep asking Codex or Claude Code for frontend work in plain language. The injected project protocol tells the agent when to use the full context, planning, evidence, and repair loop, and when ordinary task guidance is enough.
14
14
 
15
15
  ## What It Does
16
16
 
17
- `frontend-harness` gives a project a deterministic execution contract:
17
+ `frontend-harness` gives complex frontend tasks a deterministic execution contract:
18
18
 
19
19
  ```text
20
20
  context -> plan -> implement -> record changes -> verify -> repair -> done
21
21
  ```
22
22
 
23
+ The full loop is intended for work where source material, evidence, or traceability matters: design-backed UI restoration, PRD-derived product knowledge, multi-source frontend changes, and handoffs that need durable verification artifacts. Simple bug fixes, tests, docs, maintenance, and small requirement edits should stay lightweight unless the task includes explicit PRD, API, UI, or audit evidence.
24
+
23
25
  The CLI exists mainly as a protocol API for AI agents. Humans use it to install, initialize, and occasionally check health.
24
26
 
25
27
  ## What It Is Not
@@ -35,7 +37,7 @@ It should not rebuild:
35
37
  - long-running runtime launchers or supervised agent wrappers
36
38
  - replacement workflows for Codex or Claude Code
37
39
 
38
- Those belong to the official agent runtimes. This package owns only the frontend project policy around them.
40
+ Those belong to the official agent runtimes. This package owns only the frontend project context, policy, and evidence around them. It should not wrap ordinary agent conversation in process for its own sake.
39
41
 
40
42
  ## Install
41
43
 
@@ -115,7 +117,7 @@ Once those files are present, the normal team workflow is:
115
117
  ```text
116
118
  Open Codex or Claude Code.
117
119
  Ask for the frontend change.
118
- Let the injected protocol drive planning, verification, and repair.
120
+ Let the injected protocol decide whether the task needs the full harness loop or lightweight project guidance.
119
121
  ```
120
122
 
121
123
  ## Human Commands
@@ -146,9 +148,10 @@ These commands are intended for Codex / Claude Code through the injected protoco
146
148
 
147
149
  ```bash
148
150
  npm run harness -- context --json
151
+ npm run harness -- context task --json "<task>" --prd <prd-file> --api-source <openapi-file-or-url> --ui-source <ui-artifact-or-design-url>
149
152
  npm run harness -- proposal check --json --file <agent-proposal.json>
150
153
  npm run harness -- plan --json "<task>"
151
- npm run harness -- plan --json "<task>" --prd <prd-file> --ui-source <ui-artifact-or-design-url>
154
+ npm run harness -- plan --json "<task>" --prd <prd-file> --api-source <openapi-file-or-url> --ui-source <ui-artifact-or-design-url>
152
155
  npm run harness -- plan --json "<task>" --agent-proposal <agent-proposal.json>
153
156
  npm run harness -- state record-change <file>
154
157
  npm run harness -- state record-change --from-git
@@ -162,7 +165,7 @@ npm run harness -- state next --json
162
165
  npm run harness -- state explain --json
163
166
  ```
164
167
 
165
- The agent should call them automatically while doing work. They persist local state under `.frontend-harness/` and provide deterministic evidence for each step. `evidence template --json` prints the machine-readable evidence entry shape for the current plan; it is a schema aid, not proof. Put real captures, checks, comparisons, and hashes in a project-local evidence input JSON, then use `evidence record --json --file <evidence-input.json>` so the harness validates and writes `.frontend-harness/verification/evidence.json`. Captured evidence and visual comparison files are local intermediate artifacts by default; scaffolded projects ignore them and `clean` may remove them.
168
+ The agent should call them automatically when the task needs harness-managed context, planning, or evidence. They persist local state under `.frontend-harness/` and provide deterministic evidence for each step. `context task --json` emits a compact task packet from workflow policy, selected knowledge cards, explicit PRD/API/UI inputs, candidate project files, and ingest provenance so agents can use PRD/UI/API context without loading entire source materials into the prompt. `evidence template --json` prints the machine-readable evidence entry shape for the current plan; it is a schema aid, not proof. Put real captures, checks, comparisons, and hashes in a project-local evidence input JSON, then use `evidence record --json --file <evidence-input.json>` so the harness validates and writes `.frontend-harness/verification/evidence.json`. Captured evidence and visual comparison files are local intermediate artifacts by default; scaffolded projects ignore them and `clean` may remove them.
166
169
 
167
170
  `state check --json` verifies that recorded changed files cover the current plan's execution-unit files before verification. `verify --json` runs that contract check first, enforces PRD knowledge coverage when the plan has PRD input, and then discovers the default `typecheck`, `test`, and `build` scripts when present. Projects can also declare custom verification commands in `.frontend-harness/config.json`:
168
171
 
@@ -189,7 +192,7 @@ The agent should call them automatically while doing work. They persist local st
189
192
  - `documentation`
190
193
  - `maintenance`
191
194
 
192
- Each plan includes required knowledge actions, implementation constraints, and verification focus. This keeps generated UI imports, PRD digestion, Swagger/API work, tests, bug fixes, and requirement changes inside the same controlled policy loop without turning skills into executable runtime commands.
195
+ Each plan includes required knowledge actions, implementation constraints, and verification focus. UI restoration, PRD knowledge, explicit source-backed API work, and evidence-heavy changes use the full controlled loop. Ordinary tests, bug fixes, docs, maintenance, and requirement edits are intentionally lightweight policy guidance unless the task supplies PRD/API/UI source material or asks for auditable evidence. Project skills remain guidance, not executable runtime commands.
193
196
 
194
197
  ### Agent Plan Proposals
195
198
 
@@ -251,7 +254,12 @@ These commands expose project-local knowledge and workflow guidance as provenanc
251
254
  ```bash
252
255
  npm run harness -- skills list --json
253
256
  npm run harness -- skills check --json
257
+ npm run harness -- ingest record --json --kind prd|openapi|ui-package --id <source-id> --source <file-or-url> --summary "<summary>"
258
+ npm run harness -- ingest list --json
259
+ npm run harness -- ingest show --json --ref ingest://<kind>/<source-id>
254
260
  npm run harness -- knowledge add --json --kind rule --subject "<subject>" --rule "<rule>"
261
+ npm run harness -- knowledge outline --json --ref ingest://<kind>/<source-id>
262
+ npm run harness -- knowledge draft --json --ref ingest://<kind>/<source-id>
255
263
  npm run harness -- knowledge promote --json --title "<title>" --body "<body>"
256
264
  npm run harness -- knowledge update --json --id <knowledge-id> --source "docs/prd/<file>.md"
257
265
  npm run harness -- knowledge index --json
@@ -262,7 +270,7 @@ npm run harness -- knowledge show --json --id <knowledge-id>
262
270
  npm run harness -- knowledge check --json
263
271
  ```
264
272
 
265
- Prefer `knowledge add` for PRD digestion. It stores small atomic entries such as rules, workflows, permissions, terms, decisions, conventions, and pitfalls with `source_paths` pointing back to the original PRD. Use `knowledge update` when a requirement changes so existing cards are merged instead of duplicated. `knowledge index` writes `.frontend-harness/knowledge/index.json`, a deterministic manifest grouped by PRD source, card id, scope, and tag. `knowledge coverage` verifies active PRD semantics remain traceable to source documents. `knowledge promote` remains available for authored Markdown cards, but raw PRD prose should stay in source documents instead of being copied into knowledge.
273
+ Prefer `knowledge add` for PRD digestion. It stores small atomic entries such as rules, workflows, permissions, terms, decisions, conventions, and pitfalls with `source_paths` pointing back to a project file, external reference, or `ingest://...` provenance record. Use `ingest record` when PRD, OpenAPI, or UI package material is temporary but the distilled knowledge needs a lightweight source proof. Use `knowledge outline` for project-file PRD Markdown to turn the source heading structure into a deterministic checklist with suggested knowledge kinds and extraction-required hints. Use `knowledge draft` to turn an ingest record into reviewed `knowledge add` / `knowledge module` scaffolds; for PRD Markdown, `extractionItems` is the source checklist and each required block should be added, updated, or explicitly skipped with a reason. Do not add scaffolds unchanged. When existing cards already point at the same ingest record, produced card IDs, or source file, draft output includes `knowledge update` candidates so agents can merge before adding duplicates. Use `knowledge update` when a requirement changes so existing cards are merged instead of duplicated. `knowledge index` writes `.frontend-harness/knowledge/index.json`, a deterministic manifest grouped by PRD source, card id, scope, and tag. `knowledge coverage` verifies active PRD semantics remain traceable to source documents or ingest provenance. `knowledge promote` remains available for authored Markdown cards, but raw PRD prose should stay in source documents or temporary ingest inputs instead of being copied into knowledge.
266
274
 
267
275
  ## Runtime Boundary
268
276
 
@@ -272,7 +280,7 @@ The boundary is strict:
272
280
  - `frontend-harness` owns policy.
273
281
  - The project owns durable state and knowledge.
274
282
 
275
- Project skills under `.frontend-harness/skills/` are policy guidance and provenance for planning. They are intentionally separate from Codex or Claude runtime skills installed in the developer environment.
283
+ Project skills under `.frontend-harness/skills/` are policy guidance and provenance for planning. They are intentionally separate from Codex or Claude runtime skills installed in the developer environment. For simple tasks, they should be enough on their own; the harness should not force a full stateful loop when direct agent conversation plus local verification is cheaper.
276
284
 
277
285
  That means `frontend-harness` should stay small and focused. Its job is to make frontend work repeatable, not to become a second runtime.
278
286