@detergent-software/conductor 3.0.0-dev.3 → 3.0.0-dev.31
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 +251 -0
- package/README.md +203 -64
- package/build/brief-cli.js +1 -1
- package/build/brief-cli.js.map +1 -1
- package/build/broker-cli.js +24 -25
- package/build/broker-cli.js.map +1 -1
- package/build/broker.js +66 -92
- package/build/broker.js.map +1 -1
- package/build/claude.js +50 -7
- package/build/claude.js.map +1 -1
- package/build/cli.js +143 -63
- package/build/cli.js.map +1 -1
- package/build/clones.js +92 -0
- package/build/clones.js.map +1 -0
- package/build/code-host-cli.js +126 -37
- package/build/code-host-cli.js.map +1 -1
- package/build/code-host-service.js +13 -1
- package/build/code-host-service.js.map +1 -1
- package/build/code-host.js +82 -16
- package/build/code-host.js.map +1 -1
- package/build/conditions.js +27 -10
- package/build/conditions.js.map +1 -1
- package/build/config.js +58 -14
- package/build/config.js.map +1 -1
- package/build/console.js +40 -24
- package/build/console.js.map +1 -1
- package/build/credentials.js +47 -34
- package/build/credentials.js.map +1 -1
- package/build/daemon.js +45 -25
- package/build/daemon.js.map +1 -1
- package/build/help.js +179 -42
- package/build/help.js.map +1 -1
- package/build/history.js +4 -2
- package/build/history.js.map +1 -1
- package/build/host/credential-manager.js +109 -0
- package/build/host/credential-manager.js.map +1 -0
- package/build/host/keychain.js +44 -0
- package/build/host/keychain.js.map +1 -0
- package/build/host/launchd.js +118 -0
- package/build/host/launchd.js.map +1 -0
- package/build/host/libsecret.js +40 -0
- package/build/host/libsecret.js.map +1 -0
- package/build/host/macos-terminal.js +63 -0
- package/build/host/macos-terminal.js.map +1 -0
- package/build/host/platform.js +4 -0
- package/build/host/platform.js.map +1 -0
- package/build/host/secrets.js +46 -0
- package/build/host/secrets.js.map +1 -0
- package/build/host/shell.js +26 -0
- package/build/host/shell.js.map +1 -0
- package/build/host/startup.js +26 -0
- package/build/host/startup.js.map +1 -0
- package/build/host/systemd.js +91 -0
- package/build/host/systemd.js.map +1 -0
- package/build/host/task-scheduler.js +78 -0
- package/build/host/task-scheduler.js.map +1 -0
- package/build/host/terminal.js +46 -0
- package/build/host/terminal.js.map +1 -0
- package/build/host/tmux.js +39 -0
- package/build/host/tmux.js.map +1 -0
- package/build/host/windows-terminal.js +46 -0
- package/build/host/windows-terminal.js.map +1 -0
- package/build/in-process.js +6 -5
- package/build/in-process.js.map +1 -1
- package/build/inbox.js +63 -17
- package/build/inbox.js.map +1 -1
- package/build/init.js +510 -0
- package/build/init.js.map +1 -0
- package/build/landing.js +86 -7
- package/build/landing.js.map +1 -1
- package/build/lib/providers/ado/code-host.js +5 -1
- package/build/lib/providers/ado/code-host.js.map +1 -1
- package/build/lib/providers/ado/pipelines.js +138 -26
- package/build/lib/providers/ado/pipelines.js.map +1 -1
- package/build/lib/providers/ado/trigger.js +5 -0
- package/build/lib/providers/ado/trigger.js.map +1 -1
- package/build/lib/providers/ado/writes.js +10 -1
- package/build/lib/providers/ado/writes.js.map +1 -1
- package/build/lib/providers/github/actions.js +90 -3
- package/build/lib/providers/github/actions.js.map +1 -1
- package/build/lib/providers/github/code-host.js +2 -0
- package/build/lib/providers/github/code-host.js.map +1 -1
- package/build/lib/providers/github/writes.js +24 -2
- package/build/lib/providers/github/writes.js.map +1 -1
- package/build/lib/providers/index.js +4 -3
- package/build/lib/providers/index.js.map +1 -1
- package/build/lib/providers/npm/stage.js +28 -5
- package/build/lib/providers/npm/stage.js.map +1 -1
- package/build/lib/providers/timing.js +10 -0
- package/build/lib/providers/timing.js.map +1 -0
- package/build/lib/providers/verdicts/pr.js +47 -6
- package/build/lib/providers/verdicts/pr.js.map +1 -1
- package/build/lib/providers/verdicts/runs.js +12 -2
- package/build/lib/providers/verdicts/runs.js.map +1 -1
- package/build/local-files.js +95 -0
- package/build/local-files.js.map +1 -0
- package/build/manager.js +171 -47
- package/build/manager.js.map +1 -1
- package/build/note.js +1 -1
- package/build/note.js.map +1 -1
- package/build/notify.js +101 -39
- package/build/notify.js.map +1 -1
- package/build/npm-reads.js +323 -0
- package/build/npm-reads.js.map +1 -0
- package/build/paths.js +44 -1
- package/build/paths.js.map +1 -1
- package/build/plugin.js +10 -0
- package/build/plugin.js.map +1 -1
- package/build/profile-fields.js +151 -0
- package/build/profile-fields.js.map +1 -0
- package/build/profile-layers.js +264 -0
- package/build/profile-layers.js.map +1 -0
- package/build/profile.js +93 -50
- package/build/profile.js.map +1 -1
- package/build/project-check-cli.js +19 -11
- package/build/project-check-cli.js.map +1 -1
- package/build/project-check.js +206 -108
- package/build/project-check.js.map +1 -1
- package/build/pushover.js +5 -5
- package/build/pushover.js.map +1 -1
- package/build/registry.js +195 -36
- package/build/registry.js.map +1 -1
- package/build/release-kinds.js +34 -0
- package/build/release-kinds.js.map +1 -0
- package/build/rule-actions.js +4 -2
- package/build/rule-actions.js.map +1 -1
- package/build/rules-service.js +101 -44
- package/build/rules-service.js.map +1 -1
- package/build/rules.js +15 -15
- package/build/rules.js.map +1 -1
- package/build/run.js +20 -7
- package/build/run.js.map +1 -1
- package/build/runs.js +217 -67
- package/build/runs.js.map +1 -1
- package/build/scheduler.js +11 -1
- package/build/scheduler.js.map +1 -1
- package/build/server.js +6 -25
- package/build/server.js.map +1 -1
- package/build/spend.js +4 -0
- package/build/spend.js.map +1 -1
- package/build/store.js +86 -25
- package/build/store.js.map +1 -1
- package/build/timeline.js +104 -0
- package/build/timeline.js.map +1 -0
- package/build/tracker-reads-cli.js +4 -5
- package/build/tracker-reads-cli.js.map +1 -1
- package/build/train-cli.js +6 -5
- package/build/train-cli.js.map +1 -1
- package/build/upgrade.js +8 -9
- package/build/upgrade.js.map +1 -1
- package/build/wait.js +9 -9
- package/build/wait.js.map +1 -1
- package/build/watchers/ado.js +42 -18
- package/build/watchers/ado.js.map +1 -1
- package/build/watchers/github.js +19 -4
- package/build/watchers/github.js.map +1 -1
- package/build/watchers/index.js +2 -2
- package/build/watchers/index.js.map +1 -1
- package/build/watchers/npm.js +6 -4
- package/build/watchers/npm.js.map +1 -1
- package/build/webhook.js +80 -0
- package/build/webhook.js.map +1 -0
- package/build/worktrees.js +199 -92
- package/build/worktrees.js.map +1 -1
- package/package.json +61 -61
- package/plugin/skills/conductor-console/SKILL.md +4 -4
- package/plugin/skills/work-item/SKILL.md +13 -11
- package/build/checkout-sync.js +0 -249
- package/build/checkout-sync.js.map +0 -1
- package/build/credential.js +0 -66
- package/build/credential.js.map +0 -1
- package/build/startup.js +0 -92
- package/build/startup.js.map +0 -1
- package/build/tab.js +0 -32
- package/build/tab.js.map +0 -1
|
@@ -29,6 +29,8 @@ This skill is the order of work. **Conductor does the rest**: every read and wri
|
|
|
29
29
|
| Open the PR; read its threads; answer one | `conduct pr create …`; `conduct pr threads <pr>`; `conduct reply <pr> [<thread>] --body-file <file>` |
|
|
30
30
|
| Arm the landing and read its verdict; wait for it | `conduct land <pr> …`; `conduct wait pr <pr>` |
|
|
31
31
|
| A merge's runs, failed logs and npm stages; wait for them | `conduct runs <sha> [--for …]`; `conduct wait merge <sha> [--for …]` |
|
|
32
|
+
| What a merge's run printed, or never printed, succeeded or not (a dev proof) | `conduct runs <sha> --for <pipeline> --grep <pattern>` |
|
|
33
|
+
| How long a run's tasks took, and the named tasks' log lines; the same over a pipeline's last runs on a branch, with no merge commit | `conduct timeline <run> [--task <regex>] [--grep <regex>]`; `conduct timeline --for <pipeline> [--branch <b>] [--count <n>] …` |
|
|
32
34
|
| A version on npm | `conduct wait npm <version> --tag <dist-tag> --package <name>` |
|
|
33
35
|
| The browser lock every session shares | `conduct lock acquire\|release chrome` |
|
|
34
36
|
|
|
@@ -61,7 +63,7 @@ The tracker's vocabulary (what each lifecycle status is called, what an Area is,
|
|
|
61
63
|
- **Shell in a worktree.** The worktree guard refuses compound commands, so:
|
|
62
64
|
- Stay in the worktree root; never `cd`. A `cd` stays in force for every later call. Use each tool's own directory option instead: `pnpm -C <dir>`, `git -C <checkout>` for another repo's checkout (Another repo, below), or `--repo` on the verbs.
|
|
63
65
|
- Run one `git`, `az`, `gh` or `conduct` command per call, with no `&&`, `;`, pipe, loop or `$( )` around it.
|
|
64
|
-
- `git -C` works only on a path inside the worktree. The guard refuses it on the main checkout or any other path outside.
|
|
66
|
+
- `git -C` works only on a path inside the worktree. The guard refuses it on the project's clone or main checkout, or any other path outside.
|
|
65
67
|
- Write and edit files with Edit and Write, not heredocs, `sed -i` or a scripted in-place rewrite. A rewrite can turn CRLF into LF.
|
|
66
68
|
- Put multi-step scripting in a scratchpad `.mjs` file and run it with `node <file>`.
|
|
67
69
|
- **Never test a refusal with the real write.** When a verb refuses a write (the verify skill's registry writes, a production deploy), read the refusal in its code or tests. Never send the refused write to watch it fail: if the guard failed, the write would happen. Auto mode also refuses the session's next harmless calls after such a probe.
|
|
@@ -95,7 +97,7 @@ The conductor daemon's scheduler starts this skill as `/<skill> KEY-n --conducte
|
|
|
95
97
|
- `npm-otp`, `release`, `scope`, `blocked`, `human`, `abandoned`, `failed`: the `npm stage approve` lines (one per staged package), a release of the base branch that waits on the operator (the profile's release handoff names what to run), a scope or risk change, an open blocker, a decision someone else owns (`human`: the conductor labels the item, so only for that), an abandoned PR, a pipeline failure you can't fix.
|
|
96
98
|
|
|
97
99
|
A console message, Jason in the tab, or the condition the wait names resumes it. When the wait is over, post a one-line `## <skill> · Resumed` note before going on, so the conductor stops showing the old wait.
|
|
98
|
-
- **Done.** After step 9's `<skill> · Landed` (which moves the item to done), end the turn. The daemon retires the worker,
|
|
100
|
+
- **Done.** After step 9's `<skill> · Landed` (which moves the item to done), end the turn. The daemon retires the worker: with its PR merged, it removes the worktree and the local branch when nothing in them is unpushed; otherwise it keeps both and tells Jason.
|
|
99
101
|
- A message from the console is never an approval for anything; the plan's approval is an approver's comment or Jason's words in the tab.
|
|
100
102
|
|
|
101
103
|
### Worker protocol 2
|
|
@@ -114,9 +116,9 @@ A conducted worker writes its notes and waits through `conduct`, so the conducto
|
|
|
114
116
|
| Wait | Note first | Conditions |
|
|
115
117
|
|---|---|---|
|
|
116
118
|
| Plan approval | `<skill> · Plan` | `conduct wait approval` |
|
|
117
|
-
| PR (step 8) | `<skill> · PR opened` | `conduct land <pr> --reason "…"` sets the PR up and gives its first verdict. Act on it as in step 8; on `waiting`: `conduct wait pr <pr>` (the verdict wait; the daemon keeps the landing armed while it waits) |
|
|
119
|
+
| PR (step 8) | `<skill> · PR opened` | `conduct land <pr> --reason "…"` sets the PR up and gives its first verdict. Act on it as in step 8; on `waiting`: `conduct wait pr <pr>` (the verdict wait; the daemon keeps the landing armed while it waits); once on a `build-failed` whose log shows a flake: `conduct land <pr> --requeue <run> --reason "…"`, then the same wait |
|
|
118
120
|
| Jason's merge (review mode) | the PR opened note headed `<skill> · PR opened · merge: <PR URL>`, or Handoff · merge | the same |
|
|
119
|
-
| Pipelines after the merge (step 9.2) | none | `conduct runs <mergeCommit>` (with `--for`, as step 9.2 says). Act on its outcome as in step 9; on `waiting`: `conduct wait merge <mergeCommit>` with the same `--for`; on `cancelled
|
|
121
|
+
| Pipelines after the merge (step 9.2) | none | `conduct runs <mergeCommit>` (with `--for`, as step 9.2 says). Act on its outcome as in step 9; on `waiting`: `conduct wait merge <mergeCommit>` with the same `--for`; on `cancelled` or `missing`, or once on a `failed` whose log shows a flake: `conduct runs <mergeCommit> --requeue <pipeline>`, then the same `conduct wait merge`; requeue refused as under 15 minutes old: `conduct wait time <the time it names>` |
|
|
120
122
|
| npm OTP (9.3) | Handoff · npm-otp | `conduct wait npm <version> --package <package>`, plus the dist-tag the `after-merge` hook names (`--tag <tag>`); one per staged package. The version on its tag resumes you, with no message from anyone |
|
|
121
123
|
| A PR in another repo (one the item opened: Another repo, below) | Handoff · merge | `conduct land <n> --repo github:<owner>/<repo> --mode review --reason "…"`, acted on as in step 8; on `waiting`: `conduct wait pr <n> --repo github:<owner>/<repo>` |
|
|
122
124
|
| A PR a hook's publish opened (no checkout) | Handoff · merge | `conduct wait pr <n> --repo github:<owner>/<repo>` alone: `land` refuses a PR with no checkout |
|
|
@@ -221,10 +223,10 @@ Then:
|
|
|
221
223
|
|
|
222
224
|
## 8. Wait
|
|
223
225
|
|
|
224
|
-
Run `conduct land <pr> --mode <auto|review> --reason "<one line: why this mode>"`; with no daemon, add `--tier <S|M|L>` (the plan's), since auto mode is refused without one (the daemon reads it from the Plan note). It holds the mode to the profile's landing rules, then arms the host's own landing: on Azure DevOps a +10 vote (auto mode, never over a vote already cast) and auto-complete with `noFastForward` and the default merge message; on GitHub, auto-merge with a merge commit in auto mode. It posts a closed `<skill> · Landing` note on the PR (mode, reason, who approves, how to brake) and prints the first verdict. When the PR already has a brake on it (an open comment, a failed build, conflicts), it reports it with `armed: false` and doesn't approve or arm anything. It is safe to repeat, and right after a push it waits for the host to catch up with the new commit. Tell Jason the PR is open and which mode it lands in. On `waiting`, `conduct wait pr <pr>` (in the background, as Waiting says; conducted, as Worker protocol 2 says) waits for the next verdict that isn't `waiting`; with the daemon, it also keeps the landing armed (an expired build queued again, a cleared vote restored). Act on the verdict's `outcome`:
|
|
226
|
+
Run `conduct land <pr> --mode <auto|review> --reason "<one line: why this mode>"`; with no daemon, add `--tier <S|M|L>` (the plan's), since auto mode is refused without one (the daemon reads it from the Plan note). It holds the mode to the profile's landing rules, then arms the host's own landing: on Azure DevOps a +10 vote (auto mode, never over a vote already cast) and auto-complete with `noFastForward` and the default merge message; on GitHub, auto-merge with a merge commit in auto mode. It posts a closed `<skill> · Landing` note on the PR (mode, reason, who approves, how to brake) and prints the first verdict. When the PR already has a brake on it (an open comment, a failed build, conflicts), it reports it with `armed: false` and doesn't approve or arm anything. It is safe to repeat (except with `--requeue`), and right after a push it waits for the host to catch up with the new commit. Tell Jason the PR is open and which mode it lands in. On `waiting`, `conduct wait pr <pr>` (in the background, as Waiting says; conducted, as Worker protocol 2 says) waits for the next verdict that isn't `waiting`; with the daemon, it also keeps the landing armed (an expired build queued again, a cleared vote restored). Act on the verdict's `outcome`:
|
|
225
227
|
|
|
226
228
|
- `merged`: go to Land.
|
|
227
|
-
- `build-failed`: each failed build comes with its pipeline, run URL, failed task, errors and the end of the log.
|
|
229
|
+
- `build-failed`: each failed build comes with its pipeline, run URL, failed task, errors and the end of the log. When the log shows a flake that no change caused (a timeout in a test nothing touched, an agent, network or npm error), queue that build again once: `conduct land <pr> --requeue <run> --reason "<the flake and its item>"`, then act on its verdict as above. First give the flake its own item, as step 9's `failed` says. It is once per build and head commit: when it is refused because that build was queued again on the head already, or the log points at the change, fix it, commit, push, and run `conduct land` again.
|
|
228
230
|
- `conflicts`: merge `origin/<base>` into the branch (no rebase), resolve, re-run the checks the conflict touched, push, and run `conduct land` again.
|
|
229
231
|
- `review-comment`: Jason left an open comment, which also holds auto-complete. `conduct pr threads <pr>` shows the ones that need an answer (`needsAnswer`). Address it (change the code if he asked), answer with `conduct reply <pr> <thread> --body-file <file>`, and run `conduct land` again. Jason resolves the thread, which releases auto-complete.
|
|
230
232
|
- `changes-requested`: Jason voted "wait for author" or "reject". Read his comments, make the change, push, and ask him to clear the vote; `land` never votes over it.
|
|
@@ -238,16 +240,16 @@ If the session ends first, the next `/<skill>` in this worktree resumes here.
|
|
|
238
240
|
## 9. Land
|
|
239
241
|
|
|
240
242
|
1. `conduct land`'s `merged` result must show `noFastForward: true` (two parents). If not, stop and tell Jason: a squash breaks semantic-release.
|
|
241
|
-
2. `conduct runs <mergeCommit>` reads the merge's runs. On Azure Pipelines it works out which `<base>` pipelines the merge triggers from their YAML trigger paths (none: `none` at once), gives a triggered pipeline 15 minutes to queue before it is `missing`, and matches a batched run that carries a later commit. While the outcome is `waiting`, `conduct wait merge <mergeCommit>` waits for it to settle (in the background as Waiting says; conducted, as Worker protocol 2 says), then `conduct runs` again reads the details. When the `dev-proof` hook names the pipeline a changed surface's proof waits on (its deploy), add `--for <pipeline>[,<pipeline>…]` to both (the YAML file name, such as `deploy-api`): the outcome then comes from those pipelines alone, the rest come back under `others`, and step 4's proof of that surface starts as soon as it answers `succeeded` (`none` means this merge didn't run that deploy, so the environment has nothing new of it to prove). Then `conduct runs <mergeCommit>` again without `--for`, for the others and their npm stages, before step 3 and Landed. Act on its `outcome`:
|
|
243
|
+
2. `conduct runs <mergeCommit>` reads the merge's runs. On Azure Pipelines it works out which `<base>` pipelines the merge triggers from their YAML trigger paths (none: `none` at once), gives a triggered pipeline 15 minutes to queue before it is `missing`, and matches a batched run that carries a later commit. A `batch: true` pipeline whose run on the base still goes holds the merge's push until that run ends, so the merge's run waits as long as that run does (`behind` names it, and the outcome stays `waiting`). While the outcome is `waiting`, `conduct wait merge <mergeCommit>` waits for it to settle (in the background as Waiting says; conducted, as Worker protocol 2 says), then `conduct runs` again reads the details. When the `dev-proof` hook names the pipeline a changed surface's proof waits on (its deploy), add `--for <pipeline>[,<pipeline>…]` to both (the YAML file name, such as `deploy-api`): the outcome then comes from those pipelines alone, the rest come back under `others`, and step 4's proof of that surface starts as soon as it answers `succeeded` (`none` means this merge didn't run that deploy, so the environment has nothing new of it to prove). Then `conduct runs <mergeCommit>` again without `--for`, for the others and their npm stages, before step 3 and Landed. Act on its `outcome`:
|
|
242
244
|
- `succeeded`, or `none` (no pipeline's trigger matches the merge): go on.
|
|
243
|
-
- `failed`: read the failed runs' `logs
|
|
245
|
+
- `failed`: read the failed runs' `logs`. When they show a flake that no change caused (a timeout in a test nothing touched, an agent, network or npm error; not another merge's real failure, which is that item's), queue it again once with the line the note gives, `conduct runs <mergeCommit> --requeue <pipeline>`, and follow it as for `cancelled` below. First give the flake its own item: `conduct search` its test or error and name the item in your next note, or file one (Rules: new problems become new items, once). Otherwise, when the log points at the change or a requeue is refused because the run was queued again already, report it and fix it in a follow-up PR on this item; a failure you can't fix is Handoff · `failed`.
|
|
244
246
|
- `waiting-for-approval`: give Jason the run URL and the stage, and end the turn. Run `conduct runs` again after he approves.
|
|
245
|
-
- `missing`: a pipeline that should have run never queued.
|
|
247
|
+
- `missing`: a pipeline that should have run never queued, with no run ahead of its batch. First check that the merge didn't skip it on purpose: `git log --format=%B <mergeCommit>^1..<mergeCommit>` with `[skip ci]` (or another of Azure Pipelines' skip markers) in a message means the push ran nothing, so report it to Jason and don't queue it. Otherwise queue it with the line the note gives, `conduct runs <mergeCommit> --requeue <pipeline>`, then follow it as for `cancelled` below. Any other refusal: give Jason the refusal and end the turn (conducted: Handoff · `failed`).
|
|
246
248
|
- `cancelled`: no run carries the merge. On Azure Pipelines a later run on the base that contains the merge already stands in for a cancelled one (`match: batched`, with `supersedes` naming the cancelled run), so `cancelled` means none did. Queue it again with the line the note gives, `conduct runs <mergeCommit> --requeue <pipeline>` (one per cancelled pipeline, named by its YAML file): it queues the pipeline on the base at its tip. Then `conduct wait merge <mergeCommit>` (with the same `--for`) follows the new run, and `conduct runs` reads it again. A refusal for a merge under 15 minutes old (Azure DevOps can still list a newer run that carries it) names the time to try again: `conduct wait time <that time>`, end the turn, and requeue once it holds. Any other refusal: give Jason the refusal and end the turn (conducted: Handoff · `failed`).
|
|
247
249
|
- Exit 5: a lost login, as in step 8. Not a pipeline failure.
|
|
248
|
-
3. **Staged releases.** Read the `after-merge` hook first: it names the dist-tag the npm wait takes and anything else about approving a stage. For each of the profile's releases that ran, `conduct runs` gives `stages.<key>`: the staged `package`, `version`, `stageId`, `approve` and `published`. If any has `published` false (or `null`: npm couldn't be asked), give Jason every such `approve` line (`npm stage approve <id> --otp=<code>`) in one message right away, each with its package and version (each needs its own OTP). Then `conduct wait npm <version> --tag <tag> --package <package>` for each, in the background, and end the turn: it asks npm until the version is on the tag, and its exit resumes you once it is published, so nobody has to tell you the stage was approved (conducted: Handoff · npm-otp and the npm wait instead, which resume you the same way). It holds once the version is published. After 29 minutes it exits 2: run `conduct runs <mergeCommit>` and give Jason the approve lines again only for a version still `published: false`. **Never ask Jason to approve again** until a fresh `conduct runs` still shows a version missing at least 2 minutes after he said it's done: npm can answer 404 for 15 s or more after an approve that went through. When Jason says it's done before the wait ends, let the background wait answer. A key with `stageId: null` staged nothing (its `note` says why; a release with no releasable commits is normal); with a `version` and `published: true`, that version was already on npm when the run reached its stage step (
|
|
250
|
+
3. **Staged releases.** Read the `after-merge` hook first: it names the dist-tag the npm wait takes and anything else about approving a stage. For each of the profile's releases that ran, `conduct runs` gives `stages.<key>`: the staged `package`, `version`, `stageId`, `approve` and `published`. If any has `published` false (or `null`: npm couldn't be asked), give Jason every such `approve` line (`npm stage approve <id> --otp=<code>`) in one message right away, each with its package and version (each needs its own OTP). Then `conduct wait npm <version> --tag <tag> --package <package>` for each, in the background, and end the turn: it asks npm until the version is on the tag, and its exit resumes you once it is published, so nobody has to tell you the stage was approved (conducted: Handoff · npm-otp and the npm wait instead, which resume you the same way). It holds once the version is published. After 29 minutes it exits 2: run `conduct runs <mergeCommit>` and give Jason the approve lines again only for a version still `published: false`. **Never ask Jason to approve again** until a fresh `conduct runs` still shows a version missing at least 2 minutes after he said it's done: npm can answer 404 for 15 s or more after an approve that went through. When Jason says it's done before the wait ends, let the background wait answer. A key with `stageId: null` staged nothing (its `note` says why; a release with no releasable commits is normal); with a `version` and `published: true`, that version was already on npm when the run reached its stage step (another run's stage, approved, or the last release when the merge had nothing to release), so there is nothing to approve, and it carries the merge only when `git tag --contains <mergeCommit>` lists its tag. A key with `deferredTo` released nothing: the base had newer commits that touch the package by the time the run reached its release, and the run for that commit releases this merge with them. Read that run's stage with `conduct runs <deferredTo>` (`conduct wait merge <deferredTo>` while it is `waiting`), handle it as this merge's own stage above, and confirm with `git tag --contains <mergeCommit>` once it has released. If that run defers too, follow its `deferredTo` the same way, at most twice; when no run of the release carries it (`none` or `missing`), or the chain goes on, report it (conducted: Handoff · `failed`). Then the rest of the `after-merge` hook.
|
|
249
251
|
4. **Proof after the deploy.** `<verify>` against the deployed environment on the changed surfaces, once their deploy finished, as the `dev-proof` hook says (browser runs hold the `chrome` lock, as in step 6). A staged release is proved on the version it published, after Jason approved it, not on the checkout's build.
|
|
250
252
|
5. Post `<skill> · Landed`: the merge commit, the landing mode and who approved, the pipeline results, the evidence after the deploy. It moves the item to done. File follow-ups as new items related to this one, searching first (Rules: new problems become new items, once).
|
|
251
|
-
6. Wrap up. The branch is still checked out in this worktree, so leave it. Tell Jason the item is done and that `/exit` removes the worktree; the hook keeps a renamed branch, so `git branch -d <branch>` from the main checkout clears it. Conducted: end the turn; the daemon retires the worker once the item is done.
|
|
253
|
+
6. Wrap up. The branch is still checked out in this worktree, so leave it. Tell Jason the item is done and that `/exit` removes the worktree; the hook keeps a renamed branch, so `git branch -d <branch>` from the main checkout clears it. Conducted: end the turn; the daemon retires the worker once the item is done, and removes its worktree and branch once the PR has merged.
|
|
252
254
|
|
|
253
255
|
Releases are out of scope: the profile's release handoff (`release.handoff`) says how the base branch ships.
|
package/build/checkout-sync.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { link } from "./links.js";
|
|
5
|
-
import { outputOf, run } from "./run.js";
|
|
6
|
-
import {} from "./store.js";
|
|
7
|
-
const LOCKFILE = '.atk-lock.json';
|
|
8
|
-
const FETCH_MS = 60_000;
|
|
9
|
-
// How often the timer looks for a due project; a check put off by a launch runs on the next look.
|
|
10
|
-
const POLL_MS = 60_000;
|
|
11
|
-
const pinChangeSchema = z.object({
|
|
12
|
-
// Null: the asset is new on origin (from) or gone from it (to).
|
|
13
|
-
from: z.string().nullable(),
|
|
14
|
-
name: z.string(),
|
|
15
|
-
to: z.string().nullable(),
|
|
16
|
-
type: z.string().nullable(),
|
|
17
|
-
});
|
|
18
|
-
const lockSchema = z.looseObject({
|
|
19
|
-
assets: z.array(z.looseObject({ name: z.string(), type: z.string().nullish(), version: z.string().nullish() })),
|
|
20
|
-
});
|
|
21
|
-
export function checkoutSync(deps) {
|
|
22
|
-
const { config, inbox, log, ports, store } = deps;
|
|
23
|
-
const now = deps.now ?? (() => new Date());
|
|
24
|
-
const { intervalMinutes, mode } = config.checkout;
|
|
25
|
-
// When each project was last checked (ms), and its last check failure, logged once.
|
|
26
|
-
const checkedAt = new Map();
|
|
27
|
-
const failing = new Map();
|
|
28
|
-
// By project. A pull's install that failed or never ran stays here and is tried again on every
|
|
29
|
-
// check; the `checkout.pending` event keeps it across a restart.
|
|
30
|
-
const pending = new Map();
|
|
31
|
-
const restored = new Set();
|
|
32
|
-
let running = null;
|
|
33
|
-
let timer;
|
|
34
|
-
// A read the check needs (a fetch offline, a lockfile that doesn't parse) throws: logged, and
|
|
35
|
-
// tried again on the next check, never an inbox item.
|
|
36
|
-
const git = async (root, args) => {
|
|
37
|
-
const result = await ports.git(args, root);
|
|
38
|
-
if (!result.ok)
|
|
39
|
-
throw new Error(`git ${args.join(' ')}: ${result.output}`);
|
|
40
|
-
return result.stdout;
|
|
41
|
-
};
|
|
42
|
-
// The items this raises for a main checkout carry its path as their link, and an ask to bring it
|
|
43
|
-
// up to date starts its commands with the pull.
|
|
44
|
-
const pull = (root) => `git -C "${root}" pull --ff-only`;
|
|
45
|
-
const ours = (project) => inbox
|
|
46
|
-
.open()
|
|
47
|
-
.filter((i) => i.kind === 'operator' && i.item === null && i.project === project.name && i.links[0]?.href === project.root);
|
|
48
|
-
const stale = (project) => ours(project).filter((i) => i.commands[0] === pull(project.root));
|
|
49
|
-
// One open item per kind of ask: the same text stays, a different one replaces it.
|
|
50
|
-
const raise = (project, open, text, commands) => {
|
|
51
|
-
if (open.some((i) => i.text === text))
|
|
52
|
-
return;
|
|
53
|
-
for (const item of open)
|
|
54
|
-
inbox.resolve(item, 'replaced by a newer check');
|
|
55
|
-
inbox.raise({
|
|
56
|
-
commands,
|
|
57
|
-
condition: null,
|
|
58
|
-
item: null,
|
|
59
|
-
kind: 'operator',
|
|
60
|
-
links: [link(project.root, 'checkout')],
|
|
61
|
-
project: project.name,
|
|
62
|
-
text,
|
|
63
|
-
worker: null,
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
const askToUpdate = (project, why) => raise(project, stale(project), why, [pull(project.root), `atk install -P "${project.root}"`]);
|
|
67
|
-
const resolveAsks = (project, by) => {
|
|
68
|
-
for (const item of stale(project))
|
|
69
|
-
inbox.resolve(item, by);
|
|
70
|
-
};
|
|
71
|
-
const remember = (project, base, next) => {
|
|
72
|
-
const before = pending.get(project.name);
|
|
73
|
-
if (next === null)
|
|
74
|
-
pending.delete(project.name);
|
|
75
|
-
else
|
|
76
|
-
pending.set(project.name, next);
|
|
77
|
-
if (next !== null && JSON.stringify(before?.changes) !== JSON.stringify(next.changes)) {
|
|
78
|
-
store.appendEvent({
|
|
79
|
-
data: { base, changes: next.changes, root: project.root },
|
|
80
|
-
kind: 'checkout.pending',
|
|
81
|
-
project: project.name,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
// What an earlier daemon left to install: a `checkout.pending` with no `checkout.updated` after it.
|
|
86
|
-
const restore = (project) => {
|
|
87
|
-
if (restored.has(project.name))
|
|
88
|
-
return;
|
|
89
|
-
restored.add(project.name);
|
|
90
|
-
const last = store.latestEvent(['checkout.pending', 'checkout.updated'], project.name);
|
|
91
|
-
if (last?.kind !== 'checkout.pending')
|
|
92
|
-
return;
|
|
93
|
-
const changes = z.array(pinChangeSchema).safeParse(last.data.changes);
|
|
94
|
-
if (changes.success && changes.data.length > 0)
|
|
95
|
-
pending.set(project.name, { changes: changes.data });
|
|
96
|
-
};
|
|
97
|
-
const sync = async (project, base) => {
|
|
98
|
-
const root = project.root;
|
|
99
|
-
restore(project);
|
|
100
|
-
await git(root, ['fetch', '--quiet', 'origin', base]);
|
|
101
|
-
const changes = pinChanges(await git(root, ['show', `HEAD:${LOCKFILE}`]), await git(root, ['show', `origin/${base}:${LOCKFILE}`]));
|
|
102
|
-
if (changes.length > 0) {
|
|
103
|
-
remember(project, base, { changes: mergeChanges(pending.get(project.name)?.changes ?? [], changes) });
|
|
104
|
-
const behind = `origin/${base} pins ${changes.map(describeChange).join(', ')}, and the main checkout doesn't have them yet`;
|
|
105
|
-
if (mode === 'notify')
|
|
106
|
-
return askToUpdate(project, behind);
|
|
107
|
-
const branch = await ports.git(['symbolic-ref', '--quiet', '--short', 'HEAD'], root);
|
|
108
|
-
const on = branch.ok ? branch.stdout.trim() : '(detached)';
|
|
109
|
-
if (on !== base)
|
|
110
|
-
return askToUpdate(project, `${behind}: it is on ${on}, not ${base}, so the conductor left it`);
|
|
111
|
-
// Exit 1 is a change; an error proves nothing is changed either.
|
|
112
|
-
if (!(await ports.git(['diff', '--quiet', '--ignore-cr-at-eol', 'HEAD', '--', LOCKFILE], root)).ok)
|
|
113
|
-
return askToUpdate(project, `${behind}: its ${LOCKFILE} has local changes, so the conductor left it`);
|
|
114
|
-
const merged = await ports.git(['merge', '--ff-only', '--quiet', `origin/${base}`], root);
|
|
115
|
-
if (!merged.ok) {
|
|
116
|
-
// git's last line is its reason; the hints above it say what to type.
|
|
117
|
-
const reason = merged.output.trim().split('\n').at(-1);
|
|
118
|
-
return askToUpdate(project, `${behind}: git refused the fast-forward (${reason})`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// HEAD has origin's pins now: by this pull, by Jason's, or by an earlier check whose install
|
|
122
|
-
// didn't finish.
|
|
123
|
-
const todo = pending.get(project.name);
|
|
124
|
-
if (!todo)
|
|
125
|
-
return;
|
|
126
|
-
const pins = todo.changes.map(describeChange).join(', ');
|
|
127
|
-
if (mode === 'notify') {
|
|
128
|
-
remember(project, base, null);
|
|
129
|
-
return resolveAsks(project, `the main checkout has the pins of origin/${base}`);
|
|
130
|
-
}
|
|
131
|
-
const head = (await git(root, ['rev-parse', '--short', 'HEAD'])).trim();
|
|
132
|
-
const names = [...new Set(todo.changes.flatMap((c) => (c.to === null ? [] : [c.name])))];
|
|
133
|
-
const problem = names.length === 0 ? null : await ports.checkSkills(root, names);
|
|
134
|
-
if (problem !== null)
|
|
135
|
-
return askToUpdate(project, `pulled to ${head} for ${pins}, but the install didn't take: ${problem}`);
|
|
136
|
-
store.appendEvent({
|
|
137
|
-
data: { base, changes: todo.changes.map(describeChange), head, root },
|
|
138
|
-
kind: 'checkout.updated',
|
|
139
|
-
project: project.name,
|
|
140
|
-
});
|
|
141
|
-
log.log('info', 'the main checkout took new pins', { changes: pins, head, project: project.name });
|
|
142
|
-
remember(project, base, null);
|
|
143
|
-
resolveAsks(project, `the conductor installed ${pins} at ${head}`);
|
|
144
|
-
};
|
|
145
|
-
const checkAll = async () => {
|
|
146
|
-
const at = now().getTime();
|
|
147
|
-
for (const project of store.listProjects()) {
|
|
148
|
-
if (!project.enabled || !project.profile || !existsSync(join(project.root, LOCKFILE)))
|
|
149
|
-
continue;
|
|
150
|
-
if (at - (checkedAt.get(project.name) ?? -Infinity) < intervalMinutes * 60_000)
|
|
151
|
-
continue;
|
|
152
|
-
// A worktree being created copies the main checkout's skills: check on a later look.
|
|
153
|
-
if (store.listWorkers(['launching']).some((w) => w.project === project.name))
|
|
154
|
-
continue;
|
|
155
|
-
checkedAt.set(project.name, at);
|
|
156
|
-
try {
|
|
157
|
-
await sync(project, project.profile.baseBranch);
|
|
158
|
-
failing.delete(project.name);
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
162
|
-
if (failing.get(project.name) === message)
|
|
163
|
-
continue;
|
|
164
|
-
failing.set(project.name, message);
|
|
165
|
-
log.log('warn', 'the main checkout check failed', { error: message, project: project.name });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const check = () => {
|
|
170
|
-
if (mode === 'off')
|
|
171
|
-
return Promise.resolve();
|
|
172
|
-
running ??= checkAll().finally(() => (running = null));
|
|
173
|
-
return running;
|
|
174
|
-
};
|
|
175
|
-
return {
|
|
176
|
-
check,
|
|
177
|
-
settled: async () => {
|
|
178
|
-
await running;
|
|
179
|
-
},
|
|
180
|
-
start: () => {
|
|
181
|
-
if (mode === 'off')
|
|
182
|
-
return;
|
|
183
|
-
const safeCheck = () => {
|
|
184
|
-
check().catch((error) => log.log('error', 'the main checkout check failed', { error: String(error) }));
|
|
185
|
-
};
|
|
186
|
-
safeCheck();
|
|
187
|
-
timer = setInterval(safeCheck, POLL_MS);
|
|
188
|
-
timer.unref();
|
|
189
|
-
},
|
|
190
|
-
stop: async () => {
|
|
191
|
-
clearInterval(timer);
|
|
192
|
-
timer = undefined;
|
|
193
|
-
await running;
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
export function describeChange({ from, name, to }) {
|
|
198
|
-
if (from === null)
|
|
199
|
-
return `${name} ${to ?? '?'} (new)`;
|
|
200
|
-
if (to === null)
|
|
201
|
-
return `${name} ${from} (removed)`;
|
|
202
|
-
return `${name} ${from} → ${to}`;
|
|
203
|
-
}
|
|
204
|
-
export function gitPort() {
|
|
205
|
-
return async (args, cwd) => {
|
|
206
|
-
const result = await run('git', args, { cwd, timeoutMs: FETCH_MS });
|
|
207
|
-
return result.code === 0 ? { ok: true, stdout: result.stdout } : { ok: false, output: outputOf(result, 500) };
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
// Pins still to install after a further change on origin: each asset keeps the version it had
|
|
211
|
-
// before the first change and takes the newest one; an asset back where it started drops out.
|
|
212
|
-
export function mergeChanges(earlier, later) {
|
|
213
|
-
const byKey = new Map(earlier.map((c) => [keyOf(c), c]));
|
|
214
|
-
for (const c of later) {
|
|
215
|
-
const first = byKey.get(keyOf(c));
|
|
216
|
-
byKey.set(keyOf(c), first ? { ...c, from: first.from } : c);
|
|
217
|
-
}
|
|
218
|
-
return [...byKey.values()].filter((c) => c.from !== c.to).sort(byName);
|
|
219
|
-
}
|
|
220
|
-
// The pins that differ between two .atk-lock.json texts, by asset type and name.
|
|
221
|
-
export function pinChanges(before, after) {
|
|
222
|
-
const pins = (text) => new Map(lockSchema
|
|
223
|
-
.parse(JSON.parse(text))
|
|
224
|
-
.assets.map((a) => [
|
|
225
|
-
keyOf({ name: a.name, type: a.type ?? null }),
|
|
226
|
-
{ name: a.name, type: a.type ?? null, version: a.version ?? null },
|
|
227
|
-
]));
|
|
228
|
-
const was = pins(before);
|
|
229
|
-
const now = pins(after);
|
|
230
|
-
const changes = [];
|
|
231
|
-
for (const [key, { name, type, version }] of now) {
|
|
232
|
-
const old = was.get(key);
|
|
233
|
-
if (!old)
|
|
234
|
-
changes.push({ from: null, name, to: version, type });
|
|
235
|
-
else if (old.version !== version)
|
|
236
|
-
changes.push({ from: old.version, name, to: version, type });
|
|
237
|
-
}
|
|
238
|
-
for (const [key, { name, type, version }] of was)
|
|
239
|
-
if (!now.has(key))
|
|
240
|
-
changes.push({ from: version, name, to: null, type });
|
|
241
|
-
return changes.sort(byName);
|
|
242
|
-
}
|
|
243
|
-
function byName(a, b) {
|
|
244
|
-
return a.name.localeCompare(b.name) || (a.type ?? '').localeCompare(b.type ?? '');
|
|
245
|
-
}
|
|
246
|
-
function keyOf({ name, type }) {
|
|
247
|
-
return `${type ?? ''}:${name}`;
|
|
248
|
-
}
|
|
249
|
-
//# sourceMappingURL=checkout-sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-sync.js","sourceRoot":"","sources":["../src/checkout-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAA4C,MAAM,YAAY,CAAC;AAuCtE,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAClC,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,kGAAkG;AAClG,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,gEAAgE;IAChE,IAAI,EAAE,C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C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,MAAM,CAAC,CAAY,EAAE,CAAY;IACxC,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAoC;IAC7D,OAAO,GAAG,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
package/build/credential.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { run } from "./run.js";
|
|
2
|
-
const NOT_FOUND = 3;
|
|
3
|
-
// Win32 ERROR_NOT_FOUND: CredRead's "no such credential". Any other failure is a broken read.
|
|
4
|
-
const ERROR_NOT_FOUND = 1168;
|
|
5
|
-
// Writes the user name, a newline, then the password.
|
|
6
|
-
const CRED_READ = `
|
|
7
|
-
$ErrorActionPreference = 'Stop'
|
|
8
|
-
try {
|
|
9
|
-
Add-Type -Namespace AtkConduct -Name Cred -MemberDefinition @'
|
|
10
|
-
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
11
|
-
public static extern bool CredRead(string target, int type, int flags, out System.IntPtr cred);
|
|
12
|
-
[DllImport("advapi32.dll")]
|
|
13
|
-
public static extern void CredFree(System.IntPtr cred);
|
|
14
|
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
15
|
-
public struct CREDENTIAL { public int Flags; public int Type; public string TargetName; public string Comment;
|
|
16
|
-
public long LastWritten; public int CredentialBlobSize; public System.IntPtr CredentialBlob; public int Persist;
|
|
17
|
-
public int AttributeCount; public System.IntPtr Attributes; public string TargetAlias; public string UserName; }
|
|
18
|
-
'@
|
|
19
|
-
$p = [IntPtr]::Zero
|
|
20
|
-
if (-not [AtkConduct.Cred]::CredRead($env:ATK_CONDUCT_CRED_TARGET, 1, 0, [ref]$p)) {
|
|
21
|
-
$code = [Runtime.InteropServices.Marshal]::GetLastWin32Error()
|
|
22
|
-
if ($code -eq ${ERROR_NOT_FOUND}) { exit ${NOT_FOUND} }
|
|
23
|
-
[Console]::Error.WriteLine("CredRead failed with Win32 error $code"); exit 4
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
$c = [Runtime.InteropServices.Marshal]::PtrToStructure($p, [type][AtkConduct.Cred+CREDENTIAL])
|
|
27
|
-
[Console]::Out.Write([string]$c.UserName + [char]10)
|
|
28
|
-
[Console]::Out.Write([Runtime.InteropServices.Marshal]::PtrToStringUni($c.CredentialBlob, $c.CredentialBlobSize / 2))
|
|
29
|
-
} finally { [AtkConduct.Cred]::CredFree($p) }
|
|
30
|
-
} catch { [Console]::Error.WriteLine($_.Exception.Message); exit 4 }
|
|
31
|
-
`;
|
|
32
|
-
export async function credentialSaved(target, env = process.env) {
|
|
33
|
-
if (process.platform !== 'win32')
|
|
34
|
-
return 'missing';
|
|
35
|
-
const result = await run('cmdkey', [`/list:${target}`], { env, timeoutMs: 15_000 });
|
|
36
|
-
if (result.code !== 0)
|
|
37
|
-
return 'unknown';
|
|
38
|
-
if (/\*\s*NONE\s*\*/.test(result.stdout))
|
|
39
|
-
return 'missing';
|
|
40
|
-
return /^\s*Target:/m.test(result.stdout) ? 'saved' : 'unknown';
|
|
41
|
-
}
|
|
42
|
-
// Reads the generic credential `target`. Windows only.
|
|
43
|
-
export async function readCredential(target, env = process.env) {
|
|
44
|
-
if (process.platform !== 'win32')
|
|
45
|
-
return { found: false, missing: true, reason: `the ${target} credential is Windows-only` };
|
|
46
|
-
const result = await run('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(CRED_READ, 'utf16le').toString('base64')], { env: { ...env, ATK_CONDUCT_CRED_TARGET: target }, timeoutMs: 30_000 });
|
|
47
|
-
if (result.code === 0) {
|
|
48
|
-
const newline = result.stdout.indexOf('\n');
|
|
49
|
-
const secret = result.stdout.slice(newline + 1).trim();
|
|
50
|
-
if (newline >= 0 && secret)
|
|
51
|
-
return { credential: { secret, user: result.stdout.slice(0, newline).trim() }, found: true };
|
|
52
|
-
}
|
|
53
|
-
if (result.code === NOT_FOUND)
|
|
54
|
-
return { found: false, missing: true, reason: `no credential ${target}` };
|
|
55
|
-
// Never echo stdout here: on a partial failure it could hold the secret.
|
|
56
|
-
const line = result.stderr
|
|
57
|
-
.split(/\r?\n/)
|
|
58
|
-
.map((l) => l.trim())
|
|
59
|
-
.find((l) => l && !l.startsWith('#< CLIXML') && !l.startsWith('<Objs'));
|
|
60
|
-
return {
|
|
61
|
-
found: false,
|
|
62
|
-
missing: false,
|
|
63
|
-
reason: `the credential ${target} couldn't be read (${result.error ?? line ?? `exit ${result.code}`})`,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=credential.js.map
|
package/build/credential.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential.js","sourceRoot":"","sources":["../src/credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAe/B,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,8FAA8F;AAC9F,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,sDAAsD;AACtD,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;kBAgBA,eAAe,YAAY,SAAS;;;;;;;;;CASrD,CAAC;AAMF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,MAAyB,OAAO,CAA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,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvD,IAAI,OAAO,IAAI,CAAC,IAAI,MAAM;YACxB,OAAO,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACjG,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,MAAM,EAAE,EAAE,CAAC;IACzG,yEAAyE;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM;SACvB,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,kBAAkB,MAAM,sBAAsB,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,QAAQ,MAAM,CAAC,IAAI,EAAE,GAAG;KACvG,CAAC;AACJ,CAAC"}
|
package/build/startup.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { execFileSync, spawnSync } from 'node:child_process';
|
|
2
|
-
import { ConductorError } from "./errors.js";
|
|
3
|
-
export const TASK_NAME = 'Conductor';
|
|
4
|
-
// Registers a per-user Task Scheduler task that runs `conduct supervise` at logon, which keeps
|
|
5
|
-
// `conduct serve` running (supervise.ts). No elevation is needed for a task that runs as the
|
|
6
|
-
// current user. conhost --headless keeps a console window (or a Windows Terminal tab) from
|
|
7
|
-
// opening, and the zero time limit stops Task Scheduler from ending the daemon after its default
|
|
8
|
-
// 72 hours. A second start while one runs exits on the pid lock, and its supervisor with it.
|
|
9
|
-
export function installStartup({ cliPath, nodePath }) {
|
|
10
|
-
requireWindows();
|
|
11
|
-
const script = [
|
|
12
|
-
"$ErrorActionPreference = 'Stop'",
|
|
13
|
-
'$user = "$env:USERDOMAIN\\$env:USERNAME"',
|
|
14
|
-
'$action = New-ScheduledTaskAction -Execute "$env:SystemRoot\\System32\\conhost.exe" -Argument $env:CONDUCTOR_TASK_ARGS',
|
|
15
|
-
'$trigger = New-ScheduledTaskTrigger -AtLogOn -User $user',
|
|
16
|
-
'$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -MultipleInstances IgnoreNew -ExecutionTimeLimit ([TimeSpan]::Zero)',
|
|
17
|
-
'$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited',
|
|
18
|
-
`Register-ScheduledTask -TaskName '${TASK_NAME}' -Description 'Starts the conductor daemon (conduct supervise) at logon.' -Action $action -Trigger $trigger -Settings $settings -Principal $principal -Force | Out-Null`,
|
|
19
|
-
].join('\n');
|
|
20
|
-
powershell(script, { CONDUCTOR_TASK_ARGS: `--headless "${nodePath}" "${cliPath}" supervise` });
|
|
21
|
-
}
|
|
22
|
-
// True when a task was removed, false when there was none.
|
|
23
|
-
export function removeStartup() {
|
|
24
|
-
requireWindows();
|
|
25
|
-
if (!startupInstalled())
|
|
26
|
-
return false;
|
|
27
|
-
execFileSync('schtasks', ['/Delete', '/TN', TASK_NAME, '/F'], { stdio: 'ignore' });
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
export function runStartup() {
|
|
31
|
-
const result = spawnSync('schtasks', ['/Run', '/TN', TASK_NAME], { encoding: 'utf8' });
|
|
32
|
-
if (result.status !== 0) {
|
|
33
|
-
throw new ConductorError(`could not run the "${TASK_NAME}" logon task`, [
|
|
34
|
-
result.stderr?.trim() || result.error?.message || `exit ${result.status}`,
|
|
35
|
-
]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function startupInstalled() {
|
|
39
|
-
return spawnSync('schtasks', ['/Query', '/TN', TASK_NAME], { stdio: 'ignore' }).status === 0;
|
|
40
|
-
}
|
|
41
|
-
// True when the logon task exists and its action runs this cli.js, so running it starts this
|
|
42
|
-
// build. A task registered from another build (a linked checkout) would start that one.
|
|
43
|
-
export function startupRunsCli(cliPath) {
|
|
44
|
-
if (process.platform !== 'win32')
|
|
45
|
-
return false;
|
|
46
|
-
const result = spawnSync('schtasks', ['/Query', '/TN', TASK_NAME, '/XML'], { encoding: 'utf8' });
|
|
47
|
-
return result.status === 0 && taskRunsCli(result.stdout, cliPath);
|
|
48
|
-
}
|
|
49
|
-
// True when the logon task runs `conduct supervise`. One an install-startup from before ATK-417
|
|
50
|
-
// registered runs `conduct serve`, which nothing restarts.
|
|
51
|
-
export function startupSupervises() {
|
|
52
|
-
if (process.platform !== 'win32')
|
|
53
|
-
return false;
|
|
54
|
-
const result = spawnSync('schtasks', ['/Query', '/TN', TASK_NAME, '/XML'], { encoding: 'utf8' });
|
|
55
|
-
return result.status === 0 && taskSupervises(result.stdout);
|
|
56
|
-
}
|
|
57
|
-
// The task's <Arguments> quote the cli.js path (installStartup); XML escapes it, and Windows paths
|
|
58
|
-
// compare without case.
|
|
59
|
-
export function taskRunsCli(xml, cliPath) {
|
|
60
|
-
const args = taskArguments(xml);
|
|
61
|
-
return args !== undefined && args.toLowerCase().includes(`"${cliPath.toLowerCase()}"`);
|
|
62
|
-
}
|
|
63
|
-
export function taskSupervises(xml) {
|
|
64
|
-
return /\ssupervise\s*$/.test(taskArguments(xml) ?? '');
|
|
65
|
-
}
|
|
66
|
-
function powershell(script, env) {
|
|
67
|
-
const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], {
|
|
68
|
-
encoding: 'utf8',
|
|
69
|
-
env: { ...process.env, ...env },
|
|
70
|
-
});
|
|
71
|
-
if (result.status !== 0) {
|
|
72
|
-
throw new ConductorError('could not register the logon task', [result.stderr.trim() || `exit ${result.status}`]);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function requireWindows() {
|
|
76
|
-
if (process.platform !== 'win32') {
|
|
77
|
-
throw new ConductorError('install-startup supports Windows only', [
|
|
78
|
-
'start `conduct serve` from your own login items',
|
|
79
|
-
]);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// The task action's <Arguments>, XML unescaped.
|
|
83
|
-
function taskArguments(xml) {
|
|
84
|
-
return /<Arguments>([^<]*)<\/Arguments>/
|
|
85
|
-
.exec(xml)?.[1]
|
|
86
|
-
?.replaceAll('"', '"')
|
|
87
|
-
.replaceAll(''', "'")
|
|
88
|
-
.replaceAll('<', '<')
|
|
89
|
-
.replaceAll('>', '>')
|
|
90
|
-
.replaceAll('&', '&');
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=startup.js.map
|
package/build/startup.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAErC,+FAA+F;AAC/F,6FAA6F;AAC7F,2FAA2F;AAC3F,iGAAiG;AACjG,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAyC;IACzF,cAAc,EAAE,CAAC;IACjB,MAAM,MAAM,GAAG;QACb,iCAAiC;QACjC,0CAA0C;QAC1C,wHAAwH;QACxH,0DAA0D;QAC1D,uLAAuL;QACvL,gGA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M;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE;KAChC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,cAAc,CAAC,mCAAmC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnH,CAAC;AACH,CAAC;AAED,SAAS,cAAc;IACrB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,cAAc,CAAC,uCAAuC,EAAE;YAChE,iDAAiD;SAClD,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,gDAAgD;AAChD,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,iCAAiC;SACrC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACf,EAAE,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC;SAC1B,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC;SACzB,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;SACvB,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;SACvB,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
package/build/tab.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { outputOf, run } from "./run.js";
|
|
2
|
-
// Runs wt.exe for a worker's tab or the console's. Not hidden: when the named window doesn't exist
|
|
3
|
-
// yet, Windows Terminal creates it with the spawn's SW_HIDE, and the tab runs where nobody sees it
|
|
4
|
-
// (ATK-469, ATK-336).
|
|
5
|
-
export function openWindowsTerminal(args, cwd, runCommand = run) {
|
|
6
|
-
return runCommand('wt.exe', args, { cwd, timeoutMs: 60_000, windowsHide: false });
|
|
7
|
-
}
|
|
8
|
-
// A tab in the project's Windows Terminal window, attached to the session. wt.exe splits its own
|
|
9
|
-
// arguments on `;`, so titles lose it and the command chains with `||`. The tab closes when the
|
|
10
|
-
// session stops (a park), and stays open only to show a failed attach (ATK-260).
|
|
11
|
-
export function tabArgs(tab) {
|
|
12
|
-
const clean = (text) => text.replace(/;/g, ',').replace(/\s+/g, ' ').trim();
|
|
13
|
-
return [
|
|
14
|
-
'-w',
|
|
15
|
-
clean(tab.window),
|
|
16
|
-
'new-tab',
|
|
17
|
-
'--title',
|
|
18
|
-
clean(tab.title).slice(0, 80),
|
|
19
|
-
'pwsh',
|
|
20
|
-
'-Command',
|
|
21
|
-
`claude attach ${tab.handle} || Read-Host 'claude attach failed, press Enter to close this tab'`,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
export function windowsTerminalTab() {
|
|
25
|
-
return async (tab) => {
|
|
26
|
-
if (process.platform !== 'win32')
|
|
27
|
-
return 'tabs need Windows Terminal';
|
|
28
|
-
const result = await openWindowsTerminal(tabArgs(tab), tab.cwd);
|
|
29
|
-
return result.code === 0 ? null : outputOf(result, 500);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=tab.js.map
|
package/build/tab.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tab.js","sourceRoot":"","sources":["../src/tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAkB,MAAM,UAAU,CAAC;AAazD,mGAAmG;AACnG,mGAAmG;AACnG,sBAAsB;AACtB,MAAM,UAAU,mBAAmB,CAAC,IAAuB,EAAE,GAAW,EAAE,UAAU,GAAG,GAAG;IACxF,OAAO,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,iGAAiG;AACjG,gGAAgG;AAChG,iFAAiF;AACjF,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,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