Repository navigation
Add /nfts [address] as a read-only slash command - #117
Merged
portdeveloper merged 1 commit intoOct 4, 2026
Merged
Conversation
Listing NFTs needed a natural-language request and the model, while /balance and /history already read directly. /nfts and /nfts <address> now send get_nfts through handleAction, so everything runAction already does applies unchanged: the active account when no address is given, the address refusals, the indexer and network refusals, and the existing list format and page limit. More than one argument prints "usage: /nfts [address]" and fails a scripted run, the same way /history and /send handle bad arity. /help and the header comment list the command, and the README no longer says NFT reads need the model; only token sends and NFT transfers do. Tests run the built CLI in scripted mode with the existing @qvac/sdk shim, so processLine -> handleSlash -> handleAction is the real path, against a loopback indexer that records which owner it was asked about: default account (checked against what /address printed in the same run), explicit owner, malformed address, extra arguments, the mainnet no-indexer refusal, and /help. The shim gains an opt-in call log, and every /nfts case asserts the model was never asked for a completion. All six fail on main. Closes portdeveloper#116
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 #116
Change
handleSlashgets annftscase:/nftssends{ action: "get_nfts" }and/nfts <address>sends{ action: "get_nfts", address }, both throughhandleAction. EverythingrunActionalready does applies unchanged:fetchReservoir;usage: /nfts [address]and fails a scripted run, the same way/historyand/sendhandle bad arity./helpand the header comment incli.mjslist the command. The README command list includes it, and the sentence that said NFT reads need the model now covers only token sends and NFT transfers.No new read path, no change to NFT formatting or pagination, nothing on the transfer side.
Verified
test/nfts-command.test.mjsruns the built CLI (dist/cli.mjs) in scripted mode with the existing@qvac/sdkshim, soprocessLine→handleSlash→handleActionis the real path. The indexer is a loopback server that records which owner it was asked about.Six cases:
/addressprinted in the same run, and that the existing list format comes back.RESERVOIR_API_URLshows the refusal, exit 1./help. It lists the command.The model is never called. The shim gains an opt-in call log (
NAD_SHIM_CALL_LOG), and every/nftscase asserts it stayed empty.Red, then green:
main. All six fail for the expected reasons:unknown command: /nfts, no indexer read, exit 0 where 1 is expected.npm run build && npm test: 552/552 on Node 22.23 (CI's major version) and on Node 20. The new file was rerun twice with no flakes.