repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

fix win32 release readiness

62cf8ecb79276fde6fda61cba6debb1781eeb3db

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (24)

AGENTS.md

Modified
11 11 ### Tasks
13 -| Task | Command | Description |
14 -| ------------ | -------------------------------- | ------------------------------------ |
15 -| List | `mise run list` | List extensions |
16 -| Format | `mise run fmt` | Format repo |
17 -| Lint | `mise run lint` | Verify formatting and lint |
18 -| Test | `mise run test` | Run tests |
19 -| Check | `mise run check` | Static extension checks |
20 -| CI | `mise run ci` | Release gate (lint + test + check) |
21 -| Changelog | `mise run changelog -- {name}` | Generate changelog for extension |
22 -| README | `mise run readme -- {name}` | Generate/update README for extension |
23 -| Demo | `mise run demo -- {name}` | Record demo GIFs |
24 -| Publish | `mise run publish -- {name}` | Publish after release gate |
25 -| Goal pexpect | `mise run goal-pexpect [--idea]` | Run goal pexpect test |
13 +| Task | Command | Description |
14 +| ------------ | ------------------------------------ | ------------------------------------ |
15 +| List | `mise run list` | List extensions |
16 +| Format | `mise run fmt` | Format repo |
17 +| Lint | `mise run lint` | Verify formatting and lint |
18 +| Test | `mise run test` | Run tests |
19 +| Check | `mise run check` | Static extension checks |
20 +| CI | `mise run ci` | Release gate (lint + test + check) |
21 +| Changelog | `mise run changelog -- {name}` | Generate changelog for extension |
22 +| README | `mise run readme -- {name}` | Generate/update README for extension |
23 +| Demo | `mise run demo -- {name}` | Record demo GIFs |
24 +| Release plan | `mise run release-plan -- {name}` | Preview release artifacts |
25 +| Prepare | `mise run release-prepare -- {name}` | Generate release artifacts |
26 +| Publish | `mise run publish -- {name}` | Publish prepared release artifacts |
27 +| Goal pexpect | `mise run goal-pexpect [--idea]` | Run goal pexpect test |
27 29 ### Invariant
29 31 `mise run ci` must pass before pushing.
30 32 No exceptions.
34 +Use `mise run ...` for listed repo tasks.
35 +Do not bypass mise when a task exists.
32 37 ### Escalation
34 39 If the build system itself (`mise.toml`, scripts, or tooling) blocks progress,

extensions/devil/__tests__/harness.test.ts

