grepmax 0.21.2 → 0.22.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.
@@ -1,121 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Postinstall: sync plugin files to all installed integrations.
4
- * Runs after `npm install -g grepmax@latest` to automatically update
5
- * skills, hooks, and configs without manual re-installation.
3
+ * Postinstall intentionally does not modify user-home agent configuration.
4
+ * Users can install or update integrations explicitly with:
6
5
  *
7
- * Supported integrations:
8
- * - Claude Code: sync skills/hooks to plugin cache
9
- * - OpenCode: re-run installer (regenerates tool shim + plugin)
10
- * - Codex: re-run installer (updates AGENTS.md + MCP registration)
11
- * - Factory Droid: re-run installer (updates skills + hooks)
6
+ * gmax plugin add
7
+ * gmax plugin update
12
8
  */
13
- const fs = require("node:fs");
14
- const path = require("node:path");
15
- const os = require("node:os");
16
- const { execSync } = require("node:child_process");
17
9
 
18
- const sourcePlugin = path.join(__dirname, "..", "plugins", "grepmax");
19
-
20
- // --- Claude Code: sync files to plugin cache ---
21
- const pluginCacheBase = path.join(
22
- os.homedir(),
23
- ".claude",
24
- "plugins",
25
- "cache",
26
- "grepmax",
27
- "grepmax",
28
- );
29
-
30
- if (fs.existsSync(pluginCacheBase) && fs.existsSync(sourcePlugin)) {
31
- let entries;
32
- try {
33
- entries = fs.readdirSync(pluginCacheBase, { withFileTypes: true });
34
- } catch {
35
- entries = [];
36
- }
37
-
38
- const versionDirs = entries
39
- .filter((e) => e.isDirectory())
40
- .map((e) => e.name);
41
-
42
- function copyRecursive(src, dest) {
43
- if (!fs.existsSync(src)) return;
44
- const stat = fs.statSync(src);
45
- if (stat.isDirectory()) {
46
- fs.mkdirSync(dest, { recursive: true });
47
- for (const entry of fs.readdirSync(src)) {
48
- copyRecursive(path.join(src, entry), path.join(dest, entry));
49
- }
50
- } else {
51
- fs.mkdirSync(path.dirname(dest), { recursive: true });
52
- fs.copyFileSync(src, dest);
53
- }
54
- }
55
-
56
- for (const ver of versionDirs) {
57
- const destDir = path.join(pluginCacheBase, ver);
58
- try {
59
- copyRecursive(
60
- path.join(sourcePlugin, "skills"),
61
- path.join(destDir, "skills"),
62
- );
63
- copyRecursive(
64
- path.join(sourcePlugin, "hooks"),
65
- path.join(destDir, "hooks"),
66
- );
67
- const hooksJson = path.join(sourcePlugin, "hooks.json");
68
- if (fs.existsSync(hooksJson)) {
69
- fs.copyFileSync(hooksJson, path.join(destDir, "hooks.json"));
70
- }
71
- } catch {
72
- // Best-effort
73
- }
74
- }
75
- }
76
-
77
- // --- OpenCode: re-run installer if tool shim or plugin exists ---
78
- const ocToolPath = path.join(
79
- os.homedir(),
80
- ".config",
81
- "opencode",
82
- "tool",
83
- "gmax.ts",
84
- );
85
- const ocPluginPath = path.join(
86
- os.homedir(),
87
- ".config",
88
- "opencode",
89
- "plugins",
90
- "gmax.ts",
91
- );
92
- if (fs.existsSync(ocToolPath) || fs.existsSync(ocPluginPath)) {
93
- try {
94
- execSync("gmax install-opencode", { stdio: "ignore", timeout: 10000 });
95
- } catch {}
96
- }
97
-
98
- // --- Codex: re-run installer if AGENTS.md has gmax skill ---
99
- const codexAgentsPath = path.join(os.homedir(), ".codex", "AGENTS.md");
100
- if (fs.existsSync(codexAgentsPath)) {
101
- try {
102
- const content = fs.readFileSync(codexAgentsPath, "utf-8");
103
- if (content.includes("gmax")) {
104
- execSync("gmax install-codex", { stdio: "ignore", timeout: 10000 });
105
- }
106
- } catch {}
107
- }
108
-
109
- // --- Factory Droid: re-run installer if skill exists ---
110
- const droidSkillPath = path.join(
111
- os.homedir(),
112
- ".factory",
113
- "skills",
114
- "gmax",
115
- "SKILL.md",
116
- );
117
- if (fs.existsSync(droidSkillPath)) {
118
- try {
119
- execSync("gmax install-droid", { stdio: "ignore", timeout: 10000 });
120
- } catch {}
10
+ if (process.env.GMAX_POSTINSTALL_QUIET !== "1") {
11
+ console.log(
12
+ "gmax installed. To install or update editor plugins, run: gmax plugin update",
13
+ );
121
14
  }