pi-gsd 2.0.1 → 2.0.2

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 (65) hide show
  1. package/dist/pi-gsd-hooks.js +1532 -0
  2. package/package.json +3 -5
  3. package/.gsd/extensions/pi-gsd-hooks.ts +0 -973
  4. package/src/cli.ts +0 -644
  5. package/src/commands/base.ts +0 -67
  6. package/src/commands/commit.ts +0 -22
  7. package/src/commands/config.ts +0 -71
  8. package/src/commands/frontmatter.ts +0 -51
  9. package/src/commands/index.ts +0 -76
  10. package/src/commands/init.ts +0 -43
  11. package/src/commands/milestone.ts +0 -37
  12. package/src/commands/phase.ts +0 -92
  13. package/src/commands/progress.ts +0 -71
  14. package/src/commands/roadmap.ts +0 -40
  15. package/src/commands/scaffold.ts +0 -19
  16. package/src/commands/state.ts +0 -102
  17. package/src/commands/template.ts +0 -52
  18. package/src/commands/verify.ts +0 -70
  19. package/src/commands/workstream.ts +0 -98
  20. package/src/commands/wxp.ts +0 -65
  21. package/src/lib/commands.ts +0 -1040
  22. package/src/lib/config.ts +0 -385
  23. package/src/lib/core.ts +0 -1167
  24. package/src/lib/frontmatter.ts +0 -462
  25. package/src/lib/init.ts +0 -517
  26. package/src/lib/milestone.ts +0 -290
  27. package/src/lib/model-profiles.ts +0 -272
  28. package/src/lib/phase.ts +0 -1012
  29. package/src/lib/profile-output.ts +0 -237
  30. package/src/lib/profile-pipeline.ts +0 -556
  31. package/src/lib/roadmap.ts +0 -378
  32. package/src/lib/schemas.ts +0 -290
  33. package/src/lib/security.ts +0 -176
  34. package/src/lib/state.ts +0 -1175
  35. package/src/lib/template.ts +0 -246
  36. package/src/lib/uat.ts +0 -289
  37. package/src/lib/verify.ts +0 -879
  38. package/src/lib/workstream.ts +0 -524
  39. package/src/output.ts +0 -45
  40. package/src/schemas/pi-gsd-settings.schema.json +0 -80
  41. package/src/schemas/wxp.xsd +0 -619
  42. package/src/schemas/wxp.zod.ts +0 -318
  43. package/src/wxp/__tests__/arguments.test.ts +0 -86
  44. package/src/wxp/__tests__/conditions.test.ts +0 -106
  45. package/src/wxp/__tests__/executor.test.ts +0 -95
  46. package/src/wxp/__tests__/helpers.ts +0 -26
  47. package/src/wxp/__tests__/integration.test.ts +0 -166
  48. package/src/wxp/__tests__/new-features.test.ts +0 -222
  49. package/src/wxp/__tests__/parser.test.ts +0 -159
  50. package/src/wxp/__tests__/paste.test.ts +0 -66
  51. package/src/wxp/__tests__/schema.test.ts +0 -120
  52. package/src/wxp/__tests__/security.test.ts +0 -87
  53. package/src/wxp/__tests__/shell.test.ts +0 -85
  54. package/src/wxp/__tests__/string-ops.test.ts +0 -25
  55. package/src/wxp/__tests__/variables.test.ts +0 -65
  56. package/src/wxp/arguments.ts +0 -89
  57. package/src/wxp/conditions.ts +0 -78
  58. package/src/wxp/executor.ts +0 -191
  59. package/src/wxp/index.ts +0 -191
  60. package/src/wxp/parser.ts +0 -198
  61. package/src/wxp/paste.ts +0 -51
  62. package/src/wxp/security.ts +0 -102
  63. package/src/wxp/shell.ts +0 -81
  64. package/src/wxp/string-ops.ts +0 -44
  65. package/src/wxp/variables.ts +0 -109
