getvibez 0.1.1 → 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 +45 -24
  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,28 +66,36 @@ 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
- let already = false;
66
- for (const [bin, ...args] of commandsFor(target)) {
67
- const r = spawnSync(bin, args, { encoding: "utf8" });
68
- const out = (r.stdout ?? "") + (r.stderr ?? "");
69
- // "already added/installed" is success, but only for this step — the
70
- // marketplace may exist while the plugin itself is uninstalled, so the
71
- // install command must still run.
72
- already = /already/i.test(out);
73
- if (r.status !== 0 && !already) {
74
- return { ok: false, detail: out.trim() || `${bin} ${args.join(" ")} exited ${r.status}` };
75
- }
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 };
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 };
76
96
  }
77
- return { ok: true, already };
97
+ if (!installed.ok && !installed.already) return { ok: false, detail: installed.detail };
98
+ return { ok: true };
78
99
  }
79
100
 
80
101
  // Race the question against readline closing: piped stdin hitting EOF
@@ -160,7 +181,7 @@ async function main() {
160
181
  process.stdout.write(`Installing for ${t.name}... `);
161
182
  const result = install(t);
162
183
  if (result.ok) {
163
- console.log(result.already ? "already installed ✓" : "done ✓");
184
+ console.log(result.updated ? "updated to latest ✓" : "done ✓");
164
185
  } else {
165
186
  failed = true;
166
187
  console.log("failed ✗");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getvibez",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },