@aiderdesk/extensions 0.1.0 → 0.3.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/README.md CHANGED
@@ -44,21 +44,22 @@ For comprehensive documentation on creating and using extensions, see the [Exten
44
44
 
45
45
  | Extension | Description | Extension Functions |
46
46
  |-----------|-------------|---------------------|
47
- | **[theme.ts](./theme.ts)** | Adds `/theme` command to switch AiderDesk themes | `onLoad`, `getCommands` |
48
- | **[sound-notification.ts](./sound-notification.ts)** | Plays a "Jobs Done" sound when a prompt finishes | `onLoad`, `onPromptFinished` |
49
- | **[protected-paths.ts](./protected-paths.ts)** | Blocks file operations on protected paths (`.env`, `.git/`, `node_modules/`) | `onLoad`, `onToolCalled` |
50
- | **[plan-mode.ts](./plan-mode.ts)** | Adds a Plan mode that enforces planning before coding | `onLoad`, `getModes`, `onAgentStarted` |
51
- | **[pirate.ts](./pirate.ts)** | Adds a Pirate agent that speaks like a swashbuckling sea dog | `onLoad`, `getAgents`, `onAgentProfileUpdated` |
52
- | **[permission-gate.ts](./permission-gate.ts)** | Prompts for confirmation before running dangerous bash commands (`rm -rf`, `sudo`, `chmod/chown 777`) | `onLoad`, `onToolCalled` |
53
- | **[generate-tests.ts](./generate-tests.ts)** | Adds `/generate-tests` command to generate unit tests for files | `onLoad`, `getCommands` |
54
- | **[sandbox/](./sandbox/)** | OS-level sandboxing for bash commands using `@anthropic-ai/sandbox-runtime` | `onLoad`, `onUnload`, `onTaskInitialized`, `onTaskClosed`, `onToolCalled` |
55
- | **[rtk/](./rtk/)** | Transparently rewrites shell commands to RTK equivalents, reducing LLM token consumption by 60-90% | `onLoad`, `getCommands`, `onToolCalled` |
56
- | **[chunkhound-search/](./chunkhound-search/)** | Provides `chunkhound-search` tool using ChunkHound for semantic code search | `onLoad`, `onUnload`, `onProjectOpen`, `onToolFinished`, `getTools` |
57
- | **[chunkhound-on-semantic-search-tool/](./chunkhound-on-semantic-search-tool/)** | Overrides `power---semantic_search` to use ChunkHound for better semantic understanding | `onLoad`, `onUnload`, `onProjectOpen`, `onToolCalled`, `onToolFinished` |
58
- | **[wakatime.ts](./wakatime.ts)** | Tracks coding activity by sending heartbeats to WakaTime via wakatime-cli | `onLoad`, `onPromptStarted`, `onPromptFinished`, `onToolFinished`, `onFilesAdded` |
59
- | **[redact-secrets/](./redact-secrets/)** | Redacts secret values from `.env*` files in file read results | `onLoad`, `onProjectOpen`, `onToolFinished` |
60
- | **[external-rules.ts](./external-rules.ts)** | Includes rule files from Cursor, Claude Code, and Roo Code configurations | `onLoad`, `onRuleFilesRetrieved` |
61
- | **[ultrathink.ts](./ultrathink.ts)** | Detects prompts like "ultrathink" / "think hard" and increases OpenAI/OpenAI-compatible reasoning effort (`xhigh` for `-max` models, otherwise `high`) | `onLoad`, `onAgentStarted` |
47
+ | **[theme.ts](./extensions/theme.ts)** | Adds `/theme` command to switch AiderDesk themes | `onLoad`, `getCommands` |
48
+ | **[sound-notification.ts](./extensions/sound-notification.ts)** | Plays a "Jobs Done" sound when a prompt finishes | `onLoad`, `onPromptFinished` |
49
+ | **[protected-paths.ts](./extensions/protected-paths.ts)** | Blocks file operations on protected paths (`.env`, `.git/`, `node_modules/`) | `onLoad`, `onToolCalled` |
50
+ | **[plan-mode.ts](./extensions/plan-mode.ts)** | Adds a Plan mode that enforces planning before coding | `onLoad`, `getModes`, `onAgentStarted` |
51
+ | **[pirate.ts](./extensions/pirate.ts)** | Adds a Pirate agent that speaks like a swashbuckling sea dog | `onLoad`, `getAgents`, `onAgentProfileUpdated` |
52
+ | **[permission-gate.ts](./extensions/permission-gate.ts)** | Prompts for confirmation before running dangerous bash commands (`rm -rf`, `sudo`, `chmod/chown 777`) | `onLoad`, `onToolCalled` |
53
+ | **[generate-tests.ts](./extensions/generate-tests.ts)** | Adds `/generate-tests` command to generate unit tests for files | `onLoad`, `getCommands` |
54
+ | **[sandbox/](./extensions/sandbox/)** | OS-level sandboxing for bash commands using `@anthropic-ai/sandbox-runtime` | `onLoad`, `onUnload`, `onTaskInitialized`, `onTaskClosed`, `onToolCalled` |
55
+ | **[rtk/](./extensions/rtk/)** | Transparently rewrites shell commands to RTK equivalents, reducing LLM token consumption by 60-90% | `onLoad`, `getCommands`, `onToolCalled` |
56
+ | **[chunkhound-search/](./extensions/chunkhound-search/)** | Provides `chunkhound-search` tool using ChunkHound for semantic code search | `onLoad`, `onUnload`, `onProjectOpen`, `onToolFinished`, `getTools` |
57
+ | **[chunkhound-on-semantic-search-tool/](./extensions/chunkhound-on-semantic-search-tool/)** | Overrides `power---semantic_search` to use ChunkHound for better semantic understanding | `onLoad`, `onUnload`, `onProjectOpen`, `onToolCalled`, `onToolFinished` |
58
+ | **[wakatime.ts](./extensions/wakatime.ts)** | Tracks coding activity by sending heartbeats to WakaTime via wakatime-cli | `onLoad`, `onPromptStarted`, `onPromptFinished`, `onToolFinished`, `onFilesAdded` |
59
+ | **[redact-secrets/](./extensions/redact-secrets/)** | Redacts secret values from `.env*` files in file read results | `onLoad`, `onProjectOpen`, `onToolFinished` |
60
+ | **[external-rules.ts](./extensions/external-rules.ts)** | Includes rule files from Cursor, Claude Code, and Roo Code configurations | `onLoad`, `onRuleFilesRetrieved` |
61
+ | **[lsp/](./extensions/lsp/)** | LSP integration for automatic error detection after file edits and code intelligence tools (find references) | `onLoad`, `onUnload`, `getTools`, `onProjectStarted`, `onProjectStopped`, `onToolFinished` |
62
+ | **[ultrathink.ts](./extensions/ultrathink.ts)** | Detects prompts like "ultrathink" / "think hard" and increases OpenAI/OpenAI-compatible reasoning effort (`xhigh` for `-max` models, otherwise `high`) | `onLoad`, `onAgentStarted` |
62
63
 
63
64
  ## Quick Start
64
65
 
@@ -77,10 +78,10 @@ Copy the extension file(s) to your AiderDesk extensions directory:
77
78
 
78
79
  ```bash
79
80
  # Global extensions (available to all projects)
80
- cp sound-notification.ts ~/.aider-desk/extensions/
81
+ cp extensions/sound-notification.ts ~/.aider-desk/extensions/
81
82
 
82
83
  # Project-specific extensions
83
- cp sound-notification.ts .aider-desk/extensions/
84
+ cp extensions/sound-notification.ts .aider-desk/extensions/
84
85
  ```
85
86
 
86
87
  ### 3. Hot Reload
package/dist/cli.js CHANGED
@@ -4,22 +4,116 @@ import { createRequire } from "node:module";
4
4
  import { dirname, join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { homedir } from "node:os";
7
- import { existsSync, mkdirSync, cpSync, writeFileSync, rmSync } from "node:fs";
7
+ import { existsSync, mkdirSync, cpSync, writeFileSync, rmSync, readFileSync } from "node:fs";
8
8
  import { spawn } from "node:child_process";
9
9
  import { Command } from "commander";
10
- import { checkbox, confirm } from "@inquirer/prompts";
10
+ import { checkbox } from "@inquirer/prompts";
11
11
  import chalk from "chalk";
12
12
  import ora from "ora";
13
13
  var require2 = createRequire(import.meta.url);
14
14
  var __filename = fileURLToPath(import.meta.url);
15
15
  var __dirname = dirname(__filename);
16
- var EXAMPLES_JSON_PATH = join(__dirname, "..", "examples.json");
16
+ var EXTENSIONS_JSON_PATH = join(__dirname, "..", "extensions.json");
17
+ var EXTENSIONS_DIR = join(__dirname, "..", "extensions");
17
18
  var PACKAGE_VERSION = require2("../package.json").version;
18
- function loadExamples() {
19
+ var CACHE_FILE = join(homedir(), ".aider-desk", "extension-cache.json");
20
+ var CACHE_TTL = 60 * 60 * 1e3;
21
+ var GITHUB_API_URL = "https://api.github.com/repos/hotovo/aider-desk/contents/packages/extensions/extensions";
22
+ function loadFromCache() {
19
23
  try {
20
- return require2(EXAMPLES_JSON_PATH);
21
- } catch (error) {
22
- console.error(chalk.red("Error: Could not load examples.json"));
24
+ if (!existsSync(CACHE_FILE)) {
25
+ return null;
26
+ }
27
+ const cacheContent = readFileSync(CACHE_FILE, "utf-8");
28
+ const cache = JSON.parse(cacheContent);
29
+ if (Date.now() - cache.timestamp < CACHE_TTL) {
30
+ return cache;
31
+ }
32
+ return null;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ function saveToCache(extensions) {
38
+ try {
39
+ const cacheDir = dirname(CACHE_FILE);
40
+ if (!existsSync(cacheDir)) {
41
+ mkdirSync(cacheDir, { recursive: true });
42
+ }
43
+ const cacheData = {
44
+ timestamp: Date.now(),
45
+ extensions
46
+ };
47
+ writeFileSync(CACHE_FILE, JSON.stringify(cacheData, null, 2), "utf-8");
48
+ } catch {
49
+ }
50
+ }
51
+ function loadLocalExtensionsMap() {
52
+ try {
53
+ const localConfig = require2(EXTENSIONS_JSON_PATH);
54
+ const map = /* @__PURE__ */ new Map();
55
+ localConfig.extensions.forEach((ext) => {
56
+ map.set(ext.id, ext);
57
+ });
58
+ return map;
59
+ } catch {
60
+ return /* @__PURE__ */ new Map();
61
+ }
62
+ }
63
+ async function fetchExtensions() {
64
+ try {
65
+ const response = await fetch(GITHUB_API_URL, {
66
+ headers: {
67
+ "User-Agent": "aiderdesk-extensions-cli"
68
+ }
69
+ });
70
+ if (!response.ok) {
71
+ return null;
72
+ }
73
+ const contents = await response.json();
74
+ const localExtensionsMap = loadLocalExtensionsMap();
75
+ const extensions = contents.filter((item) => item.type === "file" || item.type === "dir").filter((item) => {
76
+ if (item.type === "file") {
77
+ return item.name.endsWith(".ts") || item.name.endsWith(".js");
78
+ }
79
+ return true;
80
+ }).map((item) => {
81
+ const isFile = item.type === "file";
82
+ const id = isFile ? item.name.replace(/\.(ts|js)$/, "") : item.name;
83
+ const localExt = localExtensionsMap.get(id);
84
+ if (localExt) {
85
+ return localExt;
86
+ }
87
+ const name = id.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
88
+ return {
89
+ id,
90
+ name,
91
+ description: "",
92
+ type: isFile ? "single" : "folder",
93
+ file: isFile ? item.name : void 0,
94
+ folder: isFile ? void 0 : item.name,
95
+ capabilities: []
96
+ };
97
+ });
98
+ return extensions;
99
+ } catch {
100
+ return null;
101
+ }
102
+ }
103
+ async function loadExtensions() {
104
+ const dynamicExtensions = await fetchExtensions();
105
+ if (dynamicExtensions && dynamicExtensions.length > 0) {
106
+ saveToCache(dynamicExtensions);
107
+ return { extensions: dynamicExtensions };
108
+ }
109
+ const cachedData = loadFromCache();
110
+ if (cachedData && cachedData.extensions.length > 0) {
111
+ return { extensions: cachedData.extensions };
112
+ }
113
+ try {
114
+ return require2(EXTENSIONS_JSON_PATH);
115
+ } catch {
116
+ console.error(chalk.red("Error: Could not load extensions from any source"));
23
117
  process.exit(1);
24
118
  }
25
119
  }
@@ -57,11 +151,10 @@ Installing ${ext.name} to: ${targetDir}
57
151
  `));
58
152
  const spinner = ora(`Installing ${ext.name}...`).start();
59
153
  try {
60
- const packageDir = join(__dirname, "..");
61
- const GITHUB_RAW_BASE = "https://raw.githubusercontent.com/hotovo/aider-desk/main/packages/extensions";
154
+ const GITHUB_RAW_BASE = "https://raw.githubusercontent.com/hotovo/aider-desk/main/packages/extensions/extensions";
62
155
  const GITHUB_REPO = "https://github.com/hotovo/aider-desk";
63
156
  if (ext.type === "single" && ext.file) {
64
- const localPath = join(packageDir, ext.file);
157
+ const localPath = join(EXTENSIONS_DIR, ext.file);
65
158
  if (existsSync(localPath)) {
66
159
  spinner.text = `Copying ${ext.name} from package...`;
67
160
  const targetPath = join(targetDir, ext.file);
@@ -80,41 +173,29 @@ Installing ${ext.name} to: ${targetDir}
80
173
  spinner.succeed(chalk.green(`\u2713 Installed ${ext.name} from GitHub`));
81
174
  }
82
175
  } else if (ext.type === "folder" && ext.folder) {
83
- const localPath = join(packageDir, ext.folder);
176
+ const localPath = join(EXTENSIONS_DIR, ext.folder);
84
177
  if (existsSync(localPath)) {
85
178
  spinner.text = `Copying ${ext.name} from package...`;
86
179
  const targetPath = join(targetDir, ext.folder);
87
180
  cpSync(localPath, targetPath, { recursive: true });
88
181
  spinner.succeed(chalk.green(`\u2713 Installed ${ext.name}`));
89
- if (ext.hasDependencies && existsSync(join(targetPath, "package.json"))) {
90
- const installDeps = await confirm({
91
- message: `${ext.name} has dependencies. Install them now?`,
92
- default: true
93
- });
94
- if (installDeps) {
95
- await installDependencies(targetPath);
96
- }
182
+ if (existsSync(join(targetPath, "package.json"))) {
183
+ await installDependencies(targetPath);
97
184
  }
98
185
  } else {
99
186
  spinner.text = `Downloading ${ext.name} from GitHub...`;
100
187
  const tempDir = join(process.cwd(), `.temp-ext-${Date.now()}`);
101
188
  try {
102
189
  await runCommand("git", ["clone", "--depth", "1", GITHUB_REPO, tempDir]);
103
- const sourceDir = join(tempDir, "packages", "extensions", ext.folder);
190
+ const sourceDir = join(tempDir, "packages", "extensions", "extensions", ext.folder);
104
191
  const targetPath = join(targetDir, ext.folder);
105
192
  if (!existsSync(sourceDir)) {
106
- throw new Error(`Extension folder not found in repository`);
193
+ throw new Error("Extension folder not found in repository");
107
194
  }
108
195
  cpSync(sourceDir, targetPath, { recursive: true });
109
196
  spinner.succeed(chalk.green(`\u2713 Installed ${ext.name} from GitHub`));
110
- if (ext.hasDependencies && existsSync(join(targetPath, "package.json"))) {
111
- const installDeps = await confirm({
112
- message: `${ext.name} has dependencies. Install them now?`,
113
- default: true
114
- });
115
- if (installDeps) {
116
- await installDependencies(targetPath);
117
- }
197
+ if (existsSync(join(targetPath, "package.json"))) {
198
+ await installDependencies(targetPath);
118
199
  }
119
200
  } finally {
120
201
  if (existsSync(tempDir)) {
@@ -162,16 +243,10 @@ async function installFromUrl(url, targetDir) {
162
243
  cpSync(sourceDir, targetPath, { recursive: true });
163
244
  spinner.succeed(chalk.green(`\u2713 Installed ${extName} to ${targetDir}`));
164
245
  if (existsSync(join(targetPath, "package.json"))) {
165
- const installDeps = await confirm({
166
- message: "This extension has dependencies. Install them now?",
167
- default: true
168
- });
169
- if (installDeps) {
170
- await installDependencies(targetPath);
171
- }
246
+ await installDependencies(targetPath);
172
247
  }
173
248
  } else {
174
- throw new Error(`Extension folder not found in repository`);
249
+ throw new Error("Extension folder not found in repository");
175
250
  }
176
251
  } finally {
177
252
  if (existsSync(tempDir)) {
@@ -190,7 +265,7 @@ async function installFromUrl(url, targetDir) {
190
265
  async function installFromExamples(extensions, targetDir) {
191
266
  console.log(chalk.cyan("\n\u{1F4E6} Available AiderDesk Extensions\n"));
192
267
  const choices = extensions.map((ext) => ({
193
- name: `${ext.name} - ${ext.description}`,
268
+ name: ext.description ? `${ext.name} - ${ext.description}` : ext.name,
194
269
  value: ext.id,
195
270
  disabled: false
196
271
  }));
@@ -210,46 +285,8 @@ async function installFromExamples(extensions, targetDir) {
210
285
  Installing to: ${targetDir}
211
286
  `));
212
287
  for (const extId of selectedIds) {
213
- const ext = extensions.find((e) => e.id === extId);
214
- if (!ext) continue;
215
- const spinner = ora(`Installing ${ext.name}...`).start();
216
- try {
217
- const packageDir = join(__dirname, "..");
218
- if (ext.type === "single" && ext.file) {
219
- const sourcePath = join(packageDir, ext.file);
220
- const targetPath = join(targetDir, ext.file);
221
- if (!existsSync(sourcePath)) {
222
- spinner.fail(chalk.yellow(`\u26A0 ${ext.name} source file not found, skipping`));
223
- continue;
224
- }
225
- cpSync(sourcePath, targetPath);
226
- spinner.succeed(chalk.green(`\u2713 Installed ${ext.name}`));
227
- } else if (ext.type === "folder" && ext.folder) {
228
- const sourcePath = join(packageDir, ext.folder);
229
- const targetPath = join(targetDir, ext.folder);
230
- if (!existsSync(sourcePath)) {
231
- spinner.fail(chalk.yellow(`\u26A0 ${ext.name} source folder not found, skipping`));
232
- continue;
233
- }
234
- cpSync(sourcePath, targetPath, { recursive: true });
235
- spinner.succeed(chalk.green(`\u2713 Installed ${ext.name}`));
236
- if (ext.hasDependencies && existsSync(join(targetPath, "package.json"))) {
237
- const installDeps = await confirm({
238
- message: `${ext.name} has dependencies. Install them now?`,
239
- default: true
240
- });
241
- if (installDeps) {
242
- await installDependencies(targetPath);
243
- }
244
- }
245
- }
246
- } catch (error) {
247
- spinner.fail(chalk.red(`\u2717 Failed to install ${ext.name}: ${error}`));
248
- }
288
+ await installExtensionById(extId, extensions, targetDir);
249
289
  }
250
- console.log(chalk.cyan("\n\u2728 Installation complete!\n"));
251
- console.log(chalk.gray("Extensions will be automatically loaded when you restart AiderDesk."));
252
- console.log(chalk.gray("Or they will hot-reload if AiderDesk is already running.\n"));
253
290
  }
254
291
  async function installDependencies(targetPath) {
255
292
  const spinner = ora("Installing dependencies...").start();
@@ -283,7 +320,7 @@ async function main() {
283
320
  program.name("aiderdesk-extensions").description("CLI tool for installing AiderDesk extensions").version(PACKAGE_VERSION);
284
321
  program.command("install [extension]").description("Install AiderDesk extensions interactively, by ID, or from a URL").option("-d, --directory <path>", "Custom installation directory").option("-g, --global", "Install to global directory (~/.aider-desk/extensions)").action(async (extension, options) => {
285
322
  const targetDir = getInstallDirectory(options);
286
- const examples = loadExamples();
323
+ const examples = await loadExtensions();
287
324
  console.log(chalk.cyan.bold("\n\u{1F680} AiderDesk Extension Installer\n"));
288
325
  if (extension) {
289
326
  if (isUrl(extension)) {
@@ -295,15 +332,17 @@ async function main() {
295
332
  await installFromExamples(examples.extensions, targetDir);
296
333
  }
297
334
  });
298
- program.command("list").description("List all available example extensions").action(() => {
299
- const examples = loadExamples();
335
+ program.command("list").description("List all available example extensions").action(async () => {
336
+ const examples = await loadExtensions();
300
337
  console.log(chalk.cyan.bold("\n\u{1F4E6} Available AiderDesk Extensions\n"));
301
338
  examples.extensions.forEach((ext) => {
302
339
  console.log(chalk.white.bold(` ${ext.name}`));
303
- console.log(chalk.gray(` ${ext.description}`));
340
+ if (ext.description) {
341
+ console.log(chalk.gray(` ${ext.description}`));
342
+ }
304
343
  console.log(chalk.gray(` Type: ${ext.type}`));
305
344
  if (ext.hasDependencies) {
306
- console.log(chalk.yellow(` \u26A0 Has dependencies`));
345
+ console.log(chalk.yellow(" \u26A0 Has dependencies"));
307
346
  }
308
347
  console.log();
309
348
  });
@@ -124,6 +124,15 @@
124
124
  "type": "folder",
125
125
  "hasDependencies": false,
126
126
  "capabilities": ["onLoad", "onUnload", "onProjectOpen", "onToolCalled", "onToolFinished"]
127
+ },
128
+ {
129
+ "id": "tree-sitter-repo-map",
130
+ "name": "Tree-Sitter Repo Map",
131
+ "description": "Enhanced repository map using tree-sitter parsing with PageRank-based symbol ranking",
132
+ "folder": "tree-sitter-repo-map",
133
+ "type": "folder",
134
+ "hasDependencies": true,
135
+ "capabilities": ["onLoad", "onAgentStarted", "getCommands"]
127
136
  }
128
137
  ]
129
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiderdesk/extensions",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Type definitions and examples for AiderDesk extensions",
5
5
  "author": "Hotovo",
6
6
  "homepage": "https://aiderdesk.hotovo.com",
@@ -29,7 +29,7 @@
29
29
  "extensions.d.ts",
30
30
  "README.md",
31
31
  "dist/cli.js",
32
- "examples.json"
32
+ "extensions.json"
33
33
  ],
34
34
  "scripts": {
35
35
  "build": "dts-bundle-generator --external-imports zod node --project ../../tsconfig.node.json --no-check --no-banner -o extensions.d.ts ../../src/common/extensions.ts",