@alexgorbatchev/pi-agentation 3.0.0 → 3.1.0
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 +48 -26
- package/agentation.ts +704 -80
- package/bin/pi-agentation +45 -2
- package/package.json +9 -7
- package/skills/agentation/SKILL.md +112 -0
- package/skills/agentation-fix-loop/SKILL.md +0 -199
package/bin/pi-agentation
CHANGED
|
@@ -14,7 +14,50 @@ done
|
|
|
14
14
|
SCRIPT_DIR="$(cd -P "$(dirname "${SOURCE_PATH}")" && pwd)"
|
|
15
15
|
PACKAGE_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
find_local_bin() {
|
|
18
|
+
local start_dir="$1"
|
|
19
|
+
local executable_name="$2"
|
|
20
|
+
local current_dir="${start_dir}"
|
|
21
|
+
|
|
22
|
+
while true; do
|
|
23
|
+
local candidate_path="${current_dir}/node_modules/.bin/${executable_name}"
|
|
24
|
+
if [[ -x "${candidate_path}" ]]; then
|
|
25
|
+
printf '%s\n' "${candidate_path}"
|
|
26
|
+
return 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
local parent_dir
|
|
30
|
+
parent_dir="$(dirname "${current_dir}")"
|
|
31
|
+
if [[ "${parent_dir}" == "${current_dir}" ]]; then
|
|
32
|
+
return 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
current_dir="${parent_dir}"
|
|
36
|
+
done
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
resolve_executable() {
|
|
40
|
+
local executable_name="$1"
|
|
41
|
+
local resolved_path=""
|
|
42
|
+
|
|
43
|
+
if resolved_path="$(find_local_bin "${PWD}" "${executable_name}")"; then
|
|
44
|
+
printf '%s\n' "${resolved_path}"
|
|
45
|
+
return 0
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if resolved_path="$(command -v "${executable_name}" 2>/dev/null)"; then
|
|
49
|
+
printf '%s\n' "${resolved_path}"
|
|
50
|
+
return 0
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
printf 'Required executable "%s" was not found in node_modules/.bin or PATH\n' "${executable_name}" >&2
|
|
54
|
+
exit 1
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
PI_BIN="$(resolve_executable pi)"
|
|
58
|
+
AGENTATION_BIN="$(resolve_executable agentation)"
|
|
59
|
+
|
|
60
|
+
exec env PI_AGENTATION_AGENTATION_BIN="${AGENTATION_BIN}" "${PI_BIN}" \
|
|
18
61
|
-e "${PACKAGE_ROOT}/agentation.ts" \
|
|
19
|
-
--skill "${PACKAGE_ROOT}/skills/agentation
|
|
62
|
+
--skill "${PACKAGE_ROOT}/skills/agentation/SKILL.md" \
|
|
20
63
|
"$@"
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexgorbatchev/pi-agentation",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "pi extension launcher for
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "pi extension launcher for Agentation Fork",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/alexgorbatchev/pi-agentation"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"keywords": [
|
|
7
11
|
"pi-package",
|
|
@@ -23,19 +27,17 @@
|
|
|
23
27
|
"agentation.ts",
|
|
24
28
|
"README.md",
|
|
25
29
|
"bin/pi-agentation",
|
|
26
|
-
"skills/agentation
|
|
30
|
+
"skills/agentation/SKILL.md"
|
|
27
31
|
],
|
|
28
32
|
"peerDependencies": {
|
|
29
33
|
"@mariozechner/pi-coding-agent": "*"
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
|
-
"@alexgorbatchev/agentation-
|
|
36
|
+
"@alexgorbatchev/agentation-cli": "^1.0.3",
|
|
33
37
|
"@mariozechner/pi-coding-agent": "^0.61.0"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|
|
36
|
-
"check": "npm run
|
|
37
|
-
"prepack": "npm run sync-skill",
|
|
38
|
-
"sync-skill": "node ./scripts/syncBundledSkill.js",
|
|
40
|
+
"check": "npm run verify:package && npm run verify:launcher",
|
|
39
41
|
"verify:package": "npm pack --dry-run > /dev/null",
|
|
40
42
|
"verify:launcher": "PI_OFFLINE=1 ./bin/pi-agentation --list-models > /dev/null"
|
|
41
43
|
},
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentation
|
|
3
|
+
description: >-
|
|
4
|
+
Process exactly one Agentation Fork batch that was already fetched by the
|
|
5
|
+
pi-agentation extension. Acknowledge each annotation, make the requested code
|
|
6
|
+
change, then resolve, reply, or dismiss it. Use when the extension dispatches
|
|
7
|
+
`/skill:agentation <project-id>` for a ready batch, or when the user
|
|
8
|
+
explicitly wants to continue the current batch.
|
|
9
|
+
targets:
|
|
10
|
+
- '*'
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Agentation Fork Batch Processor
|
|
14
|
+
|
|
15
|
+
Process exactly one Agentation Fork annotation batch for the supplied `<project-id>`.
|
|
16
|
+
|
|
17
|
+
If this skill is invoked as `/skill:agentation <project-id>`, treat the user-supplied argument as the authoritative project ID for this run.
|
|
18
|
+
|
|
19
|
+
## Extension contract
|
|
20
|
+
|
|
21
|
+
The `pi-agentation` extension owns polling and batching.
|
|
22
|
+
|
|
23
|
+
That means:
|
|
24
|
+
|
|
25
|
+
- The extension already ran `agentation pending` or `agentation watch`
|
|
26
|
+
- The extension injected the current batch as an extension context message
|
|
27
|
+
- You must process **only that provided batch**
|
|
28
|
+
- You must **not** start or manage your own polling loop
|
|
29
|
+
|
|
30
|
+
## Do not do these commands here
|
|
31
|
+
|
|
32
|
+
Do **not** run any of the following from this skill:
|
|
33
|
+
|
|
34
|
+
- `agentation start`
|
|
35
|
+
- `agentation status`
|
|
36
|
+
- `agentation projects`
|
|
37
|
+
- `agentation pending`
|
|
38
|
+
- `agentation watch`
|
|
39
|
+
|
|
40
|
+
Those belong to the extension, not to this skill.
|
|
41
|
+
|
|
42
|
+
## Allowed Agentation Fork CLI commands
|
|
43
|
+
|
|
44
|
+
Use only the annotation lifecycle commands needed to process the provided batch:
|
|
45
|
+
|
|
46
|
+
- `agentation ack <annotation-id>`
|
|
47
|
+
- `agentation resolve <annotation-id> --summary "..."`
|
|
48
|
+
- `agentation reply <annotation-id> --message "..."`
|
|
49
|
+
- `agentation dismiss <annotation-id> --reason "..."`
|
|
50
|
+
|
|
51
|
+
## Required workflow
|
|
52
|
+
|
|
53
|
+
For each annotation in the provided batch, in order:
|
|
54
|
+
|
|
55
|
+
1. **Acknowledge it first**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
agentation ack <annotation-id>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Understand the request**
|
|
62
|
+
- Read the annotation fields from the extension-provided batch context
|
|
63
|
+
- Inspect the relevant files
|
|
64
|
+
- Infer the smallest correct change
|
|
65
|
+
|
|
66
|
+
3. **Implement the fix**
|
|
67
|
+
- Keep changes minimal
|
|
68
|
+
- Follow repo conventions
|
|
69
|
+
- Do not broaden scope without evidence
|
|
70
|
+
|
|
71
|
+
4. **Finish the annotation with exactly one terminal action**
|
|
72
|
+
|
|
73
|
+
Resolve when fixed:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
agentation resolve <annotation-id> --summary "<short file + change summary>"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Reply when clarification is required:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
agentation reply <annotation-id> --message "I need clarification on ..."
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Dismiss when not actionable:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
agentation dismiss <annotation-id> --reason "Not actionable because ..."
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Important execution rules
|
|
92
|
+
|
|
93
|
+
- Process annotations in the order they appear in the provided batch
|
|
94
|
+
- Do not invent or fetch another batch
|
|
95
|
+
- Do not leave the skill running after the provided batch is handled
|
|
96
|
+
- Run each `agentation ack|resolve|reply|dismiss` as a **separate bash command** so the extension can track completion reliably
|
|
97
|
+
- Keep resolve summaries concise and concrete
|
|
98
|
+
- Only resolve once the requested change is actually implemented
|
|
99
|
+
|
|
100
|
+
## If no batch context is present
|
|
101
|
+
|
|
102
|
+
If the extension context says there is no active batch:
|
|
103
|
+
|
|
104
|
+
- report that clearly
|
|
105
|
+
- do not try to poll Agentation Fork yourself
|
|
106
|
+
- tell the user to resume the extension loop with `/agentation-loop-start`
|
|
107
|
+
|
|
108
|
+
## Completion condition
|
|
109
|
+
|
|
110
|
+
Stop after the current provided batch has been fully processed.
|
|
111
|
+
|
|
112
|
+
This is a **one-shot batch processor**, not a watcher.
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agentation-fix-loop
|
|
3
|
-
description: >-
|
|
4
|
-
Watch for Agentation annotations and fix each one using the Agentation CLI.
|
|
5
|
-
Runs `agentation watch` in a loop — acknowledges each annotation, makes the
|
|
6
|
-
code fix, then resolves it. Use when the user says "watch annotations",
|
|
7
|
-
"fix annotations", "annotation loop", "agentation fix loop", or wants
|
|
8
|
-
autonomous processing of design feedback from the Agentation toolbar.
|
|
9
|
-
targets:
|
|
10
|
-
- '*'
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Agentation Fix Loop (CLI)
|
|
14
|
-
|
|
15
|
-
Watch for annotations from the Agentation toolbar and fix each one in the codebase using the `agentation` CLI.
|
|
16
|
-
|
|
17
|
-
If this skill is invoked as `/skill:agentation-fix-loop <project-id>`, treat the user-supplied argument as the authoritative project ID for this run and skip repo discovery.
|
|
18
|
-
|
|
19
|
-
## CLI commands used by this skill
|
|
20
|
-
|
|
21
|
-
- `agentation start` / `agentation stop` / `agentation status`
|
|
22
|
-
- `agentation projects --json`
|
|
23
|
-
- `agentation pending <project-id> --json`
|
|
24
|
-
- `agentation watch <project-id> --json`
|
|
25
|
-
- `agentation ack <id>`
|
|
26
|
-
- `agentation resolve <id> --summary "..."`
|
|
27
|
-
- `agentation reply <id> --message "..."`
|
|
28
|
-
- `agentation dismiss <id> --reason "..."`
|
|
29
|
-
|
|
30
|
-
## Preflight (required)
|
|
31
|
-
|
|
32
|
-
### 1) Ensure the Agentation CLI is available
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
command -v agentation >/dev/null || { echo "agentation CLI not found on PATH"; exit 1; }
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If this fails, install or build the Agentation CLI first and ensure the `agentation` binary is on `PATH`.
|
|
39
|
-
|
|
40
|
-
### 2) Check whether the Agentation stack is already running
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
agentation status
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Then verify API reachability (default `http://127.0.0.1:4747`):
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
agentation projects --json >/dev/null
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
If not running or unreachable, **start it before doing anything else**:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
agentation start --background
|
|
56
|
-
# or foreground during debugging
|
|
57
|
-
agentation start --foreground
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Re-check after start:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
agentation status
|
|
64
|
-
agentation projects --json >/dev/null
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
If you only want the HTTP API without router for this run:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
AGENTATION_ROUTER_ADDR=0 agentation start --background
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 3) Determine the project ID and fetch pending work
|
|
74
|
-
|
|
75
|
-
If the skill was invoked with a user argument (for example `/skill:agentation-fix-loop project-alpha`), use that `<project-id>` directly and skip discovery.
|
|
76
|
-
|
|
77
|
-
Otherwise, quickly extract project IDs from your app code:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
rg -n --glob '*.{tsx,ts,jsx,js}' '<Agentation[^>]*projectId='
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
If you want to extract a literal string value quickly (when set as `projectId="..."` or `projectId='...'`):
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
rg -o --no-filename --glob '*.{tsx,ts,jsx,js}' "projectId=(?:\"[^\"]+\"|'[^']+')" \
|
|
87
|
-
| head -n1 \
|
|
88
|
-
| sed -E "s/projectId=(\"([^\"]+)\"|'([^']+)')/\2\3/"
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Then fetch the initial batch:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
agentation pending <project-id> --json
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Process that batch first, then enter watch mode.
|
|
98
|
-
|
|
99
|
-
### CLI behavior notes
|
|
100
|
-
|
|
101
|
-
- `agentation start` manages server + router under one process by default.
|
|
102
|
-
- One running Agentation stack is enough for multiple local projects/sessions.
|
|
103
|
-
- Do not start extra instances unless intentionally isolating ports/storage.
|
|
104
|
-
|
|
105
|
-
## Behavior
|
|
106
|
-
|
|
107
|
-
1. Call:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
agentation watch <project-id> --timeout 300 --batch-window 10 --json
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
2. For each annotation in the returned batch:
|
|
114
|
-
|
|
115
|
-
a. **Acknowledge**
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
agentation ack <annotation-id>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
b. **Understand**
|
|
122
|
-
- Read annotation text (`comment`)
|
|
123
|
-
- Read target context (`element`, `elementPath`, `url`, `nearbyText`, `reactComponents`)
|
|
124
|
-
- Map to likely source files before editing
|
|
125
|
-
|
|
126
|
-
c. **Fix**
|
|
127
|
-
- Make the code change requested by the annotation
|
|
128
|
-
- Keep changes minimal and aligned with project conventions
|
|
129
|
-
|
|
130
|
-
d. **Resolve**
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
agentation resolve <annotation-id> --summary "<short file + change summary>"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
3. After processing the batch, loop back to step 1.
|
|
137
|
-
|
|
138
|
-
4. Stop when:
|
|
139
|
-
- user says stop, or
|
|
140
|
-
- watch times out repeatedly with no new work.
|
|
141
|
-
|
|
142
|
-
## Rules
|
|
143
|
-
|
|
144
|
-
- Always acknowledge before starting work.
|
|
145
|
-
- Keep resolve summaries concise (1–2 sentences, mention file(s) + result).
|
|
146
|
-
- If unclear, ask via thread reply instead of guessing:
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
agentation reply <annotation-id> --message "I need clarification on ..."
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
- If not actionable, dismiss with reason:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
agentation dismiss <annotation-id> --reason "Not actionable because ..."
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
- Process annotations in received order.
|
|
159
|
-
- Only resolve once the requested change is implemented.
|
|
160
|
-
|
|
161
|
-
## Required project-scoped loop
|
|
162
|
-
|
|
163
|
-
Use `<project-id>` as the first argument for all pending/watch commands. Use timeout of at least 300s:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
agentation projects --json
|
|
167
|
-
agentation pending <project-id> --json
|
|
168
|
-
agentation watch <project-id> --timeout 300 --batch-window 10 --json
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Loop template
|
|
172
|
-
|
|
173
|
-
```text
|
|
174
|
-
Round 1:
|
|
175
|
-
agentation pending <project-id> --json
|
|
176
|
-
-> process all returned annotations
|
|
177
|
-
|
|
178
|
-
Round 2:
|
|
179
|
-
agentation watch <project-id> --timeout 300 --batch-window 10 --json
|
|
180
|
-
-> got 2 annotations
|
|
181
|
-
-> ack #1, fix, resolve #1
|
|
182
|
-
-> ack #2, reply (needs clarification)
|
|
183
|
-
|
|
184
|
-
Round 3:
|
|
185
|
-
agentation watch <project-id> --timeout 300 --batch-window 10 --json
|
|
186
|
-
-> got 1 annotation (clarification follow-up)
|
|
187
|
-
-> ack, fix, resolve
|
|
188
|
-
|
|
189
|
-
Round 4:
|
|
190
|
-
agentation watch <project-id> --timeout 300 --batch-window 10 --json
|
|
191
|
-
-> timeout true, no annotations
|
|
192
|
-
-> exit (or continue if user requested persistent watch mode)
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Troubleshooting
|
|
196
|
-
|
|
197
|
-
- `agentation pending` fails: Agentation is not running, base URL is wrong (`agentation start --background`), or `<project-id>` is missing.
|
|
198
|
-
- If using non-default server URL, pass `--base-url` or set `AGENTATION_BASE_URL`.
|
|
199
|
-
- If frontend keeps creating new sessions unexpectedly, verify localStorage/session behavior in the host app or Storybook setup.
|