opencode-agent-harness 0.0.0-stage → 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.
Files changed (169) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +590 -2
  4. package/bin/agent-harness.js +3059 -0
  5. package/contrib/global-plugins/README.md +49 -0
  6. package/contrib/global-plugins/harness-freshness.ts +355 -0
  7. package/package.json +48 -4
  8. package/templates/.agents/AGENTS.md +204 -0
  9. package/templates/.agents/features/INDEX.md +10 -0
  10. package/templates/.agents/handoffs/README.md +87 -0
  11. package/templates/.agents/memory/dev-loop.md +59 -0
  12. package/templates/.agents/memory/domain-map.md +29 -0
  13. package/templates/.agents/memory/environments.md +35 -0
  14. package/templates/.agents/memory/flow-map.md +23 -0
  15. package/templates/.agents/memory/history.md +7 -0
  16. package/templates/.agents/memory/locations.md +14 -0
  17. package/templates/.agents/memory/model-routing.md +261 -0
  18. package/templates/.agents/memory/orchestration.md +183 -0
  19. package/templates/.agents/memory/owned-files.md +19 -0
  20. package/templates/.agents/memory/product-principles.md +37 -0
  21. package/templates/.agents/memory/quality-parameters.md +37 -0
  22. package/templates/.agents/memory/stack-versions.md +35 -0
  23. package/templates/.agents/memory/test-design-parameters.md +36 -0
  24. package/templates/.agents/nightly.json +17 -0
  25. package/templates/.agents/qa-plans/README.md +70 -0
  26. package/templates/.agents/qa-runs/README.md +21 -0
  27. package/templates/.agents/reviews/README.md +47 -0
  28. package/templates/.agents/rules/00-operating.md +199 -0
  29. package/templates/.agents/skills/data-engineer/SKILL.md +31 -0
  30. package/templates/.agents/skills/devops-engineer/SKILL.md +50 -0
  31. package/templates/.agents/skills/diagnostics-expert/SKILL.md +44 -0
  32. package/templates/.agents/skills/docs/SKILL.md +140 -0
  33. package/templates/.agents/skills/features/SKILL.md +187 -0
  34. package/templates/.agents/skills/frontend-engineer/SKILL.md +81 -0
  35. package/templates/.agents/skills/handoff/SKILL.md +85 -0
  36. package/templates/.agents/skills/mobile-engineer/SKILL.md +101 -0
  37. package/templates/.agents/skills/planner/SKILL.md +112 -0
  38. package/templates/.agents/skills/product-manager/SKILL.md +115 -0
  39. package/templates/.agents/skills/qa-architect/SKILL.md +224 -0
  40. package/templates/.agents/skills/qa-runner/SKILL.md +64 -0
  41. package/templates/.agents/skills/security-engineer/SKILL.md +53 -0
  42. package/templates/.agents/skills/system-architect/SKILL.md +42 -0
  43. package/templates/.agents/skills/ui-designer/SKILL.md +71 -0
  44. package/templates/.github/workflows/ci.yml +148 -0
  45. package/templates/.github/workflows/deploy-uat.yml +95 -0
  46. package/templates/.github/workflows/nightly.yml +83 -0
  47. package/templates/.github/workflows/uat-health.yml +41 -0
  48. package/templates/.husky/pre-push +23 -0
  49. package/templates/.ignore +28 -0
  50. package/templates/.opencode/agents/data-engineer.md +37 -0
  51. package/templates/.opencode/agents/devops-engineer.md +37 -0
  52. package/templates/.opencode/agents/diagnostics-expert.md +37 -0
  53. package/templates/.opencode/agents/docs.md +37 -0
  54. package/templates/.opencode/agents/features.md +21 -0
  55. package/templates/.opencode/agents/frontend-engineer.md +37 -0
  56. package/templates/.opencode/agents/handoff.md +21 -0
  57. package/templates/.opencode/agents/mobile-engineer.md +37 -0
  58. package/templates/.opencode/agents/planner.md +34 -0
  59. package/templates/.opencode/agents/product-manager.md +29 -0
  60. package/templates/.opencode/agents/qa-architect.md +27 -0
  61. package/templates/.opencode/agents/qa-runner.md +17 -0
  62. package/templates/.opencode/agents/security-engineer.md +37 -0
  63. package/templates/.opencode/agents/system-architect.md +37 -0
  64. package/templates/.opencode/agents/ui-designer.md +37 -0
  65. package/templates/.opencode/commands/board.md +15 -0
  66. package/templates/.opencode/commands/checkpoint.md +25 -0
  67. package/templates/.opencode/commands/feature.md +56 -0
  68. package/templates/.opencode/commands/finish.md +36 -0
  69. package/templates/.opencode/commands/next.md +49 -0
  70. package/templates/.opencode/commands/report.md +55 -0
  71. package/templates/.opencode/commands/resume.md +39 -0
  72. package/templates/.opencode/commands/switch-model.md +34 -0
  73. package/templates/.opencode/commands/tidy.md +49 -0
  74. package/templates/.opencode/plugins/backlog-notify.ts +57 -0
  75. package/templates/.opencode/plugins/backlog.ts +272 -0
  76. package/templates/.opencode/plugins/checkpoint.ts +160 -0
  77. package/templates/.opencode/plugins/context-guard.ts +1164 -0
  78. package/templates/.opencode/plugins/diff.ts +85 -0
  79. package/templates/.opencode/plugins/gates.ts +71 -0
  80. package/templates/.opencode/plugins/job-notify.ts +241 -0
  81. package/templates/.opencode/plugins/orient.ts +67 -0
  82. package/templates/.opencode/plugins/session.ts +89 -0
  83. package/templates/.opencode/plugins/wait.ts +101 -0
  84. package/templates/.opencode/plugins/where.ts +70 -0
  85. package/templates/.opencode/skills/bounded-explore/SKILL.md +38 -0
  86. package/templates/.opencode/skills/dev-loop/SKILL.md +87 -0
  87. package/templates/.vercelignore +16 -0
  88. package/templates/AGENTS.md +27 -0
  89. package/templates/BACKLOG.md +95 -0
  90. package/templates/docs/ci-cd-pipeline.md +81 -0
  91. package/templates/docs/gates.md +128 -0
  92. package/templates/docs/mcp-integrations.md +97 -0
  93. package/templates/docs/mobile-testing.md +555 -0
  94. package/templates/docs/nightly-testing.md +106 -0
  95. package/templates/docs/wsl-optimizations.md +290 -0
  96. package/templates/opencode.json +188 -0
  97. package/templates/scripts/agent-report.js +541 -0
  98. package/templates/scripts/agent-search.sh +117 -0
  99. package/templates/scripts/backlog.js +1864 -0
  100. package/templates/scripts/board-service.sh +207 -0
  101. package/templates/scripts/checkpoint.js +290 -0
  102. package/templates/scripts/finalize.js +277 -0
  103. package/templates/scripts/nightly.js +913 -0
  104. package/templates/scripts/orient.js +514 -0
  105. package/templates/scripts/qa/board-client.js +260 -0
  106. package/templates/scripts/qa/board-lib.js +96 -0
  107. package/templates/scripts/qa/board-sync.js +469 -0
  108. package/templates/scripts/qa/capacity-lib.js +916 -0
  109. package/templates/scripts/qa/check-backlog.js +427 -0
  110. package/templates/scripts/qa/check-capacity.js +85 -0
  111. package/templates/scripts/qa/check-ci-policy.js +164 -0
  112. package/templates/scripts/qa/check-concurrency.js +344 -0
  113. package/templates/scripts/qa/check-dispatch-config.js +296 -0
  114. package/templates/scripts/qa/check-docs.js +284 -0
  115. package/templates/scripts/qa/check-integrate.js +98 -0
  116. package/templates/scripts/qa/check-linger.js +160 -0
  117. package/templates/scripts/qa/check-prefix-stability.js +183 -0
  118. package/templates/scripts/qa/check-product.js +177 -0
  119. package/templates/scripts/qa/check-qa-plan.js +378 -0
  120. package/templates/scripts/qa/check-qa-scripts.js +85 -0
  121. package/templates/scripts/qa/check-quality.js +249 -0
  122. package/templates/scripts/qa/check-test-wiring.js +253 -0
  123. package/templates/scripts/qa/ci-triage.js +346 -0
  124. package/templates/scripts/qa/ci-usage-lib.js +185 -0
  125. package/templates/scripts/qa/ci-wait-lib.js +294 -0
  126. package/templates/scripts/qa/command-classifier.js +552 -0
  127. package/templates/scripts/qa/context-guard-core.js +1618 -0
  128. package/templates/scripts/qa/diff.js +174 -0
  129. package/templates/scripts/qa/feature-scaffold.js +224 -0
  130. package/templates/scripts/qa/fixtures/backlog.md +104 -0
  131. package/templates/scripts/qa/governance.js +174 -0
  132. package/templates/scripts/qa/hash-file.js +32 -0
  133. package/templates/scripts/qa/lease-lib.js +263 -0
  134. package/templates/scripts/qa/merge-backlog.js +324 -0
  135. package/templates/scripts/qa/mobile-e2e/analyze-timings.js +300 -0
  136. package/templates/scripts/qa/mobile-e2e/apk-cache.js +420 -0
  137. package/templates/scripts/qa/mobile-e2e/backend-build-cache.js +203 -0
  138. package/templates/scripts/qa/mobile-e2e/boot-emulator.sh +432 -0
  139. package/templates/scripts/qa/mobile-e2e/build-apk.sh +210 -0
  140. package/templates/scripts/qa/mobile-e2e/check-flows.js +453 -0
  141. package/templates/scripts/qa/mobile-e2e/config.yaml +18 -0
  142. package/templates/scripts/qa/mobile-e2e/device-down.sh +88 -0
  143. package/templates/scripts/qa/mobile-e2e/device-up.sh +258 -0
  144. package/templates/scripts/qa/mobile-e2e/ios-simulator-down.sh +72 -0
  145. package/templates/scripts/qa/mobile-e2e/ios-simulator-up.sh +153 -0
  146. package/templates/scripts/qa/mobile-e2e/job-events.js +181 -0
  147. package/templates/scripts/qa/mobile-e2e/prewarm.sh +56 -0
  148. package/templates/scripts/qa/mobile-e2e/run-detached.sh +222 -0
  149. package/templates/scripts/qa/mobile-e2e/run-maestro.js +1543 -0
  150. package/templates/scripts/qa/mobile-e2e/ui-dump.js +327 -0
  151. package/templates/scripts/qa/models.allowlist.txt +32 -0
  152. package/templates/scripts/qa/provider-stats.js +878 -0
  153. package/templates/scripts/qa/run-clean.js +83 -0
  154. package/templates/scripts/qa/run-gates.js +212 -0
  155. package/templates/scripts/qa/run-loop.js +220 -0
  156. package/templates/scripts/qa/session-recon.js +512 -0
  157. package/templates/scripts/qa/store-lib.js +324 -0
  158. package/templates/scripts/qa/tool-lib.js +134 -0
  159. package/templates/scripts/qa/where.js +214 -0
  160. package/templates/scripts/qa/wslconfig-merge.js +157 -0
  161. package/templates/scripts/serve.js +1328 -0
  162. package/templates/scripts/setup-nightly.sh +185 -0
  163. package/templates/scripts/setup-tmpfs.sh +374 -0
  164. package/templates/scripts/ship.js +586 -0
  165. package/templates/scripts/switch-reasoning-model.ps1 +101 -0
  166. package/templates/scripts/switch-reasoning-model.sh +104 -0
  167. package/templates/scripts/wait-for.js +342 -0
  168. package/templates/scripts/wsl-gpu.sh +180 -0
  169. package/templates/scripts/wsl-tune.sh +261 -0
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /*
4
+ * wslconfig-merge — set/overwrite keys in a `[section]` INI file (a Windows
5
+ * `.wslconfig`) WITHOUT clobbering the user's other settings. `scripts/wsl-tune.sh`
6
+ * uses it to apply the recommended `[wsl2]`/`[experimental]` tuning idempotently.
7
+ *
8
+ * Why a merged file, not a managed block: `.wslconfig` is INI, so a second
9
+ * `[wsl2]` section would be invalid. This updates keys in place, inserts a
10
+ * missing key at the end of its section, and appends a whole section only when
11
+ * it is absent — comments, blank lines, ordering, and unknown keys survive.
12
+ *
13
+ * Usage:
14
+ * node scripts/qa/wslconfig-merge.js --file <path> --set wsl2.processors=8 \
15
+ * --set wsl2.swap=4GB [--set experimental.autoMemoryReclaim=gradual] \
16
+ * [--write] [--backup] [--dry-run]
17
+ *
18
+ * Without --write it prints the merged content to stdout (nothing is changed).
19
+ * Exit 1 on an invalid key / unreadable file.
20
+ */
21
+ const fs = require("fs");
22
+
23
+ const KEY_RE = /^[A-Za-z0-9_.-]+$/;
24
+
25
+ function validate(section, key) {
26
+ if (!KEY_RE.test(section) || !KEY_RE.test(key)) {
27
+ throw new Error(`invalid section/key: [${section}] ${key}`);
28
+ }
29
+ }
30
+
31
+ function detectEol(text) {
32
+ return /\r\n/.test(text) ? "\r\n" : "\n";
33
+ }
34
+
35
+ /* Pure merge: returns the new content. `sets` is [{section,key,value}]. */
36
+ function mergeConfig(text, sets) {
37
+ const eol = detectEol(text);
38
+ // Normalize to \n for processing, restore at the end.
39
+ const lines = String(text == null ? "" : text).replace(/\r\n/g, "\n").split("\n");
40
+ const pending = new Map(); // section(lower) -> [{key,value}]
41
+ for (const s of sets) {
42
+ validate(s.section, s.key);
43
+ const sec = s.section.toLowerCase();
44
+ if (!pending.has(sec)) pending.set(sec, []);
45
+ // Last write wins within a section.
46
+ const list = pending.get(sec);
47
+ const idx = list.findIndex((x) => x.key.toLowerCase() === s.key.toLowerCase());
48
+ if (idx === -1) list.push({ key: s.key, value: s.value });
49
+ else list[idx] = { key: s.key, value: s.value };
50
+ }
51
+
52
+ const out = [];
53
+ let current = null;
54
+ const flush = () => {
55
+ if (current && pending.has(current)) {
56
+ for (const { key, value } of pending.get(current)) out.push(`${key}=${value}`);
57
+ pending.delete(current);
58
+ }
59
+ };
60
+ for (const line of lines) {
61
+ const header = line.match(/^\s*\[([^\]]+)\]\s*$/);
62
+ if (header) {
63
+ flush();
64
+ current = header[1].trim().toLowerCase();
65
+ out.push(line);
66
+ continue;
67
+ }
68
+ const kv = line.match(/^([ \t]*)([A-Za-z0-9_.-]+)([ \t]*)=([ \t]*)(.*)$/);
69
+ if (kv && current && pending.has(current)) {
70
+ const list = pending.get(current);
71
+ const idx = list.findIndex((x) => x.key.toLowerCase() === kv[2].toLowerCase());
72
+ if (idx !== -1) {
73
+ out.push(`${kv[1]}${list[idx].key}=${list[idx].value}`);
74
+ list.splice(idx, 1);
75
+ continue;
76
+ }
77
+ }
78
+ out.push(line);
79
+ }
80
+ flush();
81
+ for (const [section, list] of pending) {
82
+ if (!list.length) continue;
83
+ out.push("", `[${section}]`, ...list.map((x) => `${x.key}=${x.value}`));
84
+ }
85
+ // Collapse an accidental leading blank when the file started empty.
86
+ let result = out.join("\n");
87
+ if (!result.endsWith("\n")) result += "\n";
88
+ return result.replace(/\n/g, eol);
89
+ }
90
+
91
+ function parseArgs(argv) {
92
+ const out = { sets: [] };
93
+ for (let i = 0; i < argv.length; i++) {
94
+ const a = argv[i];
95
+ if (a === "--file") out.file = argv[++i];
96
+ else if (a === "--set") out.sets.push(argv[++i]);
97
+ else if (a === "--write") out.write = true;
98
+ else if (a === "--backup") out.backup = true;
99
+ else if (a === "--dry-run") out.dryRun = true;
100
+ else if (a.startsWith("--set=")) out.sets.push(a.slice(6));
101
+ else if (a.startsWith("--file=")) out.file = a.slice(7);
102
+ }
103
+ return out;
104
+ }
105
+
106
+ function parseSet(spec) {
107
+ const m = String(spec).match(/^([A-Za-z0-9_.-]+)\.([A-Za-z0-9_.-]+)=(.*)$/);
108
+ if (!m) throw new Error(`--set must be <section>.<key>=<value>, got "${spec}"`);
109
+ return { section: m[1], key: m[2], value: m[3] };
110
+ }
111
+
112
+ function run(argv) {
113
+ const args = parseArgs(argv);
114
+ if (!args.file) {
115
+ console.error("usage: node scripts/qa/wslconfig-merge.js --file <path> --set section.key=value [--set ...] [--write] [--backup] [--dry-run]");
116
+ return 2;
117
+ }
118
+ let sets;
119
+ try {
120
+ sets = args.sets.map(parseSet);
121
+ } catch (e) {
122
+ console.error("wslconfig-merge: " + e.message);
123
+ return 1;
124
+ }
125
+ if (!sets.length) {
126
+ console.error("wslconfig-merge: at least one --set is required");
127
+ return 1;
128
+ }
129
+ let current = "";
130
+ try {
131
+ current = fs.readFileSync(args.file, "utf8");
132
+ } catch (_) {
133
+ current = ""; // create the file
134
+ }
135
+ const merged = mergeConfig(current, sets);
136
+ if (args.dryRun || !args.write) {
137
+ process.stdout.write(merged);
138
+ return 0;
139
+ }
140
+ if (merged === current) {
141
+ console.log(`wslconfig-merge: ${args.file} already up to date`);
142
+ return 0;
143
+ }
144
+ if (args.backup && current) {
145
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-");
146
+ fs.writeFileSync(`${args.file}.bak-${stamp}`, current, "utf8");
147
+ }
148
+ fs.writeFileSync(args.file, merged, "utf8");
149
+ console.log(`wslconfig-merge: updated ${args.file}`);
150
+ return 0;
151
+ }
152
+
153
+ if (require.main === module) {
154
+ process.exitCode = run(process.argv.slice(2));
155
+ }
156
+
157
+ module.exports = { mergeConfig, parseSet, parseArgs, detectEol };