@living-architecture/riviere-cli 0.9.21 → 0.9.22

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 (3) hide show
  1. package/dist/bin.js +167 -135
  2. package/dist/index.js +166 -134
  3. package/package.json +6 -6
package/dist/bin.js CHANGED
@@ -24704,7 +24704,7 @@ function failure13(code, message) {
24704
24704
  };
24705
24705
  }
24706
24706
 
24707
- // src/features/builder/entrypoint/add-component.ts
24707
+ // src/features/builder/entrypoint/add-component/entrypoint.ts
24708
24708
  import { Command } from "commander";
24709
24709
 
24710
24710
  // src/platform/infra/cli/presentation/error-codes.ts
@@ -24785,7 +24785,7 @@ function withParsedLineNumber(lineNumber) {
24785
24785
  return lineNumber === void 0 ? {} : { lineNumber: Number.parseInt(lineNumber, 10) };
24786
24786
  }
24787
24787
 
24788
- // src/features/builder/entrypoint/add-component.ts
24788
+ // src/features/builder/entrypoint/add-component/entrypoint.ts
24789
24789
  function createAddComponentCommand(addComponent) {
24790
24790
  return new Command("add-component").description("Add a component to the graph").requiredOption(
24791
24791
  "--type <type>",
@@ -24819,7 +24819,7 @@ var CLI_ERROR_CODES = {
24819
24819
  DUPLICATE_COMPONENT: "DUPLICATE_COMPONENT" /* DuplicateComponent */
24820
24820
  };
24821
24821
 
24822
- // src/features/builder/entrypoint/add-domain.ts
24822
+ // src/features/builder/entrypoint/add-domain/entrypoint.ts
24823
24823
  import { Command as Command2 } from "commander";
24824
24824
 
24825
24825
  // src/platform/infra/cli/input/component-types.ts
@@ -24887,7 +24887,7 @@ function isValidLinkType(value) {
24887
24887
  return VALID_LINK_TYPES.some((t) => t === value);
24888
24888
  }
24889
24889
 
24890
- // src/features/builder/entrypoint/add-domain.ts
24890
+ // src/features/builder/entrypoint/add-domain/entrypoint.ts
24891
24891
  function createAddDomainCommand(addDomain) {
24892
24892
  return new Command2("add-domain").description("Add a domain to the graph").addHelpText(
24893
24893
  "after",
@@ -24938,7 +24938,7 @@ Examples:
24938
24938
  });
24939
24939
  }
24940
24940
 
24941
- // src/features/builder/entrypoint/add-source.ts
24941
+ // src/features/builder/entrypoint/add-source/entrypoint.ts
24942
24942
  import { Command as Command3 } from "commander";
24943
24943
  function createAddSourceCommand(addSource) {
24944
24944
  return new Command3("add-source").description("Add a source repository to the graph").addHelpText(
@@ -24971,7 +24971,7 @@ Examples:
24971
24971
  });
24972
24972
  }
24973
24973
 
24974
- // src/features/builder/entrypoint/check-consistency.ts
24974
+ // src/features/builder/entrypoint/check-consistency/entrypoint.ts
24975
24975
  import { Command as Command4 } from "commander";
24976
24976
  function createCheckConsistencyCommand(checkConsistency) {
24977
24977
  return new Command4("check-consistency").description("Check for structural issues in the graph").addHelpText(
@@ -25008,7 +25008,7 @@ Examples:
25008
25008
  });
25009
25009
  }
25010
25010
 
25011
- // src/features/builder/entrypoint/component-checklist.ts
25011
+ // src/features/builder/entrypoint/component-checklist/entrypoint.ts
25012
25012
  import { Command as Command5 } from "commander";
25013
25013
  function createComponentChecklistCommand(componentChecklist) {
25014
25014
  return new Command5("component-checklist").description("List components as a checklist for linking/enrichment").addHelpText(
@@ -25061,7 +25061,7 @@ Examples:
25061
25061
  });
25062
25062
  }
25063
25063
 
25064
- // src/features/builder/entrypoint/component-summary.ts
25064
+ // src/features/builder/entrypoint/component-summary/entrypoint.ts
25065
25065
  import { Command as Command6 } from "commander";
25066
25066
  function createComponentSummaryCommand(componentSummary) {
25067
25067
  return new Command6("component-summary").description("Show component counts by type and domain").addHelpText(
@@ -25089,7 +25089,7 @@ Examples:
25089
25089
  });
25090
25090
  }
25091
25091
 
25092
- // src/features/builder/entrypoint/define-custom-type.ts
25092
+ // src/features/builder/entrypoint/define-custom-type/entrypoint.ts
25093
25093
  import { Command as Command7 } from "commander";
25094
25094
 
25095
25095
  // src/platform/infra/cli/input/custom-type-parser.ts
@@ -25150,7 +25150,7 @@ function collectOption(value, previous) {
25150
25150
  return [...previous, value];
25151
25151
  }
25152
25152
 
25153
- // src/features/builder/entrypoint/define-custom-type.ts
25153
+ // src/features/builder/entrypoint/define-custom-type/entrypoint.ts
25154
25154
  function createDefineCustomTypeCommand(defineCustomType) {
25155
25155
  return new Command7("define-custom-type").description("Define a custom component type").requiredOption("--name <name>", "Custom type name").option("--description <desc>", "Custom type description").option(
25156
25156
  "--required-property <spec>",
@@ -25200,7 +25200,7 @@ function createDefineCustomTypeCommand(defineCustomType) {
25200
25200
  });
25201
25201
  }
25202
25202
 
25203
- // src/features/builder/entrypoint/enrich.ts
25203
+ // src/features/builder/entrypoint/enrich/entrypoint.ts
25204
25204
  import { Command as Command8 } from "commander";
25205
25205
 
25206
25206
  // src/platform/infra/cli/input/enrichment-parser.ts
@@ -25299,7 +25299,7 @@ function parseSignature(input) {
25299
25299
  };
25300
25300
  }
25301
25301
 
25302
- // src/features/builder/entrypoint/enrich.ts
25302
+ // src/features/builder/entrypoint/enrich/entrypoint.ts
25303
25303
  function createEnrichCommand(enrichComponent) {
25304
25304
  return new Command8("enrich").description(
25305
25305
  "Enrich a DomainOp component with semantic information. Note: Enrichment is additive \u2014 running multiple times accumulates values."
@@ -25371,7 +25371,7 @@ Examples:
25371
25371
  });
25372
25372
  }
25373
25373
 
25374
- // src/features/builder/entrypoint/finalize.ts
25374
+ // src/features/builder/entrypoint/finalize/entrypoint.ts
25375
25375
  import { Command as Command9 } from "commander";
25376
25376
  import { writeFile } from "node:fs/promises";
25377
25377
  function createFinalizeCommand(finalizeGraph) {
@@ -25404,7 +25404,7 @@ Examples:
25404
25404
  });
25405
25405
  }
25406
25406
 
25407
- // src/features/builder/entrypoint/init.ts
25407
+ // src/features/builder/entrypoint/init/entrypoint.ts
25408
25408
  import { Command as Command10 } from "commander";
25409
25409
 
25410
25410
  // src/platform/infra/cli/input/domain-input-parser.ts
@@ -25426,7 +25426,7 @@ function parseDomainJson(value, previous) {
25426
25426
  return [...previous, parsed];
25427
25427
  }
25428
25428
 
25429
- // src/features/builder/entrypoint/init.ts
25429
+ // src/features/builder/entrypoint/init/entrypoint.ts
25430
25430
  function createInitCommand(initGraph) {
25431
25431
  return new Command10("init").description("Initialize a new graph").addHelpText(
25432
25432
  "after",
@@ -25501,7 +25501,7 @@ Examples:
25501
25501
  });
25502
25502
  }
25503
25503
 
25504
- // src/features/builder/entrypoint/link.ts
25504
+ // src/features/builder/entrypoint/link/entrypoint.ts
25505
25505
  import { Command as Command11 } from "commander";
25506
25506
 
25507
25507
  // src/platform/infra/cli/input/validation.ts
@@ -25551,7 +25551,7 @@ function validateHttpMethod(method) {
25551
25551
  };
25552
25552
  }
25553
25553
 
25554
- // src/features/builder/entrypoint/link.ts
25554
+ // src/features/builder/entrypoint/link/entrypoint.ts
25555
25555
  function createLinkCommand(linkComponents) {
25556
25556
  return new Command11("link").description("Link two components").addHelpText(
25557
25557
  "after",
@@ -25609,7 +25609,7 @@ Examples:
25609
25609
  });
25610
25610
  }
25611
25611
 
25612
- // src/features/builder/entrypoint/link-external.ts
25612
+ // src/features/builder/entrypoint/link-external/entrypoint.ts
25613
25613
  import { Command as Command12 } from "commander";
25614
25614
 
25615
25615
  // src/platform/infra/cli/input/link-external-transformer.ts
@@ -25621,7 +25621,7 @@ function buildExternalTarget(options) {
25621
25621
  };
25622
25622
  }
25623
25623
 
25624
- // src/features/builder/entrypoint/link-external.ts
25624
+ // src/features/builder/entrypoint/link-external/entrypoint.ts
25625
25625
  function createLinkExternalCommand(linkExternal) {
25626
25626
  return new Command12("link-external").description("Link a component to an external system").addHelpText(
25627
25627
  "after",
@@ -25668,7 +25668,7 @@ Examples:
25668
25668
  });
25669
25669
  }
25670
25670
 
25671
- // src/features/builder/entrypoint/link-http.ts
25671
+ // src/features/builder/entrypoint/link-http/entrypoint.ts
25672
25672
  import { Command as Command13 } from "commander";
25673
25673
 
25674
25674
  // src/platform/infra/cli/input/link-http-validator.ts
@@ -25682,7 +25682,7 @@ function validateOptions(options) {
25682
25682
  return void 0;
25683
25683
  }
25684
25684
 
25685
- // src/features/builder/entrypoint/link-http.ts
25685
+ // src/features/builder/entrypoint/link-http/entrypoint.ts
25686
25686
  function createLinkHttpCommand(linkHttp) {
25687
25687
  return new Command13("link-http").description("Find an API by HTTP path and link to a target component").addHelpText(
25688
25688
  "after",
@@ -25736,7 +25736,7 @@ Examples:
25736
25736
  });
25737
25737
  }
25738
25738
 
25739
- // src/features/builder/entrypoint/validate.ts
25739
+ // src/features/builder/entrypoint/validate/entrypoint.ts
25740
25740
  import { Command as Command14 } from "commander";
25741
25741
  function createValidateCommand(validateGraph3) {
25742
25742
  return new Command14("validate").description("Validate the graph for errors and warnings").addHelpText(
@@ -29765,7 +29765,7 @@ function loadProjectFromInput(extractionProjectRepository, extractDraftComponent
29765
29765
  });
29766
29766
  }
29767
29767
 
29768
- // src/features/extract/entrypoint/extract.ts
29768
+ // src/features/extract/entrypoint/extract/entrypoint.ts
29769
29769
  import { Command as Command15 } from "commander";
29770
29770
 
29771
29771
  // src/platform/infra/cli/presentation/exit-with-cli-error.ts
@@ -29824,7 +29824,7 @@ function validateFlagCombinations(options) {
29824
29824
  validateFormatOption(options);
29825
29825
  }
29826
29826
 
