assistant-ui 0.0.42 → 0.0.44
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/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/{shadcn/add.js → add.js} +4 -4
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/{shadcn/add.mjs → add.mjs} +3 -3
- package/dist/commands/add.mjs.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -21
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/init.mjs +34 -21
- package/dist/commands/init.mjs.map +1 -1
- package/dist/index.js +3 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/commands/shadcn/add.d.ts +0 -3
- package/dist/commands/shadcn/add.d.ts.map +0 -1
- package/dist/commands/shadcn/add.js.map +0 -1
- package/dist/commands/shadcn/add.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,GAAG,SAyCZ,CAAC"}
|
|
@@ -17,16 +17,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/commands/
|
|
20
|
+
// src/commands/add.ts
|
|
21
21
|
var add_exports = {};
|
|
22
22
|
__export(add_exports, {
|
|
23
|
-
|
|
23
|
+
add: () => add
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(add_exports);
|
|
26
26
|
var import_commander = require("commander");
|
|
27
27
|
var import_cross_spawn = require("cross-spawn");
|
|
28
28
|
var REGISTRY_BASE_URL = "https://r.assistant-ui.com";
|
|
29
|
-
var
|
|
29
|
+
var add = new import_commander.Command().name("add").description("add a component to your project").argument("<components...>", "the components to add").option("-y, --yes", "skip confirmation prompt.", true).option("-o, --overwrite", "overwrite existing files.", false).option(
|
|
30
30
|
"-c, --cwd <cwd>",
|
|
31
31
|
"the working directory. defaults to the current directory.",
|
|
32
32
|
process.cwd()
|
|
@@ -57,6 +57,6 @@ var shadcnAdd = new import_commander.Command().name("add").description("add a co
|
|
|
57
57
|
});
|
|
58
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
59
|
0 && (module.exports = {
|
|
60
|
-
|
|
60
|
+
add
|
|
61
61
|
});
|
|
62
62
|
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const add = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\n .option(\"-o, --overwrite\", \"overwrite existing files.\", false)\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9-\\/]+$/.test(c)) {\n throw new Error(`Invalid component name: ${c}`);\n }\n return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;\n });\n\n const args = [`shadcn@latest`, \"add\", ...componentsToAdd];\n\n if (opts.yes) args.push(\"--yes\");\n if (opts.overwrite) args.push(\"--overwrite\");\n if (opts.cwd) args.push(\"--cwd\", opts.cwd);\n if (opts.path) args.push(\"--path\", opts.path);\n\n const child = spawn(\"npx\", args, {\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`other-package-script process exited with code ${code}`);\n }\n });\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,yBAAsB;AAEtB,IAAM,oBAAoB;AAEnB,IAAM,MAAM,IAAI,yBAAQ,EAC5B,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,6BAA6B,IAAI,EACrD,OAAO,mBAAmB,6BAA6B,KAAK,EAC5D;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,CAAC,YAAsB,SAAS;AACtC,QAAM,kBAAkB,WAAW,IAAI,CAAC,MAAM;AAC5C,QAAI,CAAC,oBAAoB,KAAK,CAAC,GAAG;AAChC,YAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AAAA,IAChD;AACA,WAAO,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;AAAA,EACtD,CAAC;AAED,QAAM,OAAO,CAAC,iBAAiB,OAAO,GAAG,eAAe;AAExD,MAAI,KAAK,IAAK,MAAK,KAAK,OAAO;AAC/B,MAAI,KAAK,UAAW,MAAK,KAAK,aAAa;AAC3C,MAAI,KAAK,IAAK,MAAK,KAAK,SAAS,KAAK,GAAG;AACzC,MAAI,KAAK,KAAM,MAAK,KAAK,UAAU,KAAK,IAAI;AAE5C,QAAM,YAAQ,0BAAM,OAAO,MAAM;AAAA,IAC/B,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,YAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,EACzC,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,iDAAiD,IAAI,EAAE;AAAA,IACrE;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// src/commands/
|
|
1
|
+
// src/commands/add.ts
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { spawn } from "cross-spawn";
|
|
4
4
|
var REGISTRY_BASE_URL = "https://r.assistant-ui.com";
|
|
5
|
-
var
|
|
5
|
+
var add = new Command().name("add").description("add a component to your project").argument("<components...>", "the components to add").option("-y, --yes", "skip confirmation prompt.", true).option("-o, --overwrite", "overwrite existing files.", false).option(
|
|
6
6
|
"-c, --cwd <cwd>",
|
|
7
7
|
"the working directory. defaults to the current directory.",
|
|
8
8
|
process.cwd()
|
|
@@ -32,6 +32,6 @@ var shadcnAdd = new Command().name("add").description("add a component to your p
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
add
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=add.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const add = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\n .option(\"-o, --overwrite\", \"overwrite existing files.\", false)\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9-\\/]+$/.test(c)) {\n throw new Error(`Invalid component name: ${c}`);\n }\n return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;\n });\n\n const args = [`shadcn@latest`, \"add\", ...componentsToAdd];\n\n if (opts.yes) args.push(\"--yes\");\n if (opts.overwrite) args.push(\"--overwrite\");\n if (opts.cwd) args.push(\"--cwd\", opts.cwd);\n if (opts.path) args.push(\"--path\", opts.path);\n\n const child = spawn(\"npx\", args, {\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`other-package-script process exited with code ${code}`);\n }\n });\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;AAEtB,IAAM,oBAAoB;AAEnB,IAAM,MAAM,IAAI,QAAQ,EAC5B,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,6BAA6B,IAAI,EACrD,OAAO,mBAAmB,6BAA6B,KAAK,EAC5D;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,CAAC,YAAsB,SAAS;AACtC,QAAM,kBAAkB,WAAW,IAAI,CAAC,MAAM;AAC5C,QAAI,CAAC,oBAAoB,KAAK,CAAC,GAAG;AAChC,YAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AAAA,IAChD;AACA,WAAO,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;AAAA,EACtD,CAAC;AAED,QAAM,OAAO,CAAC,iBAAiB,OAAO,GAAG,eAAe;AAExD,MAAI,KAAK,IAAK,MAAK,KAAK,OAAO;AAC/B,MAAI,KAAK,UAAW,MAAK,KAAK,aAAa;AAC3C,MAAI,KAAK,IAAK,MAAK,KAAK,SAAS,KAAK,GAAG;AACzC,MAAI,KAAK,KAAM,MAAK,KAAK,UAAU,KAAK,IAAI;AAE5C,QAAM,QAAQ,MAAM,OAAO,MAAM;AAAA,IAC/B,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,YAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,EACzC,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,iDAAiD,IAAI,EAAE;AAAA,IACrE;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,IAAI,SA0Cb,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/commands/init.ts
|
|
@@ -25,27 +35,40 @@ __export(init_exports, {
|
|
|
25
35
|
module.exports = __toCommonJS(init_exports);
|
|
26
36
|
var import_commander = require("commander");
|
|
27
37
|
var import_cross_spawn = require("cross-spawn");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
var import_fs = __toESM(require("fs"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var import_chalk = __toESM(require("chalk"));
|
|
41
|
+
var import_create = require("./create.js");
|
|
42
|
+
var init = new import_commander.Command().name("init").description("initialize assistant-ui in a new or existing project").action(async () => {
|
|
43
|
+
const packageJsonPath = import_path.default.join(process.cwd(), "package.json");
|
|
44
|
+
const packageJsonExists = import_fs.default.existsSync(packageJsonPath);
|
|
45
|
+
if (packageJsonExists) {
|
|
46
|
+
console.log(
|
|
47
|
+
import_chalk.default.blue("Initializing assistant-ui in existing project...")
|
|
48
|
+
);
|
|
49
|
+
const child = (0, import_cross_spawn.spawn)(
|
|
50
|
+
"npx",
|
|
51
|
+
[
|
|
52
|
+
`shadcn@latest`,
|
|
53
|
+
"add",
|
|
54
|
+
"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json"
|
|
55
|
+
],
|
|
56
|
+
{
|
|
57
|
+
stdio: "inherit"
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
child.on("error", (error) => {
|
|
61
|
+
console.error(`Error: ${error.message}`);
|
|
62
|
+
});
|
|
63
|
+
child.on("close", (code) => {
|
|
64
|
+
if (code !== 0) {
|
|
65
|
+
console.log(`shadcn process exited with code ${code}`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
console.log(import_chalk.default.blue("Creating a new assistant-ui project..."));
|
|
70
|
+
await import_create.create.parseAsync([]);
|
|
71
|
+
}
|
|
49
72
|
});
|
|
50
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
74
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in a new or existing project\")\n .action(() => {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { create } from \"./create\";\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in a new or existing project\")\n .action(async () => {\n // Check if package.json exists in the current directory\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n // If package.json exists, run shadcn add command\n console.log(\n chalk.blue(\"Initializing assistant-ui in existing project...\"),\n );\n\n const child = spawn(\n \"npx\",\n [\n `shadcn@latest`,\n \"add\",\n \"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json\",\n ],\n {\n stdio: \"inherit\",\n },\n );\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`shadcn process exited with code ${code}`);\n }\n });\n } else {\n // If package.json doesn't exist, use the create command\n console.log(chalk.blue(\"Creating a new assistant-ui project...\"));\n\n // Execute the create command with default template\n await create.parseAsync([]);\n }\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,yBAAsB;AACtB,gBAAe;AACf,kBAAiB;AACjB,mBAAkB;AAClB,oBAAuB;AAEhB,IAAM,OAAO,IAAI,yBAAQ,EAC7B,KAAK,MAAM,EACX,YAAY,sDAAsD,EAClE,OAAO,YAAY;AAElB,QAAM,kBAAkB,YAAAA,QAAK,KAAK,QAAQ,IAAI,GAAG,cAAc;AAC/D,QAAM,oBAAoB,UAAAC,QAAG,WAAW,eAAe;AAEvD,MAAI,mBAAmB;AAErB,YAAQ;AAAA,MACN,aAAAC,QAAM,KAAK,kDAAkD;AAAA,IAC/D;AAEA,UAAM,YAAQ;AAAA,MACZ;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,cAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,IACzC,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,UAAI,SAAS,GAAG;AACd,gBAAQ,IAAI,mCAAmC,IAAI,EAAE;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AAEL,YAAQ,IAAI,aAAAA,QAAM,KAAK,wCAAwC,CAAC;AAGhE,UAAM,qBAAO,WAAW,CAAC,CAAC;AAAA,EAC5B;AACF,CAAC;","names":["path","fs","chalk"]}
|
package/dist/commands/init.mjs
CHANGED
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
// src/commands/init.ts
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { spawn } from "cross-spawn";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import { create } from "./create.mjs";
|
|
8
|
+
var init = new Command().name("init").description("initialize assistant-ui in a new or existing project").action(async () => {
|
|
9
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
10
|
+
const packageJsonExists = fs.existsSync(packageJsonPath);
|
|
11
|
+
if (packageJsonExists) {
|
|
12
|
+
console.log(
|
|
13
|
+
chalk.blue("Initializing assistant-ui in existing project...")
|
|
14
|
+
);
|
|
15
|
+
const child = spawn(
|
|
16
|
+
"npx",
|
|
17
|
+
[
|
|
18
|
+
`shadcn@latest`,
|
|
19
|
+
"add",
|
|
20
|
+
"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
stdio: "inherit"
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
child.on("error", (error) => {
|
|
27
|
+
console.error(`Error: ${error.message}`);
|
|
28
|
+
});
|
|
29
|
+
child.on("close", (code) => {
|
|
30
|
+
if (code !== 0) {
|
|
31
|
+
console.log(`shadcn process exited with code ${code}`);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
console.log(chalk.blue("Creating a new assistant-ui project..."));
|
|
36
|
+
await create.parseAsync([]);
|
|
37
|
+
}
|
|
25
38
|
});
|
|
26
39
|
export {
|
|
27
40
|
init
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in a new or existing project\")\n .action(() => {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { create } from \"./create\";\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in a new or existing project\")\n .action(async () => {\n // Check if package.json exists in the current directory\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n // If package.json exists, run shadcn add command\n console.log(\n chalk.blue(\"Initializing assistant-ui in existing project...\"),\n );\n\n const child = spawn(\n \"npx\",\n [\n `shadcn@latest`,\n \"add\",\n \"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json\",\n ],\n {\n stdio: \"inherit\",\n },\n );\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`shadcn process exited with code ${code}`);\n }\n });\n } else {\n // If package.json doesn't exist, use the create command\n console.log(chalk.blue(\"Creating a new assistant-ui project...\"));\n\n // Execute the create command with default template\n await create.parseAsync([]);\n }\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,cAAc;AAEhB,IAAM,OAAO,IAAI,QAAQ,EAC7B,KAAK,MAAM,EACX,YAAY,sDAAsD,EAClE,OAAO,YAAY;AAElB,QAAM,kBAAkB,KAAK,KAAK,QAAQ,IAAI,GAAG,cAAc;AAC/D,QAAM,oBAAoB,GAAG,WAAW,eAAe;AAEvD,MAAI,mBAAmB;AAErB,YAAQ;AAAA,MACN,MAAM,KAAK,kDAAkD;AAAA,IAC/D;AAEA,UAAM,QAAQ;AAAA,MACZ;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,cAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,IACzC,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,UAAI,SAAS,GAAG;AACd,gBAAQ,IAAI,mCAAmC,IAAI,EAAE;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AAEL,YAAQ,IAAI,MAAM,KAAK,wCAAwC,CAAC;AAGhE,UAAM,OAAO,WAAW,CAAC,CAAC;AAAA,EAC5B;AACF,CAAC;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
3
|
|
|
26
4
|
// src/index.ts
|
|
27
5
|
var import_commander = require("commander");
|
|
28
|
-
var import_package = __toESM(require("../package.json"));
|
|
29
6
|
var import_create = require("./commands/create.js");
|
|
30
|
-
var import_add = require("./commands/
|
|
7
|
+
var import_add = require("./commands/add.js");
|
|
31
8
|
var import_upgrade = require("./commands/upgrade.js");
|
|
32
9
|
var import_init = require("./commands/init.js");
|
|
33
10
|
process.on("SIGINT", () => process.exit(0));
|
|
34
11
|
process.on("SIGTERM", () => process.exit(0));
|
|
35
12
|
function main() {
|
|
36
|
-
const program = new import_commander.Command().name("assistant-ui").description("add components and dependencies to your project")
|
|
37
|
-
|
|
38
|
-
"-v, --version",
|
|
39
|
-
"display the version number"
|
|
40
|
-
);
|
|
41
|
-
program.addCommand(import_add.shadcnAdd);
|
|
13
|
+
const program = new import_commander.Command().name("assistant-ui").description("add components and dependencies to your project");
|
|
14
|
+
program.addCommand(import_add.add);
|
|
42
15
|
program.addCommand(import_create.create);
|
|
43
16
|
program.addCommand(import_init.init);
|
|
44
17
|
program.addCommand(import_upgrade.codemodCommand);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\nimport { create } from \"./commands/create\";\nimport { add } from \"./commands/add\";\nimport { codemodCommand, upgradeCommand } from \"./commands/upgrade\";\nimport { init } from \"./commands/init\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nfunction main() {\n const program = new Command()\n .name(\"assistant-ui\")\n .description(\"add components and dependencies to your project\");\n\n program.addCommand(add);\n program.addCommand(create);\n program.addCommand(init);\n program.addCommand(codemodCommand);\n program.addCommand(upgradeCommand);\n\n program.parse();\n}\n\nmain();\n"],"mappings":";;;;AAEA,uBAAwB;AACxB,oBAAuB;AACvB,iBAAoB;AACpB,qBAA+C;AAC/C,kBAAqB;AAErB,QAAQ,GAAG,UAAU,MAAM,QAAQ,KAAK,CAAC,CAAC;AAC1C,QAAQ,GAAG,WAAW,MAAM,QAAQ,KAAK,CAAC,CAAC;AAE3C,SAAS,OAAO;AACd,QAAM,UAAU,IAAI,yBAAQ,EACzB,KAAK,cAAc,EACnB,YAAY,iDAAiD;AAEhE,UAAQ,WAAW,cAAG;AACtB,UAAQ,WAAW,oBAAM;AACzB,UAAQ,WAAW,gBAAI;AACvB,UAAQ,WAAW,6BAAc;AACjC,UAAQ,WAAW,6BAAc;AAEjC,UAAQ,MAAM;AAChB;AAEA,KAAK;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import packageJson from "../package.json" with { type: "json" };
|
|
6
5
|
import { create } from "./commands/create.mjs";
|
|
7
|
-
import {
|
|
6
|
+
import { add } from "./commands/add.mjs";
|
|
8
7
|
import { codemodCommand, upgradeCommand } from "./commands/upgrade.mjs";
|
|
9
8
|
import { init } from "./commands/init.mjs";
|
|
10
9
|
process.on("SIGINT", () => process.exit(0));
|
|
11
10
|
process.on("SIGTERM", () => process.exit(0));
|
|
12
11
|
function main() {
|
|
13
|
-
const program = new Command().name("assistant-ui").description("add components and dependencies to your project")
|
|
14
|
-
|
|
15
|
-
"-v, --version",
|
|
16
|
-
"display the version number"
|
|
17
|
-
);
|
|
18
|
-
program.addCommand(shadcnAdd);
|
|
12
|
+
const program = new Command().name("assistant-ui").description("add components and dependencies to your project");
|
|
13
|
+
program.addCommand(add);
|
|
19
14
|
program.addCommand(create);
|
|
20
15
|
program.addCommand(init);
|
|
21
16
|
program.addCommand(codemodCommand);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\nimport { create } from \"./commands/create\";\nimport { add } from \"./commands/add\";\nimport { codemodCommand, upgradeCommand } from \"./commands/upgrade\";\nimport { init } from \"./commands/init\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nfunction main() {\n const program = new Command()\n .name(\"assistant-ui\")\n .description(\"add components and dependencies to your project\");\n\n program.addCommand(add);\n program.addCommand(create);\n program.addCommand(init);\n program.addCommand(codemodCommand);\n program.addCommand(upgradeCommand);\n\n program.parse();\n}\n\nmain();\n"],"mappings":";;;AAEA,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,WAAW;AACpB,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,YAAY;AAErB,QAAQ,GAAG,UAAU,MAAM,QAAQ,KAAK,CAAC,CAAC;AAC1C,QAAQ,GAAG,WAAW,MAAM,QAAQ,KAAK,CAAC,CAAC;AAE3C,SAAS,OAAO;AACd,QAAM,UAAU,IAAI,QAAQ,EACzB,KAAK,cAAc,EACnB,YAAY,iDAAiD;AAEhE,UAAQ,WAAW,GAAG;AACtB,UAAQ,WAAW,MAAM;AACzB,UAAQ,WAAW,IAAI;AACvB,UAAQ,WAAW,cAAc;AACjC,UAAQ,WAAW,cAAc;AAEjC,UAAQ,MAAM;AAChB;AAEA,KAAK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assistant-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@types/cross-spawn": "^6.0.6",
|
|
19
19
|
"@types/debug": "^4.1.12",
|
|
20
20
|
"@types/jscodeshift": "^17.3.0",
|
|
21
|
-
"@types/node": "^22.14.
|
|
21
|
+
"@types/node": "^22.14.1",
|
|
22
22
|
"eslint-config-next": "15.3.0",
|
|
23
23
|
"tsx": "^4.19.3",
|
|
24
|
-
"@assistant-ui/
|
|
25
|
-
"@assistant-ui/
|
|
24
|
+
"@assistant-ui/tsconfig": "0.0.0",
|
|
25
|
+
"@assistant-ui/tsbuildutils": "0.0.1"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"url": "https://github.com/assistant-ui/assistant-ui/issues"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=20.
|
|
45
|
+
"node": ">=20.0.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsx scripts/build.mts"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/shadcn/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,SAAS,SAyClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/shadcn/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const shadcnAdd = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\n .option(\"-o, --overwrite\", \"overwrite existing files.\", false)\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9-\\/]+$/.test(c)) {\n throw new Error(`Invalid component name: ${c}`);\n }\n return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;\n });\n\n const args = [`shadcn@latest`, \"add\", ...componentsToAdd];\n\n if (opts.yes) args.push(\"--yes\");\n if (opts.overwrite) args.push(\"--overwrite\");\n if (opts.cwd) args.push(\"--cwd\", opts.cwd);\n if (opts.path) args.push(\"--path\", opts.path);\n\n const child = spawn(\"npx\", args, {\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`other-package-script process exited with code ${code}`);\n }\n });\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,yBAAsB;AAEtB,IAAM,oBAAoB;AAEnB,IAAM,YAAY,IAAI,yBAAQ,EAClC,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,6BAA6B,IAAI,EACrD,OAAO,mBAAmB,6BAA6B,KAAK,EAC5D;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,CAAC,YAAsB,SAAS;AACtC,QAAM,kBAAkB,WAAW,IAAI,CAAC,MAAM;AAC5C,QAAI,CAAC,oBAAoB,KAAK,CAAC,GAAG;AAChC,YAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AAAA,IAChD;AACA,WAAO,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;AAAA,EACtD,CAAC;AAED,QAAM,OAAO,CAAC,iBAAiB,OAAO,GAAG,eAAe;AAExD,MAAI,KAAK,IAAK,MAAK,KAAK,OAAO;AAC/B,MAAI,KAAK,UAAW,MAAK,KAAK,aAAa;AAC3C,MAAI,KAAK,IAAK,MAAK,KAAK,SAAS,KAAK,GAAG;AACzC,MAAI,KAAK,KAAM,MAAK,KAAK,UAAU,KAAK,IAAI;AAE5C,QAAM,YAAQ,0BAAM,OAAO,MAAM;AAAA,IAC/B,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,YAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,EACzC,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,iDAAiD,IAAI,EAAE;AAAA,IACrE;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/shadcn/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const shadcnAdd = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\n .option(\"-o, --overwrite\", \"overwrite existing files.\", false)\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9-\\/]+$/.test(c)) {\n throw new Error(`Invalid component name: ${c}`);\n }\n return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;\n });\n\n const args = [`shadcn@latest`, \"add\", ...componentsToAdd];\n\n if (opts.yes) args.push(\"--yes\");\n if (opts.overwrite) args.push(\"--overwrite\");\n if (opts.cwd) args.push(\"--cwd\", opts.cwd);\n if (opts.path) args.push(\"--path\", opts.path);\n\n const child = spawn(\"npx\", args, {\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (error) => {\n console.error(`Error: ${error.message}`);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n console.log(`other-package-script process exited with code ${code}`);\n }\n });\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;AAEtB,IAAM,oBAAoB;AAEnB,IAAM,YAAY,IAAI,QAAQ,EAClC,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,6BAA6B,IAAI,EACrD,OAAO,mBAAmB,6BAA6B,KAAK,EAC5D;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,CAAC,YAAsB,SAAS;AACtC,QAAM,kBAAkB,WAAW,IAAI,CAAC,MAAM;AAC5C,QAAI,CAAC,oBAAoB,KAAK,CAAC,GAAG;AAChC,YAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AAAA,IAChD;AACA,WAAO,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;AAAA,EACtD,CAAC;AAED,QAAM,OAAO,CAAC,iBAAiB,OAAO,GAAG,eAAe;AAExD,MAAI,KAAK,IAAK,MAAK,KAAK,OAAO;AAC/B,MAAI,KAAK,UAAW,MAAK,KAAK,aAAa;AAC3C,MAAI,KAAK,IAAK,MAAK,KAAK,SAAS,KAAK,GAAG;AACzC,MAAI,KAAK,KAAM,MAAK,KAAK,UAAU,KAAK,IAAI;AAE5C,QAAM,QAAQ,MAAM,OAAO,MAAM;AAAA,IAC/B,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,YAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AAAA,EACzC,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,iDAAiD,IAAI,EAAE;AAAA,IACrE;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|