@lousy-agents/cli 5.21.23 → 5.22.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 (2) hide show
  1. package/dist/index.js +228 -44
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3053,7 +3053,7 @@ exports.basename = (path, { windows } = {}) => {
3053
3053
 
3054
3054
 
3055
3055
  },
3056
- 8535(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3056
+ 4101(__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);
@@ -46779,7 +46779,26 @@ function sortFindings(findings) {
46779
46779
  return CATEGORY_ORDER.indexOf(a.category) - CATEGORY_ORDER.indexOf(b.category);
46780
46780
  });
46781
46781
  }
46782
- function renderHuman(summary, findings, logger, snapshotRef) {
46782
+ /**
46783
+ * Prints every field of the intent load report so text output carries the
46784
+ * same status, checked path, reason, and issues as the JSON `intent` object.
46785
+ */ function renderIntentLoad(intentLoad, logger) {
46786
+ logger.info(`Intent: ${intentLoad.status}`);
46787
+ logger.info(` Checked path: ${intentLoad.checkedPath}`);
46788
+ if (intentLoad.reason !== undefined) {
46789
+ logger.info(` Reason: ${intentLoad.reason}`);
46790
+ }
46791
+ if (intentLoad.issues !== undefined && intentLoad.issues.length > 0) {
46792
+ logger.info(" Issues:");
46793
+ for (const issue of intentLoad.issues){
46794
+ logger.info(` ${issue.path}: ${issue.message}`);
46795
+ }
46796
+ if (intentLoad.omittedIssueCount !== undefined) {
46797
+ logger.info(` ...and ${intentLoad.omittedIssueCount} more`);
46798
+ }
46799
+ }
46800
+ }
46801
+ function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
46783
46802
  if (snapshotRef) {
46784
46803
  logger.info(`Evidence snapshot: ${snapshotRef}`);
46785
46804
  }
@@ -46796,6 +46815,9 @@ function renderHuman(summary, findings, logger, snapshotRef) {
46796
46815
  if (summary.crossHarnessEdges > 0) {
46797
46816
  logger.info(` Cross-harness edges: ${summary.crossHarnessEdges}`);
46798
46817
  }
46818
+ if (intentLoad !== undefined) {
46819
+ renderIntentLoad(intentLoad, logger);
46820
+ }
46799
46821
  if (findings.length === 0) {
46800
46822
  logger.success("No findings.");
46801
46823
  return;
@@ -55803,6 +55825,25 @@ function schemas_preprocess(fn, schema) {
55803
55825
  });
55804
55826
  }
55805
55827
 
55828
+ ;// CONCATENATED MODULE: ../doctor/src/entities/intent-load.ts
55829
+ /**
55830
+ * Outcome of attempting to load `.agentic-doctor/intent.json`.
55831
+ *
55832
+ * `absent` means no file exists at the checked path. Every other non-`loaded`
55833
+ * status means a file is present but was rejected, so declared intent is
55834
+ * treated as undeclared for the run.
55835
+ */ const INTENT_LOAD_STATUSES = [
55836
+ "loaded",
55837
+ "absent",
55838
+ "invalid-json",
55839
+ "invalid-schema",
55840
+ "symlink-rejected",
55841
+ "read-failed"
55842
+ ];
55843
+ function isIntentRejected(status) {
55844
+ return status !== "loaded" && status !== "absent";
55845
+ }
55846
+
55806
55847
  ;// CONCATENATED MODULE: ../doctor/src/lib/cross-harness-edges.ts
55807
55848
  function resolveEdgeTargets(edge) {
55808
55849
  return Array.isArray(edge.direction.to) ? edge.direction.to : [
@@ -55839,6 +55880,7 @@ function countCrossHarnessEdges(records) {
55839
55880
  ;// CONCATENATED MODULE: ../doctor/src/formatters/json-formatter.ts
55840
55881
 
55841
55882
 
55883
+
55842
55884
  const HarnessNameSchema = classic_schemas_enum([
55843
55885
  "claude",
55844
55886
  "copilot",
@@ -55910,6 +55952,16 @@ const FindingSchema = classic_schemas_object({
55910
55952
  evidenceCitation: CitationHandleSchema.optional(),
55911
55953
  snapshotRef: classic_schemas_string().optional()
55912
55954
  });
55955
+ const IntentLoadReportSchema = classic_schemas_object({
55956
+ status: classic_schemas_enum(INTENT_LOAD_STATUSES),
55957
+ checkedPath: classic_schemas_string(),
55958
+ reason: classic_schemas_string().optional(),
55959
+ issues: classic_schemas_array(classic_schemas_object({
55960
+ path: classic_schemas_string(),
55961
+ message: classic_schemas_string()
55962
+ })).optional(),
55963
+ omittedIssueCount: classic_schemas_number().int().positive().optional()
55964
+ });
55913
55965
  const ReportInventoryItemSchema = classic_schemas_object({
55914
55966
  id: classic_schemas_string(),
55915
55967
  path: classic_schemas_string(),
@@ -55944,6 +55996,7 @@ const ReportJsonSchema = classic_schemas_object({
55944
55996
  crossHarnessEdges: classic_schemas_number(),
55945
55997
  inventory: classic_schemas_array(ReportInventoryItemSchema),
55946
55998
  edges: classic_schemas_array(ReportEdgeSchema),
55999
+ intent: IntentLoadReportSchema.optional(),
55947
56000
  findings: classic_schemas_array(FindingSchema),
55948
56001
  snapshotRef: classic_schemas_string().optional()
55949
56002
  });
@@ -55983,7 +56036,7 @@ function toReportEdges(records) {
55983
56036
  }
55984
56037
  return result;
55985
56038
  }
55986
- function toJson(summary, findings, records, snapshotRef) {
56039
+ function toJson(summary, findings, records, snapshotRef, intentLoad) {
55987
56040
  const edges = toReportEdges(records);
55988
56041
  const report = {
55989
56042
  archetype: summary.archetype,
@@ -55993,6 +56046,9 @@ function toJson(summary, findings, records, snapshotRef) {
55993
56046
  crossHarnessEdges: edges.filter((edge)=>edge.crossHarness).length,
55994
56047
  inventory: toInventoryItems(records),
55995
56048
  edges,
56049
+ ...intentLoad !== undefined ? {
56050
+ intent: intentLoad
56051
+ } : {},
55996
56052
  findings,
55997
56053
  ...snapshotRef !== undefined ? {
55998
56054
  snapshotRef
@@ -56059,35 +56115,135 @@ const DeclaredIntentSchema = classic_schemas_object({
56059
56115
  ]),
56060
56116
  snapshotRef: classic_schemas_string().optional()
56061
56117
  });
56118
+ const MAX_SCHEMA_ISSUES = 20;
56119
+ const ErrorCodeSchema = classic_schemas_object({
56120
+ code: classic_schemas_string()
56121
+ });
56122
+ const ErrorCauseSchema = classic_schemas_object({
56123
+ cause: classic_schemas_unknown()
56124
+ });
56125
+ function intent_artifact_readErrorCode(value) {
56126
+ const parsed = ErrorCodeSchema.safeParse(value);
56127
+ return parsed.success ? parsed.data.code : undefined;
56128
+ }
56129
+ /**
56130
+ * Extracts fs-safe / errno codes from the error and, when present, its cause.
56131
+ * Each is parsed independently so a cause without a code never hides the
56132
+ * top-level code. Error messages are deliberately ignored so diagnostics
56133
+ * never depend on wording.
56134
+ */ function readErrorCodes(error) {
56135
+ const cause = ErrorCauseSchema.safeParse(error);
56136
+ return [
56137
+ intent_artifact_readErrorCode(error),
56138
+ cause.success ? intent_artifact_readErrorCode(cause.data.cause) : undefined
56139
+ ].filter((code)=>code !== undefined);
56140
+ }
56141
+ function classifyReadError(error, checkedPath) {
56142
+ const codes = readErrorCodes(error);
56143
+ const has = (code)=>codes.includes(code);
56144
+ // ENOTDIR: a path segment such as `.agentic-doctor` is a regular file,
56145
+ // so no intent file can exist at the checked path.
56146
+ if (has("not-found") || has("ENOENT") || has("ENOTDIR")) {
56147
+ return {
56148
+ status: "absent",
56149
+ checkedPath,
56150
+ reason: "No file exists at the checked path."
56151
+ };
56152
+ }
56153
+ if (has("symlink") || has("path-alias")) {
56154
+ return {
56155
+ status: "symlink-rejected",
56156
+ checkedPath,
56157
+ reason: "The checked path is or passes through a symbolic link. The intent file must be a regular file inside the repository."
56158
+ };
56159
+ }
56160
+ if (has("hardlink")) {
56161
+ return {
56162
+ status: "read-failed",
56163
+ checkedPath,
56164
+ reason: "The file is a hard link. The intent file must be a regular file with a single link."
56165
+ };
56166
+ }
56167
+ if (has("not-file") || has("EISDIR")) {
56168
+ return {
56169
+ status: "read-failed",
56170
+ checkedPath,
56171
+ reason: "The checked path is not a regular file."
56172
+ };
56173
+ }
56174
+ if (has("too-large")) {
56175
+ return {
56176
+ status: "read-failed",
56177
+ checkedPath,
56178
+ reason: `The file exceeds the ${MAX_INTENT_BYTES}-byte size limit.`
56179
+ };
56180
+ }
56181
+ const errnoCode = codes.find((code)=>/^E[A-Z]+$/.test(code));
56182
+ return {
56183
+ status: "read-failed",
56184
+ checkedPath,
56185
+ reason: errnoCode ? `The file could not be read (${errnoCode}).` : "The file could not be read."
56186
+ };
56187
+ }
56188
+ function toSchemaIssues(error) {
56189
+ const issues = error.issues.slice(0, MAX_SCHEMA_ISSUES).map((issue)=>({
56190
+ path: issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)",
56191
+ message: issue.message
56192
+ }));
56193
+ const omittedIssueCount = error.issues.length - issues.length;
56194
+ return omittedIssueCount > 0 ? {
56195
+ issues,
56196
+ omittedIssueCount
56197
+ } : {
56198
+ issues
56199
+ };
56200
+ }
56062
56201
  async function readIntentArtifact(repoRoot) {
56063
56202
  const artifactRelPath = `${ARTIFACT_DIR}/${ARTIFACT_FILENAME}`;
56064
56203
  const artifactPath = (0,external_node_path_.resolve)(repoRoot, ARTIFACT_DIR, ARTIFACT_FILENAME);
56065
56204
  let raw;
56066
56205
  try {
56067
56206
  raw = await file_system_utils_readTextWithinRoot(repoRoot, artifactRelPath, MAX_INTENT_BYTES);
56068
- } catch {
56207
+ } catch (error) {
56069
56208
  return {
56070
- found: false
56209
+ found: false,
56210
+ report: classifyReadError(error, artifactPath)
56071
56211
  };
56072
56212
  }
56073
56213
  let parsed;
56074
56214
  try {
56075
56215
  parsed = JSON.parse(raw);
56076
56216
  } catch {
56217
+ // The parser message can quote file contents, so it is not surfaced.
56077
56218
  return {
56078
- found: false
56219
+ found: false,
56220
+ report: {
56221
+ status: "invalid-json",
56222
+ checkedPath: artifactPath,
56223
+ reason: "The file is not valid JSON."
56224
+ }
56079
56225
  };
56080
56226
  }
56081
56227
  const result = DeclaredIntentSchema.safeParse(parsed);
56082
56228
  if (!result.success) {
56083
56229
  return {
56084
- found: false
56230
+ found: false,
56231
+ report: {
56232
+ status: "invalid-schema",
56233
+ checkedPath: artifactPath,
56234
+ reason: "The file does not match the intent schema.",
56235
+ ...toSchemaIssues(result.error)
56236
+ }
56085
56237
  };
56086
56238
  }
56087
56239
  return {
56088
56240
  found: true,
56089
56241
  artifact: result.data,
56090
- path: artifactPath
56242
+ path: artifactPath,
56243
+ report: {
56244
+ status: "loaded",
56245
+ checkedPath: artifactPath
56246
+ }
56091
56247
  };
56092
56248
  }
56093
56249
  async function writeIntentArtifact(repoRoot, artifact) {
@@ -56966,12 +57122,19 @@ const CRITERIA = [
56966
57122
  severity: "medium",
56967
57123
  classification: "defect",
56968
57124
  category: "governance",
56969
- description: "No declared intent artifact found at .agentic-doctor/intent.json. Without declared intent, the doctor cannot evaluate capability preconditions.",
56970
- checkMethod: "inventory.constructPresent",
56971
- checkArgs: {
56972
- harness: "claude",
56973
- constructType: "instruction"
56974
- }
57125
+ description: "No declared intent artifact found at .agentic-doctor/intent.json in the directory doctor ran from. All shipped checks still ran, and this finding alone does not fail the command. Doctor does not search parent or home directories, and declared intent does not change the detected archetype.",
57126
+ checkMethod: "intent.artifactAbsent",
57127
+ checkArgs: {}
57128
+ },
57129
+ {
57130
+ id: "invalid-intent-artifact",
57131
+ appliesToHarness: "all",
57132
+ severity: "medium",
57133
+ classification: "defect",
57134
+ category: "governance",
57135
+ description: "An intent artifact exists at .agentic-doctor/intent.json but was rejected, so doctor treated intent as undeclared. The intent status reports the checked path and the reason; fix the file and re-run doctor. This finding alone does not fail the command.",
57136
+ checkMethod: "intent.artifactRejected",
57137
+ checkArgs: {}
56975
57138
  },
56976
57139
  {
56977
57140
  id: "malformed-claude-import",
@@ -57124,6 +57287,28 @@ function detectAmbiguities(records, classification) {
57124
57287
  }
57125
57288
 
57126
57289
  ;// CONCATENATED MODULE: ../doctor/src/use-cases/evaluate-engine.ts
57290
+
57291
+ /**
57292
+ * The artifact is authoritative: a parsed intent means loaded, and a null
57293
+ * intent can never be loaded. The status only refines why intent is null.
57294
+ */ function resolveIntentLoadStatus(ctx) {
57295
+ if (ctx.intent !== null) return "loaded";
57296
+ const status = ctx.intentLoadStatus;
57297
+ return status === undefined || status === "loaded" ? "absent" : status;
57298
+ }
57299
+ function makeIntentFinding(criterion) {
57300
+ return {
57301
+ id: makeId(criterion.id, "all:intent"),
57302
+ criterionId: criterion.id,
57303
+ targetId: "all:intent",
57304
+ severity: criterion.severity,
57305
+ category: criterion.category,
57306
+ classification: criterion.classification,
57307
+ intentGated: false,
57308
+ assumedIntent: true,
57309
+ description: criterion.description
57310
+ };
57311
+ }
57127
57312
  function makeId(criterionId, targetId) {
57128
57313
  return `${criterionId}:${targetId}`;
57129
57314
  }
@@ -57147,25 +57332,19 @@ function checkFileExists(criterion, args, ctx) {
57147
57332
  }
57148
57333
  return [];
57149
57334
  }
57150
- function checkConstructPresent(criterion, ctx) {
57335
+ function checkIntentArtifactAbsent(criterion, ctx) {
57151
57336
  const hasRecords = ctx.records.length > 0;
57152
- const hasIntent = ctx.intent !== null;
57153
- if (hasRecords && !hasIntent) {
57154
- return [
57155
- {
57156
- id: makeId(criterion.id, "all:intent"),
57157
- criterionId: criterion.id,
57158
- targetId: "all:intent",
57159
- severity: criterion.severity,
57160
- category: criterion.category,
57161
- classification: criterion.classification,
57162
- intentGated: false,
57163
- assumedIntent: true,
57164
- description: criterion.description
57165
- }
57166
- ];
57167
- }
57168
- return [];
57337
+ const isAbsent = resolveIntentLoadStatus(ctx) === "absent";
57338
+ return hasRecords && isAbsent ? [
57339
+ makeIntentFinding(criterion)
57340
+ ] : [];
57341
+ }
57342
+ function checkIntentArtifactRejected(criterion, ctx) {
57343
+ const hasRecords = ctx.records.length > 0;
57344
+ const isRejected = isIntentRejected(resolveIntentLoadStatus(ctx));
57345
+ return hasRecords && isRejected ? [
57346
+ makeIntentFinding(criterion)
57347
+ ] : [];
57169
57348
  }
57170
57349
  function checkEdgePresent(criterion, args, ctx) {
57171
57350
  const fromRecords = ctx.records.filter((r)=>r.harness === args.fromHarness);
@@ -57282,9 +57461,9 @@ function evaluate(criteria, ctx) {
57282
57461
  findings.push(...checkFileExists(criterion, criterion.checkArgs, ctx));
57283
57462
  break;
57284
57463
  }
57285
- case "inventory.constructPresent":
57464
+ case "intent.artifactAbsent":
57286
57465
  {
57287
- findings.push(...checkConstructPresent(criterion, ctx));
57466
+ findings.push(...checkIntentArtifactAbsent(criterion, ctx));
57288
57467
  break;
57289
57468
  }
57290
57469
  case "inventory.edgePresent":
@@ -57312,6 +57491,11 @@ function evaluate(criteria, ctx) {
57312
57491
  findings.push(...checkCapabilityDeclared(criterion, ctx));
57313
57492
  break;
57314
57493
  }
57494
+ case "intent.artifactRejected":
57495
+ {
57496
+ findings.push(...checkIntentArtifactRejected(criterion, ctx));
57497
+ break;
57498
+ }
57315
57499
  default:
57316
57500
  break;
57317
57501
  }
@@ -57399,11 +57583,11 @@ const doctorCommand = defineCommand({
57399
57583
  }
57400
57584
  return;
57401
57585
  }
57402
- const intentResult = await readIntentArtifact(repoPath);
57403
- let intent = intentResult.found ? intentResult.artifact : null;
57404
- // Interactive elicitation when no intent artifact and running in a TTY
57586
+ let intentResult = await readIntentArtifact(repoPath);
57587
+ // Interactive elicitation only when no intent file exists and running in
57588
+ // a TTY. A present-but-rejected file is reported instead of prompting.
57405
57589
  const isInteractive = !args.ci && process.stdin.isTTY === true;
57406
- if (intent === null && isInteractive) {
57590
+ if (intentResult.report.status === "absent" && isInteractive) {
57407
57591
  const questions = detectAmbiguities(records, classification);
57408
57592
  for (const q of questions){
57409
57593
  logger.info(`\n${q.hint}`);
@@ -57416,19 +57600,19 @@ const doctorCommand = defineCommand({
57416
57600
  }
57417
57601
  }
57418
57602
  // After interactive prompts, re-read in case user pre-created the artifact
57419
- const retried = await readIntentArtifact(repoPath);
57420
- if (retried.found) intent = retried.artifact;
57603
+ intentResult = await readIntentArtifact(repoPath);
57421
57604
  }
57422
57605
  const findings = evaluate(CRITERIA, {
57423
57606
  records,
57424
57607
  classification,
57425
- intent
57608
+ intent: intentResult.found ? intentResult.artifact : null,
57609
+ intentLoadStatus: intentResult.report.status
57426
57610
  });
57427
57611
  if (format === "json") {
57428
- const report = toJson(summary, findings, records, snapshotRef);
57612
+ const report = toJson(summary, findings, records, snapshotRef, intentResult.report);
57429
57613
  process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
57430
57614
  } else {
57431
- renderHuman(summary, findings, logger, snapshotRef);
57615
+ renderHuman(summary, findings, logger, snapshotRef, intentResult.report);
57432
57616
  }
57433
57617
  if (hasBlockingFindings(findings)) {
57434
57618
  process.exitCode = 1;
@@ -110211,4 +110395,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
110211
110395
  // module factories are used so entry inlining is disabled
110212
110396
  // startup
110213
110397
  // Load entry module and return exports
110214
- var __webpack_exports__ = __webpack_require__(8535);
110398
+ var __webpack_exports__ = __webpack_require__(4101);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/cli",
3
- "version": "5.21.23",
3
+ "version": "5.22.0",
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": {