redline-review 1.0.1 → 2.0.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
@@ -46,7 +46,7 @@ mkdir -p .claude/commands
46
46
  cp $(npm root -g)/redline-review/adapters/claude/redline-review.md .claude/commands/redline-review.md
47
47
  ```
48
48
 
49
- ### Step 6 — Use it in Claude Code
49
+ ### Use it in Claude Code
50
50
 
51
51
  Open any project in Claude Code and type:
52
52
 
@@ -69,17 +69,100 @@ You can pass flags directly:
69
69
 
70
70
  ---
71
71
 
72
- ## How it works
72
+ ## Review modes
73
73
 
74
- 1. Detects your git diff automatically (`git diff main...HEAD`, falls back through `master...HEAD` → `HEAD~1` → `--cached`)
75
- 2. **Auto-detects relevant rule categories** from the diff content (or uses your `--stack`/`--type` flags)
76
- 3. Prints the assembled review prompt to stdout
77
- 4. Your agent reads that prompt and performs the review — no external calls made by the CLI
74
+ ### Default branch diff (PR-style)
75
+
76
+ ```bash
77
+ redline-review
78
+ ```
79
+
80
+ Diffs the current branch against the detected base branch and assembles a review prompt. This is the original behavior — no subcommand needed.
81
+
82
+ ### Range — review between two commits
83
+
84
+ ```bash
85
+ redline-review range --from <commit-ish> --to <commit-ish>
86
+ ```
87
+
88
+ One-shot review of everything that changed between two refs. `--to` defaults to `HEAD` if omitted.
89
+
90
+ ```bash
91
+ # Review changes between two tags
92
+ redline-review range --from v1.0.0 --to v1.1.0
93
+
94
+ # Review the last 5 commits
95
+ redline-review range --from HEAD~5 --to HEAD
96
+
97
+ # Strict mode
98
+ redline-review range --from main --to HEAD --prompt strict
99
+ ```
100
+
101
+ ### Walk — commit-by-commit review
102
+
103
+ ```bash
104
+ redline-review walk --start [--from <ref>] [--to <ref>] [--interval N] [--direction backwards|forwards]
105
+ redline-review walk --next
106
+ redline-review walk --status
107
+ redline-review walk --reset
108
+ ```
109
+
110
+ Steps through commits one at a time (or in batches), emitting a review prompt for each step. State is persisted in `.git/redline-walk.json`.
111
+
112
+ ```bash
113
+ # Start walking backwards from HEAD to main (default)
114
+ redline-review walk --start
115
+
116
+ # Walk in batches of 2 commits
117
+ redline-review walk --start --interval 2
118
+
119
+ # Walk forwards from a specific point
120
+ redline-review walk --start --from v1.0.0 --direction forwards
121
+
122
+ # Get the next review prompt
123
+ redline-review walk --next
124
+
125
+ # Check progress
126
+ redline-review walk --status
127
+
128
+ # Clear walk state
129
+ redline-review walk --reset
130
+ ```
131
+
132
+ The interactive "review → ask → continue" loop lives in your agent (see adapter docs), not in the CLI. The CLI stays stateless per invocation — it reads/writes a small state file but each call is a single deterministic function.
133
+
134
+ Flags passed at `--start` time (`--stack`, `--type`, `--prompt`) are captured into state and reused for every `--next`.
135
+
136
+ ### Repo — full repository review
137
+
138
+ ```bash
139
+ redline-review repo [--max-tree-depth N] [--stack ...] [--type ...] [--prompt ...]
140
+ ```
141
+
142
+ Emits a review prompt that instructs your agent to systematically explore the entire repository. The prompt includes:
143
+
144
+ - An annotated file tree with navigation hints (`[entry-point]`, `[config]`, `[migration]`, `[orchestration]`, `[largest]`)
145
+ - Inlined orientation files (package.json, go.mod, README, CI workflows, etc.)
146
+ - Architecture review dimensions (module boundaries, hidden coupling, consistency, abstraction quality, reliability hazards, architectural drift)
147
+ - Rule-based focus areas auto-detected from file extensions
148
+
149
+ ```bash
150
+ # Review this repo
151
+ redline-review repo
152
+
153
+ # Limit tree depth for large repos
154
+ redline-review repo --max-tree-depth 3
155
+
156
+ # Override with explicit stack
157
+ redline-review repo --stack go --type architecture,concurrency
158
+ ```
78
159
 
79
160
  ---
80
161
 
81
162
  ## Flags
82
163
 
164
+ All flags work with all modes (default, range, walk, repo).
165
+
83
166
  ### `--type` — focus by concern
84
167
 
85
168
  ```bash
