@tduyng/pi-outline 0.0.3 → 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 +16 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
# @tduyng/pi-outline
|
|
2
2
|
|
|
3
|
-
A map of a source file instead of the file. One
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
What it saves is larger and grows with the file. On a 1,213-line, 51 KB TypeScript file the depth-1 outline is 47 rows, 3.4 KB. The whole read would put 51 KB in the transcript and re-bill it on every later turn of the session, which is the cheapest mistake to make in pi and the most expensive to keep.
|
|
10
|
-
|
|
11
|
-
## The tool
|
|
12
|
-
|
|
13
|
-
`outline` takes a `path` and an optional `depth` from 0 to 5, default 1. It prints one row per declaration: the span, then the declaration line. Members sit under their class or impl, one indent per level. A row whose declaration has children beyond `depth` ends in `[N nested]`.
|
|
7
|
+
## How it works
|
|
14
8
|
|
|
15
9
|
```text
|
|
16
10
|
outline(path: "src/goal.ts", depth: 1)
|
|
17
11
|
```
|
|
18
12
|
|
|
19
|
-
|
|
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]`.
|
|
20
14
|
|
|
21
15
|
| Language | Declarations |
|
|
22
16
|
| --- | --- |
|
|
@@ -28,17 +22,15 @@ Covered:
|
|
|
28
22
|
|
|
29
23
|
Headings inside code fences are ignored.
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
A read of a file over 350 lines is blocked by pi-subagent's bulk-read guard, and the block message names `outline` first. The pair is the intended path: outline, pick the span, then a ranged read of the one body you need.
|
|
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.
|
|
34
26
|
|
|
35
|
-
|
|
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.
|
|
36
28
|
|
|
37
|
-
##
|
|
29
|
+
## With the read guard
|
|
38
30
|
|
|
39
|
-
|
|
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.
|
|
40
32
|
|
|
41
|
-
|
|
33
|
+
Without the guard the tool still works, it just stops being the thing that catches an oversized read.
|
|
42
34
|
|
|
43
35
|
## Install
|
|
44
36
|
|
|
@@ -47,3 +39,10 @@ pi install npm:@tduyng/pi-outline
|
|
|
47
39
|
```
|
|
48
40
|
|
|
49
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.
|