@credda/cli 0.1.6 → 1.0.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 CHANGED
@@ -1,6 +1,43 @@
1
- #!/usr/bin/env node
2
1
  /**
3
- * `credda`: entry point. All logic lives in cli.ts (testable); this file only
4
- * wires the real environment: env vars, stdin/file reading, process exit.
2
+ * `@credda/cli`: the public source mirror for the Credda CLI.
3
+ *
4
+ * ## What this package is
5
+ *
6
+ * The Credda CLI is published to npm as the unscoped package **`credda`**,
7
+ * which owns the `credda` executable. This package ships **no executable**.
8
+ * It is the public mirror of that CLI's command surface, and it exists so the
9
+ * surface is readable, diffable and issue-trackable outside the private
10
+ * engine repository.
11
+ *
12
+ * ## Why it ships no executable
13
+ *
14
+ * Up to 0.1.6 this package installed a binary called `credda` belonging to a
15
+ * different product (a trust-score client, retired). The engine CLI installs a
16
+ * binary called `credda` too, and two packages cannot own one name on a
17
+ * machine: whichever was installed second won, silently. 1.0.0 resolves that by
18
+ * giving the name up. See README.md, "The 0.1.6 break".
19
+ *
20
+ * ## What it exports
21
+ *
22
+ * `args.ts` and `commands.ts`, copied byte for byte from `apps/cli/src/` in the
23
+ * engine repository. Both are dependency-free by construction there — the
24
+ * parser is hand-rolled and the command table is plain data — which is the only
25
+ * reason a faithful copy is possible at all. Everything else in that CLI
26
+ * (`cli.ts`, `doctor.ts`, `triage.ts`, …) reaches into the engine, the
27
+ * database and the sandbox, and is not mirrored here.
28
+ *
29
+ * So what you can do with this package is ask, programmatically and offline,
30
+ * what commands and flags `credda` accepts and what its exit codes mean. What
31
+ * you cannot do with it is run an investigation. Install `credda` for that.
32
+ *
33
+ * The copies are verbatim, with no local edits, so that CI can compare them to
34
+ * the originals by hash. Do not add a header to them.
5
35
  */
6
- export {};
36
+ export { GLOBAL_FLAGS, parseArgs, UsageError, boolFlag, numberFlag, stringFlag, type CommandSpec, type FlagKind, type FlagSpec, type FlagValue, type GlobalFlags, type ParsedCommand, } from './args.js';
37
+ export { aliases, canonicalCommand, COMMANDS, commandUsage, EXIT, EXIT_CODE_HELP, RESERVED_EXIT_CODES, rootUsage, } from './commands.js';
38
+ /** The npm package that ships the `credda` executable this surface describes. */
39
+ export declare const EXECUTABLE_PACKAGE = "credda";
40
+ /** Where the mirrored files come from, so a reader can find the original. */
41
+ export declare const MIRROR_SOURCE = "apps/cli/src/ in the Credda engine repository";
42
+ /** The files copied verbatim. CI compares each to its original by hash. */
43
+ export declare const MIRRORED_FILES: readonly string[];
package/dist/index.js CHANGED
@@ -1,76 +1,43 @@
1
- #!/usr/bin/env node
2
1
  /**
3
- * `credda`: entry point. All logic lives in cli.ts (testable); this file only
4
- * wires the real environment: env vars, stdin/file reading, process exit.
2
+ * `@credda/cli`: the public source mirror for the Credda CLI.
3
+ *
4
+ * ## What this package is
5
+ *
6
+ * The Credda CLI is published to npm as the unscoped package **`credda`**,
7
+ * which owns the `credda` executable. This package ships **no executable**.
8
+ * It is the public mirror of that CLI's command surface, and it exists so the
9
+ * surface is readable, diffable and issue-trackable outside the private
10
+ * engine repository.
11
+ *
12
+ * ## Why it ships no executable
13
+ *
14
+ * Up to 0.1.6 this package installed a binary called `credda` belonging to a
15
+ * different product (a trust-score client, retired). The engine CLI installs a
16
+ * binary called `credda` too, and two packages cannot own one name on a
17
+ * machine: whichever was installed second won, silently. 1.0.0 resolves that by
18
+ * giving the name up. See README.md, "The 0.1.6 break".
19
+ *
20
+ * ## What it exports
21
+ *
22
+ * `args.ts` and `commands.ts`, copied byte for byte from `apps/cli/src/` in the
23
+ * engine repository. Both are dependency-free by construction there — the
24
+ * parser is hand-rolled and the command table is plain data — which is the only
25
+ * reason a faithful copy is possible at all. Everything else in that CLI
26
+ * (`cli.ts`, `doctor.ts`, `triage.ts`, …) reaches into the engine, the
27
+ * database and the sandbox, and is not mirrored here.
28
+ *
29
+ * So what you can do with this package is ask, programmatically and offline,
30
+ * what commands and flags `credda` accepts and what its exit codes mean. What
31
+ * you cannot do with it is run an investigation. Install `credda` for that.
32
+ *
33
+ * The copies are verbatim, with no local edits, so that CI can compare them to
34
+ * the originals by hash. Do not add a header to them.
5
35
  */
