theamify-cli 2.2.0 → 2.2.2
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 +37 -14
- package/package.json +1 -1
- package/src/cli.js +7 -0
- package/src/commands/manage.js +4 -1
- package/src/lib/self.js +30 -0
- package/vendor/theamify +1 -1
package/README.md
CHANGED
|
@@ -16,46 +16,65 @@ 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 (
|
|
19
|
+
theamify # ✨ interactive wizard (self-check → tools → download → browse → 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
|
|
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)
|
|
31
|
+
theamify version # print the version
|
|
32
|
+
theamify help # show all commands
|
|
28
33
|
```
|
|
29
34
|
|
|
35
|
+
> **Command aliases** — `ls` (list), `show` (info), `get`/`fetch`/`download`, `use`/`apply`/`set`, `rm`/`uncache` (remove), `del`/`delete`, `purge-cache` (clean), `browse`/`wizard`/`install` (wizard). \
|
|
36
|
+
> **Version flags** — `-v`, `-V`, `--version` · **Help flags** — `-h`, `--help`
|
|
37
|
+
|
|
30
38
|
> 💡 Upgrading is the same command — `npm install -g theamify-cli@latest`, and your downloaded themes & registry edits are preserved.
|
|
31
39
|
> 🧰 Zero-install run (no permanent install): `npx -y theamify-cli`
|
|
32
40
|
|
|
33
41
|
---
|
|
34
42
|
|
|
35
|
-
## ✨ What's New (
|
|
43
|
+
## ✨ What's New (v2.2.2 — uninstall crash hotfix)
|
|
44
|
+
|
|
45
|
+
| Feature | Details |
|
|
46
|
+
|---|---|
|
|
47
|
+
| 🩹 **`ReferenceError: path is not defined` fixed** | The v2.2.1 uninstall crashed while stripping leftover PATH markers from `~/.bashrc`/`~/.zshrc` — `cleanRcMarkers` used `path`/`os`/`fs` without importing them. Now fixed with proper `node:` imports and guarded by regression tests. |
|
|
48
|
+
| 🔄 **Engine lockstep to v2.2.2** | Bundled engine `VERSION` bumped to match the npm package — no more "update available" nag after a fresh install. |
|
|
49
|
+
|
|
50
|
+
## ✨ What's New (v2.2.1 — release)
|
|
36
51
|
|
|
37
52
|
| Feature | Details |
|
|
38
53
|
|---|---|
|
|
39
54
|
| 🧙 **Interactive wizard** | One command: detect companion tools → pick theme → **preview** → apply |
|
|
40
55
|
| 🧩 **Auto-detected companion tools** | **chafa** (thumbnails) + **grub-customizer** (GUI) are detected first; installed if missing, or **option to update** if present — then it continues on its own |
|
|
41
|
-
| 🖼️ **
|
|
56
|
+
| 🖼️ **Thumbnail by default** | Selecting a cached theme renders its terminal thumbnail **automatically** (no separate “preview” item) |
|
|
42
57
|
| 📦 **npm global install** | Engine provisions itself user-writable (no sudo for downloads) |
|
|
43
58
|
| 🩺 **`theamify doctor`** | Diagnose install, GRUB, active theme, registry, tools & dependencies |
|
|
44
|
-
| 🗑 **
|
|
59
|
+
| 🗑 **Complete uninstall** | Deletes **ALL downloaded themes**, resets GRUB to default, removes the `theamify-cli` npm package **and** strips leftover PATH markers from `~/.bashrc`/`~/.zshrc` — after which `theamify` gives a normal `command not found` |
|
|
45
60
|
| ⌨️ **Ctrl+C / Ctrl+Z safe** | Signal safety net; interactive `sudo` is never frozen |
|
|
61
|
+
| 🔄 **Self-manage (v2.2+)** | `upgrade`, `repair`, auto-update check on every wizard run |
|
|
62
|
+
| 🧹 **Install-flow download-all** | Wizard offers to download every theme up front so each one is instantly previewable/applicable |
|
|
46
63
|
|
|
47
64
|
---
|
|
48
65
|
|
|
49
66
|
## 🧭 Wizard Sequence (every `theamify` run)
|
|
50
67
|
|
|
51
|
-
1. **
|
|
68
|
+
1. **Self-check** — checks npm for a newer `theamify-cli`; offers to update if found. Also self-repairs the engine/runtime.
|
|
69
|
+
2. **Detect companion tools** — `chafa` then `grub-customizer`. For each:
|
|
52
70
|
- **Already installed?** → *“Update it now? (or just continue)”* — Continue moves on.
|
|
53
71
|
- **Missing?** → *“Install `<name>`? Yes/No”* → installs via your package manager (`sudo`), then continues.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
3. **Download all themes** — asks *“Download all themes now?”* (default Yes) → fetches the whole registry so every theme is instantly previewable/applicable.
|
|
73
|
+
4. **Show the theme picker** — every registry theme with status (`[REMOTE]`/`[CACHED]`/`[ACTIVE]`).
|
|
74
|
+
5. **Pick a theme** → the **terminal thumbnail renders automatically** below the selection (no separate “preview” menu item).
|
|
75
|
+
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
76
|
|
|
58
|
-
> Companion tools are
|
|
77
|
+
> Companion tools and themes are ready **before** the browser, so thumbnails & applies are instant when you need them.
|
|
59
78
|
|
|
60
79
|
---
|
|
61
80
|
|
|
@@ -79,11 +98,12 @@ theamify/
|
|
|
79
98
|
├── bin/theamify.js # npm bin entry → src/cli.js
|
|
80
99
|
├── src/
|
|
81
100
|
│ ├── 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)
|
|
101
|
+
│ ├── core/engine.js # runtime provisioning, repair & engine forwarding
|
|
102
|
+
│ ├── commands/manage.js # doctor / status / upgrade / repair / uninstall
|
|
103
|
+
│ ├── wizard/browse.js # interactive wizard (self-check → browse → preview → apply)
|
|
85
104
|
│ └── lib/
|
|
86
105
|
│ ├── conf.js # themes.conf registry parser
|
|
106
|
+
│ ├── self.js # version-check / self-update / self-uninstall / rc cleanup
|
|
87
107
|
│ └── tools.js # companion tools: chafa + grub-customizer
|
|
88
108
|
├── vendor/ # bundled bash engine (theamify + lib/ + config/)
|
|
89
109
|
├── test/ # unit tests (node:test)
|
|
@@ -122,7 +142,10 @@ The wizard manages two companion tools as first-class:
|
|
|
122
142
|
- **Detect** → if present, offer to update; if absent, install (with your consent).
|
|
123
143
|
- **Continue** regardless of Yes/No — the wizard proceeds to the theme picker.
|
|
124
144
|
- **`theamify update`** updates tools then re-downloads themes.
|
|
125
|
-
- **`theamify uninstall`** removes **
|
|
145
|
+
- **`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`.
|
|
146
|
+
- **`theamify upgrade`** checks the npm registry and, if a newer version exists, offers to `npm install -g theamify-cli@latest`.
|
|
147
|
+
- **`theamify repair`** re-provisions the engine from the bundled package — the fix for a broken/missing install.
|
|
148
|
+
- Every `theamify` (wizard) run also **auto-checks for updates** and **self-repairs** before showing the theme picker.
|
|
126
149
|
|
|
127
150
|
---
|
|
128
151
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -73,6 +73,13 @@ const main = defineCommand({
|
|
|
73
73
|
async run({ args }) {
|
|
74
74
|
const [cmd, ...rest] = args._;
|
|
75
75
|
|
|
76
|
+
// citty parses `-V` as a boolean flag into args.V (never reached via args._);
|
|
77
|
+
// treat it as a version request like the other aliases.
|
|
78
|
+
if (args.V) {
|
|
79
|
+
console.log(`theamify v${pkg.version}`);
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
76
83
|
// No arguments → the interactive theme browser wizard.
|
|
77
84
|
if (!cmd) return runThemeBrowser();
|
|
78
85
|
|
package/src/commands/manage.js
CHANGED
|
@@ -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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
3
6
|
import { createRequire } from 'node:module';
|
|
4
7
|
|
|
5
8
|
const require = createRequire(import.meta.url);
|
|
@@ -30,6 +33,33 @@ export async function getLatestVersion() {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Remove any leftover `# theamify CLI PATH` + follow-up `export PATH=` line from
|
|
38
|
+
* ~/.bashrc and ~/.zshrc (added by old installs). Called by uninstall so no
|
|
39
|
+
* traces of the tool remain in shell startup files.
|
|
40
|
+
* @param {string} [homeDir] override the home directory (used by tests)
|
|
41
|
+
*/
|
|
42
|
+
export async function cleanRcMarkers(homeDir = os.homedir()) {
|
|
43
|
+
const rcs = ['.bashrc', '.zshrc'].map((f) => path.join(homeDir, f));
|
|
44
|
+
const marker = '# theamify CLI PATH';
|
|
45
|
+
for (const rc of rcs) {
|
|
46
|
+
try {
|
|
47
|
+
if (!fs.existsSync(rc)) continue;
|
|
48
|
+
const lines = fs.readFileSync(rc, 'utf8').split('\n');
|
|
49
|
+
const out = [];
|
|
50
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51
|
+
if (lines[i].includes(marker)) {
|
|
52
|
+
// Also drop the immediately-following `export PATH=` line.
|
|
53
|
+
if (lines[i + 1] && /^\s*export PATH=/.test(lines[i + 1])) i++;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
out.push(lines[i]);
|
|
57
|
+
}
|
|
58
|
+
fs.writeFileSync(rc, out.join('\n'));
|
|
59
|
+
} catch { /* rc not writable — skip */ }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
33
63
|
/**
|
|
34
64
|
* Check whether the running local version is behind the latest published one.
|
|
35
65
|
* @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.
|
|
13
|
+
readonly VERSION="2.2.2"
|
|
14
14
|
readonly TOOL="theamify"
|
|
15
15
|
|
|
16
16
|
# -----------------------------------------------------------------------------
|