@danxbot/plugin-sdk 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -60
- package/dist/card-kit.d.ts +9 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,60 +1,66 @@
|
|
|
1
|
-
# @danxbot/plugin-sdk
|
|
2
|
-
|
|
3
|
-
Build a 50 Arms **card-type plugin**: a small React bundle that gives a card type its own card view (`CardView`) and/or card-list view (`CardListView`), loaded into 50 Arms' own page with `import()`.
|
|
4
|
-
|
|
5
|
-
A plugin does not bundle React, `@danxbot/ui` or the card features. The app serves them under fixed import specifiers through an import map, so a plugin shares the app's single React and renders the app's own components:
|
|
6
|
-
|
|
7
|
-
| Specifier | What it is |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `react`, `react/jsx-runtime`, `react-dom` | The app's React |
|
|
10
|
-
| `@danxbot/ui` | The app's design system |
|
|
11
|
-
| `@danxbot/card-kit@1` | The card features: data hooks, card regions (`StandardCardPage`, `EditableTitle`, `ChecklistsSection`, ...), `CardFace`, `CardBoard` |
|
|
12
|
-
|
|
13
|
-
The live list and each library's major version is `GET /api/plugin-runtime`.
|
|
14
|
-
|
|
15
|
-
## Set up a plugin
|
|
16
|
-
|
|
17
|
-
`package.json`: depend on `@danxbot/plugin-sdk` and install its peers: `vite`, `react`, `@types/react`, `@danxbot/ui` and `react-router` (types only: the app serves the real ones; the kit's declarations import them).
|
|
18
|
-
|
|
19
|
-
`vite.config.ts`:
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import { defineConfig } from "vite";
|
|
23
|
-
import { danxPlugin } from "@danxbot/plugin-sdk/vite";
|
|
24
|
-
|
|
25
|
-
export default defineConfig({ plugins: [danxPlugin()] });
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`tsconfig.json`: add `"types": ["@danxbot/plugin-sdk/card-kit"]`: the kit's declarations. They are self-contained (they import only `react`, `@danxbot/ui` and `react-router`) and the specifier is not a package, so TypeScript reads them as ambient types.
|
|
29
|
-
|
|
30
|
-
`src/index.tsx` exports `CardView` and/or `CardListView`:
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import { StandardCardPage, type CardViewProps } from "@danxbot/card-kit@1";
|
|
34
|
-
|
|
35
|
-
export function CardView({ card, mutation }: CardViewProps) {
|
|
36
|
-
return <StandardCardPage card={card} mutation={mutation} />;
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
`vite build` writes the plugin to `dist/`: `index.js` (the entry), `chunks/` for code splitting, `index.css`, source maps, and `danx-plugin.json`, the manifest listing every file with its size and sha256 and the runtime majors the plugin was built against.
|
|
41
|
-
|
|
42
|
-
The build refuses to bundle a copy of React, React DOM, `@danxbot/ui` or `react-router`: import only the specifiers above. For routing, use the kit's `Link` and `useNavigate`; `StandardCardPage` reads the plan the page was opened from out of the URL, so a view that wraps it passes only `{card, mutation}`.
|
|
43
|
-
|
|
44
|
-
## The card kit is a contract
|
|
45
|
-
|
|
46
|
-
A runtime export of `@danxbot/card-kit@1`, and its parameters, is never removed or changed in place; the keys of the exported data types follow the Versioning section below. A breaking change is `@danxbot/card-kit@2`, served beside `@1` until no approved plugin revision needs it. A plugin's manifest records the majors it was built against, and the app refuses to run a revision built for a major it no longer serves.
|
|
47
|
-
|
|
48
|
-
## Publish a revision
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
DANXBOT_DASHBOARD_URL=https://<your dashboard> DANXBOT_API_KEY=<a key from your own account> npx danx-plugin publish --plugin <key> --note "what changed" [--dir <project>] [--name "Display name"]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`publish` runs the project's own `npm run build`, archives the source (inside a git repo: the tracked files plus untracked ones git does not ignore; otherwise what the top-level `.gitignore` leaves, minus `node_modules`, `.git` and a top-level `dist`; a lockfile is required, so the download builds as is) and uploads both as a new revision of the plugin `<key>`, creating the plugin on its first publish. It prints the revision number and the Settings > Plugins link where a team admin approves it. `.env*` files are never archived, in or out of git. Inside git, a git failure (git missing, a dubious-ownership refusal) stops the publish with git's message; only "not a git repository" means outside git, where the top-level `.gitignore` is honoured (`*`, `?`, `**`, anchoring and trailing `/`; a `!` negation is refused). A blank note is refused first, before the build, the archive or any request. The dashboard validates the upload; a refusal prints its named reason.
|
|
55
|
-
|
|
56
|
-
The same flow is exported for tools as `@danxbot/plugin-sdk/publish` (`buildPlugin`, `archiveSource`, `uploadRevision`, `fetchTransport`): the dashboard MCP's `plugin_publish` tool runs it for agents.
|
|
57
|
-
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
# @danxbot/plugin-sdk
|
|
2
|
+
|
|
3
|
+
Build a 50 Arms **card-type plugin**: a small React bundle that gives a card type its own card view (`CardView`) and/or card-list view (`CardListView`), loaded into 50 Arms' own page with `import()`.
|
|
4
|
+
|
|
5
|
+
A plugin does not bundle React, `@danxbot/ui` or the card features. The app serves them under fixed import specifiers through an import map, so a plugin shares the app's single React and renders the app's own components:
|
|
6
|
+
|
|
7
|
+
| Specifier | What it is |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `react`, `react/jsx-runtime`, `react-dom` | The app's React |
|
|
10
|
+
| `@danxbot/ui` | The app's design system |
|
|
11
|
+
| `@danxbot/card-kit@1` | The card features: data hooks, card regions (`StandardCardPage`, `EditableTitle`, `ChecklistsSection`, ...), `CardFace`, `CardBoard` |
|
|
12
|
+
|
|
13
|
+
The live list and each library's major version is `GET /api/plugin-runtime`.
|
|
14
|
+
|
|
15
|
+
## Set up a plugin
|
|
16
|
+
|
|
17
|
+
`package.json`: depend on `@danxbot/plugin-sdk` and install its peers: `vite`, `react`, `@types/react`, `@danxbot/ui` and `react-router` (types only: the app serves the real ones; the kit's declarations import them).
|
|
18
|
+
|
|
19
|
+
`vite.config.ts`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { defineConfig } from "vite";
|
|
23
|
+
import { danxPlugin } from "@danxbot/plugin-sdk/vite";
|
|
24
|
+
|
|
25
|
+
export default defineConfig({ plugins: [danxPlugin()] });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`tsconfig.json`: add `"types": ["@danxbot/plugin-sdk/card-kit"]`: the kit's declarations. They are self-contained (they import only `react`, `@danxbot/ui` and `react-router`) and the specifier is not a package, so TypeScript reads them as ambient types.
|
|
29
|
+
|
|
30
|
+
`src/index.tsx` exports `CardView` and/or `CardListView`:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { StandardCardPage, type CardViewProps } from "@danxbot/card-kit@1";
|
|
34
|
+
|
|
35
|
+
export function CardView({ card, mutation }: CardViewProps) {
|
|
36
|
+
return <StandardCardPage card={card} mutation={mutation} />;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`vite build` writes the plugin to `dist/`: `index.js` (the entry), `chunks/` for code splitting, `index.css`, source maps, and `danx-plugin.json`, the manifest listing every file with its size and sha256 and the runtime majors the plugin was built against.
|
|
41
|
+
|
|
42
|
+
The build refuses to bundle a copy of React, React DOM, `@danxbot/ui` or `react-router`: import only the specifiers above. For routing, use the kit's `Link` and `useNavigate`; `StandardCardPage` reads the plan the page was opened from out of the URL, so a view that wraps it passes only `{card, mutation}`.
|
|
43
|
+
|
|
44
|
+
## The card kit is a contract
|
|
45
|
+
|
|
46
|
+
A runtime export of `@danxbot/card-kit@1`, and its parameters, is never removed or changed in place; the keys of the exported data types follow the Versioning section below. A breaking change is `@danxbot/card-kit@2`, served beside `@1` until no approved plugin revision needs it. A plugin's manifest records the majors it was built against, and the app refuses to run a revision built for a major it no longer serves.
|
|
47
|
+
|
|
48
|
+
## Publish a revision
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
DANXBOT_DASHBOARD_URL=https://<your dashboard> DANXBOT_API_KEY=<a key from your own account> npx danx-plugin publish --plugin <key> --note "what changed" [--dir <project>] [--name "Display name"]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`publish` runs the project's own `npm run build`, archives the source (inside a git repo: the tracked files plus untracked ones git does not ignore; otherwise what the top-level `.gitignore` leaves, minus `node_modules`, `.git` and a top-level `dist`; a lockfile is required, so the download builds as is) and uploads both as a new revision of the plugin `<key>`, creating the plugin on its first publish. It prints the revision number and the Settings > Plugins link where a team admin approves it. `.env*` files are never archived, in or out of git. Inside git, a git failure (git missing, a dubious-ownership refusal) stops the publish with git's message; only "not a git repository" means outside git, where the top-level `.gitignore` is honoured (`*`, `?`, `**`, anchoring and trailing `/`; a `!` negation is refused). A blank note is refused first, before the build, the archive or any request. The dashboard validates the upload; a refusal prints its named reason.
|
|
55
|
+
|
|
56
|
+
The same flow is exported for tools as `@danxbot/plugin-sdk/publish` (`buildPlugin`, `archiveSource`, `uploadRevision`, `fetchTransport`): the dashboard MCP's `plugin_publish` tool runs it for agents.
|
|
57
|
+
|
|
58
|
+
## The screenshot on a revision
|
|
59
|
+
|
|
60
|
+
An approver sees a screenshot of the plugin next to each revision. There is nothing to draw by hand: the dashboard MCP's `plugin_publish` tool (not `danx-plugin publish`, which uploads no screenshot) takes it from the plugin's own build. A headless Chromium (Playwright, resolved from your project or the MCP server's working directory) opens the dashboard's public `/plugin-preview` page, which imports your built `CardView` on the app's own React, `@danxbot/ui` and card kit and draws it with an invented sample card; the build is served from memory, so the revision need not be uploaded first. The capture waits until the page itself reports `ready` (or `failed`, with the reason), then saves a 1280x800 PNG as `screenshot.png`, which joins the revision's files and manifest.
|
|
61
|
+
|
|
62
|
+
So a plugin must export a `CardView` for a screenshot to exist. No browser, a dashboard that predates the page, or a plugin that fails to render all publish the revision WITHOUT a screenshot; `plugin_publish` answers `screenshot: "none: <reason>"` with the cause.
|
|
63
|
+
|
|
64
|
+
## Versioning
|
|
65
|
+
|
|
66
|
+
The SDK stays 0.x until the shapes behind the card kit's data types settle: phase 1 of DX-4679 (card types as rows) changes `IssueViewV2.type`, and DX-5164 (designs on any card) changes the design fields. Until then the declarations may change between 0.x releases; the kit's runtime exports follow the `@danxbot/card-kit@1` rule above.
|
package/dist/card-kit.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ declare module "@danxbot/card-kit@1" {
|
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
export { Link, useNavigate } from 'react-router';
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type CardTypeKey = string;
|
|
8
|
+
|
|
8
9
|
type IssueStatus$1 = "Review" | "ToDo" | "In Progress" | "Backlog" | "Done" | "Cancelled";
|
|
9
10
|
type EffortLevelName = "min" | "very_low" | "low" | "medium" | "high" | "very_high" | "max";
|
|
10
11
|
type IssueProblemType = "question" | "action";
|
|
@@ -17,7 +18,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
17
18
|
repo_name: string;
|
|
18
19
|
board_id: string;
|
|
19
20
|
schema_version: number;
|
|
20
|
-
type:
|
|
21
|
+
type: CardTypeKey;
|
|
21
22
|
title: string;
|
|
22
23
|
description: string;
|
|
23
24
|
summary: string | null;
|
|
@@ -389,7 +390,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
389
390
|
interface V2CopyIssue {
|
|
390
391
|
id: string;
|
|
391
392
|
parent_id: string | null;
|
|
392
|
-
type:
|
|
393
|
+
type: CardTypeKey;
|
|
393
394
|
title: string;
|
|
394
395
|
description: string;
|
|
395
396
|
summary: string | null;
|
|
@@ -575,7 +576,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
575
576
|
title: string;
|
|
576
577
|
description?: undefined | string;
|
|
577
578
|
status: "Cancelled" | "Review" | "ToDo" | "In Progress" | "Backlog" | "Done";
|
|
578
|
-
type:
|
|
579
|
+
type: string;
|
|
579
580
|
priority: number;
|
|
580
581
|
id: string;
|
|
581
582
|
parent_id: null | string;
|
|
@@ -606,7 +607,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
606
607
|
list_emoji?: undefined | null | string;
|
|
607
608
|
refs?: undefined | Array<CardRefViewV2>;
|
|
608
609
|
parent_title?: undefined | null | string;
|
|
609
|
-
parent_type?: undefined | null |
|
|
610
|
+
parent_type?: undefined | null | string;
|
|
610
611
|
parent_created_at?: undefined | null | number;
|
|
611
612
|
parent_updated_at?: undefined | null | number;
|
|
612
613
|
parent_blocked?: undefined | null | false | true;
|
|
@@ -718,7 +719,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
718
719
|
id: string;
|
|
719
720
|
name: string;
|
|
720
721
|
status: "Cancelled" | "Review" | "ToDo" | "In Progress" | "Backlog" | "Done";
|
|
721
|
-
type?: undefined |
|
|
722
|
+
type?: undefined | string;
|
|
722
723
|
priority?: undefined | number;
|
|
723
724
|
summary?: undefined | null | string;
|
|
724
725
|
waiting_on: boolean;
|
|
@@ -808,6 +809,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
808
809
|
content_hash: string;
|
|
809
810
|
created_at: string;
|
|
810
811
|
updated_at: string;
|
|
812
|
+
feedback_consent: boolean;
|
|
811
813
|
open: boolean;
|
|
812
814
|
solutions: Array<{
|
|
813
815
|
id: number;
|
|
@@ -1170,7 +1172,7 @@ declare module "@danxbot/card-kit@1" {
|
|
|
1170
1172
|
interface CardFaceModel {
|
|
1171
1173
|
id: string;
|
|
1172
1174
|
title: string;
|
|
1173
|
-
type:
|
|
1175
|
+
type: CardTypeKey;
|
|
1174
1176
|
priority: number;
|
|
1175
1177
|
statusName: IssueStatus$1;
|
|
1176
1178
|
status: CardStatusPresentation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danxbot/plugin-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "SDK for building 50 Arms card-type plugins (DX-5170): the card kit's type declarations, a Vite preset that builds a plugin against the app's shared runtime and writes its manifest, and the danx-plugin CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"test": "vitest run"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@danxbot/ui": "26.
|
|
49
|
+
"@danxbot/ui": "26.20.0",
|
|
50
50
|
"@types/node": "^22.0.0",
|
|
51
51
|
"@types/react": "^19.2.2",
|
|
52
52
|
"esbuild": "^0.25.0",
|