autonomous-sdlc-harness 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 (171) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +24 -0
  4. package/dist/cli.js +194 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/config.js +561 -0
  7. package/dist/commands/config.js.map +1 -0
  8. package/dist/commands/daemon.js +791 -0
  9. package/dist/commands/daemon.js.map +1 -0
  10. package/dist/commands/doctor.js +336 -0
  11. package/dist/commands/doctor.js.map +1 -0
  12. package/dist/commands/init.js +2023 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/registry.js +42 -0
  15. package/dist/commands/registry.js.map +1 -0
  16. package/dist/config/check.js +505 -0
  17. package/dist/config/check.js.map +1 -0
  18. package/dist/config/io.js +177 -0
  19. package/dist/config/io.js.map +1 -0
  20. package/dist/config/model.js +406 -0
  21. package/dist/config/model.js.map +1 -0
  22. package/dist/core/errors.js +71 -0
  23. package/dist/core/errors.js.map +1 -0
  24. package/dist/core/git.js +537 -0
  25. package/dist/core/git.js.map +1 -0
  26. package/dist/core/json.js +125 -0
  27. package/dist/core/json.js.map +1 -0
  28. package/dist/core/layerCoverage.js +141 -0
  29. package/dist/core/layerCoverage.js.map +1 -0
  30. package/dist/core/layerGapRemedy.js +62 -0
  31. package/dist/core/layerGapRemedy.js.map +1 -0
  32. package/dist/core/nameList.js +23 -0
  33. package/dist/core/nameList.js.map +1 -0
  34. package/dist/core/paths.js +153 -0
  35. package/dist/core/paths.js.map +1 -0
  36. package/dist/core/prompt.js +206 -0
  37. package/dist/core/prompt.js.map +1 -0
  38. package/dist/core/repoPaths.js +55 -0
  39. package/dist/core/repoPaths.js.map +1 -0
  40. package/dist/core/report.js +150 -0
  41. package/dist/core/report.js.map +1 -0
  42. package/dist/core/templating.js +88 -0
  43. package/dist/core/templating.js.map +1 -0
  44. package/dist/core/writer.js +479 -0
  45. package/dist/core/writer.js.map +1 -0
  46. package/dist/daemon/backend.js +180 -0
  47. package/dist/daemon/backend.js.map +1 -0
  48. package/dist/daemon/units.js +380 -0
  49. package/dist/daemon/units.js.map +1 -0
  50. package/dist/detect/nestedApplication.js +79 -0
  51. package/dist/detect/nestedApplication.js.map +1 -0
  52. package/dist/detect/presets.js +2033 -0
  53. package/dist/detect/presets.js.map +1 -0
  54. package/dist/detect/signals.js +1368 -0
  55. package/dist/detect/signals.js.map +1 -0
  56. package/dist/doctor/checks.js +3530 -0
  57. package/dist/doctor/checks.js.map +1 -0
  58. package/dist/generators/claudeContext.js +588 -0
  59. package/dist/generators/claudeContext.js.map +1 -0
  60. package/dist/generators/githooks.js +446 -0
  61. package/dist/generators/githooks.js.map +1 -0
  62. package/dist/generators/harnessConfig.js +632 -0
  63. package/dist/generators/harnessConfig.js.map +1 -0
  64. package/dist/generators/notifications.js +191 -0
  65. package/dist/generators/notifications.js.map +1 -0
  66. package/dist/generators/outerLoopScripts.js +165 -0
  67. package/dist/generators/outerLoopScripts.js.map +1 -0
  68. package/dist/generators/permissionProfile.js +1172 -0
  69. package/dist/generators/permissionProfile.js.map +1 -0
  70. package/dist/generators/projectSettings.js +322 -0
  71. package/dist/generators/projectSettings.js.map +1 -0
  72. package/dist/generators/repoRoot.js +417 -0
  73. package/dist/generators/repoRoot.js.map +1 -0
  74. package/dist/generators/scripts.js +557 -0
  75. package/dist/generators/scripts.js.map +1 -0
  76. package/dist/generators/stateDir.js +221 -0
  77. package/dist/generators/stateDir.js.map +1 -0
  78. package/dist/machine/paths.js +111 -0
  79. package/dist/machine/paths.js.map +1 -0
  80. package/dist/machine/plugins.js +224 -0
  81. package/dist/machine/plugins.js.map +1 -0
  82. package/dist/machine/registry.js +330 -0
  83. package/dist/machine/registry.js.map +1 -0
  84. package/package.json +23 -0
  85. package/scripts/README.md +13 -0
  86. package/scripts/daemon/launchd.plist.template +59 -0
  87. package/scripts/daemon/systemd.service.template +58 -0
  88. package/templates/README.md +15 -0
  89. package/templates/claude/CLAUDE.md +54 -0
  90. package/templates/claude/README.md +5 -0
  91. package/templates/claude/context/api.md +29 -0
  92. package/templates/claude/context/conventions.md +23 -0
  93. package/templates/claude/context/data-layer.md +28 -0
  94. package/templates/claude/context/data-storage.md +29 -0
  95. package/templates/claude/context/docs-catalog.md +29 -0
  96. package/templates/claude/context/domain.md +28 -0
  97. package/templates/claude/context/layer.md +20 -0
  98. package/templates/claude/context/module.md +30 -0
  99. package/templates/claude/context/package.md +29 -0
  100. package/templates/claude/context/presentation.md +32 -0
  101. package/templates/claude/context/state-slices.md +28 -0
  102. package/templates/claude/context/tests.md +28 -0
  103. package/templates/claude/harness-task-offer.md +58 -0
  104. package/templates/claude/push-notify.env.example +21 -0
  105. package/templates/claude/qa-accounts.env.example +38 -0
  106. package/templates/claude/qa_test_scenarios.md +110 -0
  107. package/templates/claude/settings.autonomous.json +93 -0
  108. package/templates/claude/settings.autonomous.qa.json +36 -0
  109. package/templates/githooks/README.md +3 -0
  110. package/templates/githooks/pre-push +72 -0
  111. package/templates/repo/README.md +3 -0
  112. package/templates/repo/gitattributes +16 -0
  113. package/templates/repo/gitignore +61 -0
  114. package/templates/repo/gitignore.qa +25 -0
  115. package/templates/repo/mcp.json +17 -0
  116. package/templates/scripts/README.md +5 -0
  117. package/templates/scripts/autonomous-format-stream.sh +95 -0
  118. package/templates/scripts/autonomous-notify.sh +337 -0
  119. package/templates/scripts/autonomous-watcher.sh +3087 -0
  120. package/templates/scripts/cleanup-merged-worktrees.sh +327 -0
  121. package/templates/scripts/commit-on-branch.sh +288 -0
  122. package/templates/scripts/create-worktree.sh +360 -0
  123. package/templates/scripts/deploy.sh +47 -0
  124. package/templates/scripts/lib/harness-run-lib.sh +1481 -0
  125. package/templates/scripts/push-branch.sh +140 -0
  126. package/templates/scripts/refresh-branch.sh +244 -0
  127. package/templates/scripts/restart-watcher.sh +401 -0
  128. package/templates/scripts/scratch-run.sh +302 -0
  129. package/templates/scripts/setup-worktree.sh +262 -0
  130. package/templates/scripts/start-dev-server.sh +99 -0
  131. package/templates/scripts/test.sh +50 -0
  132. package/templates/scripts/typecheck.sh +50 -0
  133. package/templates/state-dir/README-root.md +13 -0
  134. package/templates/state-dir/README.md +9 -0
  135. package/templates/state-dir/architecture_branch_review_point_reviews/README.md +9 -0
  136. package/templates/state-dir/architecture_branch_reviews/README.md +9 -0
  137. package/templates/state-dir/architecture_reviews/README.md +9 -0
  138. package/templates/state-dir/architecture_user_review_reviews/README.md +9 -0
  139. package/templates/state-dir/autonomous_inbox/README.md +9 -0
  140. package/templates/state-dir/autonomous_logs/README.md +9 -0
  141. package/templates/state-dir/branch_statistics/README.md +9 -0
  142. package/templates/state-dir/business_parity_branch_review_point_reviews/README.md +9 -0
  143. package/templates/state-dir/business_parity_branch_reviews/README.md +9 -0
  144. package/templates/state-dir/business_parity_reviews/README.md +9 -0
  145. package/templates/state-dir/business_parity_user_review_reviews/README.md +9 -0
  146. package/templates/state-dir/clarification_digests/README.md +9 -0
  147. package/templates/state-dir/clarifications/README.md +9 -0
  148. package/templates/state-dir/code_reviews/README.md +9 -0
  149. package/templates/state-dir/dispatch_additions/README.md +19 -0
  150. package/templates/state-dir/docs_catalog/README.md +9 -0
  151. package/templates/state-dir/flow_progress/README.md +9 -0
  152. package/templates/state-dir/improvement_observations/README.md +19 -0
  153. package/templates/state-dir/improvement_suggestions.md +29 -0
  154. package/templates/state-dir/lessons.md +23 -0
  155. package/templates/state-dir/qa_review_point_reviews/README.md +9 -0
  156. package/templates/state-dir/qa_reviews/README.md +9 -0
  157. package/templates/state-dir/review_plan_point_reviews/README.md +9 -0
  158. package/templates/state-dir/review_plan_reviews/README.md +9 -0
  159. package/templates/state-dir/scratch/README.md +11 -0
  160. package/templates/state-dir/skeptic_review_plan_reviews/README.md +9 -0
  161. package/templates/state-dir/skeptic_review_point_reviews/README.md +9 -0
  162. package/templates/state-dir/skeptic_reviews/README.md +9 -0
  163. package/templates/state-dir/story_plans/README.md +9 -0
  164. package/templates/state-dir/task_plan_point_reviews/README.md +9 -0
  165. package/templates/state-dir/task_plan_reviews/README.md +9 -0
  166. package/templates/state-dir/task_plans/README.md +9 -0
  167. package/templates/state-dir/task_prompts/README.md +9 -0
  168. package/templates/state-dir/ui_test_plan_reviews/README.md +9 -0
  169. package/templates/state-dir/ui_test_plans/README.md +9 -0
  170. package/templates/state-dir/user_review_fix_plan_point_reviews/README.md +9 -0
  171. package/templates/state-dir/user_reviews/README.md +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EACL,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,wBAAwB,CAAC;AAGhC,8FAA8F;AAC9F,MAAM,OAAO,GAAG,+FAA+F,CAAC;AAEhH,4EAA4E;AAC5E,MAAM,YAAY,GAA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AC;IAC7C,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACnE,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC7D,OAAO,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,YAAY;IACzB,KAAK,EAAE,YAAY;IACnB,GAAG;CACJ,CAAC"}
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Command: `doctor` — verify an adopted repository's wiring, and make the exit status the contract.
3
+ *
4
+ * **The rule this module exists to enforce: the exit status is the answer, and the report is the
5
+ * explanation.** A caller that branches on `doctor` — CI, the run daemon before it starts a run, an
6
+ * operator's `&&` — reads `$?` and nothing else, so the two codes are defined here and are the whole
7
+ * interface: **0 when no check failed**, including a run whose only findings were warnings, and
8
+ * **1 when any check failed**. A warning names something worth fixing that does not stop a run; a
9
+ * failure names something that does. Everything printed exists to say *why*.
10
+ *
11
+ * ## Three non-obvious choices, and where each comes from
12
+ *
13
+ * 1. **Warnings do not fail the command**, which is what makes the exit status usable at all. The
14
+ * condition a freshly wired repository still ships with unresolved — the marketplace entry, which
15
+ * needs a published repository — would otherwise make every such repository exit non-zero for
16
+ * something no adopter can fix, and a check nobody can make green is a check everybody starts
17
+ * ignoring.
18
+ * 2. **Every check runs, whatever the earlier ones answered.** `doctor` is reached for *because*
19
+ * something is wrong, so a report that stopped at the first failure would get shorter the worse
20
+ * the repository is. The evaluation and its per-check error containment are `doctor/checks.ts`'s;
21
+ * this file orders, prints and counts.
22
+ * 3. **The counts summary prints even under `--quiet`.** Quiet here means "only what needs attention,
23
+ * and the verdict": the `PASS` lines are dropped, the `WARN` and `FAIL` lines go to stderr as the
24
+ * reporter sends everything that needs a human, and the summary goes to stdout regardless —
25
+ * otherwise a quiet run has nothing on stdout to read its result from (`core/report.ts`,
26
+ * {@link Reporter.result}). It shares that stream with any other line this command routes through
27
+ * `result()`, which under `--dry-run` is {@link TEST_NOTIFICATION_FLAG}'s `would run:` preview.
28
+ *
29
+ * ## What this command deliberately does not do
30
+ *
31
+ * - **It repairs nothing and writes nothing** beyond the temp file the writability probe creates and
32
+ * removes in place. Every finding names what to run instead — `init`, `init --force`, or an edit to
33
+ * one config key — so `doctor` stays safe to run against a repository in any state, at any time.
34
+ * - **It launches no browser and starts no MCP server.** Reachability is command resolution on
35
+ * `PATH`, plus — under {@link CHECK_REGISTRY_FLAG} — one read-only registry metadata query per
36
+ * pinned package, which fetches nothing and starts nothing either. Driving a browser belongs to the
37
+ * interactive-test phase and its agent alone.
38
+ * - **A default run sends nothing.** The `notifications` check is a pure read of whichever settings
39
+ * file the notifier resolves; everything here with network reach is behind a flag —
40
+ * {@link TEST_NOTIFICATION_FLAG}, a delivery, which no default run and no `--dry-run` run makes,
41
+ * and {@link CHECK_REGISTRY_FLAG}, a metadata read that changes nothing anywhere and so is not
42
+ * suppressed by `--dry-run`. A POST fired by every `doctor` — in CI, from an `&&` chain, from the
43
+ * run daemon before it starts a run — would cost the command every property above.
44
+ */
45
+ import { spawnSync } from 'node:child_process';
46
+ import { existsSync } from 'node:fs';
47
+ import { EXIT, HarnessError } from '../core/errors.js';
48
+ import { currentBranch } from '../core/git.js';
49
+ import { buildCheckContext, countByStatus, runChecks, } from '../doctor/checks.js';
50
+ import { NOTIFY_SCRIPT_NAME, outerLoopScriptPath } from '../generators/outerLoopScripts.js';
51
+ /** The command's one-line summary, in the usage block and at the head of its own `--help`. */
52
+ const SUMMARY = 'Check git/worktree availability, permission profile, daemon backend, MCP reachability, stateDir writability';
53
+ /** The roadmap item this command belongs to, as the registry reports it. */
54
+ const ROADMAP_ITEM = 13;
55
+ /** An option this command takes of its own: an action, not a check. */
56
+ const TEST_NOTIFICATION_FLAG = '--test-notification';
57
+ /**
58
+ * An option this command takes of its own: it widens one check's question and changes nothing.
59
+ *
60
+ * Off by default, which is the whole design. The browser-wiring check resolves each declared server's
61
+ * launch command on `PATH`, and that is an answer a default `doctor` can give in CI, inside an `&&`
62
+ * chain and offline — but it says nothing about whether the pinned packages those servers are
63
+ * launched with can actually be fetched, which is what an adopter behind a proxy, on a mirror or
64
+ * air-gapped finds out at the first interactive-test dispatch instead. This flag asks now.
65
+ */
66
+ const CHECK_REGISTRY_FLAG = '--check-registry';
67
+ /**
68
+ * Every option this command takes of its own, in the order `--help` lists them.
69
+ *
70
+ * Declared as the list rather than spelled into the refusal message, so the message a mistyped flag
71
+ * gets names whatever the command actually accepts and cannot fall behind it.
72
+ */
73
+ const OWN_FLAGS = Object.freeze([TEST_NOTIFICATION_FLAG, CHECK_REGISTRY_FLAG]);
74
+ /**
75
+ * The event word the test send carries.
76
+ *
77
+ * Deliberately **not** one of the notifier's six lifecycle words. That vocabulary is a contract owned
78
+ * by the watcher — `completed`, `parked`, `paused`, `failed`, `launched`, `resumed` — and sending one
79
+ * from here would put a message an operator reads as a real run's outcome into the same stream real
80
+ * ones arrive in. The script's header states that an unrecognized word is still delivered, under a
81
+ * generic title, and its dispatcher's `*)` branch is where this one lands: the message reads
82
+ * `Run '<branch>': doctor-test.` and cannot be mistaken for a lifecycle event.
83
+ */
84
+ const TEST_NOTIFICATION_EVENT = 'doctor-test';
85
+ /**
86
+ * How long the notifier may take before the send is abandoned.
87
+ *
88
+ * Its POST arm is a `curl -m 10` retried once with a second body shape, so a run against an endpoint
89
+ * that accepts the connection and never answers costs about twenty seconds by design. This is that,
90
+ * with room to spare: a bound rather than a deadline, so a slow endpoint is reported instead of
91
+ * hanging the command an operator ran to find out what is wrong.
92
+ */
93
+ const NOTIFIER_TIMEOUT_MS = 45_000;
94
+ /** How each status is labelled at the head of its line. Fixed width, so the details column aligns. */
95
+ const STATUS_LABEL = {
96
+ pass: 'PASS',
97
+ warn: 'WARN',
98
+ fail: 'FAIL',
99
+ };
100
+ /**
101
+ * The lines the registry renders under this command's synopsis.
102
+ *
103
+ * The exit contract is stated **here**, in the text `doctor --help` prints, because that is where a
104
+ * CI caller looks before writing the condition it will rely on — a contract documented only in a
105
+ * source comment is one the caller has to guess at.
106
+ */
107
+ const DOCTOR_USAGE = Object.freeze([
108
+ 'Doctor options (the global options above apply too):',
109
+ ` ${TEST_NOTIFICATION_FLAG} Send one test notification through this repository's own`,
110
+ ' autonomous-notify.sh, after the report',
111
+ ` ${CHECK_REGISTRY_FLAG} Ask the registry whether each pinned MCP server package can be`,
112
+ ' fetched, inside the browser-wiring check',
113
+ '',
114
+ 'A default run sends nothing: the notifications check reads which settings file the notifier',
115
+ `resolves and prints no value from it, and only ${TEST_NOTIFICATION_FLAG} delivers a message. The`,
116
+ `test send carries the event word ${TEST_NOTIFICATION_EVENT}, which is none of the watcher's six`,
117
+ "lifecycle words, so it cannot be read as a real run's outcome. It does not change the exit status:",
118
+ 'a best-effort notifier that could not reach an endpoint is not a failed check. Under --dry-run it',
119
+ 'reports the invocation it would make and sends nothing, after every refusal a real run would make.',
120
+ '',
121
+ `${CHECK_REGISTRY_FLAG} is off by default, and that is what keeps a default run reachable from CI, from`,
122
+ 'an && chain and from the run daemon: with it off nothing here touches a network, and the answer is',
123
+ 'the same offline. The interactive-test servers are launched with `npx -y`, so their pinned packages',
124
+ 'are fetched from the registry on first use rather than installed by init, which the browser-wiring',
125
+ 'line says on every run, rather than letting a pass be read as a promise they can be. With it on,',
126
+ 'each pin is looked up with `npm view <spec> version` — a metadata read that fetches and installs',
127
+ 'nothing — and one that cannot be reached warns. It never changes the exit status, and --dry-run',
128
+ 'does not suppress it: a metadata read changes nothing, here or anywhere else.',
129
+ '',
130
+ 'Exit status is the contract — branch on it rather than on the report text:',
131
+ ' 0 no check failed: every check passed, or the only findings were warnings',
132
+ ' 1 at least one check failed',
133
+ '',
134
+ 'A warning never changes the exit status: it names something worth fixing that does not stop a',
135
+ 'run. A failure names something that does.',
136
+ '',
137
+ 'Every check is evaluated, whatever the earlier ones answered, so one report names everything',
138
+ 'wrong with the repository rather than only the first thing.',
139
+ '',
140
+ '--quiet drops the PASS lines. The WARN and FAIL lines print on stderr, and the counts summary on',
141
+ `stdout, whatever the flags are; so does the ${TEST_NOTIFICATION_FLAG} \`would run:\` preview under`,
142
+ '--dry-run, which is the second stdout line that combination prints.',
143
+ '',
144
+ 'Nothing is repaired and nothing is written, beyond a temp file the writability probe creates and',
145
+ 'removes inside the configured stateDir. No MCP server is started and no browser is launched:',
146
+ `reachability is command resolution on PATH, plus — under ${CHECK_REGISTRY_FLAG} — one read-only`,
147
+ 'registry metadata query per pinned package.',
148
+ ]);
149
+ /**
150
+ * Every option `doctor` takes of its own is recognised here, so anything else left after the global
151
+ * flags is a mistake.
152
+ *
153
+ * Refused rather than ignored, for `init`'s reason: a mistyped flag that is quietly dropped produces
154
+ * a check run that answered a different question than the one asked, and here the caller is
155
+ * branching on the result. The flags that *are* recognised are refused in the other direction too —
156
+ * a misspelling of one names every option this command accepts, so the operator whose test send
157
+ * silently never happened, or whose registry probe silently never ran, is told rather than left to
158
+ * wonder whether the thing itself is broken.
159
+ */
160
+ function parseOptions(argv) {
161
+ let testNotification = false;
162
+ let checkRegistry = false;
163
+ for (const token of argv) {
164
+ if (token === TEST_NOTIFICATION_FLAG) {
165
+ testNotification = true;
166
+ continue;
167
+ }
168
+ if (token === CHECK_REGISTRY_FLAG) {
169
+ checkRegistry = true;
170
+ continue;
171
+ }
172
+ throw new HarnessError(token.startsWith('-')
173
+ ? `doctor: unknown option ${JSON.stringify(token)} — the options doctor takes of its own are ${OWN_FLAGS.join(' and ')}; run \`npx autonomous-sdlc-harness doctor --help\` for them and for the global options it accepts`
174
+ : `doctor: unexpected argument ${JSON.stringify(token)} — doctor takes no arguments, and checks the repository containing the current directory (or --cwd)`);
175
+ }
176
+ return { testNotification, checkRegistry };
177
+ }
178
+ /** `Summary: 9 pass, 3 warn, 0 fail — exit 0 (no check failed; warnings do not fail the command)`. */
179
+ function summaryLine(pass, warn, fail) {
180
+ const verdict = fail === 0
181
+ ? 'exit 0 (no check failed; warnings do not fail the command)'
182
+ : `exit 1 (${fail} check${fail === 1 ? '' : 's'} failed)`;
183
+ return `Summary: ${pass} pass, ${warn} warn, ${fail} fail — ${verdict}`;
184
+ }
185
+ /**
186
+ * Run the notifier once with a **fixed argument vector** — the CLI's standing rule, and here also
187
+ * what keeps a branch name carrying shell metacharacters from being re-parsed. `bash <script>` is the
188
+ * form the daemon's own unit uses for the watcher beside it, so an adopter who cleared the executable
189
+ * bit off a generated script still gets a delivery check rather than a spawn error.
190
+ *
191
+ * **`spawnSync` rather than `execFileSync`**, which is what every other probe in this CLI uses. The
192
+ * two take the same argument vector and the same bounds; they differ in exactly the thing this call
193
+ * exists for. `execFileSync` returns *stdout* and surfaces a child's stderr only on the error path,
194
+ * and this script's contract is that it **exits 0 whatever happened** and says what it did on stderr
195
+ * — so the run this flag is most often used to check, the one that degraded to desktop-only, is
196
+ * precisely the run whose one line `execFileSync` would discard.
197
+ *
198
+ * A non-zero status is returned rather than thrown for the same reason: the script never fails its
199
+ * caller, so a status other than 0 is a finding to print rather than a reason for this command to
200
+ * change what it answers.
201
+ */
202
+ function runNotifier(script, args) {
203
+ const result = spawnSync('bash', [script, ...args], {
204
+ encoding: 'utf8',
205
+ stdio: ['ignore', 'ignore', 'pipe'],
206
+ timeout: NOTIFIER_TIMEOUT_MS,
207
+ windowsHide: true,
208
+ });
209
+ const lines = typeof result.stderr === 'string'
210
+ ? result.stderr
211
+ .split('\n')
212
+ .map((line) => line.trimEnd())
213
+ .filter((line) => line !== '')
214
+ : [];
215
+ // A stopped child is reported by the signal that stopped it rather than as "timed out": the bound
216
+ // this call sets is the likely cause and is named, but a `kill` from elsewhere arrives the same way
217
+ // and a message asserting the timeout would be wrong exactly when an operator is chasing something.
218
+ const stopped = (signal) => `the notifier was stopped by ${signal} before it finished; the bound on this call is ${NOTIFIER_TIMEOUT_MS / 1000}s`;
219
+ if (result.error !== undefined) {
220
+ const failure = result.error;
221
+ if (failure.code === 'ENOENT')
222
+ return { lines, problem: `bash is not on PATH, so ${script} could not be run` };
223
+ if (result.signal !== null)
224
+ return { lines, problem: stopped(result.signal) };
225
+ return { lines, problem: `the notifier could not be run to completion: ${failure.message}` };
226
+ }
227
+ if (result.signal !== null)
228
+ return { lines, problem: stopped(result.signal) };
229
+ return result.status === null ? { lines } : { status: result.status, lines };
230
+ }
231
+ /**
232
+ * Send one test notification through the repository's own notifier — the whole of what
233
+ * {@link TEST_NOTIFICATION_FLAG} adds.
234
+ *
235
+ * Three properties, and each of them is why this lives here rather than inside a check:
236
+ *
237
+ * 1. **It runs after the report and the summary**, so a repository whose wiring is broken still gets
238
+ * its findings printed before anything is attempted with them.
239
+ * 2. **It goes through `autonomous-notify.sh`**, resolved under the configured `scriptsDir` the way
240
+ * `daemon/backend.ts` resolves its sibling the watcher. A message built here instead would be a
241
+ * second implementation of the delivery contract — the credential precedence, the two arms, the
242
+ * title format — and the delivery an operator is testing is the script's, not this command's.
243
+ * 3. **It cannot move the exit status.** That stays "0 when no check failed", so a CI caller's
244
+ * condition means the same thing whether or not this flag was passed, and an unreachable endpoint
245
+ * — a best-effort arm doing exactly what its contract says — is not a failed check.
246
+ *
247
+ * A fourth, which is the CLI's rule rather than this flag's: **`--dry-run` sends nothing.** A delivery
248
+ * reaches a remote endpoint and a desktop banner, so it is a mutation sitting outside any write plan
249
+ * and is skipped for the same reason `init`'s first commit and `daemon install`'s registry entry are.
250
+ * The preview is taken **after** every refusal below, so a dry run reports each of them exactly as a
251
+ * real run would and cannot claim a send a real run would not have made.
252
+ */
253
+ function sendTestNotification(ctx, checks) {
254
+ ctx.report.step(ctx.flags.dryRun
255
+ ? `test notification (event ${TEST_NOTIFICATION_EVENT}; dry run — nothing is sent)`
256
+ : `test notification (event ${TEST_NOTIFICATION_EVENT})`);
257
+ const { repoRoot, config } = checks;
258
+ if (repoRoot === undefined || config === undefined) {
259
+ ctx.report.warn(`${TEST_NOTIFICATION_FLAG} sent nothing: ${repoRoot === undefined ? 'the repository root did not resolve' : 'the configuration could not be read'}, so the notifier could not be located — see the report above, and fix that finding first`);
260
+ return;
261
+ }
262
+ const script = outerLoopScriptPath(repoRoot, config, NOTIFY_SCRIPT_NAME);
263
+ if (!existsSync(script)) {
264
+ ctx.report.warn(`${TEST_NOTIFICATION_FLAG} sent nothing: no notifier at ${script}. \`init\` writes it into the configured scriptsDir, so nothing there means it was removed or scriptsDir was changed without a re-run — run \`npx autonomous-sdlc-harness init\` to write it back. The exit status is the checks' and is unchanged`);
265
+ return;
266
+ }
267
+ const branch = currentBranch(repoRoot) ?? config.defaultBranch;
268
+ if (typeof branch !== 'string' || branch.trim() === '') {
269
+ ctx.report.warn(`${TEST_NOTIFICATION_FLAG} sent nothing: this checkout has no branch to name — a detached HEAD, or a git that would not answer — and defaultBranch is ${JSON.stringify(branch)}, so the notifier would have been called with no branch, which is the one thing it refuses`);
270
+ return;
271
+ }
272
+ // The last thing checked, and the only one that is about this run's mode rather than the
273
+ // repository's state: everything above is a refusal a real run would have made too.
274
+ if (ctx.flags.dryRun) {
275
+ ctx.report.result(`would run: bash ${script} ${TEST_NOTIFICATION_EVENT} ${branch}`);
276
+ ctx.report.info(`${TEST_NOTIFICATION_FLAG} sent nothing: this was a dry run, and a delivery reaches a remote endpoint and a desktop banner — a change outside this repository, which is what --dry-run skips`);
277
+ return;
278
+ }
279
+ const result = runNotifier(script, [TEST_NOTIFICATION_EVENT, branch]);
280
+ ctx.report.info(`${script} ${TEST_NOTIFICATION_EVENT} ${branch}${result.status === undefined ? '' : ` — exited ${result.status}`}`);
281
+ // Quoted back unmodified: the script prints one line per arm that did not deliver and never prints
282
+ // a value, so the line an operator needs is already the line it wrote.
283
+ for (const line of result.lines)
284
+ ctx.report.warn(line);
285
+ if (result.problem !== undefined)
286
+ ctx.report.warn(`${TEST_NOTIFICATION_FLAG}: ${result.problem}`);
287
+ ctx.report.info(`${TEST_NOTIFICATION_FLAG} does not change the exit status: delivery is best-effort, and an endpoint that could not be reached is not a failed check`);
288
+ }
289
+ /**
290
+ * Build the context once, evaluate every check, print one line each, and return the exit code.
291
+ *
292
+ * The three streams are the reporter's own contract and are what `--quiet` is implemented by: a
293
+ * `PASS` line is narration and goes through `info`, a `WARN` through `warn` and a `FAIL` through
294
+ * `fail` — both of which print on stderr whatever the flags are — and the summary through `result`,
295
+ * which prints on stdout whatever the flags are.
296
+ *
297
+ * The check context is kept rather than passed straight through, because the test send needs the same
298
+ * repository root and configuration the checks were answered from: resolving them a second time could
299
+ * answer differently from the report the operator is reading.
300
+ */
301
+ async function run(ctx) {
302
+ const options = parseOptions(ctx.argv);
303
+ const checks = buildCheckContext(ctx.cwd, options.checkRegistry);
304
+ const results = runChecks(checks);
305
+ const width = Math.max(...results.map((result) => result.id.length));
306
+ ctx.report.step(`checks (${ctx.cwd})`);
307
+ for (const result of results) {
308
+ const line = `${STATUS_LABEL[result.status]} ${result.id.padEnd(width)} ${result.detail}`;
309
+ if (result.status === 'pass')
310
+ ctx.report.info(line);
311
+ else if (result.status === 'warn')
312
+ ctx.report.warn(line);
313
+ else
314
+ ctx.report.fail(line);
315
+ }
316
+ const counts = countByStatus(results);
317
+ ctx.report.result(summaryLine(counts.pass, counts.warn, counts.fail));
318
+ if (options.testNotification)
319
+ sendTestNotification(ctx, checks);
320
+ return counts.fail > 0 ? EXIT.FAILURE : EXIT.OK;
321
+ }
322
+ /**
323
+ * The registry row for this command.
324
+ *
325
+ * Exported as the row itself rather than as a `run` the table wraps, so the summary, the usage lines
326
+ * and the behaviour stay in the file that owns them. The import back to `commands/registry.ts` is
327
+ * type-only and therefore erased, so the table can list this row without a runtime cycle.
328
+ */
329
+ export const DOCTOR_COMMAND = {
330
+ name: 'doctor',
331
+ summary: SUMMARY,
332
+ roadmapItem: ROADMAP_ITEM,
333
+ usage: DOCTOR_USAGE,
334
+ run,
335
+ };
336
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,SAAS,GAGV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG5F,8FAA8F;AAC9F,MAAM,OAAO,GACX,6GAA6G,CAAC;AAEhH,4EAA4E;AAC5E,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,SAAS,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAElG;;;;;;;;;GASG;AACH,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC,sGAAsG;AACtG,MAAM,YAAY,GAA0C;IAC1D,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACb,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,YAAY,GAAsB,MAAM,CAAC,MAAM,CAAC;IACpD,sDAAsD;IACtD,K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