looply-cli 0.5.43 → 0.5.49

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 (133) hide show
  1. package/dist/.src-hash +1 -1
  2. package/dist/additive-union.d.ts +31 -0
  3. package/dist/additive-union.d.ts.map +1 -0
  4. package/dist/additive-union.js +129 -0
  5. package/dist/additive-union.js.map +1 -0
  6. package/dist/autonomy-controller.d.ts.map +1 -1
  7. package/dist/autonomy-controller.js +6 -0
  8. package/dist/autonomy-controller.js.map +1 -1
  9. package/dist/autonomy-tick.d.ts.map +1 -1
  10. package/dist/autonomy-tick.js +20 -2
  11. package/dist/autonomy-tick.js.map +1 -1
  12. package/dist/bin.d.ts.map +1 -1
  13. package/dist/bin.js +4 -0
  14. package/dist/bin.js.map +1 -1
  15. package/dist/branch-delivery-wiring.d.ts +41 -1
  16. package/dist/branch-delivery-wiring.d.ts.map +1 -1
  17. package/dist/branch-delivery-wiring.js +95 -2
  18. package/dist/branch-delivery-wiring.js.map +1 -1
  19. package/dist/branch-delivery.d.ts +51 -2
  20. package/dist/branch-delivery.d.ts.map +1 -1
  21. package/dist/branch-delivery.js +220 -13
  22. package/dist/branch-delivery.js.map +1 -1
  23. package/dist/branch-replay.d.ts +9 -1
  24. package/dist/branch-replay.d.ts.map +1 -1
  25. package/dist/branch-replay.js +58 -6
  26. package/dist/branch-replay.js.map +1 -1
  27. package/dist/canary-cmd.d.ts +42 -0
  28. package/dist/canary-cmd.d.ts.map +1 -0
  29. package/dist/canary-cmd.js +242 -0
  30. package/dist/canary-cmd.js.map +1 -0
  31. package/dist/canary-wiring.d.ts +31 -0
  32. package/dist/canary-wiring.d.ts.map +1 -0
  33. package/dist/canary-wiring.js +139 -0
  34. package/dist/canary-wiring.js.map +1 -0
  35. package/dist/canary.d.ts +123 -0
  36. package/dist/canary.d.ts.map +1 -0
  37. package/dist/canary.js +259 -0
  38. package/dist/canary.js.map +1 -0
  39. package/dist/coordinator-state.d.ts.map +1 -1
  40. package/dist/coordinator-state.js +6 -4
  41. package/dist/coordinator-state.js.map +1 -1
  42. package/dist/daemon-cmd.d.ts.map +1 -1
  43. package/dist/daemon-cmd.js +37 -3
  44. package/dist/daemon-cmd.js.map +1 -1
  45. package/dist/deliver-cmd.d.ts +12 -0
  46. package/dist/deliver-cmd.d.ts.map +1 -1
  47. package/dist/deliver-cmd.js +25 -0
  48. package/dist/deliver-cmd.js.map +1 -1
  49. package/dist/environment-hold.d.ts +32 -1
  50. package/dist/environment-hold.d.ts.map +1 -1
  51. package/dist/environment-hold.js +52 -5
  52. package/dist/environment-hold.js.map +1 -1
  53. package/dist/feature-report.d.ts +4 -2
  54. package/dist/feature-report.d.ts.map +1 -1
  55. package/dist/feature-report.js +24 -6
  56. package/dist/feature-report.js.map +1 -1
  57. package/dist/fresh-gates.d.ts +105 -0
  58. package/dist/fresh-gates.d.ts.map +1 -0
  59. package/dist/fresh-gates.js +200 -0
  60. package/dist/fresh-gates.js.map +1 -0
  61. package/dist/git-driver.d.ts +5 -0
  62. package/dist/git-driver.d.ts.map +1 -1
  63. package/dist/git-driver.js +8 -0
  64. package/dist/git-driver.js.map +1 -1
  65. package/dist/goal-adaptive.d.ts +25 -1
  66. package/dist/goal-adaptive.d.ts.map +1 -1
  67. package/dist/goal-adaptive.js +42 -1
  68. package/dist/goal-adaptive.js.map +1 -1
  69. package/dist/goal-compile.d.ts.map +1 -1
  70. package/dist/goal-compile.js +13 -0
  71. package/dist/goal-compile.js.map +1 -1
  72. package/dist/goal-gap.d.ts +14 -3
  73. package/dist/goal-gap.d.ts.map +1 -1
  74. package/dist/goal-gap.js +46 -6
  75. package/dist/goal-gap.js.map +1 -1
  76. package/dist/grant-waiting-wiring.d.ts +3 -2
  77. package/dist/grant-waiting-wiring.d.ts.map +1 -1
  78. package/dist/grant-waiting-wiring.js +5 -4
  79. package/dist/grant-waiting-wiring.js.map +1 -1
  80. package/dist/machine-settings.d.ts +4 -0
  81. package/dist/machine-settings.d.ts.map +1 -1
  82. package/dist/machine-settings.js +15 -1
  83. package/dist/machine-settings.js.map +1 -1
  84. package/dist/outcome-audit.d.ts +152 -0
  85. package/dist/outcome-audit.d.ts.map +1 -0
  86. package/dist/outcome-audit.js +313 -0
  87. package/dist/outcome-audit.js.map +1 -0
  88. package/dist/parts-attribution.d.ts +38 -0
  89. package/dist/parts-attribution.d.ts.map +1 -0
  90. package/dist/parts-attribution.js +61 -0
  91. package/dist/parts-attribution.js.map +1 -0
  92. package/dist/project-terminal.d.ts +3 -1
  93. package/dist/project-terminal.d.ts.map +1 -1
  94. package/dist/project-terminal.js +37 -5
  95. package/dist/project-terminal.js.map +1 -1
  96. package/dist/pursuit-delivery.d.ts +5 -20
  97. package/dist/pursuit-delivery.d.ts.map +1 -1
  98. package/dist/pursuit-delivery.js +30 -2
  99. package/dist/pursuit-delivery.js.map +1 -1
  100. package/dist/pursuit-ending.d.ts.map +1 -1
  101. package/dist/pursuit-ending.js +10 -0
  102. package/dist/pursuit-ending.js.map +1 -1
  103. package/dist/run-cmd.d.ts.map +1 -1
  104. package/dist/run-cmd.js +47 -1
  105. package/dist/run-cmd.js.map +1 -1
  106. package/dist/run-refusal-marks.d.ts +8 -1
  107. package/dist/run-refusal-marks.d.ts.map +1 -1
  108. package/dist/run-refusal-marks.js +14 -1
  109. package/dist/run-refusal-marks.js.map +1 -1
  110. package/dist/server-client.d.ts +26 -1
  111. package/dist/server-client.d.ts.map +1 -1
  112. package/dist/server-client.js +24 -0
  113. package/dist/server-client.js.map +1 -1
  114. package/dist/setup-check-wiring.d.ts +18 -0
  115. package/dist/setup-check-wiring.d.ts.map +1 -1
  116. package/dist/setup-check-wiring.js +63 -1
  117. package/dist/setup-check-wiring.js.map +1 -1
  118. package/dist/setup-check.d.ts +6 -0
  119. package/dist/setup-check.d.ts.map +1 -1
  120. package/dist/setup-check.js +19 -7
  121. package/dist/setup-check.js.map +1 -1
  122. package/dist/ticket-words.d.ts.map +1 -1
  123. package/dist/ticket-words.js +4 -0
  124. package/dist/ticket-words.js.map +1 -1
  125. package/dist/watchdog-wiring.d.ts +116 -5
  126. package/dist/watchdog-wiring.d.ts.map +1 -1
  127. package/dist/watchdog-wiring.js +302 -4
  128. package/dist/watchdog-wiring.js.map +1 -1
  129. package/dist/watchdog.d.ts +20 -3
  130. package/dist/watchdog.d.ts.map +1 -1
  131. package/dist/watchdog.js +24 -4
  132. package/dist/watchdog.js.map +1 -1
  133. package/package.json +2 -2
