@devcxl/opencode-cabbage 0.1.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.
Files changed (95) hide show
  1. package/README.md +88 -0
  2. package/assets/agents/dev-lifecycle.md +135 -0
  3. package/assets/agents/team/architect.md +36 -0
  4. package/assets/agents/team/backend.md +44 -0
  5. package/assets/agents/team/frontend.md +41 -0
  6. package/assets/agents/team/reviewer.md +56 -0
  7. package/assets/commands/code.md +4 -0
  8. package/assets/commands/design.md +4 -0
  9. package/assets/commands/handoff.md +4 -0
  10. package/assets/commands/release.md +4 -0
  11. package/assets/commands/requirements.md +4 -0
  12. package/assets/commands/review.md +4 -0
  13. package/assets/commands/setup.md +4 -0
  14. package/assets/commands/tasks.md +4 -0
  15. package/assets/commands/test.md +4 -0
  16. package/assets/context/CONTEXT.md +40 -0
  17. package/assets/prompts/ADR-FORMAT.md +45 -0
  18. package/assets/prompts/PRD-FORMAT.md +17 -0
  19. package/assets/prompts/bootstrap.md +19 -0
  20. package/assets/skills/flow-code/SKILL.md +93 -0
  21. package/assets/skills/flow-design/SKILL.md +70 -0
  22. package/assets/skills/flow-handoff/SKILL.md +47 -0
  23. package/assets/skills/flow-release/SKILL.md +50 -0
  24. package/assets/skills/flow-requirements/SKILL.md +48 -0
  25. package/assets/skills/flow-requirements/references/interview-guide.md +35 -0
  26. package/assets/skills/flow-review/SKILL.md +88 -0
  27. package/assets/skills/flow-review/references/smell-baseline.md +18 -0
  28. package/assets/skills/flow-setup/SKILL.md +43 -0
  29. package/assets/skills/flow-tasks/SKILL.md +104 -0
  30. package/assets/skills/flow-test/SKILL.md +44 -0
  31. package/assets/templates/gitignore +5 -0
  32. package/dist/flowrun/audit.d.ts +5 -0
  33. package/dist/flowrun/audit.js +67 -0
  34. package/dist/flowrun/audit.js.map +1 -0
  35. package/dist/flowrun/gate.d.ts +18 -0
  36. package/dist/flowrun/gate.js +130 -0
  37. package/dist/flowrun/gate.js.map +1 -0
  38. package/dist/flowrun/github.d.ts +20 -0
  39. package/dist/flowrun/github.js +134 -0
  40. package/dist/flowrun/github.js.map +1 -0
  41. package/dist/flowrun/index.d.ts +7 -0
  42. package/dist/flowrun/index.js +8 -0
  43. package/dist/flowrun/index.js.map +1 -0
  44. package/dist/flowrun/merge.d.ts +24 -0
  45. package/dist/flowrun/merge.js +116 -0
  46. package/dist/flowrun/merge.js.map +1 -0
  47. package/dist/flowrun/resilience.d.ts +18 -0
  48. package/dist/flowrun/resilience.js +80 -0
  49. package/dist/flowrun/resilience.js.map +1 -0
  50. package/dist/flowrun/types.d.ts +81 -0
  51. package/dist/flowrun/types.js +20 -0
  52. package/dist/flowrun/types.js.map +1 -0
  53. package/dist/flowrun/validator.d.ts +9 -0
  54. package/dist/flowrun/validator.js +97 -0
  55. package/dist/flowrun/validator.js.map +1 -0
  56. package/dist/index.d.ts +5 -0
  57. package/dist/index.js +6 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/plugin/agents.d.ts +15 -0
  60. package/dist/plugin/agents.js +64 -0
  61. package/dist/plugin/agents.js.map +1 -0
  62. package/dist/plugin/bootstrap.d.ts +3 -0
  63. package/dist/plugin/bootstrap.js +17 -0
  64. package/dist/plugin/bootstrap.js.map +1 -0
  65. package/dist/plugin/commands.d.ts +16 -0
  66. package/dist/plugin/commands.js +62 -0
  67. package/dist/plugin/commands.js.map +1 -0
  68. package/dist/plugin/goal.d.ts +41 -0
  69. package/dist/plugin/goal.js +194 -0
  70. package/dist/plugin/goal.js.map +1 -0
  71. package/dist/plugin/prompts.d.ts +3 -0
  72. package/dist/plugin/prompts.js +26 -0
  73. package/dist/plugin/prompts.js.map +1 -0
  74. package/dist/plugin/server.d.ts +2 -0
  75. package/dist/plugin/server.js +269 -0
  76. package/dist/plugin/server.js.map +1 -0
  77. package/dist/plugin/skills.d.ts +1 -0
  78. package/dist/plugin/skills.js +39 -0
  79. package/dist/plugin/skills.js.map +1 -0
  80. package/dist/plugin.d.ts +3 -0
  81. package/dist/plugin.js +9 -0
  82. package/dist/plugin.js.map +1 -0
  83. package/dist/util/fs.d.ts +1 -0
  84. package/dist/util/fs.js +11 -0
  85. package/dist/util/fs.js.map +1 -0
  86. package/dist/util/gh.d.ts +4 -0
  87. package/dist/util/gh.js +7 -0
  88. package/dist/util/gh.js.map +1 -0
  89. package/dist/util/paths.d.ts +17 -0
  90. package/dist/util/paths.js +78 -0
  91. package/dist/util/paths.js.map +1 -0
  92. package/dist/util/shell.d.ts +1 -0
  93. package/dist/util/shell.js +4 -0
  94. package/dist/util/shell.js.map +1 -0
  95. package/package.json +62 -0
@@ -0,0 +1,81 @@
1
+ export declare const FLOW_RUN_STAGES: readonly ["requirements", "design", "tasks", "code", "test", "review", "merge"];
2
+ export type FlowStage = typeof FLOW_RUN_STAGES[number];
3
+ export declare const FLOW_RUN_STATUSES: readonly ["planned", "running", "blocked", "merging", "completed", "cancelled"];
4
+ export type FlowRunStatus = typeof FLOW_RUN_STATUSES[number];
5
+ export declare const TASK_STATUSES: readonly ["pending", "ready", "running", "blocked", "reviewing", "merged", "cancelled"];
6
+ export type TaskStatus = typeof TASK_STATUSES[number];
7
+ export declare const STAGE_STATUSES: readonly ["pending", "running", "pass", "failed", "blocked"];
8
+ export type StageStatus = typeof STAGE_STATUSES[number];
9
+ export declare const CHECKPOINT_STATUSES: readonly ["pending", "pass", "fail"];
10
+ export type CheckpointStatus = typeof CHECKPOINT_STATUSES[number];
11
+ export interface EvidenceEntry {
12
+ command: string;
13
+ exitCode: number | null;
14
+ summary: string;
15
+ timestamp: string;
16
+ }
17
+ export interface Checkpoint {
18
+ name: string;
19
+ status: CheckpointStatus;
20
+ evidence: EvidenceEntry[];
21
+ }
22
+ export interface StageState {
23
+ status: StageStatus;
24
+ requiredArtifacts: string[];
25
+ checks: Checkpoint[];
26
+ completedAt: string | null;
27
+ evidence: EvidenceEntry[];
28
+ }
29
+ export interface PRCheckpoints {
30
+ prNumber: number;
31
+ localChecks: Checkpoint;
32
+ ciChecks: Checkpoint;
33
+ reviewerApproval: Checkpoint;
34
+ goalVerification: Checkpoint;
35
+ branchProtection: Checkpoint;
36
+ mergeResult: Checkpoint;
37
+ }
38
+ export interface TaskState {
39
+ id: string;
40
+ name: string;
41
+ status: TaskStatus;
42
+ dependsOn: string[];
43
+ area: string;
44
+ expectedFiles: string[];
45
+ testCommands: string[];
46
+ acceptance: string;
47
+ parallelSafe: boolean;
48
+ prNumber: number | null;
49
+ prCheckpoints: PRCheckpoints | null;
50
+ blockedReason: string | null;
51
+ startedAt: string | null;
52
+ }
53
+ export declare const CURRENT_SCHEMA_VERSION = 1;
54
+ export declare const DEFAULT_MAX_RUNTIME_MS = 86400000;
55
+ export interface FlowRun {
56
+ flowRunId: string;
57
+ repo: string;
58
+ parentIssueNumber: number;
59
+ status: FlowRunStatus;
60
+ schemaVersion: number;
61
+ revision: number;
62
+ stages: Record<FlowStage, StageState>;
63
+ tasks: Record<string, TaskState>;
64
+ startedAt: string | null;
65
+ lastTickAt: string | null;
66
+ nextTickAfter: string | null;
67
+ maxRuntime: number;
68
+ completedAt: string | null;
69
+ }
70
+ export declare const CABINET_START_MARKER = "<!-- cabbage-flow-run:start -->";
71
+ export declare const CABINET_END_MARKER = "<!-- cabbage-flow-run:end -->";
72
+ export declare const LABEL_PREFIX = "cabbage:";
73
+ export declare const FLOW_RUN_LABELS: {
74
+ readonly flow: "cabbage:flow";
75
+ readonly running: "cabbage:running";
76
+ readonly blocked: "cabbage:blocked";
77
+ readonly merging: "cabbage:merging";
78
+ readonly completed: "cabbage:completed";
79
+ readonly cancelled: "cabbage:cancelled";
80
+ readonly resume: "cabbage:resume";
81
+ };
@@ -0,0 +1,20 @@
1
+ export const FLOW_RUN_STAGES = ["requirements", "design", "tasks", "code", "test", "review", "merge"];
2
+ export const FLOW_RUN_STATUSES = ["planned", "running", "blocked", "merging", "completed", "cancelled"];
3
+ export const TASK_STATUSES = ["pending", "ready", "running", "blocked", "reviewing", "merged", "cancelled"];
4
+ export const STAGE_STATUSES = ["pending", "running", "pass", "failed", "blocked"];
5
+ export const CHECKPOINT_STATUSES = ["pending", "pass", "fail"];
6
+ export const CURRENT_SCHEMA_VERSION = 1;
7
+ export const DEFAULT_MAX_RUNTIME_MS = 86_400_000;
8
+ export const CABINET_START_MARKER = "<!-- cabbage-flow-run:start -->";
9
+ export const CABINET_END_MARKER = "<!-- cabbage-flow-run:end -->";
10
+ export const LABEL_PREFIX = "cabbage:";
11
+ export const FLOW_RUN_LABELS = {
12
+ flow: `${LABEL_PREFIX}flow`,
13
+ running: `${LABEL_PREFIX}running`,
14
+ blocked: `${LABEL_PREFIX}blocked`,
15
+ merging: `${LABEL_PREFIX}merging`,
16
+ completed: `${LABEL_PREFIX}completed`,
17
+ cancelled: `${LABEL_PREFIX}cancelled`,
18
+ resume: `${LABEL_PREFIX}resume`,
19
+ };
20
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/flowrun/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAG9G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,CAAU,CAAA;AAGhH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAA;AAGpH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA;AAG1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AAkDvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AACvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAA;AAkBhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,iCAAiC,CAAA;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,+BAA+B,CAAA;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAA;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,GAAG,YAAY,MAAM;IAC3B,OAAO,EAAE,GAAG,YAAY,SAAS;IACjC,OAAO,EAAE,GAAG,YAAY,SAAS;IACjC,OAAO,EAAE,GAAG,YAAY,SAAS;IACjC,SAAS,EAAE,GAAG,YAAY,WAAW;IACrC,SAAS,EAAE,GAAG,YAAY,WAAW;IACrC,MAAM,EAAE,GAAG,YAAY,QAAQ;CACvB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { type FlowRun } from "./types.js";
2
+ export interface ValidationError {
3
+ path: string;
4
+ message: string;
5
+ }
6
+ export declare function validateFlowRun(raw: unknown): {
7
+ data: FlowRun | null;
8
+ errors: ValidationError[];
9
+ };
@@ -0,0 +1,97 @@
1
+ import { FLOW_RUN_STAGES, FLOW_RUN_STATUSES, TASK_STATUSES, STAGE_STATUSES, CHECKPOINT_STATUSES, CURRENT_SCHEMA_VERSION, } from "./types.js";
2
+ export function validateFlowRun(raw) {
3
+ const errors = [];
4
+ if (!raw || typeof raw !== "object") {
5
+ errors.push({ path: "", message: "FlowRun must be a non-null object" });
6
+ return { data: null, errors };
7
+ }
8
+ const obj = raw;
9
+ if (typeof obj.flowRunId !== "string" || !obj.flowRunId) {
10
+ errors.push({ path: "flowRunId", message: "Required string" });
11
+ }
12
+ if (typeof obj.repo !== "string" || !obj.repo) {
13
+ errors.push({ path: "repo", message: "Required string" });
14
+ }
15
+ if (typeof obj.parentIssueNumber !== "number" || obj.parentIssueNumber <= 0) {
16
+ errors.push({ path: "parentIssueNumber", message: "Required positive number" });
17
+ }
18
+ if (!FLOW_RUN_STATUSES.includes(obj.status)) {
19
+ errors.push({ path: "status", message: `Must be one of: ${FLOW_RUN_STATUSES.join(", ")}` });
20
+ }
21
+ if (typeof obj.schemaVersion !== "number") {
22
+ errors.push({ path: "schemaVersion", message: "Required number" });
23
+ }
24
+ if (typeof obj.revision !== "number" || obj.revision < 0) {
25
+ errors.push({ path: "revision", message: "Required non-negative number" });
26
+ }
27
+ const stageValidation = validateStages(obj.stages, errors);
28
+ const taskValidation = validateTasks(obj.tasks, errors);
29
+ const data = errors.length === 0 ? raw : null;
30
+ return { data, errors };
31
+ }
32
+ function validateStages(stages, errors) {
33
+ if (!stages || typeof stages !== "object") {
34
+ errors.push({ path: "stages", message: "Required object with stage keys" });
35
+ return false;
36
+ }
37
+ const stageObj = stages;
38
+ for (const key of FLOW_RUN_STAGES) {
39
+ const s = stageObj[key];
40
+ if (!s || typeof s !== "object") {
41
+ errors.push({ path: `stages.${key}`, message: "Missing or invalid stage object" });
42
+ continue;
43
+ }
44
+ validateStage(key, s, errors);
45
+ }
46
+ return true;
47
+ }
48
+ function validateStage(stageKey, stage, errors) {
49
+ if (!STAGE_STATUSES.includes(stage.status)) {
50
+ errors.push({ path: `stages.${stageKey}.status`, message: `Invalid stage status` });
51
+ }
52
+ if (!Array.isArray(stage.requiredArtifacts)) {
53
+ errors.push({ path: `stages.${stageKey}.requiredArtifacts`, message: "Required array" });
54
+ }
55
+ if (typeof stage.completedAt !== "string" && stage.completedAt !== null) {
56
+ errors.push({ path: `stages.${stageKey}.completedAt`, message: "Must be string or null" });
57
+ }
58
+ if (!Array.isArray(stage.checks)) {
59
+ errors.push({ path: `stages.${stageKey}.checks`, message: "Required array" });
60
+ }
61
+ if (!Array.isArray(stage.evidence)) {
62
+ errors.push({ path: `stages.${stageKey}.evidence`, message: "Required array" });
63
+ }
64
+ }
65
+ function validateTasks(tasks, errors) {
66
+ if (!tasks || typeof tasks !== "object") {
67
+ errors.push({ path: "tasks", message: "Required object with task keys" });
68
+ return false;
69
+ }
70
+ const taskObj = tasks;
71
+ for (const [key, value] of Object.entries(taskObj)) {
72
+ if (!value || typeof value !== "object") {
73
+ errors.push({ path: `tasks.${key}`, message: "Invalid task object" });
74
+ continue;
75
+ }
76
+ validateTask(key, value, errors);
77
+ }
78
+ return true;
79
+ }
80
+ function validateTask(taskKey, task, errors) {
81
+ if (!task.id || typeof task.id !== "string") {
82
+ errors.push({ path: `tasks.${taskKey}.id`, message: "Required string" });
83
+ }
84
+ if (!TASK_STATUSES.includes(task.status)) {
85
+ errors.push({ path: `tasks.${taskKey}.status`, message: `Invalid task status` });
86
+ }
87
+ if (!Array.isArray(task.dependsOn)) {
88
+ errors.push({ path: `tasks.${taskKey}.dependsOn`, message: "Required array" });
89
+ }
90
+ if (!Array.isArray(task.expectedFiles)) {
91
+ errors.push({ path: `tasks.${taskKey}.expectedFiles`, message: "Required array" });
92
+ }
93
+ if (!Array.isArray(task.testCommands)) {
94
+ errors.push({ path: `tasks.${taskKey}.testCommands`, message: "Required array" });
95
+ }
96
+ }
97
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/flowrun/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EACtF,sBAAsB,GACvB,MAAM,YAAY,CAAA;AAOnB,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,MAAM,MAAM,GAAsB,EAAE,CAAA;IAEpC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC,CAAA;QACvE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IAC/B,CAAC;IAED,M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AE,gBAAgB,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,OAAO,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAA;IACnF,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ id: string;
3
+ server: import("@opencode-ai/plugin").Plugin;
4
+ };
5
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { OpencodeCabbage } from "./plugin.js";
2
+ export default {
3
+ id: "opencode-cabbage",
4
+ server: OpencodeCabbage,
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,eAAe;IACb,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,eAAe;CACxB,CAAA"}
@@ -0,0 +1,15 @@
1
+ export interface AgentTools {
2
+ read?: boolean;
3
+ bash?: boolean;
4
+ write?: boolean;
5
+ edit?: boolean;
6
+ }
7
+ export interface AgentEntry {
8
+ key: string;
9
+ description?: string;
10
+ mode?: "subagent" | "primary" | "all";
11
+ color?: string;
12
+ tools?: AgentTools;
13
+ prompt: string;
14
+ }
15
+ export declare function loadAgents(agentsDir: string): AgentEntry[];
@@ -0,0 +1,64 @@
1
+ import { readFileSync, readdirSync, existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { parse as parseYaml } from "yaml";
4
+ function parseAgentFile(filePath) {
5
+ const content = readFileSync(filePath, "utf8");
6
+ const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
7
+ if (!match)
8
+ return null;
9
+ const frontmatterStr = match[1];
10
+ const body = match[2].trim();
11
+ let parsed;
12
+ try {
13
+ parsed = parseYaml(frontmatterStr);
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ if (!parsed || typeof parsed !== "object")
19
+ return null;
20
+ const name = String(parsed.name ?? "");
21
+ if (!name)
22
+ return null;
23
+ const toolsRaw = parsed.tools;
24
+ const tools = toolsRaw && typeof toolsRaw === "object" && !Array.isArray(toolsRaw)
25
+ ? {
26
+ read: Boolean(toolsRaw.read),
27
+ bash: Boolean(toolsRaw.bash),
28
+ write: Boolean(toolsRaw.write),
29
+ edit: Boolean(toolsRaw.edit),
30
+ }
31
+ : undefined;
32
+ return {
33
+ key: name,
34
+ description: parsed.description,
35
+ mode: parsed.mode,
36
+ color: parsed.color,
37
+ tools,
38
+ prompt: body,
39
+ };
40
+ }
41
+ export function loadAgents(agentsDir) {
42
+ const result = [];
43
+ if (existsSync(agentsDir)) {
44
+ for (const entry of readdirSync(agentsDir, { withFileTypes: true })) {
45
+ if (entry.isFile() && entry.name.endsWith(".md")) {
46
+ const agent = parseAgentFile(path.join(agentsDir, entry.name));
47
+ if (agent)
48
+ result.push(agent);
49
+ }
50
+ }
51
+ }
52
+ const teamDir = path.join(agentsDir, "team");
53
+ if (existsSync(teamDir)) {
54
+ for (const entry of readdirSync(teamDir, { withFileTypes: true })) {
55
+ if (entry.isFile() && entry.name.endsWith(".md")) {
56
+ const agent = parseAgentFile(path.join(teamDir, entry.name));
57
+ if (agent)
58
+ result.push(agent);
59
+ }
60
+ }
61
+ }
62
+ return result;
63
+ }
64
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/plugin/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAA;AAkBzC,SAAS,cA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 -0,0 +1,3 @@
1
+ export declare function initBootstrap(): Promise<void>;
2
+ export declare function getBootstrapContent(): string;
3
+ export declare function resetBootstrap(): void;
@@ -0,0 +1,17 @@
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { loadPrompt } from "./prompts.js";
5
+ let _bootstrapCache;
6
+ const _fallbackContent = readFileSync(path.join(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."), "assets", "prompts", "bootstrap.md"), "utf-8");
7
+ export async function initBootstrap() {
8
+ const content = await loadPrompt("bootstrap");
9
+ _bootstrapCache = content || undefined;
10
+ }
11
+ export function getBootstrapContent() {
12
+ return _bootstrapCache ?? _fallbackContent;
13
+ }
14
+ export function resetBootstrap() {
15
+ _bootstrapCache = undefined;
16
+ }
17
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/plugin/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,IAAI,eAAmC,CAAA;AAEvC,MAAM,gBAAgB,GAAG,YAAY,CACnC,IAAI,CAAC,IAAI,CACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,EACnE,QAAQ,EAAE,SAAS,EAAE,cAAc,CACpC,EACD,OAAO,CACR,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,CAAA;IAC7C,eAAe,GAAG,OAAO,IAAI,SAAS,CAAA;AACxC,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,eAAe,IAAI,gBAAgB,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,eAAe,GAAG,SAAS,CAAA;AAC7B,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** 解析后的 slash command 结构 */
2
+ export interface ParsedCommand {
3
+ name: string;
4
+ description?: string;
5
+ agent?: string;
6
+ model?: string;
7
+ subtask?: boolean;
8
+ template: string;
9
+ }
10
+ /**
11
+ * 从 commandsDir 加载所有 slash command
12
+ *
13
+ * 遍历目录下的所有 .md 文件,解析 frontmatter 获取命令的元数据,
14
+ * 并将 skills 路径替换为运行时动态创建的 skills 目录。
15
+ */
16
+ export declare function loadCommands(commandsDir: string, skillsDir: string): ParsedCommand[];
@@ -0,0 +1,62 @@
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ /**
4
+ * 解析并剥离 Markdown 文件的 frontmatter
5
+ *
6
+ * Frontmatter 是位于文件开头的 --- 包裹的 YAML 格式元数据,
7
+ * 例如:---\ntitle: foo\n---\n正文内容
8
+ */
9
+ function extractAndStripFrontmatter(content) {
10
+ const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
11
+ if (!match)
12
+ return { frontmatter: {}, content };
13
+ const frontmatterStr = match[1];
14
+ const body = match[2];
15
+ const frontmatter = {};
16
+ for (const line of frontmatterStr.split("\n")) {
17
+ const colonIdx = line.indexOf(":");
18
+ if (colonIdx > 0) {
19
+ const key = line.slice(0, colonIdx).trim();
20
+ const value = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, "");
21
+ frontmatter[key] = value;
22
+ }
23
+ }
24
+ return { frontmatter, content: body };
25
+ }
26
+ /** commands 缓存,避免重复读取磁盘 */
27
+ let _commandsCache;
28
+ /**
29
+ * 从 commandsDir 加载所有 slash command
30
+ *
31
+ * 遍历目录下的所有 .md 文件,解析 frontmatter 获取命令的元数据,
32
+ * 并将 skills 路径替换为运行时动态创建的 skills 目录。
33
+ */
34
+ export function loadCommands(commandsDir, skillsDir) {
35
+ const cacheKey = `${commandsDir}:${skillsDir}`;
36
+ if (_commandsCache?.key === cacheKey)
37
+ return _commandsCache.value;
38
+ if (!existsSync(commandsDir)) {
39
+ _commandsCache = { key: cacheKey, value: [] };
40
+ return [];
41
+ }
42
+ const parsed = [];
43
+ for (const file of readdirSync(commandsDir)) {
44
+ if (!file.endsWith(".md"))
45
+ continue;
46
+ const name = path.basename(file, ".md");
47
+ const raw = readFileSync(path.join(commandsDir, file), "utf8");
48
+ const { frontmatter, content } = extractAndStripFrontmatter(raw);
49
+ const template = content.trim().replaceAll(".opencode/skills/", `${skillsDir}/`);
50
+ parsed.push({
51
+ name,
52
+ description: frontmatter.description,
53
+ agent: frontmatter.agent,
54
+ model: frontmatter.model,
55
+ subtask: frontmatter.subtask === "true" ? true : frontmatter.subtask === "false" ? false : undefined,
56
+ template,
57
+ });
58
+ }
59
+ _commandsCache = { key: cacheKey, value: parsed };
60
+ return parsed;
61
+ }
62
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/plugin/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;;;;GAKG;AACH,SAAS,0BAA0B,CAAC,OAAe;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAChE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,WAAW,EAAE,EAA4B,EAAE,OAAO,EAAE,CAAA;IAEzE,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IACrB,MAAM,WAAW,GAA2B,EAAE,CAAA;IAE9C,KA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CAAA;QACvC,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;QAC9D,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAA;QAEhE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,mBAAmB,EAAE,GAAG,SAAS,GAAG,CAAC,CAAA;QAEhF,MAAM,CAAC,IAAI,CAAC;YACV,IAAI;YACJ,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,OAAO,EAAE,WAAW,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YACpG,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED,cAAc,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IACjD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ToolContext, ToolResult } from "@opencode-ai/plugin";
2
+ import { createOpencodeClient } from "@opencode-ai/sdk/v2";
3
+ import type { Session } from "@opencode-ai/sdk/v2";
4
+ export type GoalStatus = "active" | "paused" | "complete";
5
+ export interface GoalData {
6
+ objective: string;
7
+ completionCriterion: string;
8
+ status: GoalStatus;
9
+ continuationCount: number;
10
+ }
11
+ export declare function canTransitionTo(goal: GoalData, target: GoalStatus): boolean;
12
+ export declare function formatGoal(goal: GoalData): string;
13
+ export declare const MAX_CONTINUATIONS = 50;
14
+ export declare function continuationPrompt(objective: string, completionCriterion: string): string;
15
+ export declare function verifyAgentPrompt(): string;
16
+ export declare function createGoalClient(serverUrl: URL, v1Client: any): import("@opencode-ai/sdk/v2").OpencodeClient;
17
+ export declare function readGoal(client: ReturnType<typeof createOpencodeClient>, sessionID: string): Promise<{
18
+ goal: GoalData | null;
19
+ session: Session | null;
20
+ }>;
21
+ export declare function writeGoal(client: ReturnType<typeof createOpencodeClient>, sessionID: string, goal: GoalData | null, existingSession?: Session | null): Promise<void>;
22
+ export declare function createGoalTool(client: ReturnType<typeof createOpencodeClient>): {
23
+ description: string;
24
+ args: {
25
+ op: import("zod").ZodEnum<{
26
+ complete: "complete";
27
+ create: "create";
28
+ get: "get";
29
+ resume: "resume";
30
+ cancel: "cancel";
31
+ pause: "pause";
32
+ }>;
33
+ objective: import("zod").ZodString;
34
+ completion_criterion: import("zod").ZodString;
35
+ };
36
+ execute(args: {
37
+ op: "complete" | "create" | "get" | "resume" | "cancel" | "pause";
38
+ objective: string;
39
+ completion_criterion: string;
40
+ }, context: ToolContext): Promise<ToolResult>;
41
+ };