-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
354 lines (316 loc) · 9.55 KB
/
Copy pathmise.toml
File metadata and controls
354 lines (316 loc) · 9.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
[tools]
node = "24.14.1"
python = "3.13"
"npm:@earendil-works/pi-coding-agent" = "0.75.5"
"npm:@clipboard-health/groundcrew" = "4.10.4"
"npm:@openai/codex" = "0.137.0"
"github:yvgude/lean-ctx" = "3.7.5"
[tasks.bootstrap]
description = "Provision managed tools, Pi extensions, and local scaffold files"
run = [
"mise install",
"mise run install-local",
"mise run install-skills",
"pi install -l npm:pi-sub-agent",
"mise run doctor",
]
[tasks.install-skills]
description = "Pull latest syscode-agentic-skills into .pi/skills/"
run = '''
#!/usr/bin/env bash
set -euo pipefail
skills_repo="https://github.com/syscode-labs/syscode-agentic-skills.git"
skills_cache="${XDG_CACHE_HOME:-$HOME/.cache}/syscode-agentic-skills"
if [ -d "$skills_cache/.git" ]; then
git -C "$skills_cache" pull --ff-only --quiet
else
git clone --depth 1 --quiet "$skills_repo" "$skills_cache"
fi
mkdir -p .pi/skills
for skill_dir in "$skills_cache"/skills/*/; do
skill_name="$(basename "$skill_dir")"
cp -r "$skill_dir" ".pi/skills/$skill_name"
done
count="$(find "$skills_cache/skills" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')"
printf 'installed %s skills from syscode-agentic-skills\n' "$count"
'''
[tasks.install-local]
description = "Install generated Pi configuration into this checkout"
run = """
mkdir -p .pi .agents/skills
rm -rf .pi/agents .pi/skills .pi/extensions
mkdir -p .pi/agents .pi/skills .pi/extensions
cp -R templates/pi/agents/. .pi/agents/
cp -R templates/pi/skills/. .pi/skills/
cp -R templates/pi/extensions/. .pi/extensions/
cp templates/pi/settings.json .pi/settings.json
cp templates/pi/AGENTS.md .pi/AGENTS.md
cp templates/pi/mcp.json .pi/mcp.json
"""
[tasks.doctor]
description = "Report required and optional tool availability"
run = """
#!/usr/bin/env bash
set -uo pipefail
failed=0
for tool in mise node npm git rg jq tmux curl pi crew codex; do
if command -v "$tool" >/dev/null 2>&1; then
printf 'ok %s\n' "$tool"
else
printf 'missing %s\n' "$tool"
failed=1
fi
done
node_version="$(node --version 2>/dev/null || true)"
npm_version="$(npm --version 2>/dev/null || true)"
if [ "$node_version" != "v24.14.1" ]; then
printf 'wrong node %s (required v24.14.1)\n' "$node_version"
failed=1
fi
case "$npm_version" in
11.11.*) ;;
*)
printf 'wrong npm %s (required ~11.11.0)\n' "$npm_version"
failed=1
;;
esac
for tool in safehouse specstory; do
if command -v "$tool" >/dev/null 2>&1; then
printf 'ok %s\n' "$tool"
else
printf 'optional %s\n' "$tool"
fi
done
if [ "$(uname -s)" != "Darwin" ]; then
printf 'optional safehouse requires macOS; use a VM/container boundary on this host\n'
fi
exit "$failed"
"""
[tasks.doctor-safehouse]
description = "Require Safehouse before starting a sandboxed agent"
run = """
test "$(uname -s)" = "Darwin" || {
echo "safehouse requires macOS" >&2
exit 1
}
command -v safehouse >/dev/null 2>&1 || {
echo "safehouse is required. Enter through nix develop or devbox shell." >&2
exit 1
}
"""
[tasks.doctor-specstory]
description = "Require SpecStory before starting a captured agent session"
run = """
command -v specstory >/dev/null 2>&1 || {
echo "specstory is required. Enter through nix develop or devbox shell." >&2
exit 1
}
"""
[tasks.bootstrap-context]
description = "Install project-local Pi context packages"
run = '''
set -euo pipefail
pi install -l npm:pi-lean-ctx@3.7.5
pi install -l npm:pi-mcp-adapter@2.9.0
'''
[tasks.install-context-mode-profile]
description = "Install experimental Context Mode profile instead of LeanCTX"
run = '''
set -euo pipefail
echo "Experimental profile: do not use together with pi-lean-ctx default profile."
pi install -l npm:context-mode@1.0.162
'''
[tasks.install-caveman]
description = "Install optional Pi output-token compressor"
run = '''
set -euo pipefail
pi install -l npm:pi-caveman@1.0.7
'''
[tasks.bootstrap-docmancer]
description = "Install and initialise Docmancer"
run = '''
#!/usr/bin/env bash
set -euo pipefail
command -v python3.13 >/dev/null 2>&1 || {
echo "python3.13 not found. Run: mise install" >&2
exit 1
}
python3.13 -m pip install --user pipx
python3.13 -m pipx ensurepath
python3.13 -m pipx install docmancer --python python3.13
docmancer setup
'''
[tasks.docmancer-query]
description = "Query indexed documentation"
run = '''
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -eq 0 ]; then
echo "usage: mise run docmancer-query -- '<question>'" >&2
exit 2
fi
docmancer query "$*" --mode hybrid --explain
'''
[tasks.docmancer-add]
description = "Add a documentation site to Docmancer"
run = '''
#!/usr/bin/env bash
set -euo pipefail
: "${DOCS_URL:?set DOCS_URL, e.g. DOCS_URL=https://docs.pytest.org}"
docmancer add "$DOCS_URL"
'''
[tasks.docmancer-ingest]
description = "Ingest local documentation into Docmancer"
run = '''
#!/usr/bin/env bash
set -euo pipefail
docmancer ingest "${DOCS_PATH:-./docs}"
'''
[tasks.doctor-docmancer]
description = "Check Docmancer availability"
run = '''
set -euo pipefail
command -v docmancer >/dev/null
docmancer --version
'''
[tasks.lean-ctx-daemon]
description = "Start lean-ctx daemon for full per-tool-call tracking"
run = '''
#!/usr/bin/env bash
set -euo pipefail
command -v lean-ctx >/dev/null 2>&1 || { echo "lean-ctx not found; run: mise install" >&2; exit 1; }
lean-ctx serve -d
echo "lean-ctx daemon started — per-tool-call metrics now available"
'''
[tasks.push-leanctx-metrics]
description = "Push latest lean-ctx savings metrics to Prometheus Pushgateway (set METRICS_PUSH_URL)"
run = '''
#!/usr/bin/env bash
set -euo pipefail
: "${METRICS_PUSH_URL:?set METRICS_PUSH_URL, e.g. METRICS_PUSH_URL=http://pushgateway:9091}"
command -v lean-ctx >/dev/null 2>&1 || { echo "lean-ctx not found; run: mise install" >&2; exit 1; }
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
lean-ctx gain --json > "$tmpdir/leanctx-after.json"
SESSION="${SESSION:-pi-leanctx}" REPO="$(basename "$(pwd)")" \
python3 scripts/leanctx-to-prom.py < "$tmpdir/leanctx-after.json" | tee "$tmpdir/metrics.prom"
curl -sf --data-binary @"$tmpdir/metrics.prom" \
"${METRICS_PUSH_URL}/metrics/job/pi-agent-kit/instance/${SESSION:-pi-leanctx}"
printf 'pushed to %s\n' "$METRICS_PUSH_URL"
'''
[tasks.leanctx-gain]
description = "Show LeanCTX token-savings dashboard"
run = '''
set -euo pipefail
lean-ctx gain --deep || lean-ctx gain || true
'''
[tasks.leanctx-gain-json]
description = "Export LeanCTX token-savings metrics as JSON"
run = '''
set -euo pipefail
mkdir -p .pi/metrics
lean-ctx gain --json > .pi/metrics/leanctx-gain.json
echo ".pi/metrics/leanctx-gain.json"
'''
[tasks.doctor-leanctx]
description = "Check LeanCTX binary and Pi package wiring"
run = '''
#!/usr/bin/env bash
set -uo pipefail
if command -v lean-ctx >/dev/null 2>&1; then
printf 'ok lean-ctx\n'
lean-ctx --version
lean-ctx doctor || true
else
printf 'missing lean-ctx\n'
printf ' install: mise install\n'
exit 1
fi
'''
[tasks.index-codebase-memory]
description = "Index this repository into the Codebase Memory MCP knowledge graph"
run = '''
#!/usr/bin/env bash
set -euo pipefail
command -v codebase-memory-mcp >/dev/null 2>&1 || {
printf 'codebase-memory-mcp not installed.\n' >&2
printf 'install: https://github.com/DeusData/codebase-memory-mcp/releases\n' >&2
exit 1
}
repo_path="$(pwd)"
codebase-memory-mcp cli index_repository "{\"repo_path\": \"$repo_path\"}"
'''
[tasks.doctor-codex]
description = "Check Codex CLI availability and version"
run = '''
#!/usr/bin/env bash
set -uo pipefail
if command -v codex >/dev/null 2>&1; then
printf 'ok codex\n'
codex --version || true
else
printf 'missing codex\n'
printf ' install: mise install\n'
exit 1
fi
'''
[tasks.doctor-codebase-memory]
description = "Check Codebase Memory MCP binary availability"
run = '''
#!/usr/bin/env bash
set -uo pipefail
if command -v codebase-memory-mcp >/dev/null 2>&1; then
printf 'ok codebase-memory-mcp\n'
codebase-memory-mcp --version || true
else
printf 'optional codebase-memory-mcp (not installed; structural graph queries unavailable)\n'
printf ' install: https://github.com/DeusData/codebase-memory-mcp/releases\n'
fi
'''
[tasks.pi]
description = "Run Pi directly in the current repository"
run = "pi"
[tasks.pi-safe]
description = "Run Pi through Safehouse"
depends = ["doctor-safehouse"]
run = "safehouse pi"
[tasks.pi-story]
description = "Run Pi through Safehouse with SpecStory capture"
depends = ["doctor-safehouse", "doctor-specstory"]
run = "specstory run safehouse pi"
[tasks.pi-story-alt]
description = "Alternate wrapper order if SpecStory cannot capture nested Safehouse"
depends = ["doctor-safehouse", "doctor-specstory"]
run = "safehouse specstory run pi"
[tasks.groundcrew-pi]
description = "Run Groundcrew watch mode for ticket-dispatched agent sessions"
run = "crew run --watch"
[tasks.check]
description = "Validate scaffold files"
run = """
find . -maxdepth 6 \
-path './.git' -prune -o \
-path './.devbox' -prune -o \
-path './.pi' -prune -o \
-path './.agents' -prune -o \
-path './.specstory' -prune -o \
-type f -print | sort
"""
[tasks.test]
description = "Run repository tests"
run = "bash tests/context-profile.sh"
[tasks.test-e2e]
description = "Compare plain claude vs Pi+lean-ctx session (costs tokens; requires auth)"
run = "bash tests/e2e-compare.sh"
[tasks.audit-public]
description = "Scan committed content and history for public-repository leaks"
run = """
#!/usr/bin/env bash
set -euo pipefail
home_path_pattern='/'"Users/"'[^/]+/|/'"home/"'[^/]+/'
if git grep -n -I -E "$home_path_pattern" HEAD; then
echo "machine-specific home path found in committed content" >&2
exit 1
fi
gitleaks git --no-banner --redact .
"""