mcpocket 0.1.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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +35 -0
- package/dist/cli.js.map +1 -0
- package/dist/clients/claude-code.d.ts +6 -0
- package/dist/clients/claude-code.d.ts.map +1 -0
- package/dist/clients/claude-code.js +80 -0
- package/dist/clients/claude-code.js.map +1 -0
- package/dist/clients/claude-desktop.d.ts +5 -0
- package/dist/clients/claude-desktop.d.ts.map +1 -0
- package/dist/clients/claude-desktop.js +78 -0
- package/dist/clients/claude-desktop.js.map +1 -0
- package/dist/clients/opencode.d.ts +5 -0
- package/dist/clients/opencode.d.ts.map +1 -0
- package/dist/clients/opencode.js +79 -0
- package/dist/clients/opencode.js.map +1 -0
- package/dist/clients/types.d.ts +29 -0
- package/dist/clients/types.d.ts.map +1 -0
- package/dist/clients/types.js +3 -0
- package/dist/clients/types.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +71 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/pull.d.ts +2 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +143 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +112 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +128 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +67 -0
- package/dist/config.js.map +1 -0
- package/dist/storage/github.d.ts +19 -0
- package/dist/storage/github.d.ts.map +1 -0
- package/dist/storage/github.js +168 -0
- package/dist/storage/github.js.map +1 -0
- package/dist/sync/agents.d.ts +5 -0
- package/dist/sync/agents.d.ts.map +1 -0
- package/dist/sync/agents.js +97 -0
- package/dist/sync/agents.js.map +1 -0
- package/dist/sync/mcp.d.ts +41 -0
- package/dist/sync/mcp.d.ts.map +1 -0
- package/dist/sync/mcp.js +102 -0
- package/dist/sync/mcp.js.map +1 -0
- package/dist/sync/plugins.d.ts +18 -0
- package/dist/sync/plugins.d.ts.map +1 -0
- package/dist/sync/plugins.js +126 -0
- package/dist/sync/plugins.js.map +1 -0
- package/dist/sync/skills.d.ts +5 -0
- package/dist/sync/skills.d.ts.map +1 -0
- package/dist/sync/skills.js +94 -0
- package/dist/sync/skills.js.map +1 -0
- package/dist/utils/crypto.d.ts +28 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +132 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/paths.d.ts +57 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +169 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/prompt.d.ts +5 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +85 -0
- package/dist/utils/prompt.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.pullCommand = pullCommand;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const config_js_1 = require("../config.js");
|
|
40
|
+
const github_js_1 = require("../storage/github.js");
|
|
41
|
+
const claude_desktop_js_1 = require("../clients/claude-desktop.js");
|
|
42
|
+
const claude_code_js_1 = require("../clients/claude-code.js");
|
|
43
|
+
const opencode_js_1 = require("../clients/opencode.js");
|
|
44
|
+
const mcp_js_1 = require("../sync/mcp.js");
|
|
45
|
+
const claude_desktop_js_2 = require("../clients/claude-desktop.js");
|
|
46
|
+
const claude_code_js_2 = require("../clients/claude-code.js");
|
|
47
|
+
const opencode_js_2 = require("../clients/opencode.js");
|
|
48
|
+
const plugins_js_1 = require("../sync/plugins.js");
|
|
49
|
+
const agents_js_1 = require("../sync/agents.js");
|
|
50
|
+
const skills_js_1 = require("../sync/skills.js");
|
|
51
|
+
const prompt_js_1 = require("../utils/prompt.js");
|
|
52
|
+
async function pullCommand() {
|
|
53
|
+
const config = (0, config_js_1.readConfig)();
|
|
54
|
+
const repoDir = (0, config_js_1.getLocalRepoDir)();
|
|
55
|
+
// Pull or clone
|
|
56
|
+
console.log('Pulling latest from remote...');
|
|
57
|
+
try {
|
|
58
|
+
(0, github_js_1.pullRepo)(repoDir, config.githubToken, config.repoCloneUrl);
|
|
59
|
+
(0, github_js_1.ensureGitConfig)(repoDir);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.error(`Error pulling repo: ${err.message}`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
// Check for mcp-config.json
|
|
66
|
+
const mcpConfigPath = path.join(repoDir, 'mcp-config.json');
|
|
67
|
+
if (!fs.existsSync(mcpConfigPath)) {
|
|
68
|
+
console.log('No mcp-config.json found in remote. Run `carry-on push` on your source machine first.');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Get passphrase for decrypting secrets
|
|
72
|
+
const passphrase = await (0, prompt_js_1.askSecret)('Passphrase to decrypt secrets: ');
|
|
73
|
+
if (!passphrase) {
|
|
74
|
+
console.error('Error: passphrase cannot be empty.');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
// Restore MCP servers
|
|
78
|
+
console.log('\nRestoring MCP servers...');
|
|
79
|
+
let remoteServers;
|
|
80
|
+
try {
|
|
81
|
+
const portableConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
82
|
+
remoteServers = (0, mcp_js_1.restoreFromPortableConfig)(portableConfig, passphrase);
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
console.error(`Error decrypting MCPs: ${err.message}`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
const serverCount = Object.keys(remoteServers).length;
|
|
89
|
+
const updatedClients = [];
|
|
90
|
+
// Apply to Claude Desktop
|
|
91
|
+
const localDesktop = (0, claude_desktop_js_2.readClaudeDesktopMcpServers)();
|
|
92
|
+
const mergedDesktop = (0, mcp_js_1.additiveMerge)(localDesktop, remoteServers);
|
|
93
|
+
if (Object.keys(mergedDesktop).length > Object.keys(localDesktop).length) {
|
|
94
|
+
(0, claude_desktop_js_1.writeClaudeDesktopMcpServers)(mergedDesktop);
|
|
95
|
+
updatedClients.push(`Claude Desktop (${(0, claude_desktop_js_1.getConfigPath)()})`);
|
|
96
|
+
}
|
|
97
|
+
// Apply to Claude Code
|
|
98
|
+
const localCode = (0, claude_code_js_2.readClaudeCodeMcpServers)();
|
|
99
|
+
const mergedCode = (0, mcp_js_1.additiveMerge)(localCode, remoteServers);
|
|
100
|
+
if (Object.keys(mergedCode).length > Object.keys(localCode).length) {
|
|
101
|
+
(0, claude_code_js_1.writeClaudeCodeMcpServers)(mergedCode);
|
|
102
|
+
updatedClients.push(`Claude Code (${(0, claude_code_js_1.getSettingsPath)()})`);
|
|
103
|
+
}
|
|
104
|
+
// Apply to OpenCode
|
|
105
|
+
const localOpenCode = (0, opencode_js_2.readOpenCodeMcpServers)();
|
|
106
|
+
const mergedOpenCode = (0, mcp_js_1.additiveMerge)(localOpenCode, remoteServers);
|
|
107
|
+
if (Object.keys(mergedOpenCode).length > Object.keys(localOpenCode).length) {
|
|
108
|
+
(0, opencode_js_1.writeOpenCodeMcpServers)(mergedOpenCode);
|
|
109
|
+
updatedClients.push(`OpenCode (${(0, opencode_js_1.getConfigPath)()})`);
|
|
110
|
+
}
|
|
111
|
+
console.log(` Restored ${serverCount} MCP server(s)`);
|
|
112
|
+
// Apply plugin manifests
|
|
113
|
+
console.log('\nRestoring plugin manifests...');
|
|
114
|
+
const manifests = (0, plugins_js_1.readPluginManifestsFromRepo)(repoDir);
|
|
115
|
+
const updatedManifests = (0, plugins_js_1.applyPluginManifests)(manifests);
|
|
116
|
+
console.log(` Updated ${updatedManifests.length} manifest file(s)`);
|
|
117
|
+
// Apply agents
|
|
118
|
+
console.log('\nRestoring agents...');
|
|
119
|
+
const agentCount = (0, agents_js_1.applyAgentsFromRepo)(repoDir);
|
|
120
|
+
console.log(` Restored ${agentCount} agent file(s)`);
|
|
121
|
+
// Apply skills
|
|
122
|
+
console.log('\nRestoring skills...');
|
|
123
|
+
const skillCount = (0, skills_js_1.applySkillsFromRepo)(repoDir);
|
|
124
|
+
console.log(` Restored ${skillCount} skill file(s)`);
|
|
125
|
+
// Summary
|
|
126
|
+
console.log('\n✓ Pull complete!\n');
|
|
127
|
+
console.log('Summary:');
|
|
128
|
+
console.log(` MCPs: ${serverCount} servers applied to ${updatedClients.length} client(s)`);
|
|
129
|
+
console.log(` Plugins: ${updatedManifests.length} manifest file(s) updated`);
|
|
130
|
+
console.log(` Agents: ${agentCount}`);
|
|
131
|
+
console.log(` Skills: ${skillCount}`);
|
|
132
|
+
if (updatedClients.length > 0) {
|
|
133
|
+
console.log('\nUpdated clients:');
|
|
134
|
+
for (const c of updatedClients) {
|
|
135
|
+
console.log(` • ${c}`);
|
|
136
|
+
}
|
|
137
|
+
console.log('\n⚠ Restart Claude Desktop to apply MCP changes.');
|
|
138
|
+
}
|
|
139
|
+
if (updatedManifests.length > 0) {
|
|
140
|
+
console.log('⚠ Restart Claude Code to trigger plugin installation.');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,kCAuGC;AA3HD,uCAAyB;AACzB,2CAA6B;AAC7B,4CAA2D;AAC3D,oDAA4E;AAC5E,oEAA0G;AAC1G,8DAAuF;AACvF,wDAAgG;AAChG,2CAGwB;AAExB,oEAA2E;AAC3E,8DAAqE;AACrE,wDAAgE;AAChE,mDAAuF;AACvF,iDAAwD;AAC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ACjG,OAAO,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,CAAC,MAAM,2BAA2B,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAE1C,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAaA,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAyEjD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.pushCommand = pushCommand;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const config_js_1 = require("../config.js");
|
|
40
|
+
const github_js_1 = require("../storage/github.js");
|
|
41
|
+
const claude_desktop_js_1 = require("../clients/claude-desktop.js");
|
|
42
|
+
const claude_code_js_1 = require("../clients/claude-code.js");
|
|
43
|
+
const opencode_js_1 = require("../clients/opencode.js");
|
|
44
|
+
const mcp_js_1 = require("../sync/mcp.js");
|
|
45
|
+
const plugins_js_1 = require("../sync/plugins.js");
|
|
46
|
+
const agents_js_1 = require("../sync/agents.js");
|
|
47
|
+
const skills_js_1 = require("../sync/skills.js");
|
|
48
|
+
const prompt_js_1 = require("../utils/prompt.js");
|
|
49
|
+
async function pushCommand() {
|
|
50
|
+
const config = (0, config_js_1.readConfig)();
|
|
51
|
+
const repoDir = (0, config_js_1.getLocalRepoDir)();
|
|
52
|
+
// Pull latest first to avoid conflicts
|
|
53
|
+
console.log('Pulling latest from remote...');
|
|
54
|
+
try {
|
|
55
|
+
(0, github_js_1.pullRepo)(repoDir, config.githubToken, config.repoCloneUrl);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
console.warn(`Warning: could not pull latest — ${err.message}`);
|
|
59
|
+
}
|
|
60
|
+
// Get passphrase for encrypting secrets
|
|
61
|
+
const passphrase = await (0, prompt_js_1.askSecret)('Passphrase to encrypt secrets: ');
|
|
62
|
+
if (!passphrase) {
|
|
63
|
+
console.error('Error: passphrase cannot be empty.');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
const confirm = await (0, prompt_js_1.askSecret)('Confirm passphrase: ');
|
|
67
|
+
if (passphrase !== confirm) {
|
|
68
|
+
console.error('Error: passphrases do not match.');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
console.log('\nReading MCP configurations...');
|
|
72
|
+
const desktop = (0, claude_desktop_js_1.readClaudeDesktopMcpServers)();
|
|
73
|
+
const claudeCode = (0, claude_code_js_1.readClaudeCodeMcpServers)();
|
|
74
|
+
const opencode = (0, opencode_js_1.readOpenCodeMcpServers)();
|
|
75
|
+
const merged = (0, mcp_js_1.mergeMcpSources)(desktop, claudeCode, opencode);
|
|
76
|
+
const serverCount = Object.keys(merged).length;
|
|
77
|
+
console.log(` Found ${serverCount} MCP server(s) across all clients`);
|
|
78
|
+
// Write mcp-config.json
|
|
79
|
+
const portableConfig = (0, mcp_js_1.buildPortableConfig)(merged, passphrase);
|
|
80
|
+
fs.writeFileSync(path.join(repoDir, 'mcp-config.json'), JSON.stringify(portableConfig, null, 2), 'utf8');
|
|
81
|
+
// Sync plugin manifests
|
|
82
|
+
console.log('\nReading plugin manifests...');
|
|
83
|
+
const manifests = (0, plugins_js_1.readPluginManifests)();
|
|
84
|
+
const manifestCount = Object.keys(manifests).length;
|
|
85
|
+
console.log(` Found ${manifestCount} plugin manifest file(s)`);
|
|
86
|
+
(0, plugins_js_1.writePluginManifestsToRepo)(manifests, repoDir);
|
|
87
|
+
// Sync agents
|
|
88
|
+
console.log('\nSyncing agents...');
|
|
89
|
+
const agentCount = (0, agents_js_1.writeAgentsToRepo)(repoDir);
|
|
90
|
+
console.log(` Synced ${agentCount} agent file(s)`);
|
|
91
|
+
// Sync skills
|
|
92
|
+
console.log('\nSyncing skills...');
|
|
93
|
+
const skillCount = (0, skills_js_1.writeSkillsToRepo)(repoDir);
|
|
94
|
+
console.log(` Synced ${skillCount} skill file(s)`);
|
|
95
|
+
// Commit and push
|
|
96
|
+
console.log('\nPushing to GitHub...');
|
|
97
|
+
(0, github_js_1.ensureGitConfig)(repoDir);
|
|
98
|
+
try {
|
|
99
|
+
(0, github_js_1.commitAndPush)(repoDir, config.githubToken, config.repoCloneUrl, 'carry-on: push');
|
|
100
|
+
console.log(`\n✓ Pushed to ${config.repoHtmlUrl}`);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error(`Error pushing: ${err.message}`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
console.log('\nSummary:');
|
|
107
|
+
console.log(` MCPs: ${serverCount}`);
|
|
108
|
+
console.log(` Plugins: ${manifestCount} manifest file(s)`);
|
|
109
|
+
console.log(` Agents: ${agentCount}`);
|
|
110
|
+
console.log(` Skills: ${skillCount}`);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kCAyEC;AAtFD,uCAAyB;AACzB,2CAA6B;AAC7B,4CAA2D;AAC3D,oDAAgF;AAChF,oEAA2E;AAC3E,8DAAqE;AACrE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ACzB,IAAI,CAAC;QACH,IAAA,yBAAa,EAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,kBAAmB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,gBAAgB,aAAa,mBAAmB,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAUA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA8EnD"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.statusCommand = statusCommand;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const config_js_1 = require("../config.js");
|
|
40
|
+
const github_js_1 = require("../storage/github.js");
|
|
41
|
+
const claude_desktop_js_1 = require("../clients/claude-desktop.js");
|
|
42
|
+
const claude_code_js_1 = require("../clients/claude-code.js");
|
|
43
|
+
const opencode_js_1 = require("../clients/opencode.js");
|
|
44
|
+
const mcp_js_1 = require("../sync/mcp.js");
|
|
45
|
+
async function statusCommand() {
|
|
46
|
+
const config = (0, config_js_1.readConfig)();
|
|
47
|
+
const repoDir = (0, config_js_1.getLocalRepoDir)();
|
|
48
|
+
console.log('Fetching remote state...');
|
|
49
|
+
try {
|
|
50
|
+
(0, github_js_1.pullRepo)(repoDir, config.githubToken, config.repoCloneUrl);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
console.warn(`Warning: could not pull latest — ${err.message}`);
|
|
54
|
+
}
|
|
55
|
+
const mcpConfigPath = path.join(repoDir, 'mcp-config.json');
|
|
56
|
+
if (!fs.existsSync(mcpConfigPath)) {
|
|
57
|
+
console.log('\nRemote has no config yet. Run `carry-on push` to upload your setup.');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// Compare MCPs (without decrypting — just compare names)
|
|
61
|
+
const portableConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
62
|
+
const remoteNames = new Set(Object.keys(portableConfig.mcpServers));
|
|
63
|
+
const local = (0, mcp_js_1.mergeMcpSources)((0, claude_desktop_js_1.readClaudeDesktopMcpServers)(), (0, claude_code_js_1.readClaudeCodeMcpServers)(), (0, opencode_js_1.readOpenCodeMcpServers)());
|
|
64
|
+
const localNames = new Set(Object.keys(local));
|
|
65
|
+
const onlyRemote = [...remoteNames].filter(n => !localNames.has(n));
|
|
66
|
+
const onlyLocal = [...localNames].filter(n => !remoteNames.has(n));
|
|
67
|
+
const inBoth = [...remoteNames].filter(n => localNames.has(n));
|
|
68
|
+
console.log('\n── MCP Servers ─────────────────────────────────');
|
|
69
|
+
if (inBoth.length > 0) {
|
|
70
|
+
console.log('\n Synced:');
|
|
71
|
+
for (const n of inBoth)
|
|
72
|
+
console.log(` ✓ ${n}`);
|
|
73
|
+
}
|
|
74
|
+
if (onlyRemote.length > 0) {
|
|
75
|
+
console.log('\n In remote, not local (run pull):');
|
|
76
|
+
for (const n of onlyRemote)
|
|
77
|
+
console.log(` ↓ ${n}`);
|
|
78
|
+
}
|
|
79
|
+
if (onlyLocal.length > 0) {
|
|
80
|
+
console.log('\n In local, not remote (run push):');
|
|
81
|
+
for (const n of onlyLocal)
|
|
82
|
+
console.log(` ↑ ${n}`);
|
|
83
|
+
}
|
|
84
|
+
if (remoteNames.size === 0 && localNames.size === 0) {
|
|
85
|
+
console.log(' No MCP servers found.');
|
|
86
|
+
}
|
|
87
|
+
// Plugins
|
|
88
|
+
console.log('\n── Plugin Manifests ────────────────────────────');
|
|
89
|
+
const pluginFiles = ['plugins/installed_plugins.json', 'plugins/blocklist.json', 'plugins/known_marketplaces.json'];
|
|
90
|
+
for (const f of pluginFiles) {
|
|
91
|
+
const inRepo = fs.existsSync(path.join(repoDir, f));
|
|
92
|
+
console.log(` ${inRepo ? '✓' : '✗'} ${f}`);
|
|
93
|
+
}
|
|
94
|
+
// Agents
|
|
95
|
+
console.log('\n── Agents ──────────────────────────────────────');
|
|
96
|
+
const agentsDir = path.join(repoDir, 'agents');
|
|
97
|
+
if (fs.existsSync(agentsDir)) {
|
|
98
|
+
const count = countFiles(agentsDir, '.md');
|
|
99
|
+
console.log(` ${count} agent file(s) in remote`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
console.log(' Not synced yet');
|
|
103
|
+
}
|
|
104
|
+
// Skills
|
|
105
|
+
console.log('\n── Skills ──────────────────────────────────────');
|
|
106
|
+
const skillsDir = path.join(repoDir, 'skills');
|
|
107
|
+
if (fs.existsSync(skillsDir)) {
|
|
108
|
+
const count = countFiles(skillsDir);
|
|
109
|
+
console.log(` ${count} skill file(s) in remote`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
console.log(' Not synced yet');
|
|
113
|
+
}
|
|
114
|
+
console.log(`\nRemote: ${config.repoHtmlUrl}\n`);
|
|
115
|
+
}
|
|
116
|
+
function countFiles(dir, ext) {
|
|
117
|
+
let count = 0;
|
|
118
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
119
|
+
if (entry.isDirectory()) {
|
|
120
|
+
count += countFiles(path.join(dir, entry.name), ext);
|
|
121
|
+
}
|
|
122
|
+
else if (!ext || entry.name.endsWith(ext)) {
|
|
123
|
+
count++;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return count;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,sCA8EC;AAxFD,uCAAyB;AACzB,2CAA6B;AAC7B,4CAA2D;AAC3D,oDAAgD;AAChD,oEAA2E;AAC3E,8DAAqE;AACrE,wDAAgE;AAChE,2CAAiD;AAG1C,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,IAAA,sBAAU,GAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAA,2BAAe,GAAE,CAAC;IAElC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,IAAI,CAAC;QACH,IAAA,oBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,oCAAqC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;QACrF,OAAO;IACT,CAAC;IAED,yDAAyD;IACzD,MAAM,cAAc,GAAsB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7F,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAEpE,MAA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AC;IAC/C,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,0BAA0B,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,UAAU,CAAC,GAAW,EAAE,GAAY;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACjE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5C,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CarryOnConfig {
|
|
2
|
+
githubToken: string;
|
|
3
|
+
repoFullName: string;
|
|
4
|
+
repoCloneUrl: string;
|
|
5
|
+
repoHtmlUrl: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function configExists(): boolean;
|
|
8
|
+
export declare function readConfig(): CarryOnConfig;
|
|
9
|
+
export declare function writeConfig(config: CarryOnConfig): void;
|
|
10
|
+
/** Local clone directory */
|
|
11
|
+
export declare function getLocalRepoDir(): string;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,UAAU,IAAI,aAAa,CAQ1C;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAQvD;AAED,4BAA4B;AAC5B,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.configExists = configExists;
|
|
37
|
+
exports.readConfig = readConfig;
|
|
38
|
+
exports.writeConfig = writeConfig;
|
|
39
|
+
exports.getLocalRepoDir = getLocalRepoDir;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const paths_js_1 = require("./utils/paths.js");
|
|
44
|
+
function configExists() {
|
|
45
|
+
return fs.existsSync((0, paths_js_1.getCarryOnConfigPath)());
|
|
46
|
+
}
|
|
47
|
+
function readConfig() {
|
|
48
|
+
const configPath = (0, paths_js_1.getCarryOnConfigPath)();
|
|
49
|
+
if (!fs.existsSync(configPath)) {
|
|
50
|
+
throw new Error('carry-on is not initialized. Run `carry-on init` first.');
|
|
51
|
+
}
|
|
52
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
53
|
+
}
|
|
54
|
+
function writeConfig(config) {
|
|
55
|
+
const dir = (0, paths_js_1.getCarryOnConfigDir)();
|
|
56
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
57
|
+
fs.writeFileSync((0, paths_js_1.getCarryOnConfigPath)(), JSON.stringify(config, null, 2), 'utf8');
|
|
58
|
+
// Restrict permissions on non-Windows (contains GitHub token)
|
|
59
|
+
if (process.platform !== 'win32') {
|
|
60
|
+
fs.chmodSync((0, paths_js_1.getCarryOnConfigPath)(), 0o600);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Local clone directory */
|
|
64
|
+
function getLocalRepoDir() {
|
|
65
|
+
return path.join(os.homedir(), '.carry-on', 'repo');
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,oCAEC;AAED,gCAQC;AAED,kCAQC;AAGD,0CAEC;AAvCD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,+CAA6E;AAS7E,SAAgB,YAAY;IAC1B,OAAO,EAAE,CAAC,UAAU,CAAC,IAAA,+BAAoB,GAAE,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,UAAU;IACxB,MAAM,UAAU,GAAG,IAAA,+BAAoB,GAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,WAAW,CAAC,MAAqB;IAC/C,MAAM,GAAG,GAAG,IAAA,8BAAmB,GAAE,CAAC;IAClC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,EAAE,CAAC,aAAa,CAAC,IAAA,+BAAoB,GAAE,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,8DAA8D;IAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,EAAE,CAAC,SAAS,CAAC,IAAA,+BAAoB,GAAE,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,4BAA4B;AAC5B,SAAgB,eAAe;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RepoInfo {
|
|
2
|
+
fullName: string;
|
|
3
|
+
cloneUrl: string;
|
|
4
|
+
sshUrl: string;
|
|
5
|
+
htmlUrl: string;
|
|
6
|
+
}
|
|
7
|
+
/** Get the authenticated user's login */
|
|
8
|
+
export declare function getAuthenticatedUser(token: string): Promise<string>;
|
|
9
|
+
/** Create a private repo named carry-on-sync (idempotent — returns existing if 422) */
|
|
10
|
+
export declare function createRepo(token: string, owner: string): Promise<RepoInfo>;
|
|
11
|
+
/** Clone the repo to a local directory. Uses HTTPS with token auth. */
|
|
12
|
+
export declare function cloneRepo(cloneUrl: string, token: string, localDir: string): void;
|
|
13
|
+
/** Pull latest changes */
|
|
14
|
+
export declare function pullRepo(localDir: string, token: string, remoteUrl: string): void;
|
|
15
|
+
/** Stage all changes, commit, and push */
|
|
16
|
+
export declare function commitAndPush(localDir: string, token: string, remoteUrl: string, message?: string): void;
|
|
17
|
+
/** Configure git user in the repo if not set globally */
|
|
18
|
+
export declare function ensureGitConfig(localDir: string): void;
|
|
19
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/storage/github.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD,yCAAyC;AACzC,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOzE;AAED,uFAAuF;AACvF,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0ChF;AAED,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAYjF;AAED,0BAA0B;AAC1B,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CASjF;AAED,0CAA0C;AAC1C,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAmB,GAAG,IAAI,CAiBlH;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAStD"}
|