6
- import { readFile, writeFile } from 'node:fs/promises';
7
- import { CreddaClient, verifyTrustCredential, verifyVerifiableCredential, verifyTrustExport, } from '@credda/js/headless';
8
- import { runCli } from './cli.js';
9
- import { startListener } from './listener.js';
10
- async function readInput(pathOrDash) {
11
- if (pathOrDash === '-') {
12
- const chunks = [];
13
- for await (const chunk of process.stdin)
14
- chunks.push(chunk);
15
- return Buffer.concat(chunks).toString('utf8');
16
- }
17
- return readFile(pathOrDash, 'utf8');
18
- }
19
- // Raw authenticated GET for the CSV endpoints (?format=csv): the typed SDK
20
- // returns parsed JSON only and documents CSV as a raw-fetch use case. Built
21
- // from the same base URL the client is configured with.
22
- const API_BASE = (process.env.CREDDA_API_URL ?? 'https://api.credda.io').replace(/\/+$/, '');
23
- /**
24
- * The did:web identity of the API this CLI talks to, and the issuer every
25
- * verification expects. `https://api.credda.io` is `did:web:api.credda.io`;
26
- * point CREDDA_API_URL at staging and the expectation follows it.
27
- */
28
- const ISSUER_DID = `did:web:${new URL(API_BASE).host.toLowerCase()}`;
29
- async function fetchCsv(path, apiKey) {
30
- const res = await fetch(`${API_BASE}/api/v1${path}`, {
31
- headers: { Authorization: `Bearer ${apiKey}` },
32
- });
33
- if (!res.ok) {
34
- let detail = '';
35
- try {
36
- const body = (await res.json());
37
- detail = body.error ?? body.message ?? '';
38
- }
39
- catch {
40
- /* non-JSON error body */
41
- }
42
- throw new Error(detail || `request failed (${res.status})`);
43
- }
44
- return res.text();
45
- }
46
- // process.exitCode (not process.exit()): a hard exit right after a fetch
47
- // trips a libuv assertion on Windows Node while handles are still closing.
48
- process.exitCode = await runCli(process.argv.slice(2), {
49
- client: new CreddaClient({ apiBase: process.env.CREDDA_API_URL }),
50
- fetchCsv,
51
- writeFile: (path, content) => writeFile(path, content, 'utf8'),
52
- apiKey: process.env.CREDDA_API_KEY,
53
- webhookSecret: process.env.CREDDA_WEBHOOK_SECRET,
54
- startListener,
55
- out: (line) => console.log(line),
56
- err: (line) => console.error(line),
57
- readInput,
58
- // ⚠️ EVERY VERIFIER IS TOLD WHICH ISSUER IT EXPECTS.
59
- //
60
- // `credda verify` reads a credential handed over by somebody else, which is
61
- // the whole point of it. did:web resolution proves the credential was signed
62
- // by whoever controls the DID's host; it does NOT prove that host is Credda.
63
- // Without an expected issuer, a credential minted by anyone with a domain
64
- // verifies clean and the CLI prints it as valid.
65
- //
66
- // Stated explicitly rather than left to the SDK default, because this CLI
67
- // pins an SDK line that does not have that default, and because a call site
68
- // that says what it expects keeps saying it after the dependency moves.
69
- // ISSUER_DID follows CREDDA_API_URL, so a CLI pointed at staging expects
70
- // staging's issuer rather than production's.
71
- verifiers: {
72
- trustCredential: (credential) => verifyTrustCredential(credential),
73
- verifiableCredential: (vcJwt) => verifyVerifiableCredential(vcJwt, { apiBase: API_BASE, issuer: ISSUER_DID }),
74
- trustExport: (bundle) => verifyTrustExport(bundle, { apiBase: API_BASE, issuer: ISSUER_DID }),
75
- },
76
- });
36
+ export { GLOBAL_FLAGS, parseArgs, UsageError, boolFlag, numberFlag, stringFlag, } from './args.js';
37
+ export { aliases, canonicalCommand, COMMANDS, commandUsage, EXIT, EXIT_CODE_HELP, RESERVED_EXIT_CODES, rootUsage, } from './commands.js';
38
+ /** The npm package that ships the `credda` executable this surface describes. */
39
+ export const EXECUTABLE_PACKAGE = 'credda';
40
+ /** Where the mirrored files come from, so a reader can find the original. */
41
+ export const MIRROR_SOURCE = 'apps/cli/src/ in the Credda engine repository';
42
+ /** The files copied verbatim. CI compares each to its original by hash. */
43
+ export const MIRRORED_FILES = ['args.ts', 'commands.ts'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@credda/cli",
3
- "version": "0.1.6",
4
- "description": "Official Credda CLI: look up and offline-verify portable trust from the terminal. Public trust checks, credential verification, platform score reads, share-token minting. A thin client over @credda/js; no scoring logic lives here.",
3
+ "version": "1.0.0",
4
+ "description": "Public source mirror of the Credda CLI command surface. Ships no executable: install the `credda` package for the CLI itself. Replaces the retired 0.x, which was an unrelated product.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Credda-io/credda-cli#readme",
7
7
  "bugs": {
@@ -9,29 +9,31 @@
9
9
  "email": "martin@credda.io"
10
10
  },
11
11
  "type": "module",
12
- "bin": {
13
- "credda": "dist/index.js"
14
- },
15
12
  "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
16
20
  "files": [
17
21
  "dist",
18
- "!dist/**/*.test.*"
22
+ "!dist/**/*.test.*",
23
+ "CHANGELOG.md"
19
24
  ],
20
25
  "scripts": {
21
26
  "build": "tsc -p tsconfig.json",
22
- "start": "node dist/index.js",
23
27
  "dev": "tsx src/index.ts",
24
28
  "typecheck": "tsc --noEmit",
25
- "test": "vitest run"
26
- },
27
- "dependencies": {
28
- "@credda/js": "^0.8.0"
29
+ "test": "vitest run",
30
+ "example": "node examples/surface.mjs"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@types/node": "^20.14.2",
32
34
  "tsx": "^4.23.1",
33
35
  "typescript": "^5.4.5",
34
- "vitest": "^3.2.6"
36
+ "vitest": "^3.2.7"
35
37
  },
36
38
  "publishConfig": {
37
39
  "access": "public"
@@ -43,11 +45,10 @@
43
45
  "keywords": [
44
46
  "credda",
45
47
  "cli",
46
- "command-line",
47
- "trust",
48
- "reliability-score",
49
- "verifiable-credentials",
50
- "sdk"
48
+ "mirror",
49
+ "command-surface",
50
+ "debugging",
51
+ "bug-reproduction"
51
52
  ],
52
53
  "engines": {
53
54
  "node": ">=18"
package/dist/cli.d.ts DELETED
@@ -1,108 +0,0 @@
1
- /**
2
- * Command router: pure of process/env/fs so it's testable with a mocked
3
- * context (same pattern as packages/mcp's tools.ts).
4
- *
5
- * Every command is READ-ONLY against Credda's deterministic score. Nothing
6
- * here writes an Event, adjusts a score, or makes a trust decision: the CLI
7
- * looks up and offline-verifies EXISTING, already-computed trust facts.
8
- * `mint`/`revoke` manage a share token (a capability, not a score write).
9
- */
10
- import type { CreddaClient, VerifiedCredential, VerifiedVc, VerifiedTrustExport, TrustExport } from '@credda/js/headless';
11
- export interface CliContext {
12
- client: CreddaClient;
13
- /** Platform API key from CREDDA_API_KEY, only needed for keyed commands. */
14
- apiKey?: string;
15
- out: (line: string) => void;
16
- err: (line: string) => void;
17
- readInput: (pathOrDash: string) => Promise<string>;
18
- /** Injected so tests can mock offline verification. */
19
- verifiers: {
20
- trustCredential: (credential: string) => Promise<VerifiedCredential>;
21
- verifiableCredential: (vcJwt: string) => Promise<VerifiedVc>;
22
- trustExport: (bundle: TrustExport) => Promise<VerifiedTrustExport>;
23
- };
24
- /** whsec_… signing secret from CREDDA_WEBHOOK_SECRET, used by `listen`. */
25
- webhookSecret?: string;
26
- /**
27
- * Starts the local webhook receiver (`credda listen`). Injected so the pure
28
- * router stays free of node:http; resolves when the server has stopped.
29
- */
30
- startListener?: (opts: {
31
- port: number;
32
- secret?: string;
33
- }) => Promise<void>;
34
- /**
35
- * Raw authenticated GET returning the response body as text, for the CSV
36
- * endpoints (`?format=csv`), which the typed SDK deliberately leaves to raw
37
- * fetch. `path` is relative to the `/api/v1` prefix.
38
- */
39
- fetchCsv?: (path: string, apiKey: string) => Promise<string>;
40
- /** Write a file to disk (CSV outputs). Injected so the router stays fs-free. */
41
- writeFile?: (path: string, content: string) => Promise<void>;
42
- /** Sleep between `screen --wait` polls. Injected so tests don't wait. */
43
- sleep?: (ms: number) => Promise<void>;
44
- /** Poll interval for `screen --wait` (default 2000ms). */
45
- pollIntervalMs?: number;
46
- }
47
- export declare const VERSION = "0.1.6";
48
- export declare const HELP = "credda: portable trust from the terminal\n\nStart here (needs a sandbox CREDDA_API_KEY, the crd_test_ kind):\n credda quickstart Seed your sandbox with synthetic subjects, print\n their real scores, read one back, and then close\n the counterparty-confirmation loop end to end so\n you finish holding a real VERIFIED event, not\n just a number you read. One command, nothing\n written outside the sandbox.\n --no-confirm Stop after the seed; skip the confirmation loop.\n\nSandbox (crd_test_ keys only; a live key is refused before anything happens):\n credda sandbox seed Populate the sandbox with synthetic subjects.\n Idempotent: an already-seeded subject is left\n alone, never doubled.\n credda sandbox reset Wipe the sandbox and start over.\n\nPublic (no API key):\n credda lookup <token> Trust check for a share token\n credda export <token> Full self-verifying trust export bundle\n credda verify <file|-> Offline-verify a credential: a W3C VC-JWT,\n a compact Trust Credential, or a saved trust\n export bundle (auto-detected). '-' = stdin.\n credda registry Federated trust registry\n credda did Issuer DID document\n credda benchmarks Cohort-benchmark catalog (dimensions + k-anonymity)\n credda reason-codes Adverse-action reason-code catalog (ECOA / Reg B)\n credda outcome-templates [industry]\n How a real-world business maps its work to\n Credda events, and WHO confirms each outcome.\n Guidance only. Optional industry slug filters.\n credda badges list Open Badges 3.0 achievements this issuer signs\n credda badges get <badgeId> One achievement definition\n credda professional-record public <token>\n The professional record behind a share token\n (the subject's own consent to present it)\n credda career-export --token <token>\n The subject's whole verified record as a JSON\n Resume document, behind a share token (the\n subject's own consent, no API key sent)\n\nPlatform (needs CREDDA_API_KEY):\n credda score <userId> Current score\n credda explain <userId> Factor-level score explanation\n credda components <userId> Six named 0-100 score components\n credda risk <userId> Advisory risk signals\n credda trust-summary <userId> [--narrative]\n Deterministic, evidence-based trust summary\n (explains; never a verdict). --narrative adds an\n advisory AI retelling when the server has AI on.\n credda benchmark <userId> [--dimension <d>]\n Where a subject sits within its cohort:\n percentile + the cohort distribution\n credda distribution [--dimension <d>] [--cohort <c>]\n Aggregate, k-anonymised cohort distribution.\n Omit --cohort for every cohort on the dimension.\n credda users [--score-min <n>] [--score-max <n>] [--band <b>]\n [--subject-type <PERSON|AGENT|ORGANIZATION>] [--scored|--unscored] [--frozen]\n [--active-since <iso>] [--registered-since <iso>] [--registered-before <iso>]\n [--verified] [--min-verified <n>]\n [--sort <score|lastActivity|registered|externalId>] [--order <asc|desc>]\n [--cursor <c>] [--limit <n>]\n Query + export your book of subjects.\n A subject with no score yet reports null,\n never a placeholder; list those with\n --unscored.\n credda book-summary [same filters as \"users\"]\n Size a segment WITHOUT paging it: how many\n match, how many are scored, band mix and\n median/mean. Null (not 0) when nothing in the\n segment is scored.\n credda usage [days] [--from <date> --to <date>] [--csv <outfile>]\n Your platform's metered API usage. Either a\n trailing [days] window OR an inclusive\n --from/--to date range (YYYY-MM-DD), not both.\n --csv writes the flat CSV statement to a file.\n credda activity [--action <A>] [--from <t> --to <t>] [--cursor <c>] [--limit <n>]\n Your platform's own activity/audit log,\n newest-first, cursor-paginated\n credda verified-profile <userId>\n How much of a subject's CLAIMED record\n (education/skills/certifications/employment) is\n third-party verified. Counts whether a claim is\n verified, never how prestigious it is, and it\n can never move the Reliability Score.\n credda qualify <userId> --category <education|skill|certification|employment>\n [--label <l>] [--issuer <i>] [--verified-by <witness>]\n Record a qualification claim. Always recorded;\n counts as VERIFIED only with a genuine\n third-party --verified-by witness.\n credda professional-record get <userId>\n R\u00E9sum\u00E9-shaped summary of a VERIFIED work record.\n Describes a record, not a hiring verdict, a\n background check, or a consumer report.\n credda professional-record credential <userId> [--ttl <seconds>]\n Mint the signed, offline-verifiable Professional\n Record Credential (+ an \"Add to LinkedIn\" link)\n credda reliability-report <userId> [--recent <n>] [--benchmark]\n The consolidated worker reliability report a\n staffing agency or employer weighs: reliability,\n metrics, verified experience, tenure, ranked\n drivers, recent outcomes. EVIDENCE, not a hire /\n place / rank verdict, a background check, or a\n consumer report. Use --token <token> for the\n public worker-consent route (NO API key).\n credda career-export <userId> The subject's whole verified record as an open\n JSON Resume document (jsonresume.org). Describes\n a record, not a hiring verdict or a consumer\n report. Use --token <token> for the public route.\n credda mint <userId> Mint a share token for a user\n credda revoke <userId> Revoke a user's share token\n\nConfirmation requests: the counterparty-confirmation primitive. You PROPOSE an\noutcome and deliver the one-time token to the counterparty over YOUR OWN channel;\nthe event is written, verified, only when that distinct party confirms:\n credda confirmations create --user <externalId> --type <eventType>\n --counterparty <ref> [--counterparty-name <n>] [--description <d>]\n [--stake <HIGH|MEDIUM|LOW>] [--value <n>] [--due <iso>] [--completed <iso>]\n [--return-url <url>] [--expires-in <days>] [--idempotency-key <k>]\n Needs CREDDA_API_KEY. Token shown ONCE.\n credda confirmations batch <file.json> [--idempotency-key <k>]\n The ACTIVATION ENGINE: bulk-create up to 100\n requests from a JSON file (an array of request\n bodies, or { \"requests\": [...] }). Warms a cold\n ledger from your book. Needs CREDDA_API_KEY;\n each ok item's token is shown ONCE.\n credda confirmations list [--status <s>] [--cursor <c>] [--limit <n>]\n credda confirmations get <id>\n credda confirmations cancel <id>\n credda confirmations preview <id> --token <t>\n What the counterparty is asked to confirm.\n NO API key; the token is the capability.\n credda confirmations respond <id> --token <t> (--confirm | --decline)\n The counterparty's decision. NO API key.\n --confirm writes the event; --decline writes\n nothing. Single-use either way.\n\nReference requests: the qualifications-half sibling of confirmations. A r\u00E9sum\u00E9\nclaim (employment / education / certification / skill) becomes VERIFIED when the\nnamed third party who was there confirms it. Records no qualification and never\nmoves the reliability score:\n credda references create --user <externalId>\n --category <employment|education|certification|skill>\n --counterparty <ref> [--label <l>] [--issuer <i>] [--jurisdiction <j>]\n [--reference <r>] [--counterparty-name <n>] [--description <d>]\n [--return-url <url>] [--expires-in <days>] [--idempotency-key <k>]\n Needs CREDDA_API_KEY. Token shown ONCE.\n credda references list [--status <s>] [--cursor <c>] [--limit <n>]\n credda references get <id>\n credda references cancel <id>\n credda references preview <id> --token <t>\n What the reference is asked to confirm.\n NO API key; the token is the capability.\n credda references respond <id> --token <t> (--confirm | --decline)\n The reference's decision. NO API key.\n --confirm records the qualification; --decline\n writes nothing. Single-use either way.\n\nThreshold policies (needs CREDDA_API_KEY): declarative \"tell me when this line\nis crossed\"; delivers policy.threshold_crossed through your webhooks. Config\nonly: a policy never reads into, blocks, or changes a score:\n credda policies list [--cursor <c>] [--limit <n>]\n credda policies get <id>\n credda policies create --name <n> (--user <externalId> | --all)\n --metric <score|component|band|verified_events>\n [--direction <up|down|enter|leave>] [--threshold <n>]\n [--component <reliability|timeliness|trustworthiness|verification|consistency|momentum>]\n [--band <b>]\n credda policies update <id> [--name <n>] [--direction <d>] [--threshold <n>]\n [--component <c>] [--band <b>] [--activate | --deactivate]\n The metric is immutable; delete + recreate.\n credda policies delete <id>\n\nScore monitors (needs CREDDA_API_KEY): edge-triggered watches that deliver\n\"monitor.triggered\" through your webhooks; notification config only, a\nmonitor never affects a score:\n credda monitors list [--cursor <c>] [--limit <n>]\n credda monitors get <id>\n credda monitors create --user <externalId> [--below <score>] [--above <score>] [--band-change]\n At least one condition required. --below fires\n on a downward crossing (and on a first score\n already below it), --above on an upward\n crossing, --band-change on any band change.\n credda monitors delete <id>\n\nBulk screenings (needs CREDDA_API_KEY): async batch score reads, up to\n10,000 ids per job, strictly read-only:\n credda screen <ids...> Submit ids (comma/space separated), or:\n credda screen --file <path> One id per line, or a CSV whose FIRST column\n is the id (a leading \"id\"/\"userId\"/\n \"externalId\" header row is skipped).\n [--wait] Poll until the job finishes, then print the\n summary (exit 1 if the job FAILED).\n credda screenings list [--cursor <c>] [--limit <n>]\n credda screenings get <id> Job status + summary\n credda screenings results <id> [--csv <outfile>]\n Per-user results (JSON; --csv writes the CSV\n attachment to a file instead)\n\nWebhooks (needs CREDDA_API_KEY):\n credda webhooks list Your webhook subscriptions\n credda webhooks create <url> <event..> Subscribe (secret shown ONCE)\n credda webhooks delete <id> Remove a webhook\n credda webhooks test <id> Send a synthetic signed delivery\n credda webhooks deliveries <id> Recent delivery attempts (incl. retries)\n credda webhooks recent [event..] Recent events across ALL your endpoints\n (sample data for automation platforms;\n falls back to catalog examples, flagged\n isExample, when nothing has fired yet)\n\nLocal development:\n credda listen [port] Local webhook receiver: verifies each delivery's\n HMAC signature (CREDDA_WEBHOOK_SECRET) and\n pretty-prints the payload. Default port 4141.\n Credda delivers to public HTTPS only; expose\n this port with your own tunnel (e.g. cloudflared).\n\nEnvironment:\n CREDDA_API_URL API base (default https://api.credda.io)\n CREDDA_API_KEY Platform API key for keyed commands\n CREDDA_WEBHOOK_SECRET whsec_\u2026 signing secret for \"credda listen\"\n\nExit codes: 0 ok/valid \u00B7 1 error \u00B7 2 credential failed verification";
49
- /** Raw-key prefix the API stamps on a sandbox key (lib/testMode.ts). */
50
- export declare const TEST_KEY_PREFIX = "crd_test_";
51
- /**
52
- * A sandbox key, or an error that says exactly what to do next.
53
- *
54
- * The server refuses a live key anyway (`403 TEST_MODE_ONLY`), but a first-run
55
- * user does not deserve a 403 to interpret: the prefix is visible locally, so
56
- * the actionable message costs one string comparison. This is the "better
57
- * first-run errors" rule applied to the single most likely first mistake.
58
- */
59
- export declare function requireSandboxKey(ctx: CliContext): string;
60
- /**
61
- * Extra stderr lines for a failed command.
62
- *
63
- * The important one is the **request id**: it is the single fastest way for
64
- * Credda to diagnose a failure, and a CLI user has nowhere else to find it.
65
- * Also surfaces the machine code (so it can be looked up in
66
- * `GET /api/v1/errors`) and any `Retry-After` the server asked for.
67
- *
68
- * Duck-typed rather than `instanceof CreddaError` on purpose: the router
69
- * imports only TYPES from the SDK, so it stays pure and trivially mockable.
70
- * Pure and exported for testing.
71
- */
72
- export declare function errorHints(e: unknown): string[];
73
- /**
74
- * Tiny flag parser: `--name value` for valued flags, bare `--name` for
75
- * booleans, everything else positional. Unknown `--flags` are an error rather
76
- * than silently becoming positionals.
77
- */
78
- export declare function parseFlags(args: string[], spec?: {
79
- valued?: string[];
80
- boolean?: string[];
81
- }): {
82
- positional: string[];
83
- flags: Record<string, string | true>;
84
- };
85
- /**
86
- * Parse the ids for `credda screen`. Inline args may be comma- and/or
87
- * space-separated. A file is one id per line, or a CSV, in which case only
88
- * the FIRST column is read (a leading header row named id/userId/externalId
89
- * is skipped). Deduped, order-preserving. Deliberately simple: no quoted-CSV
90
- * handling (an id containing a comma isn't a valid external id anyway).
91
- */
92
- export declare function parseIdList(input: {
93
- inline?: string[];
94
- fileText?: string;
95
- }): string[];
96
- /** Classify verify input: trust-export bundle JSON, VC-JWT, or compact credential. */
97
- export declare function classifyCredentialInput(raw: string): {
98
- kind: 'export';
99
- bundle: TrustExport;
100
- } | {
101
- kind: 'vc-jwt';
102
- jwt: string;
103
- } | {
104
- kind: 'compact';
105
- credential: string;
106
- };
107
- /** Run one CLI invocation. Returns the process exit code. */
108
- export declare function runCli(argv: string[], ctx: CliContext): Promise<number>;