@workplane/adapter-aider 0.3.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.
@@ -0,0 +1,10 @@
1
+ import { WorkAdapter } from '@workplane/adapter-sdk';
2
+
3
+ interface AiderPayload {
4
+ prompt: string;
5
+ model?: string;
6
+ testCommand?: string;
7
+ }
8
+ declare const aiderAdapter: WorkAdapter<AiderPayload>;
9
+
10
+ export { aiderAdapter };
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ // src/index.ts
2
+ import {
3
+ captureGitDiff,
4
+ createTaskBranch,
5
+ defaultTaskBranchName,
6
+ repoPath
7
+ } from "@workplane/core";
8
+ var aiderAdapter = {
9
+ name: "aider",
10
+ kind: "agent.run",
11
+ async run(context, payload) {
12
+ const cwd = repoPath(context.workspacePath);
13
+ await createTaskBranch(context, defaultTaskBranchName(context.runId));
14
+ const args = ["--yes", "--message", payload.prompt];
15
+ if (payload.model) {
16
+ args.unshift("--model", payload.model);
17
+ }
18
+ const result = await context.exec("aider", args, { cwd });
19
+ if (result.exitCode !== 0) {
20
+ throw new Error(`aider failed with exit code ${result.exitCode}`);
21
+ }
22
+ await captureGitDiff(context, "aider");
23
+ if (payload.testCommand) {
24
+ await context.log("system", `running test command: ${payload.testCommand}`, "run-tests");
25
+ const testResult = await context.exec("/bin/sh", ["-lc", payload.testCommand], { cwd });
26
+ if (testResult.exitCode !== 0) {
27
+ throw new Error(`test command failed with exit code ${testResult.exitCode}`);
28
+ }
29
+ }
30
+ }
31
+ };
32
+ export {
33
+ aiderAdapter
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n captureGitDiff,\n createTaskBranch,\n defaultTaskBranchName,\n repoPath,\n type GitExecContext,\n} from \"@workplane/core\";\nimport type { WorkAdapter } from \"@workplane/adapter-sdk\";\n\ninterface AiderPayload {\n prompt: string;\n model?: string;\n testCommand?: string;\n}\n\nexport const aiderAdapter: WorkAdapter<AiderPayload> = {\n name: \"aider\",\n kind: \"agent.run\",\n async run(context, payload) {\n const cwd = repoPath(context.workspacePath);\n await createTaskBranch(context as GitExecContext, defaultTaskBranchName(context.runId));\n\n const args = [\"--yes\", \"--message\", payload.prompt];\n if (payload.model) {\n args.unshift(\"--model\", payload.model);\n }\n\n const result = await context.exec(\"aider\", args, { cwd });\n if (result.exitCode !== 0) {\n throw new Error(`aider failed with exit code ${result.exitCode}`);\n }\n\n await captureGitDiff(context as GitExecContext, \"aider\");\n\n if (payload.testCommand) {\n await context.log(\"system\", `running test command: ${payload.testCommand}`, \"run-tests\");\n const testResult = await context.exec(\"/bin/sh\", [\"-lc\", payload.testCommand], { cwd });\n if (testResult.exitCode !== 0) {\n throw new Error(`test command failed with exit code ${testResult.exitCode}`);\n }\n }\n },\n};\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AASA,IAAM,eAA0C;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM,IAAI,SAAS,SAAS;AAC1B,UAAM,MAAM,SAAS,QAAQ,aAAa;AAC1C,UAAM,iBAAiB,SAA2B,sBAAsB,QAAQ,KAAK,CAAC;AAEtF,UAAM,OAAO,CAAC,SAAS,aAAa,QAAQ,MAAM;AAClD,QAAI,QAAQ,OAAO;AACjB,WAAK,QAAQ,WAAW,QAAQ,KAAK;AAAA,IACvC;AAEA,UAAM,SAAS,MAAM,QAAQ,KAAK,SAAS,MAAM,EAAE,IAAI,CAAC;AACxD,QAAI,OAAO,aAAa,GAAG;AACzB,YAAM,IAAI,MAAM,+BAA+B,OAAO,QAAQ,EAAE;AAAA,IAClE;AAEA,UAAM,eAAe,SAA2B,OAAO;AAEvD,QAAI,QAAQ,aAAa;AACvB,YAAM,QAAQ,IAAI,UAAU,yBAAyB,QAAQ,WAAW,IAAI,WAAW;AACvF,YAAM,aAAa,MAAM,QAAQ,KAAK,WAAW,CAAC,OAAO,QAAQ,WAAW,GAAG,EAAE,IAAI,CAAC;AACtF,UAAI,WAAW,aAAa,GAAG;AAC7B,cAAM,IAAI,MAAM,sCAAsC,WAAW,QAAQ,EAAE;AAAA,MAC7E;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@workplane/adapter-aider",
3
+ "version": "0.3.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/MindStaq/workplane.git"
10
+ },
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "sideEffects": false,
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
28
+ "dependencies": {
29
+ "@workplane/adapter-sdk": "0.3.1",
30
+ "@workplane/core": "0.3.1"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup"
34
+ }
35
+ }