Skip to content

Commit 767f200

Browse files
committed
chore: fixup
1 parent aeb6370 commit 767f200

File tree

19 files changed

+707
-386
lines changed

19 files changed

+707
-386
lines changed

apps/dev-playground/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
"scripts": {
66
"start": "node build/index.mjs",
77
"start:local": "NODE_ENV=production node --env-file=./server/.env build/index.mjs",
8+
"predev": "npm run sync",
89
"dev": "NODE_ENV=development tsx watch server/index.ts",
910
"dev:inspect": "tsx --inspect --tsconfig ./tsconfig.json ./server",
11+
"prebuild": "npm run sync",
12+
"sync": "appkit plugin sync --write --silent",
1013
"build": "npm run build:app",
1114
"build:app": "tsdown --out-dir build server/index.ts && cd client && npm run build",
1215
"build:server": "tsdown --out-dir build server/index.ts",

docs/static/schemas/plugin-manifest.schema.json

Lines changed: 135 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,6 @@
168168
"enum": ["CAN_USE"],
169169
"description": "Permission for Databricks App resources"
170170
},
171-
"resourcePermission": {
172-
"type": "string",
173-
"description": "Permission level required for the resource. Valid values depend on resource type.",
174-
"oneOf": [
175-
{ "$ref": "#/$defs/secretPermission" },
176-
{ "$ref": "#/$defs/jobPermission" },
177-
{ "$ref": "#/$defs/sqlWarehousePermission" },
178-
{ "$ref": "#/$defs/servingEndpointPermission" },
179-
{ "$ref": "#/$defs/volumePermission" },
180-
{ "$ref": "#/$defs/vectorSearchIndexPermission" },
181-
{ "$ref": "#/$defs/ucFunctionPermission" },
182-
{ "$ref": "#/$defs/ucConnectionPermission" },
183-
{ "$ref": "#/$defs/databasePermission" },
184-
{ "$ref": "#/$defs/genieSpacePermission" },
185-
{ "$ref": "#/$defs/experimentPermission" },
186-
{ "$ref": "#/$defs/appPermission" }
187-
]
188-
},
189171
"resourceFieldEntry": {
190172
"type": "object",
191173
"required": ["env"],
@@ -219,13 +201,13 @@
219201
},
220202
"alias": {
221203
"type": "string",
222-
"pattern": "^[a-z][a-zA-Z0-9_]*$",
204+
"minLength": 1,
223205
"description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias.",
224206
"examples": ["SQL Warehouse", "Secret", "Vector search index"]
225207
},
226208
"resourceKey": {
227209
"type": "string",
228-
"pattern": "^[a-z][a-zA-Z0-9_]*$",
210+
"pattern": "^[a-z][a-z0-9-]*$",
229211
"description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup.",
230212
"examples": ["sql-warehouse", "database", "secret"]
231213
},
@@ -235,7 +217,8 @@
235217
"description": "Human-readable description of why this resource is needed"
236218
},
237219
"permission": {
238-
"$ref": "#/$defs/resourcePermission"
220+
"type": "string",
221+
"description": "Permission level required for the resource. Valid values depend on resource type."
239222
},
240223
"fields": {
241224
"type": "object",
@@ -246,7 +229,137 @@
246229
"description": "Map of field name to env and optional description. Single-value types use one key (e.g. id); multi-value (database, secret) use multiple (e.g. instance_name, database_name or scope, key)."
247230
}
248231
},
249-
"additionalProperties": false
232+
"additionalProperties": false,
233+
"allOf": [
234+
{
235+
"if": {
236+
"properties": { "type": { "const": "secret" } },
237+
"required": ["type"]
238+
},
239+
"then": {
240+
"properties": {
241+
"permission": { "$ref": "#/$defs/secretPermission" }
242+
}
243+
}
244+
},
245+
{
246+
"if": {
247+
"properties": { "type": { "const": "job" } },
248+
"required": ["type"]
249+
},
250+
"then": {
251+
"properties": { "permission": { "$ref": "#/$defs/jobPermission" } }
252+
}
253+
},
254+
{
255+
"if": {
256+
"properties": { "type": { "const": "sql_warehouse" } },
257+
"required": ["type"]
258+
},
259+
"then": {
260+
"properties": {
261+
"permission": { "$ref": "#/$defs/sqlWarehousePermission" }
262+
}
263+
}
264+
},
265+
{
266+
"if": {
267+
"properties": { "type": { "const": "serving_endpoint" } },
268+
"required": ["type"]
269+
},
270+
"then": {
271+
"properties": {
272+
"permission": { "$ref": "#/$defs/servingEndpointPermission" }
273+
}
274+
}
275+
},
276+
{
277+
"if": {
278+
"properties": { "type": { "const": "volume" } },
279+
"required": ["type"]
280+
},
281+
"then": {
282+
"properties": {
283+
"permission": { "$ref": "#/$defs/volumePermission" }
284+
}
285+
}
286+
},
287+
{
288+
"if": {
289+
"properties": { "type": { "const": "vector_search_index" } },
290+
"required": ["type"]
291+
},
292+
"then": {
293+
"properties": {
294+
"permission": { "$ref": "#/$defs/vectorSearchIndexPermission" }
295+
}
296+
}
297+
},
298+
{
299+
"if": {
300+
"properties": { "type": { "const": "uc_function" } },
301+
"required": ["type"]
302+
},
303+
"then": {
304+
"properties": {
305+
"permission": { "$ref": "#/$defs/ucFunctionPermission" }
306+
}
307+
}
308+
},
309+
{
310+
"if": {
311+
"properties": { "type": { "const": "uc_connection" } },
312+
"required": ["type"]
313+
},
314+
"then": {
315+
"properties": {
316+
"permission": { "$ref": "#/$defs/ucConnectionPermission" }
317+
}
318+
}
319+
},
320+
{
321+
"if": {
322+
"properties": { "type": { "const": "database" } },
323+
"required": ["type"]
324+
},
325+
"then": {
326+
"properties": {
327+
"permission": { "$ref": "#/$defs/databasePermission" }
328+
}
329+
}
330+
},
331+
{
332+
"if": {
333+
"properties": { "type": { "const": "genie_space" } },
334+
"required": ["type"]
335+
},
336+
"then": {
337+
"properties": {
338+
"permission": { "$ref": "#/$defs/genieSpacePermission" }
339+
}
340+
}
341+
},
342+
{
343+
"if": {
344+
"properties": { "type": { "const": "experiment" } },
345+
"required": ["type"]
346+
},
347+
"then": {
348+
"properties": {
349+
"permission": { "$ref": "#/$defs/experimentPermission" }
350+
}
351+
}
352+
},
353+
{
354+
"if": {
355+
"properties": { "type": { "const": "app" } },
356+
"required": ["type"]
357+
},
358+
"then": {
359+
"properties": { "permission": { "$ref": "#/$defs/appPermission" } }
360+
}
361+
}
362+
]
250363
},
251364
"configSchemaProperty": {
252365
"type": "object",

docs/static/schemas/template-plugins.schema.json

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -91,89 +91,13 @@
9191
"additionalProperties": false
9292
},
9393
"resourceType": {
94-
"type": "string",
95-
"enum": [
96-
"secret",
97-
"job",
98-
"sql_warehouse",
99-
"serving_endpoint",
100-
"volume",
101-
"vector_search_index",
102-
"uc_function",
103-
"uc_connection",
104-
"database",
105-
"genie_space",
106-
"experiment",
107-
"app"
108-
],
109-
"description": "Type of Databricks resource"
110-
},
111-
"resourcePermission": {
112-
"type": "string",
113-
"description": "Permission level required for the resource. Valid values depend on resource type.",
114-
"examples": ["CAN_USE", "CAN_MANAGE", "READ", "WRITE", "EXECUTE"]
94+
"$ref": "plugin-manifest.schema.json#/$defs/resourceType"
11595
},
11696
"resourceFieldEntry": {
117-
"type": "object",
118-
"required": ["env"],
119-
"properties": {
120-
"env": {
121-
"type": "string",
122-
"pattern": "^[A-Z][A-Z0-9_]*$",
123-
"description": "Environment variable name for this field",
124-
"examples": ["DATABRICKS_CACHE_INSTANCE", "SECRET_SCOPE"]
125-
},
126-
"description": {
127-
"type": "string",
128-
"description": "Human-readable description for this field"
129-
}
130-
},
131-
"additionalProperties": false
97+
"$ref": "plugin-manifest.schema.json#/$defs/resourceFieldEntry"
13298
},
13399
"resourceRequirement": {
134-
"type": "object",
135-
"required": [
136-
"type",
137-
"alias",
138-
"resourceKey",
139-
"description",
140-
"permission",
141-
"fields"
142-
],
143-
"properties": {
144-
"type": {
145-
"$ref": "#/$defs/resourceType"
146-
},
147-
"alias": {
148-
"type": "string",
149-
"pattern": "^[a-z][a-zA-Z0-9_]*$",
150-
"description": "Unique alias for this resource within the plugin (UI/display)",
151-
"examples": ["SQL Warehouse", "Secret", "Vector search index"]
152-
},
153-
"resourceKey": {
154-
"type": "string",
155-
"pattern": "^[a-z][a-zA-Z0-9_]*$",
156-
"description": "Stable key for machine use (env naming, composite keys, app.yaml).",
157-
"examples": ["sql-warehouse", "database", "secret"]
158-
},
159-
"description": {
160-
"type": "string",
161-
"minLength": 1,
162-
"description": "Human-readable description of why this resource is needed"
163-
},
164-
"permission": {
165-
"$ref": "#/$defs/resourcePermission"
166-
},
167-
"fields": {
168-
"type": "object",
169-
"additionalProperties": {
170-
"$ref": "#/$defs/resourceFieldEntry"
171-
},
172-
"minProperties": 1,
173-
"description": "Map of field name to env and optional description. Single-value types use one key (e.g. id); multi-value (database, secret) use multiple (e.g. instance_name, database_name or scope, key)."
174-
}
175-
},
176-
"additionalProperties": false
100+
"$ref": "plugin-manifest.schema.json#/$defs/resourceRequirement"
177101
}
178102
}
179103
}

