Skip to content

feat(cli): add agent skills setup flow#100

Merged
AmanVarshney01 merged 2 commits into
mainfrom
aman/agent-skills-install
Jun 29, 2026
Merged

feat(cli): add agent skills setup flow#100
AmanVarshney01 merged 2 commits into
mainfrom
aman/agent-skills-install

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds agent install, agent update, and agent status to install/check Prisma skills from prisma/skills.
  • Uses the detected package manager for CLI tips and the Skills CLI runner: bunx, pnpm dlx, yarn dlx, or npx -y.
  • Runs the Skills CLI through Execa, always buffers its output, and shows only Prisma CLI-owned success/failure text.
  • Reads skills-lock.json structurally for status/prompt decisions.
  • Auth can show an agent setup tip, and interactive app deploy can prompt once to install only prisma-compute.
  • Prompts use Clack with the CLI runtime streams and abort signal; selecting No dismisses the deploy prompt, while canceling aborts the command.
  • Dry-run output is honest and shell-safe, e.g. --skill '*'.

Examples

pnpm dlx @prisma/cli@latest agent install
pnpm dlx @prisma/cli@latest agent install --skill prisma-compute
pnpm dlx @prisma/cli@latest agent status --json
pnpm dlx @prisma/cli@latest agent status --global

Without package-manager detection:

npx -y @prisma/cli@latest agent install

Deploy prompt output:

◇  Install the Prisma Compute skill for this project?
│  Yes
✔ Installed the Prisma Compute skill for this project.

Testing

  • pnpm --filter @prisma/cli exec vitest run tests/prompt.test.ts tests/app-controller.test.ts tests/agent.test.ts
  • pnpm --filter @prisma/cli test
  • pnpm --recursive exec tsc --noEmit
  • pnpm lint
  • Manual agent install --skill prisma-compute smoke from /Users/aman/dev/test/prisma-cli-agent-install-quiet
  • Manual deploy prompt smoke from /Users/aman/dev/test/prisma-cli-deploy-quiet

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR adds the agent command group with install, update, and status subcommands, plus shared types and command metadata. It introduces setup-state detection, managed AGENTS.md/CLAUDE.md updates, package-manager runner resolution, and local dismissed-prompt persistence. auth login can now suggest prisma-cli agent install, and app deploy can prompt to install agent guidance for linked projects. New tests cover the agent commands, auth hinting, and deploy prompting.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately captures the main change: adding an agent skills setup flow to the CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description matches the changeset by summarizing the new agent commands, package-manager runner support, prompts, and documentation updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aman/agent-skills-install
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch aman/agent-skills-install

Comment @coderabbitai help to get the list of available commands.

@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch from 8dd0cd5 to ec1d0ce Compare June 25, 2026 11:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/controllers/agent.ts`:
- Around line 186-198: The child process error handler in the install flow is
treating aborts as failures, so update the `child.on("error")` path to detect an
`AbortError` from `spawn` and re-throw or reject with that abort instead of
wrapping it in `skillsInstallFailed(...)`. Keep `child.on("close")` for real
exit codes, but let cancellations from the `context.runtime.signal` propagate
cleanly so the runtime handles them as user aborts rather than install errors.

In `@packages/cli/src/controllers/app.ts`:
- Around line 4246-4258: The optional agent-setup prompt in app.ts currently
aborts when confirmPrompt is canceled instead of treating cancel like a declined
install. Update the flow around confirmPrompt so Esc/Ctrl+C is handled the same
as a false response, using the existing shouldInstall branch to record
setAgentSetupPromptDismissedAt and continue without throwing, rather than
exiting before the install step.

In `@packages/cli/src/lib/agent/package-manager.ts`:
- Around line 135-150: The Windows handling in packageRunner currently routes
every binary through binary(), which incorrectly turns bunx into a .cmd shim.
Update packageRunner to special-case the "bun" branch so it uses bunx.exe on
win32 (or plain bunx when appropriate), while keeping binary() and the existing
.cmd behavior for pnpm, yarn, and npm shims.

In `@packages/cli/src/lib/agent/setup-status.ts`:
- Around line 25-41: The setup status logic in setup-status.ts is duplicating
the skills lock filename between the computed skillsLockPath used by
hasPrismaSkillsLock and the returned skillsLockPath field in the status object.
Update the setup-status flow around readPrismaAgentProjectFileStatus,
hasPrismaSkillsLock, and the returned object to derive both from the same
source, such as a shared constant or path.basename(skillsLockPath), so the value
stays consistent if the filename changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6a6d0fa7-6817-4cd3-a20b-faf56031ffa5

📥 Commits

Reviewing files that changed from the base of the PR and between 7833e62 and 8dd0cd5.

📒 Files selected for processing (19)
  • docs/product/command-spec.md
  • packages/cli/src/adapters/local-state.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/agent/index.ts
  • packages/cli/src/controllers/agent.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/controllers/auth.ts
  • packages/cli/src/lib/agent/constants.ts
  • packages/cli/src/lib/agent/package-manager.ts
  • packages/cli/src/lib/agent/project-files.ts
  • packages/cli/src/lib/agent/setup-status.ts
  • packages/cli/src/presenters/agent.ts
  • packages/cli/src/presenters/auth.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/src/types/agent.ts
  • packages/cli/src/types/auth.ts
  • packages/cli/tests/agent.test.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/auth.test.ts

Comment thread packages/cli/src/controllers/agent.ts Outdated
Comment thread packages/cli/src/controllers/app.ts
Comment thread packages/cli/src/lib/agent/package-manager.ts Outdated
Comment thread packages/cli/src/lib/agent/setup-status.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/controllers/agent.ts`:
- Around line 165-178: runChildProcess currently spawns the executable directly,
which fails on Windows when resolveSkillsPackageRunner() returns .cmd/.bat
runners like npx.cmd or pnpm.cmd. Update runChildProcess to detect win32 and
launch these runners through a Windows-compatible path (for example using shell
execution or cmd.exe /c) while preserving args, cwd, env, and signal handling;
use the runChildProcess and resolveSkillsPackageRunner symbols to locate the
fix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 10e171f8-8039-4f05-b73b-edebb47bf814

