criterionx-vscode 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Tomas Maritano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # Criterion VS Code Extension
2
+
3
+ VS Code extension for the Criterion decision engine. Provides syntax highlighting, snippets, and validation for Criterion decision files.
4
+
5
+ ## Features
6
+
7
+ ### Syntax Highlighting
8
+
9
+ Enhanced syntax highlighting for Criterion-specific keywords:
10
+ - `defineDecision`, `createRule`, `createProfileRegistry`
11
+ - Status codes: `OK`, `NO_MATCH`, `INVALID_INPUT`, `INVALID_OUTPUT`
12
+ - Zod schema methods: `z.object`, `z.string`, `z.number`, etc.
13
+
14
+ ### Snippets
15
+
16
+ Quick snippets to scaffold Criterion code:
17
+
18
+ | Prefix | Description |
19
+ |--------|-------------|
20
+ | `decision` | Create a new decision |
21
+ | `rule` | Add a rule to a decision |
22
+ | `profile` | Create a profile object |
23
+ | `run` | Run a decision with the engine |
24
+ | `inputSchema` | Define an input schema |
25
+ | `outputSchema` | Define an output schema |
26
+ | `profileSchema` | Define a profile schema |
27
+ | `when` | Create a when condition |
28
+ | `emit` | Create an emit function |
29
+ | `explain` | Create an explain function |
30
+ | `test-decision` | Create a test for a decision |
31
+ | `server` | Create a Criterion server |
32
+
33
+ ### Validation
34
+
35
+ Real-time validation for Criterion decisions:
36
+
37
+ - Missing required properties (`id`, `version`, schemas)
38
+ - Empty rules array
39
+ - Missing rule properties (`when`, `emit`, `explain`)
40
+
41
+ ### Hover Documentation
42
+
43
+ Hover over Criterion keywords to see documentation:
44
+ - `defineDecision`
45
+ - `inputSchema`, `outputSchema`, `profileSchema`
46
+ - `when`, `emit`, `explain`
47
+
48
+ ### Commands
49
+
50
+ - **Criterion: New Decision** - Create a new decision file with boilerplate
51
+
52
+ ## Installation
53
+
54
+ ### From VS Code Marketplace
55
+
56
+ Search for "Criterion" in the VS Code Extensions panel.
57
+
58
+ ### Manual Installation
59
+
60
+ 1. Download the `.vsix` file from releases
61
+ 2. Open VS Code
62
+ 3. Press `Ctrl+Shift+P` / `Cmd+Shift+P`
63
+ 4. Run "Extensions: Install from VSIX..."
64
+ 5. Select the downloaded file
65
+
66
+ ### Development
67
+
68
+ ```bash
69
+ # Clone the repository
70
+ git clone https://github.com/tomymaritano/criterionx.git
71
+ cd criterionx/packages/vscode-extension
72
+
73
+ # Install dependencies
74
+ pnpm install
75
+
76
+ # Build the extension
77
+ pnpm build
78
+
79
+ # Package the extension
80
+ pnpm package
81
+ ```
82
+
83
+ ## Configuration
84
+
85
+ | Setting | Default | Description |
86
+ |---------|---------|-------------|
87
+ | `criterion.validate` | `true` | Enable/disable validation |
88
+ | `criterion.trace` | `false` | Enable trace logging |
89
+
90
+ ## Supported File Types
91
+
92
+ - `.criterion.ts` - Dedicated Criterion files
93
+ - `.ts` / `.tsx` - TypeScript files containing `defineDecision` or importing `@criterionx/core`
94
+
95
+ ## Example
96
+
97
+ ```typescript
98
+ import { defineDecision } from "@criterionx/core";
99
+ import { z } from "zod";
100
+
101
+ export const riskDecision = defineDecision({
102
+ id: "transaction-risk",
103
+ version: "1.0.0",
104
+
105
+ inputSchema: z.object({
106
+ amount: z.number(),
107
+ country: z.string(),
108
+ }),
109
+
110
+ outputSchema: z.object({
111
+ risk: z.enum(["low", "medium", "high"]),
112
+ score: z.number(),
113
+ }),
114
+
115
+ profileSchema: z.object({
116
+ threshold: z.number(),
117
+ blockedCountries: z.array(z.string()),
118
+ }),
119
+
120
+ rules: [
121
+ {
122
+ id: "blocked-country",
123
+ when: (ctx, profile) => profile.blockedCountries.includes(ctx.country),
124
+ emit: () => ({ risk: "high", score: 100 }),
125
+ explain: (ctx) => `Country ${ctx.country} is blocked`,
126
+ },
127
+ {
128
+ id: "default",
129
+ when: () => true,
130
+ emit: () => ({ risk: "low", score: 0 }),
131
+ explain: () => "Default low risk",
132
+ },
133
+ ],
134
+ });
135
+ ```
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,354 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/extension.ts
31
+ var extension_exports = {};
32
+ __export(extension_exports, {
33
+ activate: () => activate,
34
+ deactivate: () => deactivate
35
+ });
36
+ module.exports = __toCommonJS(extension_exports);
37
+ var vscode = __toESM(require("vscode"));
38
+
39
+ // src/validators.ts
40
+ function findBlockEnd(text, start) {
41
+ let depth = 0;
42
+ let inString = false;
43
+ let stringChar = "";
44
+ for (let i = start; i < text.length; i++) {
45
+ const char = text[i];
46
+ const prevChar = i > 0 ? text[i - 1] : "";
47
+ if (inString) {
48
+ if (char === stringChar && prevChar !== "\\") {
49
+ inString = false;
50
+ }
51
+ continue;
52
+ }
53
+ if (char === '"' || char === "'" || char === "`") {
54
+ inString = true;
55
+ stringChar = char;
56
+ continue;
57
+ }
58
+ if (char === "{") {
59
+ depth++;
60
+ } else if (char === "}") {
61
+ depth--;
62
+ if (depth === 0) {
63
+ return i + 1;
64
+ }
65
+ }
66
+ }
67
+ return text.length;
68
+ }
69
+ function findArrayEnd(text, start) {
70
+ let depth = 0;
71
+ let inString = false;
72
+ let stringChar = "";
73
+ for (let i = start; i < text.length; i++) {
74
+ const char = text[i];
75
+ const prevChar = i > 0 ? text[i - 1] : "";
76
+ if (inString) {
77
+ if (char === stringChar && prevChar !== "\\") {
78
+ inString = false;
79
+ }
80
+ continue;
81
+ }
82
+ if (char === '"' || char === "'" || char === "`") {
83
+ inString = true;
84
+ stringChar = char;
85
+ continue;
86
+ }
87
+ if (char === "[") {
88
+ depth++;
89
+ } else if (char === "]") {
90
+ depth--;
91
+ if (depth === 0) {
92
+ return i;
93
+ }
94
+ }
95
+ }
96
+ return text.length;
97
+ }
98
+ function isCriterionContent(fileName, text) {
99
+ return fileName.endsWith(".criterion.ts") || fileName.endsWith(".ts") && (text.includes("defineDecision") || text.includes("@criterionx/core"));
100
+ }
101
+ function checkMissingId(text) {
102
+ const diagnostics = [];
103
+ const defineDecisionRegex = /defineDecision\s*\(\s*\{/g;
104
+ let match;
105
+ while ((match = defineDecisionRegex.exec(text)) !== null) {
106
+ const startPos = match.index;
107
+ const blockEnd = findBlockEnd(text, startPos);
108
+ const block = text.slice(startPos, blockEnd);
109
+ if (!block.includes("id:") && !block.includes("id :")) {
110
+ diagnostics.push({
111
+ range: { start: startPos, end: startPos + 14 },
112
+ message: "Decision is missing required 'id' property",
113
+ severity: "error"
114
+ });
115
+ }
116
+ }
117
+ return diagnostics;
118
+ }
119
+ function checkMissingVersion(text) {
120
+ const diagnostics = [];
121
+ const defineDecisionRegex = /defineDecision\s*\(\s*\{/g;
122
+ let match;
123
+ while ((match = defineDecisionRegex.exec(text)) !== null) {
124
+ const startPos = match.index;
125
+ const blockEnd = findBlockEnd(text, startPos);
126
+ const block = text.slice(startPos, blockEnd);
127
+ if (!block.includes("version:") && !block.includes("version :")) {
128
+ diagnostics.push({
129
+ range: { start: startPos, end: startPos + 14 },
130
+ message: "Decision is missing required 'version' property",
131
+ severity: "error"
132
+ });
133
+ }
134
+ }
135
+ return diagnostics;
136
+ }
137
+ function checkMissingSchemas(text) {
138
+ const diagnostics = [];
139
+ const defineDecisionRegex = /defineDecision\s*\(\s*\{/g;
140
+ let match;
141
+ while ((match = defineDecisionRegex.exec(text)) !== null) {
142
+ const startPos = match.index;
143
+ const blockEnd = findBlockEnd(text, startPos);
144
+ const block = text.slice(startPos, blockEnd);
145
+ const schemas = ["inputSchema", "outputSchema", "profileSchema"];
146
+ for (const schema of schemas) {
147
+ if (!block.includes(`${schema}:`)) {
148
+ diagnostics.push({
149
+ range: { start: startPos, end: startPos + 14 },
150
+ message: `Decision is missing required '${schema}' property`,
151
+ severity: "error"
152
+ });
153
+ }
154
+ }
155
+ }
156
+ return diagnostics;
157
+ }
158
+ function checkEmptyRules(text) {
159
+ const diagnostics = [];
160
+ const emptyRulesRegex = /rules\s*:\s*\[\s*\]/g;
161
+ let match;
162
+ while ((match = emptyRulesRegex.exec(text)) !== null) {
163
+ diagnostics.push({
164
+ range: { start: match.index, end: match.index + match[0].length },
165
+ message: "Decision has no rules defined. Add at least one rule.",
166
+ severity: "warning"
167
+ });
168
+ }
169
+ return diagnostics;
170
+ }
171
+ function checkMissingRuleProperties(text) {
172
+ const diagnostics = [];
173
+ const rulesRegex = /rules\s*:\s*\[/g;
174
+ let rulesMatch;
175
+ while ((rulesMatch = rulesRegex.exec(text)) !== null) {
176
+ const rulesStart = rulesMatch.index + rulesMatch[0].length;
177
+ const rulesEnd = findArrayEnd(text, rulesMatch.index);
178
+ const rulesBlock = text.slice(rulesStart, rulesEnd);
179
+ const ruleRegex = /\{\s*id\s*:/g;
180
+ let ruleMatch;
181
+ while ((ruleMatch = ruleRegex.exec(rulesBlock)) !== null) {
182
+ const ruleStart = rulesStart + ruleMatch.index;
183
+ const ruleEnd = findBlockEnd(text, ruleStart);
184
+ const ruleBlock = text.slice(ruleStart, ruleEnd);
185
+ const requiredProps = ["when", "emit", "explain"];
186
+ for (const prop of requiredProps) {
187
+ if (!ruleBlock.includes(`${prop}:`)) {
188
+ diagnostics.push({
189
+ range: { start: ruleStart, end: ruleStart + 1 },
190
+ message: `Rule is missing required '${prop}' function`,
191
+ severity: "error"
192
+ });
193
+ }
194
+ }
195
+ }
196
+ }
197
+ return diagnostics;
198
+ }
199
+ function validateCriterionContent(text) {
200
+ return [
201
+ ...checkMissingId(text),
202
+ ...checkMissingVersion(text),
203
+ ...checkMissingSchemas(text),
204
+ ...checkEmptyRules(text),
205
+ ...checkMissingRuleProperties(text)
206
+ ];
207
+ }
208
+ var hoverDocs = {
209
+ defineDecision: "**defineDecision(config)**\n\nCreate a new Criterion decision with type inference.\n\n```typescript\ndefineDecision({\n id: string,\n version: string,\n inputSchema: ZodSchema,\n outputSchema: ZodSchema,\n profileSchema: ZodSchema,\n rules: Rule[]\n})\n```",
210
+ inputSchema: "**inputSchema**\n\nZod schema defining the input context for this decision.\n\nExample:\n```typescript\ninputSchema: z.object({\n amount: z.number(),\n country: z.string()\n})\n```",
211
+ outputSchema: "**outputSchema**\n\nZod schema defining the output of this decision.\n\nExample:\n```typescript\noutputSchema: z.object({\n approved: z.boolean(),\n reason: z.string()\n})\n```",
212
+ profileSchema: "**profileSchema**\n\nZod schema defining the profile parameters.\n\nExample:\n```typescript\nprofileSchema: z.object({\n threshold: z.number(),\n blockedCountries: z.array(z.string())\n})\n```",
213
+ when: "**when(ctx, profile)**\n\nCondition function that returns true if this rule should match.\n\n```typescript\nwhen: (ctx, profile) => ctx.amount > profile.threshold\n```",
214
+ emit: "**emit(ctx, profile)**\n\nFunction that returns the output when this rule matches.\n\n```typescript\nemit: (ctx, profile) => ({\n approved: false,\n reason: 'Amount too high'\n})\n```",
215
+ explain: "**explain(ctx, profile)**\n\nFunction that returns a human-readable explanation.\n\n```typescript\nexplain: (ctx) => `Amount ${ctx.amount} exceeded limit`\n```"
216
+ };
217
+ function getHoverDoc(word) {
218
+ return hoverDocs[word];
219
+ }
220
+ function generateDecisionTemplate(name) {
221
+ const pascalName = name.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
222
+ const camelName = pascalName.charAt(0).toLowerCase() + pascalName.slice(1);
223
+ return `import { defineDecision } from "@criterionx/core";
224
+ import { z } from "zod";
225
+
226
+ /**
227
+ * ${pascalName} Decision
228
+ */
229
+ export const ${camelName} = defineDecision({
230
+ id: "${name}",
231
+ version: "1.0.0",
232
+
233
+ inputSchema: z.object({
234
+ // TODO: Define input schema
235
+ value: z.string(),
236
+ }),
237
+
238
+ outputSchema: z.object({
239
+ // TODO: Define output schema
240
+ result: z.string(),
241
+ }),
242
+
243
+ profileSchema: z.object({
244
+ // TODO: Define profile schema
245
+ }),
246
+
247
+ rules: [
248
+ {
249
+ id: "default",
250
+ when: () => true,
251
+ emit: () => ({ result: "OK" }),
252
+ explain: () => "Default rule",
253
+ },
254
+ ],
255
+ });
256
+ `;
257
+ }
258
+
259
+ // src/extension.ts
260
+ var diagnosticCollection;
261
+ function activate(context) {
262
+ console.log("Criterion extension activated");
263
+ diagnosticCollection = vscode.languages.createDiagnosticCollection("criterion");
264
+ context.subscriptions.push(diagnosticCollection);
265
+ const config = vscode.workspace.getConfiguration("criterion");
266
+ if (config.get("validate", true)) {
267
+ context.subscriptions.push(
268
+ vscode.workspace.onDidChangeTextDocument((event) => {
269
+ if (isCriterionContent(event.document.fileName, event.document.getText())) {
270
+ validateDocument(event.document);
271
+ }
272
+ })
273
+ );
274
+ context.subscriptions.push(
275
+ vscode.workspace.onDidOpenTextDocument((document) => {
276
+ if (isCriterionContent(document.fileName, document.getText())) {
277
+ validateDocument(document);
278
+ }
279
+ })
280
+ );
281
+ vscode.workspace.textDocuments.forEach((document) => {
282
+ if (isCriterionContent(document.fileName, document.getText())) {
283
+ validateDocument(document);
284
+ }
285
+ });
286
+ }
287
+ context.subscriptions.push(
288
+ vscode.languages.registerHoverProvider(
289
+ ["typescript", "typescriptreact"],
290
+ new CriterionHoverProvider()
291
+ )
292
+ );
293
+ context.subscriptions.push(
294
+ vscode.commands.registerCommand("criterion.newDecision", createNewDecision)
295
+ );
296
+ }
297
+ function deactivate() {
298
+ if (diagnosticCollection) {
299
+ diagnosticCollection.dispose();
300
+ }
301
+ }
302
+ function validateDocument(document) {
303
+ const text = document.getText();
304
+ const diagnostics = validateCriterionContent(text);
305
+ const vscodeDiagnostics = diagnostics.map((d) => convertDiagnostic(d, document));
306
+ diagnosticCollection.set(document.uri, vscodeDiagnostics);
307
+ }
308
+ function convertDiagnostic(diagnostic, document) {
309
+ const startPos = document.positionAt(diagnostic.range.start);
310
+ const endPos = document.positionAt(diagnostic.range.end);
311
+ const range = new vscode.Range(startPos, endPos);
312
+ const severity = diagnostic.severity === "error" ? vscode.DiagnosticSeverity.Error : diagnostic.severity === "warning" ? vscode.DiagnosticSeverity.Warning : vscode.DiagnosticSeverity.Information;
313
+ return new vscode.Diagnostic(range, diagnostic.message, severity);
314
+ }
315
+ var CriterionHoverProvider = class {
316
+ provideHover(document, position) {
317
+ const range = document.getWordRangeAtPosition(position);
318
+ if (!range) return null;
319
+ const word = document.getText(range);
320
+ const doc = getHoverDoc(word);
321
+ if (doc) {
322
+ return new vscode.Hover(new vscode.MarkdownString(doc));
323
+ }
324
+ return null;
325
+ }
326
+ };
327
+ async function createNewDecision() {
328
+ const name = await vscode.window.showInputBox({
329
+ prompt: "Enter decision name (e.g., risk-assessment)",
330
+ placeHolder: "decision-name"
331
+ });
332
+ if (!name) return;
333
+ const fileName = `${name}.criterion.ts`;
334
+ const content = generateDecisionTemplate(name);
335
+ const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
336
+ if (!workspaceFolder) {
337
+ vscode.window.showErrorMessage("No workspace folder open");
338
+ return;
339
+ }
340
+ const uri = vscode.Uri.joinPath(workspaceFolder.uri, fileName);
341
+ try {
342
+ await vscode.workspace.fs.writeFile(uri, Buffer.from(content));
343
+ const doc = await vscode.workspace.openTextDocument(uri);
344
+ await vscode.window.showTextDocument(doc);
345
+ vscode.window.showInformationMessage(`Created ${fileName}`);
346
+ } catch (error) {
347
+ vscode.window.showErrorMessage(`Failed to create file: ${error}`);
348
+ }
349
+ }
350
+ // Annotate the CommonJS export names for ESM import in node:
351
+ 0 && (module.exports = {
352
+ activate,
353
+ deactivate
354
+ });
@@ -0,0 +1,37 @@
1
+ {
2
+ "comments": {
3
+ "lineComment": "//",
4
+ "blockComment": ["/*", "*/"]
5
+ },
6
+ "brackets": [
7
+ ["{", "}"],
8
+ ["[", "]"],
9
+ ["(", ")"]
10
+ ],
11
+ "autoClosingPairs": [
12
+ { "open": "{", "close": "}" },
13
+ { "open": "[", "close": "]" },
14
+ { "open": "(", "close": ")" },
15
+ { "open": "'", "close": "'", "notIn": ["string", "comment"] },
16
+ { "open": "\"", "close": "\"", "notIn": ["string"] },
17
+ { "open": "`", "close": "`", "notIn": ["string", "comment"] }
18
+ ],
19
+ "surroundingPairs": [
20
+ ["{", "}"],
21
+ ["[", "]"],
22
+ ["(", ")"],
23
+ ["'", "'"],
24
+ ["\"", "\""],
25
+ ["`", "`"]
26
+ ],
27
+ "folding": {
28
+ "markers": {
29
+ "start": "^\\s*//\\s*#?region\\b",
30
+ "end": "^\\s*//\\s*#?endregion\\b"
31
+ }
32
+ },
33
+ "indentationRules": {
34
+ "increaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$",
35
+ "decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$"
36
+ }
37
+ }
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "criterionx-vscode",
3
+ "displayName": "Criterion",
4
+ "description": "VS Code extension for Criterion decision engine - syntax highlighting, snippets, and validation",
5
+ "version": "0.3.1",
6
+ "publisher": "criterionx",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/tomymaritano/criterionx.git",
11
+ "directory": "packages/vscode-extension"
12
+ },
13
+ "engines": {
14
+ "vscode": "^1.85.0"
15
+ },
16
+ "categories": [
17
+ "Programming Languages",
18
+ "Snippets",
19
+ "Linters"
20
+ ],
21
+ "keywords": [
22
+ "criterion",
23
+ "decision-engine",
24
+ "rules-engine",
25
+ "typescript"
26
+ ],
27
+ "activationEvents": [
28
+ "onLanguage:typescript",
29
+ "onLanguage:typescriptreact"
30
+ ],
31
+ "main": "./dist/extension.js",
32
+ "contributes": {
33
+ "languages": [
34
+ {
35
+ "id": "criterion",
36
+ "aliases": [
37
+ "Criterion",
38
+ "criterion"
39
+ ],
40
+ "extensions": [
41
+ ".criterion.ts"
42
+ ],
43
+ "configuration": "./language-configuration.json"
44
+ }
45
+ ],
46
+ "grammars": [
47
+ {
48
+ "language": "criterion",
49
+ "scopeName": "source.criterion",
50
+ "path": "./syntaxes/criterion.tmLanguage.json"
51
+ },
52
+ {
53
+ "scopeName": "source.criterion.injection",
54
+ "path": "./syntaxes/criterion-injection.tmLanguage.json",
55
+ "injectTo": [
56
+ "source.ts",
57
+ "source.tsx"
58
+ ]
59
+ }
60
+ ],
61
+ "snippets": [
62
+ {
63
+ "language": "typescript",
64
+ "path": "./snippets/criterion.json"
65
+ },
66
+ {
67
+ "language": "typescriptreact",
68
+ "path": "./snippets/criterion.json"
69
+ },
70
+ {
71
+ "language": "criterion",
72
+ "path": "./snippets/criterion.json"
73
+ }
74
+ ],
75
+ "configuration": {
76
+ "title": "Criterion",
77
+ "properties": {
78
+ "criterion.validate": {
79
+ "type": "boolean",
80
+ "default": true,
81
+ "description": "Enable/disable validation of Criterion decision files"
82
+ },
83
+ "criterion.trace": {
84
+ "type": "boolean",
85
+ "default": false,
86
+ "description": "Enable trace logging for debugging"
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "devDependencies": {
92
+ "@types/node": "^20.0.0",
93
+ "@types/vscode": "^1.85.0",
94
+ "@vscode/vsce": "^2.22.0",
95
+ "tsup": "^8.0.0",
96
+ "typescript": "^5.3.0",
97
+ "vitest": "^4.0.0"
98
+ },
99
+ "scripts": {
100
+ "build": "tsup src/extension.ts --format cjs --out-dir dist --clean --external vscode",
101
+ "watch": "tsup src/extension.ts --format cjs --out-dir dist --watch --external vscode",
102
+ "test": "vitest run",
103
+ "test:watch": "vitest",
104
+ "test:coverage": "vitest run --coverage",
105
+ "package": "vsce package",
106
+ "typecheck": "tsc --noEmit"
107
+ }
108
+ }