@yansirplus/cli 0.5.18 → 0.5.20

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/main.mjs CHANGED
@@ -11,19 +11,7 @@ import {
11
11
  installConsumer,
12
12
  restoreConsumer,
13
13
  } from "./consumer-overlay.mjs";
14
- import {
15
- algorithmicCheckerAcceptsArgs,
16
- hasAlgorithmicChecker,
17
- runAlgorithmicChecker,
18
- } from "./check/algorithmic-checks.mjs";
19
- import {
20
- deriveAffectedGates,
21
- printAffectedGates,
22
- runAffectedGates,
23
- } from "./check/gate-selector.mjs";
24
- import { runDefaultGate } from "./check/default-gate.mjs";
25
- import { runEffectScanGate } from "./check/effect-scan-gate.mjs";
26
- import { listGuards, runGroup, runGuard } from "./runner.mjs";
14
+ import { releaseStatus } from "./release-status.mjs";
27
15
 
28
16
  const packageRootFromMain = () => path.dirname(path.dirname(fileURLToPath(import.meta.url)));
29
17
 
@@ -55,6 +43,7 @@ Usage:
55
43
  agentos dev [--cwd <path>] [--config <path>] [--package-scope <scope>] [--host <host>] [--port <port>] [--llm config|test] [--llm-response <text>] [--json]
56
44
  agentos eval [--cwd <path>] [--config <path>] [--package-scope <scope>] [--target local|remote] [--base-url <url>] [--header <name=value>] [--llm config|test] [--llm-response <text>] [--json]
57
45
  agentos preflight llm [--cwd <path>] [--config <path>] [--route <binding-ref>] [--json]
46
+ agentos release status [path/to/consumer] [--json] [--check-npm] [--registry <url>] [--install-manifest <path>]
58
47
  agentos consumer install /path/to/consumer [--from-manifest <path>] [--no-install] [--skip-pack] [--json]
59
48
  agentos consumer status /path/to/consumer [--json] [--check-npm] [--registry <url>]
60
49
  agentos consumer check /path/to/consumer [--json] [--check-npm] [--registry <url>]
@@ -92,6 +81,7 @@ const fail = (message) => {
92
81
  message.startsWith("agentos dev:") ||
93
82
  message.startsWith("agentos eval:") ||
94
83
  message.startsWith("agentos preflight:") ||
84
+ message.startsWith("agentos release:") ||
95
85
  message.startsWith("agentos consumer:") ||
96
86
  message.startsWith("agentos check:") ||
97
87
  message.startsWith("agentos generate:")
@@ -107,6 +97,9 @@ const expectNoExtraArgs = (args, command) => {
107
97
  }
108
98
  };
109
99
 