@@ -123,16 +206,27 @@ redline-review --stack go --type backend
123
206
  ### `--prompt` — control review depth
124
207
 
125
208
  ```bash
126
- redline-review --prompt base # default
209
+ redline-review --prompt base # default for diff-based modes
127
210
  redline-review --prompt strict # CRITICAL and HIGH only + fix suggestions
128
211
  redline-review --prompt lightweight # top 3 issues only
129
212
  ```
130
213
 
131
- | Value | Output |
132
- | ---------------- | ------------------------------------------------- |
214
+ | Value | Output |
215
+ | ---------------- | -------------------------------------------------- |
133
216
  | `base` (default) | All issues grouped CRITICAL → HIGH → MEDIUM → LOW |
134
- | `strict` | CRITICAL and HIGH only, concrete fix per issue |
135
- | `lightweight` | Top 3 issues, one tight paragraph each |
217
+ | `strict` | CRITICAL and HIGH only, concrete fix per issue |
218
+ | `lightweight` | Top 3 issues, one tight paragraph each |
219
+
220
+ Repo mode defaults to its own `repo-reviewer` template (agent-driven exploration). Pass `--prompt strict` or `--prompt lightweight` to override.
221
+
222
+ ### `--base` — override base branch
223
+
224
+ ```bash
225
+ redline-review --base origin/develop
226
+ redline-review --base main
227
+ ```
228
+
229
+ Only applies to the default (branch diff) mode. Range and walk use `--from`/`--to` instead.
136
230
 
137
231
  ---
138
232
 
@@ -154,6 +248,17 @@ redline-review --stack java --prompt lightweight
154
248
  # Security review, any stack
155
249
  redline-review --type security
156
250
 
251
+ # Review a release range
252
+ redline-review range --from v1.2.0 --to v1.3.0
253
+
254
+ # Walk through a feature branch commit by commit
255
+ redline-review walk --start --prompt strict
256
+ redline-review walk --next
257
+ redline-review walk --next
258
+
259
+ # Full repo audit
260
+ redline-review repo
261
+
157
262
  # Pipe to clipboard (macOS) — paste into any agent
158
263
  redline-review | pbcopy
159
264
 
@@ -174,6 +279,8 @@ When no `--type` or `--stack` flags are given, `redline-review` scans the diff f
174
279
 
175
280
  If nothing is detected, falls back to `correctness + maintainability + risk-patterns`.
176
281
 
282
+ For repo mode (no diff), detection is based on file extensions in the repository.
283
+
177
284
  Detected domains are printed to stderr so they don't pollute the prompt:
178
285
 
179
286
  ```
@@ -205,16 +312,23 @@ Domains (auto-detected): auth.yaml, concurrency.yaml, performance-db.yaml
205
312
 
206
313
  Adapter files for other agents are in `adapters/`:
207
314
 
208
- | Agent | Command |
209
- | -------------- | -------------------------------------------------------------------------------------------------------------------------------- |
210
- | Claude Code | `cp $(npm root -g)/redline-review/adapters/claude/redline-review.md ~/.claude/commands/redline-review.md` |
211
- | GitHub Copilot | `cp $(npm root -g)/redline-review/adapters/copilot/redline-review.md .github/copilot-instructions.md` |
212
- | Codex CLI | `cp $(npm root -g)/redline-review/adapters/codex/redline-review.md AGENTS.md` |
213
- | OpenCode | `cp $(npm root -g)/redline-review/adapters/opencode/redline-review.md AGENTS.md` |
214
- | Anti-gravity | `cp $(npm root -g)/redline-review/adapters/antigravity/redline-review.md <your-config-path>` |
315
+ | Agent | Command |
316
+ | -------------- | --------------------------------------------------------------------------------------------------------- |
317
+ | Claude Code | `cp $(npm root -g)/redline-review/adapters/claude/redline-review.md ~/.claude/commands/redline-review.md` |
318
+ | GitHub Copilot | `cp $(npm root -g)/redline-review/adapters/copilot/redline-review.md .github/copilot-instructions.md` |
319
+ | Codex CLI | `cp $(npm root -g)/redline-review/adapters/codex/redline-review.md AGENTS.md` |
320
+ | OpenCode | `cp $(npm root -g)/redline-review/adapters/opencode/redline-review.md AGENTS.md` |
321
+ | Anti-gravity | `cp $(npm root -g)/redline-review/adapters/antigravity/redline-review.md <your-config-path>` |
215
322
 
216
323
  Each adapter follows the same pattern: run `redline-review`, take the output as the review task.
217
324
 
325
+ For the commit walk interactive flow, adapters should:
326
+
327
+ 1. Run `redline-review walk --start` and perform the review
328
+ 2. Ask the user: "Continue to the next commit?"
329
+ 3. If yes, run `redline-review walk --next` and repeat
330
+ 4. When walk is complete (exit 0 with no stdout), inform the user
331
+
218
332
  ---
219
333
 
220
334
  ## License
@@ -25,6 +25,37 @@ redline-review --prompt strict # CRITICAL/HIGH severity only
25
25
  redline-review --prompt lightweight # top 3 issues, quick scan
26
26
  ```
27
27
 
28
+ ## Range review
29
+
30
+ Review changes between two commits or tags:
31
+
32
+ ```bash
33
+ redline-review range --from <ref> --to <ref>
34
+ redline-review range --from v1.0.0 --to v1.1.0 --prompt strict
35
+ ```
36
+
37
+ ## Commit walk
38
+
39
+ Step through commits one at a time. Run `--start`, review the output, then `--next` to advance:
40
+
41
+ ```bash
42
+ redline-review walk --start # begin
43
+ redline-review walk --next # advance
44
+ redline-review walk --status # check progress
45
+ redline-review walk --reset # clear state
46
+ redline-review walk --start --interval 2 # batch commits
47
+ redline-review walk --start --direction forwards # walk oldest → newest
48
+ ```
49
+
50
+ ## Repo review
51
+
52
+ Full repository audit. Output is a manifest — use file-reading tools to explore as instructed:
53
+
54
+ ```bash
55
+ redline-review repo
56
+ redline-review repo --max-tree-depth 3
57
+ ```
58
+
28
59
  ## One-shot (no global install)
29
60
 
30
61
  ```bash
@@ -12,15 +12,14 @@ The CLI assembles a focused code review prompt from the git diff and the install
12
12
  npm install -g redline-review
13
13
  ```
14
14
 
15
- ## Usage
15
+ ## Branch diff (default)
16
16
 
17
17
  ```bash
18
- # All rules (default — base branch auto-detected)
18
+ # Auto-detect base branch
19
19
  redline-review
20
20
 
21
- # Pin the base branch explicitly (use when auto-detection picks the wrong base)
21
+ # Pin the base branch explicitly
22
22
  redline-review --base origin/develop
23
- redline-review --base develop
24
23
 
25
24
  # Focused by review type
26
25
  redline-review --type auth,performance
@@ -35,7 +34,60 @@ redline-review --prompt strict
35
34
  redline-review --prompt lightweight
36
35
  ```
37
36
 
