gsd-pi 0.1.0

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 (128) hide show
  1. package/README.md +341 -0
  2. package/dist/app-paths.d.ts +4 -0
  3. package/dist/app-paths.js +6 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +35 -0
  6. package/dist/loader.d.ts +2 -0
  7. package/dist/loader.js +69 -0
  8. package/dist/modes/interactive/theme/dark.json +85 -0
  9. package/dist/modes/interactive/theme/light.json +84 -0
  10. package/dist/modes/interactive/theme/theme-schema.json +335 -0
  11. package/dist/modes/interactive/theme/theme.d.ts +78 -0
  12. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  13. package/dist/modes/interactive/theme/theme.js +949 -0
  14. package/dist/modes/interactive/theme/theme.js.map +1 -0
  15. package/dist/resource-loader.d.ts +22 -0
  16. package/dist/resource-loader.js +48 -0
  17. package/dist/wizard.d.ts +20 -0
  18. package/dist/wizard.js +132 -0
  19. package/package.json +39 -0
  20. package/pkg/dist/modes/interactive/theme/dark.json +85 -0
  21. package/pkg/dist/modes/interactive/theme/light.json +84 -0
  22. package/pkg/dist/modes/interactive/theme/theme-schema.json +335 -0
  23. package/pkg/dist/modes/interactive/theme/theme.d.ts +78 -0
  24. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  25. package/pkg/dist/modes/interactive/theme/theme.js +949 -0
  26. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -0
  27. package/pkg/package.json +8 -0
  28. package/scripts/postinstall.js +10 -0
  29. package/src/resources/AGENTS.md +204 -0
  30. package/src/resources/GSD-WORKFLOW.md +661 -0
  31. package/src/resources/agents/researcher.md +29 -0
  32. package/src/resources/agents/scout.md +56 -0
  33. package/src/resources/agents/worker.md +31 -0
  34. package/src/resources/extensions/ask-user-questions.ts +200 -0
  35. package/src/resources/extensions/bg-shell/index.ts +2554 -0
  36. package/src/resources/extensions/browser-tools/BROWSER-TOOLS-V2-PROPOSAL.md +1277 -0
  37. package/src/resources/extensions/browser-tools/core.js +1057 -0
  38. package/src/resources/extensions/browser-tools/index.ts +4916 -0
  39. package/src/resources/extensions/browser-tools/package.json +20 -0
  40. package/src/resources/extensions/context7/index.ts +428 -0
  41. package/src/resources/extensions/context7/package.json +11 -0
  42. package/src/resources/extensions/get-secrets-from-user.ts +352 -0
  43. package/src/resources/extensions/gsd/activity-log.ts +48 -0
  44. package/src/resources/extensions/gsd/auto.ts +2032 -0
  45. package/src/resources/extensions/gsd/commands.ts +292 -0
  46. package/src/resources/extensions/gsd/crash-recovery.ts +85 -0
  47. package/src/resources/extensions/gsd/dashboard-overlay.ts +516 -0
  48. package/src/resources/extensions/gsd/docs/preferences-reference.md +103 -0
  49. package/src/resources/extensions/gsd/doctor.ts +683 -0
  50. package/src/resources/extensions/gsd/files.ts +730 -0
  51. package/src/resources/extensions/gsd/gitignore.ts +104 -0
  52. package/src/resources/extensions/gsd/guided-flow.ts +800 -0
  53. package/src/resources/extensions/gsd/index.ts +418 -0
  54. package/src/resources/extensions/gsd/metrics.ts +372 -0
  55. package/src/resources/extensions/gsd/observability-validator.ts +408 -0
  56. package/src/resources/extensions/gsd/package.json +11 -0
  57. package/src/resources/extensions/gsd/paths.ts +308 -0
  58. package/src/resources/extensions/gsd/preferences.ts +600 -0
  59. package/src/resources/extensions/gsd/prompt-loader.ts +50 -0
  60. package/src/resources/extensions/gsd/prompts/complete-milestone.md +25 -0
  61. package/src/resources/extensions/gsd/prompts/complete-slice.md +27 -0
  62. package/src/resources/extensions/gsd/prompts/discuss.md +151 -0
  63. package/src/resources/extensions/gsd/prompts/doctor-heal.md +29 -0
  64. package/src/resources/extensions/gsd/prompts/execute-task.md +64 -0
  65. package/src/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -0
  66. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -0
  67. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +59 -0
  68. package/src/resources/extensions/gsd/prompts/guided-execute-task.md +1 -0
  69. package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +23 -0
  70. package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -0
  71. package/src/resources/extensions/gsd/prompts/guided-research-slice.md +11 -0
  72. package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -0
  73. package/src/resources/extensions/gsd/prompts/plan-milestone.md +47 -0
  74. package/src/resources/extensions/gsd/prompts/plan-slice.md +63 -0
  75. package/src/resources/extensions/gsd/prompts/queue.md +85 -0
  76. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +48 -0
  77. package/src/resources/extensions/gsd/prompts/replan-slice.md +39 -0
  78. package/src/resources/extensions/gsd/prompts/research-milestone.md +37 -0
  79. package/src/resources/extensions/gsd/prompts/research-slice.md +28 -0
  80. package/src/resources/extensions/gsd/prompts/run-uat.md +109 -0
  81. package/src/resources/extensions/gsd/prompts/system.md +220 -0
  82. package/src/resources/extensions/gsd/session-forensics.ts +487 -0
  83. package/src/resources/extensions/gsd/skill-discovery.ts +137 -0
  84. package/src/resources/extensions/gsd/state.ts +439 -0
  85. package/src/resources/extensions/gsd/templates/context.md +76 -0
  86. package/src/resources/extensions/gsd/templates/decisions.md +8 -0
  87. package/src/resources/extensions/gsd/templates/milestone-summary.md +73 -0
  88. package/src/resources/extensions/gsd/templates/plan.md +133 -0
  89. package/src/resources/extensions/gsd/templates/preferences.md +15 -0
  90. package/src/resources/extensions/gsd/templates/project.md +31 -0
  91. package/src/resources/extensions/gsd/templates/reassessment.md +28 -0
  92. package/src/resources/extensions/gsd/templates/requirements.md +81 -0
  93. package/src/resources/extensions/gsd/templates/research.md +46 -0
  94. package/src/resources/extensions/gsd/templates/roadmap.md +118 -0
  95. package/src/resources/extensions/gsd/templates/slice-context.md +58 -0
  96. package/src/resources/extensions/gsd/templates/slice-summary.md +99 -0
  97. package/src/resources/extensions/gsd/templates/state.md +19 -0
  98. package/src/resources/extensions/gsd/templates/task-plan.md +52 -0
  99. package/src/resources/extensions/gsd/templates/task-summary.md +57 -0
  100. package/src/resources/extensions/gsd/templates/uat.md +54 -0
  101. package/src/resources/extensions/gsd/types.ts +159 -0
  102. package/src/resources/extensions/gsd/unit-runtime.ts +162 -0
  103. package/src/resources/extensions/gsd/workspace-index.ts +203 -0
  104. package/src/resources/extensions/gsd/worktree.ts +182 -0
  105. package/src/resources/extensions/plan-mode/README.md +65 -0
  106. package/src/resources/extensions/plan-mode/index.ts +521 -0
  107. package/src/resources/extensions/plan-mode/utils.ts +168 -0
  108. package/src/resources/extensions/search-the-web/cache.ts +70 -0
  109. package/src/resources/extensions/search-the-web/format.ts +134 -0
  110. package/src/resources/extensions/search-the-web/http.ts +147 -0
  111. package/src/resources/extensions/search-the-web/index.ts +46 -0
  112. package/src/resources/extensions/search-the-web/tool-fetch-page.ts +374 -0
  113. package/src/resources/extensions/search-the-web/tool-search.ts +424 -0
  114. package/src/resources/extensions/search-the-web/url-utils.ts +91 -0
  115. package/src/resources/extensions/shared/interview-ui.ts +613 -0
  116. package/src/resources/extensions/shared/next-action-ui.ts +197 -0
  117. package/src/resources/extensions/shared/progress-widget.ts +282 -0
  118. package/src/resources/extensions/shared/thinking-widget.ts +107 -0
  119. package/src/resources/extensions/shared/ui.ts +400 -0
  120. package/src/resources/extensions/shared/wizard-ui.ts +551 -0
  121. package/src/resources/extensions/slash-commands/audit.ts +88 -0
  122. package/src/resources/extensions/slash-commands/create-extension.ts +297 -0
  123. package/src/resources/extensions/slash-commands/create-slash-command.ts +234 -0
  124. package/src/resources/extensions/slash-commands/gsd-run.ts +34 -0
  125. package/src/resources/extensions/slash-commands/index.ts +12 -0
  126. package/src/resources/extensions/subagent/agents.ts +126 -0
  127. package/src/resources/extensions/subagent/index.ts +1021 -0
  128. package/src/resources/extensions/worktree/index.ts +420 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * GSD Slice Branch Management
