Skip to content

Commit c82187a

Browse files
authored
Merge pull request #11 from posit-dev/merge/1.109.0
Merge upstream changes for 1.109.0
2 parents 5576829 + dcbdf9f commit c82187a

File tree

761 files changed

+67747
-14426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

761 files changed

+67747
-14426
lines changed

.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.github/copilot-instructions.md

.esbuild.ts

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66
import * as watcher from '@parcel/watcher';
77
import * as esbuild from 'esbuild';
88
import * as fs from 'fs';
9-
import { copyFile, mkdir } from 'fs/promises';
9+
import { copyFile, mkdir, readdir, rename } from 'fs/promises';
1010
import { glob } from 'glob';
1111
import * as path from 'path';
1212

1313
const REPO_ROOT = import.meta.dirname;
1414
const isWatch = process.argv.includes('--watch');
1515
const isDev = process.argv.includes('--dev');
1616
const isPreRelease = process.argv.includes('--prerelease');
17+
const generateSourceMaps = process.argv.includes('--sourcemaps');
18+
const sourceMapOutDir = './dist-sourcemaps';
1719

1820
const baseBuildOptions = {
1921
bundle: true,
2022
logLevel: 'info',
2123
minify: !isDev,
2224
outdir: './dist',
23-
sourcemap: isDev ? 'linked' : false,
25+
// In dev mode, use linked source maps for debugging.
26+
// With --sourcemaps flag, generate external source maps (no sourceMappingURL comment in output).
27+
sourcemap: isDev ? 'linked' : (generateSourceMaps ? 'external' : false),
2428
sourcesContent: false,
2529
treeShaking: true
2630
} satisfies esbuild.BuildOptions;
@@ -283,6 +287,42 @@ const typeScriptServerPluginBuildOptions = {
283287
]
284288
} satisfies esbuild.BuildOptions;
285289

290+
/**
291+
* Moves all .map files from the output directories to a separate source maps directory.
292+
* This keeps source maps out of the packaged extension while making them available for upload.
293+
*/
294+
async function moveSourceMapsToSeparateDir(): Promise<void> {
295+
if (!generateSourceMaps) {
296+
return;
297+
}
298+
299+
const outputDirs = [
300+
'./dist',
301+
'./node_modules/@vscode/copilot-typescript-server-plugin/dist',
302+
];
303+
304+
await mkdir(sourceMapOutDir, { recursive: true });
305+
306+
for (const dir of outputDirs) {
307+
try {
308+
const files = await readdir(dir);
309+
for (const file of files) {
310+
if (file.endsWith('.map')) {
311+
const sourcePath = path.join(dir, file);
312+
// Prefix with directory name to avoid collisions
313+
const prefix = dir === './dist' ? '' : 'ts-plugin-';
314+
const destPath = path.join(sourceMapOutDir, prefix + file);
315+
await rename(sourcePath, destPath);
316+
console.log(`Moved source map: ${sourcePath} -> ${destPath}`);
317+
}
318+
}
319+
} catch (error) {
320+
// Directory might not exist in some build configurations
321+
console.warn(`Could not process directory ${dir}:`, error);
322+
}
323+
}
324+
}
325+
286326
async function main() {
287327
if (!isDev) {
288328
applyPackageJsonPatch(isPreRelease);
@@ -368,6 +408,9 @@ async function main() {
368408
esbuild.build(typeScriptServerPluginBuildOptions),
369409
esbuild.build(webviewBuildOptions),
370410
]);
411+
412+
// Move source maps to separate directory so they're not packaged with the extension
413+
await moveSourceMapsToSeparateDir();
371414
}
372415
}
373416

.github/copilot-instructions.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ You MUST check compilation output before running ANY script or declaring work co
7575
- **`intents/`**: Chat participant/slash command implementations
7676
- **`prompts/`**: Prompt engineering and template system
7777
- **`prompt/`**: Common prompt utilities
78-
- **`relatedFiles/`**: Related file discovery and context gathering
7978
- **`typescriptContext/`**: TypeScript-specific context and analysis
8079

8180
**Search & Discovery:**
@@ -275,7 +274,7 @@ The extension uses numerous proposed VS Code APIs for advanced functionality:
275274
- **GitHub**: Authentication and API access
276275
- **Azure**: Cloud services and experimentation
277276
- **OpenAI**: Language model API
278-
- **Anthropic**: Claude model integration
277+
- **Anthropic**: Claude model integration - See **[src/extension/agents/claude/AGENTS.md](../src/extension/agents/claude/AGENTS.md)** for complete Claude Agent SDK integration documentation including architecture, components, and registries
279278
- **Telemetry**: Usage analytics and performance monitoring
280279

