@standardagents/cli 0.21.1 → 0.22.1
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 +3 -1
- package/dist/index.js +67 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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.
|
|
242
|
+
return "0.22.1";
|
|
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
|
-
|
|
1199
|
-
|
|
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:
|
|
1205
|
-
shell: false
|
|
1206
|
-
|
|
1207
|
-
});
|
|
1208
|
-
child.unref();
|
|
1209
|
-
fs3.closeSync(logFd);
|
|
1210
|
-
return { logPath };
|
|
1201
|
+
stdio: "inherit",
|
|
1202
|
+
shell: false
|
|
1203
|
+
};
|
|
1211
1204
|
}
|
|
1212
|
-
function
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
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.
|
|
1532
|
+
return "0.22.1";
|
|
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
|
-
|
|
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
|
|
2196
|
-
|
|
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
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2223
|
+
if (startup.type === "exit") {
|
|
2224
|
+
logger.warning(`The dev server exited before it responded at ${devUrl}.`);
|
|
2225
|
+
logger.log("");
|
|
2226
|
+
logger.success("Your Standard Agents instance is cloned, configured, and ready.");
|
|
2227
|
+
logger.log(`Repository: ${repoUrl}`);
|
|
2228
|
+
logger.log(`Local token: ${tokenLocation}`);
|
|
2207
2229
|
logger.log("");
|
|
2208
|
-
logger.log(
|
|
2209
|
-
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("
|
|
2217
|
-
|
|
2218
|
-
|
|
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) {
|
|
@@ -5057,7 +5085,11 @@ function runGit(args, runner) {
|
|
|
5057
5085
|
function configureStandardAgentsGitCredentials(options = {}) {
|
|
5058
5086
|
const runner = options.gitRunner ?? defaultGitRunner;
|
|
5059
5087
|
const helperCommand = options.helperCommand?.trim() || process.env.STANDARD_AGENTS_GIT_HELPER || DEFAULT_GIT_HELPER_COMMAND;
|
|
5060
|
-
const
|
|
5088
|
+
const existingResult = runner(["config", "--global", "--get-all", "credential.helper"]);
|
|
5089
|
+
if (existingResult.status !== 0 && existingResult.stderr.trim()) {
|
|
5090
|
+
throw new Error(existingResult.stderr.trim());
|
|
5091
|
+
}
|
|
5092
|
+
const existing = existingResult.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
5061
5093
|
let helperAdded = false;
|
|
5062
5094
|
if (!existing.includes(helperCommand)) {
|
|
5063
5095
|
runGit(["config", "--global", "--add", "credential.helper", helperCommand], runner);
|
|
@@ -5163,7 +5195,7 @@ async function settleStdinForInitHandoff(stdin = process.stdin) {
|
|
|
5163
5195
|
}
|
|
5164
5196
|
}
|
|
5165
5197
|
var program = new Command();
|
|
5166
|
-
program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.
|
|
5198
|
+
program.name("agents").description("CLI tool for Standard Agents / AgentBuilder").version("0.22.1");
|
|
5167
5199
|
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
5200
|
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
5201
|
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);
|