@ghl-ai/aw 0.1.36-beta.89 → 0.1.36-beta.91
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/init.mjs +1 -31
- package/git.mjs +5 -1
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Uses core.hooksPath (git-lfs pattern) for system-wide hook interception.
|
|
5
5
|
// Uses IDE tasks for auto-pull on workspace open.
|
|
6
6
|
|
|
7
|
-
import { existsSync,
|
|
7
|
+
import { existsSync, writeFileSync, symlinkSync, lstatSync, readdirSync, readFileSync, rmSync, realpathSync, appendFileSync } from 'node:fs';
|
|
8
8
|
import { execSync } from 'node:child_process';
|
|
9
9
|
import { join, dirname, sep } from 'node:path';
|
|
10
10
|
import { homedir } from 'node:os';
|
|
@@ -103,34 +103,6 @@ function installIdeTasks() {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* Write .vscode/settings.json so Cursor/VS Code always treats ~/.aw as a git
|
|
108
|
-
* repository in the source-control panel — even on first load.
|
|
109
|
-
*
|
|
110
|
-
* VS Code does NOT follow symlinks when scanning for git repos, so pointing
|
|
111
|
-
* at the relative `.aw/` symlink never works. We must use the real absolute
|
|
112
|
-
* path to ~/.aw so VS Code/Cursor picks it up directly.
|
|
113
|
-
* Setting: `git.scanRepositories` (the correct VS Code setting name).
|
|
114
|
-
*/
|
|
115
|
-
function installVscodeGitSettings(projectDir) {
|
|
116
|
-
if (!projectDir || projectDir === HOME) return;
|
|
117
|
-
try {
|
|
118
|
-
const vscodeDir = join(projectDir, '.vscode');
|
|
119
|
-
mkdirSync(vscodeDir, { recursive: true });
|
|
120
|
-
const settingsPath = join(vscodeDir, 'settings.json');
|
|
121
|
-
let settings = {};
|
|
122
|
-
if (existsSync(settingsPath)) {
|
|
123
|
-
try { settings = JSON.parse(readFileSync(settingsPath, 'utf8')); } catch { /* corrupted — overwrite */ }
|
|
124
|
-
}
|
|
125
|
-
// Use absolute real path — VS Code won't follow the .aw symlink
|
|
126
|
-
const repos = settings['git.scanRepositories'] || [];
|
|
127
|
-
if (!repos.includes(AW_HOME)) {
|
|
128
|
-
settings['git.scanRepositories'] = [...repos, AW_HOME];
|
|
129
|
-
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
130
|
-
}
|
|
131
|
-
} catch { /* best effort */ }
|
|
132
|
-
}
|
|
133
|
-
|
|
134
106
|
const ALLOWED_NAMESPACES = ['platform', 'revex', 'mobile', 'commerce', 'leadgen', 'crm', 'marketplace', 'ai'];
|
|
135
107
|
|
|
136
108
|
export async function initCommand(args) {
|
|
@@ -300,7 +272,6 @@ export async function initCommand(args) {
|
|
|
300
272
|
if (!silent) fmt.logStep('Linked current project');
|
|
301
273
|
} catch { /* best effort */ }
|
|
302
274
|
}
|
|
303
|
-
installVscodeGitSettings(cwd !== HOME ? cwd : null);
|
|
304
275
|
|
|
305
276
|
// Wire ~/.claude/.cursor/.codex to the project's registry when in a project,
|
|
306
277
|
// so edits to project/.aw/.aw_registry/ are instantly visible in global IDE dirs.
|
|
@@ -427,7 +398,6 @@ export async function initCommand(args) {
|
|
|
427
398
|
fmt.logStep('Linked current project');
|
|
428
399
|
} catch { /* best effort */ }
|
|
429
400
|
}
|
|
430
|
-
installVscodeGitSettings(cwd !== HOME ? cwd : null);
|
|
431
401
|
|
|
432
402
|
// Step 5: Wire ~/.claude/.cursor/.codex to the project's registry when in a project,
|
|
433
403
|
// so edits to project/.aw/.aw_registry/ are instantly visible in global IDE dirs.
|
package/git.mjs
CHANGED
|
@@ -242,7 +242,11 @@ export async function fetchAndMerge(awHome, { silent = true } = {}) {
|
|
|
242
242
|
);
|
|
243
243
|
const currentBranch = branchOut.trim();
|
|
244
244
|
|
|
245
|
-
if
|
|
245
|
+
// Only auto-correct if on `main` — the known partial-init drift state.
|
|
246
|
+
// Push branches (upload/, remove/, sync/, feat/) are intentional and must
|
|
247
|
+
// not be switched away from: doing so would make aw push changes disappear.
|
|
248
|
+
const isDriftBranch = currentBranch === 'main';
|
|
249
|
+
if (currentBranch !== REGISTRY_BASE_BRANCH && currentBranch !== 'HEAD' && isDriftBranch) {
|
|
246
250
|
// Re-enable sparse checkout before switching branches.
|
|
247
251
|
// If sparse-checkout was disabled (e.g. by an old --no-edit merge),
|
|
248
252
|
// `init --no-cone` restores it from the existing sparse-checkout file.
|