@kontourai/flow-agents 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.github/workflows/ci.yml +110 -0
  2. package/CHANGELOG.md +24 -0
  3. package/build/src/cli/console-learning-projection.js +19 -2
  4. package/build/src/cli/effective-backlog-settings.js +18 -2
  5. package/build/src/cli/fixture-retirement-audit.js +19 -2
  6. package/build/src/cli/flow-kit.js +135 -5
  7. package/build/src/cli/init.js +19 -2
  8. package/build/src/cli/promote-workflow-artifact.js +19 -2
  9. package/build/src/cli/publish-change-helper.js +19 -2
  10. package/build/src/cli/pull-work-provider.js +19 -2
  11. package/build/src/cli/runtime-adapter.js +20 -2
  12. package/build/src/cli/usage-feedback.js +19 -2
  13. package/build/src/cli/utterance-check.js +19 -2
  14. package/build/src/cli/validate-hook-influence.js +19 -2
  15. package/build/src/cli/validate-source-tree.js +19 -2
  16. package/build/src/cli/veritas-governance.js +19 -2
  17. package/build/src/cli/workflow-artifact-cleanup-audit.js +19 -2
  18. package/build/src/runtime-adapters.js +56 -25
  19. package/build/src/tools/build-universal-bundles.js +19 -2
  20. package/build/src/tools/generate-context-map.js +19 -2
  21. package/build/src/tools/validate-package.js +19 -2
  22. package/build/src/tools/validate-source-tree.js +20 -3
  23. package/context/scripts/telemetry/console-presets.sh +1 -1
  24. package/docs/fixture-ownership.md +1 -1
  25. package/docs/kit-authoring-guide.md +20 -3
  26. package/evals/ci/run-baseline.sh +55 -8
  27. package/evals/integration/test_activate_npx_context.sh +134 -0
  28. package/evals/integration/test_flow_kit_install_git.sh +163 -0
  29. package/evals/integration/test_runtime_adapter_activation.sh +138 -17
  30. package/evals/run.sh +2 -0
  31. package/evals/static/test_console_presets.sh +49 -0
  32. package/package.json +1 -1
  33. package/scripts/telemetry/console-presets.sh +1 -1
  34. package/src/cli/console-learning-projection.ts +7 -1
  35. package/src/cli/effective-backlog-settings.ts +6 -1
  36. package/src/cli/fixture-retirement-audit.ts +7 -1
  37. package/src/cli/flow-kit.ts +123 -4
  38. package/src/cli/init.ts +7 -1
  39. package/src/cli/promote-workflow-artifact.ts +7 -1
  40. package/src/cli/publish-change-helper.ts +7 -1
  41. package/src/cli/pull-work-provider.ts +7 -1
  42. package/src/cli/runtime-adapter.ts +8 -1
  43. package/src/cli/usage-feedback.ts +7 -1
  44. package/src/cli/utterance-check.ts +7 -1
  45. package/src/cli/validate-hook-influence.ts +7 -1
  46. package/src/cli/validate-source-tree.ts +7 -1
  47. package/src/cli/veritas-governance.ts +7 -1
  48. package/src/cli/workflow-artifact-cleanup-audit.ts +7 -1
  49. package/src/runtime-adapters.ts +55 -27
  50. package/src/tools/build-universal-bundles.ts +7 -1
  51. package/src/tools/generate-context-map.ts +7 -1
  52. package/src/tools/validate-package.ts +7 -1
  53. package/src/tools/validate-source-tree.ts +8 -2
@@ -196,6 +196,55 @@ jobs:
196
196
  continue-on-error: true
197
197
  run: bash evals/ci/run-baseline.sh --check bundle-install-integration
198
198
 
