@moewolf/moe-icons-cli 0.0.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.
Files changed (103) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +32 -0
  3. package/bin/moeicons.js +20 -0
  4. package/dist/api/client.d.ts +42 -0
  5. package/dist/api/client.js +105 -0
  6. package/dist/auth/callback.d.ts +37 -0
  7. package/dist/auth/callback.js +72 -0
  8. package/dist/auth/device-login.d.ts +29 -0
  9. package/dist/auth/device-login.js +74 -0
  10. package/dist/auth/login.d.ts +41 -0
  11. package/dist/auth/login.js +85 -0
  12. package/dist/auth/open-browser.d.ts +2 -0
  13. package/dist/auth/open-browser.js +15 -0
  14. package/dist/auth/pkce.d.ts +17 -0
  15. package/dist/auth/pkce.js +20 -0
  16. package/dist/auth/token-store.d.ts +38 -0
  17. package/dist/auth/token-store.js +126 -0
  18. package/dist/catalog/catalog.d.ts +32 -0
  19. package/dist/catalog/catalog.js +80 -0
  20. package/dist/catalog/catalog.json +9371 -0
  21. package/dist/cli.d.ts +23 -0
  22. package/dist/cli.js +507 -0
  23. package/dist/commands/parser.d.ts +41 -0
  24. package/dist/commands/parser.js +146 -0
  25. package/dist/core/auth.d.ts +32 -0
  26. package/dist/core/auth.js +131 -0
  27. package/dist/core/bitmap-assets.d.ts +29 -0
  28. package/dist/core/bitmap-assets.js +77 -0
  29. package/dist/core/cli-update.d.ts +43 -0
  30. package/dist/core/cli-update.js +71 -0
  31. package/dist/core/context.d.ts +22 -0
  32. package/dist/core/context.js +1 -0
  33. package/dist/core/free-download.d.ts +66 -0
  34. package/dist/core/free-download.js +193 -0
  35. package/dist/core/generate.d.ts +33 -0
  36. package/dist/core/generate.js +285 -0
  37. package/dist/core/icon-names.d.ts +14 -0
  38. package/dist/core/icon-names.js +54 -0
  39. package/dist/core/init.d.ts +12 -0
  40. package/dist/core/init.js +23 -0
  41. package/dist/core/install.d.ts +67 -0
  42. package/dist/core/install.js +117 -0
  43. package/dist/core/library-update.d.ts +24 -0
  44. package/dist/core/library-update.js +161 -0
  45. package/dist/core/manage.d.ts +24 -0
  46. package/dist/core/manage.js +38 -0
  47. package/dist/core/pro-download.d.ts +29 -0
  48. package/dist/core/pro-download.js +112 -0
  49. package/dist/core/pro-install.d.ts +24 -0
  50. package/dist/core/pro-install.js +72 -0
  51. package/dist/core/release-descriptor.d.ts +40 -0
  52. package/dist/core/release-descriptor.js +114 -0
  53. package/dist/core/resource-variant.d.ts +35 -0
  54. package/dist/core/resource-variant.js +70 -0
  55. package/dist/core/signed-artifact.d.ts +29 -0
  56. package/dist/core/signed-artifact.js +81 -0
  57. package/dist/core/target-subtree.d.ts +49 -0
  58. package/dist/core/target-subtree.js +132 -0
  59. package/dist/core/update-policy.d.ts +31 -0
  60. package/dist/core/update-policy.js +27 -0
  61. package/dist/core/version-service.d.ts +26 -0
  62. package/dist/core/version-service.js +71 -0
  63. package/dist/core/wizard.d.ts +49 -0
  64. package/dist/core/wizard.js +71 -0
  65. package/dist/errors/errors.d.ts +34 -0
  66. package/dist/errors/errors.js +39 -0
  67. package/dist/errors/index.d.ts +1 -0
  68. package/dist/errors/index.js +1 -0
  69. package/dist/generator/cn.d.ts +5 -0
  70. package/dist/generator/cn.js +14 -0
  71. package/dist/generator/generate.d.ts +34 -0
  72. package/dist/generator/generate.js +562 -0
  73. package/dist/generator/theme-resolve.d.ts +26 -0
  74. package/dist/generator/theme-resolve.js +100 -0
  75. package/dist/mcp/server.d.ts +58 -0
  76. package/dist/mcp/server.js +176 -0
  77. package/dist/project/config.d.ts +74 -0
  78. package/dist/project/config.js +353 -0
  79. package/dist/project/detect.d.ts +26 -0
  80. package/dist/project/detect.js +104 -0
  81. package/dist/project/install-metadata.d.ts +29 -0
  82. package/dist/project/install-metadata.js +108 -0
  83. package/dist/project/install.d.ts +115 -0
  84. package/dist/project/install.js +537 -0
  85. package/dist/project/project-lock.d.ts +11 -0
  86. package/dist/project/project-lock.js +81 -0
  87. package/dist/project/tailwind.d.ts +51 -0
  88. package/dist/project/tailwind.js +188 -0
  89. package/dist/project/tar-gz.d.ts +12 -0
  90. package/dist/project/tar-gz.js +100 -0
  91. package/dist/tui/primitives.d.ts +36 -0
  92. package/dist/tui/primitives.js +88 -0
  93. package/dist/ui/banner.d.ts +11 -0
  94. package/dist/ui/banner.js +105 -0
  95. package/dist/ui/clack.d.ts +8 -0
  96. package/dist/ui/clack.js +53 -0
  97. package/dist/ui/create-ui.d.ts +14 -0
  98. package/dist/ui/create-ui.js +16 -0
  99. package/dist/ui/non-interactive.d.ts +5 -0
  100. package/dist/ui/non-interactive.js +30 -0
  101. package/dist/ui/stream.d.ts +11 -0
  102. package/dist/ui/stream.js +50 -0
  103. package/package.json +70 -0