281280
## Development Workflow
@@ -302,7 +301,6 @@ The extension uses numerous proposed VS Code APIs for advanced functionality:
302301
- **Context resolution changes**: Check `src/extension/context/` and `src/extension/typescriptContext/`
303302
- **Prompt engineering**: Update `src/extension/prompts/` and `src/extension/prompt/`
304303
- **Intent detection**: Modify `src/extension/intents/` for user intent classification
305-
- **Related files discovery**: Edit `src/extension/relatedFiles/` for context gathering
306304

307305
**Search & Discovery:**
308306
- **Search functionality**: Update `src/extension/search/` for general search
@@ -339,5 +337,9 @@ The extension uses numerous proposed VS Code APIs for advanced functionality:
339337
This extension is a complex, multi-layered system that provides comprehensive AI assistance within VS Code. Understanding the service architecture, contribution system, and separation between platform and extension layers is crucial for making effective changes.
340338

341339
## Best Practices
342-
- Use services and dependency injection whenever possible instead of using node or vscode APIs directly. For example, use `IFileSystemService` instead of node's `fs`.
340+
- Use services and dependency injection over VS Code extension APIs when possible:
341+
- Use `IFileSystemService` instead of Node's `fs` or `vscode.workspace.fs`
342+
- Use `ILogService` instead of `console.log`
343+
- Look for existing `I*Service` interfaces before reaching for raw APIs
344+
- **Why**: Enables unit testing without VS Code host, supports simulation tests, provides cross-platform abstractions (Node vs web), and adds features like caching and size limits
343345
- Always use the URI type instead of using string file paths. There are many helpers available for working with URIs.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.vscode-test-web/
44
node_modules/
55
dist/
6+
dist-sourcemaps/
67

78
# created by simulation
89
.simulation

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,7 @@
149149
"eslint": "warning"
150150
},
151151
"githubPullRequests.codingAgent.enabled": true,
152-
"githubPullRequests.codingAgent.uiIntegration": true
153-
}
152+
"githubPullRequests.codingAgent.uiIntegration": true,
153+
"python-envs.defaultEnvManager": "ms-python.python:system",
154+
"python-envs.pythonProjects": [],
155+
}

.vscodeignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ assets/walkthroughs/**
2020
!dist/suggestionsPanelWebview.js
2121
!node_modules/@vscode/copilot-typescript-server-plugin/package.json
2222
!node_modules/@vscode/copilot-typescript-server-plugin/dist/*.js
23-
!node_modules/@github/copilot/**/package.json
2423
node_modules/@github/copilot/index.js
24+
node_modules/@github/copilot/clipboard/**
25+
node_modules/@github/copilot/prebuilds/**
26+
node_modules/@github/copilot/sharp/**
27+
!node_modules/@github/copilot/package.json
28+
!node_modules/@github/copilot/sdk/**/package.json
2529
!node_modules/@github/copilot/sdk/*.js
2630
!node_modules/@github/copilot/sdk/worker/*.js
27-
!node_modules/@github/copilot/node_modules/**/*.js
31+
!node_modules/@github/copilot/sdk/sharp/**
2832
!CHANGELOG.md
2933
!README.md
3034
!package.json

assets/agents/Plan.agent.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

assets/prompts/init.prompt.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: init
3+
description: Generate or update workspace instructions file for AI coding agents
4+
argument-hint: Optionally specify a focus area or pattern to document for agents
5+
agent: agent
6+
---
7+
Related skill: `agent-customization`.
8+
9+
Generate or update workspace instructions (`.github/copilot-instructions.md` as first choice, or `AGENTS.md` if it is already present) for guiding AI coding agents in this workspace.
10+
11+
## Discovery
12+
13+
Search for existing AI conventions using this glob pattern: `**/{.github/copilot-instructions.md,AGENT.md,AGENTS.md,CLAUDE.md,.cursorrules,.windsurfrules,.clinerules,.cursor/rules/**,.windsurf/rules/**,.clinerules/**,README.md}`
14+
15+
Then, start a subagent to research essential knowledge that helps an AI agent be immediately productive. Only include sections the workspace benefits from—skip any that don't apply:
16+
17+
```markdown
18+
# Project Guidelines
19+
20+
## Code Style
21+
{Language and formatting preferences - reference key files that exemplify patterns}
22+
23+
## Architecture
24+
{Major components, service boundaries, data flows, the "why" behind structural decisions}
25+
26+
## Build and Test
27+
{Commands to install, build, test - agents will attempt to run these automatically}
28+
29+
## Project Conventions
30+
{Patterns that differ from common practices - include specific examples from the codebase}
31+
32+
## Integration Points
33+
{External dependencies and cross-component communication}
34+
35+
## Security
36+
{Sensitive areas and auth patterns}
37+
```
38+
39+
## Guidelines
40+
41+
- If `.github/copilot-instructions.md`/`AGENTS.md` exists, merge intelligently—preserve valuable content while updating outdated sections
42+
- If `AGENTS.md` exists, prefer updating it; for monorepos, use nested files per package (closest file to edited code wins)
43+
- Write concise, actionable instructions (~20-50 lines) using markdown structure
44+
- Link specific examples from the codebase when describing patterns
45+
- Reference key files/directories that exemplify important patterns
46+
- Avoid generic advice ("write tests", "handle errors")—focus on THIS project's specific approaches
47+
- Document only discoverable patterns, not aspirational practices
48+
- List build/test commands explicitly—agents will attempt to run them automatically
49+
50+
Update `.github/copilot-instructions.md`/`AGENTS.md`, then ask for feedback on unclear or incomplete sections to iterate.

assets/prompts/plan.prompt.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: plan
3+
description: Research and plan with the Plan agent
4+
agent: Plan
5+
argument-hint: Describe what you want to plan or research
6+
---
7+
Plan my task.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: agent-customization
3+
description: 'Create, update, review, fix, or debug VS Code agent customization files (.instructions.md, .prompt.md, .agent.md, SKILL.md, copilot-instructions.md, AGENTS.md). Use for: saving coding preferences; troubleshooting why instructions/skills/agents are ignored or not invoked; configuring applyTo patterns; defining tool restrictions; creating custom agent modes or specialized workflows; packaging domain knowledge; fixing YAML frontmatter syntax.'
4+
---
5+
6+
# Agent Customization
7+
8+
## Decision Flow
9+
10+
| Primitive | When to Use |
11+
|-----------|-------------|
12+
| Workspace Instructions | Always-on, applies everywhere in the project |
13+
| File Instructions | Explicit via `applyTo` patterns, or on-demand via `description` |
14+
| MCP | Integrates external systems, APIs, or data |
15+
| Custom Agents | Subagents for context isolation, or multi-stage workflows with tool restrictions |
16+
| Prompts | Single focused task with parameterized inputs |
17+
| Skills | On-demand workflow with bundled assets (scripts/templates) |
18+
19+
## Quick Reference
20+
21+
Consult the reference docs for templates, domain examples, advanced frontmatter options, asset organization, anti-patterns, and creation checklists.
22+
23+
| Type | File | Location | Key Field | Reference |
24+
|------|------|----------|-----------|---------|
25+
| Workspace Instructions | `copilot-instructions.md`, `AGENTS.md` | `.github/` or root | N/A (always applies) | [Link](./primitives/workspace-instructions.md) |
26+
| File Instructions | `*.instructions.md` | `.github/instructions/` | `applyTo` (explicit), `description` (on-demand) | [Link](./primitives/instructions.md) |
27+
| Prompts | `*.prompt.md` | `.github/prompts/` | `description` (user-invoked) | [Link](./primitives/prompts.md) |
28+
| Custom Agents | `*.agent.md` | `.github/agents/` | `description` (on-demand), `infer` (subagent) | [Link](./primitives/agents.md) |
29+
| Skills | `SKILL.md` | `.github/skills/<name>/` | `description` (on-demand) | [Link](./primitives/skills.md) |
30+
31+
**User-level**: `{{USER_PROMPTS_FOLDER}}/` (*.prompt.md, *.instructions.md, *.agent.md; not skills)
32+
Customizations roam with user's settings sync
33+
34+
## Creation Process
35+
36+
If you need to explore or validate patterns in the codebase, use a read-only subagent. If the ask-questions tool is available, use it to interview the user and clarify requirements.
37+
38+
Follow these steps when creating any customization file.
39+
40+
### 1. Determine Scope
41+
42+
Ask the user where they want the customization:
43+
- **Workspace**: For project-specific, team-shared customizations → `.github/` folder
44+
- **User profile**: For personal, cross-workspace customizations → `{{USER_PROMPTS_FOLDER}}/`
45+
46+
### 2. Choose the Right Primitive
47+
48+
Use the Decision Flow above to select the appropriate file type based on the user's need.
49+
50+
### 3. Create the File
51+
52+
Create the file directly at the appropriate path:
53+
- Use the location tables in each reference file
54+
- Include required frontmatter as needed
55+
- Add the body content following the templates
56+
57+
### 4. Validate
58+
59+
After creating:
60+
- Confirm the file is in the correct location
61+
- Verify frontmatter syntax (YAML between `---` markers)
62+
- Check that `description` is present and meaningful
63+
64+
## Edge Cases
65+
66+
**Instructions vs Skill?** Does this apply to *most* work, or *specific* tasks? Most → Instructions. Specific → Skill.
67+
68+
**Skill vs Prompt?** Multi-step workflow with bundled assets → Skill. Single focused task with inputs → Prompt.
69+
70+
**Skill vs Custom Agent?** Same capabilities for all steps → Skill. Need context isolation (subagent returns single output) or different tool restrictions per stage → Custom Agent.

0 commit comments

Comments
 (0)