wings-plugin-sdk 0.10.0 → 0.11.1

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.
Files changed (3) hide show
  1. package/build.mjs +1 -1
  2. package/package.json +1 -1
  3. package/wings.d.ts +16 -6
package/build.mjs CHANGED
@@ -133,7 +133,7 @@ export async function buildPlugin(dir, { check = false, banner = BANNER, outDir
133
133
  }
134
134
 
135
135
  /** Files at the top of a plugin folder that are for building it, not for Wings. */
136
- const SOURCE_ONLY = /^(src|node_modules|package(-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|tsconfig.*\.json|README.*|HANDOVER.*|.*\.wings-plugin)$/;
136
+ const SOURCE_ONLY = /^(src|preview|node_modules|package(-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|tsconfig.*\.json|README.*|HANDOVER.*|.*\.wings-plugin)$/;
137
137
 
138
138
  /** Copies what the plugin ships from `from` to `to`: everything but its source, dependencies and dotfiles. */
139
139
  function copyShipped(from, to, top = true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "The wings API types, the page frame, React hooks and the build command for Wings plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/wings.d.ts CHANGED
@@ -41,6 +41,14 @@ interface WingsBadge {
41
41
  actions?: { id: string; label: string; primary?: boolean }[];
42
42
  }
43
43
 
44
+ /** Where the diff viewer scrolls to and highlights once the patch is shown. A path or line the patch doesn't have just opens the diff. */
45
+ interface WingsDiffFocus {
46
+ path: string;
47
+ line?: number;
48
+ /** `new` (the default) counts lines after the change, `old` before it. */
49
+ side?: "old" | "new";
50
+ }
51
+
44
52
  interface WingsComment {
45
53
  id: number;
46
54
  replyTo: number | null;
@@ -145,7 +153,7 @@ interface Wings {
145
153
  * is sent back as a failed call. `paneId` is the Wings pane Claude runs in, or `null`. Register it in `main`.
146
154
  */
147
155
  onTool(name: string, handler: (input: Record<string, unknown>, context: { paneId: string | null }) => unknown): void;
148
- /** Runs a command from `permissions.exec`, like `git branch --show-current`. */
156
+ /** Runs a command from `permissions.exec`, like `git branch --show-current`. Rejects with `Output is larger than 8 MB` (and kills the program) when stdout or stderr passes 8 MB. */
149
157
  exec(program: string, args?: string[], options?: WingsExecOptions): Promise<{ code: number | null; stdout: string; stderr: string }>;
150
158
  /**
151
159
  * Needs `permissions.statusline`. What Claude Code last told its status line, once `wings statusline` is your
@@ -184,12 +192,12 @@ interface Wings {
184
192
  * Resolves true once the install started (or it's already installed), false if you cancelled.
185
193
  */
186
194
  installTool(program: "az" | "gh" | "glab"): Promise<boolean>;
187
- /** Needs `permissions.notify`. A desktop notification, up to 3 a minute. The title is cut at 64 characters, the body at 256. */
195
+ /** Needs `permissions.notify`. A desktop notification, up to 20 a minute. The title is cut at 64 characters, the body at 256. */
188
196
  notify(notification: { title: string; body?: string }): Promise<void>;
189
197
  /** Needs `"diff"` in `contributes.ui`. Leave out `patch` to open it loading, then call `updateDiff`. */
190
- openDiff(diff: { title: string; subtitle?: string; /** The repo or folder the diff is of, so Send to agent offers the agent working there first. */ cwd?: string; patch?: string; comments?: WingsComment[] }): Promise<{ id: string }>;
198
+ openDiff(diff: { title: string; subtitle?: string; /** The repo or folder the diff is of, so Send to agent offers the agent working there first. */ cwd?: string; patch?: string; comments?: WingsComment[]; focus?: WingsDiffFocus }): Promise<{ id: string }>;
191
199
  /** Updates a viewer opened with `openDiff`; ignored once it's closed. `{ comments }` alone keeps the patch, like after a reply. */
192
- updateDiff(id: string, update: { patch: string; comments?: WingsComment[] } | { comments: WingsComment[] } | { error: string }): Promise<void>;
200
+ updateDiff(id: string, update: { patch: string; comments?: WingsComment[]; focus?: WingsDiffFocus } | { comments: WingsComment[]; focus?: WingsDiffFocus } | { error: string }): Promise<void>;
193
201
  /**
194
202
  * Needs `"diff"` in `contributes.ui`. A reply typed under a comment with `canReply` in the diff viewer. Post it,
195
203
  * then add it with `updateDiff`. The reply box waits for the returned promise, and a thrown error shows under it
@@ -198,7 +206,8 @@ interface Wings {
198
206
  onReply(handler: (reply: WingsReply) => unknown): void;
199
207
  /**
200
208
  * POSTs `fields` (string or whole-number values, up to 64 KB) as JSON to a `permissions.post` path, as you:
201
- * `gh api`, `glab api` against `host`, or `az rest` for Azure DevOps. Wings builds the command itself.
209
+ * `gh api` (against `host` for a GitHub Enterprise Server), `glab api` against `host`, or `az rest` for Azure
210
+ * DevOps. Wings builds the command itself. A manifest entry may pin a field, like `{event=APPROVE}`.
202
211
  */
203
212
  post(
204
213
  program: "gh" | "glab" | "az",
@@ -207,7 +216,8 @@ interface Wings {
207
216
  options?: { host?: string },
208
217
  ): Promise<{ code: number | null; stdout: string; stderr: string }>;
209
218
  /**
210
- * An HTTP request to a URL under `permissions.fetch`, made by Wings. `bearer` names a secret that Wings sends
219
+ * An HTTP request to a URL under `permissions.fetch`, made by Wings. An entry may be `GET <prefix>`, or
220
+ * `POST <url with * segments>` (optionally `{field=value}`) for one write with a JSON `body`. `bearer` names a secret that Wings sends
211
221
  * as `Authorization: Bearer <secret>`. Resolves for any status; redirects aren't followed.
212
222
  */
213
223
  fetch(