37
+ ## Range review
38
+
39
+ Review changes between two specific commits or tags.
40
+
41
+ ```bash
42
+ redline-review range --from <ref> --to <ref>
43
+ redline-review range --from v1.0.0 --to v1.1.0
44
+ redline-review range --from HEAD~5 --to HEAD --prompt strict
45
+ ```
46
+
47
+ `--to` defaults to HEAD if omitted.
48
+
49
+ ## Commit walk
50
+
51
+ Step through commits one at a time.
52
+
53
+ ```bash
54
+ redline-review walk --start
55
+ redline-review walk --next
56
+ redline-review walk --status
57
+ redline-review walk --reset
58
+ ```
59
+
60
+ **Interactive flow:**
61
+
62
+ 1. Run `redline-review walk --start` and capture stdout.
63
+ 2. Perform the review described by that prompt.
64
+ 3. Present findings to the user, then ask: "Continue to the next commit?"
65
+ 4. If the user confirms, run `redline-review walk --next` and repeat from step 2.
66
+ 5. If the user declines, stop. State persists — they can resume later with `--next`.
67
+ 6. When walk is complete (`--next` exits with no stdout), tell the user.
68
+
69
+ Optional flags for `--start`:
70
+
71
+ ```bash
72
+ redline-review walk --start --interval 2 # batch 2 commits per step
73
+ redline-review walk --start --direction forwards # walk oldest → newest
74
+ redline-review walk --start --from v1.0.0 --to v2.0.0 # explicit range
75
+ redline-review walk --start --force # overwrite in-progress walk
76
+ ```
77
+
78
+ Flags `--stack`, `--type`, and `--prompt` passed at `--start` time are captured and reused for every `--next`.
79
+
80
+ ## Repo review
81
+
82
+ Full repository architecture audit. The output is a manifest with an annotated file tree and orientation files — use your file-reading tools to explore the codebase as instructed by the prompt.
83
+
84
+ ```bash
85
+ redline-review repo
86
+ redline-review repo --max-tree-depth 3
87
+ redline-review repo --stack go --type architecture
88
+ ```
89
+
38
90
  ## How to use as a Claude Code skill
39
91
 
40
- Place this file at `.claude/commands/redline-review.md` in your project.
92
+ Place this file at `.claude/commands/redline-review.md` in your project (or `~/.claude/commands/redline-review.md` for global access).
41
93
  Then invoke it with `/redline-review` in Claude Code.
@@ -31,6 +31,37 @@ redline-review --prompt strict # CRITICAL/HIGH only
31
31
  redline-review --prompt lightweight # top 3 issues
32
32
  ```
33
33
 
34
+ ## Range review
35
+
36
+ Review changes between two commits or tags:
37
+
38
+ ```bash
39
+ redline-review range --from <ref> --to <ref>
40
+ redline-review range --from v1.0.0 --to v1.1.0 --prompt strict
41
+ ```
42
+
43
+ ## Commit walk
44
+
45
+ Step through commits one at a time. Run `--start`, review the output, then `--next` to advance:
46
+
47
+ ```bash
48
+ redline-review walk --start # begin
49
+ redline-review walk --next # advance
50
+ redline-review walk --status # check progress
51
+ redline-review walk --reset # clear state
52
+ redline-review walk --start --interval 2 # batch commits
53
+ redline-review walk --start --direction forwards # walk oldest → newest
54
+ ```
55
+
56
+ ## Repo review
57
+
58
+ Full repository audit. Output is a manifest — use file-reading tools to explore as instructed:
59
+
60
+ ```bash
61
+ redline-review repo
62
+ redline-review repo --max-tree-depth 3
63
+ ```
64
+
34
65
  ## One-shot (no global install)
35
66
 
36
67
  ```bash
@@ -24,8 +24,6 @@ Take the full output and treat it as your review instructions. Perform the revie
24
24
 
25
25
  ## Focused reviews
26
26
 
27
- In the Copilot Chat panel, ask it to run:
28
-
29
27
  ```bash
30
28
  redline-review --type auth,performance
31
29
  redline-review --stack laravel,inertia --type backend
@@ -33,6 +31,37 @@ redline-review --prompt strict
33
31
  redline-review --prompt lightweight
34
32
  ```
35
33
 
34
+ ## Range review
35
+
36
+ Review changes between two commits or tags:
37
+
38
+ ```bash
39
+ redline-review range --from <ref> --to <ref>
40
+ redline-review range --from v1.0.0 --to v1.1.0 --prompt strict
41
+ ```
42
+
43
+ ## Commit walk
44
+
45
+ Step through commits one at a time. After each step, perform the review from the output, then run `--next` to continue:
46
+
47
+ ```bash
48
+ redline-review walk --start # begin
49
+ redline-review walk --next # advance
50
+ redline-review walk --status # check progress
51
+ redline-review walk --reset # clear state
52
+ redline-review walk --start --interval 2 # batch commits
53
+ redline-review walk --start --direction forwards # walk oldest → newest
54
+ ```
55
+
56
+ ## Repo review
57
+
58
+ Full repository audit. Output is a manifest — use file-reading tools to explore the codebase as instructed:
59
+
60
+ ```bash
61
+ redline-review repo
62
+ redline-review repo --max-tree-depth 3
63
+ ```
64
+
36
65
  ## Workspace instructions path
