feat: add a CLI to mint NIP-43 invite codes - #732
Merged
Anshumancanrock merged 3 commits intoAug 16, 2026
Conversation
🦋 Changeset detectedLatest commit: 47bae5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
cameri
reviewed
Aug 16, 2026
cameri
approved these changes
Aug 16, 2026
There was a problem hiding this comment.
Pull request overview
Adds an operator-facing CLI workflow for minting NIP-43 invite codes (kind 28934 claim strings) without manual SQL, wiring it into the existing invite-code persistence layer and documenting the feature.
Changes:
- Adds
nostream invite createCLI command (with JSON output and DB connectivity hints) to mint invite codes. - Introduces shared NIP-43 invite helpers (
generateInviteCode, settings-derived defaults, pubkey parsing) and expands repository support to persistcreated_by. - Updates defaults/config docs plus adds unit/integration tests to keep CLI/docs/settings aligned.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils/settings.spec.ts | Verifies nip43 defaults exist in default-settings.yaml and merge correctly. |
| test/unit/utils/nip43-invites.spec.ts | Adds unit tests for new invite helper utilities (code generation, limits, pubkey parsing, issuing). |
| test/unit/repositories/invite-code-repository.spec.ts | Updates repository tests for new create(code, options) signature and created_by persistence. |
| test/unit/cli/invite.spec.ts | Unit tests for runInviteCreate, env-defaulting behavior, and error messaging/hints. |
| test/unit/cli/docs.spec.ts | Ensures README/CLI docs mention the new invite-minting command. |
| test/unit/cli/cli.integration.spec.ts | CLI spawn/integration coverage for invite top-level help/usage and validation. |
| src/utils/nip43-invites.ts | New shared utilities to generate/issue invite codes and resolve defaults from settings. |
| src/repositories/invite-code-repository.ts | Extends invite code persistence API to accept options (incl. createdBy). |
| src/cli/index.ts | Registers invite create command, args/options parsing, and usage help wiring. |
| src/cli/commands/invite.ts | Implements DB connection logic + runInviteCreate behavior and output formatting. |
| src/@types/repositories.ts | Updates IInviteCodeRepository.create signature to accept an options object. |
| src/@types/invite-code.ts | Adds CreateInviteCodeOptions type (expires/uses/createdBy). |
| resources/default-settings.yaml | Adds nip43.inviteCodeExpiry and nip43.defaultMaxUses defaults. |
| README.md | Documents how to mint NIP-43 invite codes via the CLI. |
| CONFIGURATION.md | Adds configuration table entries for new nip43 settings. |
| CLI.md | Adds dedicated section for NIP-43 invite minting + examples and semantics. |
| .knip.json | Removes ignore entry now that repository file is referenced/used. |
| .changeset/nip43-invite-cli.md | Declares a minor release for the new invite CLI feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Anshumancanrock
force-pushed
the
feat/nip43-invite-cli
branch
from
August 16, 2026 18:50
4a79e5c to
d3ddf0b
Compare
Anshumancanrock
force-pushed
the
feat/nip43-invite-cli
branch
from
August 16, 2026 18:56
d3ddf0b to
47bae5e
Compare
cameri
approved these changes
Aug 16, 2026
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.
Description
Adds
nostream invite createso one can mint a NIP-43 claim without writing SQL.Defaults come from
nip43.defaultMaxUses(1) andnip43.inviteCodeExpiry(0 = never). Ifinfo.selfis hex ornpub1…, it gets stored ascreated_by.Related Issue
Follow-up to #676. Join (28934) is already on main; there was still no operator path to create a code.
Motivation and Context
Kind 28934 can claim a code, but minting one meant inserting into
invite_codesby hand. That's not usable.