capyai 0.3.2 → 0.3.3
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/package.json +1 -1
- package/src/commands/tasks.ts +12 -0
- package/src/mcp.ts +11 -1
package/package.json
CHANGED
package/src/commands/tasks.ts
CHANGED
|
@@ -31,10 +31,22 @@ export const get = defineCommand({
|
|
|
31
31
|
},
|
|
32
32
|
async run({ args }) {
|
|
33
33
|
const api = await import("../api.js");
|
|
34
|
+
const config = await import("../config.js");
|
|
35
|
+
const github = await import("../github.js");
|
|
34
36
|
const fmt = await import("../output.js");
|
|
35
37
|
const { log } = await import("@clack/prompts");
|
|
36
38
|
|
|
37
39
|
const data = await api.getTask(args.id);
|
|
40
|
+
|
|
41
|
+
// Capy API reports merged PRs as "closed". Cross-ref with GitHub for real state.
|
|
42
|
+
if (data.pullRequest?.number && data.pullRequest.state === "closed") {
|
|
43
|
+
const repo = data.pullRequest.repoFullName || config.load().repos[0]?.repoFullName;
|
|
44
|
+
if (repo) {
|
|
45
|
+
const ghPR = github.getPR(repo, data.pullRequest.number);
|
|
46
|
+
if (ghPR) data.pullRequest.state = ghPR.state.toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
if (args.json) { fmt.out(data); return; }
|
|
39
51
|
log.info(`Task: ${data.identifier} \u2014 ${data.title}\nStatus: ${data.status}\nCreated: ${data.createdAt}`);
|
|
40
52
|
if (data.pullRequest) {
|
package/src/mcp.ts
CHANGED
|
@@ -27,7 +27,17 @@ server.tool("capy_status", "Get task or thread status, or full dashboard", {
|
|
|
27
27
|
}, async ({ id }) => {
|
|
28
28
|
if (id) {
|
|
29
29
|
const isThread = id.length > 20 || (id.length > 10 && !id.match(/^[A-Z]+-\d+$/));
|
|
30
|
-
const data = isThread ? await api.getThread(id) : await api.getTask(id);
|
|
30
|
+
const data: any = isThread ? await api.getThread(id) : await api.getTask(id);
|
|
31
|
+
// Capy API reports merged PRs as "closed". Cross-ref with GitHub for real state.
|
|
32
|
+
if (!isThread && data.pullRequest?.number && data.pullRequest.state === "closed") {
|
|
33
|
+
const { getPR } = await import("./github.js");
|
|
34
|
+
const cfg = config.load();
|
|
35
|
+
const repo = data.pullRequest.repoFullName || cfg.repos[0]?.repoFullName;
|
|
36
|
+
if (repo) {
|
|
37
|
+
const ghPR = getPR(repo, data.pullRequest.number);
|
|
38
|
+
if (ghPR) data.pullRequest.state = ghPR.state.toLowerCase();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
31
41
|
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
32
42
|
}
|
|
33
43
|
const [threads, tasks] = await Promise.all([api.listThreads({ limit: 10 }), api.listTasks({ limit: 30 })]);
|