|
| 1 | +````instructions |
1 | 2 | ```language: .vscode-copilot-instructions |
2 | 3 |
|
3 | | -You are a software engineer working on a VS Code extension called "Prompts Sync Extension" that synchronizes GitHub Copilot prompts from Git repositories. Key points about the codebase: |
| 4 | +You are a software engineer working on a VS Code extension named "Promptitude" that syncs GitHub Copilot prompts from Git repositories to the local VS Code prompts folder. |
| 5 | +**Always** ask for clarification and present your plan and reasoning before modifying code. |
| 6 | +Update the instructions below as the codebase evolves. |
| 7 | +Update the CHANGELOG.md with each significant change. |
| 8 | +Warn me about backward-incompatible changes. |
4 | 9 |
|
5 | | -1. Core Components: |
6 | | -- Main extension entry: [src/extension.ts](src/extension.ts) handles activation and command registration |
7 | | -- Sync management: [src/syncManager.ts](src/syncManager.ts) orchestrates the sync process |
8 | | -- Config handling: [src/configManager.ts](src/configManager.ts) manages extension settings |
9 | | -- Status bar: [src/statusBarManager.ts](src/statusBarManager.ts) shows sync status |
10 | | -- GitHub API: [src/utils/github.ts](src/utils/github.ts) handles repository operations |
11 | | -- File operations: [src/utils/fileSystem.ts](src/utils/fileSystem.ts) manages local file system |
| 10 | +Architecture & key files |
| 11 | +- Entry/activation: src/extension.ts – activates on startup, wires ConfigManager, StatusBarManager, SyncManager; registers commands: |
| 12 | + promptitude.syncNow • promptitude.showStatus • promptitude.openPromptsFolder • promptitude.addAzureDevOpsPAT • promptitude.clearAzureDevOpsPAT • promptitude.clearAzureDevOpsCache |
| 13 | +- Sync: src/syncManager.ts – schedules by promptitude.frequency; per-repo (url or url|branch, default main) select provider via GitProviderFactory, authenticate, fetch tree, filter, download files. Filters chatmode/, instructions/, prompts/ and .md/.txt; writes files flat to the prompts directory using the basename (last write wins). |
| 14 | +- Configuration: src/configManager.ts – reads promptitude.*; repositoryConfigs parses url|branch; getPromptsDirectory returns OS-specific path; flags: enabled, syncOnStartup, showNotifications, debug, syncChatmode, syncInstructions, syncPrompt. |
| 15 | +- Providers: src/utils/github.ts (VS Code GitHub auth with scope repo; REST branches→sha→git/trees; contents for files). src/utils/azureDevOps.ts (PATs in SecretStorage; per-organization PAT index cached in globalState; supports dev.azure.com and legacy visualstudio.com; owner encoded as organization|project|baseUrl). |
| 16 | +- Utilities/UI: src/utils/fileSystem.ts (fs ops); src/utils/notifications.ts (messages + auth flows); src/utils/logger.ts (single "Promptitude" output channel; debug gated by setting); src/statusBarManager.ts (Idle/Syncing/Success/Error + last sync time; click triggers sync). |
12 | 17 |
|
13 | | -2. Key Features: |
14 | | -- Multi-repository sync support with error handling |
15 | | -- Configurable sync frequency (startup/hourly/daily/weekly/manual) |
16 | | -- Cross-platform file path handling |
17 | | -- GitHub authentication via VS Code's built-in auth |
18 | | -- Status bar integration with sync indicators |
19 | | -- Selective sync for different prompt types (chatmode/instructions/prompt) |
| 18 | +Developer workflows |
| 19 | +- Build/package: npm install → npm run compile (or npm run watch) → npm run package (VSIX). Lint: npm run lint. Tests: npm run test. |
| 20 | +- Debug: set "promptitude.debug": true; read logs in Output → Promptitude; use Command Palette to run the commands above. Extension activates onStartupFinished. |
20 | 21 |
|
21 | | -3. Best Practices: |
22 | | -- Use TypeScript with strict type checking |
23 | | -- Follow VS Code extension guidelines |
24 | | -- Implement proper error handling and logging |
25 | | -- Use async/await for asynchronous operations |
26 | | -- Support cross-platform paths |
27 | | -- Provide clear user feedback through notifications |
28 | | -- Maintain backward compatibility |
29 | | -- Handle GitHub API rate limits |
| 22 | +Conventions & patterns (repo-specific) |
| 23 | +- No console.log. Use Logger.get('Scope').debug|info|warn|error (debug visible only when promptitude.debug = true). |
| 24 | +- Always use FileSystemManager for IO and NotificationManager for UX/auth prompts; do not duplicate provider auth logic. |
| 25 | +- Settings drive behavior; avoid hard-coded paths/branches; use ConfigManager.repositoryConfigs for url|branch parsing. |
| 26 | +- Provider code lives in GitApiManager implementations; select via GitProviderFactory.createFromUrl(). |
| 27 | +- Duplicate filenames across repos overwrite by last processed repo (flat output). Allowed file types: .md, .txt. |
30 | 28 |
|
31 | | -4. Common Tasks: |
32 | | -- File operations should use [FileSystemManager](src/utils/fileSystem.ts) |
33 | | -- GitHub API calls through [GitHubApiManager](src/utils/github.ts) |
34 | | -- Configuration changes via [ConfigManager](src/configManager.ts) |
35 | | -- Status updates using [StatusBarManager](src/statusBarManager.ts) |
36 | | -- Error logging through [Logger](src/utils/logger.ts) |
37 | | -- User notifications via [NotificationManager](src/utils/notifications.ts) |
38 | | -
|
39 | | -5. Repository Structure: |
40 | | -- Source code in `src/` with TypeScript files |
41 | | -- Configuration in `package.json` |
42 | | -- Build settings in `tsconfig.json` |
43 | | -- ESLint config in `.eslintrc.js` |
44 | | -- GitHub workflows in `.github/workflows/` |
45 | | -
|
46 | | -When suggesting code: |
47 | | -- Use TypeScript with proper type annotations |
48 | | -- Follow existing error handling patterns |
49 | | -- Consider cross-platform compatibility |
50 | | -- Include appropriate logging statements |
51 | | -- Add JSDoc comments for public APIs |
52 | | -- Handle VS Code disposal and cleanup |
53 | | -- Consider backward compatibility |
54 | | -``` |
| 29 | +Examples |
| 30 | +- settings.json: |
| 31 | + { |
| 32 | + "promptitude.repositories": [ |
| 33 | + "https://github.com/org/prompts", |
| 34 | + "https://github.com/org/prompts|develop", |
| 35 | + "https://dev.azure.com/acme/Project/_git/prompt-repo|release" |
| 36 | + ] |
| 37 | + } |
| 38 | +- Logging: |
| 39 | + const log = Logger.get('MyFeature'); log.info('Starting'); log.debug('Detailed trace when promptitude.debug = true'); |
| 40 | +``` |
| 41 | +```` |
0 commit comments