@on-par/factory-cli 0.9.0 → 0.9.2

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 (51) hide show
  1. package/README.md +22 -5
  2. package/dist/cli/base-hold.d.ts +63 -0
  3. package/dist/cli/base-hold.d.ts.map +1 -0
  4. package/dist/cli/base-hold.js +122 -0
  5. package/dist/cli/base-hold.js.map +1 -0
  6. package/dist/cli/daemon.d.ts +111 -4
  7. package/dist/cli/daemon.d.ts.map +1 -1
  8. package/dist/cli/daemon.js +364 -6
  9. package/dist/cli/daemon.js.map +1 -1
  10. package/dist/cli/doctor.d.ts +11 -0
  11. package/dist/cli/doctor.d.ts.map +1 -1
  12. package/dist/cli/doctor.js +55 -6
  13. package/dist/cli/doctor.js.map +1 -1
  14. package/dist/cli/feedback.d.ts +18 -2
  15. package/dist/cli/feedback.d.ts.map +1 -1
  16. package/dist/cli/feedback.js +38 -4
  17. package/dist/cli/feedback.js.map +1 -1
  18. package/dist/cli/help-groups.d.ts.map +1 -1
  19. package/dist/cli/help-groups.js +10 -1
  20. package/dist/cli/help-groups.js.map +1 -1
  21. package/dist/cli/index.d.ts +24 -1
  22. package/dist/cli/index.d.ts.map +1 -1
  23. package/dist/cli/index.js +222 -43
  24. package/dist/cli/index.js.map +1 -1
  25. package/dist/cli/self-update.d.ts +68 -0
  26. package/dist/cli/self-update.d.ts.map +1 -0
  27. package/dist/cli/self-update.js +167 -0
  28. package/dist/cli/self-update.js.map +1 -0
  29. package/dist/cli/state-root.d.ts +5 -0
  30. package/dist/cli/state-root.d.ts.map +1 -0
  31. package/dist/cli/state-root.js +12 -0
  32. package/dist/cli/state-root.js.map +1 -0
  33. package/dist/cli/status-json.d.ts +4 -0
  34. package/dist/cli/status-json.d.ts.map +1 -1
  35. package/dist/cli/status-json.js +1 -0
  36. package/dist/cli/status-json.js.map +1 -1
  37. package/dist/cli/update-state.d.ts +46 -0
  38. package/dist/cli/update-state.d.ts.map +1 -0
  39. package/dist/cli/update-state.js +158 -0
  40. package/dist/cli/update-state.js.map +1 -0
  41. package/dist/cli.js +2 -2
  42. package/dist/cli.js.map +1 -1
  43. package/dist/entry.d.ts +1 -1
  44. package/dist/entry.d.ts.map +1 -1
  45. package/dist/entry.js +9 -2
  46. package/dist/entry.js.map +1 -1
  47. package/dist/node-version.d.ts +10 -0
  48. package/dist/node-version.d.ts.map +1 -0
  49. package/dist/node-version.js +15 -0
  50. package/dist/node-version.js.map +1 -0
  51. package/package.json +12 -4
package/README.md CHANGED
@@ -1,21 +1,38 @@
1
1
  # @on-par/factory-cli
2
2
 
3
- The `factory` command: ships verified GitHub issues via boss-worker-checker orchestration.
3
+ The `factory` command for On PAR Dev's Software Factory.
4
4
 
