@vibecodetown/mcp-server 2.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 (172) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -0
  3. package/build/auth/gate.js +225 -0
  4. package/build/auth/index.js +55 -0
  5. package/build/auth/public_key.js +27 -0
  6. package/build/auth/token_cache.js +122 -0
  7. package/build/auth/token_verifier.js +103 -0
  8. package/build/bootstrap/doctor.js +115 -0
  9. package/build/bootstrap/installer.js +673 -0
  10. package/build/bootstrap/lock.js +37 -0
  11. package/build/bootstrap/platform.js +26 -0
  12. package/build/bootstrap/registry.js +37 -0
  13. package/build/cache/index.js +147 -0
  14. package/build/cli.js +101 -0
  15. package/build/contracts.js +22 -0
  16. package/build/control_plane/gate.js +161 -0
  17. package/build/control_plane/index.js +6 -0
  18. package/build/dx/activity.js +139 -0
  19. package/build/engine.js +106 -0
  20. package/build/errors.js +171 -0
  21. package/build/generated/activate_input.js +2 -0
  22. package/build/generated/activate_output.js +57 -0
  23. package/build/generated/advisory_review_input.js +2 -0
  24. package/build/generated/advisory_review_output.js +35 -0
  25. package/build/generated/auth_token_file.js +2 -0
  26. package/build/generated/briefing_input.js +2 -0
  27. package/build/generated/briefing_output.js +2 -0
  28. package/build/generated/clinic_bridge_file.js +13 -0
  29. package/build/generated/contracts_bundle_info.js +5 -0
  30. package/build/generated/create_work_order_input.js +2 -0
  31. package/build/generated/create_work_order_output.js +2 -0
  32. package/build/generated/current_work_order_file.js +2 -0
  33. package/build/generated/doctor_input.js +2 -0
  34. package/build/generated/doctor_output.js +24 -0
  35. package/build/generated/execution_result.js +2 -0
  36. package/build/generated/execution_task.js +2 -0
  37. package/build/generated/export_output_input.js +2 -0
  38. package/build/generated/export_output_output.js +2 -0
  39. package/build/generated/finalize_work_input.js +2 -0
  40. package/build/generated/finalize_work_output.js +2 -0
  41. package/build/generated/gate_input.js +2 -0
  42. package/build/generated/gate_output.js +2 -0
  43. package/build/generated/gate_result_v1.js +2 -0
  44. package/build/generated/get_decision_input.js +2 -0
  45. package/build/generated/get_decision_output.js +13 -0
  46. package/build/generated/handoff_to_clinic.js +2 -0
  47. package/build/generated/index.js +75 -0
  48. package/build/generated/inspect_code_input.js +2 -0
  49. package/build/generated/inspect_code_output.js +13 -0
  50. package/build/generated/memory_retrieve_output.js +2 -0
  51. package/build/generated/memory_state_file.js +2 -0
  52. package/build/generated/memory_status_input.js +2 -0
  53. package/build/generated/memory_status_output.js +13 -0
  54. package/build/generated/memory_sync_input.js +2 -0
  55. package/build/generated/memory_sync_output.js +13 -0
  56. package/build/generated/plugin_result.js +2 -0
  57. package/build/generated/react_perf_check_patterns_input.js +2 -0
  58. package/build/generated/react_perf_check_patterns_output.js +2 -0
  59. package/build/generated/react_perf_generate_report_input.js +2 -0
  60. package/build/generated/react_perf_generate_report_output.js +2 -0
  61. package/build/generated/repair_plan_input.js +2 -0
  62. package/build/generated/repair_plan_output.js +2 -0
  63. package/build/generated/run_app_input.js +2 -0
  64. package/build/generated/run_app_output.js +2 -0
  65. package/build/generated/run_state_file.js +13 -0
  66. package/build/generated/scaffold_input.js +2 -0
  67. package/build/generated/scaffold_output.js +2 -0
  68. package/build/generated/search_oss_input.js +2 -0
  69. package/build/generated/search_oss_output.js +2 -0
  70. package/build/generated/selection_validation_result.js +2 -0
  71. package/build/generated/signal_agent_input.js +2 -0
  72. package/build/generated/spec_high_ask_queue_items_file.js +2 -0
  73. package/build/generated/spec_high_clinic_bridge_output.js +2 -0
  74. package/build/generated/spec_high_decision_draft_output.js +2 -0
  75. package/build/generated/spec_high_validate_output.js +2 -0
  76. package/build/generated/status_input.js +2 -0
  77. package/build/generated/status_output.js +2 -0
  78. package/build/generated/submit_decision_input.js +2 -0
  79. package/build/generated/submit_decision_output.js +2 -0
  80. package/build/generated/tool_error_output.js +2 -0
  81. package/build/generated/undo_last_task_input.js +2 -0
  82. package/build/generated/undo_last_task_output.js +2 -0
  83. package/build/generated/update_input.js +2 -0
  84. package/build/generated/update_output.js +2 -0
  85. package/build/generated/vibe_pm_inspection_result.js +2 -0
  86. package/build/generated/vibe_pm_report_markdown.js +2 -0
  87. package/build/generated/vibe_pm_verdict.js +2 -0
  88. package/build/generated/vibe_repo_config.js +2 -0
  89. package/build/generated/vibecoding_helper_answer_output.js +2 -0
  90. package/build/generated/vibecoding_helper_one_loop_selection_output.js +2 -0
  91. package/build/generated/vibecoding_helper_show_ask_queue_output.js +2 -0
  92. package/build/generated/work_order_v1.js +2 -0
  93. package/build/generated/zoekt_evidence_input.js +2 -0
  94. package/build/generated/zoekt_evidence_output.js +2 -0
  95. package/build/index.js +111 -0
  96. package/build/legacy_alias.js +65 -0
  97. package/build/local-mode/bash.js +61 -0
  98. package/build/local-mode/config.js +171 -0
  99. package/build/local-mode/git.js +33 -0
  100. package/build/local-mode/init.js +110 -0
  101. package/build/local-mode/paths.js +24 -0
  102. package/build/local-mode/templates.js +856 -0
  103. package/build/local-mode/work-order.js +41 -0
  104. package/build/resources/index.js +246 -0
  105. package/build/security/input-validator.js +119 -0
  106. package/build/security/path-policy.js +289 -0
  107. package/build/security/sandbox.js +228 -0
  108. package/build/tools/react_perf/check_patterns.js +172 -0
  109. package/build/tools/react_perf/generate_report.js +337 -0
  110. package/build/tools/react_perf/index.js +119 -0
  111. package/build/tools/react_perf/rules/advanced.js +325 -0
  112. package/build/tools/react_perf/rules/async.js +104 -0
  113. package/build/tools/react_perf/rules/bundle.js +101 -0
  114. package/build/tools/react_perf/rules/client.js +186 -0
  115. package/build/tools/react_perf/rules/index.js +74 -0
  116. package/build/tools/react_perf/rules/js.js +148 -0
  117. package/build/tools/react_perf/rules/rendering.js +166 -0
  118. package/build/tools/react_perf/rules/rerender.js +161 -0
  119. package/build/tools/react_perf/rules/server.js +141 -0
  120. package/build/tools/react_perf/types.js +127 -0
  121. package/build/tools/vibe_pm/activate.js +102 -0
  122. package/build/tools/vibe_pm/advisory_review.js +77 -0
  123. package/build/tools/vibe_pm/briefing.js +178 -0
  124. package/build/tools/vibe_pm/context.js +439 -0
  125. package/build/tools/vibe_pm/create_work_order.js +271 -0
  126. package/build/tools/vibe_pm/doc_status_gate.js +370 -0
  127. package/build/tools/vibe_pm/doctor.js +262 -0
  128. package/build/tools/vibe_pm/entity_gate/preflight.js +78 -0
  129. package/build/tools/vibe_pm/export_output.js +135 -0
  130. package/build/tools/vibe_pm/finalize_work.js +393 -0
  131. package/build/tools/vibe_pm/gate.js +33 -0
  132. package/build/tools/vibe_pm/get_decision.js +281 -0
  133. package/build/tools/vibe_pm/index.js +593 -0
  134. package/build/tools/vibe_pm/inspect_code.js +828 -0
  135. package/build/tools/vibe_pm/intent/generator.js +294 -0
  136. package/build/tools/vibe_pm/intent/index.js +5 -0
  137. package/build/tools/vibe_pm/intent/prompt_density.js +227 -0
  138. package/build/tools/vibe_pm/intent/types.js +70 -0
  139. package/build/tools/vibe_pm/intent/verifier.js +237 -0
  140. package/build/tools/vibe_pm/kce/doc_usage.js +51 -0
  141. package/build/tools/vibe_pm/kce/on_finalize.js +11 -0
  142. package/build/tools/vibe_pm/kce/preflight.js +232 -0
  143. package/build/tools/vibe_pm/local_memory.js +26 -0
  144. package/build/tools/vibe_pm/memory_status.js +82 -0
  145. package/build/tools/vibe_pm/memory_sync.js +134 -0
  146. package/build/tools/vibe_pm/modules/decision_snapshot.js +29 -0
  147. package/build/tools/vibe_pm/modules/ensure.js +100 -0
  148. package/build/tools/vibe_pm/modules/fingerprint.js +30 -0
  149. package/build/tools/vibe_pm/modules/fix_dependencies.js +394 -0
  150. package/build/tools/vibe_pm/modules/planning_v1.js +110 -0
  151. package/build/tools/vibe_pm/modules/repo_context.js +56 -0
  152. package/build/tools/vibe_pm/modules/research_v1.js +114 -0
  153. package/build/tools/vibe_pm/modules/skills_v1.js +100 -0
  154. package/build/tools/vibe_pm/pm_language.js +222 -0
  155. package/build/tools/vibe_pm/repair_plan.js +199 -0
  156. package/build/tools/vibe_pm/run_app.js +597 -0
  157. package/build/tools/vibe_pm/run_app_podman.js +64 -0
  158. package/build/tools/vibe_pm/scaffold.js +550 -0
  159. package/build/tools/vibe_pm/search_oss.js +124 -0
  160. package/build/tools/vibe_pm/status.js +153 -0
  161. package/build/tools/vibe_pm/submit_decision.js +87 -0
  162. package/build/tools/vibe_pm/system_design/issue_mapping.js +47 -0
  163. package/build/tools/vibe_pm/system_design/rulebook.js +112 -0
  164. package/build/tools/vibe_pm/system_design/semgrep.js +132 -0
  165. package/build/tools/vibe_pm/types.js +229 -0
  166. package/build/tools/vibe_pm/undo_last_task.js +163 -0
  167. package/build/tools/vibe_pm/update.js +146 -0
  168. package/build/tools/vibe_pm/zoekt_evidence.js +96 -0
  169. package/build/tools.js +269 -0
  170. package/build/version-check.js +239 -0
  171. package/build/vibe-cli.js +631 -0
  172. package/package.json +76 -0