📥 Commits

Reviewing files that changed from the base of the PR and between 8dd0cd5 and ec1d0ce.

📒 Files selected for processing (19)
  • docs/product/command-spec.md
  • packages/cli/src/adapters/local-state.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/agent/index.ts
  • packages/cli/src/controllers/agent.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/controllers/auth.ts
  • packages/cli/src/lib/agent/constants.ts
  • packages/cli/src/lib/agent/package-manager.ts
  • packages/cli/src/lib/agent/project-files.ts
  • packages/cli/src/lib/agent/setup-status.ts
  • packages/cli/src/presenters/agent.ts
  • packages/cli/src/presenters/auth.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/src/types/agent.ts
  • packages/cli/src/types/auth.ts
  • packages/cli/tests/agent.test.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/auth.test.ts

Comment thread packages/cli/src/controllers/agent.ts
@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch from ec1d0ce to bd6a348 Compare June 25, 2026 11:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/cli/src/controllers/app.ts (1)

4248-4260: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel still aborts the deploy (previously flagged as addressed).

confirmPrompt throws usageError on Esc/Ctrl+C, and the try/catch here only wraps runAgentInstall (Line 4262+), not the confirmPrompt call. So canceling this optional prompt aborts the whole deploy before any deploy work begins. The earlier review marked this resolved in ec1d0ce, but the current code does not handle cancellation — please confirm whether the fix was reverted.

Treat cancel the same as a decline: record the dismissal and continue.

🛡️ Proposed handling
-  const shouldInstall = await confirmPrompt({
-    input: context.runtime.stdin,
-    output: context.runtime.stderr,
-    message: "Install Prisma agent guidance for this project?",
-    initialValue: true,
-  });
-
-  if (!shouldInstall) {
+  let shouldInstall: boolean;
+  try {
+    shouldInstall = await confirmPrompt({
+      input: context.runtime.stdin,
+      output: context.runtime.stderr,
+      message: "Install Prisma agent guidance for this project?",
+      initialValue: true,
+    });
+  } catch {
+    shouldInstall = false;
+  }
+
+  if (!shouldInstall) {
     await context.stateStore.setAgentSetupPromptDismissedAt(
       new Date().toISOString(),
     );
     return [];
   }
#!/bin/bash
# Confirm confirmPrompt still throws on cancel and isn't wrapped at the call site.
fd -t f 'prompt.ts' packages/cli/src/shell --exec sed -n '60,95p' {}
printf '\n--- call site ---\n'
rg -nP -C3 'await confirmPrompt' packages/cli/src/controllers/app.ts
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/controllers/app.ts` around lines 4248 - 4260, The optional
install prompt in app.ts is not handling cancel, so Esc/Ctrl+C from
confirmPrompt still aborts the deploy. Update the confirmPrompt call site around
shouldInstall to catch usageError cancellation and treat it the same as a false
response: setAgentSetupPromptDismissedAt, then continue by returning [] only for
a real decline and otherwise proceed without failing the deploy. Use the
existing runAgentInstall try/catch location as a reference, but move the cancel
handling to the prompt step itself.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/tests/app-controller.test.ts`:
- Around line 2872-3126: Add a deploy test for the cancel path of the agent
guidance prompt, since the current cases only cover accept and decline. In the
`runAppDeploy` flow in `app-controller.test.ts`, make `confirmPrompt` reject to
simulate cancellation and assert it is handled like a decline: `deployApp` still
runs, `runAgentInstall` is not called, and `readAgentSetupPromptDismissedAt` is
recorded. Use the existing interactive deploy test setup and the
`confirmPrompt`, `runAppDeploy`, and `context.stateStore` symbols to place the
new case alongside the current prompt behavior tests.

---

Duplicate comments:
In `@packages/cli/src/controllers/app.ts`:
- Around line 4248-4260: The optional install prompt in app.ts is not handling
cancel, so Esc/Ctrl+C from confirmPrompt still aborts the deploy. Update the
confirmPrompt call site around shouldInstall to catch usageError cancellation
and treat it the same as a false response: setAgentSetupPromptDismissedAt, then
continue by returning [] only for a real decline and otherwise proceed without
failing the deploy. Use the existing runAgentInstall try/catch location as a
reference, but move the cancel handling to the prompt step itself.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d828c377-27dd-4fe7-9674-9565d8830d77

📥 Commits

Reviewing files that changed from the base of the PR and between ec1d0ce and bd6a348.

📒 Files selected for processing (19)
  • docs/product/command-spec.md
  • packages/cli/src/adapters/local-state.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/agent/index.ts
  • packages/cli/src/controllers/agent.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/controllers/auth.ts
  • packages/cli/src/lib/agent/constants.ts
  • packages/cli/src/lib/agent/package-manager.ts
  • packages/cli/src/lib/agent/project-files.ts
  • packages/cli/src/lib/agent/setup-status.ts
  • packages/cli/src/presenters/agent.ts
  • packages/cli/src/presenters/auth.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/src/types/agent.ts
  • packages/cli/src/types/auth.ts
  • packages/cli/tests/agent.test.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/auth.test.ts

Comment thread packages/cli/tests/app-controller.test.ts Outdated
@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch 2 times, most recently from c181b4c to 1eb31e9 Compare June 25, 2026 12:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/lib/agent/package-manager.ts`:
- Around line 147-164: packageRunnerForPackageManager currently mixes the spawn
runner with the display formatter by always applying binary(), which makes
help/examples emit .cmd on Windows. Split the logic used by
resolvePackageRunner* so resolveSkillsPackageRunner keeps the platform-specific
spawn binary behavior for agent.ts, while
resolvePrismaCliPackageCommandFormatter* returns plain package commands; update
the packageRunnerForPackageManager helper and any related formatter functions to
use the correct output for each path.

In `@packages/cli/tests/agent.test.ts`:
- Around line 54-62: The agent help and managed-file command strings are being
formatted with the Windows .cmd suffix from resolvePackageRunner(), which leaks
npx.cmd/pnpm.cmd into displayed output. Update the display-path in
formatPrismaCliCommand() and the agent command generation used by agent
help/status/install/update so .cmd is stripped for user-facing text, while
keeping the executable name with .cmd only for spawning.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7894b920-baa6-41f8-a079-ae5770d48413

📥 Commits

Reviewing files that changed from the base of the PR and between c181b4c and 1eb31e9.

📒 Files selected for processing (22)
  • docs/product/command-spec.md
  • packages/cli/src/adapters/local-state.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/agent/index.ts
  • packages/cli/src/controllers/agent.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/controllers/auth.ts
  • packages/cli/src/lib/agent/cli-command.ts
  • packages/cli/src/lib/agent/constants.ts
  • packages/cli/src/lib/agent/package-manager.ts
  • packages/cli/src/lib/agent/project-files.ts
  • packages/cli/src/lib/agent/setup-status.ts
  • packages/cli/src/presenters/agent.ts
  • packages/cli/src/presenters/auth.ts
  • packages/cli/src/shell/cli-command.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/src/shell/help.ts
  • packages/cli/src/types/agent.ts
  • packages/cli/src/types/auth.ts
  • packages/cli/tests/agent.test.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/auth.test.ts

Comment thread packages/cli/src/lib/agent/package-manager.ts Outdated
Comment thread packages/cli/tests/agent.test.ts
@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch from 1eb31e9 to 416804c Compare June 25, 2026 12:17
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 25, 2026
@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch 16 times, most recently from cea395c to 452762b Compare June 26, 2026 12:15
luanvdw
luanvdw previously approved these changes Jun 26, 2026

@luanvdw luanvdw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this!

Could we make these minor docs changes?

  • agent is now listed in command-spec.md as part of the beta command surface, but command-principles.md still says the preview only includes auth, project, git, branch, database, and app.
  • The implementation adds a new structured error code, AGENT_SKILLS_INSTALL_FAILED, but error-conventions.md doesn’t list or define it yet.

Both are small, but since these docs are the contract for future CLI work and agent-facing behavior, I’d update them in this PR so we don’t leave the model slightly split.

@AmanVarshney01
AmanVarshney01 force-pushed the aman/agent-skills-install branch from 076e420 to bfd2d37 Compare June 26, 2026 14:01

@luanvdw luanvdw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@AmanVarshney01
AmanVarshney01 merged commit e9666a6 into main Jun 29, 2026
10 checks passed
@AmanVarshney01
AmanVarshney01 deleted the aman/agent-skills-install branch June 29, 2026 07:55
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