@codyswann/lisa 4.90.2 → 4.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +19 -2
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/package.json +4 -4
  6. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa-agy/plugin.json +1 -1
  9. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  10. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  11. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  12. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  13. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  14. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  15. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  16. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  19. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  20. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  22. package/plugins/lisa-expo-agy/plugin.json +1 -1
  23. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  27. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  29. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  30. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  34. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  36. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  37. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  41. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  43. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  44. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  48. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  50. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  51. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  55. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-rails-agy/plugin.json +1 -1
  58. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  62. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  65. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  69. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  71. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  72. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  76. package/scripts/lisa-commit-and-pr-local.sh +14 -1
  77. package/scripts/lisa-update-local.sh +14 -1
  78. package/scripts/lisa-update-projects-plan.mjs +297 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "Distributable LLM Wiki kernel — ingest, query, lint, and maintain a git-native markdown knowledge base across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.90.2",
3
+ "version": "4.91.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -9,6 +9,9 @@
9
9
  # Intended to run after `lisa-update-local.sh` has applied Lisa templates
10
10
  # to all local projects, so each project's changes get their own PR.
11
11
  #
12
+ # Not canary-gated: every listed project gets a PR. The lisa-update-projects
13
+ # skill is the canary-first, gated rollout path (CodySwannGT/lisa#4604).
14
+ #
12
15
  # Usage:
13
16
  # ./scripts/lisa-commit-and-pr-local.sh [--dry-run]
14
17
  #
@@ -87,6 +90,16 @@ if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
87
90
  exit 1
88
91
  fi
89
92
 
93
+ # A value is either the legacy branch string or the canary-first object form
94
+ # { "branch": "<target branch>", "canary": true } (CodySwannGT/lisa#4604).
95
+ # Validated up front: the loop reads it through process substitution, whose
96
+ # exit status `set -e` ignores, so a bad entry would otherwise be skipped.
97
+ WORKSPACE_ENTRIES_JQ='to_entries[] | .key as $k | (.value | if type == "object" then .branch else . end) as $raw | (if ($raw | type) == "string" and ($raw | length) > 0 then $raw else error("entry \($k) has no valid branch (expected a non-empty string)") end) as $b | "\($k)\t\($b)"'
98
+ if ! jq -r "$WORKSPACE_ENTRIES_JQ" "$CONFIG_FILE" >/dev/null; then
99
+ log_error "Invalid workspace entry in $CONFIG_FILE"
100
+ exit 1
101
+ fi
102
+
90
103
  # Check GitHub CLI authentication (skip in dry-run since we won't use it)
91
104
  if [[ "$DRY_RUN" == false ]]; then
92
105
  log_info "Checking GitHub CLI authentication..."
@@ -204,7 +217,7 @@ while IFS=$'\t' read -r project_path target_branch; do
204
217
  log_success "PR created for $project_path"
205
218
  ((success_count++)) || true
206
219
 
207
- done < <(jq -r 'to_entries[] | "\(.key)\t\(.value)"' "$CONFIG_FILE")
220
+ done < <(jq -r "$WORKSPACE_ENTRIES_JQ" "$CONFIG_FILE")
208
221
 
209
222
  # Summary
210
223
  echo ""
@@ -10,6 +10,9 @@
10
10
  # This enables batch-updating all locally managed projects in a single command
11
11
  # rather than manually visiting each project directory.
12
12
  #
13
+ # Not canary-gated: every listed project is updated. The lisa-update-projects
14
+ # skill is the canary-first, gated rollout path (CodySwannGT/lisa#4604).
15
+ #
13
16
  # Usage:
14
17
  # ./scripts/lisa-update-local.sh [--dry-run]
15
18
  #
@@ -83,6 +86,16 @@ if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
83
86
  exit 1
84
87
  fi
85
88
 
89
+ # A value is either the legacy branch string or the canary-first object form
90
+ # { "branch": "<target branch>", "canary": true } (CodySwannGT/lisa#4604).
91
+ # Validated up front: the loop reads it through process substitution, whose
92
+ # exit status `set -e` ignores, so a bad entry would otherwise be skipped.
93
+ WORKSPACE_ENTRIES_JQ='to_entries[] | .key as $k | (.value | if type == "object" then .branch else . end) as $raw | (if ($raw | type) == "string" and ($raw | length) > 0 then $raw else error("entry \($k) has no valid branch (expected a non-empty string)") end) as $b | "\($k)\t\($b)"'
94
+ if ! jq -r "$WORKSPACE_ENTRIES_JQ" "$CONFIG_FILE" >/dev/null; then
95
+ log_error "Invalid workspace entry in $CONFIG_FILE"
96
+ exit 1
97
+ fi
98
+
86
99
  project_count=$(jq 'length' "$CONFIG_FILE")
