muonroi-cli 1.4.1 → 1.6.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 -21
- package/README.md +122 -122
- package/dist/packages/agent-harness-core/src/predicate.d.ts +1 -1
- package/dist/src/agent-harness/__tests__/mock-model.spec.js +48 -1
- package/dist/src/agent-harness/mock-model.d.ts +11 -0
- package/dist/src/agent-harness/mock-model.js +21 -0
- package/dist/src/cli/cost-forensics.js +12 -12
- package/dist/src/council/__tests__/clarification-prompt.test.js +51 -0
- package/dist/src/council/__tests__/clarifier-ready-gate.test.js +32 -0
- package/dist/src/council/__tests__/decisions-lock.test.js +17 -1
- package/dist/src/council/__tests__/oauth-reachable.test.d.ts +1 -0
- package/dist/src/council/__tests__/oauth-reachable.test.js +31 -0
- package/dist/src/council/__tests__/parse-outcome-fallback.test.js +11 -0
- package/dist/src/council/clarifier.js +9 -1
- package/dist/src/council/debate.js +5 -1
- package/dist/src/council/decisions-lock.js +3 -3
- package/dist/src/council/index.js +12 -5
- package/dist/src/council/leader.d.ts +0 -17
- package/dist/src/council/leader.js +22 -15
- package/dist/src/council/planner.js +1 -1
- package/dist/src/council/prompts.js +63 -57
- package/dist/src/council/types.d.ts +7 -0
- package/dist/src/ee/__tests__/ee-onboarding.test.d.ts +1 -0
- package/dist/src/ee/__tests__/ee-onboarding.test.js +32 -0
- package/dist/src/ee/artifact-cache.d.ts +56 -0
- package/dist/src/ee/artifact-cache.js +155 -0
- package/dist/src/ee/artifact-cache.test.d.ts +1 -0
- package/dist/src/ee/artifact-cache.test.js +69 -0
- package/dist/src/ee/auth.d.ts +9 -0
- package/dist/src/ee/auth.js +19 -0
- package/dist/src/ee/ee-onboarding.d.ts +5 -0
- package/dist/src/ee/ee-onboarding.js +76 -0
- package/dist/src/ee/search.js +7 -5
- package/dist/src/ee/search.test.d.ts +1 -0
- package/dist/src/ee/search.test.js +23 -0
- package/dist/src/generated/version.d.ts +1 -1
- package/dist/src/generated/version.js +1 -1
- package/dist/src/headless/output.js +6 -4
- package/dist/src/headless/output.test.js +4 -3
- package/dist/src/index.js +20 -1
- package/dist/src/mcp/__tests__/auto-setup.test.js +74 -0
- package/dist/src/mcp/__tests__/client-pool.spec.d.ts +1 -0
- package/dist/src/mcp/__tests__/client-pool.spec.js +98 -0
- package/dist/src/mcp/__tests__/parallel-build.spec.d.ts +1 -0
- package/dist/src/mcp/__tests__/parallel-build.spec.js +67 -0
- package/dist/src/mcp/__tests__/smart-filter.test.js +56 -0
- package/dist/src/mcp/auto-setup.js +56 -2
- package/dist/src/mcp/client-pool.d.ts +46 -0
- package/dist/src/mcp/client-pool.js +212 -0
- package/dist/src/mcp/oauth-callback.js +2 -2
- package/dist/src/mcp/parse-headers.test.js +14 -14
- package/dist/src/mcp/runtime.d.ts +28 -0
- package/dist/src/mcp/runtime.js +117 -51
- package/dist/src/mcp/self-verify-runner.d.ts +14 -0
- package/dist/src/mcp/self-verify-runner.js +38 -0
- package/dist/src/mcp/setup-guide-text.d.ts +9 -0
- package/dist/src/mcp/setup-guide-text.js +84 -0
- package/dist/src/mcp/smart-filter.js +49 -0
- package/dist/src/mcp/smoke.test.js +43 -43
- package/dist/src/mcp/tools-server.d.ts +7 -0
- package/dist/src/mcp/tools-server.js +19 -22
- package/dist/src/models/catalog.json +349 -349
- package/dist/src/ops/__tests__/doctor-ee-health.test.js +21 -0
- package/dist/src/ops/doctor.d.ts +3 -2
- package/dist/src/ops/doctor.js +47 -11
- package/dist/src/ops/doctor.test.js +4 -3
- package/dist/src/orchestrator/__tests__/mcp-capability-block.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/mcp-capability-block.test.js +39 -0
- package/dist/src/orchestrator/__tests__/project-stack.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/project-stack.test.js +65 -0
- package/dist/src/orchestrator/batch-turn-runner.js +7 -11
- package/dist/src/orchestrator/compaction.d.ts +2 -0
- package/dist/src/orchestrator/compaction.js +14 -1
- package/dist/src/orchestrator/compaction.test.js +25 -1
- package/dist/src/orchestrator/message-processor.js +72 -32
- package/dist/src/orchestrator/orchestrator.js +26 -0
- package/dist/src/orchestrator/prompts.d.ts +51 -0
- package/dist/src/orchestrator/prompts.js +257 -134
- package/dist/src/orchestrator/scope-ceiling.js +6 -1
- package/dist/src/orchestrator/scope-reminder.d.ts +12 -0
- package/dist/src/orchestrator/scope-reminder.js +16 -0
- package/dist/src/orchestrator/scope-reminder.test.js +22 -1
- package/dist/src/orchestrator/stream-runner.js +23 -15
- package/dist/src/orchestrator/subagent-compactor.d.ts +14 -5
- package/dist/src/orchestrator/subagent-compactor.js +30 -8
- package/dist/src/orchestrator/subagent-compactor.spec.js +18 -0
- package/dist/src/orchestrator/text-tool-call-detector.test.js +13 -13
- package/dist/src/pil/__tests__/clarity-gate.test.js +24 -215
- package/dist/src/pil/__tests__/config.test.js +1 -17
- package/dist/src/pil/__tests__/discovery.test.js +144 -11
- package/dist/src/pil/__tests__/layer1-intent-trace.test.js +7 -2
- package/dist/src/pil/__tests__/layer1-intent.test.js +3 -0
- package/dist/src/pil/__tests__/layer16-clarity.test.js +32 -116
- package/dist/src/pil/__tests__/layer4-gsd.test.js +37 -0
- package/dist/src/pil/__tests__/layer6-output.test.js +158 -18
- package/dist/src/pil/__tests__/llm-classify.test.js +49 -2
- package/dist/src/pil/__tests__/surface-compaction-artifacts.test.d.ts +1 -0
- package/dist/src/pil/__tests__/surface-compaction-artifacts.test.js +112 -0
- package/dist/src/pil/agent-operating-contract.d.ts +1 -1
- package/dist/src/pil/agent-operating-contract.js +2 -0
- package/dist/src/pil/agent-operating-contract.test.js +7 -2
- package/dist/src/pil/cheap-model-playbook.js +35 -35
- package/dist/src/pil/cheap-model-workbooks.js +16 -13
- package/dist/src/pil/clarity-gate.d.ts +21 -19
- package/dist/src/pil/clarity-gate.js +26 -153
- package/dist/src/pil/config.d.ts +9 -1
- package/dist/src/pil/config.js +15 -4
- package/dist/src/pil/discovery.js +211 -136
- package/dist/src/pil/layer1-intent.d.ts +12 -0
- package/dist/src/pil/layer1-intent.js +283 -38
- package/dist/src/pil/layer1-intent.test.js +210 -4
- package/dist/src/pil/layer16-clarity.d.ts +25 -11
- package/dist/src/pil/layer16-clarity.js +19 -306
- package/dist/src/pil/layer3-ee-injection.d.ts +19 -0
- package/dist/src/pil/layer3-ee-injection.js +96 -4
- package/dist/src/pil/layer4-gsd.js +18 -6
- package/dist/src/pil/layer6-output.d.ts +2 -0
- package/dist/src/pil/layer6-output.js +151 -25
- package/dist/src/pil/llm-classify.d.ts +26 -0
- package/dist/src/pil/llm-classify.js +34 -5
- package/dist/src/pil/native-capabilities-workbook.d.ts +1 -1
- package/dist/src/pil/native-capabilities-workbook.js +82 -76
- package/dist/src/pil/pipeline.js +15 -9
- package/dist/src/pil/schema.d.ts +8 -0
- package/dist/src/pil/schema.js +12 -1
- package/dist/src/pil/task-tier-map.js +4 -0
- package/dist/src/pil/types.d.ts +11 -1
- package/dist/src/product-loop/done-gate.js +3 -3
- package/dist/src/product-loop/loop-driver.js +18 -18
- package/dist/src/product-loop/progress-snapshot.js +4 -4
- package/dist/src/providers/auth/gemini-oauth.js +6 -15
- package/dist/src/providers/auth/grok-oauth.js +6 -15
- package/dist/src/providers/auth/openai-oauth.js +6 -15
- package/dist/src/providers/mcp-vision-bridge.js +48 -48
- package/dist/src/reporter/index.js +1 -1
- package/dist/src/scaffold/bb-ecosystem-apply.js +47 -47
- package/dist/src/scaffold/bb-quality-gate.js +5 -5
- package/dist/src/scaffold/continuation-prompt.js +60 -60
- package/dist/src/scaffold/init-new.js +453 -453
- package/dist/src/self-qa/__tests__/scenario-planner.test.js +3 -3
- package/dist/src/self-qa/agentic-loop.js +24 -19
- package/dist/src/self-qa/spec-emitter.js +26 -23
- package/dist/src/storage/__tests__/migrations.test.js +2 -2
- package/dist/src/storage/interaction-log.js +5 -5
- package/dist/src/storage/migrations.js +122 -122
- package/dist/src/storage/sessions.js +42 -42
- package/dist/src/storage/transcript.js +91 -84
- package/dist/src/storage/usage.js +14 -14
- package/dist/src/storage/workspaces.js +12 -12
- package/dist/src/tools/__tests__/native-tools.test.d.ts +1 -0
- package/dist/src/tools/__tests__/native-tools.test.js +53 -0
- package/dist/src/tools/git-safety.d.ts +61 -0
- package/dist/src/tools/git-safety.js +141 -0
- package/dist/src/tools/git-safety.test.d.ts +1 -0
- package/dist/src/tools/git-safety.test.js +111 -0
- package/dist/src/tools/native-tools.d.ts +31 -0
- package/dist/src/tools/native-tools.js +273 -0
- package/dist/src/tools/registry-ee-query.test.js +18 -1
- package/dist/src/tools/registry-git-safety.test.d.ts +7 -0
- package/dist/src/tools/registry-git-safety.test.js +92 -0
- package/dist/src/tools/registry.js +52 -6
- package/dist/src/ui/__tests__/markdown-render.test.d.ts +1 -0
- package/dist/src/ui/__tests__/markdown-render.test.js +48 -0
- package/dist/src/ui/app.js +0 -0
- package/dist/src/ui/components/message-view.js +4 -1
- package/dist/src/ui/components/structured-response-view.js +7 -3
- package/dist/src/ui/components/tool-group.js +7 -1
- package/dist/src/ui/markdown-render.d.ts +41 -0
- package/dist/src/ui/markdown-render.js +223 -0
- package/dist/src/ui/markdown.d.ts +10 -0
- package/dist/src/ui/markdown.js +12 -35
- package/dist/src/ui/slash/council-inspect.js +4 -4
- package/dist/src/ui/slash/export.js +4 -4
- package/dist/src/ui/utils/text.d.ts +8 -0
- package/dist/src/ui/utils/text.js +16 -0
- package/dist/src/ui/utils/text.test.d.ts +1 -0
- package/dist/src/ui/utils/text.test.js +23 -0
- package/dist/src/usage/ledger.js +48 -15
- package/dist/src/utils/__tests__/footprint-gitignore.test.d.ts +1 -0
- package/dist/src/utils/__tests__/footprint-gitignore.test.js +50 -0
- package/dist/src/utils/clipboard-image.js +23 -23
- package/dist/src/utils/open-url.d.ts +56 -0
- package/dist/src/utils/open-url.js +58 -0
- package/dist/src/utils/open-url.test.d.ts +1 -0
- package/dist/src/utils/open-url.test.js +86 -0
- package/dist/src/utils/settings.d.ts +12 -0
- package/dist/src/utils/settings.js +48 -0
- package/dist/src/utils/side-question.js +2 -2
- package/dist/src/utils/skills.js +3 -3
- package/dist/src/verify/__tests__/coverage-parsers.test.js +30 -30
- package/dist/src/verify/environment.js +2 -1
- package/package.json +1 -1
- package/dist/src/pil/layer16-clarity.test.js +0 -31
- /package/dist/src/{pil/layer16-clarity.test.d.ts → council/__tests__/clarification-prompt.test.d.ts} +0 -0
|
@@ -48,27 +48,27 @@ const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".gif", ".webp", ".bm
|
|
|
48
48
|
* Downstream agents consume this JSON directly instead of re-parsing markdown.
|
|
49
49
|
* Kept embedded in the prompt (not strict JSON-schema mode) for cross-provider portability.
|
|
50
50
|
*/
|
|
51
|
-
export const UI_LAYOUT_SCHEMA_HINT = `{
|
|
52
|
-
"viewport": { "width": number, "height": number, "deviceClass": "mobile" | "tablet" | "desktop" },
|
|
53
|
-
"tokens": {
|
|
54
|
-
"colors": [{ "name": string, "hex": string, "role": "primary" | "secondary" | "accent" | "bg" | "fg" | "border" | "muted" }],
|
|
55
|
-
"typography": [{ "role": "heading" | "body" | "caption" | "label", "fontFamily": string, "sizePx": number, "weight": number }],
|
|
56
|
-
"spacingScalePx": number[],
|
|
57
|
-
"radiusScalePx": number[]
|
|
58
|
-
},
|
|
59
|
-
"layout": { "type": "stack" | "grid" | "flex" | "absolute", "direction": "row" | "column", "gapPx": number, "columns": number | null },
|
|
60
|
-
"components": [{
|
|
61
|
-
"id": string,
|
|
62
|
-
"role": "button" | "input" | "card" | "nav" | "header" | "footer" | "image" | "icon" | "text" | "list" | "modal" | "tabs" | "table" | "chart" | "container" | "other",
|
|
63
|
-
"label": string,
|
|
64
|
-
"text": string | null,
|
|
65
|
-
"bbox": { "x": number, "y": number, "w": number, "h": number },
|
|
66
|
-
"style": { "bgHex": string | null, "fgHex": string | null, "borderHex": string | null, "radiusPx": number | null, "shadow": string | null },
|
|
67
|
-
"state": "default" | "hover" | "active" | "disabled" | "focus" | "error",
|
|
68
|
-
"children": string[]
|
|
69
|
-
}],
|
|
70
|
-
"hierarchy": [{ "level": 1 | 2 | 3, "text": string, "componentId": string }],
|
|
71
|
-
"notes": string[]
|
|
51
|
+
export const UI_LAYOUT_SCHEMA_HINT = `{
|
|
52
|
+
"viewport": { "width": number, "height": number, "deviceClass": "mobile" | "tablet" | "desktop" },
|
|
53
|
+
"tokens": {
|
|
54
|
+
"colors": [{ "name": string, "hex": string, "role": "primary" | "secondary" | "accent" | "bg" | "fg" | "border" | "muted" }],
|
|
55
|
+
"typography": [{ "role": "heading" | "body" | "caption" | "label", "fontFamily": string, "sizePx": number, "weight": number }],
|
|
56
|
+
"spacingScalePx": number[],
|
|
57
|
+
"radiusScalePx": number[]
|
|
58
|
+
},
|
|
59
|
+
"layout": { "type": "stack" | "grid" | "flex" | "absolute", "direction": "row" | "column", "gapPx": number, "columns": number | null },
|
|
60
|
+
"components": [{
|
|
61
|
+
"id": string,
|
|
62
|
+
"role": "button" | "input" | "card" | "nav" | "header" | "footer" | "image" | "icon" | "text" | "list" | "modal" | "tabs" | "table" | "chart" | "container" | "other",
|
|
63
|
+
"label": string,
|
|
64
|
+
"text": string | null,
|
|
65
|
+
"bbox": { "x": number, "y": number, "w": number, "h": number },
|
|
66
|
+
"style": { "bgHex": string | null, "fgHex": string | null, "borderHex": string | null, "radiusPx": number | null, "shadow": string | null },
|
|
67
|
+
"state": "default" | "hover" | "active" | "disabled" | "focus" | "error",
|
|
68
|
+
"children": string[]
|
|
69
|
+
}],
|
|
70
|
+
"hierarchy": [{ "level": 1 | 2 | 3, "text": string, "componentId": string }],
|
|
71
|
+
"notes": string[]
|
|
72
72
|
}`;
|
|
73
73
|
const MIME_MAP = {
|
|
74
74
|
".png": "image/png",
|
|
@@ -319,33 +319,33 @@ export async function askVisionProxy(question, imageIdOrPath, cwd, signal) {
|
|
|
319
319
|
export function getVisionGuidanceForTextOnly(modelId) {
|
|
320
320
|
if (!needsVisionProxy(modelId))
|
|
321
321
|
return "";
|
|
322
|
-
return `
|
|
323
|
-
VISION PROXY (text-only model):
|
|
324
|
-
You cannot see images directly. You have vision proxy tools to work with ANY image:
|
|
325
|
-
|
|
326
|
-
TOOLS:
|
|
327
|
-
- analyze_image: Proactively analyze an image from a file path, URL, or base64. Use this FIRST when you encounter or need to work with an image.
|
|
328
|
-
- ask_vision_proxy: Ask a specific follow-up question about any cached image (or provide a file path for a new image).
|
|
329
|
-
- list_vision_cache: See all cached images available for querying.
|
|
330
|
-
|
|
331
|
-
WHEN TO USE (be PROACTIVE, not passive):
|
|
332
|
-
- User mentions an image file → analyze_image immediately
|
|
333
|
-
- User pastes or references a screenshot → it's auto-analyzed, use ask_vision_proxy for details
|
|
334
|
-
- Working with UI/web pages → prefer browser_snapshot (text-based), use screenshot + ask_vision_proxy when visual details matter
|
|
335
|
-
- Reviewing design mockups, diagrams, charts → analyze_image the file
|
|
336
|
-
- Debugging visual issues (CSS, layout, colors) → take screenshot, then ask_vision_proxy specific questions
|
|
337
|
-
- Comparing before/after → analyze both images, ask about differences
|
|
338
|
-
- Reading text from images (OCR) → analyze_image with a question like "transcribe all text"
|
|
339
|
-
- Any file with image extension (.png, .jpg, .gif, .webp, .svg, etc.) → analyze_image
|
|
340
|
-
|
|
341
|
-
WORKFLOW:
|
|
342
|
-
1. Encounter image → analyze_image (or it's auto-analyzed from tool results)
|
|
343
|
-
2. Need more detail → ask_vision_proxy with specific question
|
|
344
|
-
3. Need to verify changes → take new screenshot/analyze new image → compare
|
|
345
|
-
|
|
346
|
-
Images are cached (up to ${IMAGE_CACHE_MAX}, ${IMAGE_CACHE_TTL_MS / 60000}min TTL). You can reference them by ID for follow-ups.
|
|
347
|
-
|
|
348
|
-
IMPORTANT: Do NOT guess what an image contains. Always use the proxy to get accurate information.
|
|
322
|
+
return `
|
|
323
|
+
VISION PROXY (text-only model):
|
|
324
|
+
You cannot see images directly. You have vision proxy tools to work with ANY image:
|
|
325
|
+
|
|
326
|
+
TOOLS:
|
|
327
|
+
- analyze_image: Proactively analyze an image from a file path, URL, or base64. Use this FIRST when you encounter or need to work with an image.
|
|
328
|
+
- ask_vision_proxy: Ask a specific follow-up question about any cached image (or provide a file path for a new image).
|
|
329
|
+
- list_vision_cache: See all cached images available for querying.
|
|
330
|
+
|
|
331
|
+
WHEN TO USE (be PROACTIVE, not passive):
|
|
332
|
+
- User mentions an image file → analyze_image immediately
|
|
333
|
+
- User pastes or references a screenshot → it's auto-analyzed, use ask_vision_proxy for details
|
|
334
|
+
- Working with UI/web pages → prefer browser_snapshot (text-based), use screenshot + ask_vision_proxy when visual details matter
|
|
335
|
+
- Reviewing design mockups, diagrams, charts → analyze_image the file
|
|
336
|
+
- Debugging visual issues (CSS, layout, colors) → take screenshot, then ask_vision_proxy specific questions
|
|
337
|
+
- Comparing before/after → analyze both images, ask about differences
|
|
338
|
+
- Reading text from images (OCR) → analyze_image with a question like "transcribe all text"
|
|
339
|
+
- Any file with image extension (.png, .jpg, .gif, .webp, .svg, etc.) → analyze_image
|
|
340
|
+
|
|
341
|
+
WORKFLOW:
|
|
342
|
+
1. Encounter image → analyze_image (or it's auto-analyzed from tool results)
|
|
343
|
+
2. Need more detail → ask_vision_proxy with specific question
|
|
344
|
+
3. Need to verify changes → take new screenshot/analyze new image → compare
|
|
345
|
+
|
|
346
|
+
Images are cached (up to ${IMAGE_CACHE_MAX}, ${IMAGE_CACHE_TTL_MS / 60000}min TTL). You can reference them by ID for follow-ups.
|
|
347
|
+
|
|
348
|
+
IMPORTANT: Do NOT guess what an image contains. Always use the proxy to get accurate information.
|
|
349
349
|
`;
|
|
350
350
|
}
|
|
351
351
|
// Keep backward compat export
|
|
@@ -28,7 +28,7 @@ const HEARTBEAT_EVERY_N_POLLS = 12; // ~60s at default 5s poll interval
|
|
|
28
28
|
function emitHeartbeat(runId) {
|
|
29
29
|
try {
|
|
30
30
|
const db = getDatabase();
|
|
31
|
-
db.prepare(`INSERT INTO interaction_logs (session_id, event_type, event_subtype, metadata_json, created_at)
|
|
31
|
+
db.prepare(`INSERT INTO interaction_logs (session_id, event_type, event_subtype, metadata_json, created_at)
|
|
32
32
|
VALUES (?, 'reporter', 'heartbeat', '{}', ?)`).run(runId, new Date().toISOString());
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
@@ -91,24 +91,24 @@ function buildSampleRuleCs(projectName, intent) {
|
|
|
91
91
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
92
92
|
.join("");
|
|
93
93
|
const contextTypeName = `${projectName}RuleContext`;
|
|
94
|
-
return `using Muonroi.RuleEngine.Abstractions;
|
|
95
|
-
using Muonroi.RuleEngine.Core;
|
|
96
|
-
|
|
97
|
-
namespace ${projectName}.Domain.Rules;
|
|
98
|
-
|
|
99
|
-
/// <summary>
|
|
100
|
-
/// Sample rule for intent: ${intent}.
|
|
101
|
-
/// Generated by muonroi-cli — replace stub logic with real business logic.
|
|
102
|
-
/// </summary>
|
|
103
|
-
[MExtractAsRule("SAMPLE_${intent.toUpperCase().replace(/[-\s]/g, "_")}", DependsOn = new string[] { })]
|
|
104
|
-
public class Sample${intentPascal}Rule : IRule<${contextTypeName}>
|
|
105
|
-
{
|
|
106
|
-
public Task<RuleResult> EvaluateAsync(${contextTypeName} context, CancellationToken cancellationToken = default)
|
|
107
|
-
{
|
|
108
|
-
// TODO: Replace with real ${intent} evaluation logic.
|
|
109
|
-
return Task.FromResult(RuleResult.Passed());
|
|
110
|
-
}
|
|
111
|
-
}
|
|
94
|
+
return `using Muonroi.RuleEngine.Abstractions;
|
|
95
|
+
using Muonroi.RuleEngine.Core;
|
|
96
|
+
|
|
97
|
+
namespace ${projectName}.Domain.Rules;
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// Sample rule for intent: ${intent}.
|
|
101
|
+
/// Generated by muonroi-cli — replace stub logic with real business logic.
|
|
102
|
+
/// </summary>
|
|
103
|
+
[MExtractAsRule("SAMPLE_${intent.toUpperCase().replace(/[-\s]/g, "_")}", DependsOn = new string[] { })]
|
|
104
|
+
public class Sample${intentPascal}Rule : IRule<${contextTypeName}>
|
|
105
|
+
{
|
|
106
|
+
public Task<RuleResult> EvaluateAsync(${contextTypeName} context, CancellationToken cancellationToken = default)
|
|
107
|
+
{
|
|
108
|
+
// TODO: Replace with real ${intent} evaluation logic.
|
|
109
|
+
return Task.FromResult(RuleResult.Passed());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
export async function generateSampleRule(serverDir, projectName, intent, fsOps) {
|
|
@@ -133,32 +133,32 @@ function buildSampleRuleTestCs(projectName, intent) {
|
|
|
133
133
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
134
134
|
.join("");
|
|
135
135
|
const contextTypeName = `${projectName}RuleContext`;
|
|
136
|
-
return `using Muonroi.RuleEngine.Abstractions;
|
|
137
|
-
using Muonroi.RuleEngine.Core;
|
|
138
|
-
using Xunit;
|
|
139
|
-
|
|
140
|
-
namespace ${projectName}.UnitTests.Rules;
|
|
141
|
-
|
|
142
|
-
/// <summary>
|
|
143
|
-
/// Tests for Sample${intentPascal}Rule.
|
|
144
|
-
/// Generated by muonroi-cli — extend with real test cases.
|
|
145
|
-
/// </summary>
|
|
146
|
-
public class Sample${intentPascal}RuleTests
|
|
147
|
-
{
|
|
148
|
-
[Fact]
|
|
149
|
-
public async Task EvaluateAsync_ReturnsRuleResultPassed()
|
|
150
|
-
{
|
|
151
|
-
// Arrange — senior-grade: uses FactBag + reflection-free context construction
|
|
152
|
-
var context = new ${contextTypeName}();
|
|
153
|
-
var rule = new Sample${intentPascal}Rule();
|
|
154
|
-
|
|
155
|
-
// Act
|
|
156
|
-
var result = await rule.EvaluateAsync(context, CancellationToken.None);
|
|
157
|
-
|
|
158
|
-
// Assert
|
|
159
|
-
Assert.Equal(RuleResultStatus.Passed, result.Status);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
136
|
+
return `using Muonroi.RuleEngine.Abstractions;
|
|
137
|
+
using Muonroi.RuleEngine.Core;
|
|
138
|
+
using Xunit;
|
|
139
|
+
|
|
140
|
+
namespace ${projectName}.UnitTests.Rules;
|
|
141
|
+
|
|
142
|
+
/// <summary>
|
|
143
|
+
/// Tests for Sample${intentPascal}Rule.
|
|
144
|
+
/// Generated by muonroi-cli — extend with real test cases.
|
|
145
|
+
/// </summary>
|
|
146
|
+
public class Sample${intentPascal}RuleTests
|
|
147
|
+
{
|
|
148
|
+
[Fact]
|
|
149
|
+
public async Task EvaluateAsync_ReturnsRuleResultPassed()
|
|
150
|
+
{
|
|
151
|
+
// Arrange — senior-grade: uses FactBag + reflection-free context construction
|
|
152
|
+
var context = new ${contextTypeName}();
|
|
153
|
+
var rule = new Sample${intentPascal}Rule();
|
|
154
|
+
|
|
155
|
+
// Act
|
|
156
|
+
var result = await rule.EvaluateAsync(context, CancellationToken.None);
|
|
157
|
+
|
|
158
|
+
// Assert
|
|
159
|
+
Assert.Equal(RuleResultStatus.Passed, result.Status);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
162
|
`;
|
|
163
163
|
}
|
|
164
164
|
export async function generateSampleRuleTest(serverDir, projectName, intent, fsOps) {
|
|
@@ -246,9 +246,9 @@ export async function copyBoundaryScript(serverDir, bbRepoRoot, fsOps) {
|
|
|
246
246
|
const ciContent = fsOps.readFile(ciYmlPath);
|
|
247
247
|
// Idempotency: skip if already wired
|
|
248
248
|
if (!ciContent.includes(BOUNDARIES_SCRIPT_NAME)) {
|
|
249
|
-
const boundaryStep = `
|
|
250
|
-
- name: Check modular boundaries
|
|
251
|
-
run: pwsh ./scripts/${BOUNDARIES_SCRIPT_NAME} -RepoRoot .
|
|
249
|
+
const boundaryStep = `
|
|
250
|
+
- name: Check modular boundaries
|
|
251
|
+
run: pwsh ./scripts/${BOUNDARIES_SCRIPT_NAME} -RepoRoot .
|
|
252
252
|
`;
|
|
253
253
|
// Append before the last line or after the last job step
|
|
254
254
|
const updated = `${ciContent.trimEnd()}\n${boundaryStep}\n`;
|
|
@@ -93,11 +93,11 @@ export async function runQualityGateWithRetry(opts, onRetryCodeGen) {
|
|
|
93
93
|
const failureSummary = firstResult.failures
|
|
94
94
|
.map((f) => `### ${f.step}\n\`\`\`\n${f.output.slice(0, 500)}\n\`\`\``)
|
|
95
95
|
.join("\n\n");
|
|
96
|
-
const councilPrompt = `${opts.intentPrompt}
|
|
97
|
-
|
|
98
|
-
## Gate failures (please fix in next iteration)
|
|
99
|
-
${failureSummary}
|
|
100
|
-
|
|
96
|
+
const councilPrompt = `${opts.intentPrompt}
|
|
97
|
+
|
|
98
|
+
## Gate failures (please fix in next iteration)
|
|
99
|
+
${failureSummary}
|
|
100
|
+
|
|
101
101
|
Please revise the BB ecosystem wiring to fix these compilation/boundary errors.`;
|
|
102
102
|
// Call council once with failures appended
|
|
103
103
|
await continueAsCouncil({
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
export function buildIdealContinuationPrompt(input) {
|
|
2
2
|
const { originalPrompt, projectDir, templateName, installedPackages } = input;
|
|
3
3
|
const packagesSuffix = installedPackages && installedPackages.length > 0 ? ` with packages: ${installedPackages.join(", ")}` : "";
|
|
4
|
-
return `You are continuing a /ideal product loop. The project has been scaffolded at ${projectDir} using the BB template ${templateName}${packagesSuffix}.
|
|
5
|
-
|
|
6
|
-
User's original request:
|
|
7
|
-
"${originalPrompt}"
|
|
8
|
-
|
|
9
|
-
You MUST implement this feature now. Do NOT ask the user for clarification unless a hard blocker is reached (missing API key, ambiguous schema requirement, etc.).
|
|
10
|
-
|
|
11
|
-
Execute these steps in order:
|
|
12
|
-
|
|
13
|
-
1. Discover structure (1-2 tool calls max)
|
|
14
|
-
- PREFERRED: if a \`muonroi-docs\` MCP tool is in your tool list (look for any \`mcp_*docs*_docs_search\` tool), call it with query \`"${templateName} structure overview"\`. This is faster than reading files.
|
|
15
|
-
- FALLBACK: list the project directory, then read whichever of \`README.md\`, \`AGENTS.md\`, \`Agent.md\`, \`EE-INTENT.md\` actually exist (do NOT assume — missing files are fine, just skip them).
|
|
16
|
-
- Identify: project name, main entry point (Program.cs / Gateway), modular boundaries, where to add new domain code.
|
|
17
|
-
|
|
18
|
-
IMPORTANT — Template sample files are REFERENCE ONLY:
|
|
19
|
-
- The BB template ships example code (e.g. \`todo-app.Catalog\`, sample \`TodoRepository\`, \`Catalog\` controller, \`DocTemplateDbContext\`, \`BaseTemplateDbContext\`) named after the template/demo, NOT after the user's project.
|
|
20
|
-
- Read AT MOST ONE such sample file to learn the convention, then DELETE all template sample directories before generating your real domain code. They are reference, not the user's feature.
|
|
21
|
-
- Do not re-read the same sample file repeatedly. If you need its pattern again, recall from memory or rely on \`docs.search\`.
|
|
22
|
-
- RENAME every file/class/namespace that still contains the literal token \`BaseTemplate\`, \`DocTemplate\`, or \`TemplateSample\` to a project-appropriate name BEFORE writing domain code. After cleanup, \`git grep -i basetemplate\` MUST return zero hits — the post-scaffold quality gate fails if any survive.
|
|
23
|
-
- DELETE any stub \`<projectName>.Catalog/\` directory that lives at server root next to \`server/src/Services/\` — \`dotnet new\` may emit a duplicate empty stub.
|
|
24
|
-
|
|
25
|
-
.NET / C# conventions to follow:
|
|
26
|
-
- Async methods MUST accept and forward \`CancellationToken\` to every downstream await; suffix names with \`Async\`.
|
|
27
|
-
- Prefer singular folder names that already exist in the template; if you add new folders, use \`Infrastructure\` (singular), \`Enums\` (plural), \`Authorization\` instead of "Permissioning".
|
|
28
|
-
- Namespace MUST mirror the folder path under the project, in PascalCase.
|
|
29
|
-
- DTO ≠ Entity. Don't return EF entities from controllers — always project to a DTO.
|
|
30
|
-
- DI registration uses \`AddX*\` extension methods in a static class under \`Extensions/\` or \`DependencyInjection/\`; wire them from \`Program.cs\`. Do not register services inline in \`Program.cs\`.
|
|
31
|
-
|
|
32
|
-
Frontend / client/ conventions (apply ONLY if a \`client/\` directory exists in the scaffold):
|
|
33
|
-
- NEVER delete or overwrite \`SemanticProvider\`, \`createSemanticRegistry\`, or any \`<Semantic ...>\` wrapper that the scaffold wrote into \`main.tsx\` / \`app.component.ts\`. The agent harness depends on them — removing them silently breaks all E2E specs. If you rewrite \`main.tsx\`, re-include the existing SemanticProvider block verbatim.
|
|
34
|
-
- Wrap every NEW user-visible region with \`<Semantic id="..." role="..." name="...">\` (composer, list, listitem, modal, statusbar). Pick \`role\` from the union in \`@muonroi/agent-harness-core/protocol\`.
|
|
35
|
-
- NEVER hardcode API URLs in components. Read from \`import.meta.env.VITE_API_BASE\` (React/Vite) or \`environment.apiBase\` (Angular). If \`.env.example\` does not exist yet, create it with a sensible default; never inline \`http://localhost:5000\` or similar in source.
|
|
36
|
-
- Put HTTP + DTO code under \`client/src/api/\`. Define request/response types in \`api/types.ts\` (mirror the C# DTO names). Components import a typed client; never call \`fetch\` directly.
|
|
37
|
-
- Every async view needs THREE states: loading, empty, error. Surface errors via a toast/notification component, not \`console.error\`. Provide an \`ErrorBoundary\` at the app shell.
|
|
38
|
-
- No inline \`style={{...}}\` literals — use CSS modules (\`*.module.css\`) or utility classes (Tailwind if scaffolded). If neither is present, write tokens + reset into \`src/styles/app.css\` and import it ONCE in main; reference variables via \`var(--color-...)\`.
|
|
39
|
-
- TypeScript MUST be strict. If \`tsconfig.json\` does not have \`"strict": true\`, add it. Run \`bunx tsc --noEmit\` before declaring done — it must exit 0.
|
|
40
|
-
- Run \`bun run build\` from \`client/\` before declaring done — it must exit 0 with zero browser-side console errors.
|
|
41
|
-
|
|
42
|
-
2. Design the feature
|
|
43
|
-
- List the domain entity(ies), DTOs, endpoints, persistence model.
|
|
44
|
-
- Match BB conventions (controller-per-resource, MediatR/CQRS if used, validation patterns observed in step 1).
|
|
45
|
-
- State your design in 5-10 lines before generating code.
|
|
46
|
-
|
|
47
|
-
3. Generate code
|
|
48
|
-
- Create files in the locations identified in step 1.
|
|
49
|
-
- Wire DI in Program.cs (use BB extension methods if present).
|
|
50
|
-
- Mirror existing patterns — same namespaces, attributes, error-handling style.
|
|
51
|
-
|
|
52
|
-
4. Verify
|
|
53
|
-
- Run \`dotnet build\` from the server root — must exit 0.
|
|
54
|
-
- If a \`client/\` directory exists, also run \`bun install\` and \`bun run build\` from \`client/\`.
|
|
55
|
-
- Report concrete evidence: build output excerpt + file list created.
|
|
56
|
-
|
|
57
|
-
5. Summarize
|
|
58
|
-
- 3-5 bullets: what was added, where, how to test manually.
|
|
59
|
-
|
|
60
|
-
Constraints:
|
|
61
|
-
- Don't re-scaffold. Don't run \`dotnet new\` again.
|
|
62
|
-
- Don't \`cd\` into ${projectDir} — your working directory is already there.
|
|
63
|
-
- Don't ask "do you want me to continue?" — proceed end-to-end.
|
|
4
|
+
return `You are continuing a /ideal product loop. The project has been scaffolded at ${projectDir} using the BB template ${templateName}${packagesSuffix}.
|
|
5
|
+
|
|
6
|
+
User's original request:
|
|
7
|
+
"${originalPrompt}"
|
|
8
|
+
|
|
9
|
+
You MUST implement this feature now. Do NOT ask the user for clarification unless a hard blocker is reached (missing API key, ambiguous schema requirement, etc.).
|
|
10
|
+
|
|
11
|
+
Execute these steps in order:
|
|
12
|
+
|
|
13
|
+
1. Discover structure (1-2 tool calls max)
|
|
14
|
+
- PREFERRED: if a \`muonroi-docs\` MCP tool is in your tool list (look for any \`mcp_*docs*_docs_search\` tool), call it with query \`"${templateName} structure overview"\`. This is faster than reading files.
|
|
15
|
+
- FALLBACK: list the project directory, then read whichever of \`README.md\`, \`AGENTS.md\`, \`Agent.md\`, \`EE-INTENT.md\` actually exist (do NOT assume — missing files are fine, just skip them).
|
|
16
|
+
- Identify: project name, main entry point (Program.cs / Gateway), modular boundaries, where to add new domain code.
|
|
17
|
+
|
|
18
|
+
IMPORTANT — Template sample files are REFERENCE ONLY:
|
|
19
|
+
- The BB template ships example code (e.g. \`todo-app.Catalog\`, sample \`TodoRepository\`, \`Catalog\` controller, \`DocTemplateDbContext\`, \`BaseTemplateDbContext\`) named after the template/demo, NOT after the user's project.
|
|
20
|
+
- Read AT MOST ONE such sample file to learn the convention, then DELETE all template sample directories before generating your real domain code. They are reference, not the user's feature.
|
|
21
|
+
- Do not re-read the same sample file repeatedly. If you need its pattern again, recall from memory or rely on \`docs.search\`.
|
|
22
|
+
- RENAME every file/class/namespace that still contains the literal token \`BaseTemplate\`, \`DocTemplate\`, or \`TemplateSample\` to a project-appropriate name BEFORE writing domain code. After cleanup, \`git grep -i basetemplate\` MUST return zero hits — the post-scaffold quality gate fails if any survive.
|
|
23
|
+
- DELETE any stub \`<projectName>.Catalog/\` directory that lives at server root next to \`server/src/Services/\` — \`dotnet new\` may emit a duplicate empty stub.
|
|
24
|
+
|
|
25
|
+
.NET / C# conventions to follow:
|
|
26
|
+
- Async methods MUST accept and forward \`CancellationToken\` to every downstream await; suffix names with \`Async\`.
|
|
27
|
+
- Prefer singular folder names that already exist in the template; if you add new folders, use \`Infrastructure\` (singular), \`Enums\` (plural), \`Authorization\` instead of "Permissioning".
|
|
28
|
+
- Namespace MUST mirror the folder path under the project, in PascalCase.
|
|
29
|
+
- DTO ≠ Entity. Don't return EF entities from controllers — always project to a DTO.
|
|
30
|
+
- DI registration uses \`AddX*\` extension methods in a static class under \`Extensions/\` or \`DependencyInjection/\`; wire them from \`Program.cs\`. Do not register services inline in \`Program.cs\`.
|
|
31
|
+
|
|
32
|
+
Frontend / client/ conventions (apply ONLY if a \`client/\` directory exists in the scaffold):
|
|
33
|
+
- NEVER delete or overwrite \`SemanticProvider\`, \`createSemanticRegistry\`, or any \`<Semantic ...>\` wrapper that the scaffold wrote into \`main.tsx\` / \`app.component.ts\`. The agent harness depends on them — removing them silently breaks all E2E specs. If you rewrite \`main.tsx\`, re-include the existing SemanticProvider block verbatim.
|
|
34
|
+
- Wrap every NEW user-visible region with \`<Semantic id="..." role="..." name="...">\` (composer, list, listitem, modal, statusbar). Pick \`role\` from the union in \`@muonroi/agent-harness-core/protocol\`.
|
|
35
|
+
- NEVER hardcode API URLs in components. Read from \`import.meta.env.VITE_API_BASE\` (React/Vite) or \`environment.apiBase\` (Angular). If \`.env.example\` does not exist yet, create it with a sensible default; never inline \`http://localhost:5000\` or similar in source.
|
|
36
|
+
- Put HTTP + DTO code under \`client/src/api/\`. Define request/response types in \`api/types.ts\` (mirror the C# DTO names). Components import a typed client; never call \`fetch\` directly.
|
|
37
|
+
- Every async view needs THREE states: loading, empty, error. Surface errors via a toast/notification component, not \`console.error\`. Provide an \`ErrorBoundary\` at the app shell.
|
|
38
|
+
- No inline \`style={{...}}\` literals — use CSS modules (\`*.module.css\`) or utility classes (Tailwind if scaffolded). If neither is present, write tokens + reset into \`src/styles/app.css\` and import it ONCE in main; reference variables via \`var(--color-...)\`.
|
|
39
|
+
- TypeScript MUST be strict. If \`tsconfig.json\` does not have \`"strict": true\`, add it. Run \`bunx tsc --noEmit\` before declaring done — it must exit 0.
|
|
40
|
+
- Run \`bun run build\` from \`client/\` before declaring done — it must exit 0 with zero browser-side console errors.
|
|
41
|
+
|
|
42
|
+
2. Design the feature
|
|
43
|
+
- List the domain entity(ies), DTOs, endpoints, persistence model.
|
|
44
|
+
- Match BB conventions (controller-per-resource, MediatR/CQRS if used, validation patterns observed in step 1).
|
|
45
|
+
- State your design in 5-10 lines before generating code.
|
|
46
|
+
|
|
47
|
+
3. Generate code
|
|
48
|
+
- Create files in the locations identified in step 1.
|
|
49
|
+
- Wire DI in Program.cs (use BB extension methods if present).
|
|
50
|
+
- Mirror existing patterns — same namespaces, attributes, error-handling style.
|
|
51
|
+
|
|
52
|
+
4. Verify
|
|
53
|
+
- Run \`dotnet build\` from the server root — must exit 0.
|
|
54
|
+
- If a \`client/\` directory exists, also run \`bun install\` and \`bun run build\` from \`client/\`.
|
|
55
|
+
- Report concrete evidence: build output excerpt + file list created.
|
|
56
|
+
|
|
57
|
+
5. Summarize
|
|
58
|
+
- 3-5 bullets: what was added, where, how to test manually.
|
|
59
|
+
|
|
60
|
+
Constraints:
|
|
61
|
+
- Don't re-scaffold. Don't run \`dotnet new\` again.
|
|
62
|
+
- Don't \`cd\` into ${projectDir} — your working directory is already there.
|
|
63
|
+
- Don't ask "do you want me to continue?" — proceed end-to-end.
|
|
64
64
|
- If you hit a blocker that genuinely needs the user, state EXACTLY which decision is blocking and stop.`;
|
|
65
65
|
}
|
|
66
66
|
//# sourceMappingURL=continuation-prompt.js.map
|