@@ -1,237 +0,0 @@
1
- /**
2
- * profile-output.ts - Profile markdown generation (CLAUDE.md, dev preferences, questionnaire).
3
- *
4
- * Ported signatures from lib/profile-output.cjs.
5
- */
6
-
7
- import fs from "fs";
8
- import path from "path";
9
- import { gsdError, output, toPosixPath } from "./core.js";
10
-
11
- interface WriteProfileOptions {
12
- input: string;
13
- output?: string | null;
14
- }
15
- interface QuestionnaireOptions {
16
- answers?: string | null;
17
- }
18
- interface DevPreferencesOptions {
19
- analysis?: string | null;
20
- output?: string | null;
21
- stack?: string | null;
22
- }
23
- interface ClaudeProfileOptions {
24
- analysis?: string | null;
25
- output?: string | null;
26
- global?: boolean;
27
- }
28
- interface ClaudeMdOptions {
29
- output?: string | null;
30
- auto?: boolean;
31
- force?: boolean;
32
- /** When 'pi', generates AGENTS.md instead of CLAUDE.md */
33
- harness?: string | null;
34
- }
35
-
36
- // ─── Helpers ──────────────────────────────────────────────────────────────────
37
-
38
- function resolveProfileOutput(
39
- cwd: string,
40
- outputOverride?: string | null,
41
- defaultName = "CLAUDE.md",
42
- ): string {
43
- if (outputOverride) return path.resolve(outputOverride);
44
- return path.join(cwd, defaultName);
45
- }
46
-
47
- /** Shape of the profile analysis JSON file produced by cmdProfileSample. */
48
- interface AnalysisData {
49
- preferences?: string;
50
- patterns?: string;
51
- style?: string;
52
- [key: string]: unknown;
53
- }
54
-
55
- function loadAnalysis(
56
- analysisPath: string | null | undefined,
57
- cwd: string,
58
- ): AnalysisData | null {
59
- if (!analysisPath) return null;
60
- const fullPath = path.isAbsolute(analysisPath)
61
- ? analysisPath
62
- : path.join(cwd, analysisPath);
63
- if (!fs.existsSync(fullPath)) return null;
64
- try {
65
- return JSON.parse(fs.readFileSync(fullPath, "utf-8"));
66
- } catch {
67
- return null;
68
- }
69
- }
70
-
71
- function formatMarkdown(
72
- sections: Array<{ heading: string; body: string }>,
73
- ): string {
74
- return (
75
- sections.map((s) => `## ${s.heading}\n\n${s.body}`).join("\n\n") + "\n"
76
- );
77
- }
78
-
79
- // ─── Commands ─────────────────────────────────────────────────────────────────
80
-
81
- export function cmdWriteProfile(
82
- cwd: string,
83
- options: WriteProfileOptions,
84
- raw: boolean,
85
- ): void {
86
- if (!options.input) gsdError("--input <analysis-json-path> is required");
87
- const analysis = loadAnalysis(options.input, cwd);
88
- if (!analysis) {
89
- output(
90
- { error: "Could not load analysis file", input: options.input },
91
- raw,
92
- );
93
- return;
94
- }
95
- const outPath = resolveProfileOutput(cwd, options.output);
96
- const sections = [];
97
- if (analysis.preferences)
98
- sections.push({
99
- heading: "Development Preferences",
100
- body: analysis.preferences,
101
- });
102
- if (analysis.patterns)
103
- sections.push({ heading: "Patterns Observed", body: analysis.patterns });
104
- if (analysis.style)
105
- sections.push({ heading: "Code Style", body: analysis.style });
106
- const content =
107
- sections.length > 0
108
- ? formatMarkdown(sections)
109
- : JSON.stringify(analysis, null, 2) + "\n";
110
- fs.writeFileSync(outPath, content, "utf-8");
111
- output(
112
- { written: true, path: toPosixPath(path.relative(cwd, outPath)) },
113
- raw,
114
- outPath,
115
- );
116
- }
117
-
118
- export function cmdProfileQuestionnaire(
119
- options: QuestionnaireOptions,
120
- raw: boolean,
121
- ): void {
122
- const questions = [
123
- {
124
- id: "style",
125
- question: "Preferred code style (functional/OOP/mixed)?",
126
- default: "mixed",
127
- },
128
- {
129
- id: "testing",
130
- question: "Testing framework preference?",
131
- default: "vitest/jest",
132
- },
133
- {
134
- id: "comments",
135
- question: "Comment verbosity (minimal/moderate/verbose)?",
136
- default: "moderate",
137
- },
138
- {
139
- id: "error_handling",
140
- question: "Error handling preference (try/catch/result-type)?",
141
- default: "try/catch",
142
- },
143
- ];
144
- if (options.answers) {
145
- try {
146
- const answers = JSON.parse(options.answers);
147
- output({ questionnaire: questions, answers, complete: true }, raw);
148
- } catch {
149
- output({ questionnaire: questions, answers: null, complete: false }, raw);
150
- }
151
- } else {
152
- output(
153
- {
154
- questionnaire: questions,
155
- instructions:
156
- 'Re-run with --answers \'{"style":"...","testing":"..."}\' to record preferences',
157
- },
158
- raw,
159
- );
160
- }
161
- }
162
-
163
- export function cmdGenerateDevPreferences(
164
- cwd: string,
165
- options: DevPreferencesOptions,
166
- raw: boolean,
167
- ): void {
168
- const analysis = loadAnalysis(options.analysis, cwd);
169
- const outPath = resolveProfileOutput(
170
- cwd,
171
- options.output,
172
- ".dev-preferences.md",
173
- );
174
- const stack = options.stack ? `\n\n## Stack\n\n${options.stack}` : "";
175
- const body = analysis
176
- ? `# Developer Preferences\n\n*Generated from session analysis*${stack}\n\n${JSON.stringify(analysis, null, 2)}\n`
177
- : `# Developer Preferences\n\n*No analysis provided - edit manually.*${stack}\n`;
178
- fs.writeFileSync(outPath, body, "utf-8");
179
- output(
180
- { written: true, path: toPosixPath(path.relative(cwd, outPath)) },
181
- raw,
182
- outPath,
183
- );
184
- }
185
-
186
- export function cmdGenerateClaudeProfile(
187
- cwd: string,
188
- options: ClaudeProfileOptions,
189
- raw: boolean,
190
- ): void {
191
- const analysis = loadAnalysis(options.analysis, cwd);
192
- const outPath = options.global
193
- ? path.join(process.env["HOME"] ?? "", ".claude", "CLAUDE.md")
194
- : resolveProfileOutput(cwd, options.output, "CLAUDE.md");
195
- fs.mkdirSync(path.dirname(outPath), { recursive: true });
196
- const body = analysis
197
- ? `# Claude Profile\n\n*Generated from session analysis*\n\n${JSON.stringify(analysis, null, 2)}\n`
198
- : `# Claude Profile\n\n*No analysis provided - edit manually.*\n`;
199
- fs.writeFileSync(outPath, body, "utf-8");
200
- output(
201
- {
202
- written: true,
203
- path: options.global ? outPath : toPosixPath(path.relative(cwd, outPath)),
204
- },
205
- raw,
206
- outPath,
207
- );
208
- }
209
-
210
- export function cmdGenerateClaudeMd(
211
- cwd: string,
212
- options: ClaudeMdOptions,
213
- raw: boolean,
214
- ): void {
215
- const defaultName = options.harness === "pi" ? "AGENTS.md" : "CLAUDE.md";
216
- const outPath = resolveProfileOutput(cwd, options.output, defaultName);
217
- if (fs.existsSync(outPath) && !options.force && !options.auto) {
218
- output(
219
- {
220
- written: false,
221
- reason: "File already exists. Use --force to overwrite.",
222
- path: toPosixPath(path.relative(cwd, outPath)),
223
- },
224
- raw,
225
- "exists",
226
- );
227
- return;
228
- }
229
- const heading = options.harness === "pi" ? "AGENTS.md" : "CLAUDE.md";
230
- const body = `# ${heading}\n\n*Agent profile for this project.*\n\n## Quick Start\n\nSee \`.planning/PROJECT.md\` for project overview.\n\n## GSD Integration\n\nThis project uses GSD (Get Shit Done) for structured development. Run \`/gsd-help\` to see available commands.\n`;
231
- fs.writeFileSync(outPath, body, "utf-8");
232
- output(
233
- { written: true, path: toPosixPath(path.relative(cwd, outPath)) },
234
- raw,
235
- outPath,
236
- );
237
- }