@reqlan/cli 0.5.2 → 0.6.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 +22 -2
- package/README.template.md +2 -2
- package/bin/cli.js +2 -1
- package/out/commands/search.d.ts +1 -0
- package/out/commands/search.js +9 -2
- package/out/commands/search.js.map +1 -1
- package/out/esm-path.d.ts +1 -0
- package/out/esm-path.js +20 -0
- package/out/esm-path.js.map +1 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ CLI for parsing, analysing, and exporting reqlan requirement graphs
|
|
|
11
11
|
- `reqlan` / `rq` Clipanion CLI for requirement workspaces
|
|
12
12
|
- `parse` — parse a `.rq` file and print diagnostics or an AST summary
|
|
13
13
|
- `analyse` / `analyze` — file, idea, or workspace graph analysis via `AnalysisApi`
|
|
14
|
-
- `search` — semantic search across indexed requirements (`--json` for scripting)
|
|
14
|
+
- `search` — semantic search across indexed requirements (`--context`, `--json` for scripting)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ npx @reqlan/cli --help
|
|
|
27
27
|
reqlan parse <file> [--json]
|
|
28
28
|
reqlan analyse [--file <path> | --idea <name>] [--depth <n>] [--cwd <dir>] [--json]
|
|
29
29
|
reqlan analyze # alias of analyse
|
|
30
|
-
reqlan search <query> [--limit <n>] [--cwd <dir>] [--json]
|
|
30
|
+
reqlan search <query> [--limit <n>] [--context <path|path#idea|name>]... [--cwd <dir>] [--json]
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Set `REQLAN_WORKSPACE` or pass `--cwd` to override the workspace root.
|
|
@@ -44,6 +44,26 @@ The ideas index is shared application memory at `<workspace>/.reqlan/ideas-index
|
|
|
44
44
|
|
|
45
45
|
## Changelog
|
|
46
46
|
|
|
47
|
+
### 0.6.1
|
|
48
|
+
|
|
49
|
+
#### Patch Changes
|
|
50
|
+
|
|
51
|
+
- 45d37df: Fix Windows CLI startup: dynamic import of `C:\...` is protocol `c:`; use `file://` URLs. Treat drive-letter paths as filesystem paths, not URI schemes.
|
|
52
|
+
- Updated dependencies [45d37df]
|
|
53
|
+
- @reqlan/language@1.8.3
|
|
54
|
+
- @reqlan/analytical@0.9.1
|
|
55
|
+
|
|
56
|
+
### 0.6.0
|
|
57
|
+
|
|
58
|
+
#### Minor Changes
|
|
59
|
+
|
|
60
|
+
- 2294beb: minor improvements to graph and search and website
|
|
61
|
+
|
|
62
|
+
#### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [2294beb]
|
|
65
|
+
- @reqlan/analytical@0.9.0
|
|
66
|
+
|
|
47
67
|
### 0.5.2
|
|
48
68
|
|
|
49
69
|
#### Patch Changes
|
package/README.template.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- `reqlan` / `rq` Clipanion CLI for requirement workspaces
|
|
12
12
|
- `parse` — parse a `.rq` file and print diagnostics or an AST summary
|
|
13
13
|
- `analyse` / `analyze` — file, idea, or workspace graph analysis via `AnalysisApi`
|
|
14
|
-
- `search` — semantic search across indexed requirements (`--json` for scripting)
|
|
14
|
+
- `search` — semantic search across indexed requirements (`--context`, `--json` for scripting)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ npx @reqlan/cli --help
|
|
|
27
27
|
reqlan parse <file> [--json]
|
|
28
28
|
reqlan analyse [--file <path> | --idea <name>] [--depth <n>] [--cwd <dir>] [--json]
|
|
29
29
|
reqlan analyze # alias of analyse
|
|
30
|
-
reqlan search <query> [--limit <n>] [--cwd <dir>] [--json]
|
|
30
|
+
reqlan search <query> [--limit <n>] [--context <path|path#idea|name>]... [--cwd <dir>] [--json]
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Set `REQLAN_WORKSPACE` or pass `--cwd` to override the workspace root.
|
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fsPathToEsmSpecifier } from '../out/esm-path.js';
|
|
4
5
|
|
|
5
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
await import(join(__dirname, '..', 'out', 'main.js'));
|
|
7
|
+
await import(fsPathToEsmSpecifier(join(__dirname, '..', 'out', 'main.js')));
|
package/out/commands/search.d.ts
CHANGED
package/out/commands/search.js
CHANGED
|
@@ -8,6 +8,9 @@ export class SearchCommand extends Command {
|
|
|
8
8
|
this.limit = Option.String('--limit', '8', {
|
|
9
9
|
description: 'Maximum number of matches (default 8)'
|
|
10
10
|
});
|
|
11
|
+
this.contextRefs = Option.Array('--context', {
|
|
12
|
+
description: 'Relative .rq path, path#idea, or idea name that biases ranking by graph hop distance (repeatable)'
|
|
13
|
+
});
|
|
11
14
|
this.cwd = Option.String('--cwd', {
|
|
12
15
|
description: 'Workspace root (default: walk from cwd, or REQLAN_WORKSPACE)'
|
|
13
16
|
});
|
|
@@ -19,7 +22,7 @@ export class SearchCommand extends Command {
|
|
|
19
22
|
const limit = Number.parseInt(this.limit, 10);
|
|
20
23
|
try {
|
|
21
24
|
await withAnalysisApi(this.cwd, async (api) => {
|
|
22
|
-
const matches = await api.searchRequirements(this.query, Number.isFinite(limit) && limit > 0 ? limit : 8);
|
|
25
|
+
const matches = await api.searchRequirements(this.query, Number.isFinite(limit) && limit > 0 ? limit : 8, this.contextRefs?.length ? { context: this.contextRefs } : undefined);
|
|
23
26
|
if (this.json) {
|
|
24
27
|
emit(matches.map(match => ({
|
|
25
28
|
idea: match.idea,
|
|
@@ -55,7 +58,11 @@ SearchCommand.usage = Command.Usage({
|
|
|
55
58
|
description: 'Search requirements by keyword across names, summaries, tags, and references.',
|
|
56
59
|
examples: [
|
|
57
60
|
['Search ideas', '$0 search "cli package"'],
|
|
58
|
-
['Limit results', '$0 search parse --limit 5 --json']
|
|
61
|
+
['Limit results', '$0 search parse --limit 5 --json'],
|
|
62
|
+
[
|
|
63
|
+
'Bias by context',
|
|
64
|
+
'$0 search ranking --context "reqlan rq/core_analysis/search.rq" --context fuzzy_search'
|
|
65
|
+
]
|
|
59
66
|
]
|
|
60
67
|
});
|
|
61
68
|
//# sourceMappingURL=search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,OAAO,aAAc,SAAQ,OAAO;IAA1C;;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,OAAO,aAAc,SAAQ,OAAO;IAA1C;;QAeI,UAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,UAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE;YAClC,WAAW,EAAE,uCAAuC;SACvD,CAAC,CAAC;QACH,gBAAW,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE;YACpC,WAAW,EACP,mGAAmG;SAC1G,CAAC,CAAC;QACH,QAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACzB,WAAW,EAAE,8DAA8D;SAC9E,CAAC,CAAC;QACH,SAAI,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,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,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACtF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzE,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;gBAC7D,CAAC,CAAC;qBACD,IAAI,CAAC,MAAM,CAAC,CAAC;gBAClB,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,CAAC;QACb,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;YAC1C,OAAO,CAAC,CAAC;QACb,CAAC;IACL,CAAC;;AApEe,mBAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,AAAf,CAAgB;AAErB,mBAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,WAAW,EAAE,+EAA+E;IAC5F,QAAQ,EAAE;QACN,CAAC,cAAc,EAAE,yBAAyB,CAAC;QAC3C,CAAC,eAAe,EAAE,kCAAkC,CAAC;QACrD;YACI,iBAAiB;YACjB,wFAAwF;SAC3F;KACJ;CACJ,CAAC,AAVmB,CAUlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fsPathToEsmSpecifier(fsPath: string): string;
|
package/out/esm-path.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a filesystem path into an ESM import specifier.
|
|
3
|
+
* Node's ESM loader on Windows rejects absolute paths like `C:\...`
|
|
4
|
+
* (protocol `c:`) and requires `file://` URLs.
|
|
5
|
+
*/
|
|
6
|
+
import { pathToFileURL } from 'node:url';
|
|
7
|
+
const WINDOWS_DRIVE_ABS = /^[A-Za-z]:[\\/]/;
|
|
8
|
+
export function fsPathToEsmSpecifier(fsPath) {
|
|
9
|
+
if (fsPath.startsWith('file:')) {
|
|
10
|
+
return fsPath;
|
|
11
|
+
}
|
|
12
|
+
if (WINDOWS_DRIVE_ABS.test(fsPath)) {
|
|
13
|
+
return `file:///${fsPath.replace(/\\/g, '/')}`;
|
|
14
|
+
}
|
|
15
|
+
if (fsPath.startsWith('\\\\')) {
|
|
16
|
+
return `file:${fsPath.replace(/\\/g, '/')}`;
|
|
17
|
+
}
|
|
18
|
+
return pathToFileURL(fsPath).href;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=esm-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esm-path.js","sourceRoot":"","sources":["../src/esm-path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C,MAAM,UAAU,oBAAoB,CAAC,MAAc;IAC/C,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,OAAO,WAAW,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IAChD,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;AACtC,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
|
+
"version": "0.6.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"repository": {
|
|
@@ -26,15 +26,17 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"clipanion": "3.2.1",
|
|
28
28
|
"langium": "~4.3.0",
|
|
29
|
-
"@reqlan/analytical": "0.
|
|
30
|
-
"@reqlan/language": "1.8.
|
|
29
|
+
"@reqlan/analytical": "0.9.1",
|
|
30
|
+
"@reqlan/language": "1.8.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"shx": "~0.4.0"
|
|
33
|
+
"shx": "~0.4.0",
|
|
34
|
+
"vitest": "~3.1.3"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"clean": "shx rm -fr *.tsbuildinfo out",
|
|
37
38
|
"build": "tsc -b tsconfig.json",
|
|
38
|
-
"build:clean": "pnpm run clean && pnpm run build"
|
|
39
|
+
"build:clean": "pnpm run clean && pnpm run build",
|
|
40
|
+
"test": "vitest run"
|
|
39
41
|
}
|
|
40
42
|
}
|