Skip to content

Commit fe8cbd5

Browse files
committed
chore: initial commit
0 parents  commit fe8cbd5

59 files changed

Lines changed: 8341 additions & 0 deletions

Some content is hidden

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

.github/copilot-instructions.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Project Guidelines
2+
3+
## Overview
4+
5+
VS Code extension for managing RabbitMQ connections, queues, exchanges, and bindings. Uses the Management HTTP API and AMQP protocol. Independent project — not affiliated with Broadcom.
6+
7+
## Architecture
8+
9+
```
10+
src/
11+
activation/ → Command registration (entry wiring)
12+
extension/ → Business logic, services, domain types, errors
13+
services/ → ConnectionStore, RabbitMqAdminService, etc.
14+
types/ → TypeScript interfaces (connection.ts, rabbitmq.ts)
15+
infra/rabbitmq/ → ManagementApiClient (HTTP), AmqpProbe, mappers
16+
ui/views/ → TreeDataProvider (RabbitMqExplorer)
17+
ui/webview/ → Webview panel (ResourceEditor)
18+
extension.ts → Entry point, explicit DI wiring
19+
```
20+
21+
- **Clean architecture**: extension → infra → UI, no reverse dependencies
22+
- **Explicit DI**: Services receive dependencies via constructor; all wiring happens in `extension.ts` `activate()`
23+
- **Error hierarchy**: All errors extend `AppError` with typed `code` field. Subtypes: `MissingConnectionError`, `ValidationError`, `ManagementApiError`
24+
- **Tree views**: `BaseProvider<T extends ExplorerNode>` with discriminated union node types
25+
26+
## Build and Test
27+
28+
**Package manager**: Bun (v1.3.10+). Never use npm/yarn.
29+
30+
| Task | Command |
31+
|------|---------|
32+
| Full build | `bun run build` |
33+
| Type-check | `bun run check-types` |
34+
| Lint | `bun run lint` |
35+
| Unit tests | `bun run test:unit` |
36+
| Integration tests | `bun run test:integration` |
37+
| Package VSIX | `bun run package:vsix` |
38+
39+
**Two bundle targets** (see `scripts/build.ts`):
40+
- Extension: `src/extension.ts``dist/extension.js` (CJS, Node)
41+
- Webview: `src/ui/webview/resourceEditorApp.ts``dist/webview/resourceEditorApp.js` (IIFE, browser)
42+
43+
Integration tests require `dist/extension.js` to exist — always build before running them.
44+
45+
## Code Style
46+
47+
- **Formatter/Linter**: Biome (double quotes, tab indentation, auto-organize imports)
48+
- **TypeScript**: Strict mode, ES2022 target, Node16 modules, no implicit any
49+
- **Files**: camelCase (`connectionStore.ts`). Classes: PascalCase. Interfaces: PascalCase, no `I` prefix
50+
51+
## Conventions
52+
53+
- **Commands**: Named `amqp-manager.[action]`, registered centrally in `registerCommands.ts`
54+
- **Settings**: Workspace-scoped in `settings.json`. Legacy `rabbitmq.*` fallback exists — maintain backward compat
55+
- **HTTP**: Uses the native Node.js `fetch` API for the RabbitMQ Management API, with `undici` only for TLS dispatcher configuration when needed
56+
- **Testing**: Unit tests use Bun native runner (`bun:test`). Integration tests use `@vscode/test-electron` with `node:assert/strict`
57+
- **Test file naming**: `[module].test.ts` in `test/unit/`
58+
- **No external test mocks library** — stubs are inline or manual
59+
- **Runtime dependencies**: `amqplib` and `undici`. Keep dependencies minimal

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ci-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
validate:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 30
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: 22
30+
31+
- name: Setup Bun
32+
uses: oven-sh/setup-bun@v2
33+
with:
34+
bun-version: 1.3.10
35+
36+
- name: Restore Bun cache
37+
uses: actions/cache@v5
38+
with:
39+
path: |
40+
~/.bun/install/cache
41+
node_modules
42+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-bun-
45+
46+
- name: Install dependencies
47+
run: bun install --frozen-lockfile
48+
49+
- name: Validate release metadata
50+
run: bun run release:check
51+
52+
- name: Run unit tests
53+
run: bun run test
54+
55+
- name: Run integration tests
56+
run: xvfb-run -a bun run test:integration
57+
58+
- name: Package VSIX
59+
run: bun run package:vsix:ci
60+
61+
- name: Upload VSIX artifact
62+
uses: actions/upload-artifact@v7
63+
with:
64+
name: amqp-manager-vscode-vsix
65+
path: artifacts/amqp-manager-vscode.vsix
66+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
env:
21+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v6
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version: 22
31+
32+
- name: Setup Bun
33+
uses: oven-sh/setup-bun@v2
34+
with:
35+
bun-version: 1.3.10
36+
37+
- name: Restore Bun cache
38+
uses: actions/cache@v5
39+
with:
40+
path: |
41+
~/.bun/install/cache
42+
node_modules
43+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-bun-
46+
47+
- name: Install dependencies
48+
run: bun install --frozen-lockfile
49+
50+
- name: Validate tag, changelog, and manifest
51+
run: bun run release:check "${{ github.ref_name }}"
52+
53+
- name: Run unit tests
54+
run: bun run test
55+
56+
- name: Run integration tests
57+
run: xvfb-run -a bun run test:integration
58+
59+
- name: Package VSIX
60+
run: bun run package:vsix:ci
61+
62+
- name: Read release metadata
63+
id: release_meta
64+
run: |
65+
version=$(node -p 'require("./package.json").version')
66+
is_prerelease=$(node -p 'require("./package.json").version.includes("-")')
67+
echo "version=$version" >> "$GITHUB_OUTPUT"
68+
echo "is_prerelease=$is_prerelease" >> "$GITHUB_OUTPUT"
69+
70+
- name: Publish to VS Code Marketplace
71+
run: |
72+
if [ "${{ steps.release_meta.outputs.is_prerelease }}" = "true" ]; then
73+
bunx @vscode/vsce publish --packagePath artifacts/amqp-manager-vscode.vsix --pat "$VSCE_PAT" --pre-release
74+
else
75+
bunx @vscode/vsce publish --packagePath artifacts/amqp-manager-vscode.vsix --pat "$VSCE_PAT"
76+
fi
77+
78+
- name: Generate release notes
79+
run: bun run release:notes > artifacts/release-notes.md
80+
81+
- name: Publish GitHub release
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
name: ${{ steps.release_meta.outputs.version }}
85+
body_path: artifacts/release-notes.md
86+
files: artifacts/amqp-manager-vscode.vsix
87+
prerelease: ${{ steps.release_meta.outputs.is_prerelease == 'true' }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
out
2+
dist
3+
node_modules
4+
.vscode-test/
5+
*.vsix
6+
artifacts/
7+
.DS_Store
8+
.env
9+
TODO.md

.vscode-test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from "@vscode/test-cli";
2+
3+
export default defineConfig({
4+
files: "out/test/**/*.test.js",
5+
});

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome", "oven.bun-vscode"]
3+
}

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
13+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
14+
"preLaunchTask": "${defaultBuildTask}"
15+
}
16+
]
17+
}

