@pageai/ralph-loop 1.5.0 → 1.6.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/README.md +2 -2
- package/bin/cli.js +10 -0
- package/bin/lib/git.js +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ This is an implementation that actually works, containing a hackable script so y
|
|
|
41
41
|
I recommend using a CLI to bootstrap your project with the necessary tools and dependencies, e.g.:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
npx @tanstack/cli create lib --add-ons shadcn,eslint,form,tanstack-query
|
|
44
|
+
npx @tanstack/cli create lib --add-ons shadcn,eslint,form,tanstack-query --no-git
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
> If you must start from a blank slate, which is not recommended, see [Starting from scratch](#starting-from-scratch). You can also go for a more barebone start by running `npx create-vite@latest src --template react-ts`
|
|
@@ -381,7 +381,7 @@ Check the `ralph.sh` script around `# This is the main command loop.` for the ma
|
|
|
381
381
|
|
|
382
382
|
Replace `docker sandbox run claude . --` with the your favorite CLI. Remember to also update the options after the `--`.
|
|
383
383
|
|
|
384
|
-
```
|
|
384
|
+
```bash
|
|
385
385
|
docker sandbox run codex . # for Codex CLI
|
|
386
386
|
docker sandbox run gemini . # for Gemini CLI
|
|
387
387
|
```
|
package/bin/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ const path = require('path');
|
|
|
11
11
|
const { execSync } = require('child_process');
|
|
12
12
|
const display = require('./lib/display');
|
|
13
13
|
const { copyFile, copyDir, mergeDir, exists, ensureDir } = require('./lib/copy');
|
|
14
|
+
const { isGitRepo, initGitRepo } = require('./lib/git');
|
|
14
15
|
|
|
15
16
|
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
16
17
|
const TARGET_DIR = process.cwd();
|
|
@@ -150,6 +151,15 @@ async function main() {
|
|
|
150
151
|
|
|
151
152
|
display.printLocation(TARGET_DIR);
|
|
152
153
|
|
|
154
|
+
// Initialize git repository if not present
|
|
155
|
+
if (!isGitRepo(TARGET_DIR)) {
|
|
156
|
+
try {
|
|
157
|
+
initGitRepo(TARGET_DIR);
|
|
158
|
+
} catch {
|
|
159
|
+
// Non-critical — continue setup even if git init fails
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
153
163
|
// Copy individual files
|
|
154
164
|
display.printStep('📄', 'Core files');
|
|
155
165
|
for (const file of FILES_TO_COPY) {
|
package/bin/lib/git.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git module for Ralph Loop CLI
|
|
3
|
+
* Handles git repository initialization in the target directory
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const { exists } = require('./copy');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a directory is inside a git repository
|
|
12
|
+
* @param {string} dir - Directory path to check
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
function isGitRepo(dir) {
|
|
16
|
+
return exists(path.join(dir, '.git'));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a new git repository in the given directory
|
|
21
|
+
* @param {string} dir - Directory path to initialize
|
|
22
|
+
*/
|
|
23
|
+
function initGitRepo(dir) {
|
|
24
|
+
execSync('git init', { cwd: dir, stdio: 'pipe' });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
isGitRepo,
|
|
29
|
+
initGitRepo,
|
|
30
|
+
};
|