@memnexus-ai/mx-agent-cli 0.1.19 → 0.1.20
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/dist/__tests__/project-config.test.d.ts +2 -0
- package/dist/__tests__/project-config.test.d.ts.map +1 -0
- package/dist/__tests__/project-config.test.js +106 -0
- package/dist/__tests__/project-config.test.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +10 -8
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/init.d.ts +26 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +120 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +4 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +18 -16
- package/dist/commands/start.js.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/catalog.d.ts +5 -5
- package/dist/lib/catalog.d.ts.map +1 -1
- package/dist/lib/catalog.js +11 -11
- package/dist/lib/catalog.js.map +1 -1
- package/dist/lib/claude.d.ts +16 -8
- package/dist/lib/claude.d.ts.map +1 -1
- package/dist/lib/claude.js +25 -25
- package/dist/lib/claude.js.map +1 -1
- package/dist/lib/project-config.d.ts +36 -0
- package/dist/lib/project-config.d.ts.map +1 -0
- package/dist/lib/project-config.js +63 -0
- package/dist/lib/project-config.js.map +1 -0
- package/dist/lib/templates.d.ts +24 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +88 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/worktree.d.ts +5 -5
- package/dist/lib/worktree.d.ts.map +1 -1
- package/dist/lib/worktree.js +20 -19
- package/dist/lib/worktree.js.map +1 -1
- package/package.json +6 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","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,WAAW,CAAC,kEAAkE,CAAC,CAAC;AAEnF,SAAS;KACN,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CAAC,+CAA+C,CAAC;KAC5D,MAAM,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;IACrC,SAAS,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,oBAAoB,CAAC;KACjC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE;IACtB,SAAS,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,GAAG,EAAE;IACX,SAAS,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE;IACtB,SAAS,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/lib/catalog.d.ts
CHANGED
|
@@ -28,22 +28,22 @@ export declare function parseTeamEntry(filePath: string): TeamEntry | null;
|
|
|
28
28
|
/**
|
|
29
29
|
* Return the path to the teams catalog directory.
|
|
30
30
|
*/
|
|
31
|
-
export declare function getTeamsCatalogDir(projectRoot: string): string;
|
|
31
|
+
export declare function getTeamsCatalogDir(projectRoot: string, teamsDir?: string): string;
|
|
32
32
|
/**
|
|
33
33
|
* Return the path to a specific team's catalog file.
|
|
34
34
|
*/
|
|
35
|
-
export declare function getTeamCatalogPath(projectRoot: string, slug: string): string;
|
|
35
|
+
export declare function getTeamCatalogPath(projectRoot: string, slug: string, teamsDir?: string): string;
|
|
36
36
|
/**
|
|
37
37
|
* List all teams from the catalog directory.
|
|
38
38
|
* Skips README.md.
|
|
39
39
|
*/
|
|
40
|
-
export declare function listTeams(projectRoot: string): TeamEntry[];
|
|
40
|
+
export declare function listTeams(projectRoot: string, teamsDir?: string): TeamEntry[];
|
|
41
41
|
/**
|
|
42
42
|
* Look up a single team entry by slug.
|
|
43
43
|
*/
|
|
44
|
-
export declare function getTeam(projectRoot: string, slug: string): TeamEntry | null;
|
|
44
|
+
export declare function getTeam(projectRoot: string, slug: string, teamsDir?: string): TeamEntry | null;
|
|
45
45
|
/**
|
|
46
46
|
* Write a team catalog entry (creates the file).
|
|
47
47
|
*/
|
|
48
|
-
export declare function writeTeamCatalog(projectRoot: string, entry: TeamEntry): void;
|
|
48
|
+
export declare function writeTeamCatalog(projectRoot: string, entry: TeamEntry, teamsDir?: string): void;
|
|
49
49
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/lib/catalog.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,SAAS;IACxB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AASD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAW3D;AAED;;;GAGG;AACH,wBAAgB,cAA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AAE,SAAS,EAAE,QAAQ,GAAE,MAAgC,GAAG,IAAI,CAKxH"}
|
package/dist/lib/catalog.js
CHANGED
|
@@ -68,21 +68,21 @@ export function parseTeamEntry(filePath) {
|
|
|
68
68
|
/**
|
|
69
69
|
* Return the path to the teams catalog directory.
|
|
70
70
|
*/
|
|
71
|
-
export function getTeamsCatalogDir(projectRoot) {
|
|
72
|
-
return join(projectRoot,
|
|
71
|
+
export function getTeamsCatalogDir(projectRoot, teamsDir = 'mx-agent-system/teams') {
|
|
72
|
+
return join(projectRoot, teamsDir);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Return the path to a specific team's catalog file.
|
|
76
76
|
*/
|
|
77
|
-
export function getTeamCatalogPath(projectRoot, slug) {
|
|
78
|
-
return join(getTeamsCatalogDir(projectRoot), `${slug}.md`);
|
|
77
|
+
export function getTeamCatalogPath(projectRoot, slug, teamsDir = 'mx-agent-system/teams') {
|
|
78
|
+
return join(getTeamsCatalogDir(projectRoot, teamsDir), `${slug}.md`);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* List all teams from the catalog directory.
|
|
82
82
|
* Skips README.md.
|
|
83
83
|
*/
|
|
84
|
-
export function listTeams(projectRoot) {
|
|
85
|
-
const dir = getTeamsCatalogDir(projectRoot);
|
|
84
|
+
export function listTeams(projectRoot, teamsDir = 'mx-agent-system/teams') {
|
|
85
|
+
const dir = getTeamsCatalogDir(projectRoot, teamsDir);
|
|
86
86
|
if (!existsSync(dir))
|
|
87
87
|
return [];
|
|
88
88
|
const files = readdirSync(dir).filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md');
|
|
@@ -93,8 +93,8 @@ export function listTeams(projectRoot) {
|
|
|
93
93
|
/**
|
|
94
94
|
* Look up a single team entry by slug.
|
|
95
95
|
*/
|
|
96
|
-
export function getTeam(projectRoot, slug) {
|
|
97
|
-
const path = getTeamCatalogPath(projectRoot, slug);
|
|
96
|
+
export function getTeam(projectRoot, slug, teamsDir = 'mx-agent-system/teams') {
|
|
97
|
+
const path = getTeamCatalogPath(projectRoot, slug, teamsDir);
|
|
98
98
|
if (!existsSync(path))
|
|
99
99
|
return null;
|
|
100
100
|
return parseTeamEntry(path);
|
|
@@ -102,11 +102,11 @@ export function getTeam(projectRoot, slug) {
|
|
|
102
102
|
/**
|
|
103
103
|
* Write a team catalog entry (creates the file).
|
|
104
104
|
*/
|
|
105
|
-
export function writeTeamCatalog(projectRoot, entry) {
|
|
106
|
-
const dir = getTeamsCatalogDir(projectRoot);
|
|
105
|
+
export function writeTeamCatalog(projectRoot, entry, teamsDir = 'mx-agent-system/teams') {
|
|
106
|
+
const dir = getTeamsCatalogDir(projectRoot, teamsDir);
|
|
107
107
|
if (!existsSync(dir))
|
|
108
108
|
mkdirSync(dir, { recursive: true });
|
|
109
|
-
const path = getTeamCatalogPath(projectRoot, entry.slug);
|
|
109
|
+
const path = getTeamCatalogPath(projectRoot, entry.slug, teamsDir);
|
|
110
110
|
writeFileSync(path, serializeTeamEntry(entry));
|
|
111
111
|
}
|
|
112
112
|
//# sourceMappingURL=catalog.js.map
|
package/dist/lib/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/lib/catalog.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAatC;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,WAAW,CAAC,IAAI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,CAAC,CAAC,CAAC;SACxC,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,WAAmB,EAAE,IAAY,EAAE,WAAmB,uBAAuB;IACnG,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,KAAgB,EAAE,WAAmB,uBAAuB;IAChH,MAAM,GAAG,GAAG,kBAAkB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnE,aAAa,CAAC,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/lib/claude.d.ts
CHANGED
|
@@ -9,10 +9,15 @@ export declare function logDim(msg: string): void;
|
|
|
9
9
|
* Deploy CLAUDE.md into the worktree from the template.
|
|
10
10
|
*
|
|
11
11
|
* Template resolution order:
|
|
12
|
-
* 1.
|
|
13
|
-
* 2. CLAUDE.md
|
|
12
|
+
* 1. origin/<baseBranch>:<configSource>/CLAUDE.md.template via git show
|
|
13
|
+
* 2. Local <configSource>/CLAUDE.md.template — offline fallback
|
|
14
|
+
* 3. Local dev-tools/worktree-cli/templates/CLAUDE.md.template — legacy fallback
|
|
15
|
+
* 4. Root CLAUDE.md
|
|
14
16
|
*/
|
|
15
|
-
export declare function deployClaudeMd(projectRoot: string, worktreePath: string
|
|
17
|
+
export declare function deployClaudeMd(projectRoot: string, worktreePath: string, opts?: {
|
|
18
|
+
baseBranch?: string;
|
|
19
|
+
configSource?: string;
|
|
20
|
+
}): void;
|
|
16
21
|
/**
|
|
17
22
|
* Write CLAUDE.local.md into the worktree with isolation context.
|
|
18
23
|
* Matches the format produced by writeWorktreeClaudeLocal in operations.ts.
|
|
@@ -29,15 +34,18 @@ export declare function writeClaudeLocal(opts: {
|
|
|
29
34
|
}): void;
|
|
30
35
|
/**
|
|
31
36
|
* Sync .claude/settings.json and .claude/hooks/worktree-guard.sh from the
|
|
32
|
-
* platform team's canonical source:
|
|
37
|
+
* platform team's canonical source: <configSource>/ on origin/<baseBranch>.
|
|
33
38
|
*
|
|
34
|
-
* Uses `git show origin
|
|
35
|
-
* remote object store — no checkout/unstage dance, no staged files left behind.
|
|
39
|
+
* Uses `git show origin/<baseBranch>:<path>` to read file content directly from
|
|
40
|
+
* the remote object store — no checkout/unstage dance, no staged files left behind.
|
|
36
41
|
*
|
|
37
|
-
* Source of truth for all agent configuration is
|
|
42
|
+
* Source of truth for all agent configuration is <configSource>/.
|
|
38
43
|
* Changes to agent permissions or hooks must go through a platform team PR.
|
|
39
44
|
*/
|
|
40
|
-
export declare function syncClaudeConfig(worktreePath: string
|
|
45
|
+
export declare function syncClaudeConfig(worktreePath: string, opts?: {
|
|
46
|
+
baseBranch?: string;
|
|
47
|
+
configSource?: string;
|
|
48
|
+
}): void;
|
|
41
49
|
/**
|
|
42
50
|
* Exec into a Claude session in the worktree with the given initial prompt.
|
|
43
51
|
* Uses spawnSync so Claude replaces the current process cleanly.
|
package/dist/lib/claude.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/lib/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,wBAAgB,UAAU,CAAC,GA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ACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAoCP"}
|
package/dist/lib/claude.js
CHANGED
|
@@ -21,10 +21,14 @@ export function logDim(msg) {
|
|
|
21
21
|
* Deploy CLAUDE.md into the worktree from the template.
|
|
22
22
|
*
|
|
23
23
|
* Template resolution order:
|
|
24
|
-
* 1.
|
|
25
|
-
* 2. CLAUDE.md
|
|
24
|
+
* 1. origin/<baseBranch>:<configSource>/CLAUDE.md.template via git show
|
|
25
|
+
* 2. Local <configSource>/CLAUDE.md.template — offline fallback
|
|
26
|
+
* 3. Local dev-tools/worktree-cli/templates/CLAUDE.md.template — legacy fallback
|
|
27
|
+
* 4. Root CLAUDE.md
|
|
26
28
|
*/
|
|
27
|
-
export function deployClaudeMd(projectRoot, worktreePath) {
|
|
29
|
+
export function deployClaudeMd(projectRoot, worktreePath, opts = {}) {
|
|
30
|
+
const baseBranch = opts.baseBranch ?? 'main';
|
|
31
|
+
const configSource = opts.configSource ?? 'mx-agent-system/agent-config';
|
|
28
32
|
const claudeMdPath = join(worktreePath, 'CLAUDE.md');
|
|
29
33
|
// Handle transition: untrack from git index if still tracked
|
|
30
34
|
try {
|
|
@@ -41,23 +45,17 @@ export function deployClaudeMd(projectRoot, worktreePath) {
|
|
|
41
45
|
catch {
|
|
42
46
|
// Not tracked or error — fine
|
|
43
47
|
}
|
|
44
|
-
// Template resolution order:
|
|
45
|
-
// 1. origin/main:mx-agent-system/agent-config/CLAUDE.md.template via git show
|
|
46
|
-
// — canonical remote source, immune to local filesystem tampering (SF-7 fix)
|
|
47
|
-
// 2. Local mx-agent-system/agent-config/CLAUDE.md.template — offline fallback
|
|
48
|
-
// 3. Local dev-tools/worktree-cli/templates/CLAUDE.md.template — legacy fallback
|
|
49
|
-
// 4. Root CLAUDE.md
|
|
50
48
|
let content = null;
|
|
51
|
-
// Prefer reading from origin
|
|
49
|
+
// Prefer reading from origin/<baseBranch> via git show to avoid local tampering
|
|
52
50
|
try {
|
|
53
|
-
content = execSync(
|
|
51
|
+
content = execSync(`git show origin/${baseBranch}:${configSource}/CLAUDE.md.template`, { cwd: worktreePath, encoding: 'utf-8', stdio: 'pipe' });
|
|
54
52
|
}
|
|
55
53
|
catch {
|
|
56
54
|
// git show failed (offline or path missing) — fall through to local paths
|
|
57
55
|
}
|
|
58
56
|
if (!content) {
|
|
59
57
|
const localCandidates = [
|
|
60
|
-
join(projectRoot, '
|
|
58
|
+
join(projectRoot, configSource, 'CLAUDE.md.template'),
|
|
61
59
|
join(projectRoot, 'dev-tools/worktree-cli/templates/CLAUDE.md.template'),
|
|
62
60
|
];
|
|
63
61
|
for (const templatePath of localCandidates) {
|
|
@@ -157,21 +155,23 @@ Today's date is ${new Date().toISOString().slice(0, 10)}.
|
|
|
157
155
|
// ── Claude config sync ────────────────────────────────────────────────
|
|
158
156
|
/**
|
|
159
157
|
* Sync .claude/settings.json and .claude/hooks/worktree-guard.sh from the
|
|
160
|
-
* platform team's canonical source:
|
|
158
|
+
* platform team's canonical source: <configSource>/ on origin/<baseBranch>.
|
|
161
159
|
*
|
|
162
|
-
* Uses `git show origin
|
|
163
|
-
* remote object store — no checkout/unstage dance, no staged files left behind.
|
|
160
|
+
* Uses `git show origin/<baseBranch>:<path>` to read file content directly from
|
|
161
|
+
* the remote object store — no checkout/unstage dance, no staged files left behind.
|
|
164
162
|
*
|
|
165
|
-
* Source of truth for all agent configuration is
|
|
163
|
+
* Source of truth for all agent configuration is <configSource>/.
|
|
166
164
|
* Changes to agent permissions or hooks must go through a platform team PR.
|
|
167
165
|
*/
|
|
168
|
-
export function syncClaudeConfig(worktreePath) {
|
|
169
|
-
|
|
166
|
+
export function syncClaudeConfig(worktreePath, opts = {}) {
|
|
167
|
+
const baseBranch = opts.baseBranch ?? 'main';
|
|
168
|
+
const configSource = opts.configSource ?? 'mx-agent-system/agent-config';
|
|
169
|
+
logDim(`Syncing agent config from ${configSource}/ (origin/${baseBranch})...`);
|
|
170
170
|
try {
|
|
171
|
-
execSync(
|
|
171
|
+
execSync(`git fetch origin ${baseBranch} --quiet`, { cwd: worktreePath, stdio: 'pipe' });
|
|
172
172
|
}
|
|
173
173
|
catch {
|
|
174
|
-
logWarning(
|
|
174
|
+
logWarning(`Could not fetch origin/${baseBranch} — using existing agent config`);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
// Ensure .claude/hooks/ exists in the worktree
|
|
@@ -180,26 +180,26 @@ export function syncClaudeConfig(worktreePath) {
|
|
|
180
180
|
let synced = 0;
|
|
181
181
|
// settings.json
|
|
182
182
|
try {
|
|
183
|
-
const content = execSync(
|
|
183
|
+
const content = execSync(`git show origin/${baseBranch}:${configSource}/settings.json`, { cwd: worktreePath, encoding: 'utf-8', stdio: 'pipe' });
|
|
184
184
|
writeFileSync(join(worktreePath, '.claude', 'settings.json'), content);
|
|
185
185
|
synced++;
|
|
186
186
|
}
|
|
187
187
|
catch {
|
|
188
|
-
logWarning(
|
|
188
|
+
logWarning(`Could not sync settings.json from ${configSource}/`);
|
|
189
189
|
}
|
|
190
190
|
// worktree-guard.sh
|
|
191
191
|
try {
|
|
192
|
-
const content = execSync(
|
|
192
|
+
const content = execSync(`git show origin/${baseBranch}:${configSource}/hooks/worktree-guard.sh`, { cwd: worktreePath, encoding: 'utf-8', stdio: 'pipe' });
|
|
193
193
|
const guardPath = join(worktreePath, '.claude', 'hooks', 'worktree-guard.sh');
|
|
194
194
|
writeFileSync(guardPath, content);
|
|
195
195
|
execSync(`chmod +x "${guardPath}"`, { stdio: 'pipe' });
|
|
196
196
|
synced++;
|
|
197
197
|
}
|
|
198
198
|
catch {
|
|
199
|
-
logWarning(
|
|
199
|
+
logWarning(`Could not sync worktree-guard.sh from ${configSource}/`);
|
|
200
200
|
}
|
|
201
201
|
if (synced === 2) {
|
|
202
|
-
logSuccess(
|
|
202
|
+
logSuccess(`Agent config synced from ${configSource}/`);
|
|
203
203
|
}
|
|
204
204
|
else if (synced > 0) {
|
|
205
205
|
logWarning(`Partial sync: ${synced}/2 config files updated`);
|
package/dist/lib/claude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/lib/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,yEAAyE;AAEzE,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,yEAAyE;AAEzE
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/lib/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,yEAAyE;AAEz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QAAQ,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,EAAE;QAClD,GAAG,EAAE,YAAY;QACjB,GAAG;QACH,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,uBAAuB,EAAE,CAAC;IAE1B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,sBAAsB;IACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-level configuration for mx-agent.
|
|
3
|
+
*
|
|
4
|
+
* Reads mx-agent.config.json from the project root. All fields are optional;
|
|
5
|
+
* absence of the file or any field falls back to the hardcoded defaults that
|
|
6
|
+
* match the existing MemNexus monorepo layout — zero behavioral change for
|
|
7
|
+
* projects that don't have a config file.
|
|
8
|
+
*/
|
|
9
|
+
export interface ProjectConfig {
|
|
10
|
+
/** Base branch for git operations (default: 'main') */
|
|
11
|
+
baseBranch?: string;
|
|
12
|
+
/** Directory under projectRoot where worktrees are stored (default: '.worktrees') */
|
|
13
|
+
worktreeDir?: string;
|
|
14
|
+
/** Path under projectRoot to the agent-config directory (default: 'mx-agent-system/agent-config') */
|
|
15
|
+
configSource?: string;
|
|
16
|
+
/** Path under projectRoot to the teams catalog directory (default: 'mx-agent-system/teams') */
|
|
17
|
+
teamsDir?: string;
|
|
18
|
+
/** Path under projectRoot to the roleguides directory (default: 'mx-agent-system/roleguides') */
|
|
19
|
+
roleguidesDir?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const PROJECT_CONFIG_DEFAULTS: Required<ProjectConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Read mx-agent.config.json from projectRoot.
|
|
24
|
+
*
|
|
25
|
+
* Returns null if the file is absent or cannot be parsed — never throws.
|
|
26
|
+
* Unknown keys are silently ignored; only known ProjectConfig fields are returned.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadProjectConfig(projectRoot: string): ProjectConfig | null;
|
|
29
|
+
/**
|
|
30
|
+
* Merge a partial ProjectConfig over the defaults.
|
|
31
|
+
*
|
|
32
|
+
* This is the primary caller API — always returns a fully populated config
|
|
33
|
+
* with every field guaranteed to be a string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveProjectConfig(c: ProjectConfig | null): Required<ProjectConfig>;
|
|
36
|
+
//# sourceMappingURL=project-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/lib/project-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,aAAa,CAM3D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAgB3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,CAQrF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-level configuration for mx-agent.
|
|
3
|
+
*
|
|
4
|
+
* Reads mx-agent.config.json from the project root. All fields are optional;
|
|
5
|
+
* absence of the file or any field falls back to the hardcoded defaults that
|
|
6
|
+
* match the existing MemNexus monorepo layout — zero behavioral change for
|
|
7
|
+
* projects that don't have a config file.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync } from 'fs';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
export const PROJECT_CONFIG_DEFAULTS = {
|
|
12
|
+
baseBranch: 'main',
|
|
13
|
+
worktreeDir: '.worktrees',
|
|
14
|
+
configSource: 'mx-agent-system/agent-config',
|
|
15
|
+
teamsDir: 'mx-agent-system/teams',
|
|
16
|
+
roleguidesDir: 'mx-agent-system/roleguides',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Read mx-agent.config.json from projectRoot.
|
|
20
|
+
*
|
|
21
|
+
* Returns null if the file is absent or cannot be parsed — never throws.
|
|
22
|
+
* Unknown keys are silently ignored; only known ProjectConfig fields are returned.
|
|
23
|
+
*/
|
|
24
|
+
export function loadProjectConfig(projectRoot) {
|
|
25
|
+
const configPath = join(projectRoot, 'mx-agent.config.json');
|
|
26
|
+
if (!existsSync(configPath))
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const raw = readFileSync(configPath, 'utf-8');
|
|
30
|
+
const parsed = JSON.parse(raw);
|
|
31
|
+
const config = {};
|
|
32
|
+
if (typeof parsed.baseBranch === 'string')
|
|
33
|
+
config.baseBranch = parsed.baseBranch;
|
|
34
|
+
if (typeof parsed.worktreeDir === 'string')
|
|
35
|
+
config.worktreeDir = parsed.worktreeDir;
|
|
36
|
+
if (typeof parsed.configSource === 'string')
|
|
37
|
+
config.configSource = parsed.configSource;
|
|
38
|
+
if (typeof parsed.teamsDir === 'string')
|
|
39
|
+
config.teamsDir = parsed.teamsDir;
|
|
40
|
+
if (typeof parsed.roleguidesDir === 'string')
|
|
41
|
+
config.roleguidesDir = parsed.roleguidesDir;
|
|
42
|
+
return config;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Merge a partial ProjectConfig over the defaults.
|
|
50
|
+
*
|
|
51
|
+
* This is the primary caller API — always returns a fully populated config
|
|
52
|
+
* with every field guaranteed to be a string.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveProjectConfig(c) {
|
|
55
|
+
return {
|
|
56
|
+
baseBranch: c?.baseBranch ?? PROJECT_CONFIG_DEFAULTS.baseBranch,
|
|
57
|
+
worktreeDir: c?.worktreeDir ?? PROJECT_CONFIG_DEFAULTS.worktreeDir,
|
|
58
|
+
configSource: c?.configSource ?? PROJECT_CONFIG_DEFAULTS.configSource,
|
|
59
|
+
teamsDir: c?.teamsDir ?? PROJECT_CONFIG_DEFAULTS.teamsDir,
|
|
60
|
+
roleguidesDir: c?.roleguidesDir ?? PROJECT_CONFIG_DEFAULTS.roleguidesDir,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=project-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.js","sourceRoot":"","sources":["../../src/lib/project-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B,MAAM,CAAC,MAAM,uBAAuB,GAA4B;IAC9D,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,YAAY;IACzB,YAAY,EAAE,8BAA8B;IAC5C,QAAQ,EAAE,uBAAuB;IACjC,aAAa,EAAE,4BAA4B;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iBA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,EAAE,CAAC,EAAE,QAAQ,IAAI,uBAAuB,CAAC,QAAQ;QACzD,aAAa,EAAE,CAAC,EAAE,aAAa,IAAI,uBAAuB,CAAC,aAAa;KACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded template strings used by `mx-agent init`.
|
|
3
|
+
*
|
|
4
|
+
* These are inline string constants — no file bundling, no network calls.
|
|
5
|
+
* They provide minimal-but-valid stubs that a user can customise after init.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Minimal settings.json for Claude Code agent permissions.
|
|
9
|
+
* Grants bash access and restricts to the worktree directory.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SETTINGS_JSON_TEMPLATE: string;
|
|
12
|
+
/**
|
|
13
|
+
* Stub worktree-guard.sh hook.
|
|
14
|
+
* Blocks branch switching to main and force-pushes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const WORKTREE_GUARD_SH_TEMPLATE = "#!/usr/bin/env bash\n# worktree-guard.sh \u2014 Claude Code PreToolUse hook\n# Blocks dangerous git operations in worktrees.\n# Customise this file for your project's safety requirements.\n\nset -euo pipefail\n\nTOOL_NAME=\"${CLAUDE_TOOL_NAME:-}\"\nTOOL_INPUT=\"${CLAUDE_TOOL_INPUT:-}\"\n\nif [[ \"$TOOL_NAME\" != \"Bash\" ]]; then\n exit 0\nfi\n\n# Block checkout/switch to base branch\nif echo \"$TOOL_INPUT\" | grep -qE 'git (checkout|switch) (main|master|develop)'; then\n echo \"Blocked: cannot switch to base branch from a worktree.\" >&2\n exit 1\nfi\n\n# Block force push to base branch\nif echo \"$TOOL_INPUT\" | grep -qE 'git push .*(--force|-f).*(main|master|develop)'; then\n echo \"Blocked: force push to base branch is not allowed.\" >&2\n exit 1\nfi\n\nexit 0\n";
|
|
17
|
+
/**
|
|
18
|
+
* Stub CLAUDE.md.template — the template that gets deployed into each worktree
|
|
19
|
+
* as CLAUDE.md when running mx-agent create / mx-agent start.
|
|
20
|
+
*
|
|
21
|
+
* Users should replace this with project-specific instructions.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CLAUDE_MD_TEMPLATE = "# Agent Instructions\n\nThis file is deployed automatically into each agent worktree by `mx-agent`.\nReplace the contents below with your project-specific agent instructions.\n\n## Project Overview\n\n<!-- Describe your project here -->\n\n## Workflow\n\n<!-- Describe the expected workflow for agents -->\n\n## Rules\n\n1. Stay within your worktree directory.\n2. Do not push to the base branch directly \u2014 create a PR.\n3. Follow the project's coding conventions.\n";
|
|
24
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAuBlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,kxBA2BtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,4dAkB9B,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded template strings used by `mx-agent init`.
|
|
3
|
+
*
|
|
4
|
+
* These are inline string constants — no file bundling, no network calls.
|
|
5
|
+
* They provide minimal-but-valid stubs that a user can customise after init.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Minimal settings.json for Claude Code agent permissions.
|
|
9
|
+
* Grants bash access and restricts to the worktree directory.
|
|
10
|
+
*/
|
|
11
|
+
export const SETTINGS_JSON_TEMPLATE = JSON.stringify({
|
|
12
|
+
permissions: {
|
|
13
|
+
allow: [
|
|
14
|
+
'Bash(*)',
|
|
15
|
+
'Read(*)',
|
|
16
|
+
'Write(*)',
|
|
17
|
+
'Edit(*)',
|
|
18
|
+
'Glob(*)',
|
|
19
|
+
'Grep(*)',
|
|
20
|
+
],
|
|
21
|
+
deny: [
|
|
22
|
+
'Bash(git checkout main)',
|
|
23
|
+
'Bash(git checkout master)',
|
|
24
|
+
'Bash(git push origin main)',
|
|
25
|
+
'Bash(git push origin master)',
|
|
26
|
+
'Bash(git switch main)',
|
|
27
|
+
'Bash(git switch master)',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
}, null, 2);
|
|
31
|
+
/**
|
|
32
|
+
* Stub worktree-guard.sh hook.
|
|
33
|
+
* Blocks branch switching to main and force-pushes.
|
|
34
|
+
*/
|
|
35
|
+
export const WORKTREE_GUARD_SH_TEMPLATE = `#!/usr/bin/env bash
|
|
36
|
+
# worktree-guard.sh — Claude Code PreToolUse hook
|
|
37
|
+
# Blocks dangerous git operations in worktrees.
|
|
38
|
+
# Customise this file for your project's safety requirements.
|
|
39
|
+
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
|
|
42
|
+
TOOL_NAME="\${CLAUDE_TOOL_NAME:-}"
|
|
43
|
+
TOOL_INPUT="\${CLAUDE_TOOL_INPUT:-}"
|
|
44
|
+
|
|
45
|
+
if [[ "\$TOOL_NAME" != "Bash" ]]; then
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Block checkout/switch to base branch
|
|
50
|
+
if echo "\$TOOL_INPUT" | grep -qE 'git (checkout|switch) (main|master|develop)'; then
|
|
51
|
+
echo "Blocked: cannot switch to base branch from a worktree." >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Block force push to base branch
|
|
56
|
+
if echo "\$TOOL_INPUT" | grep -qE 'git push .*(--force|-f).*(main|master|develop)'; then
|
|
57
|
+
echo "Blocked: force push to base branch is not allowed." >&2
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
exit 0
|
|
62
|
+
`;
|
|
63
|
+
/**
|
|
64
|
+
* Stub CLAUDE.md.template — the template that gets deployed into each worktree
|
|
65
|
+
* as CLAUDE.md when running mx-agent create / mx-agent start.
|
|
66
|
+
*
|
|
67
|
+
* Users should replace this with project-specific instructions.
|
|
68
|
+
*/
|
|
69
|
+
export const CLAUDE_MD_TEMPLATE = `# Agent Instructions
|
|
70
|
+
|
|
71
|
+
This file is deployed automatically into each agent worktree by \`mx-agent\`.
|
|
72
|
+
Replace the contents below with your project-specific agent instructions.
|
|
73
|
+
|
|
74
|
+
## Project Overview
|
|
75
|
+
|
|
76
|
+
<!-- Describe your project here -->
|
|
77
|
+
|
|
78
|
+
## Workflow
|
|
79
|
+
|
|
80
|
+
<!-- Describe the expected workflow for agents -->
|
|
81
|
+
|
|
82
|
+
## Rules
|
|
83
|
+
|
|
84
|
+
1. Stay within your worktree directory.
|
|
85
|
+
2. Do not push to the base branch directly — create a PR.
|
|
86
|
+
3. Follow the project's coding conventions.
|
|
87
|
+
`;
|
|
88
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAClD;IACE,WAAW,EAAE;QACX,KAAK,EAAE;YACL,SAAS;YACT,SAAS;YACT,UAAU;YACV,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,IAAI,EAAE;YACJ,yBAAyB;YACzB,2BAA2B;YAC3B,4BAA4B;YAC5B,8BAA8B;YAC9B,uBAAuB;YACvB,yBAAyB;SAC1B;KACF;CACF,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BzC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;CAkBjC,CAAC"}
|
package/dist/lib/worktree.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function findProjectRoot(): string;
|
|
6
6
|
type SlotMap = Record<string, number>;
|
|
7
|
-
export declare function loadSlots(projectRoot: string): SlotMap;
|
|
8
|
-
export declare function assignSlot(projectRoot: string, worktreeName: string, maxWorktrees?: number): number;
|
|
9
|
-
export declare function getSlot(projectRoot: string, worktreeName: string): number | null;
|
|
7
|
+
export declare function loadSlots(projectRoot: string, worktreeDir?: string): SlotMap;
|
|
8
|
+
export declare function assignSlot(projectRoot: string, worktreeName: string, worktreeDir?: string, maxWorktrees?: number): number;
|
|
9
|
+
export declare function getSlot(projectRoot: string, worktreeName: string, worktreeDir?: string): number | null;
|
|
10
10
|
export declare function getCurrentBranch(cwd: string): string | null;
|
|
11
11
|
export declare function fetchOrigin(cwd: string): void;
|
|
12
12
|
/**
|
|
@@ -35,8 +35,8 @@ export declare function generateBranchName(teamSlug: string): string;
|
|
|
35
35
|
export declare function generateWorktreeDirName(teamSlug: string): string;
|
|
36
36
|
/**
|
|
37
37
|
* Find the worktree directory for a team.
|
|
38
|
-
* Looks for an exact match `<name>` or a prefix match `<name>-*` under
|
|
38
|
+
* Looks for an exact match `<name>` or a prefix match `<name>-*` under worktreeDir/.
|
|
39
39
|
*/
|
|
40
|
-
export declare function findWorktreePath(projectRoot: string, teamName: string): string | null;
|
|
40
|
+
export declare function findWorktreePath(projectRoot: string, teamName: string, worktreeDir?: string): string | null;
|
|
41
41
|
export {};
|
|
42
42
|
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/lib/worktree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH,wBAAgB,eAAe,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/lib/worktree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH,wBAAgB,eAAe,IAAI,MAAM,CAwBxC;AAMD,KAAK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