Skip to content

feat(query): add composite pipeline audit commands#8

Merged
alexskatell merged 1 commit into
mainfrom
feat/composite-query-commands
May 13, 2026
Merged

feat(query): add composite pipeline audit commands#8
alexskatell merged 1 commit into
mainfrom
feat/composite-query-commands

Conversation

@alexskatell
Copy link
Copy Markdown
Contributor

Summary

  • Add topline query freshness for the warehouse_freshness view.
  • Add topline query snapshot --pipeline <id> for stage/value rollups from pipeline_snapshot.
  • Add topline query audit --pipeline <id> as the single agent-facing audit primitive wrapping freshness, snapshot, activity, active deals, and movement from the composite warehouse views.
  • Default audit/snapshot to status=open, with --status all escape hatch.
  • Use COUNT(DISTINCT source_id) so view fan-out does not inflate touch counts.
  • Cast avg_days_in_stage to integer in CLI output so --agent PII masking cannot corrupt long decimal JSON numbers.

Test Plan

  • go test ./...
  • Live smoke: built local binary and ran query audit against Sales - Flex - Qualified; output parsed as valid JSON and returned activity/deals/snapshot/movement keys.

@alexskatell alexskatell merged commit d7ee974 into main May 13, 2026
1 check passed
@alexskatell alexskatell deleted the feat/composite-query-commands branch May 13, 2026 19:50
alexskatell added a commit that referenced this pull request May 13, 2026
#9)

Bundled skill docs were still telling agents to author a hand-rolled
composite SQL string for the standard pipeline audit. Now that
`topline --agent query audit|snapshot|freshness` ship as composite
warehouse commands (PR #8), the documented contract collapses to:

  1. query doctor
  2. query audit --pipeline ... --since ... --status open
  3. answer

Hard ceiling drops from 4 calls to 3. Raw `query sql` is reserved
for non-standard analytics only.

Adds an explicit pitfall: bash heredocs around `query sql`
(`SQL=\$(cat <<'SQL' ... SQL)` or `--sql "\$(cat <<SQL ... SQL)"`)
are the bash form of the Python wrapper anti-pattern and are banned
in the default flow. If a question is a standard pipeline rollup,
the answer is `query audit`, not a hand-built multi-line SQL string.

hermes SKILL bumped to v1.5.0; claude-code SKILL keeps no version
field but is brought to the same contract.

Co-authored-by: Alex Skatell <alex@topline.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant