pi-extensions 0.1.9

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.
Files changed (135) hide show
  1. package/.ralph/import-cc-codex.md +31 -0
  2. package/.ralph/import-cc-codex.state.json +14 -0
  3. package/.ralph/mario-not-impl.md +69 -0
  4. package/.ralph/mario-not-impl.state.json +14 -0
  5. package/.ralph/mario-not-spec.md +163 -0
  6. package/.ralph/mario-not-spec.state.json +14 -0
  7. package/LICENSE +21 -0
  8. package/README.md +65 -0
  9. package/RELEASING.md +34 -0
  10. package/agent-guidance/CHANGELOG.md +4 -0
  11. package/agent-guidance/README.md +102 -0
  12. package/agent-guidance/agent-guidance.ts +147 -0
  13. package/agent-guidance/package.json +22 -0
  14. package/agent-guidance/setup.sh +75 -0
  15. package/agent-guidance/templates/CLAUDE.md +5 -0
  16. package/agent-guidance/templates/CODEX.md +92 -0
  17. package/agent-guidance/templates/GEMINI.md +5 -0
  18. package/arcade/CHANGELOG.md +4 -0
  19. package/arcade/README.md +85 -0
  20. package/arcade/assets/picman.png +0 -0
  21. package/arcade/assets/ping.png +0 -0
  22. package/arcade/assets/spice-invaders.png +0 -0
  23. package/arcade/assets/tetris.png +0 -0
  24. package/arcade/mario-not/README.md +30 -0
  25. package/arcade/mario-not/boss.js +103 -0
  26. package/arcade/mario-not/camera.js +59 -0
  27. package/arcade/mario-not/collision.js +91 -0
  28. package/arcade/mario-not/colors.js +36 -0
  29. package/arcade/mario-not/constants.js +97 -0
  30. package/arcade/mario-not/core.js +39 -0
  31. package/arcade/mario-not/death.js +77 -0
  32. package/arcade/mario-not/effects.js +84 -0
  33. package/arcade/mario-not/enemies.js +31 -0
  34. package/arcade/mario-not/engine.js +171 -0
  35. package/arcade/mario-not/fireballs.js +98 -0
  36. package/arcade/mario-not/items.js +24 -0
  37. package/arcade/mario-not/levels.js +403 -0
  38. package/arcade/mario-not/logic.js +104 -0
  39. package/arcade/mario-not/mario-not.ts +297 -0
  40. package/arcade/mario-not/player.js +244 -0
  41. package/arcade/mario-not/render.js +257 -0
  42. package/arcade/mario-not/spec.md +548 -0
  43. package/arcade/mario-not/state.js +246 -0
  44. package/arcade/mario-not/tests/e2e.test.js +855 -0
  45. package/arcade/mario-not/tests/engine.test.js +888 -0
  46. package/arcade/mario-not/tests/fixtures/story0-frame.txt +4 -0
  47. package/arcade/mario-not/tests/fixtures/story1-camera.txt +4 -0
  48. package/arcade/mario-not/tests/fixtures/story1-glyphs.txt +4 -0
  49. package/arcade/mario-not/tests/fixtures/story10-item.txt +4 -0
  50. package/arcade/mario-not/tests/fixtures/story11-hazards.txt +4 -0
  51. package/arcade/mario-not/tests/fixtures/story12-used-block.txt +4 -0
  52. package/arcade/mario-not/tests/fixtures/story13-pipes.txt +4 -0
  53. package/arcade/mario-not/tests/fixtures/story14-goal.txt +4 -0
  54. package/arcade/mario-not/tests/fixtures/story15-hud-narrow.txt +2 -0
  55. package/arcade/mario-not/tests/fixtures/story16-unknown-tile.txt +4 -0
  56. package/arcade/mario-not/tests/fixtures/story17-mix.txt +4 -0
  57. package/arcade/mario-not/tests/fixtures/story18-hud-score.txt +2 -0
  58. package/arcade/mario-not/tests/fixtures/story19-cue.txt +4 -0
  59. package/arcade/mario-not/tests/fixtures/story2-enemy.txt +4 -0
  60. package/arcade/mario-not/tests/fixtures/story20-camera-offset.txt +4 -0
  61. package/arcade/mario-not/tests/fixtures/story21-hud-zero.txt +2 -0
  62. package/arcade/mario-not/tests/fixtures/story22-big-viewport.txt +4 -0
  63. package/arcade/mario-not/tests/fixtures/story23-camera-negative.txt +4 -0
  64. package/arcade/mario-not/tests/fixtures/story24-camera-width.txt +4 -0
  65. package/arcade/mario-not/tests/fixtures/story25-camera-positive.txt +4 -0
  66. package/arcade/mario-not/tests/fixtures/story26-hud-lives.txt +2 -0
  67. package/arcade/mario-not/tests/fixtures/story27-hud-coins.txt +2 -0
  68. package/arcade/mario-not/tests/fixtures/story28-item-viewport.txt +4 -0
  69. package/arcade/mario-not/tests/fixtures/story29-enemy-viewport.txt +4 -0
  70. package/arcade/mario-not/tests/fixtures/story3-hud.txt +2 -0
  71. package/arcade/mario-not/tests/fixtures/story30-hud-score.txt +2 -0
  72. package/arcade/mario-not/tests/fixtures/story31-particles-viewport.txt +4 -0
  73. package/arcade/mario-not/tests/fixtures/story32-paused-frame.txt +4 -0
  74. package/arcade/mario-not/tests/fixtures/story4-big.txt +4 -0
  75. package/arcade/mario-not/tests/fixtures/story5-resume-hud.txt +2 -0
  76. package/arcade/mario-not/tests/fixtures/story6-particles.txt +4 -0
  77. package/arcade/mario-not/tests/fixtures/story6-paused.txt +4 -0
  78. package/arcade/mario-not/tests/fixtures/story7-powerup.txt +4 -0
  79. package/arcade/mario-not/tests/fixtures/story8-hud-time.txt +2 -0
  80. package/arcade/mario-not/tests/fixtures/story9-hud-level.txt +2 -0
  81. package/arcade/mario-not/tiles.js +79 -0
  82. package/arcade/mario-not/tsconfig.json +14 -0
  83. package/arcade/mario-not/types.js +225 -0
  84. package/arcade/package.json +26 -0
  85. package/arcade/picman.ts +328 -0
  86. package/arcade/ping.ts +594 -0
  87. package/arcade/spice-invaders.ts +1104 -0
  88. package/arcade/tetris.ts +662 -0
  89. package/code-actions/CHANGELOG.md +4 -0
  90. package/code-actions/README.md +65 -0
  91. package/code-actions/actions.ts +107 -0
  92. package/code-actions/index.ts +148 -0
  93. package/code-actions/package.json +22 -0
  94. package/code-actions/search.ts +79 -0
  95. package/code-actions/snippets.ts +179 -0
  96. package/code-actions/ui.ts +120 -0
  97. package/files-widget/CHANGELOG.md +90 -0
  98. package/files-widget/DESIGN.md +452 -0
  99. package/files-widget/README.md +122 -0
  100. package/files-widget/TODO.md +141 -0
  101. package/files-widget/browser.ts +922 -0
  102. package/files-widget/comment.ts +5 -0
  103. package/files-widget/constants.ts +18 -0
  104. package/files-widget/demo.svg +1 -0
  105. package/files-widget/file-tree.ts +224 -0
  106. package/files-widget/file-viewer.ts +93 -0
  107. package/files-widget/git.ts +107 -0
  108. package/files-widget/index.ts +140 -0
  109. package/files-widget/input-utils.ts +3 -0
  110. package/files-widget/package.json +22 -0
  111. package/files-widget/types.ts +28 -0
  112. package/files-widget/utils.ts +26 -0
  113. package/files-widget/viewer.ts +424 -0
  114. package/import-cc-codex/research/import-chats-from-other-agents.md +135 -0
  115. package/import-cc-codex/spec.md +79 -0
  116. package/package.json +29 -0
  117. package/ralph-wiggum/CHANGELOG.md +7 -0
  118. package/ralph-wiggum/README.md +96 -0
  119. package/ralph-wiggum/SKILL.md +73 -0
  120. package/ralph-wiggum/index.ts +792 -0
  121. package/ralph-wiggum/package.json +25 -0
  122. package/raw-paste/CHANGELOG.md +7 -0
  123. package/raw-paste/README.md +52 -0
  124. package/raw-paste/index.ts +112 -0
  125. package/raw-paste/package.json +22 -0
  126. package/tab-status/CHANGELOG.md +4 -0
  127. package/tab-status/README.md +61 -0
  128. package/tab-status/assets/tab-status.png +0 -0
  129. package/tab-status/package.json +22 -0
  130. package/tab-status/tab-status.ts +179 -0
  131. package/usage-extension/CHANGELOG.md +17 -0
  132. package/usage-extension/README.md +120 -0
  133. package/usage-extension/index.ts +628 -0
  134. package/usage-extension/package.json +22 -0
  135. package/usage-extension/screenshot.png +0 -0
@@ -0,0 +1,122 @@
1
+ # files-widget
2
+
3
+ In-terminal file browser and viewer for Pi. Navigate files, view diffs, select code, and send comments to the agent without leaving the terminal.
4
+
5
+ ![Demo](demo.svg)
6
+
7
+ ## Install
8
+
9
+ **Quick install (Pi package manager):**
10
+
11
+ ```bash
12
+ pi install npm:@tmustier/pi-files-widget
13
+ ```
14
+
15
+ ```bash
16
+ pi install git:github.com/tmustier/pi-extensions
17
+ ```
18
+
19
+ Then add to `~/.pi/agent/settings.json`:
20
+
21
+ ```json
22
+ {
23
+ "packages": [
24
+ {
25
+ "source": "git:github.com/tmustier/pi-extensions",
26
+ "extensions": ["files-widget/index.ts"]
27
+ }
28
+ ]
29
+ }
30
+ ```
31
+
32
+ **Local clone:**
33
+
34
+ Add to your Pi extensions list:
35
+
36
+ ```json
37
+ {
38
+ "extensions": [
39
+ "~/pi-extensions/files-widget"
40
+ ]
41
+ }
42
+ ```
43
+
44
+ If you prefer symlinking into `~/.pi/agent/extensions`:
45
+
46
+ ```bash
47
+ ln -sfn ~/pi-extensions/files-widget ~/.pi/agent/extensions/files-widget
48
+ ```
49
+
50
+ Then reference it in your settings:
51
+
52
+ ```json
53
+ {
54
+ "extensions": [
55
+ "~/.pi/agent/extensions/files-widget"
56
+ ]
57
+ }
58
+ ```
59
+
60
+ ## Dependencies (recommended)
61
+
62
+ ```bash
63
+ brew install bat git-delta glow
64
+ ```
65
+
66
+ - `bat`: syntax highlighting
67
+ - `delta`: formatted diffs
68
+ - `glow`: markdown rendering
69
+
70
+ If any are missing, the extension will notify you at session start and gracefully fall back to plain rendering.
71
+
72
+ ## Commands
73
+
74
+ - `/files` - open the file browser
75
+ - `/review` - open tuicr review flow
76
+ - `/diff` - open critique (bunx critique)
77
+
78
+ ### Review/Diff Dependencies
79
+
80
+ ```bash
81
+ brew install agavra/tap/tuicr
82
+ brew install oven-sh/bun/bun
83
+ ```
84
+
85
+ - `tuicr` is required for `/review`
86
+ - `bun` is required for `/diff`
87
+
88
+ If missing, `/review` or `/diff` will show a clear install prompt.
89
+
90
+ ## Browser Keybindings
91
+
92
+ - `j/k` or `↑/↓`: move
93
+ - `Enter`: open file / expand folder
94
+ - `h/l` or `←/→`: collapse/expand folder
95
+ - `PgUp/PgDn`: page up/down
96
+ - `c`: toggle changed-only view
97
+ - `]` / `[`: next/prev changed file
98
+ - `/`: search (type to filter, `Esc` to exit)
99
+ - `+` / `-`: increase/decrease browser height
100
+ - `q`: close
101
+
102
+ ## Viewer Keybindings
103
+
104
+ - `j/k` or `↑/↓`: scroll
105
+ - `PgUp/PgDn`: page up/down
106
+ - `g/G`: top/bottom
107
+ - `d`: toggle diff (tracked files only)
108
+ - `/`: search (type to search)
109
+ - `n` / `N`: next/prev match
110
+ - `v`: select mode (line selection)
111
+ - `c`: comment on selected lines (inline prompt)
112
+ - `]` / `[`: next/prev changed file
113
+ - `+` / `-`: increase/decrease viewer height
114
+ - `q`: back to browser
115
+
116
+ ## Notes
117
+
118
+ - Untracked files show as `[UNTRACKED]` and open in normal view.
119
+ - Folder LOCs are shown only when the folder is collapsed (expanded folders would duplicate counts).
120
+ - Line counts load asynchronously; the header shows activity while counts are computed.
121
+ - Large non-git folders load progressively and may show `[partial]` while loading in safe mode.
122
+ - Git status refreshes every 3 seconds while `/files` is open.
@@ -0,0 +1,141 @@
1
+ # Editor Extension - Implementation Checklist
2
+
3
+ ## Pre-requisites
4
+ - [x] Check for required tools (`bat`, `delta`, `glow`, `fd`) and document install commands
5
+ - [ ] Verify pi-tui capabilities for widget sizing and keyboard handling
6
+
7
+ ## Phase 1: File Browser Widget
8
+
9
+ ### Scaffold
10
+ - [x] Create `index.ts` extension entry point
11
+ - [ ] Register `Ctrl+E` toggle shortcut
12
+ - [x] Basic widget rendering with placeholder content
13
+
14
+ ### File Tree
15
+ - [x] Build file tree from current directory
16
+ - [ ] Respect `.gitignore` (use `fd` or manual parsing)
17
+ - [x] Collapse/expand directories
18
+ - [x] Navigation with `j/k` and arrow keys
19
+ - [x] Enter to expand dir or open file
20
+
21
+ ### Git Integration
22
+ - [x] Parse `git status --porcelain` output
23
+ - [x] Show indicators: M (modified), ? (untracked), A (added), D (deleted)
24
+ - [x] Color coding: green (staged), yellow (unstaged), grey (untracked)
25
+
26
+ ### Search
27
+ - [x] `/` to enter search mode
28
+ - [ ] Fuzzy match file names
29
+ - [ ] Highlight matches, Enter to jump
30
+
31
+ ## Phase 2: File Viewer
32
+
33
+ ### Basic Viewer
34
+ - [x] `ctx.ui.custom()` full-screen component
35
+ - [x] Load file content
36
+ - [x] Line numbers
37
+ - [x] Scroll with `j/k`, `PgUp/PgDn`, `g/G`
38
+ - [x] `q` to close
39
+
40
+ ### Syntax Highlighting
41
+ - [x] Detect `bat` availability
42
+ - [x] Shell out to `bat` for highlighting
43
+ - [x] Parse ANSI output for display
44
+ - [x] Fallback to plain text with line numbers
45
+
46
+ ### Markdown Rendering
47
+ - [x] Detect `glow` availability
48
+ - [x] Shell out to `glow` for .md files
49
+ - [ ] Toggle between rendered and raw (`m` key?)
50
+ - [x] Fallback to syntax-highlighted raw
51
+
52
+ ### Diff View
53
+ - [x] `d` to toggle diff mode
54
+ - [x] Shell out to `git diff HEAD -- <file>`
55
+ - [x] Use `delta` if available for nicer output
56
+ - [x] Show only if file has changes
57
+
58
+ ## Phase 3: Select + Comment + Send
59
+
60
+ ### Selection Mode
61
+ - [x] `v` to enter selection mode
62
+ - [x] Track start line and current line
63
+ - [x] Visual highlight of selected range
64
+ - [x] `j/k` to extend selection
65
+ - [x] `Esc` to cancel
66
+
67
+ ### Comment Dialog
68
+ - [x] `c` to open comment input
69
+ - [ ] Multi-line text input
70
+ - [x] `Enter` or `Ctrl+Enter` to confirm
71
+ - [x] `Esc` to cancel
72
+
73
+ ### Send to Agent
74
+ - [x] Format message with file path, line range, code snippet, comment
75
+ - [x] Use `pi.sendUserMessage()` with `deliverAs: "followUp"`
76
+ - [x] Handle case when agent is idle vs streaming
77
+ - [ ] Show confirmation notification
78
+
79
+ ## Phase 4: tuicr Integration (Optional)
80
+
81
+ ### Setup
82
+ - [x] Check for tuicr availability (`which tuicr`)
83
+ - [x] Document install: `brew install agavra/tap/tuicr`
84
+
85
+ ### /review Command
86
+ - [x] Register `/review` command
87
+ - [x] Spawn tuicr with `stdio: "inherit"` (takes over terminal)
88
+ - [x] After exit, read clipboard (`pbpaste` on macOS, `xclip` on Linux)
89
+ - [x] Detect tuicr export format (contains `## Review Summary` or structured markdown)
90
+ - [x] Send review to agent via `pi.sendUserMessage()`
91
+ - [x] Show confirmation notification
92
+
93
+ ### UX
94
+ - [ ] `/review` - review all unstaged changes
95
+ - [ ] `/review --staged` - review staged changes
96
+ - [ ] `/review HEAD` - review last commit
97
+
98
+ ## Phase 5: critique Integration (Optional)
99
+
100
+ ### Setup
101
+ - [ ] Check for critique availability (requires Bun)
102
+ - [ ] Document install: `bun install -g critique`
103
+
104
+ ### /diff Command
105
+ - [x] Register `/diff` command
106
+ - [x] Spawn critique for quick diff viewing
107
+ - [ ] `/diff --watch` for live monitoring while agent works
108
+ - [x] `/diff <file>` for specific file
109
+
110
+ ### Web Preview
111
+ - [ ] `/diff --web` generates shareable URL
112
+ - [ ] Useful for async review or sharing with others
113
+
114
+ ## Phase 6: Agent Awareness
115
+
116
+ ### Track Modifications
117
+ - [x] Subscribe to `tool_result` events
118
+ - [x] Filter for `write` and `edit` tools
119
+ - [x] Extract file paths from tool inputs
120
+ - [ ] Store in extension state with timestamps
121
+
122
+ ### Visual Indicators
123
+ - [x] Badge files in tree with "agent modified" icon (e.g., 🤖)
124
+ - [ ] Different indicator for "agent modified this session" vs "human modified"
125
+ - [ ] Persist across session reload via `pi.appendEntry()`
126
+
127
+ ### Per-Line Attribution (Stretch - Cursor Blame style)
128
+ - [ ] Parse edit tool diffs to get line ranges
129
+ - [ ] Store line-level attribution metadata (which model, which tool call)
130
+ - [ ] Show in file viewer gutter
131
+ - [ ] Differentiate: Tab completions vs agent runs vs human edits
132
+
133
+ ## Polish
134
+
135
+ - [x] Error handling for missing tools
136
+ - [x] Graceful degradation (no git, no bat, etc.)
137
+ - [ ] Performance: cache file tree, lazy load
138
+ - [ ] Help overlay (`?` key)
139
+ - [ ] Configurable keybindings
140
+ - [x] Theme integration (use pi theme colors)
141
+ - [x] Linux clipboard support (`xclip -selection clipboard`)