3
+ *
4
+ * Simple branch-per-slice workflow. No worktrees, no registry.
5
+ * Runtime state (metrics, activity, lock, STATE.md) is gitignored
6
+ * so branch switches are clean.
7
+ *
8
+ * Flow:
9
+ * 1. ensureSliceBranch() — create + checkout slice branch
10
+ * 2. agent does work, commits
11
+ * 3. mergeSliceToMain() — checkout main, squash-merge, delete branch
12
+ */
13
+
14
+ import { existsSync } from "node:fs";
15
+ import { execSync } from "node:child_process";
16
+
17
+ export interface MergeSliceResult {
18
+ branch: string;
19
+ mergedCommitMessage: string;
20
+ deletedBranch: boolean;
21
+ }
22
+
23
+ function runGit(basePath: string, args: string[], options: { allowFailure?: boolean } = {}): string {
24
+ try {
25
+ return execSync(`git ${args.join(" ")}`, {
26
+ cwd: basePath,
27
+ stdio: ["ignore", "pipe", "pipe"],
28
+ encoding: "utf-8",
29
+ }).trim();
30
+ } catch (error) {
31
+ if (options.allowFailure) return "";
32
+ const message = error instanceof Error ? error.message : String(error);
33
+ throw new Error(`git ${args.join(" ")} failed in ${basePath}: ${message}`);
34
+ }
35
+ }
36
+
37
+ export function getSliceBranchName(milestoneId: string, sliceId: string): string {
38
+ return `gsd/${milestoneId}/${sliceId}`;
39
+ }
40
+
41
+ export function getMainBranch(basePath: string): string {
42
+ const symbolic = runGit(basePath, ["symbolic-ref", "refs/remotes/origin/HEAD"], { allowFailure: true });
43
+ if (symbolic) {
44
+ const match = symbolic.match(/refs\/remotes\/origin\/(.+)$/);
45
+ if (match) return match[1]!;
46
+ }
47
+
48
+ const mainExists = runGit(basePath, ["show-ref", "--verify", "refs/heads/main"], { allowFailure: true });
49
+ if (mainExists) return "main";
50
+
51
+ const masterExists = runGit(basePath, ["show-ref", "--verify", "refs/heads/master"], { allowFailure: true });
52
+ if (masterExists) return "master";
53
+
54
+ return runGit(basePath, ["branch", "--show-current"]);
55
+ }
56
+
57
+ export function getCurrentBranch(basePath: string): string {
58
+ return runGit(basePath, ["branch", "--show-current"]);
59
+ }
60
+
61
+ function branchExists(basePath: string, branch: string): boolean {
62
+ try {
63
+ runGit(basePath, ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`]);
64
+ return true;
65
+ } catch {
66
+ return false;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Ensure the slice branch exists and is checked out.
72
+ * Creates the branch from main if it doesn't exist.
73
+ * Returns true if the branch was newly created.
74
+ */
75
+ export function ensureSliceBranch(basePath: string, milestoneId: string, sliceId: string): boolean {
76
+ const branch = getSliceBranchName(milestoneId, sliceId);
77
+ const current = getCurrentBranch(basePath);
78
+
79
+ if (current === branch) return false;
80
+
81
+ const mainBranch = getMainBranch(basePath);
82
+ let created = false;
83
+
84
+ if (!branchExists(basePath, branch)) {
85
+ runGit(basePath, ["branch", branch, mainBranch]);
86
+ created = true;
87
+ }
88
+
89
+ runGit(basePath, ["checkout", branch]);
90
+ return created;
91
+ }
92
+
93
+ /**
94
+ * Auto-commit any dirty files in the current working tree.
95
+ * Returns the commit message used, or null if already clean.
96
+ */
97
+ export function autoCommitCurrentBranch(
98
+ basePath: string, unitType: string, unitId: string,
99
+ ): string | null {
100
+ const status = runGit(basePath, ["status", "--short"]);
101
+ if (!status.trim()) return null;
102
+
103
+ runGit(basePath, ["add", "-A"]);
104
+
105
+ const staged = runGit(basePath, ["diff", "--cached", "--stat"]);
106
+ if (!staged.trim()) return null;
107
+
108
+ const message = `chore(${unitId}): auto-commit after ${unitType}`;
109
+ runGit(basePath, ["commit", "-m", JSON.stringify(message)]);
110
+ return message;
111
+ }
112
+
113
+ /**
114
+ * Switch to main, auto-committing any dirty files on the current branch first.
115
+ */
116
+ export function switchToMain(basePath: string): void {
117
+ const mainBranch = getMainBranch(basePath);
118
+ const current = getCurrentBranch(basePath);
119
+ if (current === mainBranch) return;
120
+
121
+ // Auto-commit if dirty
122
+ autoCommitCurrentBranch(basePath, "pre-switch", current);
123
+
124
+ runGit(basePath, ["checkout", mainBranch]);
125
+ }
126
+
127
+ /**
128
+ * Squash-merge a completed slice branch to main.
129
+ * Expects to already be on main (call switchToMain first).
130
+ * Deletes the branch after merge.
131
+ */
132
+ export function mergeSliceToMain(
133
+ basePath: string, milestoneId: string, sliceId: string, sliceTitle: string,
134
+ ): MergeSliceResult {
135
+ const branch = getSliceBranchName(milestoneId, sliceId);
136
+ const mainBranch = getMainBranch(basePath);
137
+
138
+ const current = getCurrentBranch(basePath);
139
+ if (current !== mainBranch) {
140
+ throw new Error(`Expected to be on ${mainBranch}, found ${current}`);
141
+ }
142
+
143
+ if (!branchExists(basePath, branch)) {
144
+ throw new Error(`Slice branch ${branch} does not exist`);
145
+ }
146
+
147
+ const ahead = runGit(basePath, ["rev-list", "--count", `${mainBranch}..${branch}`]);
148
+ if (Number(ahead) <= 0) {
149
+ throw new Error(`Slice branch ${branch} has no commits ahead of ${mainBranch}`);
150
+ }
151
+
152
+ runGit(basePath, ["merge", "--squash", branch]);
153
+ const mergedCommitMessage = `feat(${milestoneId}/${sliceId}): ${sliceTitle}`;
154
+ runGit(basePath, ["commit", "-m", JSON.stringify(mergedCommitMessage)]);
155
+ runGit(basePath, ["branch", "-D", branch]);
156
+
157
+ return {
158
+ branch,
159
+ mergedCommitMessage,
160
+ deletedBranch: true,
161
+ };
162
+ }
163
+
164
+ /**
165
+ * Check if we're currently on a slice branch (not main).
166
+ */
167
+ export function isOnSliceBranch(basePath: string): boolean {
168
+ const current = getCurrentBranch(basePath);
169
+ return current.startsWith("gsd/");
170
+ }
171
+
172
+ /**
173
+ * Get the active slice branch name, or null if on main.
174
+ */
175
+ export function getActiveSliceBranch(basePath: string): string | null {
176
+ try {
177
+ const current = getCurrentBranch(basePath);
178
+ return current.startsWith("gsd/") ? current : null;
179
+ } catch {
180
+ return null;
181
+ }
182
+ }
@@ -0,0 +1,65 @@
1
+ # Plan Mode Extension
2
+
3
+ Read-only exploration mode for safe code analysis.
4
+
5
+ ## Features
6
+
7
+ - **Read-only tools**: Restricts available tools to read, bash, grep, find, ls, question
8
+ - **Bash allowlist**: Only read-only bash commands are allowed
9
+ - **Plan extraction**: Extracts numbered steps from `Plan:` sections
10
+ - **Progress tracking**: Widget shows completion status during execution
11
+ - **[DONE:n] markers**: Explicit step completion tracking
12
+ - **Session persistence**: State survives session resume
13
+
14
+ ## Commands
15
+
16
+ - `/plan` - Toggle plan mode
17
+ - `/todos` - Show current plan progress
18
+ - `Ctrl+Alt+P` - Toggle plan mode (shortcut)
19
+
20
+ ## Usage
21
+
22
+ 1. Enable plan mode with `/plan` or `--plan` flag
23
+ 2. Ask the agent to analyze code and create a plan
24
+ 3. The agent should output a numbered plan under a `Plan:` header:
25
+
26
+ ```
27
+ Plan:
28
+ 1. First step description
29
+ 2. Second step description
30
+ 3. Third step description
31
+ ```
32
+
33
+ 4. Choose "Execute the plan" when prompted
34
+ 5. During execution, the agent marks steps complete with `[DONE:n]` tags
35
+ 6. Progress widget shows completion status
36
+
37
+ ## How It Works
38
+
39
+ ### Plan Mode (Read-Only)
40
+ - Only read-only tools available
41
+ - Bash commands filtered through allowlist
42
+ - Agent creates a plan without making changes
43
+
44
+ ### Execution Mode
45
+ - Full tool access restored
46
+ - Agent executes steps in order
47
+ - `[DONE:n]` markers track completion
48
+ - Widget shows progress
49
+
50
+ ### Command Allowlist
51
+
52
+ Safe commands (allowed):
53
+ - File inspection: `cat`, `head`, `tail`, `less`, `more`
54
+ - Search: `grep`, `find`, `rg`, `fd`
55
+ - Directory: `ls`, `pwd`, `tree`
56
+ - Git read: `git status`, `git log`, `git diff`, `git branch`
57
+ - Package info: `npm list`, `npm outdated`, `yarn info`
58
+ - System info: `uname`, `whoami`, `date`, `uptime`
59
+
60
+ Blocked commands:
61
+ - File modification: `rm`, `mv`, `cp`, `mkdir`, `touch`
62
+ - Git write: `git add`, `git commit`, `git push`
63
+ - Package install: `npm install`, `yarn add`, `pip install`
64
+ - System: `sudo`, `kill`, `reboot`
65
+ - Editors: `vim`, `nano`, `code`