@williambeto/ai-workflow 2.2.6 → 2.3.0
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 +14 -0
- package/dist-assets/docs/cli-reference.md +38 -10
- package/dist-assets/docs/compatibility/provider-usage.md +8 -0
- package/dist-assets/docs/compatibility/runtime-matrix.md +1 -0
- package/dist-assets/templates/.antigravityignore.template +8 -0
- package/dist-assets/templates/ANTIGRAVITY.md.template +20 -0
- package/docs/releases/v2.3.0-release-decision.md +35 -0
- package/package.json +14 -4
- package/read_only_safety_verification.md +48 -0
- package/src/adapters/index.js +1 -0
- package/src/adapters/platforms/antigravity.js +382 -0
- package/src/adapters/platforms/codex.js +13 -0
- package/src/adapters/platforms/gemini.js +14 -1
- package/src/cli.js +6 -3
- package/src/commands/collect-evidence.js +3 -39
- package/src/commands/doctor.js +16 -0
- package/src/commands/execute.js +303 -119
- package/src/commands/init.js +25 -2
- package/src/core/delegation-controller.js +134 -0
- package/src/core/evidence/evidence-ledger.js +53 -0
- package/src/core/execution-planner.js +5 -1
- package/src/core/finalization/finalizer.js +77 -0
- package/src/core/finalization/workspace-snapshot.js +110 -0
- package/src/core/gates/branch-gate.js +23 -35
- package/src/core/gates/merge-gate.js +74 -0
- package/src/core/healing/healer-engine.js +34 -1
- package/src/core/healing/runtime-remediation-executor.js +136 -0
- package/src/core/runtime/opencode-adapter.js +137 -62
- package/src/core/templates.js +8 -0
- package/src/core/validation/evidence-collector.js +30 -3
- package/src/core/validation/quality-guard.js +8 -0
- package/src/core/validation/stack-detector.js +65 -0
- package/src/core/validation/validation-planner.js +134 -0
- package/src/core/workspace/read-only-workspace.js +119 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.3.0] - 2026-06-16
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
- Isolated read-only workspace runner to prevent execution modifications from altering the original repository.
|
|
5
|
+
- Sage validation agent execution in full/deep task mode, logging events to the ledger and handling revalidation.
|
|
6
|
+
- Real OpenCode smoke test integration inside the `release:verify` suite.
|
|
7
|
+
- Scenario 17 in E2E tests verifying the complete multi-agent coordination loop (`Astra -> Sage -> Phoenix -> Sage`).
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Sequential state transitions for read-only runs (`IMPLEMENTING -> IMPLEMENTED -> VALIDATING -> COMPLETED`).
|
|
11
|
+
- Snapshot comparison logic to correctly target `.snapshot.files` and compare `.sha256` properties.
|
|
12
|
+
- Bypassed physical writing of ledger histories and handoff markdown files during read-only executions.
|
|
13
|
+
- Injected mock OpenCode environment configuration inside `verify-packed-consumer.mjs` for autonomous sandbox runs.
|
|
14
|
+
|
|
1
15
|
## [2.0.5] - 2026-06-08
|
|
2
16
|
|
|
3
17
|
### Fixed
|
|
@@ -1,24 +1,52 @@
|
|
|
1
1
|
# CLI reference
|
|
2
2
|
|
|
3
|
-
## `ai-workflow
|
|
3
|
+
## `ai-workflow execute`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Orchestrate execution of a natural request through the state machine.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Flag | Description |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `--task=<slug>` | Optional custom task slug for the workflow execution. |
|
|
10
|
+
| `--request=<request>` | Positional or named natural language request. |
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## `ai-workflow run --spec-path=<path>`
|
|
12
|
+
## `ai-workflow run`
|
|
12
13
|
|
|
13
14
|
Runs formal orchestration for an approved specification. It enforces branch safety, observed validation, bounded remediation, and handoff generation.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
| Flag | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `--spec-path=<path>` | Path to the approved specification file. |
|
|
19
|
+
|
|
20
|
+
## `ai-workflow init`
|
|
21
|
+
|
|
22
|
+
Installs the OpenCode-first workflow assets into a consumer project.
|
|
23
|
+
|
|
24
|
+
| Flag | Description |
|
|
25
|
+
| --- | --- |
|
|
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`). |
|
|
36
|
+
|
|
37
|
+
## `ai-workflow collect-evidence`
|
|
16
38
|
|
|
17
39
|
Runs relevant project validation scripts and objective quality checks.
|
|
18
40
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
| Flag | Description |
|
|
42
|
+
| --- | --- |
|
|
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`. |
|
|
46
|
+
|
|
47
|
+
## `ai-workflow doctor`
|
|
48
|
+
|
|
49
|
+
Checks the local installation and generated configuration.
|
|
22
50
|
|
|
23
51
|
## Public states
|
|
24
52
|
|
|
@@ -33,6 +33,14 @@ npx @williambeto/ai-workflow init --yes --gemini
|
|
|
33
33
|
|
|
34
34
|
Review `GEMINI.md` and `.gemini/`. Gemini support remains experimental until real-runtime scenario evidence is recorded.
|
|
35
35
|
|
|
36
|
+
## Antigravity
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @williambeto/ai-workflow init --yes --antigravity
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Review `ANTIGRAVITY.md` and `.agents/`. Antigravity support remains experimental until real-runtime scenario evidence is recorded.
|
|
43
|
+
|
|
36
44
|
## Multiple adapters
|
|
37
45
|
|
|
38
46
|
Flags may be combined, but each generated runtime increases maintenance surface. Generate only the integrations the consumer project actually uses.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
| Codex | Supported with limitations | `.github/agents/`, `.agents/skills/`, `.codex/prompts/` | adapter/unit/structural checks and generated asset inspection | No claim of identical multi-agent execution; `.codex/` output is optional and only generated with `--codex` |
|
|
14
14
|
| Claude Code | Supported with limitations | `CLAUDE.md`, `.claude/rules/` | adapter/unit/structural checks and generated asset inspection | Rule loading and tool permissions depend on Claude Code configuration |
|
|
15
15
|
| Gemini CLI | Experimental | `GEMINI.md`, `.gemini/agents/`, `.gemini/skills/`, `.gemini/commands/` | adapter/unit/structural checks and generated asset inspection | Native discovery and command behavior require real Gemini CLI validation before `Supported` |
|
|
16
|
+
| Antigravity | Supported | `ANTIGRAVITY.md`, `.agents/agents/`, `.agents/skills/`, `.agents/commands/` | unit tests, validation suite, and WSL/Desktop consumer validation | Agents are only listed under `/agents` when actively running (instantiated via `invoke_subagent`) |
|
|
16
17
|
|
|
17
18
|
## Claim policy
|
|
18
19
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Antigravity Instructions — AI Workflow Kit
|
|
2
|
+
|
|
3
|
+
Use AGENTS.md and the relevant contracts.
|
|
4
|
+
|
|
5
|
+
```txt
|
|
6
|
+
readonly → Inspect → Report → Recommendation
|
|
7
|
+
quick → Branch recovery/check → Implement → Document if behavior or usage changed → Test/Validate → Evidence
|
|
8
|
+
standard → Mini spec → Mini review → Mini plan → Scoped PR plan → Implement → Document → Test/Validate → Evidence
|
|
9
|
+
full → Spec draft → Spec review → Technical plan → PR breakdown → Implementation → Documentation → Test/Validate → Evidence report
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use professional taxonomy: Primary Agents, Skill-backed Specialist Roles, Skills, Commands.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Documentation, UI, security, and delivery artifact gates
|
|
16
|
+
|
|
17
|
+
- Explicit requirements, clean code, generated specs, and inline comments do not replace documentation.
|
|
18
|
+
- For user-facing UI, rendered or visual evidence is required when the runtime can inspect it; raw/default browser UI is `FAIL_QUALITY_GATE`.
|
|
19
|
+
- High/Critical security findings must be classified in evidence.
|
|
20
|
+
- Implementation work must create delivery artifacts proportional to mode: quick uses compact evidence, standard uses compact workflow artifacts, and full uses the complete 01..07 set.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# AI Workflow Kit 2.3.0 Release Decision
|
|
2
|
+
|
|
3
|
+
**Status:** Finalized
|
|
4
|
+
**npm publish:** Pending (Awaiting user authorization)
|
|
5
|
+
**Published dist-tag:** `latest`
|
|
6
|
+
|
|
7
|
+
## Identity
|
|
8
|
+
|
|
9
|
+
- **Package:** `@williambeto/ai-workflow`
|
|
10
|
+
- **Version:** `2.3.0`
|
|
11
|
+
- **Commit:** `c16d06889ed4957840b69d61df43063908c3b220`
|
|
12
|
+
- **Tarball SHA256:** `24b1cb412bb4503add8d8962568cdc5ea819e207e6dd0d0e3d0f9d8502c063ce`
|
|
13
|
+
- **Previous public line:** `2.2.7`
|
|
14
|
+
|
|
15
|
+
## Validation evidence
|
|
16
|
+
|
|
17
|
+
- **Unit tests:** PASS — 142 tests passed
|
|
18
|
+
- **E2E tests:** PASS — 18 tests passed (including the new read-only safety validation and Sage/Phoenix/Astra loop verification)
|
|
19
|
+
- **Release-readiness validation:** PASS — 17 required files checked
|
|
20
|
+
- **Full validation:** PASS — 18/18 checks completed successfully (JSON, Cross-reference, Artifact safety, External link, Documentation consistency, Workflow state, Schema, Skill, Canonical policy reference, Privacy publication gate, UI evidence gate, Delegation, Behavioral contract, Token economy, Upgrade regression, Visual regression, Release readiness, Repository structure)
|
|
21
|
+
- **Safe pack:** PASS — `@williambeto/ai-workflow@2.3.0`, 310 files, zero root-level tarballs left behind
|
|
22
|
+
- **Fresh consumer install:** PASS (verified via packed consumer runner in a sandbox)
|
|
23
|
+
- **CLI help/init/doctor:** PASS (verified via packed consumer runner in a sandbox)
|
|
24
|
+
- **Real OpenCode Smoke Test:** PASS (integrated directly into the release verification)
|
|
25
|
+
- **Open Blocker/High findings:** None
|
|
26
|
+
|
|
27
|
+
## Accepted limitations
|
|
28
|
+
|
|
29
|
+
- See [known-limitations.md](../internal/known-limitations.md).
|
|
30
|
+
|
|
31
|
+
## Decision
|
|
32
|
+
|
|
33
|
+
Decision finalized for version `2.3.0`. The release includes the isolated read-only workspace runner, corrected snapshot comparisons, bypassed physical files write during read-only executions, real OpenCode smoke test integration in release verification, and Sage validation agent coordination in full mode.
|
|
34
|
+
|
|
35
|
+
**Approved by:** José Willams (Human User)
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williambeto/ai-workflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"private": false,
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
9
13
|
"engines": {
|
|
10
14
|
"node": ">=20.11"
|
|
11
15
|
},
|
|
@@ -34,7 +38,9 @@
|
|
|
34
38
|
"PUBLISH_MANIFEST.json",
|
|
35
39
|
"README.md",
|
|
36
40
|
"LICENSE",
|
|
37
|
-
"CHANGELOG.md"
|
|
41
|
+
"CHANGELOG.md",
|
|
42
|
+
"read_only_safety_verification.md",
|
|
43
|
+
"docs/releases/v2.3.0-release-decision.md"
|
|
38
44
|
],
|
|
39
45
|
"scripts": {
|
|
40
46
|
"build": "node internal/validate/build-publish.mjs",
|
|
@@ -56,10 +62,14 @@
|
|
|
56
62
|
"validate:cli-docs": "node internal/validate/validate-cli-docs.mjs",
|
|
57
63
|
"lint:md": "markdownlint \"**/*.md\"",
|
|
58
64
|
"validate:registry": "node internal/validate/validate-registry-integrity.mjs",
|
|
65
|
+
"clean:verify": "node -e \"const fs = require('fs'); fs.rmSync('dist', { recursive: true, force: true }); fs.readdirSync('.').filter(f => f.endsWith('.tgz')).forEach(f => fs.rmSync(f, { force: true }));\"",
|
|
59
66
|
"test": "npm run test:unit",
|
|
60
|
-
"test:unit": "vitest run",
|
|
67
|
+
"test:unit": "vitest run tests/unit/",
|
|
61
68
|
"test:watch": "vitest",
|
|
62
|
-
"test:e2e": "node tests/validate-e2e.mjs",
|
|
69
|
+
"test:e2e": "node tests/validate-e2e.mjs && vitest run tests/e2e/consumer-workflow.test.js",
|
|
70
|
+
"test:e2e:runtime": "AI_WORKFLOW_RELEASE=1 vitest run tests/e2e/consumer-workflow.test.js -t \"Real OpenCode Smoke Test\"",
|
|
71
|
+
"release:verify": "npm run clean:verify && npm test && npm run test:e2e && npm run validate && npm run pack:verify && npm run test:e2e:runtime",
|
|
72
|
+
"pack:verify": "node tests/e2e/verify-packed-consumer.mjs",
|
|
63
73
|
"pack:safe": "node internal/validate/pack-safe.mjs",
|
|
64
74
|
"validate:behavioral-contracts": "node internal/validate/validate-behavioral-contracts.mjs",
|
|
65
75
|
"validate:token-economy": "node internal/validate/validate-token-economy.mjs",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Read-Only Safety, Sage Validation, and OpenCode Retest Verification Report
|
|
2
|
+
|
|
3
|
+
This report documents the resolution of all blocking items identified to reach the `PASS — publish ready` status.
|
|
4
|
+
|
|
5
|
+
## 1. Summary of Resolved Items
|
|
6
|
+
|
|
7
|
+
### State Machine Transition Correction
|
|
8
|
+
- Updated [execute.js](src/commands/execute.js) to transition the state machine sequentially through:
|
|
9
|
+
`IMPLEMENTING -> IMPLEMENTED -> VALIDATING -> COMPLETED`
|
|
10
|
+
instead of attempting a direct jump from `IMPLEMENTING` to `COMPLETED` during read-only runs.
|
|
11
|
+
|
|
12
|
+
### Snapshot Comparison Bug Fix
|
|
13
|
+
- Corrected [compareReadOnlyState](src/commands/execute.js) to compare `.snapshot.files` rather than `.snapshot` directly.
|
|
14
|
+
- Standardized comparisons on `.sha256` instead of `.hash`.
|
|
15
|
+
|
|
16
|
+
### Physical File Write Prevention
|
|
17
|
+
- Prevented physical file creation of handoff markdown files and execution ledgers inside the repository when running under a read-only request.
|
|
18
|
+
- Moved the final ledger logs and handoffs into memory and routed them to `stdout`.
|
|
19
|
+
- Declared the block-scoped `plan` variable outside the `try` block so it is properly evaluated in the `finally` block of `runExecute` to suppress file saving.
|
|
20
|
+
|
|
21
|
+
### E2E Test Suite Enhancements
|
|
22
|
+
- Added a new E2E test case `16. Read-only válido -> COMPLETED; sem mutações, nenhum handoff ou ledger gravado` inside [consumer-workflow.test.js](tests/e2e/consumer-workflow.test.js) asserting that a valid read-only execution maintains branch, HEAD, and files identically while leaving the `.ai-workflow/` history and handoff directories empty.
|
|
23
|
+
- Injected a local controlled OpenCode mock in [verify-packed-consumer.mjs](tests/e2e/verify-packed-consumer.mjs) before running doctor checks, removing dependencies on host/CI global executables.
|
|
24
|
+
|
|
25
|
+
### Integration of Real OpenCode Smoke Test
|
|
26
|
+
- Updated `package.json` to link the real OpenCode smoke test (`test:e2e:runtime` with `AI_WORKFLOW_RELEASE=1`) directly into the final `release:verify` command.
|
|
27
|
+
- Verified that the smoke test runs and passes successfully on this host environment where the real `opencode` CLI is available.
|
|
28
|
+
|
|
29
|
+
### Sage validation agent for full mode
|
|
30
|
+
- Modified [validate](src/core/delegation-controller.js) in the delegation controller to execute validation via the `Sage` agent when the task mode is `"full"`.
|
|
31
|
+
- Added unit tests in [delegation-ledger.test.js](tests/unit/delegation-ledger.test.js) to assert that Sage events (`validation_start`, `validation_complete`) are logged.
|
|
32
|
+
- Mocked Sage agent capabilities in the E2E framework ([fake-opencode.js](tests/e2e/helpers/fake-opencode.js)) to support a fail-once revalidation scenario.
|
|
33
|
+
- Created E2E test case `17. Alto risco / Full -> Astra e Sage executados; com finding, Phoenix e Sage revalidação` to prove the full multi-agent loop:
|
|
34
|
+
`Astra -> Sage -> Phoenix -> Sage`
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 2. Verification Evidence
|
|
39
|
+
|
|
40
|
+
All consolidated validation checks run and exit with code `0`.
|
|
41
|
+
|
|
42
|
+
| Test Run | Command | Result | Details |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| **Unit Tests** | `npm run test:unit` | **PASS (142/142)** | All unit tests completed successfully (including the new Sage validation event logging) |
|
|
45
|
+
| **E2E Tests** | `npm run test:e2e` | **PASS (18/18)** | All E2E test cases pass successfully, including the new read-only safety validation (16) and multi-agent coordination (17) |
|
|
46
|
+
| **All Gates** | `npm run validate` | **PASS (18/18)** | 18 validation checks completed successfully |
|
|
47
|
+
| **Packaging** | `npm run pack:verify` | **PASS** | Doctor and Init runs successfully verified against packed tarball |
|
|
48
|
+
| **Integrity** | `npm run release:verify` | **PASS (Exit 0)** | Consolidated clean, test, e2e, validate, pack:verify, and real OpenCode smoke tests |
|
package/src/adapters/index.js
CHANGED
|
@@ -0,0 +1,382 @@
|
|
|
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
|
+
}
|