@ghl-ai/aw 0.1.36-beta.88 → 0.1.36-beta.90

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.
Files changed (2) hide show
  1. package/commands/init.mjs +33 -14
  2. package/package.json +1 -1
package/commands/init.mjs CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { existsSync, mkdirSync, writeFileSync, symlinkSync, lstatSync, readdirSync, readFileSync, rmSync, realpathSync, appendFileSync } from 'node:fs';
8
8
  import { execSync } from 'node:child_process';
9
- import { join, dirname, sep } from 'node:path';
9
+ import { join, dirname, basename, sep } from 'node:path';
10
10
  import { homedir } from 'node:os';
11
11
  import { fileURLToPath } from 'node:url';
12
12
  import * as config from '../config.mjs';
@@ -104,24 +104,43 @@ function installIdeTasks() {
104
104
  }
105
105
 
106
106
  /**
107
- * Write .vscode/settings.json so Cursor/VS Code always treats .aw/ as a git
108
- * repository even on first load before the symlink existed at scan time.
109
- * Without this, the git panel is blank until the user reloads the IDE.
107
+ * Write .vscode/settings.json so Cursor/VS Code always treats ~/.aw as a git
108
+ * repository in the source-control panel.
109
+ *
110
+ * VS Code/Cursor does NOT follow symlinks when scanning for git repos, so
111
+ * `.aw/` → `~/.aw` is never auto-detected. `git.scanRepositories` is also
112
+ * documented as unreliable for this case.
113
+ *
114
+ * The only reliable fix: a `.code-workspace` file that adds `~/.aw` as an
115
+ * explicit second folder. VS Code/Cursor fully supports multi-root workspaces
116
+ * and will show the git panel for every folder listed there.
117
+ *
118
+ * We create/update `<project>.code-workspace` in the project root and merge
119
+ * `~/.aw` into its folders array without touching anything else.
110
120
  */
111
121
  function installVscodeGitSettings(projectDir) {
112
122
  if (!projectDir || projectDir === HOME) return;
113
123
  try {
114
- const vscodeDir = join(projectDir, '.vscode');
115
- mkdirSync(vscodeDir, { recursive: true });
116
- const settingsPath = join(vscodeDir, 'settings.json');
117
- let settings = {};
118
- if (existsSync(settingsPath)) {
119
- try { settings = JSON.parse(readFileSync(settingsPath, 'utf8')); } catch { /* corrupted — overwrite */ }
124
+ const projectName = basename(projectDir);
125
+ const workspacePath = join(projectDir, `${projectName}.code-workspace`);
126
+
127
+ let workspace = { folders: [], settings: {} };
128
+ if (existsSync(workspacePath)) {
129
+ try { workspace = JSON.parse(readFileSync(workspacePath, 'utf8')); } catch { /* corrupted — overwrite */ }
120
130
  }
121
- const repos = settings['git.additionalRepositories'] || [];
122
- if (!repos.includes('.aw')) {
123
- settings['git.additionalRepositories'] = [...repos, '.aw'];
124
- writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
131
+
132
+ workspace.folders = workspace.folders || [];
133
+ workspace.settings = workspace.settings || {};
134
+
135
+ // Ensure project root is listed first
136
+ const hasRoot = workspace.folders.some(f => f.path === '.' || f.path === projectDir);
137
+ if (!hasRoot) workspace.folders.unshift({ path: '.' });
138
+
139
+ // Add ~/.aw as a second folder if not already present
140
+ const hasAw = workspace.folders.some(f => f.path === AW_HOME || f.name === 'aw registry');
141
+ if (!hasAw) {
142
+ workspace.folders.push({ path: AW_HOME, name: 'aw registry' });
143
+ writeFileSync(workspacePath, JSON.stringify(workspace, null, 2) + '\n');
125
144
  }
126
145
  } catch { /* best effort */ }
127
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.36-beta.88",
3
+ "version": "0.1.36-beta.90",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": "bin.js",