@lousy-agents/cli 5.22.26 → 5.22.28

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.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@biomejs/biome": "2.5.15",
21
- "@lousy-agents/mcp": "5.22.25",
21
+ "@lousy-agents/mcp": "5.22.26",
22
22
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
23
23
  "@testcontainers/postgresql": "12.2.1",
24
24
  "@types/node": "26.6.6",
@@ -26,7 +26,7 @@
26
26
  "testcontainers": "12.2.1",
27
27
  "tsx": "4.23.15",
28
28
  "typescript": "7.0.2",
29
- "vitest": "5.0.5"
29
+ "vitest": "5.1.0"
30
30
  }
31
31
  },
32
32
  "node_modules/@balena/dockerignore": {
@@ -974,9 +974,9 @@
974
974
  }
975
975
  },
976
976
  "node_modules/@lousy-agents/mcp": {
977
- "version": "5.22.25",
978
- "resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.22.25.tgz",
979
- "integrity": "sha512-Swf2weegq2+wK3hY7MfSh3hpFlqVyJtpKHOw3wQ+gZ3E0/4sE8Zho9Wt8pha/bM9HiZZvAJwKTKr4559epz8UQ==",
977
+ "version": "5.22.26",
978
+ "resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.22.26.tgz",
979
+ "integrity": "sha512-nASR8jWoMJ6Nrf1x91HoFWL1+mLdqFAmLYdwmA9nBUBF48eOizOVlPS5qAreLVzXZN71XXHwcvWK+IDLD5t/qw==",
980
980
  "dev": true,
981
981
  "license": "BSD-2-Clause-Patent",
982
982
  "dependencies": {
@@ -1890,14 +1890,14 @@
1890
1890
  }
1891
1891
  },
1892
1892
  "node_modules/@vitest/mocker": {
1893
- "version": "5.0.5",
1894
- "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
1895
- "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",
1893
+ "version": "5.1.0",
1894
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz",
1895
+ "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==",
1896
1896
  "dev": true,
1897
1897
  "license": "MIT",
1898
1898
  "dependencies": {
1899
1899
  "@jridgewell/trace-mapping": "0.3.31",
1900
- "@vitest/spy": "5.0.5",
1900
+ "@vitest/spy": "5.1.0",
1901
1901
  "estree-walker": "^3.0.3",
1902
1902
  "magic-string": "^1.4.3"
1903
1903
  },
@@ -1918,9 +1918,9 @@
1918
1918
  }
1919
1919
  },
1920
1920
  "node_modules/@vitest/spy": {
1921
- "version": "5.0.5",
1922
- "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",
1923
- "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",
1921
+ "version": "5.1.0",
1922
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz",
1923
+ "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==",
1924
1924
  "dev": true,
1925
1925
  "license": "MIT",
1926
1926
  "funding": {
@@ -5827,14 +5827,14 @@
5827
5827
  }
5828
5828
  },
5829
5829
  "node_modules/vitest": {
5830
- "version": "5.0.5",
5831
- "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",
5832
- "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",
5830
+ "version": "5.1.0",
5831
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz",
5832
+ "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==",
5833
5833
  "dev": true,
5834
5834
  "license": "MIT",
5835
5835
  "dependencies": {
5836
5836
  "@types/chai": "^5.2.2",
5837
- "@vitest/mocker": "5.0.5",
5837
+ "@vitest/mocker": "5.1.0",
5838
5838
  "chai": "^6.3.0",
5839
5839
  "es-module-lexer": "^2.3.2",
5840
5840
  "expect-type": "^1.4.0",
@@ -5860,12 +5860,12 @@
5860
5860
  "@edge-runtime/vm": "*",
5861
5861
  "@opentelemetry/api": "^1.9.0",
5862
5862
  "@types/node": "^22.0.0 || >=24.0.0",
5863
- "@vitest/browser-playwright": "5.0.5",
5864
- "@vitest/browser-preview": "5.0.5",
5863
+ "@vitest/browser-playwright": "5.1.0",
5864
+ "@vitest/browser-preview": "5.1.0",
5865
5865
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
5866
- "@vitest/coverage-istanbul": "5.0.5",
5867
- "@vitest/coverage-v8": "5.0.5",
5868
- "@vitest/ui": "5.0.5",
5866
+ "@vitest/coverage-istanbul": "5.1.0",
5867
+ "@vitest/coverage-v8": "5.1.0",
5868
+ "@vitest/ui": "5.1.0",
5869
5869
  "happy-dom": "*",
5870
5870
  "jsdom": "*",
5871
5871
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@biomejs/biome": "2.5.15",
32
- "@lousy-agents/mcp": "5.22.25",
32
+ "@lousy-agents/mcp": "5.22.26",
33
33
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
34
34
  "@testcontainers/postgresql": "12.2.1",
35
35
  "@types/node": "26.6.6",
@@ -37,6 +37,6 @@
37
37
  "testcontainers": "12.2.1",
38
38
  "tsx": "4.23.15",
39
39
  "typescript": "7.0.2",
40
- "vitest": "5.0.5"
40
+ "vitest": "5.1.0"
41
41
  }
42
42
  }
