sp-rag 0.6.8 → 0.6.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/cli.js +14 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,18 @@ import { defaultBaseUrl, defaultMcpServerAlias, defaultMcpUrl, installMcpConfig,
|
|
|
5
5
|
import { diagnoseMcpConfig, formatMcpDoctorResult } from './lib/doctor.js';
|
|
6
6
|
import { fetchJson, fetchText, runDoctor } from './lib/http.js';
|
|
7
7
|
import { installSkill, resolveSkillInstallTarget, } from './lib/skill.js';
|
|
8
|
-
|
|
8
|
+
let cliVersionPromise;
|
|
9
|
+
async function resolveCliVersion() {
|
|
10
|
+
if (!cliVersionPromise) {
|
|
11
|
+
cliVersionPromise = readFile(new URL('../package.json', import.meta.url), 'utf8')
|
|
12
|
+
.then((raw) => {
|
|
13
|
+
const packageJson = JSON.parse(raw);
|
|
14
|
+
return packageJson.version?.trim() || '0.0.0';
|
|
15
|
+
})
|
|
16
|
+
.catch(() => '0.0.0');
|
|
17
|
+
}
|
|
18
|
+
return cliVersionPromise;
|
|
19
|
+
}
|
|
9
20
|
function parseArgv(argv) {
|
|
10
21
|
const positionals = [];
|
|
11
22
|
const options = {};
|
|
@@ -577,7 +588,7 @@ export async function runCli(argv) {
|
|
|
577
588
|
const [group, action] = parsed.positionals;
|
|
578
589
|
try {
|
|
579
590
|
if (optionFlag(parsed, 'version')) {
|
|
580
|
-
process.stdout.write(`sp-rag ${
|
|
591
|
+
process.stdout.write(`sp-rag ${await resolveCliVersion()}\n`);
|
|
581
592
|
return 0;
|
|
582
593
|
}
|
|
583
594
|
if (!group || group === 'help' || group === '--help') {
|
|
@@ -675,7 +686,7 @@ export async function runCli(argv) {
|
|
|
675
686
|
return 0;
|
|
676
687
|
}
|
|
677
688
|
if (group === 'version') {
|
|
678
|
-
process.stdout.write(`sp-rag ${
|
|
689
|
+
process.stdout.write(`sp-rag ${await resolveCliVersion()}\n`);
|
|
679
690
|
return 0;
|
|
680
691
|
}
|
|
681
692
|
process.stdout.write(helpText());
|