feat: add TypeScript support and shared types

- Added TypeScript configuration file (tsconfig.json) with strict settings.
- Introduced devDependencies for TypeScript in package.json.
- Added scripts for type checking and watching for changes.
- Created a new types file (lib/types.ts) defining shared types for the DevClaw plugin.
This commit is contained in:
Lauren ten Hoor
2026-02-09 14:27:13 +08:00
parent b5bcd313e8
commit 32eb079521
12 changed files with 282 additions and 1694 deletions

View File

@@ -4,13 +4,16 @@
* Creates a new agent (optional), configures model tiers,
* and writes workspace files (AGENTS.md, HEARTBEAT.md, roles, memory).
*/
import type { OpenClawPluginApi, OpenClawPluginToolContext } from "openclaw/plugin-sdk";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../types.js";
import { runSetup } from "../setup.js";
import { ALL_TIERS, DEFAULT_MODELS, type Tier } from "../tiers.js";
export function createSetupTool(api: OpenClawPluginApi) {
return (ctx: OpenClawPluginToolContext) => ({
return (ctx: ToolContext) => ({
name: "devclaw_setup",
label: "DevClaw Setup",
description: `Set up DevClaw in an agent's workspace. Creates AGENTS.md, HEARTBEAT.md, role templates, memory/projects.json, and writes model tier config to openclaw.json. Optionally creates a new agent. Backs up existing files before overwriting.`,
parameters: {
type: "object",
@@ -69,16 +72,11 @@ export function createSetupTool(api: OpenClawPluginApi) {
` 3. Create your first issue and pick it up`,
);
return {
content: [{
type: "text" as const,
text: JSON.stringify({
success: true,
...result,
summary: lines.join("\n"),
}, null, 2),
}],
};
return jsonResult({
success: true,
...result,
summary: lines.join("\n"),
});
},
});
}