@agentproto/cli 0.1.0-alpha.9 → 0.1.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 +4 -4
- package/dist/cli.mjs +29 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +26 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -6263,12 +6263,34 @@ async function runServe(args) {
|
|
|
6263
6263
|
port: { type: "string", short: "p" },
|
|
6264
6264
|
bind: { type: "string", short: "b" },
|
|
6265
6265
|
"allow-origin": { type: "string", multiple: true },
|
|
6266
|
-
interactive: { type: "boolean", short: "i" }
|
|
6266
|
+
interactive: { type: "boolean", short: "i" },
|
|
6267
|
+
profile: { type: "string" }
|
|
6267
6268
|
}
|
|
6268
6269
|
});
|
|
6269
6270
|
const cfg = await loadConfig();
|
|
6270
|
-
const
|
|
6271
|
-
const
|
|
6271
|
+
const profileName = values.profile ?? cfg.activeProfile;
|
|
6272
|
+
const profile = profileName ? cfg.profiles?.[profileName] : void 0;
|
|
6273
|
+
if (values.profile && !profile) {
|
|
6274
|
+
process.stderr.write(
|
|
6275
|
+
`agentproto serve: profile "${values.profile}" not found in ~/.agentproto/config.json. Available: ${cfg.profiles ? Object.keys(cfg.profiles).join(", ") || "(none)" : "(no profiles block)"}
|
|
6276
|
+
`
|
|
6277
|
+
);
|
|
6278
|
+
return 2;
|
|
6279
|
+
}
|
|
6280
|
+
if (cfg.activeProfile && !values.profile && !profile) {
|
|
6281
|
+
process.stderr.write(
|
|
6282
|
+
`agentproto serve: \u26A0 activeProfile="${cfg.activeProfile}" but no matching entry in profiles[]; falling back to top-level config.
|
|
6283
|
+
`
|
|
6284
|
+
);
|
|
6285
|
+
}
|
|
6286
|
+
if (profile && process.stdout.isTTY) {
|
|
6287
|
+
process.stdout.write(
|
|
6288
|
+
`agentproto serve: using profile "${profileName}"
|
|
6289
|
+
`
|
|
6290
|
+
);
|
|
6291
|
+
}
|
|
6292
|
+
const cfgDaemon = { ...cfg.daemon ?? {}, ...profile?.daemon ?? {} };
|
|
6293
|
+
const cfgTunnel = { ...cfg.tunnel ?? {}, ...profile?.tunnel ?? {} };
|
|
6272
6294
|
const workspace = resolve(
|
|
6273
6295
|
values.workspace ?? cfgDaemon.workspace ?? process.cwd()
|
|
6274
6296
|
);
|
|
@@ -6297,7 +6319,7 @@ async function runServe(args) {
|
|
|
6297
6319
|
}
|
|
6298
6320
|
const label = values.label ?? cfgDaemon.label ?? `${userInfo().username}@${hostname()}`;
|
|
6299
6321
|
const connectFlag = values.connect ?? (cfgTunnel.autoconnect && cfgTunnel.host ? cfgTunnel.host : void 0);
|
|
6300
|
-
let token = values.token ?? process.env.AGENTPROTO_TOKEN;
|
|
6322
|
+
let token = values.token ?? process.env.AGENTPROTO_TOKEN ?? cfgTunnel.token;
|
|
6301
6323
|
if (!token && connectFlag) {
|
|
6302
6324
|
const cred = await readHost(connectFlag);
|
|
6303
6325
|
if (cred) {
|