@standardagents/cli 0.21.1 → 0.22.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 CHANGED
@@ -24,7 +24,9 @@ This command will:
24
24
  - Clone the created platform-owned Artifact repository into the directory where you ran the command
25
25
  - Write `STANDARD_AGENTS_API_KEY`, `PLATFORM_ENDPOINT`, and `STANDARD_AGENTS_API_URL` to `.dev.vars`
26
26
  - Configure a repo-local Git credential helper that mints short-lived Artifacts tokens through the Standard Agents platform
27
- - Install dependencies with the detected package manager, start the local dev server, and open the local instance
27
+ - Install dependencies with the detected package manager, start the local dev server in the foreground, and open the local instance
28
+
29
+ The init command stays attached to the dev server. Press Ctrl-C in that terminal to stop it.
28
30
 
29
31
  For local platform development, point the same command at your local platform API:
30
32
 
package/dist/index.js CHANGED
@@ -239,7 +239,7 @@ function getScaffoldStandardAgentsVersion() {
239
239
  if (process.env.STANDARDAGENTS_WORKSPACE === "1") {
240
240
  return "workspace:*";
241
241
  }
242
- return "0.21.1";
242
+ return "0.22.0";
243
243
  }
244
244
  function findViteConfig(cwd) {
245
245
  const candidates = ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"];
@@ -1195,28 +1195,21 @@ ${details}`));
1195
1195
  child.on("error", reject);
1196
1196
  });
1197
1197
  }
1198
- var DEV_SERVER_LOG_FILE = ".agentbuilder-dev.log";
1199
- function startDetachedDevServer(command, args, cwd) {
1200
- const logPath = path7.join(cwd, DEV_SERVER_LOG_FILE);
1201
- const logFd = fs3.openSync(logPath, "w");
1202
- const child = spawn(command, args, {
1198
+ function devServerSpawnOptions(cwd) {
1199
+ return {
1203
1200
  cwd,
1204
- stdio: ["ignore", logFd, logFd],
1205
- shell: false,
1206
- detached: true
1207
- });
1208
- child.unref();
1209
- fs3.closeSync(logFd);
1210
- return { logPath };
1201
+ stdio: "inherit",
1202
+ shell: false
1203
+ };
1211
1204
  }
1212
- function readLogTail(logPath, maxLines = 20) {
1213
- try {
1214
- const text = fs3.readFileSync(logPath, "utf-8").trimEnd();
1215
- if (!text) return "";
1216
- return text.split("\n").slice(-maxLines).join("\n");
1217
- } catch {
1218
- return "";
1219
- }
1205
+ function startForegroundDevServer(command, args, cwd) {
1206
+ return spawn(command, args, devServerSpawnOptions(cwd));
1207
+ }
1208
+ function waitForDevServerExit(child) {
1209
+ return new Promise((resolve, reject) => {
1210
+ child.once("error", reject);
1211
+ child.once("close", (code) => resolve(code));
1212
+ });
1220
1213
  }
1221
1214
  function devCommandHint(packageManager) {
1222
1215
  if (packageManager === "npm") return "npm run dev";
@@ -1536,7 +1529,7 @@ async function ensurePlatformAuth(options, quietLogs = false, context = {}) {
1536
1529
  return { connected: true, mode: "standardagents" };
1537
1530
  }
1538
1531
  function getCliVersion() {
1539
- return "0.21.1";
1532
+ return "0.22.0";
1540
1533
  }
1541
1534
  function getSipVersion() {
1542
1535
  return "1.0.1";
@@ -2187,35 +2180,70 @@ async function runPlatformInit(projectNameArg, options) {
2187
2180
  const devPort = await findAvailablePort(5173);
2188
2181
  const devUrl = `http://127.0.0.1:${devPort}`;
2189
2182
  logger.info(`Starting local dev server at ${devUrl}...`);
2190
- const { logPath } = startDetachedDevServer(
2183
+ logger.info("The dev server will stay in this terminal. Press Ctrl-C to stop it.");
2184
+ const devProcess = startForegroundDevServer(
2191
2185
  projectPackageManager,
2192
2186
  buildDevServerCommand(projectPackageManager, devPort),
2193
2187
  projectPath
2194
2188
  );
2195
- const ready = await waitForLocalDevServer(devUrl);
2196
- if (ready) {
2189
+ const devExit = waitForDevServerExit(devProcess);
2190
+ let startup;
2191
+ try {
2192
+ startup = await Promise.race([
2193
+ waitForLocalDevServer(devUrl).then((ready) => ({ type: "ready", ready })),
2194
+ devExit.then((code) => ({ type: "exit", code }))
2195
+ ]);
2196
+ } catch (error) {
2197
+ const message = error instanceof Error ? error.message : "Unknown error";
2198
+ logger.warning(`The dev server could not start: ${message}`);
2199
+ logger.log("");
2200
+ logger.success("Your Standard Agents instance is cloned, configured, and ready.");
2201
+ logger.log(`Repository: ${repoUrl}`);
2202
+ logger.log(`Local token: ${tokenLocation}`);
2203
+ logger.log("");
2204
+ logger.log("Once any error above is resolved, start it with:");
2205
+ logger.log(` cd ${projectName}`);
2206
+ logger.log(` ${devCommandHint(projectPackageManager)}`);
2207
+ return;
2208
+ }
2209
+ if (startup.type === "ready" && startup.ready) {
2197
2210
  openUrl(devUrl);
2198
2211
  logger.success("Project is connected to Standard Agents.");
2199
2212
  logger.log(`Repository: ${repoUrl}`);
2200
2213
  logger.log(`Dev server: ${devUrl}`);
2201
2214
  logger.log(`Local token: ${tokenLocation}`);
2215
+ logger.log("");
2216
+ logger.log("The dev server is running in the foreground. Press Ctrl-C to stop it.");
2217
+ const exitCode2 = await devExit;
2218
+ if (exitCode2 !== null && exitCode2 !== 0) {
2219
+ logger.warning(`Dev server exited with code ${exitCode2}.`);
2220
+ }
2202
2221
  return;
2203
2222
  }
2204
- logger.warning(`The dev server didn't respond at ${devUrl} within 60s.`);
2205
- const tail = readLogTail(logPath);
2206
- if (tail) {
2223
+ if (startup.type === "exit") {
2224
+ logger.warning(`The dev server exited before it responded at ${devUrl}.`);
2207
2225
  logger.log("");
2208
- logger.log(`Last dev server output (full log: ${path7.relative(cwd, logPath)}):`);
2209
- logger.log(tail);
2226
+ logger.success("Your Standard Agents instance is cloned, configured, and ready.");
2227
+ logger.log(`Repository: ${repoUrl}`);
2228
+ logger.log(`Local token: ${tokenLocation}`);
2229
+ logger.log("");
2230
+ logger.log("Once any error above is resolved, start it with:");
2231
+ logger.log(` cd ${projectName}`);
2232
+ logger.log(` ${devCommandHint(projectPackageManager)}`);
2233
+ return;
2210
2234
  }
2235
+ logger.warning(`The dev server didn't respond at ${devUrl} within 60s.`);
2211
2236
  logger.log("");
2212
2237
  logger.success("Your Standard Agents instance is cloned, configured, and ready.");
2213
2238
  logger.log(`Repository: ${repoUrl}`);
2239
+ logger.log(`Dev server: ${devUrl}`);
2214
2240
  logger.log(`Local token: ${tokenLocation}`);
2215
2241
  logger.log("");
2216
- logger.log("Once any error above is resolved, start it with:");
2217
- logger.log(` cd ${projectName}`);
2218
- logger.log(` ${devCommandHint(projectPackageManager)}`);
2242
+ logger.log("The dev server process is still running in this terminal. Press Ctrl-C to stop it.");
2243
+ const exitCode = await devExit;
2244
+ if (exitCode !== null && exitCode !== 0) {
2245
+ logger.warning(`Dev server exited with code ${exitCode}.`);
2246
+ }
2219
2247
  }
2220
2248
  async function init(projectNameArg, options = {}) {
2221
2249
  if (!options.local) {
@@ -5163,7 +5191,7 @@ async function settleStdinForInitHandoff(stdin = process.stdin) {
5163
5191
  }
5164
5192
  }
5165
5193
  var program = new Command();
5166
- program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.21.1");
5194
+ program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.22.0");
5167
5195
  program.command("init [project-name]").description("Create a new Standard Agents project").option("-y, --yes", "Skip prompts and use defaults").option("--local", "Use local project scaffolding instead of browser platform onboarding").option("--cli", "Use classic line-by-line CLI prompts instead of the TUI wizard").option("--api-url <url>", "Standard Agents platform API URL").option("--endpoint <url>", "Platform API endpoint for auth/bootstrap exchange").option("--package-manager <manager>", "Package manager for generated project: npm, pnpm, yarn, or bun").option("--template <template>", "Vite template to use", "vanilla-ts").option("--workspace", "Install @standardagents packages as workspace:* (local pnpm workspace development)").option("--no-dev", "Clone and configure the project without starting the dev server").addOption(new Option("--bootstrap <code>", "Exchange a web onboarding bootstrap code")).action(init);
5168
5196
  program.command("login").description("Authenticate this machine (or use --bootstrap for project bootstrap auth)").option("--bootstrap <code>", "Bootstrap code from web onboarding").option("--endpoint <url>", "Platform API endpoint (default: https://api.standardagents.ai)").option("--no-open", "Do not auto-open browser URL").action(login);
5169
5197
  program.command("logout").description("Clear stored StandardAgents auth and local org-scoped project auth").option("--org <org-id-or-slug>", "Org ID or slug to logout (defaults to active org)").option("--endpoint <url>", "Platform API endpoint (default: https://api.standardagents.ai)").action(logout);