achira-wf 3.1.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/.achira/ARCHITECTURE.md +296 -0
- package/.achira/core/agents/backend-specialist.md +263 -0
- package/.achira/core/agents/code-archaeologist.md +106 -0
- package/.achira/core/agents/database-architect.md +226 -0
- package/.achira/core/agents/debugger.md +225 -0
- package/.achira/core/agents/devops-engineer.md +242 -0
- package/.achira/core/agents/documentation-writer.md +104 -0
- package/.achira/core/agents/explorer-agent.md +73 -0
- package/.achira/core/agents/frontend-specialist.md +593 -0
- package/.achira/core/agents/game-developer.md +162 -0
- package/.achira/core/agents/mobile-developer.md +377 -0
- package/.achira/core/agents/orchestrator.md +416 -0
- package/.achira/core/agents/penetration-tester.md +188 -0
- package/.achira/core/agents/performance-optimizer.md +187 -0
- package/.achira/core/agents/product-manager.md +112 -0
- package/.achira/core/agents/product-owner.md +95 -0
- package/.achira/core/agents/project-planner.md +413 -0
- package/.achira/core/agents/qa-automation-engineer.md +103 -0
- package/.achira/core/agents/security-auditor.md +170 -0
- package/.achira/core/agents/seo-specialist.md +111 -0
- package/.achira/core/agents/test-engineer.md +158 -0
- package/.achira/core/mcp_config.json +24 -0
- package/.achira/core/shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.achira/core/shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.achira/core/shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.achira/core/shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.achira/core/shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.achira/core/shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.achira/core/shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.achira/core/shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.achira/core/shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.achira/core/shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.achira/core/shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.achira/core/shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.achira/core/shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/__pycache__/generate_theme.cpython-314.pyc +0 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/generate_theme.py +99 -0
- package/.achira/core/shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/.achira/core/skills/api-patterns/SKILL.md +81 -0
- package/.achira/core/skills/api-patterns/api-style.md +42 -0
- package/.achira/core/skills/api-patterns/auth.md +24 -0
- package/.achira/core/skills/api-patterns/documentation.md +26 -0
- package/.achira/core/skills/api-patterns/graphql.md +41 -0
- package/.achira/core/skills/api-patterns/rate-limiting.md +31 -0
- package/.achira/core/skills/api-patterns/response.md +37 -0
- package/.achira/core/skills/api-patterns/rest.md +40 -0
- package/.achira/core/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.achira/core/skills/api-patterns/security-testing.md +122 -0
- package/.achira/core/skills/api-patterns/trpc.md +41 -0
- package/.achira/core/skills/api-patterns/versioning.md +22 -0
- package/.achira/core/skills/app-builder/SKILL.md +98 -0
- package/.achira/core/skills/app-builder/agent-coordination.md +71 -0
- package/.achira/core/skills/app-builder/feature-building.md +53 -0
- package/.achira/core/skills/app-builder/project-detection.md +34 -0
- package/.achira/core/skills/app-builder/scaffolding.md +118 -0
- package/.achira/core/skills/app-builder/tech-stack.md +40 -0
- package/.achira/core/skills/app-builder/templates/SKILL.md +39 -0
- package/.achira/core/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.achira/core/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.achira/core/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.achira/core/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.achira/core/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.achira/core/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.achira/core/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.achira/core/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.achira/core/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.achira/core/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.achira/core/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.achira/core/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.achira/core/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.achira/core/skills/architecture/SKILL.md +55 -0
- package/.achira/core/skills/architecture/context-discovery.md +43 -0
- package/.achira/core/skills/architecture/examples.md +94 -0
- package/.achira/core/skills/architecture/pattern-selection.md +68 -0
- package/.achira/core/skills/architecture/patterns-reference.md +50 -0
- package/.achira/core/skills/architecture/trade-off-analysis.md +77 -0
- package/.achira/core/skills/bash-linux/SKILL.md +199 -0
- package/.achira/core/skills/behavioral-modes/SKILL.md +242 -0
- package/.achira/core/skills/brainstorming/SKILL.md +163 -0
- package/.achira/core/skills/brainstorming/dynamic-questioning.md +350 -0
- package/.achira/core/skills/clean-code/SKILL.md +201 -0
- package/.achira/core/skills/code-review-checklist/SKILL.md +109 -0
- package/.achira/core/skills/database-design/SKILL.md +52 -0
- package/.achira/core/skills/database-design/database-selection.md +43 -0
- package/.achira/core/skills/database-design/indexing.md +39 -0
- package/.achira/core/skills/database-design/migrations.md +48 -0
- package/.achira/core/skills/database-design/optimization.md +36 -0
- package/.achira/core/skills/database-design/orm-selection.md +30 -0
- package/.achira/core/skills/database-design/schema-design.md +56 -0
- package/.achira/core/skills/database-design/scripts/schema_validator.py +172 -0
- package/.achira/core/skills/deployment-procedures/SKILL.md +241 -0
- package/.achira/core/skills/doc.md +177 -0
- package/.achira/core/skills/documentation-templates/SKILL.md +194 -0
- package/.achira/core/skills/frontend-design/SKILL.md +418 -0
- package/.achira/core/skills/frontend-design/animation-guide.md +331 -0
- package/.achira/core/skills/frontend-design/color-system.md +311 -0
- package/.achira/core/skills/frontend-design/decision-trees.md +418 -0
- package/.achira/core/skills/frontend-design/motion-graphics.md +306 -0
- package/.achira/core/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.achira/core/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.achira/core/skills/frontend-design/typography-system.md +345 -0
- package/.achira/core/skills/frontend-design/ux-psychology.md +1116 -0
- package/.achira/core/skills/frontend-design/visual-effects.md +383 -0
- package/.achira/core/skills/game-development/2d-games/SKILL.md +119 -0
- package/.achira/core/skills/game-development/3d-games/SKILL.md +135 -0
- package/.achira/core/skills/game-development/SKILL.md +167 -0
- package/.achira/core/skills/game-development/game-art/SKILL.md +185 -0
- package/.achira/core/skills/game-development/game-audio/SKILL.md +190 -0
- package/.achira/core/skills/game-development/game-design/SKILL.md +129 -0
- package/.achira/core/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.achira/core/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.achira/core/skills/game-development/pc-games/SKILL.md +144 -0
- package/.achira/core/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.achira/core/skills/game-development/web-games/SKILL.md +150 -0
- package/.achira/core/skills/geo-fundamentals/SKILL.md +156 -0
- package/.achira/core/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.achira/core/skills/i18n-localization/SKILL.md +154 -0
- package/.achira/core/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.achira/core/skills/intelligent-routing/SKILL.md +335 -0
- package/.achira/core/skills/lint-and-validate/SKILL.md +45 -0
- package/.achira/core/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/.achira/core/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.achira/core/skills/mcp-builder/SKILL.md +176 -0
- package/.achira/core/skills/mobile-design/SKILL.md +394 -0
- package/.achira/core/skills/mobile-design/decision-trees.md +516 -0
- package/.achira/core/skills/mobile-design/mobile-backend.md +491 -0
- package/.achira/core/skills/mobile-design/mobile-color-system.md +420 -0
- package/.achira/core/skills/mobile-design/mobile-debugging.md +122 -0
- package/.achira/core/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/.achira/core/skills/mobile-design/mobile-navigation.md +458 -0
- package/.achira/core/skills/mobile-design/mobile-performance.md +767 -0
- package/.achira/core/skills/mobile-design/mobile-testing.md +356 -0
- package/.achira/core/skills/mobile-design/mobile-typography.md +433 -0
- package/.achira/core/skills/mobile-design/platform-android.md +666 -0
- package/.achira/core/skills/mobile-design/platform-ios.md +561 -0
- package/.achira/core/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.achira/core/skills/mobile-design/touch-psychology.md +537 -0
- package/.achira/core/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
- package/.achira/core/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/.achira/core/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/.achira/core/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/.achira/core/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/.achira/core/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/.achira/core/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/.achira/core/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/.achira/core/skills/nextjs-react-expert/SKILL.md +286 -0
- package/.achira/core/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/.achira/core/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/.achira/core/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.achira/core/skills/parallel-agents/SKILL.md +175 -0
- package/.achira/core/skills/performance-profiling/SKILL.md +143 -0
- package/.achira/core/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.achira/core/skills/plan-writing/SKILL.md +152 -0
- package/.achira/core/skills/powershell-windows/SKILL.md +167 -0
- package/.achira/core/skills/project-setup/SKILL.md +291 -0
- package/.achira/core/skills/python-patterns/SKILL.md +441 -0
- package/.achira/core/skills/red-team-tactics/SKILL.md +199 -0
- package/.achira/core/skills/rust-pro/SKILL.md +176 -0
- package/.achira/core/skills/seo-fundamentals/SKILL.md +129 -0
- package/.achira/core/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/.achira/core/skills/server-management/SKILL.md +161 -0
- package/.achira/core/skills/systematic-debugging/SKILL.md +109 -0
- package/.achira/core/skills/tailwind-patterns/SKILL.md +269 -0
- package/.achira/core/skills/tdd-workflow/SKILL.md +149 -0
- package/.achira/core/skills/testing-patterns/SKILL.md +178 -0
- package/.achira/core/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.achira/core/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.achira/core/skills/vulnerability-scanner/checklists.md +121 -0
- package/.achira/core/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/.achira/core/skills/web-design-guidelines/SKILL.md +57 -0
- package/.achira/core/skills/webapp-testing/SKILL.md +187 -0
- package/.achira/core/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.achira/rules/GEMINI.md +273 -0
- package/.achira/scripts/__pycache__/checklist.cpython-314.pyc +0 -0
- package/.achira/scripts/__pycache__/shared_utils.cpython-314.pyc +0 -0
- package/.achira/scripts/__pycache__/verify_all.cpython-314.pyc +0 -0
- package/.achira/scripts/auto_preview.py +148 -0
- package/.achira/scripts/checklist.py +193 -0
- package/.achira/scripts/session_manager.py +120 -0
- package/.achira/scripts/shared_utils.py +64 -0
- package/.achira/scripts/verify_all.py +304 -0
- package/.achira/workflows/brainstorm.md +113 -0
- package/.achira/workflows/create.md +59 -0
- package/.achira/workflows/debug.md +103 -0
- package/.achira/workflows/deploy.md +176 -0
- package/.achira/workflows/enhance.md +63 -0
- package/.achira/workflows/html+js+css.md +363 -0
- package/.achira/workflows/next.js.md +316 -0
- package/.achira/workflows/orchestrate.md +237 -0
- package/.achira/workflows/plan.md +89 -0
- package/.achira/workflows/preview.md +81 -0
- package/.achira/workflows/react+vite.md +280 -0
- package/.achira/workflows/registry.json +35 -0
- package/.achira/workflows/status.md +86 -0
- package/.achira/workflows/test.md +144 -0
- package/.achira/workflows/ui-ux-pro-max.md +296 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/html+js+css.md +363 -0
- package/.agent/workflows/next.js.md +316 -0
- package/.agent/workflows/orchestrate.md +237 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +81 -0
- package/.agent/workflows/react+vite.md +280 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +296 -0
- package/LICENSE +21 -0
- package/README.md +110 -0
- package/cli.js +293 -0
- package/package.json +48 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill: webapp-testing
|
|
4
|
+
Script: playwright_runner.py
|
|
5
|
+
Purpose: Run basic Playwright browser tests
|
|
6
|
+
Usage: python playwright_runner.py <url> [--screenshot]
|
|
7
|
+
Output: JSON with page info, health status, and optional screenshot path
|
|
8
|
+
Note: Requires playwright (pip install playwright && playwright install chromium)
|
|
9
|
+
Screenshots: Saved to system temp directory (auto-cleaned by OS)
|
|
10
|
+
"""
|
|
11
|
+
import sys
|
|
12
|
+
import json
|
|
13
|
+
import os
|
|
14
|
+
import tempfile
|
|
15
|
+
from datetime import datetime
|
|
16
|
+
|
|
17
|
+
# Fix Windows console encoding for Unicode output
|
|
18
|
+
try:
|
|
19
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
20
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
21
|
+
except AttributeError:
|
|
22
|
+
pass # Python < 3.7
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
from playwright.sync_api import sync_playwright
|
|
26
|
+
PLAYWRIGHT_AVAILABLE = True
|
|
27
|
+
except ImportError:
|
|
28
|
+
PLAYWRIGHT_AVAILABLE = False
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def run_basic_test(url: str, take_screenshot: bool = False) -> dict:
|
|
32
|
+
"""Run basic browser test on URL."""
|
|
33
|
+
if not PLAYWRIGHT_AVAILABLE:
|
|
34
|
+
return {
|
|
35
|
+
"error": "Playwright not installed",
|
|
36
|
+
"fix": "pip install playwright && playwright install chromium"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
result = {
|
|
40
|
+
"url": url,
|
|
41
|
+
"timestamp": datetime.now().isoformat(),
|
|
42
|
+
"status": "pending"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
with sync_playwright() as p:
|
|
47
|
+
browser = p.chromium.launch(headless=True)
|
|
48
|
+
context = browser.new_context(
|
|
49
|
+
viewport={"width": 1280, "height": 720},
|
|
50
|
+
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
51
|
+
)
|
|
52
|
+
page = context.new_page()
|
|
53
|
+
|
|
54
|
+
# Navigate
|
|
55
|
+
response = page.goto(url, wait_until="networkidle", timeout=30000)
|
|
56
|
+
|
|
57
|
+
# Basic info
|
|
58
|
+
result["page"] = {
|
|
59
|
+
"title": page.title(),
|
|
60
|
+
"url": page.url,
|
|
61
|
+
"status_code": response.status if response else None
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Health checks
|
|
65
|
+
result["health"] = {
|
|
66
|
+
"loaded": response.ok if response else False,
|
|
67
|
+
"has_title": bool(page.title()),
|
|
68
|
+
"has_h1": page.locator("h1").count() > 0,
|
|
69
|
+
"has_links": page.locator("a").count() > 0,
|
|
70
|
+
"has_images": page.locator("img").count() > 0
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Console errors
|
|
74
|
+
console_errors = []
|
|
75
|
+
page.on("console", lambda msg: console_errors.append(msg.text) if msg.type == "error" else None)
|
|
76
|
+
|
|
77
|
+
# Performance metrics
|
|
78
|
+
result["performance"] = {
|
|
79
|
+
"dom_content_loaded": page.evaluate("window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart"),
|
|
80
|
+
"load_complete": page.evaluate("window.performance.timing.loadEventEnd - window.performance.timing.navigationStart")
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Screenshot - uses system temp directory (cross-platform, auto-cleaned)
|
|
84
|
+
if take_screenshot:
|
|
85
|
+
# Cross-platform: Windows=%TEMP%, Linux/macOS=/tmp
|
|
86
|
+
screenshot_dir = os.path.join(tempfile.gettempdir(), "maestro_screenshots")
|
|
87
|
+
os.makedirs(screenshot_dir, exist_ok=True)
|
|
88
|
+
screenshot_path = os.path.join(screenshot_dir, f"screenshot_{datetime.now().strftime('%Y%m%d_%H%M%S')}.png")
|
|
89
|
+
page.screenshot(path=screenshot_path, full_page=True)
|
|
90
|
+
result["screenshot"] = screenshot_path
|
|
91
|
+
result["screenshot_note"] = "Saved to temp directory (auto-cleaned by OS)"
|
|
92
|
+
|
|
93
|
+
# Element counts
|
|
94
|
+
result["elements"] = {
|
|
95
|
+
"links": page.locator("a").count(),
|
|
96
|
+
"buttons": page.locator("button").count(),
|
|
97
|
+
"inputs": page.locator("input").count(),
|
|
98
|
+
"images": page.locator("img").count(),
|
|
99
|
+
"forms": page.locator("form").count()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
browser.close()
|
|
103
|
+
|
|
104
|
+
result["status"] = "success" if result["health"]["loaded"] else "failed"
|
|
105
|
+
result["summary"] = "[OK] Page loaded successfully" if result["status"] == "success" else "[X] Page failed to load"
|
|
106
|
+
|
|
107
|
+
except Exception as e:
|
|
108
|
+
result["status"] = "error"
|
|
109
|
+
result["error"] = str(e)
|
|
110
|
+
result["summary"] = f"[X] Error: {str(e)[:100]}"
|
|
111
|
+
|
|
112
|
+
return result
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def run_accessibility_check(url: str) -> dict:
|
|
116
|
+
"""Run basic accessibility check."""
|
|
117
|
+
if not PLAYWRIGHT_AVAILABLE:
|
|
118
|
+
return {"error": "Playwright not installed"}
|
|
119
|
+
|
|
120
|
+
result = {"url": url, "accessibility": {}}
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
with sync_playwright() as p:
|
|
124
|
+
browser = p.chromium.launch(headless=True)
|
|
125
|
+
page = browser.new_page()
|
|
126
|
+
page.goto(url, wait_until="networkidle", timeout=30000)
|
|
127
|
+
|
|
128
|
+
# Basic a11y checks
|
|
129
|
+
result["accessibility"] = {
|
|
130
|
+
"images_with_alt": page.locator("img[alt]").count(),
|
|
131
|
+
"images_without_alt": page.locator("img:not([alt])").count(),
|
|
132
|
+
"buttons_with_label": page.locator("button[aria-label], button:has-text('')").count(),
|
|
133
|
+
"links_with_text": page.locator("a:has-text('')").count(),
|
|
134
|
+
"form_labels": page.locator("label").count(),
|
|
135
|
+
"headings": {
|
|
136
|
+
"h1": page.locator("h1").count(),
|
|
137
|
+
"h2": page.locator("h2").count(),
|
|
138
|
+
"h3": page.locator("h3").count()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
browser.close()
|
|
143
|
+
result["status"] = "success"
|
|
144
|
+
|
|
145
|
+
except Exception as e:
|
|
146
|
+
result["status"] = "error"
|
|
147
|
+
result["error"] = str(e)
|
|
148
|
+
|
|
149
|
+
return result
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if __name__ == "__main__":
|
|
153
|
+
if len(sys.argv) < 2:
|
|
154
|
+
print(json.dumps({
|
|
155
|
+
"error": "Usage: python playwright_runner.py <url> [--screenshot] [--a11y]",
|
|
156
|
+
"examples": [
|
|
157
|
+
"python playwright_runner.py https://example.com",
|
|
158
|
+
"python playwright_runner.py https://example.com --screenshot",
|
|
159
|
+
"python playwright_runner.py https://example.com --a11y"
|
|
160
|
+
]
|
|
161
|
+
}, indent=2))
|
|
162
|
+
sys.exit(1)
|
|
163
|
+
|
|
164
|
+
url = sys.argv[1]
|
|
165
|
+
take_screenshot = "--screenshot" in sys.argv
|
|
166
|
+
check_a11y = "--a11y" in sys.argv
|
|
167
|
+
|
|
168
|
+
if check_a11y:
|
|
169
|
+
result = run_accessibility_check(url)
|
|
170
|
+
else:
|
|
171
|
+
result = run_basic_test(url, take_screenshot)
|
|
172
|
+
|
|
173
|
+
print(json.dumps(result, indent=2))
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# GEMINI.md - Achira Workflow OS
|
|
6
|
+
|
|
7
|
+
> This file defines how the AI behaves in this workspace.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
|
|
12
|
+
|
|
13
|
+
> **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
|
|
14
|
+
|
|
15
|
+
### 1. Modular Skill Loading Protocol
|
|
16
|
+
|
|
17
|
+
Agent activated â Check frontmatter "skills:" â Read SKILL.md (INDEX) â Read specific sections.
|
|
18
|
+
|
|
19
|
+
- **Selective Reading:** DO NOT read ALL files in a skill folder. Read `SKILL.md` first, then only read sections matching the user's request.
|
|
20
|
+
- **Rule Priority:** P0 (GEMINI.md) > P1 (Agent .md) > P2 (SKILL.md). All rules are binding.
|
|
21
|
+
|
|
22
|
+
### 2. Enforcement Protocol
|
|
23
|
+
|
|
24
|
+
1. **When agent is activated:**
|
|
25
|
+
- â
Activate: Read Rules â Check Frontmatter â Load SKILL.md â Apply All.
|
|
26
|
+
2. **Forbidden:** Never skip reading agent rules or skill instructions. "Read â Understand â Apply" is mandatory.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## đĨ REQUEST CLASSIFIER (STEP 1)
|
|
31
|
+
|
|
32
|
+
**Before ANY action, classify the request:**
|
|
33
|
+
|
|
34
|
+
| Request Type | Trigger Keywords | Active Tiers | Result |
|
|
35
|
+
| ---------------- | ------------------------------------------ | ------------------------------ | --------------------------- |
|
|
36
|
+
| **QUESTION** | "what is", "how does", "explain" | TIER 0 only | Text Response |
|
|
37
|
+
| **SURVEY/INTEL** | "analyze", "list files", "overview" | TIER 0 + Explorer | Session Intel (No File) |
|
|
38
|
+
| **SIMPLE CODE** | "fix", "add", "change" (single file) | TIER 0 + TIER 1 (lite) | Inline Edit |
|
|
39
|
+
| **COMPLEX CODE** | "build", "create", "implement", "refactor" | TIER 0 + TIER 1 (full) + Agent | **{task-slug}.md Required** |
|
|
40
|
+
| **DESIGN/UI** | "design", "UI", "page", "dashboard" | TIER 0 + TIER 1 + Agent | **{task-slug}.md Required** |
|
|
41
|
+
| **SLASH CMD** | /create, /orchestrate, /debug | Command-specific flow | Variable |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## đ¤ INTELLIGENT AGENT ROUTING (STEP 2 - AUTO)
|
|
46
|
+
|
|
47
|
+
**ALWAYS ACTIVE: Before responding to ANY request, automatically analyze and select the best agent(s).**
|
|
48
|
+
|
|
49
|
+
> đ´ **MANDATORY:** You MUST follow the protocol defined in `@[skills/intelligent-routing]`.
|
|
50
|
+
|
|
51
|
+
### Auto-Selection Protocol
|
|
52
|
+
|
|
53
|
+
1. **Analyze (Silent)**: Detect domains (Frontend, Backend, Security, etc.) from user request.
|
|
54
|
+
2. **Select Agent(s)**: Choose the most appropriate specialist(s).
|
|
55
|
+
3. **Inform User**: Concisely state which expertise is being applied.
|
|
56
|
+
4. **Apply**: Generate response using the selected agent's persona and rules.
|
|
57
|
+
|
|
58
|
+
### Response Format (MANDATORY)
|
|
59
|
+
|
|
60
|
+
When auto-applying an agent, inform the user:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
đ¤ **Applying knowledge of `@[agent-name]`...**
|
|
64
|
+
|
|
65
|
+
[Continue with specialized response]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Rules:**
|
|
69
|
+
|
|
70
|
+
1. **Silent Analysis**: No verbose meta-commentary ("I am analyzing...").
|
|
71
|
+
2. **Respect Overrides**: If user mentions `@agent`, use it.
|
|
72
|
+
3. **Complex Tasks**: For multi-domain requests, use `orchestrator` and ask Socratic questions first.
|
|
73
|
+
|
|
74
|
+
### â ī¸ AGENT ROUTING CHECKLIST (MANDATORY BEFORE EVERY CODE/DESIGN RESPONSE)
|
|
75
|
+
|
|
76
|
+
**Before ANY code or design work, you MUST complete this mental checklist:**
|
|
77
|
+
|
|
78
|
+
| Step | Check | If Unchecked |
|
|
79
|
+
| ---- | -------------------------------------------------------- | --------------------------------------------- |
|
|
80
|
+
| 1 | Did I identify the correct agent for this domain? | â STOP. Analyze request domain first. |
|
|
81
|
+
| 2 | Did I READ the agent's `.md` file (or recall its rules)? | â STOP. Open `.achira/core/agents/{agent}.md` |
|
|
82
|
+
| 3 | Did I announce `đ¤ Applying knowledge of @[agent]...`? | â STOP. Add announcement before response. |
|
|
83
|
+
| 4 | Did I load required skills from agent's frontmatter? | â STOP. Check `skills:` field and read them. |
|
|
84
|
+
|
|
85
|
+
**Failure Conditions:**
|
|
86
|
+
|
|
87
|
+
- â Writing code without identifying an agent = **PROTOCOL VIOLATION**
|
|
88
|
+
- â Skipping the announcement = **USER CANNOT VERIFY AGENT WAS USED**
|
|
89
|
+
- â Ignoring agent-specific rules (e.g., Purple Ban) = **QUALITY FAILURE**
|
|
90
|
+
|
|
91
|
+
> đ´ **Self-Check Trigger:** Every time you are about to write code or create UI, ask yourself:
|
|
92
|
+
> "Have I completed the Agent Routing Checklist?" If NO â Complete it first.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## TIER 0: UNIVERSAL RULES (Always Active)
|
|
97
|
+
|
|
98
|
+
### đ Language Handling
|
|
99
|
+
|
|
100
|
+
When user's prompt is NOT in English:
|
|
101
|
+
|
|
102
|
+
1. **Internally translate** for better comprehension
|
|
103
|
+
2. **Respond in user's language** - match their communication
|
|
104
|
+
3. **Code comments/variables** remain in English
|
|
105
|
+
|
|
106
|
+
### đ§š Clean Code (Global Mandatory)
|
|
107
|
+
|
|
108
|
+
**ALL code MUST follow `@[skills/clean-code]` rules. No exceptions.**
|
|
109
|
+
|
|
110
|
+
- **Code**: Concise, direct, no over-engineering. Self-documenting.
|
|
111
|
+
- **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
|
|
112
|
+
- **Performance**: Measure first. Adhere to 2025 standards (Core Web Vitals).
|
|
113
|
+
- **Infra/Safety**: 5-Phase Deployment. Verify secrets security.
|
|
114
|
+
|
|
115
|
+
### đ File Dependency Awareness
|
|
116
|
+
|
|
117
|
+
**Before modifying ANY file:**
|
|
118
|
+
|
|
119
|
+
1. Check `CODEBASE.md` â File Dependencies
|
|
120
|
+
2. Identify dependent files
|
|
121
|
+
3. Update ALL affected files together
|
|
122
|
+
|
|
123
|
+
### đēī¸ System Map Read
|
|
124
|
+
|
|
125
|
+
> đ´ **MANDATORY:** Read `ARCHITECTURE.md` at session start to understand Agents, Skills, and Scripts.
|
|
126
|
+
|
|
127
|
+
**Path Awareness:**
|
|
128
|
+
|
|
129
|
+
- Agents: `.achira/core/agents/` (Project)
|
|
130
|
+
- Skills: `.achira/core/skills/` (Project)
|
|
131
|
+
- Runtime Scripts: `.achira/core/skills/<skill>/scripts/`
|
|
132
|
+
|
|
133
|
+
### đ§ Read â Understand â Apply
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
â WRONG: Read agent file â Start coding
|
|
137
|
+
â
CORRECT: Read â Understand WHY â Apply PRINCIPLES â Code
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Before coding, answer:**
|
|
141
|
+
|
|
142
|
+
1. What is the GOAL of this agent/skill?
|
|
143
|
+
2. What PRINCIPLES must I apply?
|
|
144
|
+
3. How does this DIFFER from generic output?
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## TIER 1: CODE RULES (When Writing Code)
|
|
149
|
+
|
|
150
|
+
### đą Project Type Routing
|
|
151
|
+
|
|
152
|
+
| Project Type | Primary Agent | Skills |
|
|
153
|
+
| -------------------------------------- | --------------------- | ----------------------------- |
|
|
154
|
+
| **MOBILE** (iOS, Android, RN, Flutter) | `mobile-developer` | mobile-design |
|
|
155
|
+
| **WEB** (Next.js, React web) | `frontend-specialist` | frontend-design |
|
|
156
|
+
| **BACKEND** (API, server, DB) | `backend-specialist` | api-patterns, database-design |
|
|
157
|
+
|
|
158
|
+
> đ´ **Mobile + frontend-specialist = WRONG.** Mobile = mobile-developer ONLY.
|
|
159
|
+
|
|
160
|
+
### đ Socratic Gate
|
|
161
|
+
|
|
162
|
+
**For complex requests, STOP and ASK first:**
|
|
163
|
+
|
|
164
|
+
### đ GLOBAL SOCRATIC GATE (TIER 0)
|
|
165
|
+
|
|
166
|
+
**MANDATORY: Every user request must pass through the Socratic Gate before ANY tool use or implementation.**
|
|
167
|
+
|
|
168
|
+
| Request Type | Strategy | Required Action |
|
|
169
|
+
| ----------------------- | -------------- | ----------------------------------------------------------------- |
|
|
170
|
+
| **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
|
|
171
|
+
| **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
|
|
172
|
+
| **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
|
|
173
|
+
| **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
|
|
174
|
+
| **Direct "Proceed"** | Validation | **STOP** â Even if answers are given, ask 2 "Edge Case" questions |
|
|
175
|
+
|
|
176
|
+
**Protocol:**
|
|
177
|
+
|
|
178
|
+
1. **Never Assume:** If even 1% is unclear, ASK.
|
|
179
|
+
2. **Handle Spec-heavy Requests:** When user gives a list (Answers 1, 2, 3...), do NOT skip the gate. Instead, ask about **Trade-offs** or **Edge Cases** (e.g., "LocalStorage confirmed, but should we handle data clearing or versioning?") before starting.
|
|
180
|
+
3. **Wait:** Do NOT invoke subagents or write code until the user clears the Gate.
|
|
181
|
+
4. **Reference:** Full protocol in `@[skills/brainstorming]`.
|
|
182
|
+
|
|
183
|
+
### đ Final Checklist Protocol
|
|
184
|
+
|
|
185
|
+
**Trigger:** When the user says "son kontrolleri yap", "final checks", "çalÄąÅtÄąr tÃŧm testleri", or similar phrases.
|
|
186
|
+
|
|
187
|
+
| Task Stage | Command | Purpose |
|
|
188
|
+
| ---------------- | --------------------------------------------------- | ------------------------------ |
|
|
189
|
+
| **Manual Audit** | `python .achira/scripts/checklist.py .` | Priority-based project audit |
|
|
190
|
+
| **Pre-Deploy** | `python .achira/scripts/checklist.py . --url <URL>` | Full Suite + Performance + E2E |
|
|
191
|
+
|
|
192
|
+
**Priority Execution Order:**
|
|
193
|
+
|
|
194
|
+
1. **Security** â 2. **Lint** â 3. **Schema** â 4. **Tests** â 5. **UX** â 6. **Seo** â 7. **Lighthouse/E2E**
|
|
195
|
+
|
|
196
|
+
**Rules:**
|
|
197
|
+
|
|
198
|
+
- **Completion:** A task is NOT finished until `checklist.py` returns success.
|
|
199
|
+
- **Reporting:** If it fails, fix the **Critical** blockers first (Security/Lint).
|
|
200
|
+
|
|
201
|
+
**Available Scripts (12 total):**
|
|
202
|
+
|
|
203
|
+
| Script | Skill | When to Use |
|
|
204
|
+
| -------------------------- | --------------------- | ------------------- |
|
|
205
|
+
| `security_scan.py` | vulnerability-scanner | Always on deploy |
|
|
206
|
+
| `dependency_analyzer.py` | vulnerability-scanner | Weekly / Deploy |
|
|
207
|
+
| `lint_runner.py` | lint-and-validate | Every code change |
|
|
208
|
+
| `test_runner.py` | testing-patterns | After logic change |
|
|
209
|
+
| `schema_validator.py` | database-design | After DB change |
|
|
210
|
+
| `ux_audit.py` | frontend-design | After UI change |
|
|
211
|
+
| `accessibility_checker.py` | frontend-design | After UI change |
|
|
212
|
+
| `seo_checker.py` | seo-fundamentals | After page change |
|
|
213
|
+
| `bundle_analyzer.py` | performance-profiling | Before deploy |
|
|
214
|
+
| `mobile_audit.py` | mobile-design | After mobile change |
|
|
215
|
+
| `lighthouse_audit.py` | performance-profiling | Before deploy |
|
|
216
|
+
| `playwright_runner.py` | webapp-testing | Before deploy |
|
|
217
|
+
|
|
218
|
+
> đ´ **Agents & Skills can invoke ANY script** via `python .achira/core/skills/<skill>/scripts/<script>.py`
|
|
219
|
+
|
|
220
|
+
### đ Gemini Mode Mapping
|
|
221
|
+
|
|
222
|
+
| Mode | Agent | Behavior |
|
|
223
|
+
| -------- | ----------------- | -------------------------------------------- |
|
|
224
|
+
| **plan** | `project-planner` | 4-phase methodology. NO CODE before Phase 4. |
|
|
225
|
+
| **ask** | - | Focus on understanding. Ask questions. |
|
|
226
|
+
| **edit** | `orchestrator` | Execute. Check `{task-slug}.md` first. |
|
|
227
|
+
|
|
228
|
+
**Plan Mode (4-Phase):**
|
|
229
|
+
|
|
230
|
+
1. ANALYSIS â Research, questions
|
|
231
|
+
2. PLANNING â `{task-slug}.md`, task breakdown
|
|
232
|
+
3. SOLUTIONING â Architecture, design (NO CODE!)
|
|
233
|
+
4. IMPLEMENTATION â Code + tests
|
|
234
|
+
|
|
235
|
+
> đ´ **Edit mode:** If multi-file or structural change â Offer to create `{task-slug}.md`. For single-file fixes â Proceed directly.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## TIER 2: DESIGN RULES (Reference)
|
|
240
|
+
|
|
241
|
+
> **Design rules are in the specialist agents, NOT here.**
|
|
242
|
+
|
|
243
|
+
| Task | Read |
|
|
244
|
+
| ------------ | -------------------------------------------- |
|
|
245
|
+
| Web UI/UX | `.achira/core/agents/frontend-specialist.md` |
|
|
246
|
+
| Mobile UI/UX | `.achira/core/agents/mobile-developer.md` |
|
|
247
|
+
|
|
248
|
+
**These agents contain:**
|
|
249
|
+
|
|
250
|
+
- Purple Ban (no violet/purple colors)
|
|
251
|
+
- Template Ban (no standard layouts)
|
|
252
|
+
- Anti-clichÊ rules
|
|
253
|
+
- Deep Design Thinking protocol
|
|
254
|
+
|
|
255
|
+
> đ´ **For design work:** Open and READ the agent file. Rules are there.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## đ QUICK REFERENCE
|
|
260
|
+
|
|
261
|
+
### Agents & Skills
|
|
262
|
+
|
|
263
|
+
- **Masters**: `orchestrator`, `project-planner`, `security-auditor` (Cyber/Audit), `backend-specialist` (API/DB), `frontend-specialist` (UI/UX), `mobile-developer`, `debugger`, `game-developer`
|
|
264
|
+
- **Key Skills**: `clean-code`, `brainstorming`, `app-builder`, `frontend-design`, `mobile-design`, `plan-writing`, `behavioral-modes`
|
|
265
|
+
|
|
266
|
+
### Key Scripts
|
|
267
|
+
|
|
268
|
+
- **Verify**: `.achira/scripts/verify_all.py`, `.achira/scripts/checklist.py`
|
|
269
|
+
- **Scanners**: `security_scan.py`, `dependency_analyzer.py`
|
|
270
|
+
- **Audits**: `ux_audit.py`, `mobile_audit.py`, `lighthouse_audit.py`, `seo_checker.py`
|
|
271
|
+
- **Test**: `playwright_runner.py`, `test_runner.py`
|
|
272
|
+
|
|
273
|
+
---
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Auto Preview - Antigravity Kit
|
|
4
|
+
==============================
|
|
5
|
+
Manages (start/stop/status) the local development server for previewing the application.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python .achira/scripts/auto_preview.py start [port]
|
|
9
|
+
python .achira/scripts/auto_preview.py stop
|
|
10
|
+
python .achira/scripts/auto_preview.py status
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
import time
|
|
16
|
+
import json
|
|
17
|
+
import signal
|
|
18
|
+
import argparse
|
|
19
|
+
import subprocess
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
AGENT_DIR = Path(".agent")
|
|
23
|
+
PID_FILE = AGENT_DIR / "preview.pid"
|
|
24
|
+
LOG_FILE = AGENT_DIR / "preview.log"
|
|
25
|
+
|
|
26
|
+
def get_project_root():
|
|
27
|
+
return Path(".").resolve()
|
|
28
|
+
|
|
29
|
+
def is_running(pid):
|
|
30
|
+
try:
|
|
31
|
+
os.kill(pid, 0)
|
|
32
|
+
return True
|
|
33
|
+
except OSError:
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
def get_start_command(root):
|
|
37
|
+
pkg_file = root / "package.json"
|
|
38
|
+
if not pkg_file.exists():
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
with open(pkg_file, 'r') as f:
|
|
42
|
+
data = json.load(f)
|
|
43
|
+
|
|
44
|
+
scripts = data.get("scripts", {})
|
|
45
|
+
if "dev" in scripts:
|
|
46
|
+
return ["npm", "run", "dev"]
|
|
47
|
+
elif "start" in scripts:
|
|
48
|
+
return ["npm", "start"]
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
def start_server(port=3000):
|
|
52
|
+
if PID_FILE.exists():
|
|
53
|
+
try:
|
|
54
|
+
pid = int(PID_FILE.read_text().strip())
|
|
55
|
+
if is_running(pid):
|
|
56
|
+
print(f"â ī¸ Preview already running (PID: {pid})")
|
|
57
|
+
return
|
|
58
|
+
except:
|
|
59
|
+
pass # Invalid PID file
|
|
60
|
+
|
|
61
|
+
root = get_project_root()
|
|
62
|
+
cmd = get_start_command(root)
|
|
63
|
+
|
|
64
|
+
if not cmd:
|
|
65
|
+
print("â No 'dev' or 'start' script found in package.json")
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
|
|
68
|
+
# Add port env var if needed (simple heuristic)
|
|
69
|
+
env = os.environ.copy()
|
|
70
|
+
env["PORT"] = str(port)
|
|
71
|
+
|
|
72
|
+
print(f"đ Starting preview on port {port}...")
|
|
73
|
+
|
|
74
|
+
with open(LOG_FILE, "w") as log:
|
|
75
|
+
process = subprocess.Popen(
|
|
76
|
+
cmd,
|
|
77
|
+
cwd=str(root),
|
|
78
|
+
stdout=log,
|
|
79
|
+
stderr=log,
|
|
80
|
+
env=env,
|
|
81
|
+
shell=True # Required for npm on windows often, or consistent path handling
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
PID_FILE.write_text(str(process.pid))
|
|
85
|
+
print(f"â
Preview started! (PID: {process.pid})")
|
|
86
|
+
print(f" Logs: {LOG_FILE}")
|
|
87
|
+
print(f" URL: http://localhost:{port}")
|
|
88
|
+
|
|
89
|
+
def stop_server():
|
|
90
|
+
if not PID_FILE.exists():
|
|
91
|
+
print("âšī¸ No preview server found.")
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
pid = int(PID_FILE.read_text().strip())
|
|
96
|
+
if is_running(pid):
|
|
97
|
+
# Try gentle kill first
|
|
98
|
+
os.kill(pid, signal.SIGTERM) if sys.platform != 'win32' else subprocess.call(['taskkill', '/F', '/T', '/PID', str(pid)])
|
|
99
|
+
print(f"đ Preview stopped (PID: {pid})")
|
|
100
|
+
else:
|
|
101
|
+
print("âšī¸ Process was not running.")
|
|
102
|
+
except Exception as e:
|
|
103
|
+
print(f"â Error stopping server: {e}")
|
|
104
|
+
finally:
|
|
105
|
+
if PID_FILE.exists():
|
|
106
|
+
PID_FILE.unlink()
|
|
107
|
+
|
|
108
|
+
def status_server():
|
|
109
|
+
running = False
|
|
110
|
+
pid = None
|
|
111
|
+
url = "Unknown"
|
|
112
|
+
|
|
113
|
+
if PID_FILE.exists():
|
|
114
|
+
try:
|
|
115
|
+
pid = int(PID_FILE.read_text().strip())
|
|
116
|
+
if is_running(pid):
|
|
117
|
+
running = True
|
|
118
|
+
# Heuristic for URL, strictly we should save it
|
|
119
|
+
url = "http://localhost:3000"
|
|
120
|
+
except:
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
print("\n=== Preview Status ===")
|
|
124
|
+
if running:
|
|
125
|
+
print(f"â
Status: Running")
|
|
126
|
+
print(f"đĸ PID: {pid}")
|
|
127
|
+
print(f"đ URL: {url} (Likely)")
|
|
128
|
+
print(f"đ Logs: {LOG_FILE}")
|
|
129
|
+
else:
|
|
130
|
+
print("âĒ Status: Stopped")
|
|
131
|
+
print("===================\n")
|
|
132
|
+
|
|
133
|
+
def main():
|
|
134
|
+
parser = argparse.ArgumentParser()
|
|
135
|
+
parser.add_argument("action", choices=["start", "stop", "status"])
|
|
136
|
+
parser.add_argument("port", nargs="?", default="3000")
|
|
137
|
+
|
|
138
|
+
args = parser.parse_args()
|
|
139
|
+
|
|
140
|
+
if args.action == "start":
|
|
141
|
+
start_server(int(args.port))
|
|
142
|
+
elif args.action == "stop":
|
|
143
|
+
stop_server()
|
|
144
|
+
elif args.action == "status":
|
|
145
|
+
status_server()
|
|
146
|
+
|
|
147
|
+
if __name__ == "__main__":
|
|
148
|
+
main()
|