Modified
1 +import { fileURLToPath } from "node:url";
1 2 import { afterEach, describe, expect, it } from "vitest";
2 3 import { createTestSession, type TestSession } from "../../../test/harness";
4 5 let t: TestSession | undefined;
6 7 function devilPath(): string {
7 - return new URL("../index.ts", import.meta.url).pathname;
8 + return fileURLToPath(new URL("../index.ts", import.meta.url));
10 11 afterEach(() => {

extensions/diff-review/__tests__/core.test.ts

Modified
6 6 import { parsePatchFiles } from "@pierre/diffs";
7 7 import { afterEach, describe, expect, it } from "vitest";
8 8 import { parseArgs } from "../args.js";
9 -import { collectDiff } from "../git.js";
9 +import { collectDiff, normalizeDiffHeaders } from "../git.js";
10 10 import { openBrowser } from "../open-browser.js";
12 12 const execFileAsync = promisify(execFile);
81 - it("normalizes quoted git paths into Pierre-parseable diff headers", async () => {
82 - const repo = await tempRepo();
83 - const path = "a\tb.txt";
84 - await writeFile(join(repo, path), "one\n");
85 - await git(repo, ["add", path]);
86 - await git(repo, ["commit", "-qm", "initial"]);
87 - await writeFile(join(repo, path), "two\n");
89 - const diff = await collectDiff(repo, parseArgs(""));
90 - const files = parsePatchFiles(diff.diffText, "quoted-path", true).flatMap(
81 + it("normalizes quoted git paths into Pierre-parseable diff headers", () => {
82 + const diff = normalizeDiffHeaders(
83 + [
84 + String.raw`diff --git "a/a\tb.txt" "b/a\tb.txt"`,
85 + String.raw`--- "a/a\tb.txt"`,
86 + String.raw`+++ "b/a\tb.txt"`,
87 + "@@ -1 +1 @@",
88 + "-one",
89 + "+two",
90 + "",
91 + ].join("\n"),
92 + );
93 + const files = parsePatchFiles(diff, "quoted-path", true).flatMap(
91 94 (patch) => patch.files,
94 - expect(diff.files[0]?.path).toBe(String.raw`a\tb.txt`);
95 97 expect(files[0]?.name).toBe(String.raw`a\tb.txt`);

extensions/diff-review/git.ts

Modified
228 228 return String(e.stderr ?? "").trim() || e.message || "git failed";
231 -function normalizeDiffHeaders(diffText: string): string {
231 +export function normalizeDiffHeaders(diffText: string): string {
232 232 return diffText
233 233 .split(/\r?\n/)
234 234 .map((line) => {

extensions/goal/__tests__/harness.test.ts

Modified
1 +import { fileURLToPath } from "node:url";
1 2 import { createAssistantMessageEventStream } from "@earendil-works/pi-ai";
2 3 import {
3 4 createTestSession,
25 26 function goalPath(): string {
26 - return new URL("../index.ts", import.meta.url).pathname;
27 + return fileURLToPath(new URL("../index.ts", import.meta.url));
29 30 function doneEvent(text: string) {

extensions/llmiterate/__tests__/core.test.ts

Modified
245 245 "C:\\Users\\me",
247 247 ).toBe("C:\\Users\\me\\AppData\\Local\\pi");
248 + expect(
249 + platformStateDir(
250 + "win32",
252 + XDG_STATE_HOME: "C:\\state",
253 + LOCALAPPDATA: "C:\\Users\\me\\AppData\\Local",
254 + },
255 + "C:\\Users\\me",
256 + ),
257 + ).toBe("C:\\state\\pi");
250 260 test("saves and loads state, invalid state falls back empty", () => {

extensions/llmiterate/__tests__/fake-rpc-child.mjs

Modified
6 6 let buffer = "";
8 8 process.stdin.setEncoding("utf8");
9 +process.stdin.on("end", () => process.exit(0));
10 +process.on("SIGTERM", () => process.exit(0));
11 +process.on("SIGINT", () => process.exit(0));
9 12 process.stdin.on("data", (chunk) => {
10 13 buffer += chunk;
11 14 const lines = buffer.split("\n");

extensions/llmiterate/__tests__/rpc.test.ts

Modified
1 -import { mkdtempSync, readFileSync, rmSync } from "node:fs";
1 +import { mkdtempSync, readFileSync } from "node:fs";
2 +import { rm } from "node:fs/promises";
2 3 import { tmpdir } from "node:os";
3 4 import { join } from "node:path";
5 +import { fileURLToPath } from "node:url";
4 6 import { afterEach, describe, expect, test } from "vitest";
5 7 import { LLMITERATE_WORKER_ENV, PiRpcWorker, workerArgs } from "../rpc";
6 8 import type { RpcEvent } from "../types";
8 10 const tempDirs: string[] = [];
9 11 const workers: PiRpcWorker[] = [];
10 -const fakeRpcScript = new URL("./fake-rpc-child.mjs", import.meta.url).pathname;
12 +const fakeRpcScript = fileURLToPath(
13 + new URL("./fake-rpc-child.mjs", import.meta.url),
14 +);
12 16 type FakeRpcMode = "ok" | "fail-new-session" | "malformed" | "env" | "hang";
14 -afterEach(() => {
15 - while (workers.length) workers.pop()?.dispose();
18 +afterEach(async () => {
19 + while (workers.length) await workers.pop()?.dispose();
16 20 for (const dir of tempDirs.splice(0))
17 - rmSync(dir, { recursive: true, force: true });
21 + await rm(dir, {
22 + recursive: true,
23 + force: true,
24 + maxRetries: 20,
25 + retryDelay: 50,
26 + });
20 29 describe("PiRpcWorker args", () => {

extensions/llmiterate/__tests__/watcher.test.ts

Modified
3 3 import {
4 4 mkdirSync,
5 5 mkdtempSync,
6 6 renameSync,
7 7 rmSync,
8 + utimesSync,
8 9 writeFileSync,
9 10 } from "node:fs";
10 11 import { tmpdir } from "node:os";
11 12 import { join } from "node:path";
12 13 import { afterEach, describe, expect, test } from "vitest";
13 -import { compilePathFilter, normalizeConfig } from "../core";
14 +import { compilePathFilter, normalizeConfig, toSlash } from "../core";
14 15 import { ProjectWatcher } from "../watcher";
16 17 const tempDirs: string[] = [];
58 59 return 1;
60 61 ).toBe(1);
61 - expect(seen.map((p) => p.replace(root, ""))).toEqual(["/src/a.ts"]);
62 + expect(seen.map((p) => toSlash(p.replace(root, "")))).toEqual([
63 + "/src/a.ts",
64 + ]);
64 67 test("default config starts filesystem watchers", async () => {
113 116 expect(total).toBe(2);
114 - expect(seen.map((p) => p.replace(root, ""))).toEqual(["/src/a.ts"]);
117 + expect(seen.map((p) => toSlash(p.replace(root, "")))).toEqual([
118 + "/src/a.ts",
119 + ]);
117 122 test("start watches dirs without queuing old files", async () => {
118 123 const root = tempDir();
119 124 mkdirSync(join(root, "src"));
120 - writeFileSync(join(root, "src", "old.ts"), "// llmiterate: old");
125 + const oldFile = join(root, "src", "old.ts");
126 + writeFileSync(oldFile, "// llmiterate: old");
127 + const future = new Date(Date.now() + 5000);
128 + utimesSync(oldFile, future, future);
121 129 const config = normalizeConfig({
122 130 include: ["src/**/*.ts"],
123 131 exclude: [],
238 246 writeFileSync(join(root, "src", "a.ts.tmp"), "// temp write");
239 247 renameSync(join(root, "src", "a.ts.tmp"), join(root, "src", "a.ts"));
241 - await eventually(() => seen.some((p) => p.endsWith("src/a.ts")));
249 + await eventually(() => seen.some((p) => toSlash(p).endsWith("src/a.ts")));
242 250 expect(seen.every((p) => !p.endsWith(".tmp"))).toBe(true);
334 342 return 1;
336 344 ).toBe(1);
337 - expect(seen.map((p) => p.replace(root, ""))).toEqual(["/src/ok.ts"]);
345 + expect(seen.map((p) => toSlash(p.replace(root, "")))).toEqual([
346 + "/src/ok.ts",
347 + ]);
339 349 seen.length = 0;
340 350 watcher.start();

extensions/llmiterate/index.ts

Modified
558 558 private stopWorker(): void {
559 - this.rpcWorker?.dispose();
559 + void this.rpcWorker?.dispose();
560 560 this.rpcWorker = undefined;
561 561 this.activeJob = false;
562 562 this.activeRunId = undefined;

extensions/llmiterate/path-filter.ts

Modified
28 28 ): string {
29 29 const paths = platform === "win32" ? path.win32 : path.posix;
31 + // Treat XDG_STATE_HOME as an explicit override for hermetic tests/CI,
32 + // even on platforms where it is not the native convention.
33 + if (env.XDG_STATE_HOME) return paths.join(env.XDG_STATE_HOME, APP_STATE_DIR);
31 34 if (platform === "win32") {
32 35 return paths.join(
33 36 env.LOCALAPPDATA ?? paths.join(home, "AppData", "Local"),
34 37 APP_STATE_DIR,
38 - if (env.XDG_STATE_HOME) return paths.join(env.XDG_STATE_HOME, APP_STATE_DIR);
39 40 if (platform === "darwin")
40 41 return paths.join(home, "Library", "Application Support", APP_STATE_DIR);
41 42 return paths.join(home, ".local", "state", APP_STATE_DIR);

extensions/llmiterate/rpc.ts

Modified
102 102 void this.command({ type: CMD_ABORT }).catch(() => {});
105 - dispose(): void {
105 + async dispose(): Promise<void> {
106 106 const proc = this.proc;
107 107 this.proc = undefined;
108 108 this.rejectAll(new Error("RPC worker disposed"));
109 109 if (!proc || proc.killed) return;
111 111 let exited = false;
112 - proc.once("exit", () => {
113 - exited = true;
112 + const closed = new Promise<void>((resolve) => {
113 + proc.once("close", () => {
114 + exited = true;
115 + resolve();
116 + });
118 + proc.stdin.end();
115 119 proc.kill("SIGTERM");
116 - setTimeout(() => {
120 + const killTimer = setTimeout(() => {
117 121 if (!exited) proc.kill("SIGKILL");
118 - }, RPC_KILL_GRACE_MS).unref?.();
122 + }, RPC_KILL_GRACE_MS);
123 + try {
124 + await closed;
125 + } finally {
126 + clearTimeout(killTimer);
121 130 private ensureStarted(): void {

extensions/llmiterate/watcher.ts

Modified
34 34 private readonly dirTimers = new Map<string, ReturnType<typeof setTimeout>>();
35 35 private readonly ignoreContexts = new Map<string, IgnoreContext>();
36 + private readonly scheduledFileMtimes = new Map<string, number>();
36 37 private watchLimitHit = false;
38 + private eventMtimeSinceMs: number | undefined;
38 40 public errorCount = 0;
71 73 this.dirTimers.clear();
72 74 this.watchers.clear();
73 75 this.ignoreContexts.clear();
76 + this.scheduledFileMtimes.clear();
77 + this.eventMtimeSinceMs = undefined;
76 80 scanAll(onFile: (absolutePath: string) => number): number {
141 145 return;
144 - if (stat.isFile()) this.scheduleFile(absPath);
148 + if (
149 + stat.isFile() &&
150 + this.isFreshEnough(absPath, {
151 + scheduleFiles: true,
152 + fileMtimeSinceMs: this.eventMtimeSinceMs,
153 + })
155 + this.scheduleFile(absPath);
147 158 private refreshDirectory(abs: string, options: RefreshOptions): void {
166 177 this.watchTree(child, options);
167 178 continue;
169 - if (
170 - entry.isFile() &&
171 - options.scheduleFiles &&
172 - !this.isIgnored(rel, false) &&
173 - shouldIncludeCompiledPath(rel, this.pathFilter) &&
174 - this.isFreshEnough(child, options)
175 - ) {
176 - this.scheduleFile(child);
180 + if (entry.isFile()) {
181 + if (
182 + this.isIgnored(rel, false) ||
183 + !shouldIncludeCompiledPath(rel, this.pathFilter)
185 + continue;
187 + if (!options.scheduleFiles) {
188 + this.recordFileMtime(rel, child);
189 + continue;
192 + if (this.isFreshEnough(child, options)) this.scheduleFile(child);
269 285 return;
287 + const mtimeMs = fileMtimeMs(absPath);
288 + const previousMtimeMs = this.scheduledFileMtimes.get(rel);
289 + if (
290 + mtimeMs !== undefined &&
291 + previousMtimeMs !== undefined &&
292 + mtimeMs <= previousMtimeMs
294 + return;
295 + if (mtimeMs !== undefined) this.scheduledFileMtimes.set(rel, mtimeMs);
271 297 const existing = this.fileTimers.get(rel);
272 298 if (existing) clearTimeout(existing);
273 299 this.fileTimers.set(
308 + private recordFileMtime(rel: string, absPath: string): void {
309 + const mtimeMs = fileMtimeMs(absPath);
310 + if (mtimeMs !== undefined) this.scheduledFileMtimes.set(rel, mtimeMs);
282 313 private walkFiles(dir: string, onFile: FileHandler): void {
283 314 this.loadIgnoreContext(dir);
419 +function fileMtimeMs(absPath: string): number | undefined {
420 + try {
421 + return fs.statSync(absPath).mtimeMs;
422 + } catch {
423 + return undefined;
388 427 function isSafeProjectRel(rel: string): boolean {
389 428 return Boolean(rel) && !rel.startsWith("..") && !path.isAbsolute(rel);

extensions/neko/__tests__/lifecycle.test.ts

Modified
10 10 expect,
12 12 } from "vitest";
13 +import nekoExtension from "../index.ts";
14 15 type Handler = (event: any, ctx: any) => unknown | Promise<unknown>;
15 16 type Timer = {
22 23 let agentDir = "";
23 24 let projectDir = "";
24 -let nekoExtension: (pi: any) => void;
25 +let originalAgentDir: string | undefined;
26 27 const originalSetTimeout = globalThis.setTimeout;
27 28 const originalClearTimeout = globalThis.clearTimeout;
130 -beforeAll(async () => {
131 +beforeAll(() => {
131 132 agentDir = mkdtempSync(join(tmpdir(), "neko-agent-"));
132 133 projectDir = mkdtempSync(join(tmpdir(), "neko-project-"));
134 + originalAgentDir = process.env.PI_CODING_AGENT_DIR;
133 135 process.env.PI_CODING_AGENT_DIR = agentDir;
134 - nekoExtension = (await import("../index.ts")).default;
137 138 beforeEach(() => {
146 147 afterAll(() => {
148 + if (originalAgentDir === undefined) delete process.env.PI_CODING_AGENT_DIR;
149 + else process.env.PI_CODING_AGENT_DIR = originalAgentDir;
147 150 rmSync(agentDir, { recursive: true, force: true });
148 151 rmSync(projectDir, { recursive: true, force: true });

extensions/nu-bang/__tests__/real-world.test.ts

Modified
15 15 createNuBashOperations,
16 16 executeNu,
17 17 nuCompletions,
18 + parseCompletionsOutput,
18 19 wrapNuAutocompleteProvider,
19 20 } from "../index.js";
21 22 let dir = "";
23 +const supportsControlCharPaths = process.platform !== "win32";
24 +const directoryCompletion =
25 + process.platform === "win32" ? "`my dir`" : "`my dir/`";
23 27 async function seedFiles(): Promise<void> {
24 28 await writeFile(
77 81 afterEach(async () => {
78 - await rm(dir, { recursive: true, force: true });
82 + await rm(dir, {
83 + recursive: true,
84 + force: true,
85 + maxRetries: 20,
86 + retryDelay: 50,
87 + });
81 90 describe("nu-bang real-world execution", () => {
234 243 test("streams output through bash operations before command exit", async () => {
235 244 const controller = new AbortController();
236 245 const operations = createNuBashOperations(
237 - '^bash -lc "echo first; sleep 5; echo second"',
246 + '^bash -lc "echo first; sleep 30; echo second"',
239 248 let done = false;
240 249 let seen = "";
241 250 let resolveFirst: () => void = () => {};
251 + let timeoutTimer: ReturnType<typeof setTimeout> | undefined;
242 252 const firstChunk = new Promise<void>((resolve) => {
243 253 resolveFirst = resolve;
245 - const timeout = new Promise<never>((_, reject) =>
246 - setTimeout(
255 + const timeout = new Promise<never>((_, reject) => {
256 + timeoutTimer = setTimeout(
247 257 () => reject(new Error("timed out waiting for streamed output")),
248 - 2500,
249 - ),
250 - );
258 + 10_000,
259 + );
260 + });
252 262 const exec = operations
253 263 .exec("ignored", dir, {
261 271 done = true;
264 - await Promise.race([firstChunk, timeout]);
274 + try {
275 + await Promise.race([firstChunk, timeout]);
276 + } finally {
277 + if (timeoutTimer) clearTimeout(timeoutTimer);
265 279 expect(seen).toContain("first");
266 280 expect(done).toBe(false);
395 409 expect(missingResult.output).toContain("missing-\\u001b[31mred");
396 410 expect(missingResult.output).not.toContain("\u001b");
398 - const unsafeFile = join(dir, "file-\u001b[32mgreen");
399 - await writeFile(unsafeFile, "not a directory", "utf8");
400 - const fileResult = await executeNu("pwd", unsafeFile);
401 - expect(fileResult.output).toContain("Working directory is not a directory");
402 - expect(fileResult.output).toContain("file-\\u001b[32mgreen");
403 - expect(fileResult.output).not.toContain("\u001b");
412 + if (supportsControlCharPaths) {
413 + const unsafeFile = join(dir, "file-\u001b[32mgreen");
414 + await writeFile(unsafeFile, "not a directory", "utf8");
415 + const fileResult = await executeNu("pwd", unsafeFile);
416 + expect(fileResult.output).toContain(
417 + "Working directory is not a directory",
418 + );
419 + expect(fileResult.output).toContain("file-\\u001b[32mgreen");
420 + expect(fileResult.output).not.toContain("\u001b");
406 424 test("does not leave pi-nu-bang temp dirs after execution", async () => {
424 442 const fullOutputStat = await stat(result.fullOutputPath);
425 - expect(fullOutputStat.mode & 0o777).toBe(0o600);
443 + if (process.platform !== "win32")
444 + expect(fullOutputStat.mode & 0o777).toBe(0o600);
426 445 const fullOutput = await readFile(result.fullOutputPath, "utf8");
427 446 expect(fullOutput).toContain("line-1");
428 447 expect(fullOutput).toContain("line-2500");
446 465 expect(completions).toContain("logs.csv");
449 - test("does not expose terminal controls in path completions", async () => {
450 - await writeFile(
451 - join(dir, "unsafe-\u001b[31mred\u0007.txt"),
452 - "unsafe",
453 - "utf8",
454 - );
456 - const completions = await nuCompletions("open unsafe-", 12, dir);
457 - const unsafeCompletion = completions.find((completion) =>
458 - completion.includes("unsafe-"),
459 - );
461 - expect(typeof unsafeCompletion).toBe("string");
462 - expect(unsafeCompletion).toContain("unsafe-\\u001b[31mred\\u0007.txt");
463 - expect(unsafeCompletion).not.toContain("\u001b");
464 - expect(unsafeCompletion).not.toContain("\u0007");
468 + test("escapes terminal controls in parsed completion output", () => {
469 + expect(
470 + parseCompletionsOutput(
471 + JSON.stringify({
472 + completions: [
473 + "unsafe-\u001b[31mred\u0007.txt",
474 + "c1-\u009b31mred.txt",
475 + ],
476 + }),
477 + ),
478 + ).toEqual(["unsafe-\\u001b[31mred\\u0007.txt", "c1-\\u009b31mred.txt"]);
481 + test.skipIf(!supportsControlCharPaths)(
482 + "does not expose terminal controls in path completions",
483 + async () => {
484 + await writeFile(
485 + join(dir, "unsafe-\u001b[31mred\u0007.txt"),
486 + "unsafe",
487 + "utf8",
488 + );
490 + const completions = await nuCompletions("open unsafe-", 12, dir);
491 + const unsafeCompletion = completions.find((completion) =>
492 + completion.includes("unsafe-"),
493 + );
495 + expect(typeof unsafeCompletion).toBe("string");
496 + expect(unsafeCompletion).toContain("unsafe-\\u001b[31mred\\u0007.txt");
497 + expect(unsafeCompletion).not.toContain("\u001b");
498 + expect(unsafeCompletion).not.toContain("\u0007");
499 + },
500 + );
467 502 test("filters escaped-space path suggestions to the typed prefix", async () => {
468 503 const provider = wrapNuAutocompleteProvider(
486 521 expect(broadSuggestions?.prefix).toBe("my\\ ");
487 522 expect(broadSuggestions?.items.map((item) => item.value)).toEqual([
488 - "`my dir/`",
523 + directoryCompletion,
489 524 "`my file.txt`",
507 542 expect(directorySuggestions?.prefix).toBe("my\\ d");
508 543 expect(directorySuggestions?.items.map((item) => item.value)).toEqual([
509 - "`my dir/`",
544 + directoryCompletion,
600 + test("reports file completion working directory clearly", async () => {
601 + const fileCwd = join(dir, "not-a-directory.txt");
602 + await writeFile(fileCwd, "not a directory", "utf8");
604 + await expect(nuCompletions("open ", 5, fileCwd)).rejects.toThrow(
605 + `Working directory is not a directory: ${fileCwd}`,
606 + );
607 + });
565 609 test("escapes controls in completion working directory errors", async () => {
566 610 const unsafeMissing = join(dir, "missing-\u001b]0;title\u0007-cwd");
575 619 expect(message).not.toContain("\u0007");
622 + if (!supportsControlCharPaths) return;
578 624 const unsafeFile = join(dir, "file-\u001b[33myellow");
579 625 await writeFile(unsafeFile, "not a directory", "utf8");
606 - test("reports inaccessible working directories clearly", async () => {
607 - const unsafeDir = join(dir, "deny-\u001b[35msecret");
608 - await mkdir(unsafeDir);
609 - await chmod(unsafeDir, 0o000);
611 - try {
612 - const result = await executeNu("pwd", unsafeDir);
613 - expect(result.output).toContain("Working directory is not accessible");
614 - expect(result.output).toContain("deny-\\u001b[35msecret");
615 - expect(result.output).not.toContain("posix_spawn");
616 - expect(result.output).not.toContain("spawn nu");
617 - expect(result.output).not.toContain("\u001b");
652 + test.skipIf(process.platform === "win32")(
653 + "reports inaccessible working directories clearly",
654 + async () => {
655 + const unsafeDir = join(dir, "deny-\u001b[35msecret");
656 + await mkdir(unsafeDir);
657 + await chmod(unsafeDir, 0o000);
620 - await nuCompletions("open ", 5, unsafeDir);
621 - throw new Error("expected nuCompletions to reject");
622 - } catch (error) {
623 - const message = error instanceof Error ? error.message : String(error);
624 - expect(message).toContain("Working directory is not accessible");
625 - expect(message).toContain("deny-\\u001b[35msecret");
626 - expect(message).not.toContain("posix_spawn");
627 - expect(message).not.toContain("spawn nu");
628 - expect(message).not.toContain("\u001b");
660 + const result = await executeNu("pwd", unsafeDir);
661 + expect(result.output).toContain("Working directory is not accessible");
662 + expect(result.output).toContain("deny-\\u001b[35msecret");
663 + expect(result.output).not.toContain("posix_spawn");
664 + expect(result.output).not.toContain("spawn nu");
665 + expect(result.output).not.toContain("\u001b");
667 + try {
668 + await nuCompletions("open ", 5, unsafeDir);
669 + throw new Error("expected nuCompletions to reject");
670 + } catch (error) {
671 + const message =
672 + error instanceof Error ? error.message : String(error);
673 + expect(message).toContain("Working directory is not accessible");
674 + expect(message).toContain("deny-\\u001b[35msecret");
675 + expect(message).not.toContain("posix_spawn");
676 + expect(message).not.toContain("spawn nu");
677 + expect(message).not.toContain("\u001b");
679 + } finally {
680 + await chmod(unsafeDir, 0o700).catch(() => {});
630 - } finally {
631 - await chmod(unsafeDir, 0o700).catch(() => {});
632 - }
633 - });
682 + },
683 + );
635 685 test("completion temp dirs are cleaned", async () => {
636 686 const before = tmpBangDirs();

extensions/pulse/__tests__/index.test.ts

Modified
29 29 let tmp = "";
30 +const supportsControlCharPaths = process.platform !== "win32";
31 32 function cwd(): string {
32 33 tmp = fs.mkdtempSync(path.join(os.tmpdir(), "pulse-index-"));
200 201 it("does not expose terminal controls in completions", () => {
201 202 const root = cwd();
202 - write(root, "bad\u001b[31m.md", "doc");
203 + if (supportsControlCharPaths) write(root, "bad\u001b[31m.md", "doc");
203 204 writeConfig(root, { documents: [{ path: "bad\u001b[31m.md" }] });
204 205 const h = harness(root);
206 - const add = h.commands.get("pulse").getArgumentCompletions("add ") ?? [];
207 - expect(add.some((item: any) => String(item.value).includes("\u001b"))).toBe(
208 - false,
209 - );
210 - expect(add.some((item: any) => String(item.label).includes("\u001b"))).toBe(
211 - false,
212 - );
207 + if (supportsControlCharPaths) {
208 + const add = h.commands.get("pulse").getArgumentCompletions("add ") ?? [];
209 + expect(
210 + add.some((item: any) => String(item.value).includes("\u001b")),
211 + ).toBe(false);
212 + expect(
213 + add.some((item: any) => String(item.label).includes("\u001b")),
214 + ).toBe(false);
214 217 const remove =
215 218 h.commands.get("pulse").getArgumentCompletions("remove bad") ?? [];

extensions/pulse/index.ts

Modified
665 665 setStatus(ctx);
666 666 }, CONFIG_WATCHER_DEBOUNCE_MS);
668 + state.configWatcher.on("error", () => {
669 + state.configWatcher?.close();
670 + state.configWatcher = null;
671 + state.configWatcherCwd = "";
672 + });
668 673 } catch {}

extensions/web/__tests__/web-fetch-contract.test.ts

Modified
146 146 expect(
147 147 platformStateDir("linux", { XDG_STATE_HOME: "/state" }, "/home/me"),
148 148 ).toBe("/state/pi");
149 + expect(
150 + platformStateDir(
151 + "win32",
153 + XDG_STATE_HOME: "C:\\state",
154 + LOCALAPPDATA: "C:\\Users\\me\\AppData\\Local",
155 + },
156 + "C:\\Users\\me",
157 + ),
158 + ).toBe("C:\\state\\pi");
149 159 expect(
150 160 projectStoreDir("web", "/work/project", {
151 161 platform: "linux",

extensions/web/store.ts

Modified
22 22 home = homedir(),
23 23 ): string {
24 24 const paths = platform === "win32" ? path.win32 : path.posix;
25 + // Treat XDG_STATE_HOME as an explicit override for hermetic tests/CI,
26 + // even on platforms where it is not the native convention.
27 + if (env.XDG_STATE_HOME) return paths.join(env.XDG_STATE_HOME, "pi");
25 28 if (platform === "win32")
26 29 return paths.join(
27 30 env.LOCALAPPDATA ?? paths.join(home, "AppData", "Local"),
28 31 "pi",
30 - if (env.XDG_STATE_HOME) return paths.join(env.XDG_STATE_HOME, "pi");
31 33 if (platform === "darwin")
32 34 return paths.join(home, "Library", "Application Support", "pi");
33 35 return paths.join(home, ".local", "state", "pi");
38 40 cwd: string,
39 41 options: StateDirOptions = {},
40 42 ): string {
41 - return path.join(
43 + const paths = pathModule(options.platform);
44 + return paths.join(
42 45 platformStateDir(options.platform, options.env, options.home),
43 46 namespace,
44 47 hash(cwd),
52 55 options: StateDirOptions = {},
53 56 ): Promise<SavedJsonResult> {
54 57 const responseId = randomUUID();
55 - const dir = path.join(projectStoreDir(namespace, cwd, options), "results");
58 + const paths = pathModule(options.platform);
59 + const dir = paths.join(projectStoreDir(namespace, cwd, options), "results");
56 60 await mkdir(dir, { recursive: true, mode: 0o700 });
57 - const fullOutputPath = path.join(dir, `${responseId}.json`);
61 + const fullOutputPath = paths.join(dir, `${responseId}.json`);
58 62 const body = `${JSON.stringify(value, null, 2)}\n`;
59 63 await writeFile(fullOutputPath, body, { mode: 0o600 });
60 64 return {
72 +function pathModule(platform: NodeJS.Platform = process.platform) {
73 + return platform === "win32" ? path.win32 : path.posix;
68 76 function hash(input: string): string {
69 77 return createHash("sha256").update(input).digest("hex");

mise.toml

Modified
6 6 markdownlint-cli2 = "0.22.1"
7 7 "aqua:nushell/nushell" = "0.112.2"
9 +[settings]
10 +unix_default_inline_shell_args = "nu -c"
11 +windows_default_inline_shell_args = "nu -c"
9 13 [tasks.default]
10 14 description = "List tasks"
11 15 run = "mise tasks ls"
17 +[tasks.install]
18 +description = "Install Node dependencies"
19 +run = "npm ci"
20 +sources = ["package.json", "package-lock.json"]
21 +outputs = ["node_modules/vitest/package.json"]
13 23 [tasks.fmt]
14 24 description = "Format repo"
25 +depends = ["install"]
15 26 run = [
16 27 "npm run fmt",
17 28 "dprint fmt",
20 31 [tasks.lint]
21 32 description = "Verify formatting and lint"
33 +depends = ["install"]
22 34 run = [
23 35 "npm run lint",
24 36 "dprint check",
28 40 [tasks.test]
29 41 description = "Run tests"
30 -run = "npm run test"
42 +depends = ["install"]
43 +usage = '''
44 +arg "[args]" var=#true
45 +'''
46 +run = '''
47 +npm run test --{% for arg in usage.args %} "{{ arg }}"{% endfor %}
48 +'''
32 50 [tasks.check]
33 51 description = "Static extension checks"
40 58 [tasks.list]
41 59 description = "List extensions"
42 -run = "python3 scripts/extensions.py list \"$@\""
60 +usage = '''
61 +arg "[extensions]" var=#true
62 +'''
63 +run = '''
64 +python3 scripts/extensions.py list{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
65 +'''
44 67 [tasks.changelog]
45 68 description = "Generate changelog"
46 -run = "python3 scripts/extensions.py changelog \"$@\""
69 +usage = '''
70 +arg "<extensions>" var=#true
71 +'''
72 +run = '''
73 +python3 scripts/extensions.py changelog{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
74 +'''
48 76 [tasks.readme]
49 77 description = "Generate/update READMEs"
50 -run = "python3 scripts/extensions.py readme --write \"$@\""
78 +usage = '''
79 +arg "[extensions]" var=#true
80 +flag "--model <model>"
81 +'''
82 +run = '''
83 +python3 scripts/extensions.py readme --write{% if usage.model %} --model "{{ usage.model }}"{% endif %}{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
84 +'''
52 86 [tasks.demo]
53 87 description = "Record demo GIFs"
54 -run = "python3 scripts/demo.py \"$@\""
88 +usage = '''
89 +arg "[drivers]" var=#true
90 +'''
91 +run = '''
92 +python3 scripts/demo.py{% for driver in usage.drivers %} "{{ driver }}"{% endfor %}
93 +'''
95 +[tasks.release-plan]
96 +description = "Preview release artifacts"
97 +usage = '''
98 +arg "[extensions]" var=#true
99 +flag "--model <model>"
100 +'''
101 +run = '''
102 +python3 scripts/extensions.py release-plan{% if usage.model %} --model "{{ usage.model }}"{% endif %}{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
103 +'''
105 +[tasks.release-prepare]
106 +description = "Generate release artifacts"
107 +usage = '''
108 +arg "[extensions]" var=#true
109 +flag "--model <model>"
110 +flag "--skip-demo"
111 +'''
112 +run = '''
113 +python3 scripts/extensions.py release-prepare{% if usage.model %} --model "{{ usage.model }}"{% endif %}{% if usage.skip_demo %} --skip-demo{% endif %}{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
114 +'''
56 116 [tasks.clean]
57 117 description = "Remove generated caches and scratch artifacts"
66 126 [tasks.publish]
67 -description = "Publish after release gate"
68 -depends = ["ci"]
69 -run = "PI_EXT_CI_DONE=1 python3 scripts/extensions.py publish \"$@\""
127 +description = "Publish prepared release artifacts"
128 +usage = '''
129 +arg "[extensions]" var=#true
130 +'''
131 +run = '''
132 +python3 scripts/extensions.py publish{% for extension in usage.extensions %} "{{ extension }}"{% endfor %}
133 +'''
71 135 [tasks.pre-commit]
72 136 description = "Pre-commit hook: fmt + lint + test"
79 143 [tasks.goal-pexpect]
80 144 description = "Run goal pexpect test"
81 -run = "python3 -c 'import subprocess, sys; args = sys.argv[1:]; subprocess.run([\"python3\", \"scripts/test_goal_pexpect.py\", *(([\"--idea\", args[0], *args[1:]]) if args and not args[0].startswith(\"-\") else args)], check=True)'"
145 +usage = '''
146 +arg "[idea_number]"
147 +flag "--idea <idea>"
148 +flag "--objective <objective>"
149 +flag "--llm-wait <llm_wait>"
150 +flag "--list-ideas"
151 +'''
152 +run = '''
153 +python3 scripts/test_goal_pexpect.py{% if usage.idea_number %} "{{ usage.idea_number }}"{% endif %}{% if usage.idea %} --idea "{{ usage.idea }}"{% endif %}{% if usage.objective %} --objective "{{ usage.objective }}"{% endif %}{% if usage.llm_wait %} --llm-wait "{{ usage.llm_wait }}"{% endif %}{% if usage.list_ideas %} --list-ideas{% endif %}
154 +'''

package.json

Modified
13 13 "test:watch": "vitest",
14 14 "test:brainstorming": "node --test skills/super/brainstorming/scripts/companion.test.mjs",
15 15 "typecheck": "tsc --noEmit",
16 - "check": "python3 scripts/check_skills.py && python3 scripts/extensions.py check",
17 - "ci": "npm run lint && npm run test && npm run check"
16 + "check": "python3 scripts/check_skills.py && python3 scripts/extensions.py check"
19 18 "devDependencies": {
20 19 "@playwright/test": "^1.60.0",

scripts/extensions.py

Modified
6 6 import argparse
7 7 import importlib.util
8 8 import json
9 -import os
10 9 import re
10 +import shutil
11 11 import subprocess
12 12 import sys
13 13 import tempfile
14 +import textwrap
14 15 import time
15 16 from pathlib import Path
16 17 from types import ModuleType
373 374 def pi_generate(prompt: str, model: str | None = None, label: str = "agent") -> str:
375 + pi_bin = shutil.which("pi") or shutil.which("pi.cmd")
376 + if not pi_bin:
377 + raise RuntimeError("pi executable not found on PATH")
374 379 cmd = [
375 - "pi",
380 + pi_bin,
376 381 "--no-session",
377 382 "--no-tools",
378 383 "--no-extensions",
384 389 if model:
385 390 cmd.extend(["--model", model])
386 - cmd.append(prompt)
388 392 with (
393 + tempfile.TemporaryDirectory(prefix="pi-ext-prompt-") as prompt_dir,
389 394 tempfile.TemporaryFile("w+", encoding="utf-8") as out,
390 395 tempfile.TemporaryFile("w+", encoding="utf-8") as err_out,
392 - proc = subprocess.Popen(cmd, cwd=ROOT, text=True, stdout=out, stderr=err_out)
397 + prompt_path = Path(prompt_dir) / "prompt.md"
398 + prompt_path.write_text(prompt, encoding="utf-8")
399 + proc = subprocess.Popen(
400 + [*cmd, f"@{prompt_path}"],
401 + cwd=ROOT,
402 + text=True,
403 + stdout=out,
404 + stderr=err_out,
393 406 frames = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
394 407 start = time.monotonic()
461 474 return out.rstrip() + "\n"
477 +def wrap_generated_markdown(text: str, width: int = 80) -> str:
478 + lines: list[str] = []
479 + in_fence = False
480 + for raw_line in text.replace("\r\n", "\n").replace("\r", "\n").split("\n"):
481 + line = raw_line.rstrip()
482 + stripped = line.lstrip()
483 + if stripped.startswith("```") or stripped.startswith("~~~"):
484 + in_fence = not in_fence
485 + lines.append(line)
486 + continue
487 + if in_fence or not line or stripped.startswith(("#", "<!--", "![")) or "|" in line:
488 + lines.append(line)
489 + continue
491 + bullet = re.match(r"^(\s*[-*]\s+)(.+)$", line)
492 + if bullet:
493 + prefix, body = bullet.groups()
494 + lines.extend(
495 + textwrap.wrap(
496 + body,
497 + width=width,
498 + initial_indent=prefix,
499 + subsequent_indent=" " * len(prefix),
500 + break_long_words=False,
501 + break_on_hyphens=False,
504 + continue
506 + numbered = re.match(r"^(\s*\d+[.)]\s+)(.+)$", line)
507 + if numbered:
508 + prefix, body = numbered.groups()
509 + lines.extend(
510 + textwrap.wrap(
511 + body,
512 + width=width,
513 + initial_indent=prefix,
514 + subsequent_indent=" " * len(prefix),
515 + break_long_words=False,
516 + break_on_hyphens=False,
519 + continue
521 + if line.startswith(" "):
522 + lines.append(line)
523 + continue
525 + lines.extend(
526 + textwrap.wrap(
527 + line,
528 + width=width,
529 + break_long_words=False,
530 + break_on_hyphens=False,
533 + return "\n".join(lines).rstrip() + "\n"
536 +def write_repo_text(path: Path, text: str) -> None:
537 + path.write_text(wrap_generated_markdown(text), encoding="utf-8", newline="\n")
464 540 def update_changelog(ext: Path, model: str | None = None) -> str:
465 541 path = ext / "CHANGELOG.md"
466 542 entry = generate_changelog_entry(ext, model)
467 543 heading = f"## {root_version()}"
468 544 if not path.exists():
469 - path.write_text(f"# Changelog\n\n{entry}")
545 + write_repo_text(path, f"# Changelog\n\n{entry}")
470 546 print(f"OK changelog {ext.name}")
471 547 return entry
477 553 end = next(
478 554 (i for i in range(start + 1, len(lines)) if lines[i].startswith("## ")), len(lines)
480 - path.write_text("".join(lines[:start]) + entry + "\n" + "".join(lines[end:]).lstrip("\n"))
556 + write_repo_text(
557 + path,
558 + "".join(lines[:start]) + entry + "\n" + "".join(lines[end:]).lstrip("\n"),
481 560 elif text.startswith("# Changelog"):
482 561 _, rest = text.split("\n", 1)
483 - path.write_text("# Changelog\n\n" + entry + "\n" + rest.lstrip("\n"))
562 + write_repo_text(path, "# Changelog\n\n" + entry + "\n" + rest.lstrip("\n"))
485 - path.write_text(f"# Changelog\n\n{entry}\n{text}")
564 + write_repo_text(path, f"# Changelog\n\n{entry}\n{text}")
486 565 print(f"OK changelog {ext.name}")
487 566 return entry
525 604 path = ROOT / "CHANGELOG.md"
526 605 heading = f"## {root_version()}"
527 606 if not path.exists():
528 - path.write_text(f"# Changelog\n\n{entry}")
607 + write_repo_text(path, f"# Changelog\n\n{entry}")
529 608 print("OK changelog root")
530 609 return entry
531 610 text = path.read_text()
535 614 end = next(
536 615 (i for i in range(start + 1, len(lines)) if lines[i].startswith("## ")), len(lines)
538 - path.write_text("".join(lines[:start]) + entry + "\n" + "".join(lines[end:]).lstrip("\n"))
617 + write_repo_text(
618 + path,
619 + "".join(lines[:start]) + entry + "\n" + "".join(lines[end:]).lstrip("\n"),
539 621 elif text.startswith("# Changelog"):
540 622 _, rest = text.split("\n", 1)
541 - path.write_text("# Changelog\n\n" + entry + "\n" + rest.lstrip("\n"))
623 + write_repo_text(path, "# Changelog\n\n" + entry + "\n" + rest.lstrip("\n"))
543 - path.write_text(f"# Changelog\n\n{entry}\n{text}")
625 + write_repo_text(path, f"# Changelog\n\n{entry}\n{text}")
544 626 print("OK changelog root")
545 627 return entry
586 668 def update_readme(model: str | None = None) -> str:
587 669 text = generate_readme(model)
588 - (ROOT / "README.md").write_text(text)
670 + write_repo_text(ROOT / "README.md", text)
589 671 print("OK README.md")
590 672 return text
635 717 def update_ext_readme(ext: Path, model: str | None = None) -> str:
636 718 text = generate_ext_readme(ext, model)
637 - (ext / "README.md").write_text(text)
719 + write_repo_text(ext / "README.md", text)
638 720 print(f"OK README {ext.name}")
639 721 return text
869 +def release_tag() -> str:
870 + return f"v{root_version()}"
873 +def tag_exists(tag: str) -> bool:
874 + return git("rev-parse", "--verify", "--quiet", f"refs/tags/{tag}", check=False).returncode == 0
787 877 def create_tag() -> str:
788 - tag = f"v{root_version()}"
789 - exists = (
790 - git("rev-parse", "--verify", "--quiet", f"refs/tags/{tag}", check=False).returncode == 0
878 + tag = release_tag()
879 + exists = tag_exists(tag)
792 880 if exists:
793 881 print(f"OK tag {tag} exists")
802 890 return tag
805 -def commit_release(paths_to_add: list[Path]) -> None:
893 +def commit_release(paths_to_add: list[Path]) -> bool:
806 894 assert_only_release_changes(paths_to_add)
807 895 if use_jj():
808 896 if jj("diff", "--quiet", check=False).returncode == 0:
809 897 print("OK commit none")
810 - return
898 + return False
811 899 jj("commit", "-m", f"release: v{root_version()}")
812 900 bookmark = release_bookmark()
813 901 jj("bookmark", "set", bookmark, "-r", "@-")
814 902 print(f"OK commit v{root_version()} ({bookmark})")
815 - return
903 + return True
817 905 paths = sorted({str(path.relative_to(ROOT)) for path in paths_to_add if path.exists()})
818 906 git("add", *paths)
819 907 if git("diff", "--cached", "--quiet", "--", *paths, check=False).returncode == 0:
820 908 print("OK commit none")
821 - return
909 + return False
822 910 git("commit", "-m", f"release: v{root_version()}", "--", *paths)
823 911 print(f"OK commit v{root_version()}")
912 + return True
826 915 def push_release(tag: str) -> None:
904 993 return 0
907 -def ensure_ci() -> None:
908 - if os.environ.get("PI_EXT_CI_DONE") == "1":
909 - return
910 - subprocess.run(["mise", "run", "ci"], cwd=ROOT, check=True)
911 - os.environ["PI_EXT_CI_DONE"] = "1"
914 -def cmd_publish(
915 - selected: list[str], *, dry_run: bool, model: str | None, skip_demo: bool, no_push: bool
916 -) -> int:
917 - ensure_ci()
918 - dirs = ext_dirs(selected)
920 - if dry_run:
921 - demos = demos_to_update(installed_drivers_for(dirs))
922 - print("DRY RUN publish")
923 - print(f"version: v{root_version()}")
924 - print("demos: " + (", ".join(name for name, _targets in demos) if demos else "none"))
925 - print("README:")
926 - print(generate_readme(model).rstrip())
927 - print("repo changelog:")
928 - print(generate_repo_changelog_entry(dirs, model).rstrip())
929 - for ext in dirs:
930 - print(generate_changelog_entry(ext, model).rstrip())
931 - print("skip commit/tag/push")
932 - return 0
934 - demo_paths = [] if skip_demo else update_demos(dirs)
935 - update_all_readmes(dirs, model)
936 - update_repo_changelog(dirs, model)
937 - for ext in dirs:
938 - update_changelog(ext, model)
940 - commit_release(
941 - dirs
942 - + demo_paths
943 - + [
996 +def release_paths(dirs: list[Path]) -> list[Path]:
997 + demo_dirs = [
998 + EXT_ROOT / target for _driver, targets in installed_drivers_for(dirs) for target in targets
1000 + return sorted(
1002 + *dirs,
1003 + *demo_dirs,
944 1004 ROOT / "README.md",
945 1005 ROOT / "CHANGELOG.md",
946 1006 ROOT / "package.json",
947 1007 ROOT / "package-lock.json",
1012 +def release_markdown_paths(dirs: list[Path]) -> list[Path]:
1013 + paths = [ROOT / "README.md", ROOT / "CHANGELOG.md"]
1014 + for ext in dirs:
1015 + paths.extend([ext / "README.md", ext / "CHANGELOG.md"])
1016 + return [path for path in paths if path.exists()]
1019 +def format_release_artifacts(dirs: list[Path]) -> None:
1020 + dprint = shutil.which("dprint") or shutil.which("dprint.cmd")
1021 + if not dprint:
1022 + raise SystemExit("dprint not found; cannot format release artifacts")
1023 + paths = [str(path.relative_to(ROOT)) for path in release_markdown_paths(dirs)]
1024 + if paths:
1025 + subprocess.run([dprint, "fmt", *paths], cwd=ROOT, check=True)
1028 +def cmd_release_plan(selected: list[str], model: str | None) -> int:
1029 + dirs = ext_dirs(selected)
1030 + demos = demos_to_update(installed_drivers_for(dirs))
1031 + print("RELEASE PLAN")
1032 + print(f"version: v{root_version()}")
1033 + print("demos: " + (", ".join(name for name, _targets in demos) if demos else "none"))
1034 + print("README:")
1035 + print(generate_readme(model).rstrip())
1036 + print("repo changelog:")
1037 + print(generate_repo_changelog_entry(dirs, model).rstrip())
1038 + for ext in dirs:
1039 + print(generate_changelog_entry(ext, model).rstrip())
1040 + print("skip write/commit/tag/push")
1041 + return 0
1044 +def cmd_release_prepare(selected: list[str], model: str | None, skip_demo: bool) -> int:
1045 + dirs = ext_dirs(selected)
1046 + if not skip_demo:
1047 + update_demos(dirs)
1048 + update_all_readmes(dirs, model)
1049 + update_repo_changelog(dirs, model)
1050 + for ext in dirs:
1051 + update_changelog(ext, model)
1052 + format_release_artifacts(dirs)
1053 + print(f"OK release prepared v{root_version()}")
1054 + return 0
1057 +def cmd_publish(selected: list[str]) -> int:
1058 + dirs = ext_dirs(selected)
1059 + tag = release_tag()
1060 + committed = commit_release(release_paths(dirs))
1061 + if not committed and not tag_exists(tag):
1062 + raise SystemExit(
1063 + "no prepared release changes to publish; run mise run release-prepare first"
950 1065 tag = create_tag()
951 - if no_push:
952 - print("OK push skipped")
953 - else:
954 - push_release(tag)
1066 + push_release(tag)
955 1067 return 0
974 1086 readme_p.add_argument("--write", action="store_true")
975 1087 demo_p = sub.add_parser("demo")
976 1088 demo_p.add_argument("drivers", nargs="*")
1089 + release_plan_p = sub.add_parser("release-plan")
1090 + release_plan_p.add_argument("extensions", nargs="*")
1091 + release_plan_p.add_argument("--model")
1092 + release_prepare_p = sub.add_parser("release-prepare")
1093 + release_prepare_p.add_argument("extensions", nargs="*")
1094 + release_prepare_p.add_argument("--model")
1095 + release_prepare_p.add_argument("--skip-demo", action="store_true")
977 1096 publish_p = sub.add_parser("publish")
978 1097 publish_p.add_argument("extensions", nargs="*")
979 - publish_p.add_argument("--dry-run", action="store_true")
980 - publish_p.add_argument("--model")
981 - publish_p.add_argument("--skip-demo", action="store_true")
982 - publish_p.add_argument("--no-push", action="store_true")
983 1098 args = parser.parse_args()
985 1100 if args.command == "list":
994 1109 return cmd_readme(args.extensions, args.model, args.write)
995 1110 if args.command == "demo":
996 1111 return cmd_demo(args.drivers)
1112 + if args.command == "release-plan":
1113 + return cmd_release_plan(args.extensions, args.model)
1114 + if args.command == "release-prepare":
1115 + return cmd_release_prepare(args.extensions, args.model, args.skip_demo)
997 1116 if args.command == "publish":
998 - return cmd_publish(
999 - args.extensions,
1000 - dry_run=args.dry_run,
1001 - model=args.model,
1002 - skip_demo=args.skip_demo,
1003 - no_push=args.no_push,
1117 + return cmd_publish(args.extensions)
1005 1118 raise AssertionError(args.command)

scripts/test_goal_pexpect.py

Modified
149 149 def main() -> int:
150 150 parser = argparse.ArgumentParser()
151 + parser.add_argument("idea_number", nargs="?", type=int, choices=range(1, len(IDEAS) + 1))
151 152 parser.add_argument("--idea", type=int, default=1, choices=range(1, len(IDEAS) + 1))
152 153 parser.add_argument("--objective")
153 154 parser.add_argument("--llm-wait", type=float, default=45.0)
159 160 print(f"{i}. {idea}")
160 161 return 0
162 - objective = args.objective or IDEAS[args.idea - 1]
163 + idea = args.idea_number or args.idea
164 + objective = args.objective or IDEAS[idea - 1]
163 165 transcript = run(objective, args.llm_wait)
164 166 print(f"\nOK goal pexpect smoke via {MODEL}")
165 167 print(f"OK transcript {transcript}")

vitest.config.ts

Modified
4 4 import { defineConfig } from "vitest/config";
6 6 export default defineConfig({
7 7 test: {
8 8 include: ["extensions/**/__tests__/**/*.test.ts", "skills/**/*.test.ts"],
9 9 exclude: ["**/__e2e__/**", "**/node_modules/**"],
10 + testTimeout: 30_000,
11 + hookTimeout: 30_000,