feat(kb): vk kb list/delete/prune for 0.6.0 — clean up the 425-kb backlog#6
Merged
Conversation
…ial-success exit 7
…mment Apply 3 of 4 important findings from final code review: - cmd/kb/list.go: --older-than parse error and --pattern glob error now route through clerr.Validation so they exit 2 (matches prune's behavior + the documented exit-code contract). Pre-flight pattern syntax check moved before the HTTP call. - cmd/kb/prune.go: pattern syntax pre-flighted at the top of RunE so a bad glob exits 2 before the first list-page round-trip. The scan-loop's per-page filterKBs() still validates as a safety net. - cmd/kb/delete.go: document why the confirmation prompt doesn't show the kb name. Spec §3 imagined a per-id GET to enrich the prompt; the vectoria backend returns 405 Method Not Allowed for that route, so the spec's "fallback to UUID-only" path is the only path. Skipped: --page/--size client-side clamping (consistent with the existing vk video list pattern; backend returns clear error on bad values). Locale pinning in integration tests is a cross-cutting concern best handled in one sweep across all integration tests.
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
vk kb list / delete / prune— manage vectoria knowledgebases. Headline command isvk kb prune, designed to clean up the 425 accumulated kbs fromvk create's one-kb-per-invocation pattern (0.5.2 closed the future leak; this PR adds the bulk-cleanup tool).The user can now run, post-merge:
```bash
vk kb prune --pattern 'vibeknow-cli-*' --yes # actually delete CLI's own orphans
```
Safety contract (load-bearing, all integration-test-pinned)
--patternor--older-than(exit 2). No "delete everything" shortcut.--yes(orVIBEKNOW_ASSUME_YES=1) actually deletes.Diff (10 commits)
0f1015ffeat(vectoria): add ListKBs client method— paginated list wrappingGET /v1/knowledgebases?offset=N&limit=N772610efeat(durfmt): add ParseAge supporting Nd day-suffix shortcut— newinternal/durfmtpkg parsing7d/24h/1h30m6ac258afeat(kb): add subcommand skeleton + i18n keys— 17 keys in en+zh8d742abfeat(kb): vk kb list with --pattern and --older-than filters— client-side glob + age filter; text + JSON outpute309b83feat(kb): vk kb delete with idempotent 404 handlingd558dbcfeat(kb): vk kb prune with dry-run default, pattern/age filters, partial-success exit 79d3b8a2test(integration): kb prune dry-run-by-default, apply, filter-required— 3 end-to-end tests against mock vectoria9516ce4docs: document vk kb subcommand family for 0.6.0— CHANGELOG / AGENTS / README + zh6586d69chore: bump version to 0.6.0ba44016refactor(kb): final-review fixes — exit-2 consistency, pre-flight, commentTest plan
go test ./...passes (incl. 3 new integration tests for kb prune + 4 filter unit tests + 2 prune-validation unit tests + ListKBs unit test + ParseAge unit tests)go build ./...cleanvk kb --helplists three subcommands (list,delete,prune)vk versionreflects 0.6.0vk kb prunewithout filter → exit 2 with clear messagevk kb prune --pattern 'bogus-*'→ real-backend smoke walked 5 pages, 0 matches, exit 0 (proves pagination + filter wiring against real vectoria)vk kb prune --pattern 'vibeknow-cli-*' --yeson the user's tenant; expect ~10-20 orphan kbs to be cleaned. Verify count drops viavk kb list --output json | jq .total.Final review status
🟡 APPROVED with minor follow-ups (opus-level review). 3 of 4 important findings applied in commit
ba44016. Skipped:vk video list; backend already returns clear error on bad valuesOut of scope
vk kb show <id>—vk kb list --pattern <exact-name>covers the common lookup; backend has no per-id GET anyway (returns 405).vk kb list— N+1 fetches; can add--with-doc-countlater if asked.vk create— surprising side-effect; users invokevk kb pruneexplicitly.Spec / plan
docs/superpowers/specs/2026-05-14-kb-subcommands-design.mddocs/superpowers/plans/2026-05-14-kb-subcommands.md(Both live in the untracked
docs/per team convention; not in this PR.)