gsd-pi 2.38.0-dev.63ad7e5 → 2.38.0-dev.785052f

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.
Files changed (143) hide show
  1. package/README.md +15 -11
  2. package/dist/resource-loader.js +34 -1
  3. package/dist/resources/extensions/browser-tools/index.js +3 -1
  4. package/dist/resources/extensions/browser-tools/tools/verify.js +97 -0
  5. package/dist/resources/extensions/github-sync/cli.js +284 -0
  6. package/dist/resources/extensions/github-sync/index.js +73 -0
  7. package/dist/resources/extensions/github-sync/mapping.js +67 -0
  8. package/dist/resources/extensions/github-sync/sync.js +424 -0
  9. package/dist/resources/extensions/github-sync/templates.js +118 -0
  10. package/dist/resources/extensions/github-sync/types.js +7 -0
  11. package/dist/resources/extensions/gsd/auto-dispatch.js +1 -1
  12. package/dist/resources/extensions/gsd/auto-loop.js +593 -516
  13. package/dist/resources/extensions/gsd/auto-post-unit.js +28 -3
  14. package/dist/resources/extensions/gsd/auto-prompts.js +197 -19
  15. package/dist/resources/extensions/gsd/auto-worktree.js +3 -3
  16. package/dist/resources/extensions/gsd/commands.js +2 -1
  17. package/dist/resources/extensions/gsd/doctor-providers.js +3 -0
  18. package/dist/resources/extensions/gsd/doctor.js +20 -1
  19. package/dist/resources/extensions/gsd/exit-command.js +2 -1
  20. package/dist/resources/extensions/gsd/files.js +46 -7
  21. package/dist/resources/extensions/gsd/git-service.js +30 -12
  22. package/dist/resources/extensions/gsd/gitignore.js +16 -3
  23. package/dist/resources/extensions/gsd/guided-flow.js +149 -38
  24. package/dist/resources/extensions/gsd/health-widget-core.js +32 -70
  25. package/dist/resources/extensions/gsd/health-widget.js +3 -86
  26. package/dist/resources/extensions/gsd/index.js +22 -19
  27. package/dist/resources/extensions/gsd/migrate-external.js +18 -1
  28. package/dist/resources/extensions/gsd/native-git-bridge.js +37 -0
  29. package/dist/resources/extensions/gsd/paths.js +3 -0
  30. package/dist/resources/extensions/gsd/preferences-types.js +1 -0
  31. package/dist/resources/extensions/gsd/preferences-validation.js +58 -0
  32. package/dist/resources/extensions/gsd/preferences.js +20 -9
  33. package/dist/resources/extensions/gsd/prompt-loader.js +6 -2
  34. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  35. package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  36. package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -1
  37. package/dist/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
  38. package/dist/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
  39. package/dist/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
  40. package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
  41. package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
  42. package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  43. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  44. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  45. package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  46. package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
  47. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
  48. package/dist/resources/extensions/gsd/prompts/run-uat.md +3 -1
  49. package/dist/resources/extensions/gsd/roadmap-mutations.js +24 -0
  50. package/dist/resources/extensions/gsd/state.js +41 -22
  51. package/dist/resources/extensions/gsd/templates/runtime.md +21 -0
  52. package/dist/resources/extensions/gsd/templates/task-plan.md +3 -0
  53. package/dist/resources/extensions/mcp-client/index.js +14 -1
  54. package/dist/resources/extensions/remote-questions/status.js +4 -2
  55. package/dist/resources/extensions/remote-questions/store.js +4 -2
  56. package/dist/resources/extensions/shared/frontmatter.js +1 -1
  57. package/package.json +1 -1
  58. package/packages/pi-ai/dist/utils/oauth/anthropic.js +2 -2
  59. package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
  60. package/packages/pi-ai/src/utils/oauth/anthropic.ts +2 -2
  61. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  62. package/packages/pi-coding-agent/dist/core/extensions/loader.js +205 -7
  63. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  64. package/packages/pi-coding-agent/dist/core/skills.d.ts +1 -0
  65. package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
  66. package/packages/pi-coding-agent/dist/core/skills.js +6 -1
  67. package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
  68. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  69. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  70. package/packages/pi-coding-agent/dist/index.js +1 -1
  71. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  72. package/packages/pi-coding-agent/src/core/extensions/loader.ts +223 -7
  73. package/packages/pi-coding-agent/src/core/skills.ts +9 -1
  74. package/packages/pi-coding-agent/src/index.ts +1 -0
  75. package/src/resources/extensions/browser-tools/index.ts +3 -0
  76. package/src/resources/extensions/browser-tools/tools/verify.ts +117 -0
  77. package/src/resources/extensions/github-sync/cli.ts +364 -0
  78. package/src/resources/extensions/github-sync/index.ts +93 -0
  79. package/src/resources/extensions/github-sync/mapping.ts +81 -0
  80. package/src/resources/extensions/github-sync/sync.ts +556 -0
  81. package/src/resources/extensions/github-sync/templates.ts +183 -0
  82. package/src/resources/extensions/github-sync/tests/cli.test.ts +20 -0
  83. package/src/resources/extensions/github-sync/tests/commit-linking.test.ts +39 -0
  84. package/src/resources/extensions/github-sync/tests/mapping.test.ts +104 -0
  85. package/src/resources/extensions/github-sync/tests/templates.test.ts +110 -0
  86. package/src/resources/extensions/github-sync/types.ts +47 -0
  87. package/src/resources/extensions/gsd/auto-dispatch.ts +1 -1
  88. package/src/resources/extensions/gsd/auto-loop.ts +472 -434
  89. package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
  90. package/src/resources/extensions/gsd/auto-prompts.ts +242 -19
  91. package/src/resources/extensions/gsd/auto-worktree.ts +3 -3
  92. package/src/resources/extensions/gsd/commands.ts +2 -2
  93. package/src/resources/extensions/gsd/doctor-providers.ts +4 -0
  94. package/src/resources/extensions/gsd/doctor.ts +22 -1
  95. package/src/resources/extensions/gsd/exit-command.ts +2 -2
  96. package/src/resources/extensions/gsd/files.ts +49 -9
  97. package/src/resources/extensions/gsd/git-service.ts +44 -10
  98. package/src/resources/extensions/gsd/gitignore.ts +17 -3
  99. package/src/resources/extensions/gsd/guided-flow.ts +177 -44
  100. package/src/resources/extensions/gsd/health-widget-core.ts +28 -80
  101. package/src/resources/extensions/gsd/health-widget.ts +3 -89
  102. package/src/resources/extensions/gsd/index.ts +21 -16
  103. package/src/resources/extensions/gsd/migrate-external.ts +18 -1
  104. package/src/resources/extensions/gsd/native-git-bridge.ts +37 -0
  105. package/src/resources/extensions/gsd/paths.ts +4 -0
  106. package/src/resources/extensions/gsd/preferences-types.ts +4 -0
  107. package/src/resources/extensions/gsd/preferences-validation.ts +50 -0
  108. package/src/resources/extensions/gsd/preferences.ts +23 -9
  109. package/src/resources/extensions/gsd/prompt-loader.ts +7 -2
  110. package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  111. package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  112. package/src/resources/extensions/gsd/prompts/execute-task.md +3 -1
  113. package/src/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
  114. package/src/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
  115. package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
  116. package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
  117. package/src/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
  118. package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  119. package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  120. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  121. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  122. package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
  123. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
  124. package/src/resources/extensions/gsd/prompts/run-uat.md +3 -1
  125. package/src/resources/extensions/gsd/roadmap-mutations.ts +29 -0
  126. package/src/resources/extensions/gsd/state.ts +38 -20
  127. package/src/resources/extensions/gsd/templates/runtime.md +21 -0
  128. package/src/resources/extensions/gsd/templates/task-plan.md +3 -0
  129. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +111 -37
  130. package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +4 -3
  131. package/src/resources/extensions/gsd/tests/derive-state.test.ts +43 -0
  132. package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +50 -0
  133. package/src/resources/extensions/gsd/tests/health-widget.test.ts +16 -54
  134. package/src/resources/extensions/gsd/tests/parsers.test.ts +131 -14
  135. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +209 -0
  136. package/src/resources/extensions/gsd/tests/run-uat.test.ts +5 -1
  137. package/src/resources/extensions/gsd/tests/skill-activation.test.ts +140 -0
  138. package/src/resources/extensions/gsd/types.ts +18 -0
  139. package/src/resources/extensions/gsd/verification-evidence.ts +16 -0
  140. package/src/resources/extensions/mcp-client/index.ts +17 -1
  141. package/src/resources/extensions/remote-questions/status.ts +4 -2
  142. package/src/resources/extensions/remote-questions/store.ts +4 -2
  143. package/src/resources/extensions/shared/frontmatter.ts +1 -1
