Skip to content

add create / update / view project config#42

Merged
czue merged 15 commits into
mainfrom
crud-projects
May 12, 2026
Merged

add create / update / view project config#42
czue merged 15 commits into
mainfrom
crud-projects

Conversation

@czue

@czue czue commented May 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

czue and others added 15 commits May 11, 2026 11:13
Four new subcommands under `pegasus projects`, all targeting the new
projects API:

- `projects show <id>` prints a project's full configuration.
- `projects fields` prints the editable field catalog (name, type,
  choices) — agents call this to discover the surface.
- `projects create` creates a new project.
- `projects update <id>` patches settings on an existing project.

Both `create` and `update` accept settings two ways:
- `--set key=value` (repeatable) for one-off fields. Values are
  type-coerced: true/false/yes/no/y/n → bool; null/none → None.
- `--config-file <path>` reads a YAML or JSON file. A
  `default_context:` wrapper (as in real pegasus-config.yaml) is
  unwrapped automatically, so a user can hand their local config file
  to the CLI without editing it.

Both sources may be combined; `--set` wins on conflict.

All four commands take `--json` for machine-readable output, intended
for AI agent consumers.

PyYAML is added as a direct dependency (previously transitive via
cookiecutter).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The schema endpoint now returns top-level user_tier and per-field
min_tier for license-gated features. Surface both in `pegasus projects
fields`: user_tier in the table title, a new Min Tier column populated
for gated features.

--json output is unchanged — agents see the new fields automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 400 handler looked for an "error" key and fell back to a generic
"Bad request." for DRF's field-keyed validation shape, hiding the
actual reason the request was rejected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Skill instructs an LLM agent how to drive the projects CLI: schema
fetch, tier gating, payload construction, error handling, common
workflows. Tracking in-repo for now while it's iterated on; expected
to move out before this lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Folds in the API-side dev's guidance: agents must always use --json
because the default Rich table can be truncated by terminal height and
look like fields are missing. Adds an explicit "~60+ fields" sanity
check so agents catch their own truncation goof.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two issues found while testing:
- The "2026.5.0" example in the skill is actually invalid — the server
  validates against released versions and rejects guessed strings.
- null/none/empty parse to None on the client but most string fields
  reject null server-side; only pegasus_version and license commonly
  accept it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The skill's permanent home is in the pegasus cookiecutter template at
.claude/skills/pegasus-projects/SKILL.md so it ships with every new
project.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without --upgrade or --dev, the push command always prompted
interactively for an upgrade choice, with no flag to select the
"don't upgrade" option non-interactively. Agents, CI, and any
non-TTY use had to pipe input or accept an unwanted upgrade.

--no-upgrade explicitly selects "push as-is, skip the prompt" and is
mutually exclusive with --upgrade/--dev.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The API now includes a help_url field in some 400 responses pointing
to where the user can fix the underlying issue (set up GitHub,
upgrade license, etc.). Expose it as both a structured attribute on
PegasusApiError and a "More info: <url>" line in the rendered
message, so existing CLI call sites pick it up via str(e) and any
future client can read the URL directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Configuring projects" section covering fields/show/create/
update, and documents --no-upgrade alongside the existing push flags.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The schema endpoint is now project-aware: with no project id it
returns a narrowed new-project view (omits fields whose only valid
value is the default, e.g. bundler/css_framework/database/
python_package_manager on modern releases); with ?project_id=<id> it
reflects that project's pinned release and current values so legacy
options remain configurable.

Thread an optional project_id through get_schema(), expose it as
--for <id> on the projects fields command, and surface the context
in the Rich table title.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous "try YAML then fall back to JSON" branch only fired for
files without a .yaml/.yml/.json suffix — a case we don't actually
support in practice, and the fallback only triggered when PyYAML was
missing anyway. Replace with an explicit error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
pyyaml is a hard dependency in pyproject.toml, so the try/except
around `import yaml` was dead code. Move the import to module scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
If a 400 body ever combines field errors with help_url, the URL would
be rendered twice: once as a fake field via _format_validation_errors,
and again via PegasusApiError's "More info:" suffix. Pop help_url out
of the dict before iterating so it only surfaces in its proper place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@czue czue merged commit 3d530d2 into main May 12, 2026
6 checks passed
@czue czue deleted the crud-projects branch May 12, 2026 15:05
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