packages/shared/src/cli/commands/plugin-add-resource.ts renamed to packages/shared/src/cli/commands/plugin/add-resource/add-resource.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
humanizeResourceType,
1010
RESOURCE_TYPE_OPTIONS,
1111
resourceKeyFromType,
12-
} from "../plugin-create/resource-defaults.js";
13-
import { validateManifest } from "../plugin-validate/validate-manifest.js";
12+
} from "../create/resource-defaults";
13+
import { validateManifest } from "../validate/validate-manifest";
1414

1515
interface ManifestWithResources {
1616
$schema?: string;

packages/shared/src/cli/commands/plugin-create.ts renamed to packages/shared/src/cli/commands/plugin/create/create.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ import { Command } from "commander";
1616
import {
1717
humanizeResourceType,
1818
RESOURCE_TYPE_OPTIONS,
19-
} from "../plugin-create/resource-defaults.js";
20-
import { resolveTargetDir, scaffoldPlugin } from "../plugin-create/scaffold.js";
21-
import type {
22-
CreateAnswers,
23-
Placement,
24-
SelectedResource,
25-
} from "../plugin-create/types.js";
19+
} from "./resource-defaults";
20+
import { resolveTargetDir, scaffoldPlugin } from "./scaffold";
21+
import type { CreateAnswers, Placement, SelectedResource } from "./types";
2622

