sandcastle-drain 0.1.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +139 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/content/agent-docs/issue-tracker.md +22 -0
  8. package/dist/content/agent-docs/sandcastle-windows-cleanup.md +45 -0
  9. package/dist/content/agent-docs/triage-labels.md +101 -0
  10. package/dist/content/principles/README.md +39 -0
  11. package/dist/content/principles/architecture.md +124 -0
  12. package/dist/content/principles/claude-code-modes.md +47 -0
  13. package/dist/content/principles/clean-code.md +102 -0
  14. package/dist/content/principles/context-budget.md +81 -0
  15. package/dist/content/principles/cqrs.md +70 -0
  16. package/dist/content/principles/domain-modeling.md +62 -0
  17. package/dist/content/principles/frontend-organization.md +120 -0
  18. package/dist/content/principles/language-and-types.md +85 -0
  19. package/dist/content/principles/linting-and-tooling.md +122 -0
  20. package/dist/content/principles/personal-use-tradeoffs.md +55 -0
  21. package/dist/content/principles/testing.md +89 -0
  22. package/dist/orchestrator/blocked-by.d.ts +17 -0
  23. package/dist/orchestrator/blocked-by.d.ts.map +1 -0
  24. package/dist/orchestrator/blocked-by.js +48 -0
  25. package/dist/orchestrator/blocked-by.js.map +1 -0
  26. package/dist/orchestrator/ci-gate.d.ts +28 -0
  27. package/dist/orchestrator/ci-gate.d.ts.map +1 -0
  28. package/dist/orchestrator/ci-gate.js +198 -0
  29. package/dist/orchestrator/ci-gate.js.map +1 -0
  30. package/dist/orchestrator/main.d.ts +10 -0
  31. package/dist/orchestrator/main.d.ts.map +1 -0
  32. package/dist/orchestrator/main.js +883 -0
  33. package/dist/orchestrator/main.js.map +1 -0
  34. package/dist/orchestrator/prereqs.d.ts +30 -0
  35. package/dist/orchestrator/prereqs.d.ts.map +1 -0
  36. package/dist/orchestrator/prereqs.js +191 -0
  37. package/dist/orchestrator/prereqs.js.map +1 -0
  38. package/dist/orchestrator/rejection.d.ts +60 -0
  39. package/dist/orchestrator/rejection.d.ts.map +1 -0
  40. package/dist/orchestrator/rejection.js +187 -0
  41. package/dist/orchestrator/rejection.js.map +1 -0
  42. package/dist/orchestrator/reviewer.d.ts +75 -0
  43. package/dist/orchestrator/reviewer.d.ts.map +1 -0
  44. package/dist/orchestrator/reviewer.js +260 -0
  45. package/dist/orchestrator/reviewer.js.map +1 -0
  46. package/dist/orchestrator/ship.d.ts +19 -0
  47. package/dist/orchestrator/ship.d.ts.map +1 -0
  48. package/dist/orchestrator/ship.js +73 -0
  49. package/dist/orchestrator/ship.js.map +1 -0
  50. package/dist/orchestrator/sibling-context.d.ts +16 -0
  51. package/dist/orchestrator/sibling-context.d.ts.map +1 -0
  52. package/dist/orchestrator/sibling-context.js +61 -0
  53. package/dist/orchestrator/sibling-context.js.map +1 -0
  54. package/dist/orchestrator/splits.d.ts +60 -0
  55. package/dist/orchestrator/splits.d.ts.map +1 -0
  56. package/dist/orchestrator/splits.js +149 -0
  57. package/dist/orchestrator/splits.js.map +1 -0
  58. package/dist/orchestrator/status.d.ts +13 -0
  59. package/dist/orchestrator/status.d.ts.map +1 -0
  60. package/dist/orchestrator/status.js +43 -0
  61. package/dist/orchestrator/status.js.map +1 -0
  62. package/dist/orchestrator/summary.d.ts +33 -0
  63. package/dist/orchestrator/summary.d.ts.map +1 -0
  64. package/dist/orchestrator/summary.js +59 -0
  65. package/dist/orchestrator/summary.js.map +1 -0
  66. package/dist/orchestrator/sweep.d.ts +18 -0
  67. package/dist/orchestrator/sweep.d.ts.map +1 -0
  68. package/dist/orchestrator/sweep.js +79 -0
  69. package/dist/orchestrator/sweep.js.map +1 -0
  70. package/dist/orchestrator/teardown.d.ts +12 -0
  71. package/dist/orchestrator/teardown.d.ts.map +1 -0
  72. package/dist/orchestrator/teardown.js +42 -0
  73. package/dist/orchestrator/teardown.js.map +1 -0
  74. package/dist/orchestrator/worktree-cleanup.d.ts +2 -0
  75. package/dist/orchestrator/worktree-cleanup.d.ts.map +1 -0
  76. package/dist/orchestrator/worktree-cleanup.js +39 -0
  77. package/dist/orchestrator/worktree-cleanup.js.map +1 -0
  78. package/dist/prompts/implementer.md.tpl +85 -0
  79. package/dist/prompts/reviewer.md.tpl +118 -0
  80. package/dist/render-prompt.d.ts +22 -0
  81. package/dist/render-prompt.d.ts.map +1 -0
  82. package/dist/render-prompt.js +64 -0
  83. package/dist/render-prompt.js.map +1 -0
  84. package/dist/stage.d.ts +43 -0
  85. package/dist/stage.d.ts.map +1 -0
  86. package/dist/stage.js +105 -0
  87. package/dist/stage.js.map +1 -0
  88. package/docker/Dockerfile +42 -0
  89. package/package.json +48 -0
