@doki-land/nifty 0.0.2 → 0.0.4

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 (44) hide show
  1. package/README.md +29 -0
  2. package/cli/nifty.mjs +11 -11
  3. package/locales/en-US/cli.json +68 -64
  4. package/locales/locales.json +4 -4
  5. package/package.json +20 -16
  6. package/src/cli/authArgs.ts +52 -52
  7. package/src/cli/bump-cmd.ts +55 -55
  8. package/src/cli/bump.ts +237 -237
  9. package/src/cli/change-logs-cmd.ts +97 -97
  10. package/src/cli/cli.ts +47 -45
  11. package/src/cli/context.ts +36 -36
  12. package/src/cli/format-cmd.ts +23 -0
  13. package/src/cli/format.ts +28 -0
  14. package/src/cli/index.ts +9 -9
  15. package/src/cli/install-native-cmd.ts +22 -22
  16. package/src/cli/install-native.ts +80 -80
  17. package/src/cli/lint-cmd.ts +35 -33
  18. package/src/cli/lint.ts +102 -113
  19. package/src/cli/main.ts +1 -1
  20. package/src/cli/options.ts +40 -40
  21. package/src/cli/publish-cmd.ts +38 -34
  22. package/src/cli/publish.ts +95 -95
  23. package/src/cli/resolveNpm.ts +16 -16
  24. package/src/cli/retime-cmd.ts +62 -62
  25. package/src/cli/reword-cmd.ts +87 -87
  26. package/src/cli/trust-cmd.ts +38 -38
  27. package/src/cli/trust.ts +83 -83
  28. package/src/cli/update-cmd.ts +20 -20
  29. package/src/cli/update.ts +32 -185
  30. package/src/cli/upload-cmd.ts +44 -44
  31. package/src/cli/upload.ts +313 -313
  32. package/src/cli/workspace.ts +124 -124
  33. package/src/config/defineConfig.ts +12 -12
  34. package/src/config/detectProject.ts +189 -189
  35. package/src/config/index.ts +25 -25
  36. package/src/config/loadConfig.ts +129 -129
  37. package/src/config/types.ts +57 -57
  38. package/src/git.ts +61 -61
  39. package/src/github.ts +184 -184
  40. package/src/gitmoji.ts +77 -77
  41. package/src/index.ts +36 -36
  42. package/src/native.ts +665 -507
  43. package/src/nifty.ts +95 -95
  44. package/src/types.ts +40 -40
