* fix(agent-context): discover nested plan.md in scoped layouts (#3024) The agent-context updater only looked for plan.md one level deep (specs/*/plan.md), so scoped layouts created via SPECIFY_FEATURE_DIRECTORY (specs/<scope>/<feature>/plan.md) were never picked up and no plan reference was written into the context file. Recurse into specs/ in both the bash (rglob) and PowerShell (-Recurse) scripts. In the PowerShell script, also replace [System.IO.Path]::GetRelativePath, which is .NET Core 2.1+ only and throws under Windows PowerShell 5.1 (.NET Framework); the exception was swallowed by the surrounding try/catch, leaving the plan path empty on 5.1 even when a plan was found. Compute the project-relative path by stripping the root prefix instead. Add regression tests for both scripts covering nested discovery. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix(agent-context): guard mtime plan discovery against symlink escape Address Copilot review feedback on #3301: - bash updater: the mtime fallback filtered candidates lexically via relative_to() on the *unresolved* path, so a plan reached through a specs/ symlink pointing outside the project could be selected and emit an in-project-looking path. Resolve each candidate and keep only those whose resolved path stays under root before picking the newest. - test: the nested-plan PowerShell regression targets a Windows PowerShell 5.1 (.NET Framework) failure mode, but ran whatever POWERSHELL resolved to (prefers pwsh). Prefer powershell.exe on Windows so the 5.1-only compat fix is actually exercised. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(agent-context): note recursive plan.md discovery in update command Auto-detection now recurses (`specs/**/plan.md`) to support nested scoped layouts created via SPECIFY_FEATURE_DIRECTORY (#3024). The update command doc still described the old one-level `specs/*/plan.md` glob, which could mislead users troubleshooting plan detection. Addresses Copilot review feedback on PR #3301. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1.7 KiB
description
| description |
|---|
| Refresh the managed Spec Kit section in coding agent context file(s) |
Update Coding Agent Context
Refresh the managed Spec Kit section inside the active coding agent's context/instruction file (e.g. CLAUDE.md, .github/copilot-instructions.md, AGENTS.md).
Behavior
The script reads the agent-context extension config at
.specify/extensions/agent-context/agent-context-config.yml to discover:
context_file— the path of the coding agent context file to manage.context_files— optional project-relative paths for multiple coding agent context files. When non-empty, the script updates each listed file and the list takes precedence overcontext_file.context_markers.start/.end— the delimiters surrounding the managed section. Defaults to<!-- SPECKIT START -->and<!-- SPECKIT END -->when the field is missing.
It then creates, replaces, or appends the managed block so that the section points at the most recent plan path when one can be discovered (any plan.md under specs/, including nested scoped layouts such as specs/<scope>/<feature>/plan.md).
If context_files and context_file are empty, the command reports nothing to do and exits successfully. Context file paths must stay project-relative; absolute paths, Windows drive paths, backslash separators, and .. path segments are rejected.
Execution
- Bash:
.specify/extensions/agent-context/scripts/bash/update-agent-context.sh [plan_path] - PowerShell:
.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 [plan_path]
When plan_path is omitted, the script auto-detects the most recently modified specs/**/plan.md (searched recursively, so nested scoped layouts are discovered).