pi-for-each 0.1.0 → 0.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 +4 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# pi-for
|
|
1
|
+
# pi-for-each
|
|
2
2
|
|
|
3
3
|
A [pi](https://github.com/earendil-works/pi) extension that adds a `/for`
|
|
4
|
-
prompt-loop command with variable insertion over directory children or file
|
|
4
|
+
prompt-loop command with $each variable insertion over directory children or file
|
|
5
5
|
lines.
|
|
6
6
|
|
|
7
7
|
## Why
|
|
@@ -22,8 +22,7 @@ Like subagents but much simpler, sequential and with more control for the user.
|
|
|
22
22
|
|
|
23
23
|
## What it does
|
|
24
24
|
|
|
25
|
-
Compose a message that contains a `$each@<path>` token (dollar + `each` + at-sign
|
|
26
|
-
+ a file or directory path), then invoke it as the **`/for` command**:
|
|
25
|
+
Compose a message that contains a `$each@<path>` token (dollar + `each` + at-sign + a file or directory path), then invoke it as the **`/for` command**:
|
|
27
26
|
|
|
28
27
|
```
|
|
29
28
|
/for Please reword the skill in $each@./skills/ and make it more polite
|
|
@@ -90,18 +89,11 @@ iteration.
|
|
|
90
89
|
- The submitted message must start with `/for` so that pi's command pipeline
|
|
91
90
|
routes it to the handler. A bare `$each@<path>` message submitted as a normal
|
|
92
91
|
message is not a command and is intercepted with a hint to use `/for`.
|
|
93
|
-
- **Why the old approach failed:** `ExtensionAPI.sendUserMessage()` internally
|
|
94
|
-
calls `prompt(text, { expandPromptTemplates: false, … })`, and pi only runs
|
|
95
|
-
slash/extension commands when `expandPromptTemplates` is true. So sending
|
|
96
|
-
`"/clone"` via `sendUserMessage` never executed the command — it was just
|
|
97
|
-
appended as a literal user message into the *same* session, which is why every
|
|
98
|
-
iteration chained linearly into one session. The fix uses the real
|
|
99
|
-
`ctx.fork()` instead.
|
|
100
92
|
- The `$each@` fuzzy search reuses pi's built-in fuzzy file/directory provider
|
|
101
93
|
(`CombinedAutocompleteProvider.getFuzzyFileSuggestions`) via a wrapping
|
|
102
94
|
`AutocompleteProvider`, with a `readdir` fallback. The editor is extended so
|
|
103
95
|
that typing `$each@` opens that search exactly as `@` after a space does.
|
|
104
|
-
- The full token — starting at the dollar sign and including `
|
|
96
|
+
- The full token — starting at the dollar sign and including `each`, `@` and the
|
|
105
97
|
path, up to (but not including) the first following whitespace — is replaced by
|
|
106
98
|
the iteration value. Not just the path.
|
|
107
99
|
|
package/package.json
CHANGED