objectstack-vscode 4.0.3 → 4.0.5

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/package.json CHANGED
@@ -2,15 +2,17 @@
2
2
  "name": "objectstack-vscode",
3
3
  "displayName": "ObjectStack",
4
4
  "description": "ObjectStack Protocol — Autocomplete, validation, and inline diagnostics for .object.ts, .view.ts, and objectstack.config.ts files",
5
- "version": "4.0.3",
5
+ "version": "4.0.5",
6
6
  "publisher": "objectstack",
7
7
  "license": "Apache-2.0",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/nickmessing/spec"
10
+ "url": "https://github.com/objectstack-ai/framework.git",
11
+ "directory": "packages/vscode-objectstack"
11
12
  },
12
13
  "engines": {
13
- "vscode": "^1.85.0"
14
+ "vscode": "^1.85.0",
15
+ "node": ">=18.0.0"
14
16
  },
15
17
  "categories": [
16
18
  "Programming Languages",
@@ -52,10 +54,27 @@
52
54
  ]
53
55
  },
54
56
  "devDependencies": {
55
- "@types/vscode": "^1.115.0",
56
- "@vscode/vsce": "^3.7.1",
57
- "typescript": "^6.0.2"
57
+ "@types/vscode": "^1.118.0",
58
+ "@vscode/vsce": "^3.9.1",
59
+ "typescript": "^6.0.3"
58
60
  },
