@ghl-ai/aw 0.1.42-beta.46 → 0.1.42-beta.48

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/ecc.mjs CHANGED
@@ -12,7 +12,7 @@ import { applyStoredStartupPreferences } from "./startup.mjs";
12
12
 
13
13
  const AW_ECC_REPO_SSH = "git@github.com:shreyansh-ghl/aw-ecc.git";
14
14
  const AW_ECC_REPO_HTTPS = "https://github.com/shreyansh-ghl/aw-ecc.git";
15
- export const AW_ECC_TAG = "v1.4.41-beta.9";
15
+ export const AW_ECC_TAG = "v1.4.41-beta.10";
16
16
 
17
17
  const MARKETPLACE_NAME = "aw-marketplace";
18
18
  const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
package/hook-cleanup.mjs CHANGED
@@ -7,10 +7,11 @@
7
7
 
8
8
  import {
9
9
  existsSync, mkdirSync, readFileSync, readdirSync,
10
- rmSync, writeFileSync,
10
+ renameSync, rmSync, writeFileSync,
11
11
  } from 'node:fs';
12
12
  import { dirname, join } from 'node:path';
13
13
  import { homedir } from 'node:os';
14
+ import { randomBytes } from 'node:crypto';
14
15
 
15
16
  const SCHEMA_VERSION = 'aw-hooks.v1';
16
17
  const HOME = homedir();
@@ -47,8 +48,12 @@ function readJson(filePath) {
47
48
  }
48
49
 
49
50
  function writeJson(filePath, data) {
50
- mkdirSync(dirname(filePath), { recursive: true });
51
- writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n');
51
+ const dir = dirname(filePath);
52
+ mkdirSync(dir, { recursive: true });
53
+ const content = JSON.stringify(data, null, 2) + '\n';
54
+ const tmpPath = join(dir, `.${randomBytes(8).toString('hex')}.tmp`);
55
+ writeFileSync(tmpPath, content);
56
+ renameSync(tmpPath, filePath);
52
57
  }
53
58
 
54
59
  // ── Collect current hook state ───────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.42-beta.46",
3
+ "version": "0.1.42-beta.48",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {
package/startup.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
1
+ import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
+ import { randomBytes } from 'node:crypto';
4
5
 
5
6
  import {
6
7
  CODEX_HOME_HOOK_MATCHER,
@@ -95,8 +96,14 @@ function readJson(filePath, fallback = {}) {
95
96
  }
96
97
 
97
98
  function writeJson(filePath, value) {
98
- mkdirSync(dirname(filePath), { recursive: true });
99
- writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
99
+ const dir = dirname(filePath);
100
+ mkdirSync(dir, { recursive: true });
101
+ const content = `${JSON.stringify(value, null, 2)}\n`;
102
+ // Atomic write: write to temp file then rename to prevent corruption from
103
+ // concurrent writes (e.g. aw init + Claude Code plugin registration racing).
104
+ const tmpPath = join(dir, `.${randomBytes(8).toString('hex')}.tmp`);
105
+ writeFileSync(tmpPath, content);
106
+ renameSync(tmpPath, filePath);
100
107
  }
101
108
 
102
109
  function ensureManagedFile(filePath, content, updatedFiles) {