@williambeto/ai-workflow 2.4.9 → 2.6.4

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 (103) hide show
  1. package/CHANGELOG.md +1138 -168
  2. package/README.md +203 -77
  3. package/bin/ai-workflow.d.ts +3 -0
  4. package/bin/ai-workflow.js +2669 -1
  5. package/bin/ai-workflow.js.map +1 -0
  6. package/chunk-2AOV2ATY.js +749 -0
  7. package/chunk-5WRI5ZAA.js +31 -0
  8. package/chunk-6EMG6FAO.js +734 -0
  9. package/chunk-UHLZX2EG.js +1827 -0
  10. package/core/index.d.ts +440 -0
  11. package/core/index.js +32 -0
  12. package/core/index.js.map +1 -0
  13. package/dist-assets/AGENTS.md +23 -6
  14. package/dist-assets/agents/atlas.md +8 -8
  15. package/dist-assets/agents/nexus.md +4 -4
  16. package/dist-assets/agents/orion.md +1 -1
  17. package/dist-assets/agents/phoenix.md +1 -1
  18. package/dist-assets/agents/sage.md +1 -1
  19. package/dist-assets/commands/implement.md +1 -1
  20. package/dist-assets/docs/QUICKSTART.md +8 -8
  21. package/dist-assets/docs/cli-reference.md +7 -7
  22. package/dist-assets/docs/compatibility/provider-usage.md +1 -9
  23. package/dist-assets/docs/compatibility/runtime-matrix.md +5 -6
  24. package/dist-assets/docs/consumer-onboarding.md +2 -2
  25. package/dist-assets/docs/design-patterns-policy.md +1 -1
  26. package/dist-assets/docs/npm-consumer-quickstart.md +70 -109
  27. package/dist-assets/docs/policies/01-BRANCH_GATE.md +1 -1
  28. package/dist-assets/docs/policies/06-FINAL_EVIDENCE_CONTRACT.md +2 -2
  29. package/dist-assets/docs/policies/08-PRODUCT_TRUTHFULNESS_AND_PROJECT_DOCS.md +1 -1
  30. package/dist-assets/docs/policies/10-BEHAVIORAL_CONTRACT_HARDENING.md +1 -1
  31. package/dist-assets/docs/policies/ORCHESTRATION_PROTOCOL.md +8 -9
  32. package/dist-assets/docs/policies/PROCEDURE_DELIVERY_ARTIFACTS.md +4 -10
  33. package/dist-assets/docs/policies/SKILLS_COMMON_GOVERNANCE.md +1 -1
  34. package/dist-assets/docs/profiles/README.md +2 -2
  35. package/dist-assets/docs/specs/runtime-operational-contract.md +12 -12
  36. package/dist-assets/docs/troubleshooting-guide.md +2 -2
  37. package/dist-assets/docs/visual-validation-guide.md +3 -3
  38. package/dist-assets/schemas/evidence.schema.json +109 -0
  39. package/dist-assets/templates/ANTIGRAVITY.md.template +7 -5
  40. package/dist-assets/templates/CLAUDE.md.template +7 -5
  41. package/dist-assets/templates/CODEX.md.template +7 -5
  42. package/evidence-validator-76ZQQYDU.js +6661 -0
  43. package/package.json +7 -64
  44. package/{src/core/workspace/read-only-workspace.js → read-only-workspace-PZBE7KAX.js} +14 -31
  45. package/{src/commands/validate.js → validate-Q2NLLQ5G.js} +30 -22
  46. package/AGENTS.md +0 -34
  47. package/PUBLISH_MANIFEST.json +0 -34
  48. package/dist-assets/templates/.geminiignore.template +0 -8
  49. package/dist-assets/templates/GEMINI.md.template +0 -20
  50. package/docs/compatibility/provider-usage.md +0 -46
  51. package/docs/compatibility/runtime-matrix.md +0 -31
  52. package/docs/getting-started/DESKTOP_PROMPT.md +0 -52
  53. package/docs/getting-started/authoring-custom-skills.md +0 -80
  54. package/docs/getting-started/quickstart.md +0 -117
  55. package/docs/getting-started/troubleshooting.md +0 -123
  56. package/docs/getting-started/upgrading-to-v2.md +0 -62
  57. package/src/adapters/index.js +0 -4
  58. package/src/adapters/platforms/antigravity.js +0 -382
  59. package/src/adapters/platforms/claude.js +0 -126
  60. package/src/adapters/platforms/codex.js +0 -113
  61. package/src/adapters/platforms/gemini.js +0 -245
  62. package/src/cli.js +0 -155
  63. package/src/commands/clean.js +0 -106
  64. package/src/commands/collect-evidence.js +0 -25
  65. package/src/commands/doctor.js +0 -202
  66. package/src/commands/execute.js +0 -382
  67. package/src/commands/init.js +0 -359
  68. package/src/commands/run.js +0 -112
  69. package/src/core/backup.js +0 -65
  70. package/src/core/completion-contract.js +0 -35
  71. package/src/core/delegation-controller.js +0 -193
  72. package/src/core/evidence/evidence-ledger.js +0 -98
  73. package/src/core/execution-planner.js +0 -62
  74. package/src/core/filesystem.js +0 -141
  75. package/src/core/finalization/finalizer.js +0 -165
  76. package/src/core/finalization/workspace-snapshot.js +0 -110
  77. package/src/core/gates/branch-gate.js +0 -134
  78. package/src/core/gates/merge-gate.js +0 -74
  79. package/src/core/handoff/handoff-engine.js +0 -104
  80. package/src/core/healing/cli-remediation-executor.js +0 -153
  81. package/src/core/healing/healer-engine.js +0 -212
  82. package/src/core/healing/runtime-remediation-executor.js +0 -136
  83. package/src/core/identity.js +0 -43
  84. package/src/core/install-plan.js +0 -34
  85. package/src/core/opencode-merge.js +0 -150
  86. package/src/core/package-assets.js +0 -141
  87. package/src/core/request-classifier.js +0 -73
  88. package/src/core/request-router.js +0 -289
  89. package/src/core/runtime/opencode-adapter.js +0 -202
  90. package/src/core/sdd/validator.js +0 -67
  91. package/src/core/statuses.js +0 -29
  92. package/src/core/symlink-layout.js +0 -93
  93. package/src/core/templates.js +0 -229
  94. package/src/core/validation/artifact-fidelity-gate.js +0 -445
  95. package/src/core/validation/canonical-finalization.js +0 -43
  96. package/src/core/validation/delivery-decision-engine.js +0 -344
  97. package/src/core/validation/evidence-collector.js +0 -245
  98. package/src/core/validation/quality-guard.js +0 -251
  99. package/src/core/validation/stack-detector.js +0 -65
  100. package/src/core/validation/validation-planner.js +0 -134
  101. package/src/core/validation/visual-verifier.js +0 -175
  102. package/src/core/workflow-profiles.js +0 -107
  103. package/src/core/workflow-state-machine.js +0 -46
