Skip to content

Commit cc22ee5

Browse files
committed
Merge pull request #459 from GordonSmith/LLM_TOOLS
feat: update dependencies and add new language model tools
2 parents 4595fad + 7a1ca43 commit cc22ee5

46 files changed

Lines changed: 2666 additions & 884 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: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Copilot Project Instructions (vscode-ecl)
2+
3+
These instructions give AI coding agents the minimum project-specific context needed to be productive. Keep answers concise, reference concrete files, and follow existing patterns.
4+
5+
## 1. Project Purpose & Top-Level Architecture
6+
7+
VS Code extension providing HPCC Systems ECL/KEL/Dashy language + notebook + platform workflow support. Core responsibilities:
8+
9+
- Language support (syntax, syntax checking, snippets, record definition insertion)
10+
- Workunit submission & monitoring against HPCC Platform clusters
11+
- KEL -> ECL generation workflow
12+
- ECL Notebook (.eclnb) execution + custom renderers (Workunit + ObservableJS)
13+
- Auxiliary dashboard / ECL Watch webview UI
14+
15+
Architecture overview:
16+
17+
- Entry points: `src/extension.ts` (Node runtime), `src/web-extension.ts` (browser/web). Both dynamically import feature modules after localization init.
18+
- Feature modules (lazy loaded): `src/ecl/`, `src/kel/`, `src/notebook/`, optional `dashy/` (currently commented in extension.ts) plus UI components in `src/eclwatch.tsx`.
19+
- Build outputs to `dist/` (extension + web renderers) and `dist-util/` (docs vector DB generator) via `esbuild.mjs`.
20+
- Grammar + syntax: `ecl-tmLanguage/`, `syntaxes/kel.tmLanguage.json`, `syntaxes/dashy.tmLanguage.json`.
21+
- Internationalization: strings resolved through `./util/localize` and `nls` JSON generation (`npm run gen-nls`).
22+
23+
## 2. Build & Dev Workflow
24+
25+
Primary scripts (`package.json`):
26+
27+
- Type generation (watch): `npm run gen-node-watch`, `npm run gen-webview-watch` (tsc emit d.ts only per config).
28+
- Bundle dev watch (all): run VS Code build task (maps to `build` task which depends on `gen-node-watch`, `gen-webview-watch`, `build-ts-watch`).
29+
- One-off production build: `npm run build` (runs `gen-types` + `build-ts`).
30+
- Lint: `npm run lint` / auto-fix: `npm run lint-fix`.
31+
- Testing: `npm run test:vitest` (watch), `npm run test:vitest-run` (once), `npm run test:vitest-ui` (with UI), `npm run test:vitest-coverage` (with coverage).
32+
- Package VSIX: `npm run package` (output `ecl.vsix`).
33+
- Publish (requires auth): `npm run publish`.
34+
- Generate localized resources: `npm run gen-nls` then `npm run merge-nls` if needed.
35+
- Vector doc index (LLM prompt support): `npm run gen-docs-vecdb` (writes `dist/docs.vecdb`).
36+
37+
Typical dev loop:
38+
39+
1. Run default build task (Ctrl+Shift+B) for watch mode.
40+
2. Launch extension host (F5). Open an `.ecl` or `.kel` file to trigger activation.
41+
3. Modify sources under `src/`; esbuild watch rebuilds to `dist/` automatically.
42+
43+
## 3. Key Extension Contributions (from `package.json`)
44+
45+
- Languages: ECL (`.ecl`, `.mod`, `.ecllib`), KEL (`.kel`), Dashy (`.dashy` JSON injection grammar).
46+
- Commands & menus are heavily context-driven (see `package.json` for enablement). Do not hardcode strings—reuse existing command IDs.
47+
- Notebooks: id `ecl-notebook`; renderers `wuRenderer` (Workunit JSON) and `ojsRenderer` (ObservableJS cells).
48+
- Debugger type: `ecl` (program `dist/debugger.js`) with launch schema documented in README.
49+
- Chat participant: `chat.ecl` —prefer expanding these via contributes if adding capabilities.
50+
51+
## 4. Source Layout & Patterns
52+
53+
- Dynamic imports keep activation fast; new feature areas should follow pattern in `extension.ts` (lazy import after `initialize()`).
54+
- Prefer colocated feature folders: `src/<domain>/main.ts|js` exporting `activate(context)` consumed by entry point.
55+
- Webview / browser-targeted code uses `tsconfig.webview.json` (ESM / browser target) vs Node code using root `tsconfig.json` (CJS target). Match platform when adding entrypoints.
56+
- React (v17) used for complex UI (`eclwatch.tsx`, notebook renderers). Use function components + hooks; avoid introducing different UI libs.
57+
- Telemetry encapsulated in `src/telemetry/`; send only via exported `reporter` to keep consistency.
58+
- **Prefer VS Code APIs over Node.js APIs**: Use `vscode.workspace.fs` for file operations, `vscode.Uri` for paths, and VS Code's built-in utilities where available. This ensures better integration with the VS Code environment, proper workspace context, and compatibility with both Node and web environments.
59+
60+
## 5. Localization & Strings
61+
62+
- New user-facing strings should use localization pipeline: add to base `package.nls.json`, run `npm run gen-nls` (creates `lib-util/generate.js` output consumed) then reconcile missing entries under `tmp/package.nls.*.missing.json` before commit.
63+
- Avoid embedding raw UI strings directly in TSX—centralize when reused or visible.
64+
65+
## 6. HPCC Platform Integration
66+
67+
- Workunit operations & platform APIs housed under `src/hpccplatform/` and supporting util modules (look for submission, polling, and tree view providers). Follow existing async patterns (Promise-based, minimal global state, use VS Code `TreeDataProvider`).
68+
- Submission UI flows rely on status bar selections (launch config + target cluster) + tree updates; keep side effects isolated.
69+
70+
## 7. Notebooks & Renderers
71+
72+
- Notebook kernel / controller logic under `src/notebook/` (activation imported in both node + web builds).
73+
- Renderer isolation: each renderer is a separate esbuild entry (see `esbuild.mjs`). Add new renderer by adding another `main(tsconfigBrowser, entry, "browser", format)` call and corresponding `notebookRenderer` contribution.
74+
75+
## 8. Adding Features Safely
76+
77+
- Reuse existing command categories (`ECL`, `KEL`) and enablement contexts (e.g. `ecl.connected`).
78+
- Extend menus via existing submenus `setState`, `setPriority` when dealing with workunits rather than creating new ones.
79+
- For network/platform code, respect existing configuration settings (e.g. proxy, `rejectUnauthorized`).
80+
81+
## 9. Testing & Quality
82+
83+
- **Vitest** is now configured as the primary testing framework (`vitest.config.ts`). Legacy mocha tests remain in `test/` but are excluded from vitest runs.
84+
- New tests should be placed in `src/__tests__/` using `*.test.ts` or `*.spec.ts` naming convention.
85+
- Available vitest commands:
86+
- `npm run test:vitest` - Run tests in watch mode
87+
- `npm run test:vitest-run` - Run tests once
88+
- `npm run test:vitest-ui` - Run tests with UI
89+
- `npm run test:vitest-coverage` - Run tests with coverage report
90+
- Vitest config includes jsdom environment, global test functions (`describe`, `it`, `expect`), and coverage reporting.
91+
- Keep new logic unit-testable (pure functions in util modules). Avoid coupling VS Code API calls inside deep logic—wrap them.
92+
- See `src/__tests__/vitest-example.test.ts` for testing patterns including mocks, timers, DOM manipulation, and async operations.
93+
94+
## 10. Bundling Constraints
95+
96+
- External modules declared in `esbuild.mjs` (e.g. `vscode`, core node modules) must remain external. When introducing node-only deps ensure they aren’t required by browser bundles.
97+
- Browser targets must avoid Node APIs unless polyfilled (current config doesn’t inject shims).
98+
99+
## 11. Vector Doc Index
100+
101+
- File `util/docs.vecdb` copied into `dist/docs.vecdb` for LLM/assistant usage. Updating generation logic: edit `util/index-docs.ts`, rebuild with production flag or run `node dist-util/index-docs.mjs` via script.
102+
103+
## 12. Versioning & Packaging
104+
105+
- Extension version in `package.json`—increment appropriately; run `npm run package` to produce `ecl.vsix`. Publishing uses `vsce publish` (ensure changelog updated).
106+
107+
## 13. Common Pitfalls
108+
109+
- Forgetting lazy import => increases activation time (avoid exporting heavy modules directly from entry point).
110+
- Mixing web + node code (ensure correct tsconfig target and esbuild platform entry).
111+
- Adding untranslated strings (will produce missing locale JSON files under `tmp/`).
112+
113+
When responding, cite file paths (e.g. `src/extension.ts`) and align with these established patterns. If uncertain, inspect `package.json` contributions first.
114+
115+
## 14. VS Code API Reference Shortcuts
116+
117+
Use official docs for API details; below are the most relevant entry points for this project’s common tasks:
118+
119+
- Extension Manifest (`package.json` contributes): https://code.visualstudio.com/api/references/contribution-points
120+
- Core VS Code API (activation, commands, TreeDataProvider, status bar): https://code.visualstudio.com/api/references/vscode-api
121+
- Debug Adapter & Debugger contributions (used for `type: "ecl"`): https://code.visualstudio.com/api/extension-guides/debugger-extension
122+
- Notebook API (controller, renderers): https://code.visualstudio.com/api/extension-guides/notebook
123+
- Webview UI (used by `eclwatch.tsx` and potential Dashy views): https://code.visualstudio.com/api/extension-guides/webview
124+
- Localization (NLS): https://code.visualstudio.com/api/advanced-topics/localization
125+
126+
How to apply:
127+
128+
- Before adding a new contribution, confirm an existing pattern in `package.json` (e.g. replicate a command object, adjust `enablement`).
129+
- For a new Tree View / data provider, follow existing HPCC platform tree patterns under `src/hpccplatform/` and reference TreeDataProvider docs.
130+
- For new notebook renderer: add entry in `esbuild.mjs` (browser target) + `notebookRenderer` contribution + MIME type contract.
131+
- For status bar interactions replicate existing approach (search for usages setting `ecl.launchConfiguration` & `ecl.targetCluster`).
132+
133+
When unsure of an API surface (e.g. `WorkspaceEdit`, `TextDocumentContentProvider`, etc.) prefer stable APIs listed in the vscode-api reference; avoid proposed APIs unless already adopted in this repo.
134+
135+
## 15. Reference Sample Extensions
136+
137+
For additional concrete, minimal examples of specific VS Code features (debug adapters, notebooks, webviews, tree views, authentication, testing, etc.), consult the official extension samples repository:
138+
139+
https://github.com/microsoft/vscode-extension-samples
140+
141+
Use these samples to validate API usage patterns before introducing new dependencies. Align any adopted patterns with this project's existing conventions (lazy dynamic imports in `src/extension.ts`, localization via `package.nls.json`, separation of Node vs browser bundles, and avoiding proposed APIs unless already in use).

.github/workflows/codeql-analysis.yml

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111
#
1212
name: "CodeQL"
1313

14+
# Ensure only one run per workflow + ref; cancel older in-progress runs on new commits
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1419
on:
1520
push:
16-
branches: [ trunk ]
21+
branches: [main]
1722
pull_request:
1823
# The branches below must be a subset of the branches above
19-
branches: [ trunk ]
24+
branches: [main]
2025
schedule:
21-
- cron: '23 18 * * 2'
26+
- cron: "23 18 * * 2"
2227

2328
jobs:
2429
analyze:
@@ -32,40 +37,40 @@ jobs:
3237
strategy:
3338
fail-fast: false
3439
matrix:
35-
language: [ 'javascript' ]
40+
language: ["javascript"]
3641
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3742
# Learn more:
3843
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3944

4045
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v2
46+
- name: Checkout repository
47+
uses: actions/checkout@v2
4348

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
47-
with:
48-
languages: ${{ matrix.language }}
49-
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
51-
# Prefix the list here with "+" to use these queries and those in the config file.
52-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
49+
# Initializes the CodeQL tools for scanning.
50+
- name: Initialize CodeQL
51+
uses: github/codeql-action/init@v1
52+
with:
53+
languages: ${{ matrix.language }}
54+
# If you wish to specify custom queries, you can do so here or in a config file.
55+
# By default, queries listed here will override any specified in a config file.
56+
# Prefix the list here with "+" to use these queries and those in the config file.
57+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5358

54-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55-
# If this step fails, then you should remove it and run the build manually (see below)
56-
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
59+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
60+
# If this step fails, then you should remove it and run the build manually (see below)
61+
- name: Autobuild
62+
uses: github/codeql-action/autobuild@v1
5863

59-
# ℹ️ Command-line programs to run using the OS shell.
60-
# 📚 https://git.io/JvXDl
64+
# ℹ️ Command-line programs to run using the OS shell.
65+
# 📚 https://git.io/JvXDl
6166

62-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63-
# and modify them (or add more) to build your code if your project
64-
# uses a compiled language
67+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
68+
# and modify them (or add more) to build your code if your project
69+
# uses a compiled language
6570

66-
#- run: |
67-
# make bootstrap
68-
# make release
71+
#- run: |
72+
# make bootstrap
73+
# make release
6974

70-
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@v1

.github/workflows/ossar-analysis.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
# https://github.com/github/ossar-action
44
name: OSSAR
55

6+
# Ensure only one run per workflow + ref; cancel older in-progress runs on new commits
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
611
on:
712
push:
8-
branches: [ trunk ]
13+
branches: [main]
914
pull_request:
1015
# The branches below must be a subset of the branches above
11-
branches: [ trunk ]
16+
branches: [main]
1217
schedule:
13-
- cron: '34 4 * * 3'
18+
- cron: "34 4 * * 3"
1419

