@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
@@ -1,117 +0,0 @@
1
- # Quickstart — 5-Minute Guide
2
-
3
- Get AI Workflow Kit running in your project in under 5 minutes.
4
-
5
- ## Prerequisites
6
-
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`
11
-
12
- ## Step 1: Install
13
-
14
- ```bash
15
- npm install -g @williambeto/ai-workflow
16
- ```
17
-
18
- Verify the installation:
19
-
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, 25 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
@@ -1,123 +0,0 @@
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
@@ -1,62 +0,0 @@
1
- # Upgrading to version 2
2
-
3
- Version `2.x` is a breaking public line from the previous `1.x` line. Test upgrades in a disposable or non-critical consumer before replacing an existing installation.
4
-
5
- ## Upgrade path
6
-
7
- 1. Record the installed version and back up project-level runtime files.
8
- 2. Remove the global package when applicable:
9
-
10
- ```bash
11
- npm uninstall -g @williambeto/ai-workflow
12
- ```
13
-
14
- 3. Install the current public release:
15
-
16
- ```bash
17
- npm install -g @williambeto/ai-workflow@latest
18
- ```
19
-
20
- 4. Inspect initialization before applying it:
21
-
22
- For first-time or pre-installation usage:
23
- ```bash
24
- npx @williambeto/ai-workflow init --dry-run
25
- npx @williambeto/ai-workflow init --yes
26
- ```
27
-
28
- After installing AI Workflow Kit locally in your project:
29
- ```bash
30
- npx aw init --dry-run
31
- npx aw init --yes
32
- npx aw doctor
33
- ```
34
-
35
- ## Main changes in version 2
36
-
37
- - OpenCode-first runtime with six primary ownership roles.
38
- - Proportional `quick`, `standard`, and `full` modes.
39
- - Observed validation, false-success prevention, and bounded remediation.
40
- - Concise quick/standard summaries without mandatory owner JSON, fixed delivery filenames, or `EVIDENCE.json`.
41
- - Full/release/audit/security workflows may persist structured evidence when traceability is required.
42
- - Semantic Product Truthfulness guidance without keyword-only enforcement.
43
- - Consumer files managed under `.ai-workflow/`.
44
- - Optional Codex, Claude Code, and Gemini adapter assets with documented limitations.
45
-
46
- ## Breaking changes
47
-
48
- - Generated assets and configuration may differ substantially from `1.x`.
49
- - Legacy paths, taxonomies, aliases, and obsolete documentation are not retained as active sources.
50
- - Consumer-managed files should be reviewed before accepting initialization changes.
51
- - Direct prompts and provider behavior remain subject to the documented known limitations.
52
-
53
- ## Rollback
54
-
55
- If you need to return to the previous public line during migration testing, install the known `1.x` version explicitly:
56
-
57
- ```bash
58
- npm uninstall -g @williambeto/ai-workflow
59
- npm install -g @williambeto/ai-workflow@1.19.1
60
- ```
61
-
62
- Restore backed-up project files when initialization changed consumer integrations.
@@ -1,4 +0,0 @@
1
- export { GeminiAdapter } from "./platforms/gemini.js";
2
- export { ClaudeAdapter } from "./platforms/claude.js";
3
- export { CodexAdapter } from "./platforms/codex.js";
4
- export { AntigravityAdapter } from "./platforms/antigravity.js";
@@ -1,382 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
- import { pathToFileURL } from "node:url";
4
- import { COMPLETION_STATUS_TEXT } from "../../core/statuses.js";
5
-
6
- /**
7
- * Maps OpenCode agent names to primary agent roles.
8
- * @type {Record<string, string>}
9
- */
10
- const PERSONA_MAPPING = {
11
- "atlas": "Atlas",
12
- "orion": "Orion",
13
- "sage": "Sage",
14
- "nexus": "Nexus",
15
- "astra": "Astra",
16
- "sage-validation": "Sage",
17
- "orion-release": "Orion",
18
- "orion-deploy": "Orion",
19
- "nexus-discovery": "Nexus",
20
- "phoenix": "Phoenix"
21
- };
22
-
23
- /**
24
- * Antigravity Adapter - Transforms OpenCode .md to Antigravity Skill format and manages .agents/ integration.
25
- */
26
- export class AntigravityAdapter {
27
- constructor({ cwd }) {
28
- this.cwd = cwd;
29
- }
30
-
31
- /**
32
- * Transforms an OpenCode agent or specialized skill file to an Antigravity Skill.
33
- * @param {string} filePath - Path to the source .md file.
34
- * @returns {Promise<{content: string, name: string}>}
35
- */
36
- async transform(filePath) {
37
- const content = await fs.readFile(filePath, "utf8");
38
- const fileName = path.basename(filePath, ".md") === "SKILL"
39
- ? path.basename(path.dirname(filePath))
40
- : path.basename(filePath, ".md");
41
-
42
- const persona = PERSONA_MAPPING[fileName.toLowerCase()] || "Astra";
43
-
44
- // Check if already has frontmatter
45
- if (content.trim().startsWith("---")) {
46
- return { content, name: fileName };
47
- }
48
-
49
- // Extract description from the first paragraph after the title
50
- const descriptionMatch = content.match(/^# .*\n\n(.*)/m);
51
- const description = descriptionMatch ? descriptionMatch[1].trim() : `Specialized agent for ${fileName}.`;
52
-
53
- const skillContent = `---
54
- name: ${fileName}
55
- description: ${description}
56
- ---
57
- # ${persona} Persona
58
-
59
- ${content}
60
-
61
- ## Completion Contract (Mandatory)
62
- Every task completion MUST provide the following payload:
63
- 1. **Status**: ${COMPLETION_STATUS_TEXT}
64
- 2. **Scope reviewed**: Brief summary of what was analyzed.
65
- 3. **Findings**: Evidence-based discoveries.
66
- 4. **Files affected**: List of all concrete paths modified or created.
67
- 5. **Validation/evidence**: Commands run and their results.
68
- 6. **Risks/notes**: Any caveats or technical debt introduced.
69
- 7. **Required manager action**: Clear next step for the orchestrator.
70
- 8. **Can manager continue**: [yes/no]
71
- `;
72
-
73
- return {
74
- content: skillContent,
75
- name: fileName
76
- };
77
- }
78
-
79
- /**
80
- * Deploys transformed skills and agents to their respective directories.
81
- * Also orchestrates the .antigravity/ native integration.
82
- */
83
- async deploy(transformedItems, installRoot = ".ai-workflow") {
84
- const agentsDir = path.join(this.cwd, installRoot, "opencode/agents");
85
- const skillsDir = path.join(this.cwd, installRoot, "opencode/skills");
86
-
87
- await fs.mkdir(agentsDir, { recursive: true });
88
- await fs.mkdir(skillsDir, { recursive: true });
89
-
90
- for (const item of transformedItems) {
91
- const isAgent = PERSONA_MAPPING[item.name.toLowerCase()];
92
- const targetDir = isAgent ? agentsDir : path.join(skillsDir, item.name);
93
- const fileName = isAgent ? `${item.name}.md` : "SKILL.md";
94
-
95
- const absoluteTargetDir = isAgent ? agentsDir : targetDir;
96
- await fs.mkdir(absoluteTargetDir, { recursive: true });
97
- await fs.writeFile(path.join(absoluteTargetDir, fileName), item.content);
98
- }
99
-
100
- // Deploy native Antigravity extensions (.antigravity/)
101
- await this.deployNativeExtensions(installRoot);
102
-
103
- // Also deploy root ANTIGRAVITY.md if it doesn't exist
104
- await this.deployInstructions();
105
- }
106
-
107
- /**
108
- * Orchestrates the .agents/ directory with copies of .ai-workflow/ assets.
109
- * Using hard copies instead of symlinks ensures native discovery across all platforms.
110
- */
111
- async deployNativeExtensions(installRoot = ".ai-workflow") {
112
- const antigravityDir = path.join(this.cwd, ".agents");
113
- const antigravityAgents = path.join(antigravityDir, "agents");
114
- const antigravitySkills = path.join(antigravityDir, "skills");
115
- const antigravityCommands = path.join(antigravityDir, "commands");
116
-
117
- await fs.mkdir(antigravityAgents, { recursive: true });
118
- await fs.mkdir(antigravitySkills, { recursive: true });
119
- await fs.mkdir(antigravityCommands, { recursive: true });
120
-
121
- const getUrls = (targetPath) => {
122
- const linuxUrl = pathToFileURL(targetPath).href;
123
- const urls = [linuxUrl];
124
-
125
- if (process.platform === "linux" && process.env.WSL_DISTRO_NAME) {
126
- const distro = process.env.WSL_DISTRO_NAME;
127
- const normalizedPath = targetPath.replaceAll("\\", "/");
128
- urls.push(`file://wsl.localhost/${distro}${normalizedPath}`);
129
- urls.push(`file:///wsl.localhost/${distro}${normalizedPath}`);
130
- }
131
-
132
- return urls.join("\n");
133
- };
134
-
135
- const toolNames = [
136
- "send_message",
137
- "find_by_name",
138
- "grep_search",
139
- "view_file",
140
- "list_dir",
141
- "read_url_content",
142
- "search_web",
143
- "schedule",
144
- "multi_replace_file_content",
145
- "replace_file_content",
146
- "write_to_file",
147
- "run_command",
148
- "manage_task",
149
- "define_subagent",
150
- "invoke_subagent",
151
- "manage_subagents",
152
- "call_mcp_tool"
153
- ];
154
-
155
- const systemPromptConfig = {
156
- "includeSections": [
157
- "user_information",
158
- "mcp_servers",
159
- "skills",
160
- "subagent_reminder",
161
- "messaging",
162
- "artifacts",
163
- "user_rules"
164
- ]
165
- };
166
-
167
- // 1. Deploy Primary Agents to .agents/agents/{agent_name}/
168
- const sourceAgentsDir = path.join(this.cwd, installRoot, "opencode/agents");
169
- const agentFiles = await fs.readdir(sourceAgentsDir).catch(() => []);
170
-
171
- const AGENTS_INFO = {
172
- "atlas": { name: "Atlas", description: "Router and workflow coordinator for AI Workflow Kit" },
173
- "nexus": { name: "Nexus", description: "Discovery, requirement, scope, and specification owner" },
174
- "orion": { name: "Orion", description: "Planning, PR sequencing, release, and deployment strategy owner" },
175
- "astra": { name: "Astra", description: "Implementation owner for incremental, scoped changes" },
176
- "sage": { name: "Sage", description: "Audit, validation, evidence, and quality gate owner" },
177
- "phoenix": { name: "Phoenix", description: "Remediation and regression recovery owner" }
178
- };
179
-
180
- for (const file of agentFiles) {
181
- if (!file.endsWith(".md")) continue;
182
- const lowercaseName = path.basename(file, ".md").toLowerCase();
183
- const info = AGENTS_INFO[lowercaseName];
184
- if (!info) continue;
185
-
186
- const agentFolder = path.join(antigravityAgents, lowercaseName);
187
- await fs.mkdir(agentFolder, { recursive: true });
188
-
189
- // Copy Markdown file to the agent's folder
190
- const content = await fs.readFile(path.join(sourceAgentsDir, file), "utf8");
191
- const mdTarget = path.join(agentFolder, `${lowercaseName}.md`);
192
- await fs.writeFile(mdTarget, content);
193
-
194
- // Generate agent.json
195
- const agentJson = {
196
- name: lowercaseName,
197
- description: info.description,
198
- hidden: false,
199
- config: {
200
- customAgent: {
201
- systemPromptSections: [
202
- {
203
- title: "Agent System Instructions",
204
- content: `You are ${info.name}, the ${lowercaseName === "astra" ? "implementation" : lowercaseName} owner.\n\nFollow the contract instructions in:\n${getUrls(mdTarget)}`
205
- }
206
- ],
207
- toolNames,
208
- systemPromptConfig
209
- }
210
- }
211
- };
212
- await fs.writeFile(path.join(agentFolder, "agent.json"), JSON.stringify(agentJson, null, 2));
213
- }
214
-
215
- // 2. Deploy Subagents to .agents/agents/{subagent_name}/
216
- const SUBAGENTS_INFO = {
217
- "Architecture-Specialist": { description: "Select the simplest architecture that safely satisfies current requirements", skill: "architecture" },
218
- "Backend-Engineer": { description: "Support safe PHP/Node/Python backend changes for APIs and persistence", skill: "backend-development" },
219
- "Deployment-Specialist": { description: "Plan, review, or validate deployment, release, and production-readiness", skill: "deployment" },
220
- "Design-Specialist": { description: "Apply practical design principles to keep solutions simple and maintainable", skill: "design-principles" },
221
- "Docs-Engineer": { description: "Write or improve project documentation, READMEs, guides, and prompts", skill: "documentation" },
222
- "Frontend-Engineer": { description: "Implement or review frontend changes involving UI, state, routing, and accessibility", skill: "frontend-development" },
223
- "Full-Stack-Engineer": { description: "Coordinate frontend and backend changes as one coherent, testable increment", skill: "full-stack-development" },
224
- "Token-Economist": { description: "Reduce context size while preserving information required for safe execution", skill: "optimize-tokens" },
225
- "PR-Manager": { description: "Plan, implement, review, or validate small pull requests while preserving scope", skill: "pr-workflow" },
226
- "Discovery-Analyst": { description: "Clarify ambiguous requests into actionable problem statements and success outcomes", skill: "product-discovery" },
227
- "Product-Planner": { description: "Turn clarified needs into scoped requirements with acceptance-ready outcomes", skill: "product-planning" },
228
- "Memory-Guardian": { description: "Manage discoverable project memory for durable decisions and recurring corrections", skill: "project-memory" },
229
- "Prompt-Engineer": { description: "Expert in creating and refining prompts for AI agents and workflows", skill: "prompt-engineer" },
230
- "QA-Engineer": { description: "Design, review, or improve tests, acceptance criteria, and validation evidence", skill: "qa-workflow" },
231
- "Refactoring-Specialist": { description: "Improve code/document structure safely while preserving behavior", skill: "refactoring" },
232
- "Release-Specialist": { description: "Prepare release readiness decisions with explicit gates and evidence", skill: "release-workflow" },
233
- "SDD-Specialist": { description: "Convert approved requirements into explicit, testable specification artifacts", skill: "spec-driven-development" },
234
- "Technical-Leader": { description: "Make technical decisions, review architecture, and identify trade-offs", skill: "technical-leadership" },
235
- "UI-UX-Engineer": { description: "Improve usability and interface clarity without introducing unnecessary complexity", skill: "ui-ux-design" }
236
- };
237
-
238
- for (const [name, subInfo] of Object.entries(SUBAGENTS_INFO)) {
239
- const lowercaseSubagentName = name.toLowerCase();
240
- const subagentFolder = path.join(antigravityAgents, lowercaseSubagentName);
241
- await fs.mkdir(subagentFolder, { recursive: true });
242
-
243
- const skillPath = path.join(antigravitySkills, subInfo.skill, "SKILL.md");
244
-
245
- const subagentJson = {
246
- name: lowercaseSubagentName,
247
- description: subInfo.description,
248
- hidden: false,
249
- config: {
250
- customAgent: {
251
- systemPromptSections: [
252
- {
253
- title: "Agent System Instructions",
254
- content: `You are ${name}.\n\nFollow the contract instructions in:\n${getUrls(skillPath)}`
255
- }
256
- ],
257
- toolNames,
258
- systemPromptConfig
259
- }
260
- }
261
- };
262
- await fs.writeFile(path.join(subagentFolder, "agent.json"), JSON.stringify(subagentJson, null, 2));
263
- }
264
-
265
- // 3. Copy Skills
266
- const sourceSkillsDir = path.join(this.cwd, installRoot, "opencode/skills");
267
- const skillFolders = await fs.readdir(sourceSkillsDir).catch(() => []);
268
- for (const folder of skillFolders) {
269
- const skillSource = path.join(sourceSkillsDir, folder, "SKILL.md");
270
- if (await this.exists(skillSource)) {
271
- await fs.mkdir(path.join(antigravitySkills, folder), { recursive: true });
272
- const content = await fs.readFile(skillSource, "utf8");
273
- await fs.writeFile(path.join(antigravitySkills, folder, "SKILL.md"), content);
274
- }
275
- }
276
-
277
- // 4. Copy Commands (from dist-assets/commands)
278
- const sourceCommandsDir = path.join(this.cwd, installRoot, "opencode/commands");
279
- if (await this.exists(sourceCommandsDir)) {
280
- const commandFiles = await fs.readdir(sourceCommandsDir).catch(() => []);
281
- for (const file of commandFiles) {
282
- if (!file.endsWith(".md") && !file.endsWith(".toml")) continue;
283
- const content = await fs.readFile(path.join(sourceCommandsDir, file), "utf8");
284
- await fs.writeFile(path.join(antigravityCommands, file), content);
285
- }
286
- }
287
-
288
- // 5. Copy governance policy into .agents/docs/policies/ so the relative
289
- // link ../../docs/policies/SKILLS_COMMON_GOVERNANCE.md in each
290
- // .agents/skills/{skill}/SKILL.md resolves correctly.
291
- const sourcePoliciesDir = path.join(this.cwd, installRoot, "opencode", "docs", "policies");
292
- const antigravityPolicies = path.join(antigravityDir, "docs", "policies");
293
- if (await this.exists(sourcePoliciesDir)) {
294
- await fs.mkdir(antigravityPolicies, { recursive: true });
295
- const policyFiles = await fs.readdir(sourcePoliciesDir).catch(() => []);
296
- for (const file of policyFiles) {
297
- if (!file.endsWith(".md")) continue;
298
- const content = await fs.readFile(path.join(sourcePoliciesDir, file), "utf8");
299
- await fs.writeFile(path.join(antigravityPolicies, file), content);
300
- }
301
- }
302
-
303
- // 6. Inject project settings.json
304
- const settingsPath = path.join(antigravityDir, "settings.json");
305
- if (!(await this.exists(settingsPath))) {
306
- const settings = {
307
- model: { name: "auto" },
308
- ui: { theme: "Ayu" }
309
- };
310
- await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2));
311
- }
312
- }
313
-
314
- async exists(p) {
315
- try {
316
- await fs.access(p);
317
- return true;
318
- } catch {
319
- return false;
320
- }
321
- }
322
-
323
- /**
324
- * Deploys the main ANTIGRAVITY.md and .antigravityignore instructions to the project root.
325
- */
326
- async deployInstructions() {
327
- const targetPath = path.join(this.cwd, "ANTIGRAVITY.md");
328
- const ignorePath = path.join(this.cwd, ".antigravityignore");
329
-
330
- // Deploy ANTIGRAVITY.md if it doesn't exist
331
- try {
332
- await fs.access(targetPath);
333
- } catch {
334
- const instructions = `# AI Workflow Kit - Engineering Governance
335
-
336
- ## Mandate: Atlas Authority Protocol
337
- All architectural changes must align with the specifications issued by the **Specification Authority** (./specs).
338
-
339
- ## Ternary Architecture
340
- - **Root:** Orchestration and config.
341
- - **.ai-workflow/:** Implementation (The Muscle).
342
- - **./specs:** Specifications (The Brain).
343
-
344
- ## Branch Gates
345
- - **main Branch:** READ-ONLY.
346
- - **Validation:** Merges require successful observed validation; full/release workflows may persist EVIDENCE.json.
347
-
348
- ## Primary Agents
349
- - **Atlas (Orchestrator)**
350
- - **Orion (Strategist)**
351
- - **Sage (Auditor)**
352
- - **Nexus (Spec Architect)**
353
- - **Astra (Developer)**
354
- - **Phoenix (Healer)**
355
-
356
- ## Operational Preferences
357
- - Use \`token-economy\` and \`minimal-context\` skills.
358
- - **Native Discovery**: This project uses workspace-specific extensions in \`.agents/\`.
359
- - **Workflow Entry**: Use \`/atlas\` to begin any task.
360
- `;
361
- await fs.writeFile(targetPath, instructions);
362
- }
363
-
364
- // Deploy .antigravityignore if it doesn't exist
365
- try {
366
- await fs.access(ignorePath);
367
- } catch {
368
- const ignoreContent = `.ai-workflow/
369
- .ai-workflow-backups/
370
- node_modules/
371
- .git/
372
- EVIDENCE.json
373
- *.tgz
374
- *.zip
375
- *.tar
376
- .agents/tmp/
377
- .agents/history/
378
- `;
379
- await fs.writeFile(ignorePath, ignoreContent);
380
- }
381
- }
382
- }