zion 4.3.2 → 5.0.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.
- package/README.md +10 -10
- package/dist/cli.js +37 -37
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
### zion
|
|
2
2
|
|
|
3
|
-
my site,
|
|
3
|
+
my site, dev setup, agent skills and more, in your terminal
|
|
4
4
|
|
|
5
5
|
run `npx zion` to see what it can do
|
|
6
6
|
|
|
7
7
|
#### commands
|
|
8
8
|
|
|
9
|
-
| command
|
|
10
|
-
|
|
|
11
|
-
| `npx zion`
|
|
12
|
-
| `npx zion tui`
|
|
13
|
-
| `npx zion
|
|
14
|
-
| `npx zion skills`
|
|
15
|
-
| `npx zion card`
|
|
16
|
-
| `npx zion now`
|
|
17
|
-
| `npx zion help`
|
|
9
|
+
| command | what it does |
|
|
10
|
+
| ----------------- | ------------------------------------------------------------------------------ |
|
|
11
|
+
| `npx zion` | list commands |
|
|
12
|
+
| `npx zion tui` | open the terminal version of zzzzion.com |
|
|
13
|
+
| `npx zion dot` | set up [my dot setup](https://github.com/zion-off/dot) |
|
|
14
|
+
| `npx zion skills` | install my agent skills |
|
|
15
|
+
| `npx zion card` | let's see paul allen's card |
|
|
16
|
+
| `npx zion now` | see what I'm listening to, reading and coding |
|
|
17
|
+
| `npx zion help` | list commands; `npx zion help <command>` or `npx zion <command> help` for more |
|
|
18
18
|
|
|
19
19
|
Global flags: `--no-color` (or `NO_COLOR`), `--no-input` (never prompt), `-h/--help`, `-v/--version`.
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import os3 from "os";
|
|
|
8
8
|
import path17 from "path";
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "
|
|
11
|
+
var version = "5.0.0";
|
|
12
12
|
|
|
13
13
|
// src/lib/theme.ts
|
|
14
14
|
import { Chalk, supportsColor, supportsColorStderr } from "chalk";
|
|
@@ -315,7 +315,7 @@ var HelpPrinter = class {
|
|
|
315
315
|
home(ctx) {
|
|
316
316
|
const paint = ctx.paint.stdout;
|
|
317
317
|
return render([
|
|
318
|
-
header(paint, ctx, "my site,
|
|
318
|
+
header(paint, ctx, "my site, dev setup, agent skills and more, in your terminal"),
|
|
319
319
|
...this.commandBlocks(paint),
|
|
320
320
|
[indent(`Run ${paint.accent(`${ctx.bin} help <command>`)} for details on a command.`)]
|
|
321
321
|
]);
|
|
@@ -585,7 +585,7 @@ var CardCommand = class {
|
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
587
|
|
|
588
|
-
// src/commands/
|
|
588
|
+
// src/commands/dot/DotCommand.ts
|
|
589
589
|
import path4 from "path";
|
|
590
590
|
|
|
591
591
|
// src/lib/format.ts
|
|
@@ -1140,7 +1140,7 @@ function stateHome(env) {
|
|
|
1140
1140
|
return base && path2.isAbsolute(base) ? base : path2.join(os2.homedir(), ".local", "state");
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
|
-
// src/commands/
|
|
1143
|
+
// src/commands/dot/DotRepository.ts
|
|
1144
1144
|
import { constants } from "fs";
|
|
1145
1145
|
import fs from "fs/promises";
|
|
1146
1146
|
import path3 from "path";
|
|
@@ -1153,7 +1153,7 @@ var NotACloneError = class extends CliError {
|
|
|
1153
1153
|
this.name = "NotACloneError";
|
|
1154
1154
|
}
|
|
1155
1155
|
};
|
|
1156
|
-
var
|
|
1156
|
+
var DotRepository = class {
|
|
1157
1157
|
constructor(git2, source) {
|
|
1158
1158
|
this.git = git2;
|
|
1159
1159
|
this.source = source;
|
|
@@ -1244,9 +1244,14 @@ var DotfilesRepository = class {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
};
|
|
1246
1246
|
|
|
1247
|
-
// src/commands/
|
|
1247
|
+
// src/commands/dot/actions.ts
|
|
1248
1248
|
var ask = { label: "Ask before each step", hint: "confirm every change", flags: [] };
|
|
1249
|
-
var yes = {
|
|
1249
|
+
var yes = {
|
|
1250
|
+
label: "Yes to everything",
|
|
1251
|
+
hint: "no prompts; skips GitHub login and shell change",
|
|
1252
|
+
flags: ["-y"],
|
|
1253
|
+
assumeYes: true
|
|
1254
|
+
};
|
|
1250
1255
|
var dryRun = { label: "Dry run", hint: "preview only, change nothing", flags: ["-n"], dryRun: true };
|
|
1251
1256
|
var apply = { label: "Create the links", hint: "back up anything in the way", flags: [] };
|
|
1252
1257
|
var DOT_ACTIONS = [
|
|
@@ -1280,9 +1285,9 @@ var DOT_ACTIONS = [
|
|
|
1280
1285
|
label: "Uninstall",
|
|
1281
1286
|
hint: "remove symlinks and restore backups",
|
|
1282
1287
|
modes: [],
|
|
1283
|
-
confirm: "Remove the
|
|
1288
|
+
confirm: "Remove the dot symlinks and restore your backups?",
|
|
1284
1289
|
done: {
|
|
1285
|
-
message: "
|
|
1290
|
+
message: "Dot unlinked and backups restored.",
|
|
1286
1291
|
lines: ["The source line in ~/.zshrc and ~/.gitconfig.local were left in place."]
|
|
1287
1292
|
}
|
|
1288
1293
|
}
|
|
@@ -1305,10 +1310,10 @@ function modeFromFlags(action, flags) {
|
|
|
1305
1310
|
return void 0;
|
|
1306
1311
|
}
|
|
1307
1312
|
|
|
1308
|
-
// src/commands/
|
|
1313
|
+
// src/commands/dot/options.ts
|
|
1309
1314
|
import { parseArgs as parseArgs3 } from "util";
|
|
1310
|
-
function
|
|
1311
|
-
const usageHint = `run ${bin}
|
|
1315
|
+
function parseDotOptions(args, bin) {
|
|
1316
|
+
const usageHint = `run ${bin} dot --help for usage`;
|
|
1312
1317
|
let parsed;
|
|
1313
1318
|
try {
|
|
1314
1319
|
parsed = parseArgs3({
|
|
@@ -1347,11 +1352,11 @@ function parseDotfilesOptions(args, bin) {
|
|
|
1347
1352
|
};
|
|
1348
1353
|
}
|
|
1349
1354
|
|
|
1350
|
-
// src/commands/
|
|
1351
|
-
var DIR_ENV = "
|
|
1352
|
-
var defaultDir = (env) => tildify(path4.join(stateHome(env), "zion", "
|
|
1355
|
+
// src/commands/dot/DotCommand.ts
|
|
1356
|
+
var DIR_ENV = "ZION_DOT_DIR";
|
|
1357
|
+
var defaultDir = (env) => tildify(path4.join(stateHome(env), "zion", "dot"));
|
|
1353
1358
|
var SUPPORTED_PLATFORMS = { darwin: "macOS", linux: "Linux" };
|
|
1354
|
-
var
|
|
1359
|
+
var DotCommand = class {
|
|
1355
1360
|
constructor(deps) {
|
|
1356
1361
|
this.deps = deps;
|
|
1357
1362
|
const { slug } = deps.repository.source;
|
|
@@ -1360,31 +1365,26 @@ var DotfilesCommand = class {
|
|
|
1360
1365
|
description: `Clones github.com/${slug} (or updates an existing clone) and runs its dot installer. Without an action, you choose one interactively. The clone lives in --dir, $${DIR_ENV}, the clone an earlier install was made from, or ${defaultDir(this.deps.env)}, in that order.`,
|
|
1361
1366
|
arguments: { title: "Actions", rows: DOT_ACTIONS.map((action) => [action.id, action.hint]) },
|
|
1362
1367
|
options: [
|
|
1363
|
-
["-d, --dir <path>", `where
|
|
1368
|
+
["-d, --dir <path>", `where dot lives (default: ${defaultDir(this.deps.env)})`],
|
|
1364
1369
|
["-y, --yes", "answer yes to every prompt, including uninstall"],
|
|
1365
1370
|
["-n, --dry-run", "show what would happen, change nothing"],
|
|
1366
1371
|
["--no-update", "use an existing clone as is, without pulling"]
|
|
1367
1372
|
],
|
|
1368
|
-
environment: [[DIR_ENV, "where
|
|
1369
|
-
examples: [
|
|
1370
|
-
"dotfiles",
|
|
1371
|
-
"dotfiles install --yes",
|
|
1372
|
-
"dotfiles doctor",
|
|
1373
|
-
"dotfiles link --dry-run --dir ~/src/dotfiles"
|
|
1374
|
-
]
|
|
1373
|
+
environment: [[DIR_ENV, "where dot lives, if --dir is not given"]],
|
|
1374
|
+
examples: ["dot", "dot install --yes", "dot doctor", "dot link --dry-run --dir ~/src/dot"]
|
|
1375
1375
|
};
|
|
1376
1376
|
}
|
|
1377
1377
|
deps;
|
|
1378
|
-
name = "
|
|
1379
|
-
summary = "set up my
|
|
1378
|
+
name = "dot";
|
|
1379
|
+
summary = "set up my dot setup on this machine";
|
|
1380
1380
|
group = "work";
|
|
1381
1381
|
help;
|
|
1382
1382
|
async run(args, ctx) {
|
|
1383
|
-
const options =
|
|
1383
|
+
const options = parseDotOptions(args, ctx.bin);
|
|
1384
1384
|
const ui = this.deps.createPrompter(ctx);
|
|
1385
1385
|
return runSession(ui, async () => {
|
|
1386
1386
|
const { repository, runner: runner2 } = this.deps;
|
|
1387
|
-
ui.intro("
|
|
1387
|
+
ui.intro("dot", `github.com/${repository.source.slug}`);
|
|
1388
1388
|
await this.checkSystem(ui);
|
|
1389
1389
|
const location = await this.chooseLocation(ui, options, ctx);
|
|
1390
1390
|
const action = options.action ?? await this.chooseAction(ui, options, ctx);
|
|
@@ -1411,7 +1411,7 @@ var DotfilesCommand = class {
|
|
|
1411
1411
|
"Checking your system",
|
|
1412
1412
|
async (signal) => {
|
|
1413
1413
|
const os4 = SUPPORTED_PLATFORMS[platform];
|
|
1414
|
-
if (!os4) throw new CliError(`${platform} isn't supported`, "
|
|
1414
|
+
if (!os4) throw new CliError(`${platform} isn't supported`, "dot supports macOS and Linux");
|
|
1415
1415
|
const version3 = await git2.version(signal);
|
|
1416
1416
|
if (!version3) {
|
|
1417
1417
|
throw new CliError(
|
|
@@ -1441,7 +1441,7 @@ var DotfilesCommand = class {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
let checked;
|
|
1443
1443
|
const answer = await ui.text({
|
|
1444
|
-
message: "Where should
|
|
1444
|
+
message: "Where should dot live?",
|
|
1445
1445
|
defaultValue: defaultDir(env),
|
|
1446
1446
|
validate: async (value) => {
|
|
1447
1447
|
checked = await repository.inspect(expandHome(value));
|
|
@@ -1465,7 +1465,7 @@ var DotfilesCommand = class {
|
|
|
1465
1465
|
return ui.select({
|
|
1466
1466
|
message: "What would you like to do?",
|
|
1467
1467
|
options: actions.map((action) => ({ value: action, label: action.label, hint: action.hint })),
|
|
1468
|
-
nonInteractiveHint: `pass an action, e.g. ${ctx.bin}
|
|
1468
|
+
nonInteractiveHint: `pass an action, e.g. ${ctx.bin} dot install (one of: ${actionIds(actions)})`
|
|
1469
1469
|
});
|
|
1470
1470
|
}
|
|
1471
1471
|
/** Flags win; otherwise ask only if the action was picked interactively and has a real choice. */
|
|
@@ -1483,7 +1483,7 @@ var DotfilesCommand = class {
|
|
|
1483
1483
|
return ui.confirm({
|
|
1484
1484
|
message: action.confirm,
|
|
1485
1485
|
defaultValue: false,
|
|
1486
|
-
nonInteractiveHint: `pass --yes to confirm: ${ctx.bin}
|
|
1486
|
+
nonInteractiveHint: `pass --yes to confirm: ${ctx.bin} dot ${action.id} --yes`
|
|
1487
1487
|
});
|
|
1488
1488
|
}
|
|
1489
1489
|
finish(ui, ctx, action, mode, code) {
|
|
@@ -1493,7 +1493,7 @@ var DotfilesCommand = class {
|
|
|
1493
1493
|
else {
|
|
1494
1494
|
ui.outro(action.failed ?? `dot ${action.id} didn't finish cleanly (exit code ${code})`, {
|
|
1495
1495
|
tone: "error",
|
|
1496
|
-
lines: [`Apply the fixes above, then run ${ctx.bin}
|
|
1496
|
+
lines: [`Apply the fixes above, then run ${ctx.bin} dot ${action.id} again.`]
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
@@ -23003,10 +23003,10 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
23003
23003
|
var runner = new NodeProcessRunner();
|
|
23004
23004
|
var git = new CliGit(runner, process.env);
|
|
23005
23005
|
var registry2 = new CommandRegistry().register(
|
|
23006
|
-
new
|
|
23007
|
-
repository: new
|
|
23008
|
-
slug: "zion-off/
|
|
23009
|
-
url: "https://github.com/zion-off/
|
|
23006
|
+
new DotCommand({
|
|
23007
|
+
repository: new DotRepository(git, {
|
|
23008
|
+
slug: "zion-off/dot",
|
|
23009
|
+
url: "https://github.com/zion-off/dot.git",
|
|
23010
23010
|
installer: "bin/dot",
|
|
23011
23011
|
installerLink: path17.join(os3.homedir(), ".local", "bin", "dot")
|
|
23012
23012
|
}),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zion",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "my site,
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "my site, dev setup, agent skills and more, in your terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|