@williambeto/ai-workflow 2.4.6 → 2.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [2.4.7] - 2026-06-27
2
+
3
+ ### Added
4
+ - Integrated `@vitest/coverage-v8` to compute code coverage, establishing a strict **80% minimum threshold** for lines, functions, branches, and statements in `vitest.config.js`.
5
+ - Added the `npm run test:coverage` script in `package.json` for easy local and CI coverage reporting.
6
+ - Created the official community Code of Conduct template at `.github/CODE_OF_CONDUCT.md` with maintainer contact method.
7
+ - Excluded the `coverage/` directory from git tracking in `.gitignore`.
8
+
9
+ ### Fixed
10
+ - Mitigated shell injection risks in the `cli-remediation-executor.js` by removing the insecure `shell:true` parameter and spawning native subprocess commands directly via platform detection (`npm` on POSIX and `npm.cmd` on Windows).
11
+ - Fixed 3 failing unit tests in `visual-verifier.test.js` to align with the CSS variables flexibilization threshold (>200 chars) introduced in v2.4.6.
12
+ - Documented `ai-workflow clean` limitations regarding the absolute deletion of custom `opencode.jsonc` configs in `cli-reference.md` and `troubleshooting.md`.
13
+
14
+ ### Changed
15
+ - Bumped and updated development dependencies (dev-dependencies group) to their latest stable versions for security and build stability.
16
+
17
+ ## [2.4.6] - 2026-06-25
18
+
19
+ ### Fixed
20
+ - Flexibilized Design System CSS variables check in `ArtifactFidelityGate` to only enforce the validation when CSS rules volume is substantial (>200 characters), preventing false-positive blocks on tiny or simple style additions.
21
+
1
22
  ## [2.4.5] - 2026-06-24
2
23
 
3
24
  ### Changed
@@ -40,6 +40,7 @@ Atlas must:
40
40
  ## Constraints
41
41
  * **Full Mode Sequence Enforcement**: In `full` mode, Atlas must strictly enforce that the workflow runs sequentially through `discover`, `spec-create`, `spec-review`, and `plan` phases before any implementation or coding starts. Jumping directly to implementation is forbidden.
42
42
  * **Authoritative Routing Integrity**: Atlas must routing-delegate requests strictly according to agent capabilities (e.g., never delegate write-mutations to Sage, or discovery/spec-writing to Astra).
43
+ * **Implementation Delegation Constraint**: Atlas must never perform dynamic code writing or logic modification of source files directly. Any code changes (excluding pure documentation, README updates, or spelling typos) must be delegated to Astra.
43
44
  * **Quality Gate Authoritativeness**: Any non-zero exit code or `BLOCKED` status from a safety gate, validation check, or finalizer command must immediately halt the pipeline.
44
45
  * Never write on `main`, `master`, or another protected branch.
45
46
  * If the protected branch is clean or has only preservable untracked files, create a scoped branch before editing.
@@ -56,7 +57,7 @@ Atlas must:
56
57
 
57
58
  ## Forbidden actions
58
59
  * Silently execute specialized work when another actor is selected.
59
- * Implement feature code directly when Astra should execute.
60
+ * Implement feature code or modify source code files directly (always delegate to Astra if writing code).
60
61
  * Validate its own implementation as final evidence.
61
62
  * `npm publish`
62
63
  * `git push` to protected branches (main, master), or to remote without explicit user approval in the chat.
@@ -81,7 +82,7 @@ Atlas must:
81
82
  3. For quick or standard tasks:
82
83
  * Inspect status.
83
84
  * Recover branch if needed.
84
- * Perform/coordinate edits.
85
+ * Coordinate and delegate any code-source modifications to Astra (Atlas must never execute code implementation directly).
85
86
  * Run validation.
86
87
  * For every write-capable quick or standard task, Atlas must run the package finalizer after the final implementation changes and before reporting success:
