@standardagents/cli 0.45.7 → 0.45.9

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/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, Option, CommanderError } from 'commander';
3
- import path18 from 'path';
4
- import fs13 from 'fs';
3
+ import path19 from 'path';
4
+ import fs14 from 'fs';
5
+ import { applyEdits, modify, parse as parse$1 } from 'jsonc-parser';
6
+ import { LOCKSTEP_FRAMEWORK_PACKAGES, STANDARD_AGENTS_NPM_SCOPE, FIRST_PARTY_PROVIDER_PACKAGES, AGENT_DOCS, BUILD_GUARD_SCRIPT, renderPnpmWorkspaceYaml, renderAgentBuilderSupportFiles, STANDARD_AGENTS_NPM_REGISTRY, ROOT_AGENTS_MD_UNLINKED, renderAgentSkill } from '@standardagents/agentbuilder-template';
5
7
  import { fileURLToPath, pathToFileURL } from 'url';
6
8
  import crypto2, { createHash } from 'crypto';
7
9
  import childProcess, { spawn, spawnSync, execFileSync } from 'child_process';
8
10
  import os5 from 'os';
9
11
  import net from 'net';
10
- import { STANDARD_AGENTS_NPM_SCOPE, FIRST_PARTY_PROVIDER_PACKAGES, AGENT_DOCS, BUILD_GUARD_SCRIPT, renderPnpmWorkspaceYaml, renderAgentBuilderSupportFiles, STANDARD_AGENTS_NPM_REGISTRY, ROOT_AGENTS_MD_UNLINKED } from '@standardagents/agentbuilder-template';
11
12
  import chalk from 'chalk';
12
13
  import { parse, parseDocument, visit, isScalar, isNode, isMap } from 'yaml';
13
- import { parse as parse$1, applyEdits, modify } from 'jsonc-parser';
14
14
  import { loadFile, writeFile, generateCode, builders } from 'magicast';
15
15
  import { addVitePlugin, getDefaultExportOptions } from 'magicast/helpers';
16
16
  import { useState, useMemo } from 'react';
@@ -20,47 +20,276 @@ import readline from 'readline';
20
20
  import { createRequire } from 'module';
21
21
  import { copySkill } from '@standardagents/skill';
22
22
 