@@ -4,6 +4,7 @@ exports.replayOnto = replayOnto;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_os_1 = require("node:os");
6
6
  const node_path_1 = require("node:path");
7
+ const additive_union_1 = require("./additive-union");
7
8
  /**
8
9
  * REBUILD A GOAL'S WORK ON THE BASE, WITHOUT THE OTHER GOALS' COMMITS UNDER IT.
9
10
  *
@@ -44,8 +45,14 @@ const node_path_1 = require("node:path");
44
45
  * a fresh checkout with no `node_modules`, and it is reset to its own HEAD before
45
46
  * `worktree remove` (never `--force`); only if git still refuses is the folder
46
47
  * deleted and `worktree prune` asked to forget it.
48
+ *
49
+ * 🔴 ONE NARROW EXCEPTION, ASKED FOR BY NAME (`unionAdditive`, the conflict rebuild of an open pull request only): when a
50
+ * commit no longer applies, each file is tried on its own; if EVERY file that does not apply is a JSON object both
51
+ * sides only ADDED to (`additive-union.ts`: keys, or `&&` steps appended to the same script), the united file is
52
+ * written to the index as a blob and the rest of the patch applied as usual. Not a merge: no three-way merge runs, and
53
+ * any other difference is still a refusal, which now names the files that conflict so a person knows where to look.
47
54
  */
