Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 89a7330

Browse files
committed
feat: add cli v2
1 parent c1d5e17 commit 89a7330

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1618
-3781
lines changed

bun.lock

Lines changed: 1282 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-227 KB
Binary file not shown.

package.json

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
"bin": {
88
"intentui": "dist/index.js"
99
},
10-
"files": [
11-
"dist",
12-
"src/resources",
13-
"LICENSE",
14-
"README.md",
15-
"package.json"
16-
],
10+
"files": ["dist", "src/resources", "LICENSE", "README.md", "package.json"],
1711
"repository": {
1812
"type": "git",
1913
"url": "git+https://github.com/intentuilabs/cli.git"
@@ -32,46 +26,29 @@
3226
"release": "export GITHUB_TOKEN=$(cat .github_token) && release-it",
3327
"typecheck": "tsc --noEmit"
3428
},
35-
"keywords": [
36-
"cli",
37-
"intentui cli",
38-
"Intent UI",
39-
"design-system"
40-
],
29+
"keywords": ["cli", "intentui cli", "Intent UI", "design-system"],
4130
"author": "Irsyad A. Panjaitan",
4231
"license": "MIT",
4332
"devDependencies": {
4433
"@biomejs/biome": "^1.9.4",
45-
"@changesets/cli": "^2.27.11",
46-
"@commitlint/cli": "^19.6.1",
47-
"@commitlint/config-conventional": "^19.6.0",
48-
"@release-it/conventional-changelog": "^10.0.0",
49-
"@types/babel__core": "^7.20.5",
50-
"@types/diff": "^7.0.0",
51-
"@types/figlet": "^1.7.0",
52-
"@types/fs-extra": "^11.0.4",
53-
"@types/inquirer": "^9.0.7",
54-
"@types/node": "^22.10.7",
34+
"@changesets/cli": "^2.29.3",
35+
"@commitlint/cli": "^19.8.1",
36+
"@commitlint/config-conventional": "^19.8.1",
37+
"@release-it/conventional-changelog": "^10.0.1",
38+
"@types/bun": "latest",
5539
"husky": "^9.1.7",
56-
"release-it": "^18.1.1",
40+
"release-it": "^19.0.2",
5741
"rimraf": "^6.0.1",
58-
"typescript": "^5.7.3"
42+
"typescript": "^5.8.3"
5943
},
6044
"dependencies": {
61-
"@antfu/ni": "^23.2.0",
62-
"@inquirer/prompts": "^7.2.3",
63-
"arktype": "^2.0.0",
64-
"async-listen": "^3.0.1",
65-
"chalk": "^5.4.1",
66-
"commander": "^13.0.0",
67-
"diff": "^7.0.0",
68-
"nanoid": "^5.0.9",
69-
"open": "^10.1.0",
70-
"ora": "^8.1.1",
45+
"@effect/cli": "^0.60.1",
46+
"@effect/platform": "^0.81.1",
47+
"@effect/platform-bun": "^0.62.1",
48+
"effect": "^3.14.22",
49+
"nanoid": "^5.1.5",
7150
"rc9": "^2.1.2",
72-
"strip-json-comments": "^5.0.1",
73-
"sucrase": "^3.35.0",
74-
"ts-morph": "^25.0.0"
51+
"shadcn": "^2.5.0"
7552
},
7653
"release-it": {
7754
"git": {

src/commands/add.command.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Args, Command, Options } from "@effect/cli";
2+
import { Effect } from "effect";
3+
import { REGISTRY_URL } from "~/consts";
4+
5+
import { Command as RawCommand } from "@effect/platform";
6+
7+
export const componentNames = Args.text({ name: "componentNames" }).pipe(
8+
Args.repeated,
9+
);
10+
11+
export const componentType = Options.choice("type", ["ui", "block"]).pipe(
12+
Options.withDefault("ui"),
13+
);
14+
15+
export const addCommand = Command.make(
16+
"add",
17+
{ componentNames, componentType },
18+
(config) =>
19+
Effect.gen(function* () {
20+
const componentPaths = yield* Effect.forEach(
21+
config.componentNames,
22+
(name) =>
23+
Effect.succeed(
24+
`${REGISTRY_URL}/r/${config.componentType}-${name}.json`,
25+
),
26+
);
27+
28+
const exitCode = yield* RawCommand.make(
29+
"bunx",
30+
"shadcn",
31+
"add",
32+
...componentPaths,
33+
).pipe(
34+
RawCommand.stdin("inherit"),
35+
RawCommand.stdout("inherit"),
36+
RawCommand.stderr("inherit"),
37+
RawCommand.exitCode,
38+
);
39+
}),
40+
).pipe(Command.withDescription("Adds UI components or blocks to your project."));

0 commit comments

Comments
 (0)