23
+ // src/utils/platform-endpoint.ts
24
+ var DEFAULT_PLATFORM_ENDPOINT = "https://api.standardagents.ai";
25
+ var PLATFORM_ENDPOINT_ENV_KEYS = [
26
+ "STANDARD_AGENTS_API_URL",
27
+ "PLATFORM_ENDPOINT",
28
+ "STANDARD_AGENTS_PLATFORM_URL"
29
+ ];
30
+ function normalizePlatformEndpoint(value) {
31
+ return value.trim().replace(/\/+$/, "");
32
+ }
33
+ var PlatformEndpointError = class extends Error {
34
+ constructor(message) {
35
+ super(message);
36
+ this.name = "PlatformEndpointError";
37
+ }
38
+ };
39
+ function displayEndpoint(value) {
40
+ const trimmed = value.trim();
41
+ try {
42
+ const url = new URL(trimmed);
43
+ if (url.protocol === "http:" || url.protocol === "https:") {
44
+ url.username = "";
45
+ url.password = "";
46
+ url.search = "";
47
+ url.hash = "";
48
+ return url.toString().replace(/\/+$/, "");
49
+ }
50
+ } catch {
51
+ }
52
+ return trimmed.replace(/^[^@/\s]*@/, "").replace(/[?#].*$/, "");
53
+ }
54
+ function isLoopbackHost(hostname) {
55
+ const host = hostname.toLowerCase();
56
+ return host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || /^127(\.\d{1,3}){3}$/.test(host);
57
+ }
58
+ function platformEndpointProblem(value, noun = "platform endpoint") {
59
+ const shown = displayEndpoint(value);
60
+ let url;
61
+ try {
62
+ url = new URL(value.trim());
63
+ } catch {
64
+ return `The ${noun} "${shown}" is not a URL.
65
+ Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
66
+ }
67
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
68
+ return `The ${noun} ${shown} is not an HTTPS URL.
69
+ Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
70
+ }
71
+ if (url.username || url.password) {
72
+ return `The ${noun} ${shown} must not contain a user name or password.
73
+ Use ${shown}`;
74
+ }
75
+ if (url.protocol === "http:" && !isLoopbackHost(url.hostname)) {
76
+ return `The ${noun} ${shown} is not HTTPS. The CLI sends a credential only to an HTTPS endpoint, or to plain HTTP on this machine (localhost, 127.0.0.1, [::1]).
77
+ Use ${shown.replace(/^http:/i, "https:")}`;
78
+ }
79
+ return null;
80
+ }
81
+ function assertSafePlatformEndpoint(endpoint) {
82
+ const problem = platformEndpointProblem(endpoint);
83
+ if (problem) throw new PlatformEndpointError(problem);
84
+ return endpoint;
85
+ }
86
+ function platformEndpointFrom(source) {
87
+ for (const key of PLATFORM_ENDPOINT_ENV_KEYS) {
88
+ const value = normalizePlatformEndpoint(source[key] ?? "");
89
+ if (value) return value;
90
+ }
91
+ return void 0;
92
+ }
93
+ function configuredPlatformEndpoint(flag, ...fallbackSources) {
94
+ const explicit = normalizePlatformEndpoint(flag ?? "");
95
+ if (explicit) return assertSafePlatformEndpoint(explicit);
96
+ for (const source of [process.env, ...fallbackSources]) {
97
+ const value = platformEndpointFrom(source);
98
+ if (value) return assertSafePlatformEndpoint(value);
99
+ }
100
+ return void 0;
101
+ }
102
+ function resolvePlatformEndpoint(flag) {
103
+ return configuredPlatformEndpoint(flag) ?? DEFAULT_PLATFORM_ENDPOINT;
104
+ }
105
+
106
+ // src/utils/platform-request.ts
107
+ var REQUEST_TIMEOUT_MS = 3e4;
108
+ function requestHost(url) {
109
+ try {
110
+ return new URL(url).host;
111
+ } catch {
112
+ return "the server";
113
+ }
114
+ }
115
+ var RequestTimeoutError = class extends Error {
116
+ constructor(host, timeoutMs, next) {
117
+ super(`${host} did not answer within ${Math.round(timeoutMs / 1e3)} seconds.
118
+ ${next}`);
119
+ this.host = host;
120
+ this.timeoutMs = timeoutMs;
121
+ this.name = "RequestTimeoutError";
122
+ }
123
+ };
124
+ var RedirectRefusedError = class extends Error {
125
+ constructor(host, status2, next) {
126
+ super(
127
+ `${host} answered with a redirect (HTTP ${status2}). The CLI does not follow a redirect with your sign-in.
128
+ ${next}`
129
+ );
130
+ this.host = host;
131
+ this.status = status2;
132
+ this.name = "RedirectRefusedError";
133
+ }
134
+ };
135
+ var BODILESS_STATUSES = /* @__PURE__ */ new Set([101, 204, 205, 304]);
136
+ async function fetchWithDeadline(url, init2 = {}, options) {
137
+ const timeoutMs = options.timeoutMs ?? REQUEST_TIMEOUT_MS;
138
+ const deadlineController = new AbortController();
139
+ const timer = setTimeout(() => deadlineController.abort(), timeoutMs);
140
+ const deadline = deadlineController.signal;
141
+ const signal = init2.signal ? AbortSignal.any([init2.signal, deadline]) : deadline;
142
+ try {
143
+ const response = await (options.fetchImpl ?? fetch)(url, { ...init2, signal });
144
+ if (!(response instanceof Response)) return response;
145
+ const body = await response.arrayBuffer();
146
+ return new Response(BODILESS_STATUSES.has(response.status) ? null : body, {
147
+ status: response.status,
148
+ statusText: response.statusText,
149
+ headers: response.headers
150
+ });
151
+ } catch (error) {
152
+ if (deadline.aborted && !init2.signal?.aborted) {
153
+ throw new RequestTimeoutError(requestHost(url), timeoutMs, options.next);
154
+ }
155
+ throw error;
156
+ } finally {
157
+ clearTimeout(timer);
158
+ }
159
+ }
160
+ async function credentialFetch(url, init2, options) {
161
+ const response = await fetchWithDeadline(url, { redirect: "manual", ...init2 }, options);
162
+ if (response.status >= 300 && response.status < 400) {
163
+ throw new RedirectRefusedError(requestHost(url), response.status, options.next);
164
+ }
165
+ return response;
166
+ }
167
+ async function platformFetch(endpoint, pathname, init2, options) {
168
+ assertSafePlatformEndpoint(endpoint);
169
+ return credentialFetch(`${endpoint}${pathname}`, init2, options);
170
+ }
171
+
172
+ // src/utils/framework-versions.ts
173
+ var PUBLIC_NPM_REGISTRY = "https://registry.npmjs.org";
174
+ var SCOPE_REGISTRY_ENV = "npm_config_@standardagents:registry";
175
+ var BUILDER_PACKUMENT_PATH = "/@standardagents%2Fbuilder";
176
+ var LATEST_LOOKUP_TIMEOUT_MS = 1e4;
177
+ var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
178
+ var DEPENDENCY_SECTIONS = ["dependencies", "devDependencies", "optionalDependencies"];
179
+ var FRAMEWORK_PACKAGES = new Set(LOCKSTEP_FRAMEWORK_PACKAGES);
180
+ function isExactVersion(specifier) {
181
+ return EXACT_VERSION.test(specifier);
182
+ }
183
+ function isPrereleaseVersion(specifier) {
184
+ return isExactVersion(specifier) && specifier.includes("-");
185
+ }
186
+ function frameworkRegistry(env = process.env) {
187
+ const key = Object.keys(env).find((name) => name.toLowerCase() === SCOPE_REGISTRY_ENV);
188
+ const override = key ? env[key]?.trim() : void 0;
189
+ if (override && /^https?:\/\//i.test(override)) return override.replace(/\/+$/, "");
190
+ return PUBLIC_NPM_REGISTRY;
191
+ }
192
+ function hasLatestTag(value) {
193
+ if (typeof value !== "object" || value === null || !("dist-tags" in value)) return false;
194
+ const tags = value["dist-tags"];
195
+ return typeof tags === "object" && tags !== null && "latest" in tags;
196
+ }
197
+ async function resolveLatestFrameworkVersion(options = {}) {
198
+ const url = `${frameworkRegistry(options.env)}${BUILDER_PACKUMENT_PATH}`;
199
+ const host = requestHost(url);
200
+ try {
201
+ const response = await fetchWithDeadline(
202
+ url,
203
+ { headers: { Accept: "application/vnd.npm.install-v1+json, application/json" } },
204
+ {
205
+ fetchImpl: options.fetchImpl,
206
+ timeoutMs: options.timeoutMs ?? LATEST_LOOKUP_TIMEOUT_MS,
207
+ next: "Check your network connection."
208
+ }
209
+ );
210
+ if (!response.ok) return { version: null, reason: `${host} answered HTTP ${response.status}.` };
211
+ const body = await response.json();
212
+ const latest = hasLatestTag(body) ? body["dist-tags"].latest : void 0;
213
+ if (typeof latest !== "string" || !isExactVersion(latest)) {
214
+ return { version: null, reason: `${host} did not name a latest release.` };
215
+ }
216
+ return { version: latest };
217
+ } catch (error) {
218
+ const detail = error instanceof Error ? error.message.split("\n")[0] : String(error);
219
+ return { version: null, reason: detail.includes(host) ? detail : `${host} could not be reached (${detail}).` };
220
+ }
221
+ }
222
+ function isRegistrySpecifier(specifier) {
223
+ return typeof specifier === "string" && !specifier.includes(":") && !specifier.includes("/");
224
+ }
225
+ function pinFrameworkDependencies(projectPath, version) {
226
+ const packageJsonPath = path19.join(projectPath, "package.json");
227
+ const original = fs14.readFileSync(packageJsonPath, "utf-8");
228
+ const manifest = JSON.parse(original);
229
+ if (typeof manifest !== "object" || manifest === null) return [];
230
+ let text2 = original;
231
+ const pinned = [];
232
+ for (const section of DEPENDENCY_SECTIONS) {
233
+ const dependencies = section in manifest ? Reflect.get(manifest, section) : void 0;
234
+ if (typeof dependencies !== "object" || dependencies === null) continue;
235
+ for (const [name, specifier] of Object.entries(dependencies)) {
236
+ if (!FRAMEWORK_PACKAGES.has(name) || !isRegistrySpecifier(specifier)) continue;
237
+ pinned.push(name);
238
+ if (specifier === version) continue;
239
+ text2 = applyEdits(text2, modify(text2, [section, name], version, {
240
+ formattingOptions: { insertSpaces: true, tabSize: 2 }
241
+ }));
242
+ }
243
+ }
244
+ if (text2 !== original) fs14.writeFileSync(packageJsonPath, text2, "utf-8");
245
+ return pinned;
246
+ }
247
+ function freshInstallOptions(packageManager) {
248
+ if (packageManager === "pnpm") return { args: ["--no-frozen-lockfile"], env: {} };
249
+ if (packageManager === "yarn") return { args: [], env: { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" } };
250
+ return { args: [], env: {} };
251
+ }
23
252
  function findPnpmWorkspaceRoot(startDir) {
24
253
  let currentDir = startDir;
25
254
  while (true) {
26
- if (fs13.existsSync(path18.join(currentDir, "pnpm-workspace.yaml"))) {
255
+ if (fs14.existsSync(path19.join(currentDir, "pnpm-workspace.yaml"))) {
27
256
  return currentDir;
28
257
  }
29
- const parentDir = path18.dirname(currentDir);
258
+ const parentDir = path19.dirname(currentDir);
30
259
  if (parentDir === currentDir) {
31
260
  return null;
32
261
  }
33
262
  currentDir = parentDir;
34
263
  }
35
264
  }
36
- function findStandardAgentsWorkspaceRoot(startDir = path18.dirname(fileURLToPath(import.meta.url))) {
265
+ function findStandardAgentsWorkspaceRoot(startDir = path19.dirname(fileURLToPath(import.meta.url))) {
37
266
  let currentDir = startDir;
38
267
  for (; ; ) {
39
268
  const workspaceRoot = findPnpmWorkspaceRoot(currentDir);
40
269
  if (!workspaceRoot) return null;
41
- const manifestPath = path18.join(workspaceRoot, "package.json");
270
+ const manifestPath = path19.join(workspaceRoot, "package.json");
42
271
  try {
43
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf8"));
272
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf8"));
44
273
  if (manifest && typeof manifest === "object" && "name" in manifest && manifest.name === "standardagents") {
45
274
  return workspaceRoot;
46
275
  }
47
276
  } catch {
48
277
  }
49
- const parent = path18.dirname(workspaceRoot);
278
+ const parent = path19.dirname(workspaceRoot);
50
279
  if (parent === workspaceRoot) return null;
51
280
  currentDir = parent;
52
281
  }
53
282
  }
54
283
  function resolveStandardAgentsWorkspaceRoot(startDirs = [
55
- path18.dirname(fileURLToPath(import.meta.url)),
284
+ path19.dirname(fileURLToPath(import.meta.url)),
56
285
  process.cwd()
57
286
  ]) {
58
287
  const explicitRoot = process.env.STANDARDAGENTS_WORKSPACE_ROOT?.trim();
59
288
  if (explicitRoot) {
60
- const workspaceRoot = findStandardAgentsWorkspaceRoot(path18.resolve(explicitRoot));
289
+ const workspaceRoot = findStandardAgentsWorkspaceRoot(path19.resolve(explicitRoot));
61
290
  if (workspaceRoot) return workspaceRoot;
62
291
  throw new Error(
63
- `STANDARDAGENTS_WORKSPACE_ROOT=${path18.resolve(explicitRoot)} is not a Standard Agents workspace root`
292
+ `STANDARDAGENTS_WORKSPACE_ROOT=${path19.resolve(explicitRoot)} is not a Standard Agents workspace root`
64
293
  );
65
294
  }
66
295
  for (const startDir of startDirs) {
@@ -70,14 +299,14 @@ function resolveStandardAgentsWorkspaceRoot(startDirs = [
70
299
  return null;
71
300
  }
72
301
  function workspacePackageDir(workspaceRoot, packageName) {
73
- return path18.join(workspaceRoot, "packages", packageName.replace("@standardagents/", ""));
302
+ return path19.join(workspaceRoot, "packages", packageName.replace("@standardagents/", ""));
74
303
  }
75
304
  function validateWorkspacePackageDir(packageName, packageDir) {
76
- const dependencyPackageJsonPath = path18.join(packageDir, "package.json");
77
- if (!fs13.existsSync(dependencyPackageJsonPath)) {
305
+ const dependencyPackageJsonPath = path19.join(packageDir, "package.json");
306
+ if (!fs14.existsSync(dependencyPackageJsonPath)) {
78
307
  throw new Error(`Could not find workspace package for ${packageName} at ${packageDir}`);
79
308
  }
80
- const manifest = JSON.parse(fs13.readFileSync(dependencyPackageJsonPath, "utf8"));
309
+ const manifest = JSON.parse(fs14.readFileSync(dependencyPackageJsonPath, "utf8"));
81
310
  const name = manifest && typeof manifest === "object" && "name" in manifest ? manifest.name : void 0;
82
311
  if (name !== packageName) {
83
312
  throw new Error(`Expected ${packageDir} to contain ${packageName}, found ${String(name ?? "unknown package")}`);
@@ -150,8 +379,8 @@ function ignoredByGit(projectPath) {
150
379
  return new Set(result.lines);
151
380
  }
152
381
  function coveredByGitignoreText(projectPath) {
153
- const gitignorePath = path18.join(projectPath, ".gitignore");
154
- const lines = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf8").split(/\r?\n/) : [];
382
+ const gitignorePath = path19.join(projectPath, ".gitignore");
383
+ const lines = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf8").split(/\r?\n/) : [];
155
384
  const lastNegation = lines.map((line) => line.startsWith("!")).lastIndexOf(true);
156
385
  const finalRules = new Set(lines.slice(lastNegation + 1));
157
386
  return new Set(
@@ -159,7 +388,7 @@ function coveredByGitignoreText(projectPath) {
159
388
  );
160
389
  }
161
390
  function isSymbolicLink(filePath) {
162
- return fs13.lstatSync(filePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
391
+ return fs14.lstatSync(filePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
163
392
  }
164
393
  function notIgnoredError(paths, reason) {
165
394
  return new Error([
@@ -168,10 +397,10 @@ function notIgnoredError(paths, reason) {
168
397
  ].join("\n"));
169
398
  }
170
399
  function appendGitignoreEntries(projectPath, entries) {
171
- const gitignorePath = path18.join(projectPath, ".gitignore");
172
- const existing = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf8") : "";
400
+ const gitignorePath = path19.join(projectPath, ".gitignore");
401
+ const existing = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf8") : "";
173
402
  const separator = existing.length === 0 ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
174
- fs13.appendFileSync(gitignorePath, `${separator}${GITIGNORE_HEADING}
403
+ fs14.appendFileSync(gitignorePath, `${separator}${GITIGNORE_HEADING}
175
404
  ${entries.join("\n")}
176
405
  `);
177
406
  }
@@ -189,7 +418,7 @@ function protectProjectCredentialFiles(projectPath) {
189
418
  ].join("\n"));
190
419
  }
191
420
  }
192
- const linkedGitignore = isSymbolicLink(path18.join(projectPath, ".gitignore"));
421
+ const linkedGitignore = isSymbolicLink(path19.join(projectPath, ".gitignore"));
193
422
  const covered = insideGit ? ignoredByGit(projectPath) : linkedGitignore ? /* @__PURE__ */ new Set() : coveredByGitignoreText(projectPath);
194
423
  const missing = CREDENTIAL_FILES.filter((file) => !covered.has(file.path));
195
424
  if (missing.length === 0) return { ignored: [] };
@@ -214,12 +443,12 @@ function protectProjectCredentialFiles(projectPath) {
214
443
  return { ignored: entries };
215
444
  }
216
445
  function writePrivateFileSync(filePath, content) {
217
- const descriptor = fs13.openSync(filePath, "w", 384);
446
+ const descriptor = fs14.openSync(filePath, "w", 384);
218
447
  try {
219
- fs13.fchmodSync(descriptor, 384);
220
- fs13.writeFileSync(descriptor, content, "utf8");
448
+ fs14.fchmodSync(descriptor, 384);
449
+ fs14.writeFileSync(descriptor, content, "utf8");
221
450
  } finally {
222
- fs13.closeSync(descriptor);
451
+ fs14.closeSync(descriptor);
223
452
  }
224
453
  }
225
454
 
@@ -304,12 +533,12 @@ function collapseBlankLines(content) {
304
533
  return (result + outside(content.slice(cursor))).replace(/^\n+/, "");
305
534
  }
306
535
  function readDevVarsFile(projectPath) {
307
- const filePath = path18.join(projectPath, DEV_VARS_FILENAME);
308
- return fs13.existsSync(filePath) ? fs13.readFileSync(filePath, "utf-8") : "";
536
+ const filePath = path19.join(projectPath, DEV_VARS_FILENAME);
537
+ return fs14.existsSync(filePath) ? fs14.readFileSync(filePath, "utf-8") : "";
309
538
  }
310
539
  function writeDevVarsFile(projectPath, content, options = {}) {
311
540
  if (!options.removesCredentials) protectProjectCredentialFiles(projectPath);
312
- const filePath = path18.join(projectPath, DEV_VARS_FILENAME);
541
+ const filePath = path19.join(projectPath, DEV_VARS_FILENAME);
313
542
  writePrivateFileSync(filePath, content === "" || content.endsWith("\n") ? content : `${content}
314
543
  `);
315
544
  return filePath;
@@ -505,7 +734,7 @@ function isPackageManager(name) {
505
734
  }
506
735
  function declaredPackageManager(projectPath) {
507
736
  try {
508
- const manifest = JSON.parse(fs13.readFileSync(path18.join(projectPath, "package.json"), "utf-8"));
737
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(projectPath, "package.json"), "utf-8"));
509
738
  if (!manifest || typeof manifest !== "object" || !("packageManager" in manifest)) return null;
510
739
  const declared = /^([a-z]+)@(\d+)/.exec(String(manifest.packageManager));
511
740
  return declared && isPackageManager(declared[1]) ? { name: declared[1], major: Number(declared[2]) } : null;
@@ -525,12 +754,12 @@ function globToRegExp(glob) {
525
754
  return new RegExp(`^${pattern}$`);
526
755
  }
527
756
  function isPnpmWorkspaceMember(workspaceRoot, projectPath) {
528
- const relative = path18.relative(workspaceRoot, projectPath).split(path18.sep).join("/");
757
+ const relative = path19.relative(workspaceRoot, projectPath).split(path19.sep).join("/");
529
758
  if (relative === "") return true;
530
759
  if (relative.startsWith("..")) return false;
531
760
  let packages;
532
761
  try {
533
- const workspace = parse(fs13.readFileSync(path18.join(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"));
762
+ const workspace = parse(fs14.readFileSync(path19.join(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"));
534
763
  packages = workspace && typeof workspace === "object" && "packages" in workspace ? workspace.packages : void 0;
535
764
  } catch {
536
765
  return false;
@@ -546,7 +775,7 @@ function inferProjectPackageManager(projectPath) {
546
775
  const declared = declaredPackageManager(projectPath);
547
776
  if (declared) return declared.name;
548
777
  for (const [lockfile, packageManager] of LOCKFILES) {
549
- if (fs13.existsSync(path18.join(projectPath, lockfile))) return packageManager;
778
+ if (fs14.existsSync(path19.join(projectPath, lockfile))) return packageManager;
550
779
  }
551
780
  const workspaceRoot = findPnpmWorkspaceRoot(projectPath);
552
781
  return workspaceRoot && isPnpmWorkspaceMember(workspaceRoot, projectPath) ? "pnpm" : void 0;
@@ -772,11 +1001,11 @@ function isPrivateRegistry(value) {
772
1001
  }
773
1002
  function yarnrcFiles(projectPath) {
774
1003
  const files = [];
775
- for (let directory = path18.resolve(projectPath); ; directory = path18.dirname(directory)) {
776
- files.push(path18.join(directory, ".yarnrc.yml"));
777
- if (path18.dirname(directory) === directory) break;
1004
+ for (let directory = path19.resolve(projectPath); ; directory = path19.dirname(directory)) {
1005
+ files.push(path19.join(directory, ".yarnrc.yml"));
1006
+ if (path19.dirname(directory) === directory) break;
778
1007
  }
779
- const homeFile = path18.join(os5.homedir(), ".yarnrc.yml");
1008
+ const homeFile = path19.join(os5.homedir(), ".yarnrc.yml");
780
1009
  return files.includes(homeFile) ? files : [...files, homeFile];
781
1010
  }
782
1011
  function yarnCredentialsBoundToScope(projectPath, env = process.env) {
@@ -784,10 +1013,10 @@ function yarnCredentialsBoundToScope(projectPath, env = process.env) {
784
1013
  const topLevelSources = AUTH_ENVIRONMENT.filter((name) => isSet(env[name]));
785
1014
  let privateDefaultRegistry = isPrivateRegistry(env.YARN_NPM_REGISTRY_SERVER);
786
1015
  for (const file of yarnrcFiles(projectPath)) {
787
- if (!fs13.existsSync(file)) continue;
1016
+ if (!fs14.existsSync(file)) continue;
788
1017
  let config;
789
1018
  try {
790
- config = parse(fs13.readFileSync(file, "utf-8"), { merge: true });
1019
+ config = parse(fs14.readFileSync(file, "utf-8"), { merge: true });
791
1020
  } catch {
792
1021
  scopeSources.push(`${file} (unreadable)`);
793
1022
  continue;
@@ -810,14 +1039,14 @@ function refuse(plan, step, required) {
810
1039
  if (required) plan.blocked = true;
811
1040
  }
812
1041
  function planNpmrc(npmrcPath, plan) {
813
- const stat = fs13.lstatSync(npmrcPath, { throwIfNoEntry: false });
1042
+ const stat = fs14.lstatSync(npmrcPath, { throwIfNoEntry: false });
814
1043
  if (!stat) {
815
1044
  plan.writes.push({ filePath: npmrcPath, text: `${SCOPE_REGISTRY_PIN}
816
1045
  ` });
817
1046
  return;
818
1047
  }
819
1048
  if (stat.isSymbolicLink()) {
820
- const target = fs13.existsSync(npmrcPath) ? fs13.readFileSync(npmrcPath, "utf-8") : "";
1049
+ const target = fs14.existsSync(npmrcPath) ? fs14.readFileSync(npmrcPath, "utf-8") : "";
821
1050
  if (!pinScopeRegistryInNpmrc(target).changed) return;
822
1051
  if (hasOtherNpmrcSettings(target)) {
823
1052
  refuse(plan, `${npmrcPath} is a symbolic link, so it is unchanged. Add this line to a project-owned .npmrc: ${SCOPE_REGISTRY_PIN}`, true);
@@ -827,17 +1056,17 @@ function planNpmrc(npmrcPath, plan) {
827
1056
  `, replacesLink: true });
828
1057
  return;
829
1058
  }
830
- const pinned = pinScopeRegistryInNpmrc(fs13.readFileSync(npmrcPath, "utf-8"));
1059
+ const pinned = pinScopeRegistryInNpmrc(fs14.readFileSync(npmrcPath, "utf-8"));
831
1060
  if (pinned.changed) plan.writes.push({ filePath: npmrcPath, text: pinned.text });
832
1061
  }
833
1062
  function planYaml(filePath, pin, keyPath, required, plan) {
834
1063
  const step = `Set ${keyPath.join(".")} to https://registry.npmjs.org/ in ${filePath}.`;
835
- const stat = fs13.lstatSync(filePath, { throwIfNoEntry: false });
1064
+ const stat = fs14.lstatSync(filePath, { throwIfNoEntry: false });
836
1065
  if (stat?.isSymbolicLink()) {
837
1066
  refuse(plan, `${filePath} is a symbolic link, so it is unchanged. ${step}`, required);
838
1067
  return;
839
1068
  }
840
- const pinned = pin(stat ? fs13.readFileSync(filePath, "utf-8") : "");
1069
+ const pinned = pin(stat ? fs14.readFileSync(filePath, "utf-8") : "");
841
1070
  if (pinned === null) {
842
1071
  refuse(plan, `The CLI cannot edit ${filePath} safely, so it is unchanged. ${step}`, required);
843
1072
  return;
@@ -845,9 +1074,9 @@ function planYaml(filePath, pin, keyPath, required, plan) {
845
1074
  if (pinned.changed) plan.writes.push({ filePath, text: pinned.text });
846
1075
  }
847
1076
  function planYarnrc(projectPath, required, plan) {
848
- const filePath = path18.join(projectPath, ".yarnrc.yml");
849
- const stat = fs13.lstatSync(filePath, { throwIfNoEntry: false });
850
- const current = stat && !stat.isSymbolicLink() ? fs13.readFileSync(filePath, "utf-8") : "";
1077
+ const filePath = path19.join(projectPath, ".yarnrc.yml");
1078
+ const stat = fs14.lstatSync(filePath, { throwIfNoEntry: false });
1079
+ const current = stat && !stat.isSymbolicLink() ? fs14.readFileSync(filePath, "utf-8") : "";
851
1080
  const credentials = pinScopeRegistryInYarnrc(current)?.changed ? yarnCredentialsBoundToScope(projectPath) : [];
852
1081
  if (credentials.length > 0) {
853
1082
  refuse(
@@ -860,7 +1089,7 @@ function planYarnrc(projectPath, required, plan) {
860
1089
  planYaml(filePath, pinScopeRegistryInYarnrc, YARNRC_REGISTRY_PATH, required, plan);
861
1090
  }
862
1091
  function needsYarnrc(projectPath, packageManager, options) {
863
- if (fs13.lstatSync(path18.join(projectPath, ".yarnrc.yml"), { throwIfNoEntry: false })) return true;
1092
+ if (fs14.lstatSync(path19.join(projectPath, ".yarnrc.yml"), { throwIfNoEntry: false })) return true;
864
1093
  if (packageManager !== "yarn") return false;
865
1094
  const declared = declaredPackageManager(projectPath);
866
1095
  if (declared?.name === "yarn") return declared.major >= 2;
@@ -869,13 +1098,13 @@ function needsYarnrc(projectPath, packageManager, options) {
869
1098
  }
870
1099
  function migrateLockfiles(projectPath, changed) {
871
1100
  for (const [name, migrate] of Object.entries(LOCKFILE_MIGRATIONS)) {
872
- const lockfilePath = path18.join(projectPath, name);
873
- const stat = fs13.lstatSync(lockfilePath, { throwIfNoEntry: false });
1101
+ const lockfilePath = path19.join(projectPath, name);
1102
+ const stat = fs14.lstatSync(lockfilePath, { throwIfNoEntry: false });
874
1103
  if (!stat?.isFile()) continue;
875
- const text2 = fs13.readFileSync(lockfilePath, "utf-8");
1104
+ const text2 = fs14.readFileSync(lockfilePath, "utf-8");
876
1105
  const migrated = migrate(text2);
877
1106
  if (migrated === text2) continue;
878
- fs13.writeFileSync(lockfilePath, migrated, "utf-8");
1107
+ fs14.writeFileSync(lockfilePath, migrated, "utf-8");
879
1108
  changed.push(lockfilePath);
880
1109
  }
881
1110
  }
@@ -883,9 +1112,9 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
883
1112
  const packageManager = options.packageManager ?? inferProjectPackageManager(projectPath);
884
1113
  const configRoot = registryConfigRoot(projectPath, packageManager, options.isolateFromParent ?? false);
885
1114
  const plan = { writes: [], manual: [], blocked: false };
886
- planNpmrc(path18.join(configRoot, ".npmrc"), plan);
887
- const workspaceFile = path18.join(configRoot, "pnpm-workspace.yaml");
888
- if (fs13.lstatSync(workspaceFile, { throwIfNoEntry: false })) {
1115
+ planNpmrc(path19.join(configRoot, ".npmrc"), plan);
1116
+ const workspaceFile = path19.join(configRoot, "pnpm-workspace.yaml");
1117
+ if (fs14.lstatSync(workspaceFile, { throwIfNoEntry: false })) {
889
1118
  planYaml(workspaceFile, pinScopeRegistryInPnpmWorkspace, PNPM_WORKSPACE_REGISTRY_PATH, packageManager === "pnpm", plan);
890
1119
  }
891
1120
  if (needsYarnrc(projectPath, packageManager, options)) {
@@ -894,8 +1123,8 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
894
1123
  if (plan.blocked) return { changed: [], manual: plan.manual, blocked: true };
895
1124
  const changed = [];
896
1125
  for (const write of plan.writes) {
897
- if (write.replacesLink) fs13.unlinkSync(write.filePath);
898
- fs13.writeFileSync(write.filePath, write.text, "utf-8");
1126
+ if (write.replacesLink) fs14.unlinkSync(write.filePath);
1127
+ fs14.writeFileSync(write.filePath, write.text, "utf-8");
899
1128
  changed.push(write.filePath);
900
1129
  }
901
1130
  migrateLockfiles(projectPath, changed);
@@ -904,7 +1133,7 @@ function pinStandardAgentsScopeRegistry(projectPath, options = {}) {
904
1133
  function pinProjectScopeRegistry(projectPath, options, log) {
905
1134
  const result = pinStandardAgentsScopeRegistry(projectPath, options);
906
1135
  if (result.changed.length > 0) {
907
- const files = result.changed.map((file) => path18.relative(projectPath, file)).join(", ");
1136
+ const files = result.changed.map((file) => path19.relative(projectPath, file)).join(", ");
908
1137
  log.info(`Your project now installs @standardagents packages from npm (updated ${files}).`);
909
1138
  }
910
1139
  for (const step of result.manual) log.warning(step);
@@ -923,155 +1152,6 @@ function cliCommand(args = "") {
923
1152
  }
924
1153
  var SIGN_IN_UNREADABLE_MESSAGE = `The Keychain did not return the saved sign-in. It is locked in this session (for example over SSH): unlock it with \`security unlock-keychain\`, or sign in again with: ${cliCommand("login")}`;
925
1154
 
926
- // src/utils/platform-endpoint.ts
927
- var DEFAULT_PLATFORM_ENDPOINT = "https://api.standardagents.ai";
928
- var PLATFORM_ENDPOINT_ENV_KEYS = [
929
- "STANDARD_AGENTS_API_URL",
930
- "PLATFORM_ENDPOINT",
931
- "STANDARD_AGENTS_PLATFORM_URL"
932
- ];
933
- function normalizePlatformEndpoint(value) {
934
- return value.trim().replace(/\/+$/, "");
935
- }
936
- var PlatformEndpointError = class extends Error {
937
- constructor(message) {
938
- super(message);
939
- this.name = "PlatformEndpointError";
940
- }
941
- };
942
- function displayEndpoint(value) {
943
- const trimmed = value.trim();
944
- try {
945
- const url = new URL(trimmed);
946
- if (url.protocol === "http:" || url.protocol === "https:") {
947
- url.username = "";
948
- url.password = "";
949
- url.search = "";
950
- url.hash = "";
951
- return url.toString().replace(/\/+$/, "");
952
- }
953
- } catch {
954
- }
955
- return trimmed.replace(/^[^@/\s]*@/, "").replace(/[?#].*$/, "");
956
- }
957
- function isLoopbackHost(hostname) {
958
- const host = hostname.toLowerCase();
959
- return host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || /^127(\.\d{1,3}){3}$/.test(host);
960
- }
961
- function platformEndpointProblem(value, noun = "platform endpoint") {
962
- const shown = displayEndpoint(value);
963
- let url;
964
- try {
965
- url = new URL(value.trim());
966
- } catch {
967
- return `The ${noun} "${shown}" is not a URL.
968
- Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
969
- }
970
- if (url.protocol !== "https:" && url.protocol !== "http:") {
971
- return `The ${noun} ${shown} is not an HTTPS URL.
972
- Use an https:// URL, for example ${DEFAULT_PLATFORM_ENDPOINT}`;
973
- }
974
- if (url.username || url.password) {
975
- return `The ${noun} ${shown} must not contain a user name or password.
976
- Use ${shown}`;
977
- }
978
- if (url.protocol === "http:" && !isLoopbackHost(url.hostname)) {
979
- return `The ${noun} ${shown} is not HTTPS. The CLI sends a credential only to an HTTPS endpoint, or to plain HTTP on this machine (localhost, 127.0.0.1, [::1]).
980
- Use ${shown.replace(/^http:/i, "https:")}`;
981
- }
982
- return null;
983
- }
984
- function assertSafePlatformEndpoint(endpoint) {
985
- const problem = platformEndpointProblem(endpoint);
986
- if (problem) throw new PlatformEndpointError(problem);
987
- return endpoint;
988
- }
989
- function platformEndpointFrom(source) {
990
- for (const key of PLATFORM_ENDPOINT_ENV_KEYS) {
991
- const value = normalizePlatformEndpoint(source[key] ?? "");
992
- if (value) return value;
993
- }
994
- return void 0;
995
- }
996
- function configuredPlatformEndpoint(flag, ...fallbackSources) {
997
- const explicit = normalizePlatformEndpoint(flag ?? "");
998
- if (explicit) return assertSafePlatformEndpoint(explicit);
999
- for (const source of [process.env, ...fallbackSources]) {
1000
- const value = platformEndpointFrom(source);
1001
- if (value) return assertSafePlatformEndpoint(value);
1002
- }
1003
- return void 0;
1004
- }
1005
- function resolvePlatformEndpoint(flag) {
1006
- return configuredPlatformEndpoint(flag) ?? DEFAULT_PLATFORM_ENDPOINT;
1007
- }
1008
-
1009
- // src/utils/platform-request.ts
1010
- var REQUEST_TIMEOUT_MS = 3e4;
1011
- function requestHost(url) {
1012
- try {
1013
- return new URL(url).host;
1014
- } catch {
1015
- return "the server";
1016
- }
1017
- }
1018
- var RequestTimeoutError = class extends Error {
1019
- constructor(host, timeoutMs, next) {
1020
- super(`${host} did not answer within ${Math.round(timeoutMs / 1e3)} seconds.
1021
- ${next}`);
1022
- this.host = host;
1023
- this.timeoutMs = timeoutMs;
1024
- this.name = "RequestTimeoutError";
1025
- }
1026
- };
1027
- var RedirectRefusedError = class extends Error {
1028
- constructor(host, status2, next) {
1029
- super(
1030
- `${host} answered with a redirect (HTTP ${status2}). The CLI does not follow a redirect with your sign-in.
1031
- ${next}`
1032
- );
1033
- this.host = host;
1034
- this.status = status2;
1035
- this.name = "RedirectRefusedError";
1036
- }
1037
- };
1038
- var BODILESS_STATUSES = /* @__PURE__ */ new Set([101, 204, 205, 304]);
1039
- async function fetchWithDeadline(url, init2 = {}, options) {
1040
- const timeoutMs = options.timeoutMs ?? REQUEST_TIMEOUT_MS;
1041
- const deadlineController = new AbortController();
1042
- const timer = setTimeout(() => deadlineController.abort(), timeoutMs);
1043
- const deadline = deadlineController.signal;
1044
- const signal = init2.signal ? AbortSignal.any([init2.signal, deadline]) : deadline;
1045
- try {
1046
- const response = await (options.fetchImpl ?? fetch)(url, { ...init2, signal });
1047
- if (!(response instanceof Response)) return response;
1048
- const body = await response.arrayBuffer();
1049
- return new Response(BODILESS_STATUSES.has(response.status) ? null : body, {
1050
- status: response.status,
1051
- statusText: response.statusText,
1052
- headers: response.headers
1053
- });
1054
- } catch (error) {
1055
- if (deadline.aborted && !init2.signal?.aborted) {
1056
- throw new RequestTimeoutError(requestHost(url), timeoutMs, options.next);
1057
- }
1058
- throw error;
1059
- } finally {
1060
- clearTimeout(timer);
1061
- }
1062
- }
1063
- async function credentialFetch(url, init2, options) {
1064
- const response = await fetchWithDeadline(url, { redirect: "manual", ...init2 }, options);
1065
- if (response.status >= 300 && response.status < 400) {
1066
- throw new RedirectRefusedError(requestHost(url), response.status, options.next);
1067
- }
1068
- return response;
1069
- }
1070
- async function platformFetch(endpoint, pathname, init2, options) {
1071
- assertSafePlatformEndpoint(endpoint);
1072
- return credentialFetch(`${endpoint}${pathname}`, init2, options);
1073
- }
1074
-
1075
1155
  // src/utils/cli-auth-api.ts
1076
1156
  var CliAuthWsTransportError = class extends Error {
1077
1157
  };
@@ -1675,13 +1755,18 @@ function getScaffoldStandardAgentsVersion() {
1675
1755
  if (process.env.STANDARDAGENTS_WORKSPACE === "1") {
1676
1756
  return workspacePackageLink("@standardagents/builder");
1677
1757
  }
1678
- return "0.45.7";
1758
+ return "0.45.9";
1759
+ }
1760
+ var SPEC_PACKAGE = "@standardagents/spec";
1761
+ function specSpecifierFor(builderSpecifier) {
1762
+ if (!builderSpecifier.startsWith("link:")) return builderSpecifier;
1763
+ return `link:${path19.join(path19.dirname(builderSpecifier.slice("link:".length)), "spec")}`;
1679
1764
  }
1680
1765
  function findViteConfig(cwd) {
1681
1766
  const candidates = ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"];
1682
1767
  for (const candidate of candidates) {
1683
- const configPath = path18.join(cwd, candidate);
1684
- if (fs13.existsSync(configPath)) {
1768
+ const configPath = path19.join(cwd, candidate);
1769
+ if (fs14.existsSync(configPath)) {
1685
1770
  return configPath;
1686
1771
  }
1687
1772
  }
@@ -1699,27 +1784,33 @@ function setPackageDependency(packageJsonText, section, packageName, version) {
1699
1784
  return applyEdits(packageJsonText, edits);
1700
1785
  }
1701
1786
  function updatePackageDependencies(cwd, versions = {}) {
1702
- const packageJsonPath = path18.join(cwd, "package.json");
1703
- if (!fs13.existsSync(packageJsonPath)) {
1787
+ const packageJsonPath = path19.join(cwd, "package.json");
1788
+ if (!fs14.existsSync(packageJsonPath)) {
1704
1789
  return stageResult("package-json", "failed", "No package.json found. Create one (for example with `npm init -y`).");
1705
1790
  }
1706
1791
  let text2;
1707
1792
  let pkg;
1708
1793
  try {
1709
- text2 = fs13.readFileSync(packageJsonPath, "utf-8");
1794
+ text2 = fs14.readFileSync(packageJsonPath, "utf-8");
1710
1795
  pkg = JSON.parse(text2);
1711
1796
  } catch (error) {
1712
1797
  return stageResult("package-json", "failed", `package.json is not valid JSON, so it is unchanged: ${error instanceof Error ? error.message : error}`);
1713
1798
  }
1714
1799
  const desiredBuilderVersion = versions.standardAgents ?? getScaffoldStandardAgentsVersion();
1715
1800
  const builderSection = dependencySectionFor(pkg, "@standardagents/builder", "dependencies");
1716
- if (pkg[builderSection]?.["@standardagents/builder"] === desiredBuilderVersion) {
1717
- return stageResult("package-json", "ok", "package.json already has current Standard Agents dependencies");
1801
+ if (pkg[builderSection]?.["@standardagents/builder"] !== desiredBuilderVersion) {
1802
+ const result = setPackageDependency(text2, builderSection, "@standardagents/builder", desiredBuilderVersion);
1803
+ fs14.writeFileSync(packageJsonPath, `${result.trimEnd()}
1804
+ `, "utf-8");
1718
1805
  }
1719
- const result = setPackageDependency(text2, builderSection, "@standardagents/builder", desiredBuilderVersion);
1720
- fs13.writeFileSync(packageJsonPath, `${result.trimEnd()}
1806
+ if (pkg.dependencies?.[SPEC_PACKAGE] === void 0 && pkg.devDependencies?.[SPEC_PACKAGE] === void 0) {
1807
+ const current = fs14.readFileSync(packageJsonPath, "utf-8");
1808
+ const result = setPackageDependency(current, "dependencies", SPEC_PACKAGE, specSpecifierFor(desiredBuilderVersion));
1809
+ fs14.writeFileSync(packageJsonPath, `${result.trimEnd()}
1721
1810
  `, "utf-8");
1722
- return stageResult("package-json", "ok", "Updated package.json with current Standard Agents dependencies");
1811
+ }
1812
+ if (isExactVersion(desiredBuilderVersion)) pinFrameworkDependencies(cwd, desiredBuilderVersion);
1813
+ return fs14.readFileSync(packageJsonPath, "utf-8") === text2 ? stageResult("package-json", "ok", "package.json already has current Standard Agents dependencies") : stageResult("package-json", "ok", "Updated package.json with current Standard Agents dependencies");
1723
1814
  }
1724
1815
  var BUILDER_PACKAGE = "@standardagents/builder";
1725
1816
  var BUILDER_PLUGIN_EXPORTS = ["builder", "agentbuilder"];
@@ -1746,10 +1837,10 @@ async function modifyViteConfig(cwd, force, log) {
1746
1837
  if (!configPath) {
1747
1838
  return stageResult("vite-config", "failed", `No vite.config found. Create vite.config.ts first. ${VITE_CONFIG_MANUAL_EDIT}`);
1748
1839
  }
1749
- const configName = path18.basename(configPath);
1840
+ const configName = path19.basename(configPath);
1750
1841
  try {
1751
1842
  const mod = await loadFile(configPath);
1752
- const code = fs13.readFileSync(configPath, "utf-8");
1843
+ const code = fs14.readFileSync(configPath, "utf-8");
1753
1844
  const hasAgentBuilder = code.includes("@standardagents/builder") || code.includes("builder()") || code.includes("agentbuilder()");
1754
1845
  if (!hasAgentBuilder) {
1755
1846
  addVitePlugin(mod, {
@@ -1798,40 +1889,53 @@ function projectGuides(cwd) {
1798
1889
  }
1799
1890
  function outdatedGuides(cwd) {
1800
1891
  return projectGuides(cwd).filter((doc) => {
1801
- const filePath = path18.join(cwd, guidePath(doc.directory));
1802
- return fs13.existsSync(filePath) && fs13.readFileSync(filePath, "utf-8") !== doc.content;
1892
+ const filePath = path19.join(cwd, guidePath(doc.directory));
1893
+ return fs14.existsSync(filePath) && fs14.readFileSync(filePath, "utf-8") !== doc.content;
1803
1894
  }).map((doc) => guidePath(doc.directory));
1804
1895
  }
1805
1896
  function writeGuides(cwd, replace, log) {
1806
1897
  for (const doc of projectGuides(cwd)) {
1807
- const dirPath = path18.join(cwd, doc.directory);
1808
- if (!fs13.existsSync(dirPath)) {
1809
- fs13.mkdirSync(dirPath, { recursive: true });
1898
+ const dirPath = path19.join(cwd, doc.directory);
1899
+ if (!fs14.existsSync(dirPath)) {
1900
+ fs14.mkdirSync(dirPath, { recursive: true });
1810
1901
  log.success(`Created ${doc.directory}`);
1811
1902
  }
1812
1903
  const guide = guidePath(doc.directory);
1813
- const agentsDocPath = path18.join(cwd, guide);
1814
- if (!fs13.existsSync(agentsDocPath)) {
1815
- fs13.writeFileSync(agentsDocPath, doc.content, "utf-8");
1904
+ const agentsDocPath = path19.join(cwd, guide);
1905
+ if (!fs14.existsSync(agentsDocPath)) {
1906
+ fs14.writeFileSync(agentsDocPath, doc.content, "utf-8");
1816
1907
  log.success(`Created ${guide}`);
1817
1908
  } else if (replace.has(guide)) {
1818
- fs13.writeFileSync(agentsDocPath, doc.content, "utf-8");
1909
+ fs14.writeFileSync(agentsDocPath, doc.content, "utf-8");
1819
1910
  log.success(`Replaced ${guide}`);
1820
1911
  }
1821
- const claudeDocPath = path18.join(dirPath, "CLAUDE.md");
1822
- if (!fs13.lstatSync(claudeDocPath, { throwIfNoEntry: false })) {
1823
- fs13.symlinkSync("AGENTS.md", claudeDocPath);
1912
+ const claudeDocPath = path19.join(dirPath, "CLAUDE.md");
1913
+ if (!fs14.lstatSync(claudeDocPath, { throwIfNoEntry: false })) {
1914
+ fs14.symlinkSync("AGENTS.md", claudeDocPath);
1824
1915
  log.success(`Created ${guide.replace(/AGENTS\.md$/, "CLAUDE.md")} symlink`);
1825
1916
  }
1826
1917
  }
1918
+ for (const skillFile of renderAgentSkill()) {
1919
+ const target = path19.join(cwd, skillFile.path);
1920
+ if (fs14.lstatSync(target, { throwIfNoEntry: false })) {
1921
+ continue;
1922
+ }
1923
+ fs14.mkdirSync(path19.dirname(target), { recursive: true });
1924
+ if (skillFile.kind === "symlink") {
1925
+ fs14.symlinkSync(skillFile.content, target);
1926
+ } else {
1927
+ fs14.writeFileSync(target, skillFile.content, "utf-8");
1928
+ }
1929
+ log.success(`Created ${skillFile.path}`);
1930
+ }
1827
1931
  return stageResult("guides", "ok", "Agent directories and AGENTS.md guides are in place");
1828
1932
  }
1829
1933
  function updateTsConfig(cwd) {
1830
- const tsconfigPath = path18.join(cwd, "tsconfig.json");
1831
- if (!fs13.existsSync(tsconfigPath)) {
1934
+ const tsconfigPath = path19.join(cwd, "tsconfig.json");
1935
+ if (!fs14.existsSync(tsconfigPath)) {
1832
1936
  return stageResult("tsconfig", "skipped", "No tsconfig.json found, so there is no TypeScript configuration to update");
1833
1937
  }
1834
- const text2 = fs13.readFileSync(tsconfigPath, "utf-8");
1938
+ const text2 = fs14.readFileSync(tsconfigPath, "utf-8");
1835
1939
  const config = parse$1(text2);
1836
1940
  if (typeof config !== "object" || config === null || Array.isArray(config)) {
1837
1941
  return stageResult(
@@ -1858,7 +1962,7 @@ function updateTsConfig(cwd) {
1858
1962
  if (newTypes.length === 0 && newIncludes.length === 0) {
1859
1963
  return stageResult("tsconfig", "ok", "tsconfig.json already configured");
1860
1964
  }
1861
- fs13.writeFileSync(tsconfigPath, result, "utf-8");
1965
+ fs14.writeFileSync(tsconfigPath, result, "utf-8");
1862
1966
  return stageResult("tsconfig", "ok", "Updated tsconfig.json with Standard Agents types");
1863
1967
  }
1864
1968
  function pinScopeRegistry(cwd, options, log) {
@@ -1892,21 +1996,21 @@ function cleanupViteDefaults(cwd) {
1892
1996
  ];
1893
1997
  const dirsToRemove = ["src", "public", "worker"];
1894
1998
  for (const file of filesToRemove) {
1895
- const filePath = path18.join(cwd, file);
1896
- if (fs13.existsSync(filePath)) {
1999
+ const filePath = path19.join(cwd, file);
2000
+ if (fs14.existsSync(filePath)) {
1897
2001
  try {
1898
- fs13.unlinkSync(filePath);
2002
+ fs14.unlinkSync(filePath);
1899
2003
  } catch {
1900
2004
  }
1901
2005
  }
1902
2006
  }
1903
2007
  for (const dir of dirsToRemove) {
1904
- const dirPath = path18.join(cwd, dir);
1905
- if (fs13.existsSync(dirPath)) {
2008
+ const dirPath = path19.join(cwd, dir);
2009
+ if (fs14.existsSync(dirPath)) {
1906
2010
  try {
1907
- const files = fs13.readdirSync(dirPath);
2011
+ const files = fs14.readdirSync(dirPath);
1908
2012
  if (files.length === 0) {
1909
- fs13.rmdirSync(dirPath);
2013
+ fs14.rmdirSync(dirPath);
1910
2014
  }
1911
2015
  } catch {
1912
2016
  }
@@ -1985,25 +2089,25 @@ async function scaffoldCommand(options = {}) {
1985
2089
  const directories = AGENT_DOCS.filter((doc) => doc.directory !== ".");
1986
2090
  directories.forEach((doc, index) => {
1987
2091
  const branch = index === directories.length - 1 ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
1988
- const name = `${path18.basename(doc.directory)}/`;
2092
+ const name = `${path19.basename(doc.directory)}/`;
1989
2093
  log.log(` ${branch} ${name.padEnd(20)}# ${doc.label[0].toUpperCase()}${doc.label.slice(1)} definitions`);
1990
2094
  });
1991
2095
  log.log("");
1992
2096
  }
1993
2097
  function writeBuildGuardScript(projectPath) {
1994
- const manifestPath = path18.join(projectPath, "package.json");
1995
- if (!fs13.existsSync(manifestPath)) return false;
1996
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf-8"));
2098
+ const manifestPath = path19.join(projectPath, "package.json");
2099
+ if (!fs14.existsSync(manifestPath)) return false;
2100
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf-8"));
1997
2101
  if (manifest.scripts?.build === BUILD_GUARD_SCRIPT) return false;
1998
2102
  manifest.scripts = { ...manifest.scripts, build: BUILD_GUARD_SCRIPT };
1999
- fs13.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
2103
+ fs14.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
2000
2104
  `, "utf-8");
2001
2105
  return true;
2002
2106
  }
2003
2107
 
2004
2108
  // src/utils/git-helper-command.ts
2005
2109
  function cliVersion() {
2006
- return "0.45.7";
2110
+ return "0.45.9";
2007
2111
  }
2008
2112
  function defaultGitCredentialHelperCommand(version = cliVersion()) {
2009
2113
  return `!npx -y @standardagents/cli@${version} git-credential`;
@@ -2037,7 +2141,7 @@ async function resolveSetupCode(options, readStdin2 = readStandardInput) {
2037
2141
  if (file) {
2038
2142
  source = `The file ${file}`;
2039
2143
  try {
2040
- code = fs13.readFileSync(file, "utf8");
2144
+ code = fs14.readFileSync(file, "utf8");
2041
2145
  } catch (error) {
2042
2146
  const reason = error instanceof Error && "code" in error ? String(error.code) : "it could not be read";
2043
2147
  throw new Error(`Cannot read the setup code file ${file} (${reason}).`);
@@ -2077,7 +2181,7 @@ function signalAll(pids, signal) {
2077
2181
  function readProcfsTable() {
2078
2182
  let entries;
2079
2183
  try {
2080
- entries = fs13.readdirSync("/proc");
2184
+ entries = fs14.readdirSync("/proc");
2081
2185
  } catch {
2082
2186
  return null;
2083
2187
  }
@@ -2085,7 +2189,7 @@ function readProcfsTable() {
2085
2189
  for (const entry of entries) {
2086
2190
  if (!/^\d+$/.test(entry)) continue;
2087
2191
  try {
2088
- const stat = fs13.readFileSync(`/proc/${entry}/stat`, "utf8");
2192
+ const stat = fs14.readFileSync(`/proc/${entry}/stat`, "utf8");
2089
2193
  const parent = Number.parseInt(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1], 10);
2090
2194
  if (Number.isInteger(parent)) parents.set(Number(entry), parent);
2091
2195
  } catch {
@@ -2257,10 +2361,10 @@ function directoryExistsFailure(name) {
2257
2361
  };
2258
2362
  }
2259
2363
  function resolveFreeDirectoryName(cwd, name) {
2260
- if (!fs13.existsSync(path18.join(cwd, name))) return name;
2364
+ if (!fs14.existsSync(path19.join(cwd, name))) return name;
2261
2365
  for (let suffix = 2; ; suffix += 1) {
2262
2366
  const candidate = `${name}-${suffix}`;
2263
- if (!fs13.existsSync(path18.join(cwd, candidate))) return candidate;
2367
+ if (!fs14.existsSync(path19.join(cwd, candidate))) return candidate;
2264
2368
  }
2265
2369
  }
2266
2370
  function commandFailureCause(label, error) {
@@ -2841,16 +2945,16 @@ function normalizeProjectName(raw) {
2841
2945
  return toKebabCase(raw.trim());
2842
2946
  }
2843
2947
  function isNonEmptyDirectory(targetPath) {
2844
- if (!fs13.existsSync(targetPath)) return false;
2845
- const stat = fs13.statSync(targetPath);
2948
+ if (!fs14.existsSync(targetPath)) return false;
2949
+ const stat = fs14.statSync(targetPath);
2846
2950
  if (!stat.isDirectory()) return false;
2847
- return fs13.readdirSync(targetPath).length > 0;
2951
+ return fs14.readdirSync(targetPath).length > 0;
2848
2952
  }
2849
2953
  function hasBuilderDependency(targetPath) {
2850
- const packageJsonPath = path18.join(targetPath, "package.json");
2851
- if (!fs13.existsSync(packageJsonPath)) return false;
2954
+ const packageJsonPath = path19.join(targetPath, "package.json");
2955
+ if (!fs14.existsSync(packageJsonPath)) return false;
2852
2956
  try {
2853
- const pkg = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
2957
+ const pkg = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
2854
2958
  if (pkg === null || typeof pkg !== "object") return false;
2855
2959
  const dependencies = "dependencies" in pkg ? pkg.dependencies : void 0;
2856
2960
  const devDependencies = "devDependencies" in pkg ? pkg.devDependencies : void 0;
@@ -2862,12 +2966,12 @@ function hasBuilderDependency(targetPath) {
2862
2966
  }
2863
2967
  }
2864
2968
  function isStandardAgentsProjectDir(targetPath) {
2865
- const agentsDir = path18.join(targetPath, "agents");
2866
- if (!fs13.existsSync(agentsDir) || !fs13.statSync(agentsDir).isDirectory()) {
2969
+ const agentsDir = path19.join(targetPath, "agents");
2970
+ if (!fs14.existsSync(agentsDir) || !fs14.statSync(agentsDir).isDirectory()) {
2867
2971
  return false;
2868
2972
  }
2869
2973
  if (hasBuilderDependency(targetPath)) return true;
2870
- return fs13.existsSync(path18.join(targetPath, "vite.config.ts")) && fs13.existsSync(path18.join(targetPath, "tsconfig.json"));
2974
+ return fs14.existsSync(path19.join(targetPath, "vite.config.ts")) && fs14.existsSync(path19.join(targetPath, "tsconfig.json"));
2871
2975
  }
2872
2976
  function initScaffoldOptions(useExistingProject, standardAgents) {
2873
2977
  return { freshProject: !useExistingProject, scopeRegistryPinned: true, standardAgents };
@@ -2878,7 +2982,7 @@ function resolveProjectTarget(cwd, candidate) {
2878
2982
  if (!isStandardAgentsProjectDir(cwd)) {
2879
2983
  return { ok: false, message: "Project name is required" };
2880
2984
  }
2881
- const dirName = path18.basename(cwd) || "standard-agents";
2985
+ const dirName = path19.basename(cwd) || "standard-agents";
2882
2986
  return {
2883
2987
  ok: true,
2884
2988
  target: {
@@ -2892,9 +2996,9 @@ function resolveProjectTarget(cwd, candidate) {
2892
2996
  if (!projectName) {
2893
2997
  return { ok: false, message: "Project name must include at least one letter or number" };
2894
2998
  }
2895
- const projectPath = path18.join(cwd, projectName);
2896
- const exists = fs13.existsSync(projectPath);
2897
- if (exists && !fs13.statSync(projectPath).isDirectory()) {
2999
+ const projectPath = path19.join(cwd, projectName);
3000
+ const exists = fs14.existsSync(projectPath);
3001
+ if (exists && !fs14.statSync(projectPath).isDirectory()) {
2898
3002
  return { ok: false, message: `Path "${projectName}" already exists and is not a directory` };
2899
3003
  }
2900
3004
  const existingStandardAgentsProject = exists && isStandardAgentsProjectDir(projectPath);
@@ -2911,7 +3015,7 @@ function resolveProjectTarget(cwd, candidate) {
2911
3015
  };
2912
3016
  }
2913
3017
  function detectLockfilePackageManager(projectPath) {
2914
- const has = (file) => fs13.existsSync(path18.join(projectPath, file));
3018
+ const has = (file) => fs14.existsSync(path19.join(projectPath, file));
2915
3019
  if (has("pnpm-lock.yaml")) return "pnpm";
2916
3020
  if (has("yarn.lock")) return "yarn";
2917
3021
  if (has("bun.lockb") || has("bun.lock")) return "bun";
@@ -2991,7 +3095,7 @@ function renderInitStepHeader(stage, title, subtitle, options) {
2991
3095
  logger.log("");
2992
3096
  }
2993
3097
  function getCliVersion() {
2994
- return "0.45.7";
3098
+ return "0.45.9";
2995
3099
  }
2996
3100
  function getSipVersion() {
2997
3101
  return "1.0.1";
@@ -3020,8 +3124,8 @@ function resolveStandardAgentsPackageSpecifier(packageName, packageSpecifier) {
3020
3124
  return packageSpecifier;
3021
3125
  }
3022
3126
  function rewriteStandardAgentsDependenciesForWorkspace(projectPath, workspaceRoot) {
3023
- const packageJsonPath = path18.join(projectPath, "package.json");
3024
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3127
+ const packageJsonPath = path19.join(projectPath, "package.json");
3128
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3025
3129
  const dependencies = packageJson.dependencies ?? {};
3026
3130
  const linkedPackages = [];
3027
3131
  for (const packageName of GENERATED_STANDARD_AGENTS_PACKAGES) {
@@ -3033,7 +3137,7 @@ function rewriteStandardAgentsDependenciesForWorkspace(projectPath, workspaceRoo
3033
3137
  }
3034
3138
  if (linkedPackages.length > 0) {
3035
3139
  packageJson.dependencies = dependencies;
3036
- fs13.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
3140
+ fs14.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
3037
3141
  `, "utf-8");
3038
3142
  }
3039
3143
  return linkedPackages;
@@ -3054,7 +3158,7 @@ function preparePlatformProjectDependencies(projectPath, packageManager, options
3054
3158
  return linkedPackages;
3055
3159
  }
3056
3160
  function getPnpmWorkspaceCompatibilityArgs(packageManager, projectPath) {
3057
- if (packageManager !== "pnpm" || !fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml"))) return [];
3161
+ if (packageManager !== "pnpm" || !fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml"))) return [];
3058
3162
  try {
3059
3163
  childProcess.execFileSync("pnpm", ["config", "get", "registry"], {
3060
3164
  cwd: projectPath,
@@ -3072,33 +3176,55 @@ function getPnpmWorkspaceCompatibilityArgs(packageManager, projectPath) {
3072
3176
  }
3073
3177
  }
3074
3178
  function projectInstallArgs(packageManager, projectPath, command = "install", dependencies = [], options = {}) {
3075
- const hasProjectWorkspace = projectPath !== void 0 && fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml"));
3076
- const inheritsWorkspace = !options.isolateFromParent && projectPath !== void 0 && findPnpmWorkspaceRoot(path18.dirname(projectPath)) !== null;
3179
+ const hasProjectWorkspace = projectPath !== void 0 && fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml"));
3180
+ const inheritsWorkspace = !options.isolateFromParent && projectPath !== void 0 && findPnpmWorkspaceRoot(path19.dirname(projectPath)) !== null;
3077
3181
  const prefix = [];
3078
3182
  if (packageManager === "pnpm") {
3079
3183
  if (options.ignoreProjectWorkspace) prefix.push("--ignore-workspace");
3080
3184
  else if (hasProjectWorkspace && command === "add") prefix.push("--workspace-root");
3081
3185
  else if (!hasProjectWorkspace && !inheritsWorkspace) prefix.push("--ignore-workspace");
3082
3186
  }
3083
- return [...prefix, command, ...dependencies];
3187
+ const saveExact = packageManager === "npm" && dependencies.length > 0 ? ["--save-exact"] : [];
3188
+ return [...prefix, command, ...saveExact, ...dependencies];
3189
+ }
3190
+ async function pinLatestFrameworkRelease(projectPath) {
3191
+ const cliVersion2 = getCliVersion();
3192
+ if (isPrereleaseVersion(cliVersion2)) {
3193
+ const pinned2 = pinFrameworkDependencies(projectPath, cliVersion2);
3194
+ if (pinned2.length > 0) {
3195
+ logger.info(`Pinned ${pinned2.length} Standard Agents packages to ${cliVersion2}, the release of this prerelease CLI.`);
3196
+ }
3197
+ return;
3198
+ }
3199
+ const latest = await resolveLatestFrameworkVersion();
3200
+ if (latest.version === null) {
3201
+ logger.warning(
3202
+ `Could not read the latest Standard Agents Builder release: ${latest.reason} Keeping the versions in package.json.`
3203
+ );
3204
+ return;
3205
+ }
3206
+ const pinned = pinFrameworkDependencies(projectPath, latest.version);
3207
+ if (pinned.length > 0) {
3208
+ logger.info(`Pinned ${pinned.length} Standard Agents packages to ${latest.version}, the latest release.`);
3209
+ }
3084
3210
  }
3085
3211
  function shellQuote(value) {
3086
3212
  return `"${value.replace(/(["\\$`])/g, "\\$1")}"`;
3087
3213
  }
3088
3214
  function findWorkspaceCommandRoot(projectPath) {
3089
- let current = path18.dirname(projectPath);
3215
+ let current = path19.dirname(projectPath);
3090
3216
  while (true) {
3091
- const packageJsonPath = path18.join(current, "package.json");
3092
- if (fs13.existsSync(packageJsonPath)) {
3217
+ const packageJsonPath = path19.join(current, "package.json");
3218
+ if (fs14.existsSync(packageJsonPath)) {
3093
3219
  try {
3094
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3220
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3095
3221
  if (packageJson?.scripts && typeof packageJson.scripts["sandbox:hmr"] === "string") {
3096
3222
  return current;
3097
3223
  }
3098
3224
  } catch {
3099
3225
  }
3100
3226
  }
3101
- const parent = path18.dirname(current);
3227
+ const parent = path19.dirname(current);
3102
3228
  if (parent === current) {
3103
3229
  return null;
3104
3230
  }
@@ -3106,47 +3232,47 @@ function findWorkspaceCommandRoot(projectPath) {
3106
3232
  }
3107
3233
  }
3108
3234
  function linkWorkspaceProjectToolchain(projectPath, workspaceRoot) {
3109
- const packageJsonPath = path18.join(projectPath, "package.json");
3110
- const manifest = JSON.parse(fs13.readFileSync(packageJsonPath, "utf8"));
3235
+ const packageJsonPath = path19.join(projectPath, "package.json");
3236
+ const manifest = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
3111
3237
  for (const section of [manifest.dependencies, manifest.devDependencies]) {
3112
3238
  if (!section) continue;
3113
3239
  for (const name of ["vite", "typescript"]) {
3114
3240
  if (!(name in section)) continue;
3115
- const installedPath = path18.join(workspaceRoot, "node_modules", name);
3116
- if (!fs13.existsSync(path18.join(installedPath, "package.json"))) {
3241
+ const installedPath = path19.join(workspaceRoot, "node_modules", name);
3242
+ if (!fs14.existsSync(path19.join(installedPath, "package.json"))) {
3117
3243
  throw new Error(`Install the contributor workspace before linking ${name}`);
3118
3244
  }
3119
3245
  section[name] = `link:${installedPath}`;
3120
3246
  }
3121
3247
  }
3122
- fs13.writeFileSync(packageJsonPath, `${JSON.stringify(manifest, null, 2)}
3248
+ fs14.writeFileSync(packageJsonPath, `${JSON.stringify(manifest, null, 2)}
3123
3249
  `);
3124
3250
  }
3125
3251
  function configureWorkspaceProjectScripts(projectPath, projectName) {
3126
- const packageJsonPath = path18.join(projectPath, "package.json");
3127
- if (!fs13.existsSync(packageJsonPath)) return false;
3252
+ const packageJsonPath = path19.join(projectPath, "package.json");
3253
+ if (!fs14.existsSync(packageJsonPath)) return false;
3128
3254
  const workspaceRoot = findWorkspaceCommandRoot(projectPath);
3129
3255
  if (!workspaceRoot) return false;
3130
- const workspacePackageJsonPath = path18.join(workspaceRoot, "package.json");
3131
- const workspacePackageJson = JSON.parse(fs13.readFileSync(workspacePackageJsonPath, "utf-8"));
3132
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3256
+ const workspacePackageJsonPath = path19.join(workspaceRoot, "package.json");
3257
+ const workspacePackageJson = JSON.parse(fs14.readFileSync(workspacePackageJsonPath, "utf-8"));
3258
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3133
3259
  const scripts = packageJson.scripts && typeof packageJson.scripts === "object" ? packageJson.scripts : {};
3134
- const relativeRoot = path18.relative(projectPath, workspaceRoot) || ".";
3260
+ const relativeRoot = path19.relative(projectPath, workspaceRoot) || ".";
3135
3261
  scripts["sandbox:hmr"] = `pnpm -C ${shellQuote(relativeRoot)} sandbox:hmr -- ${shellQuote(projectName)}`;
3136
3262
  if (workspacePackageJson?.scripts && typeof workspacePackageJson.scripts["cli:login:workspace"] === "string") {
3137
3263
  scripts["cli:login:workspace"] = `pnpm -C ${shellQuote(relativeRoot)} cli:login:workspace -- ${shellQuote(projectName)}`;
3138
3264
  }
3139
3265
  packageJson.scripts = scripts;
3140
- fs13.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
3266
+ fs14.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
3141
3267
  return true;
3142
3268
  }
3143
3269
  function resolvePostInitRunCommand(packageManager, projectPath, workspacePackages, pnpmCompatibilityArgs = []) {
3144
3270
  const command = packageManager === "pnpm" ? [packageManager, ...pnpmCompatibilityArgs].join(" ") : packageManager;
3145
3271
  if (workspacePackages) {
3146
- const packageJsonPath = path18.join(projectPath, "package.json");
3147
- if (fs13.existsSync(packageJsonPath)) {
3272
+ const packageJsonPath = path19.join(projectPath, "package.json");
3273
+ if (fs14.existsSync(packageJsonPath)) {
3148
3274
  try {
3149
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
3275
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
3150
3276
  if (packageJson?.scripts && typeof packageJson.scripts["sandbox:hmr"] === "string") {
3151
3277
  return packageManager === "npm" ? "npm run sandbox:hmr" : `${command} sandbox:hmr`;
3152
3278
  }
@@ -3294,8 +3420,8 @@ function gitSupportsEnvironmentConfig(versionLine) {
3294
3420
  return major > 2 || major === 2 && minor >= 31;
3295
3421
  }
3296
3422
  function platformGitCredentialHelperCommand(cliEntry = process.argv[1] ?? "") {
3297
- if (process.env.STANDARDAGENTS_WORKSPACE === "1" && cliEntry && fs13.existsSync(cliEntry)) {
3298
- return `!node ${shellQuote(path18.resolve(cliEntry))} git-credential`;
3423
+ if (process.env.STANDARDAGENTS_WORKSPACE === "1" && cliEntry && fs14.existsSync(cliEntry)) {
3424
+ return `!node ${shellQuote(path19.resolve(cliEntry))} git-credential`;
3299
3425
  }
3300
3426
  if (process.env.STANDARD_AGENTS_GIT_HELPER?.trim()) {
3301
3427
  return process.env.STANDARD_AGENTS_GIT_HELPER.trim();
@@ -3319,20 +3445,20 @@ function waitForPlatformProject(session, onProgress, signal) {
3319
3445
  return waitForCliAuthCompletion(session, PLATFORM_PROJECT_READER, { onProgress, signal });
3320
3446
  }
3321
3447
  function appendGitignoreEntries2(projectPath, heading, entries) {
3322
- const gitignorePath = path18.join(projectPath, ".gitignore");
3323
- const gitignoreContent = fs13.existsSync(gitignorePath) ? fs13.readFileSync(gitignorePath, "utf-8") : "";
3448
+ const gitignorePath = path19.join(projectPath, ".gitignore");
3449
+ const gitignoreContent = fs14.existsSync(gitignorePath) ? fs14.readFileSync(gitignorePath, "utf-8") : "";
3324
3450
  const existingEntries = new Set(gitignoreContent.split(/\r?\n/));
3325
3451
  const missingEntries = entries.filter((entry) => !existingEntries.has(entry));
3326
3452
  if (missingEntries.length === 0) return;
3327
3453
  const prefix = gitignoreContent.length === 0 ? "" : gitignoreContent.endsWith("\n") ? "\n" : "\n\n";
3328
- fs13.appendFileSync(gitignorePath, `${prefix}${heading}
3454
+ fs14.appendFileSync(gitignorePath, `${prefix}${heading}
3329
3455
  ${missingEntries.join("\n")}
3330
3456
  `);
3331
3457
  }
3332
3458
  function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3333
3459
  if (packageManager !== "pnpm") return false;
3334
- const policyPath = path18.join(projectPath, "pnpm-workspace.yaml");
3335
- if (fs13.existsSync(policyPath)) return false;
3460
+ const policyPath = path19.join(projectPath, "pnpm-workspace.yaml");
3461
+ if (fs14.existsSync(policyPath)) return false;
3336
3462
  const buildPolicySettings = [
3337
3463
  "onlyBuiltDependencies",
3338
3464
  "onlyBuiltDependenciesFile",
@@ -3343,20 +3469,20 @@ function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3343
3469
  "ignoreDepScripts",
3344
3470
  "ignoreScripts"
3345
3471
  ];
3346
- const npmrcPath = path18.join(projectPath, ".npmrc");
3347
- if (fs13.existsSync(npmrcPath)) {
3348
- const hasBuildPolicy = fs13.readFileSync(npmrcPath, "utf8").split(/\r?\n/).some((line) => {
3472
+ const npmrcPath = path19.join(projectPath, ".npmrc");
3473
+ if (fs14.existsSync(npmrcPath)) {
3474
+ const hasBuildPolicy = fs14.readFileSync(npmrcPath, "utf8").split(/\r?\n/).some((line) => {
3349
3475
  const separator = line.indexOf("=");
3350
3476
  const name = (separator < 0 ? line : line.slice(0, separator)).trim().replace(/[-_[\]]/g, "").toLowerCase();
3351
3477
  return buildPolicySettings.some((setting) => setting.toLowerCase() === name);
3352
3478
  });
3353
3479
  if (hasBuildPolicy) return false;
3354
3480
  }
3355
- if (!options.isolateFromParent && findPnpmWorkspaceRoot(path18.dirname(projectPath))) return false;
3481
+ if (!options.isolateFromParent && findPnpmWorkspaceRoot(path19.dirname(projectPath))) return false;
3356
3482
  const ignoredBuildScripts = options.ignoredBuildScripts ?? [];
3357
3483
  const approvedBuildScripts = ["esbuild", "workerd"].filter((name) => !ignoredBuildScripts.includes(name));
3358
- const manifestPath = path18.join(projectPath, "package.json");
3359
- const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf8"));
3484
+ const manifestPath = path19.join(projectPath, "package.json");
3485
+ const manifest = JSON.parse(fs14.readFileSync(manifestPath, "utf8"));
3360
3486
  const existingPnpm = manifest.pnpm ?? {};
3361
3487
  if (buildPolicySettings.some((name) => Object.hasOwn(existingPnpm, name))) return false;
3362
3488
  manifest.pnpm = {
@@ -3364,9 +3490,9 @@ function writeLocalPnpmBuildPolicy(projectPath, packageManager, options = {}) {
3364
3490
  onlyBuiltDependencies: approvedBuildScripts,
3365
3491
  ...ignoredBuildScripts.length > 0 ? { ignoredBuiltDependencies: ignoredBuildScripts } : {}
3366
3492
  };
3367
- fs13.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
3493
+ fs14.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
3368
3494
  `);
3369
- fs13.writeFileSync(policyPath, renderPnpmWorkspaceYaml(approvedBuildScripts, ignoredBuildScripts));
3495
+ fs14.writeFileSync(policyPath, renderPnpmWorkspaceYaml(approvedBuildScripts, ignoredBuildScripts));
3370
3496
  return true;
3371
3497
  }
3372
3498
  function writeStandardAgentsSupportFiles(projectPath, params) {
@@ -3379,15 +3505,17 @@ function writeStandardAgentsSupportFiles(projectPath, params) {
3379
3505
  sip: getSipVersion()
3380
3506
  }
3381
3507
  })) {
3382
- const targetPath = path18.join(projectPath, supportFile.path);
3383
- if (fs13.existsSync(targetPath)) continue;
3384
- fs13.mkdirSync(path18.dirname(targetPath), { recursive: true });
3385
- fs13.writeFileSync(targetPath, supportFile.content, "utf-8");
3508
+ const targetPath = path19.join(projectPath, supportFile.path);
3509
+ if (fs14.existsSync(targetPath)) continue;
3510
+ fs14.mkdirSync(path19.dirname(targetPath), { recursive: true });
3511
+ fs14.writeFileSync(targetPath, supportFile.content, "utf-8");
3386
3512
  written.push(supportFile.path);
3387
3513
  }
3388
3514
  appendGitignoreEntries2(projectPath, "# Standard Agents local dev state", [
3389
3515
  "node_modules",
3390
- ".agents",
3516
+ // Generated files are ignored; the committed coding-agent skill is kept.
3517
+ ".agents/*",
3518
+ "!.agents/skills/",
3391
3519
  ".wrangler",
3392
3520
  "dist",
3393
3521
  ".agentbuilder-dev.log"
@@ -3413,7 +3541,7 @@ async function writeSupportFilesStages(options = {}, log = logger) {
3413
3541
  ], resume);
3414
3542
  }
3415
3543
  const cwd = process.cwd();
3416
- const projectName = normalizeProjectName(options.projectName ?? path18.basename(cwd)) || "standard-agents";
3544
+ const projectName = normalizeProjectName(options.projectName ?? path19.basename(cwd)) || "standard-agents";
3417
3545
  const stages = [
3418
3546
  await runStage("support-files", () => {
3419
3547
  const written = writeStandardAgentsSupportFiles(cwd, { projectName, packageManager });
@@ -3577,7 +3705,7 @@ async function runPlatformInit(projectNameArg, options) {
3577
3705
  process.exit(1);
3578
3706
  }
3579
3707
  const requestedProjectName = projectNameArg?.trim() || void 0;
3580
- if (requestedProjectName && fs13.existsSync(path18.join(cwd, requestedProjectName))) {
3708
+ if (requestedProjectName && fs14.existsSync(path19.join(cwd, requestedProjectName))) {
3581
3709
  exitWithInitFailure(directoryExistsFailure(requestedProjectName));
3582
3710
  }
3583
3711
  const endpoint = platformEndpoint(options);
@@ -3622,7 +3750,7 @@ async function runPlatformInit(projectNameArg, options) {
3622
3750
  exitWithInitFailure({ cause: error instanceof Error ? error.message : String(error), next: [] });
3623
3751
  }
3624
3752
  const projectName = resolveFreeDirectoryName(cwd, platformName);
3625
- const projectPath = path18.join(cwd, projectName);
3753
+ const projectPath = path19.join(cwd, projectName);
3626
3754
  const projectLabel = project.name || projectName;
3627
3755
  logger.success("Browser setup complete.");
3628
3756
  if (projectName !== platformName) {
@@ -3630,7 +3758,7 @@ async function runPlatformInit(projectNameArg, options) {
3630
3758
  }
3631
3759
  logger.info(`Cloning ${cloneDisplayUrl(project)}...`);
3632
3760
  const stopRemoveOnInterrupt = interrupts.onInterrupt(() => {
3633
- fs13.rmSync(projectPath, { recursive: true, force: true });
3761
+ fs14.rmSync(projectPath, { recursive: true, force: true });
3634
3762
  logger.log("");
3635
3763
  logger.info(`Setup interrupted. Removed the partial "${projectName}" directory.`);
3636
3764
  for (const line of finishExistingProjectSteps(projectLabel, dashboardUrl)) {
@@ -3663,7 +3791,7 @@ async function runPlatformInit(projectNameArg, options) {
3663
3791
  apiKey: project.api_key,
3664
3792
  platformEndpoint: endpoint
3665
3793
  });
3666
- logger.success(`Wrote Standard Agents credentials to ${path18.relative(cwd, envPath)}.`);
3794
+ logger.success(`Wrote Standard Agents credentials to ${path19.relative(cwd, envPath)}.`);
3667
3795
  if (project.git_extra_header) {
3668
3796
  await configurePlatformGitCredentialHelper(projectPath);
3669
3797
  logger.success("Configured git credentials for the platform repository.");
@@ -3672,6 +3800,9 @@ async function runPlatformInit(projectNameArg, options) {
3672
3800
  if (linkedPackages.length > 0) {
3673
3801
  logger.info(`Workspace mode detected: linked ${linkedPackages.length} Standard Agents packages locally.`);
3674
3802
  }
3803
+ if (!shouldUseWorkspacePackages(options)) {
3804
+ await pinLatestFrameworkRelease(projectPath);
3805
+ }
3675
3806
  } catch (error) {
3676
3807
  stopRemoveOnInterrupt();
3677
3808
  exitWithInitFailure(configureFailure({
@@ -3685,10 +3816,14 @@ async function runPlatformInit(projectNameArg, options) {
3685
3816
  logger.info(`Installing dependencies with ${projectPackageManager}...`);
3686
3817
  const pnpmCompatibilityArgs = getPnpmWorkspaceCompatibilityArgs(projectPackageManager, projectPath);
3687
3818
  const devHint = pnpmCompatibilityArgs.length > 0 ? resolvePostInitRunCommand(projectPackageManager, projectPath, false, pnpmCompatibilityArgs) : devCommandHint(projectPackageManager);
3688
- const installArgs = projectInstallArgs(projectPackageManager, projectPath, "install", [], {
3689
- isolateFromParent: true,
3690
- ignoreProjectWorkspace: pnpmCompatibilityArgs.length > 0
3691
- });
3819
+ const freshInstall = freshInstallOptions(projectPackageManager);
3820
+ const installArgs = [
3821
+ ...projectInstallArgs(projectPackageManager, projectPath, "install", [], {
3822
+ isolateFromParent: true,
3823
+ ignoreProjectWorkspace: pnpmCompatibilityArgs.length > 0
3824
+ }),
3825
+ ...freshInstall.args
3826
+ ];
3692
3827
  const installCommand = [projectPackageManager, ...installArgs].join(" ");
3693
3828
  if (pinProjectScopeRegistry(projectPath, { packageManager: projectPackageManager, isolateFromParent: true }, logger).blocked) {
3694
3829
  exitWithInitFailure(installFailure({
@@ -3706,7 +3841,7 @@ async function runPlatformInit(projectNameArg, options) {
3706
3841
  }
3707
3842
  });
3708
3843
  try {
3709
- await runCommand(projectPackageManager, installArgs, projectPath);
3844
+ await runCommand(projectPackageManager, installArgs, projectPath, { env: freshInstall.env });
3710
3845
  } catch (error) {
3711
3846
  stopResumeHintOnInterrupt();
3712
3847
  exitWithInitFailure(installFailure({
@@ -3718,7 +3853,7 @@ async function runPlatformInit(projectNameArg, options) {
3718
3853
  }
3719
3854
  stopResumeHintOnInterrupt();
3720
3855
  const repoUrl = project.repo_html_url ?? project.repo_clone_url;
3721
- const tokenLocation = path18.relative(cwd, envPath);
3856
+ const tokenLocation = path19.relative(cwd, envPath);
3722
3857
  if (options.dev === false) {
3723
3858
  logger.success("Your Standard Agents instance is ready.");
3724
3859
  logger.log(`Repository: ${repoUrl}`);
@@ -3818,8 +3953,8 @@ var MANAGED_PROVIDER_KEY_HINTS = [
3818
3953
  ""
3819
3954
  ].join("\n");
3820
3955
  function writeLocalDevVars(projectPath, input) {
3821
- const devVarsPath = path18.join(projectPath, DEV_VARS_FILENAME);
3822
- const existed = fs13.existsSync(devVarsPath);
3956
+ const devVarsPath = path19.join(projectPath, DEV_VARS_FILENAME);
3957
+ const existed = fs14.existsSync(devVarsPath);
3823
3958
  const existing = readDevVarsFile(projectPath);
3824
3959
  const wanted = [
3825
3960
  {
@@ -3850,7 +3985,7 @@ function writeLocalDevVars(projectPath, input) {
3850
3985
  }
3851
3986
  const missing = wanted.filter(({ key }) => !readDevVar(existing, key));
3852
3987
  if (existed && missing.length === 0) {
3853
- fs13.chmodSync(devVarsPath, 384);
3988
+ fs14.chmodSync(devVarsPath, 384);
3854
3989
  } else {
3855
3990
  let devVars = existed ? existing : LOCAL_DEV_VARS_HEADER;
3856
3991
  for (const { heading, key, value } of missing) {
@@ -3909,7 +4044,7 @@ async function init(projectNameArg, initOptions = {}) {
3909
4044
  }
3910
4045
  }
3911
4046
  const providedBootstrap = options.bootstrap?.trim() ?? "";
3912
- const needsLocalEnv = (candidate) => !providedBootstrap && !fs13.existsSync(path18.join(candidate.projectPath, ".dev.vars"));
4047
+ const needsLocalEnv = (candidate) => !providedBootstrap && !fs14.existsSync(path19.join(candidate.projectPath, ".dev.vars"));
3913
4048
  const existingProjectPackageManager = (candidate) => candidate.useExistingProject ? detectLockfilePackageManager(candidate.projectPath) : void 0;
3914
4049
  const initialTarget = resolveProjectTarget(cwd, projectNameArg);
3915
4050
  let target;
@@ -3983,8 +4118,8 @@ async function init(projectNameArg, initOptions = {}) {
3983
4118
  "Installing dependencies and applying Standard Agents project structure.",
3984
4119
  headerOptions
3985
4120
  );
3986
- const stopRemoveOnInterrupt = !useExistingProject && !fs13.existsSync(projectPath) ? interrupts.onInterrupt(() => {
3987
- fs13.rmSync(projectPath, { recursive: true, force: true });
4121
+ const stopRemoveOnInterrupt = !useExistingProject && !fs14.existsSync(projectPath) ? interrupts.onInterrupt(() => {
4122
+ fs14.rmSync(projectPath, { recursive: true, force: true });
3988
4123
  logger.log("");
3989
4124
  logger.info(`Setup interrupted. Removed the partial "${projectName}" directory.`);
3990
4125
  }) : () => {
@@ -4020,28 +4155,28 @@ async function init(projectNameArg, initOptions = {}) {
4020
4155
  );
4021
4156
  process.exit(1);
4022
4157
  }
4023
- const viteConfigPath = path18.join(projectPath, "vite.config.ts");
4024
- if (!fs13.existsSync(viteConfigPath)) {
4158
+ const viteConfigPath = path19.join(projectPath, "vite.config.ts");
4159
+ if (!fs14.existsSync(viteConfigPath)) {
4025
4160
  const viteConfigContent = `import { defineConfig } from 'vite'
4026
4161
 
4027
4162
  export default defineConfig({
4028
4163
  plugins: [],
4029
4164
  })
4030
4165
  `;
4031
- fs13.writeFileSync(viteConfigPath, viteConfigContent, "utf-8");
4166
+ fs14.writeFileSync(viteConfigPath, viteConfigContent, "utf-8");
4032
4167
  logSuccess("Created vite.config.ts");
4033
4168
  }
4034
4169
  writeBuildGuardScript(projectPath);
4035
4170
  } else {
4036
4171
  logInfo(`Detected existing Standard Agents project in "${projectName}".`);
4037
4172
  }
4038
- const packageJsonPath = path18.join(projectPath, "package.json");
4039
- if (fs13.existsSync(packageJsonPath)) {
4040
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
4173
+ const packageJsonPath = path19.join(projectPath, "package.json");
4174
+ if (fs14.existsSync(packageJsonPath)) {
4175
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf-8"));
4041
4176
  const kebabName = toKebabCase(projectName);
4042
4177
  if (packageJson.name !== kebabName) {
4043
4178
  packageJson.name = kebabName;
4044
- fs13.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
4179
+ fs14.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
4045
4180
  }
4046
4181
  if (packageSpecifier === "workspace:*") {
4047
4182
  const workspaceRoot = resolveStandardAgentsWorkspaceRoot();
@@ -4066,7 +4201,7 @@ export default defineConfig({
4066
4201
  let projectPnpmCompatibilityArgs = [];
4067
4202
  try {
4068
4203
  const installBoundary = { isolateFromParent: packageSpecifier === "workspace:*" };
4069
- if (pm === "pnpm" && !installBoundary.isolateFromParent && !fs13.existsSync(path18.join(projectPath, "pnpm-workspace.yaml")) && findPnpmWorkspaceRoot(path18.dirname(projectPath))) {
4204
+ if (pm === "pnpm" && !installBoundary.isolateFromParent && !fs14.existsSync(path19.join(projectPath, "pnpm-workspace.yaml")) && findPnpmWorkspaceRoot(path19.dirname(projectPath))) {
4070
4205
  logInfo("The enclosing pnpm workspace controls esbuild and workerd build approvals.");
4071
4206
  }
4072
4207
  writeLocalPnpmBuildPolicy(projectPath, pm, {
@@ -4281,20 +4416,20 @@ var KEYCHAIN_SERVICE2 = "standardagents-cli";
4281
4416
  function configDir() {
4282
4417
  if (process.platform === "win32") {
4283
4418
  const appData = process.env.APPDATA;
4284
- if (appData) return path18.join(appData, "standardagents");
4419
+ if (appData) return path19.join(appData, "standardagents");
4285
4420
  }
4286
4421
  const xdgConfig = process.env.XDG_CONFIG_HOME;
4287
- if (xdgConfig) return path18.join(xdgConfig, "standardagents");
4288
- return path18.join(os5.homedir(), ".config", "standardagents");
4422
+ if (xdgConfig) return path19.join(xdgConfig, "standardagents");
4423
+ return path19.join(os5.homedir(), ".config", "standardagents");
4289
4424
  }
4290
4425
  function stateFilePath() {
4291
- return path18.join(configDir(), "auth-state.json");
4426
+ return path19.join(configDir(), "auth-state.json");
4292
4427
  }
4293
4428
  function cliAuthStatePath() {
4294
4429
  return stateFilePath();
4295
4430
  }
4296
4431
  function ensureStateDir() {
4297
- fs13.mkdirSync(path18.dirname(stateFilePath()), { recursive: true });
4432
+ fs14.mkdirSync(path19.dirname(stateFilePath()), { recursive: true });
4298
4433
  }
4299
4434
  function securityCommand(args) {
4300
4435
  const result = spawnSync("security", args, { encoding: "utf8" });
@@ -4323,11 +4458,11 @@ function deleteFromKeychain(orgId) {
4323
4458
  }
4324
4459
  function readCliAuthState() {
4325
4460
  const file = stateFilePath();
4326
- if (!fs13.existsSync(file)) {
4461
+ if (!fs14.existsSync(file)) {
4327
4462
  return { active_org_id: null, orgs: {} };
4328
4463
  }
4329
4464
  try {
4330
- const parsed = JSON.parse(fs13.readFileSync(file, "utf8"));
4465
+ const parsed = JSON.parse(fs14.readFileSync(file, "utf8"));
4331
4466
  return {
4332
4467
  active_org_id: parsed.active_org_id ?? null,
4333
4468
  orgs: parsed.orgs ?? {},
@@ -4381,7 +4516,7 @@ function hasStoredCliAuth() {
4381
4516
  return Object.keys(state.orgs).length > 0;
4382
4517
  }
4383
4518
  function gitAuthKeychainAccount(endpoint) {
4384
- const owner = `${path18.resolve(stateFilePath())}\0${endpoint}`;
4519
+ const owner = `${path19.resolve(stateFilePath())}\0${endpoint}`;
4385
4520
  return `git-auth-${createHash("sha256").update(owner).digest("hex").slice(0, 32)}`;
4386
4521
  }
4387
4522
  function parseGitAuthSecrets(text2) {
@@ -4723,11 +4858,11 @@ function wasReplacedByRetry(build) {
4723
4858
  return build.error_code === LEGAL_ACCEPTANCE_RETRIED;
4724
4859
  }
4725
4860
  function findDevVars(startDir) {
4726
- let current = path18.resolve(startDir);
4861
+ let current = path19.resolve(startDir);
4727
4862
  while (true) {
4728
- const candidate = path18.join(current, DEV_VARS_FILENAME);
4729
- if (fs13.existsSync(candidate)) return fs13.readFileSync(candidate, "utf-8");
4730
- const parent = path18.dirname(current);
4863
+ const candidate = path19.join(current, DEV_VARS_FILENAME);
4864
+ if (fs14.existsSync(candidate)) return fs14.readFileSync(candidate, "utf-8");
4865
+ const parent = path19.dirname(current);
4731
4866
  if (parent === current) return "";
4732
4867
  current = parent;
4733
4868
  }
@@ -5070,19 +5205,19 @@ function standardAgentsRemote(dir) {
5070
5205
  return remote && isStandardAgentsGitRemote(remote) ? remote : null;
5071
5206
  }
5072
5207
  function findProjectDir(cwd) {
5073
- let start = path18.resolve(cwd);
5208
+ let start = path19.resolve(cwd);
5074
5209
  try {
5075
- start = fs13.realpathSync(start);
5210
+ start = fs14.realpathSync(start);
5076
5211
  } catch {
5077
5212
  return null;
5078
5213
  }
5079
5214
  const toplevel = gitOutput(start, ["rev-parse", "--show-toplevel"]);
5080
- const root = toplevel ? path18.resolve(toplevel) : null;
5081
- for (let current = start; ; current = path18.dirname(current)) {
5082
- if (fs13.existsSync(path18.join(current, DEV_VARS_FILENAME)) || isStandardAgentsProjectDir(current)) {
5215
+ const root = toplevel ? path19.resolve(toplevel) : null;
5216
+ for (let current = start; ; current = path19.dirname(current)) {
5217
+ if (fs14.existsSync(path19.join(current, DEV_VARS_FILENAME)) || isStandardAgentsProjectDir(current)) {
5083
5218
  return current;
5084
5219
  }
5085
- if (!root || current === root || path18.dirname(current) === current) break;
5220
+ if (!root || current === root || path19.dirname(current) === current) break;
5086
5221
  }
5087
5222
  return root && standardAgentsRemote(root) ? root : null;
5088
5223
  }
@@ -5202,7 +5337,7 @@ async function performLogin(options = {}) {
5202
5337
  return { record, keyReused: accessKey?.reused === true, store, helper, ...helperError ? { helperError } : {}, project };
5203
5338
  }
5204
5339
  function reportProject(project) {
5205
- const devVars = path18.join(path18.relative(process.cwd(), project.dir), DEV_VARS_FILENAME);
5340
+ const devVars = path19.join(path19.relative(process.cwd(), project.dir), DEV_VARS_FILENAME);
5206
5341
  if (project.status === "key_saved") {
5207
5342
  logger.log(`Project: saved a project API key in ${devVars}. Local sign-in uses your Standard Agents account.`);
5208
5343
  return;
@@ -5336,7 +5471,7 @@ function registerLoginCommands(program2) {
5336
5471
  }
5337
5472
  function readSession(statePath) {
5338
5473
  try {
5339
- const parsed = JSON.parse(fs13.readFileSync(statePath, "utf-8"));
5474
+ const parsed = JSON.parse(fs14.readFileSync(statePath, "utf-8"));
5340
5475
  if (!parsed || typeof parsed !== "object") return null;
5341
5476
  const { endpoint, session_cookie: cookie } = parsed;
5342
5477
  return typeof endpoint === "string" && endpoint && typeof cookie === "string" && cookie ? { endpoint, cookie } : null;
@@ -5345,10 +5480,10 @@ function readSession(statePath) {
5345
5480
  }
5346
5481
  }
5347
5482
  function removeLegacyProjectSession(projectPath) {
5348
- const statePath = path18.join(projectPath, BOOTSTRAP_STATE_RELATIVE_PATH);
5349
- if (!fs13.existsSync(statePath)) return null;
5483
+ const statePath = path19.join(projectPath, BOOTSTRAP_STATE_RELATIVE_PATH);
5484
+ if (!fs14.existsSync(statePath)) return null;
5350
5485
  const session = readSession(statePath);
5351
- fs13.unlinkSync(statePath);
5486
+ fs14.unlinkSync(statePath);
5352
5487
  return { file: BOOTSTRAP_STATE_RELATIVE_PATH, session };
5353
5488
  }
5354
5489
  var GIT_TOKEN_SCOPE_ENV = "STANDARD_AGENTS_GIT_TOKEN_SCOPE";
@@ -5377,7 +5512,7 @@ function gitSubcommand(args) {
5377
5512
  }
5378
5513
  function gitTokenScopeFor(ancestors) {
5379
5514
  for (const { argv, exact } of ancestors) {
5380
- const program2 = path18.basename(argv[0] ?? "").toLowerCase().replace(/\.exe$/, "");
5515
+ const program2 = path19.basename(argv[0] ?? "").toLowerCase().replace(/\.exe$/, "");
5381
5516
  if (program2 !== "git") continue;
5382
5517
  const command = gitSubcommand(argv.slice(1));
5383
5518
  if (command?.startsWith("remote-http")) continue;
@@ -5389,8 +5524,8 @@ function gitTokenScopeFor(ancestors) {
5389
5524
  }
5390
5525
  function procfsProcess(pid) {
5391
5526
  try {
5392
- const argv = fs13.readFileSync(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean);
5393
- const stat = fs13.readFileSync(`/proc/${pid}/stat`, "utf8");
5527
+ const argv = fs14.readFileSync(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean);
5528
+ const stat = fs14.readFileSync(`/proc/${pid}/stat`, "utf8");
5394
5529
  const parent = Number.parseInt(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1], 10);
5395
5530
  return Number.isInteger(parent) ? { argv, parent } : null;
5396
5531
  } catch {
@@ -5405,7 +5540,7 @@ function psProcess(pid) {
5405
5540
  }
5406
5541
  function* readAncestorCommands(startPid = process.ppid) {
5407
5542
  if (process.platform === "win32") return;
5408
- const exact = fs13.existsSync("/proc/self/stat");
5543
+ const exact = fs14.existsSync("/proc/self/stat");
5409
5544
  let pid = startPid;
5410
5545
  for (let depth = 0; pid > 1 && depth < MAX_ANCESTORS; depth += 1) {
5411
5546
  const entry = exact ? procfsProcess(pid) : psProcess(pid);
@@ -5437,11 +5572,11 @@ function parseCredentialRequest(input) {
5437
5572
  return result;
5438
5573
  }
5439
5574
  function findDotDevVars(startDir = process.cwd()) {
5440
- let current = path18.resolve(startDir);
5575
+ let current = path19.resolve(startDir);
5441
5576
  while (true) {
5442
- const candidate = path18.join(current, DEV_VARS_FILENAME);
5443
- if (fs13.existsSync(candidate)) return candidate;
5444
- const parent = path18.dirname(current);
5577
+ const candidate = path19.join(current, DEV_VARS_FILENAME);
5578
+ if (fs14.existsSync(candidate)) return candidate;
5579
+ const parent = path19.dirname(current);
5445
5580
  if (parent === current) return null;
5446
5581
  current = parent;
5447
5582
  }
@@ -5449,7 +5584,7 @@ function findDotDevVars(startDir = process.cwd()) {
5449
5584
  var PROJECT_API_KEY = "STANDARD_AGENTS_API_KEY";
5450
5585
  function credentialSources(options) {
5451
5586
  const envPath = findDotDevVars(options.startDir);
5452
- const devVars = envPath ? readDevVarsFile(path18.dirname(envPath)) : "";
5587
+ const devVars = envPath ? readDevVarsFile(path19.dirname(envPath)) : "";
5453
5588
  const fileVar = (key) => readDevVar(devVars, key)?.trim() ?? "";
5454
5589
  const endpoint = configuredPlatformEndpoint(
5455
5590
  options.endpoint,
@@ -5600,7 +5735,7 @@ var ENVIRONMENT_CREDENTIAL_KEYS = [
5600
5735
  ];
5601
5736
  function resolveProjectDir(startDir) {
5602
5737
  const devVarsPath = findDotDevVars(startDir);
5603
- return devVarsPath ? path18.dirname(devVarsPath) : path18.resolve(startDir);
5738
+ return devVarsPath ? path19.dirname(devVarsPath) : path19.resolve(startDir);
5604
5739
  }
5605
5740
  function recordRevocation(report, outcome, labels) {
5606
5741
  if (outcome.status === "revoked") {
@@ -5957,9 +6092,9 @@ export default defineConfig(({ mode }) => {
5957
6092
  }
5958
6093
  function getReactPackageVersion() {
5959
6094
  try {
5960
- const __dirname = path18.dirname(fileURLToPath(import.meta.url));
5961
- const pkgPath = path18.resolve(__dirname, "../package.json");
5962
- const pkg = JSON.parse(fs13.readFileSync(pkgPath, "utf-8"));
6095
+ const __dirname = path19.dirname(fileURLToPath(import.meta.url));
6096
+ const pkgPath = path19.resolve(__dirname, "../package.json");
6097
+ const pkg = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
5963
6098
  const version = pkg.version;
5964
6099
  const prereleaseMatch = version.match(/-([a-z]+)\./i);
5965
6100
  if (prereleaseMatch) {
@@ -5971,9 +6106,9 @@ function getReactPackageVersion() {
5971
6106
  }
5972
6107
  }
5973
6108
  function getChatSourceDir() {
5974
- const __dirname = path18.dirname(fileURLToPath(import.meta.url));
5975
- const bundled = path18.resolve(__dirname, "../chat");
5976
- return fs13.existsSync(bundled) ? bundled : path18.resolve(__dirname, "../../chat");
6109
+ const __dirname = path19.dirname(fileURLToPath(import.meta.url));
6110
+ const bundled = path19.resolve(__dirname, "../chat");
6111
+ return fs14.existsSync(bundled) ? bundled : path19.resolve(__dirname, "../../chat");
5977
6112
  }
5978
6113
  async function prompt(question) {
5979
6114
  const rl = readline.createInterface({
@@ -5994,10 +6129,10 @@ function detectPackageManager2() {
5994
6129
  if (userAgent.includes("yarn")) return "yarn";
5995
6130
  if (userAgent.includes("bun")) return "bun";
5996
6131
  }
5997
- if (fs13.existsSync("pnpm-lock.yaml")) return "pnpm";
5998
- if (fs13.existsSync("yarn.lock")) return "yarn";
5999
- if (fs13.existsSync("bun.lockb")) return "bun";
6000
- if (fs13.existsSync("package-lock.json")) return "npm";
6132
+ if (fs14.existsSync("pnpm-lock.yaml")) return "pnpm";
6133
+ if (fs14.existsSync("yarn.lock")) return "yarn";
6134
+ if (fs14.existsSync("bun.lockb")) return "bun";
6135
+ if (fs14.existsSync("package-lock.json")) return "npm";
6001
6136
  return "npm";
6002
6137
  }
6003
6138
  async function selectPackageManager(detected) {
@@ -6226,25 +6361,25 @@ minimumReleaseAgeExclude:
6226
6361
  `;
6227
6362
  }
6228
6363
  function copyDir(src, dest, skip = []) {
6229
- if (!fs13.existsSync(dest)) {
6230
- fs13.mkdirSync(dest, { recursive: true });
6364
+ if (!fs14.existsSync(dest)) {
6365
+ fs14.mkdirSync(dest, { recursive: true });
6231
6366
  }
6232
- const entries = fs13.readdirSync(src, { withFileTypes: true });
6367
+ const entries = fs14.readdirSync(src, { withFileTypes: true });
6233
6368
  for (const entry of entries) {
6234
6369
  if (skip.includes(entry.name) || /\.test\.tsx?$/.test(entry.name)) continue;
6235
- const srcPath = path18.join(src, entry.name);
6236
- const destPath = path18.join(dest, entry.name);
6370
+ const srcPath = path19.join(src, entry.name);
6371
+ const destPath = path19.join(dest, entry.name);
6237
6372
  if (entry.isDirectory()) {
6238
6373
  copyDir(srcPath, destPath, skip);
6239
6374
  } else {
6240
- fs13.copyFileSync(srcPath, destPath);
6375
+ fs14.copyFileSync(srcPath, destPath);
6241
6376
  }
6242
6377
  }
6243
6378
  }
6244
6379
  async function initChat(projectNameArg, options = {}) {
6245
6380
  const cwd = process.cwd();
6246
6381
  const chatSourceDir = getChatSourceDir();
6247
- if (!fs13.existsSync(chatSourceDir)) {
6382
+ if (!fs14.existsSync(chatSourceDir)) {
6248
6383
  logger.error("Chat source files not found. This CLI installation may be corrupted.");
6249
6384
  process.exit(1);
6250
6385
  }
@@ -6264,8 +6399,8 @@ async function initChat(projectNameArg, options = {}) {
6264
6399
  logger.error("Project name is required");
6265
6400
  process.exit(1);
6266
6401
  }
6267
- const projectPath = path18.join(cwd, projectName);
6268
- if (fs13.existsSync(projectPath)) {
6402
+ const projectPath = path19.join(cwd, projectName);
6403
+ if (fs14.existsSync(projectPath)) {
6269
6404
  logger.error(`Directory "${projectName}" already exists`);
6270
6405
  process.exit(1);
6271
6406
  }
@@ -6299,7 +6434,7 @@ async function initChat(projectNameArg, options = {}) {
6299
6434
  logger.log("");
6300
6435
  logger.info(`Creating ${framework === "vite" ? "Vite" : "Next.js"} project...`);
6301
6436
  logger.log("");
6302
- fs13.mkdirSync(projectPath, { recursive: true });
6437
+ fs14.mkdirSync(projectPath, { recursive: true });
6303
6438
  const reactVersion = getReactPackageVersion();
6304
6439
  if (framework === "vite") {
6305
6440
  await scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl, reactVersion);
@@ -6362,25 +6497,25 @@ async function initChat(projectNameArg, options = {}) {
6362
6497
  }
6363
6498
  }
6364
6499
  async function scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl, reactVersion) {
6365
- copyDir(path18.join(chatSourceDir, "src"), path18.join(projectPath, "src"), []);
6500
+ copyDir(path19.join(chatSourceDir, "src"), path19.join(projectPath, "src"), []);
6366
6501
  logger.success("Copied src/");
6367
- const viteDir = path18.join(chatSourceDir, "vite");
6368
- let indexHtml = fs13.readFileSync(path18.join(viteDir, "index.html"), "utf-8");
6502
+ const viteDir = path19.join(chatSourceDir, "vite");
6503
+ let indexHtml = fs14.readFileSync(path19.join(viteDir, "index.html"), "utf-8");
6369
6504
  indexHtml = indexHtml.replace('src="/main.tsx"', 'src="/src/main.tsx"');
6370
- fs13.writeFileSync(path18.join(projectPath, "index.html"), indexHtml, "utf-8");
6505
+ fs14.writeFileSync(path19.join(projectPath, "index.html"), indexHtml, "utf-8");
6371
6506
  logger.success("Created index.html");
6372
- fs13.copyFileSync(path18.join(viteDir, "main.tsx"), path18.join(projectPath, "src", "main.tsx"));
6507
+ fs14.copyFileSync(path19.join(viteDir, "main.tsx"), path19.join(projectPath, "src", "main.tsx"));
6373
6508
  logger.success("Created src/main.tsx");
6374
- fs13.writeFileSync(path18.join(projectPath, "vite.config.ts"), renderChatViteConfig(), "utf-8");
6509
+ fs14.writeFileSync(path19.join(projectPath, "vite.config.ts"), renderChatViteConfig(), "utf-8");
6375
6510
  logger.success("Created vite.config.ts");
6376
- fs13.copyFileSync(path18.join(chatSourceDir, "tsconfig.json"), path18.join(projectPath, "tsconfig.json"));
6377
- const tsconfig = JSON.parse(fs13.readFileSync(path18.join(projectPath, "tsconfig.json"), "utf-8"));
6511
+ fs14.copyFileSync(path19.join(chatSourceDir, "tsconfig.json"), path19.join(projectPath, "tsconfig.json"));
6512
+ const tsconfig = JSON.parse(fs14.readFileSync(path19.join(projectPath, "tsconfig.json"), "utf-8"));
6378
6513
  tsconfig.include = ["src"];
6379
6514
  delete tsconfig.compilerOptions?.paths;
6380
- fs13.writeFileSync(path18.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6515
+ fs14.writeFileSync(path19.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6381
6516
  logger.success("Created tsconfig.json");
6382
- fs13.copyFileSync(path18.join(chatSourceDir, "package.json"), path18.join(projectPath, "package.json"));
6383
- const pkg = JSON.parse(fs13.readFileSync(path18.join(projectPath, "package.json"), "utf-8"));
6517
+ fs14.copyFileSync(path19.join(chatSourceDir, "package.json"), path19.join(projectPath, "package.json"));
6518
+ const pkg = JSON.parse(fs14.readFileSync(path19.join(projectPath, "package.json"), "utf-8"));
6384
6519
  pkg.name = projectName;
6385
6520
  pkg.scripts = { ...CHAT_SCRIPTS.vite };
6386
6521
  delete pkg.private;
@@ -6391,36 +6526,36 @@ async function scaffoldVite(projectPath, chatSourceDir, projectName, serverUrl,
6391
6526
  delete pkg.devDependencies?.["@tailwindcss/postcss"];
6392
6527
  delete pkg.devDependencies?.["postcss"];
6393
6528
  delete pkg.devDependencies?.["vitest"];
6394
- fs13.writeFileSync(path18.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6395
- fs13.writeFileSync(path18.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6529
+ fs14.writeFileSync(path19.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6530
+ fs14.writeFileSync(path19.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6396
6531
  logger.success("Created package.json");
6397
6532
  const envContent = `# Standard Agents Builder connection
6398
6533
  VITE_AGENTBUILDER_URL=${serverUrl}
6399
6534
  `;
6400
- fs13.writeFileSync(path18.join(projectPath, ".env"), envContent, "utf-8");
6535
+ fs14.writeFileSync(path19.join(projectPath, ".env"), envContent, "utf-8");
6401
6536
  logger.success("Created .env");
6402
- fs13.writeFileSync(path18.join(projectPath, ".gitignore"), `node_modules
6537
+ fs14.writeFileSync(path19.join(projectPath, ".gitignore"), `node_modules
6403
6538
  dist
6404
6539
  .env
6405
6540
  `, "utf-8");
6406
6541
  logger.success("Created .gitignore");
6407
- let mainTsx = fs13.readFileSync(path18.join(projectPath, "src", "main.tsx"), "utf-8");
6542
+ let mainTsx = fs14.readFileSync(path19.join(projectPath, "src", "main.tsx"), "utf-8");
6408
6543
  mainTsx = mainTsx.replace(/from '\.\.\/src\//g, "from './").replace(/import '\.\.\/src\//g, "import './");
6409
- fs13.writeFileSync(path18.join(projectPath, "src", "main.tsx"), mainTsx, "utf-8");
6410
- if (fs13.existsSync(path18.join(viteDir, "favicon.svg"))) {
6411
- fs13.copyFileSync(path18.join(viteDir, "favicon.svg"), path18.join(projectPath, "favicon.svg"));
6544
+ fs14.writeFileSync(path19.join(projectPath, "src", "main.tsx"), mainTsx, "utf-8");
6545
+ if (fs14.existsSync(path19.join(viteDir, "favicon.svg"))) {
6546
+ fs14.copyFileSync(path19.join(viteDir, "favicon.svg"), path19.join(projectPath, "favicon.svg"));
6412
6547
  logger.success("Created favicon.svg");
6413
6548
  }
6414
6549
  }
6415
6550
  async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl, reactVersion) {
6416
- copyDir(path18.join(chatSourceDir, "src"), path18.join(projectPath, "src"), []);
6551
+ copyDir(path19.join(chatSourceDir, "src"), path19.join(projectPath, "src"), []);
6417
6552
  logger.success("Copied src/");
6418
- const nextDir = path18.join(chatSourceDir, "next");
6419
- copyDir(path18.join(nextDir, "app"), path18.join(projectPath, "app"), []);
6553
+ const nextDir = path19.join(chatSourceDir, "next");
6554
+ copyDir(path19.join(nextDir, "app"), path19.join(projectPath, "app"), []);
6420
6555
  logger.success("Copied app/");
6421
- fs13.copyFileSync(path18.join(nextDir, "next.config.ts"), path18.join(projectPath, "next.config.ts"));
6556
+ fs14.copyFileSync(path19.join(nextDir, "next.config.ts"), path19.join(projectPath, "next.config.ts"));
6422
6557
  logger.success("Created next.config.ts");
6423
- fs13.copyFileSync(path18.join(nextDir, "postcss.config.mjs"), path18.join(projectPath, "postcss.config.mjs"));
6558
+ fs14.copyFileSync(path19.join(nextDir, "postcss.config.mjs"), path19.join(projectPath, "postcss.config.mjs"));
6424
6559
  logger.success("Created postcss.config.mjs");
6425
6560
  const tsconfig = {
6426
6561
  compilerOptions: {
@@ -6445,9 +6580,9 @@ async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl
6445
6580
  include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
6446
6581
  exclude: ["node_modules"]
6447
6582
  };
6448
- fs13.writeFileSync(path18.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6583
+ fs14.writeFileSync(path19.join(projectPath, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
6449
6584
  logger.success("Created tsconfig.json");
6450
- const pkg = JSON.parse(fs13.readFileSync(path18.join(chatSourceDir, "package.json"), "utf-8"));
6585
+ const pkg = JSON.parse(fs14.readFileSync(path19.join(chatSourceDir, "package.json"), "utf-8"));
6451
6586
  pkg.name = projectName;
6452
6587
  pkg.scripts = { ...CHAT_SCRIPTS.nextjs };
6453
6588
  delete pkg.private;
@@ -6458,26 +6593,26 @@ async function scaffoldNextjs(projectPath, chatSourceDir, projectName, serverUrl
6458
6593
  delete pkg.devDependencies?.["@vitejs/plugin-react"];
6459
6594
  delete pkg.devDependencies?.["vite"];
6460
6595
  delete pkg.devDependencies?.["vitest"];
6461
- fs13.writeFileSync(path18.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6462
- fs13.writeFileSync(path18.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6596
+ fs14.writeFileSync(path19.join(projectPath, "package.json"), JSON.stringify(applyChatBuildApprovals(pkg), null, 2) + "\n", "utf-8");
6597
+ fs14.writeFileSync(path19.join(projectPath, "pnpm-workspace.yaml"), renderChatPnpmWorkspaceYaml(), "utf-8");
6463
6598
  logger.success("Created package.json");
6464
6599
  const envContent = `# Standard Agents Builder connection
6465
6600
  NEXT_PUBLIC_AGENTBUILDER_URL=${serverUrl}
6466
6601
  `;
6467
- fs13.writeFileSync(path18.join(projectPath, ".env.local"), envContent, "utf-8");
6602
+ fs14.writeFileSync(path19.join(projectPath, ".env.local"), envContent, "utf-8");
6468
6603
  logger.success("Created .env.local");
6469
- fs13.writeFileSync(path18.join(projectPath, ".gitignore"), `node_modules
6604
+ fs14.writeFileSync(path19.join(projectPath, ".gitignore"), `node_modules
6470
6605
  .next
6471
6606
  out
6472
6607
  .env.local
6473
6608
  `, "utf-8");
6474
6609
  logger.success("Created .gitignore");
6475
- let layoutTsx = fs13.readFileSync(path18.join(projectPath, "app", "layout.tsx"), "utf-8");
6610
+ let layoutTsx = fs14.readFileSync(path19.join(projectPath, "app", "layout.tsx"), "utf-8");
6476
6611
  layoutTsx = layoutTsx.replace(/from '\.\.\/\.\.\/src\//g, "from '../src/");
6477
- fs13.writeFileSync(path18.join(projectPath, "app", "layout.tsx"), layoutTsx, "utf-8");
6478
- let pageTsx = fs13.readFileSync(path18.join(projectPath, "app", "page.tsx"), "utf-8");
6612
+ fs14.writeFileSync(path19.join(projectPath, "app", "layout.tsx"), layoutTsx, "utf-8");
6613
+ let pageTsx = fs14.readFileSync(path19.join(projectPath, "app", "page.tsx"), "utf-8");
6479
6614
  pageTsx = pageTsx.replace(/from '\.\.\/\.\.\/src\//g, "from '../src/");
6480
- fs13.writeFileSync(path18.join(projectPath, "app", "page.tsx"), pageTsx, "utf-8");
6615
+ fs14.writeFileSync(path19.join(projectPath, "app", "page.tsx"), pageTsx, "utf-8");
6481
6616
  }
6482
6617
 
6483
6618
  // src/commands/init-chat-command.ts
@@ -6514,7 +6649,7 @@ function packageManagerFor(rootDir) {
6514
6649
  }
6515
6650
  function declaresBuilder(rootDir) {
6516
6651
  try {
6517
- const manifest = JSON.parse(fs13.readFileSync(path18.join(rootDir, "package.json"), "utf-8"));
6652
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(rootDir, "package.json"), "utf-8"));
6518
6653
  if (!manifest || typeof manifest !== "object") return false;
6519
6654
  return ["dependencies", "devDependencies"].some((field2) => {
6520
6655
  const dependencies = Reflect.get(manifest, field2);
@@ -6530,15 +6665,15 @@ function builderInstallCommand(rootDir) {
6530
6665
  return packageManager === "npm" ? `npm install ${BUILDER}` : `${packageManager} add ${BUILDER}`;
6531
6666
  }
6532
6667
  function findInstalledBuilder(rootDir) {
6533
- for (let dir = path18.resolve(rootDir); ; dir = path18.dirname(dir)) {
6534
- const candidate = path18.join(dir, "node_modules", BUILDER);
6535
- if (fs13.existsSync(path18.join(candidate, "package.json"))) return candidate;
6536
- if (path18.dirname(dir) === dir) return void 0;
6668
+ for (let dir = path19.resolve(rootDir); ; dir = path19.dirname(dir)) {
6669
+ const candidate = path19.join(dir, "node_modules", BUILDER);
6670
+ if (fs14.existsSync(path19.join(candidate, "package.json"))) return candidate;
6671
+ if (path19.dirname(dir) === dir) return void 0;
6537
6672
  }
6538
6673
  }
6539
6674
  function installedVersion(builderDir) {
6540
6675
  try {
6541
- const manifest = JSON.parse(fs13.readFileSync(path18.join(builderDir, "package.json"), "utf-8"));
6676
+ const manifest = JSON.parse(fs14.readFileSync(path19.join(builderDir, "package.json"), "utf-8"));
6542
6677
  const version = manifest && typeof manifest === "object" ? Reflect.get(manifest, "version") : void 0;
6543
6678
  return typeof version === "string" ? version : "unknown version";
6544
6679
  } catch {
@@ -6555,7 +6690,7 @@ async function loadProjectPacking(rootDir) {
6555
6690
  }
6556
6691
  let entry;
6557
6692
  try {
6558
- entry = createRequire(path18.join(rootDir, "package.json")).resolve(PACKING_ENTRY);
6693
+ entry = createRequire(path19.join(rootDir, "package.json")).resolve(PACKING_ENTRY);
6559
6694
  } catch (error) {
6560
6695
  const installed = `${BUILDER} ${installedVersion(builderDir)} at ${builderDir}`;
6561
6696
  if (errorCode(error) === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
@@ -6580,7 +6715,7 @@ async function loadProjectPacking(rootDir) {
6580
6715
  }
6581
6716
  }
6582
6717
  async function requireProjectPacking(rootDir) {
6583
- if (!fs13.existsSync(path18.join(rootDir, "agents"))) {
6718
+ if (!fs14.existsSync(path19.join(rootDir, "agents"))) {
6584
6719
  throw new PackingUnavailableError(
6585
6720
  `No agents/ directory in ${rootDir}.`,
6586
6721
  "Run this command from the root of a Standard Agents project.",
@@ -6853,12 +6988,12 @@ async function pack(agentName, options) {
6853
6988
  if (removed.length > 0) {
6854
6989
  logger.warning("Packing removes these original files from the project. The package keeps a copy of each. Pass --no-remove to keep them:");
6855
6990
  for (const item of removed) {
6856
- logger.detail(` - ${path18.relative(rootDir, item.filePath)}`);
6991
+ logger.detail(` - ${path19.relative(rootDir, item.filePath)}`);
6857
6992
  }
6858
6993
  } else {
6859
6994
  logger.info("Original files are kept. Packing removes nothing from the project.");
6860
6995
  }
6861
- const outputDir = options.output || path18.join(rootDir, "agents", "packed");
6996
+ const outputDir = options.output || path19.join(rootDir, "agents", "packed");
6862
6997
  logger.info(`Packing to: ${outputDir}`);
6863
6998
  const result = await packingService.pack({
6864
6999
  agentName: selectedAgent,
@@ -6957,7 +7092,7 @@ async function unpack(pkgIdentifier) {
6957
7092
  console.log("");
6958
7093
  logger.info("Created files:");
6959
7094
  for (const file of result.filesGenerated) {
6960
- const relPath = path18.relative(rootDir, file);
7095
+ const relPath = path19.relative(rootDir, file);
6961
7096
  console.log(` - ${relPath}`);
6962
7097
  }
6963
7098
  }
@@ -7877,8 +8012,8 @@ var PROJECT_SIGNAL_PATHS = [
7877
8012
  "vite.config.mjs"
7878
8013
  ];
7879
8014
  function hasProjectSignals(cwd) {
7880
- const hits = PROJECT_SIGNAL_PATHS.filter((signal) => fs13.existsSync(path18.join(cwd, signal))).length;
7881
- return hits >= 2 || fs13.existsSync(path18.join(cwd, ".agents"));
8015
+ const hits = PROJECT_SIGNAL_PATHS.filter((signal) => fs14.existsSync(path19.join(cwd, signal))).length;
8016
+ return hits >= 2 || fs14.existsSync(path19.join(cwd, ".agents"));
7882
8017
  }
7883
8018
  function detectCliDirectoryContext(cwd = process.cwd()) {
7884
8019
  if (!hasProjectSignals(cwd)) {
@@ -8047,13 +8182,13 @@ async function runHomeTui(cwd = process.cwd()) {
8047
8182
  }
8048
8183
  var DEFAULT_SKILL_NAME = "agentbuilder";
8049
8184
  function resolveCodexHome(env = process.env, homeDir = os5.homedir()) {
8050
- return env.CODEX_HOME || path18.join(homeDir, ".codex");
8185
+ return env.CODEX_HOME || path19.join(homeDir, ".codex");
8051
8186
  }
8052
8187
  function resolveClaudeHome(homeDir = os5.homedir()) {
8053
- return path18.join(homeDir, ".claude");
8188
+ return path19.join(homeDir, ".claude");
8054
8189
  }
8055
8190
  function resolveAgentsHome(homeDir = os5.homedir()) {
8056
- return path18.join(homeDir, ".agents");
8191
+ return path19.join(homeDir, ".agents");
8057
8192
  }
8058
8193
  function normalizeTargetId(target) {
8059
8194
  if (target === "codex" || target === "agents") {
@@ -8066,12 +8201,12 @@ function expandHomePath(inputPath, homeDir = os5.homedir()) {
8066
8201
  return homeDir;
8067
8202
  }
8068
8203
  if (inputPath.startsWith("~/")) {
8069
- return path18.join(homeDir, inputPath.slice(2));
8204
+ return path19.join(homeDir, inputPath.slice(2));
8070
8205
  }
8071
8206
  return inputPath;
8072
8207
  }
8073
8208
  function buildInstallTargets(options = {}, env = process.env, homeDir = os5.homedir()) {
8074
- const customRoot = options.dir ? path18.resolve(expandHomePath(options.dir, homeDir)) : null;
8209
+ const customRoot = options.dir ? path19.resolve(expandHomePath(options.dir, homeDir)) : null;
8075
8210
  const agentsHome = resolveAgentsHome(homeDir);
8076
8211
  const claudeHome = resolveClaudeHome(homeDir);
8077
8212
  return [
@@ -8079,15 +8214,15 @@ function buildInstallTargets(options = {}, env = process.env, homeDir = os5.home
8079
8214
  id: "agents",
8080
8215
  label: "Codex and other coding agents",
8081
8216
  summary: "Agent Skills folder read by Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, and others",
8082
- detected: fs13.existsSync(agentsHome) || fs13.existsSync(resolveCodexHome(env, homeDir)),
8083
- installPath: customRoot ?? path18.join(agentsHome, "skills")
8217
+ detected: fs14.existsSync(agentsHome) || fs14.existsSync(resolveCodexHome(env, homeDir)),
8218
+ installPath: customRoot ?? path19.join(agentsHome, "skills")
8084
8219
  },
8085
8220
  {
8086
8221
  id: "claude",
8087
8222
  label: "Claude Code",
8088
8223
  summary: "Agent Skills folder read by Claude Code",
8089
- detected: fs13.existsSync(claudeHome),
8090
- installPath: customRoot ?? path18.join(claudeHome, "skills")
8224
+ detected: fs14.existsSync(claudeHome),
8225
+ installPath: customRoot ?? path19.join(claudeHome, "skills")
8091
8226
  }
8092
8227
  ];
8093
8228
  }
@@ -8107,8 +8242,8 @@ function findSupersededInstalls(targetId, skillName = DEFAULT_SKILL_NAME, option
8107
8242
  if (options.dir) {
8108
8243
  return [];
8109
8244
  }
8110
- const superseded = normalizeTargetId(targetId) === "claude" ? path18.join(resolveClaudeHome(homeDir), "agents", `${skillName}.md`) : path18.join(resolveCodexHome(env, homeDir), "skills", skillName);
8111
- return fs13.existsSync(superseded) ? [superseded] : [];
8245
+ const superseded = normalizeTargetId(targetId) === "claude" ? path19.join(resolveClaudeHome(homeDir), "agents", `${skillName}.md`) : path19.join(resolveCodexHome(env, homeDir), "skills", skillName);
8246
+ return fs14.existsSync(superseded) ? [superseded] : [];
8112
8247
  }
8113
8248
  async function selectInstallTarget(targets) {
8114
8249
  return new Promise((resolve) => {
@@ -8172,8 +8307,8 @@ async function selectInstallTarget(targets) {
8172
8307
  }
8173
8308
  async function installBundledSkill(targetId, skillName = DEFAULT_SKILL_NAME, options = {}) {
8174
8309
  const target = resolveSelectedTarget(targetId, options);
8175
- const targetDir = path18.join(target.installPath, skillName);
8176
- if (fs13.existsSync(targetDir) && !options.force) {
8310
+ const targetDir = path19.join(target.installPath, skillName);
8311
+ if (fs14.existsSync(targetDir) && !options.force) {
8177
8312
  throw new Error(
8178
8313
  `Skill already exists at ${targetDir}. Re-run with --force to overwrite it.`
8179
8314
  );
@@ -8201,7 +8336,7 @@ async function skill(options = {}) {
8201
8336
  logger.log("");
8202
8337
  logger.log("Next steps:");
8203
8338
  logger.log(` Restart ${selectedTarget.id === "claude" ? "Claude Code" : "your coding agent"} if it is already running`);
8204
- logger.log(` Edit ${path18.join(installedPath, "SKILL.md")} to continue customizing the skill`);
8339
+ logger.log(` Edit ${path19.join(installedPath, "SKILL.md")} to continue customizing the skill`);
8205
8340
  for (const superseded of findSupersededInstalls(
8206
8341
  selectedTarget.id,
8207
8342
  DEFAULT_SKILL_NAME,
@@ -8364,24 +8499,24 @@ function parseEnvFile(content) {
8364
8499
  return result;
8365
8500
  }
8366
8501
  function findProjectRoot(startDir = process.cwd()) {
8367
- let currentDir = path18.resolve(startDir);
8502
+ let currentDir = path19.resolve(startDir);
8368
8503
  while (true) {
8369
- if (fs13.existsSync(path18.join(currentDir, "package.json"))) {
8504
+ if (fs14.existsSync(path19.join(currentDir, "package.json"))) {
8370
8505
  return currentDir;
8371
8506
  }
8372
- const parentDir = path18.dirname(currentDir);
8507
+ const parentDir = path19.dirname(currentDir);
8373
8508
  if (parentDir === currentDir) {
8374
- return path18.resolve(startDir);
8509
+ return path19.resolve(startDir);
8375
8510
  }
8376
8511
  currentDir = parentDir;
8377
8512
  }
8378
8513
  }
8379
8514
  function readProjectPackageJson(projectRoot) {
8380
- const packagePath = path18.join(projectRoot, "package.json");
8381
- if (!fs13.existsSync(packagePath)) {
8515
+ const packagePath = path19.join(projectRoot, "package.json");
8516
+ if (!fs14.existsSync(packagePath)) {
8382
8517
  return {};
8383
8518
  }
8384
- return JSON.parse(fs13.readFileSync(packagePath, "utf8"));
8519
+ return JSON.parse(fs14.readFileSync(packagePath, "utf8"));
8385
8520
  }
8386
8521
  function getDeclaredProviderPackages(projectRoot) {
8387
8522
  const pkg = readProjectPackageJson(projectRoot);
@@ -8398,23 +8533,23 @@ function resolvePackageEntry(packageName, projectRoot) {
8398
8533
  if (!packageDir) {
8399
8534
  return null;
8400
8535
  }
8401
- const packageJsonPath = path18.join(packageDir, "package.json");
8536
+ const packageJsonPath = path19.join(packageDir, "package.json");
8402
8537
  try {
8403
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf8"));
8538
+ const packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
8404
8539
  const exportPath = resolvePackageExportPath(packageJson.exports) || packageJson.main || "index.js";
8405
- return path18.join(packageDir, exportPath);
8540
+ return path19.join(packageDir, exportPath);
8406
8541
  } catch {
8407
8542
  return null;
8408
8543
  }
8409
8544
  }
8410
8545
  function findInstalledPackageDir(packageName, projectRoot) {
8411
- let currentDir = path18.resolve(projectRoot);
8546
+ let currentDir = path19.resolve(projectRoot);
8412
8547
  while (true) {
8413
- const candidate = path18.join(currentDir, "node_modules", ...packageName.split("/"));
8414
- if (fs13.existsSync(candidate)) {
8548
+ const candidate = path19.join(currentDir, "node_modules", ...packageName.split("/"));
8549
+ if (fs14.existsSync(candidate)) {
8415
8550
  return candidate;
8416
8551
  }
8417
- const parentDir = path18.dirname(currentDir);
8552
+ const parentDir = path19.dirname(currentDir);
8418
8553
  if (parentDir === currentDir) {
8419
8554
  return null;
8420
8555
  }
@@ -8446,9 +8581,9 @@ function loadProjectEnv(projectRoot, processEnv = process.env) {
8446
8581
  const result = {};
8447
8582
  const envFiles = [".env", ".env.local", ".dev.vars", ".dev.vars.local"];
8448
8583
  for (const fileName of envFiles) {
8449
- const filePath = path18.join(projectRoot, fileName);
8450
- if (!fs13.existsSync(filePath)) continue;
8451
- Object.assign(result, parseEnvFile(fs13.readFileSync(filePath, "utf8")));
8584
+ const filePath = path19.join(projectRoot, fileName);
8585
+ if (!fs14.existsSync(filePath)) continue;
8586
+ Object.assign(result, parseEnvFile(fs14.readFileSync(filePath, "utf8")));
8452
8587
  }
8453
8588
  for (const [key, value] of Object.entries(processEnv)) {
8454
8589
  if (typeof value === "string") {
@@ -8638,23 +8773,23 @@ async function currentModels(options = {}) {
8638
8773
  process.exit(1);
8639
8774
  }
8640
8775
  }
8641
- var PROJECT_PROVIDERS_DIR = path18.join("agents", "providers");
8776
+ var PROJECT_PROVIDERS_DIR = path19.join("agents", "providers");
8642
8777
  function isLoadedProjectProvider(provider) {
8643
8778
  return !("loadError" in provider);
8644
8779
  }
8645
8780
  function projectProviderPath(projectRoot, provider) {
8646
- return path18.relative(projectRoot, provider.filePath).split(path18.sep).join("/");
8781
+ return path19.relative(projectRoot, provider.filePath).split(path19.sep).join("/");
8647
8782
  }
8648
8783
  function scanProjectProviders(projectRoot) {
8649
- const dir = path18.join(projectRoot, PROJECT_PROVIDERS_DIR);
8650
- if (!fs13.existsSync(dir)) return [];
8784
+ const dir = path19.join(projectRoot, PROJECT_PROVIDERS_DIR);
8785
+ if (!fs14.existsSync(dir)) return [];
8651
8786
  const providers = [];
8652
- for (const entry of fs13.readdirSync(dir, { withFileTypes: true })) {
8787
+ for (const entry of fs14.readdirSync(dir, { withFileTypes: true })) {
8653
8788
  if (!entry.isFile() || !entry.name.endsWith(".ts")) continue;
8654
- const filePath = path18.join(dir, entry.name);
8789
+ const filePath = path19.join(dir, entry.name);
8655
8790
  let content;
8656
8791
  try {
8657
- content = fs13.readFileSync(filePath, "utf8");
8792
+ content = fs14.readFileSync(filePath, "utf8");
8658
8793
  } catch {
8659
8794
  continue;
8660
8795
  }
@@ -8765,7 +8900,7 @@ async function createProjectModuleServer(projectRoot) {
8765
8900
  if (!entryPath) {
8766
8901
  throw new Error(
8767
8902
  [
8768
- `Reading ${PROJECT_PROVIDERS_DIR.split(path18.sep).join("/")}/ needs the project's Vite installation, which was not found from ${projectRoot}.`,
8903
+ `Reading ${PROJECT_PROVIDERS_DIR.split(path19.sep).join("/")}/ needs the project's Vite installation, which was not found from ${projectRoot}.`,
8769
8904
  "Install the project dependencies, then run this command again."
8770
8905
  ].join("\n")
8771
8906
  );
@@ -9078,7 +9213,7 @@ function stringField(value, key) {
9078
9213
  const field2 = Reflect.get(value, key);
9079
9214
  return typeof field2 === "string" && field2 ? field2 : null;
9080
9215
  }
9081
- function describeFailedResponse(method, path26, status2, text2) {
9216
+ function describeFailedResponse(method, path27, status2, text2) {
9082
9217
  let detail = text2.slice(0, 300);
9083
9218
  let code = null;
9084
9219
  let requestId = null;
@@ -9096,7 +9231,7 @@ function describeFailedResponse(method, path26, status2, text2) {
9096
9231
  }
9097
9232
  const context = [code ? `code: ${code}` : null, requestId ? `request ID: ${requestId}` : null].filter(Boolean);
9098
9233
  const suffix = context.length > 0 ? ` (${context.join(", ")})` : "";
9099
- return new DiagRequestError(`${method} ${path26} \u2192 HTTP ${status2}: ${detail}${suffix}`, status2, code, requestId);
9234
+ return new DiagRequestError(`${method} ${path27} \u2192 HTTP ${status2}: ${detail}${suffix}`, status2, code, requestId);
9100
9235
  }
9101
9236
  function diagJsonError(error) {
9102
9237
  const message = error instanceof Error ? error.message : String(error);
@@ -9108,40 +9243,40 @@ function diagJsonError(error) {
9108
9243
  ...error.requestId ? { request_id: error.requestId } : {}
9109
9244
  };
9110
9245
  }
9111
- async function apiGet(config, path26) {
9112
- return apiRequest(config, path26, "GET");
9246
+ async function apiGet(config, path27) {
9247
+ return apiRequest(config, path27, "GET");
9113
9248
  }
9114
- async function apiRequest(config, path26, method, body) {
9249
+ async function apiRequest(config, path27, method, body) {
9115
9250
  const headers = { Accept: "application/json" };
9116
9251
  if (config.token) headers.Authorization = `Bearer ${config.token}`;
9117
9252
  if (body !== void 0) headers["Content-Type"] = "application/json";
9118
9253
  let response;
9119
9254
  try {
9120
- response = await (config.token ? credentialFetch : fetchWithDeadline)(`${config.endpoint}${path26}`, {
9255
+ response = await (config.token ? credentialFetch : fetchWithDeadline)(`${config.endpoint}${path27}`, {
9121
9256
  method,
9122
9257
  headers,
9123
9258
  body: body === void 0 ? void 0 : JSON.stringify(body)
9124
9259
  }, { fetchImpl: config.fetchImpl, next: "Check the instance URL (--endpoint), then run the command again." });
9125
9260
  } catch (error) {
9126
9261
  if (error instanceof RequestTimeoutError) {
9127
- throw new DiagRequestError(`${method} ${path26}: ${error.message.replace("\n", " ")}`, null, "timeout", null);
9262
+ throw new DiagRequestError(`${method} ${path27}: ${error.message.replace("\n", " ")}`, null, "timeout", null);
9128
9263
  }
9129
9264
  if (error instanceof RedirectRefusedError) {
9130
- throw new DiagRequestError(`${method} ${path26}: ${error.message.replace("\n", " ")}`, error.status, "redirect_refused", null);
9265
+ throw new DiagRequestError(`${method} ${path27}: ${error.message.replace("\n", " ")}`, error.status, "redirect_refused", null);
9131
9266
  }
9132
9267
  const cause = error instanceof Error && error.cause instanceof Error ? error.cause.message : null;
9133
9268
  const detail = cause ?? (error instanceof Error ? error.message : String(error));
9134
- throw new DiagRequestError(`${method} ${path26} could not reach ${config.endpoint}: ${detail}`, null, "unreachable", null);
9269
+ throw new DiagRequestError(`${method} ${path27} could not reach ${config.endpoint}: ${detail}`, null, "unreachable", null);
9135
9270
  }
9136
9271
  const text2 = await response.text();
9137
9272
  if (!response.ok) {
9138
- throw describeFailedResponse(method, path26, response.status, text2);
9273
+ throw describeFailedResponse(method, path27, response.status, text2);
9139
9274
  }
9140
9275
  try {
9141
9276
  return JSON.parse(text2);
9142
9277
  } catch {
9143
9278
  throw new Error(
9144
- `${method} ${path26} returned non-JSON (is this a Standard Agents Builder instance URL?): ${text2.slice(0, 120)}`
9279
+ `${method} ${path27} returned non-JSON (is this a Standard Agents Builder instance URL?): ${text2.slice(0, 120)}`
9145
9280
  );
9146
9281
  }
9147
9282
  }
@@ -9257,6 +9392,11 @@ async function diagInstance(options, fetchImpl) {
9257
9392
  console.log(" builder version pre-0.26 (no runtime block in /api/diagnostics)");
9258
9393
  console.log(` config warnings ${data.warnings?.length ?? 0}`);
9259
9394
  }
9395
+ for (const warning of data.warnings ?? []) {
9396
+ if (warning && typeof warning === "object" && "message" in warning && typeof warning.message === "string") {
9397
+ console.log(` warning: ${warning.message}`);
9398
+ }
9399
+ }
9260
9400
  }
9261
9401
  async function diagThreads(options, fetchImpl) {
9262
9402
  const config = resolveDiagConfig(options, process.env, fetchImpl ?? fetch);
@@ -9641,7 +9781,7 @@ function parsePlatformError(body) {
9641
9781
  reason: details ? stringField2(details, "reason") : null
9642
9782
  };
9643
9783
  }
9644
- async function requestLegal(config, path26, init2) {
9784
+ async function requestLegal(config, path27, init2) {
9645
9785
  const fetchImpl = config.fetchImpl ?? fetch;
9646
9786
  const headers = {
9647
9787
  Accept: "application/json",
@@ -9651,7 +9791,7 @@ async function requestLegal(config, path26, init2) {
9651
9791
  if (init2.body !== void 0) headers["Content-Type"] = "application/json";
9652
9792
  let response;
9653
9793
  try {
9654
- response = await platformFetch(config.endpoint, path26, {
9794
+ response = await platformFetch(config.endpoint, path27, {
9655
9795
  method: init2.method,
9656
9796
  headers,
9657
9797
  // The cookie belongs to this endpoint only; never follow it elsewhere.
@@ -10158,7 +10298,7 @@ async function settleStdinForInitHandoff(stdin = process.stdin) {
10158
10298
  }
10159
10299
  }
10160
10300
  var program = new Command();
10161
- program.name("agents").description("CLI tool for Standard Agents Builder").version("0.45.7").exitOverride();
10301
+ program.name("agents").description("CLI tool for Standard Agents Builder").version("0.45.9").exitOverride();
10162
10302
  registerInitCommand(program);
10163
10303
  registerLoginCommands(program);
10164
10304
  addPlatformEndpointOption(
@@ -10183,7 +10323,7 @@ program.command("skill").description("Install the bundled Standard Agents Builde
10183
10323
  program.command("current-models").description("Print the live curated model guide from standardagentspec.org (standardagentspec.com when that request fails)").option("--url <url>", "Request this models markdown URL instead").action(currentModels);
10184
10324
  program.command("available-models").description("List the model IDs of one provider in the current project, using its own key or the project's Standard Agents account key").option("--provider <provider>", "Provider to query: an installed provider package such as openai, or a provider defined in agents/providers/").option("--json", "Print the provider and its models as one JSON document on stdout").action(availableModels);
10185
10325
  registerDiagCommand(program);
10186
- registerTermsCommand(program, "0.45.7");
10326
+ registerTermsCommand(program, "0.45.9");
10187
10327
  async function run() {
10188
10328
  const userArgs = process.argv.slice(2);
10189
10329
  if (userArgs[0] !== "git-credential") {