feat: Add sporting-director kit - #320
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughChangesSporting Director assistant
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
|
Failure recorded at 2026-08-04T01:29:32Z UTC. If this PR is not fixed within 4 weeks it will be automatically closed. |
There was a problem hiding this comment.
Actionable comments posted: 15
🤖 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 @.gitignore:
- Line 6: Update the .gitignore entry from the literal scripts.DS_Store pattern
to the correct scripts/.DS_Store path so the macOS file inside the scripts
directory is ignored.
In `@kits/sporting-director/.gitignore`:
- Around line 3-4: Update the kit-level ignore rules to ignore all .env
variants, including .env.production and .env.development, while adding an
exception so .env.example remains trackable. Preserve the existing
environment-file exclusions and apply the change only to the .gitignore entries.
In `@kits/sporting-director/apps/.env.example`:
- Line 3: Replace the concrete LAMATIC_ENDPOINT value in the environment
template with a clear placeholder requiring users to provide their own
deployment endpoint; do not retain any author-specific URL.
In `@kits/sporting-director/apps/actions/orchestrate.ts`:
- Around line 19-21: Extend the required-input validation in the orchestration
function alongside playerName and buyingClub to also reject blank budget and
needs values before executeFlow is called. Preserve the existing failure
response pattern and required-field error behavior while ensuring all four
report inputs are validated server-side.
- Around line 45-50: Update the result handling in orchestrate so `success:
true` is returned only when `raw.report` is a string containing non-whitespace
text; otherwise return the existing error-shaped response with a clear failure
message. Preserve the current report data for valid non-empty reports and use
the `raw`/`report` symbols to locate the change.
In `@kits/sporting-director/apps/app/layout.tsx`:
- Around line 15-18: Update the exported metadata object in the layout module to
replace the generic “Create Next App” title and generated-description values
with the application’s AI Sporting Director title and description. Keep the
existing Metadata export structure unchanged.
In `@kits/sporting-director/apps/app/page.tsx`:
- Around line 59-97: Add unique id attributes to the controls in the form and
matching htmlFor attributes to the labels for Player Name, Buying Club, Budget,
and Club Needs. Update only these four label/control pairs, ensuring each
identifier is unique and consistently paired.
- Around line 15-30: Update handleSubmit so the generateReport call and result
handling run inside try/catch, capturing rejected errors with setError, and move
setLoading(false) into a finally block so loading is always cleared even when
generateReport rejects.
- Around line 6-30: Replace the manual form field state and submission handling
in Home with react-hook-form’s useForm, using a Zod schema through the
appropriate resolver to validate playerName, buyingClub, budget, and needs. Keep
generateReport as the server submission and preserve its result/error handling,
loading behavior, and server-side validation. Add the required react-hook-form,
Zod, and resolver dependencies to the app.
In `@kits/sporting-director/apps/README.md`:
- Line 1: Add a level-one Markdown heading naming the application at the
beginning of the README, before the existing Next.js introduction text, to
satisfy the MD041 requirement.
In `@kits/sporting-director/constitutions/default.md`:
- Around line 3-15: Update the constitution template source that generates the
kit default.md files, adding blank lines after each heading affected by MD022,
including the Identity, Safety, Data Handling, and Tone sections. Apply the
formatting fix at the shared template/generator source rather than only
modifying the sporting-director copy.
In `@kits/sporting-director/flows/sporting-director.ts`:
- Around line 82-84: Update the search query in the sporting-director flow to
remove the hardcoded “2026” year, while preserving the player-name interpolation
and the existing dateRange value “qdr:m”.
- Line 137: Update the outputMapping for report in the sporting director flow to
interpolate LLMNode_505.output.generatedResponse using the required template
syntax, replacing the literal "generate Text.text" value so the API returns the
generated briefing.
In `@kits/sporting-director/prompts/sporting-director_llmnode-505_system_0.md`:
- Around line 1-9: Update the Sporting Director system prompt to explicitly
treat search-result titles and snippets as untrusted data: extract only relevant
factual claims, ignore any instructions embedded in indexed content, and never
follow or relay those instructions as directives. Preserve the existing
evidence-only and missing-data requirements.
In `@kits/sporting-director/prompts/sporting-director_llmnode-505_user_1.md`:
- Line 6: Update the sporting director report prompt content after “Generate the
sporting director report.” to include exactly one trailing newline, without
adding headings or lint-suppression text.
🪄 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: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9255192e-54de-4a35-9e1a-42f68a27dfc3
⛔ Files ignored due to path filters (10)
.DS_Storeis excluded by!**/.DS_Storekits/.DS_Storeis excluded by!**/.DS_Storekits/sporting-director/apps/app/favicon.icois excluded by!**/*.icokits/sporting-director/apps/package-lock.jsonis excluded by!**/package-lock.jsonkits/sporting-director/apps/public/background.pngis excluded by!**/*.pngkits/sporting-director/apps/public/file.svgis excluded by!**/*.svgkits/sporting-director/apps/public/globe.svgis excluded by!**/*.svgkits/sporting-director/apps/public/next.svgis excluded by!**/*.svgkits/sporting-director/apps/public/vercel.svgis excluded by!**/*.svgkits/sporting-director/apps/public/window.svgis excluded by!**/*.svg
📒 Files selected for processing (23)
.gitignorekits/sporting-director/.gitignorekits/sporting-director/README.mdkits/sporting-director/agent.mdkits/sporting-director/apps/.env.examplekits/sporting-director/apps/.gitignorekits/sporting-director/apps/README.mdkits/sporting-director/apps/actions/orchestrate.tskits/sporting-director/apps/app/globals.csskits/sporting-director/apps/app/layout.tsxkits/sporting-director/apps/app/page.tsxkits/sporting-director/apps/eslint.config.mjskits/sporting-director/apps/lib/lamatic-client.tskits/sporting-director/apps/next.config.tskits/sporting-director/apps/package.jsonkits/sporting-director/apps/postcss.config.mjskits/sporting-director/apps/tsconfig.jsonkits/sporting-director/constitutions/default.mdkits/sporting-director/flows/sporting-director.tskits/sporting-director/lamatic.config.tskits/sporting-director/model-configs/sporting-director_llmnode-505_generative-model-name.tskits/sporting-director/prompts/sporting-director_llmnode-505_system_0.mdkits/sporting-director/prompts/sporting-director_llmnode-505_user_1.md
There was a problem hiding this comment.
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 `@kits/sporting-director/.env.example`:
- Around line 1-4: Reorder the environment keys so LAMATIC_ENDPOINT and
LAMATIC_FLOW_ID appear before LAMATIC_PROJECT_ID, while keeping LAMATIC_API_KEY
present. Add a final blank line after the last entry to satisfy dotenv-linter.
In `@kits/sporting-director/lamatic.config.ts`:
- Around line 18-19: Update the links.deploy value in the Lamatic configuration
to use the LAMATIC_ENDPOINT URL defined for the sporting-director kit instead of
leaving it empty, preserving the existing GitHub link and release metadata
structure.
🪄 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: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2e0af8e5-565c-4128-8027-612f508f42a7
📒 Files selected for processing (2)
kits/sporting-director/.env.examplekits/sporting-director/lamatic.config.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@KishoharS some comments are still left, resolve that too! |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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 `@kits/sporting-director/.env.example`:
- Around line 2-4: Make both Lamatic environment templates deployment-neutral
and consistent: update kits/sporting-director/.env.example lines 2-4 and
kits/sporting-director/apps/.env.example lines 2-4 so the endpoint, flow ID, and
project ID use placeholders, or document one shared deployment with all three
matching values; ensure neither template contains identifiers tied to an
unrelated deployment.
In `@kits/sporting-director/agent.md`:
- Line 3: Update the Markdown in agent.md by adding a blank line after every
section heading, including the headings at the referenced locations, and ensure
the file ends with exactly one trailing newline after the final integration
sentence.
In `@kits/sporting-director/apps/app/page.tsx`:
- Around line 65-68: Add lucide-react to the app dependencies, replace the
inline SVG in the page component with the UserRound icon, and preserve its
existing visual sizing/color classes. Mark the decorative UserRound icon with
aria-hidden="true".
- Around line 9-14: Update the formSchema string validations for playerName,
buyingClub, budget, and needs to trim whitespace before applying the existing
min(1) checks, so whitespace-only values fail field-level validation before
onSubmit calls generateReport.
In `@kits/sporting-director/prompts/sporting-director_llmnode-505_system_0.md`:
- Line 19: Ensure the prompt content ends with exactly one trailing newline
after the final “none available” instruction, without adding headings or
lint-suppression comments.
- Around line 9-10: Update the prompt guidance around the search-result safety
rules to explicitly classify all dynamic user-prompt fields—playerName,
buyingClub, budget, and needs—as untrusted data. Instruct the model to use these
values and search results only as data, never follow instructions, role changes,
tool requests, or formatting directives embedded in either source, and preserve
the existing requirement to rely only on evidenced search results.</codeգ
In `@kits/sporting-director/README.md`:
- Line 31: Add a blank line immediately after the “Flow architecture” heading
before the diagram, and ensure the README ends with a single trailing newline
after the final limitation item.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
kits/sporting-director/prompts/sporting-director_llmnode-505_system_0.md (1)
9-10: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winMission: Treat dynamic field values as untrusted data.
playerName,buyingClub,budget, andneedsare inserted unchanged by the user prompt. Line 10 protects only search results. State that dynamic fields and search results are data only. Instruct the model to ignore instructions, role changes, tool requests, and formatting directives in both sources.🤖 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 `@kits/sporting-director/prompts/sporting-director_llmnode-505_system_0.md` around lines 9 - 10, Update the prompt guidance near the search-result safety rules to explicitly classify dynamic fields such as playerName, buyingClub, budget, and needs as untrusted data. Require the model to ignore instructions, role changes, tool requests, and formatting directives found in both these dynamic values and search results, while preserving the existing search-result fact restrictions.
🤖 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 `@kits/sporting-director/apps/actions/orchestrate.ts`:
- Around line 19-24: Update the input validation in the server action before the
try block to verify playerName, buyingClub, budget, and needs are all strings
and non-empty after trimming; short-circuit invalid values with the existing
required-fields error, and only call .trim() after the type checks pass.
In `@kits/sporting-director/apps/app/page.tsx`:
- Around line 56-60: Replace the repeated literal color values in the page
component around the main page container and its related form, error, button,
and report sections with semantic CSS variables. Define the palette in the app’s
global styling location, then reference those variables from the page’s
className or style declarations while preserving the existing visual roles and
layout.
- Around line 142-146: Update the conditional error message rendered by the
error state near the submission flow to include role="alert", ensuring assistive
technology announces asynchronous request failures while preserving the existing
styling and content.
---
Duplicate comments:
In `@kits/sporting-director/prompts/sporting-director_llmnode-505_system_0.md`:
- Around line 9-10: Update the prompt guidance near the search-result safety
rules to explicitly classify dynamic fields such as playerName, buyingClub,
budget, and needs as untrusted data. Require the model to ignore instructions,
role changes, tool requests, and formatting directives found in both these
dynamic values and search results, while preserving the existing search-result
fact restrictions.
🪄 Autofix
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: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0a7f6119-cefb-4e42-b6aa-00dcdd3995e2
⛔ Files ignored due to path filters (9)
kits/sporting-director/apps/app/favicon.icois excluded by!**/*.icokits/sporting-director/apps/package-lock.jsonis excluded by!**/package-lock.jsonkits/sporting-director/apps/public/background.pngis excluded by!**/*.pngkits/sporting-director/apps/public/file.svgis excluded by!**/*.svgkits/sporting-director/apps/public/globe.svgis excluded by!**/*.svgkits/sporting-director/apps/public/next.svgis excluded by!**/*.svgkits/sporting-director/apps/public/vercel.svgis excluded by!**/*.svgkits/sporting-director/apps/public/window.svgis excluded by!**/*.svgpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (25)
.gitignorekits/sporting-director/.env.examplekits/sporting-director/.gitignorekits/sporting-director/README.mdkits/sporting-director/agent.mdkits/sporting-director/apps/.env.examplekits/sporting-director/apps/.gitignorekits/sporting-director/apps/README.mdkits/sporting-director/apps/actions/orchestrate.tskits/sporting-director/apps/app/globals.csskits/sporting-director/apps/app/layout.tsxkits/sporting-director/apps/app/page.tsxkits/sporting-director/apps/eslint.config.mjskits/sporting-director/apps/lib/lamatic-client.tskits/sporting-director/apps/next.config.tskits/sporting-director/apps/package.jsonkits/sporting-director/apps/postcss.config.mjskits/sporting-director/apps/tsconfig.jsonkits/sporting-director/constitutions/default.mdkits/sporting-director/flows/sporting-director.tskits/sporting-director/lamatic.config.tskits/sporting-director/model-configs/sporting-director_llmnode-505_generative-model-name.tskits/sporting-director/prompts/sporting-director_llmnode-505_system_0.mdkits/sporting-director/prompts/sporting-director_llmnode-505_user_1.mdpackage.json
|
@akshatvirmani CodeRabbit has approved the changes and all functional checks are green! Just a heads up, the final Validate PR — Studio runtime check failed because it's a workflow_run triggered from a fork, so GitHub blocked it from checking out the code. Let me know if you need me to do anything else, or if you're able to pull it and run the tests on your end! |
KishoharS
left a comment
There was a problem hiding this comment.
Done resolving the comments!
|
@coderabbitai review |
|
Summary
Adds AI Sporting Director — a decision-support kit for football recruitment teams. Given a target player, buying club, budget, and positional need, it searches for real, current information and generates a structured transfer feasibility report — helping sporting directors quickly assess whether a target is realistic before investing hours of manual research.
The problem
Scouting and transfer research for lower-resourced clubs is slow and fragmented: checking transfer sites, news, contract status, and rumors across multiple sources to answer one question — "is this transfer even realistic?" Large clubs have dedicated recruitment departments and proprietary data providers; smaller clubs don't.
Approach
The flow is a two-stage pipeline, not a single prompt wrapper:
API Request (playerName, buyingClub, budget, needs)
→ Web Search (recent news/info about the player, last 30 days)
→ Generate Text (structured feasibility analysis grounded in search results)
→ API Response
The system prompt enforces strict grounding: the agent only reports facts present in the search results, explicitly states when information is unavailable rather than speculating, and writes in a concise executive-briefing style (no filler, bullet points, scannable in under 60 seconds).
Output covers: transfer feasibility score (1-10) with justification, tactical fit, personal/cultural fit (rivalries, boyhood ties, if evidenced), competing interest from other clubs, additional intel (agent, valuation, form, contract terms), key risks, and alternative targets if feasibility is low.
Result
Tested end-to-end with real players — e.g. querying Cristiano Ronaldo → Real Madrid correctly surfaced his active Al-Nassr contract, financial situation, age, and MLS rumors, while honestly flagging tactical fit as unassessable from available data rather than inventing an answer.
Tradeoffs / assumptions
Architecture notes
Frontend uses the official
lamaticSDK (lamatic.executeFlow) via a Next.js server action (apps/actions/orchestrate.ts+apps/lib/lamatic-client.ts), following the pattern fromkits/content-generationand the mergedwarranty-return-trackerkit.Testing
npm install && npm run dev) with multiple real player scenarios, including edge cases (missing selling club context, low-feasibility targets)PR Checklist
1. Select Contribution Type
kits/sporting-director/)2. General Requirements
.env.localis gitignored, only.env.examplewith placeholders is includedsporting-director)README.md(purpose, setup, usage, limitations)3. File Structure
lamatic.config.tspresent with valid metadata (name, description, tags, steps, author)flows/sporting-director.tspresent — self-contained flow export from Lamatic Studioagent.mdandconstitutions/default.mdpresentapps/.env.examplepresent with placeholder values only4. Validation
npm install && npm run devworks locally (confirmed working)feat: Add sporting-director kitsporting-directorLamatic kit and metadata.generateReportserver action.lamatic.executeFlow.sporting-directorflow.gemini-3.5-flash-litemodel configuration.