@agentuity/cli 0.0.73 → 0.0.75
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/auth.d.ts.map +1 -1
- package/dist/auth.js +13 -9
- package/dist/auth.js.map +1 -1
- package/dist/banner.js +1 -1
- package/dist/banner.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/prompt/api.d.ts.map +1 -1
- package/dist/cmd/ai/prompt/api.js +5 -4
- package/dist/cmd/ai/prompt/api.js.map +1 -1
- package/dist/cmd/auth/ssh/api.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/api.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +20 -6
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts +3 -1
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +19 -9
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/plugin.d.ts.map +1 -1
- package/dist/cmd/build/plugin.js +87 -66
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/build/route-discovery.d.ts +50 -0
- package/dist/cmd/build/route-discovery.d.ts.map +1 -0
- package/dist/cmd/build/route-discovery.js +143 -0
- package/dist/cmd/build/route-discovery.js.map +1 -0
- package/dist/cmd/build/route-registry.d.ts.map +1 -1
- package/dist/cmd/build/route-registry.js +25 -10
- package/dist/cmd/build/route-registry.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +8 -6
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/dev/agents.d.ts.map +1 -1
- package/dist/cmd/dev/agents.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +21 -0
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/dev/sync.d.ts.map +1 -1
- package/dist/cmd/dev/sync.js.map +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/download.js +16 -2
- package/dist/cmd/project/download.js.map +1 -1
- package/dist/cmd/project/list.d.ts.map +1 -1
- package/dist/cmd/project/list.js +2 -10
- package/dist/cmd/project/list.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/steps.d.ts +20 -30
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +339 -184
- package/dist/steps.js.map +1 -1
- package/dist/tui/box.d.ts.map +1 -1
- package/dist/tui/box.js +8 -4
- package/dist/tui/box.js.map +1 -1
- package/dist/tui/prompt.d.ts.map +1 -1
- package/dist/tui/prompt.js +7 -2
- package/dist/tui/prompt.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +5 -4
- package/dist/tui.js.map +1 -1
- package/package.json +3 -3
- package/src/auth.ts +13 -10
- package/src/banner.ts +1 -1
- package/src/cli.ts +4 -2
- package/src/cmd/ai/prompt/api.ts +5 -4
- package/src/cmd/auth/ssh/api.ts +1 -4
- package/src/cmd/build/ast.ts +21 -6
- package/src/cmd/build/bundler.ts +30 -11
- package/src/cmd/build/plugin.ts +108 -82
- package/src/cmd/build/route-discovery.ts +197 -0
- package/src/cmd/build/route-registry.ts +26 -10
- package/src/cmd/cloud/deploy.ts +19 -6
- package/src/cmd/dev/agents.ts +2 -8
- package/src/cmd/dev/index.ts +25 -0
- package/src/cmd/dev/sync.ts +2 -10
- package/src/cmd/project/download.ts +16 -2
- package/src/cmd/project/list.ts +2 -9
- package/src/index.ts +2 -2
- package/src/steps.ts +397 -229
- package/src/tui/box.ts +8 -4
- package/src/tui/prompt.ts +7 -4
- package/src/tui.ts +6 -4
package/src/cmd/cloud/deploy.ts
CHANGED
|
@@ -6,7 +6,14 @@ import { tmpdir } from 'node:os';
|
|
|
6
6
|
import { createSubcommand } from '../../types';
|
|
7
7
|
import * as tui from '../../tui';
|
|
8
8
|
import { saveProjectDir, getDefaultConfigDir } from '../../config';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
runSteps,
|
|
11
|
+
stepSuccess,
|
|
12
|
+
stepSkipped,
|
|
13
|
+
stepError,
|
|
14
|
+
type Step,
|
|
15
|
+
type StepContext,
|
|
16
|
+
} from '../../steps';
|
|
10
17
|
import { bundle } from '../build/bundler';
|
|
11
18
|
import { loadBuildMetadata, getStreamURL } from '../../config';
|
|
12
19
|
import {
|
|
@@ -179,8 +186,9 @@ export const deploySubcommand = createSubcommand({
|
|
|
179
186
|
if (!deployment) {
|
|
180
187
|
return stepError('deployment was null');
|
|
181
188
|
}
|
|
189
|
+
let capturedOutput: string[] = [];
|
|
182
190
|
try {
|
|
183
|
-
await bundle({
|
|
191
|
+
const bundleResult = await bundle({
|
|
184
192
|
rootDir: resolve(projectDir),
|
|
185
193
|
dev: false,
|
|
186
194
|
deploymentId: deployment.id,
|
|
@@ -195,23 +203,28 @@ export const deploySubcommand = createSubcommand({
|
|
|
195
203
|
region: project.region,
|
|
196
204
|
logger: ctx.logger,
|
|
197
205
|
});
|
|
206
|
+
capturedOutput = bundleResult.output;
|
|
198
207
|
build = await loadBuildMetadata(join(projectDir, '.agentuity'));
|
|
199
208
|
instructions = await projectDeploymentUpdate(
|
|
200
209
|
apiClient,
|
|
201
210
|
deployment.id,
|
|
202
211
|
build
|
|
203
212
|
);
|
|
204
|
-
return stepSuccess();
|
|
213
|
+
return stepSuccess(capturedOutput.length > 0 ? capturedOutput : undefined);
|
|
205
214
|
} catch (ex) {
|
|
206
215
|
const _ex = ex as Error;
|
|
207
|
-
return stepError(
|
|
216
|
+
return stepError(
|
|
217
|
+
_ex.message ?? 'Error building your project',
|
|
218
|
+
_ex,
|
|
219
|
+
capturedOutput.length > 0 ? capturedOutput : undefined
|
|
220
|
+
);
|
|
208
221
|
}
|
|
209
222
|
},
|
|
210
223
|
},
|
|
211
224
|
{
|
|
212
|
-
type: 'progress',
|
|
213
225
|
label: 'Encrypt and Upload Deployment',
|
|
214
|
-
run: async (
|
|
226
|
+
run: async (stepCtx: StepContext) => {
|
|
227
|
+
const progress = stepCtx.progress;
|
|
215
228
|
if (!deployment) {
|
|
216
229
|
return stepError('deployment was null');
|
|
217
230
|
}
|
package/src/cmd/dev/agents.ts
CHANGED
|
@@ -63,15 +63,9 @@ export const agentsSubcommand = createSubcommand({
|
|
|
63
63
|
const queryParams = deploymentId ? `?deploymentId=${deploymentId}` : '';
|
|
64
64
|
|
|
65
65
|
const response = options.json
|
|
66
|
-
? await apiClient.get(
|
|
67
|
-
`/cli/agent/${projectId}${queryParams}`,
|
|
68
|
-
AgentsResponseSchema
|
|
69
|
-
)
|
|
66
|
+
? await apiClient.get(`/cli/agent/${projectId}${queryParams}`, AgentsResponseSchema)
|
|
70
67
|
: await tui.spinner('Fetching agents', async () => {
|
|
71
|
-
return apiClient.get(
|
|
72
|
-
`/cli/agent/${projectId}${queryParams}`,
|
|
73
|
-
AgentsResponseSchema
|
|
74
|
-
);
|
|
68
|
+
return apiClient.get(`/cli/agent/${projectId}${queryParams}`, AgentsResponseSchema);
|
|
75
69
|
});
|
|
76
70
|
|
|
77
71
|
if (!response.success) {
|
package/src/cmd/dev/index.ts
CHANGED
|
@@ -256,6 +256,7 @@ export const command = createCommand({
|
|
|
256
256
|
let building = false;
|
|
257
257
|
let buildCompletedAt = 0;
|
|
258
258
|
const BUILD_COOLDOWN_MS = 500; // Ignore file changes for 500ms after build completes
|
|
259
|
+
const templatedDirectories = new Map<string, number>(); // Track directories that just had templates created
|
|
259
260
|
let metadata: Partial<BuildMetadata> | undefined;
|
|
260
261
|
let showInitialReadyMessage = true;
|
|
261
262
|
let serverStartTime = 0;
|
|
@@ -997,6 +998,7 @@ export const command = createCommand({
|
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
1000
|
|
|
1001
|
+
// Handle new empty directories in src/agent/ or src/api/ paths
|
|
1000
1002
|
if (
|
|
1001
1003
|
eventType === 'rename' &&
|
|
1002
1004
|
existsSync(absPath) &&
|
|
@@ -1006,9 +1008,32 @@ export const command = createCommand({
|
|
|
1006
1008
|
if (changedFile?.startsWith('src/agent/')) {
|
|
1007
1009
|
logger.debug('agent directory created: %s', changedFile);
|
|
1008
1010
|
createAgentTemplates(absPath);
|
|
1011
|
+
// Mark this directory as recently templated to avoid immediate rebuild
|
|
1012
|
+
templatedDirectories.set(absPath, Date.now());
|
|
1013
|
+
// Schedule cleanup of this marker after enough time for file events
|
|
1014
|
+
setTimeout(() => templatedDirectories.delete(absPath), 1000);
|
|
1015
|
+
// Don't restart - wait for the template files to trigger the rebuild
|
|
1016
|
+
return;
|
|
1009
1017
|
} else if (changedFile?.startsWith('src/api/')) {
|
|
1010
1018
|
logger.debug('api directory created: %s', changedFile);
|
|
1011
1019
|
createAPITemplates(absPath);
|
|
1020
|
+
// Mark this directory as recently templated to avoid immediate rebuild
|
|
1021
|
+
templatedDirectories.set(absPath, Date.now());
|
|
1022
|
+
// Schedule cleanup of this marker after enough time for file events
|
|
1023
|
+
setTimeout(() => templatedDirectories.delete(absPath), 1000);
|
|
1024
|
+
// Don't restart - wait for the template files to trigger the rebuild
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// Check if this file/directory was just templated - skip restart to avoid race condition
|
|
1030
|
+
for (const [templatedPath, timestamp] of templatedDirectories.entries()) {
|
|
1031
|
+
if (absPath.startsWith(templatedPath) && Date.now() - timestamp < 500) {
|
|
1032
|
+
logger.trace(
|
|
1033
|
+
'Ignoring event in recently templated directory: %s',
|
|
1034
|
+
templatedPath
|
|
1035
|
+
);
|
|
1036
|
+
return;
|
|
1012
1037
|
}
|
|
1013
1038
|
}
|
|
1014
1039
|
|
package/src/cmd/dev/sync.ts
CHANGED
|
@@ -253,11 +253,7 @@ class DevmodeSyncService implements IDevmodeSyncService {
|
|
|
253
253
|
JSON.stringify(payload, null, 2)
|
|
254
254
|
);
|
|
255
255
|
|
|
256
|
-
await this.apiClient.post(
|
|
257
|
-
'/cli/devmode/agent',
|
|
258
|
-
payload,
|
|
259
|
-
z.object({ success: z.boolean() })
|
|
260
|
-
);
|
|
256
|
+
await this.apiClient.post('/cli/devmode/agent', payload, z.object({ success: z.boolean() }));
|
|
261
257
|
}
|
|
262
258
|
|
|
263
259
|
private async syncEvals(
|
|
@@ -279,11 +275,7 @@ class DevmodeSyncService implements IDevmodeSyncService {
|
|
|
279
275
|
JSON.stringify(payload, null, 2)
|
|
280
276
|
);
|
|
281
277
|
|
|
282
|
-
await this.apiClient.post(
|
|
283
|
-
'/cli/devmode/eval',
|
|
284
|
-
payload,
|
|
285
|
-
z.object({ success: z.boolean() })
|
|
286
|
-
);
|
|
278
|
+
await this.apiClient.post('/cli/devmode/eval', payload, z.object({ success: z.boolean() }));
|
|
287
279
|
}
|
|
288
280
|
}
|
|
289
281
|
|
|
@@ -230,11 +230,25 @@ export async function setupProject(options: SetupOptions): Promise<void> {
|
|
|
230
230
|
// Initialize git repository if git is available
|
|
231
231
|
const gitPath = Bun.which('git');
|
|
232
232
|
if (gitPath) {
|
|
233
|
+
// Get default branch from git config, fallback to 'main'
|
|
234
|
+
let defaultBranch = 'main';
|
|
235
|
+
try {
|
|
236
|
+
const result = Bun.spawnSync(['git', 'config', '--global', 'init.defaultBranch']);
|
|
237
|
+
if (result.exitCode === 0) {
|
|
238
|
+
const branch = result.stdout.toString().trim();
|
|
239
|
+
if (branch) {
|
|
240
|
+
defaultBranch = branch;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
} catch {
|
|
244
|
+
// Ignore errors, use fallback
|
|
245
|
+
}
|
|
246
|
+
|
|
233
247
|
// Git is available, initialize repository
|
|
234
248
|
await tui.runCommand({
|
|
235
|
-
command:
|
|
249
|
+
command: `git init -b ${defaultBranch}`,
|
|
236
250
|
cwd: dest,
|
|
237
|
-
cmd: ['git', 'init'],
|
|
251
|
+
cmd: ['git', 'init', '-b', defaultBranch],
|
|
238
252
|
clearOnSuccess: true,
|
|
239
253
|
});
|
|
240
254
|
|
package/src/cmd/project/list.ts
CHANGED
|
@@ -43,16 +43,9 @@ export const listSubcommand = createSubcommand({
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
if (projects) {
|
|
48
|
-
projects.sort((a, b) => {
|
|
49
|
-
return a.name.localeCompare(b.name);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
46
|
+
// Projects are sorted by createdAt (most recent first) from the API
|
|
52
47
|
|
|
53
|
-
if (options.json) {
|
|
54
|
-
console.log(JSON.stringify(projects, null, 2));
|
|
55
|
-
} else {
|
|
48
|
+
if (!options.json) {
|
|
56
49
|
tui.table(projects, ['id', 'name', 'orgName']);
|
|
57
50
|
}
|
|
58
51
|
|
package/src/index.ts
CHANGED
|
@@ -83,7 +83,7 @@ export {
|
|
|
83
83
|
type CommandHandler,
|
|
84
84
|
type TableColumn,
|
|
85
85
|
} from './repl';
|
|
86
|
-
export { runSteps,
|
|
86
|
+
export { runSteps, stepSuccess, stepSkipped, stepError } from './steps';
|
|
87
87
|
export { playSound } from './sound';
|
|
88
88
|
export {
|
|
89
89
|
downloadWithProgress,
|
|
@@ -105,4 +105,4 @@ export type {
|
|
|
105
105
|
} from './types';
|
|
106
106
|
export { createSubcommand, createCommand } from './types';
|
|
107
107
|
export type { ColorScheme } from './terminal';
|
|
108
|
-
export type { Step,
|
|
108
|
+
export type { Step, StepOutcome, StepContext } from './steps';
|