pi-pstack-workflow-kit 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 +33 -9
- package/lib/catalog.ts +53 -4
- package/lib/models.ts +10 -9
- package/lib/pool.ts +4 -6
- package/lib/state.ts +24 -24
- package/lib/transcript.ts +19 -15
- package/package.json +17 -20
- package/reference/PARITY.md +1 -1
- package/scripts/job-input.ts +38 -39
- package/scripts/run-job.mjs +9 -7
- package/skills/architect/SKILL.md +1 -1
- package/skills/arena/SKILL.md +1 -1
- package/skills/automate-me/SKILL.md +1 -1
- package/skills/benchmark-checklist/SKILL.md +1 -1
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/bro/SKILL.md +1 -1
- package/skills/check-compiler-errors/SKILL.md +1 -1
- package/skills/control-cli/SKILL.md +1 -1
- package/skills/control-ui/SKILL.md +1 -1
- package/skills/correct/SKILL.md +1 -1
- package/skills/create-formal-verification-skill/SKILL.md +1 -1
- package/skills/create-verification-skill/SKILL.md +1 -1
- package/skills/deslop/SKILL.md +1 -1
- package/skills/figure-it-out/SKILL.md +1 -1
- package/skills/fix-ci/SKILL.md +1 -1
- package/skills/fix-merge-conflicts/SKILL.md +1 -1
- package/skills/get-pr-comments/SKILL.md +1 -1
- package/skills/how/SKILL.md +1 -1
- package/skills/in-your-own-words/SKILL.md +1 -1
- package/skills/interrogate/SKILL.md +1 -1
- package/skills/ketchup/SKILL.md +1 -1
- package/skills/ketchup-video/SKILL.md +1 -1
- package/skills/loop-on-ci/SKILL.md +1 -1
- package/skills/maintain-formal-verification-skill/SKILL.md +1 -1
- package/skills/maintain-verification-skill/SKILL.md +1 -1
- package/skills/make-bot-ui/SKILL.md +1 -1
- package/skills/make-pr-easy-to-review/SKILL.md +1 -1
- package/skills/new-branch-and-pr/SKILL.md +1 -1
- package/skills/no-comments/SKILL.md +1 -1
- package/skills/poteto-help/SKILL.md +1 -1
- package/skills/poteto-mode/SKILL.md +1 -1
- package/skills/poteto-mode/playbooks/authoring-a-skill.md +1 -1
- package/skills/poteto-mode/playbooks/autonomous-run.md +1 -1
- package/skills/poteto-mode/playbooks/autopilot-full.md +1 -1
- package/skills/poteto-mode/playbooks/autopilot-stack.md +1 -1
- package/skills/poteto-mode/playbooks/babysit.md +1 -1
- package/skills/poteto-mode/playbooks/bug-fix.md +1 -1
- package/skills/poteto-mode/playbooks/eval.md +1 -1
- package/skills/poteto-mode/playbooks/feature.md +1 -1
- package/skills/poteto-mode/playbooks/hillclimb.md +1 -1
- package/skills/poteto-mode/playbooks/investigation.md +1 -1
- package/skills/poteto-mode/playbooks/multi-phase-plan.md +1 -1
- package/skills/poteto-mode/playbooks/opening-a-pr.md +1 -1
- package/skills/poteto-mode/playbooks/pause-safely.md +1 -1
- package/skills/poteto-mode/playbooks/perf-issue.md +1 -1
- package/skills/poteto-mode/playbooks/prototype.md +1 -1
- package/skills/poteto-mode/playbooks/refactoring.md +1 -1
- package/skills/poteto-mode/playbooks/runtime-forensics.md +1 -1
- package/skills/poteto-mode/playbooks/session-pickup.md +1 -1
- package/skills/poteto-mode/playbooks/shipping.md +1 -1
- package/skills/poteto-mode/playbooks/trace-forensics.md +1 -1
- package/skills/poteto-mode/playbooks/visual-parity.md +1 -1
- package/skills/poteto-mode/playbooks/worktree-cleanup.md +1 -1
- package/skills/pr-review-canvas/SKILL.md +1 -1
- package/skills/principle-attack-the-premise/SKILL.md +1 -1
- package/skills/principle-boundary-discipline/SKILL.md +1 -1
- package/skills/principle-build-the-lever/SKILL.md +1 -1
- package/skills/principle-encode-lessons-in-structure/SKILL.md +1 -1
- package/skills/principle-exhaust-the-design-space/SKILL.md +1 -1
- package/skills/principle-experience-first/SKILL.md +1 -1
- package/skills/principle-explain-the-number/SKILL.md +1 -1
- package/skills/principle-fix-root-causes/SKILL.md +1 -1
- package/skills/principle-foundational-thinking/SKILL.md +1 -1
- package/skills/principle-guard-the-context-window/SKILL.md +1 -1
- package/skills/principle-laziness-protocol/SKILL.md +1 -1
- package/skills/principle-make-operations-idempotent/SKILL.md +1 -1
- package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -1
- package/skills/principle-minimize-reader-load/SKILL.md +1 -1
- package/skills/principle-model-the-domain/SKILL.md +1 -1
- package/skills/principle-never-block-on-the-human/SKILL.md +1 -1
- package/skills/principle-outcome-oriented-execution/SKILL.md +1 -1
- package/skills/principle-prove-it-works/SKILL.md +1 -1
- package/skills/principle-redesign-from-first-principles/SKILL.md +1 -1
- package/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -1
- package/skills/principle-sequence-verifiable-units/SKILL.md +1 -1
- package/skills/principle-subtract-before-you-add/SKILL.md +1 -1
- package/skills/principle-test-behavior-not-implementation/SKILL.md +1 -1
- package/skills/principle-type-system-discipline/SKILL.md +1 -1
- package/skills/recall/SKILL.md +1 -1
- package/skills/reflect/SKILL.md +1 -1
- package/skills/review-and-ship/SKILL.md +1 -1
- package/skills/run-smoke-tests/SKILL.md +1 -1
- package/skills/setup-pstack/SKILL.md +1 -1
- package/skills/sharpen/SKILL.md +1 -1
- package/skills/show-me-your-work/SKILL.md +1 -1
- package/skills/statechart/SKILL.md +1 -1
- package/skills/swarm/SKILL.md +1 -1
- package/skills/tdd/SKILL.md +1 -1
- package/skills/teach/SKILL.md +1 -1
- package/skills/technical-writing/SKILL.md +1 -1
- package/skills/thermo-nuclear-code-quality-review/SKILL.md +1 -1
- package/skills/typescript-best-practices/SKILL.md +1 -1
- package/skills/unslop/SKILL.md +1 -1
- package/skills/verify-this/SKILL.md +1 -1
- package/skills/weekly-review/SKILL.md +1 -1
- package/skills/what-did-i-get-done/SKILL.md +1 -1
- package/skills/why/SKILL.md +1 -1
- package/skills/workflow-from-chats/SKILL.md +1 -1
- package/{extensions → src}/catalog-ui.ts +2 -2
- package/{extensions → src}/delegate.ts +40 -30
- package/{extensions → src}/forge.ts +18 -17
- package/{extensions → src}/git.ts +6 -1
- package/{extensions → src}/models.ts +87 -13
- package/{extensions → src}/parent-diff.ts +4 -3
- package/{extensions → src}/plan.ts +3 -3
- package/{extensions → src}/records.ts +8 -4
- package/{extensions → src}/support.ts +3 -2
- package/{extensions → src}/worktrees.ts +3 -3
- package/{extensions → src}/index.ts +0 -0
- package/{extensions → src}/session.ts +1 -1
|
@@ -43,8 +43,9 @@ export async function saveParentDiff(
|
|
|
43
43
|
git.probe(["diff", "--no-index", "--", "/dev/null", file], repo, remaining),
|
|
44
44
|
),
|
|
45
45
|
);
|
|
46
|
-
for (const [i,
|
|
47
|
-
const
|
|
46
|
+
for (const [i, file] of batch.entries()) {
|
|
47
|
+
const patch = patches[i];
|
|
48
|
+
const r = patch?.status === "fulfilled" ? patch.value : undefined;
|
|
48
49
|
if (r && (r.code === 0 || r.code === 1)) {
|
|
49
50
|
const bytes = Buffer.byteLength(r.stdout);
|
|
50
51
|
if (bytes <= remaining) {
|
|
@@ -53,7 +54,7 @@ export async function saveParentDiff(
|
|
|
53
54
|
continue;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
omitted.push(
|
|
57
|
+
omitted.push(file);
|
|
57
58
|
}
|
|
58
59
|
next += batch.length;
|
|
59
60
|
}
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
artifacts,
|
|
22
22
|
atomicWrite,
|
|
23
23
|
fail,
|
|
24
|
+
type Notify,
|
|
24
25
|
result,
|
|
26
|
+
stringEnum,
|
|
25
27
|
text,
|
|
26
28
|
unreachable,
|
|
27
|
-
type Notify,
|
|
28
|
-
stringEnum,
|
|
29
29
|
} from "./support.ts";
|
|
30
30
|
|
|
31
31
|
const planParameters = Type.Object({
|
|
@@ -66,7 +66,7 @@ export function registerPlan(pi: ExtensionAPI, session: Session, notify: Notify)
|
|
|
66
66
|
handler: async (args, ctx) => {
|
|
67
67
|
const [route, ...words] = args.trim().split(/\s+/);
|
|
68
68
|
const goal = words.join(" ");
|
|
69
|
-
if (!routes.includes(route) || !goal)
|
|
69
|
+
if (!route || !routes.includes(route) || !goal)
|
|
70
70
|
return notify(ctx, `Choose a route and goal:\n${routes.join(", ")}`);
|
|
71
71
|
session.commit(ctx, { plan: startPlan(route, goal) });
|
|
72
72
|
sendWorkflow(pi, "pb-" + route, goal);
|
|
@@ -4,9 +4,10 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { nativeNode, packageFile } from "../lib/catalog.ts";
|
|
8
8
|
import { isJobKind } from "../lib/jobs.ts";
|
|
9
|
-
import {
|
|
9
|
+
import { parseJson } from "../lib/validation.ts";
|
|
10
|
+
import { artifacts, hasErrorCode, type Notify, result, tsvRow } from "./support.ts";
|
|
10
11
|
|
|
11
12
|
export function registerRecords(pi: ExtensionAPI, notify: Notify) {
|
|
12
13
|
pi.registerCommand("pstack-automation", {
|
|
@@ -19,8 +20,11 @@ export function registerRecords(pi: ExtensionAPI, notify: Notify) {
|
|
|
19
20
|
kind === "custom"
|
|
20
21
|
? { instructions: "Supply explicit task, approved tools, trigger and finish predicate." }
|
|
21
22
|
: {
|
|
22
|
-
instructions:
|
|
23
|
-
config:
|
|
23
|
+
instructions: nativeNode(kind).instructions,
|
|
24
|
+
config: parseJson(
|
|
25
|
+
packageFile("reference/benny/config.example.json"),
|
|
26
|
+
"Benny configuration example",
|
|
27
|
+
),
|
|
24
28
|
};
|
|
25
29
|
const job = { version: 1, enabled: false, kind, cwd: ctx.cwd, tools: [], ...draft };
|
|
26
30
|
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
@@ -9,7 +9,8 @@ import { Type } from "typebox";
|
|
|
9
9
|
|
|
10
10
|
import { isRecord } from "../lib/validation.ts";
|
|
11
11
|
|
|
12
|
-
export const agentDir = () => process.env
|
|
12
|
+
export const agentDir = () => process.env["PI_CODING_AGENT_DIR"] ?? join(homedir(), ".pi", "agent");
|
|
13
|
+
export const piBin = process.env["PSTACK_PI_BIN"] ?? "pi";
|
|
13
14
|
export const artifacts = (ctx: ExtensionContext) =>
|
|
14
15
|
join(agentDir(), "pstack", "sessions", ctx.sessionManager.getSessionId());
|
|
15
16
|
export const text = (value: unknown) =>
|
|
@@ -27,7 +28,7 @@ export function unreachable(value: never): never {
|
|
|
27
28
|
throw new Error(`Unhandled case: ${String(value)}`);
|
|
28
29
|
}
|
|
29
30
|
export const hasErrorCode = (error: unknown, code: string) =>
|
|
30
|
-
isRecord(error) && error
|
|
31
|
+
isRecord(error) && error["code"] === code;
|
|
31
32
|
export async function atomicWrite(path: string, data: string) {
|
|
32
33
|
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
33
34
|
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
@@ -5,13 +5,13 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
|
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
|
|
7
7
|
import { pool } from "../lib/pool.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { type Git, gitIn } from "./git.ts";
|
|
9
9
|
import { artifacts, fail, hasErrorCode, result, stringEnum } from "./support.ts";
|
|
10
10
|
|
|
11
11
|
export interface Worktree {
|
|
12
12
|
path: string;
|
|
13
|
-
head?: string;
|
|
14
|
-
branch?: string;
|
|
13
|
+
head?: string | undefined;
|
|
14
|
+
branch?: string | undefined;
|
|
15
15
|
locked: boolean;
|
|
16
16
|
prunable: boolean;
|
|
17
17
|
bare: boolean;
|
|
File without changes
|