@frankzhang2026/opencode-android-orchestrator 0.1.0 → 0.2.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 +75 -2
- package/LICENSE +21 -0
- package/README.md +391 -6
- package/THIRD_PARTY_NOTICES.md +119 -0
- package/dist/cli.js +243 -1
- package/dist/cli.js.map +1 -1
- package/dist/compatibility/hooks.d.ts +23 -0
- package/dist/compatibility/hooks.d.ts.map +1 -0
- package/dist/compatibility/hooks.js +44 -0
- package/dist/compatibility/hooks.js.map +1 -0
- package/dist/compatibility/versions.d.ts +19 -0
- package/dist/compatibility/versions.d.ts.map +1 -1
- package/dist/compatibility/versions.js +116 -0
- package/dist/compatibility/versions.js.map +1 -1
- package/dist/doctor/index.d.ts +36 -0
- package/dist/doctor/index.d.ts.map +1 -0
- package/dist/doctor/index.js +289 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/doctor/installation.d.ts +4 -0
- package/dist/doctor/installation.d.ts.map +1 -0
- package/dist/doctor/installation.js +472 -0
- package/dist/doctor/installation.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/installer/adaptive-templates.d.ts +56 -0
- package/dist/installer/adaptive-templates.d.ts.map +1 -0
- package/dist/installer/adaptive-templates.js +167 -0
- package/dist/installer/adaptive-templates.js.map +1 -0
- package/dist/installer/agents-config.d.ts +19 -0
- package/dist/installer/agents-config.d.ts.map +1 -0
- package/dist/installer/agents-config.js +147 -0
- package/dist/installer/agents-config.js.map +1 -0
- package/dist/installer/android-project.d.ts +36 -0
- package/dist/installer/android-project.d.ts.map +1 -0
- package/dist/installer/android-project.js +418 -0
- package/dist/installer/android-project.js.map +1 -0
- package/dist/installer/index.d.ts +8 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +8 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/init.d.ts +67 -0
- package/dist/installer/init.d.ts.map +1 -0
- package/dist/installer/init.js +389 -0
- package/dist/installer/init.js.map +1 -0
- package/dist/installer/install-manifest.d.ts +132 -0
- package/dist/installer/install-manifest.d.ts.map +1 -0
- package/dist/installer/install-manifest.js +1047 -0
- package/dist/installer/install-manifest.js.map +1 -0
- package/dist/installer/opencode-config.d.ts +31 -0
- package/dist/installer/opencode-config.d.ts.map +1 -0
- package/dist/installer/opencode-config.js +296 -0
- package/dist/installer/opencode-config.js.map +1 -0
- package/dist/installer/uninstall.d.ts +70 -0
- package/dist/installer/uninstall.d.ts.map +1 -0
- package/dist/installer/uninstall.js +770 -0
- package/dist/installer/uninstall.js.map +1 -0
- package/dist/installer/upgrade.d.ts +96 -0
- package/dist/installer/upgrade.d.ts.map +1 -0
- package/dist/installer/upgrade.js +1106 -0
- package/dist/installer/upgrade.js.map +1 -0
- package/dist/opencode-plugin.d.ts +2 -0
- package/dist/opencode-plugin.d.ts.map +1 -0
- package/dist/opencode-plugin.js +4 -0
- package/dist/opencode-plugin.js.map +1 -0
- package/dist/plugin/index.d.ts +7 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +23 -6
- package/dist/plugin/index.js.map +1 -1
- package/dist/tools/index.d.ts +35 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +197 -1
- package/dist/tools/index.js.map +1 -1
- package/docs/MIGRATION.md +173 -0
- package/docs/SECURITY.md +212 -0
- package/docs/TROUBLESHOOTING.md +172 -0
- package/package.json +23 -5
- package/templates/.opencode/agents/scheduled-coder.md +115 -0
- package/templates/.opencode/agents/scheduled-planner.md +166 -0
- package/templates/.opencode/agents/scheduled-reviewer.md +88 -0
- package/templates/.opencode/commands/abort-task.md +20 -0
- package/templates/.opencode/commands/acceptance.md +20 -0
- package/templates/.opencode/commands/change.md +23 -0
- package/templates/.opencode/commands/resume-review.md +19 -0
- package/templates/.opencode/skills/scheduled-quality-coder/SKILL.md +93 -0
- package/templates/.opencode/skills/scheduled-quality-orchestrator/SKILL.md +216 -0
- package/templates/.opencode/skills/scheduled-quality-reviewer/SKILL.md +68 -0
- package/templates/AGENTS.md.fragment +19 -0
- package/templates/README.md +52 -9
- package/templates/automation/config.json +50 -0
- package/templates/automation/config.schema.json +163 -0
- package/templates/automation/task-contract.schema.json +71 -0
- package/templates/automation/tasks/TASK-TEMPLATE.json.example +53 -0
- package/templates/docs/plans/README.md +26 -0
- package/templates/installation-manifest.schema.json +201 -0
- package/templates/scripts/automation/abort-task.sh +171 -0
- package/templates/scripts/automation/accept-and-integrate.sh +263 -0
- package/templates/scripts/automation/acceptance-report.sh +132 -0
- package/templates/scripts/automation/approve-and-run.sh +175 -0
- package/templates/scripts/automation/begin-review.sh +18 -0
- package/templates/scripts/automation/block-task.sh +26 -0
- package/templates/scripts/automation/claim-task.sh +74 -0
- package/templates/scripts/automation/integration-scope-gate.sh +103 -0
- package/templates/scripts/automation/lib.sh +697 -0
- package/templates/scripts/automation/orchestrate-task.sh +119 -0
- package/templates/scripts/automation/preflight.sh +206 -0
- package/templates/scripts/automation/prepare-contract-review.sh +101 -0
- package/templates/scripts/automation/quality-gate.sh +72 -0
- package/templates/scripts/automation/queue-task.sh +35 -0
- package/templates/scripts/automation/record-red.sh +57 -0
- package/templates/scripts/automation/resume-review-fix.sh +32 -0
- package/templates/scripts/automation/resume-review.sh +120 -0
- package/templates/scripts/automation/scope-gate.sh +110 -0
- package/templates/scripts/automation/select-task.sh +34 -0
- package/templates/scripts/automation/shadow-run.sh +24 -0
- package/templates/scripts/automation/show-acceptance-review.sh +111 -0
- package/templates/scripts/automation/status.sh +125 -0
- package/templates/scripts/automation/submit-review.sh +73 -0
- package/templates/scripts/automation/tests/run-tests.sh +699 -0
- package/templates/scripts/automation/transition-state.sh +21 -0
- package/templates/scripts/automation/validate-contract.sh +87 -0
- package/templates/scripts/automation/verify-integration.sh +37 -0
- package/templates/scripts/automation/verify-task.sh +54 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
source "$SCRIPT_DIR/lib.sh"
|
|
7
|
+
|
|
8
|
+
task_id="${1:-}"
|
|
9
|
+
expected="${2:-}"
|
|
10
|
+
next="${3:-}"
|
|
11
|
+
actor="${4:-}"
|
|
12
|
+
note="${5:-}"
|
|
13
|
+
|
|
14
|
+
if [[ -z "$task_id" || -z "$expected" || -z "$next" || -z "$actor" || -z "$note" ]]; then
|
|
15
|
+
printf 'Usage: %s TASK-ID EXPECTED NEXT ACTOR NOTE\n' "$0" >&2
|
|
16
|
+
exit 2
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
automation_validate_task_id "$task_id"
|
|
20
|
+
automation_require_layout
|
|
21
|
+
automation_transition_state "$task_id" "$expected" "$next" "$actor" "$note"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
source "$SCRIPT_DIR/lib.sh"
|
|
7
|
+
|
|
8
|
+
usage() {
|
|
9
|
+
printf 'Usage: %s TASK-ID|/path/to/contract.json\n' "$0" >&2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
input="${1:-}"
|
|
13
|
+
[[ -n "$input" ]] || { usage; exit 2; }
|
|
14
|
+
automation_require_command jq
|
|
15
|
+
automation_require_layout
|
|
16
|
+
|
|
17
|
+
if [[ "$input" == */* || "$input" == *.json || "$input" == *.example ]]; then
|
|
18
|
+
contract="$input"
|
|
19
|
+
[[ "$contract" == /* ]] || contract="$AUTOMATION_ROOT/$contract"
|
|
20
|
+
else
|
|
21
|
+
automation_validate_task_id "$input"
|
|
22
|
+
contract="$(automation_contract_path "$input")"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
[[ -f "$contract" ]] || automation_die "contract not found: $contract"
|
|
26
|
+
jq -e . "$contract" >/dev/null || automation_die "contract is not valid JSON: $contract"
|
|
27
|
+
|
|
28
|
+
jq -e '
|
|
29
|
+
.schemaVersion == 1 and
|
|
30
|
+
(.id | type == "string" and test("^TASK-[A-Z0-9-]+$")) and
|
|
31
|
+
(.title | type == "string" and length > 0) and
|
|
32
|
+
.designApproved == true and
|
|
33
|
+
(.planPath | type == "string" and length > 0) and
|
|
34
|
+
.ambiguityPolicy == "BLOCKED" and
|
|
35
|
+
(.maxFixLoops | type == "number" and . >= 0 and . <= 1 and floor == .) and
|
|
36
|
+
(.maxChangedFiles | type == "number" and . >= 1 and . <= 12 and floor == .) and
|
|
37
|
+
(.allowedPaths | type == "array" and length > 0) and
|
|
38
|
+
(.forbiddenPaths | type == "array" and length > 0) and
|
|
39
|
+
(.allowedSuperpowers == ["test-driven-development", "systematic-debugging", "verification-before-completion"]) and
|
|
40
|
+
(.acceptanceCriteria | type == "array" and length > 0) and
|
|
41
|
+
(.nonGoals | type == "array" and length > 0) and
|
|
42
|
+
(.targetTests | type == "array" and length > 0) and
|
|
43
|
+
(.deviceTestsRequired | type == "boolean") and
|
|
44
|
+
(.testPolicy == "required" or .testPolicy == "not-required") and
|
|
45
|
+
(if .testPolicy == "not-required" then (.testPolicyReason | type == "string" and length >= 20) else true end)
|
|
46
|
+
' "$contract" >/dev/null || automation_die "contract is missing required fields or violates limits"
|
|
47
|
+
|
|
48
|
+
task_id="$(jq -r '.id' "$contract")"
|
|
49
|
+
automation_validate_task_id "$task_id"
|
|
50
|
+
|
|
51
|
+
if [[ "$contract" == "$AUTOMATION_TASKS_DIR/"* ]]; then
|
|
52
|
+
expected_contract="$(automation_contract_path "$task_id")"
|
|
53
|
+
[[ "$contract" == "$expected_contract" ]] || automation_die "contract filename must match id: $(basename "$expected_contract")"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
while IFS= read -r value; do
|
|
57
|
+
[[ "$value" != /* ]] || automation_die "paths must be repository-relative: $value"
|
|
58
|
+
[[ "$value" != *".."* ]] || automation_die "paths may not contain '..': $value"
|
|
59
|
+
[[ "$value" =~ ^[A-Za-z0-9._/?*-]+$ ]] || automation_die "unsupported path pattern: $value"
|
|
60
|
+
done < <(jq -r '.allowedPaths[], .forbiddenPaths[]' "$contract")
|
|
61
|
+
|
|
62
|
+
while IFS= read -r protected; do
|
|
63
|
+
if automation_array_matches_path "$contract" '.allowedPaths' "$protected"; then
|
|
64
|
+
automation_die "allowedPaths overlaps protected path: $protected"
|
|
65
|
+
fi
|
|
66
|
+
if ! automation_array_matches_path "$contract" '.forbiddenPaths' "$protected"; then
|
|
67
|
+
automation_die "forbiddenPaths must cover protected path: $protected"
|
|
68
|
+
fi
|
|
69
|
+
done < <(jq -r '.protectedPaths[]' "$AUTOMATION_CONFIG")
|
|
70
|
+
|
|
71
|
+
safe_filter_pattern='^[A-Za-z0-9_.#$*-]+$'
|
|
72
|
+
while IFS= read -r filter; do
|
|
73
|
+
[[ "$filter" =~ $safe_filter_pattern ]] || automation_die "unsafe target test filter: $filter"
|
|
74
|
+
done < <(jq -r '.targetTests[]' "$contract")
|
|
75
|
+
|
|
76
|
+
if rg -n -i 'replace with|TASK-EXAMPLE|todo|tbd|placeholder' "$contract" >/dev/null; then
|
|
77
|
+
automation_die "contract still contains template placeholders"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
plan_path="$(jq -r '.planPath' "$contract")"
|
|
81
|
+
if [[ "$plan_path" == /* || "$plan_path" == *".."* ]]; then
|
|
82
|
+
automation_die "planPath must be a safe repository-relative path"
|
|
83
|
+
fi
|
|
84
|
+
[[ "$plan_path" == "docs/plans/$task_id.md" ]] || automation_die "planPath must be docs/plans/$task_id.md"
|
|
85
|
+
[[ -f "$AUTOMATION_ROOT/$plan_path" ]] || automation_die "approved plan does not exist: $plan_path"
|
|
86
|
+
|
|
87
|
+
automation_info "contract valid: $task_id"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
source "$SCRIPT_DIR/lib.sh"
|
|
7
|
+
|
|
8
|
+
task_id="${1:-}"
|
|
9
|
+
base="${2:-}"
|
|
10
|
+
head="${3:-}"
|
|
11
|
+
[[ "$#" -eq 3 ]] || { printf 'Usage: %s TASK-ID BASE-COMMIT HEAD-COMMIT\n' "$0" >&2; exit 2; }
|
|
12
|
+
automation_validate_task_id "$task_id"
|
|
13
|
+
[[ "$(automation_read_state "$task_id")" == "INTEGRATING" ]] || automation_die "$task_id is not INTEGRATING"
|
|
14
|
+
contract="$(automation_contract_path "$task_id")"
|
|
15
|
+
|
|
16
|
+
"$SCRIPT_DIR/integration-scope-gate.sh" "$task_id" "$base" "$head"
|
|
17
|
+
|
|
18
|
+
while IFS= read -r filter; do
|
|
19
|
+
automation_info "running integration focused test: $filter"
|
|
20
|
+
./gradlew testDebugUnitTest --tests "$filter"
|
|
21
|
+
done < <(jq -r '.targetTests[]' "$contract")
|
|
22
|
+
|
|
23
|
+
automation_info "running integration full unit tests"
|
|
24
|
+
./gradlew testDebugUnitTest
|
|
25
|
+
|
|
26
|
+
automation_info "building integration debug APK"
|
|
27
|
+
./gradlew assembleDebug
|
|
28
|
+
|
|
29
|
+
automation_info "running integration Android lint"
|
|
30
|
+
./gradlew lint
|
|
31
|
+
|
|
32
|
+
if [[ "$(jq -r '.deviceTestsRequired' "$contract")" == "true" ]]; then
|
|
33
|
+
automation_info "running integration connected device tests"
|
|
34
|
+
./gradlew connectedDebugAndroidTest
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
automation_info "integration candidate passed all deterministic verification"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
source "$SCRIPT_DIR/lib.sh"
|
|
7
|
+
|
|
8
|
+
task_id="${1:-}"
|
|
9
|
+
[[ -n "$task_id" ]] || { printf 'Usage: %s TASK-ID\n' "$0" >&2; exit 2; }
|
|
10
|
+
automation_validate_task_id "$task_id"
|
|
11
|
+
"$SCRIPT_DIR/validate-contract.sh" "$task_id" >/dev/null
|
|
12
|
+
|
|
13
|
+
contract="$(automation_contract_path "$task_id")"
|
|
14
|
+
evidence_dir="$(automation_evidence_path "$task_id")"
|
|
15
|
+
[[ -f "$evidence_dir/baseline.json" ]] || { automation_die "baseline evidence is missing"; exit 41; }
|
|
16
|
+
[[ -f "$evidence_dir/red.json" ]] || { automation_die "RED evidence is missing"; exit 41; }
|
|
17
|
+
|
|
18
|
+
"$SCRIPT_DIR/scope-gate.sh" "$task_id"
|
|
19
|
+
|
|
20
|
+
while IFS= read -r filter; do
|
|
21
|
+
automation_info "running focused test: $filter"
|
|
22
|
+
(
|
|
23
|
+
cd "$AUTOMATION_ROOT"
|
|
24
|
+
./gradlew testDebugUnitTest --tests "$filter"
|
|
25
|
+
)
|
|
26
|
+
done < <(jq -r '.targetTests[]' "$contract")
|
|
27
|
+
|
|
28
|
+
automation_info "running full unit tests"
|
|
29
|
+
(
|
|
30
|
+
cd "$AUTOMATION_ROOT"
|
|
31
|
+
./gradlew testDebugUnitTest
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
automation_info "building debug APK"
|
|
35
|
+
(
|
|
36
|
+
cd "$AUTOMATION_ROOT"
|
|
37
|
+
./gradlew assembleDebug
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
automation_info "running Android lint"
|
|
41
|
+
(
|
|
42
|
+
cd "$AUTOMATION_ROOT"
|
|
43
|
+
./gradlew lint
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
if [[ "$(jq -r '.deviceTestsRequired' "$contract")" == "true" ]]; then
|
|
47
|
+
automation_info "running connected device tests"
|
|
48
|
+
(
|
|
49
|
+
cd "$AUTOMATION_ROOT"
|
|
50
|
+
./gradlew connectedDebugAndroidTest
|
|
51
|
+
)
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
automation_info "all deterministic verification commands passed"
|