@agentuity/cli 0.0.76 → 0.0.78
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/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +73 -12
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +4 -0
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/route-registry.d.ts +2 -0
- package/dist/cmd/build/route-registry.d.ts.map +1 -1
- package/dist/cmd/build/route-registry.js +5 -1
- 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 +6 -1
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +18 -1
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/env-util.d.ts +10 -0
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +16 -0
- package/dist/env-util.js.map +1 -1
- package/dist/legacy-check.d.ts.map +1 -1
- package/dist/legacy-check.js +2 -2
- package/dist/legacy-check.js.map +1 -1
- package/package.json +3 -3
- package/src/cmd/build/ast.ts +74 -15
- package/src/cmd/build/bundler.ts +5 -0
- package/src/cmd/build/route-registry.ts +7 -1
- package/src/cmd/cloud/deploy.ts +8 -0
- package/src/cmd/dev/index.ts +20 -1
- package/src/config.ts +1 -1
- package/src/env-util.ts +23 -0
- package/src/legacy-check.ts +4 -2
package/dist/legacy-check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-check.js","sourceRoot":"","sources":["../src/legacy-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM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AAC;YACtC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;YAExD,IAAI,OAAO,CAAC,MAAM,KAAK,gBAAgB,EAAE,CAAC;gBACzC,GAAG,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACP,GAAG,CAAC,MAAM,CAAC,YAAY,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;YACzC,CAAC;QACF,CAAC;QACD,GAAG,CAAC,OAAO,EAAE,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAC;IACrD,GAAG,CAAC,OAAO,EAAE,CAAC;IAEd,OAAO,CAAC,GAAG,CACV,iBAAiB,GAAG,CAAC,IAAI,CAAC,4DAA4D,CAAC,EAAE,CACzF,CAAC;IACF,GAAG,CAAC,OAAO,EAAE,CAAC;IAEd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.78",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"prepublishOnly": "bun run clean && bun run build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@agentuity/core": "0.0.
|
|
39
|
-
"@agentuity/server": "0.0.
|
|
38
|
+
"@agentuity/core": "0.0.78",
|
|
39
|
+
"@agentuity/server": "0.0.78",
|
|
40
40
|
"@datasert/cronjs-parser": "^1.4.0",
|
|
41
41
|
"@terascope/fetch-github-release": "^2.2.1",
|
|
42
42
|
"acorn-loose": "^8.5.2",
|
package/src/cmd/build/ast.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface ASTObjectExpression extends ASTNode {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
interface ASTLiteral extends ASTNode {
|
|
51
|
-
value: string;
|
|
51
|
+
value: string | number | boolean | null;
|
|
52
52
|
raw?: string;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -75,7 +75,7 @@ function parseObjectExpressionToMap(expr: ASTObjectExpression): Map<string, stri
|
|
|
75
75
|
switch (prop.value.type) {
|
|
76
76
|
case 'Literal': {
|
|
77
77
|
const value = prop.value as unknown as ASTLiteral;
|
|
78
|
-
result.set(prop.key.name, value.value);
|
|
78
|
+
result.set(prop.key.name, String(value.value));
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
default: {
|
|
@@ -255,7 +255,8 @@ function augmentAgentMetadataNode(
|
|
|
255
255
|
}
|
|
256
256
|
const name = metadata.get('name')!;
|
|
257
257
|
const descriptionNode = propvalue.properties.find((x) => x.key.name === 'description')?.value;
|
|
258
|
-
const
|
|
258
|
+
const descriptionValue = descriptionNode ? (descriptionNode as ASTLiteral).value : '';
|
|
259
|
+
const description = typeof descriptionValue === 'string' ? descriptionValue : '';
|
|
259
260
|
const agentId = generateStableAgentId(projectId, name);
|
|
260
261
|
metadata.set('version', version);
|
|
261
262
|
metadata.set('filename', rel);
|
|
@@ -414,7 +415,7 @@ export function parseEvalMetadata(
|
|
|
414
415
|
firstArg.type === 'Literal' &&
|
|
415
416
|
typeof (firstArg as ASTLiteral).value === 'string'
|
|
416
417
|
) {
|
|
417
|
-
evalName = (firstArg as ASTLiteral).value;
|
|
418
|
+
evalName = (firstArg as ASTLiteral).value as string;
|
|
418
419
|
} else {
|
|
419
420
|
throw new MetadataError({
|
|
420
421
|
filename,
|
|
@@ -435,7 +436,9 @@ export function parseEvalMetadata(
|
|
|
435
436
|
prop.key.name === 'description'
|
|
436
437
|
) {
|
|
437
438
|
if (prop.value.type === 'Literal') {
|
|
438
|
-
|
|
439
|
+
const literalValue = (prop.value as ASTLiteral).value;
|
|
440
|
+
evalDescription =
|
|
441
|
+
typeof literalValue === 'string' ? literalValue : undefined;
|
|
439
442
|
}
|
|
440
443
|
}
|
|
441
444
|
}
|
|
@@ -777,6 +780,7 @@ interface ValidatorInfo {
|
|
|
777
780
|
agentVariable?: string;
|
|
778
781
|
inputSchemaVariable?: string;
|
|
779
782
|
outputSchemaVariable?: string;
|
|
783
|
+
stream?: boolean;
|
|
780
784
|
}
|
|
781
785
|
|
|
782
786
|
function hasValidatorCall(args: unknown[]): ValidatorInfo {
|
|
@@ -826,14 +830,16 @@ function hasValidatorCall(args: unknown[]): ValidatorInfo {
|
|
|
826
830
|
}
|
|
827
831
|
|
|
828
832
|
/**
|
|
829
|
-
* Extract schema variable names from validator() call arguments
|
|
830
|
-
* Example: validator({ input: myInputSchema, output: myOutputSchema })
|
|
833
|
+
* Extract schema variable names and stream flag from validator() call arguments
|
|
834
|
+
* Example: validator({ input: myInputSchema, output: myOutputSchema, stream: true })
|
|
831
835
|
*/
|
|
832
836
|
function extractValidatorSchemas(callExpr: ASTCallExpression): {
|
|
833
837
|
inputSchemaVariable?: string;
|
|
834
838
|
outputSchemaVariable?: string;
|
|
839
|
+
stream?: boolean;
|
|
835
840
|
} {
|
|
836
|
-
const result: { inputSchemaVariable?: string; outputSchemaVariable?: string } =
|
|
841
|
+
const result: { inputSchemaVariable?: string; outputSchemaVariable?: string; stream?: boolean } =
|
|
842
|
+
{};
|
|
837
843
|
|
|
838
844
|
// Check if validator has arguments
|
|
839
845
|
if (!callExpr.arguments || callExpr.arguments.length === 0) {
|
|
@@ -848,7 +854,17 @@ function extractValidatorSchemas(callExpr: ASTCallExpression): {
|
|
|
848
854
|
|
|
849
855
|
const objExpr = firstArg as ASTObjectExpression;
|
|
850
856
|
for (const prop of objExpr.properties) {
|
|
851
|
-
|
|
857
|
+
// Extract key name defensively - could be Identifier or Literal
|
|
858
|
+
let keyName: string | undefined;
|
|
859
|
+
const propKey = prop.key as { type: string; name?: string; value?: unknown };
|
|
860
|
+
if (propKey.type === 'Identifier') {
|
|
861
|
+
keyName = propKey.name;
|
|
862
|
+
} else if (propKey.type === 'Literal') {
|
|
863
|
+
keyName = String(propKey.value);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
if (!keyName) continue;
|
|
867
|
+
|
|
852
868
|
if ((keyName === 'input' || keyName === 'output') && prop.value.type === 'Identifier') {
|
|
853
869
|
const valueName = (prop.value as ASTNodeIdentifier).name;
|
|
854
870
|
if (keyName === 'input') {
|
|
@@ -857,6 +873,46 @@ function extractValidatorSchemas(callExpr: ASTCallExpression): {
|
|
|
857
873
|
result.outputSchemaVariable = valueName;
|
|
858
874
|
}
|
|
859
875
|
}
|
|
876
|
+
// Extract stream flag - can be Literal, Identifier, or UnaryExpression (!0 or !1)
|
|
877
|
+
if (keyName === 'stream') {
|
|
878
|
+
if (prop.value.type === 'Literal') {
|
|
879
|
+
const literal = prop.value as ASTLiteral;
|
|
880
|
+
if (typeof literal.value === 'boolean') {
|
|
881
|
+
result.stream = literal.value;
|
|
882
|
+
}
|
|
883
|
+
} else if (prop.value.type === 'Identifier') {
|
|
884
|
+
const identifier = prop.value as ASTNodeIdentifier;
|
|
885
|
+
// Handle stream: true or stream: false as identifiers
|
|
886
|
+
if (identifier.name === 'true') {
|
|
887
|
+
result.stream = true;
|
|
888
|
+
} else if (identifier.name === 'false') {
|
|
889
|
+
result.stream = false;
|
|
890
|
+
}
|
|
891
|
+
} else if (prop.value.type === 'UnaryExpression') {
|
|
892
|
+
// Handle !0 (true) or !1 (false) - acorn-loose transpiles booleans this way
|
|
893
|
+
const unary = prop.value as { type: string; operator?: string; argument?: ASTNode };
|
|
894
|
+
if (unary.argument?.type === 'Literal') {
|
|
895
|
+
const literal = unary.argument as ASTLiteral;
|
|
896
|
+
// Numeric literal: !0 = true, !1 = false
|
|
897
|
+
if (typeof literal.value === 'number') {
|
|
898
|
+
if (unary.operator === '!') {
|
|
899
|
+
result.stream = literal.value === 0;
|
|
900
|
+
}
|
|
901
|
+
} else if (typeof literal.value === 'boolean') {
|
|
902
|
+
result.stream = unary.operator === '!' ? !literal.value : literal.value;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
// Handle true/false as identifiers
|
|
906
|
+
if (unary.argument?.type === 'Identifier') {
|
|
907
|
+
const identifier = unary.argument as ASTNodeIdentifier;
|
|
908
|
+
if (identifier.name === 'true') {
|
|
909
|
+
result.stream = unary.operator === '!' ? false : true;
|
|
910
|
+
} else if (identifier.name === 'false') {
|
|
911
|
+
result.stream = unary.operator === '!' ? true : false;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
860
916
|
}
|
|
861
917
|
|
|
862
918
|
return result;
|
|
@@ -883,7 +939,7 @@ function extractZValidatorSchema(callExpr: ASTCallExpression): {
|
|
|
883
939
|
if (targetArg.type === 'Literal') {
|
|
884
940
|
const targetValue = (targetArg as ASTLiteral).value;
|
|
885
941
|
// Only extract schemas for JSON body validation
|
|
886
|
-
if (targetValue !== 'json') {
|
|
942
|
+
if (typeof targetValue === 'string' && targetValue !== 'json') {
|
|
887
943
|
return result;
|
|
888
944
|
}
|
|
889
945
|
} else {
|
|
@@ -1051,7 +1107,7 @@ export async function parseRoute(
|
|
|
1051
1107
|
case 'patch':
|
|
1052
1108
|
case 'delete': {
|
|
1053
1109
|
if (action && (action as ASTLiteral).type === 'Literal') {
|
|
1054
|
-
suffix = (action as ASTLiteral).value;
|
|
1110
|
+
suffix = String((action as ASTLiteral).value);
|
|
1055
1111
|
} else {
|
|
1056
1112
|
throw new InvalidRouterConfigError({
|
|
1057
1113
|
filename,
|
|
@@ -1068,7 +1124,7 @@ export async function parseRoute(
|
|
|
1068
1124
|
method = 'post';
|
|
1069
1125
|
const theaction = action as ASTLiteral;
|
|
1070
1126
|
if (theaction.type === 'Literal') {
|
|
1071
|
-
suffix = theaction.value;
|
|
1127
|
+
suffix = String(theaction.value);
|
|
1072
1128
|
break;
|
|
1073
1129
|
}
|
|
1074
1130
|
break;
|
|
@@ -1088,7 +1144,7 @@ export async function parseRoute(
|
|
|
1088
1144
|
const number = theaction.properties.find((p) => p.key.name === 'number');
|
|
1089
1145
|
if (number && number.value.type === 'Literal') {
|
|
1090
1146
|
const phoneNumber = number.value as ASTLiteral;
|
|
1091
|
-
suffix = hash(phoneNumber.value);
|
|
1147
|
+
suffix = hash(String(phoneNumber.value));
|
|
1092
1148
|
break;
|
|
1093
1149
|
}
|
|
1094
1150
|
}
|
|
@@ -1099,7 +1155,7 @@ export async function parseRoute(
|
|
|
1099
1155
|
method = 'post';
|
|
1100
1156
|
const theaction = action as ASTLiteral;
|
|
1101
1157
|
if (theaction.type === 'Literal') {
|
|
1102
|
-
const email = theaction.value;
|
|
1158
|
+
const email = String(theaction.value);
|
|
1103
1159
|
suffix = hash(email);
|
|
1104
1160
|
break;
|
|
1105
1161
|
}
|
|
@@ -1110,7 +1166,7 @@ export async function parseRoute(
|
|
|
1110
1166
|
method = 'post';
|
|
1111
1167
|
const theaction = action as ASTLiteral;
|
|
1112
1168
|
if (theaction.type === 'Literal') {
|
|
1113
|
-
const expression = theaction.value;
|
|
1169
|
+
const expression = String(theaction.value);
|
|
1114
1170
|
try {
|
|
1115
1171
|
parseCronExpression(expression, { hasSeconds: false });
|
|
1116
1172
|
} catch (ex) {
|
|
@@ -1169,6 +1225,9 @@ export async function parseRoute(
|
|
|
1169
1225
|
if (validatorInfo.outputSchemaVariable) {
|
|
1170
1226
|
routeConfig.outputSchemaVariable = validatorInfo.outputSchemaVariable;
|
|
1171
1227
|
}
|
|
1228
|
+
if (validatorInfo.stream !== undefined) {
|
|
1229
|
+
routeConfig.stream = validatorInfo.stream;
|
|
1230
|
+
}
|
|
1172
1231
|
}
|
|
1173
1232
|
|
|
1174
1233
|
routes.push({
|
package/src/cmd/build/bundler.ts
CHANGED
|
@@ -289,6 +289,9 @@ export async function bundle({
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
const tsconfigPath = join(rootDir, 'tsconfig.json');
|
|
293
|
+
const hasTsconfig = existsSync(tsconfigPath);
|
|
294
|
+
|
|
292
295
|
await (async () => {
|
|
293
296
|
const config: Bun.BuildConfig = {
|
|
294
297
|
entrypoints: appEntrypoints,
|
|
@@ -313,6 +316,7 @@ export async function bundle({
|
|
|
313
316
|
chunk: 'chunk/[name]-[hash].[ext]',
|
|
314
317
|
asset: 'asset/[name]-[hash].[ext]',
|
|
315
318
|
},
|
|
319
|
+
tsconfig: hasTsconfig ? tsconfigPath : undefined,
|
|
316
320
|
};
|
|
317
321
|
const buildResult = await Bun.build(config);
|
|
318
322
|
if (!buildResult.success) {
|
|
@@ -432,6 +436,7 @@ export async function bundle({
|
|
|
432
436
|
chunk: 'web/chunk/[name]-[hash].[ext]',
|
|
433
437
|
asset: 'web/asset/[name]-[hash].[ext]',
|
|
434
438
|
},
|
|
439
|
+
tsconfig: hasTsconfig ? tsconfigPath : undefined,
|
|
435
440
|
};
|
|
436
441
|
const result = await Bun.build(config);
|
|
437
442
|
if (result.success) {
|
|
@@ -25,6 +25,8 @@ export interface RouteInfo {
|
|
|
25
25
|
inputSchemaVariable?: string;
|
|
26
26
|
/** Output schema variable name if using validator({ output }) */
|
|
27
27
|
outputSchemaVariable?: string;
|
|
28
|
+
/** Whether this route is a streaming route (from validator({ stream: true })) */
|
|
29
|
+
stream?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -38,7 +40,8 @@ export interface RouteInfo {
|
|
|
38
40
|
*/
|
|
39
41
|
export function generateRouteRegistry(srcDir: string, routes: RouteInfo[]): void {
|
|
40
42
|
// Filter routes by type (include ALL routes, not just those with validators)
|
|
41
|
-
|
|
43
|
+
// Note: 'stream' routes are HTTP routes that return ReadableStream, so include them with API routes
|
|
44
|
+
const apiRoutes = routes.filter((r) => r.routeType === 'api' || r.routeType === 'stream');
|
|
42
45
|
const websocketRoutes = routes.filter((r) => r.routeType === 'websocket');
|
|
43
46
|
const sseRoutes = routes.filter((r) => r.routeType === 'sse');
|
|
44
47
|
|
|
@@ -142,6 +145,7 @@ export function generateRouteRegistry(srcDir: string, routes: RouteInfo[]): void
|
|
|
142
145
|
return ` '${routeKey}': {
|
|
143
146
|
inputSchema: typeof ${importName} extends { inputSchema?: infer I } ? I : never;
|
|
144
147
|
outputSchema: typeof ${importName} extends { outputSchema?: infer O } ? O : never;
|
|
148
|
+
stream: typeof ${importName} extends { stream?: infer S } ? S : false;
|
|
145
149
|
};`;
|
|
146
150
|
}
|
|
147
151
|
|
|
@@ -153,9 +157,11 @@ export function generateRouteRegistry(srcDir: string, routes: RouteInfo[]): void
|
|
|
153
157
|
const outputType = route.outputSchemaVariable
|
|
154
158
|
? `typeof ${route.outputSchemaVariable}`
|
|
155
159
|
: 'never';
|
|
160
|
+
const streamValue = route.stream === true ? 'true' : 'false';
|
|
156
161
|
return ` '${routeKey}': {
|
|
157
162
|
inputSchema: ${inputType};
|
|
158
163
|
outputSchema: ${outputType};
|
|
164
|
+
stream: ${streamValue};
|
|
159
165
|
};`;
|
|
160
166
|
}
|
|
161
167
|
|
package/src/cmd/cloud/deploy.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type DeploymentInstructions,
|
|
28
28
|
type DeploymentComplete,
|
|
29
29
|
type DeploymentStatusResult,
|
|
30
|
+
getAppBaseURL,
|
|
30
31
|
} from '@agentuity/server';
|
|
31
32
|
import {
|
|
32
33
|
findEnvFile,
|
|
@@ -51,6 +52,7 @@ const DeployResponseSchema = z.object({
|
|
|
51
52
|
deployment: z.string().describe('Deployment-specific URL'),
|
|
52
53
|
latest: z.string().describe('Latest/active deployment URL'),
|
|
53
54
|
custom: z.array(z.string()).optional().describe('Custom domain URLs'),
|
|
55
|
+
dashboard: z.string().describe('The dashboard URL for the deployment'),
|
|
54
56
|
})
|
|
55
57
|
.optional()
|
|
56
58
|
.describe('Deployment URLs'),
|
|
@@ -551,6 +553,10 @@ export const deploySubcommand = createSubcommand({
|
|
|
551
553
|
tui.success('Your project was deployed!');
|
|
552
554
|
}
|
|
553
555
|
|
|
556
|
+
const appUrl = getAppBaseURL(config?.name, config?.overrides);
|
|
557
|
+
|
|
558
|
+
const dashboard = `${appUrl}/r/${deployment.id}`;
|
|
559
|
+
|
|
554
560
|
// Show deployment URLs
|
|
555
561
|
if (complete?.publicUrls) {
|
|
556
562
|
tui.arrow(tui.bold(tui.padRight('Deployment ID:', 17)) + tui.link(deployment.id));
|
|
@@ -566,6 +572,7 @@ export const deploySubcommand = createSubcommand({
|
|
|
566
572
|
tui.arrow(
|
|
567
573
|
tui.bold(tui.padRight('Project URL:', 17)) + tui.link(complete.publicUrls.latest)
|
|
568
574
|
);
|
|
575
|
+
tui.arrow(tui.bold(tui.padRight('Dashboard URL:', 17)) + tui.link(dashboard));
|
|
569
576
|
}
|
|
570
577
|
}
|
|
571
578
|
|
|
@@ -579,6 +586,7 @@ export const deploySubcommand = createSubcommand({
|
|
|
579
586
|
deployment: complete.publicUrls.deployment,
|
|
580
587
|
latest: complete.publicUrls.latest,
|
|
581
588
|
custom: complete.publicUrls.custom,
|
|
589
|
+
dashboard,
|
|
582
590
|
}
|
|
583
591
|
: undefined,
|
|
584
592
|
};
|
package/src/cmd/dev/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { getDevmodeDeploymentId } from '../build/ast';
|
|
|
23
23
|
import { BuildMetadata } from '@agentuity/server';
|
|
24
24
|
import { getCommand } from '../../command-prefix';
|
|
25
25
|
import { notifyWorkbenchClients } from '../../utils/workbench-notify';
|
|
26
|
+
import { getEnvFilePaths, readEnvFile } from '../../env-util';
|
|
26
27
|
|
|
27
28
|
const shouldDisableInteractive = (interactive?: boolean) => {
|
|
28
29
|
if (!interactive) {
|
|
@@ -183,7 +184,25 @@ export const command = createCommand({
|
|
|
183
184
|
|
|
184
185
|
showBanner();
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
// Load .env file(s) based on config profile (Bun no longer auto-loads .env files)
|
|
188
|
+
const isProduction = process.env.NODE_ENV === 'production' || config?.name !== 'local';
|
|
189
|
+
const envFiles = getEnvFilePaths(rootDir, {
|
|
190
|
+
configName: config?.name,
|
|
191
|
+
isProduction,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Load and merge all .env files (later files override earlier ones)
|
|
195
|
+
let envVars: Record<string, string> = {};
|
|
196
|
+
for (const envFilePath of envFiles) {
|
|
197
|
+
if (await Bun.file(envFilePath).exists()) {
|
|
198
|
+
const vars = await readEnvFile(envFilePath);
|
|
199
|
+
envVars = { ...envVars, ...vars };
|
|
200
|
+
logger.debug('Loaded environment variables from %s', envFilePath);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Start with process.env and merge in .env file vars
|
|
205
|
+
const env: Record<string, string | undefined> = { ...process.env, ...envVars };
|
|
187
206
|
env.AGENTUITY_SDK_DEV_MODE = 'true';
|
|
188
207
|
env.AGENTUITY_ENV = 'development';
|
|
189
208
|
env.NODE_ENV = 'development';
|
package/src/config.ts
CHANGED
|
@@ -253,7 +253,7 @@ export async function saveConfig(config: Config, customPath?: string): Promise<v
|
|
|
253
253
|
cachedConfig = config;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
async function getOrInitConfig(): Promise<Config> {
|
|
256
|
+
export async function getOrInitConfig(): Promise<Config> {
|
|
257
257
|
const config = await loadConfig();
|
|
258
258
|
if (config) {
|
|
259
259
|
return config;
|
package/src/env-util.ts
CHANGED
|
@@ -32,6 +32,29 @@ export async function findExistingEnvFile(dir: string): Promise<string> {
|
|
|
32
32
|
return defaultEnv;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Find env files to load based on config profile.
|
|
37
|
+
* Returns list of .env file paths in order of precedence:
|
|
38
|
+
* - For production or non-local: .env.{configName}, .env, .env.production
|
|
39
|
+
* - For local/development: .env.{configName}, .env.development, .env
|
|
40
|
+
*/
|
|
41
|
+
export function getEnvFilePaths(
|
|
42
|
+
dir: string,
|
|
43
|
+
options: { configName?: string; isProduction?: boolean }
|
|
44
|
+
): string[] {
|
|
45
|
+
const { configName, isProduction = false } = options;
|
|
46
|
+
|
|
47
|
+
const files: string[] = isProduction
|
|
48
|
+
? ['.env', '.env.production']
|
|
49
|
+
: ['.env.development', '.env'];
|
|
50
|
+
|
|
51
|
+
if (configName) {
|
|
52
|
+
files.unshift(`.env.${configName}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return files.map((f) => join(dir, f));
|
|
56
|
+
}
|
|
57
|
+
|
|
35
58
|
/**
|
|
36
59
|
* Parse a single line from an .env file
|
|
37
60
|
* Handles comments, empty lines, and quoted values
|
package/src/legacy-check.ts
CHANGED
|
@@ -117,10 +117,12 @@ export async function checkLegacyCLI(): Promise<void> {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
console.log(' ' + tui.bold('After removal, install the new CLI:'));
|
|
120
|
-
tui.bullet('
|
|
120
|
+
tui.bullet('curl -sSL https://v1.agentuity.sh | sh');
|
|
121
121
|
tui.newline();
|
|
122
122
|
|
|
123
|
-
console.log(
|
|
123
|
+
console.log(
|
|
124
|
+
` Learn more: ${tui.link('https://preview.agentuity.dev/v1/Reference/migration-guide')}`
|
|
125
|
+
);
|
|
124
126
|
tui.newline();
|
|
125
127
|
|
|
126
128
|
process.exit(1);
|