@cubis/foundry 0.3.55 → 0.3.57

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.
@@ -1,19 +1,19 @@
1
1
  export function renderInitWelcome({ version }) {
2
2
  const safeVersion = String(version || "").trim() || "dev";
3
3
  const lines = [
4
- "╔══════════════════════════════════════════════════════════════╗",
5
- "Cubis Foundry CLI",
6
- "Interactive Init",
7
- "╚══════════════════════════════════════════════════════════════╝",
4
+ "┌────────────────────────────────────────────────────────────┐",
5
+ "Cubis Foundry CLI",
6
+ "Interactive Init Wizard │",
7
+ `│ Version ${safeVersion.padEnd(50, " ")}│`,
8
+ "└────────────────────────────────────────────────────────────┘",
8
9
  "",
9
- " ██████╗",
10
- " ██╔════╝",
11
- " ██║ Cubis Foundry",
12
- " ██║ C icon",
13
- " ╚██████╗",
14
- " ╚═════╝",
15
- "",
16
- `CLI Version ${safeVersion}`,
10
+ " ██████╗██╗ ██╗██████╗ ██╗███████╗",
11
+ " ██╔════╝██║ ██║██╔══██╗██║██╔════╝",
12
+ " ██║ ██║ ██║██████╔╝██║███████╗",
13
+ " ██║ ██║ ██║██╔══██╗██║╚════██║",
14
+ " ╚██████╗╚██████╔╝██████╔╝██║███████║",
15
+ " ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝╚══════╝",
16
+ " F O U N D R Y",
17
17
  "",
18
18
  ];
19
19
  return lines.join("\n");
@@ -1 +1 @@
1
- {"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/cli/init/banner.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAuB;IAChE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC;IAC1D,MAAM,KAAK,GAAG;QACZ,kEAAkE;QAClE,gEAAgE;QAChE,gEAAgE;QAChE,kEAAkE;QAClE,EAAE;QACF,eAAe;QACf,eAAe;QACf,6BAA6B;QAC7B,sBAAsB;QACtB,eAAe;QACf,eAAe;QACf,EAAE;QACF,eAAe,WAAW,EAAE;QAC5B,EAAE;KACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/cli/init/banner.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAuB;IAChE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC;IAC1D,MAAM,KAAK,GAAG;QACZ,gEAAgE;QAChE,+DAA+D;QAC/D,+DAA+D;QAC/D,aAAa,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG;QAC3C,gEAAgE;QAChE,EAAE;QACF,uCAAuC;QACvC,uCAAuC;QACvC,uCAAuC;QACvC,uCAAuC;QACvC,uCAAuC;QACvC,uCAAuC;QACvC,gCAAgC;QAChC,EAAE;KACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubis/foundry",
3
- "version": "0.3.55",
3
+ "version": "0.3.57",
4
4
  "description": "Cubis Foundry CLI for workflow-first AI agent environments",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/core.ts CHANGED
@@ -2622,6 +2622,44 @@ async function resolveProfilePaths(profileId, scope, cwd = process.cwd()) {
2622
2622
  };
2623
2623
  }
2624
2624
 
2625
+ function expandUniquePaths(pathList, cwd = process.cwd()) {
2626
+ const seen = new Set();
2627
+ const output = [];
2628
+ for (const value of pathList || []) {
2629
+ const normalized = String(value || "").trim();
2630
+ if (!normalized) continue;
2631
+ const expanded = expandPath(normalized, cwd);
2632
+ const key = path.resolve(expanded);
2633
+ if (seen.has(key)) continue;
2634
+ seen.add(key);
2635
+ output.push(expanded);
2636
+ }
2637
+ return output;
2638
+ }
2639
+
2640
+ function resolveProfilePathCandidates(profileId, scope, cwd = process.cwd()) {
2641
+ const profile = WORKFLOW_PROFILES[profileId];
2642
+ if (!profile) throw new Error(`Unknown platform '${profileId}'.`);
2643
+ const cfg = profile[scope];
2644
+ return {
2645
+ workflowsDirs: expandUniquePaths(cfg.workflowDirs, cwd),
2646
+ agentsDirs: expandUniquePaths(cfg.agentDirs, cwd),
2647
+ skillsDirs: expandUniquePaths(cfg.skillDirs, cwd),
2648
+ commandsDirs: expandUniquePaths(cfg.commandDirs, cwd),
2649
+ promptsDirs: expandUniquePaths(cfg.promptDirs, cwd),
2650
+ ruleFilesByPriority: expandUniquePaths(cfg.ruleFilesByPriority, cwd),
2651
+ };
2652
+ }
2653
+
2654
+ function resolveLegacySkillDirsForCleanup(platform, scope, cwd = process.cwd()) {
2655
+ if (platform !== "codex") return [];
2656
+ if (scope === "global") {
2657
+ return [path.join(os.homedir(), ".codex", "skills")];
2658
+ }
2659
+ const workspaceRoot = findWorkspaceRoot(cwd);
2660
+ return [path.join(workspaceRoot, ".codex", "skills")];
2661
+ }
2662
+
2625
2663
  async function resolveArtifactProfilePaths(
2626
2664
  profileId,
2627
2665
  scope,
@@ -8104,6 +8142,41 @@ async function removePathRecord({
8104
8142
  }
8105
8143
  }
8106
8144
 
8145
+ async function removeEmptyDirectoryRecord({
8146
+ dirPath,
8147
+ category,
8148
+ dryRun = false,
8149
+ records,
8150
+ }) {
8151
+ if (!dirPath) return;
8152
+ if (!(await pathExists(dirPath))) return;
8153
+
8154
+ let entries = [];
8155
+ try {
8156
+ entries = await readdir(dirPath);
8157
+ } catch {
8158
+ return;
8159
+ }
8160
+
8161
+ if (entries.length > 0) return;
8162
+
8163
+ if (dryRun) {
8164
+ records.push({
8165
+ path: dirPath,
8166
+ category,
8167
+ action: "would-remove",
8168
+ });
8169
+ return;
8170
+ }
8171
+
8172
+ await rm(dirPath, { recursive: true, force: true });
8173
+ records.push({
8174
+ path: dirPath,
8175
+ category,
8176
+ action: "removed",
8177
+ });
8178
+ }
8179
+
8107
8180
  async function removeMcpRuntimeEntriesJson({
8108
8181
  filePath,
8109
8182
  keyName,
@@ -8272,6 +8345,8 @@ async function runWorkflowRemoveAll(options) {
8272
8345
  const scopes = resolveRemoveAllScopes(opts.scope);
8273
8346
  const platforms = resolveRemoveAllPlatforms(opts.platform);
8274
8347
  const bundleIds = await listBundleIds();
8348
+ const knownTopLevelSkillIds =
8349
+ await listTopLevelSkillIdsFromRoot(workflowSkillsRoot());
8275
8350
 
8276
8351
  if (!dryRun && !opts.yes && process.stdin.isTTY) {
8277
8352
  const proceed = await confirm({
@@ -8291,11 +8366,45 @@ async function runWorkflowRemoveAll(options) {
8291
8366
 
8292
8367
  for (const scope of scopes) {
8293
8368
  for (const platform of platforms) {
8294
- const artifactProfilePaths = await resolveArtifactProfilePaths(
8369
+ const artifactProfilePaths = await resolveProfilePaths(
8295
8370
  platform,
8296
8371
  scope,
8297
8372
  cwd,
8298
8373
  );
8374
+ const profileCandidates = resolveProfilePathCandidates(
8375
+ platform,
8376
+ scope,
8377
+ cwd,
8378
+ );
8379
+ const legacySkillDirs = resolveLegacySkillDirsForCleanup(
8380
+ platform,
8381
+ scope,
8382
+ cwd,
8383
+ );
8384
+ const allSkillDirs = expandUniquePaths(
8385
+ [...profileCandidates.skillsDirs, ...legacySkillDirs],
8386
+ cwd,
8387
+ );
8388
+ const isPrimaryDir = (candidateDir, primaryDir) => {
8389
+ if (!candidateDir || !primaryDir) return false;
8390
+ return path.resolve(candidateDir) === path.resolve(primaryDir);
8391
+ };
8392
+ const alternateWorkflowsDirs = profileCandidates.workflowsDirs.filter(
8393
+ (dirPath) => !isPrimaryDir(dirPath, artifactProfilePaths.workflowsDir),
8394
+ );
8395
+ const alternateAgentsDirs = profileCandidates.agentsDirs.filter(
8396
+ (dirPath) => !isPrimaryDir(dirPath, artifactProfilePaths.agentsDir),
8397
+ );
8398
+ const alternateCommandsDirs = profileCandidates.commandsDirs.filter(
8399
+ (dirPath) => !isPrimaryDir(dirPath, artifactProfilePaths.commandsDir),
8400
+ );
8401
+ const alternatePromptsDirs = profileCandidates.promptsDirs.filter(
8402
+ (dirPath) => !isPrimaryDir(dirPath, artifactProfilePaths.promptsDir),
8403
+ );
8404
+ const alternateSkillsDirs = allSkillDirs.filter(
8405
+ (dirPath) => !isPrimaryDir(dirPath, artifactProfilePaths.skillsDir),
8406
+ );
8407
+
8299
8408
  for (const bundleId of bundleIds) {
8300
8409
  const manifest = await readBundleManifest(bundleId);
8301
8410
  const removedBundle = await removeBundleArtifacts({
@@ -8314,20 +8423,103 @@ async function runWorkflowRemoveAll(options) {
8314
8423
  action: dryRun ? "would-remove" : "removed",
8315
8424
  });
8316
8425
  }
8317
- }
8318
8426
 
8319
- const extraSkillPaths = [
8320
- path.join(artifactProfilePaths.skillsDir || "", POSTMAN_SKILL_ID),
8321
- path.join(artifactProfilePaths.skillsDir || "", STITCH_SKILL_ID),
8322
- path.join(artifactProfilePaths.skillsDir || "", "skills_index.json"),
8323
- ];
8324
- for (const extraPath of extraSkillPaths) {
8325
- await removePathRecord({
8326
- targetPath: extraPath,
8327
- category: `${platform}/${scope}/extra-skill`,
8328
- dryRun,
8329
- records: removedRecords,
8427
+ const platformSpec = manifest.platforms?.[platform];
8428
+ if (!platformSpec) continue;
8429
+
8430
+ const workflowFiles = (platformSpec.workflows || []).map((entry) =>
8431
+ path.basename(entry),
8432
+ );
8433
+ const agentFiles = (platformSpec.agents || []).map((entry) =>
8434
+ path.basename(entry),
8435
+ );
8436
+ const commandFiles = (platformSpec.commands || []).map((entry) =>
8437
+ path.basename(entry),
8438
+ );
8439
+ const promptFiles = (platformSpec.prompts || []).map((entry) =>
8440
+ path.basename(entry),
8441
+ );
8442
+ const skillIds = await resolveInstallSkillIds({
8443
+ platformSpec,
8444
+ extraSkillIds: [],
8330
8445
  });
8446
+ const wrapperSkillIds =
8447
+ platform === "codex" ? buildCodexWrapperSkillIds(platformSpec) : [];
8448
+ const bundleSkillIds = [...new Set([...skillIds, ...wrapperSkillIds])];
8449
+
8450
+ for (const workflowsDir of alternateWorkflowsDirs) {
8451
+ for (const workflowFile of workflowFiles) {
8452
+ await removePathRecord({
8453
+ targetPath: path.join(workflowsDir, workflowFile),
8454
+ category: `${platform}/${scope}/bundle-alt`,
8455
+ dryRun,
8456
+ records: removedRecords,
8457
+ });
8458
+ }
8459
+ }
8460
+ for (const agentsDir of alternateAgentsDirs) {
8461
+ for (const agentFile of agentFiles) {
8462
+ await removePathRecord({
8463
+ targetPath: path.join(agentsDir, agentFile),
8464
+ category: `${platform}/${scope}/bundle-alt`,
8465
+ dryRun,
8466
+ records: removedRecords,
8467
+ });
8468
+ }
8469
+ }
8470
+ for (const commandsDir of alternateCommandsDirs) {
8471
+ for (const commandFile of commandFiles) {
8472
+ await removePathRecord({
8473
+ targetPath: path.join(commandsDir, commandFile),
8474
+ category: `${platform}/${scope}/bundle-alt`,
8475
+ dryRun,
8476
+ records: removedRecords,
8477
+ });
8478
+ }
8479
+ }
8480
+ for (const promptsDir of alternatePromptsDirs) {
8481
+ for (const promptFile of promptFiles) {
8482
+ await removePathRecord({
8483
+ targetPath: path.join(promptsDir, promptFile),
8484
+ category: `${platform}/${scope}/bundle-alt`,
8485
+ dryRun,
8486
+ records: removedRecords,
8487
+ });
8488
+ }
8489
+ }
8490
+ for (const skillsDir of alternateSkillsDirs) {
8491
+ for (const skillId of bundleSkillIds) {
8492
+ await removePathRecord({
8493
+ targetPath: path.join(skillsDir, skillId),
8494
+ category: `${platform}/${scope}/bundle-alt`,
8495
+ dryRun,
8496
+ records: removedRecords,
8497
+ });
8498
+ }
8499
+ }
8500
+ }
8501
+
8502
+ for (const skillsDir of allSkillDirs) {
8503
+ for (const entry of [
8504
+ POSTMAN_SKILL_ID,
8505
+ STITCH_SKILL_ID,
8506
+ "skills_index.json",
8507
+ ]) {
8508
+ await removePathRecord({
8509
+ targetPath: path.join(skillsDir, entry),
8510
+ category: `${platform}/${scope}/extra-skill`,
8511
+ dryRun,
8512
+ records: removedRecords,
8513
+ });
8514
+ }
8515
+ for (const skillId of knownTopLevelSkillIds) {
8516
+ await removePathRecord({
8517
+ targetPath: path.join(skillsDir, skillId),
8518
+ category: `${platform}/${scope}/known-skill`,
8519
+ dryRun,
8520
+ records: removedRecords,
8521
+ });
8522
+ }
8331
8523
  }
8332
8524
 
8333
8525
  if (platform === "antigravity") {
@@ -8379,6 +8571,25 @@ async function runWorkflowRemoveAll(options) {
8379
8571
  }
8380
8572
  }
8381
8573
 
8574
+ for (const managedDir of expandUniquePaths(
8575
+ [
8576
+ ...profileCandidates.skillsDirs,
8577
+ ...profileCandidates.agentsDirs,
8578
+ ...profileCandidates.workflowsDirs,
8579
+ ...profileCandidates.commandsDirs,
8580
+ ...profileCandidates.promptsDirs,
8581
+ ...legacySkillDirs,
8582
+ ],
8583
+ cwd,
8584
+ )) {
8585
+ await removeEmptyDirectoryRecord({
8586
+ dirPath: managedDir,
8587
+ category: `${platform}/${scope}/managed-dir-empty`,
8588
+ dryRun,
8589
+ records: removedRecords,
8590
+ });
8591
+ }
8592
+
8382
8593
  const scopedProfilePaths = await resolveProfilePaths(platform, scope, cwd);
8383
8594
  const ruleCandidates = [...scopedProfilePaths.ruleFilesByPriority];
8384
8595
  if (scope === "global") {
@@ -8445,7 +8656,7 @@ async function runWorkflowRemoveAll(options) {
8445
8656
  dryRun,
8446
8657
  records: removedRecords,
8447
8658
  });
8448
- } else if (includeCredentials) {
8659
+ } else if (scope === "global" || includeCredentials) {
8449
8660
  await removePathRecord({
8450
8661
  targetPath: resolveManagedCredentialsEnvPath(),
8451
8662
  category: "global/credentials",
@@ -8453,6 +8664,20 @@ async function runWorkflowRemoveAll(options) {
8453
8664
  records: removedRecords,
8454
8665
  });
8455
8666
  }
8667
+
8668
+ if (scope === "global") {
8669
+ for (const globalRootDir of [
8670
+ path.join(os.homedir(), ".cbx"),
8671
+ path.join(os.homedir(), ".agents"),
8672
+ ]) {
8673
+ await removeEmptyDirectoryRecord({
8674
+ dirPath: globalRootDir,
8675
+ category: "global/root-dir-empty",
8676
+ dryRun,
8677
+ records: removedRecords,
8678
+ });
8679
+ }
8680
+ }
8456
8681
  }
8457
8682
 
8458
8683
  if (await checkDockerAvailable({ cwd })) {
@@ -1,19 +1,19 @@
1
1
  export function renderInitWelcome({ version }: { version: string }) {
2
2
  const safeVersion = String(version || "").trim() || "dev";
3
3
  const lines = [
4
- "╔══════════════════════════════════════════════════════════════╗",
5
- "Cubis Foundry CLI",
6
- "Interactive Init",
7
- "╚══════════════════════════════════════════════════════════════╝",
4
+ "┌────────────────────────────────────────────────────────────┐",
5
+ "Cubis Foundry CLI",
6
+ "Interactive Init Wizard │",
7
+ `│ Version ${safeVersion.padEnd(50, " ")}│`,
8
+ "└────────────────────────────────────────────────────────────┘",
8
9
  "",
9
- " ██████╗",
10
- " ██╔════╝",
11
- " ██║ Cubis Foundry",
12
- " ██║ C icon",
13
- " ╚██████╗",
14
- " ╚═════╝",
15
- "",
16
- `CLI Version ${safeVersion}`,
10
+ " ██████╗██╗ ██╗██████╗ ██╗███████╗",
11
+ " ██╔════╝██║ ██║██╔══██╗██║██╔════╝",
12
+ " ██║ ██║ ██║██████╔╝██║███████╗",
13
+ " ██║ ██║ ██║██╔══██╗██║╚════██║",
14
+ " ╚██████╗╚██████╔╝██████╔╝██║███████║",
15
+ " ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝╚══════╝",
16
+ " F O U N D R Y",
17
17
  "",
18
18
  ];
19
19
  return lines.join("\n");