199
+ - name: Bundle lifecycle integration
200
+ continue-on-error: true
201
+ run: bash evals/ci/run-baseline.sh --check bundle-lifecycle-integration
202
+
203
+ - name: Activate npx context integration
204
+ continue-on-error: true
205
+ run: bash evals/ci/run-baseline.sh --check activate-npx-context-integration
206
+
207
+ - name: Kit conformance levels integration
208
+ continue-on-error: true
209
+ run: bash evals/ci/run-baseline.sh --check kit-conformance-levels-integration
210
+
211
+ - name: Local Flow Kit install integration
212
+ continue-on-error: true
213
+ run: bash evals/ci/run-baseline.sh --check local-flow-kit-install-integration
214
+
215
+ - name: Flow Kit install-git integration
216
+ continue-on-error: true
217
+ run: bash evals/ci/run-baseline.sh --check flow-kit-install-git-integration
218
+
219
+
220
+ - name: Context map integration
221
+ continue-on-error: true
222
+ run: bash evals/ci/run-baseline.sh --check context-map-integration
223
+
224
+ - name: Effective backlog settings integration
225
+ continue-on-error: true
226
+ run: bash evals/ci/run-baseline.sh --check effective-backlog-settings-integration
227
+
228
+ - name: Flow agents statusline integration
229
+ continue-on-error: true
230
+ run: bash evals/ci/run-baseline.sh --check flow-agents-statusline-integration
231
+
232
+ - name: Telemetry contract integration
233
+ continue-on-error: true
234
+ run: bash evals/ci/run-baseline.sh --check telemetry-contract-integration
235
+
236
+ - name: Telemetry doctor integration
237
+ continue-on-error: true
238
+ run: bash evals/ci/run-baseline.sh --check telemetry-doctor-integration
239
+
240
+ - name: Utterance check integration
241
+ continue-on-error: true
242
+ run: bash evals/ci/run-baseline.sh --check utterance-check-integration
243
+
244
+ - name: Pull work provider integration
245
+ continue-on-error: true
246
+ run: bash evals/ci/run-baseline.sh --check pull-work-provider-integration
247
+
199
248
  - name: Finalize CI evidence
200
249
  if: always()
201
250
  run: bash evals/ci/run-baseline.sh --finalize
@@ -208,3 +257,64 @@ jobs:
208
257
  path: evals/results/ci-baseline/runtime-and-kit/
209
258
  if-no-files-found: warn
210
259
  retention-days: 14
