@ai-setting/roy-agent-cli 1.7.7 → 1.7.9
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/roy-agent.js +56 -3
- package/dist/index.js +56 -3
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -9461,7 +9461,7 @@ class CliQuietModeService {
|
|
|
9461
9461
|
// package.json
|
|
9462
9462
|
var package_default = {
|
|
9463
9463
|
name: "@ai-setting/roy-agent-cli",
|
|
9464
|
-
version: "1.7.
|
|
9464
|
+
version: "1.7.9",
|
|
9465
9465
|
type: "module",
|
|
9466
9466
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9467
9467
|
main: "./dist/index.js",
|
|
@@ -25478,7 +25478,7 @@ var LspCommand = {
|
|
|
25478
25478
|
|
|
25479
25479
|
// src/commands/install/index.ts
|
|
25480
25480
|
import { spawnSync } from "node:child_process";
|
|
25481
|
-
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync, mkdirSync } from "node:fs";
|
|
25481
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync, mkdirSync, rmSync } from "node:fs";
|
|
25482
25482
|
import { join as join5, resolve } from "node:path";
|
|
25483
25483
|
import { homedir as homedir4 } from "node:os";
|
|
25484
25484
|
function getConfigDir(scope) {
|
|
@@ -25570,6 +25570,34 @@ function getNpmGlobalRoot() {
|
|
|
25570
25570
|
}
|
|
25571
25571
|
return null;
|
|
25572
25572
|
}
|
|
25573
|
+
function cleanupStaleCpCopy(packageName) {
|
|
25574
|
+
const cpDir = join5(homedir4(), ".roy-agent", "node_modules", packageName);
|
|
25575
|
+
if (!existsSync4(cpDir)) {
|
|
25576
|
+
return false;
|
|
25577
|
+
}
|
|
25578
|
+
try {
|
|
25579
|
+
rmSync(cpDir, { recursive: true, force: true });
|
|
25580
|
+
return true;
|
|
25581
|
+
} catch (err) {
|
|
25582
|
+
console.warn(`⚠️ Failed to clean stale cp copy at '${cpDir}': ${err}`);
|
|
25583
|
+
return false;
|
|
25584
|
+
}
|
|
25585
|
+
}
|
|
25586
|
+
async function verifyInstalledVersion(packageName, declaredVersion) {
|
|
25587
|
+
try {
|
|
25588
|
+
await import(packageName);
|
|
25589
|
+
} catch {
|
|
25590
|
+
return { ok: false, reason: "not-importable", actualVersion: null };
|
|
25591
|
+
}
|
|
25592
|
+
const actual = readPackageInfo(packageName);
|
|
25593
|
+
if (!actual || !actual.version) {
|
|
25594
|
+
return { ok: false, reason: "no-version", actualVersion: null };
|
|
25595
|
+
}
|
|
25596
|
+
if (actual.version === declaredVersion) {
|
|
25597
|
+
return { ok: true, actualVersion: actual.version };
|
|
25598
|
+
}
|
|
25599
|
+
return { ok: false, reason: "version-mismatch", actualVersion: actual.version };
|
|
25600
|
+
}
|
|
25573
25601
|
function getPackageManagerCommand() {
|
|
25574
25602
|
if (existsSync4(join5(process.cwd(), "pnpm-lock.yaml"))) {
|
|
25575
25603
|
if (existsSync4(join5(process.cwd(), "pnpm-workspace.yaml"))) {
|
|
@@ -25600,7 +25628,7 @@ var InstallPackageCommand = {
|
|
|
25600
25628
|
type: "boolean",
|
|
25601
25629
|
conflicts: "global"
|
|
25602
25630
|
}).help(),
|
|
25603
|
-
handler: (argv) => {
|
|
25631
|
+
handler: async (argv) => {
|
|
25604
25632
|
const packageName = argv.package;
|
|
25605
25633
|
const scope = argv.project ? "project" : argv.global ? "global" : detectDefaultScope();
|
|
25606
25634
|
if (scope === "project") {
|
|
@@ -25683,6 +25711,15 @@ var InstallPackageCommand = {
|
|
|
25683
25711
|
`);
|
|
25684
25712
|
process.exit(1);
|
|
25685
25713
|
}
|
|
25714
|
+
const tmpInfo = readPackageInfo(packageName);
|
|
25715
|
+
if (tmpInfo) {
|
|
25716
|
+
const cleaned = cleanupStaleCpCopy(tmpInfo.name);
|
|
25717
|
+
if (cleaned) {
|
|
25718
|
+
console.log(`
|
|
25719
|
+
\uD83E\uDDF9 Cleaned stale cp copy: ~/.roy-agent/node_modules/${tmpInfo.name}
|
|
25720
|
+
`);
|
|
25721
|
+
}
|
|
25722
|
+
}
|
|
25686
25723
|
}
|
|
25687
25724
|
const info = readPackageInfo(packageName);
|
|
25688
25725
|
if (!info) {
|
|
@@ -25712,6 +25749,22 @@ var InstallPackageCommand = {
|
|
|
25712
25749
|
`);
|
|
25713
25750
|
}
|
|
25714
25751
|
savePlugins(plugins, scope);
|
|
25752
|
+
if (scope === "global") {
|
|
25753
|
+
try {
|
|
25754
|
+
const verify = await verifyInstalledVersion(resolvedPackageName, plugin.version);
|
|
25755
|
+
if (verify.ok === false) {
|
|
25756
|
+
console.warn(`
|
|
25757
|
+
⚠️ Post-install version drift detected for '${resolvedPackageName}':
|
|
25758
|
+
declared (plugins.json): ${plugin.version}
|
|
25759
|
+
actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25760
|
+
reason: ${verify.reason}
|
|
25761
|
+
` + ` 请检查 ~/.roy-agent/node_modules/${resolvedPackageName}/ 是否残留陈旧 cp 副本
|
|
25762
|
+
`);
|
|
25763
|
+
}
|
|
25764
|
+
} catch (err) {
|
|
25765
|
+
console.warn(`⚠️ Post-install version check failed: ${err}`);
|
|
25766
|
+
}
|
|
25767
|
+
}
|
|
25715
25768
|
}
|
|
25716
25769
|
};
|
|
25717
25770
|
var InstallListCommand = {
|
package/dist/index.js
CHANGED
|
@@ -9460,7 +9460,7 @@ class CliQuietModeService {
|
|
|
9460
9460
|
// package.json
|
|
9461
9461
|
var package_default = {
|
|
9462
9462
|
name: "@ai-setting/roy-agent-cli",
|
|
9463
|
-
version: "1.7.
|
|
9463
|
+
version: "1.7.9",
|
|
9464
9464
|
type: "module",
|
|
9465
9465
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9466
9466
|
main: "./dist/index.js",
|
|
@@ -25477,7 +25477,7 @@ var LspCommand = {
|
|
|
25477
25477
|
|
|
25478
25478
|
// src/commands/install/index.ts
|
|
25479
25479
|
import { spawnSync } from "node:child_process";
|
|
25480
|
-
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync, mkdirSync } from "node:fs";
|
|
25480
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync, mkdirSync, rmSync } from "node:fs";
|
|
25481
25481
|
import { join as join5, resolve } from "node:path";
|
|
25482
25482
|
import { homedir as homedir4 } from "node:os";
|
|
25483
25483
|
function getConfigDir(scope) {
|
|
@@ -25569,6 +25569,34 @@ function getNpmGlobalRoot() {
|
|
|
25569
25569
|
}
|
|
25570
25570
|
return null;
|
|
25571
25571
|
}
|
|
25572
|
+
function cleanupStaleCpCopy(packageName) {
|
|
25573
|
+
const cpDir = join5(homedir4(), ".roy-agent", "node_modules", packageName);
|
|
25574
|
+
if (!existsSync4(cpDir)) {
|
|
25575
|
+
return false;
|
|
25576
|
+
}
|
|
25577
|
+
try {
|
|
25578
|
+
rmSync(cpDir, { recursive: true, force: true });
|
|
25579
|
+
return true;
|
|
25580
|
+
} catch (err) {
|
|
25581
|
+
console.warn(`⚠️ Failed to clean stale cp copy at '${cpDir}': ${err}`);
|
|
25582
|
+
return false;
|
|
25583
|
+
}
|
|
25584
|
+
}
|
|
25585
|
+
async function verifyInstalledVersion(packageName, declaredVersion) {
|
|
25586
|
+
try {
|
|
25587
|
+
await import(packageName);
|
|
25588
|
+
} catch {
|
|
25589
|
+
return { ok: false, reason: "not-importable", actualVersion: null };
|
|
25590
|
+
}
|
|
25591
|
+
const actual = readPackageInfo(packageName);
|
|
25592
|
+
if (!actual || !actual.version) {
|
|
25593
|
+
return { ok: false, reason: "no-version", actualVersion: null };
|
|
25594
|
+
}
|
|
25595
|
+
if (actual.version === declaredVersion) {
|
|
25596
|
+
return { ok: true, actualVersion: actual.version };
|
|
25597
|
+
}
|
|
25598
|
+
return { ok: false, reason: "version-mismatch", actualVersion: actual.version };
|
|
25599
|
+
}
|
|
25572
25600
|
function getPackageManagerCommand() {
|
|
25573
25601
|
if (existsSync4(join5(process.cwd(), "pnpm-lock.yaml"))) {
|
|
25574
25602
|
if (existsSync4(join5(process.cwd(), "pnpm-workspace.yaml"))) {
|
|
@@ -25599,7 +25627,7 @@ var InstallPackageCommand = {
|
|
|
25599
25627
|
type: "boolean",
|
|
25600
25628
|
conflicts: "global"
|
|
25601
25629
|
}).help(),
|
|
25602
|
-
handler: (argv) => {
|
|
25630
|
+
handler: async (argv) => {
|
|
25603
25631
|
const packageName = argv.package;
|
|
25604
25632
|
const scope = argv.project ? "project" : argv.global ? "global" : detectDefaultScope();
|
|
25605
25633
|
if (scope === "project") {
|
|
@@ -25682,6 +25710,15 @@ var InstallPackageCommand = {
|
|
|
25682
25710
|
`);
|
|
25683
25711
|
process.exit(1);
|
|
25684
25712
|
}
|
|
25713
|
+
const tmpInfo = readPackageInfo(packageName);
|
|
25714
|
+
if (tmpInfo) {
|
|
25715
|
+
const cleaned = cleanupStaleCpCopy(tmpInfo.name);
|
|
25716
|
+
if (cleaned) {
|
|
25717
|
+
console.log(`
|
|
25718
|
+
\uD83E\uDDF9 Cleaned stale cp copy: ~/.roy-agent/node_modules/${tmpInfo.name}
|
|
25719
|
+
`);
|
|
25720
|
+
}
|
|
25721
|
+
}
|
|
25685
25722
|
}
|
|
25686
25723
|
const info = readPackageInfo(packageName);
|
|
25687
25724
|
if (!info) {
|
|
@@ -25711,6 +25748,22 @@ var InstallPackageCommand = {
|
|
|
25711
25748
|
`);
|
|
25712
25749
|
}
|
|
25713
25750
|
savePlugins(plugins, scope);
|
|
25751
|
+
if (scope === "global") {
|
|
25752
|
+
try {
|
|
25753
|
+
const verify = await verifyInstalledVersion(resolvedPackageName, plugin.version);
|
|
25754
|
+
if (verify.ok === false) {
|
|
25755
|
+
console.warn(`
|
|
25756
|
+
⚠️ Post-install version drift detected for '${resolvedPackageName}':
|
|
25757
|
+
declared (plugins.json): ${plugin.version}
|
|
25758
|
+
actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25759
|
+
reason: ${verify.reason}
|
|
25760
|
+
` + ` 请检查 ~/.roy-agent/node_modules/${resolvedPackageName}/ 是否残留陈旧 cp 副本
|
|
25761
|
+
`);
|
|
25762
|
+
}
|
|
25763
|
+
} catch (err) {
|
|
25764
|
+
console.warn(`⚠️ Post-install version check failed: ${err}`);
|
|
25765
|
+
}
|
|
25766
|
+
}
|
|
25714
25767
|
}
|
|
25715
25768
|
};
|
|
25716
25769
|
var InstallListCommand = {
|
|
Binary file
|