@starfetch-js/cli 0.1.0 → 0.2.0
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/index.d.ts +2 -1
- package/dist/index.js +14 -6
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,6 @@ type RunCliOptions = {
|
|
|
17
17
|
//#region packages/cli/src/index.d.ts
|
|
18
18
|
declare function helpText(): string;
|
|
19
19
|
declare function runCli(argv?: any, options?: RunCliOptions): Promise<number>;
|
|
20
|
+
declare function isCliEntrypoint(moduleUrl: string, argvPath: string | undefined): boolean;
|
|
20
21
|
//#endregion
|
|
21
|
-
export { helpText, runCli };
|
|
22
|
+
export { helpText, isCliEntrypoint, runCli };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import fs, { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { EventEmitter } from "node:events";
|
|
4
5
|
import childProcess from "node:child_process";
|
|
5
6
|
import path, { basename } from "node:path";
|
|
6
|
-
import fs from "node:fs";
|
|
7
7
|
import process$1 from "node:process";
|
|
8
8
|
import { stripVTControlCharacters } from "node:util";
|
|
9
9
|
import { readFile, writeFile } from "node:fs/promises";
|
|
@@ -3218,7 +3218,7 @@ var TapUploadError = class extends StarfetchError {
|
|
|
3218
3218
|
this.name = "TapUploadError";
|
|
3219
3219
|
}
|
|
3220
3220
|
};
|
|
3221
|
-
/** TAP service requires authentication that Starfetch
|
|
3221
|
+
/** TAP service requires authentication that Starfetch does not support. */
|
|
3222
3222
|
var TapAuthUnsupportedError = class extends StarfetchError {
|
|
3223
3223
|
constructor(message) {
|
|
3224
3224
|
super(message);
|
|
@@ -6874,7 +6874,7 @@ async function readTapCapabilitiesIfAvailable(target, options) {
|
|
|
6874
6874
|
return capabilities;
|
|
6875
6875
|
}
|
|
6876
6876
|
function assertCapabilitiesAllowAnonymousTap(capabilities) {
|
|
6877
|
-
if (capabilities.auth === "unsupported-auth") throw new TapAuthUnsupportedError("This TAP query interface requires authentication, but Starfetch
|
|
6877
|
+
if (capabilities.auth === "unsupported-auth") throw new TapAuthUnsupportedError("This TAP query interface requires authentication, but Starfetch only supports anonymous TAP requests.");
|
|
6878
6878
|
}
|
|
6879
6879
|
async function readParsedTapTables(target, options) {
|
|
6880
6880
|
return parseTapTables(await readTapMetadataXml(target, "tables", options));
|
|
@@ -7745,7 +7745,15 @@ async function runCli(argv = process.argv.slice(2), options = {}) {
|
|
|
7745
7745
|
return 1;
|
|
7746
7746
|
}
|
|
7747
7747
|
}
|
|
7748
|
-
if (
|
|
7748
|
+
if (isCliEntrypoint(import.meta.url, process.argv[1])) process.exitCode = await runCli(process.argv.slice(2), { stdin: process.stdin });
|
|
7749
|
+
function isCliEntrypoint(moduleUrl, argvPath) {
|
|
7750
|
+
if (argvPath === void 0) return false;
|
|
7751
|
+
try {
|
|
7752
|
+
return realpathSync(fileURLToPath(moduleUrl)) === realpathSync(argvPath);
|
|
7753
|
+
} catch {
|
|
7754
|
+
return false;
|
|
7755
|
+
}
|
|
7756
|
+
}
|
|
7749
7757
|
function createProgram(options) {
|
|
7750
7758
|
const stdout = options.stdout ?? process.stdout;
|
|
7751
7759
|
const stderr = options.stderr ?? process.stderr;
|
|
@@ -7768,4 +7776,4 @@ function formatError(error) {
|
|
|
7768
7776
|
return "Unknown CLI error";
|
|
7769
7777
|
}
|
|
7770
7778
|
//#endregion
|
|
7771
|
-
export { helpText, runCli };
|
|
7779
|
+
export { helpText, isCliEntrypoint, runCli };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starfetch-js/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Command-line interface for Starfetch.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"test": "vitest run"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@starfetch-js/core": "0.
|
|
46
|
-
"@starfetch-js/skill": "0.
|
|
45
|
+
"@starfetch-js/core": "0.2.0",
|
|
46
|
+
"@starfetch-js/skill": "0.2.0",
|
|
47
47
|
"commander": "15.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "d77aa260e196f3a1aebb23221f969ec0fa5baefc"
|
|
58
59
|
}
|