Fix/create dashboard skill#101
Conversation
📝 WalkthroughWalkthroughVersion incremented to 1.0.1 in both the skill metadata and tile manifest. Auto-generated command invocations now suppress stderr and emit explicit error messages with remediation suggestions when unable to connect to the Kopai backend. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/create-dashboard/SKILL.md`:
- Around line 14-18: Remove the stderr suppression and the plain-text fallback
that breaks JSON parsing: in the `npx `@kopai/cli` dashboards schema` and `npx
`@kopai/cli` metrics discover --json` invocations, delete `2>/dev/null` and stop
echoing an error string to stdout; instead let the CLI emit its diagnostics to
stderr and on failure either exit non‑zero or emit a valid JSON error object
(e.g. {"error": "..."} ) to stdout so downstream JSON parsing of `--json`
remains valid. Ensure the changes touch the two command lines shown (`npx
`@kopai/cli` dashboards schema` and `npx `@kopai/cli` metrics discover --json`) so
errors are visible on stderr and no plain-text fallback is printed to stdout.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 821e9bf6-edfa-41d5-b4be-6aaa2df01059
📒 Files selected for processing (2)
skills/create-dashboard/SKILL.mdskills/create-dashboard/tile.json
| !`npx @kopai/cli dashboards schema 2>/dev/null || echo "ERROR: Cannot connect to Kopai backend. If running locally, start it with: npx @kopai/app start — If using a remote backend, check the url in your .kopairc file."` | ||
|
|
||
| ## Available Metrics | ||
|
|
||
| !`npx @kopai/cli metrics discover --json` | ||
| !`npx @kopai/cli metrics discover --json 2>/dev/null || echo "ERROR: Cannot connect to Kopai backend. If running locally, start it with: npx @kopai/app start — If using a remote backend, check the url in your .kopairc file."` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify CLI command naming convention and usage patterns across repo docs/skills.
rg -n -C2 'npx (`@kopai/cli`|kopai/cli)\b'
rg -n -C2 'pnpm add (`@kopai/cli`|kopai/cli)\b'
rg -n -C2 'metrics discover --json.*2>/dev/null|dashboards schema.*2>/dev/null'Repository: kopai-app/kopai-mono
Length of output: 24950
Avoid suppressing CLI stderr and emitting non-JSON fallback on JSON path.
On Line 14 and Line 18, 2>/dev/null discards CLI diagnostics, and Line 18 emits plain-text fallback to stdout where JSON is expected (--json), breaking downstream parsing.
Proposed fix
-!`npx `@kopai/cli` dashboards schema 2>/dev/null || echo "ERROR: Cannot connect to Kopai backend. If running locally, start it with: npx `@kopai/app` start — If using a remote backend, check the url in your .kopairc file."`
+!`npx `@kopai/cli` dashboards schema || { echo "ERROR: Cannot connect to Kopai backend. If running locally, start it with: npx `@kopai/app` start. If using a remote backend, check the url in your .kopairc file." >&2; exit 1; }`
-!`npx `@kopai/cli` metrics discover --json 2>/dev/null || echo "ERROR: Cannot connect to Kopai backend. If running locally, start it with: npx `@kopai/app` start — If using a remote backend, check the url in your .kopairc file."`
+!`npx `@kopai/cli` metrics discover --json || echo '{"error":{"message":"Cannot connect to Kopai backend","remediation":["If running locally, start it with: npx `@kopai/app` start","If using a remote backend, check the url in your .kopairc file."]}}'`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/create-dashboard/SKILL.md` around lines 14 - 18, Remove the stderr
suppression and the plain-text fallback that breaks JSON parsing: in the `npx
`@kopai/cli` dashboards schema` and `npx `@kopai/cli` metrics discover --json`
invocations, delete `2>/dev/null` and stop echoing an error string to stdout;
instead let the CLI emit its diagnostics to stderr and on failure either exit
non‑zero or emit a valid JSON error object (e.g. {"error": "..."} ) to stdout so
downstream JSON parsing of `--json` remains valid. Ensure the changes touch the
two command lines shown (`npx `@kopai/cli` dashboards schema` and `npx `@kopai/cli`
metrics discover --json`) so errors are visible on stderr and no plain-text
fallback is printed to stdout.
Summary by CodeRabbit