Skip to content

feat: add plugin commands#110

Merged
MarioCadenas merged 14 commits intomainfrom
cli-plugin-commands
Feb 24, 2026
Merged

feat: add plugin commands#110
MarioCadenas merged 14 commits intomainfrom
cli-plugin-commands

Conversation

@MarioCadenas
Copy link
Collaborator

@MarioCadenas MarioCadenas commented Feb 18, 2026

Introduces a full suite of CLI commands under npx appkit plugin for managing plugin manifests — creating, validating, listing, syncing, and adding resources. Restructures the previous single plugins sync command into a modular command tree and strengthens the JSON schema with type-specific permission validation.

New CLI commands

  • plugin create — Interactive wizard (via @clack/prompts) to scaffold a new plugin with manifest, TypeScript class, and barrel exports. Supports in-repo or standalone placement, resource selection, and metadata fields.
  • plugin validate — Validates manifest.json or appkit.plugins.json against the JSON schema. Auto-detects schema type, reports humanized errors with actual values and expected enums.
  • plugin list — Lists plugins from appkit.plugins.json or scans a directory. Supports --json output for scripting.
  • plugin add-resource — Interactively adds a resource requirement to an existing plugin manifest.
  • plugin sync — Refactored from the previous plugins sync; discovers plugin manifests from packages and local imports, writes consolidated appkit.plugins.json.

Schema improvements

  • Type-specific permission validation: Each resource type (12 known types) now has its own permission enum enforced via allOf/if-then rules (e.g. sql_warehouse only allows CAN_MANAGE | CAN_USE).
  • No unknown resource types: The resourceType enum is the single source of truth — unknown types are rejected at the schema level.
  • Template schema deduplication: template-plugins.schema.json now $refs definitions from plugin-manifest.schema.json instead of duplicating them.

@MarioCadenas MarioCadenas changed the title feat: add plugin create command feat: add plugin commands Feb 19, 2026
@MarioCadenas MarioCadenas force-pushed the cli-plugin-commands branch 2 times, most recently from 767f200 to 34f8509 Compare February 19, 2026 17:22
@MarioCadenas MarioCadenas marked this pull request as ready for review February 20, 2026 10:27
@MarioCadenas MarioCadenas requested a review from pkosiec February 20, 2026 11:51
Copy link
Member

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

(There was a lot of code to review so I focused mostly on the end-user experience, and just checked it briefly 😄 )

@@ -219,13 +201,13 @@
},
"alias": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW IMO much clearer label would be displayName - but not sure if that's the best moment to change it 😄

Comment on lines 15 to 44
export const RESOURCE_TYPE_OPTIONS: ResourceTypeOption[] = [
{ value: "secret", label: "Secret" },
{ value: "job", label: "Job" },
{ value: "sql_warehouse", label: "SQL Warehouse" },
{ value: "serving_endpoint", label: "Serving Endpoint" },
{ value: "volume", label: "Volume" },
{ value: "vector_search_index", label: "Vector Search Index" },
{ value: "uc_function", label: "UC Function" },
{ value: "uc_connection", label: "UC Connection" },
{ value: "database", label: "Database" },
{ value: "genie_space", label: "Genie Space" },
{ value: "experiment", label: "Experiment" },
{ value: "app", label: "App" },
];

/** All valid permissions per resource type, aligned with the schema if/then rules. */
export const PERMISSIONS_BY_TYPE: Record<string, string[]> = {
secret: ["READ", "WRITE", "MANAGE"],
job: ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"],
sql_warehouse: ["CAN_USE", "CAN_MANAGE"],
serving_endpoint: ["CAN_QUERY", "CAN_VIEW", "CAN_MANAGE"],
volume: ["READ_VOLUME", "WRITE_VOLUME"],
vector_search_index: ["SELECT"],
uc_function: ["EXECUTE"],
uc_connection: ["USE_CONNECTION"],
database: ["CAN_CONNECT_AND_CREATE"],
genie_space: ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"],
experiment: ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"],
app: ["CAN_USE"],
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the fact that those resources (and sometimes permissions) are defined on:

This becomes super difficult to maintain. When I'll be adding the postgres resource support, I'll need to update so many places (and wait for CLI release) 😶

I think we should get that from the schema: https://github.com/databricks/appkit/blob/main/packages/shared/src/schemas/plugin-manifest.schema.json - especially that we host it on docs:

"$schema": "http://json-schema.org/draft-07/schema#",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I agree, we already have the database resource there though, you might need to update it but it is there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

database is a different resource (it's lakebase v1), in the API postgres is the Lakebase v2 - you can see that in the Databricks CLI (databricks postgres list-projects, databricks database list-database-instances)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just need to sync with however the resource will look like in the UI and in DABs

Comment on lines +170 to +173
.option(
"-d, --dir <path>",
"Scan directory for plugin folders (each with manifest.json)",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected the same syntax as validate (npx appkit plugin list ../../template). By default it would use . as before.
WDYT? IMO it would be great to keep the consistency across commands.

Copy link
Member

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merge please get rid of the hardcoded definitions 🙏

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on it, I thought I handled that 🤦🏻

@MarioCadenas MarioCadenas merged commit ec5481d into main Feb 24, 2026
6 checks passed
@MarioCadenas MarioCadenas deleted the cli-plugin-commands branch February 24, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants