@telora/daemon 0.19.82 → 0.19.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +2 -2
- package/dist/cli/session-state.d.ts +26 -0
- package/dist/cli/session-state.d.ts.map +1 -1
- package/dist/cli/session-state.js +53 -2
- package/dist/cli/session-state.js.map +1 -1
- package/dist/cli/verify-setup-config.d.ts +58 -0
- package/dist/cli/verify-setup-config.d.ts.map +1 -0
- package/dist/cli/verify-setup-config.js +105 -0
- package/dist/cli/verify-setup-config.js.map +1 -0
- package/dist/cli/verify-setup.d.ts +96 -0
- package/dist/cli/verify-setup.d.ts.map +1 -0
- package/dist/cli/verify-setup.js +175 -0
- package/dist/cli/verify-setup.js.map +1 -0
- package/dist/config.d.ts +29 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -23
- package/dist/config.js.map +1 -1
- package/dist/heartbeat.d.ts.map +1 -1
- package/dist/heartbeat.js +6 -0
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/types/config.d.ts +35 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/unified-engine-lifecycle.d.ts.map +1 -1
- package/dist/unified-engine-lifecycle.js +14 -2
- package/dist/unified-engine-lifecycle.js.map +1 -1
- package/dist/unified-init.d.ts.map +1 -1
- package/dist/unified-init.js +21 -1
- package/dist/unified-init.js.map +1 -1
- package/dist/unified-shell-status.d.ts +11 -0
- package/dist/unified-shell-status.d.ts.map +1 -1
- package/dist/unified-shell-status.js +30 -0
- package/dist/unified-shell-status.js.map +1 -1
- package/dist/unified-shell.d.ts.map +1 -1
- package/dist/unified-shell.js +13 -1
- package/dist/unified-shell.js.map +1 -1
- package/dist/verification-config.d.ts +45 -1
- package/dist/verification-config.d.ts.map +1 -1
- package/dist/verification-config.js +41 -0
- package/dist/verification-config.js.map +1 -1
- package/package.json +1 -1
package/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commitSha": "
|
|
3
|
-
"builtAt": "2026-07-
|
|
2
|
+
"commitSha": "30a14182e",
|
|
3
|
+
"builtAt": "2026-07-06T16:46:16.684Z",
|
|
4
4
|
"expectedMigrations": [
|
|
5
5
|
"20250829113330_create_org_nodes_table.sql",
|
|
6
6
|
"20250829113402_fix_function_security_search_path.sql",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* so an unreachable registry must not cost a fetch timeout. The running
|
|
32
32
|
* daemon keeps the cache warm (startVersionCacheRefreshLoop, 6h TTL).
|
|
33
33
|
*/
|
|
34
|
+
import { type VerificationPosture } from '../verification-config.js';
|
|
34
35
|
interface DaemonJsonProduct {
|
|
35
36
|
id?: string;
|
|
36
37
|
repoPath?: string;
|
|
@@ -61,6 +62,15 @@ interface SessionStateResponse {
|
|
|
61
62
|
pipelineConfig: Record<string, unknown> | null;
|
|
62
63
|
};
|
|
63
64
|
deliveryCounts?: Record<string, number>;
|
|
65
|
+
/**
|
|
66
|
+
* Derived verification posture for the session's active product
|
|
67
|
+
* (configured | declined | unconfigured). Locally derived from daemon.json --
|
|
68
|
+
* NOT from the product-api, which cannot know a workstation's config. Absent
|
|
69
|
+
* when it cannot be resolved (degrade-safe; the hook never blocks on it).
|
|
70
|
+
*/
|
|
71
|
+
verificationPosture?: VerificationPosture;
|
|
72
|
+
/** The configured command, present only when posture is `configured`. */
|
|
73
|
+
verificationCommand?: string;
|
|
64
74
|
error?: string;
|
|
65
75
|
}
|
|
66
76
|
export interface SessionStateOptions {
|
|
@@ -84,6 +94,12 @@ export interface SessionStateOptions {
|
|
|
84
94
|
* channel for the invariants the agent must not reason its way around.
|
|
85
95
|
* Exported for unit testing.
|
|
86
96
|
*/
|
|
97
|
+
/**
|
|
98
|
+
* One-line verification-posture summary for the session's active product.
|
|
99
|
+
* Emitted only when a posture was resolved (see formatPlain), so the byte
|
|
100
|
+
* contract is unchanged for the not-connected / unresolvable case.
|
|
101
|
+
*/
|
|
102
|
+
export declare function formatVerificationLine(posture: VerificationPosture, command?: string): string;
|
|
87
103
|
export declare function formatPlain(state: SessionStateResponse): string;
|
|
88
104
|
/**
|
|
89
105
|
* Resolve the default daemon.json path using global-first search order:
|
|
@@ -140,6 +156,16 @@ export declare function resolveCwdRepoPath(cfg: DaemonJson): string | null;
|
|
|
140
156
|
* is never blocked.
|
|
141
157
|
*/
|
|
142
158
|
export declare function selfHealClaudeMdSeed(cfg: DaemonJson): void;
|
|
159
|
+
/**
|
|
160
|
+
* Derive the verification posture for the session's active product from the raw
|
|
161
|
+
* daemon.json, via the shared carriage resolver + derivation (single source with
|
|
162
|
+
* the daemon engine + startup surfaces). Degrade-safe: returns null on any error
|
|
163
|
+
* so session start is never blocked.
|
|
164
|
+
*/
|
|
165
|
+
export declare function resolveActivePosture(cfg: DaemonJson, productId: string): {
|
|
166
|
+
posture: VerificationPosture;
|
|
167
|
+
command: string;
|
|
168
|
+
} | null;
|
|
143
169
|
export declare function runSessionState(opts: SessionStateOptions): Promise<void>;
|
|
144
170
|
export {};
|
|
145
171
|
//# sourceMappingURL=session-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-state.d.ts","sourceRoot":"","sources":["../../src/cli/session-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAUH,UAAU,iBAAiB;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE;YAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,CAA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,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAgB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,UAAU,GAAG;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAiBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAWjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAqB1D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,MAAM,GAChB;IAAE,OAAO,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAe1D;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D9E"}
|
|
@@ -38,6 +38,8 @@ import { resolve, sep } from 'node:path';
|
|
|
38
38
|
import { writeOrMergeClaudeMd } from './connect.js';
|
|
39
39
|
import { getStalenessInfo, formatStalenessWarning } from '../staleness.js';
|
|
40
40
|
import { renderCapabilityPointer } from '../capability-pointer.js';
|
|
41
|
+
import { resolveVerificationCarriage } from '../config.js';
|
|
42
|
+
import { deriveVerificationPosture, resolveDefaultVerification, } from '../verification-config.js';
|
|
41
43
|
function loadDaemonJson(configPath) {
|
|
42
44
|
if (!existsSync(configPath))
|
|
43
45
|
return null;
|
|
@@ -148,16 +150,37 @@ async function callSessionState(cfg, productId) {
|
|
|
148
150
|
* channel for the invariants the agent must not reason its way around.
|
|
149
151
|
* Exported for unit testing.
|
|
150
152
|
*/
|
|
153
|
+
/**
|
|
154
|
+
* One-line verification-posture summary for the session's active product.
|
|
155
|
+
* Emitted only when a posture was resolved (see formatPlain), so the byte
|
|
156
|
+
* contract is unchanged for the not-connected / unresolvable case.
|
|
157
|
+
*/
|
|
158
|
+
export function formatVerificationLine(posture, command) {
|
|
159
|
+
switch (posture) {
|
|
160
|
+
case 'configured':
|
|
161
|
+
return `Verification: configured${command ? ` (${command})` : ''} -- deliveries run a deterministic check before AI review.`;
|
|
162
|
+
case 'declined':
|
|
163
|
+
return 'Verification: declined (review-only) -- deliveries gate on AI review only, by recorded decision.';
|
|
164
|
+
case 'unconfigured':
|
|
165
|
+
return "Verification: unconfigured -- deliveries gate on AI review only; run 'telora-daemon verify-setup' to enable a deterministic gate.";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
151
168
|
export function formatPlain(state) {
|
|
152
169
|
const url = state.connectedUrl ?? '';
|
|
153
170
|
const orgName = state.organizationName ?? 'unknown';
|
|
154
171
|
const productName = state.productName ?? 'unknown';
|
|
155
|
-
|
|
172
|
+
const lines = [
|
|
156
173
|
`Telora connected: ${url} / ${orgName} / ${productName}`,
|
|
157
174
|
'Active focuses, branches, and deliveries are resolved on demand via Telora MCP.',
|
|
158
175
|
'DEFAULT: declare intent in Telora (Focus -> delivery -> issue, moved to In Progress) BEFORE writing or scaffolding code; build directly in the working tree only when the user explicitly says so (e.g. "build locally", "just write it").',
|
|
159
176
|
renderCapabilityPointer(),
|
|
160
|
-
]
|
|
177
|
+
];
|
|
178
|
+
// Conditional: only when posture resolved -- preserves the byte contract for
|
|
179
|
+
// sessions where it cannot be derived.
|
|
180
|
+
if (state.verificationPosture) {
|
|
181
|
+
lines.push(formatVerificationLine(state.verificationPosture, state.verificationCommand));
|
|
182
|
+
}
|
|
183
|
+
return lines.join('\n');
|
|
161
184
|
}
|
|
162
185
|
/**
|
|
163
186
|
* Resolve the default daemon.json path using global-first search order:
|
|
@@ -273,6 +296,26 @@ export function selfHealClaudeMdSeed(cfg) {
|
|
|
273
296
|
process.stderr.write(`session-state: CLAUDE.md seed refresh skipped: ${err.message}\n`);
|
|
274
297
|
}
|
|
275
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Derive the verification posture for the session's active product from the raw
|
|
301
|
+
* daemon.json, via the shared carriage resolver + derivation (single source with
|
|
302
|
+
* the daemon engine + startup surfaces). Degrade-safe: returns null on any error
|
|
303
|
+
* so session start is never blocked.
|
|
304
|
+
*/
|
|
305
|
+
export function resolveActivePosture(cfg, productId) {
|
|
306
|
+
try {
|
|
307
|
+
const carriage = resolveVerificationCarriage(cfg, (cfg.products ?? []).map((p) => ({ id: p.id ?? '', repoPath: p.repoPath ?? '' })));
|
|
308
|
+
const active = carriage.products.find((p) => p.id === productId);
|
|
309
|
+
const scoped = { defaultVerification: active?.defaultVerification ?? carriage.defaultVerification };
|
|
310
|
+
return {
|
|
311
|
+
posture: deriveVerificationPosture(scoped),
|
|
312
|
+
command: resolveDefaultVerification(scoped).command,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
276
319
|
export async function runSessionState(opts) {
|
|
277
320
|
const configPath = opts.config ? resolve(opts.config) : resolveDefaultConfigPath();
|
|
278
321
|
if (!configPath)
|
|
@@ -296,6 +339,14 @@ export async function runSessionState(opts) {
|
|
|
296
339
|
return;
|
|
297
340
|
if (cfg.teloraUrl)
|
|
298
341
|
state.connectedUrl = cfg.teloraUrl;
|
|
342
|
+
// Locally-derived verification posture for the active product (config-only;
|
|
343
|
+
// degrade-safe). Surfaced on both the plain hook output and the --json payload.
|
|
344
|
+
const posture = resolveActivePosture(cfg, productId);
|
|
345
|
+
if (posture) {
|
|
346
|
+
state.verificationPosture = posture.posture;
|
|
347
|
+
if (posture.posture === 'configured')
|
|
348
|
+
state.verificationCommand = posture.command;
|
|
349
|
+
}
|
|
299
350
|
// Staleness signal for the RUNNING daemon (null when no daemon is running
|
|
300
351
|
// or no fresh latest-version answer exists -- see staleness.ts). cacheOnly:
|
|
301
352
|
// this path must never wait on the registry (the SessionStart hook blocks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-state.js","sourceRoot":"","sources":["../../src/cli/session-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAkB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAsB,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"session-state.js","sourceRoot":"","sources":["../../src/cli/session-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAkB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAsB,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,yBAAyB,EACzB,0BAA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C,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;IACD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAE3D,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,6DAA6D;QAC7D,sEAAsE;QACtE,MAAM,iBAAiB,GAAG,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,IAAI,aAAa,CAAC;QACpF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG;YACd,GAAG,KAAK;YACR,QAAQ;YACR,sEAAsE;YACtE,0DAA0D;YAC1D,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrD,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,4EAA4E;IAC5E,kEAAkE;IAClE,IAAI,gBAAgB;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,gBAAgB,IAAI,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared primitives for the guided verification-setup path: candidate command
|
|
3
|
+
* DETECTION and the config WRITER. Used by both `telora-daemon verify-setup`
|
|
4
|
+
* (existing installs) and the `telora-daemon init` per-product question.
|
|
5
|
+
*
|
|
6
|
+
* Detection PROPOSES; it never auto-adopts. A command is only ever written
|
|
7
|
+
* after an explicit operator confirmation in the caller -- a vacuous pass (an
|
|
8
|
+
* empty or placeholder command) would stamp a false "verified" signal, so the
|
|
9
|
+
* operator is always in the loop.
|
|
10
|
+
*
|
|
11
|
+
* The write payload reuses the shared DefaultVerificationConfig shape (and its
|
|
12
|
+
* `declined` marker) from the per-product posture delivery -- there is no second
|
|
13
|
+
* config shape.
|
|
14
|
+
*
|
|
15
|
+
* @module cli/verify-setup-config
|
|
16
|
+
*/
|
|
17
|
+
import type { DefaultVerificationConfig } from '../types.js';
|
|
18
|
+
/** A detected candidate command plus a short human-readable reason. */
|
|
19
|
+
export interface DetectedVerifyCommand {
|
|
20
|
+
command: string;
|
|
21
|
+
/** Why this candidate was proposed (shown to the operator before confirm). */
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Detect a candidate verification command by inspecting ONLY the given repo
|
|
26
|
+
* directory -- never a parent. Walking up the tree misattributes an unrelated
|
|
27
|
+
* ancestor's toolchain to this repo (see the deps-scanner misattribution
|
|
28
|
+
* history); a control plane runs on many repo types, so a wrong guess here is
|
|
29
|
+
* worse than no guess. Returns null when no confident candidate is found.
|
|
30
|
+
*
|
|
31
|
+
* Node repos are matched by their package.json scripts (a real `verify` or
|
|
32
|
+
* non-placeholder `test`); other ecosystems by their canonical manifest file.
|
|
33
|
+
* Never throws -- a malformed manifest yields no candidate.
|
|
34
|
+
*/
|
|
35
|
+
export declare function detectVerifyCommand(repoPath: string): DetectedVerifyCommand | null;
|
|
36
|
+
/**
|
|
37
|
+
* Configured write entry: a command plus optional tuning. A subset of the
|
|
38
|
+
* shared DefaultVerificationConfig -- timeoutMs/maxConcurrent default in at load
|
|
39
|
+
* time (parseVerifyBlock), so a guided write only needs the command (+ an
|
|
40
|
+
* optional validated timeout).
|
|
41
|
+
*/
|
|
42
|
+
export type ConfiguredVerifyEntry = Pick<DefaultVerificationConfig, 'command'> & Partial<Pick<DefaultVerificationConfig, 'timeoutMs' | 'maxConcurrent'>>;
|
|
43
|
+
/** The payload written under `products[].defaultVerification`. */
|
|
44
|
+
export type VerifyConfigEntry = ConfiguredVerifyEntry | {
|
|
45
|
+
declined: true;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Write `products[].defaultVerification` for one product into a daemon.json
|
|
49
|
+
* file, preserving every other product and every other config key. Idempotent
|
|
50
|
+
* (writing the same entry twice produces the same file). Throws when the target
|
|
51
|
+
* product id is not present in the config's `products` array -- the caller must
|
|
52
|
+
* not silently create a phantom product entry.
|
|
53
|
+
*
|
|
54
|
+
* This is the ONLY write path; callers gate it behind an explicit operator
|
|
55
|
+
* confirmation so nothing is ever auto-adopted.
|
|
56
|
+
*/
|
|
57
|
+
export declare function writeVerifyConfig(configPath: string, productId: string, entry: VerifyConfigEntry): void;
|
|
58
|
+
//# sourceMappingURL=verify-setup-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-setup-config.d.ts","sourceRoot":"","sources":["../../src/cli/verify-setup-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CA+BlF;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC/B,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,WAAW,GAAG,eAAe,CAAC,CAAC,CAAC;AAE1E,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,iBAAiB,GACvB,IAAI,CAiBN"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared primitives for the guided verification-setup path: candidate command
|
|
3
|
+
* DETECTION and the config WRITER. Used by both `telora-daemon verify-setup`
|
|
4
|
+
* (existing installs) and the `telora-daemon init` per-product question.
|
|
5
|
+
*
|
|
6
|
+
* Detection PROPOSES; it never auto-adopts. A command is only ever written
|
|
7
|
+
* after an explicit operator confirmation in the caller -- a vacuous pass (an
|
|
8
|
+
* empty or placeholder command) would stamp a false "verified" signal, so the
|
|
9
|
+
* operator is always in the loop.
|
|
10
|
+
*
|
|
11
|
+
* The write payload reuses the shared DefaultVerificationConfig shape (and its
|
|
12
|
+
* `declined` marker) from the per-product posture delivery -- there is no second
|
|
13
|
+
* config shape.
|
|
14
|
+
*
|
|
15
|
+
* @module cli/verify-setup-config
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import { resolve } from 'node:path';
|
|
19
|
+
/**
|
|
20
|
+
* Detect a candidate verification command by inspecting ONLY the given repo
|
|
21
|
+
* directory -- never a parent. Walking up the tree misattributes an unrelated
|
|
22
|
+
* ancestor's toolchain to this repo (see the deps-scanner misattribution
|
|
23
|
+
* history); a control plane runs on many repo types, so a wrong guess here is
|
|
24
|
+
* worse than no guess. Returns null when no confident candidate is found.
|
|
25
|
+
*
|
|
26
|
+
* Node repos are matched by their package.json scripts (a real `verify` or
|
|
27
|
+
* non-placeholder `test`); other ecosystems by their canonical manifest file.
|
|
28
|
+
* Never throws -- a malformed manifest yields no candidate.
|
|
29
|
+
*/
|
|
30
|
+
export function detectVerifyCommand(repoPath) {
|
|
31
|
+
// Node: read package.json in THIS directory only.
|
|
32
|
+
const pkgPath = resolve(repoPath, 'package.json');
|
|
33
|
+
if (existsSync(pkgPath)) {
|
|
34
|
+
const scripts = readPackageScripts(pkgPath);
|
|
35
|
+
if (scripts) {
|
|
36
|
+
if (isNonEmptyString(scripts.verify)) {
|
|
37
|
+
return { command: 'npm run verify', reason: 'package.json "verify" script' };
|
|
38
|
+
}
|
|
39
|
+
if (isNonEmptyString(scripts.test) && !isPlaceholderTest(scripts.test)) {
|
|
40
|
+
return { command: 'npm test', reason: 'package.json "test" script' };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Rust
|
|
45
|
+
if (existsSync(resolve(repoPath, 'Cargo.toml'))) {
|
|
46
|
+
return { command: 'cargo test', reason: 'Cargo.toml (Rust crate)' };
|
|
47
|
+
}
|
|
48
|
+
// Go
|
|
49
|
+
if (existsSync(resolve(repoPath, 'go.mod'))) {
|
|
50
|
+
return { command: 'go test ./...', reason: 'go.mod (Go module)' };
|
|
51
|
+
}
|
|
52
|
+
// Python
|
|
53
|
+
if (existsSync(resolve(repoPath, 'pyproject.toml')) || existsSync(resolve(repoPath, 'setup.py'))) {
|
|
54
|
+
return { command: 'pytest', reason: 'pyproject.toml/setup.py (Python project)' };
|
|
55
|
+
}
|
|
56
|
+
// Make (generic) -- last resort; a Makefile with a test target is common.
|
|
57
|
+
if (existsSync(resolve(repoPath, 'Makefile'))) {
|
|
58
|
+
return { command: 'make test', reason: 'Makefile' };
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Write `products[].defaultVerification` for one product into a daemon.json
|
|
64
|
+
* file, preserving every other product and every other config key. Idempotent
|
|
65
|
+
* (writing the same entry twice produces the same file). Throws when the target
|
|
66
|
+
* product id is not present in the config's `products` array -- the caller must
|
|
67
|
+
* not silently create a phantom product entry.
|
|
68
|
+
*
|
|
69
|
+
* This is the ONLY write path; callers gate it behind an explicit operator
|
|
70
|
+
* confirmation so nothing is ever auto-adopted.
|
|
71
|
+
*/
|
|
72
|
+
export function writeVerifyConfig(configPath, productId, entry) {
|
|
73
|
+
if (!existsSync(configPath)) {
|
|
74
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
75
|
+
}
|
|
76
|
+
const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
77
|
+
const products = Array.isArray(raw.products) ? raw.products : [];
|
|
78
|
+
const target = products.find((p) => typeof p === 'object' && p !== null && p.id === productId);
|
|
79
|
+
if (!target) {
|
|
80
|
+
throw new Error(`Product ${productId} not found in ${configPath}; cannot write verification config.`);
|
|
81
|
+
}
|
|
82
|
+
target.defaultVerification = entry;
|
|
83
|
+
writeFileSync(configPath, JSON.stringify(raw, null, 2) + '\n', { mode: 0o600 });
|
|
84
|
+
}
|
|
85
|
+
// ── internals ──
|
|
86
|
+
function readPackageScripts(pkgPath) {
|
|
87
|
+
try {
|
|
88
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
89
|
+
return typeof pkg.scripts === 'object' && pkg.scripts !== null
|
|
90
|
+
? pkg.scripts
|
|
91
|
+
: null;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Malformed package.json -> no candidate, never crash the wizard.
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function isNonEmptyString(v) {
|
|
99
|
+
return typeof v === 'string' && v.trim() !== '';
|
|
100
|
+
}
|
|
101
|
+
/** The npm-init default placeholder test (`echo "Error: no test specified" && exit 1`). */
|
|
102
|
+
function isPlaceholderTest(script) {
|
|
103
|
+
return /no test specified/i.test(script);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=verify-setup-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-setup-config.js","sourceRoot":"","sources":["../../src/cli/verify-setup-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;;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IACzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAA0B,CAAC;QAChF,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI;YAC5D,CAAC,CAAE,GAAG,CAAC,OAAmC;YAC1C,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AAClD,CAAC;AAED,2FAA2F;AAC3F,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `telora-daemon verify-setup`: a guided, per-repo path to configure the
|
|
3
|
+
* default-on deterministic verification command for existing installs.
|
|
4
|
+
*
|
|
5
|
+
* Per configured product it detects a candidate command, offers a validation
|
|
6
|
+
* run (execute once, report exit code + runtime to size the timeout), and
|
|
7
|
+
* writes `products[].defaultVerification` -- or records an explicit review-only
|
|
8
|
+
* decline. Detection PROPOSES; nothing is auto-adopted: every write path
|
|
9
|
+
* requires an explicit operator confirmation (a vacuous pass would stamp a
|
|
10
|
+
* false "verified" signal).
|
|
11
|
+
*
|
|
12
|
+
* The per-product driver (`runVerifySetupForProduct`) is dependency-injected
|
|
13
|
+
* (ask / runCommand / write / out) so it is unit-testable without a TTY or a
|
|
14
|
+
* real subprocess. `runVerifySetupCommand` wires the real readline + child
|
|
15
|
+
* process + config writer for the CLI.
|
|
16
|
+
*
|
|
17
|
+
* @module cli/verify-setup
|
|
18
|
+
*/
|
|
19
|
+
import { type VerifyConfigEntry, type ConfiguredVerifyEntry } from './verify-setup-config.js';
|
|
20
|
+
/** Minimum timeout floor for a sized default-on run: 5 minutes. */
|
|
21
|
+
export declare const VERIFY_SETUP_MIN_TIMEOUT_MS: number;
|
|
22
|
+
/** One product the wizard walks. */
|
|
23
|
+
export interface VerifySetupProduct {
|
|
24
|
+
id: string;
|
|
25
|
+
repoPath: string;
|
|
26
|
+
}
|
|
27
|
+
/** Injected side-effect surface -- real impls in runVerifySetupCommand. */
|
|
28
|
+
export interface VerifySetupIO {
|
|
29
|
+
/** Ask the operator a free-text question; returns their trimmed answer. */
|
|
30
|
+
ask(question: string): Promise<string>;
|
|
31
|
+
/** Run a command in a repo; report exit code + wall-clock runtime (ms). */
|
|
32
|
+
runCommand(command: string, repoPath: string): Promise<{
|
|
33
|
+
exitCode: number;
|
|
34
|
+
durationMs: number;
|
|
35
|
+
}>;
|
|
36
|
+
/** Persist a per-product verification entry to config. */
|
|
37
|
+
write(productId: string, entry: VerifyConfigEntry): void;
|
|
38
|
+
/** Emit a line to the operator. */
|
|
39
|
+
out(line: string): void;
|
|
40
|
+
}
|
|
41
|
+
/** Per-product outcome. */
|
|
42
|
+
export type VerifySetupOutcome = 'configured' | 'declined' | 'skipped';
|
|
43
|
+
/** IO surface for the prompt-only flow (no write) -- used by init, which
|
|
44
|
+
* attaches the entry to the product being built rather than writing a file. */
|
|
45
|
+
export type VerifyPromptIO = Omit<VerifySetupIO, 'write'>;
|
|
46
|
+
/**
|
|
47
|
+
* Result of prompting for one product's verification entry, decoupled from the
|
|
48
|
+
* write so both verify-setup (writes to an existing config) and init (attaches
|
|
49
|
+
* to a product being built) can consume it.
|
|
50
|
+
*/
|
|
51
|
+
export type VerifyPromptResult = {
|
|
52
|
+
kind: 'skip';
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'decline';
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'configure';
|
|
57
|
+
entry: ConfiguredVerifyEntry;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Size a timeout from an observed validation runtime: at least 2x the run, with
|
|
61
|
+
* a 5-minute floor, rounded up to whole seconds.
|
|
62
|
+
*/
|
|
63
|
+
export declare function sizeTimeoutFromRuntime(durationMs: number): number;
|
|
64
|
+
/**
|
|
65
|
+
* Prompt the operator for one product's verification entry: show a detected
|
|
66
|
+
* candidate, accept confirm/edit/skip/decline, optionally validate. Emits
|
|
67
|
+
* informational lines via io.out but performs NO write -- it returns the
|
|
68
|
+
* decision. Nothing is auto-adopted: a skip/empty answer returns `skip`; a
|
|
69
|
+
* non-zero validation exit returns `skip` unless the operator overrides.
|
|
70
|
+
*/
|
|
71
|
+
export declare function promptVerifyEntry(product: VerifySetupProduct, io: VerifyPromptIO): Promise<VerifyPromptResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Drive the guided setup for ONE product and PERSIST the decision. Returns what
|
|
74
|
+
* was decided. Never writes config without an explicit confirm/edit/decline; a
|
|
75
|
+
* skip (or empty answer) writes nothing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runVerifySetupForProduct(product: VerifySetupProduct, io: VerifySetupIO): Promise<VerifySetupOutcome>;
|
|
78
|
+
/**
|
|
79
|
+
* Walk every product through the guided setup. Returns the per-product outcomes
|
|
80
|
+
* in order.
|
|
81
|
+
*/
|
|
82
|
+
export declare function runVerifySetup(products: readonly VerifySetupProduct[], io: VerifySetupIO): Promise<VerifySetupOutcome[]>;
|
|
83
|
+
/** Run a verification command once in a repo, reporting exit code + runtime.
|
|
84
|
+
* Shared by the verify-setup CLI and the init wizard's validation step. */
|
|
85
|
+
export declare function runVerifyCommandOnce(command: string, repoPath: string): Promise<{
|
|
86
|
+
exitCode: number;
|
|
87
|
+
durationMs: number;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* CLI entry: load config, resolve its path, and walk each product through the
|
|
91
|
+
* guided setup with real readline + subprocess + config writer.
|
|
92
|
+
*/
|
|
93
|
+
export declare function runVerifySetupCommand(opts?: {
|
|
94
|
+
config?: string;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
//# sourceMappingURL=verify-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-setup.d.ts","sourceRoot":"","sources":["../../src/cli/verify-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,QAAa,CAAC;AAEtD,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,2EAA2E;IAC3E,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjG,0DAA0D;IAC1D,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzD,mCAAmC;IACnC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,2BAA2B;AAC3B,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvE;+EAC+E;AAC/E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SA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