theamify-cli 2.2.0 → 2.2.1

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
@@ -16,15 +16,18 @@ npm install -g theamify-cli
16
16
  The `-g` flag puts the `theamify` command on your system `PATH` (or provisions a user-local runtime under `~/.local/share/theamify`), so you can call it from **any folder and any terminal**:
17
17
 
18
18
  ```bash
19
- theamify # ✨ interactive wizard (detects tools → browsepreview → apply)
19
+ theamify # ✨ interactive wizard (self-check tools → downloadbrowse → apply)
20
20
  theamify list # list all themes with status
21
21
  theamify info <name> # details + terminal preview
22
22
  theamify get <name> # download & cache a theme
23
+ theamify get --all # download every theme up front
23
24
  sudo theamify use <name> # apply to GRUB + rebuild
24
25
  theamify update # update tools (chafa, grub-customizer) + re-download themes
25
26
  theamify status # GRUB & dependency status
26
27
  theamify doctor # diagnose install, GRUB, tools & dependencies
27
- theamify uninstall # remove only theamify (keeps chafa & grub-customizer)
28
+ theamify upgrade # check for & install the latest npm version
29
+ theamify repair # fix a broken install (re-provision the engine)
30
+ theamify uninstall # remove theamify entirely (incl. npm package)
28
31
  ```
29
32
 
30
33
  > 💡 Upgrading is the same command — `npm install -g theamify-cli@latest`, and your downloaded themes & registry edits are preserved.
@@ -43,19 +46,22 @@ theamify uninstall # remove only theamify (keeps chafa & grub-customize
43
46
  | 🩺 **`theamify doctor`** | Diagnose install, GRUB, active theme, registry, tools & dependencies |
44
47
  | 🗑 **Safe uninstall** | Removes **only theamify** — leaves chafa & grub-customizer for later use |
45
48
  | ⌨️ **Ctrl+C / Ctrl+Z safe** | Signal safety net; interactive `sudo` is never frozen |
49
+ | 🔄 **Self-manage (v2.2+)** | `upgrade`, `repair`, auto-update check on every wizard run |
46
50
 
47
51
  ---
48
52
 
49
53
  ## 🧭 Wizard Sequence (every `theamify` run)
50
54
 
51
- 1. **Detect companion tools** — `chafa` then `grub-customizer`. For each:
55
+ 1. **Self-check** — checks npm for a newer `theamify-cli`; offers to update if found. Also self-repairs the engine/runtime.
56
+ 2. **Detect companion tools** — `chafa` then `grub-customizer`. For each:
52
57
  - **Already installed?** → *“Update it now? (or just continue)”* — Continue moves on.
53
58
  - **Missing?** → *“Install `<name>`? Yes/No”* → installs via your package manager (`sudo`), then continues.
54
- 2. **Show the theme picker** — every registry theme with status (`[REMOTE]`/`[CACHED]`/`[ACTIVE]`).
55
- 3. **Pick a theme** optional **terminal thumbnail preview** (needs `chafa`).
56
- 4. **Act** download, apply to GRUB, or open in browser.
59
+ 3. **Download all themes** — asks *“Download all themes now?”* (default Yes) → fetches the whole registry so every theme is instantly previewable/applicable.
60
+ 4. **Show the theme picker** every registry theme with status (`[REMOTE]`/`[CACHED]`/`[ACTIVE]`).
61
+ 5. **Pick a theme** the **terminal thumbnail renders automatically** below the selection (no separate “preview” menu item).
62
+ 6. **Act** — download/update, apply to GRUB, or open in browser. Choose `← Back to theme list` to keep browsing (the wizard never hard-exits until you pick **Quit**).
57
63
 
58
- > Companion tools are installed strictly **before** the browser, so previews are ready when you need them.
64
+ > Companion tools and themes are ready **before** the browser, so thumbnails & applies are instant when you need them.
59
65
 
60
66
  ---
61
67
 
@@ -79,11 +85,12 @@ theamify/
79
85
  ├── bin/theamify.js # npm bin entry → src/cli.js
80
86
  ├── src/
81
87
  │ ├── cli.js # command router + signal safety net
82
- │ ├── core/engine.js # runtime provisioning & engine forwarding
83
- │ ├── commands/manage.js # doctor / status / uninstall
84
- │ ├── wizard/browse.js # interactive wizard (browse → preview → apply)
88
+ │ ├── core/engine.js # runtime provisioning, repair & engine forwarding
89
+ │ ├── commands/manage.js # doctor / status / upgrade / repair / uninstall
90
+ │ ├── wizard/browse.js # interactive wizard (self-check → browse → preview → apply)
85
91
  │ └── lib/
86
92
  │ ├── conf.js # themes.conf registry parser
93
+ │ ├── self.js # version-check / self-update / self-uninstall / rc cleanup
87
94
  │ └── tools.js # companion tools: chafa + grub-customizer
88
95
  ├── vendor/ # bundled bash engine (theamify + lib/ + config/)
89
96
  ├── test/ # unit tests (node:test)
@@ -122,7 +129,10 @@ The wizard manages two companion tools as first-class:
122
129
  - **Detect** → if present, offer to update; if absent, install (with your consent).
123
130
  - **Continue** regardless of Yes/No — the wizard proceeds to the theme picker.
124
131
  - **`theamify update`** updates tools then re-downloads themes.
125
- - **`theamify uninstall`** removes **only** theamify chafa and grub-customizer stay on the system for later use.
132
+ - **`theamify uninstall`** removes **everything theamify owns**: the runtime + all downloaded themes, resets GRUB to the default boot menu, removes the `theamify-cli` npm package, and strips leftover PATH markers from `~/.bashrc` / `~/.zshrc`. Companion tools **chafa** and **grub-customizer** stay on the system for later use — run the command after that and you get a normal `command not found`.
133
+ - **`theamify upgrade`** checks the npm registry and, if a newer version exists, offers to `npm install -g theamify-cli@latest`.
134
+ - **`theamify repair`** re-provisions the engine from the bundled package — the fix for a broken/missing install.
135
+ - Every `theamify` (wizard) run also **auto-checks for updates** and **self-repairs** before showing the theme picker.
126
136
 
127
137
  ---
128
138
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theamify-cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "theamify — GRUB theme manager & interactive browser wizard. Browse, preview, download and apply GRUB boot themes from the terminal.",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -12,7 +12,7 @@ import {
12
12
  } from '../core/engine.js';
13
13
  import { parseThemes, resolveConfPath } from '../lib/conf.js';
14
14
  import { companionToolStatus } from '../lib/tools.js';
15
- import { checkForUpdate, promptSelfUpdate, selfUninstall } from '../lib/self.js';
15
+ import { checkForUpdate, promptSelfUpdate, selfUninstall, cleanRcMarkers } from '../lib/self.js';
16
16
 
17
17
  /** `theamify doctor` — installation, GRUB and dependency health. */
18
18
  export async function runDoctor() {
@@ -190,6 +190,9 @@ export async function runUninstallWizard() {
190
190
  // Remove the npm package so the `theamify` command actually disappears.
191
191
  const npmRemoved = await selfUninstall();
192
192
 
193
+ // Remove leftover PATH markers from ~/.bashrc / ~/.zshrc so zero traces remain.
194
+ await cleanRcMarkers();
195
+
193
196
  // Companion tools (chafa, grub-customizer) are intentionally LEFT in place —
194
197
  // the user may want them for later; uninstall only removes theamify itself.
195
198
  const themeNote = grubReset
package/src/lib/self.js CHANGED
@@ -30,6 +30,33 @@ export async function getLatestVersion() {
30
30
  }
31
31
  }
32
32
 
33
+ /**
34
+ * Remove any leftover `# theamify CLI PATH` + follow-up `export PATH=` line from
35
+ * ~/.bashrc and ~/.zshrc (added by old installs). Called by uninstall so no
36
+ * traces of the tool remain in shell startup files.
37
+ */
38
+ export async function cleanRcMarkers() {
39
+ const rcs = ['.bashrc', '.zshrc'].map((f) => path.join(require('node:os').homedir(), f));
40
+ const marker = '# theamify CLI PATH';
41
+ for (const rc of rcs) {
42
+ try {
43
+ const fs = require('node:fs');
44
+ if (!fs.existsSync(rc)) continue;
45
+ const lines = fs.readFileSync(rc, 'utf8').split('\n');
46
+ const out = [];
47
+ for (let i = 0; i < lines.length; i++) {
48
+ if (lines[i].includes(marker)) {
49
+ // Also drop the immediately-following `export PATH=` line.
50
+ if (lines[i + 1] && /^\s*export PATH=/.test(lines[i + 1])) i++;
51
+ continue;
52
+ }
53
+ out.push(lines[i]);
54
+ }
55
+ fs.writeFileSync(rc, out.join('\n'));
56
+ } catch { /* rc not writable — skip */ }
57
+ }
58
+ }
59
+
33
60
  /**
34
61
  * Check whether the running local version is behind the latest published one.
35
62
  * @returns {Promise<{outdated:boolean, latest:string|null, current:string}>}
package/vendor/theamify CHANGED
@@ -10,7 +10,7 @@ set -euo pipefail
10
10
  # -----------------------------------------------------------------------------
11
11
  # VERSION & TOOL NAME
12
12
  # -----------------------------------------------------------------------------
13
- readonly VERSION="2.2.0"
13
+ readonly VERSION="2.2.1"
14
14
  readonly TOOL="theamify"
15
15
 
16
16
  # -----------------------------------------------------------------------------