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.
- package/LICENSE +21 -0
- package/README.md +327 -0
- package/bin/ghcralph.js +2 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +92 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +118 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/index.d.ts +11 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +11 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +15 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +116 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/rollback.d.ts +8 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +238 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/run.d.ts +28 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +407 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +399 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/core/action-executor.d.ts +96 -0
- package/dist/core/action-executor.d.ts.map +1 -0
- package/dist/core/action-executor.js +289 -0
- package/dist/core/action-executor.js.map +1 -0
- package/dist/core/checkpoint-manager.d.ts +94 -0
- package/dist/core/checkpoint-manager.d.ts.map +1 -0
- package/dist/core/checkpoint-manager.js +236 -0
- package/dist/core/checkpoint-manager.js.map +1 -0
- package/dist/core/config-manager.d.ts +62 -0
- package/dist/core/config-manager.d.ts.map +1 -0
- package/dist/core/config-manager.js +184 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/config-schema.d.ts +74 -0
- package/dist/core/config-schema.d.ts.map +1 -0
- package/dist/core/config-schema.js +84 -0
- package/dist/core/config-schema.js.map +1 -0
- package/dist/core/context-builder.d.ts +116 -0
- package/dist/core/context-builder.d.ts.map +1 -0
- package/dist/core/context-builder.js +388 -0
- package/dist/core/context-builder.js.map +1 -0
- package/dist/core/feedback-builder.d.ts +94 -0
- package/dist/core/feedback-builder.d.ts.map +1 -0
- package/dist/core/feedback-builder.js +226 -0
- package/dist/core/feedback-builder.js.map +1 -0
- package/dist/core/file-safeguard.d.ts +109 -0
- package/dist/core/file-safeguard.d.ts.map +1 -0
- package/dist/core/file-safeguard.js +200 -0
- package/dist/core/file-safeguard.js.map +1 -0
- package/dist/core/git-branch-manager.d.ts +122 -0
- package/dist/core/git-branch-manager.d.ts.map +1 -0
- package/dist/core/git-branch-manager.js +302 -0
- package/dist/core/git-branch-manager.js.map +1 -0
- package/dist/core/github-plan.d.ts +86 -0
- package/dist/core/github-plan.d.ts.map +1 -0
- package/dist/core/github-plan.js +333 -0
- package/dist/core/github-plan.js.map +1 -0
- package/dist/core/index.d.ts +43 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +26 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/local-markdown-plan.d.ts +65 -0
- package/dist/core/local-markdown-plan.d.ts.map +1 -0
- package/dist/core/local-markdown-plan.js +154 -0
- package/dist/core/local-markdown-plan.js.map +1 -0
- package/dist/core/loop-engine.d.ts +133 -0
- package/dist/core/loop-engine.d.ts.map +1 -0
- package/dist/core/loop-engine.js +420 -0
- package/dist/core/loop-engine.js.map +1 -0
- package/dist/core/loop-events.d.ts +48 -0
- package/dist/core/loop-events.d.ts.map +1 -0
- package/dist/core/loop-events.js +24 -0
- package/dist/core/loop-events.js.map +1 -0
- package/dist/core/loop-state.d.ts +51 -0
- package/dist/core/loop-state.d.ts.map +1 -0
- package/dist/core/loop-state.js +48 -0
- package/dist/core/loop-state.js.map +1 -0
- package/dist/core/markdown-parser.d.ts +51 -0
- package/dist/core/markdown-parser.d.ts.map +1 -0
- package/dist/core/markdown-parser.js +122 -0
- package/dist/core/markdown-parser.js.map +1 -0
- package/dist/core/plan-manager.d.ts +61 -0
- package/dist/core/plan-manager.d.ts.map +1 -0
- package/dist/core/plan-manager.js +7 -0
- package/dist/core/plan-manager.js.map +1 -0
- package/dist/core/progress-tracker.d.ts +74 -0
- package/dist/core/progress-tracker.d.ts.map +1 -0
- package/dist/core/progress-tracker.js +198 -0
- package/dist/core/progress-tracker.js.map +1 -0
- package/dist/core/prompt-examples.d.ts +52 -0
- package/dist/core/prompt-examples.d.ts.map +1 -0
- package/dist/core/prompt-examples.js +194 -0
- package/dist/core/prompt-examples.js.map +1 -0
- package/dist/core/response-parser.d.ts +90 -0
- package/dist/core/response-parser.d.ts.map +1 -0
- package/dist/core/response-parser.js +209 -0
- package/dist/core/response-parser.js.map +1 -0
- package/dist/core/verification-hooks.d.ts +103 -0
- package/dist/core/verification-hooks.d.ts.map +1 -0
- package/dist/core/verification-hooks.js +268 -0
- package/dist/core/verification-hooks.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/auth.d.ts +28 -0
- package/dist/integrations/auth.d.ts.map +1 -0
- package/dist/integrations/auth.js +76 -0
- package/dist/integrations/auth.js.map +1 -0
- package/dist/integrations/copilot-agent.d.ts +104 -0
- package/dist/integrations/copilot-agent.d.ts.map +1 -0
- package/dist/integrations/copilot-agent.js +235 -0
- package/dist/integrations/copilot-agent.js.map +1 -0
- package/dist/integrations/index.d.ts +18 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +14 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/mcp-tools.d.ts +129 -0
- package/dist/integrations/mcp-tools.d.ts.map +1 -0
- package/dist/integrations/mcp-tools.js +272 -0
- package/dist/integrations/mcp-tools.js.map +1 -0
- package/dist/integrations/tokens.d.ts +45 -0
- package/dist/integrations/tokens.d.ts.map +1 -0
- package/dist/integrations/tokens.js +50 -0
- package/dist/integrations/tokens.js.map +1 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +23 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +37 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/output.d.ts +59 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +96 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/paths.d.ts +34 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +67 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/shell.d.ts +26 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +65 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/validation.d.ts +27 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +43 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Command
|
|
3
|
+
*
|
|
4
|
+
* Initialize GitHub Copilot Ralph in a repository
|
|
5
|
+
*/
|
|
6
|
+
import { execSync } from 'node:child_process';
|
|
7
|
+
import { info, success, error, warn, debug, heading, code, dim } from '../utils/index.js';
|
|
8
|
+
import { ConfigManager } from '../core/config-manager.js';
|
|
9
|
+
/**
|
|
10
|
+
* Check if we're in a git repository
|
|
11
|
+
*/
|
|
12
|
+
function isGitRepository() {
|
|
13
|
+
try {
|
|
14
|
+
execSync('git rev-parse --is-inside-work-tree', {
|
|
15
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
16
|
+
});
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the git repository root
|
|
25
|
+
*/
|
|
26
|
+
function getGitRoot() {
|
|
27
|
+
try {
|
|
28
|
+
return execSync('git rev-parse --show-toplevel', {
|
|
29
|
+
encoding: 'utf-8',
|
|
30
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
31
|
+
}).trim();
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function registerInitCommand(program) {
|
|
38
|
+
program
|
|
39
|
+
.command('init')
|
|
40
|
+
.description('Initialize GitHub Copilot Ralph in the current repository')
|
|
41
|
+
.option('--force', 'Overwrite existing configuration')
|
|
42
|
+
.option('--local', 'Use local Markdown files as plan source')
|
|
43
|
+
.option('--github', 'Use GitHub Issues as plan source')
|
|
44
|
+
.option('--plan-source <source>', 'Plan source (github or local)')
|
|
45
|
+
.addHelpText('after', `
|
|
46
|
+
Examples:
|
|
47
|
+
$ ghcralph init # Interactive initialization
|
|
48
|
+
$ ghcralph init --local # Use local Markdown plan files
|
|
49
|
+
$ ghcralph init --github # Use GitHub Issues as plan source
|
|
50
|
+
$ ghcralph init --force # Overwrite existing configuration
|
|
51
|
+
|
|
52
|
+
This command will:
|
|
53
|
+
1. Create .ghcralph/ directory in your project
|
|
54
|
+
2. Generate config.json with default settings
|
|
55
|
+
3. Add .ghcralph/ to .gitignore (optional)
|
|
56
|
+
|
|
57
|
+
See also:
|
|
58
|
+
ghcralph run Execute a coding loop
|
|
59
|
+
ghcralph config View or modify configuration
|
|
60
|
+
`)
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log(heading('🤖 GitHub Copilot Ralph - Initialize'));
|
|
64
|
+
console.log('');
|
|
65
|
+
// Check for git repository
|
|
66
|
+
if (!isGitRepository()) {
|
|
67
|
+
error('Not in a git repository. Please run "git init" first.');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
const gitRoot = getGitRoot();
|
|
71
|
+
debug(`Git root: ${gitRoot}`);
|
|
72
|
+
// Create config manager
|
|
73
|
+
const configManager = new ConfigManager(gitRoot ?? undefined);
|
|
74
|
+
// Check for existing configuration
|
|
75
|
+
const hasExisting = await configManager.hasLocalConfig();
|
|
76
|
+
if (hasExisting && !options.force) {
|
|
77
|
+
warn('GitHub Copilot Ralph is already initialized in this repository.');
|
|
78
|
+
info(`Use ${code('--force')} to reinitialize.`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// Load existing or default config
|
|
82
|
+
await configManager.load();
|
|
83
|
+
// Determine plan source
|
|
84
|
+
let planSource = 'local';
|
|
85
|
+
if (options.github) {
|
|
86
|
+
planSource = 'github';
|
|
87
|
+
}
|
|
88
|
+
else if (options.local) {
|
|
89
|
+
planSource = 'local';
|
|
90
|
+
}
|
|
91
|
+
else if (options.planSource) {
|
|
92
|
+
planSource = options.planSource;
|
|
93
|
+
}
|
|
94
|
+
// Update configuration
|
|
95
|
+
configManager.set('planSource', planSource);
|
|
96
|
+
// Initialize local directory and save config
|
|
97
|
+
const stateDir = await configManager.initLocal();
|
|
98
|
+
// Display configuration
|
|
99
|
+
const config = configManager.getConfig();
|
|
100
|
+
console.log(dim('Configuration:'));
|
|
101
|
+
console.log(` ${dim('Plan source:')} ${code(config.planSource)}`);
|
|
102
|
+
console.log(` ${dim('Max iterations:')} ${config.maxIterations}`);
|
|
103
|
+
console.log(` ${dim('Max tokens:')} ${config.maxTokens.toLocaleString()}`);
|
|
104
|
+
console.log(` ${dim('Model:')} ${code(config.defaultModel)}`);
|
|
105
|
+
console.log(` ${dim('Auto commit:')} ${config.autoCommit}`);
|
|
106
|
+
console.log(` ${dim('Branch prefix:')} ${code(config.branchPrefix)}`);
|
|
107
|
+
console.log('');
|
|
108
|
+
console.log(dim('Created:'));
|
|
109
|
+
console.log(` ${code(stateDir)}`);
|
|
110
|
+
console.log('');
|
|
111
|
+
success('GitHub Copilot Ralph initialized successfully!');
|
|
112
|
+
console.log('');
|
|
113
|
+
info(`Run ${code('ghcralph run --task "Your task"')} to start.`);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D;;GAEG;AACH,SAAS,eAAe;IACtB,IAAI,CAAC;QACH,QAAQ,CAAC,qCAAqC,EAAE;YAC9C,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,+BAA+B,EAAE;YAC/C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AASD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,2DAA2D,CAAC;SACxE,MAAM,CAAC,SAAS,EAAE,kCAAkC,CAAC;SACrD,MAAM,CAAC,SAAS,EAAE,yCAAyC,CAAC;SA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G,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,OAAO,CAAC,gDAAgD,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,IAAI,CAAC,OAAO,IAAI,CAAC,iCAAiC,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/commands/rollback.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmFzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsL9D"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rollback Command
|
|
3
|
+
*
|
|
4
|
+
* Revert to a previous checkpoint
|
|
5
|
+
*/
|
|
6
|
+
import { exec } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import { info, success, warn, error, dim, heading, code, parsePositiveInt } from '../utils/index.js';
|
|
9
|
+
const execAsync = promisify(exec);
|
|
10
|
+
/**
|
|
11
|
+
* Get recent Ralph commits
|
|
12
|
+
*/
|
|
13
|
+
async function getRalphCommits(limit = 10) {
|
|
14
|
+
try {
|
|
15
|
+
const { stdout } = await execAsync(`git log --oneline --format="%H|%s|%ar" -n ${limit} 2>/dev/null`);
|
|
16
|
+
const lines = stdout.trim().split('\n').filter(Boolean);
|
|
17
|
+
const commits = lines
|
|
18
|
+
.map(line => {
|
|
19
|
+
const [hash, message, date] = line.split('|');
|
|
20
|
+
return { hash: hash ?? '', message: message ?? '', date: date ?? '' };
|
|
21
|
+
})
|
|
22
|
+
.filter(c => c.message.startsWith('ghcralph:'));
|
|
23
|
+
return commits;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get files changed in a commit
|
|
31
|
+
*/
|
|
32
|
+
async function getCommitFiles(hash) {
|
|
33
|
+
try {
|
|
34
|
+
const { stdout } = await execAsync(`git diff-tree --no-commit-id --name-only -r ${hash} 2>/dev/null`);
|
|
35
|
+
return stdout.trim().split('\n').filter(Boolean);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the initial commit before Ralph session
|
|
43
|
+
*/
|
|
44
|
+
async function getPreSessionCommit() {
|
|
45
|
+
try {
|
|
46
|
+
// Find the first Ralph commit and get its parent
|
|
47
|
+
const { stdout } = await execAsync('git log --oneline --format="%H|%s" 2>/dev/null');
|
|
48
|
+
const lines = stdout.trim().split('\n').filter(Boolean);
|
|
49
|
+
let firstRalphCommit = null;
|
|
50
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51
|
+
const [hash, message] = lines[i]?.split('|') ?? [];
|
|
52
|
+
if (message?.startsWith('ghcralph:')) {
|
|
53
|
+
firstRalphCommit = hash ?? null;
|
|
54
|
+
}
|
|
55
|
+
else if (firstRalphCommit) {
|
|
56
|
+
// Found the first non-Ralph commit after Ralph commits
|
|
57
|
+
return hash ?? null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// If we found Ralph commits but no parent, try to get the parent of first Ralph commit
|
|
61
|
+
if (firstRalphCommit) {
|
|
62
|
+
try {
|
|
63
|
+
const { stdout: parentHash } = await execAsync(`git rev-parse "${firstRalphCommit}^" 2>/dev/null`);
|
|
64
|
+
return parentHash.trim();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export function registerRollbackCommand(program) {
|
|
77
|
+
program
|
|
78
|
+
.command('rollback')
|
|
79
|
+
.description('Revert to a previous checkpoint')
|
|
80
|
+
.option('--to <commit>', 'Specific commit hash to rollback to')
|
|
81
|
+
.option('--iterations <n>', 'Number of iterations to undo')
|
|
82
|
+
.option('--all', 'Undo entire Ralph session')
|
|
83
|
+
.option('--list', 'List available checkpoints')
|
|
84
|
+
.option('--force', 'Skip confirmation prompt')
|
|
85
|
+
.addHelpText('after', `
|
|
86
|
+
Examples:
|
|
87
|
+
$ ghcralph rollback # Undo last iteration
|
|
88
|
+
$ ghcralph rollback --iterations 3 # Undo last 3 iterations
|
|
89
|
+
$ ghcralph rollback --to abc1234 # Rollback to specific commit
|
|
90
|
+
$ ghcralph rollback --all --force # Reset to pre-session state
|
|
91
|
+
$ ghcralph rollback --list # Show available checkpoints
|
|
92
|
+
|
|
93
|
+
Safety:
|
|
94
|
+
- All rollback operations require --force flag
|
|
95
|
+
- Preview shows files that will be affected
|
|
96
|
+
- Original state can be recovered from git reflog
|
|
97
|
+
|
|
98
|
+
See also:
|
|
99
|
+
ghcralph status View current progress
|
|
100
|
+
ghcralph run Start a new coding loop
|
|
101
|
+
`)
|
|
102
|
+
.action(async (options) => {
|
|
103
|
+
// List checkpoints
|
|
104
|
+
if (options.list) {
|
|
105
|
+
console.log(heading('📋 Ralph Checkpoints'));
|
|
106
|
+
console.log('');
|
|
107
|
+
const commits = await getRalphCommits(20);
|
|
108
|
+
if (commits.length === 0) {
|
|
109
|
+
info('No Ralph checkpoints found');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
for (const commit of commits) {
|
|
113
|
+
console.log(` ${code(commit.hash.substring(0, 7))} ${commit.message} ${dim(`(${commit.date})`)}`);
|
|
114
|
+
}
|
|
115
|
+
console.log('');
|
|
116
|
+
info(`Use ${code('ghcralph rollback --to <hash>')} to rollback to a specific checkpoint`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// Rollback all
|
|
120
|
+
if (options.all) {
|
|
121
|
+
const preSession = await getPreSessionCommit();
|
|
122
|
+
if (!preSession) {
|
|
123
|
+
error('Could not find pre-session commit');
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const commits = await getRalphCommits(100);
|
|
127
|
+
console.log('');
|
|
128
|
+
warn(`This will reset to the state before the Ralph session started.`);
|
|
129
|
+
console.log(` ${dim('Target:')} ${code(preSession.substring(0, 7))}`);
|
|
130
|
+
console.log(` ${dim('Iterations to undo:')} ${commits.length}`);
|
|
131
|
+
console.log('');
|
|
132
|
+
if (!options.force) {
|
|
133
|
+
warn('Use --force to confirm this destructive operation');
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
await execAsync(`git reset --hard "${preSession}"`);
|
|
138
|
+
success(`Reset to pre-session state (${preSession.substring(0, 7)})`);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
error(`Failed to rollback: ${err instanceof Error ? err.message : String(err)}`);
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
// Rollback to specific commit
|
|
146
|
+
if (options.to) {
|
|
147
|
+
const files = await getCommitFiles(options.to);
|
|
148
|
+
console.log('');
|
|
149
|
+
console.log(`Rolling back to commit ${code(options.to.substring(0, 7))}`);
|
|
150
|
+
if (files.length > 0) {
|
|
151
|
+
console.log(` ${dim('Files affected:')} ${files.length}`);
|
|
152
|
+
for (const file of files.slice(0, 5)) {
|
|
153
|
+
console.log(` - ${file}`);
|
|
154
|
+
}
|
|
155
|
+
if (files.length > 5) {
|
|
156
|
+
console.log(` ${dim(`...and ${files.length - 5} more`)}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
console.log('');
|
|
160
|
+
if (!options.force) {
|
|
161
|
+
warn('Use --force to confirm this operation');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
await execAsync(`git reset --hard "${options.to}"`);
|
|
166
|
+
success(`Rolled back to ${options.to.substring(0, 7)}`);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
error(`Failed to rollback: ${err instanceof Error ? err.message : String(err)}`);
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Rollback N iterations
|
|
174
|
+
let iterations = 1;
|
|
175
|
+
if (options.iterations) {
|
|
176
|
+
const iterationsResult = parsePositiveInt(options.iterations, 'iterations');
|
|
177
|
+
if (!iterationsResult.valid) {
|
|
178
|
+
error(iterationsResult.error ?? 'Invalid iterations value');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (iterationsResult.value === undefined) {
|
|
182
|
+
error(iterationsResult.error ?? 'Invalid iterations value');
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
iterations = iterationsResult.value;
|
|
186
|
+
}
|
|
187
|
+
const commits = await getRalphCommits(iterations + 1);
|
|
188
|
+
if (commits.length < iterations) {
|
|
189
|
+
error(`Only ${commits.length} Ralph iterations found, cannot rollback ${iterations}`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
// Find the commit to reset to (one before the iterations we're undoing)
|
|
193
|
+
const targetIndex = iterations;
|
|
194
|
+
const targetCommit = commits[targetIndex];
|
|
195
|
+
if (!targetCommit) {
|
|
196
|
+
// Need to find parent of oldest Ralph commit being undone
|
|
197
|
+
const lastUndone = commits[iterations - 1];
|
|
198
|
+
if (!lastUndone) {
|
|
199
|
+
error('Could not determine rollback target');
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
const { stdout } = await execAsync(`git rev-parse "${lastUndone.hash}^" 2>/dev/null`);
|
|
204
|
+
const parentHash = stdout.trim();
|
|
205
|
+
console.log('');
|
|
206
|
+
console.log(`Rolling back ${iterations} iteration(s)`);
|
|
207
|
+
console.log(` ${dim('Target:')} ${code(parentHash.substring(0, 7))}`);
|
|
208
|
+
console.log('');
|
|
209
|
+
if (!options.force) {
|
|
210
|
+
warn('Use --force to confirm this operation');
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
await execAsync(`git reset --hard "${parentHash}"`);
|
|
214
|
+
success(`Rolled back ${iterations} iteration(s)`);
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
error(`Failed to rollback: ${err instanceof Error ? err.message : String(err)}`);
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
console.log('');
|
|
222
|
+
console.log(`Rolling back ${iterations} iteration(s)`);
|
|
223
|
+
console.log(` ${dim('Target:')} ${code(targetCommit.hash.substring(0, 7))} - ${targetCommit.message}`);
|
|
224
|
+
console.log('');
|
|
225
|
+
if (!options.force) {
|
|
226
|
+
warn('Use --force to confirm this operation');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
await execAsync(`git reset --hard "${targetCommit.hash}"`);
|
|
231
|
+
success(`Rolled back to iteration ${commits.length - iterations}`);
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
error(`Failed to rollback: ${err instanceof Error ? err.message : String(err)}`);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=rollback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../src/commands/rollback.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErG,MAAM,SAAS,GAAG,SAAS,CAAC,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4B,OAAO,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run Command
|
|
3
|
+
*
|
|
4
|
+
* Execute an agentic coding loop
|
|
5
|
+
*/
|
|
6
|
+
import type { Command } from 'commander';
|
|
7
|
+
export interface RunOptions {
|
|
8
|
+
task?: string;
|
|
9
|
+
file?: string;
|
|
10
|
+
plan?: string;
|
|
11
|
+
github?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
milestone?: string;
|
|
14
|
+
assignee?: string;
|
|
15
|
+
context?: string[];
|
|
16
|
+
branch?: string;
|
|
17
|
+
force?: boolean;
|
|
18
|
+
noCommit?: boolean;
|
|
19
|
+
unlimited?: boolean;
|
|
20
|
+
timeout?: string;
|
|
21
|
+
allowDelete?: boolean;
|
|
22
|
+
maxIterations: string;
|
|
23
|
+
maxTokens?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function registerRunCommand(program: Command): void;
|
|
28
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA2ED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmXzD"}
|