@cg3/equip 0.2.16 → 0.2.17

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 CHANGED
@@ -44,9 +44,9 @@ Some platforms support **lifecycle hooks** — scripts that run automatically at
44
44
  | Claude Code | ✅ | `PostToolUseFailure`, `Stop`, `PreToolUse`, `PostToolUse` |
45
45
  | All others | ❌ | — |
46
46
 
47
- When hooks are supported, equip installs lightweight Node.js scripts to `~/.prior/hooks/` and registers them in the platform's settings. Hooks are a **silent enhancement** — if the platform doesn't support them, equip installs only MCP + rules without any error or warning.
47
+ When hooks are supported, equip writes the consumer-provided scripts to a configurable directory (default: `~/.${name}/hooks/`) and registers them in the platform's settings. Hooks are a **silent enhancement** — if the platform doesn't support them, equip installs only MCP + rules without any error or warning.
48
48
 
49
- Hooks are opt-in per platform via the capabilities model. As more platforms add hook support, equip can enable them without consumer code changes.
49
+ Hook scripts and event bindings are defined by the consumer (your package), not by equip. Equip provides only the installation infrastructure — capabilities detection, file writing, settings registration, and cleanup. As more platforms add hook support, equip can enable them without consumer code changes.
50
50
 
51
51
  ## Quick Start
52
52
 
package/index.js CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  "use strict";
5
5
 
6
+ const path = require("path");
7
+ const os = require("os");
8
+
6
9
  const { detectPlatforms, whichSync, dirExists, fileExists } = require("./lib/detect");
7
10
  const { readMcpEntry, buildHttpConfig, buildHttpConfigWithAuth, buildStdioConfig, installMcp, installMcpJson, installMcpToml, uninstallMcp, updateMcpKey, parseTomlServerEntry, parseTomlSubTables, buildTomlEntry, removeTomlEntry } = require("./lib/mcp");
8
11
  const { parseRulesVersion, installRules, uninstallRules, markerPatterns } = require("./lib/rules");
@@ -42,7 +45,7 @@ class Equip {
42
45
  * @param {string} [config.hooks[].matcher] - Regex matcher for event filtering (e.g., "Bash")
43
46
  * @param {string} config.hooks[].script - Hook script content (Node.js)
44
47
  * @param {string} config.hooks[].name - Script filename (without .js extension)
45
- * @param {string} [config.hookDir] - Directory for hook scripts (default: ~/.prior/hooks)
48
+ * @param {string} [config.hookDir] - Directory for hook scripts (default: ~/.${name}/hooks)
46
49
  */
47
50
  constructor(config) {
48
51
  if (!config.name) throw new Error("Equip: name is required");
@@ -53,7 +56,7 @@ class Equip {
53
56
  this.rules = config.rules || null;
54
57
  this.stdio = config.stdio || null;
55
58
  this.hookDefs = config.hooks || null;
56
- this.hookDir = config.hookDir || null;
59
+ this.hookDir = config.hookDir || path.join(os.homedir(), `.${config.name}`, "hooks");
57
60
  }
58
61
 
59
62
  /**
package/lib/hooks.js CHANGED
@@ -78,9 +78,9 @@ function installHooks(platform, hookDefs, options = {}) {
78
78
  const caps = getHookCapabilities(platform.platform);
79
79
  if (!caps || !hookDefs || hookDefs.length === 0) return null;
80
80
 
81
- const hookDir = options.hookDir || path.join(os.homedir(), ".prior", "hooks");
81
+ if (!options.hookDir) throw new Error("hookDir is required");
82
+ const hookDir = options.hookDir;
82
83
  const dryRun = options.dryRun || false;
83
- const marker = options.marker || "prior";
84
84
 
85
85
  // 1. Write hook scripts
86
86
  const installedScripts = [];
@@ -145,7 +145,8 @@ function uninstallHooks(platform, hookDefs, options = {}) {
145
145
  const caps = getHookCapabilities(platform.platform);
146
146
  if (!caps || !hookDefs || hookDefs.length === 0) return false;
147
147
 
148
- const hookDir = options.hookDir || path.join(os.homedir(), ".prior", "hooks");
148
+ if (!options.hookDir) throw new Error("hookDir is required");
149
+ const hookDir = options.hookDir;
149
150
  const dryRun = options.dryRun || false;
150
151
  let removed = false;
151
152
 
@@ -206,7 +207,8 @@ function hasHooks(platform, hookDefs, options = {}) {
206
207
  const caps = getHookCapabilities(platform.platform);
207
208
  if (!caps || !hookDefs || hookDefs.length === 0) return false;
208
209
 
209
- const hookDir = options.hookDir || path.join(os.homedir(), ".prior", "hooks");
210
+ if (!options.hookDir) throw new Error("hookDir is required");
211
+ const hookDir = options.hookDir;
210
212
 
211
213
  // Check scripts exist
212
214
  for (const def of hookDefs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cg3/equip",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Universal MCP + behavioral rules installer for AI coding agents",
5
5
  "main": "index.js",
6
6
  "bin": {