Skip to content

feat(prisma-compute): teach agents the CLI feedback command#21

Merged
AmanVarshney01 merged 4 commits into
mainfrom
feat/compute-skill-feedback-command
Jul 14, 2026
Merged

feat(prisma-compute): teach agents the CLI feedback command#21
AmanVarshney01 merged 4 commits into
mainfrom
feat/compute-skill-feedback-command

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

@prisma/cli now ships a feedback command (prisma/prisma-cli#119) and its crash output points at it. This PR teaches the skills that, and also carries a full staleness audit of the compute/platform skills against the current sources: prisma/prisma-cli (command spec + source), the installed @prisma/compute-sdk 0.34.0, prisma/project-compute, and prisma/pdp-control-plane.

Feedback command (prisma-compute, v1.3.1 -> v1.4.0)

  • New quick rule deploy-report-cli-bugs and troubleshooting section "Report Unresolved CLI Issues": on UNEXPECTED_ERROR or unresolvable failures, send bunx @prisma/cli@latest feedback "<command>: <error summary>", preferring the pre-filled command from the crash envelope's nextActions verbatim. Privacy contract spelled out (anonymous; only CLI/node/OS versions; never secrets).

init coverage (prisma-compute)

  • The skill predated init; added config-init-formalizer and a compute-config section covering detection, --format json, the JSON-to-TS conversion, and init's refusals.

Staleness audit fixes (prisma-compute)

  • Wrong claim removed: "the CLI rejects build blocks for nuxt/astro/nestjs" was never true for these SDK versions; all build types are config-backed. Reworded in seven places to "optional; overrides framework-strategy defaults".
  • Promotion semantics: --no-promote build-then-verify path added; noted the first production deploy auto-promotes without --prod; the agent deploy template no longer assumes --prod --yes.
  • Command surface: project rename/transfer/remove, database usage, database backup list, database restore, database connection rotate added, with the exact --confirm <id> requirement. (build list/show deliberately NOT added: specced but not yet registered in the CLI.)
  • Config contract: prisma.compute.json added to the accepted filename list, bun.lockb to discovery boundaries, top-level region default documented.
  • Detection/ports: NestJS detection includes nest-cli.json; deploy port default is framework-specific (Astro 4321).
  • SDK reference: deploy-result field list completed (projectId, region, previousDeploymentId, previousDeploymentAction); env-var scoping corrected to follow the attached branch's role (preview -> branch-scoped, production -> project-scoped).
  • Branch wording narrowed to branch list (no create/remove commands exist).

prisma-postgres (v7.6.0 -> v7.7.0)

  • @prisma/cli database group added as the persistent-database path (distinct from create-db throwaways).
  • Resource model documented as Workspace -> Project -> Branch -> Database with the branch endpoints.
  • endpoints.direct/endpoints.pooled documented; flat connectionString noted as deprecated; one-time-view secret behavior noted.
  • Audit false positive rejected, for reviewer awareness: prisma postgres link is an ORM CLI command (prisma@latest), verified working, and stays.

Sequencing

The feedback guidance references a command that lands with prisma/prisma-cli#119; merge this after that PR ships in an @prisma/cli release. Everything else has no release dependency.

AmanVarshney01 added a commit to prisma/prisma-cli that referenced this pull request Jul 14, 2026
## What this adds

`prisma-cli feedback` sends a message to the Prisma CLI team. It is a
top-level command like `version`: it needs no auth, no workspace, no
project, no config, and it never prompts, so it works identically for
humans, CI, and agents.

```
$ prisma-cli feedback "loving the new deploy flow"
feedback → Feedback sent. Thank you!

│  id:        019f5f8b-a108-7000-8457-78598b856156
│  sent as:   anonymous
│  included:  CLI 3.0.0-development, node v24.18.0, darwin arm64
```

## Anonymous by default

Without `--email`, nothing identifying leaves the machine. This is the
entire wire payload:

```json
{
  "message": "loving the new deploy flow",
  "meta": {
    "cliVersion": "3.0.0-development",
    "nodeVersion": "v24.18.0",
    "platform": "darwin",
    "arch": "arm64"
  }
}
```

The command help discloses exactly that list ("Anonymous unless --email
is passed. Every submission includes the CLI version, node version, and
OS platform/arch, and nothing else."). The service uses the client IP
transiently, in memory, to rate limit; it is never stored, and the spec
says so.

`--email` is the only way to become contactable, validated before
anything is sent (shape and the service's 320-char limit):

```
$ prisma-cli feedback "please add X" --email dev@example.com   # payload gains "email"
$ prisma-cli feedback "please add X" --email not-an-email
✘ Invalid email [USAGE_ERROR]
Fix: Pass a valid address with --email, or drop the flag to stay anonymous.
```

## Agent output

`--json` returns the standard envelope; `id` is the service's stored
submission id (null when the response has none), `email` is null when
anonymous:

```json
{
  "ok": true,
  "command": "feedback",
  "result": {
    "id": "fb_...",
    "email": null,
    "context": { "cliVersion": "...", "nodeVersion": "...", "platform": "...", "arch": "..." }
  }
}
```

## Failure behavior

Validation happens before any network call and exits 2 as `USAGE_ERROR`:
empty or whitespace-only message, message over 4000 characters, email
invalid or over 320 characters. Nothing is sent in those cases.

Delivery problems exit 1 as `FEEDBACK_SEND_FAILED` and surface the
service's own detail:

```
$ prisma-cli feedback "hello"        # service returned 500
✘ Feedback could not be delivered [FEEDBACK_SEND_FAILED]
Why: The feedback service responded with HTTP 500 (db down).
Fix: Check your network and rerun the command.
```

Requests time out after 3 seconds, and the timeout covers the body read
too: a 201 whose body stalls is a delivery failure, not a fake success,
and user cancellation propagates instead of exiting 0. Only a fully
received non-JSON 2xx body maps to a null id. `PRISMA_CLI_FEEDBACK_URL`
overrides the endpoint for tests and staging.

## Crashes point here (and stop breaking --json)

Unexpected crashes previously wrote plain text even under `--json`. The
outermost boundary now emits the standard envelope with code
`UNEXPECTED_ERROR`, and both output modes advertise the feedback command
pre-filled with the failing command and error line:

```
$ prisma-cli project list            # CLI bug/crash
Unexpected CLI error: ENOENT: no such file or directory, open '...'
More: Re-run with --trace for deeper diagnostics
Tell us what happened: prisma-cli feedback 'project list crashed: ENOENT: ...'
```

```json
{
  "ok": false,
  "command": "project.list",
  "error": { "code": "UNEXPECTED_ERROR", "domain": "cli", "why": "ENOENT: ..." },
  "nextSteps": ["prisma-cli feedback 'project list crashed: ENOENT: ...'"],
  "nextActions": [
    {
      "kind": "run-command",
      "journey": "recover",
      "label": "Report this crash to the Prisma team",
      "command": "prisma-cli feedback 'project list crashed: ENOENT: ...'"
    }
  ]
}
```

`--quiet` suppresses the human hint. Usage errors and expected failures
never advertise feedback, so the pointer stays a signal rather than
wallpaper. The pre-filled command is shell-escaped and runnable
verbatim; a companion PR (prisma/skills#21) teaches the prisma-compute
skill to run it.

## Where feedback goes

A small Bun server on Prisma Compute in the Prisma DevRel workspace,
storing to Prisma Postgres (repo: `~/dev/work/prisma-cli-feedback`, app
`cli-feedback`), with the same limits enforced server-side plus per-IP
rate limiting and a token-gated admin read endpoint.

## Docs (spec-first)

- `command-spec.md`: `feedback` section, top-level command lists (Scope
and Global Rules), privacy wording including IP handling, crash-pointer
bullet.
- `error-conventions.md`: `FEEDBACK_SEND_FAILED` and `UNEXPECTED_ERROR`
registered with recommended meanings; crash-boundary rule updated.
- `output-conventions.md`: `feedback` added to the pattern mapping.

## Testing

- `tests/feedback.test.ts`: 10 tests against a real local HTTP server:
anonymous payload shape, email inclusion, empty/oversized message,
invalid and over-long email (nothing sent in each case), service 5xx,
unreachable service, stalled 2xx body (fails at 3s), null id.
- `tests/shell.test.ts`: crash-boundary tests for the feedback hint,
command labeling, pre-filled report escaping, and the `UNEXPECTED_ERROR`
JSON envelope with its `recover` action.
- Manual verification sweeps through the built CLI: 25+ usage cases
against a mock service (boundaries, flag parsing edges, failure modes,
unicode, wire-payload inspection), a forced real crash in all three
output modes, and live sends verified end to end against the production
service and database. Full suite: 643 tests pass.
Audited against prisma/prisma-cli (command spec + source), the installed
@prisma/compute-sdk 0.34.0, prisma/project-compute, and
prisma/pdp-control-plane.

prisma-compute:
- build blocks are accepted for every framework (all build types are
  config-backed); the 'CLI rejects build blocks for nuxt/astro/nestjs'
  claim was never true for these SDKs; reworded in seven places
- deploy-time database setup via --db/--no-db (--db --yes in CI)
  replaces the stale 'do not add database setup to deploy examples'
- --no-promote build-then-verify path; first production deploy
  auto-promotes without --prod
- project rename/transfer/remove, database usage/backup list/restore,
  connection rotate added to the command surface
- agent deploy template no longer assumes --prod
- prisma.compute.json in the accepted filename list; bun.lockb in the
  discovery boundaries; top-level region default documented
- NestJS detection includes nest-cli.json; deploy port default is
  framework-specific (Astro 4321)
- branch wording narrowed to branch list (no create/remove commands)
- SDK deploy-result fields completed; env-var scope follows branch role

prisma-postgres (7.6.0 -> 7.7.0):
- @prisma/cli database group added for persistent databases
- Workspace->Project->Branch->Database model and branch endpoints
- endpoints.direct/endpoints.pooled documented; flat connectionString
  deprecated; one-time-view secret behavior noted
@AmanVarshney01
AmanVarshney01 merged commit cf24f0b into main Jul 14, 2026
4 checks passed
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.

2 participants