@ghl-ai/aw 0.1.36-beta.76 → 0.1.36-beta.78
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 +23 -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, writeFileSync, symlinkSync, lstatSync, readdirSync, readFileSync, rmSync, realpathSync } from 'node:fs';
|
|
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';
|
|
@@ -45,6 +45,26 @@ const HOME = (() => { try { return realpathSync(_rawHome); } catch { return _raw
|
|
|
45
45
|
const GLOBAL_AW_DIR = join(HOME, '.aw_registry');
|
|
46
46
|
const AW_HOME = join(HOME, '.aw');
|
|
47
47
|
|
|
48
|
+
// ── Ensure ~/.aw/.gitignore has personal/local entries ───────────────────
|
|
49
|
+
|
|
50
|
+
const AW_GITIGNORE_ENTRIES = [
|
|
51
|
+
'.aw_registry/.sync-config.json',
|
|
52
|
+
'hooks/',
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
function ensureAwGitignore(awHome) {
|
|
56
|
+
// Use .git/info/exclude so the tracked .gitignore stays clean
|
|
57
|
+
const excludePath = join(awHome, '.git', 'info', 'exclude');
|
|
58
|
+
let existing = '';
|
|
59
|
+
try { existing = readFileSync(excludePath, 'utf8'); } catch { /* doesn't exist yet */ }
|
|
60
|
+
const missing = AW_GITIGNORE_ENTRIES.filter(e => !existing.includes(e));
|
|
61
|
+
if (missing.length === 0) return;
|
|
62
|
+
const block = (existing.endsWith('\n') || existing === '' ? '' : '\n')
|
|
63
|
+
+ '# aw: personal/local — do not commit\n'
|
|
64
|
+
+ missing.join('\n') + '\n';
|
|
65
|
+
try { appendFileSync(excludePath, block); } catch { /* best effort */ }
|
|
66
|
+
}
|
|
67
|
+
|
|
48
68
|
// ── IDE tasks for auto-pull ─────────────────────────────────────────────
|
|
49
69
|
|
|
50
70
|
function installIdeTasks() {
|
|
@@ -206,6 +226,7 @@ export async function initCommand(args) {
|
|
|
206
226
|
if (!silent) s.stop(chalk.yellow('Fetch failed — continuing with local cache'));
|
|
207
227
|
}
|
|
208
228
|
|
|
229
|
+
ensureAwGitignore(AW_HOME);
|
|
209
230
|
const freshCfg = config.load(GLOBAL_AW_DIR);
|
|
210
231
|
|
|
211
232
|
// Ensure project worktree sparse checkout matches the global clone.
|
|
@@ -306,6 +327,7 @@ export async function initCommand(args) {
|
|
|
306
327
|
|
|
307
328
|
try {
|
|
308
329
|
await initPersistentClone(repoUrl, AW_HOME, sparsePaths);
|
|
330
|
+
ensureAwGitignore(AW_HOME);
|
|
309
331
|
s.stop('Registry cloned');
|
|
310
332
|
} catch (e) {
|
|
311
333
|
s.stop(chalk.red('Clone failed'));
|