@patchen0518/agentbrew 1.0.2 → 1.2.0
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/README.md +101 -31
- package/dist/cli.js +175 -10
- package/dist/cli.js.map +1 -1
- package/dist/dispatcher.d.ts +18 -0
- package/dist/dispatcher.js +37 -4
- package/dist/dispatcher.js.map +1 -1
- package/dist/installer.js +4 -2
- package/dist/installer.js.map +1 -1
- package/dist/migration.js +49 -0
- package/dist/migration.js.map +1 -1
- package/dist/registry.d.ts +6 -1
- package/dist/registry.js +101 -13
- package/dist/registry.js.map +1 -1
- package/dist/router.js +21 -2
- package/dist/router.js.map +1 -1
- package/dist/state.d.ts +4 -2
- package/dist/state.js +9 -4
- package/dist/state.js.map +1 -1
- package/dist/sync.d.ts +120 -0
- package/dist/sync.js +713 -0
- package/dist/sync.js.map +1 -0
- package/dist/updater.js +2 -1
- package/dist/updater.js.map +1 -1
- package/package.json +1 -1
package/dist/state.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export interface AgentBrewState {
|
|
2
2
|
disabledPackages: string[];
|
|
3
|
+
skillsAsMcpTools?: boolean;
|
|
3
4
|
}
|
|
4
5
|
export declare function loadState(): AgentBrewState;
|
|
5
6
|
export declare function saveState(state: AgentBrewState): void;
|
|
6
|
-
export declare function enablePackage(pkgName: string):
|
|
7
|
-
export declare function disablePackage(pkgName: string):
|
|
7
|
+
export declare function enablePackage(pkgName: string): 'changed' | 'already_enabled';
|
|
8
|
+
export declare function disablePackage(pkgName: string): 'changed' | 'already_disabled';
|
|
9
|
+
export declare function getSkillsAsMcpTools(): boolean;
|
|
8
10
|
export declare function isPackageEnabled(pkgName: string, capabilityName?: string): boolean;
|
package/dist/state.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.loadState = loadState;
|
|
|
7
7
|
exports.saveState = saveState;
|
|
8
8
|
exports.enablePackage = enablePackage;
|
|
9
9
|
exports.disablePackage = disablePackage;
|
|
10
|
+
exports.getSkillsAsMcpTools = getSkillsAsMcpTools;
|
|
10
11
|
exports.isPackageEnabled = isPackageEnabled;
|
|
11
12
|
// src/state.ts
|
|
12
13
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -37,18 +38,22 @@ function enablePackage(pkgName) {
|
|
|
37
38
|
if (state.disabledPackages.includes(pkgName)) {
|
|
38
39
|
state.disabledPackages = state.disabledPackages.filter(p => p !== pkgName);
|
|
39
40
|
saveState(state);
|
|
40
|
-
return
|
|
41
|
+
return 'changed';
|
|
41
42
|
}
|
|
42
|
-
return
|
|
43
|
+
return 'already_enabled';
|
|
43
44
|
}
|
|
44
45
|
function disablePackage(pkgName) {
|
|
45
46
|
const state = loadState();
|
|
46
47
|
if (!state.disabledPackages.includes(pkgName)) {
|
|
47
48
|
state.disabledPackages.push(pkgName);
|
|
48
49
|
saveState(state);
|
|
49
|
-
return
|
|
50
|
+
return 'changed';
|
|
50
51
|
}
|
|
51
|
-
return
|
|
52
|
+
return 'already_disabled';
|
|
53
|
+
}
|
|
54
|
+
function getSkillsAsMcpTools() {
|
|
55
|
+
const state = loadState();
|
|
56
|
+
return state.skillsAsMcpTools !== false;
|
|
52
57
|
}
|
|
53
58
|
function isPackageEnabled(pkgName, capabilityName) {
|
|
54
59
|
const state = loadState();
|
package/dist/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":";;;;;AASA,8BAWC;AAED,8BAOC;AAED,sCAQC;AAED,wCAQC;AAED,kDAGC;AAED,4CASC;AAjED,eAAe;AACf,4CAAoB;AACpB,qCAAqD;AAOrD,SAAgB,SAAS;IACvB,MAAM,SAAS,GAAG,IAAA,qBAAY,GAAE,CAAC;IACjC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC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AE,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,SAAgB,mBAAmB;IACjC,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,OAAO,KAAK,CAAC,gBAAgB,KAAK,KAAK,CAAC;AAC1C,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAe,EAAE,cAAuB;IACvE,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,IAAI,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,cAAc,IAAI,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,OAAO,IAAI,cAAc,EAAE,CAAC,EAAE,CAAC;QACtF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { PackageInfo } from './registry';
|
|
2
|
+
export interface SkillEntry {
|
|
3
|
+
packageName: string;
|
|
4
|
+
skillName: string;
|
|
5
|
+
/** Absolute path to the directory containing SKILL.md */
|
|
6
|
+
skillDir: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SkillSyncResult {
|
|
10
|
+
entryName: string;
|
|
11
|
+
status: 'linked' | 'already_exists' | 'removed' | 'skipped' | 'error';
|
|
12
|
+
path?: string;
|
|
13
|
+
note?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extracts SkillEntry objects from discovered packages by scanning for SKILL.md prompts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractSkillEntries(packages: PackageInfo[]): SkillEntry[];
|
|
19
|
+
/**
|
|
20
|
+
* Symlinks each skill directory into ~/.claude/skills/<pkgName>-<skillName>
|
|
21
|
+
* so Claude Code can discover them as invocable skills.
|
|
22
|
+
*/
|
|
23
|
+
export declare function syncSkillsToClaudeCode(skills: SkillEntry[], brewRoot?: string): SkillSyncResult[];
|
|
24
|
+
/**
|
|
25
|
+
* Removes all skill symlinks previously created by syncSkillsToClaudeCode.
|
|
26
|
+
*/
|
|
27
|
+
export declare function unsyncSkillsFromClaudeCode(brewRoot?: string): SkillSyncResult[];
|
|
28
|
+
/**
|
|
29
|
+
* Registers skills with Gemini CLI by creating an agentbrew extension at
|
|
30
|
+
* ~/.gemini/extensions/agentbrew/ and symlinking each skill's directory into
|
|
31
|
+
* ~/.gemini/extensions/agentbrew/skills/<pkgName>-<skillName>.
|
|
32
|
+
*/
|
|
33
|
+
export declare function syncSkillsToGeminiCLI(skills: SkillEntry[], brewRoot?: string): SkillSyncResult[];
|
|
34
|
+
/**
|
|
35
|
+
* Removes Gemini CLI skill symlinks, the extension manifest, and the
|
|
36
|
+
* agentbrew extension entry from extension-enablement.json.
|
|
37
|
+
*/
|
|
38
|
+
export declare function unsyncSkillsFromGeminiCLI(brewRoot?: string): SkillSyncResult[];
|
|
39
|
+
/**
|
|
40
|
+
* Symlinks each skill directory into ~/.codeium/windsurf/skills/<pkgName>-<skillName>
|
|
41
|
+
* so Windsurf can discover them.
|
|
42
|
+
*/
|
|
43
|
+
export declare function syncSkillsToWindsurf(skills: SkillEntry[], brewRoot?: string): SkillSyncResult[];
|
|
44
|
+
/**
|
|
45
|
+
* Removes all Windsurf skill symlinks previously created by syncSkillsToWindsurf.
|
|
46
|
+
*/
|
|
47
|
+
export declare function unsyncSkillsFromWindsurf(brewRoot?: string): SkillSyncResult[];
|
|
48
|
+
/**
|
|
49
|
+
* Symlinks each skill directory into ~/.gemini/antigravity-cli/skills/<pkgName>-<skillName>
|
|
50
|
+
* so Antigravity CLI can auto-discover them.
|
|
51
|
+
*/
|
|
52
|
+
export declare function syncSkillsToAntigravityCLI(skills: SkillEntry[], brewRoot?: string): SkillSyncResult[];
|
|
53
|
+
/**
|
|
54
|
+
* Removes all Antigravity CLI skill symlinks previously created by syncSkillsToAntigravityCLI.
|
|
55
|
+
*/
|
|
56
|
+
export declare function unsyncSkillsFromAntigravityCLI(brewRoot?: string): SkillSyncResult[];
|
|
57
|
+
/**
|
|
58
|
+
* Removes symlinks whose targets no longer exist (e.g. after a package is uninstalled).
|
|
59
|
+
* Call after `agentbrew uninstall` to prevent stale entries.
|
|
60
|
+
*/
|
|
61
|
+
export declare function cleanOrphanSkills(brewRoot?: string): SkillSyncResult[];
|
|
62
|
+
/**
|
|
63
|
+
* Adds agentbrew to ~/.cursor/mcp.json so Cursor can discover MCP tools directly.
|
|
64
|
+
* Merges into any existing config without disturbing other servers.
|
|
65
|
+
*/
|
|
66
|
+
export declare function syncMcpServerToCursor(brewRoot?: string): SkillSyncResult[];
|
|
67
|
+
/**
|
|
68
|
+
* Removes the agentbrew entry from ~/.cursor/mcp.json.
|
|
69
|
+
* Leaves other servers intact; removes the file only if it becomes empty.
|
|
70
|
+
*/
|
|
71
|
+
export declare function unsyncMcpServerFromCursor(brewRoot?: string): SkillSyncResult[];
|
|
72
|
+
/**
|
|
73
|
+
* Writes a single skills index file to ~/.cursor/rules/agentbrew-skills-index.md
|
|
74
|
+
* listing all AgentBrew skills with paths for on-demand discovery.
|
|
75
|
+
* Does NOT copy individual SKILL.md files — Cursor rules are always-on context.
|
|
76
|
+
*/
|
|
77
|
+
export declare function syncSkillsToCursor(skills: SkillEntry[], brewRoot?: string): SkillSyncResult[];
|
|
78
|
+
/**
|
|
79
|
+
* Removes the AgentBrew skills index file from ~/.cursor/rules/.
|
|
80
|
+
*/
|
|
81
|
+
export declare function unsyncSkillsFromCursor(brewRoot?: string): SkillSyncResult[];
|
|
82
|
+
export declare const MARKER_START = "<!-- agentbrew:shared:start -->";
|
|
83
|
+
export declare const MARKER_END = "<!-- agentbrew:shared:end -->";
|
|
84
|
+
export declare const INSTRUCTIONS_FILE = "INSTRUCTIONS.md";
|
|
85
|
+
export interface AgentTarget {
|
|
86
|
+
name: string;
|
|
87
|
+
/** Absolute path to the agent's global config file. null = UI-managed; print manual instructions instead. */
|
|
88
|
+
configPath: string | null;
|
|
89
|
+
/** When true, agentbrew owns the entire file (no markers needed; overwrite entirely). */
|
|
90
|
+
isFileOwned: boolean;
|
|
91
|
+
/** Shown in sync output when configPath is null. */
|
|
92
|
+
manualInstructions?: string;
|
|
93
|
+
}
|
|
94
|
+
export declare function getDefaultTargets(): AgentTarget[];
|
|
95
|
+
export declare function getInstructionsPath(brewRoot?: string): string;
|
|
96
|
+
export declare function buildInjectedSection(content: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Injects (or updates) the agentbrew section in a file.
|
|
99
|
+
* Creates the file and any parent directories if they don't exist.
|
|
100
|
+
*/
|
|
101
|
+
export declare function injectIntoFile(filePath: string, content: string): 'created' | 'updated' | 'unchanged';
|
|
102
|
+
/**
|
|
103
|
+
* Removes the agentbrew section from a file, leaving surrounding content intact.
|
|
104
|
+
*/
|
|
105
|
+
export declare function removeFromFile(filePath: string): 'removed' | 'not_found' | 'no_section';
|
|
106
|
+
export interface SyncResult {
|
|
107
|
+
agent: string;
|
|
108
|
+
status: 'created' | 'updated' | 'unchanged' | 'skipped' | 'manual' | 'removed' | 'not_found' | 'no_section';
|
|
109
|
+
path?: string;
|
|
110
|
+
note?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Syncs ~/.agentbrew/INSTRUCTIONS.md into each target agent's global config file.
|
|
114
|
+
* Accepts an optional `targets` override (used in tests).
|
|
115
|
+
*/
|
|
116
|
+
export declare function syncInstructions(targets?: AgentTarget[], brewRoot?: string): SyncResult[];
|
|
117
|
+
/**
|
|
118
|
+
* Removes the agentbrew section from all target agent config files.
|
|
119
|
+
*/
|
|
120
|
+
export declare function unsyncInstructions(targets?: AgentTarget[]): SyncResult[];
|