@postonus/cli 0.1.14 → 0.1.15
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.js +21 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11896,19 +11896,28 @@ function configDir() {
|
|
|
11896
11896
|
function configPath() {
|
|
11897
11897
|
return join(configDir(), "config.json");
|
|
11898
11898
|
}
|
|
11899
|
+
function isString(val) {
|
|
11900
|
+
return typeof val === "string";
|
|
11901
|
+
}
|
|
11902
|
+
function isNumber(val) {
|
|
11903
|
+
return typeof val === "number";
|
|
11904
|
+
}
|
|
11905
|
+
function isRecord(val) {
|
|
11906
|
+
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
11907
|
+
}
|
|
11899
11908
|
async function readConfig() {
|
|
11900
11909
|
try {
|
|
11901
11910
|
const raw = await readFile(configPath(), "utf8");
|
|
11902
11911
|
const parsed = JSON.parse(raw);
|
|
11903
|
-
if (
|
|
11912
|
+
if (!isRecord(parsed)) return {};
|
|
11904
11913
|
const { accessToken, refreshToken, clientId, accessTokenExpiresAt, apiUrl, email: email2 } = parsed;
|
|
11905
11914
|
return {
|
|
11906
|
-
accessToken:
|
|
11907
|
-
refreshToken:
|
|
11908
|
-
clientId:
|
|
11909
|
-
accessTokenExpiresAt:
|
|
11910
|
-
apiUrl:
|
|
11911
|
-
email:
|
|
11915
|
+
accessToken: isString(accessToken) ? accessToken : void 0,
|
|
11916
|
+
refreshToken: isString(refreshToken) ? refreshToken : void 0,
|
|
11917
|
+
clientId: isString(clientId) ? clientId : void 0,
|
|
11918
|
+
accessTokenExpiresAt: isNumber(accessTokenExpiresAt) ? accessTokenExpiresAt : void 0,
|
|
11919
|
+
apiUrl: isString(apiUrl) ? apiUrl : void 0,
|
|
11920
|
+
email: isString(email2) ? email2 : void 0
|
|
11912
11921
|
};
|
|
11913
11922
|
} catch {
|
|
11914
11923
|
return {};
|
|
@@ -11983,7 +11992,7 @@ function formatTable(headers, rows) {
|
|
|
11983
11992
|
}
|
|
11984
11993
|
|
|
11985
11994
|
// src/version.ts
|
|
11986
|
-
var CLI_VERSION = "0.1.
|
|
11995
|
+
var CLI_VERSION = "0.1.15";
|
|
11987
11996
|
|
|
11988
11997
|
// src/client.ts
|
|
11989
11998
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -12541,6 +12550,9 @@ async function connectChannel(options) {
|
|
|
12541
12550
|
|
|
12542
12551
|
// src/commands/mcp.ts
|
|
12543
12552
|
import { createInterface } from "readline";
|
|
12553
|
+
function isString2(val) {
|
|
12554
|
+
return typeof val === "string";
|
|
12555
|
+
}
|
|
12544
12556
|
function decodeMessages(contentType, body) {
|
|
12545
12557
|
if (!contentType?.includes("text/event-stream")) {
|
|
12546
12558
|
const trimmed = body.trim();
|
|
@@ -12613,7 +12625,7 @@ async function mcpServe() {
|
|
|
12613
12625
|
write(frame);
|
|
12614
12626
|
try {
|
|
12615
12627
|
const parsed = JSON.parse(frame);
|
|
12616
|
-
if (
|
|
12628
|
+
if (isString2(parsed.result?.protocolVersion)) protocolVersion = parsed.result.protocolVersion;
|
|
12617
12629
|
} catch {
|
|
12618
12630
|
}
|
|
12619
12631
|
}
|