fix(vscode): batch instructions honors nested strategy - #260
Open
dsk-dev-ai wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the VS Code extension’s multi-root “Batch Instructions” command to correctly honor strategy: "nested" from agentrc.config.json, aligning batch behavior with the single-root nested instructions flow.
Changes:
- Branch batch generation per workspace root into nested (
generateNestedInstructions+writeNestedInstructions) vs flat (generateCopilotInstructions+safeWriteFile). - Surface nested-generation warnings during batch runs and keep per-root wrote/skipped/failed counters.
- Add a changelog entry documenting the nested-strategy batch fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| vscode-extension/src/commands/batch.ts | Adds nested-strategy handling to batch instructions generation/writing. |
| CHANGELOG.md | Documents the nested-strategy batch instructions bug fix. |
Suppressed comments (1)
vscode-extension/src/commands/batch.ts:68
- The warning updates in the nested branch omit the workspace root prefix, so warnings from different roots can’t be attributed in the batch output.
for (const warning of nestedResult.warnings) {
reporter.update(`Warning: ${warning}`);
}
Comment on lines
+49
to
+56
| reporter.update(`[${name}] Generating nested instructions…`); | ||
| const nestedResult = await generateNestedInstructions({ | ||
| repoPath: workspacePath, | ||
| model, | ||
| onProgress: (msg) => reporter.update(msg), | ||
| detailDir, | ||
| claudeMd | ||
| }); |
|
|
||
| ### Bug Fixes | ||
|
|
||
| - **Batch Instructions honors nested strategy** — the VS Code "Batch Instructions" command now generates hub + detail files (`.agents/*.md`, optional `CLAUDE.md`) for repositories configured with `strategy: "nested"` instead of a single flat `AGENTS.md` (#58) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (3)
vscode-extension/src/commands/batch.ts:70
- Nested-strategy warnings are logged without the root prefix, which can make warnings hard to attribute in a multi-root batch run. Prefix warning updates with
[${name}]like other batch messages.
for (const warning of nestedResult.warnings) {
reporter.update(`Warning: ${warning}`);
}
vscode-extension/src/commands/batch.ts:56
- In batch mode, progress updates emitted via
onProgressdon't include the workspace root name, so messages like "Checking Copilot CLI..." / "Generating detail..." can become ambiguous when multiple roots are processed. Prefix these nested-strategy progress messages with[${name}]for consistency with the flat branch.
This issue also appears on line 68 of the same file.
const nestedResult = await generateNestedInstructions({
repoPath: workspacePath,
model,
onProgress: (msg) => reporter.update(msg),
detailDir,
claudeMd
});
vscode-extension/src/commands/batch.ts:10
- Import order in this commands folder consistently places
node:pathimmediately after thevscodeimport (e.g.,vscode-extension/src/commands/init.ts:1-2,instructions.ts:1-2). In this file,node:pathis imported after relative imports, which deviates from the local convention.
import path from "node:path";
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
Fixes #58. The VS Code Batch Instructions command (
agentrc.batchInstructions) now honorsstrategy: "nested"inagentrc.config.json. Previously it only swapped the output filename toAGENTS.mdwhile still calling the flat generation API, so nested repositories received a single flat file instead of the hub + detail structure.What changed
vscode-extension/src/commands/batch.ts— the per-root loop now branches on strategy:config.strategy === "nested"):detailDir = config.detailDir ?? ".agents"andclaudeMd = config.claudeMd ?? false.generateNestedInstructions({ repoPath, model, onProgress, detailDir, claudeMd }).writeNestedInstructions(workspacePath, result, false)— writesAGENTS.md,.agents/{slug}.md, and optionalCLAUDE.md.FileAction[]and forwardsresult.warningsto progress.generateCopilotInstructions+safeWriteFileimplementation is unchanged.The nested branch mirrors the already-shipped single-root command (
vscode-extension/src/commands/instructions.ts), reusing the same exported core services and configuration defaults. No changes topackages/core, the CLI, or any APIs.Behavior preserved
writeNestedInstructions(..., false)delegates to the samesafeWriteFileguard used by the flat path.wrote/skipped/failedper-root counters and the finalDone: … (N roots)message.agentrc.config.jsonfalls back to flat).Verification
npm run lint— cleannpm run typecheck— cleannpm test— 675 passed (31 files)npx eslint .— clean;npx tsc --noEmitintroduces no new errors;npx prettier --check— cleanFiles changed