aw-ecc 1.4.21 → 1.4.25
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/.claude-plugin/plugin.json +1 -1
- package/.codex/hooks/aw-post-tool-use.sh +1 -0
- package/.codex/hooks/aw-pre-tool-use.sh +1 -0
- package/.codex/hooks/aw-session-start.sh +4 -0
- package/.codex/hooks/aw-stop.sh +1 -0
- package/.codex/hooks/aw-user-prompt-submit.sh +1 -0
- package/.cursor/INSTALL.md +9 -0
- package/.cursor/hooks/adapter.js +34 -3
- package/.cursor/hooks/aw-phase-definitions.js +11 -0
- package/.cursor/hooks/before-submit-prompt.js +1 -1
- package/.cursor/hooks/before-submit-prompt.sh +17 -0
- package/.cursor/hooks/session-start.sh +36 -0
- package/.cursor/hooks/shared/aw-phase-definitions.js +1 -19
- package/.cursor/hooks/shared/aw-phase-runner.js +38 -2
- package/.cursor/hooks/shared/session-start.sh +4 -0
- package/.cursor/hooks/shared/user-prompt-submit.sh +33 -140
- package/.cursor/hooks.json +15 -15
- package/.cursor/rules/common-aw-routing.md +43 -0
- package/.cursor/skills/api-and-interface-design/SKILL.md +75 -0
- package/.cursor/skills/aw-brainstorm/SKILL.md +115 -0
- package/.cursor/skills/aw-build/SKILL.md +152 -0
- package/.cursor/skills/aw-build/evals/build-stage-cases.json +28 -0
- package/.cursor/skills/aw-debug/SKILL.md +49 -0
- package/.cursor/skills/aw-deploy/SKILL.md +101 -0
- package/.cursor/skills/aw-deploy/evals/deploy-stage-cases.json +32 -0
- package/.cursor/skills/aw-execute/SKILL.md +47 -0
- package/.cursor/skills/aw-execute/references/mode-code.md +47 -0
- package/.cursor/skills/aw-execute/references/mode-docs.md +28 -0
- package/.cursor/skills/aw-execute/references/mode-infra.md +44 -0
- package/.cursor/skills/aw-execute/references/mode-migration.md +58 -0
- package/.cursor/skills/aw-execute/references/worker-implementer.md +26 -0
- package/.cursor/skills/aw-execute/references/worker-parallel-worker.md +23 -0
- package/.cursor/skills/aw-execute/references/worker-quality-reviewer.md +23 -0
- package/.cursor/skills/aw-execute/references/worker-spec-reviewer.md +23 -0
- package/.cursor/skills/aw-execute/scripts/build-worker-bundle.js +229 -0
- package/.cursor/skills/aw-finish/SKILL.md +111 -0
- package/.cursor/skills/aw-investigate/SKILL.md +109 -0
- package/.cursor/skills/aw-plan/SKILL.md +368 -0
- package/.cursor/skills/aw-prepare/SKILL.md +118 -0
- package/.cursor/skills/aw-review/SKILL.md +118 -0
- package/.cursor/skills/aw-ship/SKILL.md +115 -0
- package/.cursor/skills/aw-spec/SKILL.md +104 -0
- package/.cursor/skills/aw-tasks/SKILL.md +138 -0
- package/.cursor/skills/aw-test/SKILL.md +118 -0
- package/.cursor/skills/aw-verify/SKILL.md +51 -0
- package/.cursor/skills/aw-yolo/SKILL.md +111 -0
- package/.cursor/skills/browser-testing-with-devtools/SKILL.md +81 -0
- package/.cursor/skills/ci-cd-and-automation/SKILL.md +71 -0
- package/.cursor/skills/code-simplification/SKILL.md +74 -0
- package/.cursor/skills/context-engineering/SKILL.md +74 -0
- package/.cursor/skills/deprecation-and-migration/SKILL.md +75 -0
- package/.cursor/skills/documentation-and-adrs/SKILL.md +75 -0
- package/.cursor/skills/frontend-ui-engineering/SKILL.md +68 -0
- package/.cursor/skills/git-workflow-and-versioning/SKILL.md +75 -0
- package/.cursor/skills/idea-refine/SKILL.md +84 -0
- package/.cursor/skills/incremental-implementation/SKILL.md +75 -0
- package/.cursor/skills/performance-optimization/SKILL.md +77 -0
- package/.cursor/skills/security-and-hardening/SKILL.md +70 -0
- package/.cursor/skills/using-aw-skills/SKILL.md +290 -0
- package/.cursor/skills/using-aw-skills/evals/skill-trigger-cases.tsv +25 -0
- package/.cursor/skills/using-aw-skills/evals/test-skill-triggers.sh +171 -0
- package/.cursor/skills/using-aw-skills/hooks/hooks.json +9 -0
- package/.cursor/skills/using-aw-skills/hooks/session-start.sh +67 -0
- package/.cursor/skills/using-platform-skills/SKILL.md +163 -0
- package/.cursor/skills/using-platform-skills/evals/platform-selection-cases.json +52 -0
- package/.opencode/package.json +1 -1
- package/package.json +3 -1
- package/scripts/cursor-aw-home/hooks.json +15 -15
- package/scripts/cursor-aw-hooks/adapter.js +34 -3
- package/scripts/cursor-aw-hooks/aw-phase-definitions.js +11 -0
- package/scripts/cursor-aw-hooks/before-submit-prompt.js +1 -1
- package/scripts/cursor-aw-hooks/before-submit-prompt.sh +17 -0
- package/scripts/cursor-aw-hooks/session-start.sh +36 -0
- package/scripts/hooks/session-start-rules-context.sh +8 -1
- package/scripts/hooks/shared/aw-phase-definitions.js +1 -19
- package/scripts/hooks/shared/aw-phase-runner.js +38 -2
- package/scripts/hooks/shared/session-start.sh +4 -0
- package/scripts/hooks/shared/user-prompt-submit.sh +33 -140
- package/scripts/lib/cursor-aw-hook-files.js +2 -0
- package/scripts/lib/cursor-hook-config.js +47 -15
- package/scripts/lib/install-executor.js +7 -0
- package/scripts/lib/install-targets/cursor-project.js +7 -0
- package/skills/using-aw-skills/hooks/session-start.sh +4 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Mode: Code — TDD Execution
|
|
2
|
+
|
|
3
|
+
## Iron Law
|
|
4
|
+
|
|
5
|
+
> **Every [code] task follows TDD. No exceptions. No rationalizations.**
|
|
6
|
+
|
|
7
|
+
## Red-Green-Refactor Cycle
|
|
8
|
+
|
|
9
|
+
### 1. RED — Write the test first
|
|
10
|
+
|
|
11
|
+
- Write a failing test that describes the expected behavior.
|
|
12
|
+
- Run the test. It MUST fail. If it passes, the test is wrong or the behavior already exists.
|
|
13
|
+
- The test defines the contract. Implementation serves the test.
|
|
14
|
+
|
|
15
|
+
### 2. GREEN — Write minimal code to pass
|
|
16
|
+
|
|
17
|
+
- Write the simplest implementation that makes the test pass.
|
|
18
|
+
- Do not add features, optimizations, or "nice-to-haves" at this stage.
|
|
19
|
+
- Run the test. It MUST pass.
|
|
20
|
+
|
|
21
|
+
### 3. REFACTOR — Clean up without changing behavior
|
|
22
|
+
|
|
23
|
+
- Extract helpers, rename variables, reduce duplication.
|
|
24
|
+
- Run tests after every refactor step. They MUST still pass.
|
|
25
|
+
- Stop refactoring when the code is clean and readable.
|
|
26
|
+
|
|
27
|
+
## Rules
|
|
28
|
+
|
|
29
|
+
- **Test file per source file** — `feature.service.ts` gets `feature.service.spec.ts`.
|
|
30
|
+
- **Descriptive test names** — `it('should return empty array when no features exist for locationId')`.
|
|
31
|
+
- **No mocking internals** — Mock boundaries (HTTP, database, external services), not internal functions.
|
|
32
|
+
- **Coverage gate** — 80% minimum. Check with `npm run test:cov` or equivalent.
|
|
33
|
+
- **No skipped tests** — `it.skip` and `xit` are not allowed in committed code.
|
|
34
|
+
- **Platform logger** — Use `@platform-core/logger`, never `console.*`.
|
|
35
|
+
- **DTO validation** — Every `@Body()` parameter has a class-validator DTO.
|
|
36
|
+
- **Error handling** — Every async call has explicit error handling.
|
|
37
|
+
|
|
38
|
+
## Rationalization Table
|
|
39
|
+
|
|
40
|
+
| Rationalization | Why It Is Wrong |
|
|
41
|
+
|---|---|
|
|
42
|
+
| "I'll write tests after" | You will not. And the code will be shaped for implementation, not testability. |
|
|
43
|
+
| "This is too simple to test" | Simple code breaks too. The test documents the contract. |
|
|
44
|
+
| "Tests slow me down" | Tests slow you down now. Bugs slow you down forever. |
|
|
45
|
+
| "I'll just test the happy path" | Errors happen on unhappy paths. Test both. |
|
|
46
|
+
| "The integration test covers it" | Integration tests are slow and broad. Unit tests are fast and precise. |
|
|
47
|
+
| "I know this works" | Prove it. Run the test. |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Mode: Docs — Write, Review, Commit
|
|
2
|
+
|
|
3
|
+
## Process
|
|
4
|
+
|
|
5
|
+
### 1. Write
|
|
6
|
+
|
|
7
|
+
- Write the documentation in the appropriate location.
|
|
8
|
+
- Follow existing documentation style and format in the repo.
|
|
9
|
+
- Include code examples where they aid understanding.
|
|
10
|
+
- Keep language clear, concise, and direct.
|
|
11
|
+
|
|
12
|
+
### 2. Self-Review Checklist
|
|
13
|
+
|
|
14
|
+
Before committing documentation:
|
|
15
|
+
|
|
16
|
+
- [ ] **Accuracy** — All technical details are correct and verified against the code.
|
|
17
|
+
- [ ] **Completeness** — All public APIs, config options, and workflows are documented.
|
|
18
|
+
- [ ] **Examples** — Code examples compile/run and match current API signatures.
|
|
19
|
+
- [ ] **Links** — All internal links resolve. No broken references.
|
|
20
|
+
- [ ] **Formatting** — Consistent heading levels, code block languages, and list styles.
|
|
21
|
+
- [ ] **No stale content** — Removed or updated references to deprecated features.
|
|
22
|
+
- [ ] **Audience** — Written for the target reader (developer, operator, end user).
|
|
23
|
+
|
|
24
|
+
### 3. Commit
|
|
25
|
+
|
|
26
|
+
- Commit documentation changes with `docs:` prefix.
|
|
27
|
+
- If docs accompany code changes, include in the same PR.
|
|
28
|
+
- Update the table of contents or index if one exists.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Mode: Infra — Dry-Run First
|
|
2
|
+
|
|
3
|
+
## Core Principle
|
|
4
|
+
|
|
5
|
+
> **Never apply infrastructure changes directly. Validate first, deploy via Jenkins.**
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Validate
|
|
10
|
+
|
|
11
|
+
- Run `helm lint` for Helm chart changes.
|
|
12
|
+
- Run `terraform plan` for Terraform changes.
|
|
13
|
+
- Run `docker build` to verify Dockerfile changes.
|
|
14
|
+
- Review the diff carefully before proceeding.
|
|
15
|
+
|
|
16
|
+
### 2. Dry-Run
|
|
17
|
+
|
|
18
|
+
- `terraform plan -out=tfplan` — Review every resource change.
|
|
19
|
+
- `helm template` — Render and inspect the full manifest.
|
|
20
|
+
- `helm diff upgrade` — Compare current state with proposed changes.
|
|
21
|
+
|
|
22
|
+
### 3. Deploy via Jenkins
|
|
23
|
+
|
|
24
|
+
- **Never** run `kubectl apply`, `helm install`, or `terraform apply` directly.
|
|
25
|
+
- Use Jenkins shared library functions for all deployments.
|
|
26
|
+
- Trigger deployments via Jenkins pipeline, not CLI.
|
|
27
|
+
|
|
28
|
+
### 4. Verify
|
|
29
|
+
|
|
30
|
+
- Check pod status after deployment.
|
|
31
|
+
- Verify health probes are responding.
|
|
32
|
+
- Check logs for startup errors.
|
|
33
|
+
- Confirm the change is reflected in the running system.
|
|
34
|
+
|
|
35
|
+
## Platform Rules
|
|
36
|
+
|
|
37
|
+
- **Resource requests** — Set `resources.requests` for every container. Limits auto-calculated for servers.
|
|
38
|
+
- **Health probes** — Configure for every deployment (default path `/` on port 6050).
|
|
39
|
+
- **No CPU limits = requests** — Never set CPU limits equal to CPU requests (causes throttling).
|
|
40
|
+
- **No secrets in Helm** — Use GCP Secret Manager, not Helm values or ConfigMaps.
|
|
41
|
+
- **No KEDA** — KEDA is deprecated. Use `peakLoad.peakLoadMinReplicas` instead.
|
|
42
|
+
- **Pin image tags** — Never use `latest`. Use specific digest or semver.
|
|
43
|
+
- **Graceful shutdown** — `terminationGracePeriodSeconds` >= 30 seconds.
|
|
44
|
+
- **Terraform managed** — All GCP resources via Terraform. No manual console changes.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Mode: Migration — Staged Rollout
|
|
2
|
+
|
|
3
|
+
## Process
|
|
4
|
+
|
|
5
|
+
### 1. Script
|
|
6
|
+
|
|
7
|
+
- Write the migration script. It MUST be **idempotent** — running it twice produces the same result.
|
|
8
|
+
- Use `up()` and `down()` functions (or equivalent) for forward and rollback.
|
|
9
|
+
- Include validation checks that confirm the migration was applied correctly.
|
|
10
|
+
- Test the migration against a copy of production data (or realistic test data).
|
|
11
|
+
|
|
12
|
+
### 2. Rollback
|
|
13
|
+
|
|
14
|
+
- Every migration MUST have a rollback path.
|
|
15
|
+
- Write the rollback script before applying the migration.
|
|
16
|
+
- Test the rollback independently.
|
|
17
|
+
- Document the rollback procedure in the migration file header.
|
|
18
|
+
|
|
19
|
+
### 3. Validate
|
|
20
|
+
|
|
21
|
+
- Run the migration in a test/staging environment first.
|
|
22
|
+
- Verify data integrity after migration.
|
|
23
|
+
- Check that dependent queries still work with the new schema.
|
|
24
|
+
- Confirm indexes are in place before queries execute.
|
|
25
|
+
|
|
26
|
+
### 4. Commit
|
|
27
|
+
|
|
28
|
+
- Commit migration files with `migration:` or `feat:` prefix.
|
|
29
|
+
- Include the rollback script in the same commit.
|
|
30
|
+
- Document the migration in the PR description.
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
|
|
34
|
+
### Indexes
|
|
35
|
+
|
|
36
|
+
- **Deploy indexes BEFORE** deploying schema or query changes that use them.
|
|
37
|
+
- Use `background: true` for index creation (or rely on MongoDB 4.2+ default).
|
|
38
|
+
- Add compound indexes for multi-field queries — avoid multiple single-field indexes.
|
|
39
|
+
- Scope all MongoDB queries by `locationId` (compound index required).
|
|
40
|
+
|
|
41
|
+
### Fields
|
|
42
|
+
|
|
43
|
+
- New fields MUST have default values or be nullable — never break existing documents.
|
|
44
|
+
- Remove fields in two phases: (1) stop writing, (2) remove after migration window.
|
|
45
|
+
- Never rename fields in a single migration — add new, migrate data, remove old.
|
|
46
|
+
|
|
47
|
+
### Secrets
|
|
48
|
+
|
|
49
|
+
- Never store secrets in migration scripts.
|
|
50
|
+
- Use environment variables or GCP Secret Manager for connection strings.
|
|
51
|
+
- Never log sensitive data during migration (PII, credentials, tokens).
|
|
52
|
+
|
|
53
|
+
### Data Safety
|
|
54
|
+
|
|
55
|
+
- Back up the collection/table before running destructive migrations.
|
|
56
|
+
- Use transactions where available for multi-document updates.
|
|
57
|
+
- Set reasonable batch sizes for bulk operations — avoid OOM.
|
|
58
|
+
- Log progress for long-running migrations (every N records).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Worker Role: Implementer
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Own one bounded task unit from the approved AW execution inputs.
|
|
6
|
+
Change only the smallest correct file set for that unit.
|
|
7
|
+
|
|
8
|
+
## Inputs
|
|
9
|
+
|
|
10
|
+
- approved feature inputs from `.aw_docs/features/<feature_slug>/`
|
|
11
|
+
- current task-unit bundle
|
|
12
|
+
- repo-local AW execution contract
|
|
13
|
+
|
|
14
|
+
## Required Behavior
|
|
15
|
+
|
|
16
|
+
1. confirm the task-unit goal and file scope
|
|
17
|
+
2. capture the RED or failure-first signal when behavior changes
|
|
18
|
+
3. implement the smallest correct GREEN change
|
|
19
|
+
4. record handoff notes for spec and quality review
|
|
20
|
+
5. stop when the task unit is complete or blocked
|
|
21
|
+
|
|
22
|
+
## Hard Gates
|
|
23
|
+
|
|
24
|
+
- do not widen the write scope without naming why
|
|
25
|
+
- do not skip runnable tests silently
|
|
26
|
+
- do not mark the task done without concrete notes for the next review roles
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Worker Role: Parallel Worker
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Execute one task unit that has already been marked `parallel_candidate` with a disjoint write scope.
|
|
6
|
+
The orchestrator should keep active parallel workers within the configured cap, which defaults to `3`.
|
|
7
|
+
|
|
8
|
+
## Inputs
|
|
9
|
+
|
|
10
|
+
- current task-unit bundle
|
|
11
|
+
- declared disjoint write scope
|
|
12
|
+
- repo-local AW execution contract
|
|
13
|
+
|
|
14
|
+
## Required Behavior
|
|
15
|
+
|
|
16
|
+
1. stay inside the declared write scope
|
|
17
|
+
2. keep notes concise so the merge-back step can reconcile outputs cleanly
|
|
18
|
+
3. stop immediately if the work crosses into another worker's files
|
|
19
|
+
|
|
20
|
+
## Hard Gates
|
|
21
|
+
|
|
22
|
+
- do not edit shared files outside the declared scope
|
|
23
|
+
- do not claim a task unit is parallel-safe if overlap was discovered during execution
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Worker Role: Quality Reviewer
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Check maintainability, reliability, and stage readiness for one completed task unit.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- implementer handoff notes
|
|
10
|
+
- spec review outcome
|
|
11
|
+
- current task-unit bundle
|
|
12
|
+
|
|
13
|
+
## Required Behavior
|
|
14
|
+
|
|
15
|
+
1. inspect the changed files and local validation notes
|
|
16
|
+
2. flag maintainability or reliability issues that would block handoff
|
|
17
|
+
3. state `pass`, `pass_with_notes`, or `fail`
|
|
18
|
+
4. hand back the smallest concrete repair scope when failing
|
|
19
|
+
|
|
20
|
+
## Hard Gates
|
|
21
|
+
|
|
22
|
+
- do not reopen planning
|
|
23
|
+
- do not wave through unresolved reliability or validation gaps
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Worker Role: Spec Reviewer
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Check one completed task unit against the approved AW inputs before the stage can move forward.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- approved feature inputs from `.aw_docs/features/<feature_slug>/`
|
|
10
|
+
- implementer handoff notes
|
|
11
|
+
- current task-unit bundle
|
|
12
|
+
|
|
13
|
+
## Required Behavior
|
|
14
|
+
|
|
15
|
+
1. compare the implementation against the approved task-unit goal
|
|
16
|
+
2. flag scope drift or missed acceptance criteria
|
|
17
|
+
3. state `pass`, `pass_with_notes`, or `fail`
|
|
18
|
+
4. hand back the smallest concrete repair scope when failing
|
|
19
|
+
|
|
20
|
+
## Hard Gates
|
|
21
|
+
|
|
22
|
+
- do not invent new product scope
|
|
23
|
+
- do not approve a task unit that skipped a required acceptance point
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function usage() {
|
|
8
|
+
console.error(
|
|
9
|
+
'Usage: node skills/aw-execute/scripts/build-worker-bundle.js --feature <slug> --tasks-file <path> [--output <path>] [--allow-parallel] [--max-parallel-workers <n>]'
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function parseArgs(argv) {
|
|
14
|
+
const args = {
|
|
15
|
+
allowParallel: false,
|
|
16
|
+
maxParallelWorkers: 3,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
20
|
+
const current = argv[index];
|
|
21
|
+
if (current === '--allow-parallel') {
|
|
22
|
+
args.allowParallel = true;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!current.startsWith('--')) {
|
|
27
|
+
throw new Error(`Unexpected argument: ${current}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const next = argv[index + 1];
|
|
31
|
+
if (!next || next.startsWith('--')) {
|
|
32
|
+
throw new Error(`Missing value for ${current}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (current === '--feature') {
|
|
36
|
+
args.featureSlug = next;
|
|
37
|
+
} else if (current === '--tasks-file') {
|
|
38
|
+
args.tasksFile = next;
|
|
39
|
+
} else if (current === '--output') {
|
|
40
|
+
args.output = next;
|
|
41
|
+
} else if (current === '--max-parallel-workers') {
|
|
42
|
+
const parsedValue = Number(next);
|
|
43
|
+
if (!Number.isInteger(parsedValue) || parsedValue < 1) {
|
|
44
|
+
throw new Error('--max-parallel-workers must be a positive integer');
|
|
45
|
+
}
|
|
46
|
+
args.maxParallelWorkers = parsedValue;
|
|
47
|
+
} else {
|
|
48
|
+
throw new Error(`Unknown argument: ${current}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
index += 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!args.featureSlug || !args.tasksFile) {
|
|
55
|
+
usage();
|
|
56
|
+
throw new Error('--feature and --tasks-file are required');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return args;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function toPosixPath(value) {
|
|
63
|
+
return value.split(path.sep).join('/');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseTaskUnits(content) {
|
|
67
|
+
const units = [];
|
|
68
|
+
|
|
69
|
+
for (const line of content.split(/\r?\n/)) {
|
|
70
|
+
const match = line.match(/^\s*(?:- \[[ xX]\]|-|\*|\d+\.)\s+(.+?)\s*$/);
|
|
71
|
+
if (!match) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const title = match[1].trim();
|
|
76
|
+
if (!title) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
units.push(title);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (units.length === 0) {
|
|
84
|
+
throw new Error('No task units found in tasks file');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return units;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function buildRolePrompt({ roleGuide, featureSlug, taskUnitTitle, tasksFilePath, roleName }) {
|
|
91
|
+
return [
|
|
92
|
+
`Load role guide: ${roleGuide}`,
|
|
93
|
+
`Feature slug: ${featureSlug}`,
|
|
94
|
+
`Task unit: ${taskUnitTitle}`,
|
|
95
|
+
`Approved task source: ${tasksFilePath}`,
|
|
96
|
+
`Role: ${roleName}`,
|
|
97
|
+
'Stay within the repo-local AW execute contract and keep the scope bounded.',
|
|
98
|
+
].join('\n');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function buildBundle({ featureSlug, tasksFilePath, allowParallel, maxParallelWorkers, repoRoot }) {
|
|
102
|
+
const taskUnits = parseTaskUnits(fs.readFileSync(tasksFilePath, 'utf8'));
|
|
103
|
+
const referencePaths = {
|
|
104
|
+
implementer: 'skills/aw-execute/references/worker-implementer.md',
|
|
105
|
+
spec_reviewer: 'skills/aw-execute/references/worker-spec-reviewer.md',
|
|
106
|
+
quality_reviewer: 'skills/aw-execute/references/worker-quality-reviewer.md',
|
|
107
|
+
parallel_worker: 'skills/aw-execute/references/worker-parallel-worker.md',
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const relativeTasksFile = toPosixPath(path.relative(repoRoot, tasksFilePath) || path.basename(tasksFilePath));
|
|
111
|
+
const bundle = {
|
|
112
|
+
schema_version: 'aw.execute.worker-bundle.v1',
|
|
113
|
+
feature_slug: featureSlug,
|
|
114
|
+
generated_at: new Date().toISOString(),
|
|
115
|
+
source_tasks_file: relativeTasksFile,
|
|
116
|
+
role_reference_paths: referencePaths,
|
|
117
|
+
task_units: taskUnits.map((title, index) => {
|
|
118
|
+
const taskUnitId = `task-${index + 1}`;
|
|
119
|
+
const parallelCandidate = allowParallel && taskUnits.length > 1;
|
|
120
|
+
|
|
121
|
+
const taskUnit = {
|
|
122
|
+
id: taskUnitId,
|
|
123
|
+
title,
|
|
124
|
+
parallel_candidate: parallelCandidate,
|
|
125
|
+
roles: {
|
|
126
|
+
implementer: {
|
|
127
|
+
reference_path: referencePaths.implementer,
|
|
128
|
+
prompt: buildRolePrompt({
|
|
129
|
+
roleGuide: referencePaths.implementer,
|
|
130
|
+
featureSlug,
|
|
131
|
+
taskUnitTitle: title,
|
|
132
|
+
tasksFilePath: relativeTasksFile,
|
|
133
|
+
roleName: 'implementer',
|
|
134
|
+
}),
|
|
135
|
+
},
|
|
136
|
+
spec_reviewer: {
|
|
137
|
+
reference_path: referencePaths.spec_reviewer,
|
|
138
|
+
prompt: buildRolePrompt({
|
|
139
|
+
roleGuide: referencePaths.spec_reviewer,
|
|
140
|
+
featureSlug,
|
|
141
|
+
taskUnitTitle: title,
|
|
142
|
+
tasksFilePath: relativeTasksFile,
|
|
143
|
+
roleName: 'spec_reviewer',
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
quality_reviewer: {
|
|
147
|
+
reference_path: referencePaths.quality_reviewer,
|
|
148
|
+
prompt: buildRolePrompt({
|
|
149
|
+
roleGuide: referencePaths.quality_reviewer,
|
|
150
|
+
featureSlug,
|
|
151
|
+
taskUnitTitle: title,
|
|
152
|
+
tasksFilePath: relativeTasksFile,
|
|
153
|
+
roleName: 'quality_reviewer',
|
|
154
|
+
}),
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
if (parallelCandidate) {
|
|
160
|
+
taskUnit.roles.parallel_worker = {
|
|
161
|
+
reference_path: referencePaths.parallel_worker,
|
|
162
|
+
prompt: buildRolePrompt({
|
|
163
|
+
roleGuide: referencePaths.parallel_worker,
|
|
164
|
+
featureSlug,
|
|
165
|
+
taskUnitTitle: title,
|
|
166
|
+
tasksFilePath: relativeTasksFile,
|
|
167
|
+
roleName: 'parallel_worker',
|
|
168
|
+
}),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return taskUnit;
|
|
173
|
+
}),
|
|
174
|
+
orchestration_plan: allowParallel
|
|
175
|
+
? {
|
|
176
|
+
sessionName: `aw-execute-${featureSlug}`,
|
|
177
|
+
repoRoot,
|
|
178
|
+
baseRef: 'HEAD',
|
|
179
|
+
max_parallel_workers: maxParallelWorkers,
|
|
180
|
+
seedPaths: [
|
|
181
|
+
'skills/aw-execute/scripts/build-worker-bundle.js',
|
|
182
|
+
...Object.values(referencePaths),
|
|
183
|
+
],
|
|
184
|
+
launcherCommand: 'codex exec --skip-git-repo-check "$(cat {task_file_sh})"',
|
|
185
|
+
workers: taskUnits.map((title, index) => ({
|
|
186
|
+
name: `implementer-task-${index + 1}`,
|
|
187
|
+
task: buildRolePrompt({
|
|
188
|
+
roleGuide: referencePaths.parallel_worker,
|
|
189
|
+
featureSlug,
|
|
190
|
+
taskUnitTitle: title,
|
|
191
|
+
tasksFilePath: relativeTasksFile,
|
|
192
|
+
roleName: 'parallel_worker',
|
|
193
|
+
}),
|
|
194
|
+
})),
|
|
195
|
+
}
|
|
196
|
+
: null,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
return bundle;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function main() {
|
|
203
|
+
try {
|
|
204
|
+
const args = parseArgs(process.argv.slice(2));
|
|
205
|
+
const repoRoot = process.cwd();
|
|
206
|
+
const tasksFilePath = path.resolve(repoRoot, args.tasksFile);
|
|
207
|
+
const outputPath = args.output ? path.resolve(repoRoot, args.output) : null;
|
|
208
|
+
const bundle = buildBundle({
|
|
209
|
+
featureSlug: args.featureSlug,
|
|
210
|
+
tasksFilePath,
|
|
211
|
+
allowParallel: args.allowParallel,
|
|
212
|
+
maxParallelWorkers: args.maxParallelWorkers,
|
|
213
|
+
repoRoot,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const payload = `${JSON.stringify(bundle, null, 2)}\n`;
|
|
217
|
+
if (outputPath) {
|
|
218
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
219
|
+
fs.writeFileSync(outputPath, payload, 'utf8');
|
|
220
|
+
} else {
|
|
221
|
+
process.stdout.write(payload);
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error(error.message);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
main();
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aw-finish
|
|
3
|
+
description: Internal compatibility helper for completing a verified development branch with explicit merge, PR, keep, or discard choices and safe worktree cleanup.
|
|
4
|
+
trigger: Internal only. Invoked when verified branch work is done and the next step is a branch-completion decision rather than a staging deployment.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AW Finish
|
|
8
|
+
|
|
9
|
+
`aw-finish` is a legacy compatibility skill.
|
|
10
|
+
The canonical public release stage remains `/aw:deploy`, but this helper still owns the branch-completion decision flow when that workflow is needed internally.
|
|
11
|
+
|
|
12
|
+
## Hard Gate
|
|
13
|
+
|
|
14
|
+
`aw-test` and `aw-review` must have passed before this skill runs, or the compatibility umbrella must have recorded an equivalent verified outcome.
|
|
15
|
+
If verification failed, route back to `aw-build`, `aw-test`, or `aw-review` instead of finishing.
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Use this skill to close out verified branch work safely:
|
|
20
|
+
|
|
21
|
+
- verify tests before offering completion choices
|
|
22
|
+
- present explicit branch-completion options
|
|
23
|
+
- execute the selected path
|
|
24
|
+
- clean up the worktree only when appropriate
|
|
25
|
+
|
|
26
|
+
If `.aw_docs/features/<feature_slug>/workspace.json` exists, use it as the source of truth for:
|
|
27
|
+
|
|
28
|
+
- the active branch and worktree path
|
|
29
|
+
- cleanup policy
|
|
30
|
+
- orchestration coordination directory
|
|
31
|
+
- the recommended `node scripts/orchestration-status.js ...` status command
|
|
32
|
+
|
|
33
|
+
Staging or production deployment requests should stay on `aw-deploy`.
|
|
34
|
+
|
|
35
|
+
## Deprecation Timeline
|
|
36
|
+
|
|
37
|
+
This skill is still active internally even though `/aw:finish` is deprecated as a public entrypoint.
|
|
38
|
+
Keep `aw-finish` available until `/aw:deploy` fully absorbs branch-completion choices, workspace metadata reuse, and cleanup behavior.
|
|
39
|
+
Public deprecation must not be interpreted as immediate removal of the internal helper.
|
|
40
|
+
|
|
41
|
+
## Completion Flow
|
|
42
|
+
|
|
43
|
+
1. verify tests and validation signals still pass
|
|
44
|
+
2. determine the base branch
|
|
45
|
+
3. present exactly these choices:
|
|
46
|
+
- merge locally
|
|
47
|
+
- push and create PR
|
|
48
|
+
- keep as branch
|
|
49
|
+
- discard
|
|
50
|
+
4. execute the selected path
|
|
51
|
+
5. clean up the worktree when the selected path requires cleanup
|
|
52
|
+
6. update or clear `workspace.json` to reflect the final cleanup decision
|
|
53
|
+
|
|
54
|
+
## Required Options
|
|
55
|
+
|
|
56
|
+
### Option 1: Merge Locally
|
|
57
|
+
|
|
58
|
+
- switch to base branch
|
|
59
|
+
- update from remote when appropriate
|
|
60
|
+
- merge the verified branch
|
|
61
|
+
- rerun the minimum correct verification
|
|
62
|
+
- remove the branch or worktree when safe
|
|
63
|
+
- clear `workspace.json` when cleanup completed successfully
|
|
64
|
+
|
|
65
|
+
### Option 2: Push and Create PR
|
|
66
|
+
|
|
67
|
+
- push the branch
|
|
68
|
+
- create or update the PR with concise summary and test plan
|
|
69
|
+
- keep the worktree if the branch remains active
|
|
70
|
+
- preserve `workspace.json` for the active branch lifecycle
|
|
71
|
+
|
|
72
|
+
### Option 3: Keep As-Is
|
|
73
|
+
|
|
74
|
+
- keep the branch and worktree intact
|
|
75
|
+
- report the branch name and next expected action
|
|
76
|
+
- keep `workspace.json` intact for follow-up work
|
|
77
|
+
|
|
78
|
+
### Option 4: Discard
|
|
79
|
+
|
|
80
|
+
- require explicit confirmation
|
|
81
|
+
- delete the branch or worktree only after confirmation
|
|
82
|
+
- remove `workspace.json` only after cleanup succeeds
|
|
83
|
+
|
|
84
|
+
## Worktree Cleanup Rule
|
|
85
|
+
|
|
86
|
+
Only clean up the worktree automatically for:
|
|
87
|
+
|
|
88
|
+
- merge-complete paths
|
|
89
|
+
- confirmed discard paths
|
|
90
|
+
|
|
91
|
+
Do not clean up the worktree for:
|
|
92
|
+
|
|
93
|
+
- keep-as-branch
|
|
94
|
+
- PR-open workflows where the branch is still in active use
|
|
95
|
+
|
|
96
|
+
## Hard Gates
|
|
97
|
+
|
|
98
|
+
- do not offer completion choices until tests are rechecked
|
|
99
|
+
- do not discard work without explicit confirmation
|
|
100
|
+
- do not turn branch completion into deployment orchestration
|
|
101
|
+
- do not clean up an active PR worktree by accident
|
|
102
|
+
|
|
103
|
+
## Final Output Shape
|
|
104
|
+
|
|
105
|
+
Always end with:
|
|
106
|
+
|
|
107
|
+
- `Verification Check`
|
|
108
|
+
- `Base Branch`
|
|
109
|
+
- `Completion Options`
|
|
110
|
+
- `Selected Path`
|
|
111
|
+
- `Cleanup Decision`
|