@mohammadhprp/system-prompt 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/bin/system-prompt.js +8 -0
- package/framework/README.md +163 -0
- package/framework/agents/README.md +49 -0
- package/framework/agents/backend-architect.md +146 -0
- package/framework/agents/researcher.md +79 -0
- package/framework/agents/reviewer.md +183 -0
- package/framework/agents/security-auditor.md +131 -0
- package/framework/commands/README.md +43 -0
- package/framework/commands/changelog.md +44 -0
- package/framework/commands/commit.md +31 -0
- package/framework/commands/learn.md +24 -0
- package/framework/commands/mr.md +46 -0
- package/framework/commands/pr.md +39 -0
- package/framework/commands/release.md +34 -0
- package/framework/commands/review.md +24 -0
- package/framework/commands/summarize-changes.md +49 -0
- package/framework/mcps/README.md +78 -0
- package/framework/mcps/excalidraw/README.md +37 -0
- package/framework/mcps/excalidraw/capabilities.md +54 -0
- package/framework/mcps/excalidraw/configs/opencode.json +8 -0
- package/framework/mcps/excalidraw/install.md +92 -0
- package/framework/mcps/excalidraw/troubleshooting.md +67 -0
- package/framework/mcps/figma-mcp-go/README.md +51 -0
- package/framework/mcps/figma-mcp-go/capabilities.md +190 -0
- package/framework/mcps/figma-mcp-go/configs/opencode.json +9 -0
- package/framework/mcps/figma-mcp-go/install.md +74 -0
- package/framework/mcps/figma-mcp-go/troubleshooting.md +99 -0
- package/framework/mcps/github-mcp/README.md +51 -0
- package/framework/mcps/github-mcp/capabilities.md +83 -0
- package/framework/mcps/github-mcp/configs/.env.example +1 -0
- package/framework/mcps/github-mcp/configs/opencode.json +13 -0
- package/framework/mcps/github-mcp/install.md +60 -0
- package/framework/mcps/github-mcp/troubleshooting.md +79 -0
- package/framework/mcps/gitlab-mcp/README.md +54 -0
- package/framework/mcps/gitlab-mcp/capabilities.md +216 -0
- package/framework/mcps/gitlab-mcp/configs/.env.example +2 -0
- package/framework/mcps/gitlab-mcp/configs/opencode.json +13 -0
- package/framework/mcps/gitlab-mcp/install.md +99 -0
- package/framework/mcps/gitlab-mcp/troubleshooting.md +116 -0
- package/framework/mcps/jira-mcp/README.md +53 -0
- package/framework/mcps/jira-mcp/capabilities.md +79 -0
- package/framework/mcps/jira-mcp/configs/.env.example +2 -0
- package/framework/mcps/jira-mcp/configs/opencode.json +13 -0
- package/framework/mcps/jira-mcp/install.md +94 -0
- package/framework/mcps/jira-mcp/troubleshooting.md +113 -0
- package/framework/mcps/laravel-boost/README.md +53 -0
- package/framework/mcps/laravel-boost/capabilities.md +92 -0
- package/framework/mcps/laravel-boost/configs/opencode.json +9 -0
- package/framework/mcps/laravel-boost/install.md +106 -0
- package/framework/mcps/laravel-boost/troubleshooting.md +119 -0
- package/framework/mcps/notion-mcp/README.md +58 -0
- package/framework/mcps/notion-mcp/capabilities.md +118 -0
- package/framework/mcps/notion-mcp/configs/opencode.json +9 -0
- package/framework/mcps/notion-mcp/install.md +70 -0
- package/framework/mcps/notion-mcp/troubleshooting.md +95 -0
- package/framework/mcps/playwright-mcp/README.md +50 -0
- package/framework/mcps/playwright-mcp/capabilities.md +149 -0
- package/framework/mcps/playwright-mcp/configs/opencode.json +9 -0
- package/framework/mcps/playwright-mcp/install.md +136 -0
- package/framework/mcps/playwright-mcp/troubleshooting.md +154 -0
- package/framework/mcps/supabase-mcp/README.md +66 -0
- package/framework/mcps/supabase-mcp/capabilities.md +127 -0
- package/framework/mcps/supabase-mcp/configs/opencode.json +9 -0
- package/framework/mcps/supabase-mcp/install.md +85 -0
- package/framework/mcps/supabase-mcp/troubleshooting.md +113 -0
- package/framework/memory/README.md +17 -0
- package/framework/memory/codebase-insights.md +6 -0
- package/framework/memory/user-preferences.md +5 -0
- package/framework/modes/README.md +52 -0
- package/framework/modes/audit.md +88 -0
- package/framework/plugins/README.md +65 -0
- package/framework/plugins/opencode-goal-plugin/README.md +45 -0
- package/framework/plugins/opencode-goal-plugin/capabilities.md +127 -0
- package/framework/plugins/opencode-goal-plugin/install.md +71 -0
- package/framework/plugins/opencode-goal-plugin/troubleshooting.md +112 -0
- package/framework/plugins/ponytail/README.md +44 -0
- package/framework/plugins/ponytail/capabilities.md +112 -0
- package/framework/plugins/ponytail/install.md +77 -0
- package/framework/plugins/ponytail/troubleshooting.md +116 -0
- package/framework/references/standards/api.md +44 -0
- package/framework/references/standards/architecture.md +43 -0
- package/framework/references/standards/database.md +43 -0
- package/framework/references/standards/debugging.md +44 -0
- package/framework/references/standards/documentation.md +43 -0
- package/framework/references/standards/logging.md +43 -0
- package/framework/references/standards/naming.md +43 -0
- package/framework/references/standards/observability.md +43 -0
- package/framework/references/standards/performance.md +43 -0
- package/framework/references/standards/pull-requests.md +43 -0
- package/framework/references/standards/security.md +43 -0
- package/framework/references/standards/testing.md +43 -0
- package/framework/references/templates/adr.md +28 -0
- package/framework/references/templates/api-spec.md +56 -0
- package/framework/references/templates/design-document.md +39 -0
- package/framework/references/templates/incident-report.md +38 -0
- package/framework/references/templates/postmortem.md +41 -0
- package/framework/references/templates/pull-request.md +34 -0
- package/framework/references/templates/runbook.md +48 -0
- package/framework/references/templates/task.md +27 -0
- package/framework/skills/README.md +68 -0
- package/framework/skills/agent-browser/SKILL.md +51 -0
- package/framework/skills/backend-best-practices/SKILL.md +136 -0
- package/framework/skills/backend-best-practices/examples.md +31 -0
- package/framework/skills/backend-best-practices/references/api-design.md +79 -0
- package/framework/skills/backend-best-practices/references/architecture-review.md +77 -0
- package/framework/skills/backend-best-practices/references/database-design.md +78 -0
- package/framework/skills/backend-best-practices/references/debugging.md +76 -0
- package/framework/skills/backend-best-practices/references/observability.md +78 -0
- package/framework/skills/backend-best-practices/references/performance.md +78 -0
- package/framework/skills/backend-best-practices/references/refactoring.md +77 -0
- package/framework/skills/backend-best-practices/references/security.md +80 -0
- package/framework/skills/backend-best-practices/references/testing.md +77 -0
- package/framework/skills/backend-engineer/SKILL.md +76 -0
- package/framework/skills/backend-engineer/examples.md +31 -0
- package/framework/skills/brainstorming/SKILL.md +159 -0
- package/framework/skills/brainstorming/examples.md +49 -0
- package/framework/skills/brainstorming/scripts/frame-template.html +213 -0
- package/framework/skills/brainstorming/scripts/helper.js +167 -0
- package/framework/skills/brainstorming/scripts/server.cjs +723 -0
- package/framework/skills/brainstorming/scripts/start-server.sh +209 -0
- package/framework/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/framework/skills/brainstorming/visual-companion.md +291 -0
- package/framework/skills/brand-guidelines/LICENSE.txt +202 -0
- package/framework/skills/brand-guidelines/SKILL.md +73 -0
- package/framework/skills/code-review/SKILL.md +72 -0
- package/framework/skills/code-review/examples.md +31 -0
- package/framework/skills/design/SKILL.md +399 -0
- package/framework/skills/design/examples.md +34 -0
- package/framework/skills/diagram-design/SKILL.md +485 -0
- package/framework/skills/diagram-design/assets/example-architecture-dark.html +180 -0
- package/framework/skills/diagram-design/assets/example-architecture-full.html +192 -0
- package/framework/skills/diagram-design/assets/example-architecture.html +181 -0
- package/framework/skills/diagram-design/assets/example-bar-dark.html +127 -0
- package/framework/skills/diagram-design/assets/example-bar-full.html +103 -0
- package/framework/skills/diagram-design/assets/example-bar.html +127 -0
- package/framework/skills/diagram-design/assets/example-data-flow-dark.html +143 -0
- package/framework/skills/diagram-design/assets/example-data-flow-full.html +185 -0
- package/framework/skills/diagram-design/assets/example-data-flow.html +143 -0
- package/framework/skills/diagram-design/assets/example-datalake-dark.html +241 -0
- package/framework/skills/diagram-design/assets/example-datalake-full.html +246 -0
- package/framework/skills/diagram-design/assets/example-datalake.html +267 -0
- package/framework/skills/diagram-design/assets/example-dp-integration-dark.html +78 -0
- package/framework/skills/diagram-design/assets/example-dp-integration-full.html +88 -0
- package/framework/skills/diagram-design/assets/example-dp-integration.html +78 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix-dark.html +31 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix-full.html +32 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix.html +88 -0
- package/framework/skills/diagram-design/assets/example-er-dark.html +200 -0
- package/framework/skills/diagram-design/assets/example-er-full.html +203 -0
- package/framework/skills/diagram-design/assets/example-er.html +200 -0
- package/framework/skills/diagram-design/assets/example-flowchart-dark.html +154 -0
- package/framework/skills/diagram-design/assets/example-flowchart-full.html +157 -0
- package/framework/skills/diagram-design/assets/example-flowchart.html +154 -0
- package/framework/skills/diagram-design/assets/example-gantt-dark.html +135 -0
- package/framework/skills/diagram-design/assets/example-gantt-full.html +125 -0
- package/framework/skills/diagram-design/assets/example-gantt.html +135 -0
- package/framework/skills/diagram-design/assets/example-high-level-dark.html +249 -0
- package/framework/skills/diagram-design/assets/example-high-level-full.html +245 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical-dark.html +272 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical-full.html +250 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical.html +323 -0
- package/framework/skills/diagram-design/assets/example-high-level.html +299 -0
- package/framework/skills/diagram-design/assets/example-it-state-dark.html +90 -0
- package/framework/skills/diagram-design/assets/example-it-state-full.html +69 -0
- package/framework/skills/diagram-design/assets/example-it-state.html +128 -0
- package/framework/skills/diagram-design/assets/example-layers-dark.html +121 -0
- package/framework/skills/diagram-design/assets/example-layers-full.html +124 -0
- package/framework/skills/diagram-design/assets/example-layers.html +121 -0
- package/framework/skills/diagram-design/assets/example-line-dark.html +109 -0
- package/framework/skills/diagram-design/assets/example-line-full.html +103 -0
- package/framework/skills/diagram-design/assets/example-line.html +109 -0
- package/framework/skills/diagram-design/assets/example-loop-dark.html +100 -0
- package/framework/skills/diagram-design/assets/example-loop-full.html +137 -0
- package/framework/skills/diagram-design/assets/example-loop-terminal.html +347 -0
- package/framework/skills/diagram-design/assets/example-loop.html +100 -0
- package/framework/skills/diagram-design/assets/example-medallion-dark.html +159 -0
- package/framework/skills/diagram-design/assets/example-medallion-full.html +201 -0
- package/framework/skills/diagram-design/assets/example-medallion.html +159 -0
- package/framework/skills/diagram-design/assets/example-nested-dark.html +130 -0
- package/framework/skills/diagram-design/assets/example-nested-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-nested.html +134 -0
- package/framework/skills/diagram-design/assets/example-org-chart-dark.html +45 -0
- package/framework/skills/diagram-design/assets/example-org-chart-full.html +45 -0
- package/framework/skills/diagram-design/assets/example-org-chart.html +45 -0
- package/framework/skills/diagram-design/assets/example-process-dark.html +62 -0
- package/framework/skills/diagram-design/assets/example-process-full.html +72 -0
- package/framework/skills/diagram-design/assets/example-process.html +62 -0
- package/framework/skills/diagram-design/assets/example-pyramid-dark.html +117 -0
- package/framework/skills/diagram-design/assets/example-pyramid-full.html +120 -0
- package/framework/skills/diagram-design/assets/example-pyramid.html +117 -0
- package/framework/skills/diagram-design/assets/example-quadrant-consultant.html +164 -0
- package/framework/skills/diagram-design/assets/example-quadrant-dark.html +133 -0
- package/framework/skills/diagram-design/assets/example-quadrant-full.html +136 -0
- package/framework/skills/diagram-design/assets/example-quadrant.html +133 -0
- package/framework/skills/diagram-design/assets/example-radar-dark.html +137 -0
- package/framework/skills/diagram-design/assets/example-radar-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-radar.html +137 -0
- package/framework/skills/diagram-design/assets/example-scatter-dark.html +139 -0
- package/framework/skills/diagram-design/assets/example-scatter-full.html +114 -0
- package/framework/skills/diagram-design/assets/example-scatter.html +139 -0
- package/framework/skills/diagram-design/assets/example-sequence-dark.html +220 -0
- package/framework/skills/diagram-design/assets/example-sequence-full.html +386 -0
- package/framework/skills/diagram-design/assets/example-sequence.html +220 -0
- package/framework/skills/diagram-design/assets/example-state-dark.html +145 -0
- package/framework/skills/diagram-design/assets/example-state-full.html +148 -0
- package/framework/skills/diagram-design/assets/example-state.html +145 -0
- package/framework/skills/diagram-design/assets/example-swimlane-dark.html +170 -0
- package/framework/skills/diagram-design/assets/example-swimlane-full.html +173 -0
- package/framework/skills/diagram-design/assets/example-swimlane.html +170 -0
- package/framework/skills/diagram-design/assets/example-timeline-dark.html +133 -0
- package/framework/skills/diagram-design/assets/example-timeline-full.html +136 -0
- package/framework/skills/diagram-design/assets/example-timeline.html +133 -0
- package/framework/skills/diagram-design/assets/example-tree-dark.html +171 -0
- package/framework/skills/diagram-design/assets/example-tree-full.html +174 -0
- package/framework/skills/diagram-design/assets/example-tree.html +171 -0
- package/framework/skills/diagram-design/assets/example-venn-dark.html +130 -0
- package/framework/skills/diagram-design/assets/example-venn-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-venn.html +108 -0
- package/framework/skills/diagram-design/assets/icons.html +230 -0
- package/framework/skills/diagram-design/assets/index.html +333 -0
- package/framework/skills/diagram-design/assets/template-dark.html +82 -0
- package/framework/skills/diagram-design/assets/template-full.html +410 -0
- package/framework/skills/diagram-design/assets/template-terminal.html +170 -0
- package/framework/skills/diagram-design/assets/template.html +83 -0
- package/framework/skills/diagram-design/references/export.md +107 -0
- package/framework/skills/diagram-design/references/onboarding.md +268 -0
- package/framework/skills/diagram-design/references/primitive-annotation.md +36 -0
- package/framework/skills/diagram-design/references/primitive-icons.md +821 -0
- package/framework/skills/diagram-design/references/primitive-sketchy.md +43 -0
- package/framework/skills/diagram-design/references/primitive-terminal.md +76 -0
- package/framework/skills/diagram-design/references/style-guide.md +139 -0
- package/framework/skills/diagram-design/references/type-architecture.md +78 -0
- package/framework/skills/diagram-design/references/type-bar.md +48 -0
- package/framework/skills/diagram-design/references/type-data-flow.md +374 -0
- package/framework/skills/diagram-design/references/type-dp-integration.md +410 -0
- package/framework/skills/diagram-design/references/type-dp-security-matrix.md +379 -0
- package/framework/skills/diagram-design/references/type-er.md +23 -0
- package/framework/skills/diagram-design/references/type-flowchart.md +23 -0
- package/framework/skills/diagram-design/references/type-gantt.md +45 -0
- package/framework/skills/diagram-design/references/type-high-level.md +458 -0
- package/framework/skills/diagram-design/references/type-it-state.md +470 -0
- package/framework/skills/diagram-design/references/type-layers.md +26 -0
- package/framework/skills/diagram-design/references/type-line.md +44 -0
- package/framework/skills/diagram-design/references/type-loop.md +223 -0
- package/framework/skills/diagram-design/references/type-medallion.md +356 -0
- package/framework/skills/diagram-design/references/type-nested.md +22 -0
- package/framework/skills/diagram-design/references/type-org-chart.md +44 -0
- package/framework/skills/diagram-design/references/type-process.md +495 -0
- package/framework/skills/diagram-design/references/type-pyramid.md +33 -0
- package/framework/skills/diagram-design/references/type-quadrant.md +81 -0
- package/framework/skills/diagram-design/references/type-radar.md +80 -0
- package/framework/skills/diagram-design/references/type-scatter.md +39 -0
- package/framework/skills/diagram-design/references/type-sequence.md +35 -0
- package/framework/skills/diagram-design/references/type-state.md +21 -0
- package/framework/skills/diagram-design/references/type-swimlane.md +20 -0
- package/framework/skills/diagram-design/references/type-timeline.md +20 -0
- package/framework/skills/diagram-design/references/type-tree.md +24 -0
- package/framework/skills/diagram-design/references/type-venn.md +26 -0
- package/framework/skills/documentation/SKILL.md +74 -0
- package/framework/skills/documentation/examples.md +31 -0
- package/framework/skills/find-skills/SKILL.md +141 -0
- package/framework/skills/find-skills/examples.md +35 -0
- package/framework/skills/gitlab-mcp/SKILL.md +83 -0
- package/framework/skills/gitlab-mcp/examples.md +31 -0
- package/framework/skills/gitlab-mcp/references/code-review.md +110 -0
- package/framework/skills/gitlab-mcp/references/issues.md +141 -0
- package/framework/skills/gitlab-mcp/references/merge-requests.md +120 -0
- package/framework/skills/gitlab-mcp/references/pipelines.md +67 -0
- package/framework/skills/gitlab-mcp/references/search.md +17 -0
- package/framework/skills/gitlab-mcp/references/webhooks.md +32 -0
- package/framework/skills/gitlab-mcp/references/work-items.md +50 -0
- package/framework/skills/jira-mcp/SKILL.md +57 -0
- package/framework/skills/jira-mcp/examples.md +31 -0
- package/framework/skills/jira-mcp/references/comments.md +27 -0
- package/framework/skills/jira-mcp/references/issues.md +97 -0
- package/framework/skills/jira-mcp/references/projects.md +39 -0
- package/framework/skills/laravel-best-practices/SKILL.md +229 -0
- package/framework/skills/laravel-best-practices/examples.md +31 -0
- package/framework/skills/laravel-best-practices/references/advanced-queries.md +106 -0
- package/framework/skills/laravel-best-practices/references/architecture.md +202 -0
- package/framework/skills/laravel-best-practices/references/blade-views.md +36 -0
- package/framework/skills/laravel-best-practices/references/caching.md +70 -0
- package/framework/skills/laravel-best-practices/references/collections.md +44 -0
- package/framework/skills/laravel-best-practices/references/config.md +73 -0
- package/framework/skills/laravel-best-practices/references/db-performance.md +192 -0
- package/framework/skills/laravel-best-practices/references/eloquent.md +148 -0
- package/framework/skills/laravel-best-practices/references/error-handling.md +72 -0
- package/framework/skills/laravel-best-practices/references/events-notifications.md +52 -0
- package/framework/skills/laravel-best-practices/references/http-client.md +160 -0
- package/framework/skills/laravel-best-practices/references/mail.md +27 -0
- package/framework/skills/laravel-best-practices/references/migrations.md +121 -0
- package/framework/skills/laravel-best-practices/references/passport.md +197 -0
- package/framework/skills/laravel-best-practices/references/pennant.md +61 -0
- package/framework/skills/laravel-best-practices/references/pest-testing.md +166 -0
- package/framework/skills/laravel-best-practices/references/pulse.md +196 -0
- package/framework/skills/laravel-best-practices/references/queue-jobs.md +144 -0
- package/framework/skills/laravel-best-practices/references/routing.md +99 -0
- package/framework/skills/laravel-best-practices/references/scheduling.md +39 -0
- package/framework/skills/laravel-best-practices/references/scout.md +176 -0
- package/framework/skills/laravel-best-practices/references/security.md +198 -0
- package/framework/skills/laravel-best-practices/references/spatie-laravel-backup.md +222 -0
- package/framework/skills/laravel-best-practices/references/spatie-laravel-permission.md +272 -0
- package/framework/skills/laravel-best-practices/references/spatie-medialibrary.md +672 -0
- package/framework/skills/laravel-best-practices/references/style.md +125 -0
- package/framework/skills/laravel-best-practices/references/tailwindcss.md +112 -0
- package/framework/skills/laravel-best-practices/references/testing.md +43 -0
- package/framework/skills/laravel-best-practices/references/validation.md +75 -0
- package/framework/skills/lavish/SKILL.md +67 -0
- package/framework/skills/lavish/examples.md +31 -0
- package/framework/skills/notion-mcp/SKILL.md +57 -0
- package/framework/skills/notion-mcp/examples.md +31 -0
- package/framework/skills/notion-mcp/references/comments.md +112 -0
- package/framework/skills/notion-mcp/references/databases.md +193 -0
- package/framework/skills/notion-mcp/references/pages.md +235 -0
- package/framework/skills/skill-creator/LICENSE.txt +202 -0
- package/framework/skills/skill-creator/SKILL.md +485 -0
- package/framework/skills/skill-creator/agents/analyzer.md +274 -0
- package/framework/skills/skill-creator/agents/comparator.md +202 -0
- package/framework/skills/skill-creator/agents/grader.md +223 -0
- package/framework/skills/skill-creator/assets/eval_review.html +146 -0
- package/framework/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/framework/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/framework/skills/skill-creator/examples.md +31 -0
- package/framework/skills/skill-creator/references/schemas.md +430 -0
- package/framework/skills/skill-creator/scripts/__init__.py +0 -0
- package/framework/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/framework/skills/skill-creator/scripts/generate_report.py +326 -0
- package/framework/skills/skill-creator/scripts/improve_description.py +247 -0
- package/framework/skills/skill-creator/scripts/package_skill.py +136 -0
- package/framework/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/framework/skills/skill-creator/scripts/run_eval.py +310 -0
- package/framework/skills/skill-creator/scripts/run_loop.py +328 -0
- package/framework/skills/skill-creator/scripts/utils.py +47 -0
- package/framework/styles/README.md +35 -0
- package/framework/styles/linear/DESIGN.md +478 -0
- package/framework/styles/linear/README.md +36 -0
- package/framework/styles/linear/assets/preview.jpg +0 -0
- package/framework/styles/raycast/DESIGN.md +495 -0
- package/framework/styles/raycast/README.md +35 -0
- package/framework/styles/raycast/assets/preview.jpg +0 -0
- package/package.json +33 -0
- package/src/agent-configs.js +96 -0
- package/src/catalog.js +145 -0
- package/src/cli.js +254 -0
- package/src/installer.js +303 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Passport OAuth2 Authentication
|
|
2
|
+
|
|
3
|
+
## Documentation First
|
|
4
|
+
|
|
5
|
+
**Always use `search-docs` before writing Passport code.** The documentation covers every grant type, configuration option, and edge case in detail. This skill teaches you how to navigate Passport — the docs have the implementation specifics.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
search-docs(queries: ["Passport installation"], packages: ["laravel/framework@12.x"])
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The Passport docs live under the `laravel/framework` package — not `laravel/passport`.
|
|
12
|
+
|
|
13
|
+
## When to Apply
|
|
14
|
+
|
|
15
|
+
Activate this skill when:
|
|
16
|
+
|
|
17
|
+
- Installing or configuring Passport
|
|
18
|
+
- Setting up OAuth2 authorization grants
|
|
19
|
+
- Creating or managing OAuth clients
|
|
20
|
+
- Protecting API routes with token authentication
|
|
21
|
+
- Defining or checking token scopes
|
|
22
|
+
- Configuring SPA cookie-based authentication
|
|
23
|
+
- Choosing between Passport and Sanctum
|
|
24
|
+
|
|
25
|
+
## Passport vs. Sanctum
|
|
26
|
+
|
|
27
|
+
**Passport** is a full OAuth2 server — use it when third-party applications need to consume your API and when you need OAuth2 authorization code grants, client credentials for machine-to-machine auth, or device authorization flow.
|
|
28
|
+
|
|
29
|
+
**Sanctum** is simpler — use it when first-party SPAs, third parties, or mobile apps consume the API but you don't need the full OAuth2 grant flows.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Three steps are always required:
|
|
34
|
+
|
|
35
|
+
### 1. Install Passport
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
php artisan install:api --passport
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This publishes migrations, generates encryption keys, and registers routes.
|
|
42
|
+
|
|
43
|
+
### 2. Configure the User model
|
|
44
|
+
|
|
45
|
+
The User model needs both the `HasApiTokens` trait AND the `OAuthenticatable` interface. Missing the interface is the most common Passport setup mistake — it causes runtime errors that can be confusing to debug.
|
|
46
|
+
|
|
47
|
+
```php
|
|
48
|
+
use Laravel\Passport\Contracts\OAuthenticatable;
|
|
49
|
+
use Laravel\Passport\HasApiTokens;
|
|
50
|
+
|
|
51
|
+
class User extends Authenticatable implements OAuthenticatable
|
|
52
|
+
{
|
|
53
|
+
use HasApiTokens;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Configure the auth guard
|
|
58
|
+
|
|
59
|
+
The `api` guard must use the `passport` driver in `config/auth.php`. Using `token` or `sanctum` here silently breaks Passport authentication.
|
|
60
|
+
|
|
61
|
+
```php
|
|
62
|
+
'guards' => [
|
|
63
|
+
'api' => [
|
|
64
|
+
'driver' => 'passport',
|
|
65
|
+
'provider' => 'users',
|
|
66
|
+
],
|
|
67
|
+
],
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Choosing a Grant Type
|
|
71
|
+
|
|
72
|
+
Matching the right grant to the use case is the most important Passport decision. Use `search-docs` for implementation details of any grant.
|
|
73
|
+
|
|
74
|
+
| Use Case | Grant Type | Client Flag |
|
|
75
|
+
|----------|-----------|-------------|
|
|
76
|
+
| Third-party app accessing user data | Authorization Code | (default) |
|
|
77
|
+
| Mobile/SPA without client secret | Authorization Code + PKCE | `--public` |
|
|
78
|
+
| Machine-to-machine, no user context | Client Credentials | `--client` |
|
|
79
|
+
| User-generated API keys | Personal Access Tokens | `--personal` |
|
|
80
|
+
| Smart TV, CLI, IoT devices | Device Authorization | `--device` |
|
|
81
|
+
|
|
82
|
+
**Legacy grants** (Password, Implicit) are disabled by default and not recommended. They must be explicitly enabled with `Passport::enablePasswordGrant()` or `Passport::enableImplicitGrant()`.
|
|
83
|
+
|
|
84
|
+
## Client Management
|
|
85
|
+
|
|
86
|
+
Create clients with the appropriate flag for the grant type:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
php artisan passport:client # Authorization code
|
|
90
|
+
|
|
91
|
+
php artisan passport:client --public # PKCE (no secret)
|
|
92
|
+
|
|
93
|
+
php artisan passport:client --client # Client credentials
|
|
94
|
+
|
|
95
|
+
php artisan passport:client --personal # Personal access tokens
|
|
96
|
+
|
|
97
|
+
php artisan passport:client --device # Device authorization
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Additional flags: `--name=`, `--redirect_uri=`, `--provider=`.
|
|
102
|
+
|
|
103
|
+
Client secrets are hashed by default — the plain-text secret is only shown at creation time and cannot be retrieved later.
|
|
104
|
+
|
|
105
|
+
## Protecting Routes
|
|
106
|
+
|
|
107
|
+
Apply `auth:api` middleware. Clients send tokens via the `Authorization: Bearer <token>` header.
|
|
108
|
+
|
|
109
|
+
```php
|
|
110
|
+
Route::get('/user', function (Request $request) {
|
|
111
|
+
return $request->user();
|
|
112
|
+
})->middleware('auth:api');
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Scope Enforcement
|
|
116
|
+
|
|
117
|
+
Scope middleware must come alongside `auth:api`:
|
|
118
|
+
|
|
119
|
+
- `CheckToken::using('scope1', 'scope2')` — requires ALL listed scopes
|
|
120
|
+
- `CheckTokenForAnyScope::using('scope1', 'scope2')` — requires ANY listed scope
|
|
121
|
+
- `EnsureClientIsResourceOwner::using('scope1')` — restricts to client credential tokens
|
|
122
|
+
|
|
123
|
+
```php
|
|
124
|
+
use Laravel\Passport\Http\Middleware\CheckToken;
|
|
125
|
+
|
|
126
|
+
Route::get('/orders', function () {
|
|
127
|
+
// ...
|
|
128
|
+
})->middleware(['auth:api', CheckToken::using('orders:read')]);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Programmatic scope checking
|
|
132
|
+
|
|
133
|
+
```php
|
|
134
|
+
if ($request->user()->tokenCan('place-orders')) {
|
|
135
|
+
// ...
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Use `search-docs` for full scope middleware registration and usage patterns.
|
|
140
|
+
|
|
141
|
+
## Key Configuration
|
|
142
|
+
|
|
143
|
+
Configure in `AppServiceProvider::boot()`. Use `search-docs` for the full list of options.
|
|
144
|
+
|
|
145
|
+
```php
|
|
146
|
+
// Token lifetimes (each is independent)
|
|
147
|
+
Passport::tokensExpireIn(now()->addDays(15));
|
|
148
|
+
Passport::refreshTokensExpireIn(now()->addDays(30));
|
|
149
|
+
Passport::personalAccessTokensExpireIn(now()->addMonths(6));
|
|
150
|
+
|
|
151
|
+
// Define scopes
|
|
152
|
+
Passport::tokensCan([
|
|
153
|
+
'place-orders' => 'Place orders',
|
|
154
|
+
'check-status' => 'Check order status',
|
|
155
|
+
]);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## SPA Cookie Authentication
|
|
159
|
+
|
|
160
|
+
For first-party SPAs, the `CreateFreshApiToken` middleware issues a `laravel_token` cookie containing an encrypted JWT. The SPA must include CSRF tokens — missing the `X-CSRF-TOKEN` or `X-XSRF-TOKEN` header causes 419 errors.
|
|
161
|
+
|
|
162
|
+
Use `search-docs` for setup details — this feature has specific CSRF and cookie configuration requirements.
|
|
163
|
+
|
|
164
|
+
## Testing
|
|
165
|
+
|
|
166
|
+
Passport provides helpers to bypass full OAuth flows in tests:
|
|
167
|
+
|
|
168
|
+
```php
|
|
169
|
+
Passport::actingAs($user, ['scope1', 'scope2']);
|
|
170
|
+
Passport::actingAsClient($client, ['scope1']);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Token Maintenance
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
php artisan passport:purge # Purge revoked & expired
|
|
177
|
+
|
|
178
|
+
php artisan passport:purge --revoked # Only revoked
|
|
179
|
+
|
|
180
|
+
php artisan passport:purge --expired # Only expired
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Schedule `passport:purge` for regular expired token clean-up.
|
|
185
|
+
|
|
186
|
+
## Events
|
|
187
|
+
|
|
188
|
+
All in `Laravel\Passport\Events`: `AccessTokenCreated`, `AccessTokenRevoked`, `RefreshTokenCreated`.
|
|
189
|
+
|
|
190
|
+
## Common Pitfalls
|
|
191
|
+
|
|
192
|
+
- **Missing `OAuthenticatable` interface** — both the `HasApiTokens` trait and the `OAuthenticatable` interface are required on the User model. Missing the interface causes runtime errors.
|
|
193
|
+
- **Wrong guard driver** — the `api` guard must use `passport`, not `token` or `sanctum`. This fails silently.
|
|
194
|
+
- **Token lifetime confusion** — access token, refresh token, and personal access token lifetimes are all independent settings.
|
|
195
|
+
- **Missing CSRF for SPA cookie auth** — `CreateFreshApiToken` requires CSRF tokens. Use `Passport::ignoreCsrfToken()` only if you understand the security implications.
|
|
196
|
+
- **Client secrets are hashed** — the plain-text secret is only available at creation time.
|
|
197
|
+
- **Legacy grants are disabled** — Password and Implicit grants must be explicitly enabled and are not recommended.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Pennant Features
|
|
2
|
+
|
|
3
|
+
## Documentation
|
|
4
|
+
|
|
5
|
+
Use `search-docs` for detailed Pennant patterns and documentation.
|
|
6
|
+
|
|
7
|
+
## Basic Usage
|
|
8
|
+
|
|
9
|
+
### Defining Features
|
|
10
|
+
|
|
11
|
+
<!-- Defining Features -->
|
|
12
|
+
```php
|
|
13
|
+
use Laravel\Pennant\Feature;
|
|
14
|
+
|
|
15
|
+
Feature::define('new-dashboard', function (User $user) {
|
|
16
|
+
return $user->isAdmin();
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Checking Features
|
|
21
|
+
|
|
22
|
+
<!-- Checking Features -->
|
|
23
|
+
```php
|
|
24
|
+
if (Feature::active('new-dashboard')) {
|
|
25
|
+
// Feature is active
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// With scope
|
|
29
|
+
if (Feature::for($user)->active('new-dashboard')) {
|
|
30
|
+
// Feature is active for this user
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Blade Directive
|
|
35
|
+
|
|
36
|
+
<!-- Blade Directive -->
|
|
37
|
+
```blade
|
|
38
|
+
@feature('new-dashboard')
|
|
39
|
+
<x-new-dashboard />
|
|
40
|
+
@else
|
|
41
|
+
<x-old-dashboard />
|
|
42
|
+
@endfeature
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Activating / Deactivating
|
|
46
|
+
|
|
47
|
+
<!-- Activating Features -->
|
|
48
|
+
```php
|
|
49
|
+
Feature::activate('new-dashboard');
|
|
50
|
+
Feature::for($user)->activate('new-dashboard');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Verification
|
|
54
|
+
|
|
55
|
+
1. Check feature flag is defined
|
|
56
|
+
2. Test with different scopes/users
|
|
57
|
+
|
|
58
|
+
## Common Pitfalls
|
|
59
|
+
|
|
60
|
+
- Forgetting to scope features for specific users/entities
|
|
61
|
+
- Not following existing naming conventions
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pest-testing
|
|
3
|
+
description: "Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: test()/it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: laravel
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Pest Testing 4
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
Use `search-docs` for detailed Pest 4 patterns and documentation.
|
|
14
|
+
|
|
15
|
+
## Basic Usage
|
|
16
|
+
|
|
17
|
+
### Creating Tests
|
|
18
|
+
|
|
19
|
+
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
|
|
20
|
+
|
|
21
|
+
The `{name}` argument should include only the path and test name, but should not include the test suite.
|
|
22
|
+
- Incorrect: `php artisan make:test --pest Feature/SomeFeatureTest` will generate `tests/Feature/Feature/SomeFeatureTest.php`
|
|
23
|
+
- Correct: `php artisan make:test --pest SomeControllerTest` will generate `tests/Feature/SomeControllerTest.php`
|
|
24
|
+
- Incorrect: `php artisan make:test --pest --unit Unit/SomeServiceTest` will generate `tests/Unit/Unit/SomeServiceTest.php`
|
|
25
|
+
- Correct: `php artisan make:test --pest --unit SomeServiceTest` will generate `tests/Unit/SomeServiceTest.php`
|
|
26
|
+
|
|
27
|
+
### Test Organization
|
|
28
|
+
|
|
29
|
+
- Unit/Feature tests: `tests/Feature` and `tests/Unit` directories.
|
|
30
|
+
- Browser tests: `tests/Browser/` directory.
|
|
31
|
+
- Do NOT remove tests without approval - these are core application code.
|
|
32
|
+
|
|
33
|
+
### Basic Test Structure
|
|
34
|
+
|
|
35
|
+
Pest supports both `test()` and `it()` functions. Before writing new tests, check existing test files in the same directory to match the project's convention. Use `test()` if existing tests use `test()`, or `it()` if they use `it()`.
|
|
36
|
+
|
|
37
|
+
<!-- Basic Pest Test Example -->
|
|
38
|
+
```php
|
|
39
|
+
it('is true', function () {
|
|
40
|
+
expect(true)->toBeTrue();
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Running Tests
|
|
45
|
+
|
|
46
|
+
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
|
|
47
|
+
- Run all tests: `php artisan test --compact`.
|
|
48
|
+
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
|
|
49
|
+
|
|
50
|
+
## Assertions
|
|
51
|
+
|
|
52
|
+
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
|
|
53
|
+
|
|
54
|
+
<!-- Pest Response Assertion -->
|
|
55
|
+
```php
|
|
56
|
+
it('returns all', function () {
|
|
57
|
+
$this->postJson('/api/docs', [])->assertSuccessful();
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Use | Instead of |
|
|
62
|
+
|-----|------------|
|
|
63
|
+
| `assertSuccessful()` | `assertStatus(200)` |
|
|
64
|
+
| `assertNotFound()` | `assertStatus(404)` |
|
|
65
|
+
| `assertForbidden()` | `assertStatus(403)` |
|
|
66
|
+
|
|
67
|
+
## Mocking
|
|
68
|
+
|
|
69
|
+
Import mock function before use: `use function Pest\Laravel\mock;`
|
|
70
|
+
|
|
71
|
+
## Datasets
|
|
72
|
+
|
|
73
|
+
Use datasets for repetitive tests (validation rules, etc.):
|
|
74
|
+
|
|
75
|
+
<!-- Pest Dataset Example -->
|
|
76
|
+
```php
|
|
77
|
+
it('has emails', function (string $email) {
|
|
78
|
+
expect($email)->not->toBeEmpty();
|
|
79
|
+
})->with([
|
|
80
|
+
'james' => 'james@laravel.com',
|
|
81
|
+
'taylor' => 'taylor@laravel.com',
|
|
82
|
+
]);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Pest 4 Features
|
|
86
|
+
|
|
87
|
+
| Feature | Purpose |
|
|
88
|
+
|---------|---------|
|
|
89
|
+
| Browser Testing | Full integration tests in real browsers |
|
|
90
|
+
| Smoke Testing | Validate multiple pages quickly |
|
|
91
|
+
| Visual Regression | Compare screenshots for visual changes |
|
|
92
|
+
| Test Sharding | Parallel CI runs |
|
|
93
|
+
| Architecture Testing | Enforce code conventions |
|
|
94
|
+
|
|
95
|
+
### Browser Test Example
|
|
96
|
+
|
|
97
|
+
Browser tests run in real browsers for full integration testing:
|
|
98
|
+
|
|
99
|
+
- Browser tests live in `tests/Browser/`.
|
|
100
|
+
- Use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories.
|
|
101
|
+
- Use `RefreshDatabase` for clean state per test.
|
|
102
|
+
- Interact with page: click, type, scroll, select, submit, drag-and-drop, touch gestures.
|
|
103
|
+
- Test on multiple browsers (Chrome, Firefox, Safari) if requested.
|
|
104
|
+
- Test on different devices/viewports (iPhone 14 Pro, tablets) if requested.
|
|
105
|
+
- Switch color schemes (light/dark mode) when appropriate.
|
|
106
|
+
- Take screenshots or pause tests for debugging.
|
|
107
|
+
|
|
108
|
+
<!-- Pest Browser Test Example -->
|
|
109
|
+
```php
|
|
110
|
+
it('may reset the password', function () {
|
|
111
|
+
Notification::fake();
|
|
112
|
+
|
|
113
|
+
$this->actingAs(User::factory()->create());
|
|
114
|
+
|
|
115
|
+
$page = visit('/sign-in');
|
|
116
|
+
|
|
117
|
+
$page->assertSee('Sign In')
|
|
118
|
+
->assertNoJavaScriptErrors()
|
|
119
|
+
->click('Forgot Password?')
|
|
120
|
+
->fill('email', 'nuno@laravel.com')
|
|
121
|
+
->click('Send Reset Link')
|
|
122
|
+
->assertSee('We have emailed your password reset link!');
|
|
123
|
+
|
|
124
|
+
Notification::assertSent(ResetPassword::class);
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Smoke Testing
|
|
129
|
+
|
|
130
|
+
Quickly validate multiple pages have no JavaScript errors:
|
|
131
|
+
|
|
132
|
+
<!-- Pest Smoke Testing Example -->
|
|
133
|
+
```php
|
|
134
|
+
$pages = visit(['/', '/about', '/contact']);
|
|
135
|
+
|
|
136
|
+
$pages->assertNoJavaScriptErrors()->assertNoConsoleLogs();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Visual Regression Testing
|
|
140
|
+
|
|
141
|
+
Capture and compare screenshots to detect visual changes.
|
|
142
|
+
|
|
143
|
+
### Test Sharding
|
|
144
|
+
|
|
145
|
+
Split tests across parallel processes for faster CI runs.
|
|
146
|
+
|
|
147
|
+
### Architecture Testing
|
|
148
|
+
|
|
149
|
+
Pest 4 includes architecture testing (from Pest 3):
|
|
150
|
+
|
|
151
|
+
<!-- Architecture Test Example -->
|
|
152
|
+
```php
|
|
153
|
+
arch('controllers')
|
|
154
|
+
->expect('App\Http\Controllers')
|
|
155
|
+
->toExtendNothing()
|
|
156
|
+
->toHaveSuffix('Controller');
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Common Pitfalls
|
|
160
|
+
|
|
161
|
+
- Not importing `use function Pest\Laravel\mock;` before using mock
|
|
162
|
+
- Using `assertStatus(200)` instead of `assertSuccessful()`
|
|
163
|
+
- Forgetting datasets for repetitive validation tests
|
|
164
|
+
- Deleting tests without approval
|
|
165
|
+
- Forgetting `assertNoJavaScriptErrors()` in browser tests
|
|
166
|
+
- Prefixing `Feature/` or `Unit/` in `{name}` when using `make:test`
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Laravel Pulse Development
|
|
2
|
+
|
|
3
|
+
## Documentation
|
|
4
|
+
|
|
5
|
+
Use `search-docs` for detailed Laravel Pulse patterns and documentation, including card layout customization, user resolver configuration, all recorder options, sampling, dedicated database connections, Vite/CSS integration, Tailwind scoping, blade card components, and lazy loading.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Pulse stores data in your application's database. The current package supports MySQL, MariaDB, PostgreSQL, and SQLite.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
composer require laravel/pulse
|
|
13
|
+
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider"
|
|
14
|
+
php artisan migrate
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The dashboard is available at `/pulse`.
|
|
18
|
+
|
|
19
|
+
## Dashboard Authorization
|
|
20
|
+
|
|
21
|
+
Define the `viewPulse` gate in `AppServiceProvider::boot()` to enable production access:
|
|
22
|
+
|
|
23
|
+
<!-- Pulse Dashboard Authorization -->
|
|
24
|
+
```php
|
|
25
|
+
use App\Models\User;
|
|
26
|
+
use Illuminate\Support\Facades\Gate;
|
|
27
|
+
|
|
28
|
+
Gate::define('viewPulse', function (User $user) {
|
|
29
|
+
return $user->isAdmin();
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Without this gate, the dashboard is inaccessible in all non-local environments.
|
|
34
|
+
|
|
35
|
+
## Recorders
|
|
36
|
+
|
|
37
|
+
All 10 built-in recorders are configurable in `config/pulse.php`:
|
|
38
|
+
|
|
39
|
+
| Recorder | Key Config Options |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `CacheInteractions` | `sample_rate`, `ignore`, `groups` (regex find/replace) |
|
|
42
|
+
| `Exceptions` | `sample_rate`, `ignore`, `location` |
|
|
43
|
+
| `Queues` | `sample_rate`, `ignore` |
|
|
44
|
+
| `SlowJobs` | `threshold` (ms, per-job regex map), `sample_rate`, `ignore` |
|
|
45
|
+
| `SlowOutgoingRequests` | `threshold` (ms, per-URL regex map), `sample_rate`, `ignore`, `groups` |
|
|
46
|
+
| `SlowQueries` | `threshold` (ms, per-query regex map), `sample_rate`, `ignore`, `location` |
|
|
47
|
+
| `SlowRequests` | `threshold` (ms, per-route regex map), `sample_rate`, `ignore` |
|
|
48
|
+
| `Servers` | `PULSE_SERVER_NAME` env var, monitored disk paths |
|
|
49
|
+
| `UserJobs` | `sample_rate`, `ignore` |
|
|
50
|
+
| `UserRequests` | `sample_rate`, `ignore` |
|
|
51
|
+
|
|
52
|
+
Per-route and per-job threshold overrides use a regex-keyed map with a `default` fallback:
|
|
53
|
+
|
|
54
|
+
<!-- Per-Route Threshold Override -->
|
|
55
|
+
```php
|
|
56
|
+
Recorders\SlowRequests::class => [
|
|
57
|
+
'threshold' => [
|
|
58
|
+
'#^/api/reports#' => 5000,
|
|
59
|
+
'default' => env('PULSE_SLOW_REQUESTS_THRESHOLD', 1000),
|
|
60
|
+
],
|
|
61
|
+
],
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `Servers` recorder requires `pulse:check` running as a persistent daemon (Supervisor recommended).
|
|
65
|
+
|
|
66
|
+
### Filtering Entries
|
|
67
|
+
|
|
68
|
+
Use `Pulse::filter()` in `AppServiceProvider::boot()` to exclude entries globally. Return `true` to record, `false` to skip:
|
|
69
|
+
|
|
70
|
+
<!-- Pulse Entry Filter -->
|
|
71
|
+
```php
|
|
72
|
+
use Laravel\Pulse\Entry;
|
|
73
|
+
use Laravel\Pulse\Facades\Pulse;
|
|
74
|
+
use Laravel\Pulse\Value;
|
|
75
|
+
use Illuminate\Support\Facades\Auth;
|
|
76
|
+
|
|
77
|
+
Pulse::filter(function (Entry|Value $entry) {
|
|
78
|
+
return Auth::user()?->isNotAdmin() ?? true;
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Performance
|
|
83
|
+
|
|
84
|
+
### Redis Ingest
|
|
85
|
+
|
|
86
|
+
Offload entry writes from the request cycle to a Redis stream (requires Redis 6.2+ and `phpredis` or `predis`):
|
|
87
|
+
|
|
88
|
+
```ini
|
|
89
|
+
PULSE_INGEST_DRIVER=redis
|
|
90
|
+
PULSE_REDIS_CONNECTION=pulse
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Run a worker to drain the Redis stream into the database:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
php artisan pulse:work
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Signal a graceful restart during deployment (requires a working cache driver):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
php artisan pulse:restart
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Custom Cards
|
|
106
|
+
|
|
107
|
+
Custom cards are Livewire components extending Pulse's base `Card` class.
|
|
108
|
+
|
|
109
|
+
### Recording Entries
|
|
110
|
+
|
|
111
|
+
Call `Pulse::record()` from a recorder, listener, or observer. Chain aggregation methods (`avg`, `count`, `max`, `min`, `sum`) in a single call:
|
|
112
|
+
|
|
113
|
+
<!-- Record Pulse Entry -->
|
|
114
|
+
```php
|
|
115
|
+
use Laravel\Pulse\Facades\Pulse;
|
|
116
|
+
|
|
117
|
+
Pulse::record('user_sale', $user->id, $sale->amount)
|
|
118
|
+
->sum()
|
|
119
|
+
->count();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
When the entry is tied to the authenticated user, use `Pulse::resolveAuthenticatedUserId()` instead of `Auth::id()` to respect custom user resolvers.
|
|
123
|
+
|
|
124
|
+
### Card Component
|
|
125
|
+
|
|
126
|
+
<!-- Custom Pulse Card -->
|
|
127
|
+
```php
|
|
128
|
+
namespace App\Livewire\Pulse;
|
|
129
|
+
|
|
130
|
+
use Laravel\Pulse\Facades\Pulse;
|
|
131
|
+
use Laravel\Pulse\Livewire\Card;
|
|
132
|
+
use Livewire\Attributes\Lazy;
|
|
133
|
+
|
|
134
|
+
#[Lazy]
|
|
135
|
+
class TopSellers extends Card
|
|
136
|
+
{
|
|
137
|
+
public function render(): \Illuminate\View\View
|
|
138
|
+
{
|
|
139
|
+
$aggregates = $this->aggregate('user_sale', ['sum', 'count']);
|
|
140
|
+
$users = Pulse::resolveUsers($aggregates->pluck('key'));
|
|
141
|
+
|
|
142
|
+
return view('livewire.pulse.top-sellers', [
|
|
143
|
+
'sellers' => $aggregates->map(fn ($row) => (object) [
|
|
144
|
+
'user' => $users->find($row->key),
|
|
145
|
+
'sum' => $row->sum,
|
|
146
|
+
'count' => $row->count,
|
|
147
|
+
]),
|
|
148
|
+
]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`$this->aggregate(type, aggregates)` returns a `Collection` of `stdClass` objects with `key` and one property per aggregation method. `$this->aggregateTotal(type, aggregate)` returns a single scalar.
|
|
154
|
+
|
|
155
|
+
### Custom Recorders
|
|
156
|
+
|
|
157
|
+
A recorder is a plain class with a `$listen` array of Laravel events:
|
|
158
|
+
|
|
159
|
+
<!-- Custom Pulse Recorder -->
|
|
160
|
+
```php
|
|
161
|
+
class SaleRecorder
|
|
162
|
+
{
|
|
163
|
+
public array $listen = [
|
|
164
|
+
\App\Events\SaleCompleted::class,
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
public function record(\App\Events\SaleCompleted $event): void
|
|
168
|
+
{
|
|
169
|
+
\Laravel\Pulse\Facades\Pulse::record('user_sale', $event->user->id, $event->sale->amount)
|
|
170
|
+
->sum()
|
|
171
|
+
->count();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Register the recorder in the `recorders` array in `config/pulse.php`.
|
|
177
|
+
|
|
178
|
+
## Verification
|
|
179
|
+
|
|
180
|
+
1. Run migrations and confirm `/pulse` is accessible in local
|
|
181
|
+
2. Define `viewPulse` gate and verify production access
|
|
182
|
+
3. Confirm `pulse:check` is running for the Servers card
|
|
183
|
+
4. If using Redis ingest, confirm `pulse:work` is running
|
|
184
|
+
|
|
185
|
+
## Common Pitfalls
|
|
186
|
+
|
|
187
|
+
- An empty dashboard or database errors usually mean the Pulse tables have not been published and migrated yet.
|
|
188
|
+
- The dashboard is local-only by default. Define the `viewPulse` gate to enable production access.
|
|
189
|
+
- The Servers card shows no data unless `pulse:check` runs as a persistent process. Supervisor is recommended.
|
|
190
|
+
- Redis ingest silently queues data. The dashboard appears empty if `pulse:work` is not running.
|
|
191
|
+
- `pulse:restart` requires a working cache driver. Without it, the signal is never received.
|
|
192
|
+
- Pulse exceptions fail silently. Use `Pulse::handleExceptionsUsing()` to surface errors during development.
|
|
193
|
+
- Multiple `Authenticatable` models can cause incorrect user tracking. Use `Pulse::resolveAuthenticatedUserId()` when recording user-keyed entries.
|
|
194
|
+
- SQS queues may appear duplicated in the Queue card. Use `ignore` regex patterns to suppress them.
|
|
195
|
+
- Sampled dashboard values are approximate and prefixed with `~`. They are not suitable for financial or audit reporting.
|
|
196
|
+
- Always use `search-docs` for the latest Pulse documentation rather than relying on this skill alone.
|