@@ -1,62 +1,62 @@
1
- import type { Cli, ParsedOptions } from "@vmz/commander";
2
-
3
- import { loadNiftyNative } from "../native.js";
4
- import { bootstrapFromOptions } from "./context.js";
5
- import { cwdFrom, str } from "./options.js";
6
-
7
- export function registerRetimeCommand(cli: Cli): void {
8
- const retime = cli.command("retime", "cli.cmd.retime")
9
- .option("-s, --start-date <start>", "cli.opt.start-date")
10
- .option("--end-date <end>", "cli.opt.end-date")
11
- .option("-b, --branch <branch>", "cli.opt.branch")
12
- .option("--tip <ref>", "cli.opt.tip");
13
-
14
- retime
15
- .command("root", "cli.cmd.retime.root")
16
- .option("-s, --start-date <start>", "cli.opt.start-date")
17
- .option("--end-date <end>", "cli.opt.end-date")
18
- .option("-b, --branch <branch>", "cli.opt.branch")
19
- .option("--tip <ref>", "cli.opt.tip")
20
- .option("-m, --message <text>", "cli.opt.message")
21
- .action(async (options) => cmdRetimeRoot(options));
22
-
23
- retime.action(async (options) => cmdRetimeRange(options));
24
- }
25
-
26
- export async function cmdRetimeRange(options: ParsedOptions): Promise<number> {
27
- await bootstrapFromOptions(options);
28
- const commit = options._[0];
29
- if (!commit) {
30
- throw new Error("missing commit hash for range retime");
31
- }
32
- const native = loadNiftyNative();
33
- const report = native.history["retime-range"]({
34
- cwd: cwdFrom(options),
35
- commit,
36
- startDate: str(options, "start-date"),
37
- endDate: str(options, "end-date"),
38
- branch: str(options, "branch"),
39
- tip: str(options, "tip"),
40
- });
41
- printRetimeSummary(report);
42
- return 0;
43
- }
44
-
45
- export async function cmdRetimeRoot(options: ParsedOptions): Promise<number> {
46
- await bootstrapFromOptions(options);
47
- const native = loadNiftyNative();
48
- const report = native.history["retime-root"]({
49
- cwd: cwdFrom(options),
50
- startDate: str(options, "start-date"),
51
- endDate: str(options, "end-date"),
52
- branch: str(options, "branch"),
53
- tip: str(options, "tip"),
54
- message: str(options, "message"),
55
- });
56
- printRetimeSummary(report);
57
- return 0;
58
- }
59
-
60
- function printRetimeSummary(report: { rewritten: number; branch: string; newTip: string }): void {
61
- console.log(`retimed ${report.rewritten} commit(s) on branch ${report.branch}; tip ${report.newTip}`);
62
- }
1
+ import type { Cli, ParsedOptions } from "@vmz/commander";
2
+
3
+ import { loadNiftyNative } from "../native.js";
4
+ import { bootstrapFromOptions } from "./context.js";
5
+ import { cwdFrom, str } from "./options.js";
6
+
7
+ export function registerRetimeCommand(cli: Cli): void {
8
+ const retime = cli.command("retime", "cli.cmd.retime")
9
+ .option("-s, --start-date <start>", "cli.opt.start-date")
10
+ .option("--end-date <end>", "cli.opt.end-date")
11
+ .option("-b, --branch <branch>", "cli.opt.branch")
12
+ .option("--tip <ref>", "cli.opt.tip");
13
+
14
+ retime
15
+ .command("root", "cli.cmd.retime.root")
16
+ .option("-s, --start-date <start>", "cli.opt.start-date")
17
+ .option("--end-date <end>", "cli.opt.end-date")
18
+ .option("-b, --branch <branch>", "cli.opt.branch")
19
+ .option("--tip <ref>", "cli.opt.tip")
20
+ .option("-m, --message <text>", "cli.opt.message")
21
+ .action(async (options) => cmdRetimeRoot(options));
22
+
23
+ retime.action(async (options) => cmdRetimeRange(options));
24
+ }
25
+
26
+ export async function cmdRetimeRange(options: ParsedOptions): Promise<number> {
27
+ await bootstrapFromOptions(options);
28
+ const commit = options._[0];
29
+ if (!commit) {
30
+ throw new Error("missing commit hash for range retime");
31
+ }
32
+ const native = loadNiftyNative();
33
+ const report = native.history["retime-range"]({
34
+ cwd: cwdFrom(options),
35
+ commit,
36
+ startDate: str(options, "start-date"),
37
+ endDate: str(options, "end-date"),
38
+ branch: str(options, "branch"),
39
+ tip: str(options, "tip"),
40
+ });
41
+ printRetimeSummary(report);
42
+ return 0;
43
+ }
44
+
45
+ export async function cmdRetimeRoot(options: ParsedOptions): Promise<number> {
46
+ await bootstrapFromOptions(options);
47
+ const native = loadNiftyNative();
48
+ const report = native.history["retime-root"]({
49
+ cwd: cwdFrom(options),
50
+ startDate: str(options, "start-date"),
51
+ endDate: str(options, "end-date"),
52
+ branch: str(options, "branch"),
53
+ tip: str(options, "tip"),
54
+ message: str(options, "message"),
55
+ });
56
+ printRetimeSummary(report);
57
+ return 0;
58
+ }
59
+
60
+ function printRetimeSummary(report: { rewritten: number; branch: string; newTip: string }): void {
61
+ console.log(`retimed ${report.rewritten} commit(s) on branch ${report.branch}; tip ${report.newTip}`);
62
+ }
@@ -1,87 +1,87 @@
1
- import type { Cli, ParsedOptions } from "@vmz/commander";
2
-
3
- import { loadNiftyNative } from "../native.js";
4
- import { bootstrapFromOptions } from "./context.js";
5
- import { cwdFrom, flag, str } from "./options.js";
6
-
7
- export function registerRewordCommand(cli: Cli): void {
8
- const reword = cli.command("reword", "cli.cmd.reword");
9
-
10
- reword
11
- .command("export", "cli.cmd.reword.export")
12
- .option("--base <ref>", "cli.opt.base")
13
- .option("--ref <ref>", "cli.opt.ref")
14
- .option("--path <file>", "cli.opt.path")
15
- .action(async (options) => cmdRewordExport(options));
16
-
17
- reword
18
- .command("rewrite", "cli.cmd.reword.rewrite")
19
- .option("--base <ref>", "cli.opt.base")
20
- .option("--ref <ref>", "cli.opt.ref")
21
- .option("--path <file>", "cli.opt.path")
22
- .option("--dry-run", "cli.opt.dry-run")
23
- .action(async (options) => cmdRewordRewrite(options));
24
- }
25
-
26
- export async function cmdRewordExport(options: ParsedOptions): Promise<number> {
27
- await bootstrapFromOptions(options);
28
- const base = requireStr(options, "base");
29
- const path = str(options, "path") ?? "reword.pending.json";
30
- const native = loadNiftyNative();
31
- const report = native.history["reword-export"]({
32
- cwd: cwdFrom(options),
33
- base,
34
- ref: str(options, "ref"),
35
- path,
36
- });
37
- console.log(`export: wrote ${report.count} commit entry(ies) to ${report.path}`);
38
- return 0;
39
- }
40
-
41
- export async function cmdRewordRewrite(options: ParsedOptions): Promise<number> {
42
- await bootstrapFromOptions(options);
43
- const base = requireStr(options, "base");
44
- const path = requireStr(options, "path");
45
- const dryRun = flag(options, "dry-run");
46
- const native = loadNiftyNative();
47
- const report = native.history["reword-rewrite"]({
48
- cwd: cwdFrom(options),
49
- base,
50
- ref: str(options, "ref"),
51
- path,
52
- dryRun,
53
- });
54
-
55
- if (dryRun) {
56
- if (report.changes.length === 0) {
57
- console.log("dry-run: no commit objects need rewriting");
58
- return 0;
59
- }
60
- console.log(`dry-run: ${report.changes.length} commit object(s) would be rewritten on ${report.refName}\n`);
61
- for (const change of report.changes) {
62
- console.log(`${change.oldOid} ${change.oldSubject}`);
63
- console.log(` -> ${change.newSubject}`);
64
- if (change.parentsRelinked && !change.messageChanged) {
65
- console.log(" (parent chain relink only)");
66
- }
67
- console.log();
68
- }
69
- return 0;
70
- }
71
-
72
- console.log(
73
- `rewrote ${report.changes.length} commit object(s); ${report.oldTip} -> ${report.newTip ?? report.oldTip}`,
74
- );
75
- for (const change of report.changes) {
76
- console.log(` ${change.oldOid} ${change.newSubject}`);
77
- }
78
- return 0;
79
- }
80
-
81
- function requireStr(options: ParsedOptions, key: string): string {
82
- const value = str(options, key);
83
- if (!value) {
84
- throw new Error(`missing required --${key}`);
85
- }
86
- return value;
87
- }
1
+ import type { Cli, ParsedOptions } from "@vmz/commander";
2
+
3
+ import { loadNiftyNative } from "../native.js";
4
+ import { bootstrapFromOptions } from "./context.js";
5
+ import { cwdFrom, flag, str } from "./options.js";
6
+
7
+ export function registerRewordCommand(cli: Cli): void {
8
+ const reword = cli.command("reword", "cli.cmd.reword");
9
+
10
+ reword
11
+ .command("export", "cli.cmd.reword.export")
12
+ .option("--base <ref>", "cli.opt.base")
13
+ .option("--ref <ref>", "cli.opt.ref")
14
+ .option("--path <file>", "cli.opt.path")
15
+ .action(async (options) => cmdRewordExport(options));
16
+
17
+ reword
18
+ .command("rewrite", "cli.cmd.reword.rewrite")
19
+ .option("--base <ref>", "cli.opt.base")
20
+ .option("--ref <ref>", "cli.opt.ref")
21
+ .option("--path <file>", "cli.opt.path")
22
+ .option("--dry-run", "cli.opt.dry-run")
23
+ .action(async (options) => cmdRewordRewrite(options));
24
+ }
25
+
26
+ export async function cmdRewordExport(options: ParsedOptions): Promise<number> {
27
+ await bootstrapFromOptions(options);
28
+ const base = requireStr(options, "base");
29
+ const path = str(options, "path") ?? "reword.pending.json";
30
+ const native = loadNiftyNative();
31
+ const report = native.history["reword-export"]({
32
+ cwd: cwdFrom(options),
33
+ base,
34
+ ref: str(options, "ref"),
35
+ path,
36
+ });
37
+ console.log(`export: wrote ${report.count} commit entry(ies) to ${report.path}`);
38
+ return 0;
39
+ }
40
+
41
+ export async function cmdRewordRewrite(options: ParsedOptions): Promise<number> {
42
+ await bootstrapFromOptions(options);
43
+ const base = requireStr(options, "base");
44
+ const path = requireStr(options, "path");
45
+ const dryRun = flag(options, "dry-run");
46
+ const native = loadNiftyNative();
47
+ const report = native.history["reword-rewrite"]({
48
+ cwd: cwdFrom(options),
49
+ base,
50
+ ref: str(options, "ref"),
51
+ path,
52
+ dryRun,
53
+ });
54
+
55
+ if (dryRun) {
56
+ if (report.changes.length === 0) {
57
+ console.log("dry-run: no commit objects need rewriting");
58
+ return 0;
59
+ }
60
+ console.log(`dry-run: ${report.changes.length} commit object(s) would be rewritten on ${report.refName}\n`);
61
+ for (const change of report.changes) {
62
+ console.log(`${change.oldOid} ${change.oldSubject}`);
63
+ console.log(` -> ${change.newSubject}`);
64
+ if (change.parentsRelinked && !change.messageChanged) {
65
+ console.log(" (parent chain relink only)");
66
+ }
67
+ console.log();
68
+ }
69
+ return 0;
70
+ }
71
+
72
+ console.log(
73
+ `rewrote ${report.changes.length} commit object(s); ${report.oldTip} -> ${report.newTip ?? report.oldTip}`,
74
+ );
75
+ for (const change of report.changes) {
76
+ console.log(` ${change.oldOid} ${change.newSubject}`);
77
+ }
78
+ return 0;
79
+ }
80
+
81
+ function requireStr(options: ParsedOptions, key: string): string {
82
+ const value = str(options, key);
83
+ if (!value) {
84
+ throw new Error(`missing required --${key}`);
85
+ }
86
+ return value;
87
+ }
@@ -1,38 +1,38 @@
1
- import type { Cli, ParsedOptions } from "@vmz/commander";
2
-
3
- import { loadNiftyNative } from "../native.js";
4
- import { authPayload } from "./authArgs.js";
5
- import { loadConfig } from "../config/loadConfig.js";
6
- import { bootstrapFromOptions } from "./context.js";
7
- import { printTrustReport } from "./trust.js";
8
- import { authFromOptions, cwdFrom, flag, str } from "./options.js";
9
-
10
- export function registerTrustCommand(cli: Cli): void {
11
- cli.command("trust", "cli.cmd.trust")
12
- .option("--dry-run", "cli.opt.dry-run")
13
- .option("--refresh", "cli.opt.refresh")
14
- .option("--only <package>", "cli.opt.only")
15
- .option("--otp <code>", "cli.opt.otp")
16
- .option("--totp-secret <secret>", "cli.opt.totp-secret")
17
- .option("--npm-token <token>", "cli.opt.npm-token")
18
- .action(async (options) => cmdTrust(options));
19
- }
20
-
21
- export async function cmdTrust(options: ParsedOptions): Promise<number> {
22
- await bootstrapFromOptions(options);
23
- const { config } = await loadConfig({ cwd: cwdFrom(options), createIfMissing: false });
24
- const native = loadNiftyNative();
25
- const report = native.publisher["trust-workspace"]({
26
- cwd: cwdFrom(options),
27
- dryRun: flag(options, "dry-run"),
28
- refresh: flag(options, "refresh"),
29
- only: str(options, "only"),
30
- packages: config.publish?.packages,
31
- ...authPayload(authFromOptions(options)),
32
- });
33
- printTrustReport(report);
34
- if (report.failed.length > 0) {
35
- throw new Error(`trust failed for ${report.failed.length} package(s)`);
36
- }
37
- return 0;
38
- }
1
+ import type { Cli, ParsedOptions } from "@vmz/commander";
2
+
3
+ import { loadNiftyNative } from "../native.js";
4
+ import { authPayload } from "./authArgs.js";
5
+ import { loadConfig } from "../config/loadConfig.js";
6
+ import { bootstrapFromOptions } from "./context.js";
7
+ import { printTrustReport } from "./trust.js";
8
+ import { authFromOptions, cwdFrom, flag, str } from "./options.js";
9
+
10
+ export function registerTrustCommand(cli: Cli): void {
11
+ cli.command("trust", "cli.cmd.trust")
12
+ .option("--dry-run", "cli.opt.dry-run")
13
+ .option("--refresh", "cli.opt.refresh")
14
+ .option("--only <package>", "cli.opt.only")
15
+ .option("--otp <code>", "cli.opt.otp")
16
+ .option("--totp-secret <secret>", "cli.opt.totp-secret")
17
+ .option("--npm-token <token>", "cli.opt.npm-token")
18
+ .action(async (options) => cmdTrust(options));
19
+ }
20
+
21
+ export async function cmdTrust(options: ParsedOptions): Promise<number> {
22
+ await bootstrapFromOptions(options);
23
+ const { config } = await loadConfig({ cwd: cwdFrom(options), createIfMissing: false });
24
+ const native = loadNiftyNative();
25
+ const report = native.publisher["trust-workspace"]({
26
+ cwd: cwdFrom(options),
27
+ dryRun: flag(options, "dry-run"),
28
+ refresh: flag(options, "refresh"),
29
+ only: str(options, "only"),
30
+ packages: config.publish?.packages,
31
+ ...authPayload(authFromOptions(options)),
32
+ });
33
+ printTrustReport(report);
34
+ if (report.failed.length > 0) {
35
+ throw new Error(`trust failed for ${report.failed.length} package(s)`);
36
+ }
37
+ return 0;
38
+ }
package/src/cli/trust.ts CHANGED
@@ -1,83 +1,83 @@
1
- import { loadNiftyNative } from "../native.js";
2
- import { authPayload, parseAuthArgs } from "./authArgs.js";
3
-
4
- export type TrustReport = {
5
- root: string;
6
- configured: string[];
7
- skipped: string[];
8
- failed: string[];
9
- };
10
-
11
- export async function runTrust(argv: string[]): Promise<void> {
12
- const options = parseTrustArgs(argv);
13
- const native = loadNiftyNative();
14
- const report = native.publisher["trust-workspace"]({
15
- cwd: options.cwd,
16
- dryRun: options.dryRun,
17
- refresh: options.refresh,
18
- only: options.only,
19
- ...authPayload(options.auth),
20
- });
21
- printTrustReport(report);
22
- }
23
-
24
- function parseTrustArgs(argv: string[]) {
25
- let cwd: string | undefined;
26
- let dryRun = false;
27
- let refresh = false;
28
- let only: string | undefined;
29
- const auth = parseAuthArgs(argv);
30
-
31
- for (let i = 0; i < argv.length; i += 1) {
32
- const arg = argv[i];
33
- if (arg === "--dry-run") {
34
- dryRun = true;
35
- } else if (arg === "--refresh") {
36
- refresh = true;
37
- } else if (arg === "-C" || arg === "--cwd") {
38
- cwd = argv[++i];
39
- } else if (arg === "--only") {
40
- only = argv[++i];
41
- } else if (arg === "-h" || arg === "--help") {
42
- printTrustHelp();
43
- process.exit(0);
44
- }
45
- }
46
-
47
- return { cwd, dryRun, refresh, only, auth };
48
- }
49
-
50
- export function printTrustReport(report: TrustReport): void {
51
- console.log(`trust workspace ${report.root}`);
52
- console.log(` configured: ${report.configured.length}`);
53
- for (const name of report.configured) {
54
- console.log(` + ${name}`);
55
- }
56
- console.log(` skipped: ${report.skipped.length}`);
57
- for (const name of report.skipped) {
58
- console.log(` = ${name}`);
59
- }
60
- if (report.failed.length > 0) {
61
- console.log(` failed: ${report.failed.length}`);
62
- for (const name of report.failed) {
63
- console.log(` ! ${name}`);
64
- }
65
- }
66
- }
67
-
68
- function printTrustHelp(): void {
69
- console.log(`nifty trust — configure npm Trusted Publisher for workspace packages
70
-
71
- Reads NPM_TOTP_SECRET / NPM_OTP / NPM_TOKEN from env or .env.placeholder.local.
72
- Trust list cache lives in .cache/npm-placeholder.json.
73
-
74
- Usage:
75
- nifty trust
76
- nifty trust --only @doki-land/nifty
77
- nifty trust --dry-run
78
- nifty trust --refresh
79
- nifty trust --totp-secret <base32>
80
- nifty trust --otp 123456
81
- nifty trust -C <cwd>
82
- `);
83
- }
1
+ import { loadNiftyNative } from "../native.js";
2
+ import { authPayload, parseAuthArgs } from "./authArgs.js";
3
+
4
+ export type TrustReport = {
5
+ root: string;
6
+ configured: string[];
7
+ skipped: string[];
8
+ failed: string[];
9
+ };
10
+
11
+ export async function runTrust(argv: string[]): Promise<void> {
12
+ const options = parseTrustArgs(argv);
13
+ const native = loadNiftyNative();
14
+ const report = native.publisher["trust-workspace"]({
15
+ cwd: options.cwd,
16
+ dryRun: options.dryRun,
17
+ refresh: options.refresh,
18
+ only: options.only,
19
+ ...authPayload(options.auth),
20
+ });
21
+ printTrustReport(report);
22
+ }
23
+
24
+ function parseTrustArgs(argv: string[]) {
25
+ let cwd: string | undefined;
26
+ let dryRun = false;
27
+ let refresh = false;
28
+ let only: string | undefined;
29
+ const auth = parseAuthArgs(argv);
30
+
31
+ for (let i = 0; i < argv.length; i += 1) {
32
+ const arg = argv[i];
33
+ if (arg === "--dry-run") {
34
+ dryRun = true;
35
+ } else if (arg === "--refresh") {
36
+ refresh = true;
37
+ } else if (arg === "-C" || arg === "--cwd") {
38
+ cwd = argv[++i];
39
+ } else if (arg === "--only") {
40
+ only = argv[++i];
41
+ } else if (arg === "-h" || arg === "--help") {
42
+ printTrustHelp();
43
+ process.exit(0);
44
+ }
45
+ }
46
+
47
+ return { cwd, dryRun, refresh, only, auth };
48
+ }
49
+
50
+ export function printTrustReport(report: TrustReport): void {
51
+ console.log(`trust workspace ${report.root}`);
52
+ console.log(` configured: ${report.configured.length}`);
53
+ for (const name of report.configured) {
54
+ console.log(` + ${name}`);
55
+ }
56
+ console.log(` skipped: ${report.skipped.length}`);
57
+ for (const name of report.skipped) {
58
+ console.log(` = ${name}`);
59
+ }
60
+ if (report.failed.length > 0) {
61
+ console.log(` failed: ${report.failed.length}`);
62
+ for (const name of report.failed) {
63
+ console.log(` ! ${name}`);
64
+ }
65
+ }
66
+ }
67
+
68
+ function printTrustHelp(): void {
69
+ console.log(`nifty trust — configure npm Trusted Publisher for workspace packages
70
+
71
+ Reads NPM_TOTP_SECRET / NPM_OTP / NPM_TOKEN from env or .env.placeholder.local.
72
+ Trust list cache lives in .cache/npm-placeholder.json.
73
+
74
+ Usage:
75
+ nifty trust
76
+ nifty trust --only @doki-land/nifty
77
+ nifty trust --dry-run
78
+ nifty trust --refresh
79
+ nifty trust --totp-secret <base32>
80
+ nifty trust --otp 123456
81
+ nifty trust -C <cwd>
82
+ `);
83
+ }
@@ -1,20 +1,20 @@
1
- import type { Cli, ParsedOptions } from "@vmz/commander";
2
-
3
- import { bootstrapFromOptions } from "./context.js";
4
- import { updateWorkspace } from "./update.js";
5
- import { cwdFrom, flag } from "./options.js";
6
-
7
- export function registerUpdateCommand(cli: Cli): void {
8
- cli.command("update", "cli.cmd.update")
9
- .option("-i, --interactive", "cli.opt.interactive")
10
- .action(async (options) => cmdUpdate(options));
11
- }
12
-
13
- export async function cmdUpdate(options: ParsedOptions): Promise<number> {
14
- await bootstrapFromOptions(options);
15
- await updateWorkspace({
16
- interactive: flag(options, "interactive"),
17
- cwd: cwdFrom(options),
18
- });
19
- return 0;
20
- }
1
+ import type { Cli, ParsedOptions } from "@vmz/commander";
2
+
3
+ import { bootstrapFromOptions } from "./context.js";
4
+ import { updateWorkspace } from "./update.js";
5
+ import { cwdFrom, flag } from "./options.js";
6
+
7
+ export function registerUpdateCommand(cli: Cli): void {
8
+ cli.command("update", "cli.cmd.update")
9
+ .option("-i, --interactive", "cli.opt.interactive")
10
+ .action(async (options) => cmdUpdate(options));
11
+ }
12
+
13
+ export async function cmdUpdate(options: ParsedOptions): Promise<number> {
14
+ await bootstrapFromOptions(options);
15
+ await updateWorkspace({
16
+ interactive: flag(options, "interactive"),
17
+ cwd: cwdFrom(options),
18
+ });
19
+ return 0;
20
+ }