37
66
 
38
67
  `.github/copilot-instructions.md` is loaded automatically by Copilot in VS Code for workspace-level context.
@@ -25,6 +25,37 @@ redline-review --prompt strict
25
25
  redline-review --prompt lightweight
26
26
  ```
27
27
 
28
+ ## Range review
29
+
30
+ Review changes between two commits or tags:
31
+
32
+ ```bash
33
+ redline-review range --from <ref> --to <ref>
34
+ redline-review range --from v1.0.0 --to v1.1.0 --prompt strict
35
+ ```
36
+
37
+ ## Commit walk
38
+
39
+ Step through commits one at a time. Run `--start`, review the output, then `--next` to advance:
40
+
41
+ ```bash
42
+ redline-review walk --start # begin
43
+ redline-review walk --next # advance
44
+ redline-review walk --status # check progress
45
+ redline-review walk --reset # clear state
46
+ redline-review walk --start --interval 2 # batch commits
47
+ redline-review walk --start --direction forwards # walk oldest → newest
48
+ ```
49
+
50
+ ## Repo review
51
+
52
+ Full repository audit. Output is a manifest — use file-reading tools to explore as instructed:
53
+
54
+ ```bash
55
+ redline-review repo
56
+ redline-review repo --max-tree-depth 3
57
+ ```
58
+
28
59
  ## Integration tip
29
60
 
30
61
  Add to your project's `AGENTS.md` or OpenCode instructions:
@@ -0,0 +1,2 @@
1
+ export declare function detectRepoStacks(): string[];
2
+ //# sourceMappingURL=detect-repo-stacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-repo-stacks.d.ts","sourceRoot":"","sources":["../src/detect-repo-stacks.ts"],"names":[],"mappings":"AAkBA,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAkC3C"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectRepoStacks = detectRepoStacks;
4
+ const child_process_1 = require("child_process");
5
+ const build_context_1 = require("./build-context");
6
+ const EXTENSION_STACK_MAP = {
7
+ '.go': 'go',
8
+ '.tsx': 'react',
9
+ '.jsx': 'react',
10
+ '.vue': 'vue',
11
+ '.svelte': 'svelte',
12
+ '.rb': 'rails',
13
+ '.java': 'java',
14
+ '.cs': 'csharp',
15
+ '.py': 'django',
16
+ '.php': 'laravel',
17
+ };
18
+ const FALLBACK_FILES = ['correctness.yaml', 'maintainability.yaml', 'risk-patterns.yaml'];
19
+ function detectRepoStacks() {
20
+ let files;
21
+ try {
22
+ const output = (0, child_process_1.execSync)('git ls-files', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
23
+ files = output ? output.split('\n') : [];
24
+ }
25
+ catch {
26
+ return FALLBACK_FILES;
27
+ }
28
+ const extCounts = new Map();
29
+ for (const f of files) {
30
+ const dot = f.lastIndexOf('.');
31
+ if (dot === -1)
32
+ continue;
33
+ const ext = f.slice(dot).toLowerCase();
34
+ extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
35
+ }
36
+ const stacks = new Set();
37
+ for (const [ext, count] of extCounts) {
38
+ if (count < 2)
39
+ continue;
40
+ const stack = EXTENSION_STACK_MAP[ext];
41
+ if (stack)
42
+ stacks.add(stack);
43
+ }
44
+ // Detect Node.js projects by package.json presence
45
+ if (files.includes('package.json') && !stacks.has('react')) {
46
+ stacks.add('node');
47
+ }
48
+ if (stacks.size === 0)
49
+ return FALLBACK_FILES;
50
+ const result = (0, build_context_1.buildReviewContext)({ stack: Array.from(stacks) });
51
+ return result.length > 0 ? result : FALLBACK_FILES;
52
+ }
53
+ //# sourceMappingURL=detect-repo-stacks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-repo-stacks.js","sourceRoot":"","sources":["../src/detect-repo-stacks.ts"],"names":[],"mappings":";;AAkBA,4CAkCC;AApDD,iDAAyC;AACzC,mDAAqD;AAErD,MAAM,mBAAmB,GAA2B;IAClD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,QAAQ;IACnB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;AAE1F,SAAgB,gBAAgB;IAC9B,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,cAAc,EACpC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,SAAS;QACzB,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;QACrC,IAAI,KAAK,GAAG,CAAC;YAAE,SAAS;QACxB,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,mDAAmD;IACnD,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,cAAc,CAAC;IAE7C,MAAM,MAAM,GAAG,IAAA,kCAAkB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC;AACrD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface ManifestResult {
2
+ tree: string;
3
+ orientationContent: string;
4
+ fileCount: number;
5
+ truncated: boolean;
6
+ }
7
+ export declare function buildManifest(maxDepth?: number): ManifestResult;
8
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,QAAQ,GAAE,MAAW,GAAG,cAAc,CA0FnE"}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildManifest = buildManifest;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const child_process_1 = require("child_process");
10
+ const ENTRY_POINT_PATTERNS = /^(main|index|app|server|entrypoint|bootstrap|startup)\./i;
11
+ const ORCHESTRATION_PATTERNS = /\b(runtime|scheduler|worker|queue|dispatcher|processor)\b/i;
12
+ const MIGRATION_PATTERNS = /\bmigrations?\b/i;
13
+ const CONFIG_BASENAMES = new Set([
14
+ 'dockerfile', 'docker-compose.yml', 'docker-compose.yaml',
15
+ 'makefile', 'justfile', 'taskfile.yml',
16
+ '.env.example', '.env.sample',
17
+ ]);
18
+ const CONFIG_EXTENSIONS = new Set(['.tf', '.toml', '.ini']);
19
+ const BINARY_EXTENSIONS = new Set([
20
+ '.png', '.jpg', '.jpeg', '.gif', '.ico', '.svg', '.webp', '.bmp',
21
+ '.woff', '.woff2', '.ttf', '.eot', '.otf',
22
+ '.zip', '.tar', '.gz', '.bz2', '.7z', '.rar',
23
+ '.exe', '.dll', '.so', '.dylib', '.bin',
24
+ '.mp3', '.mp4', '.avi', '.mov', '.wav',
25
+ '.pdf', '.doc', '.docx', '.xls', '.xlsx',
26
+ '.pyc', '.class', '.o', '.obj',
27
+ ]);
28
+ const ORIENTATION_FILES = [
29
+ 'package.json', 'go.mod', 'Cargo.toml', 'pyproject.toml',
30
+ 'Gemfile', 'pom.xml', 'build.gradle', 'composer.json',
31
+ 'Makefile', 'justfile', 'Taskfile.yml',
32
+ 'tsconfig.json',
33
+ ];
34
+ const MAX_INLINE_SIZE = 2048;
35
+ const MAX_README_SIZE = 2048;
36
+ function isBinary(filePath) {
37
+ const ext = path_1.default.extname(filePath).toLowerCase();
38
+ return BINARY_EXTENSIONS.has(ext);
39
+ }
40
+ function getTag(filePath, basename) {
41
+ if (ENTRY_POINT_PATTERNS.test(basename))
42
+ return 'entry-point';
43
+ if (MIGRATION_PATTERNS.test(filePath))
44
+ return 'migration';
45
+ if (ORCHESTRATION_PATTERNS.test(basename))
46
+ return 'orchestration';
47
+ if (CONFIG_BASENAMES.has(basename.toLowerCase()))
48
+ return 'config';
49
+ if (CONFIG_EXTENSIONS.has(path_1.default.extname(filePath).toLowerCase()))
50
+ return 'config';
51
+ if (basename.toLowerCase().startsWith('config') || basename.toLowerCase().startsWith('settings'))
52
+ return 'config';
53
+ return null;
54
+ }
55
+ function getLineCount(filePath) {
56
+ try {
57
+ const output = (0, child_process_1.execSync)(`wc -l < "${filePath}"`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
58
+ return parseInt(output, 10) || 0;
59
+ }
60
+ catch {
61
+ return 0;
62
+ }
63
+ }
64
+ function buildManifest(maxDepth = 10) {
65
+ let files;
66
+ try {
67
+ const output = (0, child_process_1.execSync)('git ls-files', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
68
+ files = output ? output.split('\n') : [];
69
+ }
70
+ catch {
71
+ return { tree: '(no tracked files)', orientationContent: '', fileCount: 0, truncated: false };
72
+ }
73
+ const nonBinary = files.filter(f => !isBinary(f));
74
+ // Compute largest files (top 10 by line count)
75
+ const fileSizes = [];
76
+ for (const f of nonBinary.slice(0, 500)) {
77
+ const lines = getLineCount(f);
78
+ if (lines > 0)
79
+ fileSizes.push({ file: f, lines });
80
+ }
81
+ fileSizes.sort((a, b) => b.lines - a.lines);
82
+ const largestFiles = new Set(fileSizes.slice(0, 10).map(f => f.file));
83
+ const largestMap = new Map(fileSizes.slice(0, 10).map(f => [f.file, f.lines]));
84
+ // Build annotated tree
85
+ let truncated = false;
86
+ const treeLines = [];
87
+ for (const f of nonBinary) {
88
+ const depth = f.split('/').length - 1;
89
+ if (depth > maxDepth) {
90
+ truncated = true;
91
+ continue;
92
+ }
93
+ const basename = path_1.default.basename(f);
94
+ const tag = getTag(f, basename);
95
+ const isLargest = largestFiles.has(f);
96
+ let annotation = '';
97
+ if (tag)
98
+ annotation += ` [${tag}]`;
99
+ if (isLargest)
100
+ annotation += ` (${largestMap.get(f)} lines) [largest]`;
101
+ treeLines.push(f + annotation);
102
+ }
103
+ if (truncated) {
104
+ const truncCount = nonBinary.filter(f => f.split('/').length - 1 > maxDepth).length;
105
+ treeLines.push(`... (${truncCount} files beyond depth ${maxDepth} truncated)`);
106
+ }
107
+ // Inline orientation files
108
+ const orientationParts = [];
109
+ for (const name of ORIENTATION_FILES) {
110
+ if (!files.includes(name))
111
+ continue;
112
+ try {
113
+ const content = fs_1.default.readFileSync(name, 'utf8');
114
+ if (content.length <= MAX_INLINE_SIZE) {
115
+ orientationParts.push(`### ${name}\n\`\`\`\n${content.trimEnd()}\n\`\`\``);
116
+ }
117
+ else {
118
+ orientationParts.push(`### ${name}\n\`\`\`\n${content.slice(0, MAX_INLINE_SIZE).trimEnd()}\n... (truncated)\n\`\`\``);
119
+ }
120
+ }
121
+ catch {
122
+ continue;
123
+ }
124
+ }
125
+ // Inline README (first 2KB)
126
+ const readmeFile = files.find(f => /^readme\.md$/i.test(f));
127
+ if (readmeFile) {
128
+ try {
129
+ const content = fs_1.default.readFileSync(readmeFile, 'utf8');
130
+ const trimmed = content.slice(0, MAX_README_SIZE).trimEnd();
131
+ orientationParts.push(`### ${readmeFile}\n${trimmed}${content.length > MAX_README_SIZE ? '\n... (truncated)' : ''}`);
132
+ }
133
+ catch { /* skip */ }
134
+ }
135
+ // Inline CI workflows (truncated)
136
+ const ciFiles = files.filter(f => f.startsWith('.github/workflows/') && f.endsWith('.yml'));
137
+ for (const f of ciFiles.slice(0, 3)) {
138
+ try {
139
+ const content = fs_1.default.readFileSync(f, 'utf8');
140
+ const trimmed = content.slice(0, 1024).trimEnd();
141
+ orientationParts.push(`### ${f}\n\`\`\`yaml\n${trimmed}${content.length > 1024 ? '\n... (truncated)' : ''}\n\`\`\``);
142
+ }
143
+ catch {
144
+ continue;
145
+ }
146
+ }
147
+ return {
148
+ tree: treeLines.join('\n'),
149
+ orientationContent: orientationParts.join('\n\n'),
150
+ fileCount: files.length,
151
+ truncated,
152
+ };
153
+ }
154
+ //# sourceMappingURL=manifest.js.map