getvibez 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +2 -5
  2. package/cli.mjs +50 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,12 +6,9 @@ One-command installer for the [Vibez](https://github.com/Peter-Zhao-751/Vibez) a
6
6
  npx getvibez
7
7
  ```
8
8
 
9
- Detects which agent CLIs you have (`claude`, `codex`), asks which to install for, and runs each CLI's own plugin manager:
9
+ Detects which agent CLIs you have (`claude`, `codex`), asks which to install for, and runs each CLI's own plugin manager (marketplace add + refresh, then install).
10
10
 
11
- - **Claude Code** `claude plugin marketplace add Peter-Zhao-751/Vibez` + `claude plugin install vibez@plugin`
12
- - **Codex** → `codex plugin marketplace add Peter-Zhao-751/Vibez` + `codex plugin add vibez@vibez`
13
-
14
- Safe to re-run; already-installed plugins are detected and skipped.
11
+ **Re-run it anytime to update**: already-installed plugins are refreshed from the marketplace and updated to the latest version.
15
12
 
16
13
  ## Options
17
14
 
package/cli.mjs CHANGED
@@ -10,21 +10,33 @@ const VERSION = createRequire(import.meta.url)("./package.json").version;
10
10
  const REPO = "Peter-Zhao-751/Vibez";
11
11
  const APP_STORE = "https://apps.apple.com/us/app/ai-coding-focus-vibez/id6775433780";
12
12
 
13
+ // Each target lists its CLI's own plugin-manager invocations:
14
+ // setup (register + refresh the marketplace), install, and — when the
15
+ // plugin is already present — update. Codex has no separate update verb;
16
+ // its `plugin add` reinstalls from the freshly upgraded snapshot.
13
17
  const TARGETS = [
14
18
  {
15
19
  flag: "--claude",
16
20
  name: "Claude Code",
17
21
  bin: "claude",
18
- installVerb: "install",
19
- spec: "vibez@plugin",
22
+ setup: [
23
+ ["plugin", "marketplace", "add", REPO],
24
+ ["plugin", "marketplace", "update", "plugin"],
25
+ ],
26
+ install: ["plugin", "install", "vibez@plugin"],
27
+ update: ["plugin", "update", "vibez@plugin"],
20
28
  installHint: "https://code.claude.com/docs — npm install -g @anthropic-ai/claude-code",
21
29
  },
22
30
  {
23
31
  flag: "--codex",
24
32
  name: "Codex",
25
33
  bin: "codex",
26
- installVerb: "add",
27
- spec: "vibez@vibez",
34
+ setup: [
35
+ ["plugin", "marketplace", "add", REPO],
36
+ ["plugin", "marketplace", "upgrade", "vibez"],
37
+ ],
38
+ install: ["plugin", "add", "vibez@vibez"],
39
+ update: null,
28
40
  installHint: "https://developers.openai.com/codex — npm install -g @openai/codex",
29
41
  },
30
42
  ];
@@ -34,7 +46,8 @@ const HELP = `vibez ${VERSION} — install the Vibez plugin for your agent CLIs
34
46
  Usage: npx getvibez [options]
35
47
 
36
48
  Detects Claude Code and Codex on this machine and installs the Vibez
37
- notification plugin into each via its own plugin manager.
49
+ notification plugin into each via its own plugin manager. Re-run it
50
+ anytime to update already-installed plugins to the latest version.
38
51
 
39
52
  Options:
40
53
  --claude Install for Claude Code only (skips the prompt)
@@ -53,23 +66,35 @@ function onPath(bin) {
53
66
  }
54
67
 
55
68
  function commandsFor(target) {
56
- return [
57
- [target.bin, "plugin", "marketplace", "add", REPO],
58
- [target.bin, "plugin", target.installVerb, target.spec],
59
- ];
69
+ return [...target.setup, target.install].map((args) => [target.bin, ...args]);
60
70
  }
61
71
 
62
- // Runs both plugin commands for a target. "Already added/installed" counts
63
- // as success so re-runs are harmless.
72
+ function run(bin, args) {
73
+ const r = spawnSync(bin, args, { encoding: "utf8" });
74
+ const out = (r.stdout ?? "") + (r.stderr ?? "");
75
+ return {
76
+ ok: r.status === 0,
77
+ already: /already/i.test(out),
78
+ detail: out.trim() || `${bin} ${args.join(" ")} exited ${r.status}`,
79
+ };
80
+ }
81
+
82
+ // Register + refresh the marketplace, then install — or update when the
83
+ // plugin is already present. "Already added/installed" counts as success
84
+ // per step, so re-running is both harmless and how users pull updates.
64
85
  function install(target) {
65
- for (const [bin, ...args] of commandsFor(target)) {
66
- const r = spawnSync(bin, args, { encoding: "utf8" });
67
- const out = (r.stdout ?? "") + (r.stderr ?? "");
68
- if (r.status !== 0 && !/already/i.test(out)) {
69
- return { ok: false, detail: out.trim() || `${bin} ${args.join(" ")} exited ${r.status}` };
70
- }
71
- if (/already/i.test(out)) return { ok: true, already: true };
86
+ for (const args of target.setup) {
87
+ const r = run(target.bin, args);
88
+ if (!r.ok && !r.already) return { ok: false, detail: r.detail };
72
89
  }
90
+ const installed = run(target.bin, target.install);
91
+ if (installed.already && target.update) {
92
+ const updated = run(target.bin, target.update);
93
+ return updated.ok || updated.already
94
+ ? { ok: true, updated: true }
95
+ : { ok: false, detail: updated.detail };
96
+ }
97
+ if (!installed.ok && !installed.already) return { ok: false, detail: installed.detail };
73
98
  return { ok: true };
74
99
  }
75
100
 
@@ -156,7 +181,7 @@ async function main() {
156
181
  process.stdout.write(`Installing for ${t.name}... `);
157
182
  const result = install(t);
158
183
  if (result.ok) {
159
- console.log(result.already ? "already installed ✓" : "done ✓");
184
+ console.log(result.updated ? "updated to latest ✓" : "done ✓");
160
185
  } else {
161
186
  failed = true;
162
187
  console.log("failed ✗");
@@ -170,6 +195,12 @@ Next steps:
170
195
  2. Open a new agent session — it prints your private 4-word Vibez ID.
171
196
  (In Claude Code, /vibez:setup shows it again.)
172
197
  3. Enter the ID in the app's Setup card. One ID covers both agents.`);
198
+ if (selected.some((t) => t.bin === "codex")) {
199
+ console.log(`
200
+ Note: on first launch, Codex will ask you to review and trust the Vibez
201
+ hooks — that's expected (Codex requires a one-time review of any plugin's
202
+ hooks, and again if an update changes them).`);
203
+ }
173
204
  if (failed) process.exit(1);
174
205
  }
175
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getvibez",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },