@transight-design/cli 0.2.1 → 0.2.3

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 (2) hide show
  1. package/dist/index.js +55 -6
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -6,10 +6,16 @@ import { Command as Command6 } from "commander";
6
6
  // src/commands/init.ts
7
7
  import { Command } from "commander";
8
8
  import pc2 from "picocolors";
9
+ import * as p from "@clack/prompts";
9
10
 
10
11
  // src/config.ts
11
12
  var GITHUB_REPO = "traverse-corp/transight-design";
12
13
  var BUNDLE_ITEM = "transight-design";
14
+ var BUNDLE_ITEMS = {
15
+ base: "base",
16
+ essential: "essential",
17
+ all: BUNDLE_ITEM
18
+ };
13
19
  var githubAddress = (item, ref) => {
14
20
  const base = `${GITHUB_REPO}/${item}`;
15
21
  return ref ? `${base}#${ref}` : base;
@@ -49,12 +55,55 @@ var runShadcn = (args, options = {}) => {
49
55
  };
50
56
 
51
57
  // src/commands/init.ts
52
- var initCommand = new Command("init").description("Transight Design System \uC804\uCCB4 \uBC88\uB4E4 \uC124\uCE58 (\uD1A0\uD070\xB7\uD3F0\uD2B8\xB7lib\xB7hooks\xB7\uCEF4\uD3EC\uB10C\uD2B8)").option("--dry-run", "\uC2E4\uD589\uD558\uC9C0 \uC54A\uACE0 \uD638\uCD9C\uD560 \uBA85\uB839\uB9CC \uCD9C\uB825", false).option("--ref <ref>", "GitHub \uB808\uD37C\uB7F0\uC2A4 (\uBE0C\uB79C\uCE58\xB7\uD0DC\uADF8\xB7SHA)").action(async (options) => {
58
+ var BUNDLE_CHOICES = [
59
+ {
60
+ value: "base",
61
+ label: "Base \uCEF4\uD3EC\uB10C\uD2B8\uB9CC",
62
+ hint: "shadcn \uD45C\uC900 base \uCEF4\uD3EC\uB10C\uD2B8 (accordion, button, dialog \uB4F1)"
63
+ },
64
+ {
65
+ value: "essential",
66
+ label: "\uD544\uC218 \uCEF4\uD3EC\uB10C\uD2B8\uB9CC",
67
+ hint: "\uC11C\uBE44\uC2A4 \uCD08\uAE30 \uAD6C\uC131\uC5D0 \uD544\uC694\uD55C \uD575\uC2EC \uD3FC/\uC561\uC158 \uCEF4\uD3EC\uB10C\uD2B8"
68
+ },
69
+ {
70
+ value: "all",
71
+ label: "\uC804\uCCB4 \uCEF4\uD3EC\uB10C\uD2B8",
72
+ hint: "\uD1A0\uD070 + \uD3F0\uD2B8 + lib + hook + \uBAA8\uB4E0 \uCEF4\uD3EC\uB10C\uD2B8"
73
+ }
74
+ ];
75
+ var isBundleKey = (value) => value !== void 0 && value in BUNDLE_ITEMS;
76
+ var initCommand = new Command("init").description("Transight Design System \uBC88\uB4E4 \uC124\uCE58 (base / essential / all \uC911 \uC120\uD0DD)").option("--dry-run", "\uC2E4\uD589\uD558\uC9C0 \uC54A\uACE0 \uD638\uCD9C\uD560 \uBA85\uB839\uB9CC \uCD9C\uB825", false).option("--ref <ref>", "GitHub \uB808\uD37C\uB7F0\uC2A4 (\uBE0C\uB79C\uCE58\xB7\uD0DC\uADF8\xB7SHA)").option("--bundle <name>", "\uB300\uD654 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 \u2014 base | essential | all").action(async (options) => {
53
77
  console.log(pc2.bold(pc2.cyan("Transight Design System")) + " \u2014 init");
54
- const code = await runShadcn(
55
- ["add", githubAddress(BUNDLE_ITEM, options.ref)],
56
- { dryRun: options.dryRun }
57
- );
78
+ let bundle = isBundleKey(options.bundle) ? options.bundle : void 0;
79
+ if (!bundle) {
80
+ const selected = await p.select({
81
+ message: "\uC124\uCE58\uD560 \uCEF4\uD3EC\uB10C\uD2B8\uB97C \uC120\uD0DD\uD558\uC138\uC694",
82
+ options: BUNDLE_CHOICES,
83
+ initialValue: "all"
84
+ });
85
+ if (p.isCancel(selected)) {
86
+ p.cancel("\uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
87
+ process.exit(0);
88
+ }
89
+ bundle = selected;
90
+ }
91
+ const itemName = BUNDLE_ITEMS[bundle];
92
+ const code = await runShadcn(["add", githubAddress(itemName, options.ref)], {
93
+ dryRun: options.dryRun
94
+ });
95
+ if (code === 0 && !options.dryRun) {
96
+ const agentInstruction = "transight-design.AGENT.md\uC5D0 \uB530\uB77C \uB514\uC790\uC778 \uC2DC\uC2A4\uD15C \uCD08\uAE30 \uC124\uC815\uC744 \uC801\uC6A9\uD574\uC918";
97
+ console.log("");
98
+ console.log(pc2.green("\u2713 \uC124\uCE58 \uC644\uB8CC"));
99
+ console.log("");
100
+ console.log(pc2.bold("\uB2E4\uC74C\uC73C\uB85C AI Agent\uC5D0\uAC8C \uC544\uB798 \uBB38\uAD6C\uB97C \uC9C0\uC2DC\uD558\uC138\uC694:"));
101
+ console.log("");
102
+ console.log(" " + pc2.cyan(pc2.bold(agentInstruction)));
103
+ console.log("");
104
+ console.log(pc2.dim("(\uC704 \uBB38\uAD6C\uB97C \uADF8\uB300\uB85C \uBCF5\uC0AC\uD574 \uD130\uBBF8\uB110\uC5D0 \uBD99\uC5EC\uB123\uC73C\uC138\uC694)"));
105
+ console.log("");
106
+ }
58
107
  process.exit(code);
59
108
  });
60
109
 
@@ -110,7 +159,7 @@ var resolveComponentPath = (component, override) => {
110
159
  join(process.cwd(), "src", "components", "custom", `${component}.tsx`),
111
160
  join(process.cwd(), "packages", "ui", "src", "components", `${component}.tsx`)
112
161
  ];
113
- return candidates.find((p) => existsSync(p)) ?? null;
162
+ return candidates.find((p2) => existsSync(p2)) ?? null;
114
163
  };
115
164
  var findPresetObjectRange = (source, component) => {
116
165
  const re = /([A-Za-z_$][\w$]*)VariantPresets\s*=\s*\{/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transight-design/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Transight Design System CLI — thin wrapper around `shadcn`",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
+ "@clack/prompts": "^1.6.0",
24
25
  "commander": "^12.1.0",
25
26
  "picocolors": "^1.1.0"
26
27
  },