@@ -20,12 +20,12 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@biomejs/biome": "2.5.15",
23
- "@lousy-agents/mcp": "5.22.25",
23
+ "@lousy-agents/mcp": "5.22.26",
24
24
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
25
25
  "@types/node": "26.6.6",
26
26
  "chance": "1.1.13",
27
27
  "tsx": "4.23.15",
28
28
  "typescript": "7.0.2",
29
- "vitest": "5.0.5"
29
+ "vitest": "5.1.0"
30
30
  }
31
31
  }
package/dist/index.js CHANGED
@@ -3053,7 +3053,7 @@ exports.basename = (path, { windows } = {}) => {
3053
3053
 
3054
3054
 
3055
3055
  },
3056
- 9253(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3056
+ 9047(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3057
3057
  // NAMESPACE OBJECT: ../../node_modules/micromark/lib/constructs.js
3058
3058
  var constructs_namespaceObject = {};
3059
3059
  __webpack_require__.r(constructs_namespaceObject);
@@ -48217,7 +48217,80 @@ async function checkAndPromptAgentShell(npmrcGateway, targetDir, prompt, environ
48217
48217
  }
48218
48218
  }
48219
48219
 
48220
+ ;// CONCATENATED MODULE: ../doctor/src/cli/doctor-args.ts
48221
+ const DOCTOR_ARGS = {
48222
+ summary: {
48223
+ type: "boolean",
48224
+ description: "Show archetype classification only — skip evaluation",
48225
+ default: false
48226
+ },
48227
+ format: {
48228
+ type: "string",
48229
+ description: "Output format: human (default) or json",
48230
+ default: "human"
48231
+ },
48232
+ ci: {
48233
+ type: "boolean",
48234
+ description: "Force non-interactive mode (skip intent elicitation prompts)",
48235
+ default: false
48236
+ }
48237
+ };
48238
+
48239
+ ;// CONCATENATED MODULE: ../doctor/src/cli/process-environment.ts
48240
+
48241
+ function loggerStreamsFor(format, doctorProcess) {
48242
+ return {
48243
+ stdout: format === "json" ? doctorProcess.stderr : doctorProcess.stdout,
48244
+ stderr: doctorProcess.stderr
48245
+ };
48246
+ }
48247
+ function createDoctorEnvironment(doctorProcess, createStreamLogger) {
48248
+ return {
48249
+ cwd: doctorProcess.cwd(),
48250
+ stdinIsTty: doctorProcess.stdin.isTTY === true,
48251
+ createLogger: (format)=>createStreamLogger(loggerStreamsFor(format, doctorProcess)),
48252
+ writeStdout: (text)=>{
48253
+ doctorProcess.stdout.write(text);
48254
+ }
48255
+ };
48256
+ }
48257
+ function processDoctorEnvironment(doctorProcess = process) {
48258
+ return createDoctorEnvironment(doctorProcess, (streams)=>dist_createConsola(streams));
48259
+ }
48260
+
48261
+ ;// CONCATENATED MODULE: ../doctor/src/lib/terminal-escape.ts
48262
+ const NAMED_ESCAPES = {
48263
+ "\n": "\\n",
48264
+ "\r": "\\r",
48265
+ "\t": "\\t",
48266
+ "\\": "\\\\"
48267
+ };
48268
+ const FORMAT_CHARACTER = /\p{Cf}/u;
48269
+ const BASIC_MULTILINGUAL_PLANE_END = 0xffff;
48270
+ function escapeCharacter(character, code) {
48271
+ const named = NAMED_ESCAPES[character];
48272
+ if (named !== undefined) {
48273
+ return named;
48274
+ }
48275
+ const hex = code.toString(16);
48276
+ return code > BASIC_MULTILINGUAL_PLANE_END ? `\\u{${hex}}` : `\\u${hex.padStart(4, "0")}`;
48277
+ }
48278
+ function needsEscape(character, code) {
48279
+ const isBackslash = character === "\\";
48280
+ const isC0Control = code <= 0x1f;
48281
+ const isDeleteOrC1Control = code >= 0x7f && code <= 0x9f;
48282
+ const isUnicodeLineSeparator = code === 0x2028 || code === 0x2029;
48283
+ return isBackslash || isC0Control || isDeleteOrC1Control || isUnicodeLineSeparator || FORMAT_CHARACTER.test(character);
48284
+ }
48285
+ function escapeForTerminal(text) {
48286
+ return Array.from(text, (character)=>{
48287
+ const code = character.codePointAt(0) ?? 0;
48288
+ return needsEscape(character, code) ? escapeCharacter(character, code) : character;
48289
+ }).join("");
48290
+ }
48291
+
48220
48292
  ;// CONCATENATED MODULE: ../doctor/src/formatters/human-renderer.ts
48293
+
48221
48294
  const SEVERITY_ORDER = [
48222
48295
  "critical",
48223
48296
  "high",
@@ -48242,28 +48315,25 @@ function sortFindings(findings) {
48242
48315
  return CATEGORY_ORDER.indexOf(a.category) - CATEGORY_ORDER.indexOf(b.category);
48243
48316
  });
48244
48317
  }
