@aiderdesk/extensions 0.5.1 → 0.7.0

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/dist/cli.js CHANGED
@@ -117,6 +117,36 @@ async function loadExtensions() {
117
117
  process.exit(1);
118
118
  }
119
119
  }
120
+ function getCloneUrl(webUrl) {
121
+ try {
122
+ const url = new URL(webUrl);
123
+ if (url.hostname !== "github.com") {
124
+ return null;
125
+ }
126
+ const pathParts = url.pathname.split("/").filter(Boolean);
127
+ if (pathParts.length < 2) {
128
+ return null;
129
+ }
130
+ const owner = pathParts[0];
131
+ const repo = pathParts[1];
132
+ return `https://github.com/${owner}/${repo}.git`;
133
+ } catch {
134
+ return null;
135
+ }
136
+ }
137
+ function getExtensionsPath(repoUrl) {
138
+ try {
139
+ const url = new URL(repoUrl);
140
+ const pathParts = url.pathname.split("/").filter(Boolean);
141
+ if (pathParts.length > 4 && pathParts[2] === "tree") {
142
+ const extensionPath = pathParts.slice(4).join("/");
143
+ return extensionPath;
144
+ }
145
+ return null;
146
+ } catch {
147
+ return null;
148
+ }
149
+ }
120
150
  function getInstallDirectory(options) {
121
151
  if (options.directory) {
122
152
  return options.directory;
@@ -185,13 +215,18 @@ Installing ${ext.name} to: ${targetDir}
185
215
  } else {
186
216
  spinner.text = `Downloading ${ext.name} from GitHub...`;
187
217
  const tempDir = join(process.cwd(), `.temp-ext-${Date.now()}`);
218
+ const extensionPath = `packages/extensions/extensions/${ext.folder}`;
188
219
  try {
189
- await runCommand("git", ["clone", "--depth", "1", GITHUB_REPO, tempDir]);
190
- const sourceDir = join(tempDir, "packages", "extensions", "extensions", ext.folder);
220
+ spinner.text = "Cloning repository with sparse checkout...";
221
+ await runCommand("git", ["clone", "--depth", "1", "--sparse", GITHUB_REPO, tempDir]);
222
+ spinner.text = "Configuring sparse checkout path...";
223
+ await runCommand("git", ["-C", tempDir, "sparse-checkout", "set", extensionPath]);
224
+ const sourceDir = join(tempDir, extensionPath);
191
225
  const targetPath = join(targetDir, ext.folder);
192
226
  if (!existsSync(sourceDir)) {
193
- throw new Error("Extension folder not found in repository");
227
+ throw new Error(`Extension folder not found in repository: ${extensionPath}`);
194
228
  }
229
+ spinner.text = "Copying extension files...";
195
230
  cpSync(sourceDir, targetPath, { recursive: true });
196
231
  spinner.succeed(chalk.green(`\u2713 Installed ${ext.name} from GitHub`));
197
232
  if (existsSync(join(targetPath, "package.json"))) {
@@ -233,20 +268,31 @@ async function installFromUrl(url, targetDir) {
233
268
  } else {
234
269
  spinner.text = "Downloading extension folder...";
235
270
  if (url.includes("github.com")) {
271
+ const cloneUrl = getCloneUrl(url);
272
+ const extensionsPath = getExtensionsPath(url);
273
+ if (!cloneUrl) {
274
+ throw new Error("Invalid GitHub URL - could not extract repository URL");
275
+ }
276
+ if (!extensionsPath) {
277
+ throw new Error("Invalid GitHub URL - could not extract extension path from URL");
278
+ }
279
+ const extName = urlPath.split("/").pop() || "extension";
236
280
  const tempDir = join(process.cwd(), `.temp-ext-${Date.now()}`);
237
281
  try {
238
- await runCommand("git", ["clone", "--depth", "1", url, tempDir]);
239
- const extName = urlPath.split("/").pop() || "extension";
240
- const sourceDir = join(tempDir, extName);
282
+ spinner.text = "Cloning repository with sparse checkout...";
283
+ await runCommand("git", ["clone", "--depth", "1", "--sparse", cloneUrl, tempDir]);
284
+ spinner.text = "Configuring sparse checkout path...";
285
+ await runCommand("git", ["-C", tempDir, "sparse-checkout", "set", extensionsPath]);
286
+ const sourceDir = join(tempDir, extensionsPath);
241
287
  const targetPath = join(targetDir, extName);
242
- if (existsSync(sourceDir)) {
243
- cpSync(sourceDir, targetPath, { recursive: true });
244
- spinner.succeed(chalk.green(`\u2713 Installed ${extName} to ${targetDir}`));
245
- if (existsSync(join(targetPath, "package.json"))) {
246
- await installDependencies(targetPath);
247
- }
248
- } else {
249
- throw new Error("Extension folder not found in repository");
288
+ if (!existsSync(sourceDir)) {
289
+ throw new Error(`Extension folder not found in repository: ${extensionsPath}`);
290
+ }
291
+ spinner.text = "Copying extension files...";
292
+ cpSync(sourceDir, targetPath, { recursive: true });
293
+ spinner.succeed(chalk.green(`\u2713 Installed ${extName} to ${targetDir}`));
294
+ if (existsSync(join(targetPath, "package.json"))) {
295
+ await installDependencies(targetPath);
250
296
  }
251
297
  } finally {
252
298
  if (existsSync(tempDir)) {
package/dist/index.d.ts CHANGED
@@ -343,6 +343,8 @@ export interface UpdatedFile {
343
343
  additions: number;
344
344
  deletions: number;
345
345
  diff?: string;
346
+ commitHash?: string;
347
+ commitMessage?: string;
346
348
  }
347
349
  export interface CommandsData {
348
350
  baseDir: string;
@@ -695,6 +697,8 @@ export interface CreateTaskParams {
695
697
  sendEvent?: boolean;
696
698
  provider?: string;
697
699
  model?: string;
700
+ mode?: Mode;
701
+ addInitialContextFiles?: boolean;
698
702
  }
699
703
  export interface TodoItem {
700
704
  name: string;
@@ -774,6 +778,14 @@ export interface ToolResult {
774
778
  /** Mark result as error */
775
779
  isError?: boolean;
776
780
  }
781
+ /**
782
+ * Definition of a tool that is part of the tool set. This tool can be executed internally by extension, but it won't be propagated to UI.
783
+ *
784
+ * @execute - Optional execute function. If not provided, the tool has other unsupported means of execution.
785
+ */
786
+ export interface Tool {
787
+ execute?: (input: Record<string, unknown>) => Promise<unknown>;
788
+ }
777
789
  /**
778
790
  * Definition of a tool that can be registered by an extension
779
791
  *
@@ -800,7 +812,7 @@ export interface ToolDefinition<TSchema extends z.ZodType = z.ZodType<Record<str
800
812
  /** Zod schema for parameter validation */
801
813
  inputSchema: TSchema;
802
814
  /** Execute function with type-safe args */
803
- execute: (input: z.infer<TSchema>, signal: AbortSignal | undefined, context: ExtensionContext) => Promise<unknown>;
815
+ execute: (input: z.infer<TSchema>, signal: AbortSignal | undefined, context: ExtensionContext, allTools: Record<string, Tool>) => Promise<unknown>;
804
816
  }
805
817
  /** UI element types */
806
818
  export type UIElementType = "action-button" | "status-indicator" | "badge";
package/extensions.d.ts CHANGED
@@ -343,6 +343,8 @@ export interface UpdatedFile {
343
343
  additions: number;
344
344
  deletions: number;
345
345
  diff?: string;
346
+ commitHash?: string;
347
+ commitMessage?: string;
346
348
  }
347
349
  export interface CommandsData {
348
350
  baseDir: string;
@@ -695,6 +697,8 @@ export interface CreateTaskParams {
695
697
  sendEvent?: boolean;
696
698
  provider?: string;
697
699
  model?: string;
700
+ mode?: Mode;
701
+ addInitialContextFiles?: boolean;
698
702
  }
699
703
  export interface TodoItem {
700
704
  name: string;
@@ -774,6 +778,14 @@ export interface ToolResult {
774
778
  /** Mark result as error */
775
779
  isError?: boolean;
776
780
  }
781
+ /**
782
+ * Definition of a tool that is part of the tool set. This tool can be executed internally by extension, but it won't be propagated to UI.
783
+ *
784
+ * @execute - Optional execute function. If not provided, the tool has other unsupported means of execution.
785
+ */
786
+ export interface Tool {
787
+ execute?: (input: Record<string, unknown>) => Promise<unknown>;
788
+ }
777
789
  /**
778
790
  * Definition of a tool that can be registered by an extension
779
791
  *
@@ -800,7 +812,7 @@ export interface ToolDefinition<TSchema extends z.ZodType = z.ZodType<Record<str
800
812
  /** Zod schema for parameter validation */
801
813
  inputSchema: TSchema;
802
814
  /** Execute function with type-safe args */
803
- execute: (input: z.infer<TSchema>, signal: AbortSignal | undefined, context: ExtensionContext) => Promise<unknown>;
815
+ execute: (input: z.infer<TSchema>, signal: AbortSignal | undefined, context: ExtensionContext, allTools: Record<string, Tool>) => Promise<unknown>;
804
816
  }
805
817
  /** UI element types */
806
818
  export type UIElementType = "action-button" | "status-indicator" | "badge";
package/extensions.json CHANGED
@@ -151,6 +151,15 @@
151
151
  "type": "folder",
152
152
  "hasDependencies": true,
153
153
  "capabilities": ["onLoad", "onUnload", "onProjectStarted", "onProjectStopped", "getTools", "onToolFinished"]
154
+ },
155
+ {
156
+ "id": "plannotator",
157
+ "name": "Plannotator",
158
+ "description": "Plan-based development workflow with visual review",
159
+ "folder": "plannotator",
160
+ "type": "folder",
161
+ "hasDependencies": true,
162
+ "capabilities": ["onLoad", "onAgentStarted", "onToolCalled", "onToolApproval"]
154
163
  }
155
164
  ]
156
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiderdesk/extensions",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Type definitions and examples for AiderDesk extensions",
5
5
  "author": "Hotovo",
6
6
  "homepage": "https://aiderdesk.hotovo.com",