@cg3/equip 0.2.21 → 0.2.23
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/demo/setup.js +9 -6
- package/index.js +2 -1
- package/lib/platforms.js +26 -0
- package/package.json +1 -1
package/demo/setup.js
CHANGED
|
@@ -105,15 +105,18 @@ const equip = new Equip({
|
|
|
105
105
|
// events in supported platforms (currently Claude Code only).
|
|
106
106
|
// hooks: [
|
|
107
107
|
// {
|
|
108
|
-
// event: "
|
|
109
|
-
// matcher: "
|
|
110
|
-
// name: "
|
|
108
|
+
// event: "PostToolUse",
|
|
109
|
+
// matcher: "Write|Edit",
|
|
110
|
+
// name: "check-api-version",
|
|
111
111
|
// script: `
|
|
112
|
-
// // This runs after a
|
|
112
|
+
// // This runs after a Write or Edit tool call completes.
|
|
113
113
|
// // Hook scripts receive context via stdin (JSON).
|
|
114
114
|
// const input = require("fs").readFileSync("/dev/stdin", "utf-8");
|
|
115
|
-
// const { tool_input
|
|
116
|
-
//
|
|
115
|
+
// const { tool_input } = JSON.parse(input);
|
|
116
|
+
// // Remind the agent to verify API versions after editing code
|
|
117
|
+
// if (tool_input?.file_path?.endsWith(".ts") || tool_input?.file_path?.endsWith(".js")) {
|
|
118
|
+
// console.log("Reminder: verify API versions with acme-docs after code changes.");
|
|
119
|
+
// }
|
|
117
120
|
// `,
|
|
118
121
|
// },
|
|
119
122
|
// ],
|
package/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const { detectPlatforms, whichSync, dirExists, fileExists } = require("./lib/det
|
|
|
10
10
|
const { readMcpEntry, buildHttpConfig, buildHttpConfigWithAuth, buildStdioConfig, installMcp, installMcpJson, installMcpToml, uninstallMcp, updateMcpKey, parseTomlServerEntry, parseTomlSubTables, buildTomlEntry, removeTomlEntry } = require("./lib/mcp");
|
|
11
11
|
const { parseRulesVersion, installRules, uninstallRules, markerPatterns } = require("./lib/rules");
|
|
12
12
|
const { getHookCapabilities, installHooks, uninstallHooks, hasHooks, buildHooksConfig } = require("./lib/hooks");
|
|
13
|
-
const { createManualPlatform, platformName, KNOWN_PLATFORMS } = require("./lib/platforms");
|
|
13
|
+
const { createManualPlatform, platformName, resolvePlatformId, KNOWN_PLATFORMS } = require("./lib/platforms");
|
|
14
14
|
const cli = require("./lib/cli");
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -233,6 +233,7 @@ module.exports = {
|
|
|
233
233
|
markerPatterns,
|
|
234
234
|
createManualPlatform,
|
|
235
235
|
platformName,
|
|
236
|
+
resolvePlatformId,
|
|
236
237
|
KNOWN_PLATFORMS,
|
|
237
238
|
// Hooks
|
|
238
239
|
getHookCapabilities,
|
package/lib/platforms.js
CHANGED
|
@@ -168,6 +168,31 @@ function platformName(id) {
|
|
|
168
168
|
*/
|
|
169
169
|
const KNOWN_PLATFORMS = ["claude-code", "cursor", "windsurf", "vscode", "cline", "roo-code", "codex", "gemini-cli", "junie", "copilot-jetbrains", "copilot-cli"];
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Resolve a friendly name or alias to a canonical platform ID.
|
|
173
|
+
* Returns the ID if recognized, or the input unchanged if not.
|
|
174
|
+
*/
|
|
175
|
+
function resolvePlatformId(input) {
|
|
176
|
+
const s = input.trim().toLowerCase();
|
|
177
|
+
// Exact match first
|
|
178
|
+
if (KNOWN_PLATFORMS.includes(s)) return s;
|
|
179
|
+
// Aliases
|
|
180
|
+
const aliases = {
|
|
181
|
+
claude: "claude-code",
|
|
182
|
+
"claude-code": "claude-code",
|
|
183
|
+
"claudecode": "claude-code",
|
|
184
|
+
vscode: "vscode",
|
|
185
|
+
"vs-code": "vscode",
|
|
186
|
+
code: "vscode",
|
|
187
|
+
roo: "roo-code",
|
|
188
|
+
roocode: "roo-code",
|
|
189
|
+
copilot: "copilot-cli",
|
|
190
|
+
"copilot-jb": "copilot-jetbrains",
|
|
191
|
+
gemini: "gemini-cli",
|
|
192
|
+
};
|
|
193
|
+
return aliases[s] || s;
|
|
194
|
+
}
|
|
195
|
+
|
|
171
196
|
module.exports = {
|
|
172
197
|
getVsCodeUserDir,
|
|
173
198
|
getVsCodeMcpPath,
|
|
@@ -180,5 +205,6 @@ module.exports = {
|
|
|
180
205
|
getCopilotCliMcpPath,
|
|
181
206
|
createManualPlatform,
|
|
182
207
|
platformName,
|
|
208
|
+
resolvePlatformId,
|
|
183
209
|
KNOWN_PLATFORMS,
|
|
184
210
|
};
|