@sammons/code-outline-cli 2.1.0 → 2.1.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 +13 -9
- package/dist/cli-argument-parser.d.ts +3 -0
- package/dist/cli-argument-parser.d.ts.map +1 -1
- package/dist/cli-argument-parser.js +44 -20
- package/dist/cli-argument-parser.js.map +1 -1
- package/dist/cli-orchestrator.d.ts +10 -3
- package/dist/cli-orchestrator.d.ts.map +1 -1
- package/dist/cli-orchestrator.js +20 -18
- package/dist/cli-orchestrator.js.map +1 -1
- package/dist/cli-output-handler.d.ts +4 -3
- package/dist/cli-output-handler.d.ts.map +1 -1
- package/dist/cli-output-handler.js +7 -9
- package/dist/cli-output-handler.js.map +1 -1
- package/dist/cli.js +2 -4
- package/dist/cli.js.map +1 -1
- package/dist/file-processor.d.ts +5 -2
- package/dist/file-processor.d.ts.map +1 -1
- package/dist/file-processor.js +12 -18
- package/dist/file-processor.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -49
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/dist/cli-orchestrator.unit.test.d.ts +0 -2
- package/dist/cli-orchestrator.unit.test.d.ts.map +0 -1
- package/dist/cli-orchestrator.unit.test.js +0 -140
- package/dist/cli-orchestrator.unit.test.js.map +0 -1
- package/dist/cli.integration.test.d.ts +0 -2
- package/dist/cli.integration.test.d.ts.map +0 -1
- package/dist/cli.integration.test.js +0 -342
- package/dist/cli.integration.test.js.map +0 -1
- package/dist/cli.unit.test.d.ts +0 -2
- package/dist/cli.unit.test.d.ts.map +0 -1
- package/dist/cli.unit.test.js +0 -411
- package/dist/cli.unit.test.js.map +0 -1
- package/dist/test.d.ts +0 -25
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -41
- package/dist/test.js.map +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ A CLI tool that parses JavaScript/TypeScript files using tree-sitter and provide
|
|
|
15
15
|
## 📦 Installation
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install -g @sammons/code-outline-cli
|
|
18
|
+
npm install -g @sammons/code-outline-cli@2.1.0
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Or use directly with npx:
|
|
@@ -74,14 +74,15 @@ code-outline src/index.ts --all
|
|
|
74
74
|
|
|
75
75
|
## 📋 Command Line Options
|
|
76
76
|
|
|
77
|
-
| Option | Alias | Description
|
|
78
|
-
| ------------------ | ----- |
|
|
79
|
-
| `--format <type>` | `-f` | Output format: `json
|
|
80
|
-
| `--depth <number>` | `-d` | Maximum depth to traverse
|
|
81
|
-
| `--named-only` | | Show only named nodes
|
|
82
|
-
| `--all` | `-a` | Show all nodes (including anonymous)
|
|
83
|
-
| `--
|
|
84
|
-
| `--
|
|
77
|
+
| Option | Alias | Description | Default |
|
|
78
|
+
| ------------------ | ----- | ---------------------------------------- | ---------- | ---- | -------- | ------- |
|
|
79
|
+
| `--format <type>` | `-f` | Output format: `ascii | json | yaml | llmtext` | `ascii` |
|
|
80
|
+
| `--depth <number>` | `-d` | Maximum depth to traverse | `Infinity` |
|
|
81
|
+
| `--named-only` | | Show only named nodes | `true` |
|
|
82
|
+
| `--all` | `-a` | Show all nodes (including anonymous) | `false` |
|
|
83
|
+
| `--llmtext` | | Generate LLM-optimized compressed output | `false` |
|
|
84
|
+
| `--help` | `-h` | Show help message | |
|
|
85
|
+
| `--version` | `-v` | Show version number | |
|
|
85
86
|
|
|
86
87
|
## 📖 Examples
|
|
87
88
|
|
|
@@ -180,6 +181,9 @@ code-outline src/index.ts --format ascii | pbcopy
|
|
|
180
181
|
|
|
181
182
|
# Save outline to a file
|
|
182
183
|
code-outline "src/**/*.ts" --format yaml > codebase-outline.yaml
|
|
184
|
+
|
|
185
|
+
# Generate LLM-optimized compressed output
|
|
186
|
+
code-outline "src/**/*.ts" --format llmtext
|
|
183
187
|
```
|
|
184
188
|
|
|
185
189
|
## 🛠️ Advanced Usage
|
|
@@ -15,6 +15,9 @@ export declare class CLIArgumentError extends Error {
|
|
|
15
15
|
constructor(message: string);
|
|
16
16
|
}
|
|
17
17
|
export declare class CLIArgumentParser {
|
|
18
|
+
private readonly argv;
|
|
19
|
+
private readonly log;
|
|
20
|
+
constructor(argv?: () => string[], log?: (message: string) => void);
|
|
18
21
|
private safeExtractValue;
|
|
19
22
|
private validateAndThrow;
|
|
20
23
|
printHelp(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-argument-parser.d.ts","sourceRoot":"","sources":["../src/cli-argument-parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-argument-parser.d.ts","sourceRoot":"","sources":["../src/cli-argument-parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AA8BjE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;gBAG9C,IAAI,GAAE,MAAM,MAAM,EAAuB,EACzC,GAAG,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAwC;IAOpE,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,gBAAgB;IAajB,SAAS,IAAI,IAAI;IA+CjB,YAAY,IAAI,IAAI;IAIpB,KAAK,IAAI,UAAU;CA4H3B"}
|
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { isAbsolute } from 'node:path';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { validateFormat, validateDepthValue, } from '@sammons/code-outline-parser';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
// Read the version at runtime rather than importing package.json. A JSON import
|
|
8
|
+
// needs an import attribute under ESM (raw .ts run by Node) but that attribute
|
|
9
|
+
// is illegal in the CommonJS output tsc emits to dist/. Reading the file works
|
|
10
|
+
// unchanged in both.
|
|
11
|
+
const readVersion = () => {
|
|
12
|
+
const here = import.meta.dirname;
|
|
13
|
+
for (const candidate of [
|
|
14
|
+
join(here, '..', 'package.json'),
|
|
15
|
+
join(here, '..', '..', 'package.json'),
|
|
16
|
+
]) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(readFileSync(candidate, 'utf8')).version;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// Try the next candidate: the file sits one level up from src/ and two
|
|
22
|
+
// levels up from dist/ depending on whether we run sources or the build.
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return '0.0.0';
|
|
26
|
+
};
|
|
27
|
+
const version = readVersion();
|
|
28
|
+
export class CLIArgumentError extends Error {
|
|
10
29
|
constructor(message) {
|
|
11
30
|
super(message);
|
|
12
31
|
this.name = 'CLIArgumentError';
|
|
13
32
|
}
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
export class CLIArgumentParser {
|
|
35
|
+
argv;
|
|
36
|
+
log;
|
|
37
|
+
constructor(argv = () => process.argv, log = (message) => console.log(message)) {
|
|
38
|
+
this.argv = argv;
|
|
39
|
+
this.log = log;
|
|
40
|
+
}
|
|
17
41
|
// Type guard to safely extract unknown values from parseArgs result
|
|
18
42
|
safeExtractValue(value, defaultValue) {
|
|
19
43
|
// Use proper type narrowing instead of type assertions
|
|
@@ -35,7 +59,7 @@ class CLIArgumentParser {
|
|
|
35
59
|
return validation.value;
|
|
36
60
|
}
|
|
37
61
|
printHelp() {
|
|
38
|
-
|
|
62
|
+
this.log(`
|
|
39
63
|
🌳 Code Outline CLI - Parse and analyze JavaScript/TypeScript files
|
|
40
64
|
|
|
41
65
|
Usage:
|
|
@@ -74,17 +98,18 @@ Examples:
|
|
|
74
98
|
|
|
75
99
|
Supported Files:
|
|
76
100
|
.js JavaScript files
|
|
77
|
-
.ts TypeScript files
|
|
101
|
+
.ts TypeScript files
|
|
78
102
|
.tsx TypeScript JSX files
|
|
79
103
|
|
|
80
104
|
For more information, visit: https://github.com/sammons2/code-outline-cli
|
|
81
105
|
`);
|
|
82
106
|
}
|
|
83
107
|
printVersion() {
|
|
84
|
-
|
|
108
|
+
this.log(version);
|
|
85
109
|
}
|
|
86
110
|
parse() {
|
|
87
|
-
const { values, positionals } =
|
|
111
|
+
const { values, positionals } = parseArgs({
|
|
112
|
+
args: this.argv().slice(2),
|
|
88
113
|
options: {
|
|
89
114
|
format: {
|
|
90
115
|
type: 'string',
|
|
@@ -131,10 +156,10 @@ For more information, visit: https://github.com/sammons2/code-outline-cli
|
|
|
131
156
|
throw new CLIArgumentError('No file pattern provided');
|
|
132
157
|
}
|
|
133
158
|
// Safely validate format using type guard
|
|
134
|
-
const formatValidation =
|
|
159
|
+
const formatValidation = validateFormat(values.format);
|
|
135
160
|
const format = this.validateAndThrow(formatValidation, 'Invalid format');
|
|
136
161
|
// Safely validate depth using validator
|
|
137
|
-
const depthValidation =
|
|
162
|
+
const depthValidation = validateDepthValue(values.depth);
|
|
138
163
|
const depth = this.validateAndThrow(depthValidation, 'Invalid depth');
|
|
139
164
|
const namedOnly = values.all
|
|
140
165
|
? false
|
|
@@ -155,8 +180,8 @@ For more information, visit: https://github.com/sammons2/code-outline-cli
|
|
|
155
180
|
const endsWithCommonExtension = /\.(ts|js|tsx|jsx)$/.test(pattern);
|
|
156
181
|
// Only warn if it's not an absolute path AND not an existing file
|
|
157
182
|
// (relative paths with many segments are likely intended as globs, but existing files should not warn)
|
|
158
|
-
const isAbsolutePath =
|
|
159
|
-
const fileExists =
|
|
183
|
+
const isAbsolutePath = isAbsolute(pattern);
|
|
184
|
+
const fileExists = existsSync(pattern);
|
|
160
185
|
// Debug: Show the evaluation
|
|
161
186
|
const shouldWarn = hasMultipleSegments &&
|
|
162
187
|
endsWithCommonExtension &&
|
|
@@ -182,5 +207,4 @@ For more information, visit: https://github.com/sammons2/code-outline-cli
|
|
|
182
207
|
};
|
|
183
208
|
}
|
|
184
209
|
}
|
|
185
|
-
exports.CLIArgumentParser = CLIArgumentParser;
|
|
186
210
|
//# sourceMappingURL=cli-argument-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-argument-parser.js","sourceRoot":"","sources":["../src/cli-argument-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-argument-parser.js","sourceRoot":"","sources":["../src/cli-argument-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,cAAc,EACd,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,qBAAqB;AACrB,MAAM,WAAW,GAAG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AAW;gBACnB,KAAK;gBACL,SAAS;gBACT,OAAO;gBACP,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,KAAK;aACf;YACD,OAAO;SACR,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { CLIArgumentParser } from './cli-argument-parser.ts';
|
|
2
|
+
import { FileProcessor } from './file-processor.ts';
|
|
3
|
+
import { CLIOutputHandler } from './cli-output-handler.ts';
|
|
4
|
+
import type { OutputFormat } from '@sammons/code-outline-parser';
|
|
1
5
|
export declare class CLIOrchestrator {
|
|
2
|
-
private argumentParser;
|
|
3
|
-
private fileProcessor;
|
|
4
|
-
|
|
6
|
+
private readonly argumentParser;
|
|
7
|
+
private readonly fileProcessor;
|
|
8
|
+
private readonly outputHandlerFactory;
|
|
9
|
+
private readonly exit;
|
|
10
|
+
private readonly logError;
|
|
11
|
+
constructor(argumentParser?: CLIArgumentParser, fileProcessor?: FileProcessor, outputHandlerFactory?: (format: OutputFormat, llmtext?: boolean) => CLIOutputHandler, exit?: (code: number) => never, logError?: (message: string) => void);
|
|
5
12
|
run(): Promise<void>;
|
|
6
13
|
}
|
|
7
14
|
//# sourceMappingURL=cli-orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-orchestrator.d.ts","sourceRoot":"","sources":["../src/cli-orchestrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-orchestrator.d.ts","sourceRoot":"","sources":["../src/cli-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoB;IACnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAGf;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;gBAGnD,cAAc,GAAE,iBAA2C,EAC3D,aAAa,GAAE,aAAmC,EAClD,oBAAoB,GAAE,CACpB,MAAM,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,OAAO,KACd,gBACkC,EACvC,IAAI,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAoC,EAC5D,QAAQ,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAA0C;IAS9D,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkClC"}
|
package/dist/cli-orchestrator.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const file_processor_js_1 = require("./file-processor.js");
|
|
6
|
-
const cli_output_handler_js_1 = require("./cli-output-handler.js");
|
|
7
|
-
class CLIOrchestrator {
|
|
1
|
+
import { CLIArgumentParser, CLIArgumentError } from "./cli-argument-parser.js";
|
|
2
|
+
import { FileProcessor, FileProcessorError } from "./file-processor.js";
|
|
3
|
+
import { CLIOutputHandler } from "./cli-output-handler.js";
|
|
4
|
+
export class CLIOrchestrator {
|
|
8
5
|
argumentParser;
|
|
9
6
|
fileProcessor;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
outputHandlerFactory;
|
|
8
|
+
exit;
|
|
9
|
+
logError;
|
|
10
|
+
constructor(argumentParser = new CLIArgumentParser(), fileProcessor = new FileProcessor(), outputHandlerFactory = (format, llmtext) => new CLIOutputHandler(format, llmtext), exit = (code) => process.exit(code), logError = (message) => console.error(message)) {
|
|
11
|
+
this.argumentParser = argumentParser;
|
|
12
|
+
this.fileProcessor = fileProcessor;
|
|
13
|
+
this.outputHandlerFactory = outputHandlerFactory;
|
|
14
|
+
this.exit = exit;
|
|
15
|
+
this.logError = logError;
|
|
13
16
|
}
|
|
14
17
|
async run() {
|
|
15
18
|
try {
|
|
@@ -20,18 +23,18 @@ class CLIOrchestrator {
|
|
|
20
23
|
// Process files in parallel
|
|
21
24
|
const results = await this.fileProcessor.processFiles(files, options.depth, options.namedOnly);
|
|
22
25
|
// Format and output results
|
|
23
|
-
const outputHandler =
|
|
26
|
+
const outputHandler = this.outputHandlerFactory(options.format, options.llmtext);
|
|
24
27
|
outputHandler.formatAndOutput(results);
|
|
25
28
|
}
|
|
26
29
|
catch (error) {
|
|
27
|
-
if (error instanceof
|
|
28
|
-
|
|
30
|
+
if (error instanceof CLIArgumentError) {
|
|
31
|
+
this.logError(`Error: ${error.message}`);
|
|
29
32
|
this.argumentParser.printHelp();
|
|
30
|
-
|
|
33
|
+
this.exit(1);
|
|
31
34
|
}
|
|
32
|
-
else if (error instanceof
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
else if (error instanceof FileProcessorError) {
|
|
36
|
+
this.logError(error.message);
|
|
37
|
+
this.exit(1);
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
37
40
|
throw error; // Re-throw unexpected errors
|
|
@@ -39,5 +42,4 @@ class CLIOrchestrator {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
exports.CLIOrchestrator = CLIOrchestrator;
|
|
43
45
|
//# sourceMappingURL=cli-orchestrator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-orchestrator.js","sourceRoot":"","sources":["../src/cli-orchestrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-orchestrator.js","sourceRoot":"","sources":["../src/cli-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,kB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C7C,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,OAAO,CAChB,CAAC;YACF,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;gBACtC,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACzC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;iBAAM,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;gBAC/C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC,CAAC,6BAA6B;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { OutputFormat } from '@sammons/code-outline-parser';
|
|
2
|
-
import type { ProcessedFile } from './file-processor.
|
|
2
|
+
import type { ProcessedFile } from './file-processor.ts';
|
|
3
3
|
export declare class CLIOutputHandler {
|
|
4
|
-
private formatter;
|
|
5
|
-
|
|
4
|
+
private readonly formatter;
|
|
5
|
+
private readonly log;
|
|
6
|
+
constructor(format: OutputFormat, llmtext?: boolean, log?: (message: string) => void);
|
|
6
7
|
formatAndOutput(results: ProcessedFile[]): void;
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=cli-output-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-output-handler.d.ts","sourceRoot":"","sources":["../src/cli-output-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAY;
|
|
1
|
+
{"version":3,"file":"cli-output-handler.d.ts","sourceRoot":"","sources":["../src/cli-output-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;gBAG9C,MAAM,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,OAAO,EACjB,GAAG,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAwC;IAM7D,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI;CAIvD"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CLIOutputHandler = void 0;
|
|
4
|
-
const code_outline_formatter_1 = require("@sammons/code-outline-formatter");
|
|
5
|
-
class CLIOutputHandler {
|
|
1
|
+
import { Formatter } from '@sammons/code-outline-formatter';
|
|
2
|
+
export class CLIOutputHandler {
|
|
6
3
|
formatter;
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
log;
|
|
5
|
+
constructor(format, llmtext, log = (message) => console.log(message)) {
|
|
6
|
+
this.formatter = new Formatter(format, llmtext);
|
|
7
|
+
this.log = log;
|
|
9
8
|
}
|
|
10
9
|
formatAndOutput(results) {
|
|
11
10
|
const output = this.formatter.format(results);
|
|
12
|
-
|
|
11
|
+
this.log(output);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
exports.CLIOutputHandler = CLIOutputHandler;
|
|
16
14
|
//# sourceMappingURL=cli-output-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-output-handler.js","sourceRoot":"","sources":["../src/cli-output-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-output-handler.js","sourceRoot":"","sources":["../src/cli-output-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,MAAM,OAAO,gBAAgB;IACV,SAAS,CAAY;IACrB,GAAG,CAA4B;IAEhD,YACE,MAAoB,EACpB,OAAiB,EACjB,MAAiC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAElE,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,eAAe,CAAC,OAAwB;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;CACF"}
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const cli_orchestrator_js_1 = require("./cli-orchestrator.js");
|
|
2
|
+
import { CLIOrchestrator } from "./cli-orchestrator.js";
|
|
5
3
|
async function main() {
|
|
6
|
-
const orchestrator = new
|
|
4
|
+
const orchestrator = new CLIOrchestrator();
|
|
7
5
|
await orchestrator.run();
|
|
8
6
|
}
|
|
9
7
|
main().catch((error) => {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,KAAK,UAAU,IAAI;IACjB,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC;IAC3C,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC;AAC3B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/file-processor.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import fg from 'fast-glob';
|
|
1
2
|
import type { NodeInfo } from '@sammons/code-outline-parser';
|
|
3
|
+
import { Parser } from '@sammons/code-outline-parser';
|
|
2
4
|
export interface ProcessedFile {
|
|
3
5
|
file: string;
|
|
4
6
|
outline: NodeInfo | null;
|
|
@@ -7,8 +9,9 @@ export declare class FileProcessorError extends Error {
|
|
|
7
9
|
constructor(message: string);
|
|
8
10
|
}
|
|
9
11
|
export declare class FileProcessor {
|
|
10
|
-
private parser;
|
|
11
|
-
|
|
12
|
+
private readonly parser;
|
|
13
|
+
private readonly glob;
|
|
14
|
+
constructor(parser?: Parser, glob?: typeof fg);
|
|
12
15
|
findFiles(pattern: string): Promise<string[]>;
|
|
13
16
|
private parseFile;
|
|
14
17
|
processFiles(files: string[], depth: number, namedOnly: boolean): Promise<ProcessedFile[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-processor.d.ts","sourceRoot":"","sources":["../src/file-processor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-processor.d.ts","sourceRoot":"","sources":["../src/file-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,MAAM,GAAE,MAAqB,EAAE,IAAI,GAAE,OAAO,EAAO;IAKlD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAe5C,SAAS;IAsBV,YAAY,CACvB,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,aAAa,EAAE,CAAC;CAQ5B"}
|
package/dist/file-processor.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FileProcessor = exports.FileProcessorError = void 0;
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
9
|
-
const code_outline_parser_1 = require("@sammons/code-outline-parser");
|
|
10
|
-
class FileProcessorError extends Error {
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import fg from 'fast-glob';
|
|
3
|
+
import { Parser } from '@sammons/code-outline-parser';
|
|
4
|
+
export class FileProcessorError extends Error {
|
|
11
5
|
constructor(message) {
|
|
12
6
|
super(message);
|
|
13
7
|
this.name = 'FileProcessorError';
|
|
14
8
|
}
|
|
15
9
|
}
|
|
16
|
-
|
|
17
|
-
class FileProcessor {
|
|
10
|
+
export class FileProcessor {
|
|
18
11
|
parser;
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
glob;
|
|
13
|
+
constructor(parser = new Parser(), glob = fg) {
|
|
14
|
+
this.parser = parser;
|
|
15
|
+
this.glob = glob;
|
|
21
16
|
}
|
|
22
17
|
async findFiles(pattern) {
|
|
23
|
-
const files = await
|
|
18
|
+
const files = await this.glob(pattern, {
|
|
24
19
|
absolute: true,
|
|
25
20
|
ignore: ['**/node_modules/**', '**/dist/**', '**/build/**'],
|
|
26
21
|
});
|
|
@@ -33,7 +28,7 @@ class FileProcessor {
|
|
|
33
28
|
try {
|
|
34
29
|
const outline = await this.parser.parseFile(file, depth, namedOnly);
|
|
35
30
|
return {
|
|
36
|
-
file:
|
|
31
|
+
file: resolve(file),
|
|
37
32
|
outline,
|
|
38
33
|
};
|
|
39
34
|
}
|
|
@@ -41,7 +36,7 @@ class FileProcessor {
|
|
|
41
36
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
42
37
|
console.error(`Error parsing ${file}:`, errorMessage);
|
|
43
38
|
return {
|
|
44
|
-
file:
|
|
39
|
+
file: resolve(file),
|
|
45
40
|
outline: null,
|
|
46
41
|
};
|
|
47
42
|
}
|
|
@@ -52,5 +47,4 @@ class FileProcessor {
|
|
|
52
47
|
return await Promise.all(parsePromises);
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
|
-
exports.FileProcessor = FileProcessor;
|
|
56
50
|
//# sourceMappingURL=file-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-processor.js","sourceRoot":"","sources":["../src/file-processor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-processor.js","sourceRoot":"","sources":["../src/file-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,WAAW,CAAC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AAK,CAAC,iBAAiB,IAAI,GAAG,EAAE,YAAY,CAAC,CAAC;YACtD,OAAO;gBACL,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,KAAe,EACf,KAAa,EACb,SAAkB;QAElB,8CAA8C;QAC9C,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACvC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CACvC,CAAC;QAEF,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CLIOrchestrator } from './cli-orchestrator';
|
|
2
|
-
export { CLIArgumentParser } from './cli-argument-parser';
|
|
3
|
-
export { FileProcessor } from './file-processor';
|
|
4
|
-
export { CLIOutputHandler } from './cli-output-handler';
|
|
1
|
+
export { CLIOrchestrator } from './cli-orchestrator.ts';
|
|
2
|
+
export { CLIArgumentParser } from './cli-argument-parser.ts';
|
|
3
|
+
export { FileProcessor } from './file-processor.ts';
|
|
4
|
+
export { CLIOutputHandler } from './cli-output-handler.ts';
|
|
5
5
|
export declare function parseFiles(patterns: string | string[], options?: {
|
|
6
6
|
format?: 'ascii' | 'json' | 'yaml';
|
|
7
7
|
depth?: number;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
|
package/dist/index.js
CHANGED
|
@@ -1,53 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.CLIOutputHandler = exports.FileProcessor = exports.CLIArgumentParser = exports.CLIOrchestrator = void 0;
|
|
37
|
-
exports.parseFiles = parseFiles;
|
|
38
1
|
// Main orchestrator for programmatic usage
|
|
39
|
-
|
|
40
|
-
Object.defineProperty(exports, "CLIOrchestrator", { enumerable: true, get: function () { return cli_orchestrator_1.CLIOrchestrator; } });
|
|
2
|
+
export { CLIOrchestrator } from "./cli-orchestrator.js";
|
|
41
3
|
// Individual components
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "FileProcessor", { enumerable: true, get: function () { return file_processor_1.FileProcessor; } });
|
|
46
|
-
var cli_output_handler_1 = require("./cli-output-handler");
|
|
47
|
-
Object.defineProperty(exports, "CLIOutputHandler", { enumerable: true, get: function () { return cli_output_handler_1.CLIOutputHandler; } });
|
|
4
|
+
export { CLIArgumentParser } from "./cli-argument-parser.js";
|
|
5
|
+
export { FileProcessor } from "./file-processor.js";
|
|
6
|
+
export { CLIOutputHandler } from "./cli-output-handler.js";
|
|
48
7
|
// Convenience function for simple usage
|
|
49
|
-
async function parseFiles(patterns, options) {
|
|
50
|
-
const { FileProcessor } = await
|
|
8
|
+
export async function parseFiles(patterns, options) {
|
|
9
|
+
const { FileProcessor } = await import("./file-processor.js");
|
|
51
10
|
const fileProcessor = new FileProcessor();
|
|
52
11
|
const patternArray = Array.isArray(patterns) ? patterns : [patterns];
|
|
53
12
|
// Find matching files for all patterns
|
|
@@ -62,11 +21,11 @@ async function parseFiles(patterns, options) {
|
|
|
62
21
|
const results = await fileProcessor.processFiles(uniqueFiles, options?.depth ?? 10, // Default depth
|
|
63
22
|
options?.namedOnly ?? false);
|
|
64
23
|
// Format output
|
|
65
|
-
const { Formatter } = await
|
|
24
|
+
const { Formatter } = await import('@sammons/code-outline-formatter');
|
|
66
25
|
const formatter = new Formatter(options?.format ?? 'ascii');
|
|
67
26
|
const output = formatter.format(results);
|
|
68
27
|
if (options?.output) {
|
|
69
|
-
const fs = await
|
|
28
|
+
const fs = await import('fs');
|
|
70
29
|
await fs.promises.writeFile(options.output, output, 'utf-8');
|
|
71
30
|
return `Results written to ${options.output}`;
|
|
72
31
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,wBAAwB;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,wCAAwC;AACxC,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAA2B,EAC3B,OAKC;IAED,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAE9D,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CA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.
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "CLI tool to parse and provide concise output for JavaScript/TypeScript files",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public",
|
|
@@ -32,20 +33,20 @@
|
|
|
32
33
|
],
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"fast-glob": "3.3.3",
|
|
35
|
-
"
|
|
36
|
-
"@sammons/code-outline-
|
|
37
|
-
"@sammons/code-outline-formatter": "2.1.0"
|
|
36
|
+
"@sammons/code-outline-parser": "2.1.1",
|
|
37
|
+
"@sammons/code-outline-formatter": "2.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/node": "24.
|
|
41
|
-
"
|
|
42
|
-
|
|
40
|
+
"@types/node": "24.10.2",
|
|
41
|
+
"typescript": "5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=26.0.0"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
45
47
|
"build": "tsc",
|
|
46
|
-
"dev": "
|
|
47
|
-
"test": "
|
|
48
|
-
"
|
|
49
|
-
"clean": "rm -rf dist"
|
|
48
|
+
"dev": "node src/cli.ts",
|
|
49
|
+
"test": "node --test \"src/*.test.ts\"",
|
|
50
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-orchestrator.unit.test.d.ts","sourceRoot":"","sources":["../src/cli-orchestrator.unit.test.ts"],"names":[],"mappings":""}
|