@@ -0,0 +1,140 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { tmpdir } from "node:os";
6
+ import { loadSkills } from "@gsd/pi-coding-agent";
7
+ import { buildSkillActivationBlock } from "../auto-prompts.js";
8
+ import type { GSDPreferences } from "../preferences.js";
9
+
10
+ function makeTempBase(): string {
11
+ return mkdtempSync(join(tmpdir(), "gsd-skill-activation-"));
12
+ }
13
+
14
+ function cleanup(base: string): void {
15
+ rmSync(base, { recursive: true, force: true });
16
+ }
17
+
18
+ function writeSkill(base: string, name: string, description: string): void {
19
+ const dir = join(base, "skills", name);
20
+ mkdirSync(dir, { recursive: true });
21
+ writeFileSync(join(dir, "SKILL.md"), `---\nname: ${name}\ndescription: ${description}\n---\n\n# ${name}\n`);
22
+ }
23
+
24
+ function loadOnlyTestSkills(base: string): void {
25
+ loadSkills({ cwd: base, includeDefaults: false, skillPaths: [join(base, "skills")] });
26
+ }
27
+
28
+ function buildBlock(
29
+ base: string,
30
+ params: Partial<Parameters<typeof buildSkillActivationBlock>[0]> = {},
31
+ preferences: GSDPreferences = {},
32
+ ): string {
33
+ return buildSkillActivationBlock({
34
+ base,
35
+ milestoneId: "M001",
36
+ sliceId: "S01",
37
+ ...params,
38
+ preferences,
39
+ });
40
+ }
41
+
42
+ test("buildSkillActivationBlock matches installed skills from task context", () => {
43
+ const base = makeTempBase();
44
+ try {
45
+ writeSkill(base, "react", "Use for React components, hooks, JSX, and frontend UI work.");
46
+ writeSkill(base, "swiftui", "Use for SwiftUI views, iOS layout, and Apple platform UI work.");
47
+ loadOnlyTestSkills(base);
48
+
49
+ const result = buildBlock(base, {
50
+ sliceTitle: "Build React dashboard",
51
+ taskId: "T01",
52
+ taskTitle: "Implement React settings panel",
53
+ });
54
+
55
+ assert.match(result, /<skill_activation>/);
56
+ assert.match(result, /Call Skill\('react'\)/);
57
+ assert.doesNotMatch(result, /swiftui/);
58
+ } finally {
59
+ cleanup(base);
60
+ }
61
+ });
62
+
63
+ test("buildSkillActivationBlock includes always_use_skills from preferences", () => {
64
+ const base = makeTempBase();
65
+ try {
66
+ writeSkill(base, "testing", "Use for test setup, assertions, and verification patterns.");
67
+ loadOnlyTestSkills(base);
68
+
69
+ const result = buildBlock(base, { taskTitle: "Unrelated task title" }, {
70
+ always_use_skills: ["testing"],
71
+ });
72
+
73
+ assert.match(result, /Call Skill\('testing'\)/);
74
+ } finally {
75
+ cleanup(base);
76
+ }
77
+ });
78
+
79
+ test("buildSkillActivationBlock includes skill_rules matches and task-plan skills_used", () => {
80
+ const base = makeTempBase();
81
+ try {
82
+ writeSkill(base, "prisma", "Use for Prisma schema, migrations, and ORM queries.");
83
+ writeSkill(base, "accessibility", "Use for accessibility, aria attributes, and keyboard support.");
84
+ loadOnlyTestSkills(base);
85
+
86
+ const taskPlan = [
87
+ "---",
88
+ "skills_used:",
89
+ " - accessibility",
90
+ "---",
91
+ "# T01: Example",
92
+ ].join("\n");
93
+
94
+ const result = buildBlock(base, {
95
+ taskTitle: "Update prisma schema",
96
+ taskPlanContent: taskPlan,
97
+ }, {
98
+ skill_rules: [{ when: "prisma database schema", use: ["prisma"] }],
99
+ });
100
+
101
+ assert.match(result, /Call Skill\('accessibility'\)/);
102
+ assert.match(result, /Call Skill\('prisma'\)/);
103
+ } finally {
104
+ cleanup(base);
105
+ }
106
+ });
107
+
108
+ test("buildSkillActivationBlock honors avoid_skills", () => {
109
+ const base = makeTempBase();
110
+ try {
111
+ writeSkill(base, "react", "Use for React components and frontend UI work.");
112
+ loadOnlyTestSkills(base);
113
+
114
+ const result = buildBlock(base, {
115
+ taskTitle: "Implement React settings panel",
116
+ }, {
117
+ avoid_skills: ["react"],
118
+ });
119
+
120
+ assert.equal(result, "");
121
+ } finally {
122
+ cleanup(base);
123
+ }
124
+ });
125
+
126
+ test("buildSkillActivationBlock falls back cleanly when nothing matches", () => {
127
+ const base = makeTempBase();
128
+ try {
129
+ writeSkill(base, "swiftui", "Use for SwiftUI apps.");
130
+ loadOnlyTestSkills(base);
131
+
132
+ const result = buildBlock(base, {
133
+ taskTitle: "Plain text docs task",
134
+ });
135
+
136
+ assert.equal(result, "");
137
+ } finally {
138
+ cleanup(base);
139
+ }
140
+ });
@@ -61,6 +61,16 @@ export interface TaskPlanEntry {
61
61
  verify?: string; // e.g. "run tests" — extracted from "- Verify:" subline
62
62
  }
