Skip to content

feat: add catalogs command for the public catalog-pages API - #238

Draft
jeff-schnitter wants to merge 1 commit into
mainfrom
345-catalogs-command
Draft

feat: add catalogs command for the public catalog-pages API#238
jeff-schnitter wants to merge 1 commit into
mainfrom
345-catalogs-command

Conversation

@jeff-schnitter

Copy link
Copy Markdown
Collaborator

Summary

Deliverable 3 of 3 for [CD-345]. Adds a catalogs sub-command that wraps the new public catalog-pages API in brain-backend (PRs cortexapps/brain-backend#17183 + #17185).

Command Verb / path
cortex catalogs list GET /api/v1/catalog-pages (auto-paginated; --page/--page-size, --table/--csv)
cortex catalogs get -s <slug> GET /api/v1/catalog-pages/{slug}
cortex catalogs create -f <file> POST /api/v1/catalog-pages — create or replace (upsert)
cortex catalogs delete -s <slug> DELETE /api/v1/catalog-pages/{slug}

Modeled on commands/scaffolders.py. create accepts a JSON or YAML definition and always sends it as JSON (the endpoint is JSON-only). Registered alphabetically after catalog in cli.py.

Naming

Named catalogs (the UI feature name), and it targets /api/v1/catalog-pages — distinct from the existing catalog command, which manages catalog entities at /api/v1/catalog. Same entity-vs-page split the backend makes.

Test plan

  • Added tests/test_catalogs.py (list + full CRUD round-trip, including upsert-replace and delete), following the test_scaffolders.py real-API + skip-guard pattern, plus data/import/catalogs/cli-test-catalog.json.
  • ⚠️ Not run in my dev sandbox — this environment has no network access to PyPI, so poetry install (and therefore pytest / poetry run cortex) can't run here. New files byte-compile (py_compile) and the fixture is valid JSON. Please let CI (test-pr.yml) exercise the suite against the test tenant, or I can run it once deps are available.

Depends on the backend endpoints from cortexapps/brain-backend#17183 and #17185 being deployed to the target tenant; until then the tests skip via the _api_enabled() guard.

🤖 Generated with Claude Code

Add a `catalogs` sub-command that wraps the new public catalog-pages API
(cortexapps/brain-backend CD-345):

- cortex catalogs list           GET    /api/v1/catalog-pages
- cortex catalogs get -s <slug>  GET    /api/v1/catalog-pages/{slug}
- cortex catalogs create -f <f>  POST   /api/v1/catalog-pages (create or replace)
- cortex catalogs delete -s <slug> DELETE /api/v1/catalog-pages/{slug}

Modeled on the scaffolders command. `create` accepts a JSON or YAML
definition and always sends it as JSON. Named `catalogs` (the UI feature
name); it targets `/api/v1/catalog-pages`, distinct from the existing
`catalog` command for catalog entities.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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