@ghl-ai/aw 0.1.36-beta.90 → 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 +2 -46
- package/git.mjs +5 -1
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
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
|
-
import { join, dirname,
|
|
9
|
+
import { join, dirname, 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';
|
|
@@ -103,48 +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.
|
|
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.
|
|
120
|
-
*/
|
|
121
|
-
function installVscodeGitSettings(projectDir) {
|
|
122
|
-
if (!projectDir || projectDir === HOME) return;
|
|
123
|
-
try {
|
|
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 */ }
|
|
130
|
-
}
|
|
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');
|
|
144
|
-
}
|
|
145
|
-
} catch { /* best effort */ }
|
|
146
|
-
}
|
|
147
|
-
|
|
148
106
|
const ALLOWED_NAMESPACES = ['platform', 'revex', 'mobile', 'commerce', 'leadgen', 'crm', 'marketplace', 'ai'];
|
|
149
107
|
|
|
150
108
|
export async function initCommand(args) {
|
|
@@ -314,7 +272,6 @@ export async function initCommand(args) {
|
|
|
314
272
|
if (!silent) fmt.logStep('Linked current project');
|
|
315
273
|
} catch { /* best effort */ }
|
|
316
274
|
}
|
|
317
|
-
installVscodeGitSettings(cwd !== HOME ? cwd : null);
|
|
318
275
|
|
|
319
276
|
// Wire ~/.claude/.cursor/.codex to the project's registry when in a project,
|
|
320
277
|
// so edits to project/.aw/.aw_registry/ are instantly visible in global IDE dirs.
|
|
@@ -441,7 +398,6 @@ export async function initCommand(args) {
|
|
|
441
398
|
fmt.logStep('Linked current project');
|
|
442
399
|
} catch { /* best effort */ }
|
|
443
400
|
}
|
|
444
|
-
installVscodeGitSettings(cwd !== HOME ? cwd : null);
|
|
445
401
|
|
|
446
402
|
// Step 5: Wire ~/.claude/.cursor/.codex to the project's registry when in a project,
|
|
447
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.
|