48245
- /**
48246
- * Prints every field of the intent load report so text output carries the
48247
- * same status, checked path, reason, and issues as the JSON `intent` object.
48248
- */ function renderIntentLoad(intentLoad, logger) {
48318
+ function renderIntentLoad(intentLoad, logger) {
48249
48319
  logger.info(`Intent: ${intentLoad.status}`);
48250
- logger.info(` Checked path: ${intentLoad.checkedPath}`);
48320
+ logger.info(` Checked path: ${escapeForTerminal(intentLoad.checkedPath)}`);
48251
48321
  if (intentLoad.reason !== undefined) {
48252
- logger.info(` Reason: ${intentLoad.reason}`);
48322
+ logger.info(` Reason: ${escapeForTerminal(intentLoad.reason)}`);
48253
48323
  }
48254
48324
  if (intentLoad.issues !== undefined && intentLoad.issues.length > 0) {
48255
48325
  logger.info(" Issues:");
48256
48326
  for (const issue of intentLoad.issues){
48257
- logger.info(` ${issue.path}: ${issue.message}`);
48327
+ logger.info(` ${escapeForTerminal(issue.path)}: ${escapeForTerminal(issue.message)}`);
48258
48328
  }
48259
48329
  if (intentLoad.omittedIssueCount !== undefined) {
48260
48330
  logger.info(` ...and ${intentLoad.omittedIssueCount} more`);
48261
48331
  }
48262
48332
  }
48263
48333
  }
48264
- function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
48334
+ function renderHeader(summary, logger, snapshotRef) {
48265
48335
  if (snapshotRef) {
48266
- logger.info(`Evidence snapshot: ${snapshotRef}`);
48336
+ logger.info(`Evidence snapshot: ${escapeForTerminal(snapshotRef)}`);
48267
48337
  }
48268
48338
  logger.info(`Archetype: ${summary.archetype}`);
48269
48339
  logger.info(` ${summary.archetypeDescription}`);
@@ -48278,6 +48348,13 @@ function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
48278
48348
  if (summary.crossHarnessEdges > 0) {
48279
48349
  logger.info(` Cross-harness edges: ${summary.crossHarnessEdges}`);
48280
48350
  }
48351
+ }
48352
+ function renderHumanSummary(summary, logger, snapshotRef) {
48353
+ renderHeader(summary, logger, snapshotRef);
48354
+ logger.info("Evaluation skipped (--summary). Run without --summary to check criteria.");
48355
+ }
48356
+ function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
48357
+ renderHeader(summary, logger, snapshotRef);
48281
48358
  if (intentLoad !== undefined) {
48282
48359
  renderIntentLoad(intentLoad, logger);
48283
48360
  }
@@ -48293,7 +48370,7 @@ function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
48293
48370
  const assumedTag = finding.assumedIntent ? " [assumed intent]" : "";
48294
48371
  logger.info(` ${severityTag}${classTag} ${finding.criterionId}: ${finding.description}${assumedTag}`);
48295
48372
  if (finding.evidenceCitation) {
48296
- logger.info(` Evidence: node ${finding.evidenceCitation.nodeId} (${finding.evidenceCitation.sourceFile})`);
48373
+ logger.info(` Evidence: node ${escapeForTerminal(finding.evidenceCitation.nodeId)} (${escapeForTerminal(finding.evidenceCitation.sourceFile)})`);
48297
48374
  }
48298
48375
  }
48299
48376
  }
@@ -48461,7 +48538,11 @@ const ReportEdgeSchema = schemas_object({
48461
48538
  ]).optional(),
48462
48539
  crossHarness: schemas_boolean()
48463
48540
  });
