aidflow 1.0.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/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/context/session.d.ts +35 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +120 -0
- package/dist/context/session.js.map +1 -0
- package/dist/context/workspace.d.ts +21 -0
- package/dist/context/workspace.d.ts.map +1 -0
- package/dist/context/workspace.js +79 -0
- package/dist/context/workspace.js.map +1 -0
- package/dist/context/yaml.d.ts +8 -0
- package/dist/context/yaml.d.ts.map +1 -0
- package/dist/context/yaml.js +73 -0
- package/dist/context/yaml.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/guide/description.d.ts +2 -0
- package/dist/tools/guide/description.d.ts.map +1 -0
- package/dist/tools/guide/description.js +7 -0
- package/dist/tools/guide/description.js.map +1 -0
- package/dist/tools/guide/handler.d.ts +3 -0
- package/dist/tools/guide/handler.d.ts.map +1 -0
- package/dist/tools/guide/handler.js +68 -0
- package/dist/tools/guide/handler.js.map +1 -0
- package/dist/tools/guide/index.d.ts +4 -0
- package/dist/tools/guide/index.d.ts.map +1 -0
- package/dist/tools/guide/index.js +4 -0
- package/dist/tools/guide/index.js.map +1 -0
- package/dist/tools/guide/schema.d.ts +13 -0
- package/dist/tools/guide/schema.d.ts.map +1 -0
- package/dist/tools/guide/schema.js +12 -0
- package/dist/tools/guide/schema.js.map +1 -0
- package/dist/tools/init/description.d.ts +2 -0
- package/dist/tools/init/description.d.ts.map +1 -0
- package/dist/tools/init/description.js +6 -0
- package/dist/tools/init/description.js.map +1 -0
- package/dist/tools/init/handler.d.ts +3 -0
- package/dist/tools/init/handler.d.ts.map +1 -0
- package/dist/tools/init/handler.js +114 -0
- package/dist/tools/init/handler.js.map +1 -0
- package/dist/tools/init/index.d.ts +4 -0
- package/dist/tools/init/index.d.ts.map +1 -0
- package/dist/tools/init/index.js +4 -0
- package/dist/tools/init/index.js.map +1 -0
- package/dist/tools/init/schema.d.ts +10 -0
- package/dist/tools/init/schema.d.ts.map +1 -0
- package/dist/tools/init/schema.js +9 -0
- package/dist/tools/init/schema.js.map +1 -0
- package/dist/tools/plan/description.d.ts +2 -0
- package/dist/tools/plan/description.d.ts.map +1 -0
- package/dist/tools/plan/description.js +7 -0
- package/dist/tools/plan/description.js.map +1 -0
- package/dist/tools/plan/handler.d.ts +3 -0
- package/dist/tools/plan/handler.d.ts.map +1 -0
- package/dist/tools/plan/handler.js +65 -0
- package/dist/tools/plan/handler.js.map +1 -0
- package/dist/tools/plan/index.d.ts +4 -0
- package/dist/tools/plan/index.d.ts.map +1 -0
- package/dist/tools/plan/index.js +4 -0
- package/dist/tools/plan/index.js.map +1 -0
- package/dist/tools/plan/schema.d.ts +13 -0
- package/dist/tools/plan/schema.d.ts.map +1 -0
- package/dist/tools/plan/schema.js +12 -0
- package/dist/tools/plan/schema.js.map +1 -0
- package/dist/tools/session/description.d.ts +2 -0
- package/dist/tools/session/description.d.ts.map +1 -0
- package/dist/tools/session/description.js +9 -0
- package/dist/tools/session/description.js.map +1 -0
- package/dist/tools/session/handler.d.ts +3 -0
- package/dist/tools/session/handler.d.ts.map +1 -0
- package/dist/tools/session/handler.js +185 -0
- package/dist/tools/session/handler.js.map +1 -0
- package/dist/tools/session/index.d.ts +4 -0
- package/dist/tools/session/index.d.ts.map +1 -0
- package/dist/tools/session/index.js +4 -0
- package/dist/tools/session/index.js.map +1 -0
- package/dist/tools/session/schema.d.ts +19 -0
- package/dist/tools/session/schema.d.ts.map +1 -0
- package/dist/tools/session/schema.js +20 -0
- package/dist/tools/session/schema.js.map +1 -0
- package/dist/worktree/manager.d.ts +9 -0
- package/dist/worktree/manager.d.ts.map +1 -0
- package/dist/worktree/manager.js +92 -0
- package/dist/worktree/manager.js.map +1 -0
- package/package.json +49 -0
- package/templates/README.md +146 -0
- package/templates/config.yaml +20 -0
- package/templates/guides/getting-started.md +21 -0
- package/templates/skills/report.md +52 -0
- package/templates/skills/review.md +69 -0
- package/templates/skills/spec.md +120 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const description = "Access project guide documents. (list/read)\n\n- **list**: Show available guides. Always let the user choose which guide to read.\n- **read**: Read a specific guide by topic name.\n\nNever auto-select guides. Always ask the user which guide they want to read.";
|
|
2
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../src/tools/guide/description.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wQAKqD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const description = `Access project guide documents. (list/read)
|
|
2
|
+
|
|
3
|
+
- **list**: Show available guides. Always let the user choose which guide to read.
|
|
4
|
+
- **read**: Read a specific guide by topic name.
|
|
5
|
+
|
|
6
|
+
Never auto-select guides. Always ask the user which guide they want to read.`;
|
|
7
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../src/tools/guide/description.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;6EAKkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/guide/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiC9C,wBAAsB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAWpE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isInitialized, getConfig, resolve } from "../../context/workspace.js";
|
|
4
|
+
function getGuidesDir() {
|
|
5
|
+
const config = getConfig();
|
|
6
|
+
return resolve(config.guides.path);
|
|
7
|
+
}
|
|
8
|
+
function listGuides() {
|
|
9
|
+
const dir = getGuidesDir();
|
|
10
|
+
if (!existsSync(dir))
|
|
11
|
+
return [];
|
|
12
|
+
return readdirSync(dir)
|
|
13
|
+
.filter((f) => f.endsWith(".md"))
|
|
14
|
+
.map((f) => {
|
|
15
|
+
const name = f.replace(/\.md$/, "");
|
|
16
|
+
const content = readFileSync(join(dir, f), "utf-8");
|
|
17
|
+
const lines = content.split("\n").filter((l) => l.trim());
|
|
18
|
+
// First line as title (strip # prefix), second as description
|
|
19
|
+
const title = (lines[0] ?? name).replace(/^#+\s*/, "");
|
|
20
|
+
const description = lines[1] ?? "";
|
|
21
|
+
return { name, title, description };
|
|
22
|
+
})
|
|
23
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
24
|
+
}
|
|
25
|
+
export async function handleGuide(input) {
|
|
26
|
+
if (!isInitialized()) {
|
|
27
|
+
return "devpilot is not initialized. Run `init` first.";
|
|
28
|
+
}
|
|
29
|
+
switch (input.action) {
|
|
30
|
+
case "list":
|
|
31
|
+
return handleList();
|
|
32
|
+
case "read":
|
|
33
|
+
return handleRead(input.topic);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function handleList() {
|
|
37
|
+
const guides = listGuides();
|
|
38
|
+
if (guides.length === 0) {
|
|
39
|
+
return [
|
|
40
|
+
"No guides found.",
|
|
41
|
+
"Add markdown files to .devpilot/guides/ to create project guides.",
|
|
42
|
+
].join("\n");
|
|
43
|
+
}
|
|
44
|
+
const lines = [
|
|
45
|
+
`Available guides (${guides.length}):\n`,
|
|
46
|
+
...guides.map((g, i) => `${i + 1}. **${g.name}** - ${g.title}${g.description ? `\n ${g.description}` : ""}`),
|
|
47
|
+
"",
|
|
48
|
+
"Ask the user which guide to read using AskUserQuestion.",
|
|
49
|
+
"Do not auto-select guides.",
|
|
50
|
+
];
|
|
51
|
+
return lines.join("\n");
|
|
52
|
+
}
|
|
53
|
+
function handleRead(topic) {
|
|
54
|
+
if (!topic) {
|
|
55
|
+
return "Specify a guide topic to read. Use `guide list` to see available guides.";
|
|
56
|
+
}
|
|
57
|
+
const guidePath = join(getGuidesDir(), `${topic}.md`);
|
|
58
|
+
if (!existsSync(guidePath)) {
|
|
59
|
+
return `Guide "${topic}" not found. Use \`guide list\` to see available guides.`;
|
|
60
|
+
}
|
|
61
|
+
const content = readFileSync(guidePath, "utf-8");
|
|
62
|
+
return [
|
|
63
|
+
`Guide: ${topic}`,
|
|
64
|
+
"---",
|
|
65
|
+
content,
|
|
66
|
+
].join("\n");
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/tools/guide/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAS/E,SAAS,YAAY;IACnB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,UAAU;IACjB,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;IAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhC,OAAO,WAAW,CAAC,GAAG,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,IAAI,GAA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","sourceRoot":"","sources":["../../../src/tools/guide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GuideInputSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodDefault<z.ZodEnum<["list", "read"]>>;
|
|
4
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
action: "list" | "read";
|
|
7
|
+
topic?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
action?: "list" | "read" | undefined;
|
|
10
|
+
topic?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type GuideInput = z.infer<typeof GuideInputSchema>;
|
|
13
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/tools/guide/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;;;;;EAS3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const GuideInputSchema = z.object({
|
|
3
|
+
action: z
|
|
4
|
+
.enum(["list", "read"])
|
|
5
|
+
.default("list")
|
|
6
|
+
.describe("list: show available guides, read: read a specific guide"),
|
|
7
|
+
topic: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Guide name to read (without .md extension)"),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/guide/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACtB,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,0DAA0D,CAAC;IACvE,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;CAC1D,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const description = "Initialize devpilot in the current project.\n\nCreates .devpilot/ directory, config, guides, and Claude Code skills.\nCall this once when first using devpilot in a project.\nIf already initialized, returns current status (use force: true to overwrite).";
|
|
2
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../src/tools/init/description.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,iQAIuD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const description = `Initialize devpilot in the current project.
|
|
2
|
+
|
|
3
|
+
Creates .devpilot/ directory, config, guides, and Claude Code skills.
|
|
4
|
+
Call this once when first using devpilot in a project.
|
|
5
|
+
If already initialized, returns current status (use force: true to overwrite).`;
|
|
6
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../src/tools/init/description.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;+EAIoD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/init/handler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiC7C,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CA+FlE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, copyFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { resolve, isInitialized, getWorkspaceRoot } from "../../context/workspace.js";
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
function templatesDir() {
|
|
7
|
+
// In dist: dist/tools/init/handler.js -> need to go up to dist/, then to templates/
|
|
8
|
+
// Templates are at package root: templates/
|
|
9
|
+
return join(__dirname, "..", "..", "..", "templates");
|
|
10
|
+
}
|
|
11
|
+
function copyTemplateDir(srcDir, destDir) {
|
|
12
|
+
const created = [];
|
|
13
|
+
if (!existsSync(srcDir))
|
|
14
|
+
return created;
|
|
15
|
+
mkdirSync(destDir, { recursive: true });
|
|
16
|
+
for (const entry of readdirSync(srcDir, { withFileTypes: true })) {
|
|
17
|
+
const srcPath = join(srcDir, entry.name);
|
|
18
|
+
const destPath = join(destDir, entry.name);
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
created.push(...copyTemplateDir(srcPath, destPath));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (!existsSync(destPath)) {
|
|
24
|
+
copyFileSync(srcPath, destPath);
|
|
25
|
+
created.push(destPath);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return created;
|
|
30
|
+
}
|
|
31
|
+
export async function handleInit(input) {
|
|
32
|
+
const root = getWorkspaceRoot();
|
|
33
|
+
if (isInitialized() && !input.force) {
|
|
34
|
+
return [
|
|
35
|
+
"devpilot is already initialized in this project.",
|
|
36
|
+
"",
|
|
37
|
+
"Directory: .devpilot/",
|
|
38
|
+
"Use `force: true` to overwrite existing configuration.",
|
|
39
|
+
].join("\n");
|
|
40
|
+
}
|
|
41
|
+
const created = [];
|
|
42
|
+
const tplDir = templatesDir();
|
|
43
|
+
// 1. Create .devpilot/ structure
|
|
44
|
+
const dirs = [
|
|
45
|
+
".devpilot",
|
|
46
|
+
".devpilot/sessions",
|
|
47
|
+
".devpilot/history",
|
|
48
|
+
".devpilot/guides",
|
|
49
|
+
];
|
|
50
|
+
for (const dir of dirs) {
|
|
51
|
+
const full = resolve(dir);
|
|
52
|
+
if (!existsSync(full)) {
|
|
53
|
+
mkdirSync(full, { recursive: true });
|
|
54
|
+
created.push(dir + "/");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// 2. Copy config.yaml
|
|
58
|
+
const configDest = resolve(".devpilot", "config.yaml");
|
|
59
|
+
const configSrc = join(tplDir, "config.yaml");
|
|
60
|
+
if ((!existsSync(configDest) || input.force) && existsSync(configSrc)) {
|
|
61
|
+
copyFileSync(configSrc, configDest);
|
|
62
|
+
created.push(".devpilot/config.yaml");
|
|
63
|
+
}
|
|
64
|
+
// 3. Copy README.md
|
|
65
|
+
const readmeDest = resolve(".devpilot", "README.md");
|
|
66
|
+
const readmeSrc = join(tplDir, "README.md");
|
|
67
|
+
if ((!existsSync(readmeDest) || input.force) && existsSync(readmeSrc)) {
|
|
68
|
+
copyFileSync(readmeSrc, readmeDest);
|
|
69
|
+
created.push(".devpilot/README.md");
|
|
70
|
+
}
|
|
71
|
+
// 4. Copy guide templates
|
|
72
|
+
const guidesSrc = join(tplDir, "guides");
|
|
73
|
+
if (existsSync(guidesSrc)) {
|
|
74
|
+
const guideFiles = copyTemplateDir(guidesSrc, resolve(".devpilot", "guides"));
|
|
75
|
+
created.push(...guideFiles.map((f) => f.replace(root + "/", "")));
|
|
76
|
+
}
|
|
77
|
+
// 5. Copy skills to .claude/commands/
|
|
78
|
+
const skillsSrc = join(tplDir, "skills");
|
|
79
|
+
if (existsSync(skillsSrc)) {
|
|
80
|
+
const skillsDest = resolve(".claude", "commands");
|
|
81
|
+
mkdirSync(skillsDest, { recursive: true });
|
|
82
|
+
const skillFiles = copyTemplateDir(skillsSrc, skillsDest);
|
|
83
|
+
created.push(...skillFiles.map((f) => f.replace(root + "/", "")));
|
|
84
|
+
}
|
|
85
|
+
// 6. Add .devpilot/worktrees to .gitignore if needed
|
|
86
|
+
const gitignorePath = resolve(".gitignore");
|
|
87
|
+
const worktreeEntry = ".devpilot/worktrees/";
|
|
88
|
+
if (existsSync(gitignorePath)) {
|
|
89
|
+
const content = await import("node:fs").then((fs) => fs.readFileSync(gitignorePath, "utf-8"));
|
|
90
|
+
if (!content.includes(worktreeEntry)) {
|
|
91
|
+
writeFileSync(gitignorePath, content.trimEnd() + "\n\n# devpilot worktrees\n" + worktreeEntry + "\n");
|
|
92
|
+
created.push(".gitignore (updated)");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
writeFileSync(gitignorePath, "# devpilot worktrees\n" + worktreeEntry + "\n");
|
|
97
|
+
created.push(".gitignore (created)");
|
|
98
|
+
}
|
|
99
|
+
return [
|
|
100
|
+
"devpilot initialized successfully.",
|
|
101
|
+
"",
|
|
102
|
+
"Created files:",
|
|
103
|
+
...created.map((f) => ` - ${f}`),
|
|
104
|
+
"",
|
|
105
|
+
"Next steps:",
|
|
106
|
+
"1. Run `/spec` to define project-level engineering foundations (SPEC.md). This is essential for consistent development.",
|
|
107
|
+
"2. Add project-specific guides to .devpilot/guides/",
|
|
108
|
+
"3. Review .devpilot/config.yaml for worktree settings",
|
|
109
|
+
"4. Start working with `session create`",
|
|
110
|
+
"",
|
|
111
|
+
"Read .devpilot/README.md for detailed documentation.",
|
|
112
|
+
].join("\n");
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1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CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const InitInputSchema: z.ZodObject<{
|
|
3
|
+
force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
force: boolean;
|
|
6
|
+
}, {
|
|
7
|
+
force?: boolean | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export type InitInput = z.infer<typeof InitInputSchema>;
|
|
10
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/tools/init/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/init/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC;SACL,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,kCAAkC,CAAC;CAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const description = "Manage session work plans. (create/get)\n\n- **create**: Start a structured planning workflow. Guides through requirements gathering (HITL via AskUserQuestion), codebase research, and writing a comprehensive plan.md (PRD + implementation plan). The plan serves as the final execution specification before coding.\n- **get**: Read existing plan and show progress (checkbox-based).\n\nOptional - skip for simple bug fixes. Use for medium/large tasks that benefit from upfront planning.";
|
|
2
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/description.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,weAK6E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const description = `Manage session work plans. (create/get)
|
|
2
|
+
|
|
3
|
+
- **create**: Start a structured planning workflow. Guides through requirements gathering (HITL via AskUserQuestion), codebase research, and writing a comprehensive plan.md (PRD + implementation plan). The plan serves as the final execution specification before coding.
|
|
4
|
+
- **get**: Read existing plan and show progress (checkbox-based).
|
|
5
|
+
|
|
6
|
+
Optional - skip for simple bug fixes. Use for medium/large tasks that benefit from upfront planning.`;
|
|
7
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../src/tools/plan/description.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;qGAK0E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/handler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBlE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { isInitialized, resolve, getWorkspaceRoot } from "../../context/workspace.js";
|
|
2
|
+
import { findActiveSession, getPlanProgress, getPlanContent, sessionExists, } from "../../context/session.js";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
export async function handlePlan(input) {
|
|
6
|
+
if (!isInitialized()) {
|
|
7
|
+
return "devpilot is not initialized. Run `init` first.";
|
|
8
|
+
}
|
|
9
|
+
const sessionName = resolveSession(input.session);
|
|
10
|
+
if (!sessionName) {
|
|
11
|
+
return "No session found. Create one with `session create` first, or specify a session name.";
|
|
12
|
+
}
|
|
13
|
+
switch (input.action) {
|
|
14
|
+
case "create":
|
|
15
|
+
return handleCreate(sessionName);
|
|
16
|
+
case "get":
|
|
17
|
+
return handleGet(sessionName);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function resolveSession(name) {
|
|
21
|
+
if (name) {
|
|
22
|
+
return sessionExists(name) ? name : null;
|
|
23
|
+
}
|
|
24
|
+
const active = findActiveSession();
|
|
25
|
+
return active?.name ?? null;
|
|
26
|
+
}
|
|
27
|
+
function handleCreate(sessionName) {
|
|
28
|
+
const planPath = resolve(".devpilot", "sessions", sessionName, "plan.md");
|
|
29
|
+
if (existsSync(planPath)) {
|
|
30
|
+
return [
|
|
31
|
+
`Session "${sessionName}" already has a plan.`,
|
|
32
|
+
"Use `plan get` to view it, or overwrite by writing a new plan.md.",
|
|
33
|
+
].join("\n");
|
|
34
|
+
}
|
|
35
|
+
const hasSpec = existsSync(join(getWorkspaceRoot(), "SPEC.md"));
|
|
36
|
+
const lines = [
|
|
37
|
+
`Planning session "${sessionName}".`,
|
|
38
|
+
"",
|
|
39
|
+
];
|
|
40
|
+
// Step 0: SPEC.md context
|
|
41
|
+
if (hasSpec) {
|
|
42
|
+
lines.push("## Step 0: Load Project Context", "", "Read SPEC.md at the project root FIRST.", "The plan must follow SPEC.md conventions (architecture, error handling, testing, naming, etc.).", "Only add task-specific technical decisions that SPEC.md does not cover.", "");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
lines.push("## Step 0: Project Context", "", "**No SPEC.md found.** Use AskUserQuestion to ask the user:", "\"SPEC.md (project engineering foundations) does not exist yet. Run /spec first to define it, or proceed without it?\"", "If proceeding without SPEC.md, include relevant engineering decisions directly in the plan's Technical Approach.", "");
|
|
46
|
+
}
|
|
47
|
+
lines.push("## Step 1: Requirements Gathering (HITL)", "", "Use AskUserQuestion **multiple rounds** to thoroughly analyze requirements.", "Do NOT skip this step. Ask until requirements are fully clear.", "", "**Important: For each round, always include an 'AI auto-research' option.**", "When the user is unsure or unfamiliar with the tech stack, offer:", "- \"I'm not sure / Let AI research best practices\"", "If selected, use WebSearch to find latest stable best practices for the relevant", "technology, synthesize into concrete recommendations, and present for confirmation.", "", "**Round 1 - Core Intent**:", "- What is the goal? What problem does this solve?", "- Who is the user/consumer of this feature?", "- What does success look like?", "", "**Round 2 - Scope & Constraints**:", "- What is explicitly OUT of scope?", "- Are there technical constraints (library, pattern, compatibility)?", "- Are there dependencies on other systems or features?", "- What is the expected timeline/priority?", "", "**Round 3 - Details & Edge Cases**:", "- What are the specific behaviors/scenarios?", "- How should errors be handled?", "- Are tests required? What level (unit/integration/e2e)?", "- Any UI/UX requirements?", "", "## Step 2: Codebase Research", "", "Before writing the plan, investigate the codebase:", "- Use Glob/Grep/Read to understand existing code structure", "- Identify files that will be created/modified", "- Understand existing patterns and conventions", "- Check for reusable code or potential conflicts", "", "## Step 3: Write Plan", "", `Write to: .devpilot/sessions/${sessionName}/plan.md`, "", "Plan format (PRD + Implementation Plan):", "```markdown", "# {Title}", "", "## Background", "{Why this task exists. Context and motivation. 2-3 sentences.}", "", "## Objective", "{What we're building/changing. Clear, measurable goal. 1-2 sentences.}", "", "## Requirements", "", "### Functional Requirements", "- FR-1: {specific, testable requirement}", "- FR-2: ...", "", "### Non-Functional Requirements (if applicable)", "- NFR-1: {performance, security, etc.}", "", "## Out of Scope", "- {Explicitly excluded items to prevent scope creep}", "", "## Technical Approach", "{How to implement. Key decisions, patterns, architecture.}", "", "### Affected Files", "- `path/to/file.ts` - {what changes}", "- `path/to/new-file.ts` - {new, purpose}", "", "## Implementation Items", "- [ ] Item 1: {specific, actionable task}", "- [ ] Item 2: ...", "- [ ] Item N: Tests / Verification", "", "## Acceptance Criteria", "- [ ] AC-1: {specific, verifiable condition}", "- [ ] AC-2: ...", "", "## Notes", "{Constraints, assumptions, open decisions, references}", "```", "", "## Step 4: User Review", "", "Present the complete plan and ask the user to review.", "Use AskUserQuestion: confirm, request changes, or approve.", "Do NOT proceed to implementation until the user approves the plan.");
|
|
48
|
+
return lines.join("\n");
|
|
49
|
+
}
|
|
50
|
+
function handleGet(sessionName) {
|
|
51
|
+
const content = getPlanContent(sessionName);
|
|
52
|
+
if (!content) {
|
|
53
|
+
return [
|
|
54
|
+
`No plan found for session "${sessionName}".`,
|
|
55
|
+
"Use `plan create` to start planning.",
|
|
56
|
+
].join("\n");
|
|
57
|
+
}
|
|
58
|
+
const progress = getPlanProgress(sessionName);
|
|
59
|
+
return [
|
|
60
|
+
`Plan for "${sessionName}" (${progress.completed}/${progress.total} completed):`,
|
|
61
|
+
"",
|
|
62
|
+
content,
|
|
63
|
+
].join("\n");
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/tools/plan/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,MA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
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/plan/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PlanInputSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodDefault<z.ZodEnum<["create", "get"]>>;
|
|
4
|
+
session: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
action: "create" | "get";
|
|
7
|
+
session?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
action?: "create" | "get" | undefined;
|
|
10
|
+
session?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type PlanInput = z.infer<typeof PlanInputSchema>;
|
|
13
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;;;;EAS1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const PlanInputSchema = z.object({
|
|
3
|
+
action: z
|
|
4
|
+
.enum(["create", "get"])
|
|
5
|
+
.default("create")
|
|
6
|
+
.describe("create: start planning, get: read existing plan"),
|
|
7
|
+
session: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Session name. Auto-detects if only one active session exists"),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/plan/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACvB,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,8DAA8D,CAAC;CAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const description = "Manage development sessions. (create/list/status/complete)\n\n- **create**: Start a new session. Optionally creates a git worktree for isolation.\n- **list**: Show all active sessions with their status.\n- **status**: Get session progress (changed files, plan progress, next suggestion).\n- **complete**: Archive session to history. Prompts for worktree cleanup.\n\nStart with `create` when beginning work, end with `complete` when done.";
|
|
2
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../src/tools/session/description.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,0bAOoD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const description = `Manage development sessions. (create/list/status/complete)
|
|
2
|
+
|
|
3
|
+
- **create**: Start a new session. Optionally creates a git worktree for isolation.
|
|
4
|
+
- **list**: Show all active sessions with their status.
|
|
5
|
+
- **status**: Get session progress (changed files, plan progress, next suggestion).
|
|
6
|
+
- **complete**: Archive session to history. Prompts for worktree cleanup.
|
|
7
|
+
|
|
8
|
+
Start with \`create\` when beginning work, end with \`complete\` when done.`;
|
|
9
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../src/tools/session/description.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;4EAOiD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/session/handler.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAsB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAexE"}
|