@@ -0,0 +1,8 @@
1
+ import type { CommandUi } from "../core/context.js";
2
+ /**
3
+ * Clack adapter. Maps Clack's cancel symbol to `undefined` so core never sees
4
+ * Clack types, ANSI, or `process.exit()`.
5
+ */
6
+ export declare function createClackUi(options: {
7
+ readonly yes: boolean;
8
+ }): CommandUi;
@@ -0,0 +1,53 @@
1
+ import * as p from "@clack/prompts";
2
+ import { CliError } from "../errors/index.js";
3
+ function throwIfAborted(signal) {
4
+ if (signal.aborted)
5
+ throw new CliError("CANCELLED", "cancelled");
6
+ }
7
+ /**
8
+ * Clack adapter. Maps Clack's cancel symbol to `undefined` so core never sees
9
+ * Clack types, ANSI, or `process.exit()`.
10
+ */
11
+ export function createClackUi(options) {
12
+ return {
13
+ async select(message, choices, signal) {
14
+ throwIfAborted(signal);
15
+ const value = await p.select({
16
+ message,
17
+ options: choices.map((choice) => ({ value: choice.value, label: choice.label })),
18
+ });
19
+ if (p.isCancel(value))
20
+ return undefined;
21
+ return String(value);
22
+ },
23
+ async confirm(message, signal) {
24
+ throwIfAborted(signal);
25
+ if (options.yes)
26
+ return true;
27
+ const value = await p.confirm({ message });
28
+ if (p.isCancel(value))
29
+ return undefined;
30
+ return value;
31
+ },
32
+ async text(message, signal) {
33
+ throwIfAborted(signal);
34
+ const value = await p.text({ message });
35
+ if (p.isCancel(value))
36
+ return undefined;
37
+ return value;
38
+ },
39
+ note(message) {
40
+ p.note(message);
41
+ },
42
+ progress(message) {
43
+ const spinner = p.spinner();
44
+ spinner.start(message);
45
+ return {
46
+ update(next) { spinner.message(next); },
47
+ stop(done) {
48
+ spinner.stop(done ?? message);
49
+ },
50
+ };
51
+ },
52
+ };
53
+ }
@@ -0,0 +1,14 @@
1
+ import type { CommandUi } from "../core/context.js";
2
+ import { type StreamUiRuntime } from "./stream.js";
3
+ export interface CreateUiOptions {
4
+ readonly json: boolean;
5
+ readonly yes: boolean;
6
+ readonly isTTY: boolean;
7
+ /** Present in tests (and optional in production). When set, skip Clack so prompts are injectable. */
8
+ readonly streams?: StreamUiRuntime;
9
+ }
10
+ /**
11
+ * Pick a UI adapter. `--json` and non-TTY never render Clack/banner-capable prompts.
12
+ * TTY with injected streams uses the stream adapter; real TTY uses Clack.
13
+ */
14
+ export declare function createCommandUi(options: CreateUiOptions): CommandUi;
@@ -0,0 +1,16 @@
1
+ import { createClackUi } from "./clack.js";
2
+ import { createNonInteractiveUi } from "./non-interactive.js";
3
+ import { createStreamUi } from "./stream.js";
4
+ /**
5
+ * Pick a UI adapter. `--json` and non-TTY never render Clack/banner-capable prompts.
6
+ * TTY with injected streams uses the stream adapter; real TTY uses Clack.
7
+ */
8
+ export function createCommandUi(options) {
9
+ if (options.json || !options.isTTY) {
10
+ return createNonInteractiveUi({ yes: options.yes });
11
+ }
12
+ if (options.streams?.readLine) {
13
+ return createStreamUi(options.streams, { yes: options.yes });
14
+ }
15
+ return createClackUi({ yes: options.yes });
16
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandUi } from "../core/context.js";
2
+ /** JSON / non-TTY adapter: never prompts, never writes ANSI, never uses default-yes to continue. */
3
+ export declare function createNonInteractiveUi(options: {
4
+ readonly yes: boolean;
5
+ }): CommandUi;
@@ -0,0 +1,30 @@
1
+ import { CliError } from "../errors/index.js";
2
+ function throwIfAborted(signal) {
3
+ if (signal.aborted)
4
+ throw new CliError("CANCELLED", "cancelled");
5
+ }
6
+ /** JSON / non-TTY adapter: never prompts, never writes ANSI, never uses default-yes to continue. */
7
+ export function createNonInteractiveUi(options) {
8
+ return {
9
+ select(_message, _choices, signal) {
10
+ throwIfAborted(signal);
11
+ return Promise.reject(new CliError("NOT_TTY", "interactive selection requires a TTY; use a specific command or --json"));
12
+ },
13
+ confirm(_message, signal) {
14
+ throwIfAborted(signal);
15
+ if (options.yes)
16
+ return Promise.resolve(true);
17
+ return Promise.reject(new CliError("NOT_TTY", "confirmation requires a TTY; pass --yes to skip"));
18
+ },
19
+ text(_message, signal) {
20
+ throwIfAborted(signal);
21
+ return Promise.reject(new CliError("NOT_TTY", "text input requires a TTY"));
22
+ },
23
+ note() {
24
+ return undefined;
25
+ },
26
+ progress() {
27
+ return { stop() { return undefined; } };
28
+ },
29
+ };
30
+ }
@@ -0,0 +1,11 @@
1
+ import type { CommandUi } from "../core/context.js";
2
+ export interface StreamUiRuntime {
3
+ readonly isTTY: () => boolean;
4
+ readonly stdout: (text: string) => void;
5
+ readonly readLine: (prompt: string) => Promise<string>;
6
+ readonly readKey: () => Promise<string>;
7
+ }
8
+ /** Injected-stream adapter used by tests. Production TTY uses the Clack adapter. */
9
+ export declare function createStreamUi(runtime: StreamUiRuntime, options: {
10
+ readonly yes: boolean;
11
+ }): CommandUi;
@@ -0,0 +1,50 @@
1
+ import { confirm as promptConfirm, select as promptSelect, CancelledError } from "../tui/primitives.js";
2
+ import { CliError } from "../errors/index.js";
3
+ /** Injected-stream adapter used by tests. Production TTY uses the Clack adapter. */
4
+ export function createStreamUi(runtime, options) {
5
+ const deps = {
6
+ streams: {
7
+ isTTY: runtime.isTTY,
8
+ write: runtime.stdout,
9
+ readLine: runtime.readLine,
10
+ readKey: runtime.readKey,
11
+ },
12
+ yes: options.yes,
13
+ };
14
+ return {
15
+ async select(message, choices, signal) {
16
+ try {
17
+ return await promptSelect({ ...deps, signal }, message, { choices, canCancel: true });
18
+ }
19
+ catch (error) {
20
+ if (error instanceof CancelledError)
21
+ return undefined;
22
+ throw error;
23
+ }
24
+ },
25
+ async confirm(message, signal) {
26
+ try {
27
+ return await promptConfirm({ ...deps, signal }, message, true);
28
+ }
29
+ catch (error) {
30
+ if (error instanceof CancelledError)
31
+ return undefined;
32
+ throw error;
33
+ }
34
+ },
35
+ async text(message, signal) {
36
+ if (signal.aborted)
37
+ throw new CliError("CANCELLED", "cancelled");
38
+ if (!runtime.isTTY())
39
+ throw new CliError("NOT_TTY", "text input requires a TTY");
40
+ return runtime.readLine(`${message} `);
41
+ },
42
+ note(message) {
43
+ runtime.stdout(`${message}\n`);
44
+ },
45
+ progress(message) {
46
+ runtime.stdout(`${message}\n`);
47
+ return { update(next) { runtime.stdout(`${next}\n`); }, stop() { return undefined; } };
48
+ },
49
+ };
50
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@moewolf/moe-icons-cli",
3
+ "version": "0.0.1",
4
+ "description": "Moeicons CLI: install React, Vue, Vanilla, or Assets icon targets, manage releases and login, and expose an MCP server.",
5
+ "type": "module",
6
+ "main": "./dist/cli.js",
7
+ "types": "./dist/cli.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/cli.d.ts",
11
+ "import": "./dist/cli.js"
12
+ }
13
+ },
14
+ "license": "Apache-2.0",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/moewolf-dev/moe-icons-cli.git"
18
+ },
19
+ "homepage": "https://github.com/moewolf-dev/moe-icons-cli#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/moewolf-dev/moe-icons-cli/issues"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "bin": {
27
+ "moeicons": "bin/moeicons.js"
28
+ },
29
+ "engines": {
30
+ "node": ">=20.0.0"
31
+ },
32
+ "files": [
33
+ "bin",
34
+ "dist",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "scripts": {
39
+ "generate-banner": "node scripts/generate-banner.mjs",
40
+ "prebuild": "rimraf dist",
41
+ "build": "tsc -p tsconfig.build.json && node scripts/copy-catalog.mjs",
42
+ "typecheck": "tsc -p tsconfig.json --noEmit",
43
+ "lint": "eslint src --ext .ts",
44
+ "test": "vitest run",
45
+ "release:preflight": "node scripts/release-preflight.mjs",
46
+ "prepublishOnly": "npm run release:preflight",
47
+ "format": "prettier --write src tests"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^20.0.0",
51
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
52
+ "@typescript-eslint/parser": "^7.0.0",
53
+ "@vue/server-renderer": "^3.5.41",
54
+ "@vue/test-utils": "^2.4.11",
55
+ "eslint": "^8.57.0",
56
+ "eslint-config-prettier": "^9.1.0",
57
+ "figlet": "^1.11.4",
58
+ "happy-dom": "^20.11.1",
59
+ "prettier": "^3.2.0",
60
+ "typescript": "^5.5.0",
61
+ "vitest": "^2.0.0",
62
+ "vue": "^3.5.41"
63
+ },
64
+ "dependencies": {
65
+ "@clack/prompts": "^0.10.1",
66
+ "commander": "^12.1.0",
67
+ "fflate": "^0.8.2",
68
+ "jsonc-parser": "^3.3.1"
69
+ }
70
+ }