@go-labs-sg/gosh 0.3.0 → 0.4.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.js +76 -82
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -372,9 +372,8 @@ var import_dotenv = __toESM(require_main(), 1);
|
|
|
372
372
|
import path from "path";
|
|
373
373
|
import_dotenv.config({ path: path.resolve(process.cwd(), ".env"), quiet: true });
|
|
374
374
|
|
|
375
|
-
// src/
|
|
376
|
-
import { readFileSync
|
|
377
|
-
import { fileURLToPath } from "url";
|
|
375
|
+
// src/cli.ts
|
|
376
|
+
import { readFileSync } from "fs";
|
|
378
377
|
|
|
379
378
|
// ../../cli-auth/src/protocol/constants.ts
|
|
380
379
|
var CLI_ACCESS_TOKEN_TTL_MS = 15 * 60 * 1000;
|
|
@@ -14958,7 +14957,7 @@ import {
|
|
|
14958
14957
|
} from "@trpc/client";
|
|
14959
14958
|
import SuperJSON from "superjson";
|
|
14960
14959
|
|
|
14961
|
-
// src/authenticated-event-source.ts
|
|
14960
|
+
// src/features/authenticated-event-source.ts
|
|
14962
14961
|
class AuthenticatedEventSource {
|
|
14963
14962
|
url;
|
|
14964
14963
|
init;
|
|
@@ -15069,7 +15068,7 @@ class AuthenticatedEventSource {
|
|
|
15069
15068
|
}
|
|
15070
15069
|
}
|
|
15071
15070
|
|
|
15072
|
-
// src/runtime.ts
|
|
15071
|
+
// src/runtime/index.ts
|
|
15073
15072
|
import { createInterface } from "readline/promises";
|
|
15074
15073
|
var invocationCodes = new Set([
|
|
15075
15074
|
"USAGE",
|
|
@@ -15304,7 +15303,7 @@ var createProcessRuntime = () => ({
|
|
|
15304
15303
|
}
|
|
15305
15304
|
});
|
|
15306
15305
|
|
|
15307
|
-
// src/
|
|
15306
|
+
// src/config.ts
|
|
15308
15307
|
var DEFAULT_GOSH_API_BASE_URL = "https://app.gosh.sg";
|
|
15309
15308
|
var normalizeApiBaseUrl = (value) => {
|
|
15310
15309
|
const url2 = new URL(value);
|
|
@@ -15315,6 +15314,8 @@ var normalizeApiBaseUrl = (value) => {
|
|
|
15315
15314
|
url2.pathname = url2.pathname.replace(/\/$/, "");
|
|
15316
15315
|
return url2.toString().replace(/\/$/, "");
|
|
15317
15316
|
};
|
|
15317
|
+
|
|
15318
|
+
// src/api-client.ts
|
|
15318
15319
|
var createGoshClient = ({
|
|
15319
15320
|
apiBaseUrl,
|
|
15320
15321
|
accessToken,
|
|
@@ -15919,65 +15920,6 @@ var createGoshCommandClient = (client) => ({
|
|
|
15919
15920
|
}
|
|
15920
15921
|
});
|
|
15921
15922
|
|
|
15922
|
-
// src/parse-args.ts
|
|
15923
|
-
var parseArgs = (argv) => {
|
|
15924
|
-
const flags = {};
|
|
15925
|
-
const positional = [];
|
|
15926
|
-
for (let index = 0;index < argv.length; index += 1) {
|
|
15927
|
-
const argument = argv[index];
|
|
15928
|
-
if (!argument)
|
|
15929
|
-
continue;
|
|
15930
|
-
if (argument === "--") {
|
|
15931
|
-
positional.push(...argv.slice(index + 1));
|
|
15932
|
-
break;
|
|
15933
|
-
}
|
|
15934
|
-
if (argument === "-q") {
|
|
15935
|
-
flags.quiet = true;
|
|
15936
|
-
continue;
|
|
15937
|
-
}
|
|
15938
|
-
if (!argument.startsWith("--")) {
|
|
15939
|
-
positional.push(argument);
|
|
15940
|
-
continue;
|
|
15941
|
-
}
|
|
15942
|
-
const equalsIndex = argument.indexOf("=");
|
|
15943
|
-
if (equalsIndex > 2) {
|
|
15944
|
-
flags[argument.slice(2, equalsIndex)] = argument.slice(equalsIndex + 1);
|
|
15945
|
-
continue;
|
|
15946
|
-
}
|
|
15947
|
-
const name = argument.slice(2);
|
|
15948
|
-
const next = argv[index + 1];
|
|
15949
|
-
if (next !== undefined && !next.startsWith("-")) {
|
|
15950
|
-
flags[name] = next;
|
|
15951
|
-
index += 1;
|
|
15952
|
-
} else {
|
|
15953
|
-
flags[name] = true;
|
|
15954
|
-
}
|
|
15955
|
-
}
|
|
15956
|
-
return { flags, positional };
|
|
15957
|
-
};
|
|
15958
|
-
var getStringFlag = (flags, name) => {
|
|
15959
|
-
const value = flags[name];
|
|
15960
|
-
return typeof value === "string" ? value : undefined;
|
|
15961
|
-
};
|
|
15962
|
-
|
|
15963
|
-
// src/parse-json.ts
|
|
15964
|
-
var parseJsonInput = (value) => {
|
|
15965
|
-
if (value === undefined) {
|
|
15966
|
-
throw new CliError("USAGE", "This command requires --input with a JSON object.");
|
|
15967
|
-
}
|
|
15968
|
-
try {
|
|
15969
|
-
const parsed = JSON.parse(value);
|
|
15970
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
15971
|
-
throw new CliError("VALIDATION", "--input must be a JSON object.");
|
|
15972
|
-
}
|
|
15973
|
-
return parsed;
|
|
15974
|
-
} catch (error51) {
|
|
15975
|
-
if (error51 instanceof CliError)
|
|
15976
|
-
throw error51;
|
|
15977
|
-
throw new CliError("VALIDATION", `--input is not valid JSON: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
15978
|
-
}
|
|
15979
|
-
};
|
|
15980
|
-
|
|
15981
15923
|
// src/registry/index.ts
|
|
15982
15924
|
var defaultMutationTargetKeys = [
|
|
15983
15925
|
"id",
|
|
@@ -16219,8 +16161,7 @@ var findCommand = (positional) => {
|
|
|
16219
16161
|
}
|
|
16220
16162
|
return;
|
|
16221
16163
|
};
|
|
16222
|
-
|
|
16223
|
-
// src/upload.ts
|
|
16164
|
+
// src/features/upload.ts
|
|
16224
16165
|
import { open, readFile, stat } from "fs/promises";
|
|
16225
16166
|
import { basename, extname } from "path";
|
|
16226
16167
|
var contentTypes = {
|
|
@@ -16373,7 +16314,66 @@ var uploadFileForCommand = async ({
|
|
|
16373
16314
|
};
|
|
16374
16315
|
};
|
|
16375
16316
|
|
|
16376
|
-
// src/
|
|
16317
|
+
// src/parse-args.ts
|
|
16318
|
+
var parseArgs = (argv) => {
|
|
16319
|
+
const flags = {};
|
|
16320
|
+
const positional = [];
|
|
16321
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
16322
|
+
const argument = argv[index];
|
|
16323
|
+
if (!argument)
|
|
16324
|
+
continue;
|
|
16325
|
+
if (argument === "--") {
|
|
16326
|
+
positional.push(...argv.slice(index + 1));
|
|
16327
|
+
break;
|
|
16328
|
+
}
|
|
16329
|
+
if (argument === "-q") {
|
|
16330
|
+
flags.quiet = true;
|
|
16331
|
+
continue;
|
|
16332
|
+
}
|
|
16333
|
+
if (!argument.startsWith("--")) {
|
|
16334
|
+
positional.push(argument);
|
|
16335
|
+
continue;
|
|
16336
|
+
}
|
|
16337
|
+
const equalsIndex = argument.indexOf("=");
|
|
16338
|
+
if (equalsIndex > 2) {
|
|
16339
|
+
flags[argument.slice(2, equalsIndex)] = argument.slice(equalsIndex + 1);
|
|
16340
|
+
continue;
|
|
16341
|
+
}
|
|
16342
|
+
const name = argument.slice(2);
|
|
16343
|
+
const next = argv[index + 1];
|
|
16344
|
+
if (next !== undefined && !next.startsWith("-")) {
|
|
16345
|
+
flags[name] = next;
|
|
16346
|
+
index += 1;
|
|
16347
|
+
} else {
|
|
16348
|
+
flags[name] = true;
|
|
16349
|
+
}
|
|
16350
|
+
}
|
|
16351
|
+
return { flags, positional };
|
|
16352
|
+
};
|
|
16353
|
+
var getStringFlag = (flags, name) => {
|
|
16354
|
+
const value = flags[name];
|
|
16355
|
+
return typeof value === "string" ? value : undefined;
|
|
16356
|
+
};
|
|
16357
|
+
|
|
16358
|
+
// src/parse-json.ts
|
|
16359
|
+
var parseJsonInput = (value) => {
|
|
16360
|
+
if (value === undefined) {
|
|
16361
|
+
throw new CliError("USAGE", "This command requires --input with a JSON object.");
|
|
16362
|
+
}
|
|
16363
|
+
try {
|
|
16364
|
+
const parsed = JSON.parse(value);
|
|
16365
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
16366
|
+
throw new CliError("VALIDATION", "--input must be a JSON object.");
|
|
16367
|
+
}
|
|
16368
|
+
return parsed;
|
|
16369
|
+
} catch (error51) {
|
|
16370
|
+
if (error51 instanceof CliError)
|
|
16371
|
+
throw error51;
|
|
16372
|
+
throw new CliError("VALIDATION", `--input is not valid JSON: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
16373
|
+
}
|
|
16374
|
+
};
|
|
16375
|
+
|
|
16376
|
+
// src/cli.ts
|
|
16377
16377
|
var packageManifest = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
16378
16378
|
var GOSH_CLI_VERSION = typeof packageManifest.version === "string" ? packageManifest.version : "0.0.0";
|
|
16379
16379
|
var allowedFlags = new Set([
|
|
@@ -16625,27 +16625,21 @@ Waiting for approval\u2026
|
|
|
16625
16625
|
return emitError(dependencies.runtime, requestedCommand, error51);
|
|
16626
16626
|
}
|
|
16627
16627
|
};
|
|
16628
|
-
var
|
|
16629
|
-
const executable = process.argv[1];
|
|
16630
|
-
if (!executable)
|
|
16631
|
-
return false;
|
|
16632
|
-
try {
|
|
16633
|
-
return realpathSync(executable) === realpathSync(fileURLToPath(import.meta.url));
|
|
16634
|
-
} catch {
|
|
16635
|
-
return false;
|
|
16636
|
-
}
|
|
16637
|
-
};
|
|
16638
|
-
if (isDirectExecution()) {
|
|
16628
|
+
var runGoshCliFromProcess = async () => {
|
|
16639
16629
|
const runtime2 = createProcessRuntime();
|
|
16640
16630
|
try {
|
|
16641
16631
|
assertBunRuntime();
|
|
16642
|
-
|
|
16632
|
+
return await runGoshCli(process.argv.slice(2), { runtime: runtime2 });
|
|
16643
16633
|
} catch (error51) {
|
|
16644
|
-
|
|
16634
|
+
return emitError(runtime2, "runtime", error51);
|
|
16645
16635
|
}
|
|
16636
|
+
};
|
|
16637
|
+
|
|
16638
|
+
// src/index.ts
|
|
16639
|
+
if (import.meta.main) {
|
|
16640
|
+
process.exitCode = await runGoshCliFromProcess();
|
|
16646
16641
|
}
|
|
16647
16642
|
export {
|
|
16648
|
-
GOSH_CLI_VERSION,
|
|
16649
16643
|
commands,
|
|
16650
16644
|
runGoshCli
|
|
16651
16645
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go-labs-sg/gosh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "GOSH CLI for organizers and AI agents — manage organizations, events, teams, stations, missions, templates, and live operations through the GOSH API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|