ghcralph 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 (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +327 -0
  3. package/bin/ghcralph.js +2 -0
  4. package/dist/cli.d.ts +12 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +92 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/config.d.ts +8 -0
  9. package/dist/commands/config.d.ts.map +1 -0
  10. package/dist/commands/config.js +118 -0
  11. package/dist/commands/config.js.map +1 -0
  12. package/dist/commands/index.d.ts +11 -0
  13. package/dist/commands/index.d.ts.map +1 -0
  14. package/dist/commands/index.js +11 -0
  15. package/dist/commands/index.js.map +1 -0
  16. package/dist/commands/init.d.ts +15 -0
  17. package/dist/commands/init.d.ts.map +1 -0
  18. package/dist/commands/init.js +116 -0
  19. package/dist/commands/init.js.map +1 -0
  20. package/dist/commands/rollback.d.ts +8 -0
  21. package/dist/commands/rollback.d.ts.map +1 -0
  22. package/dist/commands/rollback.js +238 -0
  23. package/dist/commands/rollback.js.map +1 -0
  24. package/dist/commands/run.d.ts +28 -0
  25. package/dist/commands/run.d.ts.map +1 -0
  26. package/dist/commands/run.js +407 -0
  27. package/dist/commands/run.js.map +1 -0
  28. package/dist/commands/status.d.ts +8 -0
  29. package/dist/commands/status.d.ts.map +1 -0
  30. package/dist/commands/status.js +399 -0
  31. package/dist/commands/status.js.map +1 -0
  32. package/dist/core/action-executor.d.ts +96 -0
  33. package/dist/core/action-executor.d.ts.map +1 -0
  34. package/dist/core/action-executor.js +289 -0
  35. package/dist/core/action-executor.js.map +1 -0
  36. package/dist/core/checkpoint-manager.d.ts +94 -0
  37. package/dist/core/checkpoint-manager.d.ts.map +1 -0
  38. package/dist/core/checkpoint-manager.js +236 -0
  39. package/dist/core/checkpoint-manager.js.map +1 -0
  40. package/dist/core/config-manager.d.ts +62 -0
  41. package/dist/core/config-manager.d.ts.map +1 -0
  42. package/dist/core/config-manager.js +184 -0
  43. package/dist/core/config-manager.js.map +1 -0
  44. package/dist/core/config-schema.d.ts +74 -0
  45. package/dist/core/config-schema.d.ts.map +1 -0
  46. package/dist/core/config-schema.js +84 -0
  47. package/dist/core/config-schema.js.map +1 -0
  48. package/dist/core/context-builder.d.ts +116 -0
  49. package/dist/core/context-builder.d.ts.map +1 -0
  50. package/dist/core/context-builder.js +388 -0
  51. package/dist/core/context-builder.js.map +1 -0
  52. package/dist/core/feedback-builder.d.ts +94 -0
  53. package/dist/core/feedback-builder.d.ts.map +1 -0
  54. package/dist/core/feedback-builder.js +226 -0
  55. package/dist/core/feedback-builder.js.map +1 -0
  56. package/dist/core/file-safeguard.d.ts +109 -0
  57. package/dist/core/file-safeguard.d.ts.map +1 -0
  58. package/dist/core/file-safeguard.js +200 -0
  59. package/dist/core/file-safeguard.js.map +1 -0
  60. package/dist/core/git-branch-manager.d.ts +122 -0
  61. package/dist/core/git-branch-manager.d.ts.map +1 -0
  62. package/dist/core/git-branch-manager.js +302 -0
  63. package/dist/core/git-branch-manager.js.map +1 -0
  64. package/dist/core/github-plan.d.ts +86 -0
  65. package/dist/core/github-plan.d.ts.map +1 -0
  66. package/dist/core/github-plan.js +333 -0
  67. package/dist/core/github-plan.js.map +1 -0
  68. package/dist/core/index.d.ts +43 -0
  69. package/dist/core/index.d.ts.map +1 -0
  70. package/dist/core/index.js +26 -0
  71. package/dist/core/index.js.map +1 -0
  72. package/dist/core/local-markdown-plan.d.ts +65 -0
  73. package/dist/core/local-markdown-plan.d.ts.map +1 -0
  74. package/dist/core/local-markdown-plan.js +154 -0
  75. package/dist/core/local-markdown-plan.js.map +1 -0
  76. package/dist/core/loop-engine.d.ts +133 -0
  77. package/dist/core/loop-engine.d.ts.map +1 -0
  78. package/dist/core/loop-engine.js +420 -0
  79. package/dist/core/loop-engine.js.map +1 -0
  80. package/dist/core/loop-events.d.ts +48 -0
  81. package/dist/core/loop-events.d.ts.map +1 -0
  82. package/dist/core/loop-events.js +24 -0
  83. package/dist/core/loop-events.js.map +1 -0
  84. package/dist/core/loop-state.d.ts +51 -0
  85. package/dist/core/loop-state.d.ts.map +1 -0
  86. package/dist/core/loop-state.js +48 -0
  87. package/dist/core/loop-state.js.map +1 -0
  88. package/dist/core/markdown-parser.d.ts +51 -0
  89. package/dist/core/markdown-parser.d.ts.map +1 -0
  90. package/dist/core/markdown-parser.js +122 -0
  91. package/dist/core/markdown-parser.js.map +1 -0
  92. package/dist/core/plan-manager.d.ts +61 -0
  93. package/dist/core/plan-manager.d.ts.map +1 -0
  94. package/dist/core/plan-manager.js +7 -0
  95. package/dist/core/plan-manager.js.map +1 -0
  96. package/dist/core/progress-tracker.d.ts +74 -0
  97. package/dist/core/progress-tracker.d.ts.map +1 -0
  98. package/dist/core/progress-tracker.js +198 -0
  99. package/dist/core/progress-tracker.js.map +1 -0
  100. package/dist/core/prompt-examples.d.ts +52 -0
  101. package/dist/core/prompt-examples.d.ts.map +1 -0
  102. package/dist/core/prompt-examples.js +194 -0
  103. package/dist/core/prompt-examples.js.map +1 -0
  104. package/dist/core/response-parser.d.ts +90 -0
  105. package/dist/core/response-parser.d.ts.map +1 -0
  106. package/dist/core/response-parser.js +209 -0
  107. package/dist/core/response-parser.js.map +1 -0
  108. package/dist/core/verification-hooks.d.ts +103 -0
  109. package/dist/core/verification-hooks.d.ts.map +1 -0
  110. package/dist/core/verification-hooks.js +268 -0
  111. package/dist/core/verification-hooks.js.map +1 -0
  112. package/dist/index.d.ts +13 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.js +17 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/integrations/auth.d.ts +28 -0
  117. package/dist/integrations/auth.d.ts.map +1 -0
  118. package/dist/integrations/auth.js +76 -0
  119. package/dist/integrations/auth.js.map +1 -0
  120. package/dist/integrations/copilot-agent.d.ts +104 -0
  121. package/dist/integrations/copilot-agent.d.ts.map +1 -0
  122. package/dist/integrations/copilot-agent.js +235 -0
  123. package/dist/integrations/copilot-agent.js.map +1 -0
  124. package/dist/integrations/index.d.ts +18 -0
  125. package/dist/integrations/index.d.ts.map +1 -0
  126. package/dist/integrations/index.js +14 -0
  127. package/dist/integrations/index.js.map +1 -0
  128. package/dist/integrations/mcp-tools.d.ts +129 -0
  129. package/dist/integrations/mcp-tools.d.ts.map +1 -0
  130. package/dist/integrations/mcp-tools.js +272 -0
  131. package/dist/integrations/mcp-tools.js.map +1 -0
  132. package/dist/integrations/tokens.d.ts +45 -0
  133. package/dist/integrations/tokens.d.ts.map +1 -0
  134. package/dist/integrations/tokens.js +50 -0
  135. package/dist/integrations/tokens.js.map +1 -0
  136. package/dist/types/index.d.ts +53 -0
  137. package/dist/types/index.d.ts.map +1 -0
  138. package/dist/types/index.js +7 -0
  139. package/dist/types/index.js.map +1 -0
  140. package/dist/utils/index.d.ts +23 -0
  141. package/dist/utils/index.d.ts.map +1 -0
  142. package/dist/utils/index.js +37 -0
  143. package/dist/utils/index.js.map +1 -0
  144. package/dist/utils/output.d.ts +59 -0
  145. package/dist/utils/output.d.ts.map +1 -0
  146. package/dist/utils/output.js +96 -0
  147. package/dist/utils/output.js.map +1 -0
  148. package/dist/utils/paths.d.ts +34 -0
  149. package/dist/utils/paths.d.ts.map +1 -0
  150. package/dist/utils/paths.js +67 -0
  151. package/dist/utils/paths.js.map +1 -0
  152. package/dist/utils/shell.d.ts +26 -0
  153. package/dist/utils/shell.d.ts.map +1 -0
  154. package/dist/utils/shell.js +65 -0
  155. package/dist/utils/shell.js.map +1 -0
  156. package/dist/utils/validation.d.ts +27 -0
  157. package/dist/utils/validation.d.ts.map +1 -0
  158. package/dist/utils/validation.js +43 -0
  159. package/dist/utils/validation.js.map +1 -0
  160. package/package.json +86 -0
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Verification Hooks
3
+ *
4
+ * Implements objective exit criteria for the Ralph loop.
5
+ * The original Ralph pattern requires external, objective verification
6
+ * (tests pass, build succeeds) rather than trusting the AI to say "I'm done".
7
+ */
8
+ import { exec } from 'node:child_process';
9
+ import { promisify } from 'node:util';
10
+ import fs from 'node:fs/promises';
11
+ import path from 'node:path';
12
+ import { debug, info, warn } from '../utils/index.js';
13
+ const execAsync = promisify(exec);
14
+ /**
15
+ * Default hooks based on common project patterns
16
+ */
17
+ export function detectDefaultHooks(_cwd) {
18
+ const hooks = [];
19
+ // These will be populated asynchronously, so this returns a starting point
20
+ // The actual detection happens in VerificationManager.initialize()
21
+ return hooks;
22
+ }
23
+ /**
24
+ * Verification Manager
25
+ *
26
+ * Runs objective verification hooks after each iteration to determine
27
+ * if the task is actually complete (not just AI-declared complete).
28
+ */
29
+ export class VerificationManager {
30
+ config;
31
+ detectedHooks = [];
32
+ initialized = false;
33
+ constructor(config = {}) {
34
+ this.config = {
35
+ cwd: config.cwd ?? process.cwd(),
36
+ hooks: config.hooks ?? [],
37
+ stopOnFirstFailure: config.stopOnFirstFailure ?? true,
38
+ };
39
+ }
40
+ /**
41
+ * Initialize by detecting available verification hooks
42
+ */
43
+ async initialize() {
44
+ if (this.initialized)
45
+ return;
46
+ const cwd = this.config.cwd;
47
+ // Detect npm scripts
48
+ try {
49
+ const packageJsonPath = path.join(cwd, 'package.json');
50
+ const content = await fs.readFile(packageJsonPath, 'utf-8');
51
+ const pkg = JSON.parse(content);
52
+ if (pkg.scripts) {
53
+ // Check for test script
54
+ if (pkg.scripts['test']) {
55
+ this.detectedHooks.push({
56
+ type: 'test',
57
+ command: 'npm test',
58
+ name: 'npm test',
59
+ required: true,
60
+ timeoutMs: 120000, // 2 minutes
61
+ });
62
+ }
63
+ // Check for build script
64
+ if (pkg.scripts['build']) {
65
+ this.detectedHooks.push({
66
+ type: 'build',
67
+ command: 'npm run build',
68
+ name: 'npm build',
69
+ required: true,
70
+ timeoutMs: 120000,
71
+ });
72
+ }
73
+ // Check for lint script
74
+ if (pkg.scripts['lint']) {
75
+ this.detectedHooks.push({
76
+ type: 'lint',
77
+ command: 'npm run lint',
78
+ name: 'npm lint',
79
+ required: false, // Lint failures shouldn't block completion
80
+ timeoutMs: 60000,
81
+ });
82
+ }
83
+ }
84
+ }
85
+ catch {
86
+ debug('No package.json found or unable to parse');
87
+ }
88
+ // Detect Makefile
89
+ try {
90
+ await fs.access(path.join(cwd, 'Makefile'));
91
+ // Check for common targets
92
+ const makefileContent = await fs.readFile(path.join(cwd, 'Makefile'), 'utf-8');
93
+ if (makefileContent.includes('test:')) {
94
+ this.detectedHooks.push({
95
+ type: 'test',
96
+ command: 'make test',
97
+ name: 'make test',
98
+ required: true,
99
+ timeoutMs: 120000,
100
+ });
101
+ }
102
+ if (makefileContent.includes('build:')) {
103
+ this.detectedHooks.push({
104
+ type: 'build',
105
+ command: 'make build',
106
+ name: 'make build',
107
+ required: true,
108
+ timeoutMs: 120000,
109
+ });
110
+ }
111
+ }
112
+ catch {
113
+ debug('No Makefile found');
114
+ }
115
+ // Detect pytest
116
+ try {
117
+ await fs.access(path.join(cwd, 'pytest.ini'));
118
+ this.detectedHooks.push({
119
+ type: 'test',
120
+ command: 'pytest',
121
+ name: 'pytest',
122
+ required: true,
123
+ timeoutMs: 120000,
124
+ });
125
+ }
126
+ catch {
127
+ // Also check for pyproject.toml with pytest
128
+ try {
129
+ const pyprojectPath = path.join(cwd, 'pyproject.toml');
130
+ const content = await fs.readFile(pyprojectPath, 'utf-8');
131
+ if (content.includes('[tool.pytest')) {
132
+ this.detectedHooks.push({
133
+ type: 'test',
134
+ command: 'pytest',
135
+ name: 'pytest',
136
+ required: true,
137
+ timeoutMs: 120000,
138
+ });
139
+ }
140
+ }
141
+ catch {
142
+ debug('No pytest configuration found');
143
+ }
144
+ }
145
+ this.initialized = true;
146
+ debug(`Detected ${this.detectedHooks.length} verification hooks`);
147
+ }
148
+ /**
149
+ * Get all configured hooks (explicit + detected)
150
+ */
151
+ getHooks() {
152
+ return [...this.config.hooks, ...this.detectedHooks];
153
+ }
154
+ /**
155
+ * Add a custom hook
156
+ */
157
+ addHook(hook) {
158
+ this.config.hooks.push(hook);
159
+ }
160
+ /**
161
+ * Run a single verification hook
162
+ */
163
+ async runHook(hook) {
164
+ const startTime = Date.now();
165
+ const name = hook.name ?? hook.command;
166
+ info(`Running verification: ${name}`);
167
+ try {
168
+ const { stdout, stderr } = await execAsync(hook.command, {
169
+ cwd: this.config.cwd,
170
+ timeout: hook.timeoutMs,
171
+ maxBuffer: 5 * 1024 * 1024, // 5MB
172
+ });
173
+ const durationMs = Date.now() - startTime;
174
+ const output = stdout + (stderr ? `\nSTDERR:\n${stderr}` : '');
175
+ info(`✓ ${name} passed (${durationMs}ms)`);
176
+ return {
177
+ passed: true,
178
+ hookType: hook.type,
179
+ message: `${name} passed`,
180
+ output: output.trim(),
181
+ durationMs,
182
+ };
183
+ }
184
+ catch (err) {
185
+ const durationMs = Date.now() - startTime;
186
+ const execError = err;
187
+ const output = (execError.stdout ?? '') + (execError.stderr ? `\nSTDERR:\n${execError.stderr}` : '');
188
+ const message = execError.killed
189
+ ? `${name} timed out after ${hook.timeoutMs}ms`
190
+ : `${name} failed`;
191
+ warn(`✗ ${message}`);
192
+ const result = {
193
+ passed: false,
194
+ hookType: hook.type,
195
+ message,
196
+ output: output.trim(),
197
+ durationMs,
198
+ };
199
+ if (execError.message) {
200
+ result.error = execError.message;
201
+ }
202
+ return result;
203
+ }
204
+ }
205
+ /**
206
+ * Run all verification hooks
207
+ */
208
+ async runAll() {
209
+ await this.initialize();
210
+ const hooks = this.getHooks();
211
+ if (hooks.length === 0) {
212
+ debug('No verification hooks configured');
213
+ return [];
214
+ }
215
+ const results = [];
216
+ for (const hook of hooks) {
217
+ const result = await this.runHook(hook);
218
+ results.push(result);
219
+ // Stop on first failure if configured
220
+ if (!result.passed && hook.required && this.config.stopOnFirstFailure) {
221
+ debug('Stopping verification on first required failure');
222
+ break;
223
+ }
224
+ }
225
+ return results;
226
+ }
227
+ /**
228
+ * Check if all required hooks passed
229
+ */
230
+ allRequiredPassed(results) {
231
+ const hooks = this.getHooks();
232
+ const requiredHooks = hooks.filter((h) => h.required);
233
+ if (requiredHooks.length === 0) {
234
+ return true; // No required hooks = passes by default
235
+ }
236
+ // Check that all required hook types have at least one passing result
237
+ for (const hook of requiredHooks) {
238
+ const matchingResults = results.filter((r) => r.hookType === hook.type && (hook.name ? r.message.includes(hook.name) : true));
239
+ if (matchingResults.length === 0 || !matchingResults.some((r) => r.passed)) {
240
+ return false;
241
+ }
242
+ }
243
+ return true;
244
+ }
245
+ /**
246
+ * Get a summary of verification results
247
+ */
248
+ getSummary(results) {
249
+ if (results.length === 0) {
250
+ return 'No verification hooks ran';
251
+ }
252
+ const passed = results.filter((r) => r.passed).length;
253
+ const failed = results.filter((r) => !r.passed).length;
254
+ const lines = [`Verification: ${passed} passed, ${failed} failed`];
255
+ for (const result of results) {
256
+ const icon = result.passed ? '✓' : '✗';
257
+ lines.push(` ${icon} ${result.message} (${result.durationMs}ms)`);
258
+ }
259
+ return lines.join('\n');
260
+ }
261
+ }
262
+ /**
263
+ * Create a verification manager with custom configuration
264
+ */
265
+ export function createVerificationManager(config) {
266
+ return new VerificationManager(config);
267
+ }
268
+ //# sourceMappingURL=verification-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification-hooks.js","sourceRoot":"","sources":["../../src/core/verification-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAqDlC;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,MAAM,KAAK,GAAuB,EAAE,CAAC;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,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,2BAA2B,CAAC;QACrC,CAAC;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QACtD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAEvD,MAAM,KAAK,GAAa,CAAC,iBAAiB,MAAM,YAAY,MAAM,SAAS,CAAC,CAAC;QAE7E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,UAAU,KAAK,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAoC;IAEpC,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * GitHub Copilot Ralph CLI - Entry Point
3
+ *
4
+ * A cross-platform CLI for running autonomous agentic coding loops
5
+ * using the Ralph Wiggum pattern with GitHub Copilot.
6
+ *
7
+ * Original concept by Geoffrey Huntley (https://ghuntley.com/ralph/)
8
+ * This implementation by Raphael Pothin (https://github.com/rpothin)
9
+ */
10
+ export declare const VERSION: string;
11
+ export declare const NAME = "ghcralph";
12
+ export {};
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,eAAO,MAAM,OAAO,QAAc,CAAC;AACnC,eAAO,MAAM,IAAI,aAAa,CAAC;AAG/B,OAAO,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * GitHub Copilot Ralph CLI - Entry Point
3
+ *
4
+ * A cross-platform CLI for running autonomous agentic coding loops
5
+ * using the Ralph Wiggum pattern with GitHub Copilot.
6
+ *
7
+ * Original concept by Geoffrey Huntley (https://ghuntley.com/ralph/)
8
+ * This implementation by Raphael Pothin (https://github.com/rpothin)
9
+ */
10
+ import { readFileSync } from 'node:fs';
11
+ import { dirname, join } from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
15
+ export const VERSION = pkg.version;
16
+ export const NAME = 'ghcralph';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAwB,CAAC;AAE3G,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;AACnC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * GitHub Authentication
3
+ *
4
+ * Handles authentication with GitHub for Copilot access
5
+ */
6
+ /**
7
+ * Authentication result
8
+ */
9
+ export interface AuthResult {
10
+ /** Whether authentication succeeded */
11
+ authenticated: boolean;
12
+ /** Authentication token if available */
13
+ token?: string;
14
+ /** Authentication method used */
15
+ method?: 'gh-cli' | 'env-token' | 'none';
16
+ /** Error message if authentication failed */
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Get GitHub authentication using available methods
21
+ * Priority: 1. GitHub CLI, 2. Environment variable
22
+ */
23
+ export declare function getGitHubAuth(): AuthResult;
24
+ /**
25
+ * Check if GitHub authentication is available
26
+ */
27
+ export declare function isAuthenticated(): boolean;
28
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/integrations/auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;IACzC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA8CD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAoB1C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * GitHub Authentication
3
+ *
4
+ * Handles authentication with GitHub for Copilot access
5
+ */
6
+ import { execSync } from 'node:child_process';
7
+ import { debug, warn } from '../utils/index.js';
8
+ /**
9
+ * Try to get authentication from the GitHub CLI
10
+ */
11
+ function tryGhCliAuth() {
12
+ try {
13
+ // Check if gh is available and authenticated
14
+ const token = execSync('gh auth token', {
15
+ encoding: 'utf-8',
16
+ stdio: ['pipe', 'pipe', 'pipe'],
17
+ }).trim();
18
+ if (token) {
19
+ debug('Authenticated via GitHub CLI');
20
+ return {
21
+ authenticated: true,
22
+ token,
23
+ method: 'gh-cli',
24
+ };
25
+ }
26
+ }
27
+ catch {
28
+ debug('GitHub CLI authentication not available');
29
+ }
30
+ return { authenticated: false };
31
+ }
32
+ /**
33
+ * Try to get authentication from environment variable
34
+ */
35
+ function tryEnvAuth() {
36
+ const token = process.env['GITHUB_TOKEN'] ?? process.env['GH_TOKEN'] ?? process.env['COPILOT_CLI_USAGE_TOKEN'];
37
+ if (token) {
38
+ debug('Authenticated via environment token');
39
+ return {
40
+ authenticated: true,
41
+ token,
42
+ method: 'env-token',
43
+ };
44
+ }
45
+ return { authenticated: false };
46
+ }
47
+ /**
48
+ * Get GitHub authentication using available methods
49
+ * Priority: 1. GitHub CLI, 2. Environment variable
50
+ */
51
+ export function getGitHubAuth() {
52
+ // Try GitHub CLI first
53
+ const ghCliResult = tryGhCliAuth();
54
+ if (ghCliResult.authenticated) {
55
+ return ghCliResult;
56
+ }
57
+ // Try environment variable
58
+ const envResult = tryEnvAuth();
59
+ if (envResult.authenticated) {
60
+ return envResult;
61
+ }
62
+ // No authentication available
63
+ warn('No GitHub authentication found');
64
+ return {
65
+ authenticated: false,
66
+ method: 'none',
67
+ error: 'No GitHub authentication available. Run "gh auth login" or set GITHUB_TOKEN.',
68
+ };
69
+ }
70
+ /**
71
+ * Check if GitHub authentication is available
72
+ */
73
+ export function isAuthenticated() {
74
+ return getGitHubAuth().authenticated;
75
+ }
76
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/integrations/auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAgBhD;;G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ACnB,CAAC;IAED,8BAA8B;IAC9B,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACvC,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,8EAA8E;KACtF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,EAAE,CAAC,aAAa,CAAC;AACvC,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Copilot Agent
3
+ *
4
+ * Integration with GitHub Copilot for AI agent capabilities
5
+ * Uses the @github/copilot-sdk for actual Copilot API access
6
+ */
7
+ import { type TokenUsage } from './tokens.js';
8
+ /**
9
+ * Available Copilot models
10
+ */
11
+ export type CopilotModel = 'gpt-4' | 'gpt-4.1' | 'gpt-4-turbo' | 'gpt-5' | 'claude-sonnet-4.5' | string;
12
+ /**
13
+ * Copilot agent configuration
14
+ */
15
+ export interface CopilotAgentConfig {
16
+ /** Model to use for completions */
17
+ model: CopilotModel;
18
+ /** Maximum tokens per request */
19
+ maxTokensPerRequest: number;
20
+ /** Number of retries on failure */
21
+ maxRetries: number;
22
+ /** Delay between retries in ms */
23
+ retryDelayMs: number;
24
+ /** Working directory for file operations */
25
+ cwd: string;
26
+ }
27
+ /**
28
+ * Execution result from the agent
29
+ */
30
+ export interface ExecutionResult {
31
+ /** Whether the execution succeeded */
32
+ success: boolean;
33
+ /** Response content */
34
+ content?: string;
35
+ /** Token usage for this request */
36
+ tokenUsage?: TokenUsage;
37
+ /** Error message if failed */
38
+ error?: string;
39
+ }
40
+ /**
41
+ * Error types for Copilot API
42
+ */
43
+ export declare class CopilotError extends Error {
44
+ readonly code: string;
45
+ readonly retryable: boolean;
46
+ constructor(message: string, code: string, retryable?: boolean);
47
+ }
48
+ /**
49
+ * CopilotAgent class for interacting with GitHub Copilot
50
+ */
51
+ export declare class CopilotAgent {
52
+ private config;
53
+ private tokenTracker;
54
+ private authResult;
55
+ private initialized;
56
+ private client;
57
+ private session;
58
+ constructor(config?: Partial<CopilotAgentConfig>);
59
+ /**
60
+ * Initialize the agent session
61
+ */
62
+ initialize(): Promise<boolean>;
63
+ /**
64
+ * Check if the agent is initialized
65
+ */
66
+ isInitialized(): boolean;
67
+ /**
68
+ * Execute a prompt and get a response
69
+ */
70
+ execute(prompt: string): Promise<ExecutionResult>;
71
+ /**
72
+ * Execute with retry logic using Copilot SDK
73
+ */
74
+ private executeWithRetry;
75
+ /**
76
+ * Cleanup resources
77
+ */
78
+ destroy(): Promise<void>;
79
+ /**
80
+ * Get total token usage
81
+ */
82
+ getTokenUsage(): TokenUsage;
83
+ /**
84
+ * Reset token tracking
85
+ */
86
+ resetTokenUsage(): void;
87
+ /**
88
+ * Check if token budget is exceeded
89
+ */
90
+ isTokenBudgetExceeded(maxTokens: number): boolean;
91
+ /**
92
+ * Get the current model
93
+ */
94
+ getModel(): CopilotModel;
95
+ /**
96
+ * Set the model
97
+ */
98
+ setModel(model: CopilotModel): void;
99
+ /**
100
+ * Get the current configuration
101
+ */
102
+ getConfig(): CopilotAgentConfig;
103
+ }
104
+ //# sourceMappingURL=copilot-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-agent.d.ts","sourceRoot":"","sources":["../../src/integrations/copilot-agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAExG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,KAAK,EAAE,YAAY,CAAC;IACpB,iCAAiC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4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