2723
const NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
2824
const DEFAULT_VERSION = "1.0.0";

packages/shared/src/cli/plugin-create/resource-defaults.ts renamed to packages/shared/src/cli/commands/plugin/create/resource-defaults.ts

File renamed without changes.

packages/shared/src/cli/plugin-create/scaffold.ts renamed to packages/shared/src/cli/commands/plugin/create/scaffold.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
humanizeResourceType,
77
MANIFEST_SCHEMA_ID,
88
resourceKeyFromType,
9-
} from "./resource-defaults.js";
10-
import type { CreateAnswers } from "./types.js";
9+
} from "./resource-defaults";
10+
import type { CreateAnswers } from "./types";
1111

1212
/** Convert kebab-name to PascalCase (e.g. my-plugin -> MyPlugin). */
1313
function toPascalCase(name: string): string {
File renamed without changes.

packages/shared/src/cli/commands/plugins.ts renamed to packages/shared/src/cli/commands/plugin/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Command } from "commander";
2-
import { pluginAddResourceCommand } from "./plugin-add-resource.js";
3-
import { pluginCreateCommand } from "./plugin-create.js";
4-
import { pluginListCommand } from "./plugin-list.js";
5-
import { pluginValidateCommand } from "./plugin-validate.js";
6-
import { pluginsSyncCommand } from "./plugins-sync.js";
2+
import { pluginAddResourceCommand } from "./add-resource/add-resource";
3+
import { pluginCreateCommand } from "./create/create";
4+
import { pluginListCommand } from "./list/list";
5+
import { pluginsSyncCommand } from "./sync/sync";
6+
import { pluginValidateCommand } from "./validate/validate";
77

88
/**
99
* Parent command for plugin management operations.

packages/shared/src/cli/commands/plugin-list.ts renamed to packages/shared/src/cli/commands/plugin/list/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from "node:fs";
22
import path from "node:path";
33
import process from "node:process";
44
import { Command } from "commander";
5-
import { validateManifest } from "../plugin-validate/validate-manifest.js";
5+
import { validateManifest } from "../validate/validate-manifest";
66

77
interface PluginRow {
88
name: string;

0 commit comments

Comments
 (0)