1520
jobs:
1621
OSSAR-Scan:
@@ -19,26 +24,25 @@ jobs:
1924
runs-on: windows-latest
2025

2126
steps:
22-
- name: Checkout repository
23-
uses: actions/checkout@v2
24-
25-
# Ensure a compatible version of dotnet is installed.
26-
# The [Microsoft Security Code Analysis CLI](https://aka.ms/mscadocs) is built with dotnet v3.1.201.
27-
# A version greater than or equal to v3.1.201 of dotnet must be installed on the agent in order to run this action.
28-
# GitHub hosted runners already have a compatible version of dotnet installed and this step may be skipped.
29-
# For self-hosted runners, ensure dotnet version 3.1.201 or later is installed by including this action:
30-
# - name: Install .NET
31-
# uses: actions/setup-dotnet@v1
32-
# with:
33-
# dotnet-version: '3.1.x'
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
3429

30+
# Ensure a compatible version of dotnet is installed.
31+
# The [Microsoft Security Code Analysis CLI](https://aka.ms/mscadocs) is built with dotnet v3.1.201.
32+
# A version greater than or equal to v3.1.201 of dotnet must be installed on the agent in order to run this action.
33+
# GitHub hosted runners already have a compatible version of dotnet installed and this step may be skipped.
34+
# For self-hosted runners, ensure dotnet version 3.1.201 or later is installed by including this action:
35+
# - name: Install .NET
36+
# uses: actions/setup-dotnet@v1
37+
# with:
38+
# dotnet-version: '3.1.x'
3539
# Run open source static analysis tools
36-
- name: Run OSSAR
37-
uses: github/ossar-action@v1
38-
id: ossar
40+
- name: Run OSSAR
41+
uses: github/ossar-action@v1
42+
id: ossar
3943

40-
# Upload results to the Security tab
41-
- name: Upload OSSAR results
42-
uses: github/codeql-action/upload-sarif@v1
43-
with:
44-
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
44+
# Upload results to the Security tab
45+
- name: Upload OSSAR results
46+
uses: github/codeql-action/upload-sarif@v1
47+
with:
48+
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,49 @@
11
name: Pull Build Test
22

3+
# Ensure only one run per workflow + ref; cancel older in-progress runs on new commits
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
38
on:
49
push:
510
branches:
6-
- trunk
11+
- main
712
pull_request:
813
branches:
9-
- trunk
14+
- main
1015

1116
jobs:
1217
build:
13-
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
23+
runs-on: ${{ matrix.os }}
1424

1525
steps:
1626
- uses: actions/checkout@v4
27+
with:
28+
submodules: "recursive"
29+
1730
- uses: actions/setup-node@v4
1831
with:
1932
node-version: "24.x"
20-
- run: git submodule update --init --recursive
21-
- run: npm ci
22-
- run: npm run lint
23-
- run: npm run package
33+
34+
- name: Install dependencies
35+
shell: bash
36+
run: |
37+
npm ci
38+
39+
- name: Run tests (Ubuntu)
40+
if: runner.os == 'Linux'
41+
shell: bash
42+
run: |
43+
xvfb-run -a npm test
44+
45+
- name: Run tests (Windows/macOS)
46+
if: runner.os != 'Linux'
47+
shell: bash
48+
run: |
49+
npm test

.github/workflows/release-please.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ permissions:
1010

1111
name: release-please
1212

13+
# Ensure only one release pipeline per ref; cancel previous if a new commit arrives
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
release-please:
1520
runs-on: ubuntu-latest

.github/workflows/stale.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
name: 'Close stale issues and PRs'
1+
name: "Close stale issues and PRs"
2+
3+
# Prevent overlapping scheduled runs (low frequency but added for consistency)
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
27
on:
38
schedule:
4-
- cron: '30 1 * * *'
9+
- cron: "30 1 * * *"
510

611
jobs:
712
stale:
813
runs-on: ubuntu-latest
914
steps:
1015
- uses: actions/stale@v9
1116
with:
12-
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
13-
stale-pr-message: 'This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
14-
17+
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
18+
stale-pr-message: "This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."

0 commit comments

Comments
 (0)