@specforge/mcp 2.6.0 → 3.0.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 (237) hide show
  1. package/README.md +73 -0
  2. package/bin/{specforge-mcp → specforge} +0 -5
  3. package/dist/ai-provider/circuit-breaker.d.ts +63 -0
  4. package/dist/ai-provider/circuit-breaker.d.ts.map +1 -0
  5. package/dist/ai-provider/circuit-breaker.js +160 -0
  6. package/dist/ai-provider/circuit-breaker.js.map +1 -0
  7. package/dist/ai-provider/cli-version.d.ts +50 -0
  8. package/dist/ai-provider/cli-version.d.ts.map +1 -0
  9. package/dist/ai-provider/cli-version.js +141 -0
  10. package/dist/ai-provider/cli-version.js.map +1 -0
  11. package/dist/ai-provider/config-loader.d.ts +45 -0
  12. package/dist/ai-provider/config-loader.d.ts.map +1 -0
  13. package/dist/ai-provider/config-loader.js +106 -0
  14. package/dist/ai-provider/config-loader.js.map +1 -0
  15. package/dist/ai-provider/errors.d.ts +48 -0
  16. package/dist/ai-provider/errors.d.ts.map +1 -0
  17. package/dist/ai-provider/errors.js +102 -0
  18. package/dist/ai-provider/errors.js.map +1 -0
  19. package/dist/ai-provider/events.d.ts +73 -0
  20. package/dist/ai-provider/events.d.ts.map +1 -0
  21. package/dist/ai-provider/events.js +75 -0
  22. package/dist/ai-provider/events.js.map +1 -0
  23. package/dist/ai-provider/factory.d.ts +31 -0
  24. package/dist/ai-provider/factory.d.ts.map +1 -0
  25. package/dist/ai-provider/factory.js +100 -0
  26. package/dist/ai-provider/factory.js.map +1 -0
  27. package/dist/ai-provider/index.d.ts +24 -0
  28. package/dist/ai-provider/index.d.ts.map +1 -0
  29. package/dist/ai-provider/index.js +46 -0
  30. package/dist/ai-provider/index.js.map +1 -0
  31. package/dist/ai-provider/instance-coordinator.d.ts +54 -0
  32. package/dist/ai-provider/instance-coordinator.d.ts.map +1 -0
  33. package/dist/ai-provider/instance-coordinator.js +199 -0
  34. package/dist/ai-provider/instance-coordinator.js.map +1 -0
  35. package/dist/ai-provider/jsonl-parser.d.ts +43 -0
  36. package/dist/ai-provider/jsonl-parser.d.ts.map +1 -0
  37. package/dist/ai-provider/jsonl-parser.js +107 -0
  38. package/dist/ai-provider/jsonl-parser.js.map +1 -0
  39. package/dist/ai-provider/lifecycle.d.ts +50 -0
  40. package/dist/ai-provider/lifecycle.d.ts.map +1 -0
  41. package/dist/ai-provider/lifecycle.js +145 -0
  42. package/dist/ai-provider/lifecycle.js.map +1 -0
  43. package/dist/ai-provider/logger.d.ts +69 -0
  44. package/dist/ai-provider/logger.d.ts.map +1 -0
  45. package/dist/ai-provider/logger.js +161 -0
  46. package/dist/ai-provider/logger.js.map +1 -0
  47. package/dist/ai-provider/metrics.d.ts +91 -0
  48. package/dist/ai-provider/metrics.d.ts.map +1 -0
  49. package/dist/ai-provider/metrics.js +187 -0
  50. package/dist/ai-provider/metrics.js.map +1 -0
  51. package/dist/ai-provider/process-manager.d.ts +97 -0
  52. package/dist/ai-provider/process-manager.d.ts.map +1 -0
  53. package/dist/ai-provider/process-manager.js +477 -0
  54. package/dist/ai-provider/process-manager.js.map +1 -0
  55. package/dist/ai-provider/providers/claude-code.d.ts +64 -0
  56. package/dist/ai-provider/providers/claude-code.d.ts.map +1 -0
  57. package/dist/ai-provider/providers/claude-code.js +205 -0
  58. package/dist/ai-provider/providers/claude-code.js.map +1 -0
  59. package/dist/ai-provider/retry-executor.d.ts +52 -0
  60. package/dist/ai-provider/retry-executor.d.ts.map +1 -0
  61. package/dist/ai-provider/retry-executor.js +138 -0
  62. package/dist/ai-provider/retry-executor.js.map +1 -0
  63. package/dist/ai-provider/safe-args.d.ts +58 -0
  64. package/dist/ai-provider/safe-args.d.ts.map +1 -0
  65. package/dist/ai-provider/safe-args.js +176 -0
  66. package/dist/ai-provider/safe-args.js.map +1 -0
  67. package/dist/ai-provider/semaphore.d.ts +50 -0
  68. package/dist/ai-provider/semaphore.d.ts.map +1 -0
  69. package/dist/ai-provider/semaphore.js +97 -0
  70. package/dist/ai-provider/semaphore.js.map +1 -0
  71. package/dist/ai-provider/tracer.d.ts +67 -0
  72. package/dist/ai-provider/tracer.d.ts.map +1 -0
  73. package/dist/ai-provider/tracer.js +209 -0
  74. package/dist/ai-provider/tracer.js.map +1 -0
  75. package/dist/ai-provider/types.d.ts +181 -0
  76. package/dist/ai-provider/types.d.ts.map +1 -0
  77. package/dist/ai-provider/types.js +8 -0
  78. package/dist/ai-provider/types.js.map +1 -0
  79. package/dist/autopilot/agents/agent-runner.d.ts +109 -0
  80. package/dist/autopilot/agents/agent-runner.d.ts.map +1 -0
  81. package/dist/autopilot/agents/agent-runner.js +731 -0
  82. package/dist/autopilot/agents/agent-runner.js.map +1 -0
  83. package/dist/autopilot/agents/agent-selector.d.ts +59 -0
  84. package/dist/autopilot/agents/agent-selector.d.ts.map +1 -0
  85. package/dist/autopilot/agents/agent-selector.js +234 -0
  86. package/dist/autopilot/agents/agent-selector.js.map +1 -0
  87. package/dist/autopilot/agents/model-selector.d.ts +49 -0
  88. package/dist/autopilot/agents/model-selector.d.ts.map +1 -0
  89. package/dist/autopilot/agents/model-selector.js +62 -0
  90. package/dist/autopilot/agents/model-selector.js.map +1 -0
  91. package/dist/autopilot/agents/profiles/builtin.d.ts +55 -0
  92. package/dist/autopilot/agents/profiles/builtin.d.ts.map +1 -0
  93. package/dist/autopilot/agents/profiles/builtin.js +323 -0
  94. package/dist/autopilot/agents/profiles/builtin.js.map +1 -0
  95. package/dist/autopilot/agents/profiles/types.d.ts +98 -0
  96. package/dist/autopilot/agents/profiles/types.d.ts.map +1 -0
  97. package/dist/autopilot/agents/profiles/types.js +17 -0
  98. package/dist/autopilot/agents/profiles/types.js.map +1 -0
  99. package/dist/autopilot/api/autopilot-api-client.d.ts +217 -0
  100. package/dist/autopilot/api/autopilot-api-client.d.ts.map +1 -0
  101. package/dist/autopilot/api/autopilot-api-client.js +402 -0
  102. package/dist/autopilot/api/autopilot-api-client.js.map +1 -0
  103. package/dist/autopilot/cli/abort.d.ts +20 -0
  104. package/dist/autopilot/cli/abort.d.ts.map +1 -0
  105. package/dist/autopilot/cli/abort.js +201 -0
  106. package/dist/autopilot/cli/abort.js.map +1 -0
  107. package/dist/autopilot/cli/display.d.ts +63 -0
  108. package/dist/autopilot/cli/display.d.ts.map +1 -0
  109. package/dist/autopilot/cli/display.js +260 -0
  110. package/dist/autopilot/cli/display.js.map +1 -0
  111. package/dist/autopilot/cli/index.d.ts +24 -0
  112. package/dist/autopilot/cli/index.d.ts.map +1 -0
  113. package/dist/autopilot/cli/index.js +79 -0
  114. package/dist/autopilot/cli/index.js.map +1 -0
  115. package/dist/autopilot/cli/pause.d.ts +18 -0
  116. package/dist/autopilot/cli/pause.d.ts.map +1 -0
  117. package/dist/autopilot/cli/pause.js +110 -0
  118. package/dist/autopilot/cli/pause.js.map +1 -0
  119. package/dist/autopilot/cli/resume.d.ts +22 -0
  120. package/dist/autopilot/cli/resume.d.ts.map +1 -0
  121. package/dist/autopilot/cli/resume.js +172 -0
  122. package/dist/autopilot/cli/resume.js.map +1 -0
  123. package/dist/autopilot/cli/run.d.ts +25 -0
  124. package/dist/autopilot/cli/run.d.ts.map +1 -0
  125. package/dist/autopilot/cli/run.js +220 -0
  126. package/dist/autopilot/cli/run.js.map +1 -0
  127. package/dist/autopilot/cli/status.d.ts +20 -0
  128. package/dist/autopilot/cli/status.d.ts.map +1 -0
  129. package/dist/autopilot/cli/status.js +217 -0
  130. package/dist/autopilot/cli/status.js.map +1 -0
  131. package/dist/autopilot/config.d.ts +45 -0
  132. package/dist/autopilot/config.d.ts.map +1 -0
  133. package/dist/autopilot/config.js +269 -0
  134. package/dist/autopilot/config.js.map +1 -0
  135. package/dist/autopilot/core/dependency-resolver.d.ts +108 -0
  136. package/dist/autopilot/core/dependency-resolver.d.ts.map +1 -0
  137. package/dist/autopilot/core/dependency-resolver.js +394 -0
  138. package/dist/autopilot/core/dependency-resolver.js.map +1 -0
  139. package/dist/autopilot/core/dispatcher.d.ts +215 -0
  140. package/dist/autopilot/core/dispatcher.d.ts.map +1 -0
  141. package/dist/autopilot/core/dispatcher.js +594 -0
  142. package/dist/autopilot/core/dispatcher.js.map +1 -0
  143. package/dist/autopilot/core/failure-handler.d.ts +145 -0
  144. package/dist/autopilot/core/failure-handler.d.ts.map +1 -0
  145. package/dist/autopilot/core/failure-handler.js +308 -0
  146. package/dist/autopilot/core/failure-handler.js.map +1 -0
  147. package/dist/autopilot/core/rate-limit-handler.d.ts +108 -0
  148. package/dist/autopilot/core/rate-limit-handler.d.ts.map +1 -0
  149. package/dist/autopilot/core/rate-limit-handler.js +195 -0
  150. package/dist/autopilot/core/rate-limit-handler.js.map +1 -0
  151. package/dist/autopilot/core/state-manager.d.ts +160 -0
  152. package/dist/autopilot/core/state-manager.d.ts.map +1 -0
  153. package/dist/autopilot/core/state-manager.js +393 -0
  154. package/dist/autopilot/core/state-manager.js.map +1 -0
  155. package/dist/autopilot/core/timeout-manager.d.ts +95 -0
  156. package/dist/autopilot/core/timeout-manager.d.ts.map +1 -0
  157. package/dist/autopilot/core/timeout-manager.js +188 -0
  158. package/dist/autopilot/core/timeout-manager.js.map +1 -0
  159. package/dist/autopilot/git/branch-manager.d.ts +117 -0
  160. package/dist/autopilot/git/branch-manager.d.ts.map +1 -0
  161. package/dist/autopilot/git/branch-manager.js +238 -0
  162. package/dist/autopilot/git/branch-manager.js.map +1 -0
  163. package/dist/autopilot/git/index.d.ts +9 -0
  164. package/dist/autopilot/git/index.d.ts.map +1 -0
  165. package/dist/autopilot/git/index.js +9 -0
  166. package/dist/autopilot/git/index.js.map +1 -0
  167. package/dist/autopilot/git/merge-manager.d.ts +118 -0
  168. package/dist/autopilot/git/merge-manager.d.ts.map +1 -0
  169. package/dist/autopilot/git/merge-manager.js +304 -0
  170. package/dist/autopilot/git/merge-manager.js.map +1 -0
  171. package/dist/autopilot/git/worktree-manager.d.ts +128 -0
  172. package/dist/autopilot/git/worktree-manager.d.ts.map +1 -0
  173. package/dist/autopilot/git/worktree-manager.js +298 -0
  174. package/dist/autopilot/git/worktree-manager.js.map +1 -0
  175. package/dist/autopilot/index.d.ts +30 -0
  176. package/dist/autopilot/index.d.ts.map +1 -0
  177. package/dist/autopilot/index.js +55 -0
  178. package/dist/autopilot/index.js.map +1 -0
  179. package/dist/autopilot/sync/index.d.ts +7 -0
  180. package/dist/autopilot/sync/index.d.ts.map +1 -0
  181. package/dist/autopilot/sync/index.js +7 -0
  182. package/dist/autopilot/sync/index.js.map +1 -0
  183. package/dist/autopilot/sync/sync-manager.d.ts +168 -0
  184. package/dist/autopilot/sync/sync-manager.d.ts.map +1 -0
  185. package/dist/autopilot/sync/sync-manager.js +303 -0
  186. package/dist/autopilot/sync/sync-manager.js.map +1 -0
  187. package/dist/autopilot/types.d.ts +454 -0
  188. package/dist/autopilot/types.d.ts.map +1 -0
  189. package/dist/autopilot/types.js +26 -0
  190. package/dist/autopilot/types.js.map +1 -0
  191. package/dist/autopilot/utils/audit-logger.d.ts +176 -0
  192. package/dist/autopilot/utils/audit-logger.d.ts.map +1 -0
  193. package/dist/autopilot/utils/audit-logger.js +308 -0
  194. package/dist/autopilot/utils/audit-logger.js.map +1 -0
  195. package/dist/autopilot/utils/cost-tracker.d.ts +162 -0
  196. package/dist/autopilot/utils/cost-tracker.d.ts.map +1 -0
  197. package/dist/autopilot/utils/cost-tracker.js +269 -0
  198. package/dist/autopilot/utils/cost-tracker.js.map +1 -0
  199. package/dist/autopilot/utils/index.d.ts +9 -0
  200. package/dist/autopilot/utils/index.d.ts.map +1 -0
  201. package/dist/autopilot/utils/index.js +9 -0
  202. package/dist/autopilot/utils/index.js.map +1 -0
  203. package/dist/autopilot/utils/progress-reporter.d.ts +132 -0
  204. package/dist/autopilot/utils/progress-reporter.d.ts.map +1 -0
  205. package/dist/autopilot/utils/progress-reporter.js +290 -0
  206. package/dist/autopilot/utils/progress-reporter.js.map +1 -0
  207. package/dist/autopilot/worker/worker-pool.d.ts +179 -0
  208. package/dist/autopilot/worker/worker-pool.d.ts.map +1 -0
  209. package/dist/autopilot/worker/worker-pool.js +331 -0
  210. package/dist/autopilot/worker/worker-pool.js.map +1 -0
  211. package/dist/autopilot/worker/worker-session.d.ts +171 -0
  212. package/dist/autopilot/worker/worker-session.d.ts.map +1 -0
  213. package/dist/autopilot/worker/worker-session.js +295 -0
  214. package/dist/autopilot/worker/worker-session.js.map +1 -0
  215. package/dist/cli/index.d.ts +1 -1
  216. package/dist/cli/index.d.ts.map +1 -1
  217. package/dist/cli/index.js +4 -1
  218. package/dist/cli/index.js.map +1 -1
  219. package/dist/index.js +0 -1
  220. package/dist/index.js.map +1 -1
  221. package/dist/tools/core/epic.js +1 -1
  222. package/dist/tools/core/epic.js.map +1 -1
  223. package/dist/tools/core/lookup.d.ts.map +1 -1
  224. package/dist/tools/core/lookup.js +3 -2
  225. package/dist/tools/core/lookup.js.map +1 -1
  226. package/dist/tools/core/specification.js +1 -1
  227. package/dist/tools/core/specification.js.map +1 -1
  228. package/dist/tools/core/ticket.d.ts.map +1 -1
  229. package/dist/tools/core/ticket.js +4 -6
  230. package/dist/tools/core/ticket.js.map +1 -1
  231. package/dist/tools/index.d.ts.map +1 -1
  232. package/dist/tools/index.js +60 -0
  233. package/dist/tools/index.js.map +1 -1
  234. package/dist/validation/index.d.ts.map +1 -1
  235. package/dist/validation/index.js +4 -1
  236. package/dist/validation/index.js.map +1 -1
  237. package/package.json +8 -4
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Worktree Manager
3
+ *
4
+ * Manages git worktrees for parallel autopilot workers.
5
+ */
6
+ import { exec } from 'child_process';
7
+ import { promisify } from 'util';
8
+ import * as fs from 'fs/promises';
9
+ import * as path from 'path';
10
+ import { EventEmitter } from 'events';
11
+ import { createBranchManager } from './branch-manager.js';
12
+ const execAsync = promisify(exec);
13
+ /**
14
+ * Worktree Manager
15
+ *
16
+ * Creates and manages git worktrees for parallel worker execution.
17
+ */
18
+ export class WorktreeManager extends EventEmitter {
19
+ workingDirectory;
20
+ worktreeBaseDir;
21
+ branchManager;
22
+ workerPaths = new Map();
23
+ constructor(options) {
24
+ super();
25
+ this.workingDirectory = options.workingDirectory;
26
+ this.worktreeBaseDir = options.worktreeBaseDir || path.join(options.workingDirectory, '.worktrees');
27
+ this.branchManager = createBranchManager({
28
+ workingDirectory: options.workingDirectory,
29
+ branchPrefix: options.branchPrefix,
30
+ });
31
+ }
32
+ /**
33
+ * Initialize the worktree base directory
34
+ */
35
+ async initialize() {
36
+ await fs.mkdir(this.worktreeBaseDir, { recursive: true });
37
+ // Add .worktrees to .gitignore if not present
38
+ await this.ensureGitignore();
39
+ }
40
+ /**
41
+ * Ensure .worktrees is in .gitignore
42
+ */
43
+ async ensureGitignore() {
44
+ const gitignorePath = path.join(this.workingDirectory, '.gitignore');
45
+ try {
46
+ let content = '';
47
+ try {
48
+ content = await fs.readFile(gitignorePath, 'utf-8');
49
+ }
50
+ catch {
51
+ // File doesn't exist
52
+ }
53
+ const worktreeEntry = '.worktrees/';
54
+ if (!content.includes(worktreeEntry)) {
55
+ const newContent = content.endsWith('\n') || content.length === 0
56
+ ? `${content}${worktreeEntry}\n`
57
+ : `${content}\n${worktreeEntry}\n`;
58
+ await fs.writeFile(gitignorePath, newContent);
59
+ }
60
+ }
61
+ catch {
62
+ // Ignore gitignore errors
63
+ }
64
+ }
65
+ /**
66
+ * Create a worktree for a worker
67
+ */
68
+ async createWorkerWorktree(workerId, baseBranch) {
69
+ const worktreePath = this.getWorkerPath(workerId);
70
+ const branchName = this.branchManager.getWorkerBranchName(workerId);
71
+ // Check if worktree already exists
72
+ if (this.workerPaths.has(workerId)) {
73
+ const existingPath = this.workerPaths.get(workerId);
74
+ if (await this.pathExists(existingPath)) {
75
+ return existingPath;
76
+ }
77
+ }
78
+ // Remove stale worktree if it exists
79
+ await this.removeWorkerWorktree(workerId);
80
+ // Get base branch
81
+ const base = baseBranch || await this.branchManager.getBaseBranch();
82
+ // Create the branch if it doesn't exist
83
+ if (!(await this.branchManager.branchExists(branchName))) {
84
+ await this.branchManager.createBranch(branchName, base);
85
+ }
86
+ // Create worktree
87
+ try {
88
+ await execAsync(`git worktree add "${worktreePath}" ${branchName}`, {
89
+ cwd: this.workingDirectory,
90
+ });
91
+ this.workerPaths.set(workerId, worktreePath);
92
+ this.emit('worktree:created', {
93
+ workerId,
94
+ path: worktreePath,
95
+ branch: branchName,
96
+ });
97
+ return worktreePath;
98
+ }
99
+ catch (error) {
100
+ const errorMessage = error.message;
101
+ this.emit('worktree:error', { workerId, error: errorMessage });
102
+ throw new Error(`Failed to create worktree for worker ${workerId}: ${errorMessage}`);
103
+ }
104
+ }
105
+ /**
106
+ * Remove a worker's worktree
107
+ */
108
+ async removeWorkerWorktree(workerId) {
109
+ const worktreePath = this.getWorkerPath(workerId);
110
+ try {
111
+ // Check if worktree is registered with git
112
+ const worktrees = await this.listWorktrees();
113
+ const worktree = worktrees.find(w => w.path === worktreePath);
114
+ if (worktree) {
115
+ // Remove the git worktree
116
+ await execAsync(`git worktree remove "${worktreePath}" --force`, {
117
+ cwd: this.workingDirectory,
118
+ });
119
+ }
120
+ else if (await this.pathExists(worktreePath)) {
121
+ // Just remove the directory if it's not a registered worktree
122
+ await fs.rm(worktreePath, { recursive: true, force: true });
123
+ }
124
+ this.workerPaths.delete(workerId);
125
+ this.emit('worktree:removed', { workerId, path: worktreePath });
126
+ }
127
+ catch (error) {
128
+ // Try force removal of directory
129
+ try {
130
+ await fs.rm(worktreePath, { recursive: true, force: true });
131
+ this.workerPaths.delete(workerId);
132
+ }
133
+ catch {
134
+ // Ignore cleanup errors
135
+ }
136
+ }
137
+ }
138
+ /**
139
+ * Get worktree path for a worker
140
+ */
141
+ getWorkerPath(workerId) {
142
+ return path.join(this.worktreeBaseDir, `worker-${workerId}`);
143
+ }
144
+ /**
145
+ * List all git worktrees
146
+ */
147
+ async listWorktrees() {
148
+ try {
149
+ const { stdout } = await execAsync('git worktree list --porcelain', {
150
+ cwd: this.workingDirectory,
151
+ });
152
+ const worktrees = [];
153
+ let current = {};
154
+ for (const line of stdout.split('\n')) {
155
+ if (line.startsWith('worktree ')) {
156
+ if (current.path) {
157
+ worktrees.push(current);
158
+ }
159
+ current = {
160
+ path: line.substring('worktree '.length),
161
+ isLocked: false,
162
+ isPrunable: false,
163
+ };
164
+ }
165
+ else if (line.startsWith('HEAD ')) {
166
+ current.head = line.substring('HEAD '.length);
167
+ }
168
+ else if (line.startsWith('branch ')) {
169
+ current.branch = line.substring('branch '.length).replace('refs/heads/', '');
170
+ }
171
+ else if (line === 'locked') {
172
+ current.isLocked = true;
173
+ }
174
+ else if (line === 'prunable') {
175
+ current.isPrunable = true;
176
+ }
177
+ }
178
+ if (current.path) {
179
+ worktrees.push(current);
180
+ }
181
+ return worktrees;
182
+ }
183
+ catch {
184
+ return [];
185
+ }
186
+ }
187
+ /**
188
+ * Get worktree for a specific worker
189
+ */
190
+ async getWorkerWorktree(workerId) {
191
+ const worktrees = await this.listWorktrees();
192
+ const worktreePath = this.getWorkerPath(workerId);
193
+ return worktrees.find(w => w.path === worktreePath);
194
+ }
195
+ /**
196
+ * Prune stale worktrees
197
+ */
198
+ async pruneWorktrees() {
199
+ await execAsync('git worktree prune', {
200
+ cwd: this.workingDirectory,
201
+ });
202
+ }
203
+ /**
204
+ * Cleanup all worker worktrees
205
+ */
206
+ async cleanupAllWorktrees() {
207
+ // Get all worker paths
208
+ const workerIds = [...this.workerPaths.keys()];
209
+ // Remove each worker's worktree
210
+ for (const workerId of workerIds) {
211
+ await this.removeWorkerWorktree(workerId);
212
+ }
213
+ // Prune any stale worktrees
214
+ await this.pruneWorktrees();
215
+ // Try to remove the base directory if empty
216
+ try {
217
+ const contents = await fs.readdir(this.worktreeBaseDir);
218
+ if (contents.length === 0) {
219
+ await fs.rmdir(this.worktreeBaseDir);
220
+ }
221
+ }
222
+ catch {
223
+ // Ignore directory removal errors
224
+ }
225
+ }
226
+ /**
227
+ * Get number of active worktrees
228
+ */
229
+ getActiveWorktreeCount() {
230
+ return this.workerPaths.size;
231
+ }
232
+ /**
233
+ * Check if a path exists
234
+ */
235
+ async pathExists(p) {
236
+ try {
237
+ await fs.access(p);
238
+ return true;
239
+ }
240
+ catch {
241
+ return false;
242
+ }
243
+ }
244
+ /**
245
+ * Lock a worktree
246
+ */
247
+ async lockWorktree(workerId, reason) {
248
+ const worktreePath = this.getWorkerPath(workerId);
249
+ const reasonArg = reason ? `--reason "${reason}"` : '';
250
+ await execAsync(`git worktree lock "${worktreePath}" ${reasonArg}`, {
251
+ cwd: this.workingDirectory,
252
+ });
253
+ }
254
+ /**
255
+ * Unlock a worktree
256
+ */
257
+ async unlockWorktree(workerId) {
258
+ const worktreePath = this.getWorkerPath(workerId);
259
+ await execAsync(`git worktree unlock "${worktreePath}"`, {
260
+ cwd: this.workingDirectory,
261
+ });
262
+ }
263
+ /**
264
+ * Move a worktree to a new location
265
+ */
266
+ async moveWorktree(workerId, newPath) {
267
+ const oldPath = this.getWorkerPath(workerId);
268
+ await execAsync(`git worktree move "${oldPath}" "${newPath}"`, {
269
+ cwd: this.workingDirectory,
270
+ });
271
+ this.workerPaths.set(workerId, newPath);
272
+ }
273
+ /**
274
+ * Get the branch manager
275
+ */
276
+ getBranchManager() {
277
+ return this.branchManager;
278
+ }
279
+ /**
280
+ * Get worktree base directory
281
+ */
282
+ getWorktreeBaseDir() {
283
+ return this.worktreeBaseDir;
284
+ }
285
+ /**
286
+ * Get working directory
287
+ */
288
+ getWorkingDirectory() {
289
+ return this.workingDirectory;
290
+ }
291
+ }
292
+ /**
293
+ * Create a worktree manager
294
+ */
295
+ export function createWorktreeManager(options) {
296
+ return new WorktreeManager(options);
297
+ }
298
+ //# sourceMappingURL=worktree-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree-manager.js","sourceRoot":"","sources":["../../../src/autopilot/git/worktree-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAA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AmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SpecForge Autopilot Module
3
+ *
4
+ * Autonomous ticket implementation engine for SpecForge.
5
+ */
6
+ export type { AutopilotStatus, WorkerStatus, TicketResult, AutopilotState, TokenUsage, RateLimitInfo, FailedTicket, WorkerSession, FileMatcher, AgentProfile, AutopilotAIProviderConfig, BranchStrategy, AutopilotConfig, QueuedTicket, DependencyNode, AutopilotEventMap, RunSummary, TicketContext, ImplementationResult, AuditEventType, AuditLogEntry, ProgressInfo, } from './types.js';
7
+ export { DEFAULT_AUTOPILOT_CONFIG } from './types.js';
8
+ export { loadAutopilotConfig, resolveAutopilotConfig, validateAutopilotConfig, getConfigFilePath, hasAutopilotConfig, mergeWithDefaults, } from './config.js';
9
+ export { AutopilotApiClient } from './api/autopilot-api-client.js';
10
+ export { StateManager, createStateManager, STATE_FILE_NAME, } from './core/state-manager.js';
11
+ export { DependencyResolver, createDependencyResolver, } from './core/dependency-resolver.js';
12
+ export { TimeoutManager, createTimeoutManager, } from './core/timeout-manager.js';
13
+ export { FailureHandler, createFailureHandler, } from './core/failure-handler.js';
14
+ export { RateLimitHandler, createRateLimitHandler, } from './core/rate-limit-handler.js';
15
+ export { Dispatcher, createDispatcher, } from './core/dispatcher.js';
16
+ export { WorkerSession as WorkerSessionClass, createWorkerSession, } from './worker/worker-session.js';
17
+ export { WorkerPool, createWorkerPool, } from './worker/worker-pool.js';
18
+ export { AgentRunner, createAgentRunner, } from './agents/agent-runner.js';
19
+ export { AgentSelector, createAgentSelector, } from './agents/agent-selector.js';
20
+ export { builtinProfiles, generalProfile, frontendReactProfile, backendLambdaProfile, getBuiltinProfile, } from './agents/profiles/builtin.js';
21
+ export type { AgentProfile as AgentProfileType, ProfileMatch, ProfileMatchContext, ValidationCommand, } from './agents/profiles/types.js';
22
+ export { BranchManager, createBranchManager, } from './git/branch-manager.js';
23
+ export { WorktreeManager, createWorktreeManager, } from './git/worktree-manager.js';
24
+ export { MergeManager, createMergeManager, } from './git/merge-manager.js';
25
+ export { CostTracker, createCostTracker, MODEL_PRICING, } from './utils/cost-tracker.js';
26
+ export { AuditLogger, createAuditLogger, } from './utils/audit-logger.js';
27
+ export { ProgressReporter, createProgressReporter, } from './utils/progress-reporter.js';
28
+ export { SyncManager, createSyncManager, } from './sync/sync-manager.js';
29
+ export { registerAutopilotCommands } from './cli/index.js';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autopilot/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,YAAY,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAKtD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,oBAAoB,G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 @@
1
+ /**
2
+ * SpecForge Autopilot Module
3
+ *
4
+ * Autonomous ticket implementation engine for SpecForge.
5
+ */
6
+ export { DEFAULT_AUTOPILOT_CONFIG } from './types.js';
7
+ // ============================================================================
8
+ // Configuration
9
+ // ============================================================================
10
+ export { loadAutopilotConfig, resolveAutopilotConfig, validateAutopilotConfig, getConfigFilePath, hasAutopilotConfig, mergeWithDefaults, } from './config.js';
11
+ // ============================================================================
12
+ // API Client
13
+ // ============================================================================
14
+ export { AutopilotApiClient } from './api/autopilot-api-client.js';
15
+ // ============================================================================
16
+ // Core
17
+ // ============================================================================
18
+ export { StateManager, createStateManager, STATE_FILE_NAME, } from './core/state-manager.js';
19
+ export { DependencyResolver, createDependencyResolver, } from './core/dependency-resolver.js';
20
+ export { TimeoutManager, createTimeoutManager, } from './core/timeout-manager.js';
21
+ export { FailureHandler, createFailureHandler, } from './core/failure-handler.js';
22
+ export { RateLimitHandler, createRateLimitHandler, } from './core/rate-limit-handler.js';
23
+ export { Dispatcher, createDispatcher, } from './core/dispatcher.js';
24
+ // ============================================================================
25
+ // Workers
26
+ // ============================================================================
27
+ export { WorkerSession as WorkerSessionClass, createWorkerSession, } from './worker/worker-session.js';
28
+ export { WorkerPool, createWorkerPool, } from './worker/worker-pool.js';
29
+ // ============================================================================
30
+ // Agents
31
+ // ============================================================================
32
+ export { AgentRunner, createAgentRunner, } from './agents/agent-runner.js';
33
+ export { AgentSelector, createAgentSelector, } from './agents/agent-selector.js';
34
+ export { builtinProfiles, generalProfile, frontendReactProfile, backendLambdaProfile, getBuiltinProfile, } from './agents/profiles/builtin.js';
35
+ // ============================================================================
36
+ // Git
37
+ // ============================================================================
38
+ export { BranchManager, createBranchManager, } from './git/branch-manager.js';
39
+ export { WorktreeManager, createWorktreeManager, } from './git/worktree-manager.js';
40
+ export { MergeManager, createMergeManager, } from './git/merge-manager.js';
41
+ // ============================================================================
42
+ // Utilities
43
+ // ============================================================================
44
+ export { CostTracker, createCostTracker, MODEL_PRICING, } from './utils/cost-tracker.js';
45
+ export { AuditLogger, createAuditLogger, } from './utils/audit-logger.js';
46
+ export { ProgressReporter, createProgressReporter, } from './utils/progress-reporter.js';
47
+ // ============================================================================
48
+ // Sync
49
+ // ============================================================================
50
+ export { SyncManager, createSyncManager, } from './sync/sync-manager.js';
51
+ // ============================================================================
52
+ // CLI
53
+ // ============================================================================
54
+ export { registerAutopilotCommands } from './cli/index.js';
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autopilot/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8BH,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,+EAA+E;AAC/E,OAAO;AACP,+EAA+E;AAC/E,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAC/E,OAAO,EACL,aAAa,IAAI,kBAAkB,EACnC,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,UAAU,EACV,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAStC,+EAA+E;AAC/E,MAAM;AACN,+EAA+E;AAC/E,OAAO,EACL,aAAa,EACb,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,YAAY,EACZ,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,+EAA+E;AAC/E,OAAO;AACP,+EAA+E;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAC/E,MAAM;AACN,+EAA+E;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sync Module
3
+ *
4
+ * Exports for API state synchronization.
5
+ */
6
+ export * from './sync-manager.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/autopilot/sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sync Module
3
+ *
4
+ * Exports for API state synchronization.
5
+ */
6
+ export * from './sync-manager.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/autopilot/sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Sync Manager
3
+ *
4
+ * Synchronizes autopilot state with the API.
5
+ */
6
+ import { EventEmitter } from 'events';
7
+ import type { AutopilotState, TokenUsage } from '../types.js';
8
+ import type { AutopilotApiClient } from '../api/autopilot-api-client.js';
9
+ /**
10
+ * Sync status
11
+ */
12
+ export type SyncStatus = 'idle' | 'syncing' | 'error' | 'offline';
13
+ /**
14
+ * Sync result
15
+ */
16
+ export interface SyncResult {
17
+ success: boolean;
18
+ timestamp: Date;
19
+ error?: string;
20
+ latencyMs: number;
21
+ }
22
+ /**
23
+ * Sync Manager Options
24
+ */
25
+ export interface SyncManagerOptions {
26
+ apiClient: AutopilotApiClient;
27
+ syncIntervalMs?: number;
28
+ maxRetries?: number;
29
+ retryDelayMs?: number;
30
+ }
31
+ /**
32
+ * Sync Manager Events
33
+ */
34
+ export interface SyncManagerEvents {
35
+ 'sync:started': void;
36
+ 'sync:completed': {
37
+ result: SyncResult;
38
+ };
39
+ 'sync:failed': {
40
+ error: string;
41
+ retryCount: number;
42
+ };
43
+ 'sync:offline': void;
44
+ 'sync:reconnected': void;
45
+ }
46
+ /**
47
+ * State update for sync
48
+ */
49
+ export interface StateUpdate {
50
+ runId: string;
51
+ status: string;
52
+ completedTickets: string[];
53
+ failedTickets: Array<{
54
+ ticketId: string;
55
+ error: string;
56
+ retryCount: number;
57
+ }>;
58
+ currentEpic?: string;
59
+ totalCostUsd: number;
60
+ totalTokens: TokenUsage;
61
+ workers: Array<{
62
+ workerId: number;
63
+ status: string;
64
+ currentTicketId?: string;
65
+ completedCount: number;
66
+ failedCount: number;
67
+ costUsd: number;
68
+ }>;
69
+ updatedAt: string;
70
+ }
71
+ /**
72
+ * Sync Manager
73
+ *
74
+ * Handles periodic synchronization of autopilot state to the API.
75
+ */
76
+ export declare class SyncManager extends EventEmitter {
77
+ private apiClient;
78
+ private syncIntervalMs;
79
+ private maxRetries;
80
+ private retryDelayMs;
81
+ private syncTimer?;
82
+ private status;
83
+ private lastSync?;
84
+ private lastSyncResult?;
85
+ private retryCount;
86
+ private isOffline;
87
+ private pendingState?;
88
+ constructor(options: SyncManagerOptions);
89
+ /**
90
+ * Start periodic sync
91
+ */
92
+ start(): void;
93
+ /**
94
+ * Stop periodic sync
95
+ */
96
+ stop(): void;
97
+ /**
98
+ * Queue state for sync
99
+ */
100
+ queueSync(state: AutopilotState): void;
101
+ /**
102
+ * Sync state immediately
103
+ */
104
+ syncState(state: AutopilotState): Promise<SyncResult>;
105
+ /**
106
+ * Build state update from autopilot state
107
+ */
108
+ private buildStateUpdate;
109
+ /**
110
+ * Sync ticket completion
111
+ */
112
+ syncTicketCompleted(ticketId: string, result: {
113
+ success: boolean;
114
+ output?: string;
115
+ filesModified?: string[];
116
+ tokensUsed?: TokenUsage;
117
+ costUsd?: number;
118
+ commitHash?: string;
119
+ }): Promise<void>;
120
+ /**
121
+ * Sync run completion
122
+ */
123
+ syncRunCompleted(state: AutopilotState, summary: {
124
+ status: string;
125
+ completedCount: number;
126
+ failedCount: number;
127
+ totalCostUsd: number;
128
+ totalTokens: TokenUsage;
129
+ durationMs: number;
130
+ }): Promise<void>;
131
+ /**
132
+ * Get sync status
133
+ */
134
+ getStatus(): SyncStatus;
135
+ /**
136
+ * Get last sync time
137
+ */
138
+ getLastSync(): Date | undefined;
139
+ /**
140
+ * Get last sync result
141
+ */
142
+ getLastSyncResult(): SyncResult | undefined;
143
+ /**
144
+ * Check if offline
145
+ */
146
+ isOfflineMode(): boolean;
147
+ /**
148
+ * Get retry count
149
+ */
150
+ getRetryCount(): number;
151
+ /**
152
+ * Force reconnect attempt
153
+ */
154
+ reconnect(): Promise<boolean>;
155
+ /**
156
+ * Get sync interval
157
+ */
158
+ getSyncInterval(): number;
159
+ /**
160
+ * Set sync interval
161
+ */
162
+ setSyncInterval(ms: number): void;
163
+ }
164
+ /**
165
+ * Create a sync manager
166
+ */
167
+ export declare function createSyncManager(options: SyncManagerOptions): SyncManager;
168
+ //# sourceMappingURL=sync-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-manager.d.ts","sourceRoot":"","sources":["../../../src/autopilot/sync/sync-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,IAAI,CAAC;IACrB,gBAAgB,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE,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