package/README.md CHANGED
@@ -1,129 +1,255 @@
1
+ <div align="center">
2
+
1
3
  # AI Workflow Kit
2
4
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
- [![npm version](https://img.shields.io/npm/v/@williambeto/ai-workflow)](https://www.npmjs.com/package/@williambeto/ai-workflow)
5
+ **Workflow before code. Evidence before trust.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@williambeto/ai-workflow?style=flat-square&color=0066cc)](https://www.npmjs.com/package/@williambeto/ai-workflow)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
9
+ [![Node Version](https://img.shields.io/badge/node-%3E%3D20.11-brightgreen.svg?style=flat-square)](package.json)
10
+ [![Language](https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square)](tsconfig.json)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## What is AI Workflow Kit?
17
+
18
+ AI Workflow Kit (AIWK) is an **npm CLI** you install in your project that makes AI-assisted software delivery **safe, structured, and verifiable**.
19
+
20
+ It works with [OpenCode](https://opencode.ai) to turn a natural language request into a full delivery — with branch protection, specialist agent delegation, automated validation, and a persisted evidence log.
21
+
22
+ **Without AIWK**, a coding agent receives a request, writes code, and reports success. There is no proof, no branch isolation, and no guarantee that tests passed.
23
+
24
+ **With AIWK**, the same request travels through a mandatory workflow:
25
+
26
+ ```
27
+ Your request → Classification → Branch Gate → Specialist Agent
28
+ → Automated Validation → Evidence → Handoff
29
+ ```
30
+
31
+ No step can be skipped. No claim of success is made without proof.
32
+
33
+ ---
5
34
 
6
- The AI Workflow Kit is an npm/CLI package that installs a suite of agents, commands, skills, policies, and templates to guide a coding agent inside a project.
35
+ ## The problem it solves
7
36
 
8
- The central promise is:
37
+ Coding agents are fast but undisciplined. Left to their own devices, they:
9
38
 
10
- > "Transform a natural language request into a proportionate, safe, and verifiable software delivery."
39
+ - Write directly to `main` without a feature branch
40
+ - Skip tests if they think the change is "simple"
41
+ - Report `Done!` without any verifiable trace of what happened
42
+ - Mix discovery, implementation, and validation into one unstructured loop
11
43
 
12
- The workflow the product guarantees is:
44
+ AI Workflow Kit enforces a contract: **the agent must earn the right to deliver.**
13
45
 
14
- 1. **Request**: Understand the actual request.
15
- 2. **Planning**: Select the execution mode and workflow profile.
16
- 3. **Branch Gate**: Never implement directly on main/master.
17
- 4. **Delegation**: Atlas routes; Astra implements; Sage validates when appropriate; Phoenix remediates within a defined limit.
18
- 5. **Implementation**: Deliver useful code, not just reports.
19
- 6. **Validation**: Run observed validations and relevant tests, blocking false success.
20
- 7. **Evidence**: Summarize changes, validations, and limitations.
46
+ ---
21
47
 
22
- In practice, the kit is neither a frontend framework nor a UI library. It is an operational layer for software agents: it installs instructions and guardrails so that the agent can work more effectively inside the user's repository.
48
+ ## How it works
23
49
 
24
- ## Installation and Usage
50
+ AIWK installs a structured team of 6 specialist agents into your repository. Each agent has a defined role, a permission boundary, and cannot claim work that belongs to another.
25
51
 
26
- ### First-time usage
52
+ When you run `npx aw execute "your task"`, Atlas (the coordinator) takes over:
27
53
 
28
- Use the full package command when running the kit before it is installed in a project:
54
+ | Step | Who | What happens |
55
+ |:---|:---|:---|
56
+ | **1. Classify** | Atlas | Reads the request, assigns risk level (low / medium / high), selects evidence and spec policies |
57
+ | **2. Branch Gate** | Atlas | Creates `feat/<task>` from `main`. **Never writes to protected branches.** |
58
+ | **3. Plan** | Nexus / Orion | Writes a specification (when required by risk level) |
59
+ | **4. Implement** | Astra | Implements the change on the feature branch |
60
+ | **5. Validate** | Sage | Runs tests, accessibility checks, visual regression — writes evidence |
61
+ | **6. Remediate** | Phoenix | If validation fails, Phoenix heals within a bounded attempt limit |
62
+ | **7. Evidence** | Atlas | Saves `EVIDENCE.json` + `HANDOFF-<task>.md` to `.ai-workflow/` |
63
+
64
+ > **Proportional by design.** A typo fix in a README gets 1 remediation attempt and no spec. A payment integration gets 3 attempts, a required SDD, and mandatory persisted evidence. The kit calibrates automatically.
65
+
66
+ ---
67
+
68
+ ## Quick Start
69
+
70
+ ### Prerequisites
71
+
72
+ - Node.js ≥ 20.11
73
+ - Git repository initialised (`git init`)
74
+ - [OpenCode](https://opencode.ai) runtime installed
75
+
76
+ ### 1. Install
77
+
78
+ ```bash
79
+ npm install -D @williambeto/ai-workflow
80
+ ```
81
+
82
+ ### 2. Initialise
29
83
 
30
84
  ```bash
31
- npx @williambeto/ai-workflow init
85
+ npx aw init --yes
32
86
  ```
33
87
 
34
- ### Short alias after installation
88
+ This creates the `.ai-workflow/` directory and installs 6 agents, 25 skills, and all policies into your project:
89
+
90
+ ```
91
+ ✔ Created .ai-workflow/
92
+ ✔ Created opencode.jsonc
93
+ ✔ Updated .gitignore
94
+ ✔ Installed 6 agents, 25 skills, 14 commands, 11 policies
95
+ ```
35
96
 
36
- After installing AI Workflow Kit in a project, the shorter `aw` binary is available through `node_modules/.bin`:
97
+ ### 3. Run your first task
37
98
 
38
99
  ```bash
39
- npm install -D @williambeto/ai-workflow
100
+ npx aw execute "Add a health check endpoint returning HTTP 200"
101
+ ```
102
+
103
+ Atlas classifies the request, creates a branch, delegates to Astra, validates with Sage, and writes evidence — all automatically.
104
+
105
+ ### 4. Check the evidence
106
+
107
+ ```bash
108
+ npx aw collect-evidence
109
+ ```
40
110
 
41
- npx aw init
42
- npx aw doctor
43
- npx aw run "Atlas, list all agents, subagents, skills, and commands in the project. Present them in a table with their name, description, and usage examples."
111
+ ```
112
+ --- Delivery Summary ---
113
+ Status: COMPLETED
114
+ Branch: feat/health-check
115
+ Changes: src/routes/health.js, tests/health.test.js
116
+ Validation: npm test: PASS
117
+ Limitations: None recorded
44
118
  ```
45
119
 
46
- The `aw` binary is an alias for the same CLI entrypoint as `ai-workflow`.
120
+ > **Using Antigravity IDE?** Run `npx aw init --yes --antigravity` to enable Atlas directly from the agent selector dropdown.
47
121
 
48
- The CLI receives the natural request, classifies the intent, plans the workflow, switch/creates branch safely, delegates coding tasks to the OpenCode runtime adapter, validates changes, and runs bounded remediation if necessary before outputting the handoff summary.
122
+ ---
49
123
 
50
- ### Visual & Accessibility (A11y) Requirements
124
+ ## The Agent Team
51
125
 
52
- For projects utilizing visual validation (screenshots) or accessibility audits (Axe-core), ensure you have:
53
- - `playwright` (or `@playwright/test`) and `axe-core` installed under `devDependencies`.
54
- - Browser binaries installed on the host machine by running `npx playwright install` (specifically Chromium).
126
+ Each agent has a fixed role and cannot exceed its operational boundary.
55
127
 
56
- If these dependencies or browser binaries are missing, the visual and accessibility validations will fail gracefully with warning logs or block depending on CLI validation options.
128
+ | Agent | Role | What it does |
129
+ |:---|:---|:---|
130
+ | 🧭 **Atlas** | Coordinator | Classifies requests, manages branches, routes to specialists |
131
+ | 🔍 **Nexus** | Analyst | Researches codebase, defines requirements, authors specifications |
132
+ | 📅 **Orion** | Planner | Sequences pull requests, coordinates releases and planning |
133
+ | 💻 **Astra** | Engineer | Implements code changes safely on isolated feature branches |
134
+ | 🧪 **Sage** | Validator | Audits changes, runs quality gates, writes verifiable evidence |
135
+ | 🔧 **Phoenix** | Recovery | Heals broken states within a bounded remediation limit |
57
136
 
58
- ## Modes and profiles
137
+ Agents are installed as prompts in your `.ai-workflow/agents/` directory. You can read, audit, or customise them.
59
138
 
60
- | Mode | Use for | Primary evidence |
61
- | --- | --- | --- |
62
- | `quick` | Small, focused, low-risk work | Concise summary with targeted validation |
63
- | `standard` | Normal scoped feature or application work | Branch, changed areas, commands/results, limitations |
64
- | `full` | Broad, risky, architectural, migration, security, or release work | Independent validation and persisted evidence |
139
+ ---
65
140
 
66
- Execution mode controls artifact depth; workflow profile controls domain guidance.
141
+ ## CLI Commands
67
142
 
68
- Examples:
143
+ | Command | Description |
144
+ |:---|:---|
145
+ | `npx aw execute "<request>"` | Run the full workflow from a natural language request |
146
+ | `npx aw run --spec-path=<path>` | Run implementation against an existing specification |
147
+ | `npx aw validate` | Execute all quality gates manually |
148
+ | `npx aw collect-evidence` | Collect and compile delivery evidence to `EVIDENCE.json` |
149
+ | `npx aw doctor` | Diagnose installation health |
150
+ | `npx aw clean` | Remove all AIWK configuration from the project |
69
151
 
70
- - `frontend-product` for landing pages and public product surfaces;
71
- - `frontend-utility` for validators, search pages, forms, dashboards, and focused tools;
72
- - `backend-api`, `refactor`, `documentation`, and `security-review` for their respective domains.
152
+ ---
73
153
 
74
- Profiles select relevant skills and objective checks. They do not force a fixed page structure, pricing, testimonials, or subjective visual style. See `.ai-workflow/docs/profiles/` after initialization.
154
+ ## Risk Levels and Policies
75
155
 
76
- ## Consumer files
156
+ AIWK automatically assigns a risk level to every request. Policies scale accordingly.
77
157
 
78
- Initialization creates the managed workflow under `.ai-workflow/` and integrates runtime-specific files where requested. Start with:
158
+ | Signal in your request | Risk | Spec required | Evidence persisted | Remediation attempts |
159
+ |:---|:---:|:---:|:---:|:---:|
160
+ | "fix typo in README" | Low | No | No | 1 |
161
+ | "refactor auth module" | Medium | No | Optional | 2 |
162
+ | "publish to npm", "payment integration" | High | **Yes** | **Yes** | 3 |
79
163
 
80
- - `.ai-workflow/QUICKSTART.md`
81
- - `.ai-workflow/docs/compatibility/runtime-matrix.md`
82
- - `.ai-workflow/docs/compatibility/provider-usage.md`
83
- - `.ai-workflow/AGENTS.md`
84
- - `opencode.jsonc`
164
+ You don't configure this. The kit reads your request and calibrates automatically.
85
165
 
86
- Optional provider adapters can also generate `CLAUDE.md`, `GEMINI.md`, and Codex agent assets.
166
+ ---
87
167
 
88
- ## Documentation
168
+ ## What gets installed in your project
89
169
 
90
- For full guides, tutorials, and specifications, visit the [AI Workflow Kit Documentation Website](https://ai-workflow-kit-site.pages.dev/).
170
+ Running `npx aw init` writes the following into your repository:
91
171
 
92
- ### Local Consumer Files (created after `init`)
172
+ ```
173
+ .ai-workflow/
174
+ ├── agents/ # Atlas, Nexus, Orion, Astra, Sage, Phoenix prompts
175
+ ├── commands/ # Slash commands for your AI IDE
176
+ ├── skills/ # 25 domain skills (architecture, security, database, ...)
177
+ ├── templates/ # Specification and handoff templates
178
+ ├── policies/ # Branch gate, quality gate, merge gate policies
179
+ ├── history/ # Ledger of every workflow execution
180
+ └── handoffs/ # HANDOFF-<task>.md for every completed delivery
181
+ opencode.jsonc # OpenCode runtime configuration
182
+ ```
93
183
 
94
- When you initialize the kit in your project with `ai-workflow init`, the following guides are created locally in your `.ai-workflow/` folder:
184
+ Everything is plain text readable, auditable, and version-controlled.
95
185
 
96
- - **Getting Started**: `.ai-workflow/QUICKSTART.md`
97
- - **Architectural Policy**: `.ai-workflow/docs/architecture-policy.md`
98
- - **Design Conventions**: `.ai-workflow/docs/design-patterns-policy.md`
99
- - **Visual E2E Validation**: `.ai-workflow/docs/visual-validation-guide.md`
100
- - **Compatibility Matrix**: `.ai-workflow/docs/compatibility/runtime-matrix.md`
101
- - **Platform Governance**: `.ai-workflow/AGENTS.md`
186
+ ---
102
187
 
103
- ## Statuses
188
+ ## Safety Guarantees
104
189
 
105
- - `PASS`
106
- - `PASS_WITH_NOTES`
107
- - `FAIL_QUALITY_GATE`
108
- - `FAIL_DELEGATION_GATE`
109
- - `BLOCKED`
190
+ - **Branch protection**: execution is always blocked on `main`/`master`. A feature branch is created automatically.
191
+ - **Read-only confinement**: tasks classified as read-only are cryptographically verified — any file mutation blocks the execution.
192
+ - **Bounded remediation**: Phoenix is limited to N attempts. The kit never loops indefinitely.
193
+ - **Mandatory handoff**: every write-mode execution produces a `HANDOFF-<task>.md` with evidence, diff, and status — regardless of risk level.
194
+ - **Schema-validated evidence**: `EVIDENCE.json` is validated against a strict Ajv schema. Path traversal and shell injection are blocked.
110
195
 
111
- The generated consumer quickstart explains the public states `COMPLETED`, `COMPLETED_WITH_NOTES`, and `BLOCKED`.
196
+ ---
112
197
 
113
- ## Repository maintenance
198
+ ## Skills
114
199
 
115
- The following paths are internal implementation sources for maintainers and are not consumer paths:
200
+ Beyond the 6 core agents, AIWK ships 25 domain skills that agents activate as context lenses when the request profile warrants it. You can also author your own:
201
+
202
+ ```
203
+ .ai-workflow/skills/
204
+ ├── architecture/
205
+ ├── backend-development/
206
+ ├── cyber-security/ # activated by Sage on audit tasks
207
+ ├── database/ # activated by Astra on schema work
208
+ ├── frontend-design-system/
209
+ ├── performance/
210
+ ├── qa-workflow/
211
+ └── ... 18 more
212
+ ```
116
213
 
117
- - `dist-assets/**` files packaged and installed into consumers
118
- - `src/**` — CLI and runtime implementation
119
- - `internal/**` — validators, build, and release tooling
214
+ [Custom Skill Authoring Guide](docs/getting-started/authoring-custom-skills.md)
120
215
 
121
- Do not instruct package consumers to edit `dist-assets/**` directly.
216
+ ---
217
+
218
+ ## Documentation
219
+
220
+ | Guide | Description |
221
+ |:---|:---|
222
+ | [Quickstart](docs/getting-started/quickstart.md) | Step-by-step 5-minute setup |
223
+ | [Upgrading to v2](docs/getting-started/upgrading-to-v2.md) | Migration from v1 |
224
+ | [Visual Validation Guide](dist-assets/docs/visual-validation-guide.md) | Screenshot and layout regression testing |
225
+ | [Custom Skill Authoring](docs/getting-started/authoring-custom-skills.md) | Write project-specific guidance |
226
+ | [CHANGELOG](CHANGELOG.md) | Full version history |
227
+ | [Site](https://ai-workflow-kit-site.pages.dev/) | Official documentation site |
228
+
229
+ ---
230
+
231
+ ## Contributing
232
+
233
+ AIWK uses itself to manage its own development. To contribute:
234
+
235
+ ```
236
+ src/ TypeScript source (CLI + Core)
237
+ dist-assets/ Templates, agents, skills, schemas installed into consumer repos
238
+ tests/ Unit (296 tests) and E2E (19 tests) suites
239
+ internal/ Validation pipelines and release scripts
240
+ docs/ Guides, ADRs, specs, and release notes
241
+ ```
242
+
243
+ Run the full validation suite before submitting a pull request:
244
+
245
+ ```bash
246
+ npm run validate
247
+ ```
122
248
 
123
- ## Compatibility
249
+ All 22 quality gates must pass.
124
250
 
125
- OpenCode is the primary runtime. Codex and Claude Code are supported with documented limitations. Gemini CLI is experimental. Adapter generation does not guarantee identical runtime behavior.
251
+ ---
126
252
 
127
253
  ## License
128
254
 
129
- [MIT](LICENSE) © José Willams.
255
+ MIT © José Willams
@@ -0,0 +1,3 @@
1
+ declare function runCli(args: string[]): Promise<void>;
2
+
3
+ export { runCli };