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:
WalkthroughChangesThe Sporting Director kit adds a Lamatic football recruitment flow, factual-reporting prompts, a typed server action, and a Next.js interface for submitting scouting criteria and viewing generated reports. Application bootstrap and repository setup
Recruitment flow and report contract
Server-side report execution
Report submission interface
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
|
|
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! |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
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: 5
♻️ Duplicate comments (1)
kits/sporting-director/apps/app/layout.tsx (1)
15-18: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMission: align the document title with the Sporting Director kit.
The description identifies the AI Sporting Director, but the title is
Agent Hunt. UnlessAgent Huntis the documented product name, browser tabs and metadata identify a different product. UseAI Sporting Director, or update the kit documentation to establishAgent Huntas the intended brand.Proposed metadata change
- title: "Agent Hunt", + title: "AI Sporting Director",🤖 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/apps/app/layout.tsx` around lines 15 - 18, Update the title in the exported metadata object to “AI Sporting Director” so it matches the existing description and kit identity; only retain “Agent Hunt” if the documented product name is explicitly updated to establish it as the intended brand.
🤖 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: Keep the endpoint, flow ID, and project ID deployment-neutral
and consistent across both templates: update kits/sporting-director/.env.example
lines 2-4 and kits/sporting-director/apps/.env.example lines 2-4 to use
placeholders for LAMATIC_FLOW_ID and LAMATIC_PROJECT_ID, or document and
validate that all three values belong to the same deployment; ensure both files
contain identical values.
In `@kits/sporting-director/apps/actions/orchestrate.ts`:
- Around line 20-38: Add server-side length limits for playerName, buyingClub,
budget, and needs, then reject oversized values before the try block in the
action containing lamatic.executeFlow. Also apply the project’s shared
rate/concurrency limiter immediately before the executeFlow call, or document
the deployed edge layer’s equivalent enforcement; preserve the existing
empty-value validation and return a failure without invoking the workflow when
limits are exceeded.
In `@kits/sporting-director/apps/app/globals.css`:
- Around line 46-50: Update the body rule in globals.css to use the
RootLayout-loaded Geist font through var(--font-geist-sans) instead of the
hard-coded Arial fallback, while preserving the existing background and
foreground variables.
In `@kits/sporting-director/apps/next.config.ts`:
- Around line 1-7: Align the Next.js configuration filename with the documented
kit contract by replacing next.config.ts with next.config.mjs, preserving the
existing nextConfig settings and export in the new file. Do not leave both
configuration files present.
In `@kits/sporting-director/apps/README.md`:
- Around line 5-19: Add a concise setup section to the README near “Getting
Started” that instructs first-time users to create `.env.local` and configure
every Lamatic environment variable consumed by `lamatic-client.ts`, or links to
the kit setup guide containing those instructions. Keep the existing
development-server steps unchanged.
---
Duplicate comments:
In `@kits/sporting-director/apps/app/layout.tsx`:
- Around line 15-18: Update the title in the exported metadata object to “AI
Sporting Director” so it matches the existing description and kit identity; only
retain “Agent Hunt” if the documented product name is explicitly updated to
establish it as the intended brand.
🪄 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: c118a5e2-1e25-4bc2-a3f0-7d98c4134d11
⛔ Files ignored due to path filters (8)
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!**/*.svg
📒 Files selected for processing (23)
kits/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.md
|
@akshatvirmani Made the fixes CodeRabbit flagged (config filename, placeholder env values) — PR #320 should be ready for review now. Would appreciate a look and merge if it's good to go. |
|
the ValidatePR - Studio runtime check (phase 2, testing) workflow is failing on my PR, but it looks like a CI config issue, not my contribution. It's triggered via workflow_run, and GitHub blocks that from checking out fork PR code. So it can't run against any fork-based PR as current set up. Flagging in case this needs a workflow_run -> checkout fix on the maintenance side |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/sporting-director/apps/actions/orchestrate.ts (1)
55-60: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winImport and use
../../lamatic.configto resolve the configured step before callingexecuteFlow. The action currently usesLAMATIC_FLOW_IDdirectly and bypasses the parent kit configuration.🤖 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/apps/actions/orchestrate.ts` around lines 55 - 60, Update the flow execution in the action around lamatic.executeFlow to import and use the configured step from ../../lamatic.config, resolving its flow identifier before invoking executeFlow. Replace the direct LAMATIC_FLOW_ID usage while preserving the existing playerName, buyingClub, budget, and needs payload.Source: Coding guidelines
🤖 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:
- Around line 6-9: Update the .gitignore entries by removing the overly broad
bare scripts rule and the duplicate .DS_Store entry; retain a single .DS_Store
rule, or replace scripts with /scripts only if the root-level generated
directory must remain ignored.
---
Outside diff comments:
In `@kits/sporting-director/apps/actions/orchestrate.ts`:
- Around line 55-60: Update the flow execution in the action around
lamatic.executeFlow to import and use the configured step from
../../lamatic.config, resolving its flow identifier before invoking executeFlow.
Replace the direct LAMATIC_FLOW_ID usage while preserving the existing
playerName, buyingClub, budget, and needs payload.
🪄 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: e77fde8a-f098-4847-b120-81eab7a7c424
⛔ Files ignored due to path filters (1)
.DS_Storeis excluded by!**/.DS_Store
📒 Files selected for processing (8)
.gitignorekits/sporting-director/.env.examplekits/sporting-director/apps/.env.examplekits/sporting-director/apps/README.mdkits/sporting-director/apps/actions/orchestrate.tskits/sporting-director/apps/app/globals.csskits/sporting-director/apps/next.config.mjskits/sporting-director/apps/tsconfig.json
…Ds in .env.example
3aab1bf to
1a4e855
Compare
|
Hi @KishoharS! 👋 Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review. Steps to follow:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
|
@akshatvirmani, the PR is yet to be reviewed. Whenever you got a moment, a review will be helpful. |
|
@KishoharS GitHub action above reviewed the PR, no? not all checks are passing hence "requested-improvements" https://github.com/Lamatic/AgentKit/actions/runs/31553331406 |
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 kitgenerateReportaction.sporting-directorLamatic flow:next.config.mjswith the expected Next.js configuration format.