Repository navigation
feat(tsm): agent-friendly list search and JSON output - #28
Merged
Merged
Conversation
The daemon reports secret_count 0 while the vault is locked, so a locked vault looked empty. tsm status now omits the count (text and --json) until the vault is unlocked.
- tsm list takes terms and lists the secrets where any term appears in the
name, display name, description, or a tag (case-insensitive), so agents
no longer pipe the full list into ad-hoc Python filters.
- --json output is compact when stdout is not a terminal; arrays put one
element per line, so | head shows whole entries and the output stays one
JSON document.
- Errors never go to stdout. With --json, stderr holds
{"error":{"code","name","message"}}; name is a stable snake_case
word (auth_required, vault_locked, ...). Before, a locked vault printed an
error object to stdout, which a filter expecting an array read as empty.
- Skill and README document the search, the output shape, and the errors.
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.
Why
Agent session logs show that agents use
tsm listwith difficulty:tsm list --jsonoutput to Python filters. They do this in 5 of 9 calls.tsm list --jsonwrites an error object to stdout. A filter that expects an array reads it as "no match". One agent decided that the vault had no OpenRouter key.tsm list --json | head -40shows only about 5 entries. One agent did not see the second Anthropic key and used the wrong account.tsm statusshowsSecrets: 0when the vault is locked, so the vault looks empty.What changes
--json, stderr gets{"error":{"code":-32002,"name":"auth_required","message":"..."}}. Thenamefield is a stable word that scripts can match. Errors that do not come from the daemon have onlymessage.tsm list [term...]shows the secrets where any term occurs in the id, display name, description, or a tag. Case is ignored. When nothing matches,--jsongives[].| headshows complete entries. The output is still one JSON document, sojq '.[]'andjson.loadcontinue to work. A terminal still gets indented output. This applies to all--jsonoutput.tsm statusdoes not show the secret count while the vault is locked. This applies to text and--json. The change is in the CLI only, so it also works with an older daemon.The skill and README describe the search, the output shape, and the error object.
Compatibility
--jsonerrors from stdout must now read stderr.secret_countis not intsm status --jsonwhile the vault is locked.Tests
go test ./...passes.tsm list anthropic --jsonshows both Anthropic entries.| head -4shows 3 complete entries.tsm statusdoes not show the count while locked.