agent-stage 0.2.7 → 0.2.10

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.
@@ -16,9 +16,11 @@ function getTemplateDir() {
16
16
  const currentFilePath = fileURLToPath(import.meta.url);
17
17
  const currentDir = dirname(currentFilePath);
18
18
  // Production: template is next to dist
19
- const prodPath = join(currentDir, '..', '..', '..', '..', 'template');
19
+ // From dist/commands/dev/init.js -> dist/ -> package root
20
+ const prodPath = join(currentDir, '..', '..', '..', 'template');
20
21
  // Development: template is in the source
21
- const devPath = join(currentDir, '..', '..', '..', '..', '..', 'template');
22
+ // From packages/cli/src/commands/dev/init.ts -> packages/cli/
23
+ const devPath = join(currentDir, '..', '..', '..', '..', 'template');
22
24
  if (existsSync(prodPath)) {
23
25
  return prodPath;
24
26
  }
@@ -192,27 +194,25 @@ async function copyTemplateFiles(templateDir, targetDir) {
192
194
  async function configurePackageJson(targetDir) {
193
195
  const packageJsonPath = join(targetDir, 'package.json');
194
196
  const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
195
- // Replace workspace:* with actual version or local path
196
- // In dev mode (monorepo), use file: protocol to reference the local bridge package
197
- // Check if we're in the monorepo by looking for packages/bridge from the CLI location
198
- const currentFilePath = fileURLToPath(import.meta.url);
199
- const localBridgePath = resolve(join(dirname(currentFilePath), '..', '..', '..', '..', '..', 'bridge'));
200
- const isDev = existsSync(localBridgePath);
201
- if (isDev) {
202
- // In dev mode, use file: protocol to reference the local bridge package
203
- // This works with both npm and pnpm
204
- packageJson.dependencies['@agentstage/bridge'] = `file:${localBridgePath}`;
205
- }
206
- else {
207
- // Use npm version for production
208
- packageJson.dependencies['@agentstage/bridge'] = '^0.1.0';
197
+ // Replace all workspace:* dependencies with actual npm versions
198
+ // This fixes the EUNSUPPORTEDPROTOCOL error when users run npm install
199
+ const npmVersions = {
200
+ '@agentstage/render': '^0.2.2',
201
+ '@agentstage/bridge': '^0.1.0',
202
+ 'agent-stage-bridge': '^0.1.0'
203
+ };
204
+ for (const [dep, version] of Object.entries(npmVersions)) {
205
+ if (packageJson.dependencies?.[dep] === 'workspace:*') {
206
+ packageJson.dependencies[dep] = version;
207
+ }
209
208
  }
210
209
  await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
211
210
  }
212
211
  async function installDependencies(targetDir) {
213
212
  // Check if we're in the monorepo by looking for packages/bridge from the CLI location
213
+ // From packages/cli/src/commands/dev/init.ts -> packages/cli/src/ -> packages/cli/ -> packages/
214
214
  const currentFilePath = fileURLToPath(import.meta.url);
215
- const localBridgePath = resolve(join(dirname(currentFilePath), '..', '..', '..', '..', '..', 'bridge'));
215
+ const localBridgePath = resolve(join(dirname(currentFilePath), '..', '..', '..', '..', 'bridge'));
216
216
  const isDev = existsSync(localBridgePath);
217
217
  if (isDev) {
218
218
  // In development mode (monorepo), use pnpm
package/dist/index.js CHANGED
@@ -1,7 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import consola from 'consola';
4
- // CLI entry point - auto-publish test
4
+ import { readFileSync } from 'fs';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'pathe';
7
+ // Read version from package.json
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
5
10
  import { devCommand } from './commands/dev/index.js';
6
11
  import { pageCommand } from './commands/page/index.js';
7
12
  import { runCommand } from './commands/run/index.js';
@@ -10,7 +15,7 @@ const program = new Command();
10
15
  program
11
16
  .name('agentstage')
12
17
  .description('Agent UI Stage CLI - Create interactive UI for AI agents')
13
- .version('0.2.0');
18
+ .version(pkg.version);
14
19
  // New command structure
15
20
  program.addCommand(devCommand);
16
21
  program.addCommand(pageCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-stage",
3
- "version": "0.2.7",
3
+ "version": "0.2.10",
4
4
  "files": [
5
5
  "dist",
6
6
  "template"
@@ -31,6 +31,7 @@
31
31
  "scripts": {
32
32
  "dev": "tsx src/index.ts",
33
33
  "build": "rimraf dist && tsc -p tsconfig.build.json",
34
- "typecheck": "pnpm -C ../bridge build && tsc -p tsconfig.json --noEmit"
34
+ "typecheck": "pnpm -C ../bridge build && tsc -p tsconfig.json --noEmit",
35
+ "test:e2e": "bash e2e/run-e2e.sh"
35
36
  }
36
37
  }