@ghl-ai/aw 0.1.62 → 0.1.64

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/commands/push.mjs CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  AW_DOCS_TEAMOFONE_ORIGIN,
40
40
  AW_DOCS_TEAMOFONE_BASE_URL,
41
41
  AW_CO_AUTHOR,
42
- defaultAwDocsGithubDocsConfig,
42
+ defaultAwDocsConfig,
43
43
  } from '../constants.mjs';
44
44
  import { resolveInput } from '../paths.mjs';
45
45
  import { walkRegistryTree, getAllFiles } from '../registry.mjs';
@@ -246,16 +246,25 @@ function writeAwDocsConfigIfChanged(projectRoot, config) {
246
246
 
247
247
  function ensureAwDocsPublishConfig(projectRoot) {
248
248
  const config = readAwDocsConfig(projectRoot);
249
- const defaultGithubDocs = defaultAwDocsGithubDocsConfig();
249
+ const defaultConfig = defaultAwDocsConfig();
250
250
  const next = {
251
251
  ...config,
252
+ docs: {
253
+ ...defaultConfig.docs,
254
+ ...(config.docs || {}),
255
+ },
252
256
  sync: {
257
+ ...defaultConfig.sync,
253
258
  ...(config.sync || {}),
254
259
  github_docs: {
255
- ...defaultGithubDocs,
260
+ ...defaultConfig.sync.github_docs,
256
261
  ...(config.sync?.github_docs || {}),
257
262
  },
258
263
  },
264
+ paths: {
265
+ ...defaultConfig.paths,
266
+ ...(config.paths || {}),
267
+ },
259
268
  };
260
269
 
261
270
  writeAwDocsConfigIfChanged(projectRoot, next);
@@ -298,16 +307,6 @@ function resolveAwDocsPublishConfig(projectRoot) {
298
307
  };
299
308
  }
300
309
 
301
- function isOnlyUntrackedAwSymlink(status, cloneDir) {
302
- const lines = status.trim().split('\n').filter(Boolean);
303
- if (lines.length !== 1 || !/^\?\?\s+\.aw\/?$/.test(lines[0])) return false;
304
- try {
305
- return lstatSync(join(cloneDir, '.aw')).isSymbolicLink();
306
- } catch {
307
- return false;
308
- }
309
- }
310
-
311
310
  async function removeTrackedAwSymlink(cloneDir) {
312
311
  try {
313
312
  if (!lstatSync(join(cloneDir, '.aw')).isSymbolicLink()) return false;
@@ -331,6 +330,49 @@ async function removeTrackedAwSymlink(cloneDir) {
331
330
  return true;
332
331
  }
333
332
 
333
+ function parseStatusPaths(status) {
334
+ return status
335
+ .split('\n')
336
+ .filter(line => line.trim())
337
+ .flatMap(line => line.slice(3).trim().split(' -> '));
338
+ }
339
+
340
+ function isManagedAwCachePath(path) {
341
+ return path === '.aw' || path.startsWith('.aw/');
342
+ }
343
+
344
+ function isOnlyManagedAwCacheDirtiness(status) {
345
+ const paths = parseStatusPaths(status);
346
+ return paths.length > 0 && paths.every(isManagedAwCachePath);
347
+ }
348
+
349
+ async function hasTrackedAwCachePaths(cloneDir) {
350
+ const { stdout } = await execFile('git', ['ls-files', '--', '.aw'], {
351
+ cwd: cloneDir,
352
+ encoding: 'utf8',
353
+ });
354
+ return stdout.trim().length > 0;
355
+ }
356
+
357
+ async function selfHealManagedAwCacheDirtiness(cloneDir, status) {
358
+ if (!isOnlyManagedAwCacheDirtiness(status)) return false;
359
+
360
+ rmSync(join(cloneDir, '.aw'), { recursive: true, force: true });
361
+ await execFile('git', ['clean', '-fd', '--', '.aw'], {
362
+ cwd: cloneDir,
363
+ encoding: 'utf8',
364
+ });
365
+
366
+ if (await hasTrackedAwCachePaths(cloneDir)) {
367
+ await execFile('git', ['restore', '--staged', '--worktree', '--', '.aw'], {
368
+ cwd: cloneDir,
369
+ encoding: 'utf8',
370
+ });
371
+ }
372
+
373
+ return true;
374
+ }
375
+
334
376
  async function getGitStatus(repoDir) {
335
377
  const { stdout } = await execFile('git', ['status', '--porcelain'], {
336
378
  cwd: repoDir,
@@ -388,8 +430,7 @@ async function ensureAwDocsRepoClone(home, publishConfig) {
388
430
  }
389
431
 
390
432
  let status = await getGitStatus(cloneDir);
391
- if (status.trim() && isOnlyUntrackedAwSymlink(status, cloneDir)) {
392
- rmSync(join(cloneDir, '.aw'), { force: true });
433
+ if (status.trim() && await selfHealManagedAwCacheDirtiness(cloneDir, status)) {
393
434
  status = await getGitStatus(cloneDir);
394
435
  }
395
436
  if (status.trim()) {
package/constants.mjs CHANGED
@@ -45,6 +45,26 @@ export function defaultAwDocsGithubDocsConfig() {
45
45
  };
46
46
  }
47
47
 
48
+ export function defaultAwDocsConfig() {
49
+ return {
50
+ docs: {
51
+ outputMode: 'dual',
52
+ },
53
+ sync: {
54
+ eager: true,
55
+ batch_threshold: 10,
56
+ mcp_memory_enabled: true,
57
+ github_docs: defaultAwDocsGithubDocsConfig(),
58
+ },
59
+ paths: {
60
+ runs: `${AW_DOCS_DIR}/runs`,
61
+ learnings: `${AW_DOCS_DIR}/learnings`,
62
+ tasks: `${AW_DOCS_DIR}/tasks`,
63
+ cache: `${AW_DOCS_DIR}/cache`,
64
+ },
65
+ };
66
+ }
67
+
48
68
  /** Persistent git clone root — ~/.aw/ */
49
69
  export const AW_HOME = join(homedir(), '.aw');
50
70
 
package/integrate.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  import { isDefaultRoutingEnabled } from './startup.mjs';
16
16
  import {
17
17
  AW_DOCS_DIR,
18
- defaultAwDocsGithubDocsConfig,
18
+ defaultAwDocsConfig,
19
19
  } from './constants.mjs';
20
20
 
21
21
  const AW_ROUTER_BRIDGE_HEADER = 'AW Router Bridge';
@@ -648,23 +648,7 @@ No active runs. Use \`/aw:<team>-<command>\` to start a workflow.
648
648
 
649
649
  // config.json — registry paths, sync settings
650
650
  const configPath = join(awDocsDir, 'config.json');
651
- const defaultConfig = {
652
- docs: {
653
- outputMode: 'dual',
654
- },
655
- sync: {
656
- eager: true,
657
- batch_threshold: 10,
658
- mcp_memory_enabled: true,
659
- github_docs: defaultAwDocsGithubDocsConfig(),
660
- },
661
- paths: {
662
- runs: `${AW_DOCS_DIR}/runs`,
663
- learnings: `${AW_DOCS_DIR}/learnings`,
664
- tasks: `${AW_DOCS_DIR}/tasks`,
665
- cache: `${AW_DOCS_DIR}/cache`,
666
- },
667
- };
651
+ const defaultConfig = defaultAwDocsConfig();
668
652
  let nextConfig = defaultConfig;
669
653
  if (existsSync(configPath)) {
670
654
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.62",
3
+ "version": "0.1.64",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {