zefiro 0.8.0 → 0.8.1

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.
@@ -0,0 +1,119 @@
1
+ import {
2
+ exports_external
3
+ } from "./cli-z2krvkcq.js";
4
+
5
+ // src/config/schema.ts
6
+ function nested(shape) {
7
+ const inner = exports_external.object(shape);
8
+ return exports_external.preprocess((val) => val ?? {}, inner);
9
+ }
10
+ var PathsSchema = exports_external.object({
11
+ workingDir: exports_external.string().default(".qai/zefiro"),
12
+ outputDir: exports_external.string().default("app-report")
13
+ });
14
+ var BrowserSchema = exports_external.object({
15
+ sessionName: exports_external.string().default("zefiro"),
16
+ headed: exports_external.boolean().default(false),
17
+ viewport: exports_external.object({
18
+ width: exports_external.number().default(1440),
19
+ height: exports_external.number().default(900)
20
+ }).default({ width: 1440, height: 900 }),
21
+ waitStrategy: exports_external.enum(["networkidle", "load", "domcontentloaded"]).default("networkidle"),
22
+ waitDelay: exports_external.number().default(1500),
23
+ maxPages: exports_external.number().default(100),
24
+ pageTimeout: exports_external.number().default(30000),
25
+ excludePatterns: exports_external.array(exports_external.string()).default([])
26
+ });
27
+ var AuthSchema = exports_external.object({
28
+ method: exports_external.enum(["state-file", "manual"]).default("manual"),
29
+ stateFile: exports_external.string().nullable().default(null)
30
+ });
31
+ var QaiConfigSchema = exports_external.object({
32
+ baseUrl: exports_external.string().nullable().default(null),
33
+ paths: nested(PathsSchema.shape),
34
+ browser: nested(BrowserSchema.shape),
35
+ auth: nested(AuthSchema.shape),
36
+ contextFile: exports_external.string().default(".qai/zefiro/context.md")
37
+ });
38
+ function defineConfig(config) {
39
+ return config;
40
+ }
41
+
42
+ // src/config/loader.ts
43
+ import { existsSync } from "node:fs";
44
+ import { dirname, join, resolve } from "node:path";
45
+ import { pathToFileURL } from "node:url";
46
+ var CONFIG_DIR = ".qai/zefiro";
47
+ var LEGACY_CONFIG_DIR = ".e2e-ai";
48
+ var CONFIG_FILENAMES = ["config.ts", "config.js", "config.mjs"];
49
+ var cachedConfig = null;
50
+ var cachedProjectRoot = null;
51
+ function findConfigDir(startDir) {
52
+ let dir = resolve(startDir);
53
+ const root = dirname(dir) === dir ? dir : undefined;
54
+ while (true) {
55
+ for (const configDir of [CONFIG_DIR, LEGACY_CONFIG_DIR]) {
56
+ const candidate = join(dir, configDir);
57
+ if (existsSync(join(candidate, "agents")) || existsSync(join(candidate, "context.md"))) {
58
+ return dir;
59
+ }
60
+ if (configDir === CONFIG_DIR && existsSync(candidate)) {
61
+ return dir;
62
+ }
63
+ for (const name of CONFIG_FILENAMES) {
64
+ if (existsSync(join(candidate, name))) {
65
+ return dir;
66
+ }
67
+ }
68
+ }
69
+ const parent = dirname(dir);
70
+ if (parent === dir || dir === root)
71
+ return null;
72
+ dir = parent;
73
+ }
74
+ }
75
+ function getProjectRoot() {
76
+ if (cachedProjectRoot)
77
+ return cachedProjectRoot;
78
+ const found = findConfigDir(process.cwd());
79
+ cachedProjectRoot = found ?? process.cwd();
80
+ return cachedProjectRoot;
81
+ }
82
+ function getPackageRoot() {
83
+ let dir = import.meta.dirname;
84
+ while (!existsSync(join(dir, "package.json"))) {
85
+ const parent = dirname(dir);
86
+ if (parent === dir)
87
+ return dir;
88
+ dir = parent;
89
+ }
90
+ return dir;
91
+ }
92
+ async function loadConfig() {
93
+ if (cachedConfig)
94
+ return cachedConfig;
95
+ const projectRoot = getProjectRoot();
96
+ let userConfig = {};
97
+ for (const configDir of [CONFIG_DIR, LEGACY_CONFIG_DIR]) {
98
+ const dir = join(projectRoot, configDir);
99
+ let found = false;
100
+ for (const name of CONFIG_FILENAMES) {
101
+ const configPath = join(dir, name);
102
+ if (existsSync(configPath)) {
103
+ try {
104
+ const fileUrl = pathToFileURL(configPath).href;
105
+ const mod = await import(fileUrl);
106
+ userConfig = mod.default ?? mod;
107
+ found = true;
108
+ break;
109
+ } catch {}
110
+ }
111
+ }
112
+ if (found)
113
+ break;
114
+ }
115
+ cachedConfig = QaiConfigSchema.parse(userConfig);
116
+ return cachedConfig;
117
+ }
118
+
119
+ export { defineConfig, CONFIG_DIR, getProjectRoot, getPackageRoot, loadConfig };
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getPackageRoot,
5
5
  getProjectRoot,
