@bastani/atomic 0.5.8 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Configuration management CLI and SDK for coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,6 +30,10 @@
30
30
  "bun": "./src/sdk/index.ts",
31
31
  "types": "./dist/sdk/index.d.ts"
32
32
  },
33
+ "./workflows": {
34
+ "bun": "./src/sdk/workflows/index.ts",
35
+ "types": "./dist/sdk/workflows/index.d.ts"
36
+ },
33
37
  "./*": {
34
38
  "bun": "./src/sdk/*",
35
39
  "types": "./dist/sdk/*"
package/src/lib/spawn.ts CHANGED
@@ -99,29 +99,31 @@ export interface EnsureOptions {
99
99
  }
100
100
 
101
101
  /**
102
- * Install a global package via bun. Uses `--trust` to allow postinstall
103
- * lifecycle scripts (required by packages like @playwright/cli).
102
+ * Install one or more global packages via a single `bun install -g` call.
103
+ * Uses `--trust` to allow postinstall lifecycle scripts (required by
104
+ * packages like @playwright/cli).
105
+ *
106
+ * Combining multiple packages into one invocation is important: Bun's
107
+ * global linker is not safe to run concurrently — two parallel
108
+ * `bun install -g` processes race to create the same symlinks in the
109
+ * shared global store, causing EEXIST errors for transitive deps that
110
+ * both packages (or the already-installed @bastani/atomic) share.
104
111
  */
105
- export async function upgradeGlobalPackage(pkg: string): Promise<void> {
106
- const versionedPkg = pkg.includes("@latest") ? pkg : `${pkg}@latest`;
112
+ export async function upgradeGlobalPackages(pkgs: string[]): Promise<void> {
107
113
  const bunPath = Bun.which("bun");
108
114
  if (!bunPath) {
109
- throw new Error(`bun is not available to install ${pkg}.`);
115
+ throw new Error(`bun is not available to install ${pkgs.join(", ")}.`);
110
116
  }
111
- const result = await runCommand([bunPath, "install", "-g", "--trust", versionedPkg]);
117
+ const versioned = pkgs.map((p) => (p.includes("@latest") ? p : `${p}@latest`));
118
+ const result = await runCommand([bunPath, "install", "-g", "--trust", ...versioned]);
112
119
  if (!result.success) {
113
- throw new Error(`Failed to install ${pkg}: ${result.details}`);
120
+ throw new Error(`Failed to install ${pkgs.join(", ")}: ${result.details}`);
114
121
  }
115
122
  }
116
123
 
117
- /** Upgrade @playwright/cli to the latest version globally. */
118
- export async function upgradePlaywrightCli(): Promise<void> {
119
- return upgradeGlobalPackage("@playwright/cli");
120
- }
121
-
122
- /** Upgrade @llamaindex/liteparse to the latest version globally. */
123
- export async function upgradeLiteparse(): Promise<void> {
124
- return upgradeGlobalPackage("@llamaindex/liteparse");
124
+ /** Upgrade @playwright/cli and @llamaindex/liteparse globally in one pass. */
125
+ export async function upgradeGlobalToolPackages(): Promise<void> {
126
+ return upgradeGlobalPackages(["@playwright/cli", "@llamaindex/liteparse"]);
125
127
  }
126
128
 
127
129
  /**
@@ -36,8 +36,7 @@ import { VERSION } from "../../version.ts";
36
36
  import { COLORS } from "../../theme/colors.ts";
37
37
  import {
38
38
  ensureTmuxInstalled,
39
- upgradePlaywrightCli,
40
- upgradeLiteparse,
39
+ upgradeGlobalToolPackages,
41
40
  } from "../../lib/spawn.ts";
42
41
  import { installGlobalAgents } from "./agents.ts";
43
42
  import { installGlobalSkills } from "./skills.ts";
@@ -101,11 +100,10 @@ export async function autoSyncIfStale(): Promise<void> {
101
100
  // best-effort contract.
102
101
  const results = await runSteps([
103
102
  [
104
- { label: "tmux / psmux", fn: () => ensureTmuxInstalled({ quiet: true }) },
105
- { label: "global agent configs", fn: installGlobalAgents },
106
- { label: "@playwright/cli", fn: upgradePlaywrightCli },
107
- { label: "@llamaindex/liteparse", fn: upgradeLiteparse },
108
- { label: "global skills", fn: installGlobalSkills },
103
+ { label: "tmux / psmux", fn: () => ensureTmuxInstalled({ quiet: true }) },
104
+ { label: "global agent configs", fn: installGlobalAgents },
105
+ { label: "global tool packages", fn: upgradeGlobalToolPackages },
106
+ { label: "global skills", fn: installGlobalSkills },
109
107
  ],
110
108
  ]);
111
109