@@ -0,0 +1,199 @@
1
+ // adapters/mcp-ts/src/tools/vibe_pm/repair_plan.ts
2
+ // vibe_pm.repair_plan - Generate repair request prompt
3
+ import * as fs from "node:fs";
4
+ import * as path from "node:path";
5
+ import { runEngine } from "../../engine.js";
6
+ import { safeJsonParse } from "../../cli.js";
7
+ import { resolveRunId, resolveProjectId, getRunContext, readRunState, getRunsDir } from "./context.js";
8
+ import { generateRepairPrompt, transformAskQueueText } from "./pm_language.js";
9
+ import { validateToolInput } from "../../security/input-validator.js";
10
+ import { ensurePlanningForRepair, readFileIfExists } from "./modules/ensure.js";
11
+ import { maybeGetLocalMemoryContextBlock } from "./local_memory.js";
12
+ import { loadPromptDensity } from "./intent/prompt_density.js";
13
+ /**
14
+ * vibe_pm.repair_plan - Generate repair request prompt for AI
15
+ *
16
+ * Internal mapping:
17
+ * → Read latest inspect result
18
+ * → Generate repair request prompt
19
+ */
20
+ export async function repairPlan(input) {
21
+ const basePath = process.cwd();
22
+ validateToolInput({ project_id: input.project_id });
23
+ // Resolve run_id
24
+ const { run_id } = resolveRunId(input.project_id, basePath);
25
+ const project_id = resolveProjectId(run_id, basePath);
26
+ const context = getRunContext(run_id, basePath);
27
+ const runState = readRunState(run_id, basePath);
28
+ const promptDensityMode = loadPromptDensity(getRunsDir(basePath), run_id)?.mode ?? "mode_0";
29
+ // Get mode
30
+ const mode = runState?.mode ?? "balanced";
31
+ // Find latest inspect result
32
+ const inspectResult = await findLatestInspectResult(run_id, basePath);
33
+ if (!inspectResult) {
34
+ // No previous inspection, return generic prompt
35
+ return {
36
+ project_id,
37
+ problem_summary: {
38
+ what_failed: "이전 검수 결과가 없습니다",
39
+ why_it_matters: "먼저 검수를 실행해주세요"
40
+ },
41
+ repair_prompt: generateRepairPrompt({
42
+ projectName: project_id,
43
+ mode,
44
+ problem: "검수 결과를 찾을 수 없습니다",
45
+ cause: "먼저 vibe_pm.inspect_code를 실행해주세요",
46
+ fixDirection: ["vibe_pm.inspect_code 실행 후 다시 시도"],
47
+ verifyCriteria: []
48
+ }),
49
+ next_action: {
50
+ type: "COPY_PASTE_TO_AGENT",
51
+ label: "검수 결과가 없습니다. 먼저 검수를 실행하세요"
52
+ }
53
+ };
54
+ }
55
+ // Extract issues from result
56
+ const issues = inspectResult.issues ?? inspectResult.issues_found ?? [];
57
+ if (issues.length === 0) {
58
+ return {
59
+ project_id,
60
+ problem_summary: {
61
+ what_failed: "발견된 문제가 없습니다",
62
+ why_it_matters: "수정이 필요하지 않습니다"
63
+ },
64
+ repair_prompt: "수정이 필요한 문제가 없습니다. 다음 단계로 진행하세요.",
65
+ next_action: {
66
+ type: "COPY_PASTE_TO_AGENT",
67
+ label: "문제가 없습니다. 다음 단계로 진행하세요"
68
+ }
69
+ };
70
+ }
71
+ // Build problem summary
72
+ const mainIssue = issues[0];
73
+ const problemSummary = {
74
+ what_failed: mainIssue.plain_explanation ?? mainIssue.message ?? "검수에서 문제가 발견되었습니다",
75
+ why_it_matters: mainIssue.business_risk ?? "수정하지 않으면 정상 동작하지 않을 수 있습니다"
76
+ };
77
+ // Generate repair prompt
78
+ let repairPrompt = generateRepairPrompt({
79
+ projectName: project_id,
80
+ mode,
81
+ problem: problemSummary.what_failed,
82
+ cause: problemSummary.why_it_matters,
83
+ fixDirection: issues.map((i) => i.plain_explanation ?? i.message ?? "수정 필요"),
84
+ verifyCriteria: issues
85
+ .filter((i) => i.type === "VERIFY_FAIL")
86
+ .map((i) => {
87
+ const msg = i.plain_explanation ?? i.message ?? "";
88
+ // Transform failure message to success criterion
89
+ return msg.replace(/실패|미충족|없음|안 됨/g, "성공/충족/있음/됨");
90
+ })
91
+ });
92
+ // Best-effort: attach Local Memory references (client-agnostic)
93
+ if (promptDensityMode !== "mode_2") {
94
+ try {
95
+ const topIssues = issues
96
+ .slice(0, 3)
97
+ .map((i) => i.plain_explanation ?? i.message ?? "")
98
+ .filter(Boolean);
99
+ const query = [problemSummary.what_failed, problemSummary.why_it_matters, ...topIssues].join("\n").trim();
100
+ const refs = await maybeGetLocalMemoryContextBlock({ query, maxItems: 3 });
101
+ if (refs) {
102
+ const sanitized = transformAskQueueText(refs);
103
+ const clipped = sanitized.length > 2000 ? `${sanitized.slice(0, 2000).trimEnd()}…` : sanitized;
104
+ repairPrompt += `\n\n[참고 문헌]\n${clipped}\n`;
105
+ }
106
+ }
107
+ catch {
108
+ // ignore
109
+ }
110
+ }
111
+ // Add a minimal PLAN_STEPS block (goal=repair), best-effort
112
+ try {
113
+ const planning = ensurePlanningForRepair({ basePath, runId: run_id, goal: "repair" });
114
+ if (planning) {
115
+ const planRaw = readFileIfExists(planning.path);
116
+ if (planRaw) {
117
+ const planSummary = formatPlanSteps(planRaw);
118
+ if (planSummary) {
119
+ repairPrompt += `\n\n[PLAN_STEPS]\n${planSummary.trim()}\n`;
120
+ }
121
+ }
122
+ }
123
+ }
124
+ catch {
125
+ // ignore
126
+ }
127
+ return {
128
+ project_id,
129
+ problem_summary: problemSummary,
130
+ repair_prompt: repairPrompt,
131
+ next_action: {
132
+ type: "COPY_PASTE_TO_AGENT",
133
+ label: "이 텍스트를 AI에게 붙여넣으세요"
134
+ }
135
+ };
136
+ }
137
+ function formatPlanSteps(planJsonText) {
138
+ try {
139
+ const doc = JSON.parse(planJsonText);
140
+ const steps = doc.plan ?? [];
141
+ if (!Array.isArray(steps) || steps.length === 0)
142
+ return null;
143
+ const lines = [];
144
+ for (const s of steps) {
145
+ const n = s.step ?? 0;
146
+ const title = (s.title ?? "").trim();
147
+ const v = Array.isArray(s.verification) ? s.verification.filter(Boolean) : [];
148
+ if (title) {
149
+ lines.push(`${n}. ${title}`);
150
+ }
151
+ if (v.length > 0) {
152
+ lines.push(` - 확인: ${v[0]}`);
153
+ }
154
+ }
155
+ return lines.join("\n");
156
+ }
157
+ catch {
158
+ return null;
159
+ }
160
+ }
161
+ /**
162
+ * Find latest inspect/clinic result for a run
163
+ */
164
+ async function findLatestInspectResult(runId, basePath) {
165
+ // Try multiple potential result locations
166
+ const potentialPaths = [
167
+ path.join(basePath, "runs", runId, "clinic", "result.json"),
168
+ path.join(basePath, "runs", runId, "inspect", "result.json"),
169
+ path.join(basePath, "runs", runId, "validation", "result.json"),
170
+ path.join(basePath, "runs", runId, "latest_result.json")
171
+ ];
172
+ for (const resultPath of potentialPaths) {
173
+ if (fs.existsSync(resultPath)) {
174
+ try {
175
+ const content = fs.readFileSync(resultPath, "utf-8");
176
+ return JSON.parse(content);
177
+ }
178
+ catch {
179
+ // Try next path
180
+ }
181
+ }
182
+ }
183
+ // Try running clinic report to get latest
184
+ try {
185
+ const { code, stdout } = await runEngine("clinic", ["report", "--latest", "--json"], {
186
+ timeoutMs: 30_000
187
+ });
188
+ if (code === 0 && stdout) {
189
+ const parsed = safeJsonParse(stdout);
190
+ if (parsed.ok) {
191
+ return parsed.value;
192
+ }
193
+ }
194
+ }
195
+ catch {
196
+ // No result available
197
+ }
198
+ return null;
199
+ }