zefiro 0.6.1 → 0.6.2

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 (3) hide show
  1. package/dist/cli.js +11 -8
  2. package/dist/mcp.js +110 -18
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8102,16 +8102,19 @@ function registerAuth(program2) {
8102
8102
  // src/commands/mcp.ts
8103
8103
  var import_picocolors = __toESM(require_picocolors(), 1);
8104
8104
  var TOOLS = [
8105
- "zefiro_scan_codebase — scan project test infrastructure",
8106
- "zefiro_scan_ast — deep AST scan: routes, components, hooks",
8107
- "zefiro_scan_ast_detail — drill into a specific AST category",
8108
- "zefiro_build_qa_map validate + write QAMapV2Payload",
8109
- "zefiro_read_qa_map read existing QA map file"
8105
+ "zefiro_scan_codebase — scan project test infrastructure",
8106
+ "zefiro_scan_ast — deep AST scan: routes, components, hooks",
8107
+ "zefiro_scan_ast_detail — drill into a specific AST category",
8108
+ "zefiro_extract_state_variables V4: extract state variables from AST",
8109
+ "zefiro_build_v4_graph V4: build formal model from AST + state",
8110
+ "zefiro_build_qa_map — validate + write QA map (V2/V3/V4)",
8111
+ "zefiro_read_qa_map — read existing QA map file"
8110
8112
  ];
8111
8113
  var DESKTOP_CONFIG = JSON.stringify({
8112
8114
  mcpServers: {
8113
8115
  zefiro: {
8114
- command: "zefiro-mcp"
8116
+ command: "npx",
8117
+ args: ["-y", "@qai/zefiro", "mcp", "start"]
8115
8118
  }
8116
8119
  }
8117
8120
  }, null, 2);
@@ -8122,10 +8125,10 @@ function registerMcp(program2) {
8122
8125
  console.log(import_picocolors.default.dim(" " + "─".repeat(42)));
8123
8126
  console.log("");
8124
8127
  console.log(import_picocolors.default.bold(" Claude Code — add to project:"));
8125
- console.log(import_picocolors.default.cyan(" claude mcp add zefiro -- zefiro-mcp"));
8128
+ console.log(import_picocolors.default.cyan(" claude mcp add zefiro -- npx -y @qai/zefiro mcp start"));
8126
8129
  console.log("");
8127
8130
  console.log(import_picocolors.default.bold(" Claude Code — add globally:"));
8128
- console.log(import_picocolors.default.cyan(" claude mcp add zefiro -s user -- zefiro-mcp"));
8131
+ console.log(import_picocolors.default.cyan(" claude mcp add zefiro -s user -- npx -y @qai/zefiro mcp start"));
8129
8132
  console.log("");
8130
8133
  console.log(import_picocolors.default.bold(" Claude Desktop / other clients"));
8131
8134
  console.log(import_picocolors.default.dim(" ~/.config/claude/claude_desktop_config.json"));
package/dist/mcp.js CHANGED
@@ -15046,16 +15046,59 @@ var SERVER_INSTRUCTIONS = `
15046
15046
  # Zefiro — Scanner & QA Map Guide
15047
15047
 
15048
15048
  You have access to Zefiro, an AI-powered codebase scanner and QA map generator.
15049
- Supports three schema versions: V2 (flat/linear), V3 (hierarchical/DAG), and V4 (formal model). **Default to V3 for AI analysis, V4 for formal graph-based analysis.**
15050
-
15051
- ## Core Workflow
15052
-
15053
- 1. **Scan.** Call \`zefiro_scan_ast()\` to run the AST scanner and get a compact summary.
15054
- 2. **Explore.** Use \`zefiro_scan_ast_detail()\` to drill into routes, components, hooks, files, or navigationPatterns.
15055
- 3. **Propose & discuss.** Present candidate features to the user, ask clarifying questions.
15056
- 4. **Build.** Construct the QA map payload and validate with \`zefiro_build_qa_map({ dryRun: true })\`.
15057
- 5. **Write.** Once validated and approved, call \`zefiro_build_qa_map({ dryRun: false })\` to save.
15058
- 6. **Read existing.** Use \`zefiro_read_qa_map()\` to load a previously generated QA map.
15049
+ Supports three schema versions: V2 (flat/linear), V3 (hierarchical/DAG), and V4 (formal model).
15050
+
15051
+ ## IMPORTANT: Ask for Schema Version First
15052
+
15053
+ Before starting any analysis, **ask the user which QA map version to build**:
15054
+
15055
+ - **V2** Flat features, linear workflows, string-based conditions. Best for simple apps.
15056
+ - **V3** Hierarchical sections features sub-features, DAG workflows, typed conditions. Best for complex apps with many user flows.
15057
+ - **V4** Formal layered model (structural graph + state space + transition system + semantic projection). Best for apps where state management, guards, and permissions are critical.
15058
+
15059
+ Default to **V3** if the user has no preference.
15060
+
15061
+ ## Version-Specific Workflows
15062
+
15063
+ ### V2 Workflow (flat/linear)
15064
+ 1. **Scan.** \`zefiro_scan_ast()\`
15065
+ 2. **Explore.** \`zefiro_scan_ast_detail()\` — focus on routes, components
15066
+ 3. **Analyze.** Act as the \`feature-analyzer-agent\`: identify flat features from routes, group by domain
15067
+ 4. **Enrich.** Act as the \`workflow-agent\`: map linear workflow steps per feature
15068
+ 5. **Scenarios.** Act as the \`scenario-planner-agent\`: generate test scenarios per workflow
15069
+ 6. **Build.** \`zefiro_build_qa_map({ payload, dryRun: true })\` — payload must NOT include schemaVersion
15070
+ 7. **Write.** \`zefiro_build_qa_map({ dryRun: false })\`
15071
+
15072
+ ### V3 Workflow (hierarchical/DAG)
15073
+ 1. **Scan.** \`zefiro_scan_ast()\`
15074
+ 2. **Explore.** \`zefiro_scan_ast_detail()\` — use routes (layoutChain, routeGroup), navigationPatterns, components (conditionalCount, guardPatterns)
15075
+ 3. **Analyze.** Act as the \`feature-analyzer-agent-v3\`: group into sections, identify hierarchical features with entry points
15076
+ 4. **Enrich.** Act as the \`workflow-agent-v3\`: build DAG workflows with typed conditions, edges, and entry/exit steps
15077
+ 5. **Scenarios.** Act as the \`scenario-planner-agent-v3\`: generate scenarios that trace DAG paths
15078
+ 6. **Build.** \`zefiro_build_qa_map({ payload, dryRun: true })\` — payload must include \`schemaVersion: 3\`
15079
+ 7. **Write.** \`zefiro_build_qa_map({ dryRun: false })\`
15080
+
15081
+ ### V4 Workflow (formal model)
15082
+ 1. **Scan.** \`zefiro_scan_ast()\`
15083
+ 2. **Extract state.** \`zefiro_extract_state_variables()\` — gets auth guards, roles, flags, permissions
15084
+ 3. **Build graph.** \`zefiro_build_v4_graph()\` — builds structural graph + state space + transition system deterministically
15085
+ 4. **Label.** Act as the \`feature-analyzer-agent-v4\`: add semantic projection (feature labels over the formal model)
15086
+ 5. **Build.** \`zefiro_build_qa_map({ payload, dryRun: true })\` — payload must include \`schemaVersion: 4\`
15087
+ 6. **Write.** \`zefiro_build_qa_map({ dryRun: false })\`
15088
+
15089
+ ## Agent Reference
15090
+
15091
+ Each version uses different agents. When acting as an agent, load its prompt from \`.qai/zefiro/agents/\` (project-local) or the package defaults:
15092
+
15093
+ | Version | Agent | Purpose |
15094
+ |---------|-------|---------|
15095
+ | V2 | \`feature-analyzer-agent\` | Identify flat features from routes |
15096
+ | V2 | \`workflow-agent\` | Map linear workflow steps per feature |
15097
+ | V2 | \`scenario-planner-agent\` | Generate test scenarios |
15098
+ | V3 | \`feature-analyzer-agent-v3\` | Group sections, hierarchical features, entry points |
15099
+ | V3 | \`workflow-agent-v3\` | Build DAG workflows with typed conditions |
15100
+ | V3 | \`scenario-planner-agent-v3\` | Generate DAG-path scenarios |
15101
+ | V4 | \`feature-analyzer-agent-v4\` | Label semantic projection over formal model |
15059
15102
 
15060
15103
  ## Tools
15061
15104
 
@@ -15064,16 +15107,16 @@ Supports three schema versions: V2 (flat/linear), V3 (hierarchical/DAG), and V4
15064
15107
  - \`zefiro_scan_ast_detail\` — drill into a specific AST category (routes, components, hooks, dependencies, files, navigationPatterns)
15065
15108
  - \`zefiro_extract_state_variables\` — V4: extract state variables (auth, roles, flags, permissions) from scanned AST
15066
15109
  - \`zefiro_build_v4_graph\` — V4: build formal model (structural graph + state space + transition system) from AST + state variables
15067
- - \`zefiro_build_qa_map\` — validate + write QA map payload (V2, V3, or V4 auto-detected)
15110
+ - \`zefiro_build_qa_map\` — validate + write QA map payload (V2, V3, or V4 auto-detected by schemaVersion field)
15068
15111
  - \`zefiro_read_qa_map\` — read existing QA map
15069
15112
 
15070
- ## Scanner V3 Enhancements
15113
+ ## Scanner Enhancements (V3/V4)
15071
15114
 
15072
- The AST scanner extracts additional data useful for V3 map generation:
15073
- - **Navigation patterns**: \`<Link>\`, \`router.push()\`, \`redirect()\` — used for entry point detection
15074
- - **Layout chains**: layout files in route hierarchy — used for section grouping
15075
- - **Route groups**: Next.js route groups like \`(authenticated)\` — section boundaries
15076
- - **Conditional logic**: if/ternary/switch counts and guard patterns per component — branching hints
15115
+ The AST scanner extracts additional data useful for V3 and V4 map generation:
15116
+ - **Navigation patterns**: \`<Link>\`, \`router.push()\`, \`redirect()\` — used for entry point detection (V3) and structural edges (V4)
15117
+ - **Layout chains**: layout files in route hierarchy — used for section grouping (V3)
15118
+ - **Route groups**: Next.js route groups like \`(authenticated)\` — section boundaries (V3) and guard patterns (V4)
15119
+ - **Conditional logic**: if/ternary/switch counts and guard patterns per component — branching hints (V3) and state variable extraction (V4)
15077
15120
 
15078
15121
  Use \`zefiro_scan_ast_detail({ category: "navigationPatterns" })\` to explore navigation links.
15079
15122
  Routes returned by \`zefiro_scan_ast_detail({ category: "routes" })\` include \`layoutChain\` and \`routeGroup\`.
@@ -15240,6 +15283,55 @@ V3 payloads include \`schemaVersion: 3\` and support hierarchical features, DAG
15240
15283
 
15241
15284
  ---
15242
15285
 
15286
+ ## QAMapV4Payload Schema Reference (formal model)
15287
+
15288
+ V4 payloads include \`schemaVersion: 4\` and use a 4-layer deterministic model.
15289
+
15290
+ ### Top-level structure
15291
+ \`\`\`
15292
+ {
15293
+ schemaVersion: 4
15294
+ structuralGraph: { nodes: StructuralNode[], edges: StructuralEdge[], entryPoints: string[] }
15295
+ stateSpace: { variables: StateVariable[], constraints: StateConstraint[], configurations: StateConfig[] }
15296
+ transitionSystem: { nodes: TransitionNode[], transitions: Transition[], stats: object }
15297
+ semanticProjection: { features: FeatureV4[], labels: SemanticLabel[] }
15298
+ commitSha?: string
15299
+ metadata?: object
15300
+ }
15301
+ \`\`\`
15302
+
15303
+ ### StructuralNode (Layer 0 — routes/pages)
15304
+ \`\`\`
15305
+ { id, routePath, filePath, isDynamic, layoutChain, components[], forms[], apiCalls[], guards[] }
15306
+ \`\`\`
15307
+
15308
+ ### StateVariable (Layer 1 — state dimensions)
15309
+ \`\`\`
15310
+ { id, name, category: "auth-guard"|"role"|"feature-flag"|"permission"|"ui-state"|"url-param", domain: string[], extractionConfidence: "high"|"medium"|"low" }
15311
+ \`\`\`
15312
+
15313
+ ### TransitionNode (Layer 2 — route × state config)
15314
+ \`\`\`
15315
+ { id, routeId, stateConfigId, availableActions[], isEntryPoint }
15316
+ \`\`\`
15317
+
15318
+ ### Transition (Layer 2 — state machine edges)
15319
+ \`\`\`
15320
+ { id, fromNodeId, toNodeId, trigger, guards: { variableId, operator, value }[], effects: { variableId, newValue }[] }
15321
+ \`\`\`
15322
+
15323
+ ### FeatureV4 (Layer 3 — semantic labels)
15324
+ \`\`\`
15325
+ { name, subgraph: { routeIds[], transitionIds[], stateVariableIds[] }, complexity, criticalPaths }
15326
+ \`\`\`
15327
+
15328
+ ### V4 rules
15329
+ - Layers 0-2 are built deterministically by \`zefiro_build_v4_graph\`
15330
+ - Layer 3 (semantic projection) is the only AI-generated layer
15331
+ - All node/edge IDs must be internally consistent across layers
15332
+
15333
+ ---
15334
+
15243
15335
  ## QAMapV2Payload Schema Reference (legacy)
15244
15336
 
15245
15337
  V2 payloads do NOT include a schemaVersion field. Flat features, linear workflow steps.
@@ -15262,7 +15354,7 @@ V2 payloads do NOT include a schemaVersion field. Flat features, linear workflow
15262
15354
  ### V2 ConditionalBranch: \`{ condition, outcome, type: "validation"|"permission"|"error"|"business-logic" }\`
15263
15355
  ### V2 Scenario: \`{ id, workflowId, featureId, name, description, category, preconditions: string[], steps: ScenarioStep[], expectedOutcome, componentIds: string[], workflowStepIds: string[], priority }\`
15264
15356
  `.trim();
15265
- var server = new McpServer({ name: "zefiro", version: "0.6.1" }, { instructions: SERVER_INSTRUCTIONS });
15357
+ var server = new McpServer({ name: "zefiro", version: "0.6.2" }, { instructions: SERVER_INSTRUCTIONS });
15266
15358
  server.registerTool("zefiro_scan_codebase", {
15267
15359
  title: "Scan Codebase",
15268
15360
  description: "Scan a project directory for test files, configs, fixtures, path aliases, and sample test content.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zefiro",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zefiro": "./dist/cli.js",