@@ -0,0 +1,198 @@
1
+ /**
2
+ * CI gate: runs the host project's typecheck, lint, and test scripts against
3
+ * the agent's worktree after a successful run, before applying the
4
+ * run-outcome label.
5
+ *
6
+ * If the agent's original worktree dir still exists (the Windows-teardown path
7
+ * where sandcastle.run() threw with node_modules intact), we reuse it. On Linux
8
+ * sandcastle removes the worktree on success, so we create a fresh git worktree
9
+ * for the branch, run the package manager's frozen-install, then the checks.
10
+ * The temp worktree is removed when we're done.
11
+ *
12
+ * Package manager is detected from lockfiles / `packageManager` field so the
13
+ * wrapper works on npm, pnpm, and yarn-classic projects without configuration.
14
+ *
15
+ * Pure logic (decision, formatting, PM detection) is split from the execa
16
+ * orchestration so the decisions are unit-testable without spinning a real
17
+ * install.
18
+ */
19
+ import { execa } from 'execa';
20
+ import { existsSync, readFileSync } from 'node:fs';
21
+ import { mkdir, writeFile } from 'node:fs/promises';
22
+ import { join } from 'node:path';
23
+ import { removeWorktreeDir } from './worktree-cleanup.js';
24
+ const REQUIRED_CHECKS = ['typecheck', 'lint', 'test'];
25
+ export function determineCiOk(runs) {
26
+ for (const run of runs) {
27
+ if (run.exitCode !== 0)
28
+ return { ok: false, failedCheck: run.check };
29
+ }
30
+ return { ok: true };
31
+ }
32
+ // Reuse-the-existing-install heuristic. For pnpm we require `.modules.yaml`
33
+ // (pnpm writes it at the END of a successful install; on Windows after
34
+ // sandcastle's teardown ENOSYS, the dir survives without the marker and the
35
+ // symlink farm is broken — reusing it without reinstall yields false TS2307
36
+ // failures). npm and yarn-classic both write a flat `node_modules` and don't
37
+ // have a comparable end-of-install marker; presence is good enough.
38
+ export function needsInstall(dir, pm) {
39
+ if (pm === 'pnpm') {
40
+ return !existsSync(join(dir, 'node_modules', '.modules.yaml'));
41
+ }
42
+ return !existsSync(join(dir, 'node_modules'));
43
+ }
44
+ // Detect the project's package manager by precedence:
45
+ // 1. lockfile on disk (most authoritative)
46
+ // 2. `packageManager` field in package.json (corepack convention)
47
+ // 3. default to npm
48
+ // Pure: takes a repo root, returns a tag. No execa, no network, no side effects.
49
+ export function detectPackageManager(repoRoot) {
50
+ if (existsSync(join(repoRoot, 'pnpm-lock.yaml')))
51
+ return 'pnpm';
52
+ if (existsSync(join(repoRoot, 'yarn.lock')))
53
+ return 'yarn';
54
+ if (existsSync(join(repoRoot, 'package-lock.json')))
55
+ return 'npm';
56
+ const pkgPath = join(repoRoot, 'package.json');
57
+ if (existsSync(pkgPath)) {
58
+ try {
59
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
60
+ const field = pkg.packageManager;
61
+ if (typeof field === 'string') {
62
+ const name = field.split('@')[0];
63
+ if (name === 'pnpm' || name === 'yarn' || name === 'npm')
64
+ return name;
65
+ }
66
+ }
67
+ catch {
68
+ // Malformed package.json: fall through to default rather than crash the gate.
69
+ }
70
+ }
71
+ return 'npm';
72
+ }
73
+ // Frozen-install args per package manager. The intent across all three is the
74
+ // same: refuse to install if the lockfile is out of date.
75
+ function installArgs(pm) {
76
+ switch (pm) {
77
+ case 'npm':
78
+ return ['ci'];
79
+ case 'pnpm':
80
+ return ['install', '--frozen-lockfile'];
81
+ case 'yarn':
82
+ // Yarn classic. Yarn berry (v2+) uses `--immutable` and would need a
83
+ // `.yarnrc.yml` check to detect; deferring berry support until needed.
84
+ return ['install', '--frozen-lockfile'];
85
+ }
86
+ }
87
+ function lastLines(text, n) {
88
+ const lines = text.split(/\r?\n/);
89
+ return lines.slice(Math.max(0, lines.length - n)).join('\n');
90
+ }
91
+ export function formatCiSection(result) {
92
+ const lines = [];
93
+ if (result.ok) {
94
+ lines.push('**CI gate:** PASS (typecheck, lint, test)');
95
+ return lines.join('\n');
96
+ }
97
+ lines.push(`**CI gate:** FAIL — \`${result.packageManager} ${result.failedCheck ?? 'unknown'}\` exited non-zero`);
98
+ lines.push(`**CI log:** \`${result.logPath}\``);
99
+ const failedRun = result.runs.find((r) => r.exitCode !== 0);
100
+ if (failedRun) {
101
+ lines.push('');
102
+ lines.push('<details><summary>Last ~50 lines of CI output</summary>');
103
+ lines.push('');
104
+ lines.push('```');
105
+ lines.push(lastLines(failedRun.output, 50));
106
+ lines.push('```');
107
+ lines.push('');
108
+ lines.push('</details>');
109
+ }
110
+ return lines.join('\n');
111
+ }
112
+ async function runCheck(pm, check, args, cwd) {
113
+ const result = await execa(pm, args.slice(), {
114
+ cwd,
115
+ reject: false,
116
+ all: true,
117
+ env: { ...process.env, CI: 'true' },
118
+ });
119
+ const output = result.all ?? [result.stdout, result.stderr].filter((s) => Boolean(s)).join('\n');
120
+ return { check, exitCode: result.exitCode ?? -1, output };
121
+ }
122
+ async function prepareCiWorktree(args) {
123
+ const { branch, repoRoot, worktreePath, ciGateRoot, issue } = args;
124
+ if (existsSync(worktreePath)) {
125
+ return { dir: worktreePath, createdTempWorktree: false };
126
+ }
127
+ const dir = join(ciGateRoot, `issue-${issue}`);
128
+ if (existsSync(dir)) {
129
+ // Stale ci-gate worktree from a prior aborted run — remove it before re-adding.
130
+ await execa('git', ['worktree', 'remove', '--force', dir], { cwd: repoRoot, reject: false });
131
+ await removeWorktreeDir(dir);
132
+ await execa('git', ['worktree', 'prune'], { cwd: repoRoot, reject: false });
133
+ }
134
+ await mkdir(ciGateRoot, { recursive: true });
135
+ await execa('git', ['worktree', 'add', dir, branch], { cwd: repoRoot });
136
+ return { dir, createdTempWorktree: true };
137
+ }
138
+ async function teardownCiWorktree(dir, repoRoot) {
139
+ // Best-effort: a leaked ci-gate worktree gets cleaned up by the next run's
140
+ // pre-flight orphan sweep, so don't throw if removal fails.
141
+ try {
142
+ await execa('git', ['worktree', 'remove', '--force', dir], { cwd: repoRoot, reject: false });
143
+ await removeWorktreeDir(dir);
144
+ await execa('git', ['worktree', 'prune'], { cwd: repoRoot, reject: false });
145
+ }
146
+ catch (err) {
147
+ console.error(`[wrapper] ci-gate worktree cleanup failed for ${dir}:`, err);
148
+ }
149
+ }
150
+ function formatLogFile(pm, runs) {
151
+ return runs
152
+ .map((r) => `$ ${pm} ${r.check}\n(exit ${r.exitCode})\n${r.output}`)
153
+ .join('\n\n---\n\n');
154
+ }
155
+ export async function runCiGate(args) {
156
+ const { issue, branch, repoRoot, worktreePath } = args;
157
+ const logsDir = join(repoRoot, '.sandcastle-drain', 'logs');
158
+ await mkdir(logsDir, { recursive: true });
159
+ const logPath = join(logsDir, `issue-${issue}-ci.log`);
160
+ const ciGateRoot = join(repoRoot, '.sandcastle-drain', 'ci-gate');
161
+ const { dir, createdTempWorktree } = await prepareCiWorktree({
162
+ branch,
163
+ repoRoot,
164
+ worktreePath,
165
+ ciGateRoot,
166
+ issue,
167
+ });
168
+ // Detect from the agent's worktree, not the host repo, so a branch that
169
+ // changes lockfiles (e.g. adopting pnpm) is treated correctly.
170
+ const pm = detectPackageManager(dir);
171
+ const runs = [];
172
+ try {
173
+ if (needsInstall(dir, pm)) {
174
+ const install = await runCheck(pm, 'install', installArgs(pm), dir);
175
+ runs.push(install);
176
+ if (install.exitCode !== 0) {
177
+ await writeFile(logPath, formatLogFile(pm, runs));
178
+ return { ...determineCiOk(runs), runs, logPath, packageManager: pm };
179
+ }
180
+ }
181
+ for (const check of REQUIRED_CHECKS) {
182
+ const result = await runCheck(pm, check, ['run', check], dir);
183
+ runs.push(result);
184
+ if (result.exitCode !== 0) {
185
+ await writeFile(logPath, formatLogFile(pm, runs));
186
+ return { ...determineCiOk(runs), runs, logPath, packageManager: pm };
187
+ }
188
+ }
189
+ await writeFile(logPath, formatLogFile(pm, runs));
190
+ return { ...determineCiOk(runs), runs, logPath, packageManager: pm };
191
+ }
192
+ finally {
193
+ if (createdTempWorktree) {
194
+ await teardownCiWorktree(dir, repoRoot);
195
+ }
196
+ }
197
+ }
198
+ //# sourceMappingURL=ci-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-gate.js","sourceRoot":"","sources":["../../src/orchestrator/ci-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoB1D,MAAM,eAAe,GAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1E,MAAM,UAAU,aAAa,CAAC,IAA2B;IAIvD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACvE,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,oEAAoE;AACpE,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,EAAkB;IAC1D,IAAI,EAAE,KAAK,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,EAAE,EAAE,CAAC;IACvE,CAAC;YAAS,CAAC;QACT,IAAI,mBAAmB,EAAE,CAAC;YACxB,MAAM,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Drains the queue once. Expects `runAllPrereqs()` to have already succeeded —
3
+ * the CLI calls that up-front so all three subcommands share the same probes.
4
+ * On an empty queue, returns immediately; otherwise iterates the prioritized
5
+ * queue and prints a summary at the end.
6
+ */
7
+ export declare function runDrain(args: {
8
+ token: string;
9
+ }): Promise<void>;
10
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/orchestrator/main.ts"],"names":[],"mappings":"AA0lCA;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrE"}