63
63
 
64
+ export interface TaskPlanFrontmatter {
65
+ estimated_steps?: number; // optional scope estimate for plan quality validator
66
+ estimated_files?: number; // optional file-count estimate for scope warning heuristics
67
+ skills_used: string[]; // installed skill slugs/names to hand off to execute-task prompts
68
+ }
69
+
70
+ export interface TaskPlanFile {
71
+ frontmatter: TaskPlanFrontmatter;
72
+ }
73
+
64
74
  // ─── Verification Gate ─────────────────────────────────────────────────────
65
75
 
66
76
  /** Result of a single verification command execution */
@@ -478,3 +488,11 @@ export interface ReactiveExecutionState {
478
488
  };
479
489
  updatedAt: string;
480
490
  }
491
+
492
+ export interface BrowserFlowResult {
493
+ url: string;
494
+ passed: boolean;
495
+ checksTotal: number;
496
+ checksPassed: number;
497
+ duration: number;
498
+ }
@@ -37,6 +37,21 @@ export interface AuditWarningJSON {
37
37
  fixAvailable: boolean;
38
38
  }
39
39
 
40
+ export interface BrowserEvidenceCheckJSON {
41
+ description: string;
42
+ passed: boolean;
43
+ actual?: string;
44
+ evidence?: string;
45
+ error?: string;
46
+ }
47
+
48
+ export interface BrowserEvidenceJSON {
49
+ url: string;
50
+ passed: boolean;
51
+ checks: BrowserEvidenceCheckJSON[];
52
+ duration: number;
53
+ }
54
+
40
55
  export interface EvidenceJSON {
41
56
  schemaVersion: 1;
42
57
  taskId: string;
@@ -49,6 +64,7 @@ export interface EvidenceJSON {
49
64
  maxRetries?: number;
50
65
  runtimeErrors?: RuntimeErrorJSON[];
51
66
  auditWarnings?: AuditWarningJSON[];
67
+ browser?: BrowserEvidenceJSON;
52
68
  }
53
69
 
54
70
  /**
@@ -114,6 +114,22 @@ function getServerConfig(name: string): McpServerConfig | undefined {
114
114
  return readConfigs().find((s) => s.name === name);
115
115
  }
116
116
 
117
+ /** Resolve ${VAR} references in env values against process.env. */
118
+ function resolveEnv(env: Record<string, string>): Record<string, string> {
119
+ const resolved: Record<string, string> = {};
120
+ for (const [key, value] of Object.entries(env)) {
121
+ if (typeof value === "string") {
122
+ resolved[key] = value.replace(
123
+ /\$\{([^}]+)\}/g,
124
+ (_match, varName) => process.env[varName] ?? "",
125
+ );
126
+ } else {
127
+ resolved[key] = value;
128
+ }
129
+ }
130
+ return resolved;
131
+ }
132
+
117
133
  async function getOrConnect(name: string, signal?: AbortSignal): Promise<Client> {
118
134
  const existing = connections.get(name);
119
135
  if (existing) return existing.client;
@@ -128,7 +144,7 @@ async function getOrConnect(name: string, signal?: AbortSignal): Promise<Client>
128
144
  transport = new StdioClientTransport({
129
145
  command: config.command,
130
146
  args: config.args,
131
- env: config.env ? { ...process.env, ...config.env } as Record<string, string> : undefined,
147
+ env: config.env ? { ...process.env, ...resolveEnv(config.env) } as Record<string, string> : undefined,
132
148
  cwd: config.cwd,
133
149
  stderr: "pipe",
134
150
  });
@@ -7,7 +7,9 @@ import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import { readPromptRecord } from "./store.js";
9
9
 
10
- const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
10
+ function getGsdHome(): string {
11
+ return process.env.GSD_HOME || join(homedir(), ".gsd");
12
+ }
11
13
 
12
14
  export interface LatestPromptSummary {
13
15
  id: string;
@@ -16,7 +18,7 @@ export interface LatestPromptSummary {
16
18
  }
17
19
 
18
20
  export function getLatestPromptSummary(): LatestPromptSummary | null {
19
- const runtimeDir = join(gsdHome, "runtime", "remote-questions");
21
+ const runtimeDir = join(getGsdHome(), "runtime", "remote-questions");
20
22
  if (!existsSync(runtimeDir)) return null;
21
23
  const files = readdirSync(runtimeDir).filter((f) => f.endsWith(".json"));
22
24
  if (files.length === 0) return null;
@@ -7,10 +7,12 @@ import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import type { RemotePrompt, RemotePromptRecord, RemotePromptRef, RemoteAnswer, RemotePromptStatus } from "./types.js";
9
9
 
10
- const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
10
+ function getGsdHome(): string {
11
+ return process.env.GSD_HOME || join(homedir(), ".gsd");
12
+ }
11
13
 
12
14
  function runtimeDir(): string {
13
- return join(gsdHome, "runtime", "remote-questions");
15
+ return join(getGsdHome(), "runtime", "remote-questions");
14
16
  }
15
17
 
16
18
  function recordPath(id: string): string {
@@ -50,7 +50,7 @@ export function parseFrontmatterMap(lines: string[]): Record<string, unknown> {
50
50
  }
51
51
 
52
52
  // Array item (2-space indent)
53
- const arrayMatch = line.match(/^ - (.*)$/);
53
+ const arrayMatch = line.match(/^ - ?(.*)$/);
54
54
  if (arrayMatch && currentKey) {
55
55
  // If there's a pending nested object, push it
56
56
  if (currentObj && Object.keys(currentObj).length > 0) {