feat(cli): add nirium doctor preflight diagnostic command - #59
Merged
Merged
Conversation
Eras256
added a commit
to M0nsxx/nirium-sdk
that referenced
this pull request
Aug 26, 2026
- Kept both CLI commands (verify + doctor, from nirium-protocol#59 already merged) in index.ts, bin/nirium.js, and README — this branch and nirium-protocol#59 each added one, neither replaces the other. - Combined test scripts to run both test/verify.test.js and test/doctor.test.js under one `npm test`. - Aligned @stellar/stellar-sdk to ^14.5.0 (matching packages/sdk's own pin) instead of this branch's ^17.0.0, to avoid two different major versions of the same dependency living side by side once nirium-protocol#62 also merges its own ^14.5.0 addition.
Eras256
pushed a commit
that referenced
this pull request
Aug 26, 2026
…tion verifier (#60) Verified independently (code + real test run): statement is always recomputed as nirium-audit-v1:<computedHash>, never trusted from the document. Merge conflict against main (doctor command from #59 already merged) resolved by keeping both CLI commands side by side. 10/10 tests passing (5 verify + 5 doctor combined under one npm test).
Eras256
added a commit
to M0nsxx/nirium-sdk
that referenced
this pull request
Aug 26, 2026
- Kept all six CLI commands side by side (create/pay/serve/config from this branch, verify/doctor from nirium-protocol#59+nirium-protocol#60 already merged) in both src/index.ts and bin/nirium.js — removed a stale duplicate doctor and a broken verify (calling a nonexistent runAuditVerifier) that this branch's own index.ts still had from before verify.ts existed. - Added pay/serve/config to bin/nirium.js too — the real published entrypoint (package.json's "bin") only had create/doctor/verify; this branch's new commands were only reachable from the unpublished src/index.ts. - Added express + @types/express as real dependencies — serve.ts imports express directly but it was never declared. - Combined test scripts to run all three suites (verify/doctor/ pay-serve) under one npm test. Aligned @stellar/stellar-sdk to ^14.5.0 across the merge. - Rebuilt package-lock.json for both packages/cli and packages/sdk. Known issue NOT fixed here, left for a follow-up (see PR comment): `npm run build` still fails for pay.ts/serve.ts/config.ts — they import sibling files with an explicit .ts extension, which the test runner's native TS stripping needs but tsc's NodeNext resolution rejects. Fixing it by switching to .js extensions breaks the test runner instead (no dist/ exists when running from source). Needs an actual resolution strategy, not a one-line swap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37
Summary
Adds the
nirium doctorcommand to thenirium-clipackage (packages/cli), offering preflight diagnostics for x402/MPP configurations to detect misconfigurations (missing or invalidpayTo, missing or rejected facilitator API key, network passphrase mismatches, unreachable Soroban RPC endpoints) before developers encounter silent 402 or authentication errors.Acceptance Criteria Checklist
nirium doctorCommand & Options: Supports-n, --network <testnet|pubnet>,-c, --config <file>,--json, and--help.payToValidation: Validates Stellar public key format (G..., 56 chars). Detects missing address, malformed keys, or accidental use of secret keys (S...).${facilitatorUrl}/supportedendpoint health/authentication (including 401/403 detection).Test SDF Network ; July 2015vsPublic Global Stellar Network ; September 2015) against target Soroban RPC health endpoint.--jsonoutput mode for CI pipelines.test/doctor.test.js) verifying both failing/broken configurations and green pass paths against mocked endpoints.packages/cli/README.mdwith CLI usage and example human-readable and JSON output snippets.Verification
payTo, secret key used aspayTo, missingfacilitatorApiKey, 401 rejected key. All correctly identified with proper fix suggestions and non-zero exit code.ok: true) with exit code 0.npm run buildandnpm testpassing 100%.