loadouts 0.1.11
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/LICENSE +201 -0
- package/README.md +108 -0
- package/bundled/loadouts/loadouts.yaml +5 -0
- package/bundled/skills/loadout-usage/SKILL.md +110 -0
- package/dist/builtins/index.d.ts +14 -0
- package/dist/builtins/index.d.ts.map +1 -0
- package/dist/builtins/index.js +58 -0
- package/dist/builtins/index.js.map +1 -0
- package/dist/builtins/kinds/extension.d.ts +3 -0
- package/dist/builtins/kinds/extension.d.ts.map +1 -0
- package/dist/builtins/kinds/extension.js +9 -0
- package/dist/builtins/kinds/extension.js.map +1 -0
- package/dist/builtins/kinds/instruction.d.ts +3 -0
- package/dist/builtins/kinds/instruction.d.ts.map +1 -0
- package/dist/builtins/kinds/instruction.js +8 -0
- package/dist/builtins/kinds/instruction.js.map +1 -0
- package/dist/builtins/kinds/prompt.d.ts +3 -0
- package/dist/builtins/kinds/prompt.d.ts.map +1 -0
- package/dist/builtins/kinds/prompt.js +8 -0
- package/dist/builtins/kinds/prompt.js.map +1 -0
- package/dist/builtins/kinds/rule.d.ts +3 -0
- package/dist/builtins/kinds/rule.d.ts.map +1 -0
- package/dist/builtins/kinds/rule.js +10 -0
- package/dist/builtins/kinds/rule.js.map +1 -0
- package/dist/builtins/kinds/skill.d.ts +3 -0
- package/dist/builtins/kinds/skill.d.ts.map +1 -0
- package/dist/builtins/kinds/skill.js +8 -0
- package/dist/builtins/kinds/skill.js.map +1 -0
- package/dist/builtins/kinds/theme.d.ts +3 -0
- package/dist/builtins/kinds/theme.d.ts.map +1 -0
- package/dist/builtins/kinds/theme.js +8 -0
- package/dist/builtins/kinds/theme.js.map +1 -0
- package/dist/builtins/tools/claude-code.d.ts +3 -0
- package/dist/builtins/tools/claude-code.d.ts.map +1 -0
- package/dist/builtins/tools/claude-code.js +30 -0
- package/dist/builtins/tools/claude-code.js.map +1 -0
- package/dist/builtins/tools/codex.d.ts +3 -0
- package/dist/builtins/tools/codex.d.ts.map +1 -0
- package/dist/builtins/tools/codex.js +17 -0
- package/dist/builtins/tools/codex.js.map +1 -0
- package/dist/builtins/tools/cursor.d.ts +3 -0
- package/dist/builtins/tools/cursor.d.ts.map +1 -0
- package/dist/builtins/tools/cursor.js +22 -0
- package/dist/builtins/tools/cursor.js.map +1 -0
- package/dist/builtins/tools/opencode.d.ts +3 -0
- package/dist/builtins/tools/opencode.d.ts.map +1 -0
- package/dist/builtins/tools/opencode.js +45 -0
- package/dist/builtins/tools/opencode.js.map +1 -0
- package/dist/builtins/tools/pi.d.ts +3 -0
- package/dist/builtins/tools/pi.d.ts.map +1 -0
- package/dist/builtins/tools/pi.js +22 -0
- package/dist/builtins/tools/pi.js.map +1 -0
- package/dist/cli/commands/activate.d.ts +12 -0
- package/dist/cli/commands/activate.d.ts.map +1 -0
- package/dist/cli/commands/activate.js +70 -0
- package/dist/cli/commands/activate.js.map +1 -0
- package/dist/cli/commands/check.d.ts +12 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +152 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/clear.d.ts +12 -0
- package/dist/cli/commands/clear.d.ts.map +1 -0
- package/dist/cli/commands/clear.js +25 -0
- package/dist/cli/commands/clear.js.map +1 -0
- package/dist/cli/commands/create.d.ts +11 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +113 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/deactivate.d.ts +12 -0
- package/dist/cli/commands/deactivate.d.ts.map +1 -0
- package/dist/cli/commands/deactivate.js +67 -0
- package/dist/cli/commands/deactivate.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +16 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +144 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +12 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +115 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/edit.d.ts +11 -0
- package/dist/cli/commands/edit.d.ts.map +1 -0
- package/dist/cli/commands/edit.js +71 -0
- package/dist/cli/commands/edit.js.map +1 -0
- package/dist/cli/commands/fallback.d.ts +9 -0
- package/dist/cli/commands/fallback.d.ts.map +1 -0
- package/dist/cli/commands/fallback.js +35 -0
- package/dist/cli/commands/fallback.js.map +1 -0
- package/dist/cli/commands/info.d.ts +23 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +314 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/init.d.ts +18 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +255 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +27 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +586 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/instructions.d.ts +8 -0
- package/dist/cli/commands/instructions.d.ts.map +1 -0
- package/dist/cli/commands/instructions.js +218 -0
- package/dist/cli/commands/instructions.js.map +1 -0
- package/dist/cli/commands/kinds.d.ts +6 -0
- package/dist/cli/commands/kinds.d.ts.map +1 -0
- package/dist/cli/commands/kinds.js +59 -0
- package/dist/cli/commands/kinds.js.map +1 -0
- package/dist/cli/commands/list.d.ts +12 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +182 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/policy.d.ts +28 -0
- package/dist/cli/commands/policy.d.ts.map +1 -0
- package/dist/cli/commands/policy.js +50 -0
- package/dist/cli/commands/policy.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +24 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +64 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/render-engine.d.ts +36 -0
- package/dist/cli/commands/render-engine.d.ts.map +1 -0
- package/dist/cli/commands/render-engine.js +177 -0
- package/dist/cli/commands/render-engine.js.map +1 -0
- package/dist/cli/commands/rule.d.ts +11 -0
- package/dist/cli/commands/rule.d.ts.map +1 -0
- package/dist/cli/commands/rule.js +302 -0
- package/dist/cli/commands/rule.js.map +1 -0
- package/dist/cli/commands/sanitize.d.ts +14 -0
- package/dist/cli/commands/sanitize.d.ts.map +1 -0
- package/dist/cli/commands/sanitize.js +62 -0
- package/dist/cli/commands/sanitize.js.map +1 -0
- package/dist/cli/commands/skill.d.ts +11 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +380 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/status.d.ts +26 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +454 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +14 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +53 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/update.d.ts +3 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +48 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +134 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config.d.ts +64 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +166 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/discovery.d.ts +50 -0
- package/dist/core/discovery.d.ts.map +1 -0
- package/dist/core/discovery.js +249 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/fallback.d.ts +23 -0
- package/dist/core/fallback.d.ts.map +1 -0
- package/dist/core/fallback.js +119 -0
- package/dist/core/fallback.js.map +1 -0
- package/dist/core/import-discovery.d.ts +56 -0
- package/dist/core/import-discovery.d.ts.map +1 -0
- package/dist/core/import-discovery.js +304 -0
- package/dist/core/import-discovery.js.map +1 -0
- package/dist/core/kindLoader.d.ts +119 -0
- package/dist/core/kindLoader.d.ts.map +1 -0
- package/dist/core/kindLoader.js +141 -0
- package/dist/core/kindLoader.js.map +1 -0
- package/dist/core/manifest.d.ts +39 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +167 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/plugin.d.ts +22 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +20 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/registry.d.ts +115 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +105 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/render.d.ts +64 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +457 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/resolve.d.ts +39 -0
- package/dist/core/resolve.d.ts.map +1 -0
- package/dist/core/resolve.js +128 -0
- package/dist/core/resolve.js.map +1 -0
- package/dist/core/schema.d.ts +308 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +81 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/core/scope.d.ts +74 -0
- package/dist/core/scope.d.ts.map +1 -0
- package/dist/core/scope.js +176 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/core/template.d.ts +32 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +32 -0
- package/dist/core/template.js.map +1 -0
- package/dist/core/tokens.d.ts +33 -0
- package/dist/core/tokens.d.ts.map +1 -0
- package/dist/core/tokens.js +97 -0
- package/dist/core/tokens.js.map +1 -0
- package/dist/core/types.d.ts +103 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/artifact-paths.d.ts +39 -0
- package/dist/lib/artifact-paths.d.ts.map +1 -0
- package/dist/lib/artifact-paths.js +83 -0
- package/dist/lib/artifact-paths.js.map +1 -0
- package/dist/lib/artifact-table.d.ts +126 -0
- package/dist/lib/artifact-table.d.ts.map +1 -0
- package/dist/lib/artifact-table.js +263 -0
- package/dist/lib/artifact-table.js.map +1 -0
- package/dist/lib/editor.d.ts +17 -0
- package/dist/lib/editor.d.ts.map +1 -0
- package/dist/lib/editor.js +33 -0
- package/dist/lib/editor.js.map +1 -0
- package/dist/lib/fs.d.ts +87 -0
- package/dist/lib/fs.d.ts.map +1 -0
- package/dist/lib/fs.js +229 -0
- package/dist/lib/fs.js.map +1 -0
- package/dist/lib/git.d.ts +13 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js +28 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/gitignore.d.ts +26 -0
- package/dist/lib/gitignore.d.ts.map +1 -0
- package/dist/lib/gitignore.js +97 -0
- package/dist/lib/gitignore.js.map +1 -0
- package/dist/lib/loadout-column.d.ts +66 -0
- package/dist/lib/loadout-column.d.ts.map +1 -0
- package/dist/lib/loadout-column.js +66 -0
- package/dist/lib/loadout-column.js.map +1 -0
- package/dist/lib/output.d.ts +15 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +32 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/scope-indicators.d.ts +60 -0
- package/dist/lib/scope-indicators.d.ts.map +1 -0
- package/dist/lib/scope-indicators.js +110 -0
- package/dist/lib/scope-indicators.js.map +1 -0
- package/docs/authoring.md +182 -0
- package/docs/commands.md +192 -0
- package/docs/concepts.md +114 -0
- package/docs/index.md +60 -0
- package/docs/quickstart.md +100 -0
- package/docs/troubleshooting.md +147 -0
- package/docs/visual-language.md +251 -0
- package/docs/workflows.md +184 -0
- package/package.json +54 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI setup with Commander
|
|
3
|
+
*
|
|
4
|
+
* All commands support scope flags:
|
|
5
|
+
* -l / --local → project scope
|
|
6
|
+
* -g / --global → global scope
|
|
7
|
+
* -a / --all → both scopes (default for status/list/sync/clear)
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
import { createRequire } from "module";
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const pkg = require("../../package.json");
|
|
13
|
+
import { initCommand } from "./commands/init.js";
|
|
14
|
+
import { activateCommand } from "./commands/activate.js";
|
|
15
|
+
import { deactivateCommand } from "./commands/deactivate.js";
|
|
16
|
+
import { syncCommand } from "./commands/sync.js";
|
|
17
|
+
import { clearCommand } from "./commands/clear.js";
|
|
18
|
+
import { removeCommand } from "./commands/remove.js";
|
|
19
|
+
import { createCommand } from "./commands/create.js";
|
|
20
|
+
import { listCommand } from "./commands/list.js";
|
|
21
|
+
import { checkCommand } from "./commands/check.js";
|
|
22
|
+
import { statusCommand } from "./commands/status.js";
|
|
23
|
+
import { ruleCommand } from "./commands/rule.js";
|
|
24
|
+
import { skillCommand } from "./commands/skill.js";
|
|
25
|
+
import { instructionsCommand } from "./commands/instructions.js";
|
|
26
|
+
import { infoCommand } from "./commands/info.js";
|
|
27
|
+
import { diffCommand } from "./commands/diff.js";
|
|
28
|
+
import { editCommand } from "./commands/edit.js";
|
|
29
|
+
import { kindsCommand } from "./commands/kinds.js";
|
|
30
|
+
import { docsCommand } from "./commands/docs.js";
|
|
31
|
+
import { sanitizeCommand } from "./commands/sanitize.js";
|
|
32
|
+
import { fallbackCommand } from "./commands/fallback.js";
|
|
33
|
+
import { installCommand } from "./commands/install.js";
|
|
34
|
+
import { updateCommand } from "./commands/update.js";
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Command groups — controls help output order and section headers
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
const COMMAND_GROUPS = [
|
|
39
|
+
{
|
|
40
|
+
title: "Active Configuration",
|
|
41
|
+
commands: [
|
|
42
|
+
infoCommand,
|
|
43
|
+
activateCommand,
|
|
44
|
+
deactivateCommand,
|
|
45
|
+
clearCommand,
|
|
46
|
+
statusCommand,
|
|
47
|
+
syncCommand,
|
|
48
|
+
sanitizeCommand,
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "Bundle Management",
|
|
53
|
+
commands: [
|
|
54
|
+
initCommand,
|
|
55
|
+
installCommand,
|
|
56
|
+
createCommand,
|
|
57
|
+
editCommand,
|
|
58
|
+
removeCommand,
|
|
59
|
+
listCommand,
|
|
60
|
+
checkCommand,
|
|
61
|
+
diffCommand,
|
|
62
|
+
fallbackCommand,
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: "Artifact Authoring",
|
|
67
|
+
commands: [
|
|
68
|
+
ruleCommand,
|
|
69
|
+
skillCommand,
|
|
70
|
+
instructionsCommand,
|
|
71
|
+
kindsCommand,
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
title: "Help",
|
|
76
|
+
commands: [
|
|
77
|
+
docsCommand,
|
|
78
|
+
updateCommand,
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
export const cli = new Command()
|
|
83
|
+
.name("loadouts")
|
|
84
|
+
.description("Composable configuration bundles for AI coding agents")
|
|
85
|
+
.version(pkg.version);
|
|
86
|
+
for (const group of COMMAND_GROUPS) {
|
|
87
|
+
for (const cmd of group.commands) {
|
|
88
|
+
cli.addCommand(cmd);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Custom help formatter — renders commands in labeled sections
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
cli.configureHelp({
|
|
95
|
+
formatHelp(cmd, helper) {
|
|
96
|
+
const termWidth = helper.padWidth(cmd, helper);
|
|
97
|
+
const helpWidth = helper.helpWidth || 80;
|
|
98
|
+
const indent = 2;
|
|
99
|
+
const sep = 2;
|
|
100
|
+
function formatItem(term, description) {
|
|
101
|
+
if (description) {
|
|
102
|
+
const fullText = `${term.padEnd(termWidth + sep)}${description}`;
|
|
103
|
+
return helper.wrap(fullText, helpWidth - indent, termWidth + sep);
|
|
104
|
+
}
|
|
105
|
+
return term;
|
|
106
|
+
}
|
|
107
|
+
function formatList(items) {
|
|
108
|
+
return items.join("\n").replace(/^/gm, " ".repeat(indent));
|
|
109
|
+
}
|
|
110
|
+
let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
|
|
111
|
+
const desc = helper.commandDescription(cmd);
|
|
112
|
+
if (desc)
|
|
113
|
+
output = output.concat([helper.wrap(desc, helpWidth, 0), ""]);
|
|
114
|
+
// Grouped commands — build a lookup by command name for membership
|
|
115
|
+
const allGrouped = new Set(COMMAND_GROUPS.flatMap((g) => g.commands.map((c) => c.name())));
|
|
116
|
+
const visibleCmds = helper.visibleCommands(cmd);
|
|
117
|
+
for (const group of COMMAND_GROUPS) {
|
|
118
|
+
const groupNames = new Set(group.commands.map((c) => c.name()));
|
|
119
|
+
const items = visibleCmds
|
|
120
|
+
.filter((c) => groupNames.has(c.name()))
|
|
121
|
+
.map((c) => formatItem(helper.subcommandTerm(c).replace(/\s*\[options\]/, ""), helper.subcommandDescription(c)));
|
|
122
|
+
if (items.length > 0) {
|
|
123
|
+
output = output.concat([`${group.title}:`, formatList(items), ""]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Options (at the bottom — commands are the primary interface)
|
|
127
|
+
const optionList = helper.visibleOptions(cmd).map((opt) => formatItem(helper.optionTerm(opt), helper.optionDescription(opt)));
|
|
128
|
+
if (optionList.length > 0) {
|
|
129
|
+
output = output.concat(["Options:", formatList(optionList), ""]);
|
|
130
|
+
}
|
|
131
|
+
return output.join("\n");
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AE,CAAC;YAC1B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse source configs and loadout definitions
|
|
3
|
+
*/
|
|
4
|
+
import { type RuleFrontmatter } from "./schema.js";
|
|
5
|
+
import type { RootConfig, LoadoutDefinition, LoadoutRoot } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Parse the root config from a .loadouts/ directory.
|
|
8
|
+
* Returns default config if file doesn't exist.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseRootConfig(loadoutRoot: string): RootConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Parse a loadout definition file.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseLoadoutDefinition(filePath: string): LoadoutDefinition;
|
|
15
|
+
/**
|
|
16
|
+
* List available loadouts in a .loadouts/ directory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function listLoadouts(loadoutRoot: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Find a loadout definition by name, searching from nearest root upward.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findLoadoutDefinition(name: string, roots: LoadoutRoot[]): {
|
|
23
|
+
definition: LoadoutDefinition;
|
|
24
|
+
rootPath: string;
|
|
25
|
+
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* Parse frontmatter from a markdown file.
|
|
28
|
+
* Returns the frontmatter object and the body content.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseFrontmatter(content: string): {
|
|
31
|
+
frontmatter: RuleFrontmatter;
|
|
32
|
+
body: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Serialize frontmatter and body back to markdown.
|
|
36
|
+
*/
|
|
37
|
+
export declare function serializeFrontmatter(frontmatter: RuleFrontmatter, body: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Sanitize rule frontmatter for maximum cross-tool compatibility.
|
|
40
|
+
*
|
|
41
|
+
* Required fields for portability:
|
|
42
|
+
* - `description` - Cursor "Apply Intelligently" routing
|
|
43
|
+
* - `paths` - Claude Code file scoping
|
|
44
|
+
* - `globs` - Cursor/OpenCode file scoping
|
|
45
|
+
*
|
|
46
|
+
* If paths/globs are set, ensures both are present and equal.
|
|
47
|
+
* If description is missing and we have a rule name, generates one.
|
|
48
|
+
*/
|
|
49
|
+
export declare function sanitizeRuleFrontmatter(frontmatter: RuleFrontmatter, ruleName?: string): RuleFrontmatter;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a rule file needs sanitization.
|
|
52
|
+
* Returns true if the file would be modified by sanitization.
|
|
53
|
+
*/
|
|
54
|
+
export declare function ruleNeedsSanitization(filePath: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sanitize a rule file in place.
|
|
57
|
+
* Returns true if the file was modified.
|
|
58
|
+
*/
|
|
59
|
+
export declare function sanitizeRuleFile(filePath: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Find all rules that need sanitization in a loadout root.
|
|
62
|
+
*/
|
|
63
|
+
export declare function findUnsanitizedRules(loadoutRoot: string): string[];
|
|
64
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,CAAC;AAKpB;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAU/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAI1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAU1D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,EAAE,GACnB;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAoB5D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IACjD,WAAW,EAAE,eAAe,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAYA;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,MAAM,GACX,MAAM,CAOR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,eAAe,EAC5B,QAAQ,CAAC,EAAE,MAAM,GAChB,eAAe,CAoBjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO/D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkB1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAalE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse source configs and loadout definitions
|
|
3
|
+
*/
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import * as yaml from "yaml";
|
|
6
|
+
import { readFile, writeFile, fileExists, isDirectory, listFiles } from "../lib/fs.js";
|
|
7
|
+
import { RootConfigSchema, LoadoutDefinitionSchema, RuleFrontmatterSchema, } from "./schema.js";
|
|
8
|
+
const ROOT_CONFIG_FILE = "loadouts.yaml";
|
|
9
|
+
const LOADOUTS_DIR = "loadouts";
|
|
10
|
+
/**
|
|
11
|
+
* Parse the root config from a .loadouts/ directory.
|
|
12
|
+
* Returns default config if file doesn't exist.
|
|
13
|
+
*/
|
|
14
|
+
export function parseRootConfig(loadoutRoot) {
|
|
15
|
+
const configPath = path.join(loadoutRoot, ROOT_CONFIG_FILE);
|
|
16
|
+
if (!fileExists(configPath)) {
|
|
17
|
+
return { version: "1" };
|
|
18
|
+
}
|
|
19
|
+
const content = readFile(configPath);
|
|
20
|
+
const parsed = yaml.parse(content);
|
|
21
|
+
return RootConfigSchema.parse(parsed);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse a loadout definition file.
|
|
25
|
+
*/
|
|
26
|
+
export function parseLoadoutDefinition(filePath) {
|
|
27
|
+
const content = readFile(filePath);
|
|
28
|
+
const parsed = yaml.parse(content);
|
|
29
|
+
return LoadoutDefinitionSchema.parse(parsed);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List available loadouts in a .loadouts/ directory.
|
|
33
|
+
*/
|
|
34
|
+
export function listLoadouts(loadoutRoot) {
|
|
35
|
+
const loadoutsDir = path.join(loadoutRoot, LOADOUTS_DIR);
|
|
36
|
+
if (!isDirectory(loadoutsDir)) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return listFiles(loadoutsDir)
|
|
40
|
+
.filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"))
|
|
41
|
+
.map((f) => f.replace(/\.ya?ml$/, ""));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Find a loadout definition by name, searching from nearest root upward.
|
|
45
|
+
*/
|
|
46
|
+
export function findLoadoutDefinition(name, roots) {
|
|
47
|
+
for (const root of roots) {
|
|
48
|
+
const yamlPath = path.join(root.path, LOADOUTS_DIR, `${name}.yaml`);
|
|
49
|
+
const ymlPath = path.join(root.path, LOADOUTS_DIR, `${name}.yml`);
|
|
50
|
+
const filePath = fileExists(yamlPath)
|
|
51
|
+
? yamlPath
|
|
52
|
+
: fileExists(ymlPath)
|
|
53
|
+
? ymlPath
|
|
54
|
+
: null;
|
|
55
|
+
if (filePath) {
|
|
56
|
+
return {
|
|
57
|
+
definition: parseLoadoutDefinition(filePath),
|
|
58
|
+
rootPath: root.path,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse frontmatter from a markdown file.
|
|
66
|
+
* Returns the frontmatter object and the body content.
|
|
67
|
+
*/
|
|
68
|
+
export function parseFrontmatter(content) {
|
|
69
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
70
|
+
if (!match) {
|
|
71
|
+
return { frontmatter: {}, body: content };
|
|
72
|
+
}
|
|
73
|
+
const [, frontmatterStr, body] = match;
|
|
74
|
+
const parsed = yaml.parse(frontmatterStr) || {};
|
|
75
|
+
const frontmatter = RuleFrontmatterSchema.parse(parsed);
|
|
76
|
+
return { frontmatter, body };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Serialize frontmatter and body back to markdown.
|
|
80
|
+
*/
|
|
81
|
+
export function serializeFrontmatter(frontmatter, body) {
|
|
82
|
+
if (Object.keys(frontmatter).length === 0) {
|
|
83
|
+
return body;
|
|
84
|
+
}
|
|
85
|
+
const frontmatterStr = yaml.stringify(frontmatter).trim();
|
|
86
|
+
return `---\n${frontmatterStr}\n---\n${body}`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Sanitize rule frontmatter for maximum cross-tool compatibility.
|
|
90
|
+
*
|
|
91
|
+
* Required fields for portability:
|
|
92
|
+
* - `description` - Cursor "Apply Intelligently" routing
|
|
93
|
+
* - `paths` - Claude Code file scoping
|
|
94
|
+
* - `globs` - Cursor/OpenCode file scoping
|
|
95
|
+
*
|
|
96
|
+
* If paths/globs are set, ensures both are present and equal.
|
|
97
|
+
* If description is missing and we have a rule name, generates one.
|
|
98
|
+
*/
|
|
99
|
+
export function sanitizeRuleFrontmatter(frontmatter, ruleName) {
|
|
100
|
+
const result = { ...frontmatter };
|
|
101
|
+
// Mirror paths <-> globs for Cursor/OpenCode compatibility
|
|
102
|
+
if (result.paths && !result.globs) {
|
|
103
|
+
result.globs = result.paths;
|
|
104
|
+
}
|
|
105
|
+
else if (result.globs && !result.paths) {
|
|
106
|
+
result.paths = result.globs;
|
|
107
|
+
}
|
|
108
|
+
// Ensure description exists for Cursor "Apply Intelligently" mode
|
|
109
|
+
if (!result.description && ruleName) {
|
|
110
|
+
// Generate a description from the rule name
|
|
111
|
+
const humanName = ruleName
|
|
112
|
+
.replace(/[-_]/g, " ")
|
|
113
|
+
.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
114
|
+
result.description = `${humanName} guidelines`;
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check if a rule file needs sanitization.
|
|
120
|
+
* Returns true if the file would be modified by sanitization.
|
|
121
|
+
*/
|
|
122
|
+
export function ruleNeedsSanitization(filePath) {
|
|
123
|
+
const content = readFile(filePath);
|
|
124
|
+
const { frontmatter } = parseFrontmatter(content);
|
|
125
|
+
const ruleName = path.basename(filePath, ".md");
|
|
126
|
+
const sanitized = sanitizeRuleFrontmatter(frontmatter, ruleName);
|
|
127
|
+
return JSON.stringify(frontmatter) !== JSON.stringify(sanitized);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Sanitize a rule file in place.
|
|
131
|
+
* Returns true if the file was modified.
|
|
132
|
+
*/
|
|
133
|
+
export function sanitizeRuleFile(filePath) {
|
|
134
|
+
const content = readFile(filePath);
|
|
135
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
136
|
+
const ruleName = path.basename(filePath, ".md");
|
|
137
|
+
const sanitized = sanitizeRuleFrontmatter(frontmatter, ruleName);
|
|
138
|
+
// Check if anything changed
|
|
139
|
+
const originalStr = JSON.stringify(frontmatter);
|
|
140
|
+
const sanitizedStr = JSON.stringify(sanitized);
|
|
141
|
+
if (originalStr === sanitizedStr) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
const newContent = serializeFrontmatter(sanitized, body);
|
|
145
|
+
writeFile(filePath, newContent);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Find all rules that need sanitization in a loadout root.
|
|
150
|
+
*/
|
|
151
|
+
export function findUnsanitizedRules(loadoutRoot) {
|
|
152
|
+
const rulesDir = path.join(loadoutRoot, "rules");
|
|
153
|
+
if (!isDirectory(rulesDir))
|
|
154
|
+
return [];
|
|
155
|
+
const unsanitized = [];
|
|
156
|
+
for (const file of listFiles(rulesDir)) {
|
|
157
|
+
if (!file.endsWith(".md"))
|
|
158
|
+
continue;
|
|
159
|
+
const rulePath = path.join(rulesDir, file);
|
|
160
|
+
if (ruleNeedsSanitization(rulePath)) {
|
|
161
|
+
unsanitized.push(file.replace(/\.md$/, ""));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return unsanitized;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AAOrB,MAAM,gBAAgB,GAAG,eAAe,CAAC;AACzC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAA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AE,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAS;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery: Find .loadouts/ directories and resolve source references
|
|
3
|
+
*/
|
|
4
|
+
import { LoadoutRoot, Scope, CommandContext } from "./types.js";
|
|
5
|
+
export declare function getGlobalConfigPath(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Discover all .loadouts/ directories from cwd up to git root.
|
|
8
|
+
* Returns them ordered from nearest (depth 0) to furthest.
|
|
9
|
+
*/
|
|
10
|
+
export declare function discoverLoadoutRoots(cwd?: string): Promise<LoadoutRoot[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Find the nearest .loadouts/ directory.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findNearestLoadoutRoot(cwd?: string): Promise<LoadoutRoot | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the project root (git root or cwd if no git).
|
|
17
|
+
*/
|
|
18
|
+
export declare function getProjectRoot(cwd?: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the command context for a given scope.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getContext(scope: Scope, cwd?: string): Promise<CommandContext>;
|
|
23
|
+
/**
|
|
24
|
+
* Get global config path if it exists.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getGlobalRoot(): LoadoutRoot | null;
|
|
27
|
+
/**
|
|
28
|
+
* Get the bundled root (ships with loadouts CLI).
|
|
29
|
+
* Contains built-in loadouts like 'loadouts' for self-documentation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getBundledRoot(): LoadoutRoot | null;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a source path relative to a .loadouts/ directory.
|
|
34
|
+
* Handles ~, relative paths, and looks for .loadouts/ within the target.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveSourcePath(sourceRef: string, fromLoadoutDir: string): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Collect all roots starting from a primary root, following sources transitively.
|
|
39
|
+
* Missing sources generate warnings but don't fail resolution.
|
|
40
|
+
*
|
|
41
|
+
* @param primaryRoot - The starting .loadouts/ directory
|
|
42
|
+
* @param includeGlobal - Whether to append the global root
|
|
43
|
+
* @param includeBundled - Whether to append the bundled root (default: true)
|
|
44
|
+
* @returns Ordered list of roots (primary first, then sources, global, bundled last)
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectRootsWithSources(primaryRoot: LoadoutRoot, includeGlobal?: boolean, includeBundled?: boolean): {
|
|
47
|
+
roots: LoadoutRoot[];
|
|
48
|
+
warnings: string[];
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/core/discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAa,MAAM,YAAY,CAAC;AAM3E,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAID;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,WAAW,EAAE,CAAC,CA0CxB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAG7B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAwBzB;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,WAAW,GAAG,IAAI,CAYlD;AAsBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,GAAG,IAAI,CASnD;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwB1F;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,aAAa,GAAE,OAAc,EAC7B,cAAc,GAAE,OAAc,GAC7B;IAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA4D9C"}
|