feat(template): introduce coreex-ai template and decouple AI artefacts from coreex#149
Merged
Merged
Conversation
…s from coreex - Add new coreex-ai dotnet new template (CoreEx.Ai) that emits only .github/ AI workflow assets (instructions, prompts, agents) without any code scaffolding. - Template accepts an optional --app-folder parameter; when set, all instruction files' applyTo: frontmatter is scoped to that subfolder (monorepo support). - Add consumer-instructions/.github/instructions/coreex.instructions.md as a proper scoped instructions file (replaces copilot-instructions.md for coreex-ai). - Add InjectAppFolderConditional MSBuild inline task to transform applyTo: lines with template engine conditionals at pack time. - Rewrite CopyTemplateAiContext target: Bootstrap unchanged, CoreEx.Ai gets transformed instruction files, coreex (CoreEx.Core) gets NO .github/ assets. - Update CoreEx.Core AGENTS.md and CLAUDE.md to remove stale .github/ references and guide users to run dotnet new coreex-ai separately. - Add coreex-ai-single-repo and coreex-ai-monorepo scenarios to validation script. - Update README.md: new overview table, coreex-ai section (Template 1), renumber existing sections (Bootstrap->2, coreex->3, api->4, relay->5, subscribe->6). - Update solution-scaffolder SKILL.md: prerequisite and related templates. Closes #148 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new coreex-ai dotnet new template to install CoreEx Copilot/AI workflow assets (.github/instructions, prompts, agents) independently of solution scaffolding, and updates the existing templates/docs so coreex no longer emits .github/ artefacts.
Changes:
- Added
coreex-aitemplate content and packaging logic, including conditionalapplyToscoping via--app-folder. - Updated template-pack build/validation tooling and documentation to reflect the new template split.
- Updated generated-solution guidance files (
AGENTS.md/CLAUDE.md) to instruct consumers to rundotnet new coreex-aiat repo root.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/validate-template-pack.ps1 | Adds validation scenarios for coreex-ai in single-repo and monorepo modes. |
| src/CoreEx.Template/README.md | Documents coreex-ai, updates template count/order, and clarifies the new recommended workflow. |
| src/CoreEx.Template/CoreEx.Template.csproj | Adds MSBuild task/targets to package coreex-ai and inject applyTo conditionals at pack time. |
| src/CoreEx.Template/content/CoreEx.Core/CLAUDE.md | Removes direct .github/ references and points users to install AI assets via coreex-ai. |
| src/CoreEx.Template/content/CoreEx.Core/AGENTS.md | Updates AI guidance, but currently contains duplicated sections and references assets not installed by coreex-ai. |
| src/CoreEx.Template/content/CoreEx.Ai/.template.config/template.json | Defines the new template and --app-folder parameter + conditional processing. |
| consumer-instructions/.github/instructions/coreex.instructions.md | Introduces canonical repo-wide CoreEx instruction file replacing copilot-instructions.md emission. |
| .github/skills/solution-scaffolder/SKILL.md | Updates skill prerequisites and cross-links coreex-ai as the AI-asset installer. |
Comments suppressed due to low confidence (1)
src/CoreEx.Template/content/CoreEx.Core/AGENTS.md:99
Project Structure/Feature Configuration/Relevant Docsappears duplicated: the document repeats from this separator to the end, which will confuse consumers and makes the template output unnecessarily long.
---
## Project Structure
</details>
replaces: 'app-folder' is a raw text substitution; the old computed symbol name 'app-folder-enabled' contains the 'app-folder' substring, so providing --app-folder backend would rewrite it to 'backend-enabled' before the template engine could evaluate the #if conditional. Rename the computed symbol to 'hasAppFolder' (no overlap) to fix the substitution-before-evaluation bug. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…aims - Insert step 3 'Install AI workflow assets' (dotnet new coreex-ai) before the coreex scaffold step; includes monorepo --app-folder example. - Remove false claim that coreex emits .github/ and .claude/ (it no longer does). - Update step 6 'Open your IDE' to reflect AI context comes from coreex-ai. - Renumber steps: 3→4 (scaffold), 4→5 (infra), 5→6 (IDE), 6-8→7-9 (hosts), 9→10 (test). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…upport Add .claude/commands/coreex-expert.md and .claude/commands/coreex-docs-sync.md to the coreex-ai generated output so /coreex-expert and /coreex-docs-sync are available to Claude Code users after running dotnet new coreex-ai. Previously only coreex-bootstrap installed these; coreex-ai was missing them despite AGENTS.md referencing /coreex-docs-sync. Update README and csproj comments to reflect .claude/ is now part of coreex-ai output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ructions.md at pack time Eliminate consumer-instructions/.github/instructions/coreex.instructions.md as a maintained source file. The content was identical to copilot-instructions.md with only a YAML frontmatter block prepended — a drift risk. Instead, InjectAppFolderConditional now accepts an optional PrependFrontmatter parameter. When true, it prepends the standard .instructions.md frontmatter (applyTo and description) before processing the applyTo: conditional injection. The coreex-ai pack target now sources coreex.instructions.md directly from copilot-instructions.md with PrependFrontmatter=true, giving both templates a single source of truth. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Project Structure, Feature Configuration, and Relevant Docs were each emitted twice due to the new AI-assistance block being prepended without removing the original copies. Remove the second duplicate set. Also dropped the unconditional 'See .github/docs/coreex/layers.md' note from Project Structure -- that path only exists after running dotnet new coreex-ai, and is already covered by the qualified Relevant Docs section. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tstrap .github/skills/coreex-docs-sync/ (SKILL.md + README.md) was present in the CoreEx repo but was not copied into either template pack. GitHub Copilot uses skills for slash-command equivalents so Copilot users had no access to coreex-docs-sync while Claude Code users did (via .claude/commands/). Add the skill to both coreex-bootstrap (Bootstrap _AiFile group) and coreex-ai (Ai Copy batch) so both toolchains get parity on coreex-docs-sync. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…and README - getting-started.md: fix 'step 6' -> 'step 7' reference after renumbering; use generic 'backend' as --app-folder example instead of the solution name - README.md: shorten overview table template labels for readability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
D - applyTo prefix: InjectAppFolderConditional now preserves each instruction
file's original glob specificity by prefixing with app-folder/ rather than
replacing wholesale with app-folder/**. e.g. '**/*Validator*.cs' becomes
'app-folder/**/*Validator*.cs' when --app-folder is supplied.
E - null guard: Directory.CreateDirectory is now guarded with
!string.IsNullOrEmpty(destDir) to avoid ArgumentException when
Path.GetDirectoryName returns null for a root-only filename.
F - stale comment: csproj line 96 still referenced the deleted
coreex.instructions.md file; updated to show copilot-instructions.md.
A - getting-started.md: step 3 now says 'from the repo root' instead of
'from inside your solution folder' to avoid ambiguity.
B - AGENTS.md Relevant Docs: qualifier changed from 'After running
dotnet new coreex-ai' (which doesn't emit docs) to 'After running
/coreex-docs-sync (or using coreex-bootstrap)'.
C - AGENTS.md version-bump note: split into two bullets clarifying that
re-running dotnet new coreex-ai updates instruction/prompt files while
/coreex-docs-sync refreshes the docs cache.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e-pack.ps1 - Delete validate-template-pack.sh (redundant; pwsh is cross-platform) - Rewrite validate-template-pack.ps1 with 10 parameterised scenarios: - coreex-ai single-repo and monorepo (file presence + content assertions) - coreex with Postgres, SqlServer, no-data-provider, no-refdata, domain-driven - coreex-api, coreex-relay, coreex-subscribe (file presence + dotnet build) - Add template-validation job to CI.yml (ubuntu-latest, separate from main build/test) - Add tools/** to CI trigger paths so template changes trigger the job Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add has-data-provider computed symbol (data-provider != 'None') to all 4 template.json files to replace broken !implement-none-data negation. The dotnet template engine expression parser mishandles negation of computed symbols with hyphens in their names; using a positive symbol avoids the issue entirely. - Replace all !implement-none-data usages with has-data-provider across CoreEx.Core (slnx, README, AGENTS, Test.Common.csproj), CoreEx.Api (AGENTS), and CoreEx.Subscribe (AGENTS). - Remove global using app-name.Contracts from Domain/GlobalUsing.cs. The template Contracts project has no source types so the namespace does not exist and the import causes CS0246 when domain-driven=true. - Move validate-template-pack.ps1 temporary test root from artifacts/ (deep inside the worktree, ~181-char base path) to \C:\Users\ERIC~1.SIB\AppData\Local\Temp/cxval-<timestamp> (~43 chars). The repo worktree path alone is ~135 chars; adding scenario subdirs and runtime DLL paths such as runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll pushed total lengths past Windows MAX_PATH (260), causing MSB3021/MSB3030 copy errors that only appeared when building inside the script. All 10 validation scenarios now pass locally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated artifact upload path from stale artifacts/template-validation-test-* to runner.temp/cxval-* (GitHub Actions runner.temp context var). Updated script to prefer RUNNER_TEMP env var when set (CI context), falling back to GetTempPath() for local dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All file-system paths in MSBuild task attributes, ItemGroup Include patterns, and PackagePath values now use forward slashes (/), which are valid on both Windows and Linux. Previously, backslash-only paths caused the CopyTemplateAiContext and GenerateVersionedTemplateJson targets to silently produce no output on Linux, resulting in NU5026 (DLL not found) during CI pack. Also uses System.IO.Path.Combine for the RoslynCodeTaskFactory AssemblyFile path to be OS-safe. Local validation: 10/10 scenarios pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GeneratePackageOnBuild=true (inherited from src/Directory.Build.props) means dotnet build -c Release already produces the nupkg. dotnet pack on a clean runner (no prior bin/ output) never triggers the C# compiler via the multi-TF inner-build code path, causing NU5026. Building first is the correct fix and preserves the original single-command workflow intent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- validate-template-pack.ps1: remove UTF-8 BOM (breaks shebang on Linux/CI) - validate-template-pack.ps1: replace -like with .Contains() for content checks (-like treats * and ? as wildcards; needles like applyTo: "**" would match incorrectly) - validate-template-pack.ps1: add null guard for FileContains before .Keys iteration - README.md: correct --app-folder description to match implementation (prefixes original applyTo pattern per file, e.g. backend/**/Controllers/**/*.cs, not a blanket replace with backend/**) - template.json: use single-quoted empty string in computed symbol expression for consistency with other templates in the pack Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ence AGENTS.md provides AI agents pointed at the CoreEx URL with: 1. Structured CoreEx summary (capabilities, architecture fit, decision guidance) so agents can answer 'what is CoreEx / does it fit here?' without parsing the README 2. Consumer cold-start procedure: detect missing coreex AI context, ask the monorepo question, then install CoreEx.Template and run coreex-ai with the right flags CLAUDE.md is a single @AGENTS.md import so Claude Code delegates to the same content — no duplication, no drift risk. README.md AI section gets a one-line pointer to AGENTS.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
coreex-ai emits only markdown AI assets — no project files that need a version token. The replaces: coreex-version substitution would corrupt manifest key names in the emitted skill and command files (SKILL.md, coreex-docs-sync.md, agents README) where coreex-version is a YAML key, not a version placeholder. The coreex template legitimately uses this symbol (Directory.Packages.props). The coreex-ai template does not need it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without --force, dotnet new refuses to overwrite existing files, so the documented 'update AI assets after version bump' workflow would silently fail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
spruit-avanade
approved these changes
Jun 29, 2026
spruit-avanade
left a comment
Collaborator
There was a problem hiding this comment.
~.
Ya...___|__..aab . .
Y88a Y88o Y88a ( )
Y88b Y88b Y88b `.oo'
:888 :888 :888 ( (`-'
.---. d88P d88P d88P `.`.
/ .-._) d8P'"""|"""'-Y8P `.`.
( (`._) .-. .-. |.-. .-. .-. ) )
\ `---( O )( O )( O )( O )( O )-' /
`. `-' `-' `-' `-' `-' .' CJ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SHIP IT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #148
Introduces a new
coreex-aidotnet new template that installs CoreEx AI workflow assets independently of solution scaffolding, and removes.github/AI artefact emission from thecoreextemplate. Resolves the lifecycle mismatch and monorepo placement problems described in the issue.Changes
New:
coreex-aitemplate (src/CoreEx.Template/content/CoreEx.Ai/)dotnet new coreex-aitemplate — emits only.github/AI workflow assets: instructions, prompts, agents, skills, and Claude Code commands. Zero code scaffolding.--app-folder <name>parameter for monorepo support: each instruction file'sapplyTo:pattern is prefixed with the subfolder path at pack time (e.g.**/Controllers/**/*.cs→backend/**/Controllers/**/*.cs), preserving per-file instruction targeting while scoping Copilot context to that subtree. Absent → originalapplyTo:patterns unchanged (single-repo default).coreex.instructions.md(properly scoped.instructions.mdfile) rather thancopilot-instructions.md..claude/commands/coreex-expert.mdand.claude/commands/coreex-docs-sync.mdfor Claude Code support..github/skills/coreex-docs-sync/for GitHub Copilot/coreex-docs-syncskill.Modified:
CoreEx.Template.csprojInjectAppFolderConditionalMSBuild inline task: wrapsapplyTo:frontmatter in<!-- #if hasAppFolder -->conditionals at pack time and prefixes the original pattern withapp-folder/.CopyTemplateAiContexttarget: Bootstrap receives full AI asset set (instructions, prompts, agents, docs); CoreEx.Ai receives instructions (transformed), prompts, agents, skills, and Claude commands — no docs; CoreEx.Core (coreex) receives no.github/assets./separators for Linux/Windows cross-platform compatibility.GenerateVersionedTemplateJsonstampsCOREEX_VERSIONinto template.json files at pack time.New:
consumer-instructions/.github/instructions/coreex.instructions.mdCanonical scoped instruction file generated at pack time from
consumer-instructions/.github/copilot-instructions.mdwithapplyTo:frontmatter prepended. Used by both the CoreEx repo and as thecoreex-aitemplate source.Modified: template content —
CoreEx.Core/AGENTS.mdandCoreEx.Core/CLAUDE.md.github/file references (those files are no longer emitted bycoreex).## Project Structuresections.dotnet new coreex-aiat repo root to install AI workflow assets.New:
AGENTS.mdandCLAUDE.mdat repository rootAGENTS.md: AI-first entry point for the Avanade/CoreEx repo — structured CoreEx summary (capabilities, architecture fit, decision guidance) plus a consumer cold-start procedure: detect missing.github/instructions/coreex.instructions.md, ask the monorepo question, then rundotnet new install CoreEx.Template && dotnet new coreex-ai [--app-folder <dir>]from the repo root.CLAUDE.md: single@AGENTS.mdimport — delegates toAGENTS.mdwith no content drift.README.mdAI section: one-line pointer toAGENTS.md.Modified:
tools/validate-template-pack.ps1FilesPresent,FilesAbsent,FileContains, andBuildassertions.coreex-aiscenarios (single-repo and monorepo) verify file presence andapplyTo:content.coreex/coreex-api/coreex-relay/coreex-subscribescenarios cover all major parameter combinations and rundotnet buildon generated solutions.dotnet build(notdotnet pack) —GeneratePackageOnBuild=trueinDirectory.Build.propsmeans build already produces the nupkg;dotnet packalone skips compilation on a clean runner.#!/usr/bin/env pwshshebang on Linux)..Contains()instead of-like(avoids wildcard interpretation of*in assertion needles likeapplyTo: "**").validate-template-pack.sh.New:
.github/workflows/CI.yml—template-validationjobubuntu-latest, triggered on changes tosrc/CoreEx.Template/**ortools/validate-template-pack.ps1.Modified:
src/CoreEx.Template/README.mdcoreex-ailisted first).coreex-ai" section with full usage docs.--app-folderbehaviour documented to match implementation (prefix original patterns, not replace).Modified:
docs/getting-started.mddotnet new coreex-ai) with monorepo example.Modified:
.github/skills/solution-scaffolder/SKILL.mdcoreex-ai.Bug fixes applied during review
replaces: "coreex-version"removed fromcoreex-aitemplate: the symbol would have corrupted manifest key names (coreex-version: <version>) in emitted skill and command files.coreex-aiemits no project files that need version token substitution.hasAppFolderrenamed fromapp-folder-enabled: the original name conflicted with theapp-folderparameter'sreplaces:substitution.Usage
Single-repo (default):
Monorepo — CoreEx application under
backend/:Typical new-project workflow: