Skip to content

Commit 4303bde

Browse files
Nolin NaidooNolin Naidoo
authored andcommitted
Initial commit on main branch
Enterprise-grade VS Code extension for string extraction and analysis. Features: - Multi-format string support - String validation and analysis - Performance monitoring - Comprehensive i18n support - Full test coverage - Strict TypeScript with functional programming patterns All lint checks passing, tests passing, build successful.
0 parents  commit 4303bde

112 files changed

Lines changed: 2411699 additions & 0 deletions

File tree

Some content is hidden

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

.biomeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/extraction/__data__/

.cursorrules

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
You are an expert VS Code extension developer. Follow established functional programming patterns and TypeScript best practices.
2+
3+
## Code Style & Architecture
4+
5+
**TypeScript Standards:**
6+
7+
- Use functional programming with `readonly` types and `Object.freeze()` for immutability
8+
- Prefer factory functions over classes for component creation
9+
- Write pure functions with explicit return type annotations
10+
- Enable strict TypeScript: `strict`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
11+
12+
**Project Structure:**
13+
14+
- Keep `src/extension.ts` minimal - only register commands/providers
15+
- Organize by feature: commands/, config/, ui/, providers/, utils/
16+
- Separate core logic from VS Code API surface
17+
- Use centralized type definitions in `types.ts`
18+
19+
**Code Quality:**
20+
21+
- Use modern linting/formatting tools (Biome, ESLint, Prettier)
22+
- Freeze all exports to communicate immutability: `Object.freeze()`
23+
- Apply dependency injection via factory functions and parameter objects
24+
- Localize all user-facing strings with `vscode-nls` and `MessageFormat.file`
25+
26+
## Core Patterns
27+
28+
**Extension Activation:**
29+
30+
- Register all disposables through `context.subscriptions`
31+
- Use factory functions for component creation
32+
- Delegate heavy work to commands with progress indicators
33+
34+
**Configuration Management:**
35+
36+
- Read via `vscode.workspace.getConfiguration(namespace)`
37+
- Return frozen configuration objects
38+
- Support real-time changes with `onDidChangeConfiguration`
39+
40+
**Command Registration:**
41+
42+
```typescript
43+
export function registerCommands(
44+
context: vscode.ExtensionContext,
45+
deps: Readonly<{
46+
/* injected dependencies */
47+
}>
48+
): void;
49+
```
50+
51+
**Error Handling:**
52+
53+
- Handle parse/processing errors gracefully with user feedback
54+
- Return safe defaults (empty frozen arrays/objects) on errors
55+
- Validate all user inputs to prevent injection attacks
56+
57+
## Performance & UX
58+
59+
**Performance:**
60+
61+
- Warn before processing large files with user confirmation
62+
- Use `vscode.window.withProgress` for long-running operations
63+
- Support cancellation tokens where applicable
64+
- Minimize memory usage and avoid caching large content
65+
66+
**User Experience:**
67+
68+
- Provide subtle feedback (status bar) over notification spam
69+
- Use localized strings for all user-facing text
70+
- Support light/dark themes and accessibility
71+
- Handle edge cases: no active editor, empty files, unknown types
72+
73+
## Localization System
74+
75+
**Manifest Prefix:** `manifest.*`
76+
77+
```json
78+
{
79+
"displayName": "%manifest.ext.name%",
80+
"commands": [{ "title": "%manifest.command.title%" }]
81+
}
82+
```
83+
84+
**Runtime Prefix:** `runtime.*`
85+
86+
```typescript
87+
const localize = nls.config({ messageFormat: nls.MessageFormat.file })();
88+
const message = localize("runtime.error.message", "Error: {0}", details);
89+
```
90+
91+
**File Structure:**
92+
93+
- `package.nls.json` - Base English strings
94+
- `package.nls.{locale}.json` - Translations
95+
96+
## Testing & Debugging
97+
98+
**Testing:**
99+
100+
- Use Node.js built-in test runner with TypeScript support
101+
- Structure code for testability with pure functions
102+
- Organize test data with expected outputs
103+
- Use coverage tools for quality assurance
104+
105+
**Debugging:**
106+
107+
- Use VS Code Output channels for local logging
108+
- Structure logging with clear categories and levels
109+
- Support debugging in development vs production modes
110+
111+
## Security & Privacy
112+
113+
- Default to privacy-first: no data collection unless explicitly enabled
114+
- Use local-only logging when telemetry is enabled
115+
- Validate all user inputs and file operations
116+
- Support VS Code workspace trust and virtual workspace limitations
117+
118+
## Build & Tooling
119+
120+
**TypeScript Configuration:**
121+
122+
- Target modern JS (ES2020+) with CommonJS for VS Code compatibility
123+
- Enable strict mode and additional safety checks
124+
- Use proper module resolution and path mapping
125+
126+
**Code Standards:**
127+
128+
- Consistent indentation and formatting
129+
- Meaningful variable names and function signatures
130+
- Comprehensive error handling and edge case coverage
131+
- Clear separation of concerns and single responsibility
132+
133+
Follow these patterns for maintainable, secure, and user-friendly VS Code extensions.

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
# YAML files
14+
[*.{yml,yaml}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
# JSON files
19+
[*.json]
20+
indent_style = space
21+
indent_size = 2
22+
23+
# Documentation
24+
[*.{rst,md,txt}]
25+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Normalize line endings for all text files
2+
* text=auto eol=lf
3+
4+
# Specific file types
5+
*.ts text eol=lf
6+
*.js text eol=lf
7+
*.json text eol=lf
8+
*.md text eol=lf
9+
*.yml text eol=lf
10+
*.yaml text eol=lf
11+
*.csv text eol=lf
12+
13+
# Binary files
14+
*.png binary
15+
*.jpg binary
16+
*.jpeg binary
17+
*.gif binary
18+
*.ico binary
19+
*.vsix binary

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
name: CI on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
fail-fast: false
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v1
23+
with:
24+
bun-version: latest
25+
26+
- name: Install dependencies
27+
run: bun install --frozen-lockfile
28+
29+
- name: Lint
30+
run: bun run lint
31+
32+
- name: Build
33+
run: bun run build
34+
35+
- name: Test with coverage
36+
run: bun run test:coverage
37+
38+
- name: Package extension
39+
run: bun run package

.gitignore

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# real world experience to exclude things people often accidently commit
2+
3+
#project
4+
dist/
5+
gemini.md
6+
7+
package.nls.de.json
8+
package.nls.es.json
9+
package.nls.fr.json
10+
package.nls.id.json
11+
package.nls.it.json
12+
package.nls.ja.json
13+
package.nls.ko.json
14+
package.nls.pt-br.json
15+
package.nls.ru.json
16+
package.nls.uk.json
17+
package.nls.vi.json
18+
package.nls.zh-cn.json
19+
20+
!src/i18n/*.*
21+
22+
# Logs
23+
logs
24+
*.log
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
lerna-debug.log*
29+
30+
# Coverage directory used by tools like istanbul
31+
*.lcov
32+
33+
# Coverage - ignore all except main summary
34+
coverage/*
35+
!coverage/index.html
36+
37+
# Dependency directories
38+
node_modules/
39+
40+
# TypeScript cache
41+
*.tsbuildinfo
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Yarn Integrity file
50+
.yarn-integrity
51+
52+
# Temporary folders
53+
tmp/
54+
temp/
55+
56+
# VS Code extension specific
57+
out/
58+
.vscode-test/
59+
.vscode-test-electron/
60+
61+
62+
# OS generated files
63+
.DS_Store
64+
.DS_Store?
65+
._*
66+
.Spotlight-V100
67+
.Trashes
68+
ehthumbs.db
69+
Thumbs.db
70+
71+
# IDE files
72+
.idea/
73+
*.swp
74+
*.swo
75+
*~
76+
77+
# Test files and coverage
78+
test-results/
79+
*.lcov
80+
81+
# Build artifacts
82+
lib/
83+
build/
84+
dist/
85+
86+
# Package files
87+
*.7z
88+
*.rar
89+
*.7zip
90+
*.zip
91+
*.tgz
92+
*.tar.gz
93+
94+
# Windows
95+
.bat
96+
.ps1
97+
.dll
98+
99+
# Unapproved Images
100+
*.jpg
101+
*.jpeg
102+
*.ico
103+
*.bmp
104+
*.webp
105+
*.svg
106+
*.tiff
107+
108+
.env
109+
*.env.*
110+
!src/detection/__data__/*.env.*
111+
112+
# Release packages
113+
release/

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"args": [
9+
"--extensionDevelopmentPath=${workspaceFolder}"
10+
],
11+
"outFiles": [
12+
"${workspaceFolder}/dist/**/*.js"
13+
],
14+
"preLaunchTask": "${defaultBuildTask}"
15+
},
16+
{
17+
"name": "Extension Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"args": [
21+
"--extensionDevelopmentPath=${workspaceFolder}",
22+
"--extensionTestsPath=${workspaceFolder}/dist/test/suite/index"
23+
],
24+
"outFiles": [
25+
"${workspaceFolder}/dist/**/*.js"
26+
],
27+
"preLaunchTask": "${defaultBuildTask}"
28+
}
29+
]
30+
}

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"command": "bun run build",
7+
"group": {
8+
"kind": "build",
9+
"isDefault": true
10+
},
11+
"problemMatcher": "$tsc",
12+
"label": "bun: build",
13+
"detail": "bun run build"
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)