@living-architecture/riviere-cli 0.8.8 → 0.8.9

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 +41 -13
  2. package/dist/index.js +40 -12
  3. package/package.json +2 -2
package/dist/bin.js CHANGED
@@ -206,7 +206,7 @@ var require_scope = __commonJS({
206
206
  let: new code_1.Name("let"),
207
207
  var: new code_1.Name("var")
208
208
  };
209
- var Scope = class {
209
+ var Scope2 = class {
210
210
  constructor({ prefixes, parent } = {}) {
211
211
  this._names = {};
212
212
  this._prefixes = prefixes;
@@ -230,7 +230,7 @@ var require_scope = __commonJS({
230
230
  return this._names[prefix] = { prefix, index: 0 };
231
231
  }
232
232
  };
233
- exports.Scope = Scope;
233
+ exports.Scope = Scope2;
234
234
  var ValueScopeName = class extends code_1.Name {
235
235
  constructor(prefix, nameStr) {
236
236
  super(nameStr);
@@ -243,7 +243,7 @@ var require_scope = __commonJS({
243
243
  };
244
244
  exports.ValueScopeName = ValueScopeName;
245
245
  var line = (0, code_1._)`\n`;
246
- var ValueScope = class extends Scope {
246
+ var ValueScope = class extends Scope2 {
247
247
  constructor(opts) {
248
248
  super(opts);
249
249
  this._values = {};
@@ -2980,7 +2980,7 @@ var require_compile = __commonJS({
2980
2980
  const schOrFunc = root.refs[ref];
2981
2981
  if (schOrFunc)
2982
2982
  return schOrFunc;
2983
- let _sch = resolve5.call(this, root, ref);
2983
+ let _sch = resolve6.call(this, root, ref);
2984
2984
  if (_sch === void 0) {
2985
2985
  const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
2986
2986
  const { schemaId } = this.opts;
@@ -3007,7 +3007,7 @@ var require_compile = __commonJS({
3007
3007
  function sameSchemaEnv(s1, s2) {
3008
3008
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3009
3009
  }
3010
- function resolve5(root, ref) {
3010
+ function resolve6(root, ref) {
3011
3011
  let sch;
3012
3012
  while (typeof (sch = this.refs[ref]) == "string")
3013
3013
  ref = sch;
@@ -3582,7 +3582,7 @@ var require_fast_uri = __commonJS({
3582
3582
  }
3583
3583
  return uri;
3584
3584
  }
3585
- function resolve5(baseURI, relativeURI, options) {
3585
+ function resolve6(baseURI, relativeURI, options) {
3586
3586
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3587
3587
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3588
3588
  schemelessOptions.skipEscape = true;
@@ -3809,7 +3809,7 @@ var require_fast_uri = __commonJS({
3809
3809
  var fastUri = {
3810
3810
  SCHEMES,
3811
3811
  normalize,
3812
- resolve: resolve5,
3812
+ resolve: resolve6,
3813
3813
  resolveComponent,
3814
3814
  equal,
3815
3815
  serialize,
@@ -25155,9 +25155,9 @@ Examples:
25155
25155
 
25156
25156
  // src/features/extract/entrypoint/extract.ts
25157
25157
  import { Command as Command21 } from "commander";
25158
- import { Project as Project2 } from "ts-morph";
25159
25158
 
25160
25159
  // ../riviere-extract-ts/dist/domain/component-extraction/extractor.js
25160
+ import { Scope } from "ts-morph";
25161
25161
  import { posix } from "node:path";
25162
25162
 
25163
25163
  // ../riviere-extract-ts/dist/domain/predicate-evaluation/evaluate-predicate.js
@@ -25340,11 +25340,15 @@ function extractClasses(sourceFile, filePath, domain2, componentType, rule) {
25340
25340
  return sourceFile.getClasses().filter((c) => evaluatePredicate(c, rule.where)).flatMap((c) => createClassComponent(c, filePath, domain2, componentType));
25341
25341
  }
25342
25342
  function extractMethods(sourceFile, filePath, domain2, componentType, rule) {
25343
- return sourceFile.getClasses().flatMap((c) => c.getMethods()).filter((m) => evaluatePredicate(m, rule.where)).flatMap((m) => createMethodComponent(m, filePath, domain2, componentType));
25343
+ return sourceFile.getClasses().flatMap((c) => c.getMethods()).filter(isPublicMethod).filter((m) => evaluatePredicate(m, rule.where)).flatMap((m) => createMethodComponent(m, filePath, domain2, componentType));
25344
25344
  }
25345
25345
  function extractFunctions(sourceFile, filePath, domain2, componentType, rule) {
25346
25346
  return sourceFile.getFunctions().filter((f) => evaluatePredicate(f, rule.where)).flatMap((f) => createFunctionComponent(f, filePath, domain2, componentType));
25347
25347
  }
25348
+ function isPublicMethod(method) {
25349
+ const scope = method.getScope();
25350
+ return scope !== Scope.Private && scope !== Scope.Protected;
25351
+ }
25348
25352
  function createClassComponent(classDecl, filePath, domain2, componentType) {
25349
25353
  const name = classDecl.getName();
25350
25354
  if (name === void 0) {
@@ -29618,9 +29622,34 @@ function formatTimingLine(timings) {
29618
29622
  return `Extraction completed in ${formatSeconds(timings.totalMs)} (call graph: ${formatSeconds(timings.callGraphMs)}, detection: ${formatSeconds(timings.asyncDetectionMs)}, setup: ${formatSeconds(timings.setupMs)})`;
29619
29623
  }
29620
29624
 
29625
+ // src/features/extract/infra/ts-morph/create-configured-project.ts
29626
+ import { existsSync as existsSync5 } from "node:fs";
29627
+ import { resolve as resolve5 } from "node:path";
29628
+ import { Project as Project2 } from "ts-morph";
29629
+ function createConfiguredProject(configDir, skipTsConfig) {
29630
+ if (skipTsConfig) {
29631
+ return new Project2();
29632
+ }
29633
+ const tsConfigPath = resolve5(configDir, "tsconfig.json");
29634
+ if (!existsSync5(tsConfigPath)) {
29635
+ return new Project2();
29636
+ }
29637
+ return new Project2({
29638
+ tsConfigFilePath: tsConfigPath,
29639
+ skipAddingFilesFromTsConfig: true
29640
+ });
29641
+ }
29642
+
29643
+ // src/features/extract/queries/load-extraction-project.ts
29644
+ function loadExtractionProject(configDir, sourceFilePaths, skipTsConfig) {
29645
+ const project = createConfiguredProject(configDir, skipTsConfig);
29646
+ project.addSourceFilesAtPaths(sourceFilePaths);
29647
+ return project;
29648
+ }
29649
+
29621
29650
  // src/features/extract/entrypoint/extract.ts
29622
29651
  function createExtractCommand() {
29623
- return new Command21("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("--patterns", "Enable pattern-based connection detection").action((options) => {
29652
+ return new Command21("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("--patterns", "Enable pattern-based connection detection").option("--no-ts-config", "Skip tsconfig.json auto-discovery (disables full type resolution)").action((options) => {
29624
29653
  validateFlagCombinations(options);
29625
29654
  const {
29626
29655
  resolvedConfig,
@@ -29628,8 +29657,7 @@ function createExtractCommand() {
29628
29657
  } = loadAndValidateConfig(options.config);
29629
29658
  const allSourceFilePaths = resolveSourceFiles(resolvedConfig, configDir);
29630
29659
  const sourceFilePaths = resolveFilteredSourceFiles(allSourceFilePaths, options);
29631
- const project = new Project2();
29632
- project.addSourceFilesAtPaths(sourceFilePaths);
29660
+ const project = loadExtractionProject(configDir, sourceFilePaths, options.tsConfig === false);
29633
29661
  const draftComponents = (() => {
29634
29662
  if (options.enrich === void 0) {
29635
29663
  return extractComponents(project, sourceFilePaths, resolvedConfig, matchesGlob, configDir);
@@ -29727,7 +29755,7 @@ function parsePackageJson(pkg) {
29727
29755
  }
29728
29756
  function loadPackageJson() {
29729
29757
  if (true) {
29730
- return { version: "0.8.7" };
29758
+ return { version: "0.8.8" };
29731
29759
  }
29732
29760
  const require2 = createRequire2(import.meta.url);
29733
29761
  return parsePackageJson(require2("../../package.json"));
package/dist/index.js CHANGED
@@ -205,7 +205,7 @@ var require_scope = __commonJS({
205
205
  let: new code_1.Name("let"),
206
206
  var: new code_1.Name("var")
207
207
  };
208
- var Scope = class {
208
+ var Scope2 = class {
209
209
  constructor({ prefixes, parent } = {}) {
210
210
  this._names = {};
211
211
  this._prefixes = prefixes;
@@ -229,7 +229,7 @@ var require_scope = __commonJS({
229
229
  return this._names[prefix] = { prefix, index: 0 };
230
230
  }
231
231
  };
232
- exports.Scope = Scope;
232
+ exports.Scope = Scope2;
233
233
  var ValueScopeName = class extends code_1.Name {
234
234
  constructor(prefix, nameStr) {
235
235
  super(nameStr);
@@ -242,7 +242,7 @@ var require_scope = __commonJS({
242
242
  };
243
243
  exports.ValueScopeName = ValueScopeName;
244
244
  var line = (0, code_1._)`\n`;
245
- var ValueScope = class extends Scope {
245
+ var ValueScope = class extends Scope2 {
246
246
  constructor(opts) {
247
247
  super(opts);
248
248
  this._values = {};
@@ -2979,7 +2979,7 @@ var require_compile = __commonJS({
2979
2979
  const schOrFunc = root.refs[ref];
2980
2980
  if (schOrFunc)
2981
2981
  return schOrFunc;
2982
- let _sch = resolve5.call(this, root, ref);
2982
+ let _sch = resolve6.call(this, root, ref);
2983
2983
  if (_sch === void 0) {
2984
2984
  const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
2985
2985
  const { schemaId } = this.opts;
@@ -3006,7 +3006,7 @@ var require_compile = __commonJS({
3006
3006
  function sameSchemaEnv(s1, s2) {
3007
3007
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3008
3008
  }
3009
- function resolve5(root, ref) {
3009
+ function resolve6(root, ref) {
3010
3010
  let sch;
3011
3011
  while (typeof (sch = this.refs[ref]) == "string")
3012
3012
  ref = sch;
@@ -3581,7 +3581,7 @@ var require_fast_uri = __commonJS({
3581
3581
  }
3582
3582
  return uri;
3583
3583
  }
3584
- function resolve5(baseURI, relativeURI, options) {
3584
+ function resolve6(baseURI, relativeURI, options) {
3585
3585
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3586
3586
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3587
3587
  schemelessOptions.skipEscape = true;
@@ -3808,7 +3808,7 @@ var require_fast_uri = __commonJS({
3808
3808
  var fastUri = {
3809
3809
  SCHEMES,
3810
3810
  normalize,
3811
- resolve: resolve5,
3811
+ resolve: resolve6,
3812
3812
  resolveComponent,
3813
3813
  equal,
3814
3814
  serialize,
@@ -25181,9 +25181,9 @@ Examples:
25181
25181
 
25182
25182
  // src/features/extract/entrypoint/extract.ts
25183
25183
  import { Command as Command21 } from "commander";
25184
- import { Project as Project2 } from "ts-morph";
25185
25184
 
25186
25185
  // ../riviere-extract-ts/dist/domain/component-extraction/extractor.js
25186
+ import { Scope } from "ts-morph";
25187
25187
  import { posix } from "node:path";
25188
25188
 
25189
25189
  // ../riviere-extract-ts/dist/domain/predicate-evaluation/evaluate-predicate.js
@@ -25366,11 +25366,15 @@ function extractClasses(sourceFile, filePath, domain2, componentType, rule) {
25366
25366
  return sourceFile.getClasses().filter((c) => evaluatePredicate(c, rule.where)).flatMap((c) => createClassComponent(c, filePath, domain2, componentType));
25367
25367
  }
25368
25368
  function extractMethods(sourceFile, filePath, domain2, componentType, rule) {
25369
- return sourceFile.getClasses().flatMap((c) => c.getMethods()).filter((m) => evaluatePredicate(m, rule.where)).flatMap((m) => createMethodComponent(m, filePath, domain2, componentType));
25369
+ return sourceFile.getClasses().flatMap((c) => c.getMethods()).filter(isPublicMethod).filter((m) => evaluatePredicate(m, rule.where)).flatMap((m) => createMethodComponent(m, filePath, domain2, componentType));
25370
25370
  }
25371
25371
  function extractFunctions(sourceFile, filePath, domain2, componentType, rule) {
25372
25372
  return sourceFile.getFunctions().filter((f) => evaluatePredicate(f, rule.where)).flatMap((f) => createFunctionComponent(f, filePath, domain2, componentType));
25373
25373
  }
25374
+ function isPublicMethod(method) {
25375
+ const scope = method.getScope();
25376
+ return scope !== Scope.Private && scope !== Scope.Protected;
25377
+ }
25374
25378
  function createClassComponent(classDecl, filePath, domain2, componentType) {
25375
25379
  const name = classDecl.getName();
25376
25380
  if (name === void 0) {
@@ -29644,9 +29648,34 @@ function formatTimingLine(timings) {
29644
29648
  return `Extraction completed in ${formatSeconds(timings.totalMs)} (call graph: ${formatSeconds(timings.callGraphMs)}, detection: ${formatSeconds(timings.asyncDetectionMs)}, setup: ${formatSeconds(timings.setupMs)})`;
29645
29649
  }
29646
29650
 
29651
+ // src/features/extract/infra/ts-morph/create-configured-project.ts
29652
+ import { existsSync as existsSync5 } from "node:fs";
29653
+ import { resolve as resolve5 } from "node:path";
29654
+ import { Project as Project2 } from "ts-morph";
29655
+ function createConfiguredProject(configDir, skipTsConfig) {
29656
+ if (skipTsConfig) {
29657
+ return new Project2();
29658
+ }
29659
+ const tsConfigPath = resolve5(configDir, "tsconfig.json");
29660
+ if (!existsSync5(tsConfigPath)) {
29661
+ return new Project2();
29662
+ }
29663
+ return new Project2({
29664
+ tsConfigFilePath: tsConfigPath,
29665
+ skipAddingFilesFromTsConfig: true
29666
+ });
29667
+ }
29668
+
29669
+ // src/features/extract/queries/load-extraction-project.ts
29670
+ function loadExtractionProject(configDir, sourceFilePaths, skipTsConfig) {
29671
+ const project = createConfiguredProject(configDir, skipTsConfig);
29672
+ project.addSourceFilesAtPaths(sourceFilePaths);
29673
+ return project;
29674
+ }
29675
+
29647
29676
  // src/features/extract/entrypoint/extract.ts
29648
29677
  function createExtractCommand() {
29649
- return new Command21("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("--patterns", "Enable pattern-based connection detection").action((options) => {
29678
+ return new Command21("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("--patterns", "Enable pattern-based connection detection").option("--no-ts-config", "Skip tsconfig.json auto-discovery (disables full type resolution)").action((options) => {
29650
29679
  validateFlagCombinations(options);
29651
29680
  const {
29652
29681
  resolvedConfig,
@@ -29654,8 +29683,7 @@ function createExtractCommand() {
29654
29683
  } = loadAndValidateConfig(options.config);
29655
29684
  const allSourceFilePaths = resolveSourceFiles(resolvedConfig, configDir);
29656
29685
  const sourceFilePaths = resolveFilteredSourceFiles(allSourceFilePaths, options);
29657
- const project = new Project2();
29658
- project.addSourceFilesAtPaths(sourceFilePaths);
29686
+ const project = loadExtractionProject(configDir, sourceFilePaths, options.tsConfig === false);
29659
29687
  const draftComponents = (() => {
29660
29688
  if (options.enrich === void 0) {
29661
29689
  return extractComponents(project, sourceFilePaths, resolvedConfig, matchesGlob, configDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-cli",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,8 +34,8 @@
34
34
  "yaml": "^2.7.0",
35
35
  "@living-architecture/riviere-builder": "0.6.3",
36
36
  "@living-architecture/riviere-extract-config": "0.4.3",
37
- "@living-architecture/riviere-extract-ts": "0.2.7",
38
37
  "@living-architecture/riviere-query": "0.5.3",
38
+ "@living-architecture/riviere-extract-ts": "0.2.8",
39
39
  "@living-architecture/riviere-schema": "0.5.3"
40
40
  }
41
41
  }