@agentuity/cli 0.0.24 → 0.0.25

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,mCA8TlB,CAAC"}
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,CAgCvE"}
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,CA4DvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentuity/cli",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
@@ -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> {