@mozole/cli 1.4.2 → 2.0.0-b

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 (229) hide show
  1. package/LICENSE +16 -4
  2. package/README.md +85 -89
  3. package/dist/cli.d.ts +2 -2
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +204 -157
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/adopt.d.ts +5 -8
  8. package/dist/commands/adopt.d.ts.map +1 -1
  9. package/dist/commands/adopt.js +49 -812
  10. package/dist/commands/adopt.js.map +1 -1
  11. package/dist/commands/doctor.d.ts +1 -7
  12. package/dist/commands/doctor.d.ts.map +1 -1
  13. package/dist/commands/doctor.js +69 -377
  14. package/dist/commands/doctor.js.map +1 -1
  15. package/dist/commands/new.d.ts +8 -10
  16. package/dist/commands/new.d.ts.map +1 -1
  17. package/dist/commands/new.js +32 -149
  18. package/dist/commands/new.js.map +1 -1
  19. package/dist/commands/phase.d.ts +11 -0
  20. package/dist/commands/phase.d.ts.map +1 -0
  21. package/dist/commands/phase.js +106 -0
  22. package/dist/commands/phase.js.map +1 -0
  23. package/dist/commands/prototype.d.ts +6 -0
  24. package/dist/commands/prototype.d.ts.map +1 -0
  25. package/dist/commands/prototype.js +28 -0
  26. package/dist/commands/prototype.js.map +1 -0
  27. package/dist/commands/repomap.d.ts +6 -0
  28. package/dist/commands/repomap.d.ts.map +1 -0
  29. package/dist/commands/repomap.js +71 -0
  30. package/dist/commands/repomap.js.map +1 -0
  31. package/dist/commands/test.d.ts +6 -0
  32. package/dist/commands/test.d.ts.map +1 -0
  33. package/dist/commands/test.js +115 -0
  34. package/dist/commands/test.js.map +1 -0
  35. package/dist/commands/ui.d.ts +1 -37
  36. package/dist/commands/ui.d.ts.map +1 -1
  37. package/dist/commands/ui.js +75 -317
  38. package/dist/commands/ui.js.map +1 -1
  39. package/dist/commands/verify.d.ts +12 -7
  40. package/dist/commands/verify.d.ts.map +1 -1
  41. package/dist/commands/verify.js +148 -65
  42. package/dist/commands/verify.js.map +1 -1
  43. package/dist/qa/a11y.d.ts +24 -0
  44. package/dist/qa/a11y.d.ts.map +1 -0
  45. package/dist/qa/a11y.js +124 -0
  46. package/dist/qa/a11y.js.map +1 -0
  47. package/dist/qa/breakpoints.d.ts +16 -0
  48. package/dist/qa/breakpoints.d.ts.map +1 -0
  49. package/dist/qa/breakpoints.js +45 -0
  50. package/dist/qa/breakpoints.js.map +1 -0
  51. package/dist/qa/contract.d.ts +21 -0
  52. package/dist/qa/contract.d.ts.map +1 -0
  53. package/dist/qa/contract.js +116 -0
  54. package/dist/qa/contract.js.map +1 -0
  55. package/dist/qa/index.d.ts +6 -0
  56. package/dist/qa/index.d.ts.map +1 -0
  57. package/dist/qa/index.js +6 -0
  58. package/dist/qa/index.js.map +1 -0
  59. package/dist/qa/probe.d.ts +48 -0
  60. package/dist/qa/probe.d.ts.map +1 -0
  61. package/dist/qa/probe.js +206 -0
  62. package/dist/qa/probe.js.map +1 -0
  63. package/dist/qa/runner.d.ts +27 -32
  64. package/dist/qa/runner.d.ts.map +1 -1
  65. package/dist/qa/runner.js +286 -336
  66. package/dist/qa/runner.js.map +1 -1
  67. package/dist/scaffold/agents.d.ts +5 -0
  68. package/dist/scaffold/agents.d.ts.map +1 -0
  69. package/dist/scaffold/agents.js +84 -0
  70. package/dist/scaffold/agents.js.map +1 -0
  71. package/dist/scaffold/backend.d.ts +6 -8
  72. package/dist/scaffold/backend.d.ts.map +1 -1
  73. package/dist/scaffold/backend.js +318 -199
  74. package/dist/scaffold/backend.js.map +1 -1
  75. package/dist/scaffold/design.d.ts +4 -3
  76. package/dist/scaffold/design.d.ts.map +1 -1
  77. package/dist/scaffold/design.js +38 -47
  78. package/dist/scaffold/design.js.map +1 -1
  79. package/dist/scaffold/flagship.d.ts +8 -0
  80. package/dist/scaffold/flagship.d.ts.map +1 -0
  81. package/dist/scaffold/flagship.js +337 -0
  82. package/dist/scaffold/flagship.js.map +1 -0
  83. package/dist/scaffold/index.d.ts +9 -0
  84. package/dist/scaffold/index.d.ts.map +1 -0
  85. package/dist/scaffold/index.js +48 -0
  86. package/dist/scaffold/index.js.map +1 -0
  87. package/dist/scaffold/phases.d.ts +10 -0
  88. package/dist/scaffold/phases.d.ts.map +1 -0
  89. package/dist/scaffold/phases.js +165 -0
  90. package/dist/scaffold/phases.js.map +1 -0
  91. package/dist/scaffold/repomap.d.ts +6 -0
  92. package/dist/scaffold/repomap.d.ts.map +1 -0
  93. package/dist/scaffold/repomap.js +89 -0
  94. package/dist/scaffold/repomap.js.map +1 -0
  95. package/dist/scaffold/standard.d.ts +13 -0
  96. package/dist/scaffold/standard.d.ts.map +1 -0
  97. package/dist/scaffold/standard.js +371 -0
  98. package/dist/scaffold/standard.js.map +1 -0
  99. package/dist/scaffold/tokens.d.ts +3 -0
  100. package/dist/scaffold/tokens.d.ts.map +1 -0
  101. package/dist/scaffold/tokens.js +126 -0
  102. package/dist/scaffold/tokens.js.map +1 -0
  103. package/dist/server/manager.d.ts +23 -0
  104. package/dist/server/manager.d.ts.map +1 -0
  105. package/dist/server/manager.js +96 -0
  106. package/dist/server/manager.js.map +1 -0
  107. package/dist/utils/ai-trace.d.ts +8 -0
  108. package/dist/utils/ai-trace.d.ts.map +1 -0
  109. package/dist/utils/ai-trace.js +69 -0
  110. package/dist/utils/ai-trace.js.map +1 -0
  111. package/dist/utils/browser.d.ts +10 -0
  112. package/dist/utils/browser.d.ts.map +1 -0
  113. package/dist/utils/browser.js +127 -0
  114. package/dist/utils/browser.js.map +1 -0
  115. package/dist/utils/fs.d.ts +11 -0
  116. package/dist/utils/fs.d.ts.map +1 -0
  117. package/dist/utils/fs.js +166 -0
  118. package/dist/utils/fs.js.map +1 -0
  119. package/dist/utils/git.d.ts +9 -0
  120. package/dist/utils/git.d.ts.map +1 -0
  121. package/dist/utils/git.js +69 -0
  122. package/dist/utils/git.js.map +1 -0
  123. package/dist/utils/process.d.ts +21 -0
  124. package/dist/utils/process.d.ts.map +1 -0
  125. package/dist/utils/process.js +120 -0
  126. package/dist/utils/process.js.map +1 -0
  127. package/dist/version.d.ts +21 -36
  128. package/dist/version.d.ts.map +1 -1
  129. package/dist/version.js +21 -44
  130. package/dist/version.js.map +1 -1
  131. package/package.json +19 -38
  132. package/CHANGELOG.md +0 -30
  133. package/dist/commands/cce.d.ts +0 -7
  134. package/dist/commands/cce.d.ts.map +0 -1
  135. package/dist/commands/cce.js +0 -37
  136. package/dist/commands/cce.js.map +0 -1
  137. package/dist/commands/logs.d.ts +0 -3
  138. package/dist/commands/logs.d.ts.map +0 -1
  139. package/dist/commands/logs.js +0 -39
  140. package/dist/commands/logs.js.map +0 -1
  141. package/dist/commands/qa.d.ts +0 -12
  142. package/dist/commands/qa.d.ts.map +0 -1
  143. package/dist/commands/qa.js +0 -143
  144. package/dist/commands/qa.js.map +0 -1
  145. package/dist/commands/stats.d.ts +0 -37
  146. package/dist/commands/stats.d.ts.map +0 -1
  147. package/dist/commands/stats.js +0 -169
  148. package/dist/commands/stats.js.map +0 -1
  149. package/dist/config/project.d.ts +0 -51
  150. package/dist/config/project.d.ts.map +0 -1
  151. package/dist/config/project.js +0 -81
  152. package/dist/config/project.js.map +0 -1
  153. package/dist/context/cce.d.ts +0 -39
  154. package/dist/context/cce.d.ts.map +0 -1
  155. package/dist/context/cce.js +0 -455
  156. package/dist/context/cce.js.map +0 -1
  157. package/dist/governor/fingerprint.d.ts +0 -7
  158. package/dist/governor/fingerprint.d.ts.map +0 -1
  159. package/dist/governor/fingerprint.js +0 -129
  160. package/dist/governor/fingerprint.js.map +0 -1
  161. package/dist/governor/hook.d.ts +0 -13
  162. package/dist/governor/hook.d.ts.map +0 -1
  163. package/dist/governor/hook.js +0 -389
  164. package/dist/governor/hook.js.map +0 -1
  165. package/dist/governor/state.d.ts +0 -45
  166. package/dist/governor/state.d.ts.map +0 -1
  167. package/dist/governor/state.js +0 -60
  168. package/dist/governor/state.js.map +0 -1
  169. package/dist/integrations/antigravity.d.ts +0 -20
  170. package/dist/integrations/antigravity.d.ts.map +0 -1
  171. package/dist/integrations/antigravity.js +0 -153
  172. package/dist/integrations/antigravity.js.map +0 -1
  173. package/dist/output.d.ts +0 -5
  174. package/dist/output.d.ts.map +0 -1
  175. package/dist/output.js +0 -2
  176. package/dist/output.js.map +0 -1
  177. package/dist/platform/executable.d.ts +0 -11
  178. package/dist/platform/executable.d.ts.map +0 -1
  179. package/dist/platform/executable.js +0 -69
  180. package/dist/platform/executable.js.map +0 -1
  181. package/dist/platform/process.d.ts +0 -25
  182. package/dist/platform/process.d.ts.map +0 -1
  183. package/dist/platform/process.js +0 -179
  184. package/dist/platform/process.js.map +0 -1
  185. package/dist/progress.d.ts +0 -44
  186. package/dist/progress.d.ts.map +0 -1
  187. package/dist/progress.js +0 -123
  188. package/dist/progress.js.map +0 -1
  189. package/dist/qa/diff.d.ts +0 -10
  190. package/dist/qa/diff.d.ts.map +0 -1
  191. package/dist/qa/diff.js +0 -91
  192. package/dist/qa/diff.js.map +0 -1
  193. package/dist/qa/server.d.ts +0 -10
  194. package/dist/qa/server.d.ts.map +0 -1
  195. package/dist/qa/server.js +0 -127
  196. package/dist/qa/server.js.map +0 -1
  197. package/dist/scaffold/adoption.d.ts +0 -17
  198. package/dist/scaffold/adoption.d.ts.map +0 -1
  199. package/dist/scaffold/adoption.js +0 -279
  200. package/dist/scaffold/adoption.js.map +0 -1
  201. package/dist/scaffold/legacy.d.ts +0 -4
  202. package/dist/scaffold/legacy.d.ts.map +0 -1
  203. package/dist/scaffold/legacy.js +0 -139
  204. package/dist/scaffold/legacy.js.map +0 -1
  205. package/dist/scaffold/routes.d.ts +0 -3
  206. package/dist/scaffold/routes.d.ts.map +0 -1
  207. package/dist/scaffold/routes.js +0 -37
  208. package/dist/scaffold/routes.js.map +0 -1
  209. package/dist/scaffold/standalone.d.ts +0 -7
  210. package/dist/scaffold/standalone.d.ts.map +0 -1
  211. package/dist/scaffold/standalone.js +0 -294
  212. package/dist/scaffold/standalone.js.map +0 -1
  213. package/dist/scaffold/templates.d.ts +0 -8
  214. package/dist/scaffold/templates.d.ts.map +0 -1
  215. package/dist/scaffold/templates.js +0 -312
  216. package/dist/scaffold/templates.js.map +0 -1
  217. package/dist/scaffold/write.d.ts +0 -2
  218. package/dist/scaffold/write.d.ts.map +0 -1
  219. package/dist/scaffold/write.js +0 -38
  220. package/dist/scaffold/write.js.map +0 -1
  221. package/dist/telemetry/store.d.ts +0 -33
  222. package/dist/telemetry/store.d.ts.map +0 -1
  223. package/dist/telemetry/store.js +0 -75
  224. package/dist/telemetry/store.js.map +0 -1
  225. package/dist/verify/runner.d.ts +0 -15
  226. package/dist/verify/runner.d.ts.map +0 -1
  227. package/dist/verify/runner.js +0 -112
  228. package/dist/verify/runner.js.map +0 -1
  229. package/docs/agent-audit.md +0 -24
package/LICENSE CHANGED
@@ -1,9 +1,21 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Mozole contributors
3
+ Copyright (c) 2026 Mozole Studio
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
8
14
 
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,114 +1,110 @@
1
- # Mozole CLI
2
-
3
- Mozole scaffolds React + Vite projects using React Router Framework Mode. It prerenders static HTML and optionally adds a native PHP API. Node.js 22+, npm, and Windows or Linux are supported. PHP projects require PHP 8.0+.
4
-
5
- ```sh
6
- npm install --global @mozole/cli
7
- mozole new my-site
8
- mozole new my-app --backend
9
- ```
10
-
11
- Creation installs pinned dependencies and Chromium, formats the project, and moves the completed staging directory into place. Failed setup preserves available subprocess logs in a sibling `.mozole-<name>-failure-*` directory before removing staging. Existing target directories are preserved.
12
-
13
- ## Default project
14
-
15
- The default project has **no CCE, token governor, telemetry, verification cache, MCP registration, or optimization hooks**. It does not depend on `@mozole/cli`, including transitively through its generated package lock. Verification and browser QA run through standalone project scripts. `MOZOLE_INSTALL_CCE` does not enable integrations.
16
-
17
- Basic `AGENTS.md` describes actual commands, source layout, and verification policy. `CLAUDE.md` imports it using `@AGENTS.md`. Neither file imposes CCE retrieval or token policies. No `.agents/`, `.codex/hooks.json`, or `.claude/settings.json` is generated by default.
18
-
19
- ```sh
20
- cd my-site
21
- npm run dev
1
+ # Mozole CLI (`@mozole/cli`)
2
+
3
+ > **Mozole Studio** internal project generator and development cockpit tailored for autonomous agentic engineering workflows.
4
+
5
+ ---
6
+
7
+ ## Highlights
8
+
9
+ - **Vite-Powered Frontend Engines:**
10
+ - **Standard Profile:** React 19 + React Router 7 (Framework Mode Plugin) + Static Pre-rendering (SSG) + Tailwind CSS v4 + bespoke Radix UI primitives.
11
+ - **Flagship Creative Profile (`--flagship`):** React 19 + Wouter + Lenis (Smooth Scroll) + Motion + Persistent 60fps Canvas/WebGL layer.
12
+ - **Pure PHP 8.1+ Zero-Dependency Backend:**
13
+ - Engineered for budget shared hosting (cPanel 250k Inodes, 25 MB/s I/O, Imunify360).
14
+ - 5-Layer Security Architecture: Origin/Referer verification, honeypot spam protection, file-based IP rate-limiting, direct file access denial for `config.php`, input sanitization.
15
+ - **10-Step Phased Development Pipeline:**
16
+ - Sequential phases (Phase 00–10) with status tracking in `docs/phases/status.md` and automated phase advancement commits (`mozole phase next`).
17
+ - Post-launch maintenance workflow (`mozole phase reopen <id>`).
18
+ - **Architectural Fihrist (`docs/repomap/`):**
19
+ - Continuous mapping of architecture, bespoke UI primitives, application routes, and design tokens.
20
+ - **Mozole Quality Kit:**
21
+ - Static PostCSS AST contract auditor enforcing token integrity (`src/styles/tokens.css`), banning literal colors, raw font families, and `transition: all`.
22
+ - Headless in-browser DOM geometry probe detecting layout reflow defects, text clipping, and minimum touch target violations.
23
+ - Automated WCAG 2.1 AA landmark and accessibility auditor.
24
+ - **Interactive Terminal Cockpit (`mozole ui`):**
25
+ - Clean, lightweight TUI to inspect client projects, advance phases, and run deterministic verification.
26
+
27
+ ---
28
+
29
+ ## Installation & Local Development
30
+
31
+ ```bash
32
+ # Clone and install dependencies
33
+ git clone git@github.com:mozolestudio/cli.git
34
+ cd MozoleCli
35
+ npm install
36
+
37
+ # Run verification suite (Biome lint, TypeScript typecheck, Vitest, build)
22
38
  npm run verify
23
- npm run qa
24
- npm run qa:interactive
25
- npm run qa:visual
26
- ```
27
-
28
- `verify` runs lint, strict TypeScript, tests, and production build every time. PHP projects also run PHP version and recursive syntax checks first. `qa` starts a loopback development server on an available port, checks the configured routes at three viewports, and closes its browser and server. Normal QA never captures screenshots. `qa:visual` explicitly captures screenshots under `.mozole/qa/`. Reinstall Chromium with `npx playwright install chromium` if necessary.
29
39
 
30
- React Router uses `ssr: false` and `prerender: true`. The starter builds real HTML for `/`, `/about`, and `/contact` into `build/client/`, plus `__spa-fallback.html`. Production requires no Node server. See [React Router prerendering](https://reactrouter.com/how-to/pre-rendering).
31
-
32
- ## Design references and assets
33
-
34
- Place exported `design.md`, images, icons, fonts and reference screens under `docs/design/`. Generated `AGENTS.md` treats these as design evidence, preserves their intent, and requires checks for spacing, loaded fonts, foreground/background contrast, responsive behavior and interaction states. It permits justified corrections instead of blindly copying tokens. `docs/design/README.md` explains the handoff; no provider-specific design is generated. Existing exports remain untouched during adoption. Routine QA stays screenshot-free; visual comparison remains opt-in.
35
-
36
- ## PHP backend
37
-
38
- ```sh
39
- mozole new my-app --backend
40
- cd my-app
41
- npm run dev
42
- # In a separate terminal:
43
- npm run dev:api
40
+ # Run local development binary
41
+ npm run dev -- --help
44
42
  ```
45
43
 
46
- Vite proxies `/api/` calls to PHP on `127.0.0.1:8000`. The PHP front controller serves `GET` and `HEAD` for `/api/health` and `/api/info`. Unknown endpoints return JSON 404; unsupported methods on known endpoints return JSON 405 with `Allow: GET, HEAD`.
47
-
48
- ```sh
49
- npm run check:php
50
- npm run build:deploy
51
- ```
44
+ ---
52
45
 
53
- `check:php` checks PHP 8.0+ and runs `php -l` on every PHP source file under `api/`. `build:deploy` validates PHP, builds the frontend, and assembles `deploy/` with static output, `api/`, and `.htaccess`. Existing deployment output is replaced with rollback on failed replacement. Upload the **contents** of `deploy/`, including hidden `.htaccess`, to an Apache/LiteSpeed document root with PHP and rewrite support. The supplied configuration assumes domain-root hosting. Nginx needs explicit PHP-FPM configuration; see generated `docs/backend-php.md`.
46
+ ## Command Reference
54
47
 
55
- Environment values come from the process environment using `getenv`; there is no implicit `.env` loader. Production and debug-off are the defaults. Database support is an optional PDO helper; configure `DB_DSN`, `DB_USER`, and `DB_PASS` through your host.
48
+ ### `mozole new <name> [--flagship] [--backend=php|node]`
49
+ Generates a client project with Mozole Studio governance and canonical design tokens. Install its dependencies with `npm install`, then run `mozole verify` to check the generated project in your environment.
56
50
 
57
- ## Explicit integrations
51
+ ```bash
52
+ # Standard React Router 7 + SSG + Tailwind v4 project
53
+ mozole new acme-corp
58
54
 
59
- ```sh
60
- mozole cce install
61
- mozole new agent-site --cce-install
62
- # --install-cce is an alias; --backend can be combined with either flag.
63
- mozole adopt existing-site --cce-install
55
+ # Flagship creative project with smooth scroll & persistent canvas
56
+ mozole new studio-flagship --flagship
64
57
  ```
65
58
 
66
- Only explicit `--cce-install`/`--install-cce` enables the CCE runtime integration, Codex/Claude hooks, Antigravity workspace files, token governor, telemetry, and verification/QA evidence reuse. The project then depends on the matching CLI version. `--scaffold` on `new` overrides integration flags.
59
+ ### `mozole prototype init`
60
+ Initializes a new prototype repository workspace with a multi-project `projects/` directory and shared token bridges.
67
61
 
68
- CCE initialization uses the pinned release in `src/version.ts`. `mozole cce install` installs its runtime; creation reports when an unavailable runtime needs attention. Adoption with integration flags requires a runnable CCE runtime before installing managed integrations. Existing user instructions and unrelated hook/MCP entries are preserved. Managed instruction blocks and hook definitions are refreshed idempotently.
62
+ ### `mozole adopt [path]`
63
+ Adopts an existing web project into Mozole Studio governance, injecting `AGENTS.md`, `CLAUDE.md`, `docs/phases/status.md`, `docs/repomap/`, and design token foundations.
69
64
 