87
100
  log_info "Found $project_count project(s) in config"
88
101
  echo ""
@@ -201,7 +214,7 @@ while IFS=$'\t' read -r project_path target_branch; do
201
214
  log_success "Updated $project_path"
202
215
  ((success_count++)) || true
203
216
 
204
- done < <(jq -r 'to_entries[] | "\(.key)\t\(.value)"' "$CONFIG_FILE")
217
+ done < <(jq -r "$WORKSPACE_ENTRIES_JQ" "$CONFIG_FILE")
205
218
 
206
219
  # Summary
207
220
  echo ""
@@ -0,0 +1,297 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * lisa-update-projects-plan — the canary-first rollout plan for the
4
+ * `lisa-update-projects` fleet-update skill (CodySwannGT/lisa#4604).
5
+ *
6
+ * ## Why this exists
7
+ *
8
+ * The skill used to upgrade every host in `.lisa.workspaces.json` in parallel,
9
+ * so a bad Lisa release reached every host at once. It now upgrades ONE
10
+ * designated canary first and touches the rest only once the canary's update
11
+ * PR passes its required checks. The decisions that make that safe — exactly
12
+ * one canary, every host keeping its configured branch, and "anything but a
13
+ * pass halts" — live here as code with tests, rather than as prose an agent
14
+ * re-derives on each run.
15
+ *
16
+ * ## Workspace file forms
17
+ *
18
+ * `.lisa.workspaces.json` maps a host path to its update PR's target branch.
19
+ * Two value forms are accepted, and may be mixed in one file:
20
+ *
21
+ * "<path>": "<branch>" legacy form
22
+ * "<path>": { "branch": "<branch>", "canary": true } object form
23
+ *
24
+ * `canary` is optional in the object form and must be a boolean. Exactly one
25
+ * entry must set it to true; a file of legacy strings alone designates no
26
+ * canary and is refused, because the owner decision behind #4604 requires one.
27
+ *
28
+ * ## Usage
29
+ *
30
+ * node scripts/lisa-update-projects-plan.mjs [--workspaces <path>]
31
+ * prints {"canary":{path,branch},"rest":[{path,branch},...]}; exit 0,
32
+ * or exit 1 with the reason on stderr.
33
+ * node scripts/lisa-update-projects-plan.mjs decide --canary-result <pass|fail|timeout>
34
+ * prints "proceed" for pass and "halt" otherwise; exit 2 on bad usage.
35
+ *
36
+ * The host path is echoed only to this local process's output. The workspace
37
+ * file is machine-local and gitignored; nothing here writes it anywhere else.
38
+ *
39
+ * @module scripts/lisa-update-projects-plan
40
+ */
41
+ import { readFileSync } from "node:fs";
42
+ import path from "node:path";
43
+ import process from "node:process";
44
+
45
+ import { invokedAsScript } from "./lib/invoked-as-script.mjs";
46
+
47
+ /** The default workspace file, resolved against the current directory. */
48
+ const DEFAULT_WORKSPACES = ".lisa.workspaces.json";
49
+
50
+ /** The flag naming a non-default workspace file. */
51
+ const WORKSPACES_FLAG = "--workspaces";
52
+
53
+ /** Keys the object value form may carry; anything else is a likely typo. */
54
+ const OBJECT_KEYS = new Set(["branch", "canary"]);
55
+
56
+ /**
57
+ * How to designate the canary, appended to every designation refusal so the
58
+ * human at the gate knows exactly what to change.
59
+ */
60
+ export const DESIGNATION_HELP =
61
+ 'Designate exactly one canary host in .lisa.workspaces.json by giving its entry the object form: "<host path>": { "branch": "<target branch>", "canary": true }. Every other entry keeps its plain branch string (or uses { "branch": "<target branch>" }).';
62
+
63
+ /** What a canary result maps to. Anything not listed is refused, never defaulted. */
64
+ const DECISIONS = Object.freeze({
65
+ pass: "proceed",
66
+ fail: "halt",
67
+ timeout: "halt",
68
+ });
69
+
70
+ const USAGE = [
71
+ "usage: lisa-update-projects-plan.mjs [--workspaces <path>]",
72
+ " lisa-update-projects-plan.mjs decide --canary-result <pass|fail|timeout>",
73
+ ].join("\n");
74
+
75
+ /**
76
+ * Report whether a value is a plain (non-array, non-null) object.
77
+ * @param {unknown} value - the value to test
78
+ * @returns {boolean} true for a plain object
79
+ */
80
+ const isPlainObject = value =>
81
+ typeof value === "object" && value !== null && !Array.isArray(value);
82
+
83
+ /**
84
+ * Report whether a value is a usable branch name.
85
+ * @param {unknown} value - the candidate branch
86
+ * @returns {boolean} true for a non-blank string
87
+ */
88
+ const isBranch = value => typeof value === "string" && value.trim() !== "";
89
+
90
+ /**
91
+ * Validate the object value form for one entry.
92
+ * @param {string} key - the host path, for the refusal message
93
+ * @param {Record<string, unknown>} value - the entry's object value
94
+ * @returns {{ok: true, entry: {path: string, branch: string, canary: boolean}} | {ok: false, message: string}} the entry or a refusal
95
+ */
96
+ function parseObjectEntry(key, value) {
97
+ const unknown = Object.keys(value).filter(k => !OBJECT_KEYS.has(k));
98
+ if (unknown.length > 0) {
99
+ return {
100
+ ok: false,
101
+ message: `entry ${JSON.stringify(key)} has unknown key(s) ${unknown.join(", ")}; allowed keys are "branch" and "canary".`,
102
+ };
103
+ }
104
+ if (!isBranch(value.branch)) {
105
+ return {
106
+ ok: false,
107
+ message: `entry ${JSON.stringify(key)} needs a non-empty string "branch".`,
108
+ };
109
+ }
110
+ if (value.canary !== undefined && typeof value.canary !== "boolean") {
111
+ return {
112
+ ok: false,
113
+ message: `entry ${JSON.stringify(key)} has a non-boolean "canary"; use true or false.`,
114
+ };
115
+ }
116
+ return {
117
+ ok: true,
118
+ entry: { path: key, branch: value.branch, canary: value.canary === true },
119
+ };
120
+ }
121
+
122
+ /**
123
+ * Validate one workspace entry in either value form.
124
+ * @param {string} key - the host path
125
+ * @param {unknown} value - the entry's value
126
+ * @returns {{ok: true, entry: {path: string, branch: string, canary: boolean}} | {ok: false, message: string}} the entry or a refusal
127
+ */
128
+ function parseEntry(key, value) {
129
+ if (typeof value === "string") {
130
+ return isBranch(value)
131
+ ? { ok: true, entry: { path: key, branch: value, canary: false } }
132
+ : {
133
+ ok: false,
134
+ message: `entry ${JSON.stringify(key)} has an empty branch.`,
135
+ };
136
+ }
137
+ if (isPlainObject(value)) return parseObjectEntry(key, value);
138
+ return {
139
+ ok: false,
140
+ message: `entry ${JSON.stringify(key)} must be a branch string or { "branch": "<target branch>", "canary": true }.`,
141
+ };
142
+ }
143
+
144
+ /**
145
+ * Parse and validate the workspace file's text.
146
+ * @param {string} text - the raw JSON text
147
+ * @returns {{ok: true, entries: Array<{path: string, branch: string, canary: boolean}>} | {ok: false, message: string}} the entries in file order, or the first refusal
148
+ */
149
+ export function parseWorkspaces(text) {
150
+ let data;
151
+ try {
152
+ data = JSON.parse(text);
153
+ } catch (error) {
154
+ return {
155
+ ok: false,
156
+ message: `workspace file is not valid JSON: ${error.message}`,
157
+ };
158
+ }
159
+ if (!isPlainObject(data)) {
160
+ return {
161
+ ok: false,
162
+ message:
163
+ "workspace file must be a JSON object mapping host path to target branch.",
164
+ };
165
+ }
166
+ const results = Object.entries(data).map(([key, value]) =>
167
+ parseEntry(key, value)
168
+ );
169
+ const refusal = results.find(result => !result.ok);
170
+ return refusal ?? { ok: true, entries: results.map(result => result.entry) };
171
+ }
172
+
173
+ /**
174
+ * Split validated entries into the canary phase and the rest.
175
+ * @param {ReadonlyArray<{path: string, branch: string, canary: boolean}>} entries - validated entries in file order
176
+ * @returns {{ok: true, plan: {canary: {path: string, branch: string}, rest: Array<{path: string, branch: string}>}} | {ok: false, message: string}} the plan, or a designation refusal
177
+ */
178
+ export function buildPlan(entries) {
179
+ if (entries.length === 0) {
180
+ return {
181
+ ok: false,
182
+ message: `workspace file lists no hosts. ${DESIGNATION_HELP}`,
183
+ };
184
+ }
185
+ const canaries = entries.filter(entry => entry.canary);
186
+ if (canaries.length === 0) {
187
+ return {
188
+ ok: false,
189
+ message: `workspace file designates no canary; the rollout needs one before any host is touched. ${DESIGNATION_HELP}`,
190
+ };
191
+ }
192
+ if (canaries.length > 1) {
193
+ const names = canaries.map(entry => JSON.stringify(entry.path)).join(", ");
194
+ return {
195
+ ok: false,
196
+ message: `workspace file designates ${canaries.length} canaries (${names}); exactly one is allowed. ${DESIGNATION_HELP}`,
197
+ };
198
+ }
199
+ const toPhase = ({ path: hostPath, branch }) => ({ path: hostPath, branch });
200
+ return {
201
+ ok: true,
202
+ plan: {
203
+ canary: toPhase(canaries[0]),
204
+ rest: entries.filter(entry => !entry.canary).map(toPhase),
205
+ },
206
+ };
207
+ }
208
+
209
+ /**
210
+ * Parse, validate and plan in one step.
211
+ * @param {string} text - the raw workspace file text
212
+ * @returns {ReturnType<typeof buildPlan>} the plan, or the first refusal
213
+ */
214
+ export function planFromText(text) {
215
+ const parsed = parseWorkspaces(text);
216
+ return parsed.ok ? buildPlan(parsed.entries) : parsed;
217
+ }
218
+
219
+ /**
220
+ * Decide what follows a canary result. Only an explicit pass proceeds; an
221
+ * unrecognised result is refused rather than read as either answer.
222
+ * @param {unknown} result - the canary's required-check result
223
+ * @returns {{ok: true, decision: "proceed" | "halt"} | {ok: false, message: string}} the decision or a refusal
224
+ */
225
+ export function decide(result) {
226
+ return typeof result === "string" && Object.hasOwn(DECISIONS, result)
227
+ ? { ok: true, decision: DECISIONS[result] }
228
+ : {
229
+ ok: false,
230
+ message: `unrecognised canary result ${JSON.stringify(result)}; expected pass, fail or timeout.`,
231
+ };
232
+ }
233
+
234
+ /**
235
+ * Run the `decide` subcommand.
236
+ * @param {string[]} args - arguments after `decide`
237
+ * @returns {number} the exit code
238
+ */
239
+ function runDecide(args) {
240
+ const flagAt = args.indexOf("--canary-result");
241
+ const verdict = decide(flagAt === -1 ? undefined : args[flagAt + 1]);
242
+ if (!verdict.ok) {
243
+ console.error(`lisa-update-projects-plan: ${verdict.message}\n${USAGE}`);
244
+ return 2;
245
+ }
246
+ console.log(verdict.decision);
247
+ return 0;
248
+ }
249
+
250
+ /**
251
+ * Run the default plan command.
252
+ * @param {string[]} args - CLI arguments
253
+ * @returns {number} the exit code
254
+ */
255
+ function runPlan(args) {
256
+ const unknown = args.find(
257
+ (arg, i) => arg !== WORKSPACES_FLAG && args[i - 1] !== WORKSPACES_FLAG
258
+ );
259
+ const flagAt = args.indexOf(WORKSPACES_FLAG);
260
+ const file = flagAt === -1 ? DEFAULT_WORKSPACES : args[flagAt + 1];
261
+ if (unknown !== undefined || file === undefined) {
262
+ console.error(
263
+ `lisa-update-projects-plan: unexpected argument ${unknown ?? WORKSPACES_FLAG}\n${USAGE}`
264
+ );
265
+ return 2;
266
+ }
267
+ let text;
268
+ try {
269
+ text = readFileSync(path.resolve(file), "utf8");
270
+ } catch (error) {
271
+ console.error(
272
+ `lisa-update-projects-plan: cannot read ${file}: ${error.code ?? error.message}`
273
+ );
274
+ return 1;
275
+ }
276
+ const result = planFromText(text);
277
+ if (!result.ok) {
278
+ console.error(`lisa-update-projects-plan: ${file}: ${result.message}`);
279
+ return 1;
280
+ }
281
+ console.log(JSON.stringify(result.plan, null, 2));
282
+ return 0;
283
+ }
284
+
285
+ /**
286
+ * CLI entry point.
287
+ * @returns {void}
288
+ */
289
+ export function main() {
290
+ const args = process.argv.slice(2);
291
+ process.exitCode =
292
+ args[0] === "decide" ? runDecide(args.slice(1)) : runPlan(args);
293
+ }
294
+
295
+ if (invokedAsScript(import.meta.url)) {
296
+ main();
297
+ }