29827
- // src/features/extract/commands/create-extract-draft-components-input.ts
29827
+ // src/features/extract/entrypoint/extract/create-extract-draft-components-input.ts
29828
29828
  function createExtractDraftComponentsInput(options) {
29829
29829
  return {
29830
29830
  allowIncomplete: options.allowIncomplete === true,
@@ -29847,7 +29847,7 @@ function readSourceMode(options) {
29847
29847
  return options.files === void 0 ? "all" : "files";
29848
29848
  }
29849
29849
 
29850
- // src/features/extract/commands/create-enrich-draft-components-input.ts
29850
+ // src/features/extract/entrypoint/extract/create-enrich-draft-components-input.ts
29851
29851
  function createEnrichDraftComponentsInput(options, enrichPath) {
29852
29852
  return {
29853
29853
  allowIncomplete: options.allowIncomplete === true,
@@ -29996,7 +29996,7 @@ function outputResult(data, options) {
29996
29996
  console.log(JSON.stringify(data));
29997
29997
  }
29998
29998
 
29999
- // src/features/extract/infra/cli/output/present-extraction-result.ts
29999
+ // src/features/extract/entrypoint/extract/present-extraction-result.ts
30000
30000
  function presentExtractionResult(result, options) {
30001
30001
  if (result.kind === "draftOnly") {
30002
30002
  presentDraftResult(result.components, options);
@@ -30049,7 +30049,7 @@ function createOutputOptions(outputPath) {
30049
30049
  return outputPath === void 0 ? {} : { output: outputPath };
30050
30050
  }
30051
30051
 
30052
- // src/features/extract/entrypoint/extract.ts
30052
+ // src/features/extract/entrypoint/extract/entrypoint.ts
30053
30053
  function createExtractCommand(extractDraftComponents, enrichDraftComponents) {
30054
30054
  return new Command15("extract").description("Extract architectural components from source code").requiredOption("--config <path>", "Path to extraction config file").option("--dry-run", "Show component counts per domain without full output").option("-o, --output <file>", "Write output to file instead of stdout").option("--components-only", "Output only component identity (no metadata enrichment)").option("--enrich <file>", "Read draft components from file and enrich with extraction rules").option("--allow-incomplete", "Output components even when some extraction fields fail").option("--pr", "Extract from files changed in current branch vs base branch").option("--base <branch>", "Override base branch for --pr (default: auto-detect)").option("--files <paths...>", "Extract from specific files").option("--format <type>", "Output format: json (default) or markdown").option("--stats", "Show extraction statistics on stderr").option("--no-ts-config", "Skip tsconfig.json auto-discovery (disables full type resolution)").action(
30055
30055
  (options) => {
@@ -30092,14 +30092,48 @@ var RiviereQueryRepository = class {
30092
30092
  }
30093
30093
  };
30094
30094
 
30095
+ // src/features/query/queries/query-graph-load-failure.ts
30096
+ function toQueryGraphLoadFailure(error48) {
30097
+ if (error48 instanceof GraphNotFoundError) {
30098
+ return {
30099
+ kind: "graphNotFound",
30100
+ message: error48.message
30101
+ };
30102
+ }
30103
+ if (error48 instanceof GraphCorruptedError) {
30104
+ return {
30105
+ kind: "graphCorrupted",
30106
+ message: "Graph file contains invalid JSON"
30107
+ };
30108
+ }
30109
+ return void 0;
30110
+ }
30111
+ function loadQueryGraph(repository, graphPathOption) {
30112
+ try {
30113
+ return {
30114
+ kind: "loaded",
30115
+ query: repository.load(graphPathOption)
30116
+ };
30117
+ } catch (error48) {
30118
+ const failure14 = toQueryGraphLoadFailure(error48);
30119
+ if (failure14 !== void 0) {
30120
+ return failure14;
30121
+ }
30122
+ throw error48;
30123
+ }
30124
+ }
30125
+
30095
30126
  // src/features/query/queries/detect-orphans.ts
30096
30127
  var DetectOrphans = class {
30097
30128
  constructor(repository) {
30098
30129
  this.repository = repository;
30099
30130
  }
30100
30131
  execute(input) {
30101
- const query = this.repository.load(input.graphPathOption);
30102
- return { orphans: query.detectOrphans() };
30132
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30133
+ if (loaded.kind !== "loaded") {
30134
+ return loaded;
30135
+ }
30136
+ return { orphans: loaded.query.detectOrphans() };
30103
30137
  }
30104
30138
  };
30105
30139
 
@@ -30109,8 +30143,11 @@ var ListComponents = class {
30109
30143
  this.repository = repository;
30110
30144
  }
30111
30145
  execute(input) {
30112
- const query = this.repository.load(input.graphPathOption);
30113
- const allComponents = query.components();
30146
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30147
+ if (loaded.kind !== "loaded") {
30148
+ return loaded;
30149
+ }
30150
+ const allComponents = loaded.query.components();
30114
30151
  const filteredByDomain = input.domain === void 0 ? allComponents : allComponents.filter((component) => component.domain === input.domain);
30115
30152
  return {
30116
30153
  components: input.type === void 0 ? filteredByDomain : filteredByDomain.filter((component) => component.type === input.type)
@@ -30124,8 +30161,11 @@ var ListDomains = class {
30124
30161
  this.repository = repository;
30125
30162
  }
30126
30163
  execute(input) {
30127
- const query = this.repository.load(input.graphPathOption);
30128
- return { domains: query.domains() };
30164
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30165
+ if (loaded.kind !== "loaded") {
30166
+ return loaded;
30167
+ }
30168
+ return { domains: loaded.query.domains() };
30129
30169
  }
30130
30170
  };
30131
30171
 
@@ -30135,8 +30175,11 @@ var ListEntryPoints = class {
30135
30175
  this.repository = repository;
30136
30176
  }
30137
30177
  execute(input) {
30138
- const query = this.repository.load(input.graphPathOption);
30139
- return { entryPoints: query.entryPoints() };
30178
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30179
+ if (loaded.kind !== "loaded") {
30180
+ return loaded;
30181
+ }
30182
+ return { entryPoints: loaded.query.entryPoints() };
30140
30183
  }
30141
30184
  };
30142
30185
 
@@ -30146,8 +30189,11 @@ var SearchComponents = class {
30146
30189
  this.repository = repository;
30147
30190
  }
30148
30191
  execute(input) {
30149
- const query = this.repository.load(input.graphPathOption);
30150
- return { components: query.search(input.term) };
30192
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30193
+ if (loaded.kind !== "loaded") {
30194
+ return loaded;
30195
+ }
30196
+ return { components: loaded.query.search(input.term) };
30151
30197
  }
30152
30198
  };
30153
30199
 
@@ -30157,11 +30203,14 @@ var TraceFlow = class {
30157
30203
  this.repository = repository;
30158
30204
  }
30159
30205
  execute(input) {
30160
- const query = this.repository.load(input.graphPathOption);
30206
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30207
+ if (loaded.kind !== "loaded") {
30208
+ return loaded;
30209
+ }
30161
30210
  try {
30162
30211
  const componentId = parseComponentId(input.componentId);
30163
30212
  return {
30164
- flow: query.traceFlow(componentId),
30213
+ flow: loaded.query.traceFlow(componentId),
30165
30214
  success: true
30166
30215
  };
30167
30216
  } catch (error48) {
@@ -30169,7 +30218,11 @@ var TraceFlow = class {
30169
30218
  throw error48;
30170
30219
  }
30171
30220
  const parsedId = ComponentId.parse(input.componentId);
30172
- const matches = findNearMatches(query.components(), { name: parsedId.name() }, { limit: 3 });
30221
+ const matches = findNearMatches(
30222
+ loaded.query.components(),
30223
+ { name: parsedId.name() },
30224
+ { limit: 3 }
30225
+ );
30173
30226
  return {
30174
30227
  message: error48.message,
30175
30228
  success: false,
@@ -30179,22 +30232,13 @@ var TraceFlow = class {
30179
30232
  }
30180
30233
  };
30181
30234
 
30182
- // src/features/query/entrypoint/components.ts
30235
+ // src/features/query/entrypoint/components/entrypoint.ts
30183
30236
  import { Command as Command16 } from "commander";
30184
30237
 
30185
- // src/platform/infra/cli/presentation/query-graph-load-error-handler.ts
30186
- function handleQueryGraphLoadError(error48) {
30187
- if (error48 instanceof GraphNotFoundError) {
30188
- console.log(JSON.stringify(formatError2("GRAPH_NOT_FOUND" /* GraphNotFound */, error48.message)));
30189
- return true;
30190
- }
30191
- if (error48 instanceof GraphCorruptedError) {
30192
- console.log(
30193
- JSON.stringify(formatError2("GRAPH_CORRUPTED" /* GraphCorrupted */, "Graph file contains invalid JSON"))
30194
- );
30195
- return true;
30196
- }
30197
- return false;
30238
+ // src/platform/infra/cli/presentation/query-graph-load-failure-output.ts
30239
+ function formatQueryGraphLoadFailure(failure14) {
30240
+ const code = failure14.kind === "graphNotFound" ? "GRAPH_NOT_FOUND" /* GraphNotFound */ : "GRAPH_CORRUPTED" /* GraphCorrupted */;
30241
+ return formatError2(code, failure14.message);
30198
30242
  }
30199
30243
 
30200
30244
  // src/platform/infra/cli/presentation/component-output.ts
@@ -30207,7 +30251,7 @@ function toComponentOutput(component) {
30207
30251
  };
30208
30252
  }
30209
30253
 
30210
- // src/features/query/entrypoint/components.ts
30254
+ // src/features/query/entrypoint/components/entrypoint.ts
30211
30255
  function createComponentsCommand(listComponents) {
30212
30256
  return new Command16("components").description("List components with optional filtering").addHelpText(
30213
30257
  "after",
@@ -30228,25 +30272,23 @@ Examples:
30228
30272
  }
30229
30273
  return;
30230
30274
  }
30231
- try {
30232
- const result = listComponents.execute({
30233
- domain: options.domain,
30234
- graphPathOption: options.graph,
30235
- type: options.type === void 0 ? void 0 : normalizeToSchemaComponentType(options.type)
30236
- });
30237
- const components = result.components.map(toComponentOutput);
30238
- if (options.json) {
30239
- console.log(JSON.stringify(formatSuccess({ components })));
30240
- }
30241
- } catch (error48) {
30242
- if (!handleQueryGraphLoadError(error48)) {
30243
- throw error48;
30244
- }
30275
+ const result = listComponents.execute({
30276
+ domain: options.domain,
30277
+ graphPathOption: options.graph,
30278
+ type: options.type === void 0 ? void 0 : normalizeToSchemaComponentType(options.type)
30279
+ });
30280
+ if ("kind" in result) {
30281
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30282
+ return;
30283
+ }
30284
+ const components = result.components.map(toComponentOutput);
30285
+ if (options.json) {
30286
+ console.log(JSON.stringify(formatSuccess({ components })));
30245
30287
  }
30246
30288
  });
30247
30289
  }
30248
30290
 
30249
- // src/features/query/entrypoint/domains.ts
30291
+ // src/features/query/entrypoint/domains/entrypoint.ts
30250
30292
  import { Command as Command17 } from "commander";
30251
30293
  function createDomainsCommand(listDomains) {
30252
30294
  return new Command17("domains").description("List domains with component counts").addHelpText(
@@ -30257,20 +30299,18 @@ Examples:
30257
30299
  $ riviere query domains --json
30258
30300
  `
30259
30301
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30260
- try {
30261
- const result = listDomains.execute({ graphPathOption: options.graph });
30262
- if (options.json) {
30263
- console.log(JSON.stringify(formatSuccess(result)));
30264
- }
30265
- } catch (error48) {
30266
- if (!handleQueryGraphLoadError(error48)) {
30267
- throw error48;
30268
- }
30302
+ const result = listDomains.execute({ graphPathOption: options.graph });
30303
+ if ("kind" in result) {
30304
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30305
+ return;
30306
+ }
30307
+ if (options.json) {
30308
+ console.log(JSON.stringify(formatSuccess(result)));
30269
30309
  }
30270
30310
  });
30271
30311
  }
30272
30312
 
30273
- // src/features/query/entrypoint/entry-points.ts
30313
+ // src/features/query/entrypoint/entry-points/entrypoint.ts
30274
30314
  import { Command as Command18 } from "commander";
30275
30315
  function createEntryPointsCommand(listEntryPoints) {
30276
30316
  return new Command18("entry-points").description("List entry points (APIs, UIs, EventHandlers with no incoming links)").addHelpText(
@@ -30281,20 +30321,18 @@ Examples:
30281
30321
  $ riviere query entry-points --json
30282
30322
  `
30283
30323
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30284
- try {
30285
- const result = listEntryPoints.execute({ graphPathOption: options.graph });
30286
- if (options.json) {
30287
- console.log(JSON.stringify(formatSuccess(result)));
30288
- }
30289
- } catch (error48) {
30290
- if (!handleQueryGraphLoadError(error48)) {
30291
- throw error48;
30292
- }
30324
+ const result = listEntryPoints.execute({ graphPathOption: options.graph });
30325
+ if ("kind" in result) {
30326
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30327
+ return;
30328
+ }
30329
+ if (options.json) {
30330
+ console.log(JSON.stringify(formatSuccess(result)));
30293
30331
  }
30294
30332
  });
30295
30333
  }
30296
30334
 
30297
- // src/features/query/entrypoint/orphans.ts
30335
+ // src/features/query/entrypoint/orphans/entrypoint.ts
30298
30336
  import { Command as Command19 } from "commander";
30299
30337
  function createOrphansCommand(detectOrphans) {
30300
30338
  return new Command19("orphans").description("Find orphan components with no links").addHelpText(
@@ -30305,20 +30343,18 @@ Examples:
30305
30343
  $ riviere query orphans --json
30306
30344
  `
30307
30345
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30308
- try {
30309
- const result = detectOrphans.execute({ graphPathOption: options.graph });
30310
- if (options.json) {
30311
- console.log(JSON.stringify(formatSuccess(result)));
30312
- }
30313
- } catch (error48) {
30314
- if (!handleQueryGraphLoadError(error48)) {
30315
- throw error48;
30316
- }
30346
+ const result = detectOrphans.execute({ graphPathOption: options.graph });
30347
+ if ("kind" in result) {
30348
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30349
+ return;
30350
+ }
30351
+ if (options.json) {
30352
+ console.log(JSON.stringify(formatSuccess(result)));
30317
30353
  }
30318
30354
  });
30319
30355
  }
30320
30356
 
30321
- // src/features/query/entrypoint/search.ts
30357
+ // src/features/query/entrypoint/search/entrypoint.ts
30322
30358
  import { Command as Command20 } from "commander";
30323
30359
  function createSearchCommand(searchComponents2) {
30324
30360
  return new Command20("search").description("Search components by name").addHelpText(
@@ -30329,24 +30365,22 @@ Examples:
30329
30365
  $ riviere query search "place-order" --json
30330
30366
  `
30331
30367
  ).argument("<term>", "Search term").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (term, options) => {
30332
- try {
30333
- const result = searchComponents2.execute({
30334
- graphPathOption: options.graph,
30335
- term
30336
- });
30337
- const components = result.components.map(toComponentOutput);
30338
- if (options.json) {
30339
- console.log(JSON.stringify(formatSuccess({ components })));
30340
- }
30341
- } catch (error48) {
30342
- if (!handleQueryGraphLoadError(error48)) {
30343
- throw error48;
30344
- }
30368
+ const result = searchComponents2.execute({
30369
+ graphPathOption: options.graph,
30370
+ term
30371
+ });
30372
+ if ("kind" in result) {
30373
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30374
+ return;
30375
+ }
30376
+ const components = result.components.map(toComponentOutput);
30377
+ if (options.json) {
30378
+ console.log(JSON.stringify(formatSuccess({ components })));
30345
30379
  }
30346
30380
  });
30347
30381
  }
30348
30382
 
30349
- // src/features/query/entrypoint/trace.ts
30383
+ // src/features/query/entrypoint/trace/entrypoint.ts
30350
30384
  import { Command as Command21 } from "commander";
30351
30385
  function createTraceCommand(traceFlow) {
30352
30386
  return new Command21("trace").description("Trace flow from a component (bidirectional)").addHelpText(
@@ -30357,26 +30391,24 @@ Examples:
30357
30391
  $ riviere query trace "orders:checkout:usecase:placeorder" --json
30358
30392
  `
30359
30393
  ).argument("<componentId>", "Component ID to trace from").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (componentIdArg, options) => {
30360
- try {
30361
- const result = traceFlow.execute({
30362
- componentId: componentIdArg,
30363
- graphPathOption: options.graph
30364
- });
30365
- if (!result.success) {
30366
- console.log(
30367
- JSON.stringify(
30368
- formatError2("COMPONENT_NOT_FOUND" /* ComponentNotFound */, result.message, result.suggestions)
30369
- )
30370
- );
30371
- return;
30372
- }
30373
- if (options.json) {
30374
- console.log(JSON.stringify(formatSuccess(result.flow)));
30375
- }
30376
- } catch (error48) {
30377
- if (!handleQueryGraphLoadError(error48)) {
30378
- throw error48;
30379
- }
30394
+ const result = traceFlow.execute({
30395
+ componentId: componentIdArg,
30396
+ graphPathOption: options.graph
30397
+ });
30398
+ if ("kind" in result) {
30399
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30400
+ return;
30401
+ }
30402
+ if (!result.success) {
30403
+ console.log(
30404
+ JSON.stringify(
30405
+ formatError2("COMPONENT_NOT_FOUND" /* ComponentNotFound */, result.message, result.suggestions)
30406
+ )
30407
+ );
30408
+ return;
30409
+ }
30410
+ if (options.json) {
30411
+ console.log(JSON.stringify(formatSuccess(result.flow)));
30380
30412
  }
30381
30413
  });
30382
30414
  }
@@ -30399,7 +30431,7 @@ function parsePackageJson(pkg) {
30399
30431
  }
30400
30432
  function loadPackageJson() {
30401
30433
  if (true) {
30402
- return { version: "0.9.20" };
30434
+ return { version: "0.9.21" };
30403
30435
  }
30404
30436
  const require2 = createRequire2(import.meta.url);
30405
30437
  return parsePackageJson(require2("../../package.json"));
package/dist/index.js CHANGED
@@ -24703,7 +24703,7 @@ function failure13(code, message) {
24703
24703
  };
24704
24704
  }
24705
24705
 
24706
- // src/features/builder/entrypoint/add-component.ts
24706
+ // src/features/builder/entrypoint/add-component/entrypoint.ts
24707
24707
  import { Command } from "commander";
24708
24708
 
24709
24709
  // src/platform/infra/cli/presentation/error-codes.ts
@@ -24809,7 +24809,7 @@ function withParsedLineNumber(lineNumber) {
24809
24809
  return lineNumber === void 0 ? {} : { lineNumber: Number.parseInt(lineNumber, 10) };
24810
24810
  }
24811
24811
 
24812
- // src/features/builder/entrypoint/add-component.ts
24812
+ // src/features/builder/entrypoint/add-component/entrypoint.ts
24813
24813
  function createAddComponentCommand(addComponent) {
24814
24814
  return new Command("add-component").description("Add a component to the graph").requiredOption(
24815
24815
  "--type <type>",
@@ -24843,7 +24843,7 @@ var CLI_ERROR_CODES = {
24843
24843
  DUPLICATE_COMPONENT: "DUPLICATE_COMPONENT" /* DuplicateComponent */
24844
24844
  };
24845
24845
 
24846
- // src/features/builder/entrypoint/add-domain.ts
24846
+ // src/features/builder/entrypoint/add-domain/entrypoint.ts
24847
24847
  import { Command as Command2 } from "commander";
24848
24848
 
24849
24849
  // src/platform/infra/cli/input/component-types.ts
@@ -24911,7 +24911,7 @@ function isValidLinkType(value) {
24911
24911
  return VALID_LINK_TYPES.some((t) => t === value);
24912
24912
  }
24913
24913
 
24914
- // src/features/builder/entrypoint/add-domain.ts
24914
+ // src/features/builder/entrypoint/add-domain/entrypoint.ts
24915
24915
  function createAddDomainCommand(addDomain) {
24916
24916
  return new Command2("add-domain").description("Add a domain to the graph").addHelpText(
24917
24917
  "after",
@@ -24962,7 +24962,7 @@ Examples:
24962
24962
  });
24963
24963
  }
24964
24964
 
24965
- // src/features/builder/entrypoint/add-source.ts
24965
+ // src/features/builder/entrypoint/add-source/entrypoint.ts
24966
24966
  import { Command as Command3 } from "commander";
24967
24967
  function createAddSourceCommand(addSource) {
24968
24968
  return new Command3("add-source").description("Add a source repository to the graph").addHelpText(
@@ -24995,7 +24995,7 @@ Examples:
24995
24995
  });
24996
24996
  }
24997
24997
 
24998
- // src/features/builder/entrypoint/check-consistency.ts
24998
+ // src/features/builder/entrypoint/check-consistency/entrypoint.ts
24999
24999
  import { Command as Command4 } from "commander";
25000
25000
  function createCheckConsistencyCommand(checkConsistency) {
25001
25001
  return new Command4("check-consistency").description("Check for structural issues in the graph").addHelpText(
@@ -25032,7 +25032,7 @@ Examples:
25032
25032
  });
25033
25033
  }
25034
25034
 
25035
- // src/features/builder/entrypoint/component-checklist.ts
25035
+ // src/features/builder/entrypoint/component-checklist/entrypoint.ts
25036
25036
  import { Command as Command5 } from "commander";
25037
25037
  function createComponentChecklistCommand(componentChecklist) {
25038
25038
  return new Command5("component-checklist").description("List components as a checklist for linking/enrichment").addHelpText(
@@ -25085,7 +25085,7 @@ Examples:
25085
25085
  });
25086
25086
  }
25087
25087
 
25088
- // src/features/builder/entrypoint/component-summary.ts
25088
+ // src/features/builder/entrypoint/component-summary/entrypoint.ts
25089
25089
  import { Command as Command6 } from "commander";
25090
25090
  function createComponentSummaryCommand(componentSummary) {
25091
25091
  return new Command6("component-summary").description("Show component counts by type and domain").addHelpText(
@@ -25113,7 +25113,7 @@ Examples:
25113
25113
  });
25114
25114
  }
25115
25115
 
25116
- // src/features/builder/entrypoint/define-custom-type.ts
25116
+ // src/features/builder/entrypoint/define-custom-type/entrypoint.ts
25117
25117
  import { Command as Command7 } from "commander";
25118
25118
 
25119
25119
  // src/platform/infra/cli/input/custom-type-parser.ts
@@ -25174,7 +25174,7 @@ function collectOption(value, previous) {
25174
25174
  return [...previous, value];
25175
25175
  }
25176
25176
 
25177
- // src/features/builder/entrypoint/define-custom-type.ts
25177
+ // src/features/builder/entrypoint/define-custom-type/entrypoint.ts
25178
25178
  function createDefineCustomTypeCommand(defineCustomType) {
25179
25179
  return new Command7("define-custom-type").description("Define a custom component type").requiredOption("--name <name>", "Custom type name").option("--description <desc>", "Custom type description").option(
25180
25180
  "--required-property <spec>",
@@ -25224,7 +25224,7 @@ function createDefineCustomTypeCommand(defineCustomType) {
25224
25224
  });
25225
25225
  }
25226
25226
 
25227
- // src/features/builder/entrypoint/enrich.ts
25227
+ // src/features/builder/entrypoint/enrich/entrypoint.ts
25228
25228
  import { Command as Command8 } from "commander";
25229
25229
 
25230
25230
  // src/platform/infra/cli/input/enrichment-parser.ts
@@ -25323,7 +25323,7 @@ function parseSignature(input) {
25323
25323
  };
25324
25324
  }
25325
25325
 
25326
- // src/features/builder/entrypoint/enrich.ts
25326
+ // src/features/builder/entrypoint/enrich/entrypoint.ts
25327
25327
  function createEnrichCommand(enrichComponent) {
25328
25328
  return new Command8("enrich").description(
25329
25329
  "Enrich a DomainOp component with semantic information. Note: Enrichment is additive \u2014 running multiple times accumulates values."
@@ -25395,7 +25395,7 @@ Examples:
25395
25395
  });
25396
25396
  }
25397
25397
 
25398
- // src/features/builder/entrypoint/finalize.ts
25398
+ // src/features/builder/entrypoint/finalize/entrypoint.ts
25399
25399
  import { Command as Command9 } from "commander";
25400
25400
  import { writeFile } from "node:fs/promises";
25401
25401
  function createFinalizeCommand(finalizeGraph) {
@@ -25428,7 +25428,7 @@ Examples:
25428
25428
  });
25429
25429
  }
25430
25430
 
25431
- // src/features/builder/entrypoint/init.ts
25431
+ // src/features/builder/entrypoint/init/entrypoint.ts
25432
25432
  import { Command as Command10 } from "commander";
25433
25433
 
25434
25434
  // src/platform/infra/cli/input/domain-input-parser.ts
@@ -25450,7 +25450,7 @@ function parseDomainJson(value, previous) {
25450
25450
  return [...previous, parsed];
25451
25451
  }
25452
25452
 
25453
- // src/features/builder/entrypoint/init.ts
25453
+ // src/features/builder/entrypoint/init/entrypoint.ts
25454
25454
  function createInitCommand(initGraph) {
25455
25455
  return new Command10("init").description("Initialize a new graph").addHelpText(
25456
25456
  "after",
@@ -25525,7 +25525,7 @@ Examples:
25525
25525
  });
25526
25526
  }
25527
25527
 
25528
- // src/features/builder/entrypoint/link.ts
25528
+ // src/features/builder/entrypoint/link/entrypoint.ts
25529
25529
  import { Command as Command11 } from "commander";
25530
25530
 
25531
25531
  // src/platform/infra/cli/input/validation.ts
@@ -25575,7 +25575,7 @@ function validateHttpMethod(method) {
25575
25575
  };
25576
25576
  }
25577
25577
 
25578
- // src/features/builder/entrypoint/link.ts
25578
+ // src/features/builder/entrypoint/link/entrypoint.ts
25579
25579
  function createLinkCommand(linkComponents) {
25580
25580
  return new Command11("link").description("Link two components").addHelpText(
25581
25581
  "after",
@@ -25633,7 +25633,7 @@ Examples:
25633
25633
  });
25634
25634
  }
25635
25635
 
25636
- // src/features/builder/entrypoint/link-external.ts
25636
+ // src/features/builder/entrypoint/link-external/entrypoint.ts
25637
25637
  import { Command as Command12 } from "commander";
25638
25638
 
25639
25639
  // src/platform/infra/cli/input/link-external-transformer.ts
@@ -25645,7 +25645,7 @@ function buildExternalTarget(options) {
25645
25645
  };
25646
25646
  }
25647
25647
 
25648
- // src/features/builder/entrypoint/link-external.ts
25648
+ // src/features/builder/entrypoint/link-external/entrypoint.ts
25649
25649
  function createLinkExternalCommand(linkExternal) {
25650
25650
  return new Command12("link-external").description("Link a component to an external system").addHelpText(
25651
25651
  "after",
@@ -25692,7 +25692,7 @@ Examples:
25692
25692
  });
25693
25693
  }
25694
25694
 
25695
- // src/features/builder/entrypoint/link-http.ts
25695
+ // src/features/builder/entrypoint/link-http/entrypoint.ts
25696
25696
  import { Command as Command13 } from "commander";
25697
25697
 
25698
25698
  // src/platform/infra/cli/input/link-http-validator.ts
@@ -25706,7 +25706,7 @@ function validateOptions(options) {
25706
25706
  return void 0;
25707
25707
  }
25708
25708
 
25709
- // src/features/builder/entrypoint/link-http.ts
25709
+ // src/features/builder/entrypoint/link-http/entrypoint.ts
25710
25710
  function createLinkHttpCommand(linkHttp) {
25711
25711
  return new Command13("link-http").description("Find an API by HTTP path and link to a target component").addHelpText(
25712
25712
  "after",
@@ -25760,7 +25760,7 @@ Examples:
25760
25760
  });
25761
25761
  }
25762
25762
 
25763
- // src/features/builder/entrypoint/validate.ts
25763
+ // src/features/builder/entrypoint/validate/entrypoint.ts
25764
25764
  import { Command as Command14 } from "commander";
25765
25765
  function createValidateCommand(validateGraph3) {
25766
25766
  return new Command14("validate").description("Validate the graph for errors and warnings").addHelpText(
@@ -29789,7 +29789,7 @@ function loadProjectFromInput(extractionProjectRepository, extractDraftComponent
29789
29789
  });
29790
29790
  }
29791
29791
 
29792
- // src/features/extract/entrypoint/extract.ts
29792
+ // src/features/extract/entrypoint/extract/entrypoint.ts
29793
29793
  import { Command as Command15 } from "commander";
29794
29794
 
29795
29795
  // src/platform/infra/cli/presentation/exit-with-cli-error.ts
@@ -29848,7 +29848,7 @@ function validateFlagCombinations(options) {
29848
29848
  validateFormatOption(options);
29849
29849
  }
29850
29850
 
29851
- // src/features/extract/commands/create-extract-draft-components-input.ts
29851
+ // src/features/extract/entrypoint/extract/create-extract-draft-components-input.ts
29852
29852
  function createExtractDraftComponentsInput(options) {
29853
29853
  return {
29854
29854
  allowIncomplete: options.allowIncomplete === true,
@@ -29871,7 +29871,7 @@ function readSourceMode(options) {
29871
29871
  return options.files === void 0 ? "all" : "files";
29872
29872
  }
29873
29873
 
29874
- // src/features/extract/commands/create-enrich-draft-components-input.ts
29874
+ // src/features/extract/entrypoint/extract/create-enrich-draft-components-input.ts
29875
29875
  function createEnrichDraftComponentsInput(options, enrichPath) {
29876
29876
  return {
29877
29877
  allowIncomplete: options.allowIncomplete === true,
@@ -30020,7 +30020,7 @@ function outputResult(data, options) {
30020
30020
  console.log(JSON.stringify(data));
30021
30021
  }
30022
30022
 
30023
- // src/features/extract/infra/cli/output/present-extraction-result.ts
30023
+ // src/features/extract/entrypoint/extract/present-extraction-result.ts
30024
30024
  function presentExtractionResult(result, options) {
30025
30025
  if (result.kind === "draftOnly") {
30026
30026
  presentDraftResult(result.components, options);
@@ -30073,7 +30073,7 @@ function createOutputOptions(outputPath) {
30073
30073
  return outputPath === void 0 ? {} : { output: outputPath };
30074
30074
  }
30075
30075
 
30076
- // src/features/extract/entrypoint/extract.ts
30076
+ // src/features/extract/entrypoint/extract/entrypoint.ts
30077
30077
  function createExtractCommand(extractDraftComponents, enrichDraftComponents) {
30078
30078
  return new Command15("extract").description("Extract architectural components from source code").requiredOption("--config <path>", "Path to extraction config file").option("--dry-run", "Show component counts per domain without full output").option("-o, --output <file>", "Write output to file instead of stdout").option("--components-only", "Output only component identity (no metadata enrichment)").option("--enrich <file>", "Read draft components from file and enrich with extraction rules").option("--allow-incomplete", "Output components even when some extraction fields fail").option("--pr", "Extract from files changed in current branch vs base branch").option("--base <branch>", "Override base branch for --pr (default: auto-detect)").option("--files <paths...>", "Extract from specific files").option("--format <type>", "Output format: json (default) or markdown").option("--stats", "Show extraction statistics on stderr").option("--no-ts-config", "Skip tsconfig.json auto-discovery (disables full type resolution)").action(
30079
30079
  (options) => {
@@ -30116,14 +30116,48 @@ var RiviereQueryRepository = class {
30116
30116
  }
30117
30117
  };
30118
30118
 
30119
+ // src/features/query/queries/query-graph-load-failure.ts
30120
+ function toQueryGraphLoadFailure(error48) {
30121
+ if (error48 instanceof GraphNotFoundError) {
30122
+ return {
30123
+ kind: "graphNotFound",
30124
+ message: error48.message
30125
+ };
30126
+ }
30127
+ if (error48 instanceof GraphCorruptedError) {
30128
+ return {
30129
+ kind: "graphCorrupted",
30130
+ message: "Graph file contains invalid JSON"
30131
+ };
30132
+ }
30133
+ return void 0;
30134
+ }
30135
+ function loadQueryGraph(repository, graphPathOption) {
30136
+ try {
30137
+ return {
30138
+ kind: "loaded",
30139
+ query: repository.load(graphPathOption)
30140
+ };
30141
+ } catch (error48) {
30142
+ const failure14 = toQueryGraphLoadFailure(error48);
30143
+ if (failure14 !== void 0) {
30144
+ return failure14;
30145
+ }
30146
+ throw error48;
30147
+ }
30148
+ }
30149
+
30119
30150
  // src/features/query/queries/detect-orphans.ts
30120
30151
  var DetectOrphans = class {
30121
30152
  constructor(repository) {
30122
30153
  this.repository = repository;
30123
30154
  }
30124
30155
  execute(input) {
30125
- const query = this.repository.load(input.graphPathOption);
30126
- return { orphans: query.detectOrphans() };
30156
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30157
+ if (loaded.kind !== "loaded") {
30158
+ return loaded;
30159
+ }
30160
+ return { orphans: loaded.query.detectOrphans() };
30127
30161
  }
30128
30162
  };
30129
30163
 
@@ -30133,8 +30167,11 @@ var ListComponents = class {
30133
30167
  this.repository = repository;
30134
30168
  }
30135
30169
  execute(input) {
30136
- const query = this.repository.load(input.graphPathOption);
30137
- const allComponents = query.components();
30170
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30171
+ if (loaded.kind !== "loaded") {
30172
+ return loaded;
30173
+ }
30174
+ const allComponents = loaded.query.components();
30138
30175
  const filteredByDomain = input.domain === void 0 ? allComponents : allComponents.filter((component) => component.domain === input.domain);
30139
30176
  return {
30140
30177
  components: input.type === void 0 ? filteredByDomain : filteredByDomain.filter((component) => component.type === input.type)
@@ -30148,8 +30185,11 @@ var ListDomains = class {
30148
30185
  this.repository = repository;
30149
30186
  }
30150
30187
  execute(input) {
30151
- const query = this.repository.load(input.graphPathOption);
30152
- return { domains: query.domains() };
30188
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30189
+ if (loaded.kind !== "loaded") {
30190
+ return loaded;
30191
+ }
30192
+ return { domains: loaded.query.domains() };
30153
30193
  }
30154
30194
  };
30155
30195
 
@@ -30159,8 +30199,11 @@ var ListEntryPoints = class {
30159
30199
  this.repository = repository;
30160
30200
  }
30161
30201
  execute(input) {
30162
- const query = this.repository.load(input.graphPathOption);
30163
- return { entryPoints: query.entryPoints() };
30202
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30203
+ if (loaded.kind !== "loaded") {
30204
+ return loaded;
30205
+ }
30206
+ return { entryPoints: loaded.query.entryPoints() };
30164
30207
  }
30165
30208
  };
30166
30209
 
@@ -30170,8 +30213,11 @@ var SearchComponents = class {
30170
30213
  this.repository = repository;
30171
30214
  }
30172
30215
  execute(input) {
30173
- const query = this.repository.load(input.graphPathOption);
30174
- return { components: query.search(input.term) };
30216
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30217
+ if (loaded.kind !== "loaded") {
30218
+ return loaded;
30219
+ }
30220
+ return { components: loaded.query.search(input.term) };
30175
30221
  }
30176
30222
  };
30177
30223
 
@@ -30181,11 +30227,14 @@ var TraceFlow = class {
30181
30227
  this.repository = repository;
30182
30228
  }
30183
30229
  execute(input) {
30184
- const query = this.repository.load(input.graphPathOption);
30230
+ const loaded = loadQueryGraph(this.repository, input.graphPathOption);
30231
+ if (loaded.kind !== "loaded") {
30232
+ return loaded;
30233
+ }
30185
30234
  try {
30186
30235
  const componentId = parseComponentId(input.componentId);
30187
30236
  return {
30188
- flow: query.traceFlow(componentId),
30237
+ flow: loaded.query.traceFlow(componentId),
30189
30238
  success: true
30190
30239
  };
30191
30240
  } catch (error48) {
@@ -30193,7 +30242,11 @@ var TraceFlow = class {
30193
30242
  throw error48;
30194
30243
  }
30195
30244
  const parsedId = ComponentId.parse(input.componentId);
30196
- const matches = findNearMatches(query.components(), { name: parsedId.name() }, { limit: 3 });
30245
+ const matches = findNearMatches(
30246
+ loaded.query.components(),
30247
+ { name: parsedId.name() },
30248
+ { limit: 3 }
30249
+ );
30197
30250
  return {
30198
30251
  message: error48.message,
30199
30252
  success: false,
@@ -30203,22 +30256,13 @@ var TraceFlow = class {
30203
30256
  }
30204
30257
  };
30205
30258
 
30206
- // src/features/query/entrypoint/components.ts
30259
+ // src/features/query/entrypoint/components/entrypoint.ts
30207
30260
  import { Command as Command16 } from "commander";
30208
30261
 
30209
- // src/platform/infra/cli/presentation/query-graph-load-error-handler.ts
30210
- function handleQueryGraphLoadError(error48) {
30211
- if (error48 instanceof GraphNotFoundError) {
30212
- console.log(JSON.stringify(formatError2("GRAPH_NOT_FOUND" /* GraphNotFound */, error48.message)));
30213
- return true;
30214
- }
30215
- if (error48 instanceof GraphCorruptedError) {
30216
- console.log(
30217
- JSON.stringify(formatError2("GRAPH_CORRUPTED" /* GraphCorrupted */, "Graph file contains invalid JSON"))
30218
- );
30219
- return true;
30220
- }
30221
- return false;
30262
+ // src/platform/infra/cli/presentation/query-graph-load-failure-output.ts
30263
+ function formatQueryGraphLoadFailure(failure14) {
30264
+ const code = failure14.kind === "graphNotFound" ? "GRAPH_NOT_FOUND" /* GraphNotFound */ : "GRAPH_CORRUPTED" /* GraphCorrupted */;
30265
+ return formatError2(code, failure14.message);
30222
30266
  }
30223
30267
 
30224
30268
  // src/platform/infra/cli/presentation/component-output.ts
@@ -30231,7 +30275,7 @@ function toComponentOutput(component) {
30231
30275
  };
30232
30276
  }
30233
30277
 
30234
- // src/features/query/entrypoint/components.ts
30278
+ // src/features/query/entrypoint/components/entrypoint.ts
30235
30279
  function createComponentsCommand(listComponents) {
30236
30280
  return new Command16("components").description("List components with optional filtering").addHelpText(
30237
30281
  "after",
@@ -30252,25 +30296,23 @@ Examples:
30252
30296
  }
30253
30297
  return;
30254
30298
  }
30255
- try {
30256
- const result = listComponents.execute({
30257
- domain: options.domain,
30258
- graphPathOption: options.graph,
30259
- type: options.type === void 0 ? void 0 : normalizeToSchemaComponentType(options.type)
30260
- });
30261
- const components = result.components.map(toComponentOutput);
30262
- if (options.json) {
30263
- console.log(JSON.stringify(formatSuccess({ components })));
30264
- }
30265
- } catch (error48) {
30266
- if (!handleQueryGraphLoadError(error48)) {
30267
- throw error48;
30268
- }
30299
+ const result = listComponents.execute({
30300
+ domain: options.domain,
30301
+ graphPathOption: options.graph,
30302
+ type: options.type === void 0 ? void 0 : normalizeToSchemaComponentType(options.type)
30303
+ });
30304
+ if ("kind" in result) {
30305
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30306
+ return;
30307
+ }
30308
+ const components = result.components.map(toComponentOutput);
30309
+ if (options.json) {
30310
+ console.log(JSON.stringify(formatSuccess({ components })));
30269
30311
  }
30270
30312
  });
30271
30313
  }
30272
30314
 
30273
- // src/features/query/entrypoint/domains.ts
30315
+ // src/features/query/entrypoint/domains/entrypoint.ts
30274
30316
  import { Command as Command17 } from "commander";
30275
30317
  function createDomainsCommand(listDomains) {
30276
30318
  return new Command17("domains").description("List domains with component counts").addHelpText(
@@ -30281,20 +30323,18 @@ Examples:
30281
30323
  $ riviere query domains --json
30282
30324
  `
30283
30325
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30284
- try {
30285
- const result = listDomains.execute({ graphPathOption: options.graph });
30286
- if (options.json) {
30287
- console.log(JSON.stringify(formatSuccess(result)));
30288
- }
30289
- } catch (error48) {
30290
- if (!handleQueryGraphLoadError(error48)) {
30291
- throw error48;
30292
- }
30326
+ const result = listDomains.execute({ graphPathOption: options.graph });
30327
+ if ("kind" in result) {
30328
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30329
+ return;
30330
+ }
30331
+ if (options.json) {
30332
+ console.log(JSON.stringify(formatSuccess(result)));
30293
30333
  }
30294
30334
  });
30295
30335
  }
30296
30336
 
30297
- // src/features/query/entrypoint/entry-points.ts
30337
+ // src/features/query/entrypoint/entry-points/entrypoint.ts
30298
30338
  import { Command as Command18 } from "commander";
30299
30339
  function createEntryPointsCommand(listEntryPoints) {
30300
30340
  return new Command18("entry-points").description("List entry points (APIs, UIs, EventHandlers with no incoming links)").addHelpText(
@@ -30305,20 +30345,18 @@ Examples:
30305
30345
  $ riviere query entry-points --json
30306
30346
  `
30307
30347
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30308
- try {
30309
- const result = listEntryPoints.execute({ graphPathOption: options.graph });
30310
- if (options.json) {
30311
- console.log(JSON.stringify(formatSuccess(result)));
30312
- }
30313
- } catch (error48) {
30314
- if (!handleQueryGraphLoadError(error48)) {
30315
- throw error48;
30316
- }
30348
+ const result = listEntryPoints.execute({ graphPathOption: options.graph });
30349
+ if ("kind" in result) {
30350
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30351
+ return;
30352
+ }
30353
+ if (options.json) {
30354
+ console.log(JSON.stringify(formatSuccess(result)));
30317
30355
  }
30318
30356
  });
30319
30357
  }
30320
30358
 
30321
- // src/features/query/entrypoint/orphans.ts
30359
+ // src/features/query/entrypoint/orphans/entrypoint.ts
30322
30360
  import { Command as Command19 } from "commander";
30323
30361
  function createOrphansCommand(detectOrphans) {
30324
30362
  return new Command19("orphans").description("Find orphan components with no links").addHelpText(
@@ -30329,20 +30367,18 @@ Examples:
30329
30367
  $ riviere query orphans --json
30330
30368
  `
30331
30369
  ).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
30332
- try {
30333
- const result = detectOrphans.execute({ graphPathOption: options.graph });
30334
- if (options.json) {
30335
- console.log(JSON.stringify(formatSuccess(result)));
30336
- }
30337
- } catch (error48) {
30338
- if (!handleQueryGraphLoadError(error48)) {
30339
- throw error48;
30340
- }
30370
+ const result = detectOrphans.execute({ graphPathOption: options.graph });
30371
+ if ("kind" in result) {
30372
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30373
+ return;
30374
+ }
30375
+ if (options.json) {
30376
+ console.log(JSON.stringify(formatSuccess(result)));
30341
30377
  }
30342
30378
  });
30343
30379
  }
30344
30380
 
30345
- // src/features/query/entrypoint/search.ts
30381
+ // src/features/query/entrypoint/search/entrypoint.ts
30346
30382
  import { Command as Command20 } from "commander";
30347
30383
  function createSearchCommand(searchComponents2) {
30348
30384
  return new Command20("search").description("Search components by name").addHelpText(
@@ -30353,24 +30389,22 @@ Examples:
30353
30389
  $ riviere query search "place-order" --json
30354
30390
  `
30355
30391
  ).argument("<term>", "Search term").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (term, options) => {
30356
- try {
30357
- const result = searchComponents2.execute({
30358
- graphPathOption: options.graph,
30359
- term
30360
- });
30361
- const components = result.components.map(toComponentOutput);
30362
- if (options.json) {
30363
- console.log(JSON.stringify(formatSuccess({ components })));
30364
- }
30365
- } catch (error48) {
30366
- if (!handleQueryGraphLoadError(error48)) {
30367
- throw error48;
30368
- }
30392
+ const result = searchComponents2.execute({
30393
+ graphPathOption: options.graph,
30394
+ term
30395
+ });
30396
+ if ("kind" in result) {
30397
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30398
+ return;
30399
+ }
30400
+ const components = result.components.map(toComponentOutput);
30401
+ if (options.json) {
30402
+ console.log(JSON.stringify(formatSuccess({ components })));
30369
30403
  }
30370
30404
  });
30371
30405
  }
30372
30406
 
30373
- // src/features/query/entrypoint/trace.ts
30407
+ // src/features/query/entrypoint/trace/entrypoint.ts
30374
30408
  import { Command as Command21 } from "commander";
30375
30409
  function createTraceCommand(traceFlow) {
30376
30410
  return new Command21("trace").description("Trace flow from a component (bidirectional)").addHelpText(
@@ -30381,26 +30415,24 @@ Examples:
30381
30415
  $ riviere query trace "orders:checkout:usecase:placeorder" --json
30382
30416
  `
30383
30417
  ).argument("<componentId>", "Component ID to trace from").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (componentIdArg, options) => {
30384
- try {
30385
- const result = traceFlow.execute({
30386
- componentId: componentIdArg,
30387
- graphPathOption: options.graph
30388
- });
30389
- if (!result.success) {
30390
- console.log(
30391
- JSON.stringify(
30392
- formatError2("COMPONENT_NOT_FOUND" /* ComponentNotFound */, result.message, result.suggestions)
30393
- )
30394
- );
30395
- return;
30396
- }
30397
- if (options.json) {
30398
- console.log(JSON.stringify(formatSuccess(result.flow)));
30399
- }
30400
- } catch (error48) {
30401
- if (!handleQueryGraphLoadError(error48)) {
30402
- throw error48;
30403
- }
30418
+ const result = traceFlow.execute({
30419
+ componentId: componentIdArg,
30420
+ graphPathOption: options.graph
30421
+ });
30422
+ if ("kind" in result) {
30423
+ console.log(JSON.stringify(formatQueryGraphLoadFailure(result)));
30424
+ return;
30425
+ }
30426
+ if (!result.success) {
30427
+ console.log(
30428
+ JSON.stringify(
30429
+ formatError2("COMPONENT_NOT_FOUND" /* ComponentNotFound */, result.message, result.suggestions)
30430
+ )
30431
+ );
30432
+ return;
30433
+ }
30434
+ if (options.json) {
30435
+ console.log(JSON.stringify(formatSuccess(result.flow)));
30404
30436
  }
30405
30437
  });
30406
30438
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-cli",
3
- "version": "0.9.21",
3
+ "version": "0.9.22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,10 +32,10 @@
32
32
  "glob": "^11.0.2",
33
33
  "ts-morph": "^24.0.0",
34
34
  "yaml": "^2.7.0",
35
- "@living-architecture/riviere-builder": "0.8.4",
36
- "@living-architecture/riviere-extract-ts": "0.4.19",
37
- "@living-architecture/riviere-query": "0.6.15",
38
- "@living-architecture/riviere-schema": "0.6.15",
39
- "@living-architecture/riviere-extract-config": "0.5.15"
35
+ "@living-architecture/riviere-builder": "0.8.5",
36
+ "@living-architecture/riviere-extract-ts": "0.4.20",
37
+ "@living-architecture/riviere-extract-config": "0.5.16",
38
+ "@living-architecture/riviere-query": "0.6.16",
39
+ "@living-architecture/riviere-schema": "0.6.16"
40
40
  }
41
41
  }