@tduyng/pi-outline 0.0.2 → 0.0.4
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 +35 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
# @tduyng/pi-outline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A map of a source file instead of the file. One call lists every declaration with its line span, so the read that follows fetches one body.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A 1,213-line TypeScript file puts 51 KB into the transcript, and every later turn of the session re-reads it. The depth-1 outline of that file is 47 rows, about 3 KB, and it names the lines worth reading.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## How it works
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```text
|
|
10
|
+
outline(path: "src/goal.ts", depth: 1)
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Depth runs from 0 to 5 and defaults to 1. Depth 0 lists top-level declarations, each extra level adds members, and a row with children past the depth ends in `[N nested]`.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
| Language | Declarations |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| TypeScript, JavaScript | functions, classes, interfaces, type aliases, enums, class methods |
|
|
18
|
+
| Python | `def`, `class` |
|
|
19
|
+
| Go | `func`, `type` |
|
|
20
|
+
| Rust | `fn`, `struct`, `enum`, `trait`, `impl`, `mod` |
|
|
21
|
+
| Markdown | headings |
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
Headings inside code fences are ignored.
|
|
24
|
+
|
|
25
|
+
There is no parser. A parser means a dependency, a language server, and a version of both that disagrees with the repository. The outline is built from single-line rules over the text, and spans come from indentation: a declaration runs until the next line at the same or a lower indent, and includes the closing brace that follows its body.
|
|
26
|
+
|
|
27
|
+
That covers the languages people actually outline, and a miss is visible. A file the rules do not cover gets a line saying so, with grep and a ranged read as the fallback.
|
|
28
|
+
|
|
29
|
+
## With the read guard
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
pi-subagent's bulk-read guard blocks a read of a file over 350 lines, and its block message names `outline` first. The intended path is outline, then a ranged read of the one body needed.
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
Without the guard the tool still works, it just stops being the thing that catches an oversized read.
|
|
20
34
|
|
|
21
35
|
## Install
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
```bash
|
|
38
|
+
pi install npm:@tduyng/pi-outline
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-outline`
|
|
42
|
+
|
|
43
|
+
## Limits
|
|
44
|
+
|
|
45
|
+
- Files over 2 MB are refused, since the map would be bigger than the useful part.
|
|
46
|
+
- At most 200 rows, and a row is cut at 120 characters.
|
|
47
|
+
- Spans come from indentation, so unusual formatting can miss a declaration, and an object-literal method can show up as a member.
|
|
48
|
+
- No types, no imports, no call graph.
|