260
+
261
+ usage-feedback:
262
+ name: Usage Feedback
263
+ runs-on: ubuntu-latest
264
+ timeout-minutes: 15
265
+ env:
266
+ FLOW_AGENTS_CI_LANE: usage-feedback
267
+ FLOW_AGENTS_CI_RESULTS_DIR: evals/results/ci-baseline/usage-feedback
268
+
269
+ steps:
270
+ - name: Checkout
271
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
272
+
273
+ - name: Set up Node.js
274
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
275
+ with:
276
+ node-version: "22"
277
+
278
+ - name: Install Node dependencies
279
+ run: npm ci
280
+
281
+ - name: Install shell tools
282
+ run: |
283
+ sudo apt-get update
284
+ sudo apt-get install -y jq ripgrep
285
+
286
+ - name: Initialize CI evidence
287
+ run: bash evals/ci/run-baseline.sh --init
288
+
289
+ - name: Usage feedback import integration
290
+ continue-on-error: true
291
+ run: bash evals/ci/run-baseline.sh --check usage-feedback-import-integration
292
+
293
+ - name: Usage feedback outcomes integration
294
+ continue-on-error: true
295
+ run: bash evals/ci/run-baseline.sh --check usage-feedback-outcomes-integration
296
+
297
+ - name: Usage feedback report integration
298
+ continue-on-error: true
299
+ run: bash evals/ci/run-baseline.sh --check usage-feedback-report-integration
300
+
301
+ - name: Usage feedback dashboard integration
302
+ continue-on-error: true
303
+ run: bash evals/ci/run-baseline.sh --check usage-feedback-dashboard-integration
304
+
305
+ - name: Usage feedback global integration
306
+ continue-on-error: true
307
+ run: bash evals/ci/run-baseline.sh --check usage-feedback-global-integration
308
+
309
+ - name: Finalize CI evidence
310
+ if: always()
311
+ run: bash evals/ci/run-baseline.sh --finalize
312
+
313
+ - name: Upload CI evidence artifacts
314
+ if: always()
315
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
316
+ with:
317
+ name: flow-agents-ci-usage-feedback
318
+ path: evals/results/ci-baseline/usage-feedback/
319
+ if-no-files-found: warn
320
+ retention-days: 14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0](https://github.com/kontourai/flow-agents/compare/v1.0.1...v1.1.0) (2026-06-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * activate skills and docs in kit runtime adapters (fix [#58](https://github.com/kontourai/flow-agents/issues/58)) ([dc726fd](https://github.com/kontourai/flow-agents/commit/dc726fd1d56e79b5bda577985aa87befe3a1eb9d))
9
+ * activate skills and docs in kit runtime adapters (fix [#58](https://github.com/kontourai/flow-agents/issues/58)) ([dc774e0](https://github.com/kontourai/flow-agents/commit/dc774e001b54f7a09f6ab81a6aafcf2ad8552b6d))
10
+
11
+
12
+ ### Fixes
13
+
14
+ * apply realpathSync entry-guard to 7 remaining CLI/tool files ([c1b3272](https://github.com/kontourai/flow-agents/commit/c1b3272c623055662a63c5d11c6dbef5aabe1cf0))
15
+ * apply realpathSync entry-guard to all 16 affected CLI/tool files (closes [#71](https://github.com/kontourai/flow-agents/issues/71)) ([8a676b0](https://github.com/kontourai/flow-agents/commit/8a676b0c9c91464d64755719ff778a13e298beb9))
16
+ * apply realpathSync entry-guard to remaining 10 CLI/tool files ([159bb78](https://github.com/kontourai/flow-agents/commit/159bb785b6b28f99b0a3a5c95e0d4428512f4314))
17
+ * use hosted console io preset ([5b4bb7b](https://github.com/kontourai/flow-agents/commit/5b4bb7bc86d154bcf4d529a62e398a2196b702cc))
18
+
19
+ ## [1.0.1](https://github.com/kontourai/flow-agents/compare/v1.0.0...v1.0.1) (2026-06-12)
20
+
21
+
22
+ ### Fixes
23
+
24
+ * resolve three kit-distribution blockers ([#55](https://github.com/kontourai/flow-agents/issues/55) [#56](https://github.com/kontourai/flow-agents/issues/56) [#57](https://github.com/kontourai/flow-agents/issues/57)) ([3350cb1](https://github.com/kontourai/flow-agents/commit/3350cb15f44bff92d8d9c57f447761d0e1a1b20c))
25
+ * resolve three kit-distribution blockers ([#55](https://github.com/kontourai/flow-agents/issues/55), [#56](https://github.com/kontourai/flow-agents/issues/56), [#57](https://github.com/kontourai/flow-agents/issues/57)) ([13bf732](https://github.com/kontourai/flow-agents/commit/13bf732ff365efa84423e9ea46042e501d202db8))
26
+
3
27
  ## [1.0.0](https://github.com/kontourai/flow-agents/compare/v0.4.0...v1.0.0) (2026-06-12)
4
28
 
5
29
 
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import * as path from "node:path";
3
4
  import { flagBool, flagString, parseArgs } from "../lib/args.js";
4
5
  import { buildWorkflowLearningProjection, readWorkflowLearningSources } from "../lib/workflow-learning-projection.js";
@@ -119,5 +120,21 @@ export function main(argv = process.argv.slice(2)) {
119
120
  return 1;
120
121
  }
121
122
  }
122
- if (import.meta.url === `file://${process.argv[1]}`)
123
- process.exit(main());
123
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
124
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
125
+ // entry-point guard fires correctly when the module is loaded directly as a script.
126
+ const _selfRealPath = (() => { try {
127
+ return fs.realpathSync(fileURLToPath(import.meta.url));
128
+ }
129
+ catch {
130
+ return fileURLToPath(import.meta.url);
131
+ } })();
132
+ const _argv1RealPath = (() => { try {
133
+ return fs.realpathSync(process.argv[1]);
134
+ }
135
+ catch {
136
+ return process.argv[1];
137
+ } })();
138
+ if (_selfRealPath === _argv1RealPath) {
139
+ process.exitCode = main();
140
+ }
@@ -98,5 +98,21 @@ export function main(argv = process.argv.slice(2)) {
98
98
  return 1;
99
99
  }
100
100
  }
101
- if (import.meta.url === `file://${process.argv[1]}`)
102
- process.exit(main());
101
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
102
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
103
+ // entry-point guard fires correctly when the module is loaded directly as a script.
104
+ const _selfRealPath = (() => { try {
105
+ return fs.realpathSync(fileURLToPath(import.meta.url));
106
+ }
107
+ catch {
108
+ return fileURLToPath(import.meta.url);
109
+ } })();
110
+ const _argv1RealPath = (() => { try {
111
+ return fs.realpathSync(process.argv[1]);
112
+ }
113
+ catch {
114
+ return process.argv[1];
115
+ } })();
116
+ if (_selfRealPath === _argv1RealPath) {
117
+ process.exitCode = main();
118
+ }
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import * as fs from "node:fs";
3
+ import { fileURLToPath } from "node:url";
3
4
  import * as path from "node:path";
4
5
  const root = path.resolve(".");
5
6
  const fixtureRoot = "evals/fixtures";
@@ -136,5 +137,21 @@ export function main(argv = process.argv.slice(2)) {
136
137
  return 1;
137
138
  }
138
139
  }
139
- if (import.meta.url === `file://${process.argv[1]}`)
140
- process.exit(main());
140
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
141
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
142
+ // entry-point guard fires correctly when the module is loaded directly as a script.
143
+ const _selfRealPath = (() => { try {
144
+ return fs.realpathSync(fileURLToPath(import.meta.url));
145
+ }
146
+ catch {
147
+ return fileURLToPath(import.meta.url);
148
+ } })();
149
+ const _argv1RealPath = (() => { try {
150
+ return fs.realpathSync(process.argv[1]);
151
+ }
152
+ catch {
153
+ return process.argv[1];
154
+ } })();
155
+ if (_selfRealPath === _argv1RealPath) {
156
+ process.exitCode = main();
157
+ }
@@ -1,6 +1,9 @@
1
+ import * as child_process from "node:child_process";
1
2
  import * as crypto from "node:crypto";
2
3
  import * as fs from "node:fs";
4
+ import * as os from "node:os";
3
5
  import * as path from "node:path";
6
+ import { fileURLToPath } from "node:url";
4
7
  import { parseArgs, flagBool, flagString } from "../lib/args.js";
5
8
  import { assertPathContained, copyDir, isoNow, readJson, walkFiles, writeJson } from "../lib/fs.js";
6
9
  import { assertKitRepository, deriveKitTargets } from "../flow-kit/validate.js";
@@ -27,6 +30,22 @@ function contentHash(root) {
27
30
  }
28
31
  return `sha256:${hash.digest("hex")}`;
29
32
  }
33
+ /** Content hash that excludes .git and other VCS/cache directories (for install-git clones). */
34
+ function kitContentHash(root) {
35
+ const EXCLUDE_DIRS = new Set([".git", "__pycache__", ".pytest_cache"]);
36
+ const hash = crypto.createHash("sha256");
37
+ for (const file of walkFiles(root)) {
38
+ const parts = path.relative(root, file).split(path.sep);
39
+ if (parts.some((p) => EXCLUDE_DIRS.has(p)))
40
+ continue;
41
+ const rel = parts.join("/");
42
+ hash.update(rel);
43
+ hash.update("\0");
44
+ hash.update(fs.readFileSync(file));
45
+ hash.update("\0");
46
+ }
47
+ return `sha256:${hash.digest("hex")}`;
48
+ }
30
49
  function installLocal(argv) {
31
50
  const args = parseArgs(argv);
32
51
  const source = path.resolve(args.positionals[0] ?? "");
@@ -36,13 +55,11 @@ function installLocal(argv) {
36
55
  manifest = assertKitRepository(source);
37
56
  }
38
57
  catch (error) {
39
- console.log("warning: Flow validation surface unavailable; local kit check uses the minimal Flow Definition fallback");
40
58
  console.log("Flow Kit repository validation failed:");
41
59
  for (const diagnostic of (error.diagnostics ?? [error.message]))
42
60
  console.log(` - ${diagnostic}`);
43
61
  return 1;
44
62
  }
45
- console.log("warning: Flow validation surface unavailable; local kit check uses the minimal Flow Definition fallback");
46
63
  const kitId = String(manifest.id);
47
64
  const hash = contentHash(source);
48
65
  const registry = loadRegistry(dest);
@@ -163,10 +180,107 @@ function inspect(argv) {
163
180
  console.log(JSON.stringify(result, null, 2));
164
181
  return result.conformance.k0 ? 0 : 1;
165
182
  }
183
+ /**
184
+ * install-git <repo-url>[#ref] [--ref <branch|tag|sha>] [--dest <path>] [--force] [--update]
185
+ *
186
+ * Shallow-clones a remote git repository to a temporary directory, validates the kit
187
+ * container with the same logic used by install-local, then delegates to the existing
188
+ * install path. Supports an optional #ref fragment in the URL or a separate --ref flag.
189
+ *
190
+ * Implements kontourai/flow-agents#56 (git-ref install surface).
191
+ */
192
+ function installGit(argv) {
193
+ const args = parseArgs(argv);
194
+ const rawUrl = args.positionals[0] ?? "";
195
+ if (!rawUrl) {
196
+ console.error("install-git: missing <repo-url> argument");
197
+ console.error("usage: flow-kit install-git <repo-url>[#ref] [--ref <branch|tag|sha>] [--dest <path>]");
198
+ return 2;
199
+ }
200
+ // Parse ref: #fragment in URL takes precedence over --ref flag.
201
+ let repoUrl = rawUrl;
202
+ let ref = null;
203
+ const hashIdx = rawUrl.indexOf("#");
204
+ if (hashIdx !== -1) {
205
+ repoUrl = rawUrl.slice(0, hashIdx);
206
+ ref = rawUrl.slice(hashIdx + 1) || null;
207
+ }
208
+ if (!ref)
209
+ ref = flagString(args.flags, "ref") ?? null;
210
+ const dest = path.resolve(flagString(args.flags, "dest", ".") ?? ".");
211
+ const force = flagBool(args.flags, "force") ?? false;
212
+ const update = flagBool(args.flags, "update") ?? false;
213
+ // Shallow-clone into a temporary directory.
214
+ const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "flow-kit-git-"));
215
+ try {
216
+ const cloneArgs = ["clone", "--depth", "1"];
217
+ if (ref)
218
+ cloneArgs.push("--branch", ref);
219
+ cloneArgs.push("--", repoUrl, tmpBase);
220
+ try {
221
+ child_process.execFileSync("git", cloneArgs, { stdio: ["ignore", "pipe", "pipe"] });
222
+ }
223
+ catch (err) {
224
+ const msg = err instanceof Error && err.stderr
225
+ ? err.stderr.toString().trim()
226
+ : String(err);
227
+ console.error(`install-git: git clone failed: ${msg}`);
228
+ return 1;
229
+ }
230
+ // Validate the cloned kit using the same logic as install-local.
231
+ let manifest;
232
+ try {
233
+ manifest = assertKitRepository(tmpBase);
234
+ }
235
+ catch (error) {
236
+ console.log("Flow Kit repository validation failed:");
237
+ for (const diagnostic of (error.diagnostics ?? [error.message])) {
238
+ console.log(` - ${diagnostic}`);
239
+ }
240
+ return 1;
241
+ }
242
+ // Delegate to the shared install logic (copy + registry update).
243
+ const kitId = String(manifest.id);
244
+ const hash = kitContentHash(tmpBase);
245
+ const registry = loadRegistry(dest);
246
+ const existing = registry.kits.find((entry) => entry.id === kitId);
247
+ const target = installedPath(dest, kitId);
248
+ assertPathContained(dest, target);
249
+ const sourceText = repoUrl + (ref ? `#${ref}` : "");
250
+ if (existing && existing.source !== sourceText && !update) {
251
+ console.log(`conflict: kit '${kitId}' is already installed from ${existing.source}; rerun with --update to replace it`);
252
+ return 2;
253
+ }
254
+ if (existing && existing.source === sourceText && existing.hash === hash && fs.existsSync(target) && !force) {
255
+ console.log(`kit '${kitId}' is already installed from ${sourceText}`);
256
+ return 0;
257
+ }
258
+ copyDir(tmpBase, target);
259
+ const entry = {
260
+ id: kitId,
261
+ source: sourceText,
262
+ hash,
263
+ installed_at: existing && existing.source === sourceText && !update ? existing.installed_at : isoNow(),
264
+ installed_path: target,
265
+ state: "installed",
266
+ };
267
+ if (typeof manifest.version === "string" && manifest.version)
268
+ entry.version = manifest.version;
269
+ registry.kits = existing ? registry.kits.map((item) => item.id === kitId ? entry : item) : [...registry.kits, entry];
270
+ writeJson(registryPath(dest), registry);
271
+ console.log(`${existing ? "updated" : "installed"} git kit '${kitId}' from ${sourceText} at ${target}`);
272
+ return 0;
273
+ }
274
+ finally {
275
+ fs.rmSync(tmpBase, { recursive: true, force: true });
276
+ }
277
+ }
166
278
  export function main(argv = process.argv.slice(2)) {
167
279
  const [command, ...rest] = argv;
168
280
  if (command === "install-local")
169
281
  return installLocal(rest);
282
+ if (command === "install-git")
283
+ return installGit(rest);
170
284
  if (command === "list")
171
285
  return list(rest);
172
286
  if (command === "status")
@@ -175,8 +289,24 @@ export function main(argv = process.argv.slice(2)) {
175
289
  return activate(rest);
176
290
  if (command === "inspect")
177
291
  return inspect(rest);
178
- console.error("usage: flow-kit <install-local|list|status|activate|inspect> ...");
292
+ console.error("usage: flow-kit <install-local|install-git|list|status|activate|inspect> ...");
179
293
  return 2;
180
294
  }
181
- if (import.meta.url === `file://${process.argv[1]}`)
182
- process.exit(main());
295
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
296
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
297
+ // entry-point guard fires correctly when the module is loaded directly as a script.
298
+ const _selfRealPath = (() => { try {
299
+ return fs.realpathSync(fileURLToPath(import.meta.url));
300
+ }
301
+ catch {
302
+ return fileURLToPath(import.meta.url);
303
+ } })();
304
+ const _argv1RealPath = (() => { try {
305
+ return fs.realpathSync(process.argv[1]);
306
+ }
307
+ catch {
308
+ return process.argv[1];
309
+ } })();
310
+ if (_selfRealPath === _argv1RealPath) {
311
+ process.exitCode = main();
312
+ }
@@ -1,5 +1,6 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import * as fs from "node:fs";
3
+ import { fileURLToPath } from "node:url";
3
4
  import * as os from "node:os";
4
5
  import * as path from "node:path";
5
6
  import { createInterface } from "node:readline/promises";
@@ -445,5 +446,21 @@ export async function mainDogfood(argv = process.argv.slice(2)) {
445
446
  return 2;
446
447
  }
447
448
  }
448
- if (import.meta.url === `file://${process.argv[1]}`)
449
- process.exit(await main());
449
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
450
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
451
+ // entry-point guard fires correctly when the module is loaded directly as a script.
452
+ const _selfRealPath = (() => { try {
453
+ return fs.realpathSync(fileURLToPath(import.meta.url));
454
+ }
455
+ catch {
456
+ return fileURLToPath(import.meta.url);
457
+ } })();
458
+ const _argv1RealPath = (() => { try {
459
+ return fs.realpathSync(process.argv[1]);
460
+ }
461
+ catch {
462
+ return process.argv[1];
463
+ } })();
464
+ if (_selfRealPath === _argv1RealPath) {
465
+ process.exitCode = await main();
466
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import * as path from "node:path";
3
4
  import { parseArgs, flagString } from "../lib/args.js";
4
5
  import { isoNow, relPath } from "../lib/fs.js";
@@ -59,5 +60,21 @@ export function main(argv = process.argv.slice(2)) {
59
60
  console.log(`archived_artifact=${archive}`);
60
61
  return 0;
61
62
  }
62
- if (import.meta.url === `file://${process.argv[1]}`)
63
- process.exit(main());
63
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
64
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
65
+ // entry-point guard fires correctly when the module is loaded directly as a script.
66
+ const _selfRealPath = (() => { try {
67
+ return fs.realpathSync(fileURLToPath(import.meta.url));
68
+ }
69
+ catch {
70
+ return fileURLToPath(import.meta.url);
71
+ } })();
72
+ const _argv1RealPath = (() => { try {
73
+ return fs.realpathSync(process.argv[1]);
74
+ }
75
+ catch {
76
+ return process.argv[1];
77
+ } })();
78
+ if (_selfRealPath === _argv1RealPath) {
79
+ process.exitCode = main();
80
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import * as path from "node:path";
3
4
  import { parseArgs, flagString } from "../lib/args.js";
4
5
  import { readJson } from "../lib/fs.js";
@@ -150,5 +151,21 @@ export function main(argv = process.argv.slice(2)) {
150
151
  return 1;
151
152
  }
152
153
  }
153
- if (import.meta.url === `file://${process.argv[1]}`)
154
- process.exit(main());
154
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
155
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
156
+ // entry-point guard fires correctly when the module is loaded directly as a script.
157
+ const _selfRealPath = (() => { try {
158
+ return fs.realpathSync(fileURLToPath(import.meta.url));
159
+ }
160
+ catch {
161
+ return fileURLToPath(import.meta.url);
162
+ } })();
163
+ const _argv1RealPath = (() => { try {
164
+ return fs.realpathSync(process.argv[1]);
165
+ }
166
+ catch {
167
+ return process.argv[1];
168
+ } })();
169
+ if (_selfRealPath === _argv1RealPath) {
170
+ process.exitCode = main();
171
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import { parseArgs, flagList, flagString } from "../lib/args.js";
3
4
  const FLOW_ARTIFACT_PATTERN = /(?<path>\.flow-agents\/[^\s`'")]+)/g;
4
5
  const GITHUB_ISSUE_PATTERN = /(?:(?<owner>[A-Za-z0-9_.-]+)\/(?<repo>[A-Za-z0-9_.-]+))?#(?<number>\d+)/g;
@@ -465,5 +466,21 @@ export function main(argv = process.argv.slice(2)) {
465
466
  console.log(JSON.stringify({ items }, null, 2));
466
467
  return 0;
467
468
  }
468
- if (import.meta.url === `file://${process.argv[1]}`)
469
- process.exit(main());
469
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
470
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
471
+ // entry-point guard fires correctly when the module is loaded directly as a script.
472
+ const _selfRealPath = (() => { try {
473
+ return fs.realpathSync(fileURLToPath(import.meta.url));
474
+ }
475
+ catch {
476
+ return fileURLToPath(import.meta.url);
477
+ } })();
478
+ const _argv1RealPath = (() => { try {
479
+ return fs.realpathSync(process.argv[1]);
480
+ }
481
+ catch {
482
+ return process.argv[1];
483
+ } })();
484
+ if (_selfRealPath === _argv1RealPath) {
485
+ process.exitCode = main();
486
+ }
@@ -1,3 +1,5 @@
1
+ import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
1
3
  import * as path from "node:path";
2
4
  import { parseArgs, flagString } from "../lib/args.js";
3
5
  import { activateCodexLocal, activateStrandsLocal } from "../runtime-adapters.js";
@@ -23,5 +25,21 @@ export function main(argv = process.argv.slice(2)) {
23
25
  console.log(JSON.stringify(result, null, 2));
24
26
  return Array.isArray(result.errors) && result.errors.length ? 1 : 0;
25
27
  }
26
- if (import.meta.url === `file://${process.argv[1]}`)
27
- process.exit(main());
28
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
29
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
30
+ // entry-point guard fires correctly when the module is loaded directly as a script.
31
+ const _selfRealPath = (() => { try {
32
+ return fs.realpathSync(fileURLToPath(import.meta.url));
33
+ }
34
+ catch {
35
+ return fileURLToPath(import.meta.url);
36
+ } })();
37
+ const _argv1RealPath = (() => { try {
38
+ return fs.realpathSync(process.argv[1]);
39
+ }
40
+ catch {
41
+ return process.argv[1];
42
+ } })();
43
+ if (_selfRealPath === _argv1RealPath) {
44
+ process.exitCode = main();
45
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import * as os from "node:os";
3
4
  import * as path from "node:path";
4
5
  import { parseArgs, flagBool, flagList, flagString } from "../lib/args.js";
@@ -439,5 +440,21 @@ export function main(argv = process.argv.slice(2)) {
439
440
  return 1;
440
441
  }
441
442
  }
442
- if (import.meta.url === `file://${process.argv[1]}`)
443
- process.exit(main());
443
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
444
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
445
+ // entry-point guard fires correctly when the module is loaded directly as a script.
446
+ const _selfRealPath = (() => { try {
447
+ return fs.realpathSync(fileURLToPath(import.meta.url));
448
+ }
449
+ catch {
450
+ return fileURLToPath(import.meta.url);
451
+ } })();
452
+ const _argv1RealPath = (() => { try {
453
+ return fs.realpathSync(process.argv[1]);
454
+ }
455
+ catch {
456
+ return process.argv[1];
457
+ } })();
458
+ if (_selfRealPath === _argv1RealPath) {
459
+ process.exitCode = main();
460
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  import * as path from "node:path";
3
4
  import { flagBool, flagString, parseArgs } from "../lib/args.js";
4
5
  // ---------------------------------------------------------------------------
@@ -232,5 +233,21 @@ export async function main(argv = process.argv.slice(2)) {
232
233
  }
233
234
  return runCheck(rest);
234
235
  }
235
- if (import.meta.url === `file://${process.argv[1]}`)
236
- process.exit(await main());
236
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
237
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
238
+ // entry-point guard fires correctly when the module is loaded directly as a script.
239
+ const _selfRealPath = (() => { try {
240
+ return fs.realpathSync(fileURLToPath(import.meta.url));
241
+ }
242
+ catch {
243
+ return fileURLToPath(import.meta.url);
244
+ } })();
245
+ const _argv1RealPath = (() => { try {
246
+ return fs.realpathSync(process.argv[1]);
247
+ }
248
+ catch {
249
+ return process.argv[1];
250
+ } })();
251
+ if (_selfRealPath === _argv1RealPath) {
252
+ process.exitCode = await main();
253
+ }
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
  const validTiers = new Set(["adapter", "design-target", "installed-command", "live-acceptance", "documented-runtime-gap"]);
3
4
  const validRuntimes = new Set(["codex", "claude-code", "kiro-cli"]);
4
5
  const validHooks = new Set(["workflow-steering", "stop-goal-fit"]);
@@ -148,5 +149,21 @@ export function main(argv = process.argv.slice(2)) {
148
149
  return 1;
149
150
  }
150
151
  }
151
- if (import.meta.url === `file://${process.argv[1]}`)
152
- process.exit(main());
152
+ // Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
153
+ // Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) so the
154
+ // entry-point guard fires correctly when the module is loaded directly as a script.
155
+ const _selfRealPath = (() => { try {
156
+ return fs.realpathSync(fileURLToPath(import.meta.url));
157
+ }
158
+ catch {
159
+ return fileURLToPath(import.meta.url);
160
+ } })();
161
+ const _argv1RealPath = (() => { try {
162
+ return fs.realpathSync(process.argv[1]);
163
+ }
164
+ catch {
165
+ return process.argv[1];
166
+ } })();
167
+ if (_selfRealPath === _argv1RealPath) {
168
+ process.exitCode = main();
169
+ }