loadouts 0.1.12 → 0.1.14
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/cli/commands/activate.d.ts.map +1 -1
- package/dist/cli/commands/activate.js +7 -1
- package/dist/cli/commands/activate.js.map +1 -1
- package/dist/cli/commands/create.js +2 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/deactivate.d.ts.map +1 -1
- package/dist/cli/commands/deactivate.js +7 -1
- package/dist/cli/commands/deactivate.js.map +1 -1
- package/dist/cli/commands/info.d.ts +1 -0
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +83 -6
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +5 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +3 -5
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts +2 -2
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +90 -30
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/rule.d.ts.map +1 -1
- package/dist/cli/commands/rule.js +11 -16
- package/dist/cli/commands/rule.js.map +1 -1
- package/dist/cli/commands/skill.d.ts.map +1 -1
- package/dist/cli/commands/skill.js +11 -16
- package/dist/cli/commands/skill.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +32 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/core/discovery.d.ts +27 -0
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +58 -0
- package/dist/core/discovery.js.map +1 -1
- package/dist/core/manifest.d.ts.map +1 -1
- package/dist/core/manifest.js +1 -7
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/render.d.ts +0 -1
- package/dist/core/render.d.ts.map +1 -1
- package/dist/core/render.js +44 -92
- package/dist/core/render.js.map +1 -1
- package/dist/core/scope.d.ts +0 -3
- package/dist/core/scope.d.ts.map +1 -1
- package/dist/core/scope.js +16 -14
- package/dist/core/scope.js.map +1 -1
- package/dist/core/types.d.ts +0 -6
- package/dist/core/types.d.ts.map +1 -1
- package/dist/lib/fs.d.ts +4 -5
- package/dist/lib/fs.d.ts.map +1 -1
- package/dist/lib/fs.js +20 -22
- package/dist/lib/fs.js.map +1 -1
- package/dist/lib/gitignore.d.ts +48 -20
- package/dist/lib/gitignore.d.ts.map +1 -1
- package/dist/lib/gitignore.js +178 -84
- package/dist/lib/gitignore.js.map +1 -1
- package/dist/lib/scope-indicators.d.ts +6 -0
- package/dist/lib/scope-indicators.d.ts.map +1 -1
- package/dist/lib/scope-indicators.js +12 -2
- package/dist/lib/scope-indicators.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/lib/fs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGjE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMnD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM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cvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiB/C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAGnD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,MAAM,EAAE,CAEV;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBjD"}
|
package/dist/lib/fs.js
CHANGED
|
@@ -65,27 +65,6 @@ export function readSymlinkTarget(linkPath) {
|
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if any parent directory in a path is a symlink.
|
|
70
|
-
* Returns the first symlinked parent path, or null if none.
|
|
71
|
-
*/
|
|
72
|
-
export function findSymlinkParent(filePath) {
|
|
73
|
-
const parts = filePath.split(path.sep).filter(Boolean);
|
|
74
|
-
let current = filePath.startsWith(path.sep) ? path.sep : "";
|
|
75
|
-
// Check all parents except the final component (which may legitimately be a symlink)
|
|
76
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
77
|
-
current = path.join(current, parts[i]);
|
|
78
|
-
try {
|
|
79
|
-
if (fs.lstatSync(current).isSymbolicLink()) {
|
|
80
|
-
return current;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
// Path doesn't exist yet, that's fine
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
68
|
/**
|
|
90
69
|
* Create a symlink (relative if possible).
|
|
91
70
|
* Idempotent: if symlink already exists with correct target, does nothing.
|
|
@@ -116,9 +95,14 @@ export function createSymlink(target, linkPath) {
|
|
|
116
95
|
* Remove a file or symlink.
|
|
117
96
|
*/
|
|
118
97
|
export function removeFile(filePath) {
|
|
119
|
-
|
|
98
|
+
try {
|
|
120
99
|
fs.unlinkSync(filePath);
|
|
121
100
|
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error.code !== "ENOENT") {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
122
106
|
}
|
|
123
107
|
/**
|
|
124
108
|
* Remove a directory recursively.
|
|
@@ -128,6 +112,20 @@ export function removeDir(dirPath) {
|
|
|
128
112
|
fs.rmSync(dirPath, { recursive: true });
|
|
129
113
|
}
|
|
130
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Remove a filesystem path, handling symlinks safely.
|
|
117
|
+
*/
|
|
118
|
+
export function removePath(targetPath) {
|
|
119
|
+
if (isSymlink(targetPath)) {
|
|
120
|
+
removeFile(targetPath);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (isDirectory(targetPath)) {
|
|
124
|
+
removeDir(targetPath);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
removeFile(targetPath);
|
|
128
|
+
}
|
|
131
129
|
/**
|
|
132
130
|
* Copy a file.
|
|
133
131
|
*/
|
package/dist/lib/fs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/lib/fs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,EAA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AAe;IACrC,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,SAAS,IAAI,CAAC,GAAW,EAAE,MAAc;QACvC,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;YACzE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/lib/gitignore.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gitignore management —
|
|
2
|
+
* Gitignore management — per-target .gitignore files.
|
|
3
|
+
*
|
|
4
|
+
* Each tool's output directory (e.g., .claude/, .cursor/) gets its own
|
|
5
|
+
* .gitignore with paths relative to that directory. This ensures:
|
|
6
|
+
*
|
|
7
|
+
* - All artifacts are ignored regardless of activation state
|
|
8
|
+
* - Global scope is supported (same mechanism, absolute target dirs)
|
|
9
|
+
* - The project root .gitignore is not cluttered with tool-specific paths
|
|
10
|
+
*
|
|
11
|
+
* Gitignore is part of the artifact lifecycle (add/delete/import), not the
|
|
12
|
+
* render pipeline. Updates happen when artifacts are created or removed,
|
|
13
|
+
* not when loadouts are activated or synced.
|
|
3
14
|
*
|
|
4
15
|
* Uses markers to identify the managed section:
|
|
5
16
|
* # <loadouts>
|
|
@@ -8,36 +19,53 @@
|
|
|
8
19
|
*/
|
|
9
20
|
import type { Scope } from "../core/types.js";
|
|
10
21
|
/**
|
|
11
|
-
* Update .gitignore
|
|
22
|
+
* Update .gitignore within a specific target directory.
|
|
12
23
|
*
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* - Preserves all user content outside the markers
|
|
16
|
-
* - Removes the section entirely if managedPaths is empty
|
|
24
|
+
* @param targetDir - Absolute path to the target directory (e.g., /project/.claude or ~/.claude)
|
|
25
|
+
* @param relativePaths - Paths relative to targetDir (e.g., ["rules/foo.md", "skills/bar/"])
|
|
17
26
|
*/
|
|
18
|
-
export declare function
|
|
27
|
+
export declare function updateTargetGitignore(targetDir: string, relativePaths: string[]): void;
|
|
19
28
|
/**
|
|
20
|
-
*
|
|
29
|
+
* Update .loadouts/.gitignore with state file entries.
|
|
30
|
+
* Always includes .state.json and .fallback-applied.
|
|
21
31
|
*/
|
|
22
|
-
export declare function
|
|
32
|
+
export declare function updateLoadoutsGitignore(loadoutsDir: string): void;
|
|
23
33
|
/**
|
|
24
|
-
*
|
|
34
|
+
* Compute gitignore paths for an artifact, grouped by target directory.
|
|
35
|
+
*
|
|
36
|
+
* Returns a Map of targetBase (as stored in tool.basePath[scope]) →
|
|
37
|
+
* relative paths within that directory.
|
|
38
|
+
*
|
|
39
|
+
* Instruction artifacts (CLAUDE.md, AGENTS.md) that resolve outside the
|
|
40
|
+
* tool's base directory are automatically excluded.
|
|
25
41
|
*/
|
|
26
|
-
export declare function
|
|
42
|
+
export declare function computeArtifactGitignorePaths(kindId: string, artifactName: string, scope?: Scope): Map<string, string[]>;
|
|
27
43
|
/**
|
|
28
|
-
*
|
|
44
|
+
* Rebuild gitignore entries for all artifacts in the loadouts directory.
|
|
45
|
+
*
|
|
46
|
+
* Scans all rules and skills and writes per-target .gitignore files so that
|
|
47
|
+
* every artifact is ignored regardless of whether it is currently activated.
|
|
48
|
+
* Called after artifact add/delete/import.
|
|
29
49
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
50
|
+
* @param loadoutsDir - Absolute path to .loadouts/ or ~/.config/loadouts/
|
|
51
|
+
* @param projectRoot - Project root for resolving relative target paths
|
|
52
|
+
* (unused for global scope since all paths are absolute)
|
|
53
|
+
* @param scope - "project" or "global"
|
|
32
54
|
*/
|
|
33
|
-
export declare function
|
|
55
|
+
export declare function rebuildAllGitignores(loadoutsDir: string, projectRoot: string, scope: Scope): void;
|
|
34
56
|
/**
|
|
35
|
-
*
|
|
36
|
-
* Merges with existing managed paths rather than replacing.
|
|
57
|
+
* Get the current managed paths from a target directory's .gitignore.
|
|
37
58
|
*/
|
|
38
|
-
export declare function
|
|
59
|
+
export declare function getManagedPathsFromTarget(targetDir: string): string[];
|
|
39
60
|
/**
|
|
40
|
-
* Remove
|
|
61
|
+
* Remove the legacy loadouts-managed section from the project root .gitignore.
|
|
62
|
+
* Handles both old (# <loadout>) and current (# <loadouts>) markers.
|
|
63
|
+
* Used by the `update` command to migrate from the old single-file approach.
|
|
41
64
|
*/
|
|
42
|
-
export declare function
|
|
65
|
+
export declare function removeLegacyRootGitignoreSection(projectRoot: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Use getManagedPathsFromTarget instead.
|
|
68
|
+
* Still used by the update command to detect whether migration is needed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getManagedPaths(projectRoot: string): string[];
|
|
43
71
|
//# sourceMappingURL=gitignore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAmE9C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EAAE,GACtB,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAEjE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,KAAiB,GACvB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAsDvB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,KAAK,GACX,IAAI,CA2BN;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAErE;AAsBD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAe1E;AAqCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D"}
|
package/dist/lib/gitignore.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gitignore management —
|
|
2
|
+
* Gitignore management — per-target .gitignore files.
|
|
3
|
+
*
|
|
4
|
+
* Each tool's output directory (e.g., .claude/, .cursor/) gets its own
|
|
5
|
+
* .gitignore with paths relative to that directory. This ensures:
|
|
6
|
+
*
|
|
7
|
+
* - All artifacts are ignored regardless of activation state
|
|
8
|
+
* - Global scope is supported (same mechanism, absolute target dirs)
|
|
9
|
+
* - The project root .gitignore is not cluttered with tool-specific paths
|
|
10
|
+
*
|
|
11
|
+
* Gitignore is part of the artifact lifecycle (add/delete/import), not the
|
|
12
|
+
* render pipeline. Updates happen when artifacts are created or removed,
|
|
13
|
+
* not when loadouts are activated or synced.
|
|
3
14
|
*
|
|
4
15
|
* Uses markers to identify the managed section:
|
|
5
16
|
* # <loadouts>
|
|
@@ -8,40 +19,36 @@
|
|
|
8
19
|
*/
|
|
9
20
|
import * as path from "node:path";
|
|
10
21
|
import * as os from "node:os";
|
|
11
|
-
import { fileExists, readFile, writeFile } from "./fs.js";
|
|
22
|
+
import { fileExists, readFile, writeFile, listFiles, listFilesWithExtension, isDirectory, } from "./fs.js";
|
|
12
23
|
import { registry } from "../core/registry.js";
|
|
13
24
|
import { expandTemplate } from "../core/template.js";
|
|
14
25
|
const START_MARKER = "# <loadouts>";
|
|
15
26
|
const END_MARKER = "# </loadouts>";
|
|
16
27
|
const HEADER_COMMENT = "# Auto-generated by loadouts. Do not edit this section.";
|
|
28
|
+
// Legacy markers from old naming convention
|
|
29
|
+
const LEGACY_START_MARKER = "# <loadout>";
|
|
30
|
+
const LEGACY_END_MARKER = "# </loadout>";
|
|
31
|
+
// Paths always ignored within .loadouts/
|
|
32
|
+
const LOADOUTS_STATE_PATHS = [".fallback-applied", ".state.json"];
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Core write function
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
17
36
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - Creates .gitignore if it doesn't exist
|
|
21
|
-
* - Adds or updates the managed section between markers
|
|
22
|
-
* - Preserves all user content outside the markers
|
|
23
|
-
* - Removes the section entirely if managedPaths is empty
|
|
37
|
+
* Low-level: write the managed section to a specific .gitignore file path.
|
|
24
38
|
*/
|
|
25
|
-
|
|
26
|
-
const gitignorePath = path.join(projectRoot, ".gitignore");
|
|
27
|
-
// Always include the state file
|
|
28
|
-
const allPaths = [".loadouts/.state.json", ".loadouts/.fallback-applied", ...managedPaths];
|
|
39
|
+
function updateGitignoreFile(gitignorePath, managedPaths) {
|
|
29
40
|
// Sort and deduplicate
|
|
30
|
-
const uniquePaths = [...new Set(
|
|
31
|
-
// Build the managed section content
|
|
41
|
+
const uniquePaths = [...new Set(managedPaths)].sort();
|
|
32
42
|
const managedSection = uniquePaths.length > 0
|
|
33
43
|
? `${START_MARKER}\n${HEADER_COMMENT}\n${uniquePaths.join("\n")}\n${END_MARKER}`
|
|
34
44
|
: "";
|
|
35
45
|
if (!fileExists(gitignorePath)) {
|
|
36
|
-
// Create new .gitignore with just the managed section
|
|
37
46
|
if (managedSection) {
|
|
38
47
|
writeFile(gitignorePath, managedSection + "\n");
|
|
39
48
|
}
|
|
40
49
|
return;
|
|
41
50
|
}
|
|
42
|
-
// Read existing content
|
|
43
51
|
const content = readFile(gitignorePath);
|
|
44
|
-
// Find existing managed section
|
|
45
52
|
const startIdx = content.indexOf(START_MARKER);
|
|
46
53
|
const endIdx = content.indexOf(END_MARKER);
|
|
47
54
|
if (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {
|
|
@@ -49,21 +56,17 @@ export function updateGitignore(projectRoot, managedPaths) {
|
|
|
49
56
|
const before = content.slice(0, startIdx).trimEnd();
|
|
50
57
|
const after = content.slice(endIdx + END_MARKER.length).trimStart();
|
|
51
58
|
const parts = [before];
|
|
52
|
-
if (managedSection)
|
|
59
|
+
if (managedSection)
|
|
53
60
|
parts.push(managedSection);
|
|
54
|
-
|
|
55
|
-
if (after) {
|
|
61
|
+
if (after)
|
|
56
62
|
parts.push(after);
|
|
57
|
-
}
|
|
58
|
-
// Join with appropriate newlines
|
|
59
63
|
let newContent = parts.filter(Boolean).join("\n\n");
|
|
60
|
-
if (!newContent.endsWith("\n"))
|
|
64
|
+
if (!newContent.endsWith("\n"))
|
|
61
65
|
newContent += "\n";
|
|
62
|
-
}
|
|
63
66
|
writeFile(gitignorePath, newContent);
|
|
64
67
|
}
|
|
65
68
|
else {
|
|
66
|
-
// No existing section — append
|
|
69
|
+
// No existing section — append
|
|
67
70
|
if (!managedSection)
|
|
68
71
|
return;
|
|
69
72
|
let newContent = content.trimEnd();
|
|
@@ -71,53 +74,52 @@ export function updateGitignore(projectRoot, managedPaths) {
|
|
|
71
74
|
writeFile(gitignorePath, newContent);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Public write functions
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
74
80
|
/**
|
|
75
|
-
*
|
|
81
|
+
* Update .gitignore within a specific target directory.
|
|
82
|
+
*
|
|
83
|
+
* @param targetDir - Absolute path to the target directory (e.g., /project/.claude or ~/.claude)
|
|
84
|
+
* @param relativePaths - Paths relative to targetDir (e.g., ["rules/foo.md", "skills/bar/"])
|
|
76
85
|
*/
|
|
77
|
-
export function
|
|
78
|
-
|
|
86
|
+
export function updateTargetGitignore(targetDir, relativePaths) {
|
|
87
|
+
updateGitignoreFile(path.join(targetDir, ".gitignore"), relativePaths);
|
|
79
88
|
}
|
|
80
89
|
/**
|
|
81
|
-
*
|
|
90
|
+
* Update .loadouts/.gitignore with state file entries.
|
|
91
|
+
* Always includes .state.json and .fallback-applied.
|
|
82
92
|
*/
|
|
83
|
-
export function
|
|
84
|
-
|
|
85
|
-
if (!fileExists(gitignorePath)) {
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
const content = readFile(gitignorePath);
|
|
89
|
-
const startIdx = content.indexOf(START_MARKER);
|
|
90
|
-
const endIdx = content.indexOf(END_MARKER);
|
|
91
|
-
if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx) {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
const section = content.slice(startIdx + START_MARKER.length, endIdx);
|
|
95
|
-
return section
|
|
96
|
-
.split("\n")
|
|
97
|
-
.map((line) => line.trim())
|
|
98
|
-
.filter((line) => line && !line.startsWith("#"));
|
|
93
|
+
export function updateLoadoutsGitignore(loadoutsDir) {
|
|
94
|
+
updateGitignoreFile(path.join(loadoutsDir, ".gitignore"), LOADOUTS_STATE_PATHS);
|
|
99
95
|
}
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// Path computation
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
100
99
|
/**
|
|
101
|
-
* Compute
|
|
100
|
+
* Compute gitignore paths for an artifact, grouped by target directory.
|
|
101
|
+
*
|
|
102
|
+
* Returns a Map of targetBase (as stored in tool.basePath[scope]) →
|
|
103
|
+
* relative paths within that directory.
|
|
102
104
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
+
* Instruction artifacts (CLAUDE.md, AGENTS.md) that resolve outside the
|
|
106
|
+
* tool's base directory are automatically excluded.
|
|
105
107
|
*/
|
|
106
108
|
export function computeArtifactGitignorePaths(kindId, artifactName, scope = "project") {
|
|
107
109
|
const kind = registry.getKind(kindId);
|
|
108
110
|
if (!kind)
|
|
109
|
-
return
|
|
110
|
-
const
|
|
111
|
+
return new Map();
|
|
112
|
+
const byTarget = new Map();
|
|
111
113
|
for (const tool of registry.allTools()) {
|
|
114
|
+
if (!tool.supports.includes(kindId))
|
|
115
|
+
continue;
|
|
112
116
|
const mapping = registry.resolveMapping(tool.name, kindId);
|
|
113
117
|
if (!mapping)
|
|
114
118
|
continue;
|
|
115
|
-
|
|
116
|
-
// For dir-layout kinds, {name} and {stem} are the directory name
|
|
117
|
-
// For file-layout kinds, we need to include the extension
|
|
119
|
+
const targetBase = tool.basePath[scope];
|
|
118
120
|
const ext = mapping.ext ?? (kind.layout === "file" ? ".md" : "");
|
|
119
121
|
const vars = {
|
|
120
|
-
base:
|
|
122
|
+
base: targetBase,
|
|
121
123
|
home: os.homedir(),
|
|
122
124
|
stem: artifactName,
|
|
123
125
|
ext,
|
|
@@ -125,49 +127,141 @@ export function computeArtifactGitignorePaths(kindId, artifactName, scope = "pro
|
|
|
125
127
|
relative: `${kindId}s/${artifactName}${ext}`,
|
|
126
128
|
kind: kindId,
|
|
127
129
|
};
|
|
128
|
-
|
|
129
|
-
const pathTemplate = typeof mapping.path === "string"
|
|
130
|
-
? mapping.path
|
|
131
|
-
: mapping.path[scope];
|
|
130
|
+
const pathTemplate = typeof mapping.path === "string" ? mapping.path : mapping.path[scope];
|
|
132
131
|
try {
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
const expandedPath = expandTemplate(pathTemplate, scope, vars);
|
|
133
|
+
// Compute the relative path within the target directory
|
|
134
|
+
const relPath = path.relative(targetBase, expandedPath);
|
|
135
|
+
// Skip if the path escapes the target directory (e.g., instruction
|
|
136
|
+
// artifacts that expand to CLAUDE.md or AGENTS.md at the project root)
|
|
137
|
+
if (relPath.startsWith(".."))
|
|
138
|
+
continue;
|
|
139
|
+
const existing = byTarget.get(targetBase) ?? [];
|
|
140
|
+
if (kind.layout === "dir") {
|
|
141
|
+
// Dir-layout: use trailing slash so all files within are covered
|
|
142
|
+
existing.push(relPath.endsWith("/") ? relPath : relPath + "/");
|
|
137
143
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
paths.push(targetPath);
|
|
144
|
+
else {
|
|
145
|
+
existing.push(relPath);
|
|
141
146
|
}
|
|
147
|
+
byTarget.set(targetBase, existing);
|
|
142
148
|
}
|
|
143
149
|
catch {
|
|
144
|
-
// Skip if template expansion fails
|
|
145
|
-
continue;
|
|
150
|
+
// Skip if template expansion fails
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
|
-
return
|
|
153
|
+
return byTarget;
|
|
149
154
|
}
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// Rebuild
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
150
158
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
159
|
+
* Rebuild gitignore entries for all artifacts in the loadouts directory.
|
|
160
|
+
*
|
|
161
|
+
* Scans all rules and skills and writes per-target .gitignore files so that
|
|
162
|
+
* every artifact is ignored regardless of whether it is currently activated.
|
|
163
|
+
* Called after artifact add/delete/import.
|
|
164
|
+
*
|
|
165
|
+
* @param loadoutsDir - Absolute path to .loadouts/ or ~/.config/loadouts/
|
|
166
|
+
* @param projectRoot - Project root for resolving relative target paths
|
|
167
|
+
* (unused for global scope since all paths are absolute)
|
|
168
|
+
* @param scope - "project" or "global"
|
|
153
169
|
*/
|
|
154
|
-
export function
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
170
|
+
export function rebuildAllGitignores(loadoutsDir, projectRoot, scope) {
|
|
171
|
+
const rulesDir = path.join(loadoutsDir, "rules");
|
|
172
|
+
const skillsDir = path.join(loadoutsDir, "skills");
|
|
173
|
+
// Collect all paths grouped by target base
|
|
174
|
+
const allByTarget = new Map();
|
|
175
|
+
// Rules
|
|
176
|
+
for (const file of listFilesWithExtension(rulesDir, ".md")) {
|
|
177
|
+
const name = file.replace(/\.md$/, "");
|
|
178
|
+
mergeIntoMap(allByTarget, computeArtifactGitignorePaths("rule", name, scope));
|
|
179
|
+
}
|
|
180
|
+
// Skills
|
|
181
|
+
for (const name of listFiles(skillsDir).filter((d) => isDirectory(path.join(skillsDir, d)))) {
|
|
182
|
+
mergeIntoMap(allByTarget, computeArtifactGitignorePaths("skill", name, scope));
|
|
183
|
+
}
|
|
184
|
+
// Write per-target .gitignore files
|
|
185
|
+
for (const [targetBase, paths] of allByTarget) {
|
|
186
|
+
const absTargetDir = path.isAbsolute(targetBase)
|
|
187
|
+
? targetBase
|
|
188
|
+
: path.join(projectRoot, targetBase);
|
|
189
|
+
updateTargetGitignore(absTargetDir, paths);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
// Read helpers
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
/**
|
|
196
|
+
* Get the current managed paths from a target directory's .gitignore.
|
|
197
|
+
*/
|
|
198
|
+
export function getManagedPathsFromTarget(targetDir) {
|
|
199
|
+
return getManagedPathsFromFile(path.join(targetDir, ".gitignore"));
|
|
200
|
+
}
|
|
201
|
+
function getManagedPathsFromFile(gitignorePath) {
|
|
202
|
+
if (!fileExists(gitignorePath))
|
|
203
|
+
return [];
|
|
204
|
+
const content = readFile(gitignorePath);
|
|
205
|
+
const startIdx = content.indexOf(START_MARKER);
|
|
206
|
+
const endIdx = content.indexOf(END_MARKER);
|
|
207
|
+
if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx)
|
|
208
|
+
return [];
|
|
209
|
+
const section = content.slice(startIdx + START_MARKER.length, endIdx);
|
|
210
|
+
return section
|
|
211
|
+
.split("\n")
|
|
212
|
+
.map((line) => line.trim())
|
|
213
|
+
.filter((line) => line && !line.startsWith("#"));
|
|
161
214
|
}
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Migration helper
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
162
218
|
/**
|
|
163
|
-
* Remove
|
|
219
|
+
* Remove the legacy loadouts-managed section from the project root .gitignore.
|
|
220
|
+
* Handles both old (# <loadout>) and current (# <loadouts>) markers.
|
|
221
|
+
* Used by the `update` command to migrate from the old single-file approach.
|
|
164
222
|
*/
|
|
165
|
-
export function
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
223
|
+
export function removeLegacyRootGitignoreSection(projectRoot) {
|
|
224
|
+
const gitignorePath = path.join(projectRoot, ".gitignore");
|
|
225
|
+
if (!fileExists(gitignorePath))
|
|
168
226
|
return;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
227
|
+
let content = readFile(gitignorePath);
|
|
228
|
+
// Remove both new and old marker sections
|
|
229
|
+
content = removeMarkerSection(content, START_MARKER, END_MARKER);
|
|
230
|
+
content = removeMarkerSection(content, LEGACY_START_MARKER, LEGACY_END_MARKER);
|
|
231
|
+
// Clean up excess blank lines
|
|
232
|
+
content = content.replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
233
|
+
if (content)
|
|
234
|
+
content += "\n";
|
|
235
|
+
writeFile(gitignorePath, content || "");
|
|
236
|
+
}
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// Internal utilities
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
function removeMarkerSection(content, startMarker, endMarker) {
|
|
241
|
+
const startIdx = content.indexOf(startMarker);
|
|
242
|
+
const endIdx = content.indexOf(endMarker);
|
|
243
|
+
if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx)
|
|
244
|
+
return content;
|
|
245
|
+
const before = content.slice(0, startIdx).trimEnd();
|
|
246
|
+
const after = content.slice(endIdx + endMarker.length).trimStart();
|
|
247
|
+
if (before && after)
|
|
248
|
+
return before + "\n\n" + after;
|
|
249
|
+
return before || after;
|
|
250
|
+
}
|
|
251
|
+
function mergeIntoMap(target, source) {
|
|
252
|
+
for (const [key, values] of source) {
|
|
253
|
+
const existing = target.get(key) ?? [];
|
|
254
|
+
target.set(key, [...existing, ...values]);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// ---------------------------------------------------------------------------
|
|
258
|
+
// Deprecated — kept for migration use in update.ts
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated Use getManagedPathsFromTarget instead.
|
|
262
|
+
* Still used by the update command to detect whether migration is needed.
|
|
263
|
+
*/
|
|
264
|
+
export function getManagedPaths(projectRoot) {
|
|
265
|
+
return getManagedPathsFromFile(path.join(projectRoot, ".gitignore"));
|
|
172
266
|
}
|
|
173
267
|
//# sourceMappingURL=gitignore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":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AG,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,mDAAmD;AACnD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Symbols:
|
|
8
8
|
* • (dim) — global scope
|
|
9
9
|
* ◦ (cyan) — local/project scope
|
|
10
|
+
* ◆ (blue) — bundled (built-in)
|
|
10
11
|
* →name (yellow) — external source
|
|
11
12
|
*/
|
|
12
13
|
import type { LoadoutRoot, Scope } from "../core/types.js";
|
|
@@ -17,6 +18,8 @@ export type ScopeIndicator = {
|
|
|
17
18
|
type: "global";
|
|
18
19
|
} | {
|
|
19
20
|
type: "local";
|
|
21
|
+
} | {
|
|
22
|
+
type: "bundled";
|
|
20
23
|
} | {
|
|
21
24
|
type: "source";
|
|
22
25
|
name: string;
|
|
@@ -44,6 +47,9 @@ export declare function scopeIndicatorWidth(scope: ScopeIndicator): number;
|
|
|
44
47
|
export declare function maxScopeWidth<T extends {
|
|
45
48
|
scope: ScopeIndicator;
|
|
46
49
|
}>(items: T[]): number;
|
|
50
|
+
/**
|
|
51
|
+
* Convert a LoadoutRoot to a ScopeIndicator.
|
|
52
|
+
*/
|
|
47
53
|
export declare function rootToScope(root: LoadoutRoot): ScopeIndicator;
|
|
48
54
|
/**
|
|
49
55
|
* Determine scope indicator by matching a path against collected roots.
|