idea-manager 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.ts +27 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-manager",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Turn free-form brainstorming into structured task trees with AI-generated prompts. Built-in MCP Server for autonomous AI agent execution. Local-first with SQLite, cross-PC sync via Git.",
5
5
  "keywords": [
6
6
  "brainstorm",
package/src/cli.ts CHANGED
@@ -111,27 +111,46 @@ program
111
111
 
112
112
  program
113
113
  .command('start')
114
- .description('Start the web UI (Next.js dev server on port 3456)')
114
+ .description('Start the web UI on port 3456')
115
115
  .option('-p, --port <port>', 'Port number', '3456')
116
116
  .action(async (opts) => {
117
117
  const port = opts.port;
118
- console.log(`\n IM - Idea Manager v2`);
119
- console.log(` Starting on http://localhost:${port}\n`);
118
+ const fs = await import('fs');
120
119
 
121
- // Resolve next CLI directly — avoids .bin symlink issues on Windows
122
- // and npm global install hoisting issues
120
+ // Resolve next CLI
123
121
  let nextCli: string;
124
122
  try {
125
123
  nextCli = require.resolve('next/dist/bin/next', { paths: [PKG_ROOT] });
126
124
  } catch {
127
- // Fallback: try to find next package manually
128
125
  nextCli = path.join(PKG_ROOT, 'node_modules', 'next', 'dist', 'bin', 'next');
129
126
  }
130
127
 
131
- const child = spawn(process.execPath, [nextCli, 'dev', '-p', port], {
128
+ // Build if not already built
129
+ const buildDir = path.join(PKG_ROOT, '.next');
130
+ if (!fs.existsSync(buildDir)) {
131
+ console.log('\n IM - First run: building... (this may take a minute)\n');
132
+ const buildResult = spawn(process.execPath, [nextCli, 'build'], {
133
+ cwd: PKG_ROOT,
134
+ stdio: 'inherit',
135
+ env: { ...process.env, NODE_ENV: 'production' },
136
+ });
137
+ await new Promise<void>((resolve, reject) => {
138
+ buildResult.on('exit', (code) => {
139
+ if (code !== 0) reject(new Error(`Build failed with code ${code}`));
140
+ else resolve();
141
+ });
142
+ buildResult.on('error', reject);
143
+ });
144
+ }
145
+
146
+ console.log(`\n IM - Idea Manager`);
147
+ console.log(` Starting on http://localhost:${port}\n`);
148
+
149
+ // Run production server (next start)
150
+ const child = spawn(process.execPath, [nextCli, 'start', '-p', port], {
132
151
  cwd: PKG_ROOT,
133
152
  stdio: 'inherit',
134
- env: { ...process.env, NODE_ENV: 'development' },
153
+ env: { ...process.env, NODE_ENV: 'production' },
135
154
  });
136
155
 
137
156
  child.on('error', (err) => {