@kashdao/cli 0.1.0 → 0.1.1
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/CHANGELOG.md +12 -0
- package/README.md +13 -14
- package/dist/{account-AVFLEM5D.js → account-CVJZ3HVT.js} +9 -9
- package/dist/{auth-GUJCVKTD.js → auth-V5WVZBCO.js} +9 -9
- package/dist/auth-V5WVZBCO.js.map +1 -0
- package/dist/{chunk-LBIRQHX5.js → chunk-A3IH5HUV.js} +3 -3
- package/dist/{chunk-YHCG2SUC.js → chunk-BVFDUI73.js} +2 -2
- package/dist/{chunk-MIXOZU2S.js → chunk-KADB3OKE.js} +2 -2
- package/dist/chunk-KAM6KOFD.js +9 -0
- package/dist/{chunk-BN2CUM42.js.map → chunk-KAM6KOFD.js.map} +1 -1
- package/dist/{chunk-YJX3JJ4M.js → chunk-L4AFV2HK.js} +3 -3
- package/dist/{chunk-VIADBYFY.js → chunk-MQUJG224.js} +2 -2
- package/dist/{chunk-KMBMQIZ7.js → chunk-N26VGVGB.js} +3 -3
- package/dist/{chunk-KMBMQIZ7.js.map → chunk-N26VGVGB.js.map} +1 -1
- package/dist/{chunk-QJMF73M5.js → chunk-QALDZHTX.js} +5 -5
- package/dist/{chunk-BRK7KJ4O.js → chunk-R4NGUZKN.js} +2 -2
- package/dist/{chunk-UZNSYATZ.js → chunk-X2VM6VKM.js} +7 -7
- package/dist/chunk-X2VM6VKM.js.map +1 -0
- package/dist/client-75FVHGOH.js +14 -0
- package/dist/{completion-ZZGX5BQC.js → completion-PK74S3EZ.js} +4 -4
- package/dist/{config-XJL5TSYK.js → config-T5U6E6KU.js} +8 -8
- package/dist/{config-store-3ZSYGXMQ.js → config-store-UTFDUCKW.js} +4 -4
- package/dist/{docs-MDKKSJDC.js → docs-VA7CJ2ZF.js} +5 -5
- package/dist/{eoa-IQ72EIHR.js → eoa-RL3NLN3H.js} +9 -9
- package/dist/{errors-WMZIEGQI.js → errors-2NNXRNES.js} +2 -2
- package/dist/{explain-H4EH3KH3.js → explain-3SPMWDYX.js} +7 -7
- package/dist/{explain-H4EH3KH3.js.map → explain-3SPMWDYX.js.map} +1 -1
- package/dist/{global-options-XOLJUPTT.js → global-options-WFQ6CEFK.js} +4 -4
- package/dist/{health-VZEIII74.js → health-2KD6XUTJ.js} +10 -10
- package/dist/health-2KD6XUTJ.js.map +1 -0
- package/dist/index.js +27 -27
- package/dist/{markets-C37JZDPE.js → markets-H6EK2XDE.js} +10 -10
- package/dist/{output-VCBZ3FM7.js → output-FGTXXZEQ.js} +4 -4
- package/dist/{portfolio-2AEPIJIG.js → portfolio-R63D5QB2.js} +10 -10
- package/dist/{protocol-XEQXF2GW.js → protocol-ZB6R25IM.js} +9 -9
- package/dist/{quote-I4DVJ7ZB.js → quote-OF6BTAPQ.js} +10 -10
- package/dist/{schema-PIFQ65TS.js → schema-3HQN4RFL.js} +6 -6
- package/dist/{setup-USZ6IODD.js → setup-IIPQXLPL.js} +12 -12
- package/dist/setup-IIPQXLPL.js.map +1 -0
- package/dist/{trace-IZBYTUFO.js → trace-WMO3KDHS.js} +10 -10
- package/dist/{trade-IIZSEXEI.js → trade-YBCI6XD2.js} +10 -10
- package/dist/{version-JDK3PEP5.js → version-WB2ACHMU.js} +7 -7
- package/dist/{version-check-TDCION37.js → version-check-PRAVPFC6.js} +4 -4
- package/dist/{webhooks-PTVRKICZ.js → webhooks-DVS55O4T.js} +10 -10
- package/dist/{with-retry-4FIZG3A7.js → with-retry-2MD2CNK2.js} +5 -5
- package/package.json +3 -3
- package/dist/auth-GUJCVKTD.js.map +0 -1
- package/dist/chunk-BN2CUM42.js +0 -9
- package/dist/chunk-UZNSYATZ.js.map +0 -1
- package/dist/client-IOM55ZCS.js +0 -14
- package/dist/health-VZEIII74.js.map +0 -1
- package/dist/setup-USZ6IODD.js.map +0 -1
- /package/dist/{account-AVFLEM5D.js.map → account-CVJZ3HVT.js.map} +0 -0
- /package/dist/{chunk-LBIRQHX5.js.map → chunk-A3IH5HUV.js.map} +0 -0
- /package/dist/{chunk-YHCG2SUC.js.map → chunk-BVFDUI73.js.map} +0 -0
- /package/dist/{chunk-MIXOZU2S.js.map → chunk-KADB3OKE.js.map} +0 -0
- /package/dist/{chunk-YJX3JJ4M.js.map → chunk-L4AFV2HK.js.map} +0 -0
- /package/dist/{chunk-VIADBYFY.js.map → chunk-MQUJG224.js.map} +0 -0
- /package/dist/{chunk-QJMF73M5.js.map → chunk-QALDZHTX.js.map} +0 -0
- /package/dist/{chunk-BRK7KJ4O.js.map → chunk-R4NGUZKN.js.map} +0 -0
- /package/dist/{client-IOM55ZCS.js.map → client-75FVHGOH.js.map} +0 -0
- /package/dist/{completion-ZZGX5BQC.js.map → completion-PK74S3EZ.js.map} +0 -0
- /package/dist/{config-XJL5TSYK.js.map → config-T5U6E6KU.js.map} +0 -0
- /package/dist/{config-store-3ZSYGXMQ.js.map → config-store-UTFDUCKW.js.map} +0 -0
- /package/dist/{docs-MDKKSJDC.js.map → docs-VA7CJ2ZF.js.map} +0 -0
- /package/dist/{eoa-IQ72EIHR.js.map → eoa-RL3NLN3H.js.map} +0 -0
- /package/dist/{errors-WMZIEGQI.js.map → errors-2NNXRNES.js.map} +0 -0
- /package/dist/{global-options-XOLJUPTT.js.map → global-options-WFQ6CEFK.js.map} +0 -0
- /package/dist/{markets-C37JZDPE.js.map → markets-H6EK2XDE.js.map} +0 -0
- /package/dist/{output-VCBZ3FM7.js.map → output-FGTXXZEQ.js.map} +0 -0
- /package/dist/{portfolio-2AEPIJIG.js.map → portfolio-R63D5QB2.js.map} +0 -0
- /package/dist/{protocol-XEQXF2GW.js.map → protocol-ZB6R25IM.js.map} +0 -0
- /package/dist/{quote-I4DVJ7ZB.js.map → quote-OF6BTAPQ.js.map} +0 -0
- /package/dist/{schema-PIFQ65TS.js.map → schema-3HQN4RFL.js.map} +0 -0
- /package/dist/{trace-IZBYTUFO.js.map → trace-WMO3KDHS.js.map} +0 -0
- /package/dist/{trade-IIZSEXEI.js.map → trade-YBCI6XD2.js.map} +0 -0
- /package/dist/{version-JDK3PEP5.js.map → version-WB2ACHMU.js.map} +0 -0
- /package/dist/{version-check-TDCION37.js.map → version-check-PRAVPFC6.js.map} +0 -0
- /package/dist/{webhooks-PTVRKICZ.js.map → webhooks-DVS55O4T.js.map} +0 -0
- /package/dist/{with-retry-4FIZG3A7.js.map → with-retry-2MD2CNK2.js.map} +0 -0
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadRawPrivateKey,
|
|
4
4
|
resolveCliCustomChain
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-L4AFV2HK.js";
|
|
6
6
|
import {
|
|
7
7
|
formatAddress,
|
|
8
8
|
formatBigDecimal,
|
|
9
9
|
formatGwei,
|
|
10
10
|
formatUsdcAtomic,
|
|
11
11
|
formatWad
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R4NGUZKN.js";
|
|
13
13
|
import {
|
|
14
14
|
readConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N26VGVGB.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_SLIPPAGE_BPS,
|
|
18
18
|
HEX_HASH_REGEX,
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
parseUppercaseSide,
|
|
27
27
|
validateAddress,
|
|
28
28
|
validateAddressOptional
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BVFDUI73.js";
|
|
30
30
|
import {
|
|
31
31
|
parseOptionalPositiveFloat,
|
|
32
32
|
parseOptionalPositiveInt,
|
|
33
33
|
parsePositiveInt,
|
|
34
34
|
readGlobals
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-A3IH5HUV.js";
|
|
36
36
|
import {
|
|
37
37
|
isQuiet,
|
|
38
38
|
log,
|
|
@@ -40,14 +40,14 @@ import {
|
|
|
40
40
|
printJson,
|
|
41
41
|
style,
|
|
42
42
|
writeNdjson
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-MQUJG224.js";
|
|
44
|
+
import "./chunk-KADB3OKE.js";
|
|
45
45
|
import {
|
|
46
46
|
CliError,
|
|
47
47
|
CliValidationError,
|
|
48
48
|
EXIT_CODES,
|
|
49
49
|
toCliError
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-X2VM6VKM.js";
|
|
51
51
|
|
|
52
52
|
// src/commands/protocol/index.ts
|
|
53
53
|
import { Command as Command13 } from "commander";
|
|
@@ -1569,4 +1569,4 @@ var protocolCommand = new Command13("protocol").description(
|
|
|
1569
1569
|
export {
|
|
1570
1570
|
protocolCommand
|
|
1571
1571
|
};
|
|
1572
|
-
//# sourceMappingURL=protocol-
|
|
1572
|
+
//# sourceMappingURL=protocol-ZB6R25IM.js.map
|
|
@@ -4,30 +4,30 @@ import {
|
|
|
4
4
|
formatUsdcAtomic,
|
|
5
5
|
formatWad,
|
|
6
6
|
shortId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R4NGUZKN.js";
|
|
8
8
|
import {
|
|
9
9
|
buildClient
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-QALDZHTX.js";
|
|
11
|
+
import "./chunk-N26VGVGB.js";
|
|
12
12
|
import {
|
|
13
13
|
decimalToAtomicUsdc,
|
|
14
14
|
decimalToAtomicWad,
|
|
15
15
|
parseOutcomeIndex
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-BVFDUI73.js";
|
|
17
|
+
import "./chunk-KAM6KOFD.js";
|
|
18
18
|
import {
|
|
19
19
|
readGlobals
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-A3IH5HUV.js";
|
|
21
21
|
import {
|
|
22
22
|
log,
|
|
23
23
|
print,
|
|
24
24
|
printJson,
|
|
25
25
|
style
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-MQUJG224.js";
|
|
27
|
+
import "./chunk-KADB3OKE.js";
|
|
28
28
|
import {
|
|
29
29
|
toCliError
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-X2VM6VKM.js";
|
|
31
31
|
|
|
32
32
|
// src/commands/quote/index.ts
|
|
33
33
|
import { Command as Command3 } from "commander";
|
|
@@ -141,4 +141,4 @@ var quoteCommand = new Command3("quote").description("Get on-chain AMM price quo
|
|
|
141
141
|
export {
|
|
142
142
|
quoteCommand
|
|
143
143
|
};
|
|
144
|
-
//# sourceMappingURL=quote-
|
|
144
|
+
//# sourceMappingURL=quote-OF6BTAPQ.js.map
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
BIGINT_STRING_REGEX,
|
|
4
4
|
HEX_ADDRESS_REGEX,
|
|
5
5
|
USDC_DECIMAL_REGEX
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BVFDUI73.js";
|
|
7
7
|
import {
|
|
8
8
|
readGlobals
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A3IH5HUV.js";
|
|
10
10
|
import {
|
|
11
11
|
print,
|
|
12
12
|
printJson,
|
|
13
13
|
style
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-MQUJG224.js";
|
|
15
|
+
import "./chunk-KADB3OKE.js";
|
|
16
16
|
import {
|
|
17
17
|
CliError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-X2VM6VKM.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/schema.ts
|
|
21
21
|
import {
|
|
@@ -407,4 +407,4 @@ Notes:
|
|
|
407
407
|
export {
|
|
408
408
|
schemaCommand
|
|
409
409
|
};
|
|
410
|
-
//# sourceMappingURL=schema-
|
|
410
|
+
//# sourceMappingURL=schema-3HQN4RFL.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readGlobals
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A3IH5HUV.js";
|
|
5
5
|
import {
|
|
6
6
|
log,
|
|
7
7
|
print,
|
|
8
8
|
printJson,
|
|
9
9
|
style
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-MQUJG224.js";
|
|
11
|
+
import "./chunk-KADB3OKE.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
toCliError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-X2VM6VKM.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/setup.ts
|
|
18
18
|
import { Command } from "commander";
|
|
19
|
-
var
|
|
20
|
-
var KEY_REQUEST_INSTRUCTIONS = `
|
|
19
|
+
var KEY_ISSUANCE_URL = "https://app.kash.bot";
|
|
20
|
+
var KEY_REQUEST_INSTRUCTIONS = `Create a key under Settings \u2192 API Keys at ${KEY_ISSUANCE_URL} \u2014 \`Live\` for Base mainnet or \`Test\` for Base Sepolia.`;
|
|
21
21
|
var setupCommand = new Command("setup").description("Interactive first-run wizard: configure an API key, verify, install completion.").option("-y, --yes", "accept all defaults and skip optional prompts (non-interactive)").option("--api-key <key>", "pass the API key non-interactively (skips the prompt)").addHelpText(
|
|
22
22
|
"after",
|
|
23
23
|
`
|
|
@@ -49,8 +49,8 @@ async function runSetup(options, globals) {
|
|
|
49
49
|
const jsonMode = globals.json;
|
|
50
50
|
const [{ confirm, input, password }, { updateConfig, setCurrentProfile }, { buildClient }] = await Promise.all([
|
|
51
51
|
import("@inquirer/prompts"),
|
|
52
|
-
import("./config-store-
|
|
53
|
-
import("./client-
|
|
52
|
+
import("./config-store-UTFDUCKW.js"),
|
|
53
|
+
import("./client-75FVHGOH.js")
|
|
54
54
|
]);
|
|
55
55
|
if (!jsonMode) {
|
|
56
56
|
print("");
|
|
@@ -74,7 +74,7 @@ async function runSetup(options, globals) {
|
|
|
74
74
|
});
|
|
75
75
|
} else {
|
|
76
76
|
if (!jsonMode) {
|
|
77
|
-
print(`${style.dim("
|
|
77
|
+
print(`${style.dim("Need a key?")} ${KEY_REQUEST_INSTRUCTIONS} (Ctrl-C to abort.)`);
|
|
78
78
|
}
|
|
79
79
|
apiKey = await password({
|
|
80
80
|
message: "Paste your API key:",
|
|
@@ -190,7 +190,7 @@ async function runSetup(options, globals) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
async function probeReadScopes(opts) {
|
|
193
|
-
const { buildClient } = await import("./client-
|
|
193
|
+
const { buildClient } = await import("./client-75FVHGOH.js");
|
|
194
194
|
const { client } = await buildClient({
|
|
195
195
|
requireAuth: true,
|
|
196
196
|
globals: { ...opts.globals, profile: opts.profile }
|
|
@@ -234,7 +234,7 @@ function renderScopesHuman(scopes) {
|
|
|
234
234
|
const denied = entries.filter(([, v]) => v === "denied").map(([k]) => k);
|
|
235
235
|
if (denied.length > 0) {
|
|
236
236
|
log.info(
|
|
237
|
-
`
|
|
237
|
+
`Issue a key with broader scope under Settings \u2192 API Keys at ${KEY_ISSUANCE_URL} if you need: ${denied.join(", ")}.`
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
@@ -257,4 +257,4 @@ function pickNextStepHints(scopes) {
|
|
|
257
257
|
export {
|
|
258
258
|
setupCommand
|
|
259
259
|
};
|
|
260
|
-
//# sourceMappingURL=setup-
|
|
260
|
+
//# sourceMappingURL=setup-IIPQXLPL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/setup.ts"],"sourcesContent":["/**\n * `kash setup` — first-run interactive wizard.\n *\n * Collapses what's normally a four-step onboarding into a single\n * guided flow:\n * 1. Open the dashboard URL so the user can issue an API key.\n * 2. Paste the key (validated for the `kash_` prefix).\n * 3. Pick a profile name (defaults to `default`).\n * 4. Verify connectivity via `kash health`.\n * 5. Optionally install shell completion.\n *\n * **Lazy-loaded.** `@inquirer/prompts` is heavy — the dynamic import\n * keeps it out of the cold path for `kash --version` and other\n * non-interactive invocations. The KashClient + completion modules\n * are also lazy.\n *\n * **Skippable.** Every prompt has a sensible default and `--yes`\n * accepts all defaults non-interactively (CI / automation). `--json`\n * emits a structured summary at the end so post-setup scripts can\n * verify state without re-reading the config file.\n */\n\nimport { Command } from 'commander';\n\nimport { CliError, toCliError } from '../errors.js';\nimport { readGlobals } from '../utils/global-options.js';\nimport { log, print, printJson, style } from '../utils/output.js';\n\nimport type { GlobalOptions } from '../utils/global-options.js';\n\n// Keys are issued self-service in the Kash app. A `kash_live_*` key\n// auto-routes to the production API (Base mainnet); a `kash_test_*` key\n// auto-routes to staging (Base Sepolia) for dry-runs.\nconst KEY_ISSUANCE_URL = 'https://app.kash.bot';\nconst KEY_REQUEST_INSTRUCTIONS = `Create a key under Settings → API Keys at ${KEY_ISSUANCE_URL} — \\`Live\\` for Base mainnet or \\`Test\\` for Base Sepolia.`;\n\ntype SetupOptions = {\n yes?: boolean;\n apiKey?: string;\n};\n\n/**\n * Per-scope probe result. `'ok'` means the canary call succeeded;\n * `'denied'` means the API returned 403 / INSUFFICIENT_SCOPE for that\n * scope (the key is valid but doesn't carry the scope); `'unknown'`\n * means the probe failed for a non-scope reason (network, server\n * error) — we don't pretend to know.\n */\ntype ScopeProbeStatus = 'ok' | 'denied' | 'unknown';\n\n/**\n * Output envelope when `--json` is set. Stable contract — agents and\n * provisioning scripts pin to it.\n */\ntype SetupResult = {\n ok: true;\n profile: string;\n authenticated: boolean;\n health: { ok: boolean; latencyMs?: number; status?: string; version?: string };\n /**\n * Best-effort scope detection from canary read calls. Each entry is\n * a granted/denied/unknown verdict for a named scope. Does NOT probe\n * write scopes (that'd require a real trade).\n */\n scopes: Record<string, ScopeProbeStatus>;\n completionInstalled: boolean;\n};\n\nexport const setupCommand = new Command('setup')\n .description('Interactive first-run wizard: configure an API key, verify, install completion.')\n .option('-y, --yes', 'accept all defaults and skip optional prompts (non-interactive)')\n .option('--api-key <key>', 'pass the API key non-interactively (skips the prompt)')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash setup\n $ kash setup --api-key kash_live_… --yes --json\n $ kash --profile staging setup --yes # write to a named profile\n $ KASH_API_KEY=kash_live_… kash setup --yes # picks up the env var\n\nNotes:\n - Re-runnable. Existing profiles are updated, not duplicated.\n - --yes accepts every default and skips optional prompts (no shell\n completion install). Combine with --api-key for full automation.\n - Use the top-level --profile flag (\\`kash --profile <name> setup\\`)\n to write to a named profile non-interactively.\n`\n )\n .action(async (options: SetupOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n\n try {\n const result = await runSetup(options, globals);\n if (globals.json) {\n printJson(result);\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nasync function runSetup(options: SetupOptions, globals: GlobalOptions): Promise<SetupResult> {\n const jsonMode = globals.json;\n // Lazy imports — see file header.\n const [{ confirm, input, password }, { updateConfig, setCurrentProfile }, { buildClient }] =\n await Promise.all([\n import('@inquirer/prompts'),\n import('../utils/config-store.js'),\n import('../utils/client.js'),\n ]);\n\n if (!jsonMode) {\n print('');\n print(style.bold('Kash CLI setup'));\n print(style.dim('Configure an API key, verify connectivity, install shell completion.'));\n print('');\n }\n\n // Resolve the API key. Precedence: --api-key flag → env → prompt.\n const envKey = process.env['KASH_API_KEY'];\n let apiKey: string;\n if (options.apiKey) {\n apiKey = options.apiKey;\n if (!jsonMode) log.info('Using --api-key from the command line.');\n } else if (envKey) {\n apiKey = envKey;\n if (!jsonMode) log.info('Using KASH_API_KEY from the environment.');\n } else if (options.yes) {\n throw new CliError('Cannot run --yes without an API key.', {\n code: 'INVALID_INPUT',\n recoverable: true,\n suggestion: `Pass --api-key <kash_…>, set KASH_API_KEY, or run \\`kash setup\\` without --yes. ${KEY_REQUEST_INSTRUCTIONS}`,\n });\n } else {\n if (!jsonMode) {\n print(`${style.dim('Need a key?')} ${KEY_REQUEST_INSTRUCTIONS} (Ctrl-C to abort.)`);\n }\n // Use the masked-input prompt — `input()` would echo every\n // keystroke to the terminal, defeating the protection that\n // `kash setup` should provide for fresh API keys (shoulder-\n // surfing, screen recording, scroll-back capture). The validation\n // shape is identical to the previous `input` call.\n apiKey = await password({\n message: 'Paste your API key:',\n mask: '*',\n validate: (value: string) => {\n const trimmed = value.trim();\n if (trimmed.length < 16) return 'API key looks too short.';\n if (!trimmed.startsWith('kash_')) return 'API keys start with \"kash_\".';\n return true;\n },\n });\n apiKey = apiKey.trim();\n }\n\n // Resolve the profile name. Precedence: top-level --profile flag →\n // interactive prompt → 'default'. We deliberately reuse the global\n // flag rather than declaring our own to avoid two profile flags\n // with subtly different semantics.\n let profile = globals.profile;\n if (profile === undefined && !options.yes) {\n profile = await input({\n message: 'Profile name:',\n default: 'default',\n });\n }\n profile = (profile ?? 'default').trim();\n\n // Persist. `updateConfig` handles the file IO, mode 0600, and Zod\n // validation. We only update apiKey — baseUrl/chain are inferred\n // from the key prefix on first request. Both calls thread the\n // global `--config <path>` override so `kash setup --config\n // /tmp/test.json` writes to the user-specified file rather than\n // silently falling back to ~/.kash/config.json.\n const writeOpts = {\n profile,\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n };\n const written = await updateConfig({ apiKey }, writeOpts);\n await setCurrentProfile(\n written.profile,\n globals.configPath === undefined ? undefined : { configPath: globals.configPath }\n );\n\n if (!jsonMode) {\n log.success(`Saved API key to profile \"${written.profile}\".`);\n }\n\n // Verify connectivity. We pass the just-resolved profile so the\n // health check reads the key we just wrote (not whatever was the\n // active profile before).\n let healthOk = false;\n let healthLatency: number | undefined;\n let healthStatus: string | undefined;\n let healthVersion: string | undefined;\n try {\n const { client } = await buildClient({\n requireAuth: true,\n // Reuse the resolved globals but pin the profile to the one we\n // just wrote — otherwise a stale flag could cause us to verify\n // a different profile than the one we configured.\n globals: { ...globals, profile: written.profile },\n });\n const result = await client.healthCheck();\n healthOk = result.ok;\n healthLatency = result.latencyMs;\n healthStatus = result.status;\n healthVersion = result.version;\n if (!jsonMode) {\n if (healthOk) {\n log.success(\n `Health check OK in ${String(healthLatency)}ms${\n healthVersion ? ` (server ${healthVersion})` : ''\n }.`\n );\n } else {\n log.warn('Health check returned not-ok. Verify your network or rerun later.');\n }\n }\n } catch (cause) {\n // Don't fail setup on a flaky health check — the key may still be\n // good and the user just has temporary connectivity issues.\n if (!jsonMode) {\n log.warn(`Health check failed: ${cause instanceof Error ? cause.message : String(cause)}`);\n log.info('Setup completed; verify later with `kash health`.');\n }\n }\n\n // Probe a handful of read scopes via canary calls. We don't probe\n // write scopes (that'd require a real trade or webhook rotation),\n // and we don't fail setup on probe errors — the key still works,\n // we just couldn't tell which scopes it carries.\n const scopes = await probeReadScopes({ globals, profile: written.profile });\n if (!jsonMode) {\n renderScopesHuman(scopes);\n }\n\n // Optional: shell completion. Skip in --yes mode (no good default\n // for an action that mutates the user's shell rc files).\n let completionInstalled = false;\n if (!options.yes && !jsonMode) {\n const detectedShell = process.env['SHELL'] ?? '(unknown)';\n const wantCompletion = await confirm({\n message: `Install shell completion for ${detectedShell}?`,\n default: true,\n });\n if (wantCompletion) {\n try {\n const { default: omelette } = await import('omelette');\n const completion = omelette('kash');\n completion.setupShellInitFile();\n completionInstalled = true;\n log.success('Shell completions installed.');\n log.info('Restart your shell or source your shell config to activate.');\n } catch (cause) {\n log.warn(\n `Could not install completion: ${cause instanceof Error ? cause.message : String(cause)}`\n );\n }\n }\n }\n\n if (!jsonMode) {\n print('');\n print(style.bold(\"You're all set.\"));\n // Pick a \"Try:\" suggestion the user's key actually has scope for.\n // Pre-fix this was hardcoded to `markets list --status ACTIVE`,\n // which fails immediately for keys that only carry webhooks-read\n // / trades-read scope. Probe results drive the suggestion now.\n for (const line of pickNextStepHints(scopes)) {\n print(` ${style.dim('Try:')} ${line}`);\n }\n print(` ${style.dim(' :')} kash docs --json --quiet | jq '.subcommands[].name'`);\n print('');\n }\n\n return {\n ok: true,\n profile: written.profile,\n authenticated: true,\n health: {\n ok: healthOk,\n ...(healthLatency === undefined ? {} : { latencyMs: healthLatency }),\n ...(healthStatus === undefined ? {} : { status: healthStatus }),\n ...(healthVersion === undefined ? {} : { version: healthVersion }),\n },\n scopes,\n completionInstalled,\n };\n}\n\n/**\n * Probe-derived scope detection.\n *\n * Each named scope is mapped to a canary SDK call. We invoke the call\n * with a minimal pageSize and inspect the failure mode to classify:\n *\n * - call resolves → `'ok'` (scope present)\n * - throws KashAuthorizationError(INSUFFICIENT_SCOPE) → `'denied'`\n * - throws anything else → `'unknown'` (probe inconclusive,\n * don't claim the scope is missing)\n *\n * Read-only by design — write scopes (`trades:create`, `auth:manage`)\n * would require either a real mutation or a sentinel \"what scopes do\n * I have?\" endpoint, which the API doesn't currently expose.\n */\nasync function probeReadScopes(opts: {\n globals: GlobalOptions;\n profile: string;\n}): Promise<Record<string, ScopeProbeStatus>> {\n const { buildClient } = await import('../utils/client.js');\n const { client } = await buildClient({\n requireAuth: true,\n globals: { ...opts.globals, profile: opts.profile },\n });\n\n // Each canary is a (scope-name, call) pair. Call uses limit:1 to\n // minimise server load. Order is stable so the JSON envelope is\n // pinnable.\n const probes: ReadonlyArray<readonly [string, () => Promise<unknown>]> = [\n ['markets:read', async () => client.markets.list({ limit: 1 })],\n ['trades:read', async () => client.trades.list({ limit: 1 })],\n ['webhooks:read', async () => client.webhooks.list({ limit: 1 })],\n ];\n\n const result: Record<string, ScopeProbeStatus> = {};\n for (const [scope, call] of probes) {\n result[scope] = await classifyProbe(call);\n }\n return result;\n}\n\nasync function classifyProbe(call: () => Promise<unknown>): Promise<ScopeProbeStatus> {\n try {\n await call();\n return 'ok';\n } catch (cause) {\n // The SDK's KashAuthorizationError carries `code: 'INSUFFICIENT_SCOPE'`.\n // We duck-type rather than import the class to avoid a dependency\n // on the SDK's class identity (an instanceof check would couple\n // to the exact module-graph copy of @kashdao/sdk).\n if (cause !== null && typeof cause === 'object') {\n const code = (cause as { code?: unknown }).code;\n if (code === 'INSUFFICIENT_SCOPE') return 'denied';\n }\n return 'unknown';\n }\n}\n\nfunction renderScopesHuman(scopes: Record<string, ScopeProbeStatus>): void {\n const entries = Object.entries(scopes);\n if (entries.length === 0) return;\n const allOk = entries.every(([, v]) => v === 'ok');\n if (allOk) {\n log.success('Scope check OK — key carries every probed read scope.');\n return;\n }\n log.info('Scope detection (probed via canary read calls):');\n for (const [scope, status] of entries) {\n const label =\n status === 'ok'\n ? style.success('granted')\n : status === 'denied'\n ? style.warn('not granted')\n : style.dim('inconclusive');\n print(` ${style.dim(scope.padEnd(16))} ${label}`);\n }\n const denied = entries.filter(([, v]) => v === 'denied').map(([k]) => k);\n if (denied.length > 0) {\n log.info(\n `Issue a key with broader scope under Settings → API Keys at ${KEY_ISSUANCE_URL} if you need: ${denied.join(', ')}.`\n );\n }\n}\n\n/**\n * Pick `kash <…>` suggestions to surface in the post-setup banner,\n * gated on the scopes the probe confirmed. Order from most-common\n * to least-common; emit at most 2 lines so the banner stays terse.\n *\n * Falls back to a generic \"see `kash --help`\" when no probed scope\n * looks usable (rare — the probe already errored loudly in that\n * case, but we keep the wizard's last line useful regardless).\n */\nfunction pickNextStepHints(scopes: Record<string, ScopeProbeStatus>): readonly string[] {\n const hints: string[] = [];\n if (scopes['markets:read'] === 'ok') {\n hints.push('kash markets list --status ACTIVE');\n }\n if (scopes['trades:read'] === 'ok') {\n hints.push('kash trade list --json --quiet | jq -r \".data[].id\"');\n }\n if (scopes['webhooks:read'] === 'ok' && hints.length < 2) {\n hints.push('kash webhooks list --status failed,retrying');\n }\n if (hints.length === 0) {\n // Probe results were inconclusive or every read scope was denied.\n // The earlier `renderScopesHuman` already surfaced the per-scope\n // verdict; keep the banner non-actionable instead of pointing at\n // a command that 403s.\n hints.push('kash --help');\n }\n return hints.slice(0, 2);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,SAAS,eAAe;AAWxB,IAAM,mBAAmB;AACzB,IAAM,2BAA2B,kDAA6C,gBAAgB;AAkCvF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UAAM,KAAK,aAAa;AAAA,EAC1B;AACA,SAAO,MAAM,MAAM,GAAG,CAAC;AACzB;","names":[]}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
formatDate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R4NGUZKN.js";
|
|
5
5
|
import {
|
|
6
6
|
buildClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-QALDZHTX.js";
|
|
8
|
+
import "./chunk-N26VGVGB.js";
|
|
9
|
+
import "./chunk-BVFDUI73.js";
|
|
10
|
+
import "./chunk-KAM6KOFD.js";
|
|
11
11
|
import {
|
|
12
12
|
readGlobals
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-A3IH5HUV.js";
|
|
14
14
|
import {
|
|
15
15
|
print,
|
|
16
16
|
printJson,
|
|
17
17
|
style
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-MQUJG224.js";
|
|
19
|
+
import "./chunk-KADB3OKE.js";
|
|
20
20
|
import {
|
|
21
21
|
CliValidationError,
|
|
22
22
|
toCliError
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-X2VM6VKM.js";
|
|
24
24
|
|
|
25
25
|
// src/commands/trace.ts
|
|
26
26
|
import { Command } from "commander";
|
|
@@ -100,4 +100,4 @@ function formatSummary(event) {
|
|
|
100
100
|
export {
|
|
101
101
|
traceCommand
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=trace-
|
|
103
|
+
//# sourceMappingURL=trace-WMO3KDHS.js.map
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
formatDate,
|
|
7
7
|
formatUsdcDecimal,
|
|
8
8
|
shortId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-R4NGUZKN.js";
|
|
10
10
|
import {
|
|
11
11
|
buildClient
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-QALDZHTX.js";
|
|
13
|
+
import "./chunk-N26VGVGB.js";
|
|
14
14
|
import {
|
|
15
15
|
parseOutcomeIndex,
|
|
16
16
|
validateUsdcDecimalShape
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-BVFDUI73.js";
|
|
18
|
+
import "./chunk-KAM6KOFD.js";
|
|
19
19
|
import {
|
|
20
20
|
parsePositiveInt,
|
|
21
21
|
readGlobals
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-A3IH5HUV.js";
|
|
23
23
|
import {
|
|
24
24
|
isQuiet,
|
|
25
25
|
log,
|
|
@@ -27,12 +27,12 @@ import {
|
|
|
27
27
|
printJson,
|
|
28
28
|
style,
|
|
29
29
|
writeNdjson
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-MQUJG224.js";
|
|
31
|
+
import "./chunk-KADB3OKE.js";
|
|
32
32
|
import {
|
|
33
33
|
CliValidationError,
|
|
34
34
|
toCliError
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-X2VM6VKM.js";
|
|
36
36
|
|
|
37
37
|
// src/commands/trade/index.ts
|
|
38
38
|
import { Command as Command6 } from "commander";
|
|
@@ -583,4 +583,4 @@ var tradeCommand = new Command6("trade").description("Place trades and inspect t
|
|
|
583
583
|
export {
|
|
584
584
|
tradeCommand
|
|
585
585
|
};
|
|
586
|
-
//# sourceMappingURL=trade-
|
|
586
|
+
//# sourceMappingURL=trade-YBCI6XD2.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CLI_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KAM6KOFD.js";
|
|
5
5
|
import {
|
|
6
6
|
readGlobals
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A3IH5HUV.js";
|
|
8
8
|
import {
|
|
9
9
|
print,
|
|
10
10
|
printJson,
|
|
11
11
|
style
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-MQUJG224.js";
|
|
13
|
+
import "./chunk-KADB3OKE.js";
|
|
14
|
+
import "./chunk-X2VM6VKM.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/version.ts
|
|
17
17
|
import { createRequire } from "module";
|
|
@@ -74,7 +74,7 @@ Examples:
|
|
|
74
74
|
const manifest = buildVersionManifest();
|
|
75
75
|
let updateInfo = null;
|
|
76
76
|
if (options.check) {
|
|
77
|
-
const { checkLatestVersion } = await import("./version-check-
|
|
77
|
+
const { checkLatestVersion } = await import("./version-check-PRAVPFC6.js");
|
|
78
78
|
updateInfo = await checkLatestVersion(manifest.cli);
|
|
79
79
|
}
|
|
80
80
|
if (globals.json) {
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
buildVersionManifest,
|
|
115
115
|
versionCommand
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=version-
|
|
117
|
+
//# sourceMappingURL=version-WB2ACHMU.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
resolveConfigPathsForOverride
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-N26VGVGB.js";
|
|
5
|
+
import "./chunk-BVFDUI73.js";
|
|
6
|
+
import "./chunk-X2VM6VKM.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/version-check.ts
|
|
9
9
|
import { existsSync } from "fs";
|
|
@@ -135,4 +135,4 @@ export {
|
|
|
135
135
|
compareVersions,
|
|
136
136
|
isOptedOut
|
|
137
137
|
};
|
|
138
|
-
//# sourceMappingURL=version-check-
|
|
138
|
+
//# sourceMappingURL=version-check-PRAVPFC6.js.map
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDate,
|
|
4
4
|
shortId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R4NGUZKN.js";
|
|
6
6
|
import {
|
|
7
7
|
buildClient
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-QALDZHTX.js";
|
|
9
|
+
import "./chunk-N26VGVGB.js";
|
|
10
|
+
import "./chunk-BVFDUI73.js";
|
|
11
|
+
import "./chunk-KAM6KOFD.js";
|
|
12
12
|
import {
|
|
13
13
|
parsePositiveInt,
|
|
14
14
|
readGlobals
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-A3IH5HUV.js";
|
|
16
16
|
import {
|
|
17
17
|
log,
|
|
18
18
|
print,
|
|
19
19
|
printJson,
|
|
20
20
|
style,
|
|
21
21
|
writeNdjson
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-MQUJG224.js";
|
|
23
|
+
import "./chunk-KADB3OKE.js";
|
|
24
24
|
import {
|
|
25
25
|
CliError,
|
|
26
26
|
CliValidationError,
|
|
27
27
|
toCliError
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-X2VM6VKM.js";
|
|
29
29
|
|
|
30
30
|
// src/commands/webhooks/index.ts
|
|
31
31
|
import { Command as Command6 } from "commander";
|
|
@@ -677,4 +677,4 @@ var webhooksCommand = new Command6("webhooks").description("Manage webhook deliv
|
|
|
677
677
|
export {
|
|
678
678
|
webhooksCommand
|
|
679
679
|
};
|
|
680
|
-
//# sourceMappingURL=webhooks-
|
|
680
|
+
//# sourceMappingURL=webhooks-DVS55O4T.js.map
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
parsePositiveInt,
|
|
4
4
|
readGlobals
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-A3IH5HUV.js";
|
|
6
6
|
import {
|
|
7
7
|
log,
|
|
8
8
|
style
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-MQUJG224.js";
|
|
10
|
+
import "./chunk-KADB3OKE.js";
|
|
11
11
|
import {
|
|
12
12
|
CliError,
|
|
13
13
|
toCliError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-X2VM6VKM.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/with-retry.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
parseErrorEnvelope,
|
|
221
221
|
withRetryCommand
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=with-retry-
|
|
223
|
+
//# sourceMappingURL=with-retry-2MD2CNK2.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashdao/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Official non-custodial command-line interface for the Kash prediction-market protocol. Wraps @kashdao/sdk (Kash-orchestrated mode) and @kashdao/protocol-sdk (self-orchestrated mode).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"viem": "^2.45.0",
|
|
36
36
|
"zod": "^3.25.76",
|
|
37
37
|
"zod-to-json-schema": "^3.25.0",
|
|
38
|
-
"@kashdao/sdk": "0.1.
|
|
39
|
-
"@kashdao/
|
|
38
|
+
"@kashdao/protocol-sdk": "0.1.1",
|
|
39
|
+
"@kashdao/sdk": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^25.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/auth/index.ts","../src/commands/auth/logout.ts","../src/commands/auth/set-key.ts","../src/commands/auth/status.ts"],"sourcesContent":["/**\n * `kash auth` — credential management.\n *\n * Users issue a key from the Kash dashboard and run `auth set-key`\n * (or set `KASH_API_KEY` in their environment). A future browser-based\n * login flow may be added; for now, key issuance lives on the dashboard.\n */\n\nimport { Command } from 'commander';\n\nimport { logoutCommand } from './logout.js';\nimport { setKeyCommand } from './set-key.js';\nimport { statusCommand } from './status.js';\n\nexport const authCommand = new Command('auth')\n .description('Manage local API credentials.')\n .addCommand(setKeyCommand)\n .addCommand(statusCommand)\n .addCommand(logoutCommand);\n","/**\n * `kash auth logout` — remove the stored API key.\n *\n * Only clears the `apiKey` field; the rest of the config (baseUrl,\n * chain id) survives so logging back in doesn't lose unrelated\n * preferences. If `KASH_API_KEY` is set in the environment, we warn\n * the user that env vars take precedence so the \"logout\" is partial.\n */\n\nimport { Command } from 'commander';\n\nimport { clearConfigField, readConfig } from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\nexport const logoutCommand = new Command('logout')\n .description('Remove the stored API key from ~/.kash/config.json.')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash auth logout\n $ kash auth logout --profile staging\n`\n )\n .action(async (_opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const scope = {\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n };\n const before = await readConfig(scope);\n await clearConfigField('apiKey', scope);\n\n const envWillOverride = Boolean(process.env['KASH_API_KEY']);\n\n if (globals.json) {\n printJson({\n ok: true,\n profile: before.profile,\n cleared: Boolean(before.apiKey && before.sources.apiKey === 'file'),\n envOverride: envWillOverride,\n });\n return;\n }\n\n if (before.apiKey === undefined) {\n log.info(`No API key was stored for profile \"${before.profile}\".`);\n } else {\n log.success(`API key cleared from profile \"${before.profile}\".`);\n }\n if (envWillOverride) {\n log.warn('KASH_API_KEY is still set in your environment. Unset it to fully log out.');\n }\n });\n","/**\n * `kash auth set-key [key]` — store an API key in `~/.kash/config.json`.\n *\n * Three input paths, each leaves no trace of the key in shell history:\n *\n * 1. Positional `<key>` — convenient for one-off use, but shows up\n * in `~/.bash_history`. Kept for backward compat.\n * 2. `--from-stdin` — pipe a key from a secret-store (`pass kash`,\n * `1password read`, `aws secretsmanager`, …). The key is\n * `.trim()`-ed so trailing newlines from the source are ignored.\n * 3. Interactive prompt (no positional, no flag, TTY available) —\n * reads from stderr-bound readline so the prompt doesn't taint\n * stdout pipes. Single newline of input.\n *\n * Validates the prefix client-side (the SDK's config schema enforces\n * the same shape, but failing here gives a clearer error than the\n * generic config error chain). The persisted file is `0600`.\n */\n\nimport { Command } from 'commander';\n\nimport { CliValidationError, toCliError } from '../../errors.js';\nimport { setCurrentProfile, updateConfig } from '../../utils/config-store.js';\nimport { redact } from '../../utils/formatting.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\ntype SetKeyOptions = {\n fromStdin?: boolean;\n activate?: boolean;\n};\n\nexport const setKeyCommand = new Command('set-key')\n .description('Store an API key in ~/.kash/config.json (mode 0600).')\n .argument('[key]', 'API key starting with \"kash_\" (omit to read from stdin or prompt)')\n .option('--from-stdin', 'read the key from stdin (preferred for secret-store integration)')\n .option(\n '--activate',\n \"also switch the active profile to the one being written (default: leave the active profile unchanged — `kash auth set-key --profile staging` updates 'staging' but doesn't make it active; pass --activate or run `kash config use staging` separately)\"\n )\n .addHelpText(\n 'after',\n `\nExamples:\n # Interactive prompt (no shell history footprint).\n $ kash auth set-key\n\n # Pipe from a secret store.\n $ pass show kash/api-key | kash auth set-key --from-stdin\n $ op read \"op://Private/kash/api-key\" | kash auth set-key --from-stdin\n\n # Positional (convenient but shows up in ~/.bash_history).\n $ kash auth set-key kash_live_abc...\n $ kash auth set-key kash_test_abc... --profile staging\n`\n )\n .action(async (positional: string | undefined, options: SetKeyOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n const key = await resolveKey(positional, options);\n\n if (!key.startsWith('kash_')) {\n throw new CliValidationError(\n 'API keys must start with \"kash_\".',\n 'Request a `kash_test_*` staging key by emailing `engineering@kash.bot` with your intended use case. Self-service issuance and `kash_live_*` keys land with the production launch.'\n );\n }\n let result;\n try {\n result = await updateConfig(\n { apiKey: key },\n {\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n }\n );\n // `--activate` flips the file's `currentProfile` so the next\n // command picks up this profile without needing\n // `kash config use <name>`. Mirrors the all-in-one wizard\n // behaviour of `kash setup`.\n if (options.activate === true) {\n await setCurrentProfile(\n result.profile,\n globals.configPath === undefined ? undefined : { configPath: globals.configPath }\n );\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n // Surface the actually-written profile (resolved from --profile,\n // KASH_PROFILE, file's currentProfile, or \"default\") so the JSON\n // contract reports truth, not the unresolved flag value.\n printJson({\n ok: true,\n apiKey: redact(key),\n profile: result.profile,\n // Whether this run also flipped the file's currentProfile.\n // Agents driving multi-profile workflows can chain off this\n // to know if a follow-up `kash config use` is needed.\n activated: options.activate === true,\n });\n return;\n }\n log.success(`API key saved to profile \"${result.profile}\" (${redact(key)}).`);\n log.detail('Location', globals.configPath ?? '~/.kash/config.json (mode 0600)');\n if (options.activate === true) {\n log.success(`Active profile is now \"${result.profile}\".`);\n }\n });\n\n/**\n * Resolve the API key from the three supported sources. Order:\n * 1. Positional argument (legacy, less secure — still works).\n * 2. `--from-stdin` (read until EOF, trim, single key per stream).\n * 3. Interactive prompt (TTY only).\n *\n * **Mutual-exclusion guard.** Pre-fix, `kash auth set-key <key>\n * --from-stdin` silently used the positional and dropped the piped\n * secret. That's a real footgun: the operator sees \"API key saved\"\n * for the WRONG key (the one on argv, possibly a stale value from\n * shell history). We refuse to guess and require the operator to\n * pick one source.\n */\nasync function resolveKey(positional: string | undefined, options: SetKeyOptions): Promise<string> {\n if (positional !== undefined && positional !== '' && options.fromStdin === true) {\n throw new CliValidationError(\n 'Pass either the positional <key> OR --from-stdin, not both.',\n 'The positional key would silently win and the piped value would be dropped.'\n );\n }\n if (positional !== undefined && positional !== '') {\n return positional;\n }\n if (options.fromStdin === true) {\n return readFromStdin();\n }\n if (process.stdin.isTTY) {\n return promptInteractively();\n }\n // No positional, no --from-stdin, no TTY — caller's intent is\n // ambiguous. Surface a clear validation error rather than reading\n // stdin silently (which would surprise CI runs that pipe other\n // data into the command).\n throw new CliValidationError(\n 'No API key provided.',\n 'Pass the key positionally, use --from-stdin to read it from a pipe, or run interactively for a prompt.'\n );\n}\n\nasync function readFromStdin(): Promise<string> {\n // Use the shared BOM-aware reader. Notepad-saved files (and VSCode\n // with `files.encoding=utf8bom`) prepend U+FEFF; without the strip,\n // the leading three bytes leak into the API key and fail the\n // `kash_` prefix check.\n const { readStdinTrimmed } = await import('../../utils/stdin.js');\n return readStdinTrimmed();\n}\n\nasync function promptInteractively(): Promise<string> {\n // Use the masked-input prompt so the key never echoes to the\n // terminal (defends against shoulder-surfing, screen recordings,\n // and scroll-back capture). The previous `readline.question` path\n // echoed every keystroke which defeated the \"no shell history\"\n // promise of this command. Lazy-load `@inquirer/prompts` to keep\n // it off the cold path for non-interactive invocations.\n const { password } = await import('@inquirer/prompts');\n const answer = await password({\n message: 'Paste your API key (kash_live_… or kash_test_…):',\n mask: '*',\n });\n return answer.trim();\n}\n","/**\n * `kash auth status` — report the locally-stored credentials.\n *\n * Does NOT call the API. There is no `whoami` endpoint on the public\n * API today (the only auth-flavoured route is webhook-secret rotation,\n * which is a write). Reporting purely-local state keeps the command\n * cheap and side-effect-free; the moment the user issues a real call\n * (e.g. `kash markets list`) the SDK raises `KashAuthenticationError`\n * if the key is invalid.\n */\n\nimport { Command } from 'commander';\n\nimport { readConfig } from '../../utils/config-store.js';\nimport { redact } from '../../utils/formatting.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, print, printJson, style } from '../../utils/output.js';\n\nexport const statusCommand = new Command('status')\n .description('Show locally-configured credentials. Does not call the API.')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash auth status\n $ kash auth status --profile prod\n $ kash auth status --json --quiet | jq -r '.apiKey'\n`\n )\n .action(async (_opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const config = await readConfig({\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n\n if (globals.json) {\n printJson({\n // Pure local-state field. `true` means \"an API key is in\n // scope for this profile\" (file or env), NOT \"this key is\n // accepted by the server\" — `kash auth status` is offline by\n // design. Use `kash health --json --quiet | jq .ok` for a\n // server-side check.\n configured: Boolean(config.apiKey),\n // Backward-compat alias. Same value as `configured`. Kept\n // for downstream scripts that pin to the old field name —\n // will be removed in a major bump after the rename has\n // burned in.\n authenticated: Boolean(config.apiKey),\n apiKey: config.apiKey ? redact(config.apiKey) : null,\n profile: config.profile,\n baseUrl: config.baseUrl,\n defaultChainId: config.defaultChainId,\n // Direct-mode fields (`kash protocol …` / `kash eoa …`). Always\n // emitted (`null` when unset) so direct-mode operators can\n // introspect their own profile via JSON without falling back\n // to reading `~/.kash/config.json` directly. The signerKeyRef\n // is the reference shape (`file:<path>` / `env:<NAME>`),\n // never the raw private key — the CLI never persists keys.\n rpcUrl: config.rpcUrl ?? null,\n smartAccount: config.smartAccount ?? null,\n bundlerUrl: config.bundlerUrl ?? null,\n bundlerProvider: config.bundlerProvider ?? null,\n signerKeyRef: config.signerKeyRef ?? null,\n sources: config.sources,\n });\n return;\n }\n\n if (!config.apiKey) {\n log.warn(`No API key configured for profile \"${config.profile}\".`);\n log.detail(\n 'Hint',\n \"Run 'kash setup' for the wizard, or 'kash auth set-key' for the bare key. Or set KASH_API_KEY.\"\n );\n return;\n }\n\n print(`${style.success('✓')} API key configured (profile: ${config.profile})`);\n print(\n ` ${style.dim('Note ')} not verified against the server — run \\`kash health\\` to probe`\n );\n print(` ${style.dim('API key ')} ${redact(config.apiKey)} (${config.sources.apiKey})`);\n print(` ${style.dim('Profile ')} ${config.profile} (${config.sources.profile})`);\n print(` ${style.dim('Base URL ')} ${config.baseUrl} (${config.sources.baseUrl})`);\n print(\n ` ${style.dim('Chain id ')} ${String(config.defaultChainId)} (${config.sources.defaultChainId})`\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,WAAAA,gBAAe;;;ACCxB,SAAS,eAAe;AAMjB,IAAM,gBAAgB,IAAI,QAAQ,QAAQ,EAC9C,YAAY,qDAAqD,EACjE;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAKF,EACC,OAAO,OAAO,OAAO,QAAiB;AACrC,QAAM,UAAU,YAAY,GAAG;AAC/B,QAAM,QAAQ;AAAA,IACZ,GAAI,QAAQ,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACpE,GAAI,QAAQ,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,QAAQ,WAAW;AAAA,EAC/E;AACA,QAAM,SAAS,MAAM,WAAW,KAAK;AACrC,QAAM,iBAAiB,UAAU,KAAK;AAEtC,QAAM,kBAAkB,QAAQ,QAAQ,IAAI,cAAc,CAAC;AAE3D,MAAI,QAAQ,MAAM;AAChB,cAAU;AAAA,MACR,IAAI;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,SAAS,QAAQ,OAAO,UAAU,OAAO,QAAQ,WAAW,MAAM;AAAA,MAClE,aAAa;AAAA,IACf,CAAC;AACD;AAAA,EACF;AAEA,MAAI,OAAO,WAAW,QAAW;AAC/B,QAAI,KAAK,sCAAsC,OAAO,OAAO,IAAI;AAAA,EACnE,OAAO;AACL,QAAI,QAAQ,iCAAiC,OAAO,OAAO,IAAI;AAAA,EACjE;AACA,MAAI,iBAAiB;AACnB,QAAI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