assistant-ui 0.0.70 → 0.0.71

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.
@@ -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;AAQpC,eAAO,MAAM,IAAI,SAiEb,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,IAAI,SA8Db,CAAC"}
@@ -5,30 +5,32 @@ import path from "node:path";
5
5
  import { create } from "./create.js";
6
6
  import { logger } from "../lib/utils/logger.js";
7
7
  import { hasConfig } from "../lib/utils/config.js";
8
+ const DEFAULT_REGISTRY_URL = "https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json";
8
9
  export const init = new Command()
9
10
  .name("init")
10
11
  .description("initialize assistant-ui in a new or existing project")
11
12
  .option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd())
13
+ .option("-p, --preset <url>", "preset URL from playground (e.g., https://www.assistant-ui.com/playground/init?preset=chatgpt)")
12
14
  .action(async (opts) => {
13
15
  const cwd = opts.cwd;
14
- // Check if already initialized
16
+ const presetUrl = opts.preset;
15
17
  if (hasConfig(cwd)) {
16
18
  logger.warn("Project is already initialized.");
17
19
  logger.info("Use 'assistant-ui add' to add more components.");
18
20
  return;
19
21
  }
20
- // Check if package.json exists in the current directory
21
22
  const packageJsonPath = path.join(cwd, "package.json");
22
23
  const packageJsonExists = fs.existsSync(packageJsonPath);
23
24
  if (packageJsonExists) {
24
- // If package.json exists, run shadcn add command
25
- logger.info("Initializing assistant-ui in existing project...");
25
+ const registryUrl = presetUrl ?? DEFAULT_REGISTRY_URL;
26
+ if (presetUrl) {
27
+ logger.info("Initializing assistant-ui with preset configuration...");
28
+ }
29
+ else {
30
+ logger.info("Initializing assistant-ui in existing project...");
31
+ }
26
32
  logger.break();
27
- const child = spawn("npx", [
28
- `shadcn@latest`,
29
- "add",
30
- "https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json.json",
31
- ], {
33
+ const child = spawn("npx", [`shadcn@latest`, "add", registryUrl], {
32
34
  stdio: "inherit",
33
35
  cwd,
34
36
  });
@@ -49,10 +51,8 @@ export const init = new Command()
49
51
  });
50
52
  }
51
53
  else {
52
- // If package.json doesn't exist, use the create command
53
54
  logger.info("Creating a new assistant-ui project...");
54
55
  logger.break();
55
- // Execute the create command with default template
56
56
  await create.parseAsync([]);
57
57
  }
58
58
  });
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,oBAAiB;AAClC,OAAO,EAAE,MAAM,EAAE,+BAA4B;AAC7C,OAAO,EAAE,SAAS,EAAE,+BAA4B;AAEhD,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE;KAC9B,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CACL,iBAAiB,EACjB,2DAA2D,EAC3D,OAAO,CAAC,GAAG,EAAE,CACd;KACA,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IAErB,+BAA+B;IAC/B,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC/C,MAAM,CAAC,IAA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,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistant-ui",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
4
4
  "description": "CLI for assistant-ui",
5
5
  "keywords": [
6
6
  "cli",
@@ -6,6 +6,9 @@ import { create } from "./create";
6
6
  import { logger } from "../lib/utils/logger";
7
7
  import { hasConfig } from "../lib/utils/config";
8
8
 
9
+ const DEFAULT_REGISTRY_URL =
10
+ "https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json";
11
+
9
12
  export const init = new Command()
10
13
  .name("init")
11
14
  .description("initialize assistant-ui in a new or existing project")
@@ -14,37 +17,37 @@ export const init = new Command()
14
17
  "the working directory. defaults to the current directory.",
15
18
  process.cwd(),
16
19
  )
20
+ .option(
21
+ "-p, --preset <url>",
22
+ "preset URL from playground (e.g., https://www.assistant-ui.com/playground/init?preset=chatgpt)",
23
+ )
17
24
  .action(async (opts) => {
18
25
  const cwd = opts.cwd;
26
+ const presetUrl = opts.preset;
19
27
 
20
- // Check if already initialized
21
28
  if (hasConfig(cwd)) {
22
29
  logger.warn("Project is already initialized.");
23
30
  logger.info("Use 'assistant-ui add' to add more components.");
24
31
  return;
25
32
  }
26
33
 
27
- // Check if package.json exists in the current directory
28
34
  const packageJsonPath = path.join(cwd, "package.json");
29
35
  const packageJsonExists = fs.existsSync(packageJsonPath);
30
36
 
31
37
  if (packageJsonExists) {
32
- // If package.json exists, run shadcn add command
33
- logger.info("Initializing assistant-ui in existing project...");
38
+ const registryUrl = presetUrl ?? DEFAULT_REGISTRY_URL;
39
+
40
+ if (presetUrl) {
41
+ logger.info("Initializing assistant-ui with preset configuration...");
42
+ } else {
43
+ logger.info("Initializing assistant-ui in existing project...");
44
+ }
34
45
  logger.break();
35
46
 
36
- const child = spawn(
37
- "npx",
38
- [
39
- `shadcn@latest`,
40
- "add",
41
- "https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json.json",
42
- ],
43
- {
44
- stdio: "inherit",
45
- cwd,
46
- },
47
- );
47
+ const child = spawn("npx", [`shadcn@latest`, "add", registryUrl], {
48
+ stdio: "inherit",
49
+ cwd,
50
+ });
48
51
 
49
52
  child.on("error", (error) => {
50
53
  logger.error(`Failed to initialize: ${error.message}`);
@@ -64,11 +67,8 @@ export const init = new Command()
64
67
  }
65
68
  });
66
69
  } else {
67
- // If package.json doesn't exist, use the create command
68
70
  logger.info("Creating a new assistant-ui project...");
69
71
  logger.break();
70
-
71
- // Execute the create command with default template
72
72
  await create.parseAsync([]);
73
73
  }
74
74
  });