@frankzhang2026/opencode-android-orchestrator 0.2.0 → 0.4.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 +30 -1
- package/README.md +85 -43
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/cli.js +127 -10
- package/dist/cli.js.map +1 -1
- package/dist/doctor/installation.d.ts.map +1 -1
- package/dist/doctor/installation.js +29 -4
- package/dist/doctor/installation.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/installer/adaptive-templates.d.ts +25 -3
- package/dist/installer/adaptive-templates.d.ts.map +1 -1
- package/dist/installer/adaptive-templates.js +75 -9
- package/dist/installer/adaptive-templates.js.map +1 -1
- package/dist/installer/index.d.ts +2 -2
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +2 -2
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/init.d.ts +2 -1
- package/dist/installer/init.d.ts.map +1 -1
- package/dist/installer/init.js +11 -2
- package/dist/installer/init.js.map +1 -1
- package/dist/installer/opencode-config.d.ts +4 -3
- package/dist/installer/opencode-config.d.ts.map +1 -1
- package/dist/installer/opencode-config.js +10 -4
- package/dist/installer/opencode-config.js.map +1 -1
- package/dist/installer/upgrade.d.ts +5 -0
- package/dist/installer/upgrade.d.ts.map +1 -1
- package/dist/installer/upgrade.js +44 -10
- package/dist/installer/upgrade.js.map +1 -1
- package/docs/MIGRATION.md +25 -14
- package/docs/SECURITY.md +29 -5
- package/docs/TROUBLESHOOTING.md +25 -6
- package/package.json +1 -1
- package/templates/.opencode/agents/scheduled-coder.md +3 -0
- package/templates/.opencode/agents/scheduled-reviewer.md +5 -4
- package/templates/.opencode/skills/scheduled-quality-coder/SKILL.md +10 -6
- package/templates/.opencode/skills/scheduled-quality-reviewer/SKILL.md +7 -4
- package/templates/AGENTS.md.fragment +4 -0
- package/templates/README.md +5 -2
- package/templates/automation/config.json +18 -0
- package/templates/automation/config.schema.json +31 -0
- package/templates/automation/task-contract.schema.json +22 -1
- package/templates/automation/tasks/TASK-TEMPLATE.json.example +5 -1
- package/templates/scripts/automation/abort-task.sh +5 -10
- package/templates/scripts/automation/accept-and-integrate.sh +1 -1
- package/templates/scripts/automation/acceptance-report.sh +2 -9
- package/templates/scripts/automation/approve-and-run.sh +3 -0
- package/templates/scripts/automation/claim-task.sh +6 -6
- package/templates/scripts/automation/lib.sh +403 -8
- package/templates/scripts/automation/orchestrate-task.sh +1 -1
- package/templates/scripts/automation/preflight.sh +1 -1
- package/templates/scripts/automation/record-red.sh +7 -9
- package/templates/scripts/automation/scope-gate.sh +12 -9
- package/templates/scripts/automation/show-acceptance-review.sh +1 -1
- package/templates/scripts/automation/status.sh +4 -0
- package/templates/scripts/automation/tests/run-tests.sh +164 -9
- package/templates/scripts/automation/validate-contract.sh +16 -5
- package/templates/scripts/automation/verify-integration.sh +12 -11
- package/templates/scripts/automation/verify-task.sh +13 -28
package/docs/MIGRATION.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# Migration guide
|
|
2
2
|
|
|
3
3
|
This guide covers migration to
|
|
4
|
-
`@frankzhang2026/opencode-android-orchestrator@0.
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
`@frankzhang2026/opencode-android-orchestrator@0.4.0`. Pin the exact version and
|
|
5
|
+
prove the migration in a disposable clone before changing a long-lived
|
|
6
|
+
repository.
|
|
7
7
|
|
|
8
8
|
## Choose the migration path
|
|
9
9
|
|
|
10
10
|
| Current state | Correct command after release | Important distinction |
|
|
11
11
|
| --- | --- | --- |
|
|
12
|
-
| No orchestrator files or manifest | `npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
12
|
+
| No orchestrator files or manifest | `npx @frankzhang2026/opencode-android-orchestrator@0.4.0 init .` | Normal new installation; all detected Android modules are enabled by default. |
|
|
13
13
|
| Published `0.1.0` scaffold only | Remove any project-local `@0.1.0` plugin reference after review, then run `init`. | `0.1.0` did not create a usable managed installation and cannot be upgraded. |
|
|
14
|
+
| Healthy `0.2.0` or `0.3.0` manifest-managed installation | Run the fixed `0.4.0` doctor, then `upgrade`. | A missing module-scope field is treated as `primary`; an existing scope is preserved unless explicitly changed. |
|
|
14
15
|
| Manually copied V3 files, no `.automation-plugin/manifest.json` | Finish active tasks, preserve historical evidence separately, then run `init`. | Exact files can be reused; differing managed files fail as conflicts. |
|
|
15
16
|
| Healthy older manifest-managed installation | Run `doctor`, then the fixed target version's `upgrade`. | `upgrade` requires a valid installed manifest and intact original backups. |
|
|
16
17
|
| Healthy current-version manifest | Run `doctor`; repeated `init` or same-version `upgrade` is verification-only and byte-idempotent. | Do not reinstall or delete the manifest. |
|
|
@@ -35,7 +36,7 @@ removes unchanged plugin-created files, and retains drift for manual review.
|
|
|
35
36
|
5. If a managed manifest already exists, run:
|
|
36
37
|
|
|
37
38
|
```sh
|
|
38
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
39
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 doctor . --json
|
|
39
40
|
```
|
|
40
41
|
|
|
41
42
|
Do not proceed with `upgrade` unless the installation checks pass.
|
|
@@ -51,18 +52,22 @@ scaffold, not as an older managed installation.
|
|
|
51
52
|
If the project OpenCode configuration contains an exact
|
|
52
53
|
`@frankzhang2026/opencode-android-orchestrator@0.1.0` entry, save the file and
|
|
53
54
|
remove only that obsolete entry in a reviewed Git change before running
|
|
54
|
-
`0.
|
|
55
|
+
`0.4.0 init`. The merger deliberately rejects a different version of the same
|
|
55
56
|
managed package; it will not silently replace the reference. A global npm
|
|
56
57
|
installation of `0.1.0` alone does not require project-file cleanup.
|
|
57
58
|
|
|
58
59
|
After release, initialize with the fixed version:
|
|
59
60
|
|
|
60
61
|
```sh
|
|
61
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
62
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 init .
|
|
62
63
|
```
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
New installations default to all-module scope, so multiple application modules
|
|
66
|
+
do not require a selection. Use
|
|
67
|
+
`--module-scope primary --primary-module :mobile` only when generated task
|
|
68
|
+
contracts must be restricted to `:mobile`. In all-module scope,
|
|
69
|
+
`--primary-module :mobile` merely chooses the focused-test placeholder's
|
|
70
|
+
default module.
|
|
66
71
|
|
|
67
72
|
## From a manually copied V3 setup
|
|
68
73
|
|
|
@@ -100,15 +105,21 @@ installer to guess which customization should survive.
|
|
|
100
105
|
Use the lifecycle command selected by the active manifest:
|
|
101
106
|
|
|
102
107
|
```sh
|
|
103
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
104
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
108
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 doctor . --json
|
|
109
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 upgrade . --json
|
|
105
110
|
```
|
|
106
111
|
|
|
107
112
|
`upgrade` verifies the installed manifest, every managed file, and every
|
|
108
113
|
first-install backup before it creates recovery state. It reconstructs merged
|
|
109
114
|
OpenCode and AGENTS content from the original pre-install files, carries that
|
|
110
115
|
recovery lineage forward, snapshots the current version, writes the new
|
|
111
|
-
resources, and reruns the
|
|
116
|
+
resources, and reruns the 42 automation tests plus the shadow run.
|
|
117
|
+
|
|
118
|
+
Upgrade preserves an installed `androidProject.moduleScope`. A legacy
|
|
119
|
+
manifest-managed configuration without that field is treated as `primary`,
|
|
120
|
+
which prevents an upgrade from silently expanding its editable module set. To
|
|
121
|
+
adopt all-module scope during a version upgrade, pass `--module-scope all` and
|
|
122
|
+
review the regenerated task example before approving automation.
|
|
112
123
|
|
|
113
124
|
The command refuses:
|
|
114
125
|
|
|
@@ -127,7 +138,7 @@ the source of drift and use the recorded recovery data.
|
|
|
127
138
|
Run all checks from the detected Git root:
|
|
128
139
|
|
|
129
140
|
```sh
|
|
130
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
141
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 doctor .
|
|
131
142
|
opencode debug config
|
|
132
143
|
opencode debug agent scheduled-planner
|
|
133
144
|
opencode debug agent scheduled-coder
|
|
@@ -142,7 +153,7 @@ Verify all of the following before switching normal work to the plugin:
|
|
|
142
153
|
- doctor has no failed check;
|
|
143
154
|
- all three agents, four commands, and required skills are discoverable;
|
|
144
155
|
- both read-only custom tools resolve for the scheduled agents;
|
|
145
|
-
- the Shell suite ends with `1..
|
|
156
|
+
- the Shell suite ends with `1..42`;
|
|
146
157
|
- shadow output contains `"mutationPerformed": false`;
|
|
147
158
|
- `git status --short` contains only the reviewed installation diff;
|
|
148
159
|
- no Git push, launchd registration, extra candidate worktree, or copied Android
|
package/docs/SECURITY.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Security model
|
|
2
2
|
|
|
3
3
|
This document describes the security properties of
|
|
4
|
-
`@frankzhang2026/opencode-android-orchestrator@0.
|
|
5
|
-
|
|
6
|
-
`
|
|
4
|
+
`@frankzhang2026/opencode-android-orchestrator@0.4.0`. The lifecycle foundation
|
|
5
|
+
completed the real OpenCode `1.14.22` and `1.15.13` release matrix in `0.2.0`;
|
|
6
|
+
`0.4.0` retains that compatibility boundary.
|
|
7
7
|
|
|
8
8
|
## Security goals and non-goals
|
|
9
9
|
|
|
@@ -52,7 +52,7 @@ modify local files; this package does not claim to protect against that actor.
|
|
|
52
52
|
|
|
53
53
|
OpenCode permission prompts are also not semantic workflow approval. They can
|
|
54
54
|
be accepted for the remainder of a session and may be auto-approved. For that
|
|
55
|
-
reason `0.
|
|
55
|
+
reason `0.4.0` exposes only `android_orchestrator_status` and
|
|
56
56
|
`android_orchestrator_doctor` as custom tools. State-changing wrappers remain a
|
|
57
57
|
NO-GO until a one-use, non-model-forgeable receipt can bind the approval kind,
|
|
58
58
|
task, session/message, sealed SHA or branch, time, and nonce.
|
|
@@ -105,6 +105,20 @@ plugin options. It rejects malformed/ambiguous files, duplicate identities,
|
|
|
105
105
|
different managed-plugin versions, and symlinks. AGENTS merging owns only one
|
|
106
106
|
marked block and rejects partial, duplicate, or modified markers.
|
|
107
107
|
|
|
108
|
+
New installations generate task examples in `all` module scope: every detected
|
|
109
|
+
Android module's `src/main`, `src/test`, and `src/androidTest` path is eligible,
|
|
110
|
+
while Gradle settings/build files and orchestration resources remain protected.
|
|
111
|
+
`primary` scope narrows the generated paths to one module. Upgrade treats a
|
|
112
|
+
legacy configuration with no scope field as `primary`, preventing an implicit
|
|
113
|
+
permission expansion.
|
|
114
|
+
|
|
115
|
+
The optional repository-root `.automation-worktree-allowlist` is controlled by
|
|
116
|
+
the local human operator, not by task agents. It accepts at most 256 exact,
|
|
117
|
+
normalized repository-relative file paths in a regular file no larger than 64
|
|
118
|
+
KiB. Patterns, directories, duplicates, Git metadata, planning artifacts, and
|
|
119
|
+
configured protected paths fail closed. The control file itself is protected
|
|
120
|
+
and excluded from orchestration change views.
|
|
121
|
+
|
|
108
122
|
The installed manifest is `0600`. Installer control, backup, recovery, and
|
|
109
123
|
history directories are created with private `0700` defaults; backup files
|
|
110
124
|
preserve the original file mode where recovery requires it. Shell resources
|
|
@@ -114,7 +128,7 @@ non-executable.
|
|
|
114
128
|
## Transaction and recovery safety
|
|
115
129
|
|
|
116
130
|
`init` writes original-file backups before publishing a prepared manifest. It
|
|
117
|
-
then applies validated files, runs the
|
|
131
|
+
then applies validated files, runs the 42-case transaction suite and a shadow
|
|
118
132
|
run, verifies final hashes/modes, and only then marks the manifest installed.
|
|
119
133
|
Failure before completion restores originals and removes safely unchanged new
|
|
120
134
|
files.
|
|
@@ -144,6 +158,13 @@ the recorded before/after hashes and Git refs.
|
|
|
144
158
|
ready. Successful integration creates exactly one combined local commit.
|
|
145
159
|
- Scope gates inspect tracked and untracked changes, reject protected paths and
|
|
146
160
|
obvious test weakening, and bind the accepted result to a diff SHA.
|
|
161
|
+
- An approved task snapshots the validated worktree allowlist. Listed local
|
|
162
|
+
changes are excluded consistently from cleanliness, scope, hashes, evidence,
|
|
163
|
+
archival, and commits; explicit commit pathsets preserve allowlisted staged
|
|
164
|
+
entries, and rename detection cannot hide an unlisted source path. Changing
|
|
165
|
+
the control file mid-task cannot widen the active snapshot. Status exposes
|
|
166
|
+
the effective list to Coder and Reviewer sessions and returns an empty list
|
|
167
|
+
inside isolated task worktrees.
|
|
147
168
|
- Integration reruns verification before a fast-forward. It never pushes.
|
|
148
169
|
- A successfully integrated task branch is deleted only after the original
|
|
149
170
|
branch reaches the verified commit. Failure preserves the branch for
|
|
@@ -202,6 +223,9 @@ commit installer recovery data unless an explicit internal policy requires it.
|
|
|
202
223
|
validating its storage and cleanup policy.
|
|
203
224
|
- Recovery evidence improves auditability but increases local sensitive-data
|
|
204
225
|
retention.
|
|
226
|
+
- A human can intentionally hide a product-file change by allowlisting its
|
|
227
|
+
exact path. Such a file is outside the task's reviewed and committed result;
|
|
228
|
+
remove it from the list before any task that is expected to modify it.
|
|
205
229
|
- Real dual-version end-to-end acceptance and a clean install from the final
|
|
206
230
|
tarball remain mandatory release gates.
|
|
207
231
|
|
package/docs/TROUBLESHOOTING.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
3
|
Use this guide for
|
|
4
|
-
`@frankzhang2026/opencode-android-orchestrator@0.
|
|
5
|
-
unpublished, so lifecycle commands shown here are post-release commands unless
|
|
6
|
-
you are working in an isolated maintainer fixture.
|
|
4
|
+
`@frankzhang2026/opencode-android-orchestrator@0.4.0`.
|
|
7
5
|
|
|
8
6
|
## Start with read-only evidence
|
|
9
7
|
|
|
@@ -13,7 +11,7 @@ From the repository root, capture:
|
|
|
13
11
|
git status --short --branch
|
|
14
12
|
git rev-parse HEAD
|
|
15
13
|
opencode --version
|
|
16
|
-
npx @frankzhang2026/opencode-android-orchestrator@0.
|
|
14
|
+
npx @frankzhang2026/opencode-android-orchestrator@0.4.0 doctor . --json
|
|
17
15
|
```
|
|
18
16
|
|
|
19
17
|
If installation never completed, doctor will correctly report a missing or
|
|
@@ -41,8 +39,9 @@ remain human-readable on stderr with a stable code such as `[FILE_CONFLICT]`.
|
|
|
41
39
|
| OpenCode version failure | Installed version is below `1.14.22`, at or above `1.16.0`, or cannot be parsed/executed. | Install a certified version (`1.14.22` or `1.15.13`) for release validation. Do not bypass the version gate. |
|
|
42
40
|
| Git root or Android project not detected | The target is outside a Git repository, settings are missing, or no supported Android module was found. | Run from the intended repository/module and inspect `settings.gradle` or `settings.gradle.kts`. Nested Gradle roots are intentionally unsupported. |
|
|
43
41
|
| Gradle Wrapper failure | `gradlew` or `gradle/wrapper/gradle-wrapper.properties` is missing, or `gradlew` is not executable. | Restore the project's reviewed Wrapper files. Do not let the installer generate or replace build configuration. |
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
42
|
+
| `MODULE_SCOPE_INVALID` or an invalid `--module-scope` argument | The value is not `all` or `primary`. | Use `all` for the default all-module contract or `primary` for an intentional single-module restriction. |
|
|
43
|
+
| `PRIMARY_MODULE_AMBIGUOUS` | Restrictive `primary` scope has multiple possible Android modules. | Supply an exact Gradle path, for example `--module-scope primary --primary-module :mobile`, or use the default `all` scope. |
|
|
44
|
+
| `PRIMARY_MODULE_NOT_FOUND` | The selected Gradle path was not detected. | Use a module path reported by doctor/project detection; do not pass a filesystem directory. |
|
|
46
45
|
| Android SDK failure | No valid explicit SDK, `ANDROID_HOME`, `ANDROID_SDK_ROOT`, or `local.properties` `sdk.dir` was found. | Configure one real SDK root containing `platforms/` and `build-tools/`. Do not publish `local.properties`. |
|
|
47
46
|
| Missing `git`, `jq`, `rg`, `shasum`, or Java | Required deterministic command is unavailable on `PATH`. | Install or restore the missing command, record its version, and rerun the read-only checks. |
|
|
48
47
|
|
|
@@ -61,6 +60,26 @@ plugins, required skills, agent permissions, and both read-only custom tools.
|
|
|
61
60
|
If it fails, preserve its exact output. Do not broaden an agent's default-deny
|
|
62
61
|
permissions to make discovery pass.
|
|
63
62
|
|
|
63
|
+
## Worktree allowlist failures
|
|
64
|
+
|
|
65
|
+
Use `.automation-worktree-allowlist` only for intentional local changes that
|
|
66
|
+
must remain outside every task diff and commit. The file belongs in the Git
|
|
67
|
+
repository root, with one exact repository-relative file path per line.
|
|
68
|
+
|
|
69
|
+
| Symptom | Likely cause | Safe response |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `Git worktree is dirty` | At least one tracked or untracked change is not listed. | Inspect `git status --short`. Commit/revert the task-relevant change, or add only an intentionally local exact file path to the allowlist. |
|
|
72
|
+
| `must be exact file paths, not patterns` | An entry contains `*`, `?`, or bracket syntax. | Replace it with each exact file path; directory-wide bypasses are intentionally unsupported. |
|
|
73
|
+
| `must not include a protected path` or `reserved or unsafe` | The entry targets orchestration, Gradle, Git metadata, a plan, or another protected path. | Remove the entry. Protected control and planning files must remain visible to the gates. |
|
|
74
|
+
| `must be a regular file, not a symlink` | The control file is a symlink or another unsupported file type. | Replace it with a small regular text file at the repository root. |
|
|
75
|
+
| A task does not include a file you expected it to edit | The path was in the snapshot taken at contract approval. | Finish/abort the active task, remove the entry, then start and approve a new task. |
|
|
76
|
+
| A local rename still blocks startup | Only the new or old name is listed. | Add both exact paths; rename detection treats the source deletion and destination addition independently. |
|
|
77
|
+
|
|
78
|
+
The control file itself does not block orchestration and does not require a
|
|
79
|
+
`.gitignore` entry for that purpose. Git may still display it in ordinary
|
|
80
|
+
`git status`, which is separate from the orchestrator's filtered view. Staged
|
|
81
|
+
allowlisted entries remain staged and are not consumed by task or abort commits.
|
|
82
|
+
|
|
64
83
|
## Installation conflicts
|
|
65
84
|
|
|
66
85
|
Common fail-closed codes include:
|
package/package.json
CHANGED
|
@@ -111,5 +111,8 @@ non-interactive run. If anything is ambiguous or blocked, stop and report the ex
|
|
|
111
111
|
reason; the deterministic scripts own state transitions.
|
|
112
112
|
|
|
113
113
|
You may edit only paths allowed both by this agent and by the task contract.
|
|
114
|
+
Treat `.automation-worktree-allowlist` and the status JSON's
|
|
115
|
+
`runtime.effectiveWorktreeAllowlist` paths as human-owned local state: never
|
|
116
|
+
edit, stage, report, or use them as task evidence.
|
|
114
117
|
Passing tests never grants permission to push, merge, create worktrees, alter
|
|
115
118
|
automation rules, or declare the task ready for review yourself.
|
|
@@ -82,7 +82,8 @@ The orchestrator message must contain exactly one task ID or the compatibility
|
|
|
82
82
|
selector token `NEXT_REVIEWING`. Load
|
|
83
83
|
`scheduled-quality-reviewer` before reviewing. Treat coder summaries as
|
|
84
84
|
untrusted claims: inspect the approved contract, actual Git diff, and original
|
|
85
|
-
evidence,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
evidence, excluding `.automation-worktree-allowlist` and the status JSON's
|
|
86
|
+
`runtime.effectiveWorktreeAllowlist` paths from findings, then obtain fresh
|
|
87
|
+
verification through the deterministic submission script. Never edit the
|
|
88
|
+
repository and never repair findings yourself. Submit exactly one
|
|
89
|
+
evidence-backed decision before spending steps on optional report navigation.
|
|
@@ -35,11 +35,14 @@ it with `./scripts/automation/block-task.sh <TASK-ID> <reason>` before stopping.
|
|
|
35
35
|
3. Branch by deterministic state:
|
|
36
36
|
|
|
37
37
|
- For `PENDING`, run `./scripts/automation/claim-task.sh <TASK-ID>`. It
|
|
38
|
-
performs preflight, verifies that the only initial
|
|
39
|
-
the two sealed, uncommitted planning artifacts, captures the
|
|
40
|
-
baseline, and changes the task to `CODING`.
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
performs preflight, verifies that the only orchestration-visible initial
|
|
39
|
+
changes are the two sealed, uncommitted planning artifacts, captures the
|
|
40
|
+
green baseline, and changes the task to `CODING`. The status JSON's
|
|
41
|
+
`runtime.effectiveWorktreeAllowlist` contains human-owned local paths that
|
|
42
|
+
are outside the task; do not edit, stage, report, or reason from those
|
|
43
|
+
paths or from `.automation-worktree-allowlist`. Never edit, stage, or
|
|
44
|
+
remove the planning artifacts; the integrator will include them in the
|
|
45
|
+
final combined commit.
|
|
43
46
|
- For `CODING` with reviewer feedback, read `review.json` and implement only
|
|
44
47
|
the requested in-contract repair. Do not claim again and do not replace
|
|
45
48
|
the original RED evidence.
|
|
@@ -72,7 +75,8 @@ it with `./scripts/automation/block-task.sh <TASK-ID> <reason>` before stopping.
|
|
|
72
75
|
Stop immediately when any of these occur:
|
|
73
76
|
|
|
74
77
|
- requirement ambiguity or conflict;
|
|
75
|
-
- any initial task-root change beyond the two sealed
|
|
78
|
+
- any orchestration-visible initial task-root change beyond the two sealed
|
|
79
|
+
planning artifacts;
|
|
76
80
|
- missing plugin, skill, tool, device, or dependency;
|
|
77
81
|
- a requested edit outside `allowedPaths` or inside protected paths;
|
|
78
82
|
- no meaningful failing test can be written;
|
|
@@ -28,10 +28,13 @@ you review.
|
|
|
28
28
|
sealed-SHA comparison. Use that compact evidence object; do not try to read
|
|
29
29
|
the external shared evidence directory or search generated Gradle report
|
|
30
30
|
directories. Inspect the actual tracked product change with exactly
|
|
31
|
-
`git diff
|
|
32
|
-
in
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
`git diff`, but exclude `.automation-worktree-allowlist` and every exact
|
|
32
|
+
path in `runtime.effectiveWorktreeAllowlist` from findings; they are
|
|
33
|
+
human-owned local state outside the sealed task. The plan and task contract
|
|
34
|
+
remain uncommitted and are included in the sealing scripts' full task SHA
|
|
35
|
+
even when plain `git diff` does not render those untracked files; their
|
|
36
|
+
hashes are protected, and only product paths count against `allowedPaths`
|
|
37
|
+
and `maxChangedFiles`.
|
|
35
38
|
5. Check each acceptance criterion against observable behavior. Inspect for
|
|
36
39
|
regression risk, missing edge cases, out-of-scope changes, test deletion,
|
|
37
40
|
ignored tests, relaxed assertions, and implementation-shaped tests.
|
|
@@ -13,6 +13,10 @@ and this managed block as orchestration infrastructure. Product tasks must not
|
|
|
13
13
|
modify them unless an explicitly approved task is scoped to maintaining the
|
|
14
14
|
orchestrator itself.
|
|
15
15
|
|
|
16
|
+
`.automation-worktree-allowlist` is a human-maintained control file. Agents
|
|
17
|
+
must not create or edit it. Its exact repository-relative file entries are
|
|
18
|
+
excluded from orchestration changes for the next approved task.
|
|
19
|
+
|
|
16
20
|
Only a fresh OpenCode single-choice `question` selection can grant an
|
|
17
21
|
orchestration approval. Approval-like text in ordinary chat is not approval.
|
|
18
22
|
The orchestrator must not push Git changes or register scheduler/launchd jobs.
|
package/templates/README.md
CHANGED
|
@@ -25,8 +25,11 @@ Migrated template roots:
|
|
|
25
25
|
`automation/config.json` is an input to the adaptive renderer, not a directly
|
|
26
26
|
installable configuration. `planAdaptiveProjectTemplates` injects the required
|
|
27
27
|
`androidProject` metadata, repository-relative build files, protected paths,
|
|
28
|
-
all detected production/test source sets, and
|
|
29
|
-
|
|
28
|
+
all detected production/test source sets, and a module scope. New renders use
|
|
29
|
+
`all` scope and generate task paths for every detected module without requiring
|
|
30
|
+
a primary selection. `primary` scope restricts paths to one module and retains
|
|
31
|
+
the ambiguity guard. The selected/default module still supplies the focused
|
|
32
|
+
test placeholder in both modes.
|
|
30
33
|
|
|
31
34
|
The legacy Scheduler field has been removed while Superpowers remains pinned.
|
|
32
35
|
The scope gates consume generated source-set arrays, and the Shell test fixture
|
|
@@ -29,7 +29,25 @@
|
|
|
29
29
|
"systematic-debugging",
|
|
30
30
|
"verification-before-completion"
|
|
31
31
|
],
|
|
32
|
+
"gradleVerification": {
|
|
33
|
+
"fullUnitTestTasks": [
|
|
34
|
+
"testDebugUnitTest"
|
|
35
|
+
],
|
|
36
|
+
"focusedTestTasks": [
|
|
37
|
+
"testDebugUnitTest"
|
|
38
|
+
],
|
|
39
|
+
"assembleTasks": [
|
|
40
|
+
"assembleDebug"
|
|
41
|
+
],
|
|
42
|
+
"lintTasks": [
|
|
43
|
+
"lint"
|
|
44
|
+
],
|
|
45
|
+
"deviceTestTasks": [
|
|
46
|
+
"connectedDebugAndroidTest"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
32
49
|
"protectedPaths": [
|
|
50
|
+
".automation-worktree-allowlist",
|
|
33
51
|
".opencode/",
|
|
34
52
|
".automation-plugin/",
|
|
35
53
|
"automation/",
|
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
"nullableIdentifier": {
|
|
14
14
|
"type": ["string", "null"],
|
|
15
15
|
"minLength": 1
|
|
16
|
+
},
|
|
17
|
+
"gradleTask": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"minLength": 1,
|
|
20
|
+
"pattern": "^(?:[A-Za-z][A-Za-z0-9_.-]*|(?::[A-Za-z0-9_.-]+)+)$"
|
|
21
|
+
},
|
|
22
|
+
"gradleTaskList": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"minItems": 1,
|
|
25
|
+
"uniqueItems": true,
|
|
26
|
+
"items": { "$ref": "#/$defs/gradleTask" }
|
|
16
27
|
}
|
|
17
28
|
},
|
|
18
29
|
"required": [
|
|
@@ -30,6 +41,7 @@
|
|
|
30
41
|
"approvalPhrases",
|
|
31
42
|
"plugins",
|
|
32
43
|
"requiredSkills",
|
|
44
|
+
"gradleVerification",
|
|
33
45
|
"androidProject",
|
|
34
46
|
"protectedPaths"
|
|
35
47
|
],
|
|
@@ -72,6 +84,24 @@
|
|
|
72
84
|
"uniqueItems": true,
|
|
73
85
|
"items": { "type": "string", "minLength": 1 }
|
|
74
86
|
},
|
|
87
|
+
"gradleVerification": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"required": [
|
|
91
|
+
"fullUnitTestTasks",
|
|
92
|
+
"focusedTestTasks",
|
|
93
|
+
"assembleTasks",
|
|
94
|
+
"lintTasks",
|
|
95
|
+
"deviceTestTasks"
|
|
96
|
+
],
|
|
97
|
+
"properties": {
|
|
98
|
+
"fullUnitTestTasks": { "$ref": "#/$defs/gradleTaskList" },
|
|
99
|
+
"focusedTestTasks": { "$ref": "#/$defs/gradleTaskList" },
|
|
100
|
+
"assembleTasks": { "$ref": "#/$defs/gradleTaskList" },
|
|
101
|
+
"lintTasks": { "$ref": "#/$defs/gradleTaskList" },
|
|
102
|
+
"deviceTestTasks": { "$ref": "#/$defs/gradleTaskList" }
|
|
103
|
+
}
|
|
104
|
+
},
|
|
75
105
|
"androidProject": {
|
|
76
106
|
"type": "object",
|
|
77
107
|
"additionalProperties": false,
|
|
@@ -88,6 +118,7 @@
|
|
|
88
118
|
"name": { "type": "string", "minLength": 1 },
|
|
89
119
|
"gradleDsl": { "enum": ["kotlin", "groovy", "mixed"] },
|
|
90
120
|
"settingsFile": { "$ref": "#/$defs/repositoryPath" },
|
|
121
|
+
"moduleScope": { "enum": ["all", "primary"] },
|
|
91
122
|
"primaryModule": {
|
|
92
123
|
"type": "string",
|
|
93
124
|
"pattern": "^:(?:[A-Za-z0-9_.-]+(?::[A-Za-z0-9_.-]+)*)?$"
|
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
"title": "Scheduled coding task contract",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
|
+
"$defs": {
|
|
8
|
+
"gradleTask": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"minLength": 1,
|
|
11
|
+
"pattern": "^(?:[A-Za-z][A-Za-z0-9_.-]*|(?::[A-Za-z0-9_.-]+)+)$"
|
|
12
|
+
},
|
|
13
|
+
"testFilter": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"pattern": "^[A-Za-z0-9_.#$*-]+$"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
7
19
|
"required": [
|
|
8
20
|
"schemaVersion",
|
|
9
21
|
"id",
|
|
@@ -62,7 +74,16 @@
|
|
|
62
74
|
"targetTests": {
|
|
63
75
|
"type": "array",
|
|
64
76
|
"minItems": 1,
|
|
65
|
-
"
|
|
77
|
+
"uniqueItems": true,
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"required": ["gradleTask", "filter"],
|
|
82
|
+
"properties": {
|
|
83
|
+
"gradleTask": { "$ref": "#/$defs/gradleTask" },
|
|
84
|
+
"filter": { "$ref": "#/$defs/testFilter" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
66
87
|
},
|
|
67
88
|
"deviceTestsRequired": { "type": "boolean" },
|
|
68
89
|
"testPolicy": { "enum": ["required", "not-required"] },
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"**/src/androidTest/**"
|
|
14
14
|
],
|
|
15
15
|
"forbiddenPaths": [
|
|
16
|
+
".automation-worktree-allowlist",
|
|
16
17
|
".opencode/**",
|
|
17
18
|
".automation-plugin/**",
|
|
18
19
|
"automation/**",
|
|
@@ -45,7 +46,10 @@
|
|
|
45
46
|
"Do not upgrade dependencies or Gradle configuration"
|
|
46
47
|
],
|
|
47
48
|
"targetTests": [
|
|
48
|
-
|
|
49
|
+
{
|
|
50
|
+
"gradleTask": "testDebugUnitTest",
|
|
51
|
+
"filter": "*ReplaceWithFocusedTest"
|
|
52
|
+
}
|
|
49
53
|
],
|
|
50
54
|
"deviceTestsRequired": false,
|
|
51
55
|
"testPolicy": "required",
|
|
@@ -59,6 +59,7 @@ if [[ -d "$task_root" ]]; then
|
|
|
59
59
|
changed_paths=()
|
|
60
60
|
changed_path_count=0
|
|
61
61
|
product_path_count=0
|
|
62
|
+
changed_path_list="$(automation_changed_paths_at "$task_root")"
|
|
62
63
|
while IFS= read -r path; do
|
|
63
64
|
if [[ -n "$path" ]]; then
|
|
64
65
|
changed_paths+=("$path")
|
|
@@ -67,16 +68,10 @@ if [[ -d "$task_root" ]]; then
|
|
|
67
68
|
product_path_count=$((product_path_count + 1))
|
|
68
69
|
fi
|
|
69
70
|
fi
|
|
70
|
-
done
|
|
71
|
+
done <<< "$changed_path_list"
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
git -C "$task_root" diff --binary HEAD --
|
|
75
|
-
while IFS= read -r path; do
|
|
76
|
-
[[ -n "$path" ]] || continue
|
|
77
|
-
git -C "$task_root" diff --binary --no-index -- /dev/null "$task_root/$path" || [[ "$?" -eq 1 ]]
|
|
78
|
-
done < <(git -C "$task_root" ls-files --others --exclude-standard | LC_ALL=C sort)
|
|
79
|
-
} > "$evidence_dir/aborted.diff"
|
|
73
|
+
automation_worktree_status_at "$task_root" > "$evidence_dir/abort-status.txt"
|
|
74
|
+
automation_worktree_patch_at "$task_root" > "$evidence_dir/aborted.diff"
|
|
80
75
|
|
|
81
76
|
if [[ "$changed_path_count" -gt 0 ]]; then
|
|
82
77
|
for path in "${changed_paths[@]}"; do
|
|
@@ -92,7 +87,7 @@ if [[ -d "$task_root" ]]; then
|
|
|
92
87
|
done
|
|
93
88
|
if [[ "$product_path_count" -gt 0 ]]; then
|
|
94
89
|
git -C "$task_root" add -- "${changed_paths[@]}"
|
|
95
|
-
git -C "$task_root" commit -m "Archive aborted work for $task_id"
|
|
90
|
+
git -C "$task_root" commit --only -m "Archive aborted work for $task_id" -- "${changed_paths[@]}"
|
|
96
91
|
recovery_commit="$(git -C "$task_root" rev-parse HEAD)"
|
|
97
92
|
else
|
|
98
93
|
plan_rel="$(jq -er '.planPath' "$origin_file")"
|
|
@@ -134,7 +134,7 @@ done < <(automation_changed_paths_at "$task_root")
|
|
|
134
134
|
[[ "${#commit_paths[@]}" -ge 3 ]] || automation_die "final commit must contain product changes and both planning artifacts"
|
|
135
135
|
git -C "$task_root" add -- "${commit_paths[@]}"
|
|
136
136
|
title="$(jq -er '.title' "$task_root/automation/tasks/$task_id.json")"
|
|
137
|
-
git -C "$task_root" commit -m "Implement $title ($task_id)"
|
|
137
|
+
git -C "$task_root" commit --only -m "Implement $title ($task_id)" -- "${commit_paths[@]}"
|
|
138
138
|
product_commit="$(git -C "$task_root" rev-parse HEAD)"
|
|
139
139
|
automation_worktree_is_clean "$task_root" || automation_die "task root is dirty after the combined task commit"
|
|
140
140
|
git -C "$task_root" merge-base --is-ancestor "$baseline_head" "$product_commit" || automation_die "combined task commit is not based on the recorded pre-task baseline"
|
|
@@ -52,17 +52,10 @@ while IFS= read -r path; do
|
|
|
52
52
|
done < <(automation_product_changed_paths_at "$task_id" "$AUTOMATION_ROOT")
|
|
53
53
|
changed_paths_json="$(printf '%s\n' "${changed_paths[@]}" | jq -Rsc 'split("\n") | map(select(length > 0))')"
|
|
54
54
|
planning_artifacts_json="$(jq -c '[.planPath, .contractPath]' "$origin_file")"
|
|
55
|
-
diff_stat="$(
|
|
56
|
-
untracked_paths="$(git -C "$AUTOMATION_ROOT" ls-files --others --exclude-standard | LC_ALL=C sort)"
|
|
55
|
+
diff_stat="$(automation_worktree_diff_stat_at "$AUTOMATION_ROOT")"
|
|
57
56
|
|
|
58
57
|
sealed_diff="$evidence_dir/sealed.diff"
|
|
59
|
-
|
|
60
|
-
git -C "$AUTOMATION_ROOT" diff --binary HEAD --
|
|
61
|
-
while IFS= read -r path; do
|
|
62
|
-
[[ -n "$path" ]] || continue
|
|
63
|
-
git -C "$AUTOMATION_ROOT" diff --binary --no-index -- /dev/null "$AUTOMATION_ROOT/$path" || [[ "$?" -eq 1 ]]
|
|
64
|
-
done <<< "$untracked_paths"
|
|
65
|
-
} > "$sealed_diff"
|
|
58
|
+
automation_worktree_patch_at "$AUTOMATION_ROOT" > "$sealed_diff"
|
|
66
59
|
|
|
67
60
|
report_file="$evidence_dir/acceptance-report.json"
|
|
68
61
|
jq -n \
|
|
@@ -48,6 +48,7 @@ for planning_path in "$plan_rel" "$contract_rel"; do
|
|
|
48
48
|
automation_die "planning artifact must remain a new untracked file until the combined task commit: $planning_path"
|
|
49
49
|
fi
|
|
50
50
|
done
|
|
51
|
+
worktree_allowlist_json="$(automation_worktree_allowlist_file_json_at "$source_root")"
|
|
51
52
|
|
|
52
53
|
automation_require_command git
|
|
53
54
|
automation_require_command jq
|
|
@@ -159,11 +160,13 @@ jq -n \
|
|
|
159
160
|
--arg taskBranch "$task_branch" \
|
|
160
161
|
--arg worktreeBase "$worktree_base" \
|
|
161
162
|
--arg createdAt "$(automation_now)" \
|
|
163
|
+
--argjson worktreeAllowlist "$worktree_allowlist_json" \
|
|
162
164
|
'{taskId: $taskId, sourceRoot: $sourceRoot, originalBranch: $originalBranch,
|
|
163
165
|
baselineHead: $baselineHead, workspaceStrategy: $workspaceStrategy,
|
|
164
166
|
taskRoot: $taskRoot, repositoryLeaseRequired: true,
|
|
165
167
|
planningArtifactsCommitPolicy: "withProductChanges",
|
|
166
168
|
taskBranch: $taskBranch, worktreeBase: $worktreeBase,
|
|
169
|
+
worktreeAllowlist: $worktreeAllowlist,
|
|
167
170
|
codingCycle: 0, reviewCycles: 0, createdAt: $createdAt}' \
|
|
168
171
|
| automation_record_json "$workspace_file"
|
|
169
172
|
|
|
@@ -30,12 +30,10 @@ baseline_meta="$evidence_dir/baseline.json"
|
|
|
30
30
|
protected_hashes="$evidence_dir/protected.sha256"
|
|
31
31
|
started_at="$(automation_now)"
|
|
32
32
|
head_commit="$(git -C "$AUTOMATION_ROOT" rev-parse HEAD)"
|
|
33
|
+
baseline_command="$(automation_gradle_group_command_json "fullUnitTestTasks")"
|
|
33
34
|
|
|
34
35
|
set +e
|
|
35
|
-
|
|
36
|
-
cd "$AUTOMATION_ROOT"
|
|
37
|
-
./gradlew testDebugUnitTest
|
|
38
|
-
) 2>&1 | tee "$baseline_log"
|
|
36
|
+
automation_run_gradle_group "fullUnitTestTasks" "$AUTOMATION_ROOT" 2>&1 | tee "$baseline_log"
|
|
39
37
|
baseline_status=${PIPESTATUS[0]}
|
|
40
38
|
set -e
|
|
41
39
|
|
|
@@ -45,8 +43,9 @@ if [[ "$baseline_status" -ne 0 ]]; then
|
|
|
45
43
|
--arg startedAt "$started_at" \
|
|
46
44
|
--arg finishedAt "$(automation_now)" \
|
|
47
45
|
--arg head "$head_commit" \
|
|
46
|
+
--argjson command "$baseline_command" \
|
|
48
47
|
--argjson exitCode "$baseline_status" \
|
|
49
|
-
'{taskId: $taskId, startedAt: $startedAt, finishedAt: $finishedAt, head: $head, command:
|
|
48
|
+
'{taskId: $taskId, startedAt: $startedAt, finishedAt: $finishedAt, head: $head, command: $command, exitCode: $exitCode}' \
|
|
50
49
|
| automation_record_json "$baseline_meta"
|
|
51
50
|
automation_transition_state "$task_id" "CODING" "BLOCKED" "preflight" "baseline unit tests failed"
|
|
52
51
|
automation_die "baseline unit tests failed"
|
|
@@ -68,7 +67,8 @@ jq -n \
|
|
|
68
67
|
--arg finishedAt "$(automation_now)" \
|
|
69
68
|
--arg head "$head_commit" \
|
|
70
69
|
--arg worktree "$AUTOMATION_ROOT" \
|
|
71
|
-
|
|
70
|
+
--argjson command "$baseline_command" \
|
|
71
|
+
'{taskId: $taskId, startedAt: $startedAt, finishedAt: $finishedAt, head: $head, worktree: $worktree, command: $command, exitCode: 0}' \
|
|
72
72
|
| automation_record_json "$baseline_meta"
|
|
73
73
|
|
|
74
74
|
automation_info "$task_id claimed; baseline is green"
|