@codyswann/lisa 2.294.0 → 2.295.1
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/dist/cli/gate-commands.d.ts +1 -3
- package/dist/cli/gate-commands.d.ts.map +1 -1
- package/dist/cli/gate-commands.js +0 -26
- package/dist/cli/gate-commands.js.map +1 -1
- package/dist/cli/index.d.ts +7 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +43 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/update-check.d.ts +0 -8
- package/dist/cli/update-check.d.ts.map +1 -1
- package/dist/cli/update-check.js +2 -4
- package/dist/cli/update-check.js.map +1 -1
- package/dist/core/project-config.d.ts +0 -3
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +40 -4
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +2 -28
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/sync/registry.d.ts.map +1 -1
- package/dist/sync/registry.js +6 -3
- package/dist/sync/registry.js.map +1 -1
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/rules/eager/config-resolution.md +0 -9
- package/plugins/lisa/rules/reference/config-resolution.md +0 -59
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/rules/eager/config-resolution.md +0 -9
- package/plugins/lisa-copilot/rules/reference/config-resolution.md +0 -59
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +0 -59
- package/plugins/lisa-cursor/rules/config-resolution.mdc +0 -9
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/rules/eager/config-resolution.md +0 -9
- package/plugins/src/base/rules/reference/config-resolution.md +0 -59
- package/dist/cli/deploy-status-adapter-github.d.ts +0 -20
- package/dist/cli/deploy-status-adapter-github.d.ts.map +0 -1
- package/dist/cli/deploy-status-adapter-github.js +0 -167
- package/dist/cli/deploy-status-adapter-github.js.map +0 -1
- package/dist/cli/deploy-status-adapter-jira.d.ts +0 -18
- package/dist/cli/deploy-status-adapter-jira.d.ts.map +0 -1
- package/dist/cli/deploy-status-adapter-jira.js +0 -215
- package/dist/cli/deploy-status-adapter-jira.js.map +0 -1
- package/dist/cli/deploy-status-adapter-linear.d.ts +0 -16
- package/dist/cli/deploy-status-adapter-linear.d.ts.map +0 -1
- package/dist/cli/deploy-status-adapter-linear.js +0 -204
- package/dist/cli/deploy-status-adapter-linear.js.map +0 -1
- package/dist/cli/deploy-status-adapter-shared.d.ts +0 -57
- package/dist/cli/deploy-status-adapter-shared.d.ts.map +0 -1
- package/dist/cli/deploy-status-adapter-shared.js +0 -62
- package/dist/cli/deploy-status-adapter-shared.js.map +0 -1
- package/dist/cli/deploy-status-adapter.d.ts +0 -49
- package/dist/cli/deploy-status-adapter.d.ts.map +0 -1
- package/dist/cli/deploy-status-adapter.js +0 -87
- package/dist/cli/deploy-status-adapter.js.map +0 -1
- package/dist/cli/deploy-status-refs.d.ts +0 -70
- package/dist/cli/deploy-status-refs.d.ts.map +0 -1
- package/dist/cli/deploy-status-refs.js +0 -195
- package/dist/cli/deploy-status-refs.js.map +0 -1
- package/dist/cli/deploy-status-sync-cmd.d.ts +0 -23
- package/dist/cli/deploy-status-sync-cmd.d.ts.map +0 -1
- package/dist/cli/deploy-status-sync-cmd.js +0 -75
- package/dist/cli/deploy-status-sync-cmd.js.map +0 -1
- package/dist/cli/deploy-status-sync-engine.d.ts +0 -49
- package/dist/cli/deploy-status-sync-engine.d.ts.map +0 -1
- package/dist/cli/deploy-status-sync-engine.js +0 -214
- package/dist/cli/deploy-status-sync-engine.js.map +0 -1
- package/dist/cli/deploy-status-sync-exec.d.ts +0 -73
- package/dist/cli/deploy-status-sync-exec.d.ts.map +0 -1
- package/dist/cli/deploy-status-sync-exec.js +0 -95
- package/dist/cli/deploy-status-sync-exec.js.map +0 -1
- package/dist/cli/kane-commands.d.ts +0 -21
- package/dist/cli/kane-commands.d.ts.map +0 -1
- package/dist/cli/kane-commands.js +0 -44
- package/dist/cli/kane-commands.js.map +0 -1
- package/dist/core/config-field-validation.d.ts +0 -19
- package/dist/core/config-field-validation.d.ts.map +0 -1
- package/dist/core/config-field-validation.js +0 -69
- package/dist/core/config-field-validation.js.map +0 -1
- package/dist/core/deploy-status-sync.d.ts +0 -103
- package/dist/core/deploy-status-sync.d.ts.map +0 -1
- package/dist/core/deploy-status-sync.js +0 -339
- package/dist/core/deploy-status-sync.js.map +0 -1
- package/dist/core/deploy-status-transition.d.ts +0 -97
- package/dist/core/deploy-status-transition.d.ts.map +0 -1
- package/dist/core/deploy-status-transition.js +0 -134
- package/dist/core/deploy-status-transition.js.map +0 -1
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deploy-status-sync engine internals (DSS-2): context resolution, ref
|
|
3
|
-
* extraction scoping, state fetching, and plan execution. The thin
|
|
4
|
-
* `deploy-status-sync-cmd` entry point validates CLI inputs and delegates
|
|
5
|
-
* here; tests drive the same seams through injectable dependencies.
|
|
6
|
-
* @module cli/deploy-status-sync-engine
|
|
7
|
-
*/
|
|
8
|
-
import { readFile } from "node:fs/promises";
|
|
9
|
-
import * as path from "node:path";
|
|
10
|
-
import { resolveDeployLadder, } from "../core/deploy-status-sync.js";
|
|
11
|
-
import { planTransitions } from "../core/deploy-status-transition.js";
|
|
12
|
-
import { getAtPath, isJsonObject } from "../sync/json-path.js";
|
|
13
|
-
import { createTrackerAdapter, withDryRun, } from "./deploy-status-adapter.js";
|
|
14
|
-
import { extractWorkItemRefs, } from "./deploy-status-refs.js";
|
|
15
|
-
import { emitNoOp, executePlan, fetchStates, } from "./deploy-status-sync-exec.js";
|
|
16
|
-
const VALID_TRACKERS = new Set(["github", "jira", "linear"]);
|
|
17
|
-
/**
|
|
18
|
-
* Resolve the target environment from an explicit flag or the deployed
|
|
19
|
-
* branch via the ladder (raw `deploy.branches` catches skipped rungs so the
|
|
20
|
-
* planner can explain the missing done-map key).
|
|
21
|
-
* @param options - CLI options
|
|
22
|
-
* @param ladder - Resolved deploy ladder
|
|
23
|
-
* @param config - Parsed config
|
|
24
|
-
* @returns The environment name, or an error message
|
|
25
|
-
*/
|
|
26
|
-
function resolveEnvironment(options, ladder, config) {
|
|
27
|
-
if (options.environment !== undefined)
|
|
28
|
-
return { env: options.environment };
|
|
29
|
-
const branch = options.branch ?? "";
|
|
30
|
-
const matching = ladder.rungs.filter(rung => rung.branch === branch);
|
|
31
|
-
const envs = [...new Set(matching.map(rung => rung.env))];
|
|
32
|
-
if (envs.length === 1 && envs[0] !== undefined)
|
|
33
|
-
return { env: envs[0] };
|
|
34
|
-
if (envs.length > 1) {
|
|
35
|
-
return {
|
|
36
|
-
problem: `Branch "${branch}" deploys to multiple environments (${envs.join(", ")}); pass --environment to disambiguate.`,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const branches = getAtPath(config, "deploy.branches");
|
|
40
|
-
const rawEnvs = isJsonObject(branches)
|
|
41
|
-
? Object.keys(branches).filter(env => branches[env] === branch)
|
|
42
|
-
: [];
|
|
43
|
-
if (rawEnvs.length === 1 && rawEnvs[0] !== undefined) {
|
|
44
|
-
return { env: rawEnvs[0] };
|
|
45
|
-
}
|
|
46
|
-
if (rawEnvs.length > 1) {
|
|
47
|
-
// Name ALL candidates — silently picking the first would report a
|
|
48
|
-
// misleading no-op for an env the operator never meant.
|
|
49
|
-
return {
|
|
50
|
-
problem: `Branch "${branch}" deploys to multiple environments (${rawEnvs.join(", ")}); pass --environment to disambiguate.`,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
problem: `Branch "${branch}" is not a value of deploy.branches in .lisa.config.json.`,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Read the config and resolve the tracker, ladder, and environment.
|
|
59
|
-
* @param options - CLI options
|
|
60
|
-
* @param cwd - Working directory
|
|
61
|
-
* @returns Run context, or a decision-ready problem
|
|
62
|
-
*/
|
|
63
|
-
export async function resolveRunContext(options, cwd) {
|
|
64
|
-
const configPath = path.resolve(cwd, options.config ?? ".lisa.config.json");
|
|
65
|
-
const config = JSON.parse(await readFile(configPath, "utf8"));
|
|
66
|
-
const tracker = getAtPath(config, "tracker");
|
|
67
|
-
if (typeof tracker !== "string" || !VALID_TRACKERS.has(tracker)) {
|
|
68
|
-
return {
|
|
69
|
-
problem: "'tracker' is not set in .lisa.config.json. Run /lisa:setup:jira (or :github, :linear) to configure.",
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const ladder = resolveDeployLadder(config, tracker, configPath);
|
|
73
|
-
const resolvedEnv = resolveEnvironment(options, ladder, config);
|
|
74
|
-
if ("problem" in resolvedEnv)
|
|
75
|
-
return resolvedEnv;
|
|
76
|
-
const env = resolvedEnv.env;
|
|
77
|
-
return {
|
|
78
|
-
config,
|
|
79
|
-
tracker: tracker,
|
|
80
|
-
ladder,
|
|
81
|
-
env,
|
|
82
|
-
branch: options.branch ??
|
|
83
|
-
ladder.rungs.find(rung => rung.env === env)?.branch ??
|
|
84
|
-
env,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Extract the work-item refs for the run's tracker scope.
|
|
89
|
-
* @param context - Resolved run context
|
|
90
|
-
* @param range - Normalized commit range
|
|
91
|
-
* @param cwd - Working directory
|
|
92
|
-
* @param deps - Injectable collaborators
|
|
93
|
-
* @returns Extraction result
|
|
94
|
-
*/
|
|
95
|
-
function extractRefsForRun(context, range, cwd, deps) {
|
|
96
|
-
const org = getAtPath(context.config, "github.org");
|
|
97
|
-
const repo = getAtPath(context.config, "github.repo");
|
|
98
|
-
const repository = typeof org === "string" && typeof repo === "string"
|
|
99
|
-
? `${org}/${repo}`
|
|
100
|
-
: undefined;
|
|
101
|
-
const projectKey = getAtPath(context.config, context.tracker === "jira" ? "jira.project" : "linear.teamKey");
|
|
102
|
-
return (deps.extractRefs ?? extractWorkItemRefs)({
|
|
103
|
-
range,
|
|
104
|
-
tracker: context.tracker,
|
|
105
|
-
...(repository === undefined ? {} : { repository }),
|
|
106
|
-
...(typeof projectKey === "string" ? { projectKey } : {}),
|
|
107
|
-
cwd,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Fetch states, plan, and execute for the extracted refs.
|
|
112
|
-
* @param context - Resolved run context
|
|
113
|
-
* @param extracted - Extraction result
|
|
114
|
-
* @param options - CLI options
|
|
115
|
-
* @param deps - Injectable collaborators
|
|
116
|
-
* @param sinks - Output sinks
|
|
117
|
-
* @returns Intended process exit code
|
|
118
|
-
*/
|
|
119
|
-
async function runPlanned(context, extracted, options, deps, sinks) {
|
|
120
|
-
const base = (deps.adapterFactory ?? createTrackerAdapter)({
|
|
121
|
-
tracker: context.tracker,
|
|
122
|
-
config: context.config,
|
|
123
|
-
doneStatuses: context.ladder.rungs.map(rung => rung.doneStatus),
|
|
124
|
-
cwd: deps.cwd ?? process.cwd(),
|
|
125
|
-
});
|
|
126
|
-
const adapter = options.dryRun === true
|
|
127
|
-
? withDryRun(base, write => {
|
|
128
|
-
sinks.human(`dry-run: would ${write.method} ${write.ref}`);
|
|
129
|
-
})
|
|
130
|
-
: base;
|
|
131
|
-
const fetched = await fetchStates(extracted.refs, adapter);
|
|
132
|
-
const plan = planTransitions({
|
|
133
|
-
ladder: context.ladder,
|
|
134
|
-
env: context.env,
|
|
135
|
-
tracker: context.tracker,
|
|
136
|
-
branch: context.branch,
|
|
137
|
-
headSha: extracted.headSha,
|
|
138
|
-
items: fetched.items,
|
|
139
|
-
});
|
|
140
|
-
// The if-guard is load-bearing for code-organization/enforce-statement-
|
|
141
|
-
// order: `if` statements are exempt from the definitions-before-side-
|
|
142
|
-
// effects ordering, a bare forEach here is not.
|
|
143
|
-
if (fetched.failures.length > 0) {
|
|
144
|
-
fetched.failures.forEach(failure => {
|
|
145
|
-
sinks.error(`failed ${failure.ref}: ${failure.detail ?? ""}`);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
if (plan.kind === "no-op") {
|
|
149
|
-
emitNoOp(sinks, options, plan);
|
|
150
|
-
return fetched.failures.length > 0 ? 1 : 0;
|
|
151
|
-
}
|
|
152
|
-
const results = await executePlan(plan, adapter, sinks);
|
|
153
|
-
const allResults = [...fetched.failures, ...results];
|
|
154
|
-
if (options.json === true) {
|
|
155
|
-
sinks.log(JSON.stringify({ env: context.env, plan, results: allResults }, null, 2));
|
|
156
|
-
}
|
|
157
|
-
sinks.human(`deploy-status-sync: ${String(allResults.length)} item(s) processed for ${context.env}${options.dryRun === true ? " (dry-run)" : ""}`);
|
|
158
|
-
return allResults.some(result => result.outcome === "failed") ? 1 : 0;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Run the engine over a resolved context: preflight the environment (an
|
|
162
|
-
* unconfigured env is an explanatory no-op, exit 0), extract refs, then
|
|
163
|
-
* fetch/plan/execute.
|
|
164
|
-
* @param context - Resolved run context
|
|
165
|
-
* @param range - Normalized commit range
|
|
166
|
-
* @param options - CLI options
|
|
167
|
-
* @param deps - Injectable collaborators
|
|
168
|
-
* @param sinks - Output sinks
|
|
169
|
-
* @returns Intended process exit code
|
|
170
|
-
*/
|
|
171
|
-
export async function runResolved(context, range, options, deps, sinks) {
|
|
172
|
-
const preflight = planTransitions({
|
|
173
|
-
ladder: context.ladder,
|
|
174
|
-
env: context.env,
|
|
175
|
-
tracker: context.tracker,
|
|
176
|
-
branch: context.branch,
|
|
177
|
-
headSha: "",
|
|
178
|
-
items: [],
|
|
179
|
-
});
|
|
180
|
-
if (preflight.kind === "no-op") {
|
|
181
|
-
emitNoOp(sinks, options, preflight);
|
|
182
|
-
return 0;
|
|
183
|
-
}
|
|
184
|
-
const extracted = await extractRefsForRun(context, range, deps.cwd ?? process.cwd(), deps);
|
|
185
|
-
extracted.skipped.forEach(entry => {
|
|
186
|
-
// Skipped tokens come from untrusted commit messages and PR bodies —
|
|
187
|
-
// strip control characters (incl. ANSI escapes) AND Unicode bidi/
|
|
188
|
-
// formatting controls (Trojan-Source-style reordering: LRM/RLM,
|
|
189
|
-
// embeddings/overrides U+202A-E, isolates U+2066-9) before echoing so a
|
|
190
|
-
// crafted token cannot manipulate the operator's terminal.
|
|
191
|
-
const printable = [...entry.token]
|
|
192
|
-
.filter(character => {
|
|
193
|
-
const code = character.codePointAt(0) ?? 0;
|
|
194
|
-
const isControl = code < 0x20 || code === 0x7f || (code >= 0x80 && code <= 0x9f);
|
|
195
|
-
const isBidi = code === 0x20_0e ||
|
|
196
|
-
code === 0x20_0f ||
|
|
197
|
-
(code >= 0x20_2a && code <= 0x20_2e) ||
|
|
198
|
-
(code >= 0x20_66 && code <= 0x20_69);
|
|
199
|
-
return !isControl && !isBidi;
|
|
200
|
-
})
|
|
201
|
-
.join("");
|
|
202
|
-
sinks.human(`skipped token ${printable} (${entry.reason})`);
|
|
203
|
-
});
|
|
204
|
-
if (extracted.refs.length === 0) {
|
|
205
|
-
emitNoOp(sinks, options, {
|
|
206
|
-
kind: "no-op",
|
|
207
|
-
env: context.env,
|
|
208
|
-
reason: `no work-item refs found in ${range}`,
|
|
209
|
-
});
|
|
210
|
-
return 0;
|
|
211
|
-
}
|
|
212
|
-
return runPlanned(context, extracted, options, deps, sinks);
|
|
213
|
-
}
|
|
214
|
-
//# sourceMappingURL=deploy-status-sync-engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-status-sync-engine.js","sourceRoot":"","sources":["../../src/cli/deploy-status-sync-engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,mBAAmB,GAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,UAAU,GAGX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,GAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,WAAW,GAGZ,MAAM,8BAA8B,CAAC;AAgCtC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAErE;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,OAAgC,EAChC,MAAoB,EACpB,MAAiB;IAEjB,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;Q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K,EAAE,OAAO,EAAE;YACvB,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,MAAM,EAAE,8BAA8B,KAAK,EAAE;SAC9C,CAAC,CAAC;QACH,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution layer for the deploy-status-sync engine (DSS-2): per-item state
|
|
3
|
-
* fetching, planned-action execution, and no-op reporting. Split from
|
|
4
|
-
* `deploy-status-sync-engine` so the context/orchestration and the
|
|
5
|
-
* write-execution concerns each stay within the max-lines budget; the
|
|
6
|
-
* engine composes these pieces and owns the run lifecycle.
|
|
7
|
-
* @module cli/deploy-status-sync-exec
|
|
8
|
-
*/
|
|
9
|
-
import type { TrackerItemState, TransitionPlan } from "../core/deploy-status-transition.js";
|
|
10
|
-
import type { TrackerAdapter } from "./deploy-status-adapter.js";
|
|
11
|
-
/** CLI options for the deploy-status-sync engine. */
|
|
12
|
-
export interface DeployStatusSyncOptions {
|
|
13
|
-
/** Environment the deploy landed in (exclusive with `branch`) */
|
|
14
|
-
readonly environment?: string;
|
|
15
|
-
/** Deployed branch, reverse-mapped to an env (exclusive with `environment`) */
|
|
16
|
-
readonly branch?: string;
|
|
17
|
-
/** Commit range as `base..head` */
|
|
18
|
-
readonly range?: string;
|
|
19
|
-
/** Range base SHA (used with `after`) */
|
|
20
|
-
readonly before?: string;
|
|
21
|
-
/** Range head SHA (used with `before`) */
|
|
22
|
-
readonly after?: string;
|
|
23
|
-
/** Plan and print without any tracker writes */
|
|
24
|
-
readonly dryRun?: boolean;
|
|
25
|
-
/** Emit the machine-readable plan/result JSON */
|
|
26
|
-
readonly json?: boolean;
|
|
27
|
-
/** Config path (default `.lisa.config.json` in the working directory) */
|
|
28
|
-
readonly config?: string;
|
|
29
|
-
}
|
|
30
|
-
/** Output sinks bound to the run's json mode. */
|
|
31
|
-
export interface Sinks {
|
|
32
|
-
readonly log: (message: string) => void;
|
|
33
|
-
readonly error: (message: string) => void;
|
|
34
|
-
readonly human: (message: string) => void;
|
|
35
|
-
}
|
|
36
|
-
/** One executed (or attempted) item outcome. */
|
|
37
|
-
export interface ItemResult {
|
|
38
|
-
readonly ref: string;
|
|
39
|
-
readonly outcome: "promoted" | "skipped-at-or-beyond" | "skipped-container" | "skipped-unrecognized-status" | "failed";
|
|
40
|
-
readonly detail?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Fetch item states, tolerating per-item failures.
|
|
44
|
-
* @param refs - Canonical refs
|
|
45
|
-
* @param adapter - Tracker adapter
|
|
46
|
-
* @returns Fetched states and per-ref failures
|
|
47
|
-
*/
|
|
48
|
-
export declare function fetchStates(refs: readonly string[], adapter: TrackerAdapter): Promise<{
|
|
49
|
-
readonly items: readonly TrackerItemState[];
|
|
50
|
-
readonly failures: readonly ItemResult[];
|
|
51
|
-
}>;
|
|
52
|
-
/**
|
|
53
|
-
* Execute the planned actions, tolerating per-item failures.
|
|
54
|
-
* @param plan - Per-item action plan
|
|
55
|
-
* @param adapter - Tracker adapter (possibly dry-run wrapped)
|
|
56
|
-
* @param sinks - Output sinks
|
|
57
|
-
* @returns Item results including failures
|
|
58
|
-
*/
|
|
59
|
-
export declare function executePlan(plan: Extract<TransitionPlan, {
|
|
60
|
-
kind: "plan";
|
|
61
|
-
}>, adapter: TrackerAdapter, sinks: Sinks): Promise<readonly ItemResult[]>;
|
|
62
|
-
/**
|
|
63
|
-
* Report an explanatory no-op on both channels: the human line always, plus
|
|
64
|
-
* the machine payload in json mode — json consumers must receive parseable
|
|
65
|
-
* output on EVERY exit path, not only when a plan executed.
|
|
66
|
-
* @param sinks - Output sinks
|
|
67
|
-
* @param options - CLI options (json mode)
|
|
68
|
-
* @param plan - The no-op plan
|
|
69
|
-
*/
|
|
70
|
-
export declare function emitNoOp(sinks: Sinks, options: DeployStatusSyncOptions, plan: Extract<TransitionPlan, {
|
|
71
|
-
kind: "no-op";
|
|
72
|
-
}>): void;
|
|
73
|
-
//# sourceMappingURL=deploy-status-sync-exec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-status-sync-exec.d.ts","sourceRoot":"","sources":["../../src/cli/deploy-status-sync-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qDAAqD;AACrD,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,iDAAiD;AACjD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EACZ,UAAU,GACV,sBAAsB,GACtB,mBAAmB,GACnB,6BAA6B,GAC7B,QAAQ,CAAC;IACb,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC;IACT,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;CAC1C,CAAC,CA0BD;AAwCD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAYhC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/C,IAAI,CAKN"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch item states, tolerating per-item failures.
|
|
3
|
-
* @param refs - Canonical refs
|
|
4
|
-
* @param adapter - Tracker adapter
|
|
5
|
-
* @returns Fetched states and per-ref failures
|
|
6
|
-
*/
|
|
7
|
-
export async function fetchStates(refs, adapter) {
|
|
8
|
-
const settled = await Promise.all(refs.map(async (ref) => {
|
|
9
|
-
try {
|
|
10
|
-
return {
|
|
11
|
-
kind: "ok",
|
|
12
|
-
state: await adapter.fetchItemState(ref),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
catch (cause) {
|
|
16
|
-
return {
|
|
17
|
-
kind: "failed",
|
|
18
|
-
failure: {
|
|
19
|
-
ref,
|
|
20
|
-
outcome: "failed",
|
|
21
|
-
detail: cause instanceof Error ? cause.message : String(cause),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
|
-
return {
|
|
27
|
-
items: settled.flatMap(entry => (entry.kind === "ok" ? [entry.state] : [])),
|
|
28
|
-
failures: settled.flatMap(entry => entry.kind === "failed" ? [entry.failure] : []),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Execute one planned action through the adapter.
|
|
33
|
-
* @param action - Planned item action
|
|
34
|
-
* @param adapter - Tracker adapter (possibly dry-run wrapped)
|
|
35
|
-
* @param log - Output sink
|
|
36
|
-
* @returns The item outcome
|
|
37
|
-
*/
|
|
38
|
-
async function executeAction(action, adapter, log) {
|
|
39
|
-
if (action.kind === "promote") {
|
|
40
|
-
// Comment FIRST: the upsert is idempotent (byte-identical body →
|
|
41
|
-
// `unchanged`), so any partial-failure prefix — comment ok + transition
|
|
42
|
-
// failed, or transition ok + close failed — heals on retry. Transition
|
|
43
|
-
// or closure first would strand evidence-less state changes.
|
|
44
|
-
await adapter.upsertManagedComment(action.ref, action.commentBody);
|
|
45
|
-
await adapter.transitionToDone(action.ref, action.doneStatus);
|
|
46
|
-
if (action.close)
|
|
47
|
-
await adapter.closeNatively(action.ref);
|
|
48
|
-
log(`promoted ${action.ref} → ${action.doneStatus}${action.close ? " (closed natively)" : ""}`);
|
|
49
|
-
return { ref: action.ref, outcome: "promoted", detail: action.doneStatus };
|
|
50
|
-
}
|
|
51
|
-
if (action.kind === "skip-container") {
|
|
52
|
-
await adapter.upsertManagedComment(action.ref, action.commentBody);
|
|
53
|
-
log(`skipped ${action.ref} (container, leaf-only-lifecycle)`);
|
|
54
|
-
return { ref: action.ref, outcome: "skipped-container" };
|
|
55
|
-
}
|
|
56
|
-
const outcome = action.kind === "skip-at-or-beyond"
|
|
57
|
-
? "skipped-at-or-beyond"
|
|
58
|
-
: "skipped-unrecognized-status";
|
|
59
|
-
log(`skipped ${action.ref} (${action.reason})`);
|
|
60
|
-
return { ref: action.ref, outcome, detail: action.reason };
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Execute the planned actions, tolerating per-item failures.
|
|
64
|
-
* @param plan - Per-item action plan
|
|
65
|
-
* @param adapter - Tracker adapter (possibly dry-run wrapped)
|
|
66
|
-
* @param sinks - Output sinks
|
|
67
|
-
* @returns Item results including failures
|
|
68
|
-
*/
|
|
69
|
-
export async function executePlan(plan, adapter, sinks) {
|
|
70
|
-
return Promise.all(plan.actions.map(async (action) => {
|
|
71
|
-
try {
|
|
72
|
-
return await executeAction(action, adapter, sinks.human);
|
|
73
|
-
}
|
|
74
|
-
catch (cause) {
|
|
75
|
-
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
76
|
-
sinks.error(`failed ${action.ref}: ${detail}`);
|
|
77
|
-
return { ref: action.ref, outcome: "failed", detail };
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Report an explanatory no-op on both channels: the human line always, plus
|
|
83
|
-
* the machine payload in json mode — json consumers must receive parseable
|
|
84
|
-
* output on EVERY exit path, not only when a plan executed.
|
|
85
|
-
* @param sinks - Output sinks
|
|
86
|
-
* @param options - CLI options (json mode)
|
|
87
|
-
* @param plan - The no-op plan
|
|
88
|
-
*/
|
|
89
|
-
export function emitNoOp(sinks, options, plan) {
|
|
90
|
-
sinks.human(plan.reason);
|
|
91
|
-
if (options.json === true) {
|
|
92
|
-
sinks.log(JSON.stringify({ env: plan.env, plan, results: [] }, null, 2));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=deploy-status-sync-exec.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
|
|
2
|
-
* Registrar for the optional Kane provider command group, extracted from the
|
|
3
|
-
* CLI index to keep that module within its size budget (mirrors the
|
|
4
|
-
* gate-commands registrar pattern).
|
|
5
|
-
* @module cli/kane-commands
|
|
6
|
-
*/
|
|
7
|
-
import type { Command } from "commander";
|
|
8
|
-
import type { KaneRunOptions } from "./kane-cmd.js";
|
|
9
|
-
/** Kane runners kept structural to avoid importing the CLI dependency record. */
|
|
10
|
-
export interface KaneCommandDependencies {
|
|
11
|
-
runKaneCli: (targetPath: string | undefined, options: KaneRunOptions) => Promise<void>;
|
|
12
|
-
runKaneProbeCli: (targetPath: string | undefined, json: boolean) => Promise<void>;
|
|
13
|
-
runKanePilotCli: (manifest: string, reportOnly: boolean) => Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Register the optional Kane provider command group.
|
|
17
|
-
* @param program - Commander program to mutate
|
|
18
|
-
* @param deps - Program dependencies
|
|
19
|
-
*/
|
|
20
|
-
export declare function addKaneCommands(program: Command, deps: KaneCommandDependencies): void;
|
|
21
|
-
//# sourceMappingURL=kane-commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kane-commands.d.ts","sourceRoot":"","sources":["../../src/cli/kane-commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,CACV,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,EAAE,CACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,IAAI,EAAE,OAAO,KACV,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,uBAAuB,GAC5B,IAAI,CAiDN"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const PATH_ARG_DESCRIPTION = "Project path (default: current directory)";
|
|
2
|
-
/**
|
|
3
|
-
* Register the optional Kane provider command group.
|
|
4
|
-
* @param program - Commander program to mutate
|
|
5
|
-
* @param deps - Program dependencies
|
|
6
|
-
*/
|
|
7
|
-
export function addKaneCommands(program, deps) {
|
|
8
|
-
const kane = program
|
|
9
|
-
.command("kane")
|
|
10
|
-
.description("Use Lisa's guarded optional Kane CLI browser provider");
|
|
11
|
-
kane
|
|
12
|
-
.command("probe")
|
|
13
|
-
.description("Check Kane installation, auth, target, and AI-credit availability")
|
|
14
|
-
.argument("[path]", PATH_ARG_DESCRIPTION)
|
|
15
|
-
.option("--json", "Emit JSON")
|
|
16
|
-
.action(async (targetPath, options) => {
|
|
17
|
-
await deps.runKaneProbeCli(targetPath, options.json === true);
|
|
18
|
-
});
|
|
19
|
-
kane
|
|
20
|
-
.command("run")
|
|
21
|
-
.description("Run one empirical browser objective through Lisa's safety gate")
|
|
22
|
-
.argument("[path]", PATH_ARG_DESCRIPTION)
|
|
23
|
-
.requiredOption("--objective <text>", "Self-contained browser objective")
|
|
24
|
-
.requiredOption("--environment <name>", "Lisa exploration environment")
|
|
25
|
-
.requiredOption("--mutation <level>", "Resolved Lisa mutation policy (forbidden | read-only | full)")
|
|
26
|
-
.option("--url <url>", "Starting URL")
|
|
27
|
-
.option("--max-steps <count>", "Kane reasoning-step limit")
|
|
28
|
-
.option("--json", "Emit Lisa's normalized JSON result")
|
|
29
|
-
.action(async (targetPath, options) => {
|
|
30
|
-
if (!["forbidden", "read-only", "full"].includes(options.mutation)) {
|
|
31
|
-
throw new Error("--mutation must be forbidden, read-only, or full");
|
|
32
|
-
}
|
|
33
|
-
await deps.runKaneCli(targetPath, options);
|
|
34
|
-
});
|
|
35
|
-
kane
|
|
36
|
-
.command("pilot")
|
|
37
|
-
.description("Execute or report the 30-day multi-application Kane pilot")
|
|
38
|
-
.argument("<manifest>", "Path to the Kane pilot JSON manifest")
|
|
39
|
-
.option("--report-only", "Read existing JSONL results without executing")
|
|
40
|
-
.action(async (manifest, options) => {
|
|
41
|
-
await deps.runKanePilotCli(manifest, options.reportOnly === true);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=kane-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kane-commands.js","sourceRoot":"","sources":["../../src/cli/kane-commands.ts"],"names":[],"mappings":"AAsBA,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,IAA6B;IAE7B,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,uDAAuD,CAAC,CAAC;IACxE,IAAI;SACD,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CACV,mEAAmE,CACpE;SACA,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;SACxC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC;SAC7B,MAAM,CACL,KAAK,EAAE,UAA8B,EAAE,OAA2B,EAAE,EAAE;QACpE,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAChE,CAAC,CACF,CAAC;IACJ,IAAI;SACD,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CACV,gEAAgE,CACjE;SACA,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;SACxC,cAAc,CAAC,oBAAoB,EAAE,kCAAkC,CAAC;SACxE,cAAc,CAAC,sBAAsB,EAAE,8BAA8B,CAAC;SACtE,cAAc,CACb,oBAAoB,EACpB,8DAA8D,CAC/D;SACA,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC;SACrC,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,CAAC;SAC1D,MAAM,CAAC,QAAQ,EAAE,oCAAoC,CAAC;SACtD,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,OAAuB,EAAE,EAAE;QACxE,IACE,CAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAW,CAAC,QAAQ,CACrD,OAAO,CAAC,QAAQ,CACjB,EACD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IACL,IAAI;SACD,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,2DAA2D,CAAC;SACxE,QAAQ,CAAC,YAAY,EAAE,sCAAsC,CAAC;SAC9D,MAAM,CAAC,eAAe,EAAE,+CAA+C,CAAC;SACxE,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,OAAiC,EAAE,EAAE;QACpE,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validate an optional non-empty trimmed string field.
|
|
3
|
-
* @param value - Untrusted field value
|
|
4
|
-
* @param source - Config source shown in errors
|
|
5
|
-
* @param field - Dotted field name
|
|
6
|
-
* @returns Valid string or undefined
|
|
7
|
-
*/
|
|
8
|
-
export declare function optionalString(value: unknown, source: string, field: string): string | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Validate a configurable destination as a safe, relative, non-traversing
|
|
11
|
-
* Markdown path. Shared by every path-typed config field; the `field` label is
|
|
12
|
-
* interpolated into each diagnostic so callers get a field-specific message.
|
|
13
|
-
* @param value - Raw configured path
|
|
14
|
-
* @param source - Config source for errors
|
|
15
|
-
* @param field - Config field name used in error messages
|
|
16
|
-
* @returns Validated project-relative path
|
|
17
|
-
*/
|
|
18
|
-
export declare function validateSafeRelativeMarkdownPath(value: unknown, source: string, field: string): string;
|
|
19
|
-
//# sourceMappingURL=config-field-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-field-validation.d.ts","sourceRoot":"","sources":["../../src/core/config-field-validation.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAapB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CA6BR"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared validation for `.lisa.config.json` field values.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `project-config.ts` so path-typed destinations
|
|
5
|
-
* (`projectRulesFile`, `learnings.file`, …) and string-typed section fields
|
|
6
|
-
* (`deployStatusSync.*`) funnel through the same hardened checks without
|
|
7
|
-
* growing the config module.
|
|
8
|
-
* @module core/config-field-validation
|
|
9
|
-
*/
|
|
10
|
-
import * as path from "node:path";
|
|
11
|
-
/**
|
|
12
|
-
* Whether a path contains an ASCII control character.
|
|
13
|
-
* @param value - Configured path
|
|
14
|
-
* @returns True when any control character is present
|
|
15
|
-
*/
|
|
16
|
-
function containsControlCharacter(value) {
|
|
17
|
-
return Array.from(value).some(character => {
|
|
18
|
-
const code = character.charCodeAt(0);
|
|
19
|
-
return code <= 31 || code === 127;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Validate an optional non-empty trimmed string field.
|
|
24
|
-
* @param value - Untrusted field value
|
|
25
|
-
* @param source - Config source shown in errors
|
|
26
|
-
* @param field - Dotted field name
|
|
27
|
-
* @returns Valid string or undefined
|
|
28
|
-
*/
|
|
29
|
-
export function optionalString(value, source, field) {
|
|
30
|
-
if (value === undefined)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (typeof value !== "string" ||
|
|
33
|
-
value.trim() !== value ||
|
|
34
|
-
value.length === 0 ||
|
|
35
|
-
containsControlCharacter(value)) {
|
|
36
|
-
throw new Error(`Invalid ${field} in ${source}: expected a non-empty string`);
|
|
37
|
-
}
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Validate a configurable destination as a safe, relative, non-traversing
|
|
42
|
-
* Markdown path. Shared by every path-typed config field; the `field` label is
|
|
43
|
-
* interpolated into each diagnostic so callers get a field-specific message.
|
|
44
|
-
* @param value - Raw configured path
|
|
45
|
-
* @param source - Config source for errors
|
|
46
|
-
* @param field - Config field name used in error messages
|
|
47
|
-
* @returns Validated project-relative path
|
|
48
|
-
*/
|
|
49
|
-
export function validateSafeRelativeMarkdownPath(value, source, field) {
|
|
50
|
-
if (typeof value !== "string" ||
|
|
51
|
-
value.length === 0 ||
|
|
52
|
-
value.trim() !== value ||
|
|
53
|
-
value.includes("\\") ||
|
|
54
|
-
containsControlCharacter(value) ||
|
|
55
|
-
/^[a-z]:/iu.test(value) ||
|
|
56
|
-
path.posix.isAbsolute(value) ||
|
|
57
|
-
path.win32.isAbsolute(value)) {
|
|
58
|
-
throw new Error(`Invalid ${field} in ${source}: expected a safe relative POSIX path`);
|
|
59
|
-
}
|
|
60
|
-
const segments = value.split("/");
|
|
61
|
-
if (segments.some(segment => segment === "" || segment === "." || segment === "..")) {
|
|
62
|
-
throw new Error(`Invalid ${field} in ${source}: path traversal is not allowed`);
|
|
63
|
-
}
|
|
64
|
-
if (path.posix.extname(value).toLowerCase() !== ".md") {
|
|
65
|
-
throw new Error(`Invalid ${field} in ${source}: expected a Markdown file`);
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=config-field-validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-field-validation.js","sourceRoot":"","sources":["../../src/core/config-field-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,KAAa;IAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QACxC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,KAAK,GAAG,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAc,EACd,MAAc,EACd,KAAa;IAEb,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK;QACtB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,wBAAwB,CAAC,KAAK,CAAC,EAC/B,CAAC;QACD,MAAM,IAAI,KAAK,CACb,WAAW,KAAK,OAAO,MAAM,+BAA+B,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAc,EACd,MAAc,EACd,KAAa;IAEb,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK;QACtB,KAAK,CAAC,QAA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