5
- Part of [Software Factory](https://github.com/on-par/software-factory), a multi-agent factory that ships verified work autonomously. Most users want the CLI, [`@on-par/factory-cli`](https://www.npmjs.com/package/@on-par/factory-cli); the other packages are its building blocks.
5
+ On PAR Dev's Software Factory is a local CLI that takes a GitHub issue through plan, build and check with AI agents, then opens a ready-for-review PR. You decide what merges.
6
+
7
+ Built in TypeScript. Routes work across Claude and Codex, with experimental local models through Ollama, and logs cost per task.
8
+
9
+ ![On PAR Dev's Software Factory running a Sound Buddy lane (sped up)](https://raw.githubusercontent.com/on-par/software-factory/main/docs/assets/factory-run.gif)
6
10
 
7
11
  ## Install
8
12
 
9
13
  ```bash
10
14
  npm install -g @on-par/factory-cli
11
- factory --help
15
+ factory --version
16
+ factory doctor
17
+ ```
18
+
19
+ Requires Node.js >= 24, `git`, Claude Code (`claude`) installed and signed in, and the GitHub CLI signed in with `gh auth login`. The factory reads `GITHUB_TOKEN`, then `GH_TOKEN`, and falls back to `gh auth token`. `factory doctor` checks all of this and prints a fix for anything missing.
20
+
21
+ ## Safety
22
+
23
+ Agents run with their permission prompts off (Claude Code with `--permission-mode bypassPermissions`, Codex with `approval_policy=never`) in a separate git worktree, with your permissions and your GitHub token. Only point the factory at repos and issues you trust. It never merges by default: `factory run` and `factory supervise` merge only if you turn auto-merge on (`FACTORY_MERGE=1`, `run.merge.auto: true`, or `--auto-merge`), and `factory land` merges when you run it. Details are in the [Safety section](https://github.com/on-par/software-factory#safety) and [SECURITY.md](https://github.com/on-par/software-factory/blob/main/SECURITY.md).
24
+
25
+ ## Updating
26
+
27
+ ```bash
28
+ npm install -g @on-par/factory-cli@latest
12
29
  ```
13
30
 
14
- Requires Node.js >= 24, `git`, and an authenticated GitHub CLI (`gh`). See the [Quick Start](https://github.com/on-par/software-factory#quick-start-5-minutes) for model CLIs and first-run setup.
31
+ Automatic updates are planned: [#2354](https://github.com/on-par/software-factory/issues/2354), [#2355](https://github.com/on-par/software-factory/issues/2355).
15
32
 
16
33
  ## Documentation
17
34
 
18
- - [README and Quick Start](https://github.com/on-par/software-factory#readme)
35
+ - [README and quick start](https://github.com/on-par/software-factory#readme)
19
36
  - [Architecture and package graph](https://github.com/on-par/software-factory/blob/main/docs/architecture.md)
20
37
  - [Changelog](https://github.com/on-par/software-factory/blob/main/CHANGELOG.md)
21
38
 
@@ -0,0 +1,63 @@
1
+ /** A base SHA found broken by an environment pause (ADR-0141). */
2
+ export interface BaseHold {
3
+ /** `owner/name` of the repo the hold applies to. */
4
+ repo: string;
5
+ baseSha: string;
6
+ failingChecks: string[];
7
+ /** ISO-8601 time the hold was recorded. */
8
+ since: string;
9
+ }
10
+ export declare function writeBaseHold(file: string, hold: BaseHold): void;
11
+ /** Fails soft: a missing, unreadable, non-JSON, non-object or wrongly-typed file is no hold (null). */
12
+ export declare function readBaseHold(file: string): BaseHold | null;
13
+ export declare function deleteBaseHold(file: string): void;
14
+ /** Why a hold ended (#2350). */
15
+ export type BaseHoldClearReason = 'sha-changed' | 'ci-green';
16
+ export interface BaseHoldCleared {
17
+ hold: BaseHold;
18
+ reason: BaseHoldClearReason;
19
+ /** origin/main SHA seen on the clearing poll. */
20
+ currentSha: string;
21
+ }
22
+ /** Deletes the hold only if it is still on `baseSha`; true only when this call deleted it. Fully
23
+ * synchronous, so concurrent lanes in one process cannot both get true. */
24
+ export declare function clearBaseHold(file: string, baseSha: string): boolean;
25
+ export declare function formatBaseHoldCleared(c: BaseHoldCleared): string;
26
+ /** `factory status` lines for an active hold (#2351). */
27
+ export declare function formatBaseHoldStatus(hold: BaseHold): string[];
28
+ export type BaseHoldDecision = {
29
+ kind: 'claim';
30
+ } | {
31
+ kind: 'hold';
32
+ hold: BaseHold;
33
+ };
34
+ export interface BaseHoldGateDeps {
35
+ /** Current origin/main SHA; null (or a throw) means unknown. */
36
+ currentBaseSha: () => Promise<string | null>;
37
+ /** True only when main's CI on `sha` is green. */
38
+ baseCiGreen: (sha: string) => Promise<boolean>;
39
+ /** Called once, only by the poll that actually deleted the hold. A throw is swallowed. */
40
+ onCleared?: (cleared: BaseHoldCleared) => void;
41
+ }
42
+ /** Decides whether a lane may claim: hold only while origin/main is still at the held SHA and
43
+ * its CI is not green. Unknown origin/main fails open; a failed CI lookup counts as not green.
44
+ * Clears the hold when origin/main moved or its CI is green (#2350). */
45
+ export declare function evaluateBaseHold(file: string, repo: string, deps: BaseHoldGateDeps): Promise<BaseHoldDecision>;
46
+ /** Green = at least one check run, all completed, all on the ADR-0014 passing allow-list. */
47
+ export declare function isGreenCheckRunSet(runs: ReadonlyArray<{
48
+ status: string | null;
49
+ conclusion: string | null;
50
+ }>): boolean;
51
+ /** SHA from the first line of `git ls-remote` output, or null when absent or malformed. */
52
+ export declare function parseLsRemoteSha(stdout: string): string | null;
53
+ export declare function createBaseHoldGate(opts: {
54
+ file: string;
55
+ repo: string;
56
+ git: (cmd: string) => Promise<string>;
57
+ listCheckRuns: (ref: string) => Promise<Array<{
58
+ status: string | null;
59
+ conclusion: string | null;
60
+ }>>;
61
+ onCleared?: (cleared: BaseHoldCleared) => void;
62
+ }): () => Promise<BaseHoldDecision>;
63
+ //# sourceMappingURL=base-hold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-hold.d.ts","sourceRoot":"","sources":["../../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AG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,0FAA0F;IAC1F,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD;AAED;;yEAEyE;AACzE,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+BpH;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,OAAO,CAErH;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAOlC"}
@@ -0,0 +1,122 @@
1
+ // packages/cli/src/cli/base-hold.ts — base hold persisted when a lane pauses on a broken
2
+ // base SHA (#2348), so a restarted supervisor remembers the pause. #2349 reads it back as the
3
+ // claim gate: no claiming while origin/main is still at the held SHA and its CI is not green.
4
+ // #2350 clears the hold once origin/main moves or its CI goes green. #2351 reads it for
5
+ // `factory status`.
6
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
7
+ import { dirname } from 'node:path';
8
+ import { isPassingConclusion } from '@on-par/factory-core/internal';
9
+ export function writeBaseHold(file, hold) {
10
+ mkdirSync(dirname(file), { recursive: true });
11
+ const record = {
12
+ repo: hold.repo,
13
+ baseSha: hold.baseSha,
14
+ failingChecks: [...hold.failingChecks],
15
+ since: hold.since,
16
+ };
17
+ writeFileSync(file, `${JSON.stringify(record, null, 2)}\n`);
18
+ }
19
+ /** Fails soft: a missing, unreadable, non-JSON, non-object or wrongly-typed file is no hold (null). */
20
+ export function readBaseHold(file) {
21
+ if (!existsSync(file))
22
+ return null;
23
+ let raw;
24
+ try {
25
+ raw = JSON.parse(readFileSync(file, 'utf-8'));
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
31
+ return null;
32
+ const { repo, baseSha, failingChecks, since } = raw;
33
+ if (typeof repo !== 'string' || typeof baseSha !== 'string' || typeof since !== 'string')
34
+ return null;
35
+ if (!Array.isArray(failingChecks) || !failingChecks.every((c) => typeof c === 'string'))
36
+ return null;
37
+ return { repo, baseSha, failingChecks: [...failingChecks], since };
38
+ }
39
+ export function deleteBaseHold(file) {
40
+ rmSync(file, { force: true });
41
+ }
42
+ /** Deletes the hold only if it is still on `baseSha`; true only when this call deleted it. Fully
43
+ * synchronous, so concurrent lanes in one process cannot both get true. */
44
+ export function clearBaseHold(file, baseSha) {
45
+ const current = readBaseHold(file);
46
+ if (current === null || current.baseSha !== baseSha)
47
+ return false;
48
+ deleteBaseHold(file);
49
+ return true;
50
+ }
51
+ export function formatBaseHoldCleared(c) {
52
+ const held = c.hold.baseSha.slice(0, 8);
53
+ const now = c.currentSha.slice(0, 8);
54
+ return c.reason === 'sha-changed'
55
+ ? `base hold on ${held} cleared (reason: sha-changed): origin/main moved to ${now}`
56
+ : `base hold on ${held} cleared (reason: ci-green): main CI on ${now} is green`;
57
+ }
58
+ /** `factory status` lines for an active hold (#2351). */
59
+ export function formatBaseHoldStatus(hold) {
60
+ const checks = hold.failingChecks.length > 0 ? hold.failingChecks.join(', ') : '(none recorded)';
61
+ return [` repo: ${hold.repo}`, ` baseSha: ${hold.baseSha}`, ` failingChecks: ${checks}`, ` since: ${hold.since}`];
62
+ }
63
+ /** Decides whether a lane may claim: hold only while origin/main is still at the held SHA and
64
+ * its CI is not green. Unknown origin/main fails open; a failed CI lookup counts as not green.
65
+ * Clears the hold when origin/main moved or its CI is green (#2350). */
66
+ export async function evaluateBaseHold(file, repo, deps) {
67
+ const hold = readBaseHold(file);
68
+ if (hold === null || hold.repo !== repo)
69
+ return { kind: 'claim' };
70
+ let sha;
71
+ try {
72
+ sha = await deps.currentBaseSha();
73
+ }
74
+ catch {
75
+ sha = null;
76
+ }
77
+ if (sha === null)
78
+ return { kind: 'claim' };
79
+ const clear = (reason, currentSha) => {
80
+ if (!clearBaseHold(file, hold.baseSha))
81
+ return;
82
+ try {
83
+ deps.onCleared?.({ hold, reason, currentSha });
84
+ }
85
+ catch {
86
+ // an observer failure must not change the decision
87
+ }
88
+ };
89
+ if (sha !== hold.baseSha) {
90
+ clear('sha-changed', sha);
91
+ return { kind: 'claim' };
92
+ }
93
+ let green = false;
94
+ try {
95
+ green = await deps.baseCiGreen(sha);
96
+ }
97
+ catch {
98
+ green = false;
99
+ }
100
+ if (!green)
101
+ return { kind: 'hold', hold };
102
+ clear('ci-green', sha);
103
+ return { kind: 'claim' };
104
+ }
105
+ /** Green = at least one check run, all completed, all on the ADR-0014 passing allow-list. */
106
+ export function isGreenCheckRunSet(runs) {
107
+ return runs.length > 0 && runs.every((r) => r.status === 'completed' && isPassingConclusion(r.conclusion));
108
+ }
109
+ /** SHA from the first line of `git ls-remote` output, or null when absent or malformed. */
110
+ export function parseLsRemoteSha(stdout) {
111
+ const line = stdout.split('\n').find((l) => l.trim() !== '');
112
+ const field = line?.trim().split(/\s+/)[0] ?? '';
113
+ return /^[0-9a-f]{40}$/i.test(field) ? field : null;
114
+ }
115
+ export function createBaseHoldGate(opts) {
116
+ return () => evaluateBaseHold(opts.file, opts.repo, {
117
+ currentBaseSha: async () => parseLsRemoteSha(await opts.git('git ls-remote origin refs/heads/main')),
118
+ baseCiGreen: async (sha) => isGreenCheckRunSet(await opts.listCheckRuns(sha)),
119
+ onCleared: opts.onCleared,
120
+ });
121
+ }
122
+ //# sourceMappingURL=base-hold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-hold.js","sourceRoot":"","sources":["../../src/cli/base-hold.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8FAA8F;AAC9F,8FAA8F;AAC9F,wFAAwF;AACxF,oBAAoB;AAEpB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAYpE,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAc;IACxD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAa;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,aAAa,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QACtC,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;IACF,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;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AAgB,CAAC,MAAc;IAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAMlC;IACC,OAAO,GAAG,EAAE,CACV,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;QACrC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpG,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC7E,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;AACP,CAAC"}
@@ -1,4 +1,5 @@
1
- import { type RepoState } from '@on-par/factory-core/internal';
1
+ import { type RepoState, type RunRuntime } from '@on-par/factory-core/internal';
2
+ import { type UpdateState } from './update-state.js';
2
3
  export declare const FACTORYD_LABEL = "com.onpar.factoryd";
3
4
  /** Expected daemon-control failure. index.ts's commander wrappers map it onto
4
5
  * CliExitError (importing CliExitError here would be circular — index.ts
@@ -41,21 +42,70 @@ export declare function factorydFiles(home: string): {
41
42
  plistPath: string;
42
43
  logPath: string;
43
44
  };
45
+ export declare const UPDATE_MODES: readonly ['manual', 'stable', 'prerelease'];
46
+ export type UpdateMode = (typeof UPDATE_MODES)[number];
47
+ export type UpdateChannel = 'latest' | 'next';
48
+ /** The single mode → npm dist-tag mapping (#2246). */
49
+ export declare function updateChannel(mode: UpdateMode): UpdateChannel | null;
50
+ /** Exact, case-sensitive parse of an update mode. Throws DaemonCtlError (code 2). */
51
+ export declare function parseUpdateMode(value: string, source: string): UpdateMode;
52
+ export type InstallKind = 'npm-global' | 'source' | 'unknown';
53
+ export interface InstallInfo {
54
+ kind: InstallKind;
55
+ prefix: string;
56
+ version: string;
57
+ }
58
+ export interface DetectInstallDeps {
59
+ execPath?: string;
60
+ cliPath?: string;
61
+ env?: NodeJS.ProcessEnv;
62
+ version?: string;
63
+ exists?: (p: string) => boolean;
64
+ }
65
+ /** Classifies the running cli.js as npm-global, source or unknown (#2246). Pure
66
+ * apart from the injectable fs probe; never spawns npm or git. */
67
+ export declare function detectInstall(deps?: DetectInstallDeps): InstallInfo;
68
+ /** Optional daemon-scoped config file (<registry dir>/daemon.json). */
69
+ export interface DaemonFileConfig {
70
+ autoUpdate?: {
71
+ mode?: string;
72
+ checkIntervalMinutes?: unknown;
73
+ drainTimeoutMinutes?: unknown;
74
+ };
75
+ }
76
+ /** Reads daemon.json. A missing file is `{}`; malformed structure throws DaemonCtlError (code 2). */
77
+ export declare function loadDaemonFileConfig(file: string): DaemonFileConfig;
78
+ export interface ResolvedAutoUpdate {
79
+ /** Effective mode (after the source/unknown downgrade). */
80
+ mode: UpdateMode;
81
+ /** Mode requested before the downgrade. */
82
+ requestedMode: UpdateMode;
83
+ channel: UpdateChannel | null;
84
+ checkIntervalMinutes: number;
85
+ drainTimeoutMinutes: number;
86
+ }
44
87
  /** Resolved options for the foreground `factory daemon run` process. */
45
88
  export interface FactorydConfig {
46
89
  /** Registry file served (default ~/.factory/registry.json). */
47
90
  registryFile: string;
48
91
  /** Port to bind on 127.0.0.1 (default DEFAULT_FACTORYD_PORT). */
49
92
  port: number;
50
- /** Opt-in auto-update (#2128). Off unless --auto-update was passed; nothing acts on it yet. */
51
- autoUpdate: boolean;
93
+ /** Resolved self-update setting (#2246). runAutoUpdateLoop acts on it (#1939). */
94
+ autoUpdate: ResolvedAutoUpdate;
95
+ install: InstallInfo;
96
+ /** One-time startup notices (deprecation, downgrade); cmdFactoryd logs each once. */
97
+ notices: string[];
52
98
  }
53
99
  /** Resolves `factory daemon run` options into a FactorydConfig. Throws
54
- * DaemonCtlError (code 2) on an invalid --port. */
100
+ * DaemonCtlError (code 2) on an invalid --port, --update-mode or daemon.json value. */
55
101
  export declare function resolveFactorydConfig(opts: {
56
102
  port?: string;
57
103
  registry?: string;
104
+ updateMode?: string;
58
105
  autoUpdate?: boolean;
106
+ }, deps?: {
107
+ install?: InstallInfo;
108
+ fileConfig?: DaemonFileConfig;
59
109
  }): FactorydConfig;
60
110
  /** Pure renderer for ~/Library/LaunchAgents/com.onpar.factoryd.plist. KeepAlive
61
111
  * relaunches factoryd after any exit; RunAtLoad starts it at login/bootstrap;
@@ -110,4 +160,61 @@ export declare function cmdDaemonLogs(opts: {
110
160
  follow?: boolean;
111
161
  lines?: string;
112
162
  }, deps?: DaemonCtlDeps): Promise<void>;
163
+ /** Exit code that makes launchd KeepAlive / systemd Restart=always relaunch factoryd. */
164
+ export declare const AUTO_UPDATE_RESTART_EXIT_CODE = 75;
165
+ /** `factory self-update` exit code for "a run is active, refusing to apply". */
166
+ export declare const AUTO_UPDATE_BUSY_EXIT_CODE = 3;
167
+ export interface AutoUpdateCheck {
168
+ candidate: string | null;
169
+ updateAvailable: boolean;
170
+ error: string | null;
171
+ }
172
+ export interface AutoUpdateApplyResult {
173
+ code: number;
174
+ rolledBack: boolean;
175
+ error: string | null;
176
+ }
177
+ export type AutoUpdateOutcome = 'manual' | 'check-error' | 'no-update' | 'skipped-failed-version' | 'drain-timeout' | 'busy' | 'failed' | 'updated';
178
+ export interface AutoUpdateDeps {
179
+ stateFile: string;
180
+ check(): Promise<AutoUpdateCheck>;
181
+ apply(version: string): Promise<AutoUpdateApplyResult>;
182
+ /** Slugs/labels with an active run; empty = drained. */
183
+ activeRuns(): Promise<string[]>;
184
+ /** Exclusively creates STOP in every attached repo; returns only the paths it created. */
185
+ writeStops(): Promise<string[]>;
186
+ clearStops(files: string[]): Promise<void>;
187
+ /** Epoch ms. */
188
+ now(): number;
189
+ sleep(ms: number): Promise<void>;
190
+ log(line: string): void;
191
+ exit(code: number): Promise<void> | void;
192
+ /** Loop guard; default () => false. */
193
+ stopped?(): boolean;
194
+ /** Drain poll interval; default 30_000. */
195
+ drainPollMs?: number;
196
+ }
197
+ type AutoUpdateConfig = Pick<FactorydConfig, 'autoUpdate' | 'install'>;
198
+ /** True only for an error-free, newer candidate; prereleases are ignored in stable mode. */
199
+ export declare function isUpdateCandidate(check: AutoUpdateCheck, mode: UpdateMode, current: string): check is AutoUpdateCheck & {
200
+ candidate: string;
201
+ };
202
+ /** One check → drain → apply pass. Never throws; never applies while a run is active. */
203
+ export declare function runAutoUpdateCycle(config: AutoUpdateConfig, deps: AutoUpdateDeps): Promise<AutoUpdateOutcome>;
204
+ /** Sleeps the check interval, runs a cycle, and exits 75 after a successful update. */
205
+ export declare function runAutoUpdateLoop(config: AutoUpdateConfig, deps: AutoUpdateDeps): Promise<void>;
206
+ /** Removes STOP files a previous (crashed) drain left behind; returns the paths removed. */
207
+ export declare function recoverStaleDrain(previous: UpdateState | null, removeStop: (file: string) => boolean): string[];
208
+ /** Production deps: checks via the injected `check`, applies via `factory self-update --to`, detects activity from the run runtime and run locks. */
209
+ export declare function createAutoUpdateDeps(opts: {
210
+ registryFile: string;
211
+ stateFile: string;
212
+ cliEntrypoint: string;
213
+ /** Registry check; cmdFactoryd passes `checkForUpdate` from self-update.ts (#2354). */
214
+ check: () => Promise<AutoUpdateCheck>;
215
+ runRuntime: Pick<RunRuntime, 'list'>;
216
+ log: (line: string) => void;
217
+ exit: (code: number) => Promise<void> | void;
218
+ }): AutoUpdateDeps;
219
+ export {};
113
220
  //# sourceMappingURL=daemon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"da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