87
88
  ```bash
@@ -1,55 +1,207 @@
1
- # CLI reference
1
+ # CLI Reference
2
+
3
+ Complete reference for all `ai-workflow` (alias: `aw`) commands.
4
+
5
+ ## Global Usage
6
+
7
+ ```
8
+ ai-workflow <command> [options]
9
+ ai-workflow --version
10
+ ai-workflow --help
11
+ ```
12
+
13
+ ---
14
+
15
+ ## `ai-workflow init`
16
+
17
+ Installs AI Workflow Kit assets into a consumer project.
18
+
19
+ **Synopsis:**
20
+ ```bash
21
+ ai-workflow init [--yes] [--force] [--dry-run] [--no-install] [--no-overwrite] [--profile=<profile>] [--gemini] [--claude] [--codex] [--antigravity]
22
+ ```
23
+
24
+ **Description:**
25
+ Creates the `.ai-workflow/` directory with agents, skills, commands, policies, and templates. Generates `opencode.jsonc`, updates `.gitignore`, and creates symlinks for `opencode` and `.agents`.
26
+
27
+ | Flag | Description |
28
+ | --- | --- |
29
+ | `--yes` | Auto-approve all confirmations |
30
+ | `--force` | Force overwrite existing files (backs up originals to `.ai-workflow-backups/`) |
31
+ | `--dry-run` | Print actions without applying any changes |
32
+ | `--no-install` | Skip installing npm dependencies |
33
+ | `--no-overwrite` | Do not overwrite any existing files |
34
+ | `--profile=<profile>` | Installation profile: `standard` (default) or `full` (includes examples) |
35
+ | `--gemini` | Install Gemini platform adapter configuration |
36
+ | `--claude` | Install Claude platform adapter configuration |
37
+ | `--codex` | Install Codex platform adapter configuration |
38
+ | `--antigravity` | Install Antigravity platform adapter configuration |
39
+
40
+ **Example:**
41
+ ```bash
42
+ ai-workflow init --yes --profile=full --gemini --claude
43
+ ```
44
+
45
+ ---
2
46
 
3
47
  ## `ai-workflow execute`
4
48
 
5
- Orchestrate execution of a natural request through the state machine.
49
+ Orchestrates execution of a natural language request through the workflow state machine.
50
+
51
+ **Synopsis:**
52
+ ```bash
53
+ ai-workflow execute "<request>" [--task=<slug>] [--request="<request>"]
54
+ ```
55
+
56
+ **Description:**
57
+ Accepts a natural language request, classifies intent, selects the appropriate workflow mode, creates a safe branch, delegates to the right agent, runs observed validation, and returns a structured delivery summary.
6
58
 
7
59
  | Flag | Description |
8
60
  | --- | --- |
9
- | `--task=<slug>` | Optional custom task slug for the workflow execution. |
10
- | `--request=<request>` | Positional or named natural language request. |
61
+ | `"<request>"` | Positional argument: the natural language request |
62
+ | `--request="<request>"` | Named alternative for the request string |
63
+ | `--task=<slug>` | Optional custom task slug for the workflow execution |
64
+
65
+ **Example:**
66
+ ```bash
67
+ ai-workflow execute "Add input validation to the user registration form"
68
+ ai-workflow execute --request="Refactor the database module" --task=db-refactor
69
+ ```
70
+
71
+ ---
11
72
 
12
73
  ## `ai-workflow run`
13
74
 
14
- Runs formal orchestration for an approved specification. It enforces branch safety, observed validation, bounded remediation, and handoff generation.
75
+ Runs formal orchestration for an approved specification with branch safety, observed validation, bounded remediation, and handoff generation.
76
+
77
+ **Synopsis:**
78
+ ```bash
79
+ ai-workflow run --spec-path=<path>
80
+ ```
81
+
82
+ **Description:**
83
+ Reads an approved specification file and orchestrates the full implementation workflow. Enforces branch gate safety, runs validation commands, applies bounded remediation (up to configured attempt limits), and generates a handoff summary.
15
84
 
16
85
  | Flag | Description |
17
86
  | --- | --- |
18
- | `--spec-path=<path>` | Path to the approved specification file. |
87
+ | `--spec-path=<path>` | Path to the approved specification file (required) |
19
88
 
20
- ## `ai-workflow init`
89
+ **Example:**
90
+ ```bash
91
+ ai-workflow run --spec-path=.ai-workflow/specs/feature-auth.md
92
+ ```
93
+
94
+ ---
95
+
96
+ ## `ai-workflow validate`
97
+
98
+ Runs the project validation suite including tests, linting, and quality checks.
99
+
100
+ **Synopsis:**
101
+ ```bash
102
+ ai-workflow validate [--a11y] [--visual-dist=<path>] [--port=<port>]
103
+ ```
21
104
 
22
- Installs the OpenCode-first workflow assets into a consumer project.
105
+ **Description:**
106
+ Executes the project's configured validation commands (`npm test`, `npm run lint`, `npm run build`, etc.) and optionally runs visual regression and accessibility checks.
23
107
 
24
108
  | Flag | Description |
25
109
  | --- | --- |
26
- | `--yes` | Auto-approve all confirmations. |
27
- | `--force` | Force overwrite existing files. |
28
- | `--dry-run` | Print actions without applying changes. |
29
- | `--no-install` | Skip installing dependencies. |
30
- | `--no-overwrite` | Do not overwrite existing files. |
31
- | `--gemini` | Install Gemini-specific configurations. |
32
- | `--claude` | Install Claude-specific configurations. |
33
- | `--codex` | Install Codex-specific configurations. |
34
- | `--antigravity` | Install Antigravity-specific configurations. |
35
- | `--profile=<profile>` | Specify installation profile (e.g. `standard`, `full`). |
110
+ | `--a11y` | Run accessibility audit using Axe-core (requires Playwright) |
111
+ | `--visual-dist=<path>` | Path to the built frontend assets for visual validation |
112
+ | `--port=<port>` | Port to serve the frontend assets on for screenshot capture |
113
+
114
+ **Example:**
115
+ ```bash
116
+ ai-workflow validate
117
+ ai-workflow validate --a11y --visual-dist=dist --port=3000
118
+ ```
119
+
120
+ ---
36
121
 
37
122
  ## `ai-workflow collect-evidence`
38
123
 
39
- Runs relevant project validation scripts and objective quality checks.
124
+ Runs observed project validation and collects structured evidence.
125
+
126
+ **Synopsis:**
127
+ ```bash
128
+ ai-workflow collect-evidence [--task=<slug>] [--mode=<mode>] [--dry-run] [--visual-dist=<path>] [--port=<port>]
129
+ ```
130
+
131
+ **Description:**
132
+ Executes validation scripts, collects results, and produces a delivery summary. In `full` mode, persists an `EVIDENCE.json` artifact. Returns one of three statuses: `COMPLETED`, `COMPLETED_WITH_NOTES`, or `BLOCKED`.
40
133
 
41
134
  | Flag | Description |
42
135
  | --- | --- |
43
- | `--task=<slug>` | Optional task slug to target. |
44
- | `--mode=<mode>` | Validation mode (`quick`, `standard`, `full`). |
45
- | `--dry-run` | Run checks without writing `EVIDENCE.json`. |
136
+ | `--task=<slug>` | Optional task slug to associate with the evidence |
137
+ | `--mode=<mode>` | Validation mode: `quick`, `standard` (default), or `full` |
138
+ | `--dry-run` | Run checks without writing `EVIDENCE.json` |
139
+ | `--visual-dist=<path>` | Path to built frontend assets for visual validation |
140
+ | `--port=<port>` | Port for serving frontend assets |
141
+
142
+ **Example:**
143
+ ```bash
144
+ ai-workflow collect-evidence --mode=full --task=auth-feature
145
+ ai-workflow collect-evidence --dry-run
146
+ ```
147
+
148
+ ---
46
149
 
47
150
  ## `ai-workflow doctor`
48
151
 
49
- Checks the local installation and generated configuration.
152
+ Verifies the local AI Workflow Kit installation and configuration.
153
+
154
+ **Synopsis:**
155
+ ```bash
156
+ ai-workflow doctor
157
+ ```
158
+
159
+ **Description:**
160
+ Checks that the CLI is properly installed, the project has a valid Git repository, Node.js version is compatible, and the `.ai-workflow/` configuration exists and is valid.
161
+
162
+ **Example:**
163
+ ```bash
164
+ ai-workflow doctor
165
+ ```
166
+
167
+ ---
168
+
169
+ ## `ai-workflow clean`
50
170
 
51
- ## Public states
171
+ De-initializes and removes AI Workflow Kit files and symlinks from the project.
52
172
 
53
- - `COMPLETED`
54
- - `COMPLETED_WITH_NOTES`
55
- - `BLOCKED`
173
+ **Synopsis:**
174
+ ```bash
175
+ ai-workflow clean [--yes] [--dry-run] [--purge-agents]
176
+ ```
177
+
178
+ **Description:**
179
+ Removes `.ai-workflow/`, `opencode.jsonc`, `.workflow-state.json`, and the `opencode` symlink. Prompts for confirmation unless `--yes` is provided. Use `--purge-agents` to also remove the `.agents/` directory.
180
+
181
+ > [!WARNING]
182
+ > **Limitations:** `ai-workflow clean` deletes the `opencode.jsonc` file entirely. If you had pre-existing configurations or custom additions merged into `opencode.jsonc` before or during initialization, they will not be restored to their original state. Back up any custom `opencode.jsonc` configs before cleaning.
183
+
184
+ | Flag | Description |
185
+ | --- | --- |
186
+ | `--yes` | Skip confirmation prompt |
187
+ | `--dry-run` | Preview what would be deleted without removing anything |
188
+ | `--purge-agents` | Also remove the `.agents/` directory and symlink |
189
+
190
+ **Example:**
191
+ ```bash
192
+ ai-workflow clean --dry-run # Preview
193
+ ai-workflow clean --yes # Remove without confirmation
194
+ ai-workflow clean --purge-agents # Remove everything including .agents/
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Public Statuses
200
+
201
+ All workflow commands that produce delivery summaries use these statuses:
202
+
203
+ | Status | Meaning |
204
+ | --- | --- |
205
+ | `COMPLETED` | All validation passed successfully |
206
+ | `COMPLETED_WITH_NOTES` | Passed with recorded limitations or observations |
207
+ | `BLOCKED` | Validation failed, approval missing, or policy violation detected |
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: cyber-security
3
+ description: Guides the agent to review and harden the codebase against vulnerabilities, secret leaks, and command injections.
4
+ governance: ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md
5
+ ---
6
+
7
+ # Cyber Security PromptContract
8
+
9
+ ## Role
10
+ This skill guides agents to identify security vulnerabilities, mitigate risks of command execution, and prevent secret leakages in codebases.
11
+
12
+ ## Objective
13
+ Ensure code is highly secure, avoiding common OWASP Top 10 vulnerabilities, command injection risks, and credentials disclosure.
14
+
15
+ ## Trusted context
16
+ - Static analysis reports
17
+ - Parameterized configurations
18
+ - Secure storage documentation
19
+
20
+ Do not trust:
21
+ - Raw user strings passed to system shells
22
+ - Hardcoded keys, tokens, or credentials
23
+ - Dynamic query concatenation
24
+
25
+ ## User input
26
+ - Code file paths
27
+ - Environment files
28
+ - Third-party packages metadata
29
+
30
+ ## Constraints
31
+ - **Strict Parameterization Constraint**: All database interactions, file access paths, and external commands must be parameterized. Concat or raw interpolation of variable strings is strictly prohibited.
32
+ - **Secret Hardening Rule**: Never hardcode API keys, client secrets, passwords, or tokens. Always resolve secrets from process environment variables or secure vault integrations.
33
+ - **Non-privileged Execution Guide**: Enforce non-root execution guidelines for application processes and helper utilities.
34
+
35
+ ## Allowed tools
36
+ - Static application security testing (SAST) utilities
37
+ - Dependency scanner tools
38
+ - Environment configuration checkers
39
+
40
+ ## Forbidden actions
41
+ - Adding plaintext secrets or tokens to code repositories
42
+ - Committing temporary `.env` files containing credentials
43
+ - Running commands with `shell: true` option in process spawners without argument parameter arrays
44
+
45
+ ## Procedure
46
+ 1. Scan changed files for any hardcoded tokens, passwords, or keys using regular expressions.
47
+ 2. Review command invocation functions to replace raw dynamic shell spawning with parameterized execution.
48
+ 3. Validate database access calls to ensure query parameterization is implemented.
49
+ 4. Verify that configuration variables are resolved through environment files rather than hardcoded definitions.
50
+
51
+ ## Expected output schema
52
+ Output must include:
53
+ - Security audit log
54
+ - Identified risk surface area
55
+ - Actions taken for parameterization and secret removal
56
+ - Next security steps
57
+
58
+ ## Evidence required
59
+ - Git diff showing secret removal and parameterization
60
+ - Secure configuration files verification logs
61
+ - Linter output
62
+
63
+ ## Stop conditions
64
+ - Hardcoded secrets cannot be extracted safely to config
65
+ - Unparameterized dependencies are required but cannot be mitigated
66
+
67
+ ## Failure modes
68
+ - Dynamic command invocation bypass
69
+ - Leftover tokens in historical commits
70
+
71
+ ## Escalation rules
72
+ - Escalate to Phoenix if security issues cannot be resolved automatically.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: database
3
+ description: Guides the agent on how to write safe database schema migrations that prevent table locks and downtime.
4
+ governance: ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md
5
+ ---
6
+
7
+ # Database PromptContract
8
+
9
+ ## Role
10
+ This skill guides agents to design, construct, and apply safe database schema migrations without causing table locks or service downtime.
11
+
12
+ ## Objective
13
+ Implement schema and data transformations safely using non-blocking strategies and backward-compatible operations.
14
+
15
+ ## Trusted context
16
+ - Database schema definition files
17
+ - SQL migration scripts
18
+ - Target database engine configuration limits
19
+
20
+ Do not trust:
21
+ - Speculative migrations that do not specify transaction behavior
22
+ - Schema changes applied directly to production environments without dry-run testing
23
+ - Destructive operations (drop table, drop column) executed inside standard migration scripts
24
+
25
+ ## User input
26
+ - Target database schema definition
27
+ - Migration library config
28
+ - Proposed schema changes definition
29
+
30
+ ## Constraints
31
+ - **Zero-Downtime Rule**: Schema modifications must be backward-compatible (expand-contract phase). Raw dropping of columns or tables must be performed in separate, decoupled deployments.
32
+ - **Table Lock Mitigation**: Avoid executing long-running migrations that require exclusive table locks on large tables. For PostgreSQL, MySQL, or similar, use online schema changes or toolsets (e.g. `gh-ost`, `pt-online-schema-change`) when modifying high-volume tables.
33
+ - **Rollback Consistency**: Every forward migration script must have a corresponding, tested rollback script that reverts the schema and state without data corruption.
34
+
35
+ ## Allowed tools
36
+ - Database schema comparison utilities
37
+ - SQL query plan analyzer
38
+ - Migration dry-run execution wrappers
39
+
40
+ ## Forbidden actions
41
+ - Adding default values to existing columns in large tables in a single step without nullability transitions
42
+ - Executing migrations that mix DDL (schema) and DML (data updates) statements within the same database transaction
43
+ - Modifying production database schemas manually without version-controlled migration scripts
44
+
45
+ ## Procedure
46
+ 1. Review the proposed migration to classify operations into safe (non-blocking) and unsafe categories.
47
+ 2. Structure schema changes into a multi-step rollout plan (e.g. add nullable column, backfill data, add constraint).
48
+ 3. Draft the SQL migration script alongside its corresponding rollback script.
49
+ 4. Execute a local dry-run migration to verify correct syntax, transaction execution, and rollback stability.
50
+
51
+ ## Expected output schema
52
+ Output must include:
53
+ - Migration safety classification report
54
+ - Complete forward SQL script
55
+ - Complete rollback SQL script
56
+ - Execution dry-run confirmation log
57
+
58
+ ## Evidence required
59
+ - Migration transaction logs
60
+ - Database schema diff
61
+ - Dry-run validation output
62
+
63
+ ## Stop conditions
64
+ - Migration requires exclusive locks on high-traffic tables and lacks a mitigation strategy
65
+ - Rollback execution fails to restore schema integrity
66
+
67
+ ## Failure modes
68
+ - Table locks halting application traffic
69
+ - Data corruption during execution or rollback phase
70
+
71
+ ## Escalation rules
72
+ - Escalate to Orion if resource bounds are exceeded.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: devops
3
+ description: Guides the agent to construct secure, optimized, and containerized environments using Docker.
4
+ governance: ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md
5
+ ---
6
+
7
+ # DevOps PromptContract
8
+
9
+ ## Role
10
+ This skill guides agents to build secure, optimized, and portable Docker environments for local development and production environments.
11
+
12
+ ## Objective
13
+ Provide robust Docker configurations, minimizing image layer sizes, optimizing build speeds, and preventing container runtime vulnerabilities.
14
+
15
+ ## Trusted context
16
+ - Dockerfile and docker-compose configurations
17
+ - Container security scanning reports
18
+ - Official base image documentation
19
+
20
+ Do not trust:
21
+ - Raw third-party base images without version tags
22
+ - Unverified dependencies installed globally inside container layers
23
+ - Storing sensitive secrets inside Dockerfiles or image metadata
24
+
25
+ ## User input
26
+ - Source configuration files
27
+ - Port bindings definitions
28
+ - Environment files list
29
+
30
+ ## Constraints
31
+ - **Minimal Base Image Rule**: Always use verified, minimal base images (e.g., node:alpine, distroless) to reduce container size and minimize the attack surface.
32
+ - **Non-Root Execution Constraint**: Container processes must run as a non-privileged user (e.g. `node` user in node-based containers). Running services as `root` is strictly prohibited.
33
+ - **Multi-Stage Build Standard**: Use multi-stage builds to separate build dependencies from production execution layers, ensuring no build tools (compilers, npm devDependencies) are shipped to production.
34
+
35
+ ## Allowed tools
36
+ - Container scanners (e.g. Trivy, Hadolint)
37
+ - Container composition managers (Docker Compose)
38
+ - Layer analysis tools (e.g. Dive)
39
+
40
+ ## Forbidden actions
41
+ - Copying full source directories into the container before running dependency installation steps (breaks Docker layer caching)
42
+ - Exposing unneeded internal container ports to public interfaces
43
+ - Hardcoding credentials or environment-specific values in Dockerfiles
44
+
45
+ ## Procedure
46
+ 1. Define a multi-stage Docker build structure starting from a minimal, version-tagged base image.
47
+ 2. Structure Docker commands to install dependencies before copying source files to leverage docker layer caching.
48
+ 3. Configure the container runtime to switch execution context to a non-root user.
49
+ 4. Draft a consistent docker-compose configuration for local service replication.
50
+
51
+ ## Expected output schema
52
+ Output must include:
53
+ - Multi-stage Dockerfile configuration
54
+ - Local Docker Compose config (if required)
55
+ - Image layer size optimization report
56
+ - Security and permission checklist
57
+
58
+ ## Evidence required
59
+ - Validated Dockerfile contents
60
+ - Container build log verification
61
+ - Hadolint/security scan outputs
62
+
63
+ ## Stop conditions
64
+ - Base image is unavailable or vulnerable to high-severity issues with no upgrade path
65
+ - Environment constraints prevent building Docker images locally
66
+
67
+ ## Failure modes
68
+ - Cache invalidation causing slow build cycles
69
+ - Privilege escalation due to root execution fallback
70
+
71
+ ## Escalation rules
72
+ - Escalate to Orion if resource bounds are exceeded.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: localization
3
+ description: Guides the agent to implement internationalization, localized formatting, and translation workflows.
4
+ governance: ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md
5
+ ---
6
+
7
+ # Localization PromptContract
8
+
9
+ ## Role
10
+ This skill guides agents to write localized software, handle translation keys, manage resource bundles, and format values based on target locales.
11
+
12
+ ## Objective
13
+ Enable full support for multiple locales and translations, preventing hardcoded user-facing strings and layout breaks due to language changes.
14
+
15
+ ## Trusted context
16
+ - Translation dictionaries (JSON, PO, YAML)
17
+ - Locale-specific standards (CLDR)
18
+ - Global internationalization library documentation (e.g. i18next, react-intl)
19
+
20
+ Do not trust:
21
+ - Hardcoded literals in templates or components
22
+ - Translation values provided via unverified automatic machine translations
23
+ - Assumptions about layout size constraints for dynamic localized content
24
+
25
+ ## User input
26
+ - Source translation dictionary
27
+ - Target locale keys
28
+ - Layout components code
29
+
30
+ ## Constraints
31
+ - **Zero Hardcoded Strings Rule**: All user-facing text, alerts, labels, and placeholders must be resolved through translation keys. Inline hardcoded text is strictly prohibited.
32
+ - **Dynamic Formatting Constraint**: Always use internationalization API helpers (like `Intl.NumberFormat`, `Intl.DateTimeFormat`) for currencies, dates, times, and numbers.
33
+ - **Pluralization Handling**: Do not write manual logic for plural rules. Use the i18n library's built-in pluralization and interpolation formats.
34
+
35
+ ## Allowed tools
36
+ - i18n linter and key validation tools
37
+ - Locale resource validators
38
+ - Dynamic translation extraction scanners
39
+
40
+ ## Forbidden actions
41
+ - Concat strings to form user-facing text sentences (breaks grammar in different languages)
42
+ - Committing incomplete locale resource files missing required fallback language translations
43
+ - Hardcoding currency codes, time zones, or number separator formats in the source code
44
+
45
+ ## Procedure
46
+ 1. Scan source code and templates for hardcoded string literals.
47
+ 2. Extract found strings and register them as keys in the default locale file.
48
+ 3. Replace hardcoded strings in code with corresponding translation function calls.
49
+ 4. Verify that date, number, and currency formatting are dynamically adjusted based on the current locale setting.
50
+
51
+ ## Expected output schema
52
+ Output must include:
53
+ - Extracted translation keys list
54
+ - Modified localization files
55
+ - UI translation keys verification checklist
56
+ - Localized formatting implementation details
57
+
58
+ ## Evidence required
59
+ - Diff of updated translation JSON/YAML resource files
60
+ - Code snippets demonstrating i18n wrapper usage
61
+ - Validation command outputs
62
+
63
+ ## Stop conditions
64
+ - Required translation key structure is incompatible with existing i18n engine configuration
65
+ - Fallback language definitions are missing
66
+
67
+ ## Failure modes
68
+ - Broken translation keys rendering missing-key placeholders in UI
69
+ - Text overflow due to language expansion (e.g., German translations being longer than English)
70
+
71
+ ## Escalation rules
72
+ - Escalate to Orion if resource bounds are exceeded.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: performance
3
+ description: Guides the agent to optimize application rendering, assets delivery, and control bundle sizes.
4
+ governance: ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md
5
+ ---
6
+
7
+ # Performance PromptContract
8
+
9
+ ## Role
10
+ This skill guides agents to optimize application speed, layout responsiveness, rendering pipelines, and control asset bundle sizes.
11
+
12
+ ## Objective
13
+ Deliver high-performance user interfaces and backend operations aligned with strict response times and volume budgets.
14
+
15
+ ## Trusted context
16
+ - Performance audit reports (Lighthouse, Core Web Vitals)
17
+ - Bundle size analysis reports
18
+ - Memory and heap profiling logs
19
+
20
+ Do not trust:
21
+ - Speculative performance enhancements without metrics
22
+ - Uncompressed assets and third-party script integrations
23
+ - Local test execution times on non-standard configurations
24
+
25
+ ## User input
26
+ - Source bundle components list
27
+ - Runtime performance budgets
28
+ - Build compilation logs
29
+
30
+ ## Constraints
31
+ - **Bundle Size Hard Limit**: UI bundle components must not exceed 50KB gzipped individually. Every new utility dependency must be audited for bundle size impact before introduction.
32
+ - **Resource Optimization Rule**: Avoid layout shifts and excessive main thread blocking. All resource loading must be optimized (e.g. image lazy loading, async scripts, font preloading).
33
+ - **Core Web Vitals Alignment**: Ensure implementation respects standard metrics: First Contentful Paint (FCP) < 1.8s, Cumulative Layout Shift (CLS) < 0.1, and Interaction to Next Paint (INP) < 200ms.
34
+
35
+ ## Allowed tools
36
+ - Bundle analysis utilities (e.g., webpack-bundle-analyzer, rollup-plugin-visualizer)
37
+ - Network emulation tools
38
+ - Memory leaks detection profilers
39
+
40
+ ## Forbidden actions
41
+ - Importing large library suites (e.g. lodash, ramda) when a single lightweight helper function is sufficient
42
+ - Committing unminified or uncompressed assets directly to version control
43
+ - Disabling performance build checks or warnings in compiler/bundler configurations
44
+
45
+ ## Procedure
46
+ 1. Inspect the bundle size of any newly introduced package or asset.
47
+ 2. Verify that images use next-gen formats (WebP/AVIF) and explicit dimensions to avoid layout shifts.
48
+ 3. Review javascript source code to ensure proper clean-up of event listeners, timers, and active subscriptions.
49
+ 4. Execute bundle compilation and review build output size metrics against the established budgets.
50
+
51
+ ## Expected output schema
52
+ Output must include:
53
+ - Performance budget evaluation table
54
+ - Asset size analysis
55
+ - UI rendering optimization strategies applied
56
+ - Core Web Vitals impact estimation
57
+
58
+ ## Evidence required
59
+ - Build output size reports
60
+ - Memory heap profile snapshots (if applicable)
61
+ - Lighthouse/performance audit logs
62
+
63
+ ## Stop conditions
64
+ - Bundle size exceeds the maximum limit with no possibility of modular refactoring
65
+ - Execution environment constraints prevent performance validation
66
+
67
+ ## Failure modes
68
+ - Memory leakage through uncleaned closures
69
+ - Render-blocking resources introduction
70
+
71
+ ## Escalation rules
72
+ - Escalate to Orion if resource bounds are exceeded.
@@ -1,23 +1,117 @@
1
- # Quickstart
1
+ # Quickstart — 5-Minute Guide
2
2
 