48
- async function replayOnto(repoExec, execAt, base, commits, scratchRoot = (0, node_os_1.tmpdir)()) {
55
+ async function replayOnto(repoExec, execAt, base, commits, scratchRoot = (0, node_os_1.tmpdir)(), opts = {}) {
49
56
  if (commits.length === 0)
50
57
  return { ok: false, because: 'there is no commit of this goal to rebuild' };
51
58
  const baseSha = await repoExec(['rev-parse', '--verify', '--quiet', `${base}^{commit}`]);
@@ -62,6 +69,7 @@ async function replayOnto(repoExec, execAt, base, commits, scratchRoot = (0, nod
62
69
  added = true;
63
70
  const wt = execAt(tree);
64
71
  const alreadyInBase = [];
72
+ const unioned = [];
65
73
  let replayed = 0;
66
74
  for (const c of commits) {
67
75
  const parents = await repoExec(['rev-list', '--parents', '-n', '1', c]);
@@ -80,11 +88,55 @@ async function replayOnto(repoExec, execAt, base, commits, scratchRoot = (0, nod
80
88
  alreadyInBase.push(c);
81
89
  continue;
82
90
  }
83
- return { ok: false, at: c, because: `${c.slice(0, 12)} does not apply cleanly onto ${base}: ${check.stderr.trim().split(/\r?\n/)[0]?.slice(0, 300) ?? ''}` };
91
+ // Which files: each one tried on its own, so the refusal can name them — and the union can take exactly those.
92
+ const named = await repoExec(['diff', '--name-only', '--no-renames', `${c}^`, c]);
93
+ const files = named.code === 0 ? named.stdout.split(/\r?\n/).map((f) => f.trim()).filter((f) => f !== '') : [];
94
+ const failing = [];
95
+ for (const f of files)
96
+ if ((await wt(['apply', '--cached', '--check', `--include=${f}`, patch])).code !== 0)
97
+ failing.push(f);
98
+ const first = check.stderr.trim().split(/\r?\n/)[0]?.slice(0, 300) ?? '';
99
+ const refuse = (which) => ({
100
+ ok: false,
101
+ at: c,
102
+ because: `${c.slice(0, 12)} does not apply cleanly onto ${base}${which.length > 0 ? ` (it conflicts in ${which.slice(0, 6).join(', ')}${which.length > 6 ? ', …' : ''})` : `: ${first}`}`,
103
+ });
104
+ if (opts.unionAdditive !== true || failing.length === 0)
105
+ return refuse(failing);
106
+ const united = new Map();
107
+ for (const f of failing) {
108
+ const now = await wt(['show', `:${f}`]);
109
+ const was = await repoExec(['show', `${c}^:${f}`]);
110
+ const mine = await repoExec(['show', `${c}:${f}`]);
111
+ const text = now.code === 0 && was.code === 0 && mine.code === 0 ? (0, additive_union_1.additiveUnion)(f, now.stdout, was.stdout, mine.stdout) : null;
112
+ if (text === null)
113
+ return refuse(failing);
114
+ united.set(f, text);
115
+ }
116
+ // The rest of the change applies as it is; the united files go in as blobs.
117
+ if (failing.length < files.length) {
118
+ const rest = await wt(['apply', '--cached', ...failing.map((f) => `--exclude=${f}`), patch]);
119
+ if (rest.code !== 0)
120
+ return refuse(failing);
121
+ }
122
+ for (const [f, text] of united) {
123
+ const file = (0, node_path_1.join)(scratch, `union-${unioned.length}`);
124
+ (0, node_fs_1.writeFileSync)(file, text, 'utf8');
125
+ // As written: no autocrlf or clean filter rewrites the united file on its way into the index.
126
+ const blob = await wt(['hash-object', '-w', '--no-filters', file]);
127
+ const mode = (await wt(['ls-files', '-s', '--', f])).stdout.trim().split(/\s+/)[0] || '100644';
128
+ const put = blob.code === 0 ? await wt(['update-index', '--cacheinfo', `${mode},${blob.stdout.trim()},${f}`]) : blob;
129
+ if (put.code !== 0)
130
+ return refuse(failing);
131
+ if (!unioned.includes(f))
132
+ unioned.push(f);
133
+ }
134
+ }
135
+ else {
136
+ const applied = await wt(['apply', '--cached', patch]);
137
+ if (applied.code !== 0)
138
+ return { ok: false, at: c, because: `git apply exited ${applied.code} on ${c.slice(0, 12)}: ${applied.stderr.trim().slice(0, 300)}` };
84
139
  }
85
- const applied = await wt(['apply', '--cached', patch]);
86
- if (applied.code !== 0)
87
- return { ok: false, at: c, because: `git apply exited ${applied.code} on ${c.slice(0, 12)}: ${applied.stderr.trim().slice(0, 300)}` };
88
140
  // An empty change (a commit with no diff) needs no commit of its own.
89
141
  const staged = await wt(['diff', '--cached', '--quiet']);
90
142
  if (staged.code === 0)
@@ -100,7 +152,7 @@ async function replayOnto(repoExec, execAt, base, commits, scratchRoot = (0, nod
100
152
  const headTree = await wt(['rev-parse', 'HEAD^{tree}']);
101
153
  if (head.code !== 0 || headTree.code !== 0)
102
154
  return { ok: false, because: 'the rebuilt commit could not be read back' };
103
- return { ok: true, sha: head.stdout.trim(), tree: headTree.stdout.trim(), replayed, alreadyInBase };
155
+ return { ok: true, sha: head.stdout.trim(), tree: headTree.stdout.trim(), replayed, alreadyInBase, ...(unioned.length > 0 ? { unioned } : {}) };
104
156
  }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CAAC,CAAC,CAAC;gBAC3D,OAAO,GAAG,CAAC,MAAM,QAAQ,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;YACtE,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;YACD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,IAAA,gBAAM,EAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC/C,MAAM,QAAQ,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;QACD,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `looply canary` — THE PIPELINE CANARY'S ONE-TIME SETUP AND ITS SWITCH (`canary.ts`).
3
+ *
4
+ * looply canary setup --create [--name looply-canary] make a PRIVATE GitHub repository for it (as this
5
+ * PC's GitHub login), fill it, and serve it
6
+ * looply canary setup --repo <url> use a repository made by hand (an empty one is filled)
7
+ * looply canary the last run, stage by stage
8
+ * looply canary on | off whether this PC runs it
9
+ *
10
+ * The repository lives in `~/.looply/canary/<name>`, apart from every project, and is served like any
11
+ * other: its daemon runs the canary. Nothing here touches a real project.
12
+ */
13
+ export declare const CANARY_USAGE = "looply canary \u2014 Looply proves its own pipeline, daily and after every update\n\n looply canary the last canary run, stage by stage\n looply canary setup --create [--name <name>] make a private GitHub repository named looply-canary (or <name>,\n which must start with looply-canary) and serve it on this PC\n looply canary setup --repo <url> use an existing (or empty) looply-canary repository\n looply canary on | off whether this PC runs the canary (on by default once set up)";
14
+ /** The files a canary repository starts with. Ten lines of check, no dependencies, the smallest model. */
15
+ export declare function canaryTemplate(): Record<string, string>;
16
+ export declare function writeCanaryTemplate(dir: string): string[];
17
+ export interface CanaryCmdDeps {
18
+ home: string;
19
+ out(line: string): void;
20
+ err(line: string): void;
21
+ /** git, run in `cwd`; a person is at the keyboard, so their own credential helper may answer. */
22
+ git(args: readonly string[], cwd: string): {
23
+ code: number;
24
+ stdout: string;
25
+ stderr: string;
26
+ };
27
+ /** `POST /user/repos` as this PC's GitHub login: the new repository's clone URL, or why not. */
28
+ createRepo(name: string): Promise<{
29
+ ok: true;
30
+ cloneUrl: string;
31
+ fullName: string;
32
+ } | {
33
+ ok: false;
34
+ because: string;
35
+ }>;
36
+ /** `looply serve add <dir>`. */
37
+ serveAdd(dir: string): Promise<number> | number;
38
+ }
39
+ export declare function canaryCommand(argv: readonly string[], deps: CanaryCmdDeps): Promise<number>;
40
+ /** Production deps. */
41
+ export declare function nodeCanaryCmdDeps(home: string, serveAdd: (dir: string) => Promise<number>): CanaryCmdDeps;
42
+ //# sourceMappingURL=canary-cmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canary-cmd.d.ts","sourceRoot":"","sources":["../src/canary-cmd.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,YAAY,+lBAMmF,CAAC;AAE7G,0GAA0G;AAC1G,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4DvD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CASzD;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,iGAAiG;IACjG,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5F,gGAAgG;IAChG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrH,gCAAgC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CACjD;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBjG;AA8ED,uBAAuB;AACvB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,aAAa,CA0BzG"}
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANARY_USAGE = void 0;
4
+ exports.canaryTemplate = canaryTemplate;
5
+ exports.writeCanaryTemplate = writeCanaryTemplate;
6
+ exports.canaryCommand = canaryCommand;
7
+ exports.nodeCanaryCmdDeps = nodeCanaryCmdDeps;
8
+ const node_child_process_1 = require("node:child_process");
9
+ const node_fs_1 = require("node:fs");
10
+ const node_path_1 = require("node:path");
11
+ const core_1 = require("@looply/core");
12
+ const canary_1 = require("./canary");
13
+ const canary_wiring_1 = require("./canary-wiring");
14
+ const github_api_1 = require("./github-api");
15
+ const trusted_git_1 = require("./trusted-git");
16
+ const machine_secrets_1 = require("./machine-secrets");
17
+ const machine_settings_1 = require("./machine-settings");
18
+ const serve_cmd_1 = require("./serve-cmd");
19
+ /**
20
+ * `looply canary` — THE PIPELINE CANARY'S ONE-TIME SETUP AND ITS SWITCH (`canary.ts`).
21
+ *
22
+ * looply canary setup --create [--name looply-canary] make a PRIVATE GitHub repository for it (as this
23
+ * PC's GitHub login), fill it, and serve it
24
+ * looply canary setup --repo <url> use a repository made by hand (an empty one is filled)
25
+ * looply canary the last run, stage by stage
26
+ * looply canary on | off whether this PC runs it
27
+ *
28
+ * The repository lives in `~/.looply/canary/<name>`, apart from every project, and is served like any
29
+ * other: its daemon runs the canary. Nothing here touches a real project.
30
+ */
31
+ exports.CANARY_USAGE = `looply canary — Looply proves its own pipeline, daily and after every update
32
+
33
+ looply canary the last canary run, stage by stage
34
+ looply canary setup --create [--name <name>] make a private GitHub repository named looply-canary (or <name>,
35
+ which must start with looply-canary) and serve it on this PC
36
+ looply canary setup --repo <url> use an existing (or empty) looply-canary repository
37
+ looply canary on | off whether this PC runs the canary (on by default once set up)`;
38
+ /** The files a canary repository starts with. Ten lines of check, no dependencies, the smallest model. */
39
+ function canaryTemplate() {
40
+ return {
41
+ [core_1.CANARY_FILE]: [
42
+ core_1.CANARY_MARKER,
43
+ '',
44
+ 'This repository exists only for Looply\'s pipeline canary. Once a day, and after every Looply',
45
+ 'update, Looply rewrites the line below through its whole pipeline (plan, round, checks, goal',
46
+ 'check, pull request, merge) to prove the pipeline works. Put nothing else here.',
47
+ '',
48
+ 'canary-run: none',
49
+ '',
50
+ ].join('\n'),
51
+ 'check.js': [
52
+ "// The canary's only check: CANARY.md keeps its marker and has exactly one well-formed run line.",
53
+ "const fs = require('fs');",
54
+ "const lines = fs.readFileSync('CANARY.md', 'utf8').replace(/\\r\\n/g, '\\n').split('\\n');",
55
+ `if (lines[0].trim() !== '${core_1.CANARY_MARKER}') { console.error('CANARY.md lost its first line'); process.exit(1); }`,
56
+ "const runs = lines.filter((l) => l.trim().startsWith('canary-run:'));",
57
+ "if (runs.length !== 1) { console.error('CANARY.md must have exactly one canary-run line, has ' + runs.length); process.exit(1); }",
58
+ "if (!/^canary-run: (none|[a-z0-9]{8,24})$/.test(runs[0].trim())) { console.error('bad canary-run line: ' + runs[0]); process.exit(1); }",
59
+ "console.log('canary ok: ' + runs[0].trim());",
60
+ '',
61
+ ].join('\n'),
62
+ 'package.json': JSON.stringify({ name: 'looply-canary', private: true, version: '0.0.0', scripts: { test: 'node check.js' } }, null, 2) + '\n',
63
+ '.github/workflows/check.yml': [
64
+ '# The CI a merge waits for: the same ten-line check, a few seconds a day.',
65
+ 'name: check',
66
+ 'on:',
67
+ ' pull_request:',
68
+ ' push:',
69
+ ' branches: [main]',
70
+ 'jobs:',
71
+ ' check:',
72
+ ' runs-on: ubuntu-latest',
73
+ ' timeout-minutes: 5',
74
+ ' steps:',
75
+ ' - uses: actions/checkout@v4',
76
+ ' - run: node check.js',
77
+ '',
78
+ ].join('\n'),
79
+ '.looply/config.yaml': [
80
+ '# The pipeline canary (Looply `canary.ts`). Cheap on purpose: the smallest model at the lowest',
81
+ '# effort, one check, merged as soon as CI is green. Do not point this at a real project.',
82
+ 'project:',
83
+ ' name: "looply-canary"',
84
+ '',
85
+ 'agent:',
86
+ ' models:',
87
+ ' default: "claude-haiku-5-5"',
88
+ ' effort: "low"',
89
+ '',
90
+ 'gates:',
91
+ ' - { name: "check", run: "node check.js", timeout_s: 60, required: true }',
92
+ '',
93
+ 'deliver:',
94
+ ' mode: merge',
95
+ '',
96
+ ].join('\n'),
97
+ '.gitignore': '.looply/state/\nnode_modules/\n',
98
+ };
99
+ }
100
+ function writeCanaryTemplate(dir) {
101
+ const written = [];
102
+ for (const [rel, content] of Object.entries(canaryTemplate())) {
103
+ const p = (0, node_path_1.join)(dir, ...rel.split('/'));
104
+ (0, node_fs_1.mkdirSync)((0, node_path_1.join)(p, '..'), { recursive: true });
105
+ (0, node_fs_1.writeFileSync)(p, content, 'utf8');
106
+ written.push(rel);
107
+ }
108
+ return written;
109
+ }
110
+ async function canaryCommand(argv, deps) {
111
+ const [verb, ...rest] = argv;
112
+ if (verb === undefined || verb === 'status')
113
+ return status(deps);
114
+ if (verb === 'on' || verb === 'off') {
115
+ try {
116
+ (0, machine_settings_1.writeCanarySetting)(verb === 'on', deps.home);
117
+ }
118
+ catch (e) {
119
+ deps.err(`looply canary: ${e.message}`);
120
+ return serve_cmd_1.EXIT_REFUSED;
121
+ }
122
+ deps.out(verb === 'on' ? 'canary: on — this PC runs the pipeline canary once a day and after each Looply update.' : 'canary: off — this PC never runs the pipeline canary (`looply canary on` to undo).');
123
+ return serve_cmd_1.EXIT_OK;
124
+ }
125
+ if (verb === 'setup')
126
+ return setup(rest, deps);
127
+ if (verb === 'help' || verb === '--help') {
128
+ deps.out(exports.CANARY_USAGE);
129
+ return serve_cmd_1.EXIT_OK;
130
+ }
131
+ deps.err(`looply canary: ${JSON.stringify(verb)} — no idea what that means.\n\n${exports.CANARY_USAGE}`);
132
+ return serve_cmd_1.EXIT_USAGE;
133
+ }
134
+ function status(deps) {
135
+ const record = (0, canary_1.readCanaryRecord)((0, machine_secrets_1.looplyHome)(deps.home));
136
+ let off = null;
137
+ try {
138
+ off = (0, machine_settings_1.readLocalMachineSettings)(deps.home).canary === false ? 'off on this PC (`looply canary on` to undo)' : null;
139
+ }
140
+ catch {
141
+ /* said by the daemon */
142
+ }
143
+ const r = record.report;
144
+ if (r === null) {
145
+ deps.out(`canary: no run yet on this PC${off ? ` — ${off}` : ''}.${record.refused ? ` The server would not start one: ${record.refused.because}` : ' Set it up with `looply canary setup --create`.'}`);
146
+ return serve_cmd_1.EXIT_OK;
147
+ }
148
+ deps.out(`canary: ${r.state.toUpperCase()} — ${r.said}${off ? ` (${off})` : ''}`);
149
+ deps.out(` run ${r.runId} (${r.trigger}, Looply ${r.looplyVersion}), started ${r.startedAt}${r.endedAt ? `, ended ${r.endedAt}` : ''}; last passed ${r.lastPassedAt ?? 'never'}`);
150
+ for (const s of r.stages)
151
+ deps.out(` ${s.state.padEnd(7)} ${s.stage.padEnd(10)} ${s.detail ?? core_1.CANARY_STAGE_SAID[s.stage]}`);
152
+ return serve_cmd_1.EXIT_OK;
153
+ }
154
+ async function setup(rest, deps) {
155
+ const create = rest.includes('--create');
156
+ const at = (flag) => {
157
+ const i = rest.indexOf(flag);
158
+ return i >= 0 ? rest[i + 1] : undefined;
159
+ };
160
+ let url = at('--repo');
161
+ const name = at('--name') ?? (url ? (0, core_1.repoNameFromUrl)(url) : null) ?? 'looply-canary';
162
+ if (create === (url !== undefined)) {
163
+ deps.err(`looply canary setup: either --create or --repo <url>.\n\n${exports.CANARY_USAGE}`);
164
+ return serve_cmd_1.EXIT_USAGE;
165
+ }
166
+ if (!core_1.CANARY_REPO_NAME.test(name)) {
167
+ deps.err(`looply canary setup: the repository must be named looply-canary or looply-canary-<something> (not ${name}) — the server gives canary goals to no other`);
168
+ return serve_cmd_1.EXIT_REFUSED;
169
+ }
170
+ if (create) {
171
+ const made = await deps.createRepo(name);
172
+ if (!made.ok) {
173
+ deps.err(`looply canary setup: could not create the repository: ${made.because}`);
174
+ return serve_cmd_1.EXIT_REFUSED;
175
+ }
176
+ deps.out(`canary: created the private repository ${made.fullName}`);
177
+ url = made.cloneUrl;
178
+ }
179
+ const dir = (0, node_path_1.join)((0, machine_secrets_1.looplyHome)(deps.home), 'canary', name);
180
+ if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(dir, '.git'))) {
181
+ (0, node_fs_1.mkdirSync)((0, node_path_1.join)(dir, '..'), { recursive: true });
182
+ const c = deps.git(['clone', url, dir], (0, node_path_1.join)(dir, '..'));
183
+ if (c.code !== 0) {
184
+ deps.err(`looply canary setup: git clone failed: ${(c.stderr || c.stdout).trim().slice(0, 300)}`);
185
+ return serve_cmd_1.EXIT_REFUSED;
186
+ }
187
+ }
188
+ const empty = !(0, node_fs_1.existsSync)((0, node_path_1.join)(dir, core_1.CANARY_FILE)) && (0, node_fs_1.readdirSync)(dir).filter((n) => n !== '.git').length === 0;
189
+ if (empty) {
190
+ writeCanaryTemplate(dir);
191
+ for (const args of [['checkout', '-B', 'main'], ['add', '-A'], ['commit', '-m', 'The Looply pipeline canary'], ['push', '-u', 'origin', 'main']]) {
192
+ const r = deps.git(args, dir);
193
+ if (r.code !== 0) {
194
+ deps.err(`looply canary setup: git ${args[0]} failed: ${(r.stderr || r.stdout).trim().slice(0, 300)}`);
195
+ return serve_cmd_1.EXIT_REFUSED;
196
+ }
197
+ }
198
+ deps.out('canary: filled the repository (CANARY.md, check.js, the check workflow, .looply/config.yaml) and pushed main');
199
+ }
200
+ const origin = deps.git(['remote', 'get-url', 'origin'], dir).stdout.trim() || null;
201
+ if (!(0, canary_wiring_1.isCanaryCheckout)(dir, origin)) {
202
+ deps.err(`looply canary setup: ${dir} is not a canary repository (its ${core_1.CANARY_FILE} must start with "${core_1.CANARY_MARKER}", and origin must be named looply-canary…). An empty repository is filled by itself; a non-empty one is never changed.`);
203
+ return serve_cmd_1.EXIT_REFUSED;
204
+ }
205
+ const served = await deps.serveAdd(dir);
206
+ if (served !== serve_cmd_1.EXIT_OK)
207
+ return served;
208
+ deps.out('canary: set up. The first run starts within minutes of `looply serve` picking it up, then daily and after each Looply update. `looply canary` shows it; `looply canary off` stops it.');
209
+ return serve_cmd_1.EXIT_OK;
210
+ }
211
+ /** Production deps. */
212
+ function nodeCanaryCmdDeps(home, serveAdd) {
213
+ return {
214
+ home,
215
+ out: (l) => process.stdout.write(`${l}\n`),
216
+ err: (l) => process.stderr.write(`${l}\n`),
217
+ git: (args, cwd) => {
218
+ // By absolute path, never a bare name the folder could supply (`trusted-git.ts`).
219
+ const bin = (0, trusted_git_1.gitBinary)();
220
+ if (bin === null)
221
+ return { code: 1, stdout: '', stderr: 'git was not found on PATH' };
222
+ const r = (0, node_child_process_1.spawnSync)(bin, [...args], { cwd, encoding: 'utf8', windowsHide: true });
223
+ return { code: r.status ?? 1, stdout: r.stdout ?? '', stderr: r.stderr ?? (r.error ? r.error.message : '') };
224
+ },
225
+ createRepo: async (name) => {
226
+ const t = await (0, github_api_1.githubToken)();
227
+ if (t === null)
228
+ return { ok: false, because: 'this PC has no GitHub login Looply can use (sign in with `gh auth login`, or let git store a github.com credential)' };
229
+ const r = await fetch('https://api.github.com/user/repos', {
230
+ method: 'POST',
231
+ headers: { authorization: `Bearer ${t.token}`, accept: 'application/vnd.github+json', 'user-agent': 'looply-canary', 'content-type': 'application/json' },
232
+ body: JSON.stringify({ name, private: true, auto_init: false, description: "Looply's pipeline canary: a throwaway repository Looply changes daily to prove its own pipeline." }),
233
+ });
234
+ const j = (await r.json().catch(() => ({})));
235
+ if (r.status !== 201 || typeof j.clone_url !== 'string')
236
+ return { ok: false, because: `GitHub said ${r.status}${j.message ? `: ${j.message}` : ''}` };
237
+ return { ok: true, cloneUrl: j.clone_url, fullName: j.full_name ?? name };
238
+ },
239
+ serveAdd,
240
+ };
241
+ }
242
+ //# sourceMappingURL=canary-cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canary-cmd.js","sourceRoot":"","sources":["../src/canary-cmd.ts"],"names":[],"mappings":";;;AAkCA,wCA4DC;AAED,kDASC;AAcD,sCAoBC;AA+ED,8CA0BC;AApPD,2DAA+C;AAC/C,qCAA4E;AAC5E,yCAAiC;AACjC,uCAAgH;AAChH,qCAA4C;AAC5C,mDAAmD;AACnD,6CAA2C;AAC3C,+CAA0C;AAC1C,uDAA+C;AAC/C,yDAAkF;AAClF,2CAAgE;AAEhE;;;;;;;;;;;GAWG;AAEU,QAAA,YAAY,GAAG;;;;;;4GAMgF,CAAC;AAE7G,0GAA0G;AAC1G,SAAgB,cAAc;IAC5B,OAAO;QACL,CAAC,kBAAW,CAAC,EAAE;YACb,oBAAa;YACb,EAAE;YACF,+FAA+F;YAC/F,8FAA8F;YAC9F,iFAAiF;YACjF,EAAE;YACF,kBAAkB;YAClB,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,UAAU,EAAE;YACV,kGAAkG;YAClG,2BAA2B;YAC3B,4FA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CAAC;QAC5E,CAAC;QACD,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { makeCanary, readCanaryRecord } from './canary';
2
+ import { type ServerClient } from './server-client';
3
+ /** Where the delivered commit is fetched to be read: the canary's own ref, outside refs/heads. */
4
+ export declare const CANARY_REF = "refs/looply/canary";
5
+ /**
6
+ * IS THIS CHECKOUT THIS PC'S CANARY? Both locks, read on the PC: `origin` is a repository named
7
+ * `looply-canary…` (`CANARY_REPO_NAME`) AND `CANARY.md` at the root starts with the marker. The
8
+ * server checks the first again on its side; nothing else in the daemon changes for any other repo.
9
+ */
10
+ export declare function isCanaryCheckout(cwd: string, originUrl: string | null): boolean;
11
+ /** Why the canary must not start now on this PC or for this project, or null. */
12
+ export declare function canaryOff(opts: {
13
+ stateDir: string;
14
+ env?: NodeJS.ProcessEnv;
15
+ home?: string;
16
+ }): string | null;
17
+ /** A server answer that means "not now, and asking again soon will not change it". */
18
+ export declare function canaryRefusal(e: unknown): string | null;
19
+ /** The daemon's canary, or null when this checkout is not a canary (the usual case: nothing runs). */
20
+ export declare function nodeCanary(opts: {
21
+ cwd: string;
22
+ stateDir: string;
23
+ projectId: string;
24
+ client: Pick<ServerClient, 'startCanary' | 'endCanary' | 'goalEvidence'>;
25
+ looplyVersion: string;
26
+ originUrl: string | null;
27
+ log(line: string): void;
28
+ }): ReturnType<typeof makeCanary> | null;
29
+ /** The card for every daemon's feature report on this PC: the canary record is machine-wide. */
30
+ export declare function canaryReportOnThisPc(home?: string): ReturnType<typeof readCanaryRecord>['report'];
31
+ //# sourceMappingURL=canary-wiring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canary-wiring.d.ts","sourceRoot":"","sources":["../src/canary-wiring.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMxD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGjE,kGAAkG;AAClG,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAU/E;AAED,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAW3G;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKvD;AAED,sGAAsG;AACtG,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,WAAW,GAAG,cAAc,CAAC,CAAC;IACzE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAqDvC;AAED,gGAAgG;AAChG,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,MAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAG/G"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANARY_REF = void 0;
4
+ exports.isCanaryCheckout = isCanaryCheckout;
5
+ exports.canaryOff = canaryOff;
6
+ exports.canaryRefusal = canaryRefusal;
7
+ exports.nodeCanary = nodeCanary;
8
+ exports.canaryReportOnThisPc = canaryReportOnThisPc;
9
+ const node_fs_1 = require("node:fs");
10
+ const node_path_1 = require("node:path");
11
+ const core_1 = require("@looply/core");
12
+ const canary_1 = require("./canary");
13
+ const delivery_rules_1 = require("./delivery-rules");
14
+ const feature_settings_cache_1 = require("./feature-settings-cache");
15
+ const github_api_1 = require("./github-api");
16
+ const machine_secrets_1 = require("./machine-secrets");
17
+ const machine_settings_1 = require("./machine-settings");
18
+ const server_client_1 = require("./server-client");
19
+ const setup_check_wiring_1 = require("./setup-check-wiring");
20
+ /** Where the delivered commit is fetched to be read: the canary's own ref, outside refs/heads. */
21
+ exports.CANARY_REF = 'refs/looply/canary';
22
+ /**
23
+ * IS THIS CHECKOUT THIS PC'S CANARY? Both locks, read on the PC: `origin` is a repository named
24
+ * `looply-canary…` (`CANARY_REPO_NAME`) AND `CANARY.md` at the root starts with the marker. The
25
+ * server checks the first again on its side; nothing else in the daemon changes for any other repo.
26
+ */
27
+ function isCanaryCheckout(cwd, originUrl) {
28
+ if (originUrl === null)
29
+ return false;
30
+ const name = (0, core_1.repoNameFromUrl)(originUrl);
31
+ if (name === null || !core_1.CANARY_REPO_NAME.test(name))
32
+ return false;
33
+ try {
34
+ const first = (0, node_fs_1.readFileSync)((0, node_path_1.join)(cwd, core_1.CANARY_FILE), 'utf8').replace(/^/, '').split(/\r?\n/)[0] ?? '';
35
+ return first.trim() === core_1.CANARY_MARKER;
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ }
41
+ /** Why the canary must not start now on this PC or for this project, or null. */
42
+ function canaryOff(opts) {
43
+ const env = opts.env ?? process.env;
44
+ const v = (env['LOOPLY_CANARY'] ?? '').trim().toLowerCase();
45
+ if (v === 'off' || v === '0' || v === 'false')
46
+ return 'switched off on this PC (LOOPLY_CANARY=off)';
47
+ try {
48
+ if ((0, machine_settings_1.readLocalMachineSettings)(opts.home).canary === false)
49
+ return 'switched off on this PC (looply canary off)';
50
+ }
51
+ catch {
52
+ /* an unreadable machine-settings.json is said by the daemon's own settings pass */
53
+ }
54
+ if ((0, feature_settings_cache_1.readFeatureSettingsCache)(opts.stateDir)?.settings?.canary?.enabled === false)
55
+ return 'switched off for the canary project (feature setting canary.enabled = false)';
56
+ return null;
57
+ }
58
+ /** A server answer that means "not now, and asking again soon will not change it". */
59
+ function canaryRefusal(e) {
60
+ if (!(e instanceof server_client_1.ServerError))
61
+ return null;
62
+ if (e.status === 404)
63
+ return 'this Looply server does not run pipeline canaries yet (it needs looply-api 0.5.45 or later), or the project is unknown';
64
+ if (e.status === 409 || e.status === 429 || e.status === 403 || e.status === 400)
65
+ return `the server would not start a canary: ${e.message}`;
66
+ return null;
67
+ }
68
+ /** The daemon's canary, or null when this checkout is not a canary (the usual case: nothing runs). */
69
+ function nodeCanary(opts) {
70
+ if (!isCanaryCheckout(opts.cwd, opts.originUrl))
71
+ return null;
72
+ const git = (0, setup_check_wiring_1.boundedGitExec)(opts.cwd, setup_check_wiring_1.NETWORK_GIT_TIMEOUT_MS);
73
+ const gh = opts.originUrl === null ? null : (0, delivery_rules_1.githubRepoOf)(opts.originUrl);
74
+ return (0, canary_1.makeCanary)({
75
+ home: (0, machine_secrets_1.looplyHome)(),
76
+ projectId: opts.projectId,
77
+ looplyVersion: opts.looplyVersion,
78
+ off: () => canaryOff({ stateDir: opts.stateDir }),
79
+ start: async (trigger) => opts.client.startCanary(opts.projectId, { trigger, looplyVersion: opts.looplyVersion }),
80
+ evidence: (goalId) => opts.client.goalEvidence(opts.projectId, goalId),
81
+ end: async (goalId) => {
82
+ await opts.client.endCanary(opts.projectId, goalId);
83
+ },
84
+ readDelivered: async ({ ref }) => {
85
+ /**
86
+ * Fetched into the canary's own private ref, never a branch: the served checkout's branches and files
87
+ * are never changed, and no other fetch (the daemon's, a run's) can move what is read in between,
88
+ * as it could FETCH_HEAD.
89
+ */
90
+ if (!/^[A-Za-z0-9._/-]{1,200}$/.test(ref) || ref.startsWith('-'))
91
+ return { ok: false, because: `"${ref}" is not a branch name` };
92
+ const f = await git(['fetch', '--no-tags', '--quiet', 'origin', `+refs/heads/${ref}:${exports.CANARY_REF}`]);
93
+ if (f.code !== 0)
94
+ return { ok: false, because: (f.stderr || f.stdout).trim().slice(0, 200) || `git fetch exited ${f.code}` };
95
+ const s = await git(['show', `${exports.CANARY_REF}:${core_1.CANARY_FILE}`]);
96
+ return s.code === 0 ? { ok: true, content: s.stdout } : { ok: false, because: (s.stderr || s.stdout).trim().slice(0, 200) || `git show exited ${s.code}` };
97
+ },
98
+ cleanUp: async ({ branch, runId }) => {
99
+ // Only the canary's own run branch: never the base, never a branch Looply did not name.
100
+ if (branch === null)
101
+ return { ok: true, detail: 'nothing was delivered, so there was nothing to clean up' };
102
+ if (!branch.startsWith('looply/'))
103
+ return { ok: false, because: `the delivered branch ${branch} is not a Looply run branch, so it was left alone` };
104
+ if (gh === null)
105
+ return { ok: false, because: 'origin is not a GitHub repository, so the branch could not be removed' };
106
+ const t = await (0, github_api_1.githubToken)();
107
+ if (t === null)
108
+ return { ok: false, because: 'this PC has no GitHub credentials Looply can use' };
109
+ const api = (0, github_api_1.makeGitHubApi)({ owner: gh.owner, repo: gh.repo, token: t.token });
110
+ const said = [];
111
+ const pull = await api.findPull(branch).catch(() => null);
112
+ if (pull !== null && pull.state === 'open') {
113
+ await api.closePull(pull.number, `Closed by Looply's pipeline canary (${runId}): it proved the pull request opens; nothing here is to be merged.`);
114
+ said.push(`closed pull request #${pull.number}`);
115
+ }
116
+ if (await api.branchExists(branch)) {
117
+ const r = await fetch(`https://api.github.com/repos/${encodeURIComponent(gh.owner)}/${encodeURIComponent(gh.repo)}/git/refs/heads/${branch.split('/').map(encodeURIComponent).join('/')}`, {
118
+ method: 'DELETE',
119
+ headers: { authorization: `Bearer ${t.token}`, accept: 'application/vnd.github+json', 'user-agent': 'looply-canary' },
120
+ });
121
+ if (r.status !== 204 && r.status !== 422)
122
+ return { ok: false, because: `GitHub would not delete ${branch} (HTTP ${r.status})` };
123
+ said.push(`deleted ${branch}`);
124
+ }
125
+ else
126
+ said.push(`${branch} was already gone`);
127
+ return { ok: true, detail: said.join('; ') };
128
+ },
129
+ refusal: canaryRefusal,
130
+ log: opts.log,
131
+ });
132
+ }
133
+ /** The card for every daemon's feature report on this PC: the canary record is machine-wide. */
134
+ function canaryReportOnThisPc(home = (0, machine_secrets_1.looplyHome)()) {
135
+ if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(home, 'canary.json')))
136
+ return null;
137
+ return (0, canary_1.readCanaryRecord)(home).report;
138
+ }
139
+ //# sourceMappingURL=canary-wiring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canary-wiring.js","sourceRoot":"","sources":["../src/canary-wiring.ts"],"names":[],"mappings":";;;AAoBA,4CAUC;AAGD,8BAWC;AAGD,sCAKC;AAGD,gCA6DC;AAGD,oDAGC;AA1HD,qCAAmD;AACnD,yCAAiC;AACjC,uCAAiH;AACjH,qCAAwD;AACxD,qDAAgD;AAChD,qEAAoE;AACpE,6CAA0D;AAC1D,uDAA+C;AAC/C,yDAA8D;AAC9D,mDAAiE;AACjE,6DAA8E;AAE9E,kGAAkG;AACrF,QAAA,UAAU,GAAG,oBAAoB,CAAC;AAE/C;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,GAAW,EAAE,SAAwB;IACpE,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,IAAI,GAAG,IAAA,sBAAe,EAAC,SAAS,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,uBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAChE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,kBAAW,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACrG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