100
+ const isHelpCommand = (command) =>
101
+ command === undefined || command === "--help" || command === "-h";
102
+
110
103
  const runBuildRunner = async (command, args) => {
111
104
  const runner = fileURLToPath(new URL("./build/build-cli.js", import.meta.url));
112
105
  const bundled = await bundleModuleForNode(runner, {
@@ -151,6 +144,21 @@ const runEval = async (args) => runBuildRunner("eval", args);
151
144
 
152
145
  const runPreflight = async (args) => runBuildRunner("preflight", args);
153
146
 
147
+ const loadRunner = () => import("./runner.mjs");
148
+
149
+ const runCheckGroup = async (group) => {
150
+ const { runGroup } = await loadRunner();
151
+ await runGroup(group);
152
+ };
153
+
154
+ const loadAlgorithmicChecks = () => import("./check/algorithmic-checks.mjs");
155
+
156
+ const loadGateSelector = () => import("./check/gate-selector.mjs");
157
+
158
+ const loadDefaultGate = () => import("./check/default-gate.mjs");
159
+
160
+ const loadEffectScanGate = () => import("./check/effect-scan-gate.mjs");
161
+
154
162
  const sourceConsumerProducer = () => {
155
163
  const modulePath = path.join(repoRootFromMain(), "tooling/distribution/pack-check.mjs");
156
164
  const supportPath = path.join(repoRootFromMain(), "tooling/distribution/support.mjs");
@@ -171,6 +179,10 @@ const sourceConsumerProducer = () => {
171
179
 
172
180
  const runConsumer = async (args) => {
173
181
  const [command, ...rest] = args;
182
+ if (isHelpCommand(command)) {
183
+ printHelp();
184
+ return;
185
+ }
174
186
  const commandArgs = rest[0] === "--" ? rest.slice(1) : rest;
175
187
  const sourceContext = sourceConsumerProducer() ?? {};
176
188
  const context = { packageRoot: packageRootFromMain(), ...sourceContext };
@@ -192,20 +204,45 @@ const runConsumer = async (args) => {
192
204
  }
193
205
  };
194
206
 
207
+ const runRelease = async (args) => {
208
+ const [command, ...rest] = args;
209
+ if (isHelpCommand(command)) {
210
+ printHelp();
211
+ return;
212
+ }
213
+ const commandArgs = rest[0] === "--" ? rest.slice(1) : rest;
214
+ const sourceContext = sourceConsumerProducer() ?? {};
215
+ const context = { packageRoot: packageRootFromMain(), ...sourceContext };
216
+ switch (command) {
217
+ case "status":
218
+ releaseStatus(commandArgs, context);
219
+ return;
220
+ default:
221
+ throw new Error("agentos release: choose status");
222
+ }
223
+ };
224
+
195
225
  const runCheck = async (args) => {
196
226
  const [command, ...rest] = args;
227
+ if (isHelpCommand(command)) {
228
+ printHelp();
229
+ return;
230
+ }
197
231
  switch (command) {
198
232
  case "all":
199
233
  expectNoExtraArgs(rest, "agentos check all");
200
- await runGroup("all");
234
+ await runCheckGroup("all");
201
235
  return;
202
236
  case "default":
203
237
  expectNoExtraArgs(rest, "agentos check default");
204
- await runDefaultGate();
238
+ {
239
+ const { runDefaultGate } = await loadDefaultGate();
240
+ await runDefaultGate();
241
+ }
205
242
  return;
206
243
  case "structural":
207
244
  expectNoExtraArgs(rest, "agentos check structural");
208
- await runGroup("all");
245
+ await runCheckGroup("all");
209
246
  return;
210
247
  case "affected": {
211
248
  let base;
@@ -232,6 +269,8 @@ const runCheck = async (args) => {
232
269
  throw new Error(`agentos check affected: unexpected argument ${arg}`);
233
270
  }
234
271
  }
272
+ const { deriveAffectedGates, printAffectedGates, runAffectedGates } =
273
+ await loadGateSelector();
235
274
  const result = deriveAffectedGates({ base, head });
236
275
  printAffectedGates(result, { json });
237
276
  if (run) runAffectedGates(result);
@@ -239,45 +278,56 @@ const runCheck = async (args) => {
239
278
  }
240
279
  case "docs":
241
280
  expectNoExtraArgs(rest, "agentos check docs");
242
- await runGroup("check-docs");
281
+ await runCheckGroup("check-docs");
243
282
  return;
244
283
  case "effect-scan":
245
- runEffectScanGate(rest, { defaultRepoRoot: repoRootFromMain() });
284
+ {
285
+ const { runEffectScanGate } = await loadEffectScanGate();
286
+ runEffectScanGate(rest, { defaultRepoRoot: repoRootFromMain() });
287
+ }
246
288
  return;
247
289
  case "effect-manifests":
248
290
  expectNoExtraArgs(rest, "agentos check effect-manifests");
249
- await runGroup("check-effect-manifests");
291
+ await runCheckGroup("check-effect-manifests");
250
292
  return;
251
293
  case "release":
252
294
  expectNoExtraArgs(rest, "agentos check release");
253
- await runGroup("release");
295
+ await runCheckGroup("release");
254
296
  return;
255
297
  case "site":
256
298
  expectNoExtraArgs(rest, "agentos check site");
257
- await runGroup("check-site");
299
+ await runCheckGroup("check-site");
258
300
  return;
259
301
  case "guard-coverage":
260
302
  expectNoExtraArgs(rest, "agentos check guard-coverage");
261
- await runGroup("guard-coverage");
303
+ await runCheckGroup("guard-coverage");
262
304
  return;
263
305
  case "guard": {
264
306
  const [ruleId, ...extra] = rest;
265
307
  if (ruleId === undefined) throw new Error("agentos check guard: missing <rule-id>");
266
308
  expectNoExtraArgs(extra, "agentos check guard");
309
+ const { runGuard } = await loadRunner();
267
310
  await runGuard(ruleId);
268
311
  return;
269
312
  }
270
313
  case "guards":
271
314
  expectNoExtraArgs(rest, "agentos check guards");
272
- for (const id of listGuards()) console.log(id);
315
+ {
316
+ const { listGuards } = await loadRunner();
317
+ for (const id of listGuards()) console.log(id);
318
+ }
273
319
  return;
274
320
  default:
275
- if (command !== undefined && hasAlgorithmicChecker(command)) {
276
- if (!algorithmicCheckerAcceptsArgs(command)) {
277
- expectNoExtraArgs(rest, `agentos check ${command}`);
321
+ {
322
+ const { algorithmicCheckerAcceptsArgs, hasAlgorithmicChecker, runAlgorithmicChecker } =
323
+ await loadAlgorithmicChecks();
324
+ if (command !== undefined && hasAlgorithmicChecker(command)) {
325
+ if (!algorithmicCheckerAcceptsArgs(command)) {
326
+ expectNoExtraArgs(rest, `agentos check ${command}`);
327
+ }
328
+ await runAlgorithmicChecker(command, rest);
329
+ return;
278
330
  }
279
- await runAlgorithmicChecker(command, rest);
280
- return;
281
331
  }
282
332
  throw new Error(
283
333
  "agentos check: choose one of all, default, structural, affected, docs, effect-scan, effect-manifests, release, site, guard-coverage, guard, guards, or an algorithmic checker id",
@@ -287,22 +337,26 @@ const runCheck = async (args) => {
287
337
 
288
338
  const runGenerate = async (args) => {
289
339
  const [command, ...rest] = args;
340
+ if (isHelpCommand(command)) {
341
+ printHelp();
342
+ return;
343
+ }
290
344
  switch (command) {
291
345
  case "docs":
292
346
  expectNoExtraArgs(rest, "agentos generate docs");
293
- await runGroup("generate-docs");
347
+ await runCheckGroup("generate-docs");
294
348
  return;
295
349
  case "effect-manifests":
296
350
  expectNoExtraArgs(rest, "agentos generate effect-manifests");
297
- await runGroup("generate-effect-manifests");
351
+ await runCheckGroup("generate-effect-manifests");
298
352
  return;
299
353
  case "site":
300
354
  if (rest[0] === "--watch") {
301
355
  expectNoExtraArgs(rest.slice(1), "agentos generate site --watch");
302
- await runGroup("generate-site-watch");
356
+ await runCheckGroup("generate-site-watch");
303
357
  } else {
304
358
  expectNoExtraArgs(rest, "agentos generate site");
305
- await runGroup("generate-site");
359
+ await runCheckGroup("generate-site");
306
360
  }
307
361
  return;
308
362
  default:
@@ -340,6 +394,9 @@ const main = async () => {
340
394
  case "preflight":
341
395
  await runPreflight(rest);
342
396
  return;
397
+ case "release":
398
+ await runRelease(rest);
399
+ return;
343
400
  case "consumer":
344
401
  await runConsumer(rest);
345
402
  return;
@@ -351,7 +408,7 @@ const main = async () => {
351
408
  return;
352
409
  default:
353
410
  throw new Error(
354
- "agentos: choose one of build, info, serve, dev, eval, preflight, consumer, check, generate",
411
+ "agentos: choose one of build, info, serve, dev, eval, preflight, release, consumer, check, generate",
355
412
  );
356
413
  }
357
414
  };