70
- Optimized `AGENTS.md` provides the shared CCE-first contract; `CLAUDE.md` imports it and Antigravity rules reference it. Instructions are guidance, not execution proof. Codex discovers `AGENTS.md` by directory scope, with `AGENTS.override.md` taking precedence. Project hooks need host review/trust before execution. See [AGENTS.md discovery](https://learn.chatgpt.com/docs/agent-configuration/agents-md) and [Codex hooks](https://learn.chatgpt.com/docs/hooks).
65
+ ### `mozole phase [status|next|reopen]`
66
+ Manages project progression through the 10-step atomic development lifecycle:
71
67
 
72
- Read and command policies run on `PreToolUse`. CCE retrieval tracking runs on `PostToolUse`, including MCP tool names, and ignores explicit tool-error responses. The Antigravity visual workflow provides a reason accepted by the visual QA gate. Host-specific agent sessions are not automatically launched by the CLI test suite.
68
+ - `mozole phase status` Displays visual checklist and status for all phases.
69
+ - `mozole phase next` — Advances one phase and creates a conventional commit (`feat(phase-XX): ...`) when Git is initialized. Complete the checklist and run `mozole verify` first; checklist completion is a developer responsibility. Failed commits restore the previous phase file and Git index.
70
+ - `mozole phase reopen <id>` — Reopens a completed phase for post-launch maintenance.
73
71
 
74
- Optimized verification/QA reuses matching successful evidence. Use `--force` for a fresh run. Routine QA is screenshot-free; visual QA uses explicit `--visual` and, after successful routine QA, `--reason` or `--force`. Enabled governors enforce read/command policies and can deny calls; they are not advisory-only. Local telemetry reports measured output compression and tool activity, not model billing savings.
72
+ ### `mozole repomap [sync|check]`
73
+ Synchronizes and audits the `docs/repomap/` architectural index, component registry, and route catalog.
75
74
 
76
- ## Adopt an existing project
75
+ ### `mozole test [contract|a11y|probe|all]`
76
+ Executes Mozole Quality Kit verification suites:
77
+ - `mozole test contract` — PostCSS AST design token contract audit (prohibits literal colors, `transition: all`, fixed viewport dimensions).
78
+ - `mozole test a11y` — Static HTML and accessibility landmark hierarchy validation.
79
+ - `mozole test probe` — Headless live DOM geometry and trace runner. Discovers local Brave/Chromium (or auto-provisions Playwright Chromium if absent). Measures live bounding boxes, horizontal overflow on mobile viewports (320px+), text clipping, touch targets (<24px), prefers-reduced-motion violations, and 200% text-zoom reflow stress. Strictly zero raster screenshots (`screenshots: false, snapshots: true`); emits full interactive trace packages to `docs/qa/trace.zip` for inspection via [trace.playwright.dev](https://trace.playwright.dev).
80
+ - `mozole test all` (default) — Executes static contract and accessibility audits.
77
81
 
78
- New projects include pinned Tailwind CSS v4 and `@tailwindcss/vite` by default in all modes, including PHP projects. `app/styles/global.css` imports Tailwind and keeps starter styles in the base layer. Adoption preserves existing CSS and Vite configuration; it does not automatically migrate older styling pipelines or inject Preflight into an existing design.
82
+ ### `mozole verify [--probe]`
83
+ The authoritative, multi-stage deterministic gate required before completing agentic tasks:
84
+ 1. AI Trace Scanner (strictly prohibits synthetic watermarks and bot co-author trailers)
85
+ 2. Biome lint & code style check
86
+ 3. Project `typecheck` script (including React Router type generation), or local TypeScript compiler
87
+ 4. Production build (`npm run build`)
88
+ 5. PostCSS design token contract audit
89
+ 6. Accessibility & landmark hierarchy validation against built HTML
90
+ 7. *(Optional with `--probe`)* Live headless DOM geometry & trace probe across critical viewports
79
91
 
80
- ```sh
81
- mozole adopt ../existing-app
82
- ```
92
+ Biome and TypeScript must be installed locally; verification never downloads missing CLI tools with `npx`. Standard projects emit static pages for `/`, `/about`, and `/contact` without requiring a Node server in production. See the [React Router pre-rendering documentation](https://reactrouter.com/how-to/pre-rendering) for hosting configuration.
83
93
 
84
- Adoption reconciles a React/Vite or React Router project with the current project system. Without `--cce-install`, it removes Mozole-owned CCE integrations, optimization hooks and state, including from previously optimized projects, and installs standalone verification/QA. The flag explicitly selects the optimized system. User instructions, unrelated integrations, application source and design exports are preserved. Recognized unchanged legacy PHP templates are upgraded; customized backend files are retained with a review notice. Replaced files and obsolete state are archived under `.mozole/backups/adopt-*`; managed files are restored if installation fails. Tooling versions and npm dependencies are reconciled on every adoption. Custom verifier commands and configured QA servers remain in use. Repeating adoption does not duplicate managed instruction blocks.
94
+ The PHP contact backend requires an allowed Origin or a Referer with the same scheme, host and port as an allowed origin. Requests without either are rejected. Rate-limit storage errors return HTTP 503; mail transport failures return HTTP 502 with `success: false`. Configure `api/config.php` and the hosting mail transport before accepting real submissions.
85
95
 
86
- ## CLI commands
96
+ ### `mozole doctor`
97
+ Diagnoses workstation prerequisites: Node.js (>= 20), Git, PHP 8.1+ status, local Chromium/Brave browser engine availability, and network port availability.
87
98
 
88
- ```text
89
- mozole new <name> [--backend] [--cce-install] [--verbose]
90
- mozole adopt <path> [--cce-install] [--verbose]
91
- mozole doctor
92
- mozole verify [--force]
93
- mozole qa [--interactive | --visual [--diff]] [--force]
94
- mozole logs [name] [--raw]
95
- mozole cce install
96
- mozole stats
97
- mozole ui
98
- ```
99
+ ### `mozole ui` (or bare `mozole`)
100
+ Launches the interactive terminal cockpit.
99
101
 
100
- `doctor` checks runtime, project tooling, and optional PHP syntax. CCE probes are omitted for plain projects. `mozole verify` and `mozole qa` can also operate on plain project metadata without reading or writing optimization state. `stats` reports that statistics are disabled in plain projects. Standalone project QA supports normal, interactive, and visual modes; pixel diffing remains in the optional CLI QA runner.
102
+ ---
101
103
 
102
- ## Development
104
+ ## Repository Governance
103
105
 
104
- ```sh
105
- npm ci
106
- npx playwright install chromium
107
- npm run verify
108
- npm run test:smoke
109
- npm pack --dry-run
110
- ```
106
+ This project is governed by [AGENTS.md](./AGENTS.md). All automated agents and contributors must adhere to the rules therein.
111
107
 
112
- The CI matrix runs on native Windows and Ubuntu with PHP. It covers real PHP routing, method handling, syntax failures, deployment replacement and rollback, default scaffold isolation, agent-file wiring, conservative adoption, and generated frontend/PHP/optimized projects. The optimized smoke scenario skips CCE initialization; live CCE installation is covered separately with runtime fixtures.
108
+ ## License
113
109
 
114
- Subprocesses use argument arrays and `shell: false`. Persisted configuration, state, and telemetry use temporary files and atomic replacement. Dependency versions are pinned centrally in `src/version.ts`.
110
+ MIT © Mozole Studio
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export declare function isCliEntrypoint(entryUrl: string, invokedPath: string | undefined): boolean;
3
- export declare function main(args?: string[], cwd?: string): Promise<number>;
2
+ export declare const main: import("citty").CommandDef<import("citty").ArgsDef>;
3
+ export declare function runCli(argv?: string[]): Promise<void>;
4
4
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAeA,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAOT;AAqCD,wBAAsB,IAAI,CACxB,IAAI,WAAwB,EAC5B,GAAG,SAAgB,GAClB,OAAO,CAAC,MAAM,CAAC,CAiJjB"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA+LA,eAAO,MAAM,IAAI,qDAuBf,CAAC;AAEH,wBAAgB,MAAM,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAElE"}
package/dist/cli.js CHANGED
@@ -1,169 +1,216 @@
1
1
  #!/usr/bin/env node
2
- import { realpathSync } from "node:fs";
3
- import { fileURLToPath } from "node:url";
4
- import { adoptCommand } from "./commands/adopt.js";
5
- import { cceInstallCommand } from "./commands/cce.js";
2
+ import { defineCommand, runMain } from "citty";
3
+ import { adoptProject } from "./commands/adopt.js";
6
4
  import { doctorCommand } from "./commands/doctor.js";
7
- import { logsCommand } from "./commands/logs.js";
8
- import { newCommand } from "./commands/new.js";
9
- import { qaCommand } from "./commands/qa.js";
10
- import { statsCommand } from "./commands/stats.js";
5
+ import { createNewProject } from "./commands/new.js";
6
+ import { phaseCommand } from "./commands/phase.js";
7
+ import { prototypeInit } from "./commands/prototype.js";
8
+ import { repomapCommand } from "./commands/repomap.js";
9
+ import { testCommand } from "./commands/test.js";
11
10
  import { uiCommand } from "./commands/ui.js";
12
11
  import { verifyCommand } from "./commands/verify.js";
13
- import { governorHookCommand } from "./governor/hook.js";
14
12
  import { CLI_VERSION } from "./version.js";
15
- export function isCliEntrypoint(entryUrl, invokedPath) {
16
- if (!invokedPath)
17
- return false;
18
- try {
19
- return realpathSync(fileURLToPath(entryUrl)) === realpathSync(invokedPath);
20
- }
21
- catch {
22
- return false;
23
- }
24
- }
25
- const help = `mozole ${CLI_VERSION}
26
-
27
- Usage:
28
- mozole new <name> [--backend] [--cce-install] [--verbose]
29
- mozole adopt <path> [--cce-install] [--verbose]
30
- mozole cce install [--verbose]
31
- mozole doctor [--verbose]
32
- mozole verify [--force] [--verbose]
33
- mozole qa [--interactive | --visual [--diff]] [--force] [--verbose]
34
- mozole stats [--verbose]
35
- mozole ui
36
- mozole logs [name] [--raw]`;
37
- function parseCliArgs(args, allowedFlags = [], isAllowedFlag) {
38
- const clean = args.filter((arg) => Boolean(arg));
39
- const positional = clean.filter((arg) => !arg.startsWith("-"));
40
- const flags = clean.filter((arg) => arg.startsWith("-"));
41
- const verbose = flags.includes("--verbose") || flags.includes("-v");
42
- const allowed = new Set(["--verbose", "-v", ...allowedFlags]);
43
- const unknown = flags.filter((flag) => !allowed.has(flag) && !isAllowedFlag?.(flag));
44
- return { positional, flags, unknown, verbose };
45
- }
46
- export async function main(args = process.argv.slice(2), cwd = process.cwd()) {
47
- const [command, value, ...rest] = args;
48
- if (!command ||
49
- command === "help" ||
50
- command === "--help" ||
51
- command === "-h") {
52
- console.log(help);
53
- return 0;
54
- }
55
- if (command === "--version" || (command === "-v" && !value)) {
56
- console.log(CLI_VERSION);
57
- return 0;
58
- }
59
- if (command === "new") {
60
- const { positional, flags, unknown, verbose } = parseCliArgs([value, ...rest], ["--backend", "--cce-install", "--install-cce", "--scaffold"]);
61
- if (unknown.length || positional.length > 1) {
62
- console.error(`Unknown option: ${unknown[0] ?? positional[1]}`);
63
- return 2;
64
- }
65
- const cceInstall = flags.includes("--cce-install") || flags.includes("--install-cce");
66
- const backend = flags.includes("--backend");
67
- const scaffold = flags.includes("--scaffold");
68
- return newCommand(positional[0], cwd, console, {
69
- verbose,
70
- cceInstall,
71
- backend,
72
- scaffold,
13
+ const newCmd = defineCommand({
14
+ meta: {
15
+ name: "new",
16
+ description: "Generate a new client project (Standard React Router 7 or Flagship Creative)",
17
+ },
18
+ args: {
19
+ name: {
20
+ type: "positional",
21
+ description: "Project name",
22
+ required: true,
23
+ },
24
+ flagship: {
25
+ type: "boolean",
26
+ description: "Enable Flagship profile (Wouter + Lenis + Canvas)",
27
+ default: false,
28
+ },
29
+ backend: {
30
+ type: "string",
31
+ description: "Backend runtime: 'php' (default) or 'node'",
32
+ default: "php",
33
+ },
34
+ },
35
+ async run({ args }) {
36
+ await createNewProject({
37
+ name: args.name,
38
+ flagship: args.flagship,
39
+ backend: args.backend || "php",
73
40
  });
74
- }
75
- if (command === "adopt") {
76
- const { positional, unknown, verbose, flags } = parseCliArgs([value, ...rest], ["--cce-install", "--install-cce"]);
77
- if (unknown.length || positional.length > 1) {
78
- console.error(`Unknown option: ${unknown[0] ?? positional[1]}`);
79
- return 2;
80
- }
81
- return adoptCommand(positional[0], cwd, console, {
82
- verbose,
83
- cceInstall: flags.includes("--cce-install") || flags.includes("--install-cce"),
41
+ },
42
+ });
43
+ const prototypeCmd = defineCommand({
44
+ meta: {
45
+ name: "prototype",
46
+ description: "Manage prototype repository workspace",
47
+ },
48
+ subCommands: {
49
+ init: defineCommand({
50
+ meta: {
51
+ name: "init",
52
+ description: "Initialize a new prototype workspace repository",
53
+ },
54
+ async run() {
55
+ await prototypeInit();
56
+ },
57
+ }),
58
+ },
59
+ async run() {
60
+ await prototypeInit();
61
+ },
62
+ });
63
+ const adoptCmd = defineCommand({
64
+ meta: {
65
+ name: "adopt",
66
+ description: "Adopt an existing project into Mozole Studio governance",
67
+ },
68
+ args: {
69
+ path: {
70
+ type: "positional",
71
+ description: "Path to project root",
72
+ required: false,
73
+ default: ".",
74
+ },
75
+ },
76
+ async run({ args }) {
77
+ await adoptProject({ targetDir: args.path });
78
+ },
79
+ });
80
+ const phaseCmd = defineCommand({
81
+ meta: {
82
+ name: "phase",
83
+ description: "Manage 10-step atomic development phases",
84
+ },
85
+ args: {
86
+ action: {
87
+ type: "positional",
88
+ description: "Phase action: 'status', 'next', or 'reopen'",
89
+ required: false,
90
+ default: "status",
91
+ },
92
+ id: {
93
+ type: "positional",
94
+ description: "Phase number (for reopen)",
95
+ required: false,
96
+ },
97
+ },
98
+ async run({ args }) {
99
+ await phaseCommand({
100
+ action: args.action || "status",
101
+ phaseId: args.id,
84
102
  });
85
- }
86
- if (command === "cce") {
87
- const { positional, unknown, verbose } = parseCliArgs([value, ...rest]);
88
- if (positional[0] !== "install" ||
89
- positional.length > 1 ||
90
- unknown.length) {
91
- console.error("Usage: mozole cce install [--verbose]");
92
- return 2;
93
- }
94
- return cceInstallCommand(cwd, console, { verbose });
95
- }
96
- if (command === "doctor") {
97
- const { unknown, verbose } = parseCliArgs([value, ...rest]);
98
- if (unknown.length) {
99
- console.error(`Unknown doctor option: ${unknown[0]}`);
100
- return 2;
101
- }
102
- return doctorCommand(cwd, console, { verbose });
103
- }
104
- if (command === "verify") {
105
- const { flags, unknown, verbose } = parseCliArgs([value, ...rest], ["--force"]);
106
- if (unknown.length) {
107
- console.error(`Unknown verify option: ${unknown[0]}`);
108
- return 2;
109
- }
110
- return verifyCommand(cwd, console, {
111
- force: flags.includes("--force"),
112
- verbose,
103
+ },
104
+ });
105
+ const repomapCmd = defineCommand({
106
+ meta: {
107
+ name: "repomap",
108
+ description: "Manage docs/repomap architectural index and component registry",
109
+ },
110
+ args: {
111
+ action: {
112
+ type: "positional",
113
+ description: "Action: 'sync' (default) or 'check'",
114
+ required: false,
115
+ default: "sync",
116
+ },
117
+ },
118
+ async run({ args }) {
119
+ await repomapCommand({
120
+ action: args.action || "sync",
113
121
  });
114
- }
115
- if (command === "stats") {
116
- const { unknown, verbose } = parseCliArgs([value, ...rest]);
117
- if (unknown.length) {
118
- console.error(`Unknown stats option: ${unknown[0]}`);
119
- return 2;
120
- }
121
- return statsCommand(cwd, console, { verbose });
122
- }
123
- if (command === "ui") {
124
- if (value || rest.length) {
125
- console.error("Usage: mozole ui");
126
- return 2;
127
- }
128
- return uiCommand(cwd);
129
- }
130
- if (command === "logs") {
131
- const { positional, flags, unknown } = parseCliArgs([value, ...rest], ["--raw"]);
132
- if (unknown.length || positional.length > 1) {
133
- console.error(`Unknown logs option: ${unknown[0] ?? positional[1]}`);
134
- return 2;
135
- }
136
- const name = positional[0];
137
- return logsCommand(cwd, name, flags.includes("--raw"));
138
- }
139
- if (command === "governor" && value === "hook")
140
- return governorHookCommand();
141
- if (command === "qa") {
142
- const { flags, unknown, verbose } = parseCliArgs([value, ...rest], ["--interactive", "--visual", "--diff", "--force"], (flag) => flag.startsWith("--reason="));
143
- if (unknown.length) {
144
- console.error(`Unknown QA option: ${unknown[0]}`);
145
- return 2;
122
+ },
123
+ });
124
+ const testCmd = defineCommand({
125
+ meta: {
126
+ name: "test",
127
+ description: "Run Mozole quality test suites (contract, a11y, probe, or all)",
128
+ },
129
+ args: {
130
+ type: {
131
+ type: "positional",
132
+ description: "Test type: 'contract', 'a11y', 'probe', or 'all'",
133
+ required: false,
134
+ default: "all",
135
+ },
136
+ },
137
+ async run({ args }) {
138
+ await testCommand({
139
+ type: args.type || "all",
140
+ });
141
+ },
142
+ });
143
+ const verifyCmd = defineCommand({
144
+ meta: {
145
+ name: "verify",
146
+ description: "Run full deterministic verification (lint, typecheck, contracts, AI trace, optional probe)",
147
+ },
148
+ args: {
149
+ probe: {
150
+ type: "boolean",
151
+ description: "Also run headless live DOM geometry & trace probe",
152
+ required: false,
153
+ default: false,
154
+ },
155
+ },
156
+ async run({ args }) {
157
+ const passed = await verifyCommand({ withProbe: Boolean(args.probe) });
158
+ if (!passed) {
159
+ process.exit(1);
146
160
  }
147
- if (flags.includes("--diff") && !flags.includes("--visual")) {
148
- console.error("QA --diff requires --visual.");
149
- return 2;
161
+ },
162
+ });
163
+ const doctorCmd = defineCommand({
164
+ meta: {
165
+ name: "doctor",
166
+ description: "Diagnose local system environment, runtimes, and network ports",
167
+ },
168
+ async run() {
169
+ await doctorCommand();
170
+ },
171
+ });
172
+ const uiCmd = defineCommand({
173
+ meta: {
174
+ name: "ui",
175
+ description: "Launch interactive terminal cockpit",
176
+ },
177
+ async run() {
178
+ await uiCommand();
179
+ },
180
+ });
181
+ export const main = defineCommand({
182
+ meta: {
183
+ name: "mozole",
184
+ version: CLI_VERSION,
185
+ description: "Mozole Studio - Autonomous Development Engine & Process Cockpit",
186
+ },
187
+ subCommands: {
188
+ new: newCmd,
189
+ prototype: prototypeCmd,
190
+ adopt: adoptCmd,
191
+ phase: phaseCmd,
192
+ repomap: repomapCmd,
193
+ test: testCmd,
194
+ verify: verifyCmd,
195
+ doctor: doctorCmd,
196
+ ui: uiCmd,
197
+ },
198
+ async run({ rawArgs }) {
199
+ // If run without arguments, launch the interactive UI cockpit
200
+ if (rawArgs.length === 0) {
201
+ await uiCommand();
150
202
  }
151
- const reasonFlag = flags.find((flag) => flag.startsWith("--reason="));
152
- const reason = reasonFlag
153
- ? reasonFlag.slice("--reason=".length)
154
- : undefined;
155
- return qaCommand(cwd, {
156
- interactive: flags.includes("--interactive"),
157
- visual: flags.includes("--visual"),
158
- diff: flags.includes("--diff"),
159
- force: flags.includes("--force"),
160
- verbose,
161
- reason,
162
- }, console);
163
- }
164
- console.error(`Unknown command: ${command}\n\n${help}`);
165
- return 2;
203
+ },
204
+ });
205
+ export function runCli(argv = process.argv.slice(2)) {
206
+ return runMain(main, { rawArgs: argv });
207
+ }
208
+ // Automatically invoke if executed as the main CLI entrypoint
209
+ const isEntry = Boolean(process.argv[1] &&
210
+ (process.argv[1].endsWith("/cli.js") ||
211
+ process.argv[1].endsWith("/cli.ts") ||
212
+ process.argv[1].endsWith("/mozole")));
213
+ if (isEntry) {
214
+ runCli();
166
215
  }
167
- if (isCliEntrypoint(import.meta.url, process.argv[1]))
168
- process.exitCode = await main();
169
216
  //# sourceMappingURL=cli.js.map