61
+ "keywords": [
62
+ "objectstack",
63
+ "vscode",
64
+ "extension",
65
+ "intellisense",
66
+ "schema"
67
+ ],
68
+ "author": "ObjectStack",
69
+ "homepage": "https://objectstack.ai/docs",
70
+ "bugs": "https://github.com/objectstack-ai/framework/issues",
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "files": [
75
+ "dist",
76
+ "README.md"
77
+ ],
59
78
  "scripts": {
60
79
  "build": "tsc -p ./tsconfig.json",
61
80
  "watch": "tsc -watch -p ./tsconfig.json",
@@ -1,4 +0,0 @@
1
-
2
- > objectstack-vscode@4.0.3 build /home/runner/work/framework/framework/packages/vscode-objectstack
3
- > tsc -p ./tsconfig.json
4
-
package/CHANGELOG.md DELETED
@@ -1,43 +0,0 @@
1
- # objectstack-vscode
2
-
3
- ## 4.0.3
4
-
5
- ## 4.0.2
6
-
7
- ## 4.0.0
8
-
9
- ## 3.3.1
10
-
11
- ## 3.3.0
12
-
13
- ## 3.2.9
14
-
15
- ## 3.2.8
16
-
17
- ## 3.2.7
18
-
19
- ## 3.2.6
20
-
21
- ## 3.2.5
22
-
23
- ## 3.2.4
24
-
25
- ## 3.2.3
26
-
27
- ## 3.2.2
28
-
29
- ## 3.2.1
30
-
31
- ## 3.2.0
32
-
33
- ## 3.1.1
34
-
35
- ## 3.1.0
36
-
37
- ## 3.0.11
38
-
39
- ## 3.0.10
40
-
41
- ## 3.0.9
42
-
43
- ## 3.0.8
@@ -1,19 +0,0 @@
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
- }
@@ -1,168 +0,0 @@
1
- {
2
- "ObjectStack: Define Object": {
3
- "prefix": "os-object",
4
- "description": "Define a new ObjectStack business object",
5
- "body": [
6
- "import { Data } from '@objectstack/spec';",
7
- "",
8
- "const ${1:myObject}: Data.Object = {",
9
- " name: '${2:my_object}',",
10
- " label: '${3:My Object}',",
11
- " pluralLabel: '${3:My Object}s',",
12
- " ownership: 'own',",
13
- " fields: {",
14
- " name: {",
15
- " type: 'text',",
16
- " label: 'Name',",
17
- " required: true,",
18
- " maxLength: 255,",
19
- " },",
20
- " $0",
21
- " },",
22
- "};",
23
- "",
24
- "export default ${1:myObject};"
25
- ]
26
- },
27
- "ObjectStack: Text Field": {
28
- "prefix": "os-field-text",
29
- "description": "Add a text field to an object",
30
- "body": [
31
- "${1:field_name}: {",
32
- " type: 'text',",
33
- " label: '${2:Field Label}',",
34
- " required: ${3|false,true|},",
35
- " maxLength: ${4:255},",
36
- "},"
37
- ]
38
- },
39
- "ObjectStack: Select Field": {
40
- "prefix": "os-field-select",
41
- "description": "Add a select (picklist) field to an object",
42
- "body": [
43
- "${1:status}: {",
44
- " type: 'select',",
45
- " label: '${2:Status}',",
46
- " required: ${3|false,true|},",
47
- " options: [",
48
- " { label: '${4:Active}', value: '${5:active}' },",
49
- " { label: '${6:Inactive}', value: '${7:inactive}' },",
50
- " ],",
51
- " defaultValue: '${5:active}',",
52
- "},"
53
- ]
54
- },
55
- "ObjectStack: Lookup Field": {
56
- "prefix": "os-field-lookup",
57
- "description": "Add a lookup (reference) field to an object",
58
- "body": [
59
- "${1:related_object}: {",
60
- " type: 'lookup',",
61
- " label: '${2:Related Object}',",
62
- " required: ${3|false,true|},",
63
- " reference: {",
64
- " object: '${4:target_object}',",
65
- " labelField: '${5:name}',",
66
- " },",
67
- "},"
68
- ]
69
- },
70
- "ObjectStack: Grid List View": {
71
- "prefix": "os-view-grid",
72
- "description": "Define a grid list view for an object",
73
- "body": [
74
- "import { UI } from '@objectstack/spec';",
75
- "",
76
- "const ${1:myObject}ListView: UI.View = {",
77
- " name: '${2:my_object}_list',",
78
- " label: '${3:My Object} List',",
79
- " type: 'list',",
80
- " objectName: '${2:my_object}',",
81
- " list: {",
82
- " type: 'grid',",
83
- " columns: [",
84
- " { field: 'name', width: 200 },",
85
- " $0",
86
- " ],",
87
- " defaultSort: { field: 'name', direction: 'asc' },",
88
- " pageSize: 25,",
89
- " },",
90
- "};",
91
- "",
92
- "export default ${1:myObject}ListView;"
93
- ]
94
- },
95
- "ObjectStack: Automation Flow": {
96
- "prefix": "os-flow",
97
- "description": "Define an automation flow",
98
- "body": [
99
- "import { Automation } from '@objectstack/spec';",
100
- "",
101
- "const ${1:myFlow}: Automation.Flow = {",
102
- " name: '${2:my_flow}',",
103
- " label: '${3:My Flow}',",
104
- " type: '${4|autolaunched,screen,schedule|}',",
105
- " status: 'draft',",
106
- " trigger: {",
107
- " type: 'record_change',",
108
- " object: '${5:my_object}',",
109
- " events: ['after_insert', 'after_update'],",
110
- " },",
111
- " nodes: [",
112
- " {",
113
- " id: 'start',",
114
- " type: 'start',",
115
- " name: 'Start',",
116
- " next: '${6:end}',",
117
- " },",
118
- " $0",
119
- " ],",
120
- "};",
121
- "",
122
- "export default ${1:myFlow};"
123
- ]
124
- },
125
- "ObjectStack: defineStack Boilerplate": {
126
- "prefix": "os-stack",
127
- "description": "Full defineStack boilerplate for objectstack.config.ts",
128
- "body": [
129
- "import { defineStack } from '@objectstack/spec';",
130
- "",
131
- "export default defineStack({",
132
- " manifest: {",
133
- " name: '${1:my_app}',",
134
- " version: '${2:0.1.0}',",
135
- " label: '${3:My Application}',",
136
- " },",
137
- " objects: [",
138
- " $0",
139
- " ],",
140
- " views: [],",
141
- " plugins: [],",
142
- "});"
143
- ]
144
- },
145
- "ObjectStack: AI Agent Definition": {
146
- "prefix": "os-agent",
147
- "description": "Define an AI agent",
148
- "body": [
149
- "import { AI } from '@objectstack/spec';",
150
- "",
151
- "const ${1:myAgent}: AI.Agent = {",
152
- " name: '${2:my_agent}',",
153
- " label: '${3:My Agent}',",
154
- " role: '${4:Assistant}',",
155
- " instructions: '${5:You are a helpful assistant.}',",
156
- " model: {",
157
- " provider: '${6|openai,anthropic,google|}',",
158
- " model: '${7:gpt-4o}',",
159
- " },",
160
- " tools: [",
161
- " $0",
162
- " ],",
163
- "};",
164
- "",
165
- "export default ${1:myAgent};"
166
- ]
167
- }
168
- }
package/src/extension.ts DELETED
@@ -1,226 +0,0 @@
1
- // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
-
3
- import * as vscode from 'vscode';
4
-
5
- /** Well-known ObjectStack field types for hover documentation */
6
- const FIELD_TYPE_DOCS: Record<string, string> = {
7
- text: 'Single-line text field (max 255 chars by default)',
8
- textarea: 'Multi-line text area for longer content',
9
- richtext: 'Rich text editor with HTML formatting',
10
- number: 'Decimal number with configurable precision',
11
- integer: 'Whole number without decimals',
12
- currency: 'Monetary value with currency code',
13
- boolean: 'True/false toggle',
14
- date: 'Calendar date (no time)',
15
- datetime: 'Date with time and timezone',
16
- select: 'Single-choice picklist (requires `options`)',
17
- multiselect: 'Multi-choice picklist (requires `options`)',
18
- lookup: 'Reference to another object (requires `reference`)',
19
- master_detail: 'Parent-child relationship with cascade delete',
20
- formula: 'Computed field using expressions',
21
- email: 'Email address with validation',
22
- phone: 'Phone number',
23
- url: 'URL with protocol validation',
24
- image: 'Image file reference',
25
- file: 'File attachment reference',
26
- json: 'Arbitrary JSON data',
27
- uuid: 'Universally unique identifier',
28
- slug: 'URL-friendly identifier (auto-generated from name)',
29
- rating: 'Numeric star rating',
30
- color: 'Hex color value (#RRGGBB)',
31
- vector: 'Numeric vector for AI embeddings and similarity search',
32
- encrypted: 'Encrypted at rest — displayed masked in UI',
33
- autonumber: 'Auto-incrementing display number',
34
- geo_point: 'Geographic coordinates (lat/lng)',
35
- };
36
-
37
- /** ObjectStack schema keywords for hover tooltips */
38
- const SCHEMA_DOCS: Record<string, string> = {
39
- defineStack: 'Define an ObjectStack project or plugin. Validates against ObjectStackDefinitionSchema.',
40
- defineView: 'Type-safe helper to define a list or form view for an object.',
41
- defineApp: 'Type-safe helper to define an application with navigation.',
42
- defineFlow: 'Type-safe helper to define an automation flow.',
43
- defineAgent: 'Type-safe helper to define an AI agent with tools and instructions.',
44
- manifest: 'Project package configuration — name, version, label, and metadata.',
45
- objects: 'Business object definitions with fields, validation, and relationships.',
46
- views: 'List and form view configurations for object data display.',
47
- flows: 'Automation flows — screen flows, auto-launched, or scheduled.',
48
- agents: 'AI agent definitions with model config, tools, and instructions.',
49
- actions: 'Button actions, batch operations, and URL redirects.',
50
- dashboards: 'Analytics dashboard layouts with widget grids.',
51
- permissions: 'Permission sets defining CRUD access per object and field.',
52
- roles: 'User role hierarchy for access control.',
53
- plugins: 'External plugins to load into the stack.',
54
- ownership: "Record ownership model: 'own' (creator-owned) or 'shared'.",
55
- objectName: 'Snake_case reference to a business object (e.g. project_task).',
56
- };
57
-
58
- let diagnosticCollection: vscode.DiagnosticCollection;
59
-
60
- export function activate(context: vscode.ExtensionContext): void {
61
- diagnosticCollection = vscode.languages.createDiagnosticCollection('objectstack');
62
- context.subscriptions.push(diagnosticCollection);
63
-
64
- // Watch for objectstack.config.ts changes
65
- const configWatcher = vscode.workspace.createFileSystemWatcher('**/objectstack.config.ts');
66
-
67
- configWatcher.onDidChange((uri) => {
68
- validateConfigFile(uri);
69
- });
70
-
71
- configWatcher.onDidCreate((uri) => {
72
- validateConfigFile(uri);
73
- });
74
-
75
- context.subscriptions.push(configWatcher);
76
-
77
- // Register hover provider for TypeScript files
78
- const hoverProvider = vscode.languages.registerHoverProvider(
79
- [
80
- { scheme: 'file', pattern: '**/*.object.ts' },
81
- { scheme: 'file', pattern: '**/*.view.ts' },
82
- { scheme: 'file', pattern: '**/objectstack.config.ts' },
83
- { scheme: 'file', language: 'typescript' },
84
- ],
85
- {
86
- provideHover(document, position) {
87
- const range = document.getWordRangeAtPosition(position);
88
- if (!range) return undefined;
89
-
90
- const word = document.getText(range);
91
-
92
- // Check schema-level keywords
93
- if (SCHEMA_DOCS[word]) {
94
- return new vscode.Hover(
95
- new vscode.MarkdownString(`**ObjectStack** — \`${word}\`\n\n${SCHEMA_DOCS[word]}`),
96
- );
97
- }
98
-
99
- // Check field type values (e.g. type: 'text')
100
- const line = document.lineAt(position.line).text;
101
- const typeMatch = line.match(/type:\s*['"](\w+)['"]/);
102
- if (typeMatch && FIELD_TYPE_DOCS[typeMatch[1]]) {
103
- const fieldType = typeMatch[1];
104
- if (word === fieldType || word === 'type') {
105
- return new vscode.Hover(
106
- new vscode.MarkdownString(
107
- `**ObjectStack Field Type** — \`${fieldType}\`\n\n${FIELD_TYPE_DOCS[fieldType]}`,
108
- ),
109
- );
110
- }
111
- }
112
-
113
- return undefined;
114
- },
115
- },
116
- );
117
-
118
- context.subscriptions.push(hoverProvider);
119
-
120
- // Register code action provider stub for quick fixes
121
- const codeActionProvider = vscode.languages.registerCodeActionsProvider(
122
- [
123
- { scheme: 'file', pattern: '**/*.object.ts' },
124
- { scheme: 'file', pattern: '**/*.view.ts' },
125
- { scheme: 'file', pattern: '**/objectstack.config.ts' },
126
- ],
127
- {
128
- provideCodeActions(document, range, context) {
129
- const actions: vscode.CodeAction[] = [];
130
-
131
- for (const diagnostic of context.diagnostics) {
132
- if (diagnostic.source !== 'objectstack') continue;
133
-
134
- // Quick fix: add missing label
135
- if (diagnostic.message.includes('missing label')) {
136
- const fix = new vscode.CodeAction(
137
- 'Add missing label property',
138
- vscode.CodeActionKind.QuickFix,
139
- );
140
- fix.diagnostics = [diagnostic];
141
- fix.isPreferred = true;
142
- actions.push(fix);
143
- }
144
-
145
- // Quick fix: convert to snake_case
146
- if (diagnostic.message.includes('snake_case')) {
147
- const fix = new vscode.CodeAction(
148
- 'Convert name to snake_case',
149
- vscode.CodeActionKind.QuickFix,
150
- );
151
- fix.diagnostics = [diagnostic];
152
- actions.push(fix);
153
- }
154
- }
155
-
156
- return actions;
157
- },
158
- },
159
- { providedCodeActionKinds: [vscode.CodeActionKind.QuickFix] },
160
- );
161
-
162
- context.subscriptions.push(codeActionProvider);
163
-
164
- // Validate open config files on activation
165
- if (vscode.window.activeTextEditor) {
166
- const uri = vscode.window.activeTextEditor.document.uri;
167
- if (uri.fsPath.endsWith('objectstack.config.ts')) {
168
- validateConfigFile(uri);
169
- }
170
- }
171
- }
172
-
173
- /**
174
- * Basic validation for objectstack.config.ts files.
175
- * Checks for common structural issues and reports diagnostics.
176
- */
177
- function validateConfigFile(uri: vscode.Uri): void {
178
- const document = vscode.workspace.textDocuments.find(
179
- (doc) => doc.uri.toString() === uri.toString(),
180
- );
181
- if (!document) return;
182
-
183
- const diagnostics: vscode.Diagnostic[] = [];
184
- const text = document.getText();
185
-
186
- // Check for missing manifest
187
- if (text.includes('defineStack') && !text.includes('manifest')) {
188
- const defineStackPos = text.indexOf('defineStack');
189
- const pos = document.positionAt(defineStackPos);
190
- diagnostics.push(
191
- new vscode.Diagnostic(
192
- new vscode.Range(pos, pos.translate(0, 'defineStack'.length)),
193
- 'defineStack requires a "manifest" property with name and version',
194
- vscode.DiagnosticSeverity.Warning,
195
- ),
196
- );
197
- }
198
-
199
- // Check for camelCase object names (should be snake_case)
200
- const nameMatches = text.matchAll(/name:\s*['"]([a-z][a-zA-Z]+)['"]/g);
201
- for (const match of nameMatches) {
202
- if (match[1] && /[A-Z]/.test(match[1]) && match.index !== undefined) {
203
- const pos = document.positionAt(match.index);
204
- const endPos = document.positionAt(match.index + match[0].length);
205
- diagnostics.push(
206
- new vscode.Diagnostic(
207
- new vscode.Range(pos, endPos),
208
- `Object/field name "${match[1]}" should use snake_case (e.g. "${toSnakeCase(match[1])}")`,
209
- vscode.DiagnosticSeverity.Warning,
210
- ),
211
- );
212
- }
213
- }
214
-
215
- diagnosticCollection.set(uri, diagnostics);
216
- }
217
-
218
- function toSnakeCase(str: string): string {
219
- return str.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
220
- }
221
-
222
- export function deactivate(): void {
223
- if (diagnosticCollection) {
224
- diagnosticCollection.dispose();
225
- }
226
- }
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "ES2022",
5
- "lib": ["ES2022"],
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "sourceMap": true
15
- },
16
- "include": ["src"],
17
- "exclude": ["node_modules", "dist"]
18
- }