@aiderdesk/extensions 0.6.0 → 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 +60 -14
- package/extensions.json +9 -0
- package/package.json +1 -1
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
|
-
|
|
190
|
-
|
|
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(
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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/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
|
}
|