feat: add 'prime' subcommand for LLM agent orientation#21
Merged
Conversation
Per quantcli shared contract §6, every CLI exposes 'prime' printing a one-screen primer aimed at LLM agents calling the CLI as a tool. Same section structure across all three repos (WHAT IT IS / OUTPUT FORMATS / AUTH / DATE FLAGS / SUBCOMMANDS / EXAMPLES / GOTCHAS) so an agent that has read crono's prime knows where to look in liftoff's. https://github.com/quantcli/common/blob/main/CONTRACT.md#6-the-prime-subcommand Liftoff-specific content covers: - workouts list/show/stats and bodyweights list/stats - Local-zone date semantics - LIFTOFF_API_BASE override for the periodic API host rotation - jq recipes for volume math and bodyweight delta Also extends the rootCmd Long description so 'liftoff-export --help' points agents at 'prime' from the top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three small gaps the new 'prime' subcommand surfaced when its examples
were exercised end-to-end:
- 'bodyweights list' had no --format flag at all, but the prime's
bodyweight-delta example pipes 'bodyweights list --since 90d --format
json' into jq. Add --format json (markdown stays default) emitting
[{"date":"YYYY-MM-DD","weight":N}, ...].
- 'workouts stats' printed plain-text "No workouts found." even when the
caller asked for --format json, breaking jq pipelines on empty
windows. Emit '[]' instead.
- printJSON encoded nil slices as 'null'. Match the prime's "JSON is
'[]'" promise by special-casing nil slices via reflect.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
@claude rebase on main |
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.
Summary
primesubcommand per quantcli shared contract §6 — a one-screen, LLM-targeted primer covering output formats, auth, date flags, every subcommand's JSON shape, and ready-to-run jq recipes.bodyweights listnow accepts--format json(the prime's bodyweight-delta example uses it).workouts stats --format jsonemits[]on empty windows instead of plain-textNo workouts found..printJSONno longer encodes nil slices asnull— they're[], matching the prime contract.Test plan
liftoff-export primeprints the primer.workouts show today,workouts stats --since 30d --format json | jq '.[]|select(.type=="WR")...',workouts stats --exercise bench --since 1y --format json,bodyweights list --since 90d --format json | jq ....bodyweights list --format jsonreturns[{"date":"YYYY-MM-DD","weight":N}, ...].workouts stats --since 2024-01-01 --until 2024-01-01 --format json→[].workouts list --since 2024-01-01 --until 2024-01-01 --format json→[].🤖 Generated with Claude Code