@agentuity/cli 0.0.24 → 0.0.26-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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/dev/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/dev/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,mCAuVlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/cmd/project/download.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,UAAU,eAAe;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,UAAU,YAAY;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAsBD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyH9E;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/cmd/project/download.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE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3,"file":"template-flow.d.ts","sourceRoot":"","sources":["../../../src/cmd/project/template-flow.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAM3C,UAAU,iBAAiB;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4J7E"}
|
package/package.json
CHANGED
package/src/cmd/dev/index.ts
CHANGED
|
@@ -54,6 +54,30 @@ export const command = createCommand({
|
|
|
54
54
|
let shuttingDownForRestart = false;
|
|
55
55
|
let pendingRestart = false;
|
|
56
56
|
|
|
57
|
+
// Track restart timestamps to detect restart loops
|
|
58
|
+
const restartTimestamps: number[] = [];
|
|
59
|
+
const MAX_RESTARTS = 10;
|
|
60
|
+
const TIME_WINDOW_MS = 10000; // 10 seconds
|
|
61
|
+
|
|
62
|
+
function checkRestartThrottle() {
|
|
63
|
+
const now = Date.now();
|
|
64
|
+
restartTimestamps.push(now);
|
|
65
|
+
|
|
66
|
+
// Remove timestamps older than the time window
|
|
67
|
+
while (restartTimestamps.length > 0 && now - restartTimestamps[0]! > TIME_WINDOW_MS) {
|
|
68
|
+
restartTimestamps.shift();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Check if we've exceeded the threshold
|
|
72
|
+
if (restartTimestamps.length >= MAX_RESTARTS) {
|
|
73
|
+
tui.error(`Detected ${MAX_RESTARTS} restarts in ${TIME_WINDOW_MS / 1000} seconds`);
|
|
74
|
+
tui.error(
|
|
75
|
+
'This usually indicates a file watcher loop (e.g., log files in the project root)'
|
|
76
|
+
);
|
|
77
|
+
tui.fatal('Too many rapid restarts, exiting to prevent infinite loop');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
57
81
|
function failure(msg: string) {
|
|
58
82
|
failed = true;
|
|
59
83
|
failures++;
|
|
@@ -133,6 +157,7 @@ export const command = createCommand({
|
|
|
133
157
|
try {
|
|
134
158
|
if (running) {
|
|
135
159
|
logger.trace('Server is running, killing before restart');
|
|
160
|
+
checkRestartThrottle();
|
|
136
161
|
tui.info('Restarting on file change');
|
|
137
162
|
await kill();
|
|
138
163
|
logger.trace('Server killed, continuing with restart');
|
|
@@ -213,6 +213,34 @@ export async function setupProject(options: SetupOptions): Promise<void> {
|
|
|
213
213
|
logger.error('Failed to build project');
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
+
|
|
217
|
+
// Initialize git repository if git is available
|
|
218
|
+
const gitPath = Bun.which('git');
|
|
219
|
+
if (gitPath) {
|
|
220
|
+
// Git is available, initialize repository
|
|
221
|
+
await tui.runCommand({
|
|
222
|
+
command: 'git init',
|
|
223
|
+
cwd: dest,
|
|
224
|
+
cmd: ['git', 'init'],
|
|
225
|
+
clearOnSuccess: true,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Add all files
|
|
229
|
+
await tui.runCommand({
|
|
230
|
+
command: 'git add .',
|
|
231
|
+
cwd: dest,
|
|
232
|
+
cmd: ['git', 'add', '.'],
|
|
233
|
+
clearOnSuccess: true,
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Create initial commit
|
|
237
|
+
await tui.runCommand({
|
|
238
|
+
command: 'git commit -m "Initial Setup"',
|
|
239
|
+
cwd: dest,
|
|
240
|
+
cmd: ['git', 'commit', '-m', 'Initial Setup'],
|
|
241
|
+
clearOnSuccess: true,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
216
244
|
}
|
|
217
245
|
|
|
218
246
|
async function replaceInFiles(dir: string, projectName: string, dirName: string): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { basename, resolve } from 'node:path';
|
|
2
|
-
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readdirSync, rmSync, statSync } from 'node:fs';
|
|
3
3
|
import { cwd } from 'node:process';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import enquirer from 'enquirer';
|
|
@@ -77,7 +77,8 @@ export async function runCreateFlow(options: CreateFlowOptions): Promise<void> {
|
|
|
77
77
|
const baseDir = expandedTargetDir ? resolve(expandedTargetDir) : process.cwd();
|
|
78
78
|
const dest = dirName === '.' ? baseDir : resolve(baseDir, dirName);
|
|
79
79
|
const destExists = existsSync(dest);
|
|
80
|
-
const
|
|
80
|
+
const destIsDir = destExists ? statSync(dest).isDirectory() : false;
|
|
81
|
+
const destEmpty = destIsDir ? readdirSync(dest).length === 0 : !destExists;
|
|
81
82
|
|
|
82
83
|
if (destExists && !destEmpty && dirName !== '.') {
|
|
83
84
|
// In TTY mode, ask if they want to overwrite
|