@general-input/cli 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -4511,36 +4511,36 @@ var require_pbkdf2 = __commonJS({
4511
4511
  require_md();
4512
4512
  require_util();
4513
4513
  var pkcs5 = forge2.pkcs5 = forge2.pkcs5 || {};
4514
- var crypto;
4514
+ var crypto2;
4515
4515
  if (forge2.util.isNodejs && !forge2.options.usePureJavaScript) {
4516
- crypto = __require("crypto");
4516
+ crypto2 = __require("crypto");
4517
4517
  }
4518
4518
  module.exports = forge2.pbkdf2 = pkcs5.pbkdf2 = function(p2, s, c, dkLen, md, callback) {
4519
4519
  if (typeof md === "function") {
4520
4520
  callback = md;
4521
4521
  md = null;
4522
4522
  }
4523
- if (forge2.util.isNodejs && !forge2.options.usePureJavaScript && crypto.pbkdf2 && (md === null || typeof md !== "object") && (crypto.pbkdf2Sync.length > 4 || (!md || md === "sha1"))) {
4523
+ if (forge2.util.isNodejs && !forge2.options.usePureJavaScript && crypto2.pbkdf2 && (md === null || typeof md !== "object") && (crypto2.pbkdf2Sync.length > 4 || (!md || md === "sha1"))) {
4524
4524
  if (typeof md !== "string") {
4525
4525
  md = "sha1";
4526
4526
  }
4527
4527
  p2 = Buffer.from(p2, "binary");
4528
4528
  s = Buffer.from(s, "binary");
4529
4529
  if (!callback) {
4530
- if (crypto.pbkdf2Sync.length === 4) {
4531
- return crypto.pbkdf2Sync(p2, s, c, dkLen).toString("binary");
4530
+ if (crypto2.pbkdf2Sync.length === 4) {
4531
+ return crypto2.pbkdf2Sync(p2, s, c, dkLen).toString("binary");
4532
4532
  }
4533
- return crypto.pbkdf2Sync(p2, s, c, dkLen, md).toString("binary");
4533
+ return crypto2.pbkdf2Sync(p2, s, c, dkLen, md).toString("binary");
4534
4534
  }
4535
- if (crypto.pbkdf2Sync.length === 4) {
4536
- return crypto.pbkdf2(p2, s, c, dkLen, function(err2, key) {
4535
+ if (crypto2.pbkdf2Sync.length === 4) {
4536
+ return crypto2.pbkdf2(p2, s, c, dkLen, function(err2, key) {
4537
4537
  if (err2) {
4538
4538
  return callback(err2);
4539
4539
  }
4540
4540
  callback(null, key.toString("binary"));
4541
4541
  });
4542
4542
  }
4543
- return crypto.pbkdf2(p2, s, c, dkLen, md, function(err2, key) {
4543
+ return crypto2.pbkdf2(p2, s, c, dkLen, md, function(err2, key) {
4544
4544
  if (err2) {
4545
4545
  return callback(err2);
4546
4546
  }
@@ -21001,7 +21001,11 @@ var V1ProjectsApiClient = class {
21001
21001
  this.http.requireAuthed();
21002
21002
  return this.http.fetch(`/v1/projects/${encodeURIComponent(args.projectId)}/files/uploads/${encodeURIComponent(args.uploadId)}`, {
21003
21003
  method: "POST",
21004
- body: { folderPath: args.folderPath, name: args.name },
21004
+ body: {
21005
+ folderPath: args.folderPath,
21006
+ name: args.name,
21007
+ onNameTaken: args.onNameTaken
21008
+ },
21005
21009
  signal: args.signal,
21006
21010
  timeoutMs: FILE_UPLOAD_COMMIT_TIMEOUT_MS
21007
21011
  });
@@ -21147,7 +21151,12 @@ var V1SkillsApiClient = class {
21147
21151
  this.http.requireAuthed();
21148
21152
  return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}`);
21149
21153
  }
21150
- /** Presigned GET for the live bundle (pull). */
21154
+ /** Links to the live files (pull). */
21155
+ async treeUrl(id) {
21156
+ this.http.requireAuthed();
21157
+ return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}/tree-url`);
21158
+ }
21159
+ /** Presigned GET for the live bundle, for a server from before Tree pulls. */
21151
21160
  async bundleUrl(id) {
21152
21161
  this.http.requireAuthed();
21153
21162
  return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}/bundle-url`);
@@ -21226,6 +21235,10 @@ var V1WorkflowsApiClient = class {
21226
21235
  this.http.requireAuthed();
21227
21236
  return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/bundle-url`);
21228
21237
  }
21238
+ async treeUrl(id) {
21239
+ this.http.requireAuthed();
21240
+ return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/tree-url`);
21241
+ }
21229
21242
  async bundleUploadUrl(id) {
21230
21243
  this.http.requireAuthed();
21231
21244
  return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/bundle-upload-url`, { method: "POST" });
@@ -21963,8 +21976,255 @@ function sleep(ms) {
21963
21976
  }
21964
21977
 
21965
21978
  // src/lib/bundleArchive.ts
21966
- import { mkdirSync as mkdirSync2 } from "fs";
21979
+ import { randomUUID } from "crypto";
21980
+ import {
21981
+ lstatSync,
21982
+ mkdirSync as mkdirSync2,
21983
+ readFileSync as readFileSync2,
21984
+ renameSync,
21985
+ rmSync,
21986
+ writeFileSync as writeFileSync2
21987
+ } from "fs";
21988
+ import { dirname, join as join2 } from "path";
21967
21989
  import { Readable } from "stream";
21990
+
21991
+ // ../../packages/bundler/dist/archiveLimits.js
21992
+ var MIB = 1024 * 1024;
21993
+ var UNTRUSTED_ARCHIVE_LIMITS = {
21994
+ maxBytes: 512 * MIB,
21995
+ maxEntries: 5e4
21996
+ };
21997
+ var STORED_ARCHIVE_LIMITS = {
21998
+ maxBytes: 1024 * MIB,
21999
+ maxEntries: 2e5
22000
+ };
22001
+ function isUnsafeArchivePath(path) {
22002
+ if (path.startsWith("/") || path.includes("\\"))
22003
+ return true;
22004
+ return path.split("/").some((segment) => segment === ".." || segment === "." || segment === "");
22005
+ }
22006
+ function leavesItsFolder(path) {
22007
+ if (path.startsWith("/") || path.includes("\\"))
22008
+ return true;
22009
+ return path.split("/").includes("..");
22010
+ }
22011
+ var EXPANSION_BUDGET_BYTES = 1536 * MIB;
22012
+ var EXPANSION_WAIT_MS = 3e4;
22013
+ var ArchiveBusyError = class extends Error {
22014
+ constructor() {
22015
+ super("Too many archives are being unpacked; try again shortly");
22016
+ this.name = "ArchiveBusyError";
22017
+ }
22018
+ };
22019
+ var ExpansionBudget = class {
22020
+ reserved = 0;
22021
+ waiting = [];
22022
+ async reserve(bytes) {
22023
+ if (this.waiting.length > 0 || !this.hasRoom(bytes)) {
22024
+ await this.waitFor(bytes);
22025
+ } else {
22026
+ this.reserved += bytes;
22027
+ }
22028
+ let isReleased = false;
22029
+ return () => {
22030
+ if (isReleased)
22031
+ return;
22032
+ isReleased = true;
22033
+ this.reserved -= bytes;
22034
+ this.admitWaiting();
22035
+ };
22036
+ }
22037
+ hasRoom(bytes) {
22038
+ return this.reserved === 0 || this.reserved + bytes <= EXPANSION_BUDGET_BYTES;
22039
+ }
22040
+ async waitFor(bytes) {
22041
+ await new Promise((resolve32, reject) => {
22042
+ const expansion = {
22043
+ bytes,
22044
+ admit: () => {
22045
+ clearTimeout(timer);
22046
+ resolve32();
22047
+ }
22048
+ };
22049
+ const timer = setTimeout(() => {
22050
+ this.waiting.splice(this.waiting.indexOf(expansion), 1);
22051
+ this.admitWaiting();
22052
+ reject(new ArchiveBusyError());
22053
+ }, EXPANSION_WAIT_MS);
22054
+ this.waiting.push(expansion);
22055
+ });
22056
+ }
22057
+ admitWaiting() {
22058
+ for (; ; ) {
22059
+ const next = this.waiting[0];
22060
+ if (!next || !this.hasRoom(next.bytes))
22061
+ return;
22062
+ this.waiting.shift();
22063
+ this.reserved += next.bytes;
22064
+ next.admit();
22065
+ }
22066
+ }
22067
+ };
22068
+ var archiveExpansionBudget = new ExpansionBudget();
22069
+
22070
+ // ../../packages/bundler/dist/workspaceCas.js
22071
+ import crypto from "crypto";
22072
+ var CAS_PACK_THRESHOLD_BYTES = 1024 * 1024;
22073
+ function hashWorkspaceContent(content) {
22074
+ const buffer = typeof content === "string" ? Buffer.from(content, "utf-8") : content;
22075
+ return crypto.createHash("sha256").update(buffer).digest("hex");
22076
+ }
22077
+
22078
+ // ../../packages/bundler/dist/resourceTree.js
22079
+ var RESOURCE_TREE_FORMAT = "gi-tree/1";
22080
+ var MAX_PACK_BYTES = 32 * 1024 * 1024;
22081
+ var HASH_YIELD_BYTES = 16 * 1024 * 1024;
22082
+ var RANGE_MERGE_GAP_BYTES = 256 * 1024;
22083
+ var SHA256_HEX = /^[0-9a-f]{64}$/;
22084
+ var LINKED_READ_CONCURRENCY = 8;
22085
+ var ResourceTreeFetchError = class extends Error {
22086
+ constructor(status) {
22087
+ super(`Failed to fetch files (${status})`);
22088
+ this.name = "ResourceTreeFetchError";
22089
+ }
22090
+ };
22091
+ var ResourceTreeCorruptError = class extends Error {
22092
+ constructor(message) {
22093
+ super(message);
22094
+ this.name = "ResourceTreeCorruptError";
22095
+ }
22096
+ };
22097
+ function compareCodePoints(a, b) {
22098
+ if (a === b)
22099
+ return 0;
22100
+ return a < b ? -1 : 1;
22101
+ }
22102
+ function packResourceTree(args) {
22103
+ let offset = 0;
22104
+ const chunks = [];
22105
+ const entries = [];
22106
+ for (const path of [...args.files.keys()].sort(compareCodePoints)) {
22107
+ const content = args.files.get(path);
22108
+ if (content === void 0)
22109
+ continue;
22110
+ entries.push({
22111
+ path,
22112
+ hash: hashWorkspaceContent(content),
22113
+ size: content.length,
22114
+ object: args.object,
22115
+ offset
22116
+ });
22117
+ chunks.push(content);
22118
+ offset += content.length;
22119
+ }
22120
+ return {
22121
+ manifest: { format: RESOURCE_TREE_FORMAT, entries },
22122
+ content: Buffer.concat(chunks)
22123
+ };
22124
+ }
22125
+ function serializeResourceTreeManifest(manifest) {
22126
+ return Buffer.from(JSON.stringify(manifest), "utf-8");
22127
+ }
22128
+ function isByteCount(value) {
22129
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
22130
+ }
22131
+ function isTreeEntry(value) {
22132
+ return typeof value === "object" && value !== null && "path" in value && typeof value.path === "string" && value.path.length > 0 && "hash" in value && typeof value.hash === "string" && SHA256_HEX.test(value.hash) && "size" in value && isByteCount(value.size) && "object" in value && typeof value.object === "string" && SHA256_HEX.test(value.object) && "offset" in value && isByteCount(value.offset);
22133
+ }
22134
+ function parseResourceTreeManifest(serialized) {
22135
+ const parsed = JSON.parse(serialized.toString("utf-8"));
22136
+ if (typeof parsed !== "object" || parsed === null || !("format" in parsed) || parsed.format !== RESOURCE_TREE_FORMAT || !("entries" in parsed) || !Array.isArray(parsed.entries)) {
22137
+ throw new ResourceTreeCorruptError("Not a resource tree manifest");
22138
+ }
22139
+ const entries = [];
22140
+ for (const entry of parsed.entries) {
22141
+ if (!isTreeEntry(entry)) {
22142
+ throw new ResourceTreeCorruptError("Resource tree entry is malformed");
22143
+ }
22144
+ entries.push(entry);
22145
+ }
22146
+ return { format: RESOURCE_TREE_FORMAT, entries };
22147
+ }
22148
+ function planResourceTreeRanges(entries) {
22149
+ const byObject = /* @__PURE__ */ new Map();
22150
+ for (const entry of entries) {
22151
+ if (entry.size === 0)
22152
+ continue;
22153
+ const inObject = byObject.get(entry.object);
22154
+ if (inObject)
22155
+ inObject.push(entry);
22156
+ else
22157
+ byObject.set(entry.object, [entry]);
22158
+ }
22159
+ const ranges = [];
22160
+ for (const [object, inObject] of byObject) {
22161
+ inObject.sort((a, b) => a.offset - b.offset);
22162
+ let current = null;
22163
+ for (const entry of inObject) {
22164
+ const end = current ? current.offset + current.length : 0;
22165
+ if (current && entry.offset - end <= RANGE_MERGE_GAP_BYTES) {
22166
+ current.length = Math.max(current.length, entry.offset + entry.size - current.offset);
22167
+ current.entries.push(entry);
22168
+ continue;
22169
+ }
22170
+ current = {
22171
+ object,
22172
+ offset: entry.offset,
22173
+ length: entry.size,
22174
+ entries: [entry]
22175
+ };
22176
+ ranges.push(current);
22177
+ }
22178
+ }
22179
+ return ranges;
22180
+ }
22181
+ function sliceResourceTreeEntry(args) {
22182
+ const start = args.entry.offset - args.range.offset;
22183
+ const content = args.bytes.subarray(start, start + args.entry.size);
22184
+ if (content.length !== args.entry.size || hashWorkspaceContent(content) !== args.entry.hash) {
22185
+ throw new ResourceTreeCorruptError(`Stored bytes for ${args.entry.path} do not match the manifest`);
22186
+ }
22187
+ return content;
22188
+ }
22189
+ async function fetchLinked(args) {
22190
+ const response = await fetch(args.url, { headers: args.headers });
22191
+ if (!response.ok)
22192
+ throw new ResourceTreeFetchError(response.status);
22193
+ return Buffer.from(await response.arrayBuffer());
22194
+ }
22195
+ async function fetchResourceTree(args) {
22196
+ const manifest = parseResourceTreeManifest(await fetchLinked({ url: args.tree.manifestUrl, headers: {} }));
22197
+ const wanted = manifest.entries.filter((entry) => args.isWanted(entry.path));
22198
+ const files = /* @__PURE__ */ new Map();
22199
+ for (const entry of wanted) {
22200
+ if (leavesItsFolder(entry.path)) {
22201
+ throw new ResourceTreeCorruptError(`Unsafe path: ${entry.path}`);
22202
+ }
22203
+ if (entry.size === 0)
22204
+ files.set(entry.path, Buffer.alloc(0));
22205
+ }
22206
+ const ranges = planResourceTreeRanges(wanted);
22207
+ const readNext = async () => {
22208
+ for (let range = ranges.pop(); range; range = ranges.pop()) {
22209
+ const url = args.tree.objectUrls[range.object];
22210
+ if (!url)
22211
+ throw new ResourceTreeCorruptError(`No link for ${range.object}`);
22212
+ const bytes = await fetchLinked({
22213
+ url,
22214
+ headers: {
22215
+ range: `bytes=${range.offset}-${range.offset + range.length - 1}`
22216
+ }
22217
+ });
22218
+ for (const entry of range.entries) {
22219
+ files.set(entry.path, sliceResourceTreeEntry({ range, bytes, entry }));
22220
+ }
22221
+ }
22222
+ };
22223
+ await Promise.all(Array.from({ length: LINKED_READ_CONCURRENCY }, readNext));
22224
+ return files;
22225
+ }
22226
+
22227
+ // src/lib/bundleArchive.ts
21968
22228
  import { create, extract } from "tar";
21969
22229
 
21970
22230
  // src/lib/resourceFiles.ts
@@ -22091,17 +22351,50 @@ async function extractBundle(dir, buffer) {
22091
22351
  Readable.from(buffer).on("error", reject).pipe(unpack);
22092
22352
  });
22093
22353
  }
22094
- async function uploadResourceBundle(args) {
22095
- const buffer = await packResourceDir(args.dir);
22096
- const response = await fetch(args.uploadUrl, {
22354
+ async function putBytes(args) {
22355
+ const response = await fetch(args.url, {
22097
22356
  method: "PUT",
22098
22357
  headers: { "Content-Type": args.contentType },
22099
- body: new Uint8Array(buffer)
22358
+ body: new Uint8Array(args.body)
22100
22359
  });
22101
22360
  if (!response.ok) {
22102
- throw new Error(`Bundle upload failed (HTTP ${response.status}).`);
22361
+ throw new Error(`Upload failed (HTTP ${response.status}).`);
22103
22362
  }
22104
22363
  }
22364
+ function readResourceFiles(dir) {
22365
+ return new Map(
22366
+ listResourceRelPaths(dir).map((path) => [
22367
+ path,
22368
+ readFileSync2(join2(dir, path))
22369
+ ])
22370
+ );
22371
+ }
22372
+ async function stageResourceDir(args) {
22373
+ const { target, dir } = args;
22374
+ if (!target.tree) {
22375
+ await putBytes({
22376
+ url: target.uploadUrl,
22377
+ body: await packResourceDir(dir),
22378
+ contentType: target.contentType
22379
+ });
22380
+ return target.bundleKey;
22381
+ }
22382
+ const { manifest, content } = packResourceTree({
22383
+ files: readResourceFiles(dir),
22384
+ object: target.tree.object
22385
+ });
22386
+ await putBytes({
22387
+ url: target.tree.packUploadUrl,
22388
+ body: content,
22389
+ contentType: "application/octet-stream"
22390
+ });
22391
+ await putBytes({
22392
+ url: target.tree.manifestUploadUrl,
22393
+ body: serializeResourceTreeManifest(manifest),
22394
+ contentType: "application/json"
22395
+ });
22396
+ return target.tree.bundleKey;
22397
+ }
22105
22398
  async function downloadResourceBundle(args) {
22106
22399
  const response = await fetch(args.downloadUrl);
22107
22400
  if (!response.ok) {
@@ -22111,6 +22404,65 @@ async function downloadResourceBundle(args) {
22111
22404
  await extractBundle(args.dir, buffer);
22112
22405
  return listResourceRelPaths(args.dir).length;
22113
22406
  }
22407
+ function assertNoLinkOnPath(args) {
22408
+ let current = args.dir;
22409
+ for (const segment of args.path.split("/")) {
22410
+ current = join2(current, segment);
22411
+ if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink()) {
22412
+ throw new Error(
22413
+ `Not writing ${args.path}: ${current} is a link. Remove it and pull again.`
22414
+ );
22415
+ }
22416
+ }
22417
+ }
22418
+ function writeResourceFile(args) {
22419
+ assertNoLinkOnPath(args);
22420
+ const target = join2(args.dir, args.path);
22421
+ mkdirSync2(dirname(target), { recursive: true });
22422
+ const existing = lstatSync(target, { throwIfNoEntry: false });
22423
+ const staged = join2(dirname(target), `.gi-${randomUUID()}.tmp`);
22424
+ try {
22425
+ writeFileSync2(staged, args.content, {
22426
+ mode: existing ? existing.mode & 511 : void 0
22427
+ });
22428
+ renameSync(staged, target);
22429
+ } finally {
22430
+ rmSync(staged, { force: true });
22431
+ }
22432
+ }
22433
+ async function downloadResourceTree(args) {
22434
+ const files = await fetchResourceTree({
22435
+ tree: args.tree,
22436
+ isWanted: (path) => !SKIP_DIRS.has(path.split("/")[0] ?? "")
22437
+ });
22438
+ mkdirSync2(args.dir, { recursive: true });
22439
+ for (const [path, content] of files) {
22440
+ writeResourceFile({ dir: args.dir, path, content });
22441
+ }
22442
+ return listResourceRelPaths(args.dir).length;
22443
+ }
22444
+ async function pullResourceDir(args) {
22445
+ try {
22446
+ const pulled2 = await args.treeUrl();
22447
+ return {
22448
+ pulled: pulled2,
22449
+ fileCount: await downloadResourceTree({
22450
+ tree: pulled2.tree,
22451
+ dir: args.dir
22452
+ })
22453
+ };
22454
+ } catch (error) {
22455
+ if (!(error instanceof ApiError) || error.status !== 404) throw error;
22456
+ }
22457
+ const pulled = await args.bundleUrl();
22458
+ return {
22459
+ pulled,
22460
+ fileCount: await downloadResourceBundle({
22461
+ downloadUrl: pulled.downloadUrl,
22462
+ dir: args.dir
22463
+ })
22464
+ };
22465
+ }
22114
22466
 
22115
22467
  // src/services/MemoryService.ts
22116
22468
  var MemoryService = class {
@@ -22220,26 +22572,26 @@ import chalk4 from "chalk";
22220
22572
 
22221
22573
  // src/lib/execEnv.ts
22222
22574
  import { existsSync as existsSync2, statSync as statSync2 } from "fs";
22223
- import { join as join3 } from "path";
22575
+ import { join as join4 } from "path";
22224
22576
  import tls from "tls";
22225
22577
 
22226
22578
  // src/lib/paths.ts
22227
22579
  import { homedir } from "os";
22228
- import { join as join2 } from "path";
22580
+ import { join as join3 } from "path";
22229
22581
  function configDir() {
22230
- return process.env.GENI_CONFIG_DIR ?? join2(homedir(), ".config", "geni");
22582
+ return process.env.GENI_CONFIG_DIR ?? join3(homedir(), ".config", "geni");
22231
22583
  }
22232
22584
  function cacheDir() {
22233
- return process.env.GENI_CACHE_DIR ?? join2(homedir(), ".cache", "geni");
22585
+ return process.env.GENI_CACHE_DIR ?? join3(homedir(), ".cache", "geni");
22234
22586
  }
22235
22587
  function sessionFilePath() {
22236
- return join2(configDir(), "runner-session.json");
22588
+ return join3(configDir(), "runner-session.json");
22237
22589
  }
22238
22590
  function configFilePath() {
22239
- return join2(configDir(), "config.json");
22591
+ return join3(configDir(), "config.json");
22240
22592
  }
22241
22593
  function browserSessionFilePath() {
22242
- return join2(configDir(), "browser-session.json");
22594
+ return join3(configDir(), "browser-session.json");
22243
22595
  }
22244
22596
 
22245
22597
  // src/lib/cache.ts
@@ -22251,11 +22603,11 @@ function ensureCacheDir() {
22251
22603
  }
22252
22604
 
22253
22605
  // src/lib/atomicWrite.ts
22254
- import { writeFileSync as writeFileSync2, renameSync } from "fs";
22606
+ import { writeFileSync as writeFileSync3, renameSync as renameSync2 } from "fs";
22255
22607
  function atomicWriteFileSync(args) {
22256
22608
  const partial = `${args.path}.${process.pid}.tmp`;
22257
- writeFileSync2(partial, args.data, { mode: args.mode });
22258
- renameSync(partial, args.path);
22609
+ writeFileSync3(partial, args.data, { mode: args.mode });
22610
+ renameSync2(partial, args.path);
22259
22611
  }
22260
22612
 
22261
22613
  // src/lib/execEnv.ts
@@ -22300,7 +22652,7 @@ function buildCaTrustEnv() {
22300
22652
  };
22301
22653
  }
22302
22654
  function ensureCaBundleFile() {
22303
- const path = join3(cacheDir(), `ca-certs-${process.version}.pem`);
22655
+ const path = join4(cacheDir(), `ca-certs-${process.version}.pem`);
22304
22656
  try {
22305
22657
  if (existsSync2(path) && statSync2(path).size > 0) return path;
22306
22658
  ensureCacheDir();
@@ -22866,7 +23218,7 @@ var ConfigService = class {
22866
23218
  };
22867
23219
 
22868
23220
  // src/services/WorkflowAuthoringService.ts
22869
- import { readFileSync as readFileSync2 } from "fs";
23221
+ import { readFileSync as readFileSync3 } from "fs";
22870
23222
  import { basename } from "path";
22871
23223
  var WorkflowAuthoringService = class {
22872
23224
  constructor(sessionContext) {
@@ -22881,10 +23233,14 @@ var WorkflowAuthoringService = class {
22881
23233
  name: args.name,
22882
23234
  projectId: args.projectId
22883
23235
  });
22884
- const { downloadUrl, checkoutId } = await client.workflows.bundleUrl(
22885
- detail.id
22886
- );
22887
- const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
23236
+ const {
23237
+ pulled: { checkoutId },
23238
+ fileCount
23239
+ } = await pullResourceDir({
23240
+ dir: args.dir,
23241
+ treeUrl: () => client.workflows.treeUrl(detail.id),
23242
+ bundleUrl: () => client.workflows.bundleUrl(detail.id)
23243
+ });
22888
23244
  writeMarker(args.dir, {
22889
23245
  resourceId: detail.id,
22890
23246
  resourceType: detail.workflowType,
@@ -22907,8 +23263,14 @@ var WorkflowAuthoringService = class {
22907
23263
  /** Download a workflow's live files into `dir` + write its marker. */
22908
23264
  async pull(args) {
22909
23265
  const { client } = await this.sessionContext.requireAuthed();
22910
- const { workflowType, downloadUrl, checkoutId } = await client.workflows.bundleUrl(args.id);
22911
- const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
23266
+ const {
23267
+ pulled: { workflowType, checkoutId },
23268
+ fileCount
23269
+ } = await pullResourceDir({
23270
+ dir: args.dir,
23271
+ treeUrl: () => client.workflows.treeUrl(args.id),
23272
+ bundleUrl: () => client.workflows.bundleUrl(args.id)
23273
+ });
22912
23274
  writeMarker(args.dir, {
22913
23275
  resourceId: args.id,
22914
23276
  resourceType: workflowType,
@@ -22936,16 +23298,13 @@ var WorkflowAuthoringService = class {
22936
23298
  }
22937
23299
  return result;
22938
23300
  }
22939
- /** Tar `dir`, PUT it to a presigned URL, return the staged `bundleKey`. */
23301
+ /** Stage `dir` for validate or publish, returning its `bundleKey`. */
22940
23302
  async uploadBundle(id, dir) {
22941
23303
  const { client } = await this.sessionContext.requireAuthed();
22942
- const { uploadUrl, bundleKey, contentType } = await client.workflows.bundleUploadUrl(id);
22943
- await uploadResourceBundle({ dir, uploadUrl, contentType });
22944
- return bundleKey;
22945
- }
22946
- /** GET a presigned bundle URL, extract it into `dir`, return the file count. */
22947
- async downloadBundleInto(downloadUrl, dir) {
22948
- return downloadResourceBundle({ downloadUrl, dir });
23304
+ return stageResourceDir({
23305
+ dir,
23306
+ target: await client.workflows.bundleUploadUrl(id)
23307
+ });
22949
23308
  }
22950
23309
  async getConfig(id) {
22951
23310
  const { client } = await this.sessionContext.requireAuthed();
@@ -22989,7 +23348,7 @@ var WorkflowAuthoringService = class {
22989
23348
  */
22990
23349
  async stageInput(args) {
22991
23350
  const { client } = await this.sessionContext.requireAuthed();
22992
- const bytes = readFileSync2(args.localPath);
23351
+ const bytes = readFileSync3(args.localPath);
22993
23352
  const filename = basename(args.localPath);
22994
23353
  const mimeType = guessMimeType(args.localPath);
22995
23354
  const { uploadUrl, storageUri } = await client.workflows.inputUploadUrl(
@@ -23106,8 +23465,8 @@ var WorkflowAuthoringService = class {
23106
23465
  };
23107
23466
 
23108
23467
  // src/services/SkillAuthoringService.ts
23109
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "fs";
23110
- import { dirname, relative as relative2, isAbsolute, resolve } from "path";
23468
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
23469
+ import { dirname as dirname2, relative as relative2, isAbsolute, resolve } from "path";
23111
23470
 
23112
23471
  // src/lib/slugifySkillName.ts
23113
23472
  function slugifySkillName(name) {
@@ -23156,10 +23515,13 @@ Write the instructions the loading agent should follow.
23156
23515
  /** Download a skill's live bundle into `dir` + write its marker. */
23157
23516
  async pull(args) {
23158
23517
  const { client } = await this.sessionContext.requireAuthed();
23159
- const { downloadUrl, checkoutId } = await client.skills.bundleUrl(args.id);
23160
- const fileCount = await downloadResourceBundle({
23161
- downloadUrl,
23162
- dir: args.dir
23518
+ const {
23519
+ pulled: { checkoutId },
23520
+ fileCount
23521
+ } = await pullResourceDir({
23522
+ dir: args.dir,
23523
+ treeUrl: () => client.skills.treeUrl(args.id),
23524
+ bundleUrl: () => client.skills.bundleUrl(args.id)
23163
23525
  });
23164
23526
  writeMarker(args.dir, {
23165
23527
  resourceId: args.id,
@@ -23206,9 +23568,10 @@ Write the instructions the loading agent should follow.
23206
23568
  /** Tar `dir`, PUT it to a presigned URL, return the staged `bundleKey`. */
23207
23569
  async uploadBundle(id, dir) {
23208
23570
  const { client } = await this.sessionContext.requireAuthed();
23209
- const { uploadUrl, bundleKey, contentType } = await client.skills.bundleUploadUrl(id);
23210
- await uploadResourceBundle({ dir, uploadUrl, contentType });
23211
- return bundleKey;
23571
+ return stageResourceDir({
23572
+ dir,
23573
+ target: await client.skills.bundleUploadUrl(id)
23574
+ });
23212
23575
  }
23213
23576
  writeFileInto(dir, relPath, content) {
23214
23577
  const base = resolve(dir);
@@ -23219,8 +23582,8 @@ Write the instructions the loading agent should follow.
23219
23582
  `Refusing to write outside the target directory: ${relPath}`
23220
23583
  );
23221
23584
  }
23222
- mkdirSync4(dirname(absolute), { recursive: true });
23223
- writeFileSync3(absolute, content);
23585
+ mkdirSync4(dirname2(absolute), { recursive: true });
23586
+ writeFileSync4(absolute, content);
23224
23587
  }
23225
23588
  };
23226
23589
 
@@ -23651,6 +24014,9 @@ var CrmService = class {
23651
24014
  };
23652
24015
 
23653
24016
  // src/services/ProjectService.ts
24017
+ var PUSHED_FILE_TYPE = "application/octet-stream";
24018
+ var PUSH_TIMEOUT_MS = 30 * 6e4;
24019
+ var PULL_LINK_TIMEOUT_MS = 3e4;
23654
24020
  var ProjectService = class {
23655
24021
  constructor(sessionContext) {
23656
24022
  this.sessionContext = sessionContext;
@@ -23696,17 +24062,60 @@ var ProjectService = class {
23696
24062
  /** Download every specialist file into `dir`; returns how many landed. */
23697
24063
  async pullFiles(args) {
23698
24064
  const { client } = await this.sessionContext.requireAuthed();
23699
- const bundle = await client.projects.downloadFilesBundle(args.id);
23700
- await extractBundle(args.dir, Buffer.from(bundle));
24065
+ const { files } = await client.projects.listFiles(args.id);
24066
+ for (const { path } of files) {
24067
+ const { url } = await client.projects.fileLink({
24068
+ projectId: args.id,
24069
+ path,
24070
+ signal: AbortSignal.timeout(PULL_LINK_TIMEOUT_MS)
24071
+ });
24072
+ const response = await fetch(url);
24073
+ if (!response.ok) {
24074
+ throw new Error(`Download failed (HTTP ${response.status}).`);
24075
+ }
24076
+ if (isUnsafeArchivePath(path)) throw new Error(`Unsafe path: ${path}`);
24077
+ writeResourceFile({
24078
+ dir: args.dir,
24079
+ path,
24080
+ content: Buffer.from(await response.arrayBuffer())
24081
+ });
24082
+ }
23701
24083
  return { fileCount: listResourceRelPaths(args.dir).length };
23702
24084
  }
23703
- /** Upload `dir` into the specialist, adding or replacing the paths it holds. */
24085
+ /**
24086
+ * Upload `dir` into the specialist, adding or replacing the paths it holds. Each
24087
+ * file goes straight to storage, so the server never unpacks anything of ours.
24088
+ */
23704
24089
  async pushFiles(args) {
23705
24090
  const { client } = await this.sessionContext.requireAuthed();
23706
- return client.projects.uploadFilesBundle(
23707
- args.id,
23708
- await packResourceDir(args.dir)
23709
- );
24091
+ const signal = AbortSignal.timeout(PUSH_TIMEOUT_MS);
24092
+ for (const [path, content] of readResourceFiles(args.dir)) {
24093
+ const { uploadId, uploadUrl } = await client.projects.prepareFileUpload({
24094
+ projectId: args.id,
24095
+ mimeType: PUSHED_FILE_TYPE,
24096
+ signal
24097
+ });
24098
+ await putBytes({
24099
+ url: uploadUrl,
24100
+ body: content,
24101
+ contentType: PUSHED_FILE_TYPE
24102
+ });
24103
+ const slash = path.lastIndexOf("/");
24104
+ const committed = await client.projects.commitFileUpload({
24105
+ projectId: args.id,
24106
+ uploadId,
24107
+ folderPath: slash === -1 ? null : path.slice(0, slash),
24108
+ name: path.slice(slash + 1),
24109
+ onNameTaken: "replace",
24110
+ signal
24111
+ });
24112
+ if (committed.path !== path) {
24113
+ throw new Error(
24114
+ `Your server filed ${path} as ${committed.path}. Update the server before pushing with this CLI.`
24115
+ );
24116
+ }
24117
+ }
24118
+ return client.projects.listFiles(args.id);
23710
24119
  }
23711
24120
  async deleteFile(args) {
23712
24121
  const { client } = await this.sessionContext.requireAuthed();
@@ -25552,7 +25961,7 @@ var V1CrmApiClient = class {
25552
25961
  // package.json
25553
25962
  var package_default = {
25554
25963
  name: "@general-input/cli",
25555
- version: "0.21.0",
25964
+ version: "0.22.0",
25556
25965
  type: "module",
25557
25966
  description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
25558
25967
  license: "SEE LICENSE IN LICENSE",
@@ -25603,6 +26012,7 @@ var package_default = {
25603
26012
  devDependencies: {
25604
26013
  "@general-input/core": "workspace:*",
25605
26014
  "@packages/api": "workspace:*",
26015
+ "@packages/bundler": "workspace:*",
25606
26016
  "@packages/crm-api": "workspace:*",
25607
26017
  "@packages/egress-proxy": "workspace:*",
25608
26018
  "@packages/eslint-config": "workspace:*",
@@ -25824,9 +26234,9 @@ function isErrnoCode2(err, expected) {
25824
26234
  }
25825
26235
 
25826
26236
  // src/clients/ConfigStore.ts
25827
- import { readFileSync as readFileSync3 } from "fs";
26237
+ import { readFileSync as readFileSync4 } from "fs";
25828
26238
  import { mkdir as mkdir3, writeFile as writeFile3, unlink as unlink3 } from "fs/promises";
25829
- import { dirname as dirname2 } from "path";
26239
+ import { dirname as dirname3 } from "path";
25830
26240
  var ConfigStore = class {
25831
26241
  constructor(filePath) {
25832
26242
  this.filePath = filePath;
@@ -25840,7 +26250,7 @@ var ConfigStore = class {
25840
26250
  loadSync() {
25841
26251
  let raw;
25842
26252
  try {
25843
- raw = readFileSync3(this.filePath, "utf8");
26253
+ raw = readFileSync4(this.filePath, "utf8");
25844
26254
  } catch {
25845
26255
  return null;
25846
26256
  }
@@ -25858,7 +26268,7 @@ var ConfigStore = class {
25858
26268
  * config is non-secret, unlike the session file.
25859
26269
  */
25860
26270
  async save(config) {
25861
- await mkdir3(dirname2(this.filePath), { recursive: true });
26271
+ await mkdir3(dirname3(this.filePath), { recursive: true });
25862
26272
  await writeFile3(this.filePath, JSON.stringify(config, null, 2) + "\n", {
25863
26273
  mode: 420
25864
26274
  });
@@ -26019,7 +26429,7 @@ function signalNumber(signal) {
26019
26429
  // src/clients/EgressProxyHost.ts
26020
26430
  import { mkdtemp, writeFile as writeFile4, rm } from "fs/promises";
26021
26431
  import { tmpdir } from "os";
26022
- import { join as join5 } from "path";
26432
+ import { join as join6 } from "path";
26023
26433
  import tls4 from "tls";
26024
26434
 
26025
26435
  // ../../packages/egress-proxy/dist/ca.js
@@ -26106,7 +26516,7 @@ function createEgressCa(material) {
26106
26516
  }
26107
26517
 
26108
26518
  // ../../packages/egress-proxy/dist/policyStore.js
26109
- import { readFileSync as readFileSync4, statSync as statSync3 } from "fs";
26519
+ import { readFileSync as readFileSync5, statSync as statSync3 } from "fs";
26110
26520
  var EMPTY_POLICY = {
26111
26521
  unmatched: "allow_log",
26112
26522
  credentials: []
@@ -26139,7 +26549,7 @@ var EgressPolicyStore = class {
26139
26549
  return;
26140
26550
  this.loadedMtimeMs = mtimeMs;
26141
26551
  try {
26142
- const parsed = ExecutionEgressPolicySchema.safeParse(JSON.parse(readFileSync4(this.filePath, "utf-8")));
26552
+ const parsed = ExecutionEgressPolicySchema.safeParse(JSON.parse(readFileSync5(this.filePath, "utf-8")));
26143
26553
  this.policy = parsed.success ? parsed.data : EMPTY_POLICY;
26144
26554
  } catch {
26145
26555
  this.policy = EMPTY_POLICY;
@@ -26242,8 +26652,8 @@ function createEgressProxy(args) {
26242
26652
  }
26243
26653
 
26244
26654
  // src/lib/egressCa.ts
26245
- import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
26246
- import { join as join4 } from "path";
26655
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
26656
+ import { join as join5 } from "path";
26247
26657
  import { z as z40 } from "zod";
26248
26658
  var EGRESS_CA_CACHE_VERSION = 3;
26249
26659
  var EgressCaCacheSchema = z40.object({
@@ -26253,7 +26663,7 @@ var EgressCaCacheSchema = z40.object({
26253
26663
  leafKeyPem: z40.string().min(1)
26254
26664
  });
26255
26665
  function loadOrCreateEgressCa() {
26256
- const path = join4(ensureCacheDir(), "egress-ca.json");
26666
+ const path = join5(ensureCacheDir(), "egress-ca.json");
26257
26667
  const cached = readMaterial(path);
26258
26668
  if (cached !== null) {
26259
26669
  try {
@@ -26276,7 +26686,7 @@ function readMaterial(path) {
26276
26686
  if (!existsSync3(path)) return null;
26277
26687
  try {
26278
26688
  const parsed = EgressCaCacheSchema.safeParse(
26279
- JSON.parse(readFileSync5(path, "utf-8"))
26689
+ JSON.parse(readFileSync6(path, "utf-8"))
26280
26690
  );
26281
26691
  if (!parsed.success) return null;
26282
26692
  const { caKeyPem, caCertPem, leafKeyPem } = parsed.data;
@@ -26289,10 +26699,10 @@ function readMaterial(path) {
26289
26699
  // src/clients/EgressProxyHost.ts
26290
26700
  var EgressProxyHost = class {
26291
26701
  async start(policy) {
26292
- const dir = await mkdtemp(join5(tmpdir(), "gi-egress-"));
26293
- const caFile = join5(dir, "ca.pem");
26294
- const bundleFile = join5(dir, "bundle.pem");
26295
- const policyFile = join5(dir, "policy.json");
26702
+ const dir = await mkdtemp(join6(tmpdir(), "gi-egress-"));
26703
+ const caFile = join6(dir, "ca.pem");
26704
+ const bundleFile = join6(dir, "bundle.pem");
26705
+ const policyFile = join6(dir, "policy.json");
26296
26706
  const ca = loadOrCreateEgressCa();
26297
26707
  await writeFile4(caFile, ca.caCertPem);
26298
26708
  await writeFile4(
@@ -26852,7 +27262,7 @@ function registerWorkspaceCommands(program2) {
26852
27262
  }
26853
27263
 
26854
27264
  // src/commands/exec/bash.ts
26855
- import { readFileSync as readFileSync6 } from "fs";
27265
+ import { readFileSync as readFileSync7 } from "fs";
26856
27266
  function registerExecBash(parent) {
26857
27267
  parent.command("bash").description(
26858
27268
  "Run `bash -lc <cmd>` locally with cloud-resolved credentials injected as env vars. Output is streamed back through a scrubber that replaces every registered secret with [REDACTED:credential_<id>]."
@@ -26952,7 +27362,7 @@ async function resolveCommand(opts, positional) {
26952
27362
  }
26953
27363
  if (opts.file === "-") return readStdin();
26954
27364
  try {
26955
- return readFileSync6(opts.file, "utf-8");
27365
+ return readFileSync7(opts.file, "utf-8");
26956
27366
  } catch (error) {
26957
27367
  const detail = error instanceof Error ? error.message : String(error);
26958
27368
  printError(`Could not read --file ${opts.file}: ${detail}`);
@@ -27870,7 +28280,7 @@ function registerIntegrationCommands(program2) {
27870
28280
  }
27871
28281
 
27872
28282
  // src/commands/customApi/index.ts
27873
- import { readFileSync as readFileSync7 } from "fs";
28283
+ import { readFileSync as readFileSync8 } from "fs";
27874
28284
  import { resolve as resolve2 } from "path";
27875
28285
 
27876
28286
  // src/lib/jsonArg.ts
@@ -28029,7 +28439,7 @@ function parseBody(opts) {
28029
28439
  }
28030
28440
  let contents;
28031
28441
  try {
28032
- contents = readFileSync7(resolve2(file), "utf8");
28442
+ contents = readFileSync8(resolve2(file), "utf8");
28033
28443
  } catch (error) {
28034
28444
  const message = error instanceof Error ? error.message : String(error);
28035
28445
  printError(`Could not read JSON file: ${message}`);
@@ -29362,16 +29772,16 @@ function registerWorkflowExecutions(parent) {
29362
29772
  import { resolve as resolve21 } from "path";
29363
29773
 
29364
29774
  // src/lib/executionTrace.ts
29365
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4 } from "fs";
29366
- import { join as join6, resolve as resolve20 } from "path";
29775
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
29776
+ import { join as join7, resolve as resolve20 } from "path";
29367
29777
  function writeExecutionTraceBundle(args) {
29368
29778
  const { baseDir, trace } = args;
29369
29779
  const dir = resolve20(baseDir, trace.id);
29370
29780
  mkdirSync5(dir, { recursive: true });
29371
29781
  const files = [];
29372
29782
  const write = (name, content) => {
29373
- const path = join6(dir, name);
29374
- writeFileSync4(path, content);
29783
+ const path = join7(dir, name);
29784
+ writeFileSync5(path, content);
29375
29785
  files.push(path);
29376
29786
  };
29377
29787
  if (trace.run !== null && trace.run !== void 0) {
@@ -29501,8 +29911,8 @@ function registerWorkflowCommands(program2) {
29501
29911
  }
29502
29912
 
29503
29913
  // src/commands/app/screenshots.ts
29504
- import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync5 } from "fs";
29505
- import { resolve as resolve22, join as join7 } from "path";
29914
+ import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6 } from "fs";
29915
+ import { resolve as resolve22, join as join8 } from "path";
29506
29916
  function registerAppScreenshots(parent) {
29507
29917
  parent.command("screenshots [id]").alias("screenshot").description(
29508
29918
  "Capture authenticated pages of the published app at mobile/desktop widths. Page loads run live handlers."
@@ -29548,8 +29958,8 @@ function registerAppScreenshots(parent) {
29548
29958
  const dir = resolve22(options.out ?? "app-screenshots");
29549
29959
  mkdirSync6(dir, { recursive: true });
29550
29960
  const shots = result.shots.map(({ pngBase64, ...shot }, index) => {
29551
- const path = join7(dir, `${index + 1}-${shot.width}px.png`);
29552
- writeFileSync5(path, Buffer.from(pngBase64, "base64"));
29961
+ const path = join8(dir, `${index + 1}-${shot.width}px.png`);
29962
+ writeFileSync6(path, Buffer.from(pngBase64, "base64"));
29553
29963
  return { ...shot, path };
29554
29964
  });
29555
29965
  printJson({ status: "captured", shots });
@@ -30034,14 +30444,14 @@ logout (or use \`geni login --server <url>\`) to switch in one step.
30034
30444
 
30035
30445
  // src/lib/skills.ts
30036
30446
  import { homedir as homedir2 } from "os";
30037
- import { join as join8 } from "path";
30447
+ import { join as join9 } from "path";
30038
30448
  import {
30039
30449
  mkdirSync as mkdirSync7,
30040
- writeFileSync as writeFileSync6,
30450
+ writeFileSync as writeFileSync7,
30041
30451
  existsSync as existsSync5,
30042
- readFileSync as readFileSync8,
30452
+ readFileSync as readFileSync9,
30043
30453
  unlinkSync,
30044
- rmSync
30454
+ rmSync as rmSync2
30045
30455
  } from "fs";
30046
30456
 
30047
30457
  // src/skills/geni.md
@@ -30058,23 +30468,23 @@ var SKILLS = [
30058
30468
  { name: GENI_CRM_SKILL_NAME, md: geni_crm_default }
30059
30469
  ];
30060
30470
  var home = homedir2();
30061
- var claudeSkillsDir = join8(home, ".claude", "skills");
30062
- var agentSkillsDir = join8(home, ".agents", "skills");
30471
+ var claudeSkillsDir = join9(home, ".claude", "skills");
30472
+ var agentSkillsDir = join9(home, ".agents", "skills");
30063
30473
  var TARGETS = [
30064
30474
  {
30065
30475
  name: "Claude Code",
30066
- detect: () => existsSync5(join8(home, ".claude")),
30476
+ detect: () => existsSync5(join9(home, ".claude")),
30067
30477
  skillsBaseDir: claudeSkillsDir,
30068
30478
  // Earlier versions wrote a loose `~/.claude/skills/<skill>.md`, which
30069
30479
  // Claude Code silently ignores. Clean it up so upgraders aren't left
30070
30480
  // with a stale sibling that confuses `doctor`.
30071
- legacyPaths: (skillName) => [join8(claudeSkillsDir, `${skillName}.md`)]
30481
+ legacyPaths: (skillName) => [join9(claudeSkillsDir, `${skillName}.md`)]
30072
30482
  },
30073
30483
  {
30074
30484
  name: "Codex CLI / Gemini CLI / VS Code Copilot",
30075
30485
  // Detection: any supporting agent has touched disk, or the shared
30076
30486
  // `~/.agents/` dir already exists (likely written by another installer).
30077
- detect: () => existsSync5(join8(home, ".codex")) || existsSync5(join8(home, ".gemini")) || existsSync5(join8(home, ".agents")),
30487
+ detect: () => existsSync5(join9(home, ".codex")) || existsSync5(join9(home, ".gemini")) || existsSync5(join9(home, ".agents")),
30078
30488
  skillsBaseDir: agentSkillsDir,
30079
30489
  legacyPaths: () => []
30080
30490
  }
@@ -30087,7 +30497,7 @@ function detectSkillTargets() {
30087
30497
  out.push({
30088
30498
  name: target.name,
30089
30499
  skill: skill.name,
30090
- path: join8(target.skillsBaseDir, skill.name, "SKILL.md"),
30500
+ path: join9(target.skillsBaseDir, skill.name, "SKILL.md"),
30091
30501
  expectedMd: skill.md
30092
30502
  });
30093
30503
  }
@@ -30099,13 +30509,13 @@ function installSkills() {
30099
30509
  for (const target of TARGETS) {
30100
30510
  if (!target.detect()) continue;
30101
30511
  for (const skill of SKILLS) {
30102
- const dir = join8(target.skillsBaseDir, skill.name);
30103
- const path = join8(dir, "SKILL.md");
30512
+ const dir = join9(target.skillsBaseDir, skill.name);
30513
+ const path = join9(dir, "SKILL.md");
30104
30514
  try {
30105
30515
  mkdirSync7(dir, { recursive: true });
30106
- const previous = existsSync5(path) ? readFileSync8(path, "utf-8") : null;
30516
+ const previous = existsSync5(path) ? readFileSync9(path, "utf-8") : null;
30107
30517
  const changed = previous !== skill.md;
30108
- writeFileSync6(path, skill.md);
30518
+ writeFileSync7(path, skill.md);
30109
30519
  for (const legacy of target.legacyPaths(skill.name)) {
30110
30520
  if (existsSync5(legacy)) unlinkSync(legacy);
30111
30521
  }
@@ -30133,8 +30543,8 @@ function uninstallSkills() {
30133
30543
  for (const target of TARGETS) {
30134
30544
  if (!target.detect()) continue;
30135
30545
  for (const skill of SKILLS) {
30136
- const dir = join8(target.skillsBaseDir, skill.name);
30137
- const path = join8(dir, "SKILL.md");
30546
+ const dir = join9(target.skillsBaseDir, skill.name);
30547
+ const path = join9(dir, "SKILL.md");
30138
30548
  const legacies = target.legacyPaths(skill.name).filter((p2) => existsSync5(p2));
30139
30549
  if (!existsSync5(dir) && legacies.length === 0) {
30140
30550
  results.push({
@@ -30146,7 +30556,7 @@ function uninstallSkills() {
30146
30556
  continue;
30147
30557
  }
30148
30558
  try {
30149
- rmSync(dir, { recursive: true, force: true });
30559
+ rmSync2(dir, { recursive: true, force: true });
30150
30560
  for (const legacy of legacies) unlinkSync(legacy);
30151
30561
  results.push({
30152
30562
  name: target.name,
@@ -30230,7 +30640,7 @@ function registerSkillsUninstall(parent) {
30230
30640
  }
30231
30641
 
30232
30642
  // src/commands/skills/load.ts
30233
- import { resolve as resolve29, join as join9 } from "path";
30643
+ import { resolve as resolve29, join as join10 } from "path";
30234
30644
  function registerSkillsLoad(parent) {
30235
30645
  parent.command("load <name>").description(
30236
30646
  "Download a platform skill (SKILL.md + references/) into a local directory. Load the matching authoring skill (code-workflow, agent-workflow, app, skill-authoring, custom-api) before building."
@@ -30238,13 +30648,13 @@ function registerSkillsLoad(parent) {
30238
30648
  "--dir <path>",
30239
30649
  "Destination directory. Defaults to ./geni-skills/<name>."
30240
30650
  ).action(async (name, opts) => {
30241
- const dir = resolve29(opts.dir ?? join9("geni-skills", name));
30651
+ const dir = resolve29(opts.dir ?? join10("geni-skills", name));
30242
30652
  try {
30243
30653
  const { fileCount, description } = await skillAuthoringService.loadPlatformSkill({ name, dir });
30244
30654
  printSuccess(`Loaded ${name} (${fileCount} file(s)) into ${dir}`);
30245
30655
  printInfo(description);
30246
30656
  printInfo(
30247
- `Start with ${join9(dir, "SKILL.md")}; the spec and worked example (when the skill ships them) are under ${join9(dir, "references")}/.`
30657
+ `Start with ${join10(dir, "SKILL.md")}; the spec and worked example (when the skill ships them) are under ${join10(dir, "references")}/.`
30248
30658
  );
30249
30659
  } catch (error) {
30250
30660
  exitOnApiError(error, {
@@ -33111,7 +33521,7 @@ function registerSpecialistCommands(program2) {
33111
33521
  import chalk9 from "chalk";
33112
33522
 
33113
33523
  // src/lib/preflight.ts
33114
- import { delimiter, join as join10 } from "path";
33524
+ import { delimiter, join as join11 } from "path";
33115
33525
  import { accessSync, constants } from "fs";
33116
33526
  var REQUIRED_RUNTIME_DEPS = ["bash", "curl", "jq"];
33117
33527
  function findOnPath(name) {
@@ -33119,7 +33529,7 @@ function findOnPath(name) {
33119
33529
  if (!path) return null;
33120
33530
  for (const dir of path.split(delimiter)) {
33121
33531
  if (dir.length === 0) continue;
33122
- const candidate = join10(dir, name);
33532
+ const candidate = join11(dir, name);
33123
33533
  try {
33124
33534
  accessSync(candidate, constants.X_OK);
33125
33535
  return candidate;
@@ -33158,7 +33568,7 @@ function installHint(deps) {
33158
33568
  }
33159
33569
 
33160
33570
  // src/commands/doctor.ts
33161
- import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
33571
+ import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
33162
33572
  function registerDoctorCommand(program2) {
33163
33573
  program2.command("doctor").description(
33164
33574
  "Diagnose your geni setup: required system tools, active session, network reach to the cloud, and skill installation across detected AI agents. Prints a checklist with \u2713/\u2717 for each."
@@ -33269,7 +33679,7 @@ function skillsCheck() {
33269
33679
  });
33270
33680
  continue;
33271
33681
  }
33272
- const onDisk = readFileSync9(target.path, "utf-8");
33682
+ const onDisk = readFileSync10(target.path, "utf-8");
33273
33683
  if (onDisk === target.expectedMd) {
33274
33684
  out.push({
33275
33685
  label: `${target.name}: ${target.skill} skill installed`,