Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions .github/agents/pr-review.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ All PR review tracking artifacts reside in `.copilot-tracking/pr/review/{{normal
review/
{{normalized_branch_name}}/
in-progress-review.md # Living PR review document
pr-reference.xml # Generated via scripts/dev-tools/pr-ref-gen.sh
pr-reference.xml # Generated via pr-ref-gen.sh (see script location in Phase 1)
handoff.md # Finalized PR comments and decisions
```

Expand Down Expand Up @@ -148,7 +148,7 @@ Repeat phases as needed when new information or user direction warrants deeper a

### Phase 1: Initialize Review

Key tools: `git`, `scripts/dev-tools/pr-ref-gen.sh`, workspace file operations
Key tools: `git`, `pr-ref-gen.sh` (with fallback resolution), workspace file operations

#### Step 1: Normalize Branch Name

Expand All @@ -160,7 +160,47 @@ Create the PR tracking directory `.copilot-tracking/pr/review/{{normalized_branc

#### Step 3: Generate PR Reference

Generate `pr-reference.xml` using `./scripts/dev-tools/pr-ref-gen.sh --output "{{tracking_directory}}/pr-reference.xml"`. Pass additional flags such as `--base` when the user specifies one.
Locate and execute the PR reference script using environment-specific fallback patterns.

**For Unix-like shells (bash/zsh)**:

```bash
# Try local first, then extension
SCRIPT_PATH="./scripts/dev-tools/pr-ref-gen.sh"
if [ ! -f "$SCRIPT_PATH" ]; then
SCRIPT_PATH=$(find ~/.vscode*/extensions -name "pr-ref-gen.sh" 2>/dev/null | head -1)
fi

Comment thread
katriendg marked this conversation as resolved.
if [ -z "$SCRIPT_PATH" ] || [ ! -f "$SCRIPT_PATH" ]; then
echo "Error: pr-ref-gen.sh not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions." >&2
exit 1
fi

"$SCRIPT_PATH" --output "{{tracking_directory}}/pr-reference.xml"

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{tracking_directory}} is used as an output path placeholder here, but it is not defined anywhere else in the agent. Use the explicit tracking path (e.g., .copilot-tracking/pr/review/{{normalized_branch_name}}) or define tracking_directory earlier so this command resolves deterministically.

Suggested change
"$SCRIPT_PATH" --output "{{tracking_directory}}/pr-reference.xml"
"$SCRIPT_PATH" --output ".copilot-tracking/pr/review/{{normalized_branch_name}}/pr-reference.xml"

Copilot uses AI. Check for mistakes.
```

**For Windows PowerShell**:

```powershell
# Try local first, then extension
$ScriptPath = "./scripts/dev-tools/Generate-PrReference.ps1"
if (-not (Test-Path $ScriptPath)) {
$ScriptPath = Get-ChildItem -Path "$HOME/.vscode*/extensions" -Filter "Generate-PrReference.ps1" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
}

if (-not $ScriptPath) {
Write-Error "Error: Generate-PrReference.ps1 not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions."
exit 1
}

# Generate reference to default location
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PowerShell snippet passes -BaseBranch "${input:baseBranch}", but this agent file does not declare any ${input:...} variables. As written, it will likely pass the literal string and fail branch resolution. Only pass -BaseBranch when the user explicitly provided one, otherwise omit it and rely on the script’s default base branch behavior; also quote $ScriptPath when invoking pwsh -File to avoid issues with spaces in paths.

Suggested change
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"
pwsh -File "$ScriptPath"

Copilot uses AI. Check for mistakes.

# Move generated file to tracking directory
Move-Item -Path ".copilot-tracking/pr/pr-reference.xml" -Destination "{{tracking_directory}}/pr-reference.xml" -Force

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{tracking_directory}} is referenced in the Move-Item destination, but the agent never defines that placeholder/value. Use the explicit .copilot-tracking/pr/review/{{normalized_branch_name}} path (or define tracking_directory) so the generated pr-reference.xml is moved to the intended location.

Suggested change
Move-Item -Path ".copilot-tracking/pr/pr-reference.xml" -Destination "{{tracking_directory}}/pr-reference.xml" -Force
Move-Item -Path ".copilot-tracking/pr/pr-reference.xml" -Destination ".copilot-tracking/pr/review/{{normalized_branch_name}}/pr-reference.xml" -Force

