@cg3/equip 0.5.0 → 0.5.2

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.
Files changed (2) hide show
  1. package/bin/equip.js +28 -12
  2. package/package.json +1 -1
package/bin/equip.js CHANGED
@@ -158,8 +158,17 @@ function spawnTool(pkg, command, extraArgs, toolName) {
158
158
  env: { ...process.env, EQUIP_VERSION },
159
159
  });
160
160
  child.on("close", (code) => {
161
- if (code === 0 && toolName) {
162
- try { reconcileState(toolName, pkg); } catch (e) { process.stderr.write(`[equip] state reconciliation failed: ${e.message}\n`); }
161
+ // Always reconcile state install may have succeeded even if
162
+ // the tool exited non-zero (e.g. user cancelled a post-install prompt)
163
+ if (toolName) {
164
+ try {
165
+ const changed = reconcileState(toolName, pkg);
166
+ if (changed > 0) {
167
+ process.stderr.write(`\n equip: tracked ${toolName} on ${changed} platform${changed === 1 ? "" : "s"}\n`);
168
+ }
169
+ } catch (e) {
170
+ process.stderr.write(`\n[equip] state reconciliation failed: ${e.message}\n`);
171
+ }
163
172
  }
164
173
  process.exit(code || 0);
165
174
  });
@@ -182,6 +191,8 @@ function reconcileState(toolName, pkg) {
182
191
  const _fs = require("fs");
183
192
  const _path = require("path");
184
193
 
194
+ let count = 0;
195
+
185
196
  for (const [id, def] of PLATFORM_REGISTRY) {
186
197
  // Quick check: is this platform present?
187
198
  const dirFound = def.detection.dirs.some(fn => dirExists(fn()));
@@ -199,7 +210,7 @@ function reconcileState(toolName, pkg) {
199
210
  transport: entry.command ? "stdio" : "http",
200
211
  };
201
212
 
202
- // Check for rules
213
+ // Check for rules (only on platforms that support writable rules)
203
214
  if (def.rulesPath) {
204
215
  const rulesPath = def.rulesPath();
205
216
  try {
@@ -212,18 +223,23 @@ function reconcileState(toolName, pkg) {
212
223
  } catch {}
213
224
  }
214
225
 
215
- // Check for hooks (look for tool's hook directory)
216
- const hookDir = _path.join(require("os").homedir(), `.${toolName}`, "hooks");
217
- try {
218
- const hookFiles = _fs.readdirSync(hookDir).filter(f => f.endsWith(".js"));
219
- if (hookFiles.length > 0) {
220
- record.hookDir = hookDir;
221
- record.hookScripts = hookFiles;
222
- }
223
- } catch {}
226
+ // Check for hooks (only on platforms that support hooks)
227
+ if (def.hooks) {
228
+ const hookDir = _path.join(require("os").homedir(), `.${toolName}`, "hooks");
229
+ try {
230
+ const hookFiles = _fs.readdirSync(hookDir).filter(f => f.endsWith(".js"));
231
+ if (hookFiles.length > 0) {
232
+ record.hookDir = hookDir;
233
+ record.hookScripts = hookFiles;
234
+ }
235
+ } catch {}
236
+ }
224
237
 
225
238
  trackInstall(toolName, pkg, id, record);
239
+ count++;
226
240
  }
241
+
242
+ return count;
227
243
  }
228
244
 
229
245
  // ─── Main ───────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cg3/equip",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Universal MCP + behavioral rules installer for AI coding agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",