frontos 0.2.0__tar.gz

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 (33) hide show
  1. frontos-0.2.0/LICENSE +21 -0
  2. frontos-0.2.0/PKG-INFO +375 -0
  3. frontos-0.2.0/README.md +356 -0
  4. frontos-0.2.0/frontos/__init__.py +3 -0
  5. frontos-0.2.0/frontos/__main__.py +6 -0
  6. frontos-0.2.0/frontos/cli.py +474 -0
  7. frontos-0.2.0/frontos/core/__init__.py +2 -0
  8. frontos-0.2.0/frontos/core/paths.py +70 -0
  9. frontos-0.2.0/frontos/core/redaction.py +35 -0
  10. frontos-0.2.0/frontos/core/store.py +319 -0
  11. frontos-0.2.0/frontos/engines/__init__.py +2 -0
  12. frontos-0.2.0/frontos/engines/design_pack.py +658 -0
  13. frontos-0.2.0/frontos/engines/detect.py +71 -0
  14. frontos-0.2.0/frontos/engines/dev_server.py +200 -0
  15. frontos-0.2.0/frontos/engines/patches.py +730 -0
  16. frontos-0.2.0/frontos/engines/qa.py +259 -0
  17. frontos-0.2.0/frontos/engines/scanner.py +503 -0
  18. frontos-0.2.0/frontos/engines/security.py +51 -0
  19. frontos-0.2.0/frontos/engines/visual.py +654 -0
  20. frontos-0.2.0/frontos/engines/workflow.py +398 -0
  21. frontos-0.2.0/frontos/mcp/__init__.py +2 -0
  22. frontos-0.2.0/frontos/mcp/server.py +837 -0
  23. frontos-0.2.0/frontos/server/__init__.py +2 -0
  24. frontos-0.2.0/frontos/server/http_api.py +315 -0
  25. frontos-0.2.0/frontos.egg-info/PKG-INFO +375 -0
  26. frontos-0.2.0/frontos.egg-info/SOURCES.txt +31 -0
  27. frontos-0.2.0/frontos.egg-info/dependency_links.txt +1 -0
  28. frontos-0.2.0/frontos.egg-info/entry_points.txt +2 -0
  29. frontos-0.2.0/frontos.egg-info/requires.txt +7 -0
  30. frontos-0.2.0/frontos.egg-info/top_level.txt +1 -0
  31. frontos-0.2.0/pyproject.toml +33 -0
  32. frontos-0.2.0/setup.cfg +4 -0
  33. frontos-0.2.0/tests/test_frontos.py +540 -0
