ideaco 1.1.7 → 1.1.8
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/bin/ideaco.js
CHANGED
|
@@ -32,6 +32,7 @@ const LOG_FILE = path.join(HOME_DIR, 'server.log');
|
|
|
32
32
|
const DATA_DIR = path.join(HOME_DIR, 'data');
|
|
33
33
|
const WORKSPACE_DIR = path.join(HOME_DIR, 'workspace');
|
|
34
34
|
const BANNER_FILE = path.join(DATA_DIR, 'banner.ans');
|
|
35
|
+
const BUILD_VERSION_FILE = path.join(HOME_DIR, 'build.version');
|
|
35
36
|
const t = createCliT();
|
|
36
37
|
|
|
37
38
|
const args = process.argv.slice(2);
|
|
@@ -340,11 +341,24 @@ function getElectronBin() {
|
|
|
340
341
|
}
|
|
341
342
|
|
|
342
343
|
function ensureBuild() {
|
|
344
|
+
ensureDirs();
|
|
345
|
+
const currentVersion = readPackageVersion();
|
|
346
|
+
const cachedVersion = readBuildVersion();
|
|
347
|
+
const hasBuild = fs.existsSync(path.join(ROOT, '.next'));
|
|
348
|
+
if (currentVersion && cachedVersion === currentVersion && hasBuild) return;
|
|
343
349
|
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
344
|
-
const result = spawnSync(npmBin, ['run', 'build'], {
|
|
350
|
+
const result = spawnSync(npmBin, ['run', 'build'], {
|
|
351
|
+
cwd: ROOT,
|
|
352
|
+
stdio: 'inherit',
|
|
353
|
+
env: {
|
|
354
|
+
...process.env,
|
|
355
|
+
IDEACO_SILENT_INIT: '1',
|
|
356
|
+
},
|
|
357
|
+
});
|
|
345
358
|
if (result.status !== 0) {
|
|
346
359
|
process.exit(result.status ?? 1);
|
|
347
360
|
}
|
|
361
|
+
if (currentVersion) writeBuildVersion(currentVersion);
|
|
348
362
|
}
|
|
349
363
|
|
|
350
364
|
function ensureDependencies() {
|
|
@@ -399,14 +413,6 @@ async function startServer() {
|
|
|
399
413
|
// Tip for user
|
|
400
414
|
console.log(chalk.gray(`\nTip: You can use ${chalk.bold('ideaco ui')} to open the dashboard next time.`));
|
|
401
415
|
|
|
402
|
-
// Try to open Electron first
|
|
403
|
-
try {
|
|
404
|
-
console.log(chalk.cyan(`Opening Electron UI...`));
|
|
405
|
-
await openElectron(port);
|
|
406
|
-
} catch (error) {
|
|
407
|
-
console.log(chalk.yellow('Failed to open Electron UI, falling back to browser...'));
|
|
408
|
-
openUrl(url);
|
|
409
|
-
}
|
|
410
416
|
} catch (err) {
|
|
411
417
|
try { process.kill(child.pid, 'SIGTERM'); } catch {}
|
|
412
418
|
clearPid();
|
|
@@ -497,34 +503,14 @@ async function openElectron(port) {
|
|
|
497
503
|
}
|
|
498
504
|
|
|
499
505
|
async function handleUiCommand() {
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
if (pid && isPidRunning(pid)) {
|
|
505
|
-
try {
|
|
506
|
-
// Simple check if port is responding
|
|
507
|
-
await new Promise((resolve, reject) => {
|
|
508
|
-
const socket = new net.Socket();
|
|
509
|
-
socket.setTimeout(1000);
|
|
510
|
-
socket.on('connect', () => { socket.destroy(); resolve(); });
|
|
511
|
-
socket.on('timeout', () => { socket.destroy(); reject(new Error('timeout')); });
|
|
512
|
-
socket.on('error', (err) => reject(err));
|
|
513
|
-
socket.connect(port, '127.0.0.1');
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
// Service is running, open Electron directly
|
|
517
|
-
console.log(chalk.cyan(`Opening Electron UI on port ${port}...`));
|
|
518
|
-
await openElectron(port);
|
|
519
|
-
return;
|
|
520
|
-
} catch (e) {
|
|
521
|
-
// Port check failed, service might be dead
|
|
522
|
-
}
|
|
506
|
+
const ok = await ensureServerRunning();
|
|
507
|
+
if (!ok) {
|
|
508
|
+
console.log(t('cli.webUnavailable'));
|
|
509
|
+
return;
|
|
523
510
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
await startServer();
|
|
511
|
+
const port = readPort() ?? PORT;
|
|
512
|
+
console.log(chalk.cyan(`Opening Electron UI on port ${port}...`));
|
|
513
|
+
await openElectron(port);
|
|
528
514
|
}
|
|
529
515
|
|
|
530
516
|
function printHelp() {
|
|
@@ -538,6 +524,24 @@ ${t('cli.helpTitle')}
|
|
|
538
524
|
`);
|
|
539
525
|
}
|
|
540
526
|
|
|
527
|
+
function readPackageVersion() {
|
|
528
|
+
try {
|
|
529
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
530
|
+
return pkg.version || null;
|
|
531
|
+
} catch {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function readBuildVersion() {
|
|
537
|
+
if (!fs.existsSync(BUILD_VERSION_FILE)) return null;
|
|
538
|
+
return fs.readFileSync(BUILD_VERSION_FILE, 'utf8').trim() || null;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function writeBuildVersion(version) {
|
|
542
|
+
fs.writeFileSync(BUILD_VERSION_FILE, version);
|
|
543
|
+
}
|
|
544
|
+
|
|
541
545
|
async function main() {
|
|
542
546
|
if (command === 'start') return await startServer();
|
|
543
547
|
if (command === 'stop') return await stopServer();
|
package/package.json
CHANGED
|
@@ -34,6 +34,12 @@ export const EntryType = {
|
|
|
34
34
|
NOTE: 'note', // Notes/memos
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const logInfo = (...args) => {
|
|
38
|
+
if (process.env.IDEACO_SILENT_INIT === '1') return;
|
|
39
|
+
if (process.env.NEXT_PHASE === 'phase-production-build') return;
|
|
40
|
+
console.log(...args);
|
|
41
|
+
};
|
|
42
|
+
|
|
37
43
|
/**
|
|
38
44
|
* Knowledge entry
|
|
39
45
|
*/
|
|
@@ -161,7 +167,7 @@ export class KnowledgeManager {
|
|
|
161
167
|
create(config) {
|
|
162
168
|
const kb = new KnowledgeBase(config);
|
|
163
169
|
this.bases.set(kb.id, kb);
|
|
164
|
-
|
|
170
|
+
logInfo(`📖 Knowledge base created: ${kb.name} (${kb.type})`);
|
|
165
171
|
return kb;
|
|
166
172
|
}
|
|
167
173
|
|
|
@@ -36,6 +36,12 @@ export const SkillCategory = {
|
|
|
36
36
|
DEVOPS: 'devops', // DevOps/deployment
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const logInfo = (...args) => {
|
|
40
|
+
if (process.env.IDEACO_SILENT_INIT === '1') return;
|
|
41
|
+
if (process.env.NEXT_PHASE === 'phase-production-build') return;
|
|
42
|
+
console.log(...args);
|
|
43
|
+
};
|
|
44
|
+
|
|
39
45
|
/**
|
|
40
46
|
* Skill definition
|
|
41
47
|
*/
|
|
@@ -90,7 +96,7 @@ export class SkillRegistry {
|
|
|
90
96
|
skill.state = SkillState.INSTALLED;
|
|
91
97
|
skill.config = { ...config };
|
|
92
98
|
skill.installedAt = new Date();
|
|
93
|
-
|
|
99
|
+
logInfo(`📚 Skill installed: ${skill.definition.name}`);
|
|
94
100
|
return skill;
|
|
95
101
|
}
|
|
96
102
|
|
|
@@ -34,6 +34,11 @@ function tryRequire(moduleName) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const execAsync = promisify(cpExec);
|
|
37
|
+
const logInfo = (...args) => {
|
|
38
|
+
if (process.env.IDEACO_SILENT_INIT === '1') return;
|
|
39
|
+
if (process.env.NEXT_PHASE === 'phase-production-build') return;
|
|
40
|
+
console.log(...args);
|
|
41
|
+
};
|
|
37
42
|
|
|
38
43
|
// Runtime references (lazily fetched to avoid circular dependencies)
|
|
39
44
|
let _sessionManager = null;
|
|
@@ -152,7 +157,7 @@ export class PluginRegistry {
|
|
|
152
157
|
instance.config = { ...config };
|
|
153
158
|
this.plugins.set(manifest.id, instance);
|
|
154
159
|
|
|
155
|
-
|
|
160
|
+
logInfo(`🔌 Plugin installed: ${manifest.name} v${manifest.version}`);
|
|
156
161
|
return instance;
|
|
157
162
|
}
|
|
158
163
|
|
|
@@ -178,7 +183,7 @@ export class PluginRegistry {
|
|
|
178
183
|
|
|
179
184
|
instance.state = PluginState.ENABLED;
|
|
180
185
|
instance.enabledAt = new Date();
|
|
181
|
-
|
|
186
|
+
logInfo(`✅ Plugin enabled: ${instance.manifest.name}`);
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
/**
|