@reqlan/cli 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,6 +44,27 @@ The ideas index is shared application memory at `<workspace>/.reqlan/ideas-index
44
44
 
45
45
  ## Changelog
46
46
 
47
+ ### 0.5.1
48
+
49
+ #### Patch Changes
50
+
51
+ - d46b740: Fix missed build and test errors.
52
+ - Updated dependencies [d46b740]
53
+ - @reqlan/analytical@0.8.1
54
+ - @reqlan/language@1.8.1
55
+
56
+ ### 0.5.0
57
+
58
+ #### Minor Changes
59
+
60
+ - 93368c6: Update exports; add support for wildcard import; update search functionality; add barrel import
61
+
62
+ #### Patch Changes
63
+
64
+ - Updated dependencies [93368c6]
65
+ - @reqlan/analytical@0.8.0
66
+ - @reqlan/language@1.8.0
67
+
47
68
  ### 0.4.0
48
69
 
49
70
  #### Minor Changes
@@ -0,0 +1,13 @@
1
+ import { Command } from 'clipanion';
2
+ /**
3
+ * rq:["../../../reqlan rq/extension/features-commands.rq".barrel_page]
4
+ */
5
+ export declare class BarrelCommand extends Command {
6
+ static paths: string[][];
7
+ static usage: import("clipanion").Usage;
8
+ file: string;
9
+ name: string | undefined;
10
+ dryRun: boolean;
11
+ json: boolean;
12
+ execute(): Promise<number>;
13
+ }
@@ -0,0 +1,76 @@
1
+ import { Command, Option } from 'clipanion';
2
+ import { resolve } from 'node:path';
3
+ import { barrelPage } from '@reqlan/analytical';
4
+ import { emit } from '../output.js';
5
+ /**
6
+ * rq:["../../../reqlan rq/extension/features-commands.rq".barrel_page]
7
+ */
8
+ export class BarrelCommand extends Command {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.file = Option.String({ required: true });
12
+ this.name = Option.String('--name', {
13
+ description: 'Container idea name (default: sanitized file basename)'
14
+ });
15
+ this.dryRun = Option.Boolean('--dry-run', false, {
16
+ description: 'Compute the barrel plan without writing files'
17
+ });
18
+ this.json = Option.Boolean('--json', false, {
19
+ description: 'Emit machine-readable JSON'
20
+ });
21
+ }
22
+ async execute() {
23
+ try {
24
+ const result = await barrelPage(resolve(this.file), {
25
+ containerName: this.name,
26
+ dryRun: this.dryRun
27
+ });
28
+ const payload = {
29
+ ok: true,
30
+ dryRun: result.dryRun,
31
+ sourcePath: result.sourcePath,
32
+ containerName: result.containerName,
33
+ createdPaths: result.createdPaths,
34
+ children: result.children.map(child => ({
35
+ ideaName: child.ideaName,
36
+ fileName: child.fileName
37
+ }))
38
+ };
39
+ if (this.json) {
40
+ emit(payload, true);
41
+ }
42
+ else if (result.dryRun) {
43
+ this.context.stdout.write(`Dry run: would barrel ${result.sourcePath} into container "${result.containerName}" with ${result.children.length} child file(s)\n`);
44
+ for (const child of result.children) {
45
+ this.context.stdout.write(` - ${child.fileName} (${child.ideaName})\n`);
46
+ }
47
+ }
48
+ else {
49
+ this.context.stdout.write(`Barreled ${result.sourcePath} into container "${result.containerName}"\n`);
50
+ for (const path of result.createdPaths) {
51
+ this.context.stdout.write(` wrote ${path}\n`);
52
+ }
53
+ }
54
+ return 0;
55
+ }
56
+ catch (error) {
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ this.context.stderr.write(`${message}\n`);
59
+ return 1;
60
+ }
61
+ }
62
+ }
63
+ BarrelCommand.paths = [['barrel']];
64
+ BarrelCommand.usage = Command.Usage({
65
+ description: 'Barrel a large .rq page into a container that imports one file per top-level idea.',
66
+ details: `
67
+ Creates one sibling .rq file per top-level idea, then replaces the source file
68
+ with namespace imports and a container idea (default name: sanitized file basename).
69
+ `,
70
+ examples: [
71
+ ['Barrel the current file', '$0 barrel ./path/to/page.rq'],
72
+ ['Choose the container idea name', '$0 barrel ./page.rq --name features'],
73
+ ['Plan without writing', '$0 barrel ./page.rq --dry-run --json']
74
+ ]
75
+ });
76
+ //# sourceMappingURL=barrel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel.js","sourceRoot":"","sources":["../../src/commands/barrel.ts"],"names":[],"mappings":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mBAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,AAAf,CAAgB;AAErB,mBAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,WAAW,EACP,oFAAoF;IACxF,OAAO,EAAE;;;SAGR;IACD,QAAQ,EAAE;QACN,CAAC,yBAAyB,EAAE,6BAA6B,CAAC;QAC1D,CAAC,gCAAgC,EAAE,qCAAqC,CAAC;QACzE,CAAC,sBAAsB,EAAE,sCAAsC,CAAC;KACnE;CACJ,CAAC,AAZmB,CAYlB"}
package/out/main.js CHANGED
@@ -7,6 +7,7 @@ import { AnalyseCommand } from './commands/analyse.js';
7
7
  import { SearchCommand } from './commands/search.js';
8
8
  import { ExportCommand } from './commands/export.js';
9
9
  import { InitCommand } from './commands/init.js';
10
+ import { BarrelCommand } from './commands/barrel.js';
10
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
11
12
  const packageJson = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'));
12
13
  const cli = new Cli({
@@ -21,5 +22,6 @@ cli.register(AnalyseCommand);
21
22
  cli.register(SearchCommand);
22
23
  cli.register(ExportCommand);
23
24
  cli.register(InitCommand);
25
+ cli.register(BarrelCommand);
24
26
  await cli.runExit(process.argv.slice(2));
25
27
  //# sourceMappingURL=main.js.map
package/out/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA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C,CAAC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reqlan/cli",
3
3
  "description": "CLI for parsing, analysing, and exporting reqlan requirement graphs",
4
- "version": "0.4.0",
4
+ "version": "0.5.1",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "dependencies": {
27
27
  "clipanion": "3.2.1",
28
28
  "langium": "~4.3.0",
29
- "@reqlan/language": "1.7.0",
30
- "@reqlan/analytical": "0.7.0"
29
+ "@reqlan/analytical": "0.8.1",
30
+ "@reqlan/language": "1.8.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "shx": "~0.4.0"