juno-code 1.0.19 → 1.0.22
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/bin/cli.js +156 -8
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/cli.mjs +155 -8
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/templates/services/codex.py +5 -3
- package/package.json +1 -1
package/dist/bin/cli.mjs
CHANGED
|
@@ -5,6 +5,8 @@ import path3__default, { dirname, join } from 'path';
|
|
|
5
5
|
import * as os2 from 'os';
|
|
6
6
|
import os2__default, { homedir, EOL } from 'os';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
|
+
import semver from 'semver';
|
|
8
10
|
import { z } from 'zod';
|
|
9
11
|
import * as nodeFs from 'fs';
|
|
10
12
|
import { promises } from 'fs';
|
|
@@ -30,7 +32,6 @@ import { v4 } from 'uuid';
|
|
|
30
32
|
import whichPkg from 'which';
|
|
31
33
|
import { glob } from 'glob';
|
|
32
34
|
import fastGlob from 'fast-glob';
|
|
33
|
-
import { createRequire } from 'module';
|
|
34
35
|
|
|
35
36
|
var __defProp = Object.defineProperty;
|
|
36
37
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -306,6 +307,94 @@ var init_service_installer = __esm({
|
|
|
306
307
|
init_version();
|
|
307
308
|
ServiceInstaller = class {
|
|
308
309
|
static SERVICES_DIR = path3.join(homedir(), ".juno_code", "services");
|
|
310
|
+
static VERSION_FILE = path3.join(homedir(), ".juno_code", "services", ".version");
|
|
311
|
+
/**
|
|
312
|
+
* Get the current package version
|
|
313
|
+
*/
|
|
314
|
+
static getPackageVersion() {
|
|
315
|
+
try {
|
|
316
|
+
const __dirname2 = path3.dirname(fileURLToPath(import.meta.url));
|
|
317
|
+
const require3 = createRequire(import.meta.url);
|
|
318
|
+
let packageJsonPath = path3.join(__dirname2, "..", "..", "package.json");
|
|
319
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
320
|
+
const packageJson2 = require3(packageJsonPath);
|
|
321
|
+
return packageJson2.version;
|
|
322
|
+
}
|
|
323
|
+
packageJsonPath = path3.join(__dirname2, "..", "..", "..", "package.json");
|
|
324
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
325
|
+
const packageJson2 = require3(packageJsonPath);
|
|
326
|
+
return packageJson2.version;
|
|
327
|
+
}
|
|
328
|
+
return "0.0.0";
|
|
329
|
+
} catch {
|
|
330
|
+
return "0.0.0";
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Get the installed services version
|
|
335
|
+
*/
|
|
336
|
+
static async getInstalledVersion() {
|
|
337
|
+
try {
|
|
338
|
+
const exists = await fs3.pathExists(this.VERSION_FILE);
|
|
339
|
+
if (!exists) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
const version3 = await fs3.readFile(this.VERSION_FILE, "utf-8");
|
|
343
|
+
return version3.trim();
|
|
344
|
+
} catch {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Save the current package version to the version file
|
|
350
|
+
*/
|
|
351
|
+
static async saveVersion() {
|
|
352
|
+
const version3 = this.getPackageVersion();
|
|
353
|
+
await fs3.writeFile(this.VERSION_FILE, version3, "utf-8");
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Check if services need to be updated based on version
|
|
357
|
+
*/
|
|
358
|
+
static async needsUpdate() {
|
|
359
|
+
try {
|
|
360
|
+
const packageVersion = this.getPackageVersion();
|
|
361
|
+
const installedVersion = await this.getInstalledVersion();
|
|
362
|
+
if (!installedVersion) {
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
const exists = await fs3.pathExists(this.SERVICES_DIR);
|
|
366
|
+
if (!exists) {
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
if (semver.gt(packageVersion, installedVersion)) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
if (semver.eq(packageVersion, installedVersion)) {
|
|
373
|
+
const codexExists = await fs3.pathExists(path3.join(this.SERVICES_DIR, "codex.py"));
|
|
374
|
+
const claudeExists = await fs3.pathExists(path3.join(this.SERVICES_DIR, "claude.py"));
|
|
375
|
+
if (!codexExists || !claudeExists) {
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
const packageServicesDir = this.getPackageServicesDir();
|
|
380
|
+
const packageCodex = path3.join(packageServicesDir, "codex.py");
|
|
381
|
+
const packageClaude = path3.join(packageServicesDir, "claude.py");
|
|
382
|
+
const packageCodexExists = await fs3.pathExists(packageCodex);
|
|
383
|
+
const packageClaudeExists = await fs3.pathExists(packageClaude);
|
|
384
|
+
if (packageCodexExists || packageClaudeExists) {
|
|
385
|
+
const isDevelopment2 = packageServicesDir.includes("/src/");
|
|
386
|
+
if (isDevelopment2) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
} catch {
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return false;
|
|
394
|
+
} catch {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
309
398
|
/**
|
|
310
399
|
* Get the path to the services directory in the package
|
|
311
400
|
*/
|
|
@@ -323,8 +412,9 @@ var init_service_installer = __esm({
|
|
|
323
412
|
}
|
|
324
413
|
/**
|
|
325
414
|
* Install all service scripts to ~/.juno_code/services/
|
|
415
|
+
* @param silent - If true, suppresses console output
|
|
326
416
|
*/
|
|
327
|
-
static async install() {
|
|
417
|
+
static async install(silent = false) {
|
|
328
418
|
try {
|
|
329
419
|
await fs3.ensureDir(this.SERVICES_DIR);
|
|
330
420
|
const packageServicesDir = this.getPackageServicesDir();
|
|
@@ -340,11 +430,45 @@ var init_service_installer = __esm({
|
|
|
340
430
|
await fs3.chmod(filePath, 493);
|
|
341
431
|
}
|
|
342
432
|
}
|
|
343
|
-
|
|
433
|
+
await this.saveVersion();
|
|
434
|
+
if (!silent) {
|
|
435
|
+
console.log(`\u2713 Services installed to: ${this.SERVICES_DIR}`);
|
|
436
|
+
}
|
|
344
437
|
} catch (error) {
|
|
345
438
|
throw new Error(`Failed to install services: ${error instanceof Error ? error.message : String(error)}`);
|
|
346
439
|
}
|
|
347
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Automatically update services if needed (silent operation)
|
|
443
|
+
* This should be called on every CLI run to ensure services are up-to-date
|
|
444
|
+
*/
|
|
445
|
+
static async autoUpdate() {
|
|
446
|
+
try {
|
|
447
|
+
const debug = process.env.JUNO_CODE_DEBUG === "1";
|
|
448
|
+
if (debug) {
|
|
449
|
+
const packageVersion = this.getPackageVersion();
|
|
450
|
+
const installedVersion = await this.getInstalledVersion();
|
|
451
|
+
console.error(`[DEBUG] Package version: ${packageVersion}, Installed version: ${installedVersion || "not found"}`);
|
|
452
|
+
}
|
|
453
|
+
const needsUpdate = await this.needsUpdate();
|
|
454
|
+
if (debug) {
|
|
455
|
+
console.error(`[DEBUG] Needs update: ${needsUpdate}`);
|
|
456
|
+
}
|
|
457
|
+
if (needsUpdate) {
|
|
458
|
+
await this.install(true);
|
|
459
|
+
if (debug) {
|
|
460
|
+
console.error(`[DEBUG] Service scripts updated successfully`);
|
|
461
|
+
}
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
} catch (error) {
|
|
466
|
+
if (process.env.JUNO_CODE_DEBUG === "1") {
|
|
467
|
+
console.error("[DEBUG] autoUpdate error:", error instanceof Error ? error.message : String(error));
|
|
468
|
+
}
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
348
472
|
/**
|
|
349
473
|
* Check if services are installed
|
|
350
474
|
*/
|
|
@@ -12686,11 +12810,23 @@ var init_main = __esm({
|
|
|
12686
12810
|
return;
|
|
12687
12811
|
}
|
|
12688
12812
|
}
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12813
|
+
try {
|
|
12814
|
+
const jsonObj = JSON.parse(event.content);
|
|
12815
|
+
const formattedJson = this.colorizeJson(jsonObj);
|
|
12816
|
+
const backend = event.backend ? chalk12.cyan(`[${event.backend}]`) : "";
|
|
12817
|
+
if (this.verbose) {
|
|
12818
|
+
console.error(`${chalk12.gray(timestamp)} ${backend} ${formattedJson}`);
|
|
12819
|
+
} else {
|
|
12820
|
+
console.error(`${backend} ${formattedJson}`);
|
|
12821
|
+
}
|
|
12822
|
+
return;
|
|
12823
|
+
} catch (error) {
|
|
12824
|
+
const backend = event.backend ? `[${event.backend}]` : "";
|
|
12825
|
+
if (this.verbose) {
|
|
12826
|
+
console.error(chalk12.gray(`[${timestamp}] ${backend} ${event.type}: ${event.content}`));
|
|
12827
|
+
} else {
|
|
12828
|
+
console.error(`${backend} ${chalk12.blue(`${event.type}:`)} ${event.content}`);
|
|
12829
|
+
}
|
|
12694
12830
|
}
|
|
12695
12831
|
}
|
|
12696
12832
|
/**
|
|
@@ -25027,6 +25163,17 @@ function configureEnvironment() {
|
|
|
25027
25163
|
async function main() {
|
|
25028
25164
|
const program = new Command();
|
|
25029
25165
|
configureEnvironment();
|
|
25166
|
+
try {
|
|
25167
|
+
const { ServiceInstaller: ServiceInstaller2 } = await Promise.resolve().then(() => (init_service_installer(), service_installer_exports));
|
|
25168
|
+
const updated = await ServiceInstaller2.autoUpdate();
|
|
25169
|
+
if (updated && (process.argv.includes("--verbose") || process.argv.includes("-v") || process.env.JUNO_CODE_DEBUG === "1")) {
|
|
25170
|
+
console.error("[DEBUG] Service scripts auto-updated to latest version");
|
|
25171
|
+
}
|
|
25172
|
+
} catch (error) {
|
|
25173
|
+
if (process.env.JUNO_CODE_DEBUG === "1") {
|
|
25174
|
+
console.error("[DEBUG] Service auto-update failed:", error instanceof Error ? error.message : String(error));
|
|
25175
|
+
}
|
|
25176
|
+
}
|
|
25030
25177
|
program.name("juno-code").description("TypeScript implementation of juno-code CLI tool for AI subagent orchestration").version(VERSION, "-V, --version", "Display version information").helpOption("-h, --help", "Display help information");
|
|
25031
25178
|
setupGlobalOptions(program);
|
|
25032
25179
|
const isVerbose = process.argv.includes("--verbose") || process.argv.includes("-v");
|