assistant-ui 0.0.83 → 0.0.85

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/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import { init } from "./commands/init";
8
8
  import { update } from "./commands/update";
9
9
  import { mcp } from "./commands/mcp";
10
10
  import { agent } from "./commands/agent";
11
+ import { info } from "./commands/info";
11
12
 
12
13
  process.on("SIGINT", () => process.exit(0));
13
14
  process.on("SIGTERM", () => process.exit(0));
@@ -25,6 +26,7 @@ function main() {
25
26
  program.addCommand(upgradeCommand);
26
27
  program.addCommand(update);
27
28
  program.addCommand(agent);
29
+ program.addCommand(info);
28
30
 
29
31
  program.parse();
30
32
  }
@@ -24,7 +24,7 @@ export function dlxCommand(pm: PackageManagerName): [string, string[]] {
24
24
  export interface TransformOptions {
25
25
  hasLocalComponents: boolean;
26
26
  skipInstall?: boolean;
27
- packageManager?: PackageManagerName;
27
+ packageManager: PackageManagerName;
28
28
  }
29
29
 
30
30
  export async function resolveLatestReleaseRef(): Promise<string | undefined> {
@@ -51,9 +51,12 @@ export async function downloadProject(
51
51
  ? `gh:assistant-ui/assistant-ui/${repoPath}#${ref}`
52
52
  : `gh:assistant-ui/assistant-ui/${repoPath}`;
53
53
 
54
- // Suppress giget's console.debug output
55
- const origDebug = console.debug;
56
- console.debug = () => {};
54
+ // Suppress giget's debug output. The `debug` package (used by the upgrade
55
+ // command) sets process.env.DEBUG at module-load time, and giget logs to
56
+ // console.debug whenever that env var is truthy — even for unrelated
57
+ // namespaces. Temporarily unsetting it targets the root cause.
58
+ const origDebug = process.env.DEBUG;
59
+ delete process.env.DEBUG;
57
60
  try {
58
61
  const downloadPromise = downloadTemplate(source, {
59
62
  dir: destDir,
@@ -80,7 +83,9 @@ export async function downloadProject(
80
83
  clearTimeout(timer!);
81
84
  }
82
85
  } finally {
83
- console.debug = origDebug;
86
+ if (origDebug !== undefined) {
87
+ process.env.DEBUG = origDebug;
88
+ }
84
89
  }
85
90
  }
86
91
 
@@ -110,21 +115,21 @@ export async function transformProject(
110
115
  if (!opts.hasLocalComponents) {
111
116
  logger.step("Transforming project files...");
112
117
 
113
- // 2–5. Transform tsconfig, CSS, scan components, and remove workspace
114
- // components — all independent, run in parallel
118
+ // 2–4. Transform tsconfig, CSS, and scan components in parallel
115
119
  const [, , components] = await Promise.all([
116
120
  transformTsConfig(projectDir),
117
121
  transformCssFiles(projectDir),
118
122
  scanRequiredComponents(projectDir),
119
- removeWorkspaceComponents(projectDir),
120
123
  ]);
121
124
  assistantUI = components.assistantUI;
122
125
  shadcnUI = components.shadcnUI;
126
+
127
+ // 5. Remove workspace components (after scan completes — scan reads these files)
128
+ await removeWorkspaceComponents(projectDir);
123
129
  }
124
130
 
125
131
  // 6. Install dependencies
126
- const pm =
127
- opts.packageManager ?? (await resolvePackageManagerName(projectDir));
132
+ const pm = opts.packageManager;
128
133
  if (!opts.skipInstall) {
129
134
  logger.step("Installing dependencies...");
130
135
  await installDependencies(projectDir, pm);
@@ -153,7 +158,7 @@ async function transformPackageJson(projectDir: string): Promise<void> {
153
158
  const pkgPath = path.join(projectDir, "package.json");
154
159
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
155
160
 
156
- // Remove @assistant-ui/ui (workspace-only package)
161
+ // Remove @assistant-ui/react-ui (workspace-only package)
157
162
  if (pkg.dependencies?.["@assistant-ui/ui"]) {
158
163
  delete pkg.dependencies["@assistant-ui/ui"];
159
164
  }
@@ -246,14 +251,16 @@ async function transformCssFiles(projectDir: string): Promise<void> {
246
251
  for (const file of cssFiles) {
247
252
  const fullPath = path.join(projectDir, file);
248
253
  try {
249
- let content = fs.readFileSync(fullPath, "utf-8");
254
+ const content = fs.readFileSync(fullPath, "utf-8");
250
255
 
251
- content = content.replace(
256
+ const newContent = content.replace(
252
257
  /@source\s+["'][^"']*packages\/ui\/src[^"']*["'];\s*\n?/g,
253
258
  "",
254
259
  );
255
260
 
256
- fs.writeFileSync(fullPath, content);
261
+ if (newContent !== content) {
262
+ fs.writeFileSync(fullPath, newContent);
263
+ }
257
264
  } catch {
258
265
  // Ignore files that cannot be read/written
259
266
  }