diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..20e8e28c9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Mark auto-generated artifacts as such so GitHub collapses them in the +# diff view and they are excluded from language stats. The files are +# regenerated by the build pipeline; reviewers should not need to read +# the diffs. + +# JSON Schemas emitted from Zod by tools/generate-json-schema.ts +docs/static/schemas/*.schema.json linguist-generated=true + +# Synced template manifest emitted by `pnpm sync:template` +template/appkit.plugins.json linguist-generated=true + +# TypeScript types emitted by tools/generate-registry-types.ts and +# tools/generate-plugin-entries.ts +packages/appkit/src/registry/types.generated.ts linguist-generated=true +packages/appkit/src/plugins/*-exports.generated.ts linguist-generated=true + +# Typedoc API reference generated from JSDoc + inferred types +docs/docs/api/** linguist-generated=true + +# pnpm lockfile is generated; reviewers care about package.json changes, +# not the lockfile diff +pnpm-lock.yaml linguist-generated=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 368067f5e..158c85581 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,10 +56,11 @@ jobs: run: | pnpm run generate:types if ! git diff --exit-code \ - packages/shared/src/schemas/plugin-manifest.generated.ts \ packages/appkit/src/registry/types.generated.ts \ packages/appkit/src/plugins/ga-exports.generated.ts \ packages/appkit/src/plugins/beta-exports.generated.ts \ + docs/static/schemas/plugin-manifest.schema.json \ + docs/static/schemas/template-plugins.schema.json \ docs/docs/plugins/analytics.md \ docs/docs/plugins/files.md \ docs/docs/plugins/genie.md \ @@ -80,11 +81,7 @@ jobs: # `pnpm run sync:template` runs through `packages/shared/bin/appkit.js` # which imports the built `packages/shared/dist/cli/index.js`. The # lint job doesn't otherwise build, so build just shared's dist - # before invoking sync. We invoke tsdown directly rather than - # `pnpm --filter shared build:package` because the latter also - # re-runs `generate-schema-types.ts`, which writes the raw (unformatted) - # version of `plugin-manifest.generated.ts` and trips the biome - # check that runs immediately after. ~1s. + # before invoking sync. run: pnpm --filter shared exec tsdown --config tsdown.config.ts - name: Check synced template manifest is up to date run: | diff --git a/.gitignore b/.gitignore index 5d417368a..645f5cf52 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ coverage .turbo .databricks + +.claude/scheduled_tasks.lock diff --git a/docs/docs/api/appkit/Enumeration.ResourceType.md b/docs/docs/api/appkit/Enumeration.ResourceType.md index 2dc2e2b31..7d8c6f5de 100644 --- a/docs/docs/api/appkit/Enumeration.ResourceType.md +++ b/docs/docs/api/appkit/Enumeration.ResourceType.md @@ -1,6 +1,6 @@ # Enumeration: ResourceType -Resource types from schema $defs.resourceType.enum +Resource types from resourceTypeSchema.options ## Enumeration Members diff --git a/docs/docs/api/appkit/Interface.PluginManifest.md b/docs/docs/api/appkit/Interface.PluginManifest.md index 0f12a2b48..b5f9ff206 100644 --- a/docs/docs/api/appkit/Interface.PluginManifest.md +++ b/docs/docs/api/appkit/Interface.PluginManifest.md @@ -6,7 +6,7 @@ Extends the shared PluginManifest with strict resource types. ## See - - `packages/shared/src/schemas/plugin-manifest.generated.ts` `PluginManifest` — generated base + - `packages/shared/src/schemas/manifest.ts` `pluginManifestSchema` — Zod source of truth - SharedPluginManifest — shared re-export with JSONSchema7 config ## Extends @@ -27,8 +27,6 @@ Extends the shared PluginManifest with strict resource types. optional author: string; ``` -Author name or organization - #### Inherited from ```ts @@ -62,8 +60,6 @@ schema: JSONSchema7; description: string; ``` -Brief description of what the plugin does - #### Inherited from ```ts @@ -78,8 +74,6 @@ Omit.description displayName: string; ``` -Human-readable display name for UI and CLI - #### Inherited from ```ts @@ -94,8 +88,6 @@ Omit.displayName optional hidden: boolean; ``` -When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync. - #### Inherited from ```ts @@ -110,8 +102,6 @@ Omit.hidden optional keywords: string[]; ``` -Keywords for plugin discovery - #### Inherited from ```ts @@ -126,8 +116,6 @@ Omit.keywords optional license: string; ``` -SPDX license identifier - #### Inherited from ```ts @@ -158,8 +146,6 @@ Omit.name optional onSetupMessage: string; ``` -Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning). - #### Inherited from ```ts @@ -168,14 +154,41 @@ Omit.onSetupMessage *** +### postScaffold? + +```ts +optional postScaffold: { + instruction: string; + required?: boolean; +}[]; +``` + +#### instruction + +```ts +instruction: string; +``` + +#### required? + +```ts +optional required: boolean; +``` + +#### Inherited from + +```ts +Omit.postScaffold +``` + +*** + ### repository? ```ts optional repository: string; ``` -URL to the plugin's source repository - #### Inherited from ```ts @@ -219,8 +232,6 @@ Resources that must be available for the plugin to function optional stability: "beta" | "ga"; ``` -Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly. - #### Inherited from ```ts @@ -235,8 +246,6 @@ Omit.stability optional version: string; ``` -Plugin version (semver format) - #### Inherited from ```ts diff --git a/docs/docs/api/appkit/Interface.ResourceEntry.md b/docs/docs/api/appkit/Interface.ResourceEntry.md index f9e20e921..797c64da8 100644 --- a/docs/docs/api/appkit/Interface.ResourceEntry.md +++ b/docs/docs/api/appkit/Interface.ResourceEntry.md @@ -15,7 +15,7 @@ Extends ResourceRequirement with resolution state and plugin ownership. alias: string; ``` -Human-readable label for UI/display only. Deduplication uses resourceKey, not alias. +Human-readable label for UI/display only. #### Inherited from @@ -29,7 +29,7 @@ Human-readable label for UI/display only. Deduplication uses resourceKey, not al description: string; ``` -Human-readable description of why this resource is needed +Human-readable description of why this resource is needed. #### Inherited from @@ -43,7 +43,7 @@ Human-readable description of why this resource is needed fields: Record; ``` -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). +Map of field name to field entry. Required at runtime. #### Inherited from @@ -93,6 +93,8 @@ Plugin(s) that require this resource (comma-separated if multiple) required: boolean; ``` +Whether the resource is mandatory at runtime. + #### Inherited from [`ResourceRequirement`](Interface.ResourceRequirement.md).[`required`](Interface.ResourceRequirement.md#required) @@ -115,7 +117,7 @@ Whether the resource has been resolved (all field env vars set) resourceKey: string; ``` -Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup. +Stable key for machine use: deduplication, env naming, composite keys, app.yaml. #### Inherited from diff --git a/docs/docs/api/appkit/Interface.ResourceFieldEntry.md b/docs/docs/api/appkit/Interface.ResourceFieldEntry.md deleted file mode 100644 index 324a82f01..000000000 --- a/docs/docs/api/appkit/Interface.ResourceFieldEntry.md +++ /dev/null @@ -1,76 +0,0 @@ -# Interface: ResourceFieldEntry - -Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key). - -This interface was referenced by `PluginManifest`'s JSON-Schema -via the `definition` "resourceFieldEntry". - -## Properties - -### bundleIgnore? - -```ts -optional bundleIgnore: boolean; -``` - -When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation. - -*** - -### description? - -```ts -optional description: string; -``` - -Human-readable description for this field - -*** - -### env? - -```ts -optional env: string; -``` - -Environment variable name for this field - -*** - -### examples? - -```ts -optional examples: string[]; -``` - -Example values showing the expected format for this field - -*** - -### localOnly? - -```ts -optional localOnly: boolean; -``` - -When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time. - -*** - -### resolve? - -```ts -optional resolve: string; -``` - -Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow. - -*** - -### value? - -```ts -optional value: string; -``` - -Static value for this field. Used when no prompted or resolved value exists. diff --git a/docs/docs/api/appkit/Interface.ResourceRequirement.md b/docs/docs/api/appkit/Interface.ResourceRequirement.md index b2112040b..c188e2d57 100644 --- a/docs/docs/api/appkit/Interface.ResourceRequirement.md +++ b/docs/docs/api/appkit/Interface.ResourceRequirement.md @@ -2,16 +2,14 @@ Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). -Narrows the generated base: type → ResourceType enum, permission → ResourcePermission union. -## See - - - `packages/shared/src/schemas/plugin-manifest.generated.ts` `ResourceRequirement` — generated base - - SharedResourceRequirement — shared re-export with runtime `fields` and `required` - -## Extends - -- `ResourceRequirement` +Defined as a flat structural shape rather than narrowing the shared +discriminated-union `ResourceRequirement`. The registry needs to construct +and pass these values around at runtime where `type` and `permission` are +looked up dynamically from a string; preserving per-variant tightness here +would force every constructor to thread variant types end-to-end. The +runtime guarantee (permission valid for type) is enforced by the manifest +schema's parse, not by the registry's static types. ## Extended by @@ -25,13 +23,7 @@ Narrows the generated base: type → ResourceType enum, permission → ResourceP alias: string; ``` -Human-readable label for UI/display only. Deduplication uses resourceKey, not alias. - -#### Inherited from - -```ts -SharedResourceRequirement.alias -``` +Human-readable label for UI/display only. *** @@ -41,13 +33,7 @@ SharedResourceRequirement.alias description: string; ``` -Human-readable description of why this resource is needed - -#### Inherited from - -```ts -SharedResourceRequirement.description -``` +Human-readable description of why this resource is needed. *** @@ -57,13 +43,7 @@ SharedResourceRequirement.description fields: Record; ``` -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). - -#### Inherited from - -```ts -SharedResourceRequirement.fields -``` +Map of field name to field entry. Required at runtime. *** @@ -75,12 +55,6 @@ permission: ResourcePermission; Required permission level for the resource (narrowed to union) -#### Overrides - -```ts -SharedResourceRequirement.permission -``` - *** ### required @@ -89,11 +63,7 @@ SharedResourceRequirement.permission required: boolean; ``` -#### Inherited from - -```ts -SharedResourceRequirement.required -``` +Whether the resource is mandatory at runtime. *** @@ -103,13 +73,7 @@ SharedResourceRequirement.required resourceKey: string; ``` -Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup. - -#### Inherited from - -```ts -SharedResourceRequirement.resourceKey -``` +Stable key for machine use: deduplication, env naming, composite keys, app.yaml. *** @@ -120,9 +84,3 @@ type: ResourceType; ``` Type of Databricks resource required (narrowed to enum) - -#### Overrides - -```ts -SharedResourceRequirement.type -``` diff --git a/docs/docs/api/appkit/TypeAlias.ResourceFieldEntry.md b/docs/docs/api/appkit/TypeAlias.ResourceFieldEntry.md new file mode 100644 index 000000000..d1d7c9920 --- /dev/null +++ b/docs/docs/api/appkit/TypeAlias.ResourceFieldEntry.md @@ -0,0 +1,5 @@ +# Type Alias: ResourceFieldEntry + +```ts +type ResourceFieldEntry = z.infer; +``` diff --git a/docs/docs/api/appkit/index.md b/docs/docs/api/appkit/index.md index 5a21e935f..c30cd0f45 100644 --- a/docs/docs/api/appkit/index.md +++ b/docs/docs/api/appkit/index.md @@ -8,7 +8,7 @@ plugin architecture, and React integration. | Enumeration | Description | | ------ | ------ | | [RequestedClaimsPermissionSet](Enumeration.RequestedClaimsPermissionSet.md) | Permission set for Unity Catalog table access | -| [ResourceType](Enumeration.ResourceType.md) | Resource types from schema $defs.resourceType.enum | +| [ResourceType](Enumeration.ResourceType.md) | Resource types from resourceTypeSchema.options | ## Classes @@ -48,8 +48,7 @@ plugin architecture, and React integration. | [RequestedClaims](Interface.RequestedClaims.md) | Optional claims for fine-grained Unity Catalog table permissions When specified, the returned token will be scoped to only the requested tables | | [RequestedResource](Interface.RequestedResource.md) | Resource to request permissions for in Unity Catalog | | [ResourceEntry](Interface.ResourceEntry.md) | Internal representation of a resource in the registry. Extends ResourceRequirement with resolution state and plugin ownership. | -| [ResourceFieldEntry](Interface.ResourceFieldEntry.md) | Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key). | -| [ResourceRequirement](Interface.ResourceRequirement.md) | Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). Narrows the generated base: type → ResourceType enum, permission → ResourcePermission union. | +| [ResourceRequirement](Interface.ResourceRequirement.md) | Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). | | [ServingEndpointEntry](Interface.ServingEndpointEntry.md) | Shape of a single registry entry. | | [ServingEndpointRegistry](Interface.ServingEndpointRegistry.md) | Registry interface for serving endpoint type generation. Empty by default — augmented by the Vite type generator's `.d.ts` output via module augmentation. When populated, provides autocomplete for alias names and typed request/response/chunk per endpoint. | | [StreamExecutionSettings](Interface.StreamExecutionSettings.md) | Execution settings for streaming endpoints. Extends PluginExecutionSettings with SSE stream configuration. | @@ -68,6 +67,7 @@ plugin architecture, and React integration. | [JobHandle](TypeAlias.JobHandle.md) | Job handle returned by `appkit.jobs("etl")`. Supports OBO access via `.asUser(req)`. | | [JobsExport](TypeAlias.JobsExport.md) | Public API shape of the jobs plugin. Callable to select a job by key. | | [PluginData](TypeAlias.PluginData.md) | Tuple of plugin class, config, and name. Created by `toPlugin()` and passed to `createApp()`. | +| [ResourceFieldEntry](TypeAlias.ResourceFieldEntry.md) | - | | [ResourcePermission](TypeAlias.ResourcePermission.md) | Union of all possible permission levels across all resource types. | | [ServingFactory](TypeAlias.ServingFactory.md) | Factory function returned by `AppKit.serving`. | | [ToPlugin](TypeAlias.ToPlugin.md) | Factory function type returned by `toPlugin()`. Accepts optional config and returns a PluginData tuple. | diff --git a/docs/docs/api/appkit/typedoc-sidebar.ts b/docs/docs/api/appkit/typedoc-sidebar.ts index 162c3e68b..92371d735 100644 --- a/docs/docs/api/appkit/typedoc-sidebar.ts +++ b/docs/docs/api/appkit/typedoc-sidebar.ts @@ -172,11 +172,6 @@ const typedocSidebar: SidebarsConfig = { id: "api/appkit/Interface.ResourceEntry", label: "ResourceEntry" }, - { - type: "doc", - id: "api/appkit/Interface.ResourceFieldEntry", - label: "ResourceFieldEntry" - }, { type: "doc", id: "api/appkit/Interface.ResourceRequirement", @@ -253,6 +248,11 @@ const typedocSidebar: SidebarsConfig = { id: "api/appkit/TypeAlias.PluginData", label: "PluginData" }, + { + type: "doc", + id: "api/appkit/TypeAlias.ResourceFieldEntry", + label: "ResourceFieldEntry" + }, { type: "doc", id: "api/appkit/TypeAlias.ResourcePermission", diff --git a/docs/package.json b/docs/package.json index dfc52a896..f3b9cd84c 100644 --- a/docs/package.json +++ b/docs/package.json @@ -6,9 +6,8 @@ "docusaurus": "docusaurus", "dev": "pnpm run gen && docusaurus start --no-open", "build": "pnpm run gen && docusaurus build", - "gen": "pnpm run build-appkit-ui-styles && pnpm run generate-component-docs && pnpm run copy-schemas", + "gen": "pnpm run build-appkit-ui-styles && pnpm run generate-component-docs", "build-appkit-ui-styles": "tsx scripts/build-appkit-ui-styles.ts", - "copy-schemas": "tsx scripts/copy-schemas.ts", "generate-component-docs": "tsx ../tools/generate-component-mdx.ts", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", diff --git a/docs/scripts/copy-schemas.ts b/docs/scripts/copy-schemas.ts deleted file mode 100644 index 7a465eb08..000000000 --- a/docs/scripts/copy-schemas.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copies JSON schemas from packages to docs/static for hosting. - * - * Schemas are served at: - * https://databricks.github.io/appkit/schemas/{schema-name}.json - */ - -import { copyFileSync, existsSync, mkdirSync, readdirSync } from "node:fs"; -import { dirname, join } from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = dirname(fileURLToPath(import.meta.url)); - -const SCHEMAS_SOURCE = join(__dirname, "../../packages/shared/src/schemas"); -const SCHEMAS_DEST = join(__dirname, "../static/schemas"); - -function copySchemas() { - console.log("Copying JSON schemas to docs/static/schemas..."); - - // Ensure destination directory exists - if (!existsSync(SCHEMAS_DEST)) { - mkdirSync(SCHEMAS_DEST, { recursive: true }); - } - - // Check if source directory exists - if (!existsSync(SCHEMAS_SOURCE)) { - console.warn(`Schemas source directory not found: ${SCHEMAS_SOURCE}`); - return; - } - - // Copy all .json files - const files = readdirSync(SCHEMAS_SOURCE).filter((f) => f.endsWith(".json")); - - for (const file of files) { - const src = join(SCHEMAS_SOURCE, file); - const dest = join(SCHEMAS_DEST, file); - copyFileSync(src, dest); - console.log(` Copied: ${file}`); - } - - console.log(`Done! ${files.length} schema(s) copied.`); -} - -copySchemas(); diff --git a/docs/static/schemas/plugin-manifest.schema.json b/docs/static/schemas/plugin-manifest.schema.json index 021c7f0bf..dee69aaaf 100644 --- a/docs/static/schemas/plugin-manifest.schema.json +++ b/docs/static/schemas/plugin-manifest.schema.json @@ -2,418 +2,4407 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://databricks.github.io/appkit/schemas/plugin-manifest.schema.json", "title": "AppKit Plugin Manifest", - "description": "Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options.", "type": "object", - "required": ["name", "displayName", "description", "resources"], "properties": { "$schema": { - "type": "string", - "description": "Reference to the JSON Schema for validation" + "description": "Reference to the JSON Schema for validation", + "type": "string" }, "name": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", - "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", - "examples": ["analytics", "server", "my-custom-plugin"] + "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens." }, "displayName": { "type": "string", "minLength": 1, - "description": "Human-readable display name for UI and CLI", - "examples": ["Analytics Plugin", "Server Plugin"] + "description": "Human-readable display name for UI and CLI" }, "description": { "type": "string", "minLength": 1, - "description": "Brief description of what the plugin does", - "examples": ["SQL query execution against Databricks SQL Warehouses"] + "description": "Brief description of what the plugin does" }, "resources": { "type": "object", - "required": ["required", "optional"], - "description": "Databricks resource requirements for this plugin", "properties": { "required": { "type": "array", - "description": "Resources that must be available for the plugin to function", "items": { - "$ref": "#/$defs/resourceRequirement" - } + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["READ", "WRITE", "MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "job" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sql_warehouse" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "serving_endpoint" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "volume" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["READ_VOLUME", "WRITE_VOLUME"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vector_search_index" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["SELECT"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_function" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["EXECUTE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_connection" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["USE_CONNECTION"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "database" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "postgres" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "genie_space" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "experiment" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "app" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + } + ], + "description": "Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements()." + }, + "description": "Resources that must be available for the plugin to function" }, "optional": { "type": "array", - "description": "Resources that enhance functionality but are not mandatory", "items": { - "$ref": "#/$defs/resourceRequirement" - } + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["READ", "WRITE", "MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "job" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sql_warehouse" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "serving_endpoint" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "volume" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["READ_VOLUME", "WRITE_VOLUME"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vector_search_index" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["SELECT"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_function" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["EXECUTE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_connection" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["USE_CONNECTION"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "database" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "postgres" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "genie_space" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "experiment" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "app" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "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).", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": ["type", "cliCommand", "selectField"], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + } + }, + "additionalProperties": false, + "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key)." + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + } + ], + "description": "Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements()." + }, + "description": "Resources that enhance functionality but are not mandatory" } }, - "additionalProperties": false + "required": ["required", "optional"], + "additionalProperties": false, + "description": "Databricks resource requirements for this plugin" }, "config": { - "type": "object", "description": "Configuration schema for the plugin", + "type": "object", "properties": { "schema": { - "$ref": "#/$defs/configSchema" + "allOf": [ + { + "$ref": "#/definitions/__schema0" + } + ] } }, "additionalProperties": false }, "author": { - "type": "string", - "description": "Author name or organization" + "description": "Author name or organization", + "type": "string" }, "version": { - "type": "string", - "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$", "description": "Plugin version (semver format)", - "examples": ["1.0.0", "2.1.0-beta.1"] + "type": "string", + "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$" }, "repository": { + "description": "URL to the plugin's source repository", "type": "string", - "format": "uri", - "description": "URL to the plugin's source repository" + "format": "uri" }, "keywords": { + "description": "Keywords for plugin discovery", "type": "array", "items": { "type": "string" - }, - "description": "Keywords for plugin discovery" + } }, "license": { - "type": "string", "description": "SPDX license identifier", - "examples": ["Apache-2.0", "MIT"] + "type": "string" }, "onSetupMessage": { - "type": "string", - "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning)." + "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning).", + "type": "string" }, "hidden": { - "type": "boolean", - "default": false, - "description": "When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync." + "description": "When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync.", + "type": "boolean" }, "stability": { + "description": "Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly.", "type": "string", - "enum": ["beta", "ga"], - "default": "ga", - "description": "Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly." + "enum": ["beta", "ga"] + }, + "postScaffold": { + "description": "Ordered list of post-scaffolding instructions shown to the user after project initialization. Array position determines display order.", + "type": "array", + "items": { + "type": "object", + "properties": { + "instruction": { + "type": "string", + "minLength": 1, + "description": "Human-readable instruction for the user to follow after scaffolding." + }, + "required": { + "description": "Whether this step is required for the plugin to function correctly.", + "type": "boolean" + } + }, + "required": ["instruction"], + "additionalProperties": false, + "description": "A post-scaffolding instruction shown to the user after project initialization." + } } }, + "required": ["name", "displayName", "description", "resources"], "additionalProperties": false, - "$defs": { - "resourceType": { - "type": "string", - "enum": [ - "secret", - "job", - "sql_warehouse", - "serving_endpoint", - "volume", - "vector_search_index", - "uc_function", - "uc_connection", - "database", - "postgres", - "genie_space", - "experiment", - "app" - ], - "description": "Type of Databricks resource" - }, - "secretPermission": { - "type": "string", - "enum": ["READ", "WRITE", "MANAGE"], - "description": "Permission for secret resources (order: weakest to strongest)" - }, - "jobPermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], - "description": "Permission for job resources (order: weakest to strongest)" - }, - "sqlWarehousePermission": { - "type": "string", - "enum": ["CAN_USE", "CAN_MANAGE"], - "description": "Permission for SQL warehouse resources (order: weakest to strongest)" - }, - "servingEndpointPermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], - "description": "Permission for serving endpoint resources (order: weakest to strongest)" - }, - "volumePermission": { - "type": "string", - "enum": ["READ_VOLUME", "WRITE_VOLUME"], - "description": "Permission for Unity Catalog volume resources" - }, - "vectorSearchIndexPermission": { - "type": "string", - "enum": ["SELECT"], - "description": "Permission for vector search index resources" - }, - "ucFunctionPermission": { - "type": "string", - "enum": ["EXECUTE"], - "description": "Permission for Unity Catalog function resources" - }, - "ucConnectionPermission": { - "type": "string", - "enum": ["USE_CONNECTION"], - "description": "Permission for Unity Catalog connection resources" - }, - "databasePermission": { - "type": "string", - "enum": ["CAN_CONNECT_AND_CREATE"], - "description": "Permission for database resources" - }, - "postgresPermission": { - "type": "string", - "enum": ["CAN_CONNECT_AND_CREATE"], - "description": "Permission for Postgres resources" - }, - "genieSpacePermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"], - "description": "Permission for Genie Space resources (order: weakest to strongest)" - }, - "experimentPermission": { - "type": "string", - "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], - "description": "Permission for MLflow experiment resources (order: weakest to strongest)" - }, - "appPermission": { - "type": "string", - "enum": ["CAN_USE"], - "description": "Permission for Databricks App resources" - }, - "resourceFieldEntry": { - "type": "object", - "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).", - "properties": { - "env": { - "type": "string", - "pattern": "^[A-Z][A-Z0-9_]*$", - "description": "Environment variable name for this field", - "examples": ["DATABRICKS_CACHE_INSTANCE", "SECRET_SCOPE"] - }, - "description": { - "type": "string", - "description": "Human-readable description for this field" - }, - "bundleIgnore": { - "type": "boolean", - "default": false, - "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation." - }, - "examples": { - "type": "array", - "items": { "type": "string" }, - "description": "Example values showing the expected format for this field" - }, - "localOnly": { - "type": "boolean", - "default": false, - "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time." - }, - "value": { - "type": "string", - "description": "Static value for this field. Used when no prompted or resolved value exists." - }, - "resolve": { - "type": "string", - "pattern": "^[a-z_]+:[a-zA-Z]+$", - "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow." - } - }, - "additionalProperties": false - }, - "resourceRequirement": { + "description": "Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options.", + "definitions": { + "__schema0": { "type": "object", - "description": "Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements().", - "required": ["type", "alias", "resourceKey", "description", "permission"], "properties": { "type": { - "$ref": "#/$defs/resourceType" - }, - "alias": { - "type": "string", - "minLength": 1, - "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias.", - "examples": ["SQL Warehouse", "Secret", "Vector search index"] - }, - "resourceKey": { - "type": "string", - "pattern": "^[a-z][a-z0-9-]*$", - "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup.", - "examples": ["sql-warehouse", "database", "secret"] - }, - "description": { - "type": "string", - "minLength": 1, - "description": "Human-readable description of why this resource is needed" - }, - "permission": { "type": "string", - "description": "Required permission level. Validated per resource type by the allOf/if-then rules below." + "enum": ["object", "array", "string", "number", "boolean"] }, - "fields": { + "properties": { "type": "object", - "additionalProperties": { - "$ref": "#/$defs/resourceFieldEntry" - }, - "minProperties": 1, - "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)." - } - }, - "additionalProperties": false, - "allOf": [ - { - "if": { - "properties": { "type": { "const": "secret" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/secretPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "job" } }, - "required": ["type"] - }, - "then": { - "properties": { "permission": { "$ref": "#/$defs/jobPermission" } } - } - }, - { - "if": { - "properties": { "type": { "const": "sql_warehouse" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/sqlWarehousePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "serving_endpoint" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/servingEndpointPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "volume" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/volumePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "vector_search_index" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/vectorSearchIndexPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "uc_function" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/ucFunctionPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "uc_connection" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/ucConnectionPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "database" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/databasePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "postgres" } }, - "required": ["type"] + "propertyNames": { + "type": "string" }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/postgresPermission" } - } + "additionalProperties": { + "$ref": "#/definitions/__schema1" } }, - { - "if": { - "properties": { "type": { "const": "genie_space" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/genieSpacePermission" } + "items": { + "allOf": [ + { + "$ref": "#/definitions/__schema0" } - } + ] }, - { - "if": { - "properties": { "type": { "const": "experiment" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/experimentPermission" } - } + "required": { + "type": "array", + "items": { + "type": "string" } }, - { - "if": { - "properties": { "type": { "const": "app" } }, - "required": ["type"] - }, - "then": { - "properties": { "permission": { "$ref": "#/$defs/appPermission" } } - } + "additionalProperties": { + "type": "boolean" } - ] + }, + "required": ["type"], + "additionalProperties": false }, - "configSchemaProperty": { + "__schema1": { "type": "object", - "required": ["type"], "properties": { "type": { "type": "string", @@ -424,16 +4413,24 @@ }, "default": {}, "enum": { - "type": "array" + "type": "array", + "items": {} }, "properties": { "type": "object", + "propertyNames": { + "type": "string" + }, "additionalProperties": { - "$ref": "#/$defs/configSchemaProperty" + "$ref": "#/definitions/__schema1" } }, "items": { - "$ref": "#/$defs/configSchemaProperty" + "allOf": [ + { + "$ref": "#/definitions/__schema1" + } + ] }, "minimum": { "type": "number" @@ -443,36 +4440,13 @@ }, "minLength": { "type": "integer", - "minimum": 0 + "minimum": 0, + "maximum": 9007199254740991 }, "maxLength": { "type": "integer", - "minimum": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "configSchema": { - "type": "object", - "required": ["type"], - "properties": { - "type": { - "type": "string", - "enum": ["object", "array", "string", "number", "boolean"] - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/configSchemaProperty" - } - }, - "items": { - "$ref": "#/$defs/configSchema" + "minimum": 0, + "maximum": 9007199254740991 }, "required": { "type": "array", @@ -481,9 +4455,18 @@ } }, "additionalProperties": { - "type": "boolean" + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/__schema1" + } + ] } - } + }, + "required": ["type"], + "additionalProperties": false } } } diff --git a/docs/static/schemas/template-plugins.schema.json b/docs/static/schemas/template-plugins.schema.json index 47d385936..0ead2544a 100644 --- a/docs/static/schemas/template-plugins.schema.json +++ b/docs/static/schemas/template-plugins.schema.json @@ -2,112 +2,4642 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", "title": "AppKit Template Plugins Manifest", - "description": "Aggregated plugin manifest for AppKit templates. Read by Databricks CLI during init to discover available plugins and their resource requirements.", "type": "object", - "required": ["version", "plugins"], "properties": { "$schema": { - "type": "string", - "description": "Reference to the JSON Schema for validation" + "description": "Reference to the JSON Schema for validation", + "type": "string" }, "version": { "type": "string", - "enum": ["1.0", "1.1"], + "enum": ["1.0", "1.1", "2.0"], "description": "Schema version for the template plugins manifest" }, "plugins": { "type": "object", - "description": "Map of plugin name to plugin manifest with package source", + "propertyNames": { + "type": "string" + }, "additionalProperties": { - "$ref": "#/$defs/templatePlugin" - } - } - }, - "additionalProperties": false, - "$defs": { - "templatePlugin": { + "type": "object", + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens." + }, + "displayName": { + "type": "string", + "minLength": 1, + "description": "Human-readable display name for UI and CLI" + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Brief description of what the plugin does" + }, + "package": { + "type": "string", + "minLength": 1, + "description": "NPM package name that provides this plugin" + }, + "requiredByTemplate": { + "description": "When true, this plugin is required by the template and cannot be deselected during CLI init. The user will only be prompted to configure its resources. When absent or false, the plugin is optional and the user can choose whether to include it.", + "type": "boolean" + }, + "onSetupMessage": { + "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning).", + "type": "string" + }, + "stability": { + "description": "Plugin stability level. Beta is heading to GA; APIs may change between minor releases. GA (general availability) follows semver.", + "type": "string", + "enum": ["beta", "ga"] + }, + "postScaffold": { + "description": "Ordered list of post-scaffolding instructions propagated from the plugin manifest.", + "type": "array", + "items": { + "type": "object", + "properties": { + "instruction": { + "type": "string", + "minLength": 1, + "description": "Human-readable instruction for the user to follow after scaffolding." + }, + "required": { + "description": "Whether this step is required for the plugin to function correctly.", + "type": "boolean" + } + }, + "required": ["instruction"], + "additionalProperties": false, + "description": "A post-scaffolding instruction shown to the user after project initialization." + } + }, + "resources": { + "type": "object", + "properties": { + "required": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["READ", "WRITE", "MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "job" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sql_warehouse" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "serving_endpoint" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "volume" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["READ_VOLUME", "WRITE_VOLUME"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vector_search_index" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["SELECT"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_function" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["EXECUTE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_connection" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["USE_CONNECTION"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "database" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "postgres" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "genie_space" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": [ + "CAN_VIEW", + "CAN_RUN", + "CAN_EDIT", + "CAN_MANAGE" + ], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "experiment" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "app" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + } + ], + "description": "Resource requirement with template-specific field entries (includes computed origin)." + }, + "description": "Resources that must be available for the plugin to function" + }, + "optional": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["READ", "WRITE", "MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "job" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sql_warehouse" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "serving_endpoint" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "volume" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["READ_VOLUME", "WRITE_VOLUME"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vector_search_index" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["SELECT"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_function" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["EXECUTE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uc_connection" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["USE_CONNECTION"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "database" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "postgres" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_CONNECT_AND_CREATE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "genie_space" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": [ + "CAN_VIEW", + "CAN_RUN", + "CAN_EDIT", + "CAN_MANAGE" + ], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "experiment" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "app" + }, + "alias": { + "type": "string", + "minLength": 1, + "description": "Human-readable label for UI/display only." + }, + "resourceKey": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "description": "Stable key for machine use: deduplication, env naming, composite keys." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "Human-readable description of why this resource is needed" + }, + "fields": { + "description": "Map of field name to field entry with computed origin.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "env": { + "description": "Environment variable name for this field", + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]*$" + }, + "description": { + "description": "Human-readable description for this field", + "type": "string" + }, + "bundleIgnore": { + "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + "type": "boolean" + }, + "examples": { + "description": "Example values showing the expected format for this field", + "type": "array", + "items": { + "type": "string" + } + }, + "localOnly": { + "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + "type": "boolean" + }, + "value": { + "description": "Static value for this field. Used when no prompted or resolved value exists.", + "type": "string" + }, + "resolve": { + "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + "type": "string", + "pattern": "^[a-z_]+:[a-zA-Z]+$" + }, + "discovery": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "kind", + "description": "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind." + }, + "resourceKind": { + "type": "string", + "enum": [ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume" + ], + "description": "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules." + }, + "select": { + "description": "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + "type": "string" + }, + "display": { + "description": "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + "type": "string" + } + }, + "required": ["type", "resourceKind"], + "additionalProperties": false, + "description": "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind." + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cli", + "description": "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin." + }, + "cliCommand": { + "type": "string", + "description": "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map." + }, + "selectField": { + "type": "string", + "description": "jq-style path to the field used as the selected value (e.g., '.id', '.name')." + }, + "displayField": { + "description": "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + "type": "string" + }, + "dependsOn": { + "description": "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + "type": "string" + }, + "shortcut": { + "description": "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + "type": "string" + } + }, + "required": [ + "type", + "cliCommand", + "selectField" + ], + "additionalProperties": false, + "description": "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions." + } + ], + "description": "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command." + }, + "origin": { + "type": "string", + "enum": ["user", "platform", "static", "cli"], + "description": "How the field value is determined. Computed during sync, not authored by plugin developers." + } + }, + "additionalProperties": false + } + }, + "permission": { + "type": "string", + "enum": ["CAN_USE"], + "description": "Required permission level. Validated per resource type." + } + }, + "required": [ + "type", + "alias", + "resourceKey", + "description", + "permission" + ], + "additionalProperties": false + } + ], + "description": "Resource requirement with template-specific field entries (includes computed origin)." + }, + "description": "Resources that enhance functionality but are not mandatory" + } + }, + "required": ["required", "optional"], + "additionalProperties": false, + "description": "Databricks resource requirements for this plugin" + } + }, + "required": [ + "name", + "displayName", + "description", + "package", + "resources" + ], + "additionalProperties": false, + "description": "Plugin manifest with package source information" + }, + "description": "Map of plugin name to plugin manifest with package source" + }, + "scaffolding": { + "description": "Describes the scaffolding command and its configuration for project initialization.", "type": "object", - "required": [ - "name", - "displayName", - "description", - "package", - "resources" - ], - "description": "Plugin manifest with package source information", "properties": { - "name": { + "command": { "type": "string", - "pattern": "^[a-z][a-z0-9-]*$", - "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", - "examples": ["analytics", "server", "my-custom-plugin"] + "description": "The scaffolding command (e.g., 'databricks apps init')." }, - "displayName": { - "type": "string", - "minLength": 1, - "description": "Human-readable display name for UI and CLI", - "examples": ["Analytics Plugin", "Server Plugin"] - }, - "description": { - "type": "string", - "minLength": 1, - "description": "Brief description of what the plugin does", - "examples": ["SQL query execution against Databricks SQL Warehouses"] - }, - "package": { - "type": "string", - "minLength": 1, - "description": "NPM package name that provides this plugin", - "examples": ["@databricks/appkit", "@my-org/custom-plugin"] - }, - "requiredByTemplate": { - "type": "boolean", - "default": false, - "description": "When true, this plugin is required by the template and cannot be deselected during CLI init. The user will only be prompted to configure its resources. When absent or false, the plugin is optional and the user can choose whether to include it." - }, - "onSetupMessage": { - "type": "string", - "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning)." - }, - "stability": { - "type": "string", - "enum": ["beta", "ga"], - "default": "ga", - "description": "Plugin stability level. Beta is heading to GA; APIs may change between minor releases. GA (general availability) follows semver." + "flags": { + "description": "Map of flag name to flag descriptor.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Human-readable description of the flag." + }, + "required": { + "description": "Whether this flag is required.", + "type": "boolean" + }, + "pattern": { + "description": "Regex pattern for validating the flag value.", + "type": "string" + }, + "default": { + "description": "Default value for this flag.", + "type": "string" + } + }, + "required": ["description"], + "additionalProperties": false, + "description": "A flag for the scaffolding command." + } }, - "resources": { + "rules": { + "description": "Structured rules for scaffolding agents.", "type": "object", - "required": ["required", "optional"], - "description": "Databricks resource requirements for this plugin", "properties": { - "required": { + "never": { + "description": "Actions the scaffolding agent must never perform.", "type": "array", - "description": "Resources that must be available for the plugin to function", "items": { - "$ref": "#/$defs/resourceRequirement" + "type": "string", + "maxLength": 120 } }, - "optional": { + "must": { + "description": "Actions the scaffolding agent must always perform.", "type": "array", - "description": "Resources that enhance functionality but are not mandatory", "items": { - "$ref": "#/$defs/resourceRequirement" + "type": "string", + "maxLength": 120 } } }, "additionalProperties": false } }, + "required": ["command"], "additionalProperties": false - }, - "resourceType": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceType" - }, - "resourceFieldEntry": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceFieldEntry" - }, - "resourceRequirement": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceRequirement" } - } + }, + "required": ["version", "plugins"], + "additionalProperties": false, + "description": "Aggregated plugin manifest for AppKit templates. Read by Databricks CLI during init to discover available plugins and their resource requirements." } diff --git a/knip.json b/knip.json index 101b9253a..c6f54d22e 100644 --- a/knip.json +++ b/knip.json @@ -27,6 +27,5 @@ "docs/**", ".github/scripts/**" ], - "ignoreDependencies": ["json-schema-to-typescript"], "ignoreBinaries": ["tarball"] } diff --git a/package.json b/package.json index 8f045f178..fff062625 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build:watch": "pnpm -r --filter=!dev-playground --filter=!docs build:watch", "check:fix": "biome check --write .", "check": "biome check .", - "generate:types": "tsx tools/generate-schema-types.ts && tsx tools/generate-registry-types.ts && tsx tools/generate-plugin-entries.ts && tsx tools/generate-plugin-doc-banners.ts", + "generate:types": "tsx tools/generate-json-schema.ts && tsx tools/generate-registry-types.ts && tsx tools/generate-plugin-entries.ts && tsx tools/generate-plugin-doc-banners.ts", "generate:plugin-entries": "tsx tools/generate-plugin-entries.ts", "generate:plugin-doc-banners": "tsx tools/generate-plugin-doc-banners.ts", "generate:app-templates": "tsx tools/generate-app-templates.ts", @@ -64,7 +64,6 @@ "husky": "9.1.7", "jsdom": "27.0.0", "knip": "5.86.0", - "json-schema-to-typescript": "15.0.4", "lint-staged": "15.5.2", "publint": "0.3.15", "release-it": "19.2.0", @@ -73,7 +72,8 @@ "turbo": "2.6.1", "typescript": "5.9.3", "vite-tsconfig-paths": "5.1.4", - "vitest": "3.2.4" + "vitest": "3.2.4", + "zod": "4.3.6" }, "resolutions": { "conventional-changelog-conventionalcommits": "9.1.0" diff --git a/packages/appkit/src/plugins/analytics/manifest.json b/packages/appkit/src/plugins/analytics/manifest.json index 4a6a60c28..de4858069 100644 --- a/packages/appkit/src/plugins/analytics/manifest.json +++ b/packages/appkit/src/plugins/analytics/manifest.json @@ -14,13 +14,27 @@ "fields": { "id": { "env": "DATABRICKS_WAREHOUSE_ID", - "description": "SQL Warehouse ID" + "description": "SQL Warehouse ID", + "discovery": { + "type": "kind", + "resourceKind": "warehouse" + } } } } ], "optional": [] }, + "postScaffold": [ + { + "instruction": "Ensure your SQL Warehouse is running and accessible from your workspace.", + "required": true + }, + { + "instruction": "Create a config/queries/ directory and add .sql files for your analytics queries.", + "required": false + } + ], "config": { "schema": { "type": "object", diff --git a/packages/appkit/src/plugins/files/manifest.json b/packages/appkit/src/plugins/files/manifest.json index c886decaa..79d1bdf5b 100644 --- a/packages/appkit/src/plugins/files/manifest.json +++ b/packages/appkit/src/plugins/files/manifest.json @@ -14,13 +14,28 @@ "fields": { "path": { "env": "DATABRICKS_VOLUME_FILES", - "description": "Volume path for file storage (e.g. /Volumes/catalog/schema/volume_name)" + "description": "Volume path for file storage (e.g. /Volumes/catalog/schema/volume_name)", + "discovery": { + "type": "kind", + "resourceKind": "volume", + "select": "full_name" + } } } } ], "optional": [] }, + "postScaffold": [ + { + "instruction": "Verify your Unity Catalog volume exists and you have WRITE_VOLUME permission.", + "required": true + }, + { + "instruction": "Set the DATABRICKS_VOLUME_FILES environment variable to the full volume path (e.g. /Volumes/catalog/schema/volume_name).", + "required": true + } + ], "config": { "schema": { "type": "object", diff --git a/packages/appkit/src/plugins/genie/manifest.json b/packages/appkit/src/plugins/genie/manifest.json index a269795d6..06e4bce70 100644 --- a/packages/appkit/src/plugins/genie/manifest.json +++ b/packages/appkit/src/plugins/genie/manifest.json @@ -1,4 +1,5 @@ { + "$schema": "https://databricks.github.io/appkit/schemas/plugin-manifest.schema.json", "name": "genie", "displayName": "Genie Plugin", "description": "AI/BI Genie space integration for natural language data queries", @@ -13,13 +14,27 @@ "fields": { "id": { "env": "DATABRICKS_GENIE_SPACE_ID", - "description": "Default Genie Space ID" + "description": "Default Genie Space ID", + "discovery": { + "type": "kind", + "resourceKind": "genie_space" + } } } } ], "optional": [] }, + "postScaffold": [ + { + "instruction": "Configure the 'spaces' map in your plugin config with alias-to-Space-ID mappings.", + "required": true + }, + { + "instruction": "Ensure your Genie Space(s) are configured with the appropriate data tables and instructions.", + "required": false + } + ], "config": { "schema": { "type": "object", diff --git a/packages/appkit/src/plugins/lakebase/manifest.json b/packages/appkit/src/plugins/lakebase/manifest.json index 2959c0927..c42526916 100644 --- a/packages/appkit/src/plugins/lakebase/manifest.json +++ b/packages/appkit/src/plugins/lakebase/manifest.json @@ -13,15 +13,36 @@ "description": "Lakebase Postgres database for persistent storage", "permission": "CAN_CONNECT_AND_CREATE", "fields": { + "project": { + "description": "Full Lakebase Postgres project resource name. Obtain by running `databricks postgres list-projects`, select the desired item from the output array and use its .name value.", + "examples": ["projects/{project-id}"], + "discovery": { + "type": "kind", + "resourceKind": "postgres_project", + "select": "name" + } + }, "branch": { - "description": "Full Lakebase Postgres branch resource name. Obtain by running `databricks postgres list-branches projects/{project-id}`, select the desired item from the output array and use its .name value.", - "examples": ["projects/{project-id}/branches/{branch-id}"] + "description": "Full Lakebase Postgres branch resource name. Obtain by running `databricks postgres list-branches {project-name}`, select the desired item from the output array and use its .name value. Requires the project resource name.", + "examples": ["projects/{project-id}/branches/{branch-id}"], + "discovery": { + "type": "kind", + "resourceKind": "postgres_branch", + "select": "name", + "dependsOn": "project" + } }, "database": { "description": "Full Lakebase Postgres database resource name. Obtain by running `databricks postgres list-databases {branch-name}`, select the desired item from the output array and use its .name value. Requires the branch resource name.", "examples": [ "projects/{project-id}/branches/{branch-id}/databases/{database-id}" - ] + ], + "discovery": { + "type": "kind", + "resourceKind": "postgres_database", + "select": "name", + "dependsOn": "branch" + } }, "host": { "env": "PGHOST", @@ -60,5 +81,15 @@ } ], "optional": [] - } + }, + "postScaffold": [ + { + "instruction": "Run database migrations to initialize your Lakebase schema.", + "required": true + }, + { + "instruction": "Verify local connectivity to Lakebase using: PGHOST= PGDATABASE= PGPORT=5432 PGSSLMODE=require psql", + "required": false + } + ] } diff --git a/packages/appkit/src/registry/types.generated.ts b/packages/appkit/src/registry/types.generated.ts index 7e38af9bd..5739f0a9c 100644 --- a/packages/appkit/src/registry/types.generated.ts +++ b/packages/appkit/src/registry/types.generated.ts @@ -1,7 +1,7 @@ -// AUTO-GENERATED from packages/shared/src/schemas/plugin-manifest.schema.json +// AUTO-GENERATED from packages/shared/src/schemas/manifest.ts (Zod canonical). // Do not edit. Run: pnpm exec tsx tools/generate-registry-types.ts -/** Resource types from schema $defs.resourceType.enum */ +/** Resource types from resourceTypeSchema.options */ export enum ResourceType { SECRET = "secret", JOB = "job", @@ -19,7 +19,7 @@ export enum ResourceType { } // ============================================================================ -// Permissions per resource type (from schema permission $defs) +// Permissions per resource type (from per-type permission enum schemas) // ============================================================================ /** Permissions for SECRET resources */ export type SecretPermission = "READ" | "WRITE" | "MANAGE"; diff --git a/packages/appkit/src/registry/types.ts b/packages/appkit/src/registry/types.ts index b26227df7..a18a2881e 100644 --- a/packages/appkit/src/registry/types.ts +++ b/packages/appkit/src/registry/types.ts @@ -6,9 +6,9 @@ * in a machine-readable format. * * Base interfaces (ResourceFieldEntry, ResourceRequirement, PluginManifest) - * are generated from plugin-manifest.schema.json and imported via shared. - * This module re-exports them with strict narrowing (ResourceType enum, - * ResourcePermission union) for appkit-internal use. + * are inferred from the Zod schemas in `packages/shared/src/schemas/manifest.ts` + * and imported via shared. This module re-exports them with strict narrowing + * (ResourceType enum, ResourcePermission union) for appkit-internal use. * * Resource types, permissions, and hierarchy constants are generated by * tools/generate-registry-types.ts into types.generated.ts. @@ -29,33 +29,46 @@ export { type ResourcePermission, }; -// Re-export generated base type from shared (schema-derived, used directly). +// Re-export schema-derived base type from shared. export type { ResourceFieldEntry } from "shared"; // Import shared base types for strict extension below. import type { + ResourceFieldEntry, PluginManifest as SharedPluginManifest, - ResourceRequirement as SharedResourceRequirement, } from "shared"; // ============================================================================ -// Strict appkit wrappers — narrow generated base types for registry use +// Strict appkit wrappers — narrow shared base types for registry use // ============================================================================ /** * Declares a resource requirement for a plugin. * Can be defined statically in a manifest or dynamically via getResourceRequirements(). - * Narrows the generated base: type → ResourceType enum, permission → ResourcePermission union. * - * @see `packages/shared/src/schemas/plugin-manifest.generated.ts` `ResourceRequirement` — generated base - * @see {@link SharedResourceRequirement} — shared re-export with runtime `fields` and `required` + * Defined as a flat structural shape rather than narrowing the shared + * discriminated-union `ResourceRequirement`. The registry needs to construct + * and pass these values around at runtime where `type` and `permission` are + * looked up dynamically from a string; preserving per-variant tightness here + * would force every constructor to thread variant types end-to-end. The + * runtime guarantee (permission valid for type) is enforced by the manifest + * schema's parse, not by the registry's static types. */ -export interface ResourceRequirement extends SharedResourceRequirement { +export interface ResourceRequirement { /** Type of Databricks resource required (narrowed to enum) */ type: ResourceType; - /** Required permission level for the resource (narrowed to union) */ permission: ResourcePermission; + /** Human-readable label for UI/display only. */ + alias: string; + /** Stable key for machine use: deduplication, env naming, composite keys, app.yaml. */ + resourceKey: string; + /** Human-readable description of why this resource is needed. */ + description: string; + /** Map of field name to field entry. Required at runtime. */ + fields: Record; + /** Whether the resource is mandatory at runtime. */ + required: boolean; } /** @@ -109,7 +122,7 @@ export type ConfigSchema = JSONSchema7; * Attached to plugin classes as a static property. * Extends the shared PluginManifest with strict resource types. * - * @see `packages/shared/src/schemas/plugin-manifest.generated.ts` `PluginManifest` — generated base + * @see `packages/shared/src/schemas/manifest.ts` `pluginManifestSchema` — Zod source of truth * @see {@link SharedPluginManifest} — shared re-export with JSONSchema7 config */ export interface PluginManifest diff --git a/packages/shared/package.json b/packages/shared/package.json index 27d268ca3..00aafed93 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -15,7 +15,7 @@ "./package.json": "./package.json" }, "scripts": { - "build:package": "pnpm exec tsx ../../tools/generate-schema-types.ts && tsdown --config tsdown.config.ts", + "build:package": "pnpm exec tsx ../../tools/generate-json-schema.ts && tsdown --config tsdown.config.ts", "build:watch": "tsdown --config tsdown.config.ts --watch", "typecheck": "tsc --noEmit", "clean": "rm -rf dist", @@ -37,9 +37,9 @@ }, "dependencies": { "@ast-grep/napi": "0.37.0", - "ajv": "8.17.1", - "ajv-formats": "3.0.1", + "@standard-schema/spec": "1.1.0", "@clack/prompts": "1.0.1", - "commander": "12.1.0" + "commander": "12.1.0", + "zod": "4.3.6" } } diff --git a/packages/shared/src/cli/commands/plugin/add-resource/add-resource.ts b/packages/shared/src/cli/commands/plugin/add-resource/add-resource.ts index 621700987..9bd6ac553 100644 --- a/packages/shared/src/cli/commands/plugin/add-resource/add-resource.ts +++ b/packages/shared/src/cli/commands/plugin/add-resource/add-resource.ts @@ -99,8 +99,11 @@ function buildEntry( } } - const entry: ResourceRequirement = { - type: type as ResourceRequirement["type"], + // Constructed dynamically from a string `type` and string `permission`; + // the per-type permission tightness from the discriminated union is + // recovered at runtime by `validateManifest` before the entry is written. + const entry = { + type, alias, resourceKey: opts.resourceKey ?? resourceKeyFromType(type), description: @@ -109,7 +112,7 @@ function buildEntry( permission: opts.permission ?? DEFAULT_PERMISSION_BY_TYPE[type] ?? "CAN_VIEW", fields, - }; + } as ResourceRequirement; return { entry, isRequired }; } @@ -163,14 +166,16 @@ async function runInteractive(opts: AddResourceOptions): Promise { } const alias = humanizeResourceType(spec.type); - const entry: ResourceRequirement = { - type: spec.type as ResourceRequirement["type"], + // See note on the non-interactive variant in `buildEntry` — the entry is + // assembled from prompt strings and validated by Zod at write time. + const entry = { + type: spec.type, alias, resourceKey: spec.resourceKey, description: spec.description || `Required for ${alias} functionality.`, permission: spec.permission, fields: spec.fields, - }; + } as ResourceRequirement; if (spec.required) { manifest.resources.required.push(entry); diff --git a/packages/shared/src/cli/commands/plugin/create/resource-defaults.ts b/packages/shared/src/cli/commands/plugin/create/resource-defaults.ts index de1eaabd9..1e078926b 100644 --- a/packages/shared/src/cli/commands/plugin/create/resource-defaults.ts +++ b/packages/shared/src/cli/commands/plugin/create/resource-defaults.ts @@ -1,6 +1,7 @@ /** * Resource type and permission defaults for plugin scaffolding. - * Values are derived from plugin-manifest.schema.json via schema-resources. + * Values are sourced from the canonical Zod schemas in `schemas/manifest`, + * surfaced through the `schema-resources` module. */ import { diff --git a/packages/shared/src/cli/commands/plugin/manifest-types.ts b/packages/shared/src/cli/commands/plugin/manifest-types.ts index 8f649036f..c06b13d1b 100644 --- a/packages/shared/src/cli/commands/plugin/manifest-types.ts +++ b/packages/shared/src/cli/commands/plugin/manifest-types.ts @@ -1,28 +1,25 @@ /** - * Shared types for plugin manifests used across CLI commands. - * Base types (ResourceFieldEntry, ResourceRequirement, PluginManifest) are - * generated from plugin-manifest.schema.json — only CLI-specific extensions - * (TemplatePlugin, TemplatePluginsManifest) are hand-written here. + * Thin re-export shim for plugin manifest types used across CLI commands. + * + * Phase 5: source of truth is the Zod schema module (`../../../schemas/manifest`). + * All type aliases and the Standard Schema interface re-export from there. The + * legacy `plugin-manifest.generated.ts` is gone; kept this shim only so existing + * callers (`sync.ts`, `validate.ts`, `create.ts`, `add-resource.ts`, etc.) + * continue importing from the same path without rewrite. */ +export type { StandardSchemaV1 } from "@standard-schema/spec"; export type { + DiscoveryDescriptor, + Origin, PluginManifest, + PostScaffoldStep, ResourceFieldEntry, + ResourceKind, ResourceRequirement, -} from "../../../schemas/plugin-manifest.generated"; - -import type { PluginManifest } from "../../../schemas/plugin-manifest.generated"; - -export interface TemplatePlugin extends Omit { - package: string; - /** When true, this plugin is required by the template and cannot be deselected during CLI init. */ - requiredByTemplate?: boolean; - /** Plugin stability level. Absent or undefined means "ga" (general availability). */ - stability?: "beta" | "ga"; -} - -export interface TemplatePluginsManifest { - $schema: string; - version: string; - plugins: Record; -} + ScaffoldingDescriptor, + ScaffoldingFlag, + ScaffoldingRules, + TemplatePlugin, + TemplatePluginsManifest, +} from "../../../schemas/manifest"; diff --git a/packages/shared/src/cli/commands/plugin/schema-resources.ts b/packages/shared/src/cli/commands/plugin/schema-resources.ts index 167f08dfb..7b75ea656 100644 --- a/packages/shared/src/cli/commands/plugin/schema-resources.ts +++ b/packages/shared/src/cli/commands/plugin/schema-resources.ts @@ -1,40 +1,33 @@ /** - * Resource types and permissions derived from plugin-manifest.schema.json. - * Single source of truth so create, add-resource, and validate stay in sync with the schema. + * Resource types and permissions sourced from the canonical Zod schemas in + * `schemas/manifest.ts`. Single source of truth so create, add-resource, and + * validate stay in sync with the schema. + * + * Phase 5 update: replaced runtime JSON-schema reads with direct imports from + * the Zod module. Values are now constant at module load — no caching needed. */ -import fs from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const SCHEMA_NAME = "plugin-manifest.schema.json"; -// Try dist/schemas first (shared build + appkit pack), then dist/cli/schemas -const SCHEMA_PATHS = [ - path.join(__dirname, "..", "..", "..", "schemas", SCHEMA_NAME), - path.join(__dirname, "..", "..", "schemas", SCHEMA_NAME), -]; +import { + appPermissionSchema, + databasePermissionSchema, + experimentPermissionSchema, + genieSpacePermissionSchema, + jobPermissionSchema, + postgresPermissionSchema, + resourceTypeSchema, + secretPermissionSchema, + servingEndpointPermissionSchema, + sqlWarehousePermissionSchema, + ucConnectionPermissionSchema, + ucFunctionPermissionSchema, + vectorSearchIndexPermissionSchema, + volumePermissionSchema, +} from "../../../schemas/manifest"; export interface ResourceTypeOption { value: string; label: string; } -function loadSchema(): Record | null { - for (const schemaPath of SCHEMA_PATHS) { - try { - if (fs.existsSync(schemaPath)) { - return JSON.parse(fs.readFileSync(schemaPath, "utf-8")) as Record< - string, - unknown - >; - } - } catch { - // try next path - } - } - return null; -} - /** Optional display overrides for acronyms (e.g. SQL, UC). Omitted entries use title-case of value. */ const LABEL_OVERRIDES: Record = { sql_warehouse: "SQL Warehouse", @@ -47,69 +40,47 @@ function humanize(value: string): string { return value.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()); } -let cachedOptions: ResourceTypeOption[] | null = null; -let cachedPermissions: Record | null = null; +/** + * Map from resource type literal to its permission enum schema. Mirrors the + * `allOf + if/then` block in the previous hand-written JSON Schema, but driven + * directly from the Zod source. Add an entry here when extending + * `resourceTypeSchema`. + */ +const PERMISSION_SCHEMAS_BY_TYPE = { + secret: secretPermissionSchema, + job: jobPermissionSchema, + sql_warehouse: sqlWarehousePermissionSchema, + serving_endpoint: servingEndpointPermissionSchema, + volume: volumePermissionSchema, + vector_search_index: vectorSearchIndexPermissionSchema, + uc_function: ucFunctionPermissionSchema, + uc_connection: ucConnectionPermissionSchema, + database: databasePermissionSchema, + postgres: postgresPermissionSchema, + genie_space: genieSpacePermissionSchema, + experiment: experimentPermissionSchema, + app: appPermissionSchema, +} as const; /** - * Resource type options (value + label) from schema $defs.resourceType.enum. + * Resource type options (value + label) from `resourceTypeSchema.options`. */ export function getResourceTypeOptions(): ResourceTypeOption[] { - if (cachedOptions) return cachedOptions; - const schema = loadSchema(); - const defs = schema?.$defs as Record | undefined; - const resourceType = defs?.resourceType as { enum?: string[] } | undefined; - const enumArr = resourceType?.enum; - if (!Array.isArray(enumArr)) { - cachedOptions = []; - return cachedOptions; - } - cachedOptions = enumArr.map((value) => ({ + return resourceTypeSchema.options.map((value) => ({ value, label: humanize(value), })); - return cachedOptions; } /** - * Permissions per resource type from schema resourceRequirement.allOf (if/then). + * Permissions per resource type, derived from each type's per-type permission + * schema's `.options` array. Order is weakest-to-strongest (matches Zod enum + * declaration order, which the original JSON Schema also preserved). */ export function getResourceTypePermissions(): Record { - if (cachedPermissions) return cachedPermissions; - const schema = loadSchema(); const out: Record = {}; - if (!schema?.$defs || typeof schema.$defs !== "object") { - cachedPermissions = out; - return out; - } - const defs = schema.$defs as Record; - const resourceReq = defs.resourceRequirement as - | Record - | undefined; - const allOf = resourceReq?.allOf as - | Array<{ - if?: { properties?: { type?: { const?: string } } }; - then?: { properties?: { permission?: { $ref?: string } } }; - }> - | undefined; - if (!Array.isArray(allOf)) { - cachedPermissions = out; - return out; - } - for (const branch of allOf) { - const typeConst = branch?.if?.properties?.type?.const; - const ref = branch?.then?.properties?.permission?.$ref; - if (typeof typeConst !== "string" || typeof ref !== "string") continue; - const refSegments = ref.replace(/^#\//, "").split("/"); - let def: unknown = schema; - for (const seg of refSegments) { - if (def == null || typeof def !== "object") break; - def = (def as Record)[seg]; - } - const enumArr = Array.isArray((def as { enum?: string[] })?.enum) - ? (def as { enum: string[] }).enum - : undefined; - if (enumArr?.length) out[typeConst] = enumArr; + for (const [type, schema] of Object.entries(PERMISSION_SCHEMAS_BY_TYPE)) { + out[type] = [...schema.options]; } - cachedPermissions = out; return out; } diff --git a/packages/shared/src/cli/commands/plugin/sync/sync.test.ts b/packages/shared/src/cli/commands/plugin/sync/sync.test.ts index 64eec572b..e331e27f3 100644 --- a/packages/shared/src/cli/commands/plugin/sync/sync.test.ts +++ b/packages/shared/src/cli/commands/plugin/sync/sync.test.ts @@ -1,6 +1,7 @@ import path from "node:path"; import { Lang, parse } from "@ast-grep/napi"; import { describe, expect, it } from "vitest"; +import { templateFieldEntrySchema } from "../../../../schemas/manifest"; import { isWithinDirectory, parseImports, @@ -182,4 +183,64 @@ describe("plugin sync", () => { expect(shouldAllowJsManifestForPackage("@acme/plugin")).toBe(false); }); }); + + describe("templateFieldEntrySchema origin transform", () => { + function originOf( + field: Parameters[0], + ) { + return templateFieldEntrySchema.parse(field).origin; + } + + it("emits 'platform' when localOnly is true", () => { + expect(originOf({ env: "PGHOST", localOnly: true })).toBe("platform"); + }); + + it("emits 'platform' when localOnly is true even with resolve", () => { + expect( + originOf({ + env: "PGHOST", + localOnly: true, + resolve: "postgres:host", + }), + ).toBe("platform"); + }); + + it("emits 'static' when value is present", () => { + expect(originOf({ env: "PGPORT", value: "5432" })).toBe("static"); + }); + + it("emits 'cli' when resolve is present", () => { + expect( + originOf({ + env: "LAKEBASE_ENDPOINT", + resolve: "postgres:endpointPath", + }), + ).toBe("cli"); + }); + + it("emits 'user' for fields with no special properties", () => { + expect( + originOf({ + env: "DATABRICKS_WAREHOUSE_ID", + description: "Warehouse ID", + }), + ).toBe("user"); + }); + + it("emits 'user' for a minimal field with only env", () => { + expect(originOf({ env: "MY_VAR" })).toBe("user"); + }); + + it("overwrites a stale 'origin' on input — drift-by-construction", () => { + // A previously-synced template manifest may carry an origin in its + // input; the transform must still emit the canonical computed value. + expect( + originOf({ + env: "PGPORT", + value: "5432", + origin: "user", + }), + ).toBe("static"); + }); + }); }); diff --git a/packages/shared/src/cli/commands/plugin/sync/sync.ts b/packages/shared/src/cli/commands/plugin/sync/sync.ts index 10258c81a..8371856dd 100644 --- a/packages/shared/src/cli/commands/plugin/sync/sync.ts +++ b/packages/shared/src/cli/commands/plugin/sync/sync.ts @@ -2,6 +2,10 @@ import fs from "node:fs"; import path from "node:path"; import { Lang, parse, type SgNode } from "@ast-grep/napi"; import { Command } from "commander"; +import { + TEMPLATE_SCAFFOLDING, + templateFieldEntrySchema, +} from "../../../../schemas/manifest"; import { loadManifestFromFile, type ResolvedManifest, @@ -37,7 +41,7 @@ function isWithinDirectory(filePath: string, boundary: string): boolean { } /** - * Validates a parsed JSON object against the plugin-manifest JSON schema. + * Validates a parsed JSON object against the plugin-manifest schema. * Returns the manifest if valid, or null and logs schema errors. */ function validateManifestWithSchema( @@ -48,7 +52,7 @@ function validateManifestWithSchema( if (result.valid && result.manifest) return result.manifest; if (result.errors?.length) { console.warn( - `Warning: Manifest at ${sourcePath} failed schema validation:\n${formatValidationErrors(result.errors, obj)}`, + `Warning: Manifest at ${sourcePath} failed schema validation:\n${formatValidationErrors(result.errors)}`, ); } return null; @@ -93,6 +97,9 @@ async function loadPluginEntry( manifest.stability !== "ga" && { stability: manifest.stability, }), + ...(manifest.postScaffold && { + postScaffold: manifest.postScaffold, + }), }, ]; } @@ -426,6 +433,9 @@ async function scanForPlugins( manifest.stability !== "ga" && { stability: manifest.stability, }), + ...(manifest.postScaffold && { + postScaffold: manifest.postScaffold, + }), } satisfies TemplatePlugin; } } @@ -529,17 +539,40 @@ async function scanPluginsDir( /** * Write (or preview) the template plugins manifest to disk. + * + * Each resource field is parsed through `templateFieldEntrySchema` so the + * `origin` transform fires and produces canonical `origin` values, even + * when the input carries a stale `origin`. Parsing per-field (rather than + * the whole manifest) keeps the surrounding plugin/resource key order + * stable so the synced JSON's diff stays minimal. */ function writeManifest( outputPath: string, { plugins }: { plugins: TemplatePluginsManifest["plugins"] }, options: { write?: boolean; silent?: boolean; json?: boolean }, ) { + for (const plugin of Object.values(plugins)) { + for (const group of [ + plugin.resources.required, + plugin.resources.optional, + ]) { + for (const resource of group) { + if (!resource.fields) continue; + for (const fieldName of Object.keys(resource.fields)) { + resource.fields[fieldName] = templateFieldEntrySchema.parse( + resource.fields[fieldName], + ); + } + } + } + } + const templateManifest: TemplatePluginsManifest = { $schema: "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", - version: "1.1", + version: "2.0", plugins, + scaffolding: TEMPLATE_SCAFFOLDING, }; const serialized = JSON.stringify(templateManifest, null, 2); diff --git a/packages/shared/src/cli/commands/plugin/validate/validate-manifest.test.ts b/packages/shared/src/cli/commands/plugin/validate/validate-manifest.test.ts index 63dd622d5..1a7371660 100644 --- a/packages/shared/src/cli/commands/plugin/validate/validate-manifest.test.ts +++ b/packages/shared/src/cli/commands/plugin/validate/validate-manifest.test.ts @@ -1,8 +1,12 @@ -import type { ErrorObject } from "ajv"; import { describe, expect, it } from "vitest"; +import { + scaffoldingDescriptorSchema, + TEMPLATE_SCAFFOLDING, +} from "../../../../schemas/manifest"; import { detectSchemaType, formatValidationErrors, + type SemanticIssue, validateManifest, validateTemplateManifest, } from "./validate-manifest"; @@ -234,158 +238,650 @@ describe("validate-manifest", () => { }); describe("formatValidationErrors", () => { - it("formats a required-property error", () => { - const errors: ErrorObject[] = [ + it("formats a single issue with humanized path", () => { + const issues: SemanticIssue[] = [ { - keyword: "required", - instancePath: "", - schemaPath: "#/required", - params: { missingProperty: "name" }, - message: "must have required property 'name'", + level: "error", + path: "name", + message: "Invalid string: must match pattern", }, ]; - const output = formatValidationErrors(errors); - expect(output).toContain('missing required property "name"'); + const output = formatValidationErrors(issues); + expect(output).toBe(" name: Invalid string: must match pattern"); }); - it("formats an enum error with actual value", () => { - const errors: ErrorObject[] = [ + it("formats nested array paths with bracket notation", () => { + const issues: SemanticIssue[] = [ { - keyword: "enum", - instancePath: "/resources/required/0/permission", - schemaPath: "#/$defs/secretPermission/enum", - params: { allowedValues: ["MANAGE", "READ", "WRITE"] }, - message: "must be equal to one of the allowed values", + level: "error", + path: "resources.required[0].permission", + message: "Invalid option", }, ]; - const obj = { - resources: { - required: [{ permission: "INVALID" }], - }, - }; - const output = formatValidationErrors(errors, obj); + const output = formatValidationErrors(issues); expect(output).toContain("resources.required[0].permission"); - expect(output).toContain('(got "INVALID")'); - expect(output).toContain("MANAGE, READ, WRITE"); + expect(output).toContain("Invalid option"); }); - it("formats a pattern error with actual value", () => { - const errors: ErrorObject[] = [ + it("emits one line per issue", () => { + const issues: SemanticIssue[] = [ { - keyword: "pattern", - instancePath: "/name", - schemaPath: "#/properties/name/pattern", - params: { pattern: "^[a-z][a-z0-9-]*$" }, - message: 'must match pattern "^[a-z][a-z0-9-]*$"', + level: "error", + path: "name", + message: "missing", + }, + { + level: "error", + path: "displayName", + message: "must not be empty", }, ]; - const obj = { name: "INVALID" }; - const output = formatValidationErrors(errors, obj); - expect(output).toContain("name"); - expect(output).toContain("does not match expected pattern"); - expect(output).toContain('(got "INVALID")'); + const output = formatValidationErrors(issues); + const lines = output.split("\n"); + expect(lines).toHaveLength(2); }); - it("formats a type error", () => { - const errors: ErrorObject[] = [ - { - keyword: "type", - instancePath: "/name", - schemaPath: "#/properties/name/type", - params: { type: "string" }, - message: "must be string", + it("handles empty issue list", () => { + expect(formatValidationErrors([])).toBe(""); + }); + }); + + describe("validation error contents (semantic equivalence)", () => { + it("reports missing required property", () => { + const result = validateManifest({ name: "test" }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + // Zod reports missing required props as "Invalid input: expected ..." + expect(formatted).toMatch(/displayName|description|resources/); + }); + + it("reports invalid name pattern with the path", () => { + const result = validateManifest({ + ...VALID_MANIFEST, + name: "INVALID", + }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("name"); + expect(formatted).toMatch(/pattern/i); + }); + + it("reports invalid permission for type with allowed enum hints", () => { + const result = validateManifest({ + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "sql_warehouse", + alias: "Warehouse", + resourceKey: "wh", + description: "wh", + permission: "INVALID_PERM", + fields: { id: { env: "TEST_ID" } }, + }, + ], + optional: [], }, - ]; - const output = formatValidationErrors(errors); - expect(output).toContain('expected type "string"'); + }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("resources.required[0].permission"); + expect(formatted).toMatch(/CAN_USE/); }); - it("formats a minLength error", () => { - const errors: ErrorObject[] = [ - { - keyword: "minLength", - instancePath: "/displayName", - schemaPath: "#/properties/displayName/minLength", - params: { limit: 1 }, - message: "must NOT have fewer than 1 characters", + it("reports unknown property at root", () => { + const result = validateManifest({ + ...VALID_MANIFEST, + nonsenseField: "boom", + }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toMatch(/nonsenseField|Unrecognized/); + }); + + it("reports type mismatch", () => { + const result = validateManifest({ + ...VALID_MANIFEST, + name: 42, + }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("name"); + expect(formatted).toMatch(/expected string|received number/); + }); + + it("reports empty-string failures from min(1)", () => { + const result = validateManifest({ + ...VALID_MANIFEST, + displayName: "", + }); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("displayName"); + }); + }); + + describe("semantic refinements (cycles, dangling refs, )", () => { + it("returns valid for a manifest without discovery", () => { + const result = validateManifest(VALID_MANIFEST_WITH_RESOURCE); + expect(result.valid).toBe(true); + }); + + it("detects dangling dependsOn reference", () => { + const manifest = { + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "postgres", + alias: "Postgres", + resourceKey: "postgres", + description: "test", + permission: "CAN_CONNECT_AND_CREATE", + fields: { + branch: { + env: "BRANCH", + description: "Branch name", + discovery: { + type: "cli", + cliCommand: + "databricks postgres list-branches --profile ", + selectField: ".name", + dependsOn: "nonexistent", + }, + }, + }, + }, + ], + optional: [], }, - ]; - const output = formatValidationErrors(errors); - expect(output).toContain("must not be empty"); + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(false); + const messages = (result.errors ?? []).map((e) => e.message).join("\n"); + expect(messages).toContain("non-existent sibling field"); + expect(messages).toContain("nonexistent"); }); - it("formats an additionalProperties error", () => { - const errors: ErrorObject[] = [ - { - keyword: "additionalProperties", - instancePath: "", - schemaPath: "#/additionalProperties", - params: { additionalProperty: "foo" }, - message: "must NOT have additional properties", + it("detects cyclic dependsOn chain", () => { + const manifest = { + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "postgres", + alias: "Postgres", + resourceKey: "postgres", + description: "test", + permission: "CAN_CONNECT_AND_CREATE", + fields: { + a: { + env: "A", + discovery: { + type: "cli", + cliCommand: "databricks cmd --profile ", + selectField: ".id", + dependsOn: "b", + }, + }, + b: { + env: "B", + discovery: { + type: "cli", + cliCommand: "databricks cmd --profile ", + selectField: ".id", + dependsOn: "a", + }, + }, + }, + }, + ], + optional: [], }, - ]; - const output = formatValidationErrors(errors); - expect(output).toContain('unknown property "foo"'); + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(false); + const cycleErrors = (result.errors ?? []).filter((e) => + e.message.includes("cycle"), + ); + expect(cycleErrors.length).toBeGreaterThan(0); + // Cycle path targets the resource, not a specific field. + expect(cycleErrors[0].path).toContain("resources.required[0]"); }); - it("collapses anyOf with enum sub-errors", () => { - const errors: ErrorObject[] = [ - { - keyword: "enum", - instancePath: "/perm", - schemaPath: "#/$defs/a/enum", - params: { allowedValues: ["A", "B"] }, - message: "must be equal to one of the allowed values", + it("detects cyclic dependsOn chain across kind variants", () => { + const manifest = { + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "postgres", + alias: "Postgres", + resourceKey: "postgres", + description: "test", + permission: "CAN_CONNECT_AND_CREATE", + fields: { + branch: { + env: "BRANCH", + discovery: { + type: "kind", + resourceKind: "postgres_branch", + dependsOn: "database", + }, + }, + database: { + env: "DATABASE", + discovery: { + type: "kind", + resourceKind: "postgres_database", + dependsOn: "branch", + }, + }, + }, + }, + ], + optional: [], }, - { - keyword: "enum", - instancePath: "/perm", - schemaPath: "#/$defs/b/enum", - params: { allowedValues: ["C", "D"] }, - message: "must be equal to one of the allowed values", + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(false); + const cycleErrors = (result.errors ?? []).filter((e) => + e.message.includes("cycle"), + ); + expect(cycleErrors.length).toBeGreaterThan(0); + }); + + it("detects missing in cli variant cliCommand", () => { + const manifest = { + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "sql_warehouse", + alias: "SQL Warehouse", + resourceKey: "sql-warehouse", + description: "test", + permission: "CAN_USE", + fields: { + id: { + env: "WAREHOUSE_ID", + discovery: { + type: "cli", + cliCommand: "databricks warehouses list --output json", + selectField: ".id", + }, + }, + }, + }, + ], + optional: [], }, - { - keyword: "anyOf", - instancePath: "/perm", - schemaPath: "#/anyOf", - params: {}, - message: "must match a schema in anyOf", + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(false); + const messages = (result.errors ?? []).map((e) => e.message).join("\n"); + expect(messages).toContain(""); + }); + + it("rejects empty postScaffold instruction", () => { + const manifest = { + ...VALID_MANIFEST, + postScaffold: [{ instruction: "" }], + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("postScaffold[0].instruction"); + }); + + it("passes for valid manifest with all new fields", () => { + const manifest = { + ...VALID_MANIFEST, + postScaffold: [ + { instruction: "Run migrations", required: true }, + { instruction: "Verify connectivity" }, + ], + resources: { + required: [ + { + type: "sql_warehouse", + alias: "SQL Warehouse", + resourceKey: "sql-warehouse", + description: "test", + permission: "CAN_USE", + fields: { + id: { + env: "WAREHOUSE_ID", + description: "Warehouse ID", + discovery: { + type: "cli", + cliCommand: + "databricks warehouses list --profile --output json", + selectField: ".id", + displayField: ".name", + }, + }, + }, + }, + ], + optional: [], }, - ]; - const obj = { perm: "X" }; - const output = formatValidationErrors(errors, obj); - expect(output).toContain('invalid value (got "X")'); - expect(output).toContain("A, B, C, D"); - const lines = output.split("\n"); - expect(lines.length).toBe(2); + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(true); }); + }); - it("skips if-keyword errors", () => { - const errors: ErrorObject[] = [ - { - keyword: "if", - instancePath: "", - schemaPath: "#/allOf/0/if", - params: { failingKeyword: "if" }, - message: 'must match "if" schema', + describe("discovery descriptor (discriminated union)", () => { + function buildManifestWithDiscovery( + type: string, + permission: string, + discovery: unknown, + ): unknown { + return { + ...VALID_MANIFEST, + resources: { + required: [ + { + type, + alias: "Test Resource", + resourceKey: "test", + description: "test", + permission, + fields: { + id: { + env: "TEST_ID", + discovery, + }, + }, + }, + ], + optional: [], }, - ]; - const output = formatValidationErrors(errors); - expect(output).toBe(""); + }; + } + + it("accepts a manifest with no discovery descriptor (v1.0 fixture)", () => { + // No `discovery` field on the resource field — minimal v1.0-shaped manifest. + const result = validateManifest({ + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "sql_warehouse", + alias: "SQL Warehouse", + resourceKey: "sql-warehouse", + description: "Required for queries", + permission: "CAN_USE", + fields: { + id: { + env: "DATABRICKS_WAREHOUSE_ID", + description: "SQL Warehouse ID", + }, + }, + }, + ], + optional: [], + }, + }); + expect(result.valid).toBe(true); }); - it("handles root-level errors with empty instancePath", () => { - const errors: ErrorObject[] = [ - { - keyword: "required", - instancePath: "", - schemaPath: "#/required", - params: { missingProperty: "name" }, - message: "must have required property 'name'", + it("accepts kind variant for warehouse", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "kind", + resourceKind: "warehouse", + }), + ); + expect(result.valid).toBe(true); + }); + + it("accepts kind variant for genie_space", () => { + const result = validateManifest( + buildManifestWithDiscovery("genie_space", "CAN_RUN", { + type: "kind", + resourceKind: "genie_space", + }), + ); + expect(result.valid).toBe(true); + }); + + it("accepts kind variant for postgres_branch", () => { + const result = validateManifest( + buildManifestWithDiscovery("postgres", "CAN_CONNECT_AND_CREATE", { + type: "kind", + resourceKind: "postgres_branch", + }), + ); + expect(result.valid).toBe(true); + }); + + it("accepts kind variant for postgres_database with dependsOn", () => { + const manifest = { + ...VALID_MANIFEST, + resources: { + required: [ + { + type: "postgres", + alias: "Postgres", + resourceKey: "postgres", + description: "test", + permission: "CAN_CONNECT_AND_CREATE", + fields: { + branch: { + env: "BRANCH", + discovery: { + type: "kind", + resourceKind: "postgres_branch", + }, + }, + database: { + env: "DATABASE", + discovery: { + type: "kind", + resourceKind: "postgres_database", + dependsOn: "branch", + }, + }, + }, + }, + ], + optional: [], }, - ]; - const output = formatValidationErrors(errors); - expect(output).toContain('missing required property "name"'); + }; + const result = validateManifest(manifest); + expect(result.valid).toBe(true); + }); + + it("accepts kind variant for volume with custom select", () => { + const result = validateManifest( + buildManifestWithDiscovery("volume", "READ_VOLUME", { + type: "kind", + resourceKind: "volume", + select: "full_name", + }), + ); + expect(result.valid).toBe(true); + }); + + it("rejects kind variant with unrecognized resourceKind", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "kind", + resourceKind: "unknown_kind", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("resourceKind"); + }); + + it("accepts cli variant with ", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "cli", + cliCommand: + "databricks warehouses list --profile --output json", + selectField: ".id", + displayField: ".name", + }), + ); + expect(result.valid).toBe(true); + }); + + it("rejects cli variant missing cliCommand", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "cli", + selectField: ".id", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("cliCommand"); + }); + + it("rejects cli variant missing selectField", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "cli", + cliCommand: + "databricks warehouses list --profile --output json", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("selectField"); + }); + + it("rejects discovery descriptor missing type discriminator", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + cliCommand: + "databricks warehouses list --profile --output json", + selectField: ".id", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + // Either a missing-discriminator error, or a "type" path issue. + expect(formatted).toMatch(/type|discriminator/i); + }); + + it("rejects cli variant with shell metacharacters in cliCommand", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "cli", + cliCommand: + "databricks warehouses list --profile --output json; rm -rf /", + selectField: ".id", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("cliCommand"); + expect(formatted).toMatch(/shell metacharacters/i); + }); + + it("rejects cli variant with shell metacharacters in shortcut", () => { + const result = validateManifest( + buildManifestWithDiscovery("sql_warehouse", "CAN_USE", { + type: "cli", + cliCommand: + "databricks warehouses list --profile --output json", + selectField: ".id", + shortcut: + "databricks warehouses get --profile | tail -n1", + }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("shortcut"); + expect(formatted).toMatch(/shell metacharacters/i); + }); + }); + + describe("scaffolding rule item maxLength (Phase 6)", () => { + function buildTemplateManifestWithRules(rules: { + never?: string[]; + must?: string[]; + }): unknown { + return { + $schema: + "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", + version: "2.0", + plugins: {}, + scaffolding: { + command: "databricks apps init", + rules, + }, + }; + } + + // 121-char string — one past the boundary. + const TOO_LONG = "x".repeat(121); + // 120-char string — at the boundary. + const AT_MAX = "x".repeat(120); + + it("rejects a never[] item exceeding 120 characters", () => { + const result = validateTemplateManifest( + buildTemplateManifestWithRules({ never: [TOO_LONG] }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("scaffolding.rules.never[0]"); + expect(formatted).toMatch(/120/); + }); + + it("rejects a must[] item exceeding 120 characters", () => { + const result = validateTemplateManifest( + buildTemplateManifestWithRules({ must: [TOO_LONG] }), + ); + expect(result.valid).toBe(false); + const formatted = formatValidationErrors(result.errors ?? []); + expect(formatted).toContain("scaffolding.rules.must[0]"); + expect(formatted).toMatch(/120/); + }); + + it("accepts rule items at exactly 120 characters", () => { + const result = validateTemplateManifest( + buildTemplateManifestWithRules({ + never: [AT_MAX], + must: [AT_MAX], + }), + ); + expect(result.valid).toBe(true); + }); + + it("flags only the offending entry in a mixed-length array", () => { + const result = validateTemplateManifest( + buildTemplateManifestWithRules({ + must: ["short directive", TOO_LONG, "another short one"], + }), + ); + expect(result.valid).toBe(false); + const paths = (result.errors ?? []).map((e) => e.path); + expect(paths).toContain("scaffolding.rules.must[1]"); + expect(paths).not.toContain("scaffolding.rules.must[0]"); + expect(paths).not.toContain("scaffolding.rules.must[2]"); + }); + + it("TEMPLATE_SCAFFOLDING parses against scaffoldingDescriptorSchema", () => { + // The exported constant must validate against its own schema, including + // the maxLength ceiling on each rule item. + const parsed = scaffoldingDescriptorSchema.parse(TEMPLATE_SCAFFOLDING); + expect(parsed.command).toBe("databricks apps init"); + expect(parsed.rules?.must).toBeDefined(); + expect(parsed.rules?.never).toBeDefined(); + }); + + it("TEMPLATE_SCAFFOLDING.rules.must includes the volume parent-walk MUST directive", () => { + // Phase 6: hierarchical context for volumes is encoded as a MUST rule + // rather than a schema-level dependency graph. + expect(TEMPLATE_SCAFFOLDING.rules.must).toContain( + "When discovering volume resources, prompt the user for catalog and schema before listing volumes.", + ); }); }); }); diff --git a/packages/shared/src/cli/commands/plugin/validate/validate-manifest.ts b/packages/shared/src/cli/commands/plugin/validate/validate-manifest.ts index b0284b765..062d9f87b 100644 --- a/packages/shared/src/cli/commands/plugin/validate/validate-manifest.ts +++ b/packages/shared/src/cli/commands/plugin/validate/validate-manifest.ts @@ -1,23 +1,12 @@ -import fs from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import Ajv, { type ErrorObject } from "ajv"; -import addFormats from "ajv-formats"; +import type { StandardSchemaV1 } from "@standard-schema/spec"; +import { + pluginManifestSchema, + templatePluginsManifestSchema, +} from "../../../../schemas/manifest"; import type { PluginManifest } from "../manifest-types"; export type { PluginManifest }; -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const SCHEMAS_DIR = path.join(__dirname, "..", "..", "..", "..", "schemas"); -const PLUGIN_MANIFEST_SCHEMA_PATH = path.join( - SCHEMAS_DIR, - "plugin-manifest.schema.json", -); -const TEMPLATE_PLUGINS_SCHEMA_PATH = path.join( - SCHEMAS_DIR, - "template-plugins.schema.json", -); - export type SchemaType = "plugin-manifest" | "template-plugins" | "unknown"; const SCHEMA_ID_MAP: Record = { @@ -38,112 +27,128 @@ export function detectSchemaType(obj: unknown): SchemaType { return SCHEMA_ID_MAP[schemaUrl] ?? "unknown"; } +/** + * A single validation issue produced by the schema validator. The `path` + * is a humanized property path (e.g., `resources.required[0].permission`) + * suitable for direct CLI output. + */ +export interface SemanticIssue { + level: "error" | "warning"; + path: string; + message: string; +} + export interface ValidateResult { valid: boolean; manifest?: PluginManifest; - errors?: ErrorObject[]; + errors?: SemanticIssue[]; } -let schemaLoadWarned = false; - -function loadSchema(schemaPath: string): object | null { - try { - return JSON.parse(fs.readFileSync(schemaPath, "utf-8")) as object; - } catch (err) { - if (!schemaLoadWarned) { - schemaLoadWarned = true; - console.warn( - `Warning: Could not load JSON schema at ${schemaPath}: ${err instanceof Error ? err.message : err}. Falling back to basic validation.`, - ); +/** + * Convert a Standard Schema issue path (array of property keys / path segments) + * into a humanized string like `resources.required[0].permission`. + */ +function humanizePath( + path: ReadonlyArray | undefined, +): string { + if (!path || path.length === 0) return "(root)"; + + let out = ""; + for (const segment of path) { + const key = + typeof segment === "object" && segment !== null && "key" in segment + ? segment.key + : segment; + if (typeof key === "number") { + out += `[${key}]`; + } else { + const str = String(key); + out += out.length === 0 ? str : `.${str}`; } - return null; } + return out.length === 0 ? "(root)" : out; } -let compiledPluginValidator: ReturnType | null = null; - -function getPluginValidator(): ReturnType | null { - if (compiledPluginValidator) return compiledPluginValidator; - const schema = loadSchema(PLUGIN_MANIFEST_SCHEMA_PATH); - if (!schema) return null; - try { - const ajv = new Ajv({ allErrors: true, strict: false }); - addFormats(ajv); - compiledPluginValidator = ajv.compile(schema); - return compiledPluginValidator; - } catch { - return null; - } -} - -let compiledTemplateValidator: ReturnType | null = null; - -function getTemplateValidator(): ReturnType | null { - if (compiledTemplateValidator) return compiledTemplateValidator; - const pluginSchema = loadSchema(PLUGIN_MANIFEST_SCHEMA_PATH); - const templateSchema = loadSchema(TEMPLATE_PLUGINS_SCHEMA_PATH); - if (!pluginSchema || !templateSchema) return null; - try { - const ajv = new Ajv({ allErrors: true, strict: false }); - addFormats(ajv); - ajv.addSchema(pluginSchema); - compiledTemplateValidator = ajv.compile(templateSchema); - return compiledTemplateValidator; - } catch { - return null; +/** + * Map a Standard Schema issue list into the legacy `SemanticIssue` shape so + * consumer code can stay uniform. + */ +function mapIssues( + issues: ReadonlyArray, +): SemanticIssue[] { + const result: SemanticIssue[] = []; + for (const issue of issues) { + result.push({ + level: "error", + path: humanizePath(issue.path), + message: issue.message, + }); } + return result; } /** - * Validate a manifest object against the plugin-manifest JSON schema. - * Returns validation result with optional errors for CLI output. + * Validate an object against a Standard Schema and produce a uniform + * `ValidateResult`. The manifest output is captured for downstream consumers. */ -export function validateManifest(obj: unknown): ValidateResult { - if (!obj || typeof obj !== "object") { +function validateWithStandardSchema( + schema: StandardSchemaV1, + obj: unknown, +): { valid: true; output: T } | { valid: false; errors: SemanticIssue[] } { + const result = schema["~standard"].validate(obj); + if (result instanceof Promise) { + // Our schemas are synchronous; treat any async resolution as an error + // rather than blocking the CLI on a background promise. return { valid: false, errors: [ { - instancePath: "", - message: "Manifest is not a valid object", - } as ErrorObject, + level: "error", + path: "(root)", + message: + "Schema returned an async validation result; expected synchronous validation.", + }, ], }; } + if (result.issues) { + return { valid: false, errors: mapIssues(result.issues) }; + } + return { valid: true, output: result.value }; +} - const validate = getPluginValidator(); - if (!validate) { - const m = obj as Record; - const basicValid = - typeof m.name === "string" && - m.name.length > 0 && - typeof m.displayName === "string" && - m.displayName.length > 0 && - typeof m.description === "string" && - m.description.length > 0 && - m.resources && - typeof m.resources === "object" && - Array.isArray((m.resources as { required?: unknown }).required); - if (basicValid) return { valid: true, manifest: obj as PluginManifest }; +/** + * Validate a manifest object against the plugin-manifest schema. + * Returns validation result with optional errors for CLI output. + * + * On success, the returned `manifest` is the original input object (preserving + * its property order) typed as `PluginManifest`, not a re-emitted Zod copy. + * Round-trip writers like `add-resource` rely on this to keep the on-disk + * field ordering stable. + */ +export function validateManifest(obj: unknown): ValidateResult { + if (!obj || typeof obj !== "object") { return { valid: false, errors: [ { - instancePath: "", - message: "Invalid manifest structure", - } as ErrorObject, + level: "error", + path: "(root)", + message: "Manifest is not a valid object", + }, ], }; } - const valid = validate(obj); - if (valid) return { valid: true, manifest: obj as PluginManifest }; - return { valid: false, errors: validate.errors ?? [] }; + const result = validateWithStandardSchema(pluginManifestSchema, obj); + if (result.valid) { + return { valid: true, manifest: obj as PluginManifest }; + } + return { valid: false, errors: result.errors }; } /** * Validate a template-plugins manifest (appkit.plugins.json) against its schema. - * Registers the plugin-manifest schema first so external $refs resolve. */ export function validateTemplateManifest(obj: unknown): ValidateResult { if (!obj || typeof obj !== "object") { @@ -151,155 +156,27 @@ export function validateTemplateManifest(obj: unknown): ValidateResult { valid: false, errors: [ { - instancePath: "", + level: "error", + path: "(root)", message: "Template manifest is not a valid object", - } as ErrorObject, + }, ], }; } - const validate = getTemplateValidator(); - if (!validate) { - const m = obj as Record; - const basicValid = - typeof m.version === "string" && - m.plugins && - typeof m.plugins === "object"; - if (basicValid) return { valid: true }; - return { - valid: false, - errors: [ - { - instancePath: "", - message: "Invalid template manifest structure", - } as ErrorObject, - ], - }; + const result = validateWithStandardSchema(templatePluginsManifestSchema, obj); + if (result.valid) { + return { valid: true }; } - - const valid = validate(obj); - if (valid) return { valid: true }; - return { valid: false, errors: validate.errors ?? [] }; + return { valid: false, errors: result.errors }; } /** - * Convert a JSON pointer like /resources/required/0/permission - * to a readable path like resources.required[0].permission + * Format validation issues for CLI output. Each issue is rendered on its own + * line indented by two spaces, with the format ` : `. The + * `path` is already humanized when issues are produced by `validateManifest` + * / `validateTemplateManifest`. */ -function humanizePath(instancePath: string): string { - if (!instancePath) return "(root)"; - return instancePath - .replace(/^\//, "") - .replace(/\/(\d+)\//g, "[$1].") - .replace(/\/(\d+)$/g, "[$1]") - .replace(/\//g, "."); -} - -/** - * Resolve a JSON pointer to the actual value in the parsed object. - */ -function resolvePointer(obj: unknown, instancePath: string): unknown { - if (!instancePath) return obj; - const segments = instancePath.replace(/^\//, "").split("/"); - let current: unknown = obj; - for (const seg of segments) { - if (current == null || typeof current !== "object") return undefined; - current = (current as Record)[seg]; - } - return current; -} - -/** - * Format schema errors for CLI output. - * Collapses anyOf/oneOf sub-errors into a single message and shows - * the actual invalid value when available. - * - * @param errors - AJV error objects - * @param obj - The original parsed object (optional, used to show actual values) - */ -export function formatValidationErrors( - errors: ErrorObject[], - obj?: unknown, -): string { - const grouped = new Map(); - for (const e of errors) { - const key = e.instancePath || "/"; - if (!grouped.has(key)) grouped.set(key, []); - const list = grouped.get(key); - if (list) list.push(e); - } - - const lines: string[] = []; - - for (const [path, errs] of grouped) { - const readable = humanizePath(path); - const anyOfErr = errs.find( - (e) => e.keyword === "anyOf" || e.keyword === "oneOf", - ); - - if (anyOfErr) { - const enumErrors = errs.filter((e) => e.keyword === "enum"); - if (enumErrors.length > 0) { - const allValues = [ - ...new Set( - enumErrors.flatMap( - (e) => (e.params?.allowedValues as string[]) ?? [], - ), - ), - ]; - const actual = - obj !== undefined ? resolvePointer(obj, path) : undefined; - const valueHint = - actual !== undefined ? ` (got ${JSON.stringify(actual)})` : ""; - lines.push( - ` ${readable}: invalid value${valueHint}`, - ` allowed: ${allValues.join(", ")}`, - ); - continue; - } - } - - for (const e of errs) { - if (e.keyword === "anyOf" || e.keyword === "oneOf") continue; - if (e.keyword === "if") continue; - if (anyOfErr && e.keyword === "enum") continue; - - if (e.keyword === "enum") { - const allowed = (e.params?.allowedValues as string[]) ?? []; - const actual = - obj !== undefined ? resolvePointer(obj, path) : undefined; - const valueHint = - actual !== undefined ? ` (got ${JSON.stringify(actual)})` : ""; - lines.push( - ` ${readable}: invalid value${valueHint}, allowed: ${allowed.join(", ")}`, - ); - } else if (e.keyword === "required") { - lines.push( - ` ${readable}: missing required property "${e.params?.missingProperty}"`, - ); - } else if (e.keyword === "additionalProperties") { - lines.push( - ` ${readable}: unknown property "${e.params?.additionalProperty}"`, - ); - } else if (e.keyword === "pattern") { - const actual = - obj !== undefined ? resolvePointer(obj, path) : undefined; - const valueHint = - actual !== undefined ? ` (got ${JSON.stringify(actual)})` : ""; - lines.push( - ` ${readable}: does not match expected pattern${valueHint}`, - ); - } else if (e.keyword === "type") { - lines.push(` ${readable}: expected type "${e.params?.type}"`); - } else if (e.keyword === "minLength") { - lines.push(` ${readable}: must not be empty`); - } else { - lines.push( - ` ${readable}: ${e.message}${e.params ? ` (${JSON.stringify(e.params)})` : ""}`, - ); - } - } - } - - return lines.join("\n"); +export function formatValidationErrors(issues: SemanticIssue[]): string { + return issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n"); } diff --git a/packages/shared/src/cli/commands/plugin/validate/validate.ts b/packages/shared/src/cli/commands/plugin/validate/validate.ts index 306ee7a8c..fd0a20a86 100644 --- a/packages/shared/src/cli/commands/plugin/validate/validate.ts +++ b/packages/shared/src/cli/commands/plugin/validate/validate.ts @@ -7,6 +7,7 @@ import { type ResolvedManifest, resolveManifestInDir, } from "../manifest-resolve"; +import type { ValidateResult } from "./validate-manifest"; import { detectSchemaType, formatValidationErrors, @@ -92,7 +93,12 @@ async function runPluginValidate( } let hasFailure = false; - const jsonResults: { path: string; valid: boolean; errors?: string[] }[] = []; + const jsonResults: { + path: string; + valid: boolean; + errors?: string[]; + warnings?: string[]; + }[] = []; for (const { path: manifestPath, type } of manifestPaths) { const relativePath = path.relative(cwd, manifestPath); @@ -116,7 +122,7 @@ async function runPluginValidate( } const schemaType = detectSchemaType(obj); - const result = + const result: ValidateResult = schemaType === "template-plugins" ? validateTemplateManifest(obj) : validateManifest(obj); @@ -130,9 +136,7 @@ async function runPluginValidate( } else { if (options.json) { const errors = result.errors?.length - ? formatValidationErrors(result.errors, obj) - .split("\n") - .filter(Boolean) + ? formatValidationErrors(result.errors).split("\n").filter(Boolean) : []; jsonResults.push({ path: relativePath, @@ -142,7 +146,7 @@ async function runPluginValidate( } else { console.error(`✗ ${relativePath}`); if (result.errors?.length) { - console.error(formatValidationErrors(result.errors, obj)); + console.error(formatValidationErrors(result.errors)); } } hasFailure = true; diff --git a/packages/shared/src/plugin.ts b/packages/shared/src/plugin.ts index 651840c7b..73fd87519 100644 --- a/packages/shared/src/plugin.ts +++ b/packages/shared/src/plugin.ts @@ -1,13 +1,17 @@ import type express from "express"; import type { JSONSchema7 } from "json-schema"; import type { + DiscoveryDescriptor, PluginManifest as GeneratedPluginManifest, - ResourceRequirement as GeneratedResourceRequirement, + PostScaffoldStep, ResourceFieldEntry, -} from "./schemas/plugin-manifest.generated"; +} from "./schemas/manifest"; -// Re-export generated types as the shared canonical definitions. -export type { ResourceFieldEntry }; +// Re-export the canonical schema-derived types as the shared definitions. +// Phase 4: sourced from `./schemas/manifest` (the Zod canonical) instead of +// the legacy generated file, which has a stale `DiscoveryDescriptor` shape +// (free-form vs. discriminated union after the Phase 4 reshape). +export type { ResourceFieldEntry, DiscoveryDescriptor, PostScaffoldStep }; /** Base plugin interface. */ export interface BasePlugin { @@ -92,11 +96,11 @@ export type PluginConstructor< /** * Manifest declaration for plugins. - * Extends the generated PluginManifest with a generic name parameter - * and uses JSONSchema7 for config.schema (the generated ConfigSchema + * Extends the schema-derived PluginManifest with a generic name parameter + * and uses JSONSchema7 for config.schema (the schema-inferred ConfigSchema * is too restrictive for plugin consumers). * - * @see {@link GeneratedPluginManifest} — generated base from plugin-manifest.schema.json + * @see {@link GeneratedPluginManifest} — Zod-inferred base from `schemas/manifest` * @see `packages/appkit/src/registry/types.ts` `PluginManifest` — strict appkit narrowing (enum types) */ export interface PluginManifest @@ -119,10 +123,21 @@ export interface PluginManifest * - `fields` is made required (schema has it optional, but registry always populates it) * - `required` boolean tracks whether the resource is mandatory at runtime * - * @see {@link GeneratedResourceRequirement} — generated base from plugin-manifest.schema.json + * Defined as a flat structural shape rather than narrowing the schema-derived + * discriminated union. Per-type permission tightness is enforced by the + * Zod parse at validation time; expressing it in the consumer-facing + * `ResourceRequirement` would force every plugin to thread the variant type + * through `getResourceRequirements()` for no runtime benefit. + * + * @see `packages/shared/src/schemas/manifest.ts` `resourceRequirementSchema` — Zod discriminated union * @see `packages/appkit/src/registry/types.ts` `ResourceRequirement` — strict appkit narrowing (enum types) */ -export interface ResourceRequirement extends GeneratedResourceRequirement { +export interface ResourceRequirement { + type: string; + alias: string; + resourceKey: string; + description: string; + permission: string; fields: Record; required: boolean; } diff --git a/packages/shared/src/schemas/manifest.ts b/packages/shared/src/schemas/manifest.ts new file mode 100644 index 000000000..51cd5f9ca --- /dev/null +++ b/packages/shared/src/schemas/manifest.ts @@ -0,0 +1,1076 @@ +/** + * Zod-authoring module for AppKit plugin manifest schemas. + * + * Single source of truth for the plugin manifest contract. JSON Schema + * artifacts published at the docs URL are emitted from these schemas via + * `tools/generate-json-schema.ts` and live only in `docs/static/schemas/` + * (no package-internal copies). + * + * - Phase 2: cross-field constraints (cycle/dangling-reference checks, + * `` placeholder, post-scaffold instruction non-empty) are + * refinements co-located with the shape they constrain. Validation is + * driven through the Standard Schema interface from `validate-manifest.ts`. + * - Phase 3: `templateFieldEntrySchema` is a transform that emits `origin` + * from `localOnly`/`value`/`resolve`. The input slot is still allowed so + * re-parsing previously-synced template manifests does not fail, but the + * transform always overwrites it — drift-by-construction for hand-edits. + * - Phase 4: `discoveryDescriptorSchema` is a discriminated union over a + * `type` literal. The `kind` variant references one of five well-known + * `resourceKind` values for which AppKit owns the CLI command map (see + * `RESOURCE_KIND_COMMANDS` below). The `cli` variant is the escape hatch + * carrying the existing free-form fields (with the `` + * refinement). Hierarchical context for volumes (catalog/schema parent + * walk) is encoded as a Phase 6 MUST rule, not modeled in the schema. + * - Phase 6: scaffolding rule items carry a `maxLength` (120 chars) so + * `rules.never[]` / `rules.must[]` stay short directives by contract, and + * the canonical `TEMPLATE_SCAFFOLDING` constant lives co-located with the + * scaffolding schemas (sync.ts imports it). + */ + +import { z } from "zod"; + +// ── Resource type + per-type permission enums ──────────────────────────── + +export const resourceTypeSchema = z + .enum([ + "secret", + "job", + "sql_warehouse", + "serving_endpoint", + "volume", + "vector_search_index", + "uc_function", + "uc_connection", + "database", + "postgres", + "genie_space", + "experiment", + "app", + ]) + .describe("Type of Databricks resource"); + +export const secretPermissionSchema = z + .enum(["READ", "WRITE", "MANAGE"]) + .describe("Permission for secret resources (order: weakest to strongest)"); + +export const jobPermissionSchema = z + .enum(["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"]) + .describe("Permission for job resources (order: weakest to strongest)"); + +export const sqlWarehousePermissionSchema = z + .enum(["CAN_USE", "CAN_MANAGE"]) + .describe( + "Permission for SQL warehouse resources (order: weakest to strongest)", + ); + +export const servingEndpointPermissionSchema = z + .enum(["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"]) + .describe( + "Permission for serving endpoint resources (order: weakest to strongest)", + ); + +export const volumePermissionSchema = z + .enum(["READ_VOLUME", "WRITE_VOLUME"]) + .describe("Permission for Unity Catalog volume resources"); + +export const vectorSearchIndexPermissionSchema = z + .enum(["SELECT"]) + .describe("Permission for vector search index resources"); + +export const ucFunctionPermissionSchema = z + .enum(["EXECUTE"]) + .describe("Permission for Unity Catalog function resources"); + +export const ucConnectionPermissionSchema = z + .enum(["USE_CONNECTION"]) + .describe("Permission for Unity Catalog connection resources"); + +export const databasePermissionSchema = z + .enum(["CAN_CONNECT_AND_CREATE"]) + .describe("Permission for database resources"); + +export const postgresPermissionSchema = z + .enum(["CAN_CONNECT_AND_CREATE"]) + .describe("Permission for Postgres resources"); + +export const genieSpacePermissionSchema = z + .enum(["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"]) + .describe( + "Permission for Genie Space resources (order: weakest to strongest)", + ); + +export const experimentPermissionSchema = z + .enum(["CAN_READ", "CAN_EDIT", "CAN_MANAGE"]) + .describe( + "Permission for MLflow experiment resources (order: weakest to strongest)", + ); + +export const appPermissionSchema = z + .enum(["CAN_USE"]) + .describe("Permission for Databricks App resources"); + +// ── Discovery descriptor (discriminated union) ─────────────────────────── + +/** + * Well-known Databricks resource kinds for which AppKit owns the CLI + * command map. Plugins reference one of these via the `kind` variant of the + * discovery descriptor; everything else falls back to the free-form `cli` + * variant. + * + * Kept narrow on purpose: each entry costs an addition to + * `RESOURCE_KIND_COMMANDS` below, which is the single source of truth for + * how that kind is enumerated. + */ +export const resourceKindSchema = z + .enum([ + "warehouse", + "genie_space", + "postgres_project", + "postgres_branch", + "postgres_database", + "volume", + ]) + .describe( + "Well-known Databricks resource kind whose listing command is owned by AppKit (see RESOURCE_KIND_COMMANDS).", + ); + +export const kindDiscoveryDescriptorSchema = z + .object({ + type: z + .literal("kind") + .describe( + "Discriminator: 'kind' uses the AppKit-owned command map for the named resourceKind.", + ), + resourceKind: resourceKindSchema.describe( + "Reference to a well-known Databricks resource kind. AppKit owns the CLI command, response shape, and unwrap rules.", + ), + select: z + .string() + .optional() + .describe( + "Field name in the parsed CLI response used as the selected value (e.g., 'id'). Defaults to the kind's natural identifier when omitted.", + ), + display: z + .string() + .optional() + .describe( + "Field name in the parsed CLI response shown to the user in selection UI. Defaults to `select` if omitted.", + ), + dependsOn: z + .string() + .optional() + .describe( + "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + ), + shortcut: z + .string() + .optional() + .describe( + "Single-value fast-path command that returns exactly one value, skipping interactive selection.", + ), + }) + .strict() + .describe( + "Discovery via a well-known resource kind. AppKit owns the CLI command and unwrap rules for the named kind.", + ); + +/** + * Shell metacharacters rejected on free-form CLI command strings. Catches the + * common foot-guns (statement separators, pipes, redirects via shell, command + * substitution, newlines). Not a security boundary on its own — executors must + * always pass these via argv, never shell-exec the string. Angle brackets are + * permitted because `` (and future `<…>` placeholders) are part of + * the command-template convention. + */ +const SHELL_METACHAR_RE = /[;|&`$\n\r]/; + +export const cliDiscoveryDescriptorSchema = z + .object({ + type: z + .literal("cli") + .describe( + "Discriminator: 'cli' uses a free-form Databricks CLI command supplied by the plugin.", + ), + cliCommand: z + .string() + .describe( + "Databricks CLI command that lists resources. Must include . Shell metacharacters (;|&`$ and newlines) are rejected; for first-party Databricks resources prefer the `kind` variant which uses AppKit's typed command map.", + ), + selectField: z + .string() + .describe( + "jq-style path to the field used as the selected value (e.g., '.id', '.name').", + ), + displayField: z + .string() + .optional() + .describe( + "jq-style path to the field shown to the user in selection UI. Defaults to selectField if omitted.", + ), + dependsOn: z + .string() + .optional() + .describe( + "Name of a sibling field within the same resource that must be resolved first. Used to express ordering dependencies between resource fields.", + ), + shortcut: z + .string() + .optional() + .describe( + "Single-value fast-path command that returns exactly one value, skipping interactive selection. Shell metacharacters are rejected.", + ), + }) + .strict() + .refine((descriptor) => descriptor.cliCommand.includes(""), { + message: "must include placeholder", + path: ["cliCommand"], + }) + .refine((descriptor) => !SHELL_METACHAR_RE.test(descriptor.cliCommand), { + message: + "must not contain shell metacharacters (;|&`$ or newlines); use the `kind` variant for typed Databricks resources", + path: ["cliCommand"], + }) + .refine( + (descriptor) => + descriptor.shortcut === undefined || + !SHELL_METACHAR_RE.test(descriptor.shortcut), + { + message: "must not contain shell metacharacters (;|&`$ or newlines)", + path: ["shortcut"], + }, + ) + .describe( + "Discovery via a free-form Databricks CLI command. Escape hatch — prefer the `kind` variant when a typed resourceKind covers the resource. This shape is intentionally minimal and may tighten further in future versions.", + ); + +export const discoveryDescriptorSchema = z + .discriminatedUnion("type", [ + kindDiscoveryDescriptorSchema, + cliDiscoveryDescriptorSchema, + ]) + .describe( + "Describes how the CLI discovers values for a resource field. 'kind' references a well-known Databricks resource kind whose command is owned by AppKit; 'cli' is the escape hatch carrying a free-form Databricks CLI command.", + ); + +// ── Resource kind → CLI command map ────────────────────────────────────── + +/** + * Descriptor for how a well-known resource kind is listed via the + * Databricks CLI. + * + * - `command` is the CLI invocation template. It carries two kinds of + * placeholders: + * - `` — substituted with the user's CLI profile by the runner. + * - `{}` — substituted with the resolved value of the named + * sibling field (used for `dependsOn` chains). + * - `unwrap`, when set, is the JSON path into the response wrapper (e.g., + * `"warehouses"` for `{ warehouses: [...] }`). Omitted when the response + * is already a flat array. + */ +export type ResourceKindCommand = { + command: string; + unwrap?: string; +}; + +/** + * Single source of truth for AppKit-owned discovery commands. + * + * To add a new resource kind: extend `resourceKindSchema` and add an entry + * here. Plugins reference the kind via `discovery: { type: "kind", + * resourceKind: "..." }` and inherit the command + response shape. + * + * `unwrap` defaults are unset: the existing core plugin manifests use simple + * jq paths (`.id`, `.name`, `.full_name`), implying the listed CLI commands + * return flat arrays. Refine in a follow-up if a kind's CLI returns wrapped + * data. + * + * Volume's catalog/schema parent context is supplied via the `{catalog}` and + * `{schema}` placeholders, prompted from the user via a Phase 6 MUST rule + * (the CLI does not auto-discover these — it asks before listing volumes). + */ +export const RESOURCE_KIND_COMMANDS: Record< + z.infer, + ResourceKindCommand +> = { + warehouse: { + command: "databricks warehouses list --profile --output json", + }, + genie_space: { + command: "databricks genie list-spaces --profile --output json", + }, + postgres_project: { + command: + "databricks postgres list-projects --profile --output json", + }, + postgres_branch: { + // {project} is a placeholder for the resolved value of the `project` + // sibling field (declared via `dependsOn: "project"` on the kind variant). + // The Databricks CLI requires the parent project resource name (format + // `projects/{project_id}`) as a positional argument. + command: + "databricks postgres list-branches {project} --profile --output json", + }, + postgres_database: { + // {branch} is a placeholder for the resolved value of the `branch` + // sibling field (declared via `dependsOn: "branch"` on the kind variant). + command: + "databricks postgres list-databases {branch} --profile --output json", + }, + volume: { + // {catalog} and {schema} parent context must be supplied by the CLI + // runner — they are encoded as a Phase 6 MUST rule (prompt the user for + // catalog and schema before listing volumes), not as `dependsOn` siblings. + command: + "databricks volumes list {catalog} {schema} --profile --output json", + }, +}; + +// ── Resource field entry (plugin manifest variant) ─────────────────────── + +export const resourceFieldEntrySchema = z + .object({ + env: z + .string() + .regex(/^[A-Z][A-Z0-9_]*$/) + .optional() + .describe("Environment variable name for this field"), + description: z + .string() + .optional() + .describe("Human-readable description for this field"), + bundleIgnore: z + .boolean() + .optional() + .describe( + "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation.", + ), + examples: z + .array(z.string()) + .optional() + .describe("Example values showing the expected format for this field"), + localOnly: z + .boolean() + .optional() + .describe( + "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time.", + ), + value: z + .string() + .optional() + .describe( + "Static value for this field. Used when no prompted or resolved value exists.", + ), + resolve: z + .string() + .regex(/^[a-z_]+:[a-zA-Z]+$/) + .optional() + .describe( + "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow.", + ), + discovery: discoveryDescriptorSchema.optional(), + }) + .strict() + .describe( + "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).", + ); + +// ── Resource requirement (per-type permission discriminator) ───────────── + +/** + * Build a per-type variant. Each variant fixes `type` to a literal and constrains + * `permission` to the matching enum, mirroring the existing JSON Schema's + * `allOf + if/then` block. `fields` and the rest of the shape come from a + * shared base. + */ +const resourceRequirementBaseShape = { + alias: z + .string() + .min(1) + .describe( + "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias.", + ), + resourceKey: z + .string() + .regex(/^[a-z][a-z0-9-]*$/) + .describe( + "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup.", + ), + description: z + .string() + .min(1) + .describe("Human-readable description of why this resource is needed"), + fields: z + .record(z.string(), resourceFieldEntrySchema) + .refine((obj) => Object.keys(obj).length >= 1, { + message: "fields must contain at least one entry", + }) + .optional() + .describe( + "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).", + ), +}; + +/** + * Adds the cycle/dangling-reference cross-field check to a resource variant. + * Iterates the resource's `fields`, validates each `discovery.dependsOn` target + * is a sibling field name, then runs DFS over the dependsOn graph to detect + * cycles. Issue paths target either the offending field's `dependsOn` slot or + * the resource itself for cycles. + */ +function refineResourceDependsOn( + resource: { fields?: Record }, + ctx: z.core.$RefinementCtx, +): void { + if (!resource.fields) return; + const fieldNames = new Set(Object.keys(resource.fields)); + + // Pass 1: validate dependsOn references and build the dependency graph. + const deps = new Map(); + for (const [name, field] of Object.entries(resource.fields)) { + const dep = field.discovery?.dependsOn; + if (!dep) continue; + if (!fieldNames.has(dep)) { + ctx.addIssue({ + code: "custom", + path: ["fields", name, "discovery", "dependsOn"], + message: `references non-existent sibling field '${dep}'`, + }); + } + deps.set(name, dep); + } + + // Pass 2: detect cycles via DFS. Emit one issue per cycle found. + const visited = new Set(); + const visiting = new Set(); + + function dfs(node: string, chain: string[]): string[] | null { + if (visiting.has(node)) return [...chain, node]; + if (visited.has(node)) return null; + visiting.add(node); + const next = deps.get(node); + if (next) { + const cycle = dfs(next, [...chain, node]); + if (cycle) return cycle; + } + visiting.delete(node); + visited.add(node); + return null; + } + + for (const node of deps.keys()) { + if (visited.has(node)) continue; + const cycle = dfs(node, []); + if (cycle) { + ctx.addIssue({ + code: "custom", + path: [], + message: `discovery.dependsOn creates a cycle: ${cycle.join(" → ")}`, + }); + // One cycle error per resource is enough. + break; + } + } +} + +function makeResourceVariant< + TType extends z.ZodLiteral, + TPerm extends z.ZodTypeAny, +>(typeLiteral: TType, permission: TPerm) { + return z + .object({ + type: typeLiteral, + ...resourceRequirementBaseShape, + permission: permission.describe( + "Required permission level. Validated per resource type.", + ), + }) + .strict() + .superRefine(refineResourceDependsOn); +} + +export const resourceRequirementSchema = z + .discriminatedUnion("type", [ + makeResourceVariant(z.literal("secret"), secretPermissionSchema), + makeResourceVariant(z.literal("job"), jobPermissionSchema), + makeResourceVariant( + z.literal("sql_warehouse"), + sqlWarehousePermissionSchema, + ), + makeResourceVariant( + z.literal("serving_endpoint"), + servingEndpointPermissionSchema, + ), + makeResourceVariant(z.literal("volume"), volumePermissionSchema), + makeResourceVariant( + z.literal("vector_search_index"), + vectorSearchIndexPermissionSchema, + ), + makeResourceVariant(z.literal("uc_function"), ucFunctionPermissionSchema), + makeResourceVariant( + z.literal("uc_connection"), + ucConnectionPermissionSchema, + ), + makeResourceVariant(z.literal("database"), databasePermissionSchema), + makeResourceVariant(z.literal("postgres"), postgresPermissionSchema), + makeResourceVariant(z.literal("genie_space"), genieSpacePermissionSchema), + makeResourceVariant(z.literal("experiment"), experimentPermissionSchema), + makeResourceVariant(z.literal("app"), appPermissionSchema), + ]) + .describe( + "Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements().", + ); + +// ── Config schema (recursive) ──────────────────────────────────────────── + +export const configSchemaPropertySchema: z.ZodType = z.lazy(() => + z + .object({ + type: z.enum([ + "object", + "array", + "string", + "number", + "boolean", + "integer", + ]), + description: z.string().optional(), + default: z.unknown().optional(), + enum: z.array(z.unknown()).optional(), + properties: z.record(z.string(), configSchemaPropertySchema).optional(), + items: configSchemaPropertySchema.optional(), + minimum: z.number().optional(), + maximum: z.number().optional(), + minLength: z.number().int().min(0).optional(), + maxLength: z.number().int().min(0).optional(), + required: z.array(z.string()).optional(), + // `additionalProperties` is a standard JSON Schema keyword used by core + // plugin manifests (e.g., serving, vector-search, genie) to constrain + // dictionary-shaped properties. Allowed on nested property entries as + // either a boolean or a sub-schema, mirroring JSON Schema semantics. + additionalProperties: z + .union([z.boolean(), configSchemaPropertySchema]) + .optional(), + }) + .strict(), +); + +export const configSchemaSchema: z.ZodType = z.lazy(() => + z + .object({ + type: z.enum(["object", "array", "string", "number", "boolean"]), + properties: z.record(z.string(), configSchemaPropertySchema).optional(), + items: configSchemaSchema.optional(), + required: z.array(z.string()).optional(), + additionalProperties: z.boolean().optional(), + }) + .strict(), +); + +// ── Post-scaffold step ─────────────────────────────────────────────────── + +export const postScaffoldStepSchema = z + .object({ + instruction: z + .string() + .min(1) + .describe( + "Human-readable instruction for the user to follow after scaffolding.", + ), + required: z + .boolean() + .optional() + .describe( + "Whether this step is required for the plugin to function correctly.", + ), + }) + .strict() + .describe( + "A post-scaffolding instruction shown to the user after project initialization.", + ); + +// ── Plugin manifest (root) ─────────────────────────────────────────────── + +export const pluginManifestSchema = z + .object({ + $schema: z + .string() + .optional() + .describe("Reference to the JSON Schema for validation"), + name: z + .string() + .regex(/^[a-z][a-z0-9-]*$/) + .describe( + "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", + ), + displayName: z + .string() + .min(1) + .describe("Human-readable display name for UI and CLI"), + description: z + .string() + .min(1) + .describe("Brief description of what the plugin does"), + resources: z + .object({ + required: z + .array(resourceRequirementSchema) + .describe( + "Resources that must be available for the plugin to function", + ), + optional: z + .array(resourceRequirementSchema) + .describe( + "Resources that enhance functionality but are not mandatory", + ), + }) + .strict() + .describe("Databricks resource requirements for this plugin"), + config: z + .object({ + schema: configSchemaSchema.optional(), + }) + .strict() + .optional() + .describe("Configuration schema for the plugin"), + author: z.string().optional().describe("Author name or organization"), + version: z + .string() + .regex(/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?$/) + .optional() + .describe("Plugin version (semver format)"), + repository: z + .url() + .optional() + .describe("URL to the plugin's source repository"), + keywords: z + .array(z.string()) + .optional() + .describe("Keywords for plugin discovery"), + license: z.string().optional().describe("SPDX license identifier"), + onSetupMessage: z + .string() + .optional() + .describe( + "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning).", + ), + hidden: z + .boolean() + .optional() + .describe( + "When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync.", + ), + stability: z + .enum(["beta", "ga"]) + .optional() + .describe( + "Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly.", + ), + postScaffold: z + .array(postScaffoldStepSchema) + .optional() + .describe( + "Ordered list of post-scaffolding instructions shown to the user after project initialization. Array position determines display order.", + ), + }) + .strict() + .describe( + "Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options.", + ); + +// ── Origin enum ────────────────────────────────────────────────────────── + +export const originSchema = z + .enum(["user", "platform", "static", "cli"]) + .describe( + "How the field value is determined. Computed during sync, not authored by plugin developers.", + ); + +// ── Template field entry (origin computed by transform) ───────────────── + +/** + * Derives the canonical origin of a resource field value from its shape. + * + * - `localOnly: true` → `"platform"` (auto-injected by the Databricks Apps + * platform at deploy time; takes precedence over `value`/`resolve`). + * - `value !== undefined` → `"static"` (hardcoded value). + * - `resolve !== undefined` → `"cli"` (resolved by the CLI during init). + * - else → `"user"` (user must provide the value at init time). + * + * Co-located with `templateFieldEntrySchema` because the transform is the + * only consumer. Kept private so any other "origin computation" goes + * through the schema rather than re-implementing the rules. + */ +function computeOriginFromField(field: { + localOnly?: boolean; + value?: string; + resolve?: string; +}): z.infer { + if (field.localOnly) return "platform"; + if (field.value !== undefined) return "static"; + if (field.resolve !== undefined) return "cli"; + return "user"; +} + +/** + * Template field entry: extends the plugin manifest field entry with an + * optional `origin` input slot, then runs a `.transform()` that overwrites + * `origin` with the computed value. Allowing `origin` on input means + * re-parsing a previously-synced template manifest does not fail; emitting + * `origin` always means hand-edits in synced JSON are silently corrected + * on the next parse — drift-by-construction. + */ +export const templateFieldEntrySchema = resourceFieldEntrySchema + .extend({ origin: originSchema.optional() }) + .transform((field) => ({ + ...field, + origin: computeOriginFromField(field), + })); + +// ── Template resource requirement (uses templateFieldEntrySchema) ──────── + +const templateResourceRequirementBaseShape = { + alias: z + .string() + .min(1) + .describe("Human-readable label for UI/display only."), + resourceKey: z + .string() + .regex(/^[a-z][a-z0-9-]*$/) + .describe( + "Stable key for machine use: deduplication, env naming, composite keys.", + ), + description: z + .string() + .min(1) + .describe("Human-readable description of why this resource is needed"), + fields: z + .record(z.string(), templateFieldEntrySchema) + .refine((obj) => Object.keys(obj).length >= 1, { + message: "fields must contain at least one entry", + }) + .optional() + .describe("Map of field name to field entry with computed origin."), +}; + +function makeTemplateResourceVariant< + TType extends z.ZodLiteral, + TPerm extends z.ZodTypeAny, +>(typeLiteral: TType, permission: TPerm) { + return z + .object({ + type: typeLiteral, + ...templateResourceRequirementBaseShape, + permission: permission.describe( + "Required permission level. Validated per resource type.", + ), + }) + .strict() + .superRefine(refineResourceDependsOn); +} + +export const templateResourceRequirementSchema = z + .discriminatedUnion("type", [ + makeTemplateResourceVariant(z.literal("secret"), secretPermissionSchema), + makeTemplateResourceVariant(z.literal("job"), jobPermissionSchema), + makeTemplateResourceVariant( + z.literal("sql_warehouse"), + sqlWarehousePermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("serving_endpoint"), + servingEndpointPermissionSchema, + ), + makeTemplateResourceVariant(z.literal("volume"), volumePermissionSchema), + makeTemplateResourceVariant( + z.literal("vector_search_index"), + vectorSearchIndexPermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("uc_function"), + ucFunctionPermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("uc_connection"), + ucConnectionPermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("database"), + databasePermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("postgres"), + postgresPermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("genie_space"), + genieSpacePermissionSchema, + ), + makeTemplateResourceVariant( + z.literal("experiment"), + experimentPermissionSchema, + ), + makeTemplateResourceVariant(z.literal("app"), appPermissionSchema), + ]) + .describe( + "Resource requirement with template-specific field entries (includes computed origin).", + ); + +// ── Template plugin (extends plugin manifest) ──────────────────────────── + +export const templatePluginSchema = z + .object({ + name: z + .string() + .regex(/^[a-z][a-z0-9-]*$/) + .describe( + "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", + ), + displayName: z + .string() + .min(1) + .describe("Human-readable display name for UI and CLI"), + description: z + .string() + .min(1) + .describe("Brief description of what the plugin does"), + package: z + .string() + .min(1) + .describe("NPM package name that provides this plugin"), + requiredByTemplate: z + .boolean() + .optional() + .describe( + "When true, this plugin is required by the template and cannot be deselected during CLI init. The user will only be prompted to configure its resources. When absent or false, the plugin is optional and the user can choose whether to include it.", + ), + onSetupMessage: z + .string() + .optional() + .describe( + "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning).", + ), + stability: z + .enum(["beta", "ga"]) + .optional() + .describe( + "Plugin stability level. Beta is heading to GA; APIs may change between minor releases. GA (general availability) follows semver.", + ), + postScaffold: z + .array(postScaffoldStepSchema) + .optional() + .describe( + "Ordered list of post-scaffolding instructions propagated from the plugin manifest.", + ), + resources: z + .object({ + required: z + .array(templateResourceRequirementSchema) + .describe( + "Resources that must be available for the plugin to function", + ), + optional: z + .array(templateResourceRequirementSchema) + .describe( + "Resources that enhance functionality but are not mandatory", + ), + }) + .strict() + .describe("Databricks resource requirements for this plugin"), + }) + .strict() + .describe("Plugin manifest with package source information"); + +// ── Scaffolding descriptor ─────────────────────────────────────────────── + +export const scaffoldingFlagSchema = z + .object({ + description: z.string().describe("Human-readable description of the flag."), + required: z.boolean().optional().describe("Whether this flag is required."), + pattern: z + .string() + .optional() + .describe("Regex pattern for validating the flag value."), + default: z.string().optional().describe("Default value for this flag."), + }) + .strict() + .describe("A flag for the scaffolding command."); + +/** + * Per-item upper bound on scaffolding rule strings. The intent is to enforce + * "short directive" by contract — long paragraphs fail validation and force + * authors to split prose into discrete actionable items. + */ +const SCAFFOLDING_RULE_MAX_LENGTH = 120; + +const scaffoldingRuleItemSchema = z + .string() + .max( + SCAFFOLDING_RULE_MAX_LENGTH, + `rule item must be ≤ ${SCAFFOLDING_RULE_MAX_LENGTH} chars`, + ); + +export const scaffoldingRulesSchema = z + .object({ + never: z + .array(scaffoldingRuleItemSchema) + .optional() + .describe("Actions the scaffolding agent must never perform."), + must: z + .array(scaffoldingRuleItemSchema) + .optional() + .describe("Actions the scaffolding agent must always perform."), + }) + .strict() + .describe("Structured rules for scaffolding agents."); + +export const scaffoldingDescriptorSchema = z + .object({ + command: z + .string() + .describe("The scaffolding command (e.g., 'databricks apps init')."), + flags: z + .record(z.string(), scaffoldingFlagSchema) + .optional() + .describe("Map of flag name to flag descriptor."), + rules: scaffoldingRulesSchema + .optional() + .describe("Structured rules for scaffolding agents."), + }) + .strict() + .describe( + "Describes the scaffolding command, flags, and rules for project initialization.", + ); + +/** + * Canonical scaffolding descriptor for the `databricks apps init` command, + * embedded in v2.0 template manifests to guide scaffolding agents. + * + * Co-located with `scaffoldingDescriptorSchema` so any change to the rule set + * (or the schema's `maxLength` ceiling) shows up next to its consumer. The + * `satisfies` annotation gives compile-time validation that the literal + * matches the schema's input shape; if a `must`/`never` entry exceeds the + * `maxLength` ceiling at runtime, `scaffoldingDescriptorSchema.parse` would + * surface the breach in tests. + */ +export const TEMPLATE_SCAFFOLDING = { + command: "databricks apps init", + flags: { + "--template-dir": { + description: "Path to the template directory containing the app scaffold", + required: true, + }, + "--config-dir": { + description: "Path to the output directory for the initialized app", + required: true, + }, + "--profile": { + description: "Databricks CLI profile to use for authentication", + required: false, + }, + }, + rules: { + never: [ + "Modify files inside the template directory", + "Skip resource configuration prompts", + "Hardcode workspace-specific values in template files", + ], + must: [ + "Use the template manifest (appkit.plugins.json) as the source of truth for available plugins", + "Respect requiredByTemplate flags when presenting plugin selection", + "Generate .env files with all required environment variables from selected plugins", + "When discovering volume resources, prompt the user for catalog and schema before listing volumes.", + ], + }, +} satisfies z.infer; + +// ── Template plugins manifest (root) ───────────────────────────────────── + +export const templatePluginsManifestSchema = z + .object({ + $schema: z + .string() + .optional() + .describe("Reference to the JSON Schema for validation"), + version: z + .enum(["1.0", "1.1", "2.0"]) + .describe("Schema version for the template plugins manifest"), + plugins: z + .record(z.string(), templatePluginSchema) + .describe("Map of plugin name to plugin manifest with package source"), + scaffolding: scaffoldingDescriptorSchema + .optional() + .describe( + "Describes the scaffolding command and its configuration for project initialization.", + ), + }) + .strict() + .superRefine((value, ctx) => { + if (value.version === "2.0" && !value.scaffolding) { + ctx.addIssue({ + code: "custom", + path: ["scaffolding"], + message: "scaffolding is required when version is '2.0'", + }); + } + }) + .describe( + "Aggregated plugin manifest for AppKit templates. Read by Databricks CLI during init to discover available plugins and their resource requirements.", + ); + +// ── Inferred types ─────────────────────────────────────────────────────── + +export type ResourceType = z.infer; +export type SecretPermission = z.infer; +export type JobPermission = z.infer; +export type SqlWarehousePermission = z.infer< + typeof sqlWarehousePermissionSchema +>; +export type ServingEndpointPermission = z.infer< + typeof servingEndpointPermissionSchema +>; +export type VolumePermission = z.infer; +export type VectorSearchIndexPermission = z.infer< + typeof vectorSearchIndexPermissionSchema +>; +export type UcFunctionPermission = z.infer; +export type UcConnectionPermission = z.infer< + typeof ucConnectionPermissionSchema +>; +export type DatabasePermission = z.infer; +export type PostgresPermission = z.infer; +export type GenieSpacePermission = z.infer; +export type ExperimentPermission = z.infer; +export type AppPermission = z.infer; +export type ResourceKind = z.infer; +export type KindDiscoveryDescriptor = z.infer< + typeof kindDiscoveryDescriptorSchema +>; +export type CliDiscoveryDescriptor = z.infer< + typeof cliDiscoveryDescriptorSchema +>; +export type DiscoveryDescriptor = z.infer; +export type ResourceFieldEntry = z.infer; +export type ResourceRequirement = z.infer; +export type ConfigSchemaProperty = z.infer; +export type ConfigSchema = z.infer; +export type PostScaffoldStep = z.infer; +export type PluginManifest = z.infer; +export type Origin = z.infer; +// Template-side types use `z.input` so callers can construct a TemplatePlugin +// from a parsed PluginManifest before the field-level origin transform runs. +// `writeManifest` parses every field through `templateFieldEntrySchema` at +// write-time, so the on-disk shape always has origin populated. The runtime +// invariant: origin is *always* present after sync writes; the type slot +// stays optional so the in-memory pipeline does not need to fabricate origin +// before assignment. +export type TemplateFieldEntry = z.input; +export type TemplateResourceRequirement = z.input< + typeof templateResourceRequirementSchema +>; +export type TemplatePlugin = z.input; +export type ScaffoldingFlag = z.infer; +export type ScaffoldingRules = z.infer; +export type ScaffoldingDescriptor = z.infer; +export type TemplatePluginsManifest = z.input< + typeof templatePluginsManifestSchema +>; diff --git a/packages/shared/src/schemas/plugin-manifest.generated.ts b/packages/shared/src/schemas/plugin-manifest.generated.ts deleted file mode 100644 index dd30f27d3..000000000 --- a/packages/shared/src/schemas/plugin-manifest.generated.ts +++ /dev/null @@ -1,289 +0,0 @@ -// AUTO-GENERATED from plugin-manifest.schema.json — do not edit. -// Run: pnpm exec tsx tools/generate-schema-types.ts -/** - * Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "resourceRequirement". - */ -export type ResourceRequirement = { - type: ResourceType; - /** - * Human-readable label for UI/display only. Deduplication uses resourceKey, not alias. - */ - alias: string; - /** - * Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup. - */ - resourceKey: string; - /** - * Human-readable description of why this resource is needed - */ - description: string; - /** - * Required permission level. Validated per resource type by the allOf/if-then rules below. - */ - permission: string; - /** - * 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). - */ - fields?: { - [k: string]: ResourceFieldEntry; - }; -}; -/** - * Type of Databricks resource - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "resourceType". - */ -export type ResourceType = - | "secret" - | "job" - | "sql_warehouse" - | "serving_endpoint" - | "volume" - | "vector_search_index" - | "uc_function" - | "uc_connection" - | "database" - | "postgres" - | "genie_space" - | "experiment" - | "app"; -/** - * Permission for secret resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "secretPermission". - */ -export type SecretPermission = "READ" | "WRITE" | "MANAGE"; -/** - * Permission for job resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "jobPermission". - */ -export type JobPermission = "CAN_VIEW" | "CAN_MANAGE_RUN" | "CAN_MANAGE"; -/** - * Permission for SQL warehouse resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "sqlWarehousePermission". - */ -export type SqlWarehousePermission = "CAN_USE" | "CAN_MANAGE"; -/** - * Permission for serving endpoint resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "servingEndpointPermission". - */ -export type ServingEndpointPermission = "CAN_VIEW" | "CAN_QUERY" | "CAN_MANAGE"; -/** - * Permission for Unity Catalog volume resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "volumePermission". - */ -export type VolumePermission = "READ_VOLUME" | "WRITE_VOLUME"; -/** - * Permission for vector search index resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "vectorSearchIndexPermission". - */ -export type VectorSearchIndexPermission = "SELECT"; -/** - * Permission for Unity Catalog function resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "ucFunctionPermission". - */ -export type UcFunctionPermission = "EXECUTE"; -/** - * Permission for Unity Catalog connection resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "ucConnectionPermission". - */ -export type UcConnectionPermission = "USE_CONNECTION"; -/** - * Permission for database resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "databasePermission". - */ -export type DatabasePermission = "CAN_CONNECT_AND_CREATE"; -/** - * Permission for Postgres resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "postgresPermission". - */ -export type PostgresPermission = "CAN_CONNECT_AND_CREATE"; -/** - * Permission for Genie Space resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "genieSpacePermission". - */ -export type GenieSpacePermission = - | "CAN_VIEW" - | "CAN_RUN" - | "CAN_EDIT" - | "CAN_MANAGE"; -/** - * Permission for MLflow experiment resources (order: weakest to strongest) - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "experimentPermission". - */ -export type ExperimentPermission = "CAN_READ" | "CAN_EDIT" | "CAN_MANAGE"; -/** - * Permission for Databricks App resources - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "appPermission". - */ -export type AppPermission = "CAN_USE"; - -/** - * Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options. - */ -export interface PluginManifest { - /** - * Reference to the JSON Schema for validation - */ - $schema?: string; - /** - * Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens. - */ - name: string; - /** - * Human-readable display name for UI and CLI - */ - displayName: string; - /** - * Brief description of what the plugin does - */ - description: string; - /** - * Databricks resource requirements for this plugin - */ - resources: { - /** - * Resources that must be available for the plugin to function - */ - required: ResourceRequirement[]; - /** - * Resources that enhance functionality but are not mandatory - */ - optional: ResourceRequirement[]; - }; - /** - * Configuration schema for the plugin - */ - config?: { - schema?: ConfigSchema; - }; - /** - * Author name or organization - */ - author?: string; - /** - * Plugin version (semver format) - */ - version?: string; - /** - * URL to the plugin's source repository - */ - repository?: string; - /** - * Keywords for plugin discovery - */ - keywords?: string[]; - /** - * SPDX license identifier - */ - license?: string; - /** - * Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning). - */ - onSetupMessage?: string; - /** - * When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync. - */ - hidden?: boolean; - /** - * Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly. - */ - stability?: "beta" | "ga"; -} -/** - * Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key). - * - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "resourceFieldEntry". - */ -export interface ResourceFieldEntry { - /** - * Environment variable name for this field - */ - env?: string; - /** - * Human-readable description for this field - */ - description?: string; - /** - * When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation. - */ - bundleIgnore?: boolean; - /** - * Example values showing the expected format for this field - */ - examples?: string[]; - /** - * When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time. - */ - localOnly?: boolean; - /** - * Static value for this field. Used when no prompted or resolved value exists. - */ - value?: string; - /** - * Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow. - */ - resolve?: string; -} -/** - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "configSchema". - */ -export interface ConfigSchema { - type: "object" | "array" | "string" | "number" | "boolean"; - properties?: { - [k: string]: ConfigSchemaProperty; - }; - items?: ConfigSchema; - required?: string[]; - additionalProperties?: boolean; -} -/** - * This interface was referenced by `PluginManifest`'s JSON-Schema - * via the `definition` "configSchemaProperty". - */ -export interface ConfigSchemaProperty { - type: "object" | "array" | "string" | "number" | "boolean" | "integer"; - description?: string; - default?: unknown; - enum?: unknown[]; - properties?: { - [k: string]: ConfigSchemaProperty; - }; - items?: ConfigSchemaProperty; - minimum?: number; - maximum?: number; - minLength?: number; - maxLength?: number; - required?: string[]; -} diff --git a/packages/shared/src/schemas/plugin-manifest.schema.json b/packages/shared/src/schemas/plugin-manifest.schema.json deleted file mode 100644 index 021c7f0bf..000000000 --- a/packages/shared/src/schemas/plugin-manifest.schema.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://databricks.github.io/appkit/schemas/plugin-manifest.schema.json", - "title": "AppKit Plugin Manifest", - "description": "Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options.", - "type": "object", - "required": ["name", "displayName", "description", "resources"], - "properties": { - "$schema": { - "type": "string", - "description": "Reference to the JSON Schema for validation" - }, - "name": { - "type": "string", - "pattern": "^[a-z][a-z0-9-]*$", - "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", - "examples": ["analytics", "server", "my-custom-plugin"] - }, - "displayName": { - "type": "string", - "minLength": 1, - "description": "Human-readable display name for UI and CLI", - "examples": ["Analytics Plugin", "Server Plugin"] - }, - "description": { - "type": "string", - "minLength": 1, - "description": "Brief description of what the plugin does", - "examples": ["SQL query execution against Databricks SQL Warehouses"] - }, - "resources": { - "type": "object", - "required": ["required", "optional"], - "description": "Databricks resource requirements for this plugin", - "properties": { - "required": { - "type": "array", - "description": "Resources that must be available for the plugin to function", - "items": { - "$ref": "#/$defs/resourceRequirement" - } - }, - "optional": { - "type": "array", - "description": "Resources that enhance functionality but are not mandatory", - "items": { - "$ref": "#/$defs/resourceRequirement" - } - } - }, - "additionalProperties": false - }, - "config": { - "type": "object", - "description": "Configuration schema for the plugin", - "properties": { - "schema": { - "$ref": "#/$defs/configSchema" - } - }, - "additionalProperties": false - }, - "author": { - "type": "string", - "description": "Author name or organization" - }, - "version": { - "type": "string", - "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$", - "description": "Plugin version (semver format)", - "examples": ["1.0.0", "2.1.0-beta.1"] - }, - "repository": { - "type": "string", - "format": "uri", - "description": "URL to the plugin's source repository" - }, - "keywords": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Keywords for plugin discovery" - }, - "license": { - "type": "string", - "description": "SPDX license identifier", - "examples": ["Apache-2.0", "MIT"] - }, - "onSetupMessage": { - "type": "string", - "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning)." - }, - "hidden": { - "type": "boolean", - "default": false, - "description": "When true, this plugin is excluded from the template plugins manifest (appkit.plugins.json) during sync." - }, - "stability": { - "type": "string", - "enum": ["beta", "ga"], - "default": "ga", - "description": "Plugin stability level. Beta plugins may have breaking API changes between minor releases but are on a path to GA. GA (general availability) plugins follow semver strictly." - } - }, - "additionalProperties": false, - "$defs": { - "resourceType": { - "type": "string", - "enum": [ - "secret", - "job", - "sql_warehouse", - "serving_endpoint", - "volume", - "vector_search_index", - "uc_function", - "uc_connection", - "database", - "postgres", - "genie_space", - "experiment", - "app" - ], - "description": "Type of Databricks resource" - }, - "secretPermission": { - "type": "string", - "enum": ["READ", "WRITE", "MANAGE"], - "description": "Permission for secret resources (order: weakest to strongest)" - }, - "jobPermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"], - "description": "Permission for job resources (order: weakest to strongest)" - }, - "sqlWarehousePermission": { - "type": "string", - "enum": ["CAN_USE", "CAN_MANAGE"], - "description": "Permission for SQL warehouse resources (order: weakest to strongest)" - }, - "servingEndpointPermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"], - "description": "Permission for serving endpoint resources (order: weakest to strongest)" - }, - "volumePermission": { - "type": "string", - "enum": ["READ_VOLUME", "WRITE_VOLUME"], - "description": "Permission for Unity Catalog volume resources" - }, - "vectorSearchIndexPermission": { - "type": "string", - "enum": ["SELECT"], - "description": "Permission for vector search index resources" - }, - "ucFunctionPermission": { - "type": "string", - "enum": ["EXECUTE"], - "description": "Permission for Unity Catalog function resources" - }, - "ucConnectionPermission": { - "type": "string", - "enum": ["USE_CONNECTION"], - "description": "Permission for Unity Catalog connection resources" - }, - "databasePermission": { - "type": "string", - "enum": ["CAN_CONNECT_AND_CREATE"], - "description": "Permission for database resources" - }, - "postgresPermission": { - "type": "string", - "enum": ["CAN_CONNECT_AND_CREATE"], - "description": "Permission for Postgres resources" - }, - "genieSpacePermission": { - "type": "string", - "enum": ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"], - "description": "Permission for Genie Space resources (order: weakest to strongest)" - }, - "experimentPermission": { - "type": "string", - "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"], - "description": "Permission for MLflow experiment resources (order: weakest to strongest)" - }, - "appPermission": { - "type": "string", - "enum": ["CAN_USE"], - "description": "Permission for Databricks App resources" - }, - "resourceFieldEntry": { - "type": "object", - "description": "Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).", - "properties": { - "env": { - "type": "string", - "pattern": "^[A-Z][A-Z0-9_]*$", - "description": "Environment variable name for this field", - "examples": ["DATABRICKS_CACHE_INSTANCE", "SECRET_SCOPE"] - }, - "description": { - "type": "string", - "description": "Human-readable description for this field" - }, - "bundleIgnore": { - "type": "boolean", - "default": false, - "description": "When true, this field is excluded from Databricks bundle configuration (databricks.yml) generation." - }, - "examples": { - "type": "array", - "items": { "type": "string" }, - "description": "Example values showing the expected format for this field" - }, - "localOnly": { - "type": "boolean", - "default": false, - "description": "When true, this field is only generated for local .env files. The Databricks Apps platform auto-injects it at deploy time." - }, - "value": { - "type": "string", - "description": "Static value for this field. Used when no prompted or resolved value exists." - }, - "resolve": { - "type": "string", - "pattern": "^[a-z_]+:[a-zA-Z]+$", - "description": "Named resolver prefixed by resource type (e.g., 'postgres:host'). The CLI resolves this value during the init prompt flow." - } - }, - "additionalProperties": false - }, - "resourceRequirement": { - "type": "object", - "description": "Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements().", - "required": ["type", "alias", "resourceKey", "description", "permission"], - "properties": { - "type": { - "$ref": "#/$defs/resourceType" - }, - "alias": { - "type": "string", - "minLength": 1, - "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias.", - "examples": ["SQL Warehouse", "Secret", "Vector search index"] - }, - "resourceKey": { - "type": "string", - "pattern": "^[a-z][a-z0-9-]*$", - "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup.", - "examples": ["sql-warehouse", "database", "secret"] - }, - "description": { - "type": "string", - "minLength": 1, - "description": "Human-readable description of why this resource is needed" - }, - "permission": { - "type": "string", - "description": "Required permission level. Validated per resource type by the allOf/if-then rules below." - }, - "fields": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/resourceFieldEntry" - }, - "minProperties": 1, - "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)." - } - }, - "additionalProperties": false, - "allOf": [ - { - "if": { - "properties": { "type": { "const": "secret" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/secretPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "job" } }, - "required": ["type"] - }, - "then": { - "properties": { "permission": { "$ref": "#/$defs/jobPermission" } } - } - }, - { - "if": { - "properties": { "type": { "const": "sql_warehouse" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/sqlWarehousePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "serving_endpoint" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/servingEndpointPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "volume" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/volumePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "vector_search_index" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/vectorSearchIndexPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "uc_function" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/ucFunctionPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "uc_connection" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/ucConnectionPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "database" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/databasePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "postgres" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/postgresPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "genie_space" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/genieSpacePermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "experiment" } }, - "required": ["type"] - }, - "then": { - "properties": { - "permission": { "$ref": "#/$defs/experimentPermission" } - } - } - }, - { - "if": { - "properties": { "type": { "const": "app" } }, - "required": ["type"] - }, - "then": { - "properties": { "permission": { "$ref": "#/$defs/appPermission" } } - } - } - ] - }, - "configSchemaProperty": { - "type": "object", - "required": ["type"], - "properties": { - "type": { - "type": "string", - "enum": ["object", "array", "string", "number", "boolean", "integer"] - }, - "description": { - "type": "string" - }, - "default": {}, - "enum": { - "type": "array" - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/configSchemaProperty" - } - }, - "items": { - "$ref": "#/$defs/configSchemaProperty" - }, - "minimum": { - "type": "number" - }, - "maximum": { - "type": "number" - }, - "minLength": { - "type": "integer", - "minimum": 0 - }, - "maxLength": { - "type": "integer", - "minimum": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "configSchema": { - "type": "object", - "required": ["type"], - "properties": { - "type": { - "type": "string", - "enum": ["object", "array", "string", "number", "boolean"] - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/configSchemaProperty" - } - }, - "items": { - "$ref": "#/$defs/configSchema" - }, - "required": { - "type": "array", - "items": { - "type": "string" - } - }, - "additionalProperties": { - "type": "boolean" - } - } - } - } -} diff --git a/packages/shared/src/schemas/template-plugins.schema.json b/packages/shared/src/schemas/template-plugins.schema.json deleted file mode 100644 index 47d385936..000000000 --- a/packages/shared/src/schemas/template-plugins.schema.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", - "title": "AppKit Template Plugins Manifest", - "description": "Aggregated plugin manifest for AppKit templates. Read by Databricks CLI during init to discover available plugins and their resource requirements.", - "type": "object", - "required": ["version", "plugins"], - "properties": { - "$schema": { - "type": "string", - "description": "Reference to the JSON Schema for validation" - }, - "version": { - "type": "string", - "enum": ["1.0", "1.1"], - "description": "Schema version for the template plugins manifest" - }, - "plugins": { - "type": "object", - "description": "Map of plugin name to plugin manifest with package source", - "additionalProperties": { - "$ref": "#/$defs/templatePlugin" - } - } - }, - "additionalProperties": false, - "$defs": { - "templatePlugin": { - "type": "object", - "required": [ - "name", - "displayName", - "description", - "package", - "resources" - ], - "description": "Plugin manifest with package source information", - "properties": { - "name": { - "type": "string", - "pattern": "^[a-z][a-z0-9-]*$", - "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.", - "examples": ["analytics", "server", "my-custom-plugin"] - }, - "displayName": { - "type": "string", - "minLength": 1, - "description": "Human-readable display name for UI and CLI", - "examples": ["Analytics Plugin", "Server Plugin"] - }, - "description": { - "type": "string", - "minLength": 1, - "description": "Brief description of what the plugin does", - "examples": ["SQL query execution against Databricks SQL Warehouses"] - }, - "package": { - "type": "string", - "minLength": 1, - "description": "NPM package name that provides this plugin", - "examples": ["@databricks/appkit", "@my-org/custom-plugin"] - }, - "requiredByTemplate": { - "type": "boolean", - "default": false, - "description": "When true, this plugin is required by the template and cannot be deselected during CLI init. The user will only be prompted to configure its resources. When absent or false, the plugin is optional and the user can choose whether to include it." - }, - "onSetupMessage": { - "type": "string", - "description": "Message displayed to the user after project initialization. Use this to inform about manual setup steps (e.g. environment variables, resource provisioning)." - }, - "stability": { - "type": "string", - "enum": ["beta", "ga"], - "default": "ga", - "description": "Plugin stability level. Beta is heading to GA; APIs may change between minor releases. GA (general availability) follows semver." - }, - "resources": { - "type": "object", - "required": ["required", "optional"], - "description": "Databricks resource requirements for this plugin", - "properties": { - "required": { - "type": "array", - "description": "Resources that must be available for the plugin to function", - "items": { - "$ref": "#/$defs/resourceRequirement" - } - }, - "optional": { - "type": "array", - "description": "Resources that enhance functionality but are not mandatory", - "items": { - "$ref": "#/$defs/resourceRequirement" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "resourceType": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceType" - }, - "resourceFieldEntry": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceFieldEntry" - }, - "resourceRequirement": { - "$ref": "plugin-manifest.schema.json#/$defs/resourceRequirement" - } - } -} diff --git a/packages/shared/tsdown.config.ts b/packages/shared/tsdown.config.ts index d118f7ab9..9db6274a7 100644 --- a/packages/shared/tsdown.config.ts +++ b/packages/shared/tsdown.config.ts @@ -21,14 +21,4 @@ export default defineConfig({ exports: { devExports: "development", }, - copy: [ - { - from: "src/schemas/plugin-manifest.schema.json", - to: "dist/schemas", - }, - { - from: "src/schemas/template-plugins.schema.json", - to: "dist/schemas", - }, - ], }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba4b8ef8e..a1827e369 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,9 +47,6 @@ importers: jsdom: specifier: 27.0.0 version: 27.0.0(bufferutil@4.0.9)(postcss@8.5.6) - json-schema-to-typescript: - specifier: 15.0.4 - version: 15.0.4 knip: specifier: 5.86.0 version: 5.86.0(@types/node@24.7.2)(typescript@5.9.3) @@ -80,6 +77,9 @@ importers: vitest: specifier: 3.2.4 version: 3.2.4(@types/debug@4.1.12)(@types/node@24.7.2)(jiti@2.6.1)(jsdom@27.0.0(bufferutil@4.0.9)(postcss@8.5.6))(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.2) + zod: + specifier: 4.3.6 + version: 4.3.6 apps/clean-app: dependencies: @@ -539,15 +539,15 @@ importers: '@clack/prompts': specifier: 1.0.1 version: 1.0.1 - ajv: - specifier: 8.17.1 - version: 8.17.1 - ajv-formats: - specifier: 3.0.1 - version: 3.0.1(ajv@8.17.1) + '@standard-schema/spec': + specifier: 1.1.0 + version: 1.1.0 commander: specifier: 12.1.0 version: 12.1.0 + zod: + specifier: 4.3.6 + version: 4.3.6 devDependencies: '@types/express': specifier: 4.17.23 @@ -670,10 +670,6 @@ packages: '@antfu/install-pkg@1.1.0': resolution: {integrity: sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==} - '@apidevtools/json-schema-ref-parser@11.9.3': - resolution: {integrity: sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ==} - engines: {node: '>= 16'} - '@appthreat/atom-common@1.1.0': resolution: {integrity: sha512-vGZpJdy9e0l83o8XwDAsQUDpkMVzR4DLb7mbi5npu8Nz/R+2m5oyHlpBGuLYBKm5+KkjTInXP9eNTcMa0Mn3Uw==} @@ -721,24 +717,28 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] '@ast-grep/napi-linux-arm64-musl@0.37.0': resolution: {integrity: sha512-LF9sAvYy6es/OdyJDO3RwkX3I82Vkfsng1sqUBcoWC1jVb1wX5YVzHtpQox9JrEhGl+bNp7FYxB4Qba9OdA5GA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] '@ast-grep/napi-linux-x64-gnu@0.37.0': resolution: {integrity: sha512-TViz5/klqre6aSmJzswEIjApnGjJzstG/SE8VDWsrftMBMYt2PTu3MeluZVwzSqDao8doT/P+6U11dU05UOgxw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] '@ast-grep/napi-linux-x64-musl@0.37.0': resolution: {integrity: sha512-/BcCH33S9E3ovOAEoxYngUNXgb+JLg991sdyiNP2bSoYd30a9RHrG7CYwW6fMgua3ijQ474eV6cq9yZO1bCpXg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] '@ast-grep/napi-win32-arm64-msvc@0.37.0': resolution: {integrity: sha512-TjQA4cFoIEW2bgjLkaL9yqT4XWuuLa5MCNd0VCDhGRDMNQ9+rhwi9eLOWRaap3xzT7g+nlbcEHL3AkVCD2+b3A==} @@ -1425,24 +1425,28 @@ packages: engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + libc: [musl] '@biomejs/cli-linux-arm64@2.2.6': resolution: {integrity: sha512-BpGtuMJGN+o8pQjvYsUKZ+4JEErxdSmcRD/JG3mXoWc6zrcA7OkuyGFN1mDggO0Q1n7qXxo/PcupHk8gzijt5g==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + libc: [glibc] '@biomejs/cli-linux-x64-musl@2.2.6': resolution: {integrity: sha512-1ZcBux8zVM3JhWN2ZCPaYf0+ogxXG316uaoXJdgoPZcdK/rmRcRY7PqHdAos2ExzvjIdvhQp72UcveI98hgOog==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + libc: [musl] '@biomejs/cli-linux-x64@2.2.6': resolution: {integrity: sha512-1HaM/dpI/1Z68zp8ZdT6EiBq+/O/z97a2AiHMl+VAdv5/ELckFt9EvRb8hDHpk8hUMoz03gXkC7VPXOVtU7faA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + libc: [glibc] '@biomejs/cli-win32-arm64@2.2.6': resolution: {integrity: sha512-h3A88G8PGM1ryTeZyLlSdfC/gz3e95EJw9BZmA6Po412DRqwqPBa2Y9U+4ZSGUAXCsnSQE00jLV8Pyrh0d+jQw==} @@ -1476,16 +1480,19 @@ packages: resolution: {integrity: sha512-q5O2RoJ/VqnMSawAGqLeYgvX/tMd8Uyd35fBX9DqkL8eABcUSydL6c2I3u/ImrucxohtSG0KS8eVIoX5HKQW2Q==} cpu: [x64] os: [linux] + libc: glibc '@cdxgen/cdxgen-plugins-bin-linux-arm64@2.0.2': resolution: {integrity: sha512-tGu5A68jBtrSsu469pYFKH54ckXzdcesa+adSMQJLo7oxI76cGyhnXgWYaaLoLtKTvBZxsxqquRxTQrVve9AHg==} cpu: [arm64] os: [linux] + libc: glibc '@cdxgen/cdxgen-plugins-bin-linux-arm@2.0.2': resolution: {integrity: sha512-G0j0QDwKJDXHJKNBsOZQMkXQLfC0yPxsU9ZFyCc5aPo0NUGZFnTCg2NqMvmKuRbC8PtESswYETPWbQomBubY2A==} cpu: [arm] os: [linux] + libc: glibc '@cdxgen/cdxgen-plugins-bin-linux-ppc64@2.0.2': resolution: {integrity: sha512-OofcMJasdLcWBkI9EljimtSXxN6UlPgNj19nC2rFhpLig+S6984DpHqHpymLz0dI6l/n99bRMmVCftnISWH5Ag==} @@ -1496,11 +1503,13 @@ packages: resolution: {integrity: sha512-7V0dQUHhl6TbBUxeOncBqIx7rXAF7oP5w3zKBoSGkIEhyt5ViKwzwpZgeK/YOHsrp42sEpzBgCasCnNIdNDzKA==} cpu: [x64] os: [linux] + libc: musl '@cdxgen/cdxgen-plugins-bin-linuxmusl-arm64@2.0.2': resolution: {integrity: sha512-/r62CQtl+tp+zWCXbpT87IUq06eY+MYXgIIGQ79fmTmKv8EL4g7d21vNaI0O5KxXC16Orp4ihiAmr7o86uFdQQ==} cpu: [arm64] os: [linux] + libc: musl '@cdxgen/cdxgen-plugins-bin-windows-amd64@2.0.2': resolution: {integrity: sha512-++U1N5OX/pwZXupSJWQPv8nKryw5CDAlK52ts3i9zyQdTgWWBl/GLG642SJ9Y2oWYBtbKi2z9m9zyMEAn5VdZA==} @@ -2597,9 +2606,6 @@ packages: '@js-sdsl/ordered-map@4.4.2': resolution: {integrity: sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==} - '@jsdevtools/ono@7.1.3': - resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} - '@jsonjoy.com/base64@1.1.2': resolution: {integrity: sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==} engines: {node: '>=10.0'} @@ -3293,41 +3299,49 @@ packages: resolution: {integrity: sha512-heV2+jmXyYnUrpUXSPugqWDRpnsQcDm2AX4wzTuvgdlZfoNYO0O3W2AVpJYaDn9AG4JdM6Kxom8+foE7/BcSig==} cpu: [arm64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-arm64-musl@11.19.1': resolution: {integrity: sha512-jvo2Pjs1c9KPxMuMPIeQsgu0mOJF9rEb3y3TdpsrqwxRM+AN6/nDDwv45n5ZrUnQMsdBy5gIabioMKnQfWo9ew==} cpu: [arm64] os: [linux] + libc: [musl] '@oxc-resolver/binding-linux-ppc64-gnu@11.19.1': resolution: {integrity: sha512-vLmdNxWCdN7Uo5suays6A/+ywBby2PWBBPXctWPg5V0+eVuzsJxgAn6MMB4mPlshskYbppjpN2Zg83ArHze9gQ==} cpu: [ppc64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-riscv64-gnu@11.19.1': resolution: {integrity: sha512-/b+WgR+VTSBxzgOhDO7TlMXC1ufPIMR6Vj1zN+/x+MnyXGW7prTLzU9eW85Aj7Th7CCEG9ArCbTeqxCzFWdg2w==} cpu: [riscv64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-riscv64-musl@11.19.1': resolution: {integrity: sha512-YlRdeWb9j42p29ROh+h4eg/OQ3dTJlpHSa+84pUM9+p6i3djtPz1q55yLJhgW9XfDch7FN1pQ/Vd6YP+xfRIuw==} cpu: [riscv64] os: [linux] + libc: [musl] '@oxc-resolver/binding-linux-s390x-gnu@11.19.1': resolution: {integrity: sha512-EDpafVOQWF8/MJynsjOGFThcqhRHy417sRyLfQmeiamJ8qVhSKAn2Dn2VVKUGCjVB9C46VGjhNo7nOPUi1x6uA==} cpu: [s390x] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-x64-gnu@11.19.1': resolution: {integrity: sha512-NxjZe+rqWhr+RT8/Ik+5ptA3oz7tUw361Wa5RWQXKnfqwSSHdHyrw6IdcTfYuml9dM856AlKWZIUXDmA9kkiBQ==} cpu: [x64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-x64-musl@11.19.1': resolution: {integrity: sha512-cM/hQwsO3ReJg5kR+SpI69DMfvNCp+A/eVR4b4YClE5bVZwz8rh2Nh05InhwI5HR/9cArbEkzMjcKgTHS6UaNw==} cpu: [x64] os: [linux] + libc: [musl] '@oxc-resolver/binding-openharmony-arm64@11.19.1': resolution: {integrity: sha512-QF080IowFB0+9Rh6RcD19bdgh49BpQHUW5TajG1qvWHvmrQznTZZjYlgE2ltLXyKY+qs4F/v5xuX1XS7Is+3qA==} @@ -4163,72 +4177,84 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-arm64-gnu@1.0.0-rc.3': resolution: {integrity: sha512-kWXkoxxarYISBJ4bLNf5vFkEbb4JvccOwxWDxuK9yee8lg5XA7OpvlTptfRuwEvYcOZf+7VS69Uenpmpyo5Bjw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-arm64-gnu@1.0.0-rc.5': resolution: {integrity: sha512-KSol1De1spMZL+Xg7K5IBWXIvRWv7+pveaxFWXpezezAG7CS6ojzRjtCGCiLxQricutTAi/LkNWKMsd2wNhMKQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.0.0-beta.41': resolution: {integrity: sha512-MioXcCIX/wB1pBnBoJx8q4OGucUAfC1+/X1ilKFsjDK05VwbLZGRgOVD5OJJpUQPK86DhQciNBrfOKDiatxNmg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] '@rolldown/binding-linux-arm64-musl@1.0.0-rc.3': resolution: {integrity: sha512-Z03/wrqau9Bicfgb3Dbs6SYTHliELk2PM2LpG2nFd+cGupTMF5kanLEcj2vuuJLLhptNyS61rtk7SOZ+lPsTUA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] '@rolldown/binding-linux-arm64-musl@1.0.0-rc.5': resolution: {integrity: sha512-WFljyDkxtXRlWxMjxeegf7xMYXxUr8u7JdXlOEWKYgDqEgxUnSEsVDxBiNWQ1D5kQKwf8Wo4sVKEYPRhCdsjwA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] '@rolldown/binding-linux-x64-gnu@1.0.0-beta.41': resolution: {integrity: sha512-m66M61fizvRCwt5pOEiZQMiwBL9/y0bwU/+Kc4Ce/Pef6YfoEkR28y+DzN9rMdjo8Z28NXjsDPq9nH4mXnAP0g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.0.0-rc.3': resolution: {integrity: sha512-iSXXZsQp08CSilff/DCTFZHSVEpEwdicV3W8idHyrByrcsRDVh9sGC3sev6d8BygSGj3vt8GvUKBPCoyMA4tgQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.0.0-rc.5': resolution: {integrity: sha512-CUlplTujmbDWp2gamvrqVKi2Or8lmngXT1WxsizJfts7JrvfGhZObciaY/+CbdbS9qNnskvwMZNEhTPrn7b+WA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-musl@1.0.0-beta.41': resolution: {integrity: sha512-yRxlSfBvWnnfrdtJfvi9lg8xfG5mPuyoSHm0X01oiE8ArmLRvoJGHUTJydCYz+wbK2esbq5J4B4Tq9WAsOlP1Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] '@rolldown/binding-linux-x64-musl@1.0.0-rc.3': resolution: {integrity: sha512-qaj+MFudtdCv9xZo9znFvkgoajLdc+vwf0Kz5N44g+LU5XMe+IsACgn3UG7uTRlCCvhMAGXm1XlpEA5bZBrOcw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] '@rolldown/binding-linux-x64-musl@1.0.0-rc.5': resolution: {integrity: sha512-wdf7g9NbVZCeAo2iGhsjJb7I8ZFfs6X8bumfrWg82VK+8P6AlLXwk48a1ASiJQDTS7Svq2xVzZg3sGO2aXpHRA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] '@rolldown/binding-openharmony-arm64@1.0.0-beta.41': resolution: {integrity: sha512-PHVxYhBpi8UViS3/hcvQQb9RFqCtvFmFU1PvUoTRiUdBtgHA6fONNHU4x796lgzNlVSD3DO/MZNk1s5/ozSMQg==} @@ -4354,56 +4380,67 @@ packages: resolution: {integrity: sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.52.4': resolution: {integrity: sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.52.4': resolution: {integrity: sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.52.4': resolution: {integrity: sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.52.4': resolution: {integrity: sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-gnu@4.52.4': resolution: {integrity: sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.52.4': resolution: {integrity: sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.52.4': resolution: {integrity: sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.52.4': resolution: {integrity: sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.52.4': resolution: {integrity: sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.52.4': resolution: {integrity: sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openharmony-arm64@4.52.4': resolution: {integrity: sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA==} @@ -4624,24 +4661,28 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.1.18': resolution: {integrity: sha512-1px92582HkPQlaaCkdRcio71p8bc8i/ap5807tPRDK/uw953cauQBT8c5tVGkOwrHMfc2Yh6UuxaH4vtTjGvHg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.1.18': resolution: {integrity: sha512-v3gyT0ivkfBLoZGF9LyHmts0Isc8jHZyVcbzio6Wpzifg/+5ZJpDiRiUhDLkcr7f/r38SWNe7ucxmGW3j3Kb/g==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.1.18': resolution: {integrity: sha512-bhJ2y2OQNlcRwwgOAGMY0xTFStt4/wyU6pvI6LSuZpRgKQwxTec0/3Scu91O8ir7qCR3AuepQKLU/kX99FouqQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.1.18': resolution: {integrity: sha512-LffYTvPjODiP6PT16oNeUQJzNVyJl1cjIebq/rWWBF+3eDst5JGEFSc5cWxyRCJ0Mxl+KyIkqRxk1XPEs9x8TA==} @@ -4921,9 +4962,6 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/lodash@4.17.24': - resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==} - '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} @@ -8127,11 +8165,6 @@ packages: resolution: {integrity: sha512-ZF1nxZ28VhQouRWhUcVlUIN3qwSgPuswK05s/HIaoetAoE/9tngVmCHjSxmSQPav1nd+lPtTL0YZ/2AFdR/iYQ==} engines: {node: ^20.17.0 || >=22.9.0} - json-schema-to-typescript@15.0.4: - resolution: {integrity: sha512-Su9oK8DR4xCmDsLlyvadkXzX6+GGXJpbhwoLtOGArAG61dvbW4YQmSEno2y66ahpIdmLMg6YUf/QHLgiwvkrHQ==} - engines: {node: '>=16.0.0'} - hasBin: true - json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} @@ -8264,24 +8297,28 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [glibc] lightningcss-linux-arm64-musl@1.30.2: resolution: {integrity: sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [musl] lightningcss-linux-x64-gnu@1.30.2: resolution: {integrity: sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [glibc] lightningcss-linux-x64-musl@1.30.2: resolution: {integrity: sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [musl] lightningcss-win32-arm64-msvc@1.30.2: resolution: {integrity: sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==} @@ -9793,11 +9830,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier@3.8.1: - resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} - engines: {node: '>=14'} - hasBin: true - pretty-error@4.0.0: resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==} @@ -12042,12 +12074,6 @@ snapshots: package-manager-detector: 1.6.0 tinyexec: 1.0.2 - '@apidevtools/json-schema-ref-parser@11.9.3': - dependencies: - '@jsdevtools/ono': 7.1.3 - '@types/json-schema': 7.0.15 - js-yaml: 4.1.1 - '@appthreat/atom-common@1.1.0': optional: true @@ -14781,8 +14807,6 @@ snapshots: '@js-sdsl/ordered-map@4.4.2': {} - '@jsdevtools/ono@7.1.3': {} - '@jsonjoy.com/base64@1.1.2(tslib@2.8.1)': dependencies: tslib: 2.8.1 @@ -17266,8 +17290,6 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/lodash@4.17.24': {} - '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 @@ -17756,10 +17778,6 @@ snapshots: optionalDependencies: ajv: 8.17.1 - ajv-formats@3.0.1(ajv@8.17.1): - optionalDependencies: - ajv: 8.17.1 - ajv-formats@3.0.1(ajv@8.18.0): optionalDependencies: ajv: 8.18.0 @@ -20903,18 +20921,6 @@ snapshots: json-parse-even-better-errors@5.0.0: {} - json-schema-to-typescript@15.0.4: - dependencies: - '@apidevtools/json-schema-ref-parser': 11.9.3 - '@types/json-schema': 7.0.15 - '@types/lodash': 4.17.24 - is-glob: 4.0.3 - js-yaml: 4.1.1 - lodash: 4.17.21 - minimist: 1.2.8 - prettier: 3.8.1 - tinyglobby: 0.2.15 - json-schema-traverse@0.4.1: {} json-schema-traverse@1.0.0: {} @@ -22928,8 +22934,6 @@ snapshots: prelude-ls@1.2.1: {} - prettier@3.8.1: {} - pretty-error@4.0.0: dependencies: lodash: 4.17.21 diff --git a/template/appkit.plugins.json b/template/appkit.plugins.json index d3c8702f9..61a577149 100644 --- a/template/appkit.plugins.json +++ b/template/appkit.plugins.json @@ -1,6 +1,6 @@ { "$schema": "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", - "version": "1.1", + "version": "2.0", "plugins": { "analytics": { "name": "analytics", @@ -18,13 +18,28 @@ "fields": { "id": { "env": "DATABRICKS_WAREHOUSE_ID", - "description": "SQL Warehouse ID" + "description": "SQL Warehouse ID", + "discovery": { + "type": "kind", + "resourceKind": "warehouse" + }, + "origin": "user" } } } ], "optional": [] - } + }, + "postScaffold": [ + { + "instruction": "Ensure your SQL Warehouse is running and accessible from your workspace.", + "required": true + }, + { + "instruction": "Create a config/queries/ directory and add .sql files for your analytics queries.", + "required": false + } + ] }, "files": { "name": "files", @@ -42,13 +57,29 @@ "fields": { "path": { "env": "DATABRICKS_VOLUME_FILES", - "description": "Volume path for file storage (e.g. /Volumes/catalog/schema/volume_name)" + "description": "Volume path for file storage (e.g. /Volumes/catalog/schema/volume_name)", + "discovery": { + "type": "kind", + "resourceKind": "volume", + "select": "full_name" + }, + "origin": "user" } } } ], "optional": [] - } + }, + "postScaffold": [ + { + "instruction": "Verify your Unity Catalog volume exists and you have WRITE_VOLUME permission.", + "required": true + }, + { + "instruction": "Set the DATABRICKS_VOLUME_FILES environment variable to the full volume path (e.g. /Volumes/catalog/schema/volume_name).", + "required": true + } + ] }, "genie": { "name": "genie", @@ -66,13 +97,28 @@ "fields": { "id": { "env": "DATABRICKS_GENIE_SPACE_ID", - "description": "Default Genie Space ID" + "description": "Default Genie Space ID", + "discovery": { + "type": "kind", + "resourceKind": "genie_space" + }, + "origin": "user" } } } ], "optional": [] - } + }, + "postScaffold": [ + { + "instruction": "Configure the 'spaces' map in your plugin config with alias-to-Space-ID mappings.", + "required": true + }, + { + "instruction": "Ensure your Genie Space(s) are configured with the appropriate data tables and instructions.", + "required": false + } + ] }, "jobs": { "name": "jobs", @@ -90,7 +136,8 @@ "fields": { "id": { "env": "DATABRICKS_JOB_ID", - "description": "Numeric Databricks job ID. Find it in the Jobs UI or via `databricks jobs list`." + "description": "Numeric Databricks job ID. Find it in the Jobs UI or via `databricks jobs list`.", + "origin": "user" } } } @@ -112,56 +159,97 @@ "description": "Lakebase Postgres database for persistent storage", "permission": "CAN_CONNECT_AND_CREATE", "fields": { + "project": { + "description": "Full Lakebase Postgres project resource name. Obtain by running `databricks postgres list-projects`, select the desired item from the output array and use its .name value.", + "examples": [ + "projects/{project-id}" + ], + "discovery": { + "type": "kind", + "resourceKind": "postgres_project", + "select": "name" + }, + "origin": "user" + }, "branch": { - "description": "Full Lakebase Postgres branch resource name. Obtain by running `databricks postgres list-branches projects/{project-id}`, select the desired item from the output array and use its .name value.", + "description": "Full Lakebase Postgres branch resource name. Obtain by running `databricks postgres list-branches {project-name}`, select the desired item from the output array and use its .name value. Requires the project resource name.", "examples": [ "projects/{project-id}/branches/{branch-id}" - ] + ], + "discovery": { + "type": "kind", + "resourceKind": "postgres_branch", + "select": "name", + "dependsOn": "project" + }, + "origin": "user" }, "database": { "description": "Full Lakebase Postgres database resource name. Obtain by running `databricks postgres list-databases {branch-name}`, select the desired item from the output array and use its .name value. Requires the branch resource name.", "examples": [ "projects/{project-id}/branches/{branch-id}/databases/{database-id}" - ] + ], + "discovery": { + "type": "kind", + "resourceKind": "postgres_database", + "select": "name", + "dependsOn": "branch" + }, + "origin": "user" }, "host": { "env": "PGHOST", + "description": "Postgres host for local development. Auto-injected by the platform at deploy time.", "localOnly": true, "resolve": "postgres:host", - "description": "Postgres host for local development. Auto-injected by the platform at deploy time." + "origin": "platform" }, "databaseName": { "env": "PGDATABASE", + "description": "Postgres database name for local development. Auto-injected by the platform at deploy time.", "localOnly": true, "resolve": "postgres:databaseName", - "description": "Postgres database name for local development. Auto-injected by the platform at deploy time." + "origin": "platform" }, "endpointPath": { "env": "LAKEBASE_ENDPOINT", - "bundleIgnore": true, - "resolve": "postgres:endpointPath", "description": "Lakebase endpoint resource name. Auto-injected at runtime via app.yaml valueFrom: postgres. For local development, obtain by running `databricks postgres list-endpoints {branch-name}`, select the desired item from the output array and use its .name value.", + "bundleIgnore": true, "examples": [ "projects/{project-id}/branches/{branch-id}/endpoints/{endpoint-id}" - ] + ], + "resolve": "postgres:endpointPath", + "origin": "cli" }, "port": { "env": "PGPORT", + "description": "Postgres port. Auto-injected by the platform at deploy time.", "localOnly": true, "value": "5432", - "description": "Postgres port. Auto-injected by the platform at deploy time." + "origin": "platform" }, "sslmode": { "env": "PGSSLMODE", + "description": "Postgres SSL mode. Auto-injected by the platform at deploy time.", "localOnly": true, "value": "require", - "description": "Postgres SSL mode. Auto-injected by the platform at deploy time." + "origin": "platform" } } } ], "optional": [] - } + }, + "postScaffold": [ + { + "instruction": "Run database migrations to initialize your Lakebase schema.", + "required": true + }, + { + "instruction": "Verify local connectivity to Lakebase using: PGHOST= PGDATABASE= PGPORT=5432 PGSSLMODE=require psql", + "required": false + } + ] }, "server": { "name": "server", @@ -190,7 +278,8 @@ "fields": { "name": { "env": "DATABRICKS_SERVING_ENDPOINT_NAME", - "description": "Serving endpoint name" + "description": "Serving endpoint name", + "origin": "user" } } } @@ -198,5 +287,35 @@ "optional": [] } } + }, + "scaffolding": { + "command": "databricks apps init", + "flags": { + "--template-dir": { + "description": "Path to the template directory containing the app scaffold", + "required": true + }, + "--config-dir": { + "description": "Path to the output directory for the initialized app", + "required": true + }, + "--profile": { + "description": "Databricks CLI profile to use for authentication", + "required": false + } + }, + "rules": { + "never": [ + "Modify files inside the template directory", + "Skip resource configuration prompts", + "Hardcode workspace-specific values in template files" + ], + "must": [ + "Use the template manifest (appkit.plugins.json) as the source of truth for available plugins", + "Respect requiredByTemplate flags when presenting plugin selection", + "Generate .env files with all required environment variables from selected plugins", + "When discovering volume resources, prompt the user for catalog and schema before listing volumes." + ] + } } } diff --git a/tools/generate-json-schema.ts b/tools/generate-json-schema.ts new file mode 100644 index 000000000..c2db2667b --- /dev/null +++ b/tools/generate-json-schema.ts @@ -0,0 +1,107 @@ +/** + * Generates JSON Schema artifacts from the Zod authoring module + * (packages/shared/src/schemas/manifest.ts) and writes them into the docs + * site's static schemas directory. Those files are what the published + * docs URL serves to plugin authors' editors via $schema. + * + * Phase 1: this generator runs alongside the existing + * `tools/generate-schema-types.ts` (which still emits TypeScript types from + * the hand-written JSON Schema). Phases 2-5 cut downstream consumers over + * to the Zod-authored shape and delete the legacy generator. + * + * Run from repo root: pnpm exec tsx tools/generate-json-schema.ts + */ +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { z } from "zod"; +import { + pluginManifestSchema, + templatePluginsManifestSchema, +} from "../packages/shared/src/schemas/manifest.ts"; +import { formatWithBiome } from "./format-with-biome.ts"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.join(__dirname, ".."); +const DOCS_SCHEMAS_DIR = path.join(REPO_ROOT, "docs/static/schemas"); + +const PLUGIN_OUT_PATH = path.join( + DOCS_SCHEMAS_DIR, + "plugin-manifest.schema.json", +); +const TEMPLATE_OUT_PATH = path.join( + DOCS_SCHEMAS_DIR, + "template-plugins.schema.json", +); + +const PLUGIN_SCHEMA_ID = + "https://databricks.github.io/appkit/schemas/plugin-manifest.schema.json"; +const TEMPLATE_SCHEMA_ID = + "https://databricks.github.io/appkit/schemas/template-plugins.schema.json"; + +function emit( + schema: z.ZodType, + schemaId: string, + title: string, +): Record { + // Targeting draft-07 keeps parity with the existing hand-written schemas + // (which are draft-07). The default in Zod 4 is draft-2020-12. + // + // `io: "input"` makes Zod emit the pre-transform shape, so transforms + // (like the `origin`-emitter on `templateFieldEntrySchema`) produce + // valid JSON Schema instead of throwing "Transforms cannot be + // represented in JSON Schema". For schemas without transforms, this is + // equivalent to the default ("output"). + const generated = z.toJSONSchema(schema, { + target: "draft-07", + io: "input", + }); + // Inject $id and title at the top level so editor tooling can identify + // the schema by URL even when fetched out-of-band. + return { + $schema: "http://json-schema.org/draft-07/schema#", + $id: schemaId, + title, + ...stripTopLevelSchemaKey(generated), + }; +} + +/** + * Zod's `toJSONSchema` emits `$schema` at the root. We re-construct it in + * a deterministic order alongside `$id` and `title`, so this strips the + * key from the generated shape before merging. + */ +function stripTopLevelSchemaKey( + obj: Record, +): Record { + const { $schema: _ignored, ...rest } = obj; + return rest; +} + +function writeJson(outPath: string, value: unknown): void { + fs.mkdirSync(path.dirname(outPath), { recursive: true }); + fs.writeFileSync(outPath, `${JSON.stringify(value, null, 2)}\n`, "utf-8"); + formatWithBiome(outPath); + console.log("Wrote", outPath); +} + +async function main(): Promise { + const pluginJson = emit( + pluginManifestSchema, + PLUGIN_SCHEMA_ID, + "AppKit Plugin Manifest", + ); + const templateJson = emit( + templatePluginsManifestSchema, + TEMPLATE_SCHEMA_ID, + "AppKit Template Plugins Manifest", + ); + + writeJson(PLUGIN_OUT_PATH, pluginJson); + writeJson(TEMPLATE_OUT_PATH, templateJson); +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/tools/generate-plugin-entries.ts b/tools/generate-plugin-entries.ts index f7517defa..c2aa6ec7a 100644 --- a/tools/generate-plugin-entries.ts +++ b/tools/generate-plugin-entries.ts @@ -145,8 +145,7 @@ function main(): void { fs.writeFileSync(BETA_OUT, renderBarrel(beta), "utf-8"); // Self-format so a fresh `pnpm build` doesn't leave the generated // barrels dirty against biome's canonical formatting (matches the - // pattern set by tools/generate-schema-types.ts and - // tools/generate-registry-types.ts after PR #324). + // pattern set by tools/generate-registry-types.ts after PR #324). formatWithBiome(GA_OUT); formatWithBiome(BETA_OUT); diff --git a/tools/generate-registry-types.ts b/tools/generate-registry-types.ts index 531802260..0a769d790 100644 --- a/tools/generate-registry-types.ts +++ b/tools/generate-registry-types.ts @@ -1,109 +1,109 @@ /** * Generates registry types (ResourceType enum, permission types, hierarchy) from - * plugin-manifest.schema.json. Single source of truth for resource types and permissions. + * the canonical Zod schemas in `packages/shared/src/schemas/manifest.ts`. Single + * source of truth for resource types and permissions. + * + * Phase 5: replaced JSON-Schema runtime read with direct Zod imports. The + * resource-type enum + per-type permission enums are extracted via Zod 4's + * native `.options` accessor on enum schemas. * * Run from repo root: pnpm exec tsx tools/generate-registry-types.ts */ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; +import { + appPermissionSchema, + databasePermissionSchema, + experimentPermissionSchema, + genieSpacePermissionSchema, + jobPermissionSchema, + postgresPermissionSchema, + resourceTypeSchema, + secretPermissionSchema, + servingEndpointPermissionSchema, + sqlWarehousePermissionSchema, + ucConnectionPermissionSchema, + ucFunctionPermissionSchema, + vectorSearchIndexPermissionSchema, + volumePermissionSchema, +} from "../packages/shared/src/schemas/manifest.ts"; import { formatWithBiome } from "./format-with-biome.ts"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const REPO_ROOT = path.join(__dirname, ".."); -const SCHEMA_PATH = path.join( - REPO_ROOT, - "packages/shared/src/schemas/plugin-manifest.schema.json", -); const OUT_PATH = path.join( REPO_ROOT, "packages/appkit/src/registry/types.generated.ts", ); -interface SchemaDefs { - resourceType?: { enum?: string[] }; - resourceRequirement?: { - allOf?: Array<{ - if?: { properties?: { type?: { const?: string } } }; - then?: { properties?: { permission?: { $ref?: string } } }; - }>; - }; - [key: string]: unknown; -} - -function loadSchema(): Record { - const raw = fs.readFileSync(SCHEMA_PATH, "utf-8"); - return JSON.parse(raw) as Record; -} - /** value "sql_warehouse" -> "SQL_WAREHOUSE" */ function toEnumKey(value: string): string { return value.toUpperCase().replace(/-/g, "_"); } -/** def key "secretPermission" -> "SecretPermission" */ -function toPermissionTypeName(defKey: string): string { - return defKey.charAt(0).toUpperCase() + defKey.slice(1); +/** type "sql_warehouse" -> "SqlWarehousePermission" */ +function toPermissionTypeName(type: string): string { + return ( + type + .split("_") + .map((p) => p.charAt(0).toUpperCase() + p.slice(1)) + .join("") + "Permission" + ); } -function generate(schema: Record): string { - const defs = (schema.$defs ?? {}) as SchemaDefs; - const resourceType = defs.resourceType; - const resourceReq = defs.resourceRequirement; - const allOf = resourceReq?.allOf ?? []; - - const resourceTypes: string[] = resourceType?.enum ?? []; - const typeToPermissionRef: Array<{ type: string; ref: string }> = []; - - for (const branch of allOf) { - const typeConst = branch?.if?.properties?.type?.const; - const ref = branch?.then?.properties?.permission?.$ref; - if (typeof typeConst === "string" && typeof ref === "string") { - typeToPermissionRef.push({ type: typeConst, ref }); - } - } - - // Resolve ref to def key: "#/$defs/secretPermission" -> "secretPermission" - const refToDefKey = (ref: string): string => { - const segments = ref.replace(/^#\//, "").split("/"); - return segments[segments.length - 1] ?? ""; - }; - - const defKeyToPermissionTypeName: Record = {}; - const typeToPermissions: Record = {}; - - for (const { type, ref } of typeToPermissionRef) { - const defKey = refToDefKey(ref); - const permDef = defs[defKey] as { enum?: string[] } | undefined; - const enumArr = permDef?.enum ?? []; - if (enumArr.length > 0) { - defKeyToPermissionTypeName[defKey] = toPermissionTypeName(defKey); - // Schema enum order is weakest to strongest (see schema descriptions) - typeToPermissions[type] = [...enumArr]; - } - } +/** + * Per-type permission enum schemas, keyed by the resource type literal. + * Mirrors `schema-resources.ts`'s `PERMISSION_SCHEMAS_BY_TYPE`. Add an entry + * when extending `resourceTypeSchema`. + */ +const PERMISSION_SCHEMAS_BY_TYPE = { + secret: secretPermissionSchema, + job: jobPermissionSchema, + sql_warehouse: sqlWarehousePermissionSchema, + serving_endpoint: servingEndpointPermissionSchema, + volume: volumePermissionSchema, + vector_search_index: vectorSearchIndexPermissionSchema, + uc_function: ucFunctionPermissionSchema, + uc_connection: ucConnectionPermissionSchema, + database: databasePermissionSchema, + postgres: postgresPermissionSchema, + genie_space: genieSpacePermissionSchema, + experiment: experimentPermissionSchema, + app: appPermissionSchema, +} as const; + +function generate(): string { + const resourceTypes = [...resourceTypeSchema.options]; const lines: string[] = [ - "// AUTO-GENERATED from packages/shared/src/schemas/plugin-manifest.schema.json", + "// AUTO-GENERATED from packages/shared/src/schemas/manifest.ts (Zod canonical).", "// Do not edit. Run: pnpm exec tsx tools/generate-registry-types.ts", "", - "/** Resource types from schema $defs.resourceType.enum */", + "/** Resource types from resourceTypeSchema.options */", "export enum ResourceType {", ...resourceTypes.map((v) => ` ${toEnumKey(v)} = "${v}",`), "}", "", "// ============================================================================", - "// Permissions per resource type (from schema permission $defs)", + "// Permissions per resource type (from per-type permission enum schemas)", "// ============================================================================", ]; const permissionTypeNames: string[] = []; - for (const { type, ref } of typeToPermissionRef) { - const defKey = refToDefKey(ref); - const typeName = defKeyToPermissionTypeName[defKey]; - if (!typeName) continue; - const perms = typeToPermissions[type]; - if (!perms?.length) continue; + const typeToPermissions: Record = {}; + + for (const type of resourceTypes) { + const schema = PERMISSION_SCHEMAS_BY_TYPE[type]; + if (!schema) { + throw new Error( + `generate-registry-types: missing permission schema for resource type '${type}'. ` + + `Add it to PERMISSION_SCHEMAS_BY_TYPE in tools/generate-registry-types.ts.`, + ); + } + const perms = [...schema.options]; + typeToPermissions[type] = perms; + const typeName = toPermissionTypeName(type); permissionTypeNames.push(typeName); const union = perms.map((p) => `"${p}"`).join(" | "); lines.push(`/** Permissions for ${toEnumKey(type)} resources */`); @@ -115,9 +115,7 @@ function generate(schema: Record): string { "/** Union of all possible permission levels across all resource types. */", ); lines.push( - "export type ResourcePermission =\n | " + - permissionTypeNames.join("\n | ") + - ";", + `export type ResourcePermission =\n | ${permissionTypeNames.join("\n | ")};`, ); lines.push(""); lines.push( @@ -146,8 +144,7 @@ function generate(schema: Record): string { } function main(): void { - const schema = loadSchema(); - const out = generate(schema); + const out = generate(); fs.mkdirSync(path.dirname(OUT_PATH), { recursive: true }); fs.writeFileSync(OUT_PATH, out, "utf-8"); formatWithBiome(OUT_PATH); diff --git a/tools/generate-schema-types.ts b/tools/generate-schema-types.ts deleted file mode 100644 index 18360fb2f..000000000 --- a/tools/generate-schema-types.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Generates TypeScript interfaces from plugin-manifest.schema.json using - * json-schema-to-typescript. Single source of truth for structural types - * (ResourceFieldEntry, ResourceRequirement, PluginManifest). - * - * Run from repo root: pnpm exec tsx tools/generate-schema-types.ts - */ -import fs from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import { compileFromFile } from "json-schema-to-typescript"; -import { formatWithBiome } from "./format-with-biome.ts"; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const REPO_ROOT = path.join(__dirname, ".."); -const SCHEMA_PATH = path.join( - REPO_ROOT, - "packages/shared/src/schemas/plugin-manifest.schema.json", -); -const OUT_PATH = path.join( - REPO_ROOT, - "packages/shared/src/schemas/plugin-manifest.generated.ts", -); - -const BANNER = `// AUTO-GENERATED from plugin-manifest.schema.json — do not edit. -// Run: pnpm exec tsx tools/generate-schema-types.ts -`; - -async function main(): Promise { - const raw = await compileFromFile(SCHEMA_PATH, { - bannerComment: "", - additionalProperties: false, - strictIndexSignatures: false, - unreachableDefinitions: true, - format: false, - style: { semi: true, singleQuote: false }, - // Rename the root type (derived from schema title "AppKit Plugin Manifest") - // to "PluginManifest" for ergonomic imports. - customName: (schema) => - schema.title === "AppKit Plugin Manifest" ? "PluginManifest" : undefined, - }); - - // Post-processing: work around json-schema-to-typescript limitations that - // have no config options. Track upstream: https://github.com/bcherny/json-schema-to-typescript/issues/428 - // allOf/if-then produces `{ [k: string]: unknown } & { … }` — strip the index-signature part. - const output = raw.replace(/\{\s*\[k: string\]: unknown;?\s*\}\s*&\s*/g, ""); - - const result = BANNER + output; - - fs.mkdirSync(path.dirname(OUT_PATH), { recursive: true }); - fs.writeFileSync(OUT_PATH, result, "utf-8"); - formatWithBiome(OUT_PATH); - console.log("Wrote", OUT_PATH); -} - -main();