@danxbot/plugin-sdk 0.2.33 → 0.2.36

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 CHANGED
@@ -25,6 +25,8 @@ import { danxPlugin } from "@danxbot/plugin-sdk/vite";
25
25
  export default defineConfig({ plugins: [danxPlugin()] });
26
26
  ```
27
27
 
28
+ A plugin whose `CardView` is made for particular card types names them: `danxPlugin({ cardTypes: ["Bug"] })`. Each becomes that type's default view once the plugin's revision is approved and active (a team admin's card-view board shows it as "Default" and reverts a type to it); where two plugins name one type, the one activated first wins. The names go into `danx-plugin.json` as `cardTypes`, and the upload refuses a key that is not a card type key or a plugin that exports no `CardView`.
29
+
28
30
  `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
31
 
30
32
  `src/index.tsx` exports `CardView` and/or `CardListView`:
@@ -39,6 +41,8 @@ export function CardView({ card, mutation }: CardViewProps) {
39
41
 
40
42
  `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
43
 
44
+ A plugin styles itself with its own CSS (import a `.css` file; the build emits it as `index.css`) over the design system's runtime tokens such as `var(--surface)` and `var(--accent)`: the app's stylesheet holds only the utility classes the app's own source uses, so a utility class in a plugin may be missing at run time. A plugin changes cards with the kit's writes (`createCard`, `editCard`, `transitionCard`). A list view about one card type reads its cards with `useCardsOfType(scope, type)`, never by filtering `useBoardLaneState`'s lanes: those hold a window of each status, so cards would go missing.
45
+
42
46
  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
47
 
44
48
  ## The card kit is a contract
@@ -583,6 +583,7 @@ declare module "@danxbot/card-kit@1" {
583
583
  interface LiveQueryResult<T> {
584
584
  data: T | null;
585
585
  loading: boolean;
586
+ refreshing?: boolean;
586
587
  error: Error | null;
587
588
  connection: ConnectionState;
588
589
  refetch: () => void;
@@ -1177,6 +1178,18 @@ declare module "@danxbot/card-kit@1" {
1177
1178
 
1178
1179
  type LifecycleAction = Extract<TransitionAction, "ready" | "unready" | "complete" | "cancel" | "reopen">;
1179
1180
 
1181
+ interface CardEditPatch {
1182
+ title?: string;
1183
+ description?: string;
1184
+ summary?: string | null;
1185
+ pull_request_url?: string | null;
1186
+ priority?: number;
1187
+ type?: CardTypeKey;
1188
+ parent_id?: string | null;
1189
+ effort_level?: EffortLevelName;
1190
+ content_hash?: string;
1191
+ }
1192
+ function editCard(id: string, patch: CardEditPatch): Promise<void>;
1180
1193
  function transitionCard(id: string, action: LifecycleAction | "unblock" | "archive"): Promise<void>;
1181
1194
  type PriorityPlacement = {
1182
1195
  side: "after" | "before";
@@ -1213,6 +1226,47 @@ declare module "@danxbot/card-kit@1" {
1213
1226
  run: (key: string, failureTitle: string, op: () => Promise<void>) => Promise<boolean>;
1214
1227
  }
1215
1228
  function useCardMutation(): CardMutation;
1229
+
1230
+ type PlanWire = number | {
1231
+ name: string;
1232
+ } | null;
1233
+
1234
+ interface NewCardInput {
1235
+ board: string;
1236
+ type: CardTypeKey;
1237
+ title: string;
1238
+ priority: number;
1239
+ plan: PlanWire;
1240
+ description: string;
1241
+ }
1242
+ function createCard(input: NewCardInput): Promise<string>;
1243
+
1244
+ interface ChildProgress {
1245
+ done: number;
1246
+ total: number;
1247
+ }
1248
+ interface CardStatusPresentation {
1249
+ label: string;
1250
+ icon: string;
1251
+ reason: string | null;
1252
+ live: boolean;
1253
+ isContainer: boolean;
1254
+ childProgress: ChildProgress | null;
1255
+ }
1256
+ type SnoozePresentation = {
1257
+ active: false;
1258
+ } | {
1259
+ active: true;
1260
+ wakeAt: string;
1261
+ wakeAction: "ready" | "review";
1262
+ };
1263
+ interface GateBreakdownEntry {
1264
+ gate: string;
1265
+ label: string;
1266
+ status: GateVerdict;
1267
+ }
1268
+ const defaultNewCardPriority: () => number;
1269
+ type GateVerdict = QualityGateViewV2["status"];
1216
1270
  type HideableLane = "Cancelled" | "Backlog";
1217
1271
  interface LaneVisibility {
1218
1272
  isShown: (lane: IssueStatus$1) => boolean;
@@ -1249,6 +1303,8 @@ declare module "@danxbot/card-kit@1" {
1249
1303
  }
1250
1304
  function useBoardLaneState(scope: BoardScope): BoardLaneState;
1251
1305
 
1306
+ function useCardsOfType(scope: BoardScope, type: string): LiveQueryResult<readonly IssueViewV2[]>;
1307
+
1252
1308
  function boardCardPath(cardId: string): string;
1253
1309
  function planCardPath(planId: number, cardId: string, planSearch?: string): string;
1254
1310
  function planPathFromCard(planId: number, cardSearch?: string): string;
@@ -1276,32 +1332,6 @@ declare module "@danxbot/card-kit@1" {
1276
1332
  mutation: CardMutation;
1277
1333
  }): react.JSX.Element;
1278
1334
 
1279
- interface ChildProgress {
1280
- done: number;
1281
- total: number;
1282
- }
1283
- interface CardStatusPresentation {
1284
- label: string;
1285
- icon: string;
1286
- reason: string | null;
1287
- live: boolean;
1288
- isContainer: boolean;
1289
- childProgress: ChildProgress | null;
1290
- }
1291
- type SnoozePresentation = {
1292
- active: false;
1293
- } | {
1294
- active: true;
1295
- wakeAt: string;
1296
- wakeAction: "ready" | "review";
1297
- };
1298
- interface GateBreakdownEntry {
1299
- gate: string;
1300
- label: string;
1301
- status: GateVerdict;
1302
- }
1303
- type GateVerdict = QualityGateViewV2["status"];
1304
-
1305
1335
  interface ProblemAttention {
1306
1336
  problem: ProblemViewV2;
1307
1337
  solutions: SolutionViewV2[];
@@ -1527,6 +1557,6 @@ declare module "@danxbot/card-kit@1" {
1527
1557
  readonly cardPath: (cardId: string) => string;
1528
1558
  }
1529
1559
 
1530
- export { ActivityTab, AttachmentsTab, AttentionZone, CardActionsMenu, CardBoard, CardFace, CardLink, ChecklistsSection, ChildrenSection, DependenciesSection, EditableContext, EditableSummary, EditableTitle, EffortControl, GatesSection, ParentField, PlansField, PriorityControl, ProblemsSection, RetroTab, StandardCardPage, StatusControl, TypeControl, WorkStateControl, boardCardPath, planCardPath, planPathFromCard, requestBoardMove, transitionCard, useAttachmentActions, useBoardLaneState, useIssueDetail as useCard, useCardMutation };
1531
- export type { AttachmentActions, BoardLaneState, BoardMoveResult, BoardScope, CardFaceProps, CardListViewProps, CardMutation, CardViewProps, IssueViewV2, LaneMoveRequest, LiveQueryResult, StandardCardPageProps };
1560
+ export { ActivityTab, AttachmentsTab, AttentionZone, CardActionsMenu, CardBoard, CardFace, CardLink, ChecklistsSection, ChildrenSection, DependenciesSection, EditableContext, EditableSummary, EditableTitle, EffortControl, GatesSection, ParentField, PlansField, PriorityControl, ProblemsSection, RetroTab, StandardCardPage, StatusControl, TypeControl, WorkStateControl, boardCardPath, createCard, defaultNewCardPriority, editCard, planCardPath, planPathFromCard, requestBoardMove, transitionCard, useAttachmentActions, useBoardLaneState, useIssueDetail as useCard, useCardMutation, useCardsOfType };
1561
+ export type { AttachmentActions, BoardLaneState, BoardMoveResult, BoardScope, CardEditPatch, CardFaceProps, CardListViewProps, CardMutation, CardViewProps, IssueViewV2, LaneMoveRequest, LiveQueryResult, NewCardInput, StandardCardPageProps };
1532
1562
  }
package/dist/publish.d.ts CHANGED
@@ -27,6 +27,12 @@ interface PluginManifest {
27
27
  readonly screenshot?: string;
28
28
  /** Each shared library's major the plugin was built against (`PLUGIN_RUNTIME_LIBRARIES`), compared with what the app serves. */
29
29
  readonly runtime: Readonly<Record<string, number>>;
30
+ /**
31
+ * DX-6178: the card types the plugin's `CardView` is made for (card type keys, e.g. `["Bug"]`); absent when it is made for none. Each is that type's DEFAULT view
32
+ * while the plugin's active revision is approved and exports `CardView`: the admin's card-view board shows it as the type's "Default" and reverts to it.
33
+ * Where two plugins declare one type, the one activated first wins (`plugins.activated_at`).
34
+ */
35
+ readonly cardTypes?: readonly string[];
30
36
  /** DX-5282: which view modules the entry exports (`PLUGIN_VIEW_EXPORTS`), recorded at build from the entry chunk's real exports; never empty. */
31
37
  readonly exports: readonly PluginViewExport[];
32
38
  readonly files: readonly PluginManifestFile[];
package/dist/vite.d.ts CHANGED
@@ -5,6 +5,11 @@ declare const PLUGIN_ENTRY_FILE = "index.js";
5
5
  interface DanxPluginOptions {
6
6
  /** The module exporting `CardView` and/or `CardListView`, relative to the project root. */
7
7
  readonly entry?: string;
8
+ /**
9
+ * DX-6178: the card types the plugin's `CardView` is made for (card type keys, e.g. `["Bug"]`). Each becomes that type's DEFAULT view once the plugin's revision is approved
10
+ * and active, and the team can always set the type back to it. Leave it out for a plugin made for no particular type.
11
+ */
12
+ readonly cardTypes?: readonly string[];
8
13
  }
9
14
  /**
10
15
  * The Vite preset for a 50 Arms card-type plugin: an ES-module library build whose output the app loads with `import()`.
package/dist/vite.js CHANGED
@@ -49,7 +49,7 @@ function describeFile(root, file) {
49
49
  sha256: createHash("sha256").update(bytes).digest("hex")
50
50
  };
51
51
  }
52
- function buildManifest(outDir, entry, exports) {
52
+ function buildManifest(outDir, entry, exports, cardTypes = []) {
53
53
  const files = filesUnder(outDir).map((file) => describeFile(outDir, file)).filter((file) => file.path !== PLUGIN_MANIFEST_FILE);
54
54
  if (!files.some((file) => file.path === entry)) throw new Error(`danx-plugin: the build produced no entry module ${entry} in ${outDir}`);
55
55
  return {
@@ -57,11 +57,13 @@ function buildManifest(outDir, entry, exports) {
57
57
  styles: files.filter((file) => file.path.endsWith(".css")).map((file) => file.path),
58
58
  runtime: pluginRuntimeContract().majors,
59
59
  exports: [...exports],
60
+ // DX-6178: the card types the plugin's card view is made for, written only when the author named some.
61
+ ...cardTypes.length === 0 ? {} : { cardTypes: [...cardTypes] },
60
62
  files
61
63
  };
62
64
  }
63
- function writeManifest(outDir, entry, exports) {
64
- const manifest = buildManifest(outDir, entry, exports);
65
+ function writeManifest(outDir, entry, exports, cardTypes = []) {
66
+ const manifest = buildManifest(outDir, entry, exports, cardTypes);
65
67
  writeFileSync(join(outDir, PLUGIN_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
66
68
  `);
67
69
  return manifest;
@@ -120,9 +122,9 @@ function danxPlugin(options = {}) {
120
122
  }
121
123
  }
122
124
  },
123
- writeBundle(options2) {
124
- if (options2.dir === void 0) throw new Error("danx-plugin: the build has no output directory to write the manifest into");
125
- writeManifest(options2.dir, PLUGIN_ENTRY_FILE, viewExports);
125
+ writeBundle(output) {
126
+ if (output.dir === void 0) throw new Error("danx-plugin: the build has no output directory to write the manifest into");
127
+ writeManifest(output.dir, PLUGIN_ENTRY_FILE, viewExports, options.cardTypes ?? []);
126
128
  }
127
129
  };
128
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/plugin-sdk",
3
- "version": "0.2.33",
3
+ "version": "0.2.36",
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": "28.4.0",
49
+ "@danxbot/ui": "28.5.1",
50
50
  "@types/node": "^22.0.0",
51
51
  "@types/react": "^19.2.2",
52
52
  "esbuild": "^0.25.0",