3
- 1. Install and initialize AI Workflow Kit.
4
- 2. Ask Atlas for a natural software outcome.
5
- 3. Atlas selects quick, standard, or full mode and the closest domain profile.
6
- 4. Write-capable work moves off protected branches before editing.
7
- 5. Relevant validation runs before completion.
3
+ Get AI Workflow Kit running in your project in under 5 minutes.
8
4
 
9
- ## Completion
5
+ ## Prerequisites
10
6
 
11
- - `COMPLETED`
12
- - `COMPLETED_WITH_NOTES`
13
- - `BLOCKED`
7
+ - **Node.js** ≥ 18 (LTS recommended)
8
+ - **npm** ≥ 9
9
+ - **Git** initialized repository
10
+ - **OpenCode** runtime installed ([opencode.ai](https://opencode.ai)) — required for `aw run` and `aw execute`
14
11
 
15
- Quick and standard work return a concise summary with branch, changed areas, observed validation, and limitations. Full/release/audit/security work may persist structured evidence.
12
+ ## Step 1: Install
16
13
 
17
- Use `ai-workflow collect-evidence --mode=full` when a durable validation artefact is required. Do not use workflow files as substitutes for actual commands.
14
+ ```bash
15
+ npm install -g @williambeto/ai-workflow
16
+ ```
18
17
 
19
- ## Visual & Accessibility Evidence Requirements
18
+ Verify the installation:
20
19
 
21
- If your project utilizes visual validation (screenshots) or accessibility audits (Axe-core), ensure you have:
22
- - `playwright` (or `@playwright/test`) and `axe-core` installed under `devDependencies`.
23
- - Browser binaries installed on the host machine by running `npx playwright install`.
20
+ ```bash
21
+ ai-workflow doctor
22
+ ```
23
+
24
+ Expected output:
25
+
26
+ ```
27
+ ✔ ai-workflow CLI found
28
+ ✔ Node.js version compatible
29
+ ✔ Git repository detected
30
+ ```
31
+
32
+ ## Step 2: Initialize your project
33
+
34
+ Navigate to your project root and run:
35
+
36
+ ```bash
37
+ cd your-project
38
+ ai-workflow init
39
+ ```
40
+
41
+ This installs the workflow assets into your project:
42
+
43
+ ```
44
+ ✔ Created .ai-workflow/
45
+ ✔ Created opencode.jsonc
46
+ ✔ Updated .gitignore
47
+ ✔ Installed 6 agents, 20 skills, 14 commands, 11 policies
48
+ ```
49
+
50
+ ### Init options
51
+
52
+ | Flag | Description |
53
+ | --- | --- |
54
+ | `--yes` | Auto-approve all confirmations |
55
+ | `--dry-run` | Preview changes without writing files |
56
+ | `--profile=full` | Install with examples (default: `standard`) |
57
+ | `--gemini` | Also install Gemini adapter config |
58
+ | `--claude` | Also install Claude adapter config |
59
+ | `--antigravity` | Also install Antigravity adapter config |
60
+
61
+ ## Step 3: Make a request
62
+
63
+ With OpenCode running, ask Atlas for a natural software outcome:
64
+
65
+ ```bash
66
+ ai-workflow execute "Add a health check endpoint to the Express API"
67
+ ```
68
+
69
+ Atlas will:
70
+ 1. Classify the request intent
71
+ 2. Select the appropriate mode (`quick`, `standard`, or `full`)
72
+ 3. Create a safe branch (never writes to `main`)
73
+ 4. Delegate to the right agent (e.g., Astra for implementation)
74
+ 5. Run observed validation (tests, lint, build)
75
+ 6. Return a structured delivery summary
76
+
77
+ ## Step 4: Collect evidence
78
+
79
+ After work is complete, collect validation evidence:
80
+
81
+ ```bash
82
+ ai-workflow collect-evidence --mode=standard
83
+ ```
84
+
85
+ Expected output:
86
+
87
+ ```
88
+ --- Delivery Summary ---
89
+ Status: COMPLETED
90
+ Branch: feat/health-check
91
+ Changes: src/routes/health.js, tests/health.test.js
92
+ Validation: npm,test: PASS
93
+ Known limitations: None recorded
94
+ ```
95
+
96
+ ## Completion statuses
97
+
98
+ | Status | Meaning |
99
+ | --- | --- |
100
+ | `COMPLETED` | All validation passed |
101
+ | `COMPLETED_WITH_NOTES` | Passed with recorded limitations |
102
+ | `BLOCKED` | Validation failed or approval missing |
103
+
104
+ ## Visual & accessibility evidence
105
+
106
+ If your project uses visual validation or accessibility audits, install the required dependencies:
107
+
108
+ ```bash
109
+ npm install -D playwright @playwright/test axe-core
110
+ npx playwright install chromium
111
+ ```
112
+
113
+ ## Next steps
114
+
115
+ - [CLI Reference](../../dist-assets/docs/cli-reference.md) — all commands, flags, and examples
116
+ - [Troubleshooting](./troubleshooting.md) — common errors and FAQ
117
+ - [Upgrading to v2](./upgrading-to-v2.md) — migration guide from v1
@@ -0,0 +1,123 @@
1
+ # Troubleshooting
2
+
3
+ Common issues, solutions, and frequently asked questions for AI Workflow Kit.
4
+
5
+ ## Common Errors
6
+
7
+ ### `Error: Not a git repository`
8
+
9
+ **Cause:** `ai-workflow` requires a Git-initialized project directory.
10
+
11
+ **Solution:**
12
+ ```bash
13
+ git init
14
+ ai-workflow init
15
+ ```
16
+
17
+ ### `Error: ai-workflow must not run init inside its own repository`
18
+
19
+ **Cause:** You are running `ai-workflow init` inside the AI Workflow Kit source repository itself.
20
+
21
+ **Solution:** Navigate to your consumer project directory before running `init`.
22
+
23
+ ### `Error: Current branch is protected (main/master)`
24
+
25
+ **Cause:** The Branch Gate prevents writing directly to protected branches.
26
+
27
+ **Solution:** The workflow will automatically create a feature branch. If on a dirty working tree, commit or stash changes first:
28
+ ```bash
29
+ git stash
30
+ ai-workflow execute "your request"
31
+ ```
32
+
33
+ ### `Status: BLOCKED — FAIL_QUALITY_GATE`
34
+
35
+ **Cause:** Validation commands (`npm test`, `npm run lint`, `npm run build`) failed.
36
+
37
+ **Solution:**
38
+ 1. Check the delivery summary for which command failed
39
+ 2. Fix the failing tests or lint errors
40
+ 3. Re-run: `ai-workflow collect-evidence --mode=standard`
41
+
42
+ ### `Error: opencode not found` or `ENOENT: opencode`
43
+
44
+ **Cause:** The OpenCode runtime is not installed or not in your PATH.
45
+
46
+ **Solution:**
47
+ 1. Install OpenCode from [opencode.ai](https://opencode.ai)
48
+ 2. Verify: `which opencode`
49
+ 3. If installed but not found, add it to your PATH
50
+
51
+ ### `BLOCKED — Delivery decision is blocking: BLOCK_STACK_CONFLICT`
52
+
53
+ **Cause:** The request asks for a framework or stack that conflicts with the existing project setup.
54
+
55
+ **Solution:** Be explicit about the target stack in your request, or use the `explicitApprovals` mechanism to override.
56
+
57
+ ### `Fidelity Violation: Design System token mismatch`
58
+
59
+ **Cause:** CSS files with more than 200 characters of rules were detected without CSS custom properties (`var(--...)`), and the `frontend-design-system` skill is installed.
60
+
61
+ **Solution:**
62
+ - Add CSS custom properties to your stylesheets, or
63
+ - Add explicit approval `no-css-vars` to bypass for simple/legacy stylesheets
64
+
65
+ ## Frequently Asked Questions
66
+
67
+ ### 1. Can I use AI Workflow Kit without OpenCode?
68
+
69
+ The `init`, `doctor`, `clean`, `validate`, and `collect-evidence` commands work without OpenCode. However, `run` and `execute` require the OpenCode runtime to orchestrate agent workflows.
70
+
71
+ ### 2. Does `aw init` modify my existing code?
72
+
73
+ No. It only creates workflow configuration files (`.ai-workflow/`, `opencode.jsonc`, symlinks) and appends entries to `.gitignore`. Your source code is never modified by `init`.
74
+
75
+ ### 3. How do I uninstall AI Workflow Kit from a project?
76
+
77
+ ```bash
78
+ ai-workflow clean --yes
79
+ ```
80
+
81
+ This removes `.ai-workflow/`, `opencode.jsonc`, `.workflow-state.json`, and the `opencode` symlink. Add `--purge-agents` to also remove `.agents/`. Use `--dry-run` to preview what will be deleted.
82
+
83
+ > [!WARNING]
84
+ > **Limitations:** `clean` deletes `opencode.jsonc` entirely. If you had pre-existing configurations or custom additions merged into `opencode.jsonc` before or during initialization, they will not be restored to their original state. Back up any custom `opencode.jsonc` configs before cleaning.
85
+
86
+ ### 4. Which AI platforms are supported?
87
+
88
+ AI Workflow Kit includes adapters for:
89
+ - **Gemini** (`--gemini`)
90
+ - **Claude** (`--claude`)
91
+ - **Codex** (`--codex`)
92
+ - **Antigravity** (`--antigravity`)
93
+
94
+ ### 5. What is the difference between `standard` and `full` profiles?
95
+
96
+ | Feature | `standard` | `full` |
97
+ | --- | --- | --- |
98
+ | Agents, skills, commands, policies | ✅ | ✅ |
99
+ | Example specs and templates | ❌ | ✅ |
100
+ | Default | ✅ | ❌ |
101
+
102
+ ### 6. Can agents push directly to `main`?
103
+
104
+ No. The Branch Gate policy enforces that all write operations happen on feature branches (`feat/*`, `fix/*`, `chore/*`, `docs/*`). Direct pushes to `main` or `master` are blocked.
105
+
106
+ ### 7. How do I update to a newer version?
107
+
108
+ ```bash
109
+ npm install -g @williambeto/ai-workflow@latest
110
+ ai-workflow init --force
111
+ ```
112
+
113
+ See [Upgrading to v2](./upgrading-to-v2.md) for detailed migration instructions.
114
+
115
+ ## Reporting Issues
116
+
117
+ - **Security vulnerabilities:** Follow the process in [SECURITY.md](../../.github/SECURITY.md)
118
+ - **Bug reports:** Open an issue in the project's GitHub repository with:
119
+ - AI Workflow Kit version (`ai-workflow --version`)
120
+ - Node.js version (`node --version`)
121
+ - Operating system
122
+ - Steps to reproduce
123
+ - Expected vs actual behavior
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williambeto/ai-workflow",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "description": "AI Workflow Kit — OpenCode-first software delivery workflow with agents, commands, skills, validation, and evidence",
5
5
  "license": "MIT",
6
6
  "author": "José Willams",
@@ -73,6 +73,7 @@
73
73
  "test": "npm run test:unit",
74
74
  "test:unit": "vitest run tests/unit/",
75
75
  "test:watch": "vitest",
76
+ "test:coverage": "vitest run --coverage",
76
77
  "test:e2e": "node tests/validate-e2e.mjs && vitest run tests/e2e/consumer-workflow.test.js",
77
78
  "test:e2e:runtime": "AI_WORKFLOW_RELEASE=1 vitest run tests/e2e/consumer-workflow.test.js -t \"Real OpenCode Smoke Test\"",
78
79
  "release:verify": "npm run clean:verify && npm test && npm run test:e2e && npm run validate && npm run pack:verify && npm run test:e2e:runtime",
@@ -90,10 +91,11 @@
90
91
  "@semantic-release/git": "^10.0.1",
91
92
  "@semantic-release/github": "^12.0.8",
92
93
  "@semantic-release/npm": "^13.1.5",
94
+ "@vitest/coverage-v8": "^4.1.7",
93
95
  "ajv": "^8.20.0",
94
96
  "ajv-formats": "^3.0.1",
95
97
  "axe-core": "^4.10.0",
96
- "markdownlint-cli": "^0.48.0",
98
+ "markdownlint-cli": "^0.49.0",
97
99
  "playwright": "^1.60.0",
98
100
  "semantic-release": "^25.0.3",
99
101
  "vitest": "^4.1.7"
@@ -116,9 +116,11 @@ export function createCliRemediationExecutor(cwd) {
116
116
 
117
117
  for (const scriptName of toRetry) {
118
118
  process.stdout.write(` → npm run ${scriptName} ... `);
119
- const result = spawnSync("npm", ["run", scriptName], {
119
+ const isWin32 = process.platform === "win32";
120
+ const cmd = isWin32 ? "npm.cmd" : "npm";
121
+ const result = spawnSync(cmd, ["run", scriptName], {
120
122
  cwd,
121
- shell: true,
123
+ shell: false,
122
124
  encoding: "utf8",
123
125
  timeout: 120000
124
126
  });
@@ -32,7 +32,12 @@ export class RequestClassifier {
32
32
  if (/\b(deep|architectural|migration|major|full|\[deep\])\b/i.test(text)) {
33
33
  mode = "full";
34
34
  } else if (/\b(tiny|small|quick|simple|only\s+update|typo|comment|\[tiny\])\b/i.test(text)) {
35
- mode = "quick";
35
+ const isPureDocsOrTypo = profile === "documentation" || /\b(typo|comment|readme|docs|documentation)\b/i.test(text);
36
+ if (intent === "write" && !isPureDocsOrTypo) {
37
+ mode = "standard";
38
+ } else {
39
+ mode = "quick";
40
+ }
36
41
  }
37
42
 
38
43
  // 4. Classify Risk