gsd-pi 2.38.0-dev.add4f78 → 2.38.0-dev.d533afb
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/dist/resource-loader.js +34 -1
- package/dist/resources/extensions/github-sync/cli.js +284 -0
- package/dist/resources/extensions/github-sync/index.js +73 -0
- package/dist/resources/extensions/github-sync/mapping.js +67 -0
- package/dist/resources/extensions/github-sync/sync.js +424 -0
- package/dist/resources/extensions/github-sync/templates.js +118 -0
- package/dist/resources/extensions/github-sync/types.js +7 -0
- package/dist/resources/extensions/gsd/auto/session.js +3 -23
- package/dist/resources/extensions/gsd/auto-dispatch.js +1 -1
- package/dist/resources/extensions/gsd/auto-loop.js +292 -263
- package/dist/resources/extensions/gsd/auto-post-unit.js +28 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +23 -43
- package/dist/resources/extensions/gsd/auto-start.js +7 -1
- package/dist/resources/extensions/gsd/auto-worktree.js +3 -3
- package/dist/resources/extensions/gsd/auto.js +143 -80
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands.js +2 -1
- package/dist/resources/extensions/gsd/context-budget.js +2 -10
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +0 -2
- package/dist/resources/extensions/gsd/doctor-providers.js +27 -11
- package/dist/resources/extensions/gsd/doctor.js +20 -1
- package/dist/resources/extensions/gsd/exit-command.js +2 -1
- package/dist/resources/extensions/gsd/files.js +4 -0
- package/dist/resources/extensions/gsd/git-service.js +15 -12
- package/dist/resources/extensions/gsd/guided-flow.js +82 -32
- package/dist/resources/extensions/gsd/index.js +22 -19
- package/dist/resources/extensions/gsd/native-git-bridge.js +37 -0
- package/dist/resources/extensions/gsd/preferences-models.js +0 -12
- package/dist/resources/extensions/gsd/preferences-types.js +1 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +58 -10
- package/dist/resources/extensions/gsd/preferences.js +4 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +11 -14
- package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -2
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +11 -12
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +8 -10
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -8
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +11 -8
- package/dist/resources/extensions/gsd/prompts/run-uat.md +27 -10
- package/dist/resources/extensions/gsd/prompts/workflow-start.md +2 -2
- package/dist/resources/extensions/gsd/repo-identity.js +19 -3
- package/dist/resources/extensions/gsd/roadmap-mutations.js +24 -0
- package/dist/resources/extensions/mcp-client/index.js +14 -1
- package/package.json +1 -1
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +2 -2
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +205 -7
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +223 -7
- package/src/resources/extensions/github-sync/cli.ts +364 -0
- package/src/resources/extensions/github-sync/index.ts +93 -0
- package/src/resources/extensions/github-sync/mapping.ts +81 -0
- package/src/resources/extensions/github-sync/sync.ts +556 -0
- package/src/resources/extensions/github-sync/templates.ts +183 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +20 -0
- package/src/resources/extensions/github-sync/tests/commit-linking.test.ts +39 -0
- package/src/resources/extensions/github-sync/tests/mapping.test.ts +104 -0
- package/src/resources/extensions/github-sync/tests/templates.test.ts +110 -0
- package/src/resources/extensions/github-sync/types.ts +47 -0
- package/src/resources/extensions/gsd/auto/session.ts +3 -25
- package/src/resources/extensions/gsd/auto-dispatch.ts +1 -1
- package/src/resources/extensions/gsd/auto-loop.ts +382 -360
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +25 -45
- package/src/resources/extensions/gsd/auto-start.ts +11 -1
- package/src/resources/extensions/gsd/auto-worktree.ts +3 -3
- package/src/resources/extensions/gsd/auto.ts +139 -86
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands.ts +2 -2
- package/src/resources/extensions/gsd/context-budget.ts +2 -12
- package/src/resources/extensions/gsd/docs/preferences-reference.md +0 -2
- package/src/resources/extensions/gsd/doctor-providers.ts +26 -9
- package/src/resources/extensions/gsd/doctor.ts +22 -1
- package/src/resources/extensions/gsd/exit-command.ts +2 -2
- package/src/resources/extensions/gsd/files.ts +3 -1
- package/src/resources/extensions/gsd/git-service.ts +20 -10
- package/src/resources/extensions/gsd/guided-flow.ts +110 -38
- package/src/resources/extensions/gsd/index.ts +21 -16
- package/src/resources/extensions/gsd/native-git-bridge.ts +37 -0
- package/src/resources/extensions/gsd/preferences-models.ts +0 -12
- package/src/resources/extensions/gsd/preferences-types.ts +4 -4
- package/src/resources/extensions/gsd/preferences-validation.ts +50 -10
- package/src/resources/extensions/gsd/preferences.ts +3 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +11 -14
- package/src/resources/extensions/gsd/prompts/execute-task.md +2 -2
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +11 -12
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +8 -10
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +4 -8
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +11 -8
- package/src/resources/extensions/gsd/prompts/run-uat.md +27 -10
- package/src/resources/extensions/gsd/prompts/workflow-start.md +2 -2
- package/src/resources/extensions/gsd/repo-identity.ts +20 -3
- package/src/resources/extensions/gsd/roadmap-mutations.ts +29 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +21 -18
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +122 -68
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +86 -3
- package/src/resources/extensions/gsd/tests/preferences.test.ts +2 -7
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +11 -3
- package/src/resources/extensions/gsd/types.ts +0 -1
- package/src/resources/extensions/mcp-client/index.ts +17 -1
- package/dist/resources/extensions/gsd/prompt-compressor.js +0 -393
- package/dist/resources/extensions/gsd/semantic-chunker.js +0 -254
- package/dist/resources/extensions/gsd/summary-distiller.js +0 -212
- package/src/resources/extensions/gsd/prompt-compressor.ts +0 -508
- package/src/resources/extensions/gsd/semantic-chunker.ts +0 -336
- package/src/resources/extensions/gsd/summary-distiller.ts +0 -258
- package/src/resources/extensions/gsd/tests/context-compression.test.ts +0 -193
- package/src/resources/extensions/gsd/tests/prompt-compressor.test.ts +0 -529
- package/src/resources/extensions/gsd/tests/semantic-chunker.test.ts +0 -426
- package/src/resources/extensions/gsd/tests/summary-distiller.test.ts +0 -323
- package/src/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +0 -1272
- package/src/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +0 -164
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Sync extension for GSD.
|
|
3
|
+
*
|
|
4
|
+
* Opt-in extension that syncs GSD lifecycle events to GitHub:
|
|
5
|
+
* milestones → GH Milestones + tracking issues, slices → draft PRs,
|
|
6
|
+
* tasks → sub-issues with auto-close on commit.
|
|
7
|
+
*
|
|
8
|
+
* Integration happens via a single dynamic import in auto-post-unit.ts.
|
|
9
|
+
* This index registers a `/github-sync` command for manual bootstrap
|
|
10
|
+
* and status display.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
14
|
+
import { bootstrapSync } from "./sync.js";
|
|
15
|
+
import { loadSyncMapping } from "./mapping.js";
|
|
16
|
+
import { ghIsAvailable } from "./cli.js";
|
|
17
|
+
|
|
18
|
+
export default function (pi: ExtensionAPI) {
|
|
19
|
+
pi.registerCommand("github-sync", {
|
|
20
|
+
description: "Bootstrap GitHub sync or show sync status",
|
|
21
|
+
handler: async (args: string, ctx) => {
|
|
22
|
+
const subcommand = args.trim().toLowerCase();
|
|
23
|
+
|
|
24
|
+
if (subcommand === "status") {
|
|
25
|
+
await showStatus(ctx);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (subcommand === "bootstrap" || subcommand === "") {
|
|
30
|
+
await runBootstrap(ctx);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ctx.ui.notify(
|
|
35
|
+
"Usage: /github-sync [bootstrap|status]",
|
|
36
|
+
"info",
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function showStatus(ctx: import("@gsd/pi-coding-agent").ExtensionCommandContext) {
|
|
43
|
+
if (!ghIsAvailable()) {
|
|
44
|
+
ctx.ui.notify("GitHub sync: `gh` CLI not installed or not authenticated.", "warning");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const mapping = loadSyncMapping(ctx.cwd);
|
|
49
|
+
if (!mapping) {
|
|
50
|
+
ctx.ui.notify("GitHub sync: No sync mapping found. Run `/github-sync bootstrap` to initialize.", "info");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const milestoneCount = Object.keys(mapping.milestones).length;
|
|
55
|
+
const sliceCount = Object.keys(mapping.slices).length;
|
|
56
|
+
const taskCount = Object.keys(mapping.tasks).length;
|
|
57
|
+
const openMilestones = Object.values(mapping.milestones).filter(m => m.state === "open").length;
|
|
58
|
+
const openSlices = Object.values(mapping.slices).filter(s => s.state === "open").length;
|
|
59
|
+
const openTasks = Object.values(mapping.tasks).filter(t => t.state === "open").length;
|
|
60
|
+
|
|
61
|
+
ctx.ui.notify(
|
|
62
|
+
[
|
|
63
|
+
`GitHub sync: repo=${mapping.repo}`,
|
|
64
|
+
` Milestones: ${milestoneCount} (${openMilestones} open)`,
|
|
65
|
+
` Slices: ${sliceCount} (${openSlices} open)`,
|
|
66
|
+
` Tasks: ${taskCount} (${openTasks} open)`,
|
|
67
|
+
].join("\n"),
|
|
68
|
+
"info",
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function runBootstrap(ctx: import("@gsd/pi-coding-agent").ExtensionCommandContext) {
|
|
73
|
+
if (!ghIsAvailable()) {
|
|
74
|
+
ctx.ui.notify("GitHub sync: `gh` CLI not installed or not authenticated.", "warning");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
ctx.ui.notify("GitHub sync: bootstrapping...", "info");
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
const counts = await bootstrapSync(ctx.cwd);
|
|
82
|
+
if (counts.milestones === 0 && counts.slices === 0 && counts.tasks === 0) {
|
|
83
|
+
ctx.ui.notify("GitHub sync: everything already synced (or no milestones found).", "info");
|
|
84
|
+
} else {
|
|
85
|
+
ctx.ui.notify(
|
|
86
|
+
`GitHub sync: created ${counts.milestones} milestone(s), ${counts.slices} slice(s), ${counts.tasks} task(s).`,
|
|
87
|
+
"info",
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
} catch (err) {
|
|
91
|
+
ctx.ui.notify(`GitHub sync bootstrap failed: ${err}`, "error");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence layer for the GitHub sync mapping.
|
|
3
|
+
*
|
|
4
|
+
* The mapping lives at `.gsd/github-sync.json` and tracks which GSD
|
|
5
|
+
* entities have been synced to which GitHub entities (issues, PRs,
|
|
6
|
+
* milestones) along with their numbers and sync timestamps.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { atomicWriteSync } from "../gsd/atomic-write.js";
|
|
12
|
+
import type { SyncMapping, MilestoneSyncRecord, SliceSyncRecord, SyncEntityRecord } from "./types.js";
|
|
13
|
+
|
|
14
|
+
const MAPPING_FILENAME = "github-sync.json";
|
|
15
|
+
|
|
16
|
+
function mappingPath(basePath: string): string {
|
|
17
|
+
return join(basePath, ".gsd", MAPPING_FILENAME);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ─── Load / Save ────────────────────────────────────────────────────────────
|
|
21
|
+
|
|
22
|
+
export function loadSyncMapping(basePath: string): SyncMapping | null {
|
|
23
|
+
const path = mappingPath(basePath);
|
|
24
|
+
if (!existsSync(path)) return null;
|
|
25
|
+
try {
|
|
26
|
+
const raw = readFileSync(path, "utf-8");
|
|
27
|
+
const parsed = JSON.parse(raw);
|
|
28
|
+
if (parsed?.version !== 1) return null;
|
|
29
|
+
return parsed as SyncMapping;
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function saveSyncMapping(basePath: string, mapping: SyncMapping): void {
|
|
36
|
+
const path = mappingPath(basePath);
|
|
37
|
+
atomicWriteSync(path, JSON.stringify(mapping, null, 2) + "\n");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function createEmptyMapping(repo: string): SyncMapping {
|
|
41
|
+
return {
|
|
42
|
+
version: 1,
|
|
43
|
+
repo,
|
|
44
|
+
milestones: {},
|
|
45
|
+
slices: {},
|
|
46
|
+
tasks: {},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ─── Accessors ──────────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
export function getMilestoneRecord(mapping: SyncMapping, mid: string): MilestoneSyncRecord | null {
|
|
53
|
+
return mapping.milestones[mid] ?? null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getSliceRecord(mapping: SyncMapping, mid: string, sid: string): SliceSyncRecord | null {
|
|
57
|
+
return mapping.slices[`${mid}/${sid}`] ?? null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getTaskRecord(mapping: SyncMapping, mid: string, sid: string, tid: string): SyncEntityRecord | null {
|
|
61
|
+
return mapping.tasks[`${mid}/${sid}/${tid}`] ?? null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getTaskIssueNumber(mapping: SyncMapping, mid: string, sid: string, tid: string): number | null {
|
|
65
|
+
const record = getTaskRecord(mapping, mid, sid, tid);
|
|
66
|
+
return record?.issueNumber ?? null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ─── Mutators ───────────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
export function setMilestoneRecord(mapping: SyncMapping, mid: string, record: MilestoneSyncRecord): void {
|
|
72
|
+
mapping.milestones[mid] = record;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function setSliceRecord(mapping: SyncMapping, mid: string, sid: string, record: SliceSyncRecord): void {
|
|
76
|
+
mapping.slices[`${mid}/${sid}`] = record;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function setTaskRecord(mapping: SyncMapping, mid: string, sid: string, tid: string, record: SyncEntityRecord): void {
|
|
80
|
+
mapping.tasks[`${mid}/${sid}/${tid}`] = record;
|
|
81
|
+
}
|