6
6
  loadConfig
7
- } from "./cli-m3fv379v.js";
7
+ } from "./cli-cymqw41r.js";
8
8
  import"./cli-z2krvkcq.js";
9
9
  import {
10
10
  dist_default2 as dist_default,
@@ -3117,13 +3117,9 @@ function registerAuth(program2) {
3117
3117
  // src/commands/mcp.ts
3118
3118
  var import_picocolors3 = __toESM(require_picocolors(), 1);
3119
3119
  var TOOLS = [
3120
- "zefiro_scan_codebase scan project test infrastructure",
3121
- "zefiro_scan_ast deep AST scan: routes, components, hooks",
3122
- "zefiro_scan_ast_detail drill into a specific AST category",
3123
- "zefiro_extract_state_variables — V4: extract state variables from AST",
3124
- "zefiro_build_v4_graph — V4: build formal model from AST + state",
3125
- "zefiro_build_qa_map — validate + write QA map (V2/V3/V4)",
3126
- "zefiro_read_qa_map — read existing QA map file"
3120
+ "zefiro_explore explore a web application via BFS",
3121
+ "zefiro_read_docs read generated documentation",
3122
+ "zefiro_scan_codebase scan project test infrastructure"
3127
3123
  ];
3128
3124
  var DESKTOP_CONFIG = JSON.stringify({
3129
3125
  mcpServers: {
@@ -3216,11 +3212,6 @@ async function migrateFromLegacy(projectRoot, nonInteractive) {
3216
3212
  cpSync(astSrc, join4(newPath, "ast-scan.json"));
3217
3213
  migrated++;
3218
3214
  }
3219
- const qamapSrc = join4(legacyPath, "qa-map.json");
3220
- if (existsSync2(qamapSrc)) {
3221
- cpSync(qamapSrc, join4(newPath, "qa-map.json"));
3222
- migrated++;
3223
- }
3224
3215
  success(`Migrated ${migrated} item(s) from ${LEGACY_DIR}/ to ${CONFIG_DIR}/`);
3225
3216
  if (!nonInteractive) {
3226
3217
  const remove = await dist_default({
@@ -3411,7 +3402,7 @@ var hasFlags = userArgs.some((a) => a.startsWith("-"));
3411
3402
  var cols = process.stdout.columns || 80;
3412
3403
  var rows = process.stdout.rows || 24;
3413
3404
  if (!hasCommand && !hasFlags && process.stdout.isTTY && cols >= 60 && rows >= 20) {
3414
- const { launchTui } = await import("./App-3e6t6c8c.js");
3405
+ const { launchTui } = await import("./App-bh752tgg.js");
3415
3406
  await launchTui(program2);
3416
3407
  } else {
3417
3408
  program2.parse();
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  getPackageRoot,
4
4
  getProjectRoot,
5
5
  loadConfig
6
- } from "./cli-m3fv379v.js";
6
+ } from "./cli-cymqw41r.js";
7
7
  import"./cli-z2krvkcq.js";
8
8
  import"./cli-wckvcay0.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zefiro",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zefiro": "./dist/cli.js",
@@ -41,6 +41,8 @@
41
41
  "zod": "^4.0.5"
42
42
  },
43
43
  "dependencies": {
44
- "@modelcontextprotocol/sdk": "^1.27.1"
44
+ "@modelcontextprotocol/sdk": "^1.27.1",
45
+ "@types/ws": "^8.18.1",
46
+ "ws": "^8.20.0"
45
47
  }
46
48
  }