forked from laurentenhoor/devclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonboard.ts
More file actions
37 lines (33 loc) · 1.57 KB
/
onboard.ts
File metadata and controls
37 lines (33 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* onboard — Conversational DevClaw onboarding.
*
* Returns step-by-step guidance. Call this before setup.
*/
import { jsonResult } from "../../json-result.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { isPluginConfigured, hasWorkspaceFiles, buildOnboardToolContext, buildReconfigContext } from "../../setup/onboarding.js";
export function createOnboardTool(ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
name: "onboard",
label: "Onboard",
description: "Start DevClaw onboarding workflow. Returns step-by-step QA-style guidance. Call this first, then setup with collected answers.",
parameters: {
type: "object",
properties: {
mode: { type: "string", enum: ["first-run", "reconfigure"], description: "Auto-detected if omitted." },
},
},
async execute(_id: string, params: Record<string, unknown>) {
const configured = isPluginConfigured(ctx.pluginConfig);
const hasWorkspace = await hasWorkspaceFiles(toolCtx.workspaceDir);
const mode = params.mode ? (params.mode as "first-run" | "reconfigure")
: configured && hasWorkspace ? "reconfigure" : "first-run";
const instructions = mode === "first-run" ? buildOnboardToolContext() : buildReconfigContext();
return jsonResult({
success: true, mode, configured, instructions,
nextSteps: ["Follow instructions above", "Call setup with collected answers", mode === "first-run" ? "Register a project afterward" : null].filter(Boolean),
});
},
});
}