onkol 0.5.0 → 0.5.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.
- package/dist/cli/index.js +35 -16
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -570,32 +570,45 @@ program
|
|
|
570
570
|
console.log(chalk.cyan('[1/3] Updating files from npm package...'));
|
|
571
571
|
try {
|
|
572
572
|
// Find where this CLI is running from — that's the latest package
|
|
573
|
+
// __dirname is dist/cli/, so pkgRoot is the npm package root
|
|
573
574
|
const pkgRoot = resolve(__dirname, '..');
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
575
|
+
const { readdirSync, chmodSync } = await import('fs');
|
|
576
|
+
// Try src/plugin first (has .ts files), then dist/plugin (.js files)
|
|
577
|
+
let pluginUpdated = false;
|
|
578
|
+
for (const candidate of ['src/plugin', 'dist/plugin']) {
|
|
579
|
+
const pluginSrc = resolve(pkgRoot, candidate);
|
|
580
|
+
if (existsSync(pluginSrc)) {
|
|
581
|
+
const pluginDest = resolve(dir, 'plugins/discord-filtered');
|
|
582
|
+
mkdirSync(pluginDest, { recursive: true });
|
|
583
|
+
for (const f of readdirSync(pluginSrc)) {
|
|
584
|
+
if (f.endsWith('.ts') || f.endsWith('.js')) {
|
|
585
|
+
copyFileSync(resolve(pluginSrc, f), resolve(pluginDest, f));
|
|
586
|
+
}
|
|
585
587
|
}
|
|
588
|
+
console.log(chalk.green(` ✓ Plugin files updated (from ${candidate})`));
|
|
589
|
+
pluginUpdated = true;
|
|
590
|
+
break;
|
|
586
591
|
}
|
|
587
|
-
|
|
592
|
+
}
|
|
593
|
+
if (!pluginUpdated) {
|
|
594
|
+
console.log(chalk.yellow(` ⚠ No plugin source found in package (looked in ${pkgRoot})`));
|
|
588
595
|
}
|
|
589
596
|
// Copy scripts
|
|
597
|
+
const scriptsSrc = resolve(pkgRoot, 'scripts');
|
|
590
598
|
if (existsSync(scriptsSrc)) {
|
|
591
|
-
|
|
599
|
+
mkdirSync(resolve(dir, 'scripts'), { recursive: true });
|
|
600
|
+
let count = 0;
|
|
592
601
|
for (const f of readdirSync(scriptsSrc)) {
|
|
593
602
|
if (f.endsWith('.sh')) {
|
|
594
603
|
copyFileSync(resolve(scriptsSrc, f), resolve(dir, 'scripts', f));
|
|
595
604
|
chmodSync(resolve(dir, 'scripts', f), 0o755);
|
|
605
|
+
count++;
|
|
596
606
|
}
|
|
597
607
|
}
|
|
598
|
-
console.log(chalk.green(
|
|
608
|
+
console.log(chalk.green(` ✓ ${count} scripts updated`));
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
console.log(chalk.yellow(` ⚠ No scripts dir found at ${scriptsSrc}`));
|
|
599
612
|
}
|
|
600
613
|
}
|
|
601
614
|
catch (err) {
|
|
@@ -665,11 +678,17 @@ program
|
|
|
665
678
|
--intent "${w.intent}" \
|
|
666
679
|
${resumeArg}`;
|
|
667
680
|
try {
|
|
668
|
-
execSync(cmd, { stdio: 'pipe' });
|
|
681
|
+
const output = execSync(cmd, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
669
682
|
console.log(chalk.green(` ✓ ${w.name} respawned${w.sessionId ? ' (resumed)' : ''}`));
|
|
683
|
+
if (output.trim())
|
|
684
|
+
console.log(chalk.gray(` ${output.trim()}`));
|
|
670
685
|
}
|
|
671
686
|
catch (err) {
|
|
672
|
-
console.log(chalk.red(` ✗ Failed to spawn ${w.name}
|
|
687
|
+
console.log(chalk.red(` ✗ Failed to spawn ${w.name}`));
|
|
688
|
+
if (err.stderr)
|
|
689
|
+
console.log(chalk.red(` stderr: ${err.stderr.toString().trim()}`));
|
|
690
|
+
if (err.stdout)
|
|
691
|
+
console.log(chalk.gray(` stdout: ${err.stdout.toString().trim()}`));
|
|
673
692
|
}
|
|
674
693
|
// Small delay to avoid Discord rate limits
|
|
675
694
|
await new Promise(r => setTimeout(r, 2000));
|