48464
- const ReportJsonSchema = schemas_object({
48541
+ const ReportEvaluationSchema = schemas_enum([
48542
+ "completed",
48543
+ "not-applicable"
48544
+ ]);
48545
+ const ArchetypeFieldsSchema = schemas_object({
48465
48546
  archetype: ArchetypeSchema,
48466
48547
  dominanceScore: schemas_number(),
48467
48548
  totalRecords: schemas_number(),
@@ -48469,13 +48550,20 @@ const ReportJsonSchema = schemas_object({
48469
48550
  harness: schemas_string(),
48470
48551
  count: schemas_number()
48471
48552
  })),
48472
- crossHarnessEdges: schemas_number(),
48553
+ crossHarnessEdges: schemas_number()
48554
+ });
48555
+ const ReportJsonSchema = ArchetypeFieldsSchema.extend({
48556
+ evaluation: ReportEvaluationSchema,
48473
48557
  inventory: schemas_array(ReportInventoryItemSchema),
48474
48558
  edges: schemas_array(ReportEdgeSchema),
48475
48559
  intent: IntentLoadReportSchema.optional(),
48476
48560
  findings: schemas_array(FindingSchema),
48477
48561
  snapshotRef: schemas_string().optional()
48478
48562
  });
48563
+ const SummaryReportJsonSchema = ArchetypeFieldsSchema.extend({
48564
+ evaluation: schemas_literal("skipped"),
48565
+ inventory: schemas_array(ReportInventoryItemSchema)
48566
+ });
48479
48567
  function toInventoryItems(records) {
48480
48568
  return records.map((record)=>({
48481
48569
  id: record.id,
@@ -48512,7 +48600,7 @@ function toReportEdges(records) {
48512
48600
  }
48513
48601
  return result;
48514
48602
  }
48515
- function toJson(summary, findings, records, snapshotRef, intentLoad) {
48603
+ function toJson(summary, findings, records, snapshotRef, intentLoad, evaluation = "completed") {
48516
48604
  const edges = toReportEdges(records);
48517
48605
  const report = {
48518
48606
  archetype: summary.archetype,
@@ -48520,6 +48608,7 @@ function toJson(summary, findings, records, snapshotRef, intentLoad) {
48520
48608
  totalRecords: summary.totalRecords,
48521
48609
  harnessBreakdown: summary.harnessBreakdown,
48522
48610
  crossHarnessEdges: edges.filter((edge)=>edge.crossHarness).length,
48611
+ evaluation,
48523
48612
  inventory: toInventoryItems(records),
48524
48613
  edges,
48525
48614
  ...intentLoad !== undefined ? {
@@ -48532,6 +48621,17 @@ function toJson(summary, findings, records, snapshotRef, intentLoad) {
48532
48621
  };
48533
48622
  return ReportJsonSchema.parse(report);
48534
48623
  }
48624
+ function toSummaryJson(summary, records) {
48625
+ return SummaryReportJsonSchema.parse({
48626
+ archetype: summary.archetype,
48627
+ dominanceScore: summary.dominanceScore,
48628
+ totalRecords: summary.totalRecords,
48629
+ harnessBreakdown: summary.harnessBreakdown,
48630
+ crossHarnessEdges: summary.crossHarnessEdges,
48631
+ evaluation: "skipped",
48632
+ inventory: toInventoryItems(records)
48633
+ });
48634
+ }
48535
48635
 
48536
48636
  ;// CONCATENATED MODULE: ../doctor/src/formatters/summary-formatter.ts
48537
48637
 
@@ -48563,6 +48663,52 @@ function formatSummary(records, classification) {
48563
48663
  };
48564
48664
  }
48565
48665
 
48666
+ ;// CONCATENATED MODULE: ../doctor/src/formatters/present-run.ts
48667
+
48668
+
48669
+
48670
+ const BLOCKING_FINDINGS_EXIT_CODE = 1;
48671
+ const SUCCESS_EXIT_CODE = 0;
48672
+ function writeJson(output, value) {
48673
+ output.writeStdout(`${JSON.stringify(value, null, 2)}\n`);
48674
+ }
48675
+ function presentJson(run, output) {
48676
+ const summary = formatSummary(run.records, run.classification);
48677
+ switch(run.kind){
48678
+ case "summary":
48679
+ writeJson(output, toSummaryJson(summary, run.records));
48680
+ return;
48681
+ case "no-constructs":
48682
+ writeJson(output, toJson(summary, [], run.records, run.snapshotRef, undefined, "not-applicable"));
48683
+ return;
48684
+ case "evaluated":
48685
+ writeJson(output, toJson(summary, run.findings, run.records, run.snapshotRef, run.intentLoad));
48686
+ return;
48687
+ }
48688
+ }
48689
+ function presentHuman(run, output) {
48690
+ const summary = formatSummary(run.records, run.classification);
48691
+ switch(run.kind){
48692
+ case "summary":
48693
+ renderHumanSummary(summary, output.logger, run.snapshotRef);
48694
+ return;
48695
+ case "no-constructs":
48696
+ output.logger.info("No agentic constructs found in the repository.");
48697
+ return;
48698
+ case "evaluated":
48699
+ renderHuman(summary, run.findings, output.logger, run.snapshotRef, run.intentLoad);
48700
+ return;
48701
+ }
48702
+ }
48703
+ function presentDoctorRun(run, format, output) {
48704
+ if (format === "json") {
48705
+ presentJson(run, output);
48706
+ } else {
48707
+ presentHuman(run, output);
48708
+ }
48709
+ return run.kind === "evaluated" && hasBlockingFindings(run.findings) ? BLOCKING_FINDINGS_EXIT_CODE : SUCCESS_EXIT_CODE;
48710
+ }
48711
+
48566
48712
  ;// CONCATENATED MODULE: ../doctor/src/gateways/intent-artifact.ts
48567
48713
 
48568
48714
 
@@ -49462,6 +49608,118 @@ function createWisdomClient(wisdomDir) {
49462
49608
  };
49463
49609
  }
49464
49610
 
49611
+ ;// CONCATENATED MODULE: ../doctor/src/gateways/doctor-gateways.ts
49612
+
49613
+
49614
+
49615
+
49616
+ const DEFAULT_DEPENDENCIES = {
49617
+ createWisdomClient: createWisdomClient
49618
+ };
49619
+ function createDoctorGateways(logger, dependencies = DEFAULT_DEPENDENCIES) {
49620
+ return {
49621
+ scanRepository: scanRepository,
49622
+ async readIntent (repoPath) {
49623
+ const result = await readIntentArtifact(repoPath);
49624
+ return {
49625
+ intent: result.found ? result.artifact : null,
49626
+ report: result.report
49627
+ };
49628
+ },
49629
+ async loadSnapshotRef (repoPath) {
49630
+ try {
49631
+ const graph = await dependencies.createWisdomClient((0,external_node_path_.resolve)(repoPath, "wisdom")).getGraph();
49632
+ return graph.snapshotRef;
49633
+ } catch (error) {
49634
+ if (!(error instanceof WisdomUnavailableError)) throw error;
49635
+ logger.debug("Wisdom graph unavailable — snapshotRef will be omitted");
49636
+ return undefined;
49637
+ }
49638
+ }
49639
+ };
49640
+ }
49641
+
49642
+ ;// CONCATENATED MODULE: ../doctor/src/lib/doctor-options.ts
49643
+
49644
+
49645
+ const DOCTOR_FORMATS = [
49646
+ "human",
49647
+ "json"
49648
+ ];
49649
+ const DoctorFormatSchema = schemas_enum(DOCTOR_FORMATS);
49650
+ const DEFAULT_FORMAT = "human";
49651
+ const DoctorFlagsSchema = schemas_object({
49652
+ summary: schemas_boolean(),
49653
+ format: schemas_unknown().optional(),
49654
+ ci: schemas_boolean()
49655
+ });
49656
+ function describeFormatValue(value) {
49657
+ return typeof value === "string" ? `"${escapeForTerminal(value)}"` : typeof value;
49658
+ }
49659
+ function unsupportedFormatWarning(value) {
49660
+ return `Unsupported --format ${describeFormatValue(value)}. Accepted values: ${DOCTOR_FORMATS.join(", ")}. Falling back to human output.`;
49661
+ }
49662
+ function resolveFormat(rawFormat) {
49663
+ const supported = DoctorFormatSchema.safeParse(rawFormat);
49664
+ if (supported.success) {
49665
+ return {
49666
+ format: supported.data,
49667
+ warnings: [],
49668
+ formatFellBack: false
49669
+ };
49670
+ }
49671
+ if (rawFormat === undefined) {
49672
+ return {
49673
+ format: DEFAULT_FORMAT,
49674
+ warnings: [],
49675
+ formatFellBack: false
49676
+ };
49677
+ }
49678
+ return {
49679
+ format: DEFAULT_FORMAT,
49680
+ warnings: [
49681
+ unsupportedFormatWarning(rawFormat)
49682
+ ],
49683
+ formatFellBack: true
49684
+ };
49685
+ }
49686
+ function describeInvalidOptions(error) {
49687
+ const flags = [
49688
+ ...new Set(error.issues.map((issue)=>issue.path[0]).filter(isFlag))
49689
+ ].map((flag)=>`--${flag}`);
49690
+ if (flags.length === 0) {
49691
+ return "Invalid doctor options: options must be an object.";
49692
+ }
49693
+ const noun = flags.length === 1 ? "a boolean" : "booleans";
49694
+ return `Invalid doctor options: ${flags.join(" and ")} must be ${noun}.`;
49695
+ }
49696
+ function isFlag(key) {
49697
+ return typeof key === "string";
49698
+ }
49699
+ function parseDoctorOptions(raw) {
49700
+ const flags = DoctorFlagsSchema.safeParse(raw);
49701
+ if (!flags.success) {
49702
+ return {
49703
+ success: false,
49704
+ message: describeInvalidOptions(flags.error)
49705
+ };
49706
+ }
49707
+ const resolved = resolveFormat(flags.data.format);
49708
+ return {
49709
+ success: true,
49710
+ options: {
49711
+ summary: flags.data.summary,
49712
+ format: resolved.format,
49713
+ ci: flags.data.ci
49714
+ },
49715
+ warnings: resolved.warnings,
49716
+ formatFellBack: resolved.formatFellBack
49717
+ };
49718
+ }
49719
+ function shouldElicitIntent(options, stdinIsTty, formatFellBack) {
49720
+ return options.format === "human" && !options.ci && stdinIsTty && !formatFellBack;
49721
+ }
49722
+
49465
49723
  ;// CONCATENATED MODULE: ../doctor/src/use-cases/harness-profile.ts
49466
49724
  const PURE_DOMINANCE_THRESHOLD = 0.8;
49467
49725
  function buildHarnessProfiles(records) {
@@ -49979,6 +50237,125 @@ function evaluate(criteria, ctx) {
49979
50237
  return findings;
49980
50238
  }
49981
50239
 
50240
+ ;// CONCATENATED MODULE: ../doctor/src/use-cases/run-doctor.ts
50241
+
50242
+
50243
+
50244
+
50245
+ async function loadIntent(repoPath, records, classification, ports) {
50246
+ const loaded = await ports.readIntent(repoPath);
50247
+ if (loaded.report.status !== "absent" || !ports.elicitIntent) {
50248
+ return loaded;
50249
+ }
50250
+ const questions = detectAmbiguities(records, classification);
50251
+ if (questions.length === 0) {
50252
+ return loaded;
50253
+ }
50254
+ await ports.elicitIntent(questions);
50255
+ return ports.readIntent(repoPath);
50256
+ }
50257
+ async function runDoctor(input, ports) {
50258
+ const records = await ports.scanRepository(input.repoPath);
50259
+ const classification = classifyArchetype(records);
50260
+ const snapshotRef = await ports.loadSnapshotRef(input.repoPath);
50261
+ const base = {
50262
+ records,
50263
+ classification,
50264
+ ...snapshotRef !== undefined ? {
50265
+ snapshotRef
50266
+ } : {}
50267
+ };
50268
+ if (input.summaryOnly) {
50269
+ return {
50270
+ kind: "summary",
50271
+ ...base
50272
+ };
50273
+ }
50274
+ if (classification.archetype === "none") {
50275
+ return {
50276
+ kind: "no-constructs",
50277
+ ...base
50278
+ };
50279
+ }
50280
+ const loaded = await loadIntent(input.repoPath, records, classification, ports);
50281
+ const findings = evaluate(CRITERIA, {
50282
+ records,
50283
+ classification,
50284
+ intent: loaded.intent,
50285
+ intentLoadStatus: loaded.report.status
50286
+ });
50287
+ return {
50288
+ kind: "evaluated",
50289
+ ...base,
50290
+ findings,
50291
+ intentLoad: loaded.report
50292
+ };
50293
+ }
50294
+
50295
+ ;// CONCATENATED MODULE: ../doctor/src/cli/intent-elicitor.ts
50296
+ function createConsoleConfirm(logger) {
50297
+ return (question)=>logger.prompt(question, {
50298
+ type: "confirm",
50299
+ initial: false
50300
+ });
50301
+ }
50302
+ function createIntentElicitor({ logger, confirm }) {
50303
+ return async (questions)=>{
50304
+ for (const question of questions){
50305
+ logger.info(`\n${question.hint}`);
50306
+ const answer = await confirm(question.question);
50307
+ if (answer) {
50308
+ logger.info(" Noted.");
50309
+ }
50310
+ }
50311
+ };
50312
+ }
50313
+
50314
+ ;// CONCATENATED MODULE: ../doctor/src/cli/run-doctor-command.ts
50315
+
50316
+
50317
+
50318
+
50319
+
50320
+
50321
+ const USAGE_ERROR_EXIT_CODE = 2;
50322
+ const USAGE_ERROR_LOG_FORMAT = "human";
50323
+ /**
50324
+ * Runs the shared doctor pipeline and returns the process exit code instead of exiting.
50325
+ *
50326
+ * Returns `0` when no critical or high defect is found, `1` when one is, and `2` when the
50327
+ * options are not an object or `summary` or `ci` is not a boolean. Only a programmatic caller
50328
+ * can reach `2`: the `doctor` command line goes through citty, which coerces boolean flags first.
50329
+ * An unsupported `format` is not an error; it logs a warning and renders human output.
50330
+ */ async function runDoctorCommand(rawArgs, environment) {
50331
+ const parsed = parseDoctorOptions(rawArgs);
50332
+ if (!parsed.success) {
50333
+ environment.createLogger(USAGE_ERROR_LOG_FORMAT).error(parsed.message);
50334
+ return USAGE_ERROR_EXIT_CODE;
50335
+ }
50336
+ const { options } = parsed;
50337
+ const logger = environment.createLogger(options.format);
50338
+ for (const warning of parsed.warnings){
50339
+ logger.warn(warning);
50340
+ }
50341
+ const run = await runDoctor({
50342
+ repoPath: (0,external_node_path_.resolve)(environment.cwd),
50343
+ summaryOnly: options.summary
50344
+ }, {
50345
+ ...createDoctorGateways(logger),
50346
+ ...shouldElicitIntent(options, environment.stdinIsTty, parsed.formatFellBack) ? {
50347
+ elicitIntent: createIntentElicitor({
50348
+ logger,
50349
+ confirm: environment.confirm ?? createConsoleConfirm(logger)
50350
+ })
50351
+ } : {}
50352
+ });
50353
+ return presentDoctorRun(run, options.format, {
50354
+ logger,
50355
+ writeStdout: environment.writeStdout
50356
+ });
50357
+ }
50358
+
49982
50359
  ;// CONCATENATED MODULE: ../doctor/src/index.ts
49983
50360
 
49984
50361
 
@@ -49991,108 +50368,20 @@ function evaluate(criteria, ctx) {
49991
50368
 
49992
50369
 
49993
50370
 
49994
- ;// CONCATENATED MODULE: ./src/commands/doctor.ts
49995
50371
 
49996
50372
 
49997
50373
 
50374
+ ;// CONCATENATED MODULE: ./src/commands/doctor.ts
50375
+
49998
50376
 
49999
50377
  const doctorCommand = defineCommand({
50000
50378
  meta: {
50001
50379
  name: "doctor",
50002
50380
  description: "Diagnose agentic configuration across harnesses: inventory, classify, and evaluate preconditions"
50003
50381
  },
50004
- args: {
50005
- summary: {
50006
- type: "boolean",
50007
- description: "Show archetype classification only — skip evaluation",
50008
- default: false
50009
- },
50010
- format: {
50011
- type: "string",
50012
- description: "Output format: human (default) or json",
50013
- default: "human"
50014
- },
50015
- ci: {
50016
- type: "boolean",
50017
- description: "Force non-interactive mode",
50018
- default: false
50019
- }
50020
- },
50382
+ args: DOCTOR_ARGS,
50021
50383
  async run ({ args }) {
50022
- const logger = dist_createConsola();
50023
- const repoPath = (0,external_node_path_.resolve)(process.cwd());
50024
- const format = args.format === "json" ? "json" : "human";
50025
- const records = await scanRepository(repoPath);
50026
- const classification = classifyArchetype(records);
50027
- const summary = formatSummary(records, classification);
50028
- // Load wisdom graph for snapshotRef (gracefully degrade if unavailable)
50029
- const wisdomDir = (0,external_node_path_.resolve)(repoPath, "wisdom");
50030
- let snapshotRef;
50031
- try {
50032
- const wisdomClient = createWisdomClient(wisdomDir);
50033
- const graph = await wisdomClient.getGraph();
50034
- snapshotRef = graph.snapshotRef;
50035
- } catch (err) {
50036
- if (!(err instanceof WisdomUnavailableError)) throw err;
50037
- logger.debug("Wisdom graph unavailable — snapshotRef will be omitted");
50038
- }
50039
- if (args.summary) {
50040
- if (format === "json") {
50041
- process.stdout.write(`${JSON.stringify({
50042
- archetype: summary.archetype,
50043
- dominanceScore: summary.dominanceScore,
50044
- totalRecords: summary.totalRecords,
50045
- harnessBreakdown: summary.harnessBreakdown,
50046
- crossHarnessEdges: summary.crossHarnessEdges,
50047
- inventory: toInventoryItems(records)
50048
- }, null, 2)}\n`);
50049
- } else {
50050
- renderHuman(summary, [], logger, snapshotRef);
50051
- }
50052
- return;
50053
- }
50054
- if (classification.archetype === "none") {
50055
- if (format === "json") {
50056
- process.stdout.write(`${JSON.stringify(toJson(summary, [], records, snapshotRef), null, 2)}\n`);
50057
- } else {
50058
- logger.info("No agentic constructs found in the repository.");
50059
- }
50060
- return;
50061
- }
50062
- let intentResult = await readIntentArtifact(repoPath);
50063
- // Interactive elicitation only when no intent file exists and running in
50064
- // a TTY. A present-but-rejected file is reported instead of prompting.
50065
- const isInteractive = !args.ci && process.stdin.isTTY === true;
50066
- if (intentResult.report.status === "absent" && isInteractive) {
50067
- const questions = detectAmbiguities(records, classification);
50068
- for (const q of questions){
50069
- logger.info(`\n${q.hint}`);
50070
- const answer = await logger.prompt(q.question, {
50071
- type: "confirm",
50072
- initial: false
50073
- });
50074
- if (answer) {
50075
- logger.info(" Noted.");
50076
- }
50077
- }
50078
- // After interactive prompts, re-read in case user pre-created the artifact
50079
- intentResult = await readIntentArtifact(repoPath);
50080
- }
50081
- const findings = evaluate(CRITERIA, {
50082
- records,
50083
- classification,
50084
- intent: intentResult.found ? intentResult.artifact : null,
50085
- intentLoadStatus: intentResult.report.status
50086
- });
50087
- if (format === "json") {
50088
- const report = toJson(summary, findings, records, snapshotRef, intentResult.report);
50089
- process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
50090
- } else {
50091
- renderHuman(summary, findings, logger, snapshotRef, intentResult.report);
50092
- }
50093
- if (hasBlockingFindings(findings)) {
50094
- process.exitCode = 1;
50095
- }
50384
+ process.exitCode = await runDoctorCommand(args, processDoctorEnvironment());
50096
50385
  }
50097
50386
  });
50098
50387
 
@@ -75600,7 +75889,7 @@ function readRawFormat(context) {
75600
75889
  }
75601
75890
  return "human";
75602
75891
  }
75603
- function resolveFormat(context) {
75892
+ function lint_resolveFormat(context) {
75604
75893
  const rawFormat = readRawFormat(context);
75605
75894
  if (isLintFormatType(rawFormat)) {
75606
75895
  return rawFormat;
@@ -75636,7 +75925,7 @@ async function runLintCommand(context) {
75636
75925
  if (isLessonsSubcommand(context.rawArgs ?? [])) {
75637
75926
  return;
75638
75927
  }
75639
- const format = resolveFormat(context);
75928
+ const format = lint_resolveFormat(context);
75640
75929
  const result = await executeLint(context);
75641
75930
  if (result === null) {
75642
75931
  return;
@@ -84779,4 +85068,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
84779
85068
  // module factories are used so entry inlining is disabled
84780
85069
  // startup
84781
85070
  // Load entry module and return exports
84782
- var __webpack_exports__ = __webpack_require__(9253);
85071
+ var __webpack_exports__ = __webpack_require__(9047);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/cli",
3
- "version": "5.22.26",
3
+ "version": "5.22.28",
4
4
  "description": "CLI scaffolding tool that sets up projects with structure, instructions, and feedback loops for AI coding assistants",
5
5
  "type": "module",
6
6
  "repository": {
@@ -16,14 +16,14 @@
16
16
  "@emotion/server": "11.11.0",
17
17
  "@mui/material": "9.5.0",
18
18
  "@mui/material-nextjs": "9.5.0",
19
- "next": "16.4.3",
19
+ "next": "16.4.4",
20
20
  "react": "19.3.1",
21
21
  "react-dom": "19.3.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@biomejs/biome": "2.5.15",
25
25
  "@eslint/eslintrc": "3.3.7",
26
- "@lousy-agents/mcp": "5.22.25",
26
+ "@lousy-agents/mcp": "5.22.26",
27
27
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
28
28
  "@testing-library/jest-dom": "7.0.1",
29
29
  "@testing-library/react": "16.3.3",
@@ -31,13 +31,13 @@
31
31
  "@types/react": "19.3.0",
32
32
  "@types/react-dom": "19.3.0",
33
33
  "@vitejs/plugin-react": "6.2.1",
34
- "@vitest/ui": "5.0.5",
34
+ "@vitest/ui": "5.1.0",
35
35
  "eslint": "10.14.0",
36
- "eslint-config-next": "16.4.3",
36
+ "eslint-config-next": "16.4.4",
37
37
  "happy-dom": "21.0.4",
38
38
  "jsdom": "30.1.3",
39
39
  "typescript": "7.0.2",
40
- "vitest": "5.0.5",
40
+ "vitest": "5.1.0",
41
41
  "whatwg-fetch": "3.6.20"
42
42
  }
43
43
  }