sw-plan 0.1.21 → 0.1.23
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/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +37 -70
- package/dist/execute.js.map +1 -1
- package/package.json +1 -1
package/dist/execute.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../execute.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../execute.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAyH3E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoB7D"}
|
package/dist/execute.js
CHANGED
|
@@ -37,92 +37,59 @@ export async function executeCommand(options) {
|
|
|
37
37
|
outputStage('start', options.outputMode);
|
|
38
38
|
console.error('\n=== Stage 1: Pre-build Check ===\n');
|
|
39
39
|
console.error('Running build verification before making changes...');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- Only run the build command and report results
|
|
51
|
-
- If the build fails, report the error details`, repoPath, options.outputMode);
|
|
40
|
+
// Read prompt from file
|
|
41
|
+
const preBuildPromptPath = `${repoPath}/.execute-prompts/pre-build-check.txt`;
|
|
42
|
+
if (!existsSync(preBuildPromptPath)) {
|
|
43
|
+
throw new Error(`Pre-build check prompt file not found: ${preBuildPromptPath}`);
|
|
44
|
+
}
|
|
45
|
+
const preBuildPrompt = readFileSync(preBuildPromptPath, 'utf-8');
|
|
46
|
+
const preBuildResult = await runTextStage(preBuildPrompt, repoPath, options.outputMode, undefined, // sessionId
|
|
47
|
+
undefined, // logCallback
|
|
48
|
+
repoPath // allowedWriteDir - auto-approve writes in repo
|
|
49
|
+
);
|
|
52
50
|
console.error(`\nPre-build check complete!`);
|
|
53
51
|
// Stage 2: Execute the plan
|
|
54
52
|
outputStage('plan1', options.outputMode);
|
|
55
53
|
console.error('\n=== Stage 2: Execute Integration Plan ===\n');
|
|
56
54
|
console.error('Executing the integration plan...');
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
IMPORTANT:
|
|
68
|
-
- Follow the plan exactly as written
|
|
69
|
-
- Complete all setup, integration, and verification steps
|
|
70
|
-
- Make all necessary code changes
|
|
71
|
-
- Install any required packages
|
|
72
|
-
- The plan is cached in AI cache for reference`, repoPath, options.outputMode, preBuildResult.sessionId // Resume from pre-build check
|
|
55
|
+
// Read prompt from file
|
|
56
|
+
const executePromptPath = `${repoPath}/.execute-prompts/execute-integration.txt`;
|
|
57
|
+
if (!existsSync(executePromptPath)) {
|
|
58
|
+
throw new Error(`Execute integration prompt file not found: ${executePromptPath}`);
|
|
59
|
+
}
|
|
60
|
+
const executePrompt = readFileSync(executePromptPath, 'utf-8');
|
|
61
|
+
const executionResult = await runTextStage(executePrompt, repoPath, options.outputMode, preBuildResult.sessionId, // Resume from pre-build check
|
|
62
|
+
undefined, // logCallback
|
|
63
|
+
repoPath // allowedWriteDir - auto-approve writes in repo
|
|
73
64
|
);
|
|
74
65
|
console.error(`\nIntegration complete!`);
|
|
75
66
|
// Stage 3: Post-build verification
|
|
76
67
|
outputStage('plan2', options.outputMode);
|
|
77
68
|
console.error('\n=== Stage 3: Post-build Verification ===\n');
|
|
78
69
|
console.error('Verifying that everything builds correctly...');
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
IMPORTANT:
|
|
89
|
-
- Fix any build errors that arise from the integration
|
|
90
|
-
- Ensure the build succeeds before completing`, repoPath, options.outputMode, executionResult.sessionId // Resume from execution
|
|
70
|
+
// Read prompt from file
|
|
71
|
+
const postBuildPromptPath = `${repoPath}/.execute-prompts/post-build-verification.txt`;
|
|
72
|
+
if (!existsSync(postBuildPromptPath)) {
|
|
73
|
+
throw new Error(`Post-build verification prompt file not found: ${postBuildPromptPath}`);
|
|
74
|
+
}
|
|
75
|
+
const postBuildPrompt = readFileSync(postBuildPromptPath, 'utf-8');
|
|
76
|
+
await runTextStage(postBuildPrompt, repoPath, options.outputMode, executionResult.sessionId, // Resume from execution
|
|
77
|
+
undefined, // logCallback
|
|
78
|
+
repoPath // allowedWriteDir - auto-approve writes in repo
|
|
91
79
|
);
|
|
92
80
|
console.error(`\nPost-build verification complete!`);
|
|
93
81
|
// Stage 4: Commit and push changes
|
|
94
82
|
outputStage('plan3', options.outputMode);
|
|
95
83
|
console.error('\n=== Stage 4: Commit and Push Changes ===\n');
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
5. Push the changes: git push
|
|
106
|
-
|
|
107
|
-
HANDLING MERGE CONFLICTS:
|
|
108
|
-
If the push fails due to remote changes:
|
|
109
|
-
1. Pull the latest changes: git pull --rebase
|
|
110
|
-
2. If there are merge conflicts:
|
|
111
|
-
- Check which files have conflicts: git status
|
|
112
|
-
- Read the conflicting files and resolve conflicts manually
|
|
113
|
-
- Look for conflict markers (<<<<<<, =======, >>>>>>>)
|
|
114
|
-
- Keep the appropriate changes (usually prefer your integration changes)
|
|
115
|
-
- Stage the resolved files: git add <file>
|
|
116
|
-
- Continue the rebase: git rebase --continue
|
|
117
|
-
3. Once conflicts are resolved, push again: git push
|
|
118
|
-
4. If pull/rebase fails repeatedly, try: git pull --no-rebase, then push
|
|
119
|
-
|
|
120
|
-
IMPORTANT:
|
|
121
|
-
- Use a clear commit message that describes the integration (e.g., "feat: integrate Stripe payments")
|
|
122
|
-
- Make sure ALL changes from the integration are included
|
|
123
|
-
- Handle merge conflicts carefully - prefer keeping the integration changes
|
|
124
|
-
- Keep retrying until the push succeeds
|
|
125
|
-
- If you encounter any git errors, read the error message and follow the suggested fix`, repoPath, options.outputMode, executionResult.sessionId // Resume from execution
|
|
84
|
+
// Read prompt from file
|
|
85
|
+
const commitPromptPath = `${repoPath}/.execute-prompts/commit-and-push.txt`;
|
|
86
|
+
if (!existsSync(commitPromptPath)) {
|
|
87
|
+
throw new Error(`Commit and push prompt file not found: ${commitPromptPath}`);
|
|
88
|
+
}
|
|
89
|
+
const commitPrompt = readFileSync(commitPromptPath, 'utf-8');
|
|
90
|
+
await runTextStage(commitPrompt, repoPath, options.outputMode, executionResult.sessionId, // Resume from execution
|
|
91
|
+
undefined, // logCallback
|
|
92
|
+
repoPath // allowedWriteDir - auto-approve writes in repo
|
|
126
93
|
);
|
|
127
94
|
// Output complete stage
|
|
128
95
|
outputStage('complete', options.outputMode);
|
package/dist/execute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","source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