.vscode/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"amqp-manager.connections": [
3+
{
4+
"id": "eb46a67f-1341-49cc-a4f9-3915ee5a5f50",
5+
"name": "Local",
6+
"managementUrl": "http://localhost:15673",
7+
"amqpUrl": "amqp://localhost:5673",
8+
"vhost": "/",
9+
"username": "guest",
10+
"tls": false,
11+
"timeoutMs": 10000,
12+
"rejectUnauthorized": true,
13+
"password": "guest"
14+
}
15+
]
16+
}

.vscode/tasks.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "watch",
8+
"dependsOn": ["npm: watch:tsc", "npm: watch:esbuild"],
9+
"presentation": {
10+
"reveal": "never"
11+
},
12+
"group": {
13+
"kind": "build",
14+
"isDefault": true
15+
}
16+
},
17+
{
18+
"type": "npm",
19+
"script": "watch:esbuild",
20+
"group": "build",
21+
"problemMatcher": "$esbuild-watch",
22+
"isBackground": true,
23+
"label": "npm: watch:esbuild",
24+
"presentation": {
25+
"group": "watch",
26+
"reveal": "never"
27+
}
28+
},
29+
{
30+
"type": "npm",
31+
"script": "watch:tsc",
32+
"group": "build",
33+
"problemMatcher": "$tsc-watch",
34+
"isBackground": true,
35+
"label": "npm: watch:tsc",
36+
"presentation": {
37+
"group": "watch",
38+
"reveal": "never"
39+
}
40+
},
41+
{
42+
"type": "npm",
43+
"script": "watch-tests",
44+
"problemMatcher": "$tsc-watch",
45+
"isBackground": true,
46+
"presentation": {
47+
"reveal": "never",
48+
"group": "watchers"
49+
},
50+
"group": "build"
51+
},
52+
{
53+
"label": "tasks: watch-tests",
54+
"dependsOn": ["npm: watch", "npm: watch-tests"],
55+
"problemMatcher": []
56+
}
57+
]
58+
}

.vscodeignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.vscode/**
2+
.github/**
3+
.vscode-test/**
4+
artifacts/**
5+
out/**
6+
node_modules/**
7+
src/**
8+
test/**
9+
CLAUDE.md
10+
biome.jsonc
11+
bun.lock
12+
compose.yaml
13+
.gitignore
14+
.yarnrc
15+
scripts/**
16+
vsc-extension-quickstart.md
17+
**/tsconfig.json
18+
**/eslint.config.mjs
19+
**/*.map
20+
**/*.ts
21+
**/.vscode-test.*
22+
.env

0 commit comments

Comments
 (0)