Skip to content

Commit 8894908

Browse files
Nolin NaidooNolin Naidoo
authored andcommitted
Initial commit on main branch
Enterprise-grade VS Code extension for web scraping and data extraction. Features: - Multi-format scraping support - Data 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 8894908

Some content is hidden

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

83 files changed

+11077
-0
lines changed

.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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
*.html text eol=lf
13+
14+
# Binary files
15+
*.png binary
16+
*.jpg binary
17+
*.jpeg binary
18+
*.gif binary
19+
*.ico binary
20+
*.vsix binary

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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: Install Playwright Chromium
30+
run: bunx playwright install chromium --with-deps
31+
32+
- name: Lint
33+
run: bun run lint
34+
35+
- name: Build
36+
run: bun run build
37+
38+
- name: Test with coverage
39+
run: bun run test:coverage
40+
41+
- name: Package extension
42+
run: bun run package

.gitignore

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

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Nolin D Naidoo <nolin.naidoo@me.com>
2+
nolindnaidoo <nolin.naidoo@me.com>
3+

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"biomejs.biome",
4+
"ms-playwright.playwright"
5+
]
6+
}

.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+
}

0 commit comments

Comments
 (0)