frontos-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FrontOS contributors
4
+
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
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.
frontos-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,375 @@
1
+ Metadata-Version: 2.4
2
+ Name: frontos
3
+ Version: 0.2.0
4
+ Summary: Local frontend design-system server for AI coding agents.
5
+ Author: FrontOS
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/imwalkinhere/frontend-system
8
+ Project-URL: Issues, https://github.com/imwalkinhere/frontend-system/issues
9
+ Project-URL: Changelog, https://github.com/imwalkinhere/frontend-system/blob/main/CHANGELOG.md
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Provides-Extra: visual
14
+ Requires-Dist: Pillow>=10.0; extra == "visual"
15
+ Requires-Dist: playwright>=1.44; extra == "visual"
16
+ Provides-Extra: dev
17
+ Requires-Dist: build>=1.2; extra == "dev"
18
+ Dynamic: license-file
19
+
20
+ # FrontOS
21
+
22
+ FrontOS is a local frontend design-system server for AI coding agents. It registers any local project once, scans the frontend, creates project-specific design packs, generates reviewable patch artifacts, and runs strict design QA so agents stop shipping generic frontend work.
23
+
24
+ The current implementation is local-first and patch-only by default. It does not upload source code, and it does not mutate registered projects unless future commands are explicitly given write permission.
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pipx install "git+https://github.com/imwalkinhere/frontend-system.git"
30
+ frontos status
31
+ ```
32
+
33
+ See [`docs/install.md`](docs/install.md) for virtualenv, visual extras, upgrades, Homebrew, PyPI, and release install notes.
34
+
35
+ By default FrontOS stores data in `~/.frontos`. For tests or sandboxed usage:
36
+
37
+ ```bash
38
+ export FRONTOS_HOME=/tmp/frontos-home
39
+ ```
40
+
41
+ ## Getting Started In 5 Minutes
42
+
43
+ ```bash
44
+ frontos project add ~/dev/acme-crm --name acme-crm
45
+ frontos project scan acme-crm
46
+ frontos design-pack create acme-crm
47
+ frontos design-pack create acme-crm --preset field-service-command
48
+ frontos design-pack presets
49
+ frontos repair acme-crm --route /dashboard
50
+ ```
51
+
52
+ `frontos repair` returns the intended output contract:
53
+
54
+ ```json
55
+ {
56
+ "jobId": "job_acme_crm_...",
57
+ "project": "acme-crm",
58
+ "mode": "repair_existing_frontend",
59
+ "route": "/dashboard",
60
+ "designPack": {
61
+ "id": "quiet-premium-ops-acme-crm-v1",
62
+ "styleDNA": "quiet-premium-ops",
63
+ "tokensGenerated": true,
64
+ "componentContractsGenerated": true,
65
+ "screenPatternsGenerated": true
66
+ },
67
+ "artifacts": {
68
+ "appMap": "frontos://project/acme-crm/app-map",
69
+ "behaviorContracts": "frontos://project/acme-crm/behavior-contracts",
70
+ "frontendAudit": "frontos://project/acme-crm/audit/latest",
71
+ "patch": "frontos://patch/patch_acme_crm_...",
72
+ "beforeScreenshot": null,
73
+ "afterScreenshot": null,
74
+ "qaReport": "frontos://qa/job_acme_crm_..."
75
+ },
76
+ "scores": {
77
+ "accessibility": 88,
78
+ "behaviorPreservation": 100,
79
+ "designQuality": 94,
80
+ "responsiveQuality": 91,
81
+ "samenessRisk": 8,
82
+ "stateCoverage": 94,
83
+ "tokenCompliance": 98
84
+ },
85
+ "status": "ready_for_review"
86
+ }
87
+ ```
88
+
89
+ The MVP focuses on local registry, code understanding, design packs, route/component repair diffs, patch artifacts, visual capture metadata, projected patch QA, HTTP, and MCP.
90
+
91
+ ## Optional Visual Tools
92
+
93
+ Visual screenshot capture and pixel comparisons use optional dependencies:
94
+
95
+ ```bash
96
+ python -m pip install -e ".[visual]"
97
+ python -m playwright install chromium
98
+ frontos visual doctor --check-browser
99
+ ```
100
+
101
+ Without those packages, FrontOS still returns structured visual failure reports instead of crashing the workflow.
102
+
103
+ ## Demo
104
+
105
+ Run the first repair demo against a deliberately bad CRM dashboard:
106
+
107
+ ```bash
108
+ python examples/run_ugly_crm_demo.py --apply
109
+ ```
110
+
111
+ The script copies `examples/ugly-crm` into an isolated workspace, registers the copy, repairs `/dashboard`, optionally applies the patch, and prints the patch id, changed files, artifact URIs, and QA scores.
112
+
113
+ To include screenshot planning without launching a browser:
114
+
115
+ ```bash
116
+ python examples/run_ugly_crm_demo.py --apply --visual-dry-run
117
+ ```
118
+
119
+ The public demo script and before/after example assets are documented in [`docs/public-demo.md`](docs/public-demo.md).
120
+ Demo video recording is documented in [`docs/demo-video.md`](docs/demo-video.md).
121
+
122
+ ## Agent Setup
123
+
124
+ MCP setup snippets for Codex, Cursor, and Claude Desktop live in [`docs/agent-setup.md`](docs/agent-setup.md).
125
+
126
+ You can also generate client config from the CLI:
127
+
128
+ ```bash
129
+ frontos mcp config codex
130
+ frontos mcp config cursor
131
+ frontos mcp config claude
132
+ python examples/mcp_smoke.py
133
+ ```
134
+
135
+ The shortest instruction to give an agent is:
136
+
137
+ ```text
138
+ Use FrontOS for all frontend work.
139
+ ```
140
+
141
+ ## Benchmark
142
+
143
+ Run the local benchmark suite:
144
+
145
+ ```bash
146
+ python benchmarks/run_frontos_benchmark.py
147
+ ```
148
+
149
+ The benchmark generates 20 ugly frontend projects in a temporary workspace, including Next App Router, Pages Router, dynamic routes, route groups, Vite React, TanStack Query, SWR, auth-gated, and empty-state-heavy cases. It repairs each one, writes a markdown benchmark report, and checks behavior preservation, token compliance, sameness risk, generated handoff files, and patch artifacts.
150
+
151
+ ## CLI
152
+
153
+ ```bash
154
+ frontos status
155
+ frontos serve --host 127.0.0.1 --port 4791
156
+ frontos stop
157
+
158
+ frontos project add ~/dev/acme-crm --name acme-crm
159
+ frontos project configure acme-crm --base-url http://127.0.0.1:3000 --dev-command "npm run dev"
160
+ frontos project list
161
+ frontos project scan acme-crm
162
+
163
+ frontos design-pack create acme-crm
164
+ frontos design-pack create acme-crm --preset fleet-command
165
+ frontos design-pack presets
166
+ frontos design-pack get acme-crm
167
+
168
+ frontos patch generate acme-crm --route /dashboard
169
+ frontos patch preview patch_acme_crm_20260530T000000 --diff
170
+ frontos patch validate patch_acme_crm_20260530T000000
171
+ frontos patch apply patch_acme_crm_20260530T000000 --dry-run --confirm
172
+ frontos patch apply patch_acme_crm_20260530T000000 --confirm
173
+ frontos patch rollback patch_acme_crm_20260530T000000 --confirm
174
+
175
+ frontos visual capture acme-crm --phase before --route /dashboard
176
+ frontos visual capture acme-crm --phase after --route /dashboard --viewport mobile
177
+ frontos visual compare acme-crm --route /dashboard
178
+ frontos visual latest acme-crm
179
+ frontos visual comparison-latest acme-crm
180
+ frontos visual doctor --check-browser
181
+
182
+ frontos qa acme-crm
183
+ frontos security audit acme-crm
184
+ frontos repair acme-crm --route /dashboard
185
+ frontos workflow repair acme-crm --route /dashboard --base-url http://127.0.0.1:3000 --apply --confirm
186
+ frontos workflow repair acme-crm --route /dashboard --start-server --apply --confirm
187
+ frontos workflow latest acme-crm
188
+ frontos mcp
189
+ ```
190
+
191
+ `frontos visual capture` uses Playwright when installed. To inspect the planned routes, viewport set, and screenshot paths without launching a browser, pass `--dry-run`.
192
+
193
+ `frontos visual compare` pairs the latest `before` and `after` screenshots by route and viewport. If Pillow is installed, it writes pixel diff images and reports changed-pixel percentages. Without Pillow, it still detects byte-identical screenshots and reports when pixel diff support is missing.
194
+
195
+ `frontos workflow repair` runs the coherent product loop: scan, before capture, Design Pack, patch, projected QA, optional apply, after capture, visual comparison, and final QA. Use `--skip-visual` when no local dev server is running, or `--visual-dry-run` to write planned screenshot artifacts without opening a browser.
196
+
197
+ If the project has a configured runtime, `--start-server` launches the stored dev command in the registered project directory, waits for the target route URL when `--route` is provided, records the PID/log path in the workflow report, and stops the process at the end. Pass `--keep-server` only when you intentionally want that child process to stay running.
198
+
199
+ Playwright, browser, and route navigation failures are returned as structured `visual_failed` workflow reports with the capture manifest attached, instead of uncaught runtime errors.
200
+
201
+ Patch validation, dry-run apply, and rollback details are documented in [`docs/patch-safety.md`](docs/patch-safety.md). Visual capture troubleshooting is documented in [`docs/visual-qa.md`](docs/visual-qa.md).
202
+
203
+ ## HTTP API
204
+
205
+ Run:
206
+
207
+ ```bash
208
+ frontos serve
209
+ ```
210
+
211
+ Then open `http://127.0.0.1:4791/` for the simple local project dashboard, or use the API endpoints below.
212
+
213
+ Endpoints:
214
+
215
+ - `GET /health`
216
+ - `GET /`
217
+ - `GET /projects`
218
+ - `GET /design-presets`
219
+ - `POST /projects`
220
+ - `GET /projects/{id}`
221
+ - `POST /projects/{id}/scan`
222
+ - `GET /projects/{id}/scan/latest`
223
+ - `POST /projects/{id}/runtime`
224
+ - `GET /projects/{id}/runtime`
225
+ - `POST /projects/{id}/design-pack`
226
+ - `GET /projects/{id}/design-pack/latest`
227
+ - `POST /projects/{id}/patch`
228
+ - `POST /projects/{id}/visual`
229
+ - `GET /projects/{id}/visual/latest`
230
+ - `POST /projects/{id}/visual-compare`
231
+ - `GET /projects/{id}/visual-comparison/latest`
232
+ - `POST /projects/{id}/workflow-repair`
233
+ - `GET /projects/{id}/workflow/latest`
234
+ - `POST /projects/{id}/qa`
235
+ - `GET /projects/{id}/qa/latest`
236
+ - `GET /patches/{patchId}`
237
+ - `GET /patches/{patchId}/validate`
238
+ - `POST /patches/{patchId}/apply`
239
+ - `POST /patches/{patchId}/validate`
240
+ - `POST /patches/{patchId}/rollback`
241
+
242
+ ## MCP
243
+
244
+ Run:
245
+
246
+ ```bash
247
+ frontos mcp
248
+ ```
249
+
250
+ The stdio server supports Content-Length framed JSON-RPC and exposes:
251
+
252
+ - `frontos.register_project`
253
+ - `frontos.scan_project`
254
+ - `frontos.configure_project_runtime`
255
+ - `frontos.describe_app`
256
+ - `frontos.audit_frontend`
257
+ - `frontos.create_design_pack`
258
+ - `frontos.list_design_presets`
259
+ - `frontos.get_design_pack`
260
+ - `frontos.generate_component`
261
+ - `frontos.generate_screen`
262
+ - `frontos.redesign_route`
263
+ - `frontos.generate_patch`
264
+ - `frontos.preview_patch`
265
+ - `frontos.validate_patch`
266
+ - `frontos.apply_patch`
267
+ - `frontos.compare_before_after`
268
+ - `frontos.capture_screenshots`
269
+ - `frontos.fix_qa_issues`
270
+ - `frontos.repair_frontend`
271
+ - `frontos.run_repair_workflow`
272
+ - `frontos.run_design_qa`
273
+ - `frontos.rollback_patch`
274
+
275
+ `frontos.run_repair_workflow` accepts `startServer`, `keepServer`, and `startupTimeoutSeconds` in addition to the CLI-equivalent repair, apply, visual, and runtime options.
276
+
277
+ Resources include:
278
+
279
+ - `frontos://projects`
280
+ - `frontos://project/{id}/app-map`
281
+ - `frontos://project/{id}/ui-inventory`
282
+ - `frontos://project/{id}/behavior-contracts`
283
+ - `frontos://project/{id}/audit/latest`
284
+ - `frontos://project/{id}/screenshots/latest`
285
+ - `frontos://project/{id}/screenshots/before`
286
+ - `frontos://project/{id}/screenshots/after`
287
+ - `frontos://project/{id}/visual-comparison/latest`
288
+ - `frontos://project/{id}/workflow/latest`
289
+ - `frontos://design-pack/{id}`
290
+ - `frontos://patch/{id}`
291
+ - `frontos://visual-comparison/{id}`
292
+ - `frontos://workflow/{id}`
293
+ - `frontos://qa/{id}`
294
+
295
+ Prompts include:
296
+
297
+ - `frontos.repair_existing_frontend`
298
+ - `frontos.redesign_route`
299
+ - `frontos.design_qa_review`
300
+
301
+ ## What FrontOS Scans
302
+
303
+ The MVP scanner understands the stack targeted in the product plan:
304
+
305
+ - React, Next.js, Vite, Vue/Nuxt route scanning, and SvelteKit route scanning
306
+ - TypeScript and JavaScript
307
+ - Tailwind, CSS modules, and CSS
308
+ - App/pages routes
309
+ - Components
310
+ - Forms, buttons, links, tables
311
+ - `fetch` and `axios` calls
312
+ - imported local helper data calls
313
+ - TanStack Query, SWR, and data hooks
314
+ - Auth, loading, empty, error, success states
315
+ - Raw colors, arbitrary Tailwind values, and generic AI design patterns
316
+
317
+ ## Artifact Layout
318
+
319
+ FrontOS creates the layout from the product plan:
320
+
321
+ ```text
322
+ ~/.frontos/
323
+ config.yml
324
+ frontos.db
325
+ projects/
326
+ design-packs/
327
+ scans/
328
+ behavior-contracts/
329
+ screenshots/
330
+ patches/
331
+ qa-reports/
332
+ registry/
333
+ adapters/
334
+ ```
335
+
336
+ ## Safety Model
337
+
338
+ - Projects must be registered explicitly.
339
+ - Default permissions are read-only and patch-only.
340
+ - Generated patch artifacts are stored under `~/.frontos/patches`.
341
+ - Patch apply writes only staged files listed in the patch manifest and requires `--confirm` for patch-only projects.
342
+ - Patch validation blocks apply if target files changed after patch generation.
343
+ - Dev-server commands reject shell control operators and run as argument vectors.
344
+ - Route repair patches include the matched route file and local imported components when FrontOS can resolve them.
345
+ - Patch QA scores the projected repaired files; plain `frontos qa` still audits the current source for before/after proof.
346
+ - Screenshot capture targets the configured local base URL and stores images/reports under `~/.frontos/screenshots`.
347
+ - Visual comparison stores before/after diff reports under `~/.frontos/screenshots/{project}/diffs`.
348
+ - Workflow repair reports are stored under `~/.frontos/qa-reports/{project}/workflows`.
349
+ - Rollback snapshots are captured for route and component files included in a generated patch.
350
+ - Patch rollback restores snapshotted files and removes new files created by the patch.
351
+ - Source code never leaves the machine in this implementation.
352
+ - Generated patch artifacts can contain source snippets and diffs; treat `~/.frontos` as sensitive local developer data.
353
+ - FrontOS is a local developer tool and cannot guarantee complete runtime behavior preservation. Review patches and run the app's own tests before shipping.
354
+ - `frontos security audit <project>` scans registered source files for secret-like values and reports redacted previews.
355
+ - Longer cloud/model upload security gates are documented in [`docs/security-review.md`](docs/security-review.md).
356
+
357
+ ## Development
358
+
359
+ ```bash
360
+ python -m pip install -e .
361
+ python -m unittest discover -s tests -v
362
+ python -m compileall -q frontos tests examples benchmarks
363
+ python examples/run_ugly_crm_demo.py --apply
364
+ python benchmarks/run_frontos_benchmark.py
365
+ ```
366
+
367
+ GitHub Actions runs those same checks on Python 3.10, 3.11, and 3.12.
368
+
369
+ Optional Playwright screenshot CI is available through the manually triggered `Visual QA` workflow.
370
+ Publishing, PyPI trusted-publisher setup, Homebrew formula details, and Pages deployment are documented in [`docs/publishing.md`](docs/publishing.md).
371
+ The static landing page source lives in [`site/`](site/).
372
+
373
+ ## License
374
+
375
+ FrontOS is released under the MIT License. See [`LICENSE`](LICENSE).