Copilot uses AI. Check for mistakes.
```

Pass additional flags such as `--base-branch` (bash) or `-BaseBranch` (PowerShell) when the user specifies one.

#### Step 4: Seed Tracking Document

Expand Down
42 changes: 41 additions & 1 deletion .github/instructions/ado-create-pull-request.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,46 @@ Git operations via `run_in_terminal`:

Workspace utilities: `list_dir`, `read_file`, `grep_search`

**Script path resolution**: Use environment-specific fallback patterns.

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file now introduces script fallback resolution below, but the earlier Tooling bullets still instruct running scripts/dev-tools/pr-ref-gen.sh ... directly. To avoid conflicting guidance, update the Tooling bullet list to reference the new script path resolution (or remove the direct-path bullet).

Suggested change
**Script path resolution**: Use environment-specific fallback patterns.
**Script path resolution**: Use environment-specific fallback patterns instead of hardcoding `scripts/dev-tools/pr-ref-gen.sh`. If earlier instructions mention running `scripts/dev-tools/pr-ref-gen.sh` directly, treat this section as the authoritative guidance and use the resolved `SCRIPT_PATH` variable instead.

Copilot uses AI. Check for mistakes.

**For Unix-like shells (bash/zsh)**:

```bash
# Try local first, then extension
SCRIPT_PATH="./scripts/dev-tools/pr-ref-gen.sh"
if [ ! -f "$SCRIPT_PATH" ]; then
SCRIPT_PATH=$(find ~/.vscode*/extensions -name "pr-ref-gen.sh" 2>/dev/null | head -1)
fi

if [ -z "$SCRIPT_PATH" ] || [ ! -f "$SCRIPT_PATH" ]; then
echo "Error: pr-ref-gen.sh not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions." >&2
exit 1
fi

"$SCRIPT_PATH" --base-branch "${input:baseBranch}" --output pr-reference.xml

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bash fallback snippet writes the output to pr-reference.xml in the current working directory. Later phases expect pr-reference.xml to exist inside the planning directory under .copilot-tracking/pr/new/<normalized-branch-name>/, so this will be missed unless the terminal happens to be in that folder. Update the --output path to target the planning directory path used by the workflow.

Suggested change
"$SCRIPT_PATH" --base-branch "${input:baseBranch}" --output pr-reference.xml
OUTPUT_DIR=".copilot-tracking/pr/new/${input:normalizedBranchName}"
mkdir -p "$OUTPUT_DIR"
"$SCRIPT_PATH" --base-branch "${input:baseBranch}" --output "$OUTPUT_DIR/pr-reference.xml"

Copilot uses AI. Check for mistakes.
```

**For Windows PowerShell**:

```powershell
# Try local first, then extension
$ScriptPath = "./scripts/dev-tools/Generate-PrReference.ps1"
if (-not (Test-Path $ScriptPath)) {
$ScriptPath = Get-ChildItem -Path "$HOME/.vscode*/extensions" -Filter "Generate-PrReference.ps1" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
}

if (-not $ScriptPath) {
Write-Error "Error: Generate-PrReference.ps1 not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions."
exit 1
}

# Generate reference to default location
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pwsh -File $ScriptPath should quote $ScriptPath (or use & $ScriptPath) so the fallback path works when the user profile or extension install path contains spaces. This makes the copy-paste snippet reliable on Windows.

Suggested change
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"
pwsh -File "$ScriptPath" -BaseBranch "${input:baseBranch}"

Copilot uses AI. Check for mistakes.

# Move generated file to PR planning directory
Move-Item -Path ".copilot-tracking/pr/pr-reference.xml" -Destination ".copilot-tracking/pr/new/{{normalized branch name}}/pr-reference.xml" -Force
```

Persist all tool output into planning files per ado-wit-planning.instructions.md.

## Tracking Directory Structure
Expand Down Expand Up @@ -367,7 +407,7 @@ Execute without presenting details to user:
3. Initialize `planning-log.md` with Phase-1 status.
4. Check if `pr-reference.xml` exists:
* If exists: Use existing file silently.
* If not exists: Generate using `scripts/dev-tools/pr-ref-gen.sh` with optional `--no-md-diff` flag if `${input:includeMarkdown}` is false.
* If not exists: Generate using script path resolution with fallback patterns (see Tooling section) with optional `--no-md-diff` flag if `${input:includeMarkdown}` is false.
5. Read complete `pr-reference.xml`. For files exceeding 2000 lines, read in 1000-2000 line chunks, capturing complete commit boundaries before advancing to the next chunk.
6. Log artifact in `planning-log.md` with status `Complete`.

Expand Down
40 changes: 39 additions & 1 deletion .github/instructions/ado-wit-discovery.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,46 @@ Add an **External References** section to work item descriptions when authoritat

**Git context** (when `${input:includeBranchChanges}` is `true` and no documents exist):

* `run_in_terminal`: Generate diff XML via `scripts/dev-tools/pr-ref-gen.sh --base-branch "${input:baseBranch}" --output "<planning-folder>/git-branch-diff.xml"`
* Sync remote first: `git fetch <remote> <branch> --prune`
* `run_in_terminal`: Generate diff XML using environment-specific fallback patterns:

**For Unix-like shells (bash/zsh)**:

```bash
# Try local first, then extension
SCRIPT_PATH="./scripts/dev-tools/pr-ref-gen.sh"
if [ ! -f "$SCRIPT_PATH" ]; then
SCRIPT_PATH=$(find ~/.vscode*/extensions -name "pr-ref-gen.sh" 2>/dev/null | head -1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly the user could have installed this as a cloned repo (somewhere) on their computer, or a submodule, etc. I think I have a for this but it might seem a little weird.

I'll post a PR with the change here in a moment but it will basically take advantage of how instruction files and their descriptions are added to the system message for all conversations. Since any custom agent or prompt that needs to reference anything out of hve-core, will have this problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR #402 may help us address the fallback correctly in case of any installation method, including Extension. We do however still need to validate the extension file path resolution works because we risk your newest instruction to also not even load if loaded through Windows/WSL install mode.

I will do a new dedicated PR for Extension to be set as extensionKind: "workspace" and changes that affect the Extension only, as I believe we still need this to be fixed.

fi

Comment thread
katriendg marked this conversation as resolved.
if [ -z "$SCRIPT_PATH" ] || [ ! -f "$SCRIPT_PATH" ]; then
echo "Error: pr-ref-gen.sh not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions." >&2
exit 1
fi

"$SCRIPT_PATH" --base-branch "${input:baseBranch}" --output "<planning-folder>/git-branch-diff.xml"
```

**For Windows PowerShell**:

```powershell
# Try local first, then extension
$ScriptPath = "./scripts/dev-tools/Generate-PrReference.ps1"
if (-not (Test-Path $ScriptPath)) {
$ScriptPath = Get-ChildItem -Path "$HOME/.vscode*/extensions" -Filter "Generate-PrReference.ps1" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
}

if (-not $ScriptPath) {
Write-Error "Error: Generate-PrReference.ps1 not found. Checked ./scripts/dev-tools and VS Code extensions under ~/.vscode*/extensions."
exit 1
}

# Generate reference to default location
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pwsh -File $ScriptPath should quote $ScriptPath (or use & $ScriptPath) to handle extension install paths that include spaces (common on Windows). Without quoting, PowerShell can split the argument and fail to launch the script.

Suggested change
pwsh -File $ScriptPath -BaseBranch "${input:baseBranch}"
pwsh -File "$ScriptPath" -BaseBranch "${input:baseBranch}"

Copilot uses AI. Check for mistakes.

# Move generated file to planning folder
Move-Item -Path ".copilot-tracking/pr/pr-reference.xml" -Destination "<planning-folder>/git-branch-diff.xml" -Force
```

**Workspace utilities**: `list_dir`, `read_file`, `grep_search` for artifact location.

Expand Down
68 changes: 42 additions & 26 deletions extension/PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ extension/
└── PACKAGING.md # This file
```

## Extension Configuration

### Extension Kind

The extension is configured with `"extensionKind": ["workspace", "ui"]` in `package.json` to support multiple execution contexts:

* **Workspace mode**: Extension runs in the workspace extension host with access to local workspace files, including scripts in `.github/` and `scripts/dev-tools/`
* **UI mode**: Extension runs in the UI extension host for scenarios where workspace access is restricted

This dual-mode configuration enables script fallback patterns where:

1. Local workspace scripts (e.g., `./scripts/dev-tools/pr-ref-gen.sh`) are used when available
2. Extension-bundled scripts fall back when workspace access is unavailable (e.g., remote development scenarios)

The configuration ensures the extension works correctly in local workspaces, devcontainers, Codespaces, and other VS Code environments.

## Prerequisites

Install the VS Code Extension Manager CLI:
Expand Down Expand Up @@ -65,11 +81,11 @@ npm run extension:prepare

The preparation script automatically:

- Discovers and registers all chat agents from `.github/agents/`
- Discovers and registers all prompts from `.github/prompts/`
- Discovers and registers all instruction files from `.github/instructions/`
- Updates `package.json` with discovered components
- Uses existing version from `package.json` (does not modify it)
* Discovers and registers all chat agents from `.github/agents/`
* Discovers and registers all prompts from `.github/prompts/`
* Discovers and registers all instruction files from `.github/instructions/`
* Updates `package.json` with discovered components
* Uses existing version from `package.json` (does not modify it)

#### Step 2: Package the Extension

Expand All @@ -94,13 +110,13 @@ pwsh ./scripts/extension/Package-Extension.ps1 -Version "1.1.0" -DevPatchNumber

The packaging script automatically:

- Uses version from `package.json` (or specified version)
- Optionally appends dev patch number for pre-release builds
- Copies required `.github` directory
- Copies `scripts/dev-tools` directory (developer utilities)
- Packages the extension using `vsce`
- Cleans up temporary files
- Restores original `package.json` version if temporarily modified
* Uses version from `package.json` (or specified version)
* Optionally appends dev patch number for pre-release builds
* Copies required `.github` directory
* Copies `scripts/dev-tools` directory (developer utilities)
* Packages the extension using `vsce`
* Cleans up temporary files
* Restores original `package.json` version if temporarily modified

### Manual Packaging (Legacy)

Expand Down Expand Up @@ -145,15 +161,15 @@ vsce publish --packagePath "$VSIX_FILE"

The `extension/.vscodeignore` file controls what gets packaged. Currently included:

- `.github/agents/**` - All custom agent definitions
- `.github/prompts/**` - All prompt templates
- `.github/instructions/**` - All instruction files
- `docs/templates/**` - Document templates used by agents (ADR, BRD, Security Plan)
- `scripts/dev-tools/**` - Developer utilities (PR reference generation)
- `package.json` - Extension manifest
- `README.md` - Extension description
- `LICENSE` - License file
- `CHANGELOG.md` - Version history
* `.github/agents/**` - All custom agent definitions
* `.github/prompts/**` - All prompt templates
* `.github/instructions/**` - All instruction files
* `docs/templates/**` - Document templates used by agents (ADR, BRD, Security Plan)
* `scripts/dev-tools/**` - Developer utilities (PR reference generation)
* `package.json` - Extension manifest
* `README.md` - Extension description
* `LICENSE` - License file
* `CHANGELOG.md` - Version history

## Testing Locally

Expand Down Expand Up @@ -243,11 +259,11 @@ See [Agent Maturity Levels](../docs/contributing/ai-artifacts-common.md#maturity

## Notes

- The `.github`, `docs/templates`, and `scripts/dev-tools` folders are temporarily copied during packaging (not permanently stored)
- `LICENSE` and `CHANGELOG.md` are copied from root during packaging and excluded from git
- Only essential extension files are included (agents, prompts, instructions, templates, dev-tools)
- Non-essential files are excluded (workflows, issue templates, agent installer, etc.)
- The root `package.json` contains development scripts for the repository
* The `.github`, `docs/templates`, and `scripts/dev-tools` folders are temporarily copied during packaging (not permanently stored)
* `LICENSE` and `CHANGELOG.md` are copied from root during packaging and excluded from git
* Only essential extension files are included (agents, prompts, instructions, templates, dev-tools)
* Non-essential files are excluded (workflows, issue templates, agent installer, etc.)
* The root `package.json` contains development scripts for the repository

---

Expand Down
1 change: 1 addition & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "hve-core",
"displayName": "HVE Core",
"extensionKind": ["workspace", "ui"],
"version": "2.0.1",
"description": "AI-powered chat agents, prompts, and instructions for hybrid virtual environments",
"publisher": "ise-hve-essentials",
Expand Down
Loading