|
1 | | -# DevStack Project Context |
2 | | - |
3 | | -## Tech Stack |
4 | | -- **Core:** Tauri v2 + React (Vite) |
5 | | -- **State:** Zustand (Slice Pattern for modularity) |
6 | | -- **Backend:** 100% Native Rust — NO PowerShell. All system tasks use Rust commands via `invoke()`. |
7 | | -- **Styling:** Tailwind CSS |
8 | | - |
9 | | -## Architecture & Structure |
10 | | -- `src/store/`: Modular state management. |
11 | | - - `index.js`: Store combiner. |
12 | | - - `*Slice.js`: Domain-specific state/actions — all invoke Rust commands, zero PowerShell. |
13 | | -- `src/lib/`: Low-level utilities. |
14 | | - - `paths.js`: Centralized path management. |
15 | | - - `ssl.js`: SSL/mkcert helpers using native `path_exists` + `start_detached_process`. |
16 | | - - ~~`ps.js`: DEPRECATED — PowerShell wrapper. Do NOT use in new code.~~ |
17 | | -- `src/hooks/`: React hooks for logic/monitoring. |
18 | | - - `useServicePoll.js`: Adaptive polling (1s active / 5s idle). |
19 | | - - `useSystemStats.js`: 2s system resource monitoring. |
20 | | - |
21 | | -## Rust Commands (src-tauri/src/lib.rs) |
22 | | -All commands use `CREATE_NO_WINDOW` flag — completely silent, no console popups. |
23 | | - |
24 | | -| Command | Purpose | |
25 | | -|---|---| |
26 | | -| `scan_processes` | Detect running DevStack services via sysinfo | |
27 | | -| `get_system_stats` | CPU/RAM metrics | |
28 | | -| `check_ports_status` | Check if ports are bound (native TCP) | |
29 | | -| `kill_process_by_name` | Kill process by name (sysinfo) | |
30 | | -| `kill_process_by_name_exact` | Kill process by exact name (sysinfo) | |
31 | | -| `kill_process_by_port` | Find PID via netstat, kill via taskkill | |
32 | | -| `start_detached_process` | Launch service binary silently | |
33 | | -| `path_exists` | Check file/dir existence | |
34 | | -| `remove_dir` | Delete directory recursively | |
35 | | -| `list_subdirs` | List subdirectories | |
36 | | -| `update_ini_value` | Update key=value in INI files | |
37 | | -| `configure_apache_php` | Update DEVSTACK PHP CONFIG block in httpd.conf | |
38 | | -| `setup_virtual_host` | Add/update VirtualHost in httpd-vhosts.conf | |
39 | | -| `install_binary` | Download + extract binary with progress events | |
40 | | -| `run_mysql_query` | Execute MySQL query via mysql.exe | |
41 | | -| `open_file_default` | Open file in editor (or default app) | |
42 | | -| `enable_php_extension` | Uncomment extension line in php.ini | |
43 | | -| `patch_php_ini_extensions` | Enable common extensions + set PHP defaults | |
44 | | - |
45 | | -## Critical Rules |
46 | | -- **Rule 1:** Files MUST NOT exceed 300 lines (modularize into slices/services/helpers). |
47 | | -- **Rule 2:** NO heavy business logic in UI components (use slices or services). |
48 | | -- **Rule 3:** DONT scan external services (focus ONLY on DevStack managed binaries). |
49 | | -- **Rule 4:** ALL new features MUST use native Rust commands — NO PowerShell, NO shell scripts. |
50 | | -- **Rule 5:** All Rust child processes MUST use `CREATE_NO_WINDOW` (0x08000000) on Windows. |
51 | | -- **Rule 6:** Prefer `sysinfo` for process management over spawning external tools. |
52 | | - |
53 | | -## Current Progress & Focus |
54 | | -- **Phase 1 [DONE]:** Store refactored to Slices, Adaptive Polling implemented. |
55 | | -- **Phase 2 [DONE]:** Rust optimization — process scanning, system stats, all system tasks. |
56 | | -- **Phase 3 [DONE]:** Full PowerShell elimination — 100% native Rust backend. |
57 | | -- **Phase 4 [NEXT]:** SSL automation with mkcert, advanced UI polish, installer improvements. |
| 1 | +# PROJECT_CONTEXT.md |
| 2 | +# Generated by thachvd-kit init wizard on 2026-04-01 |
| 3 | +# Refined against the actual codebase on 2026-04-01 |
| 4 | +# Edit freely — this is your project's brain. |
| 5 | + |
| 6 | +## Project |
| 7 | + |
| 8 | +- **Name:** DevStack |
| 9 | +- **Description:** Windows desktop app for managing a local PHP / Apache / MySQL development stack, with additional Node, Redis, tunnel, log, and quick-config tooling. |
| 10 | +- **Type:** desktop |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## Context Status |
| 15 | + |
| 16 | +```yaml |
| 17 | +context: |
| 18 | + status: refined |
| 19 | + needs_ai_refinement: false |
| 20 | + last_refined_at: 2026-04-01 |
| 21 | +``` |
| 22 | +
|
| 23 | +--- |
| 24 | +
|
| 25 | +## Stack |
| 26 | +
|
| 27 | +```yaml |
| 28 | +stack: |
| 29 | + app_root: . |
| 30 | + primary_language: rust |
| 31 | + secondary_languages: [javascript] |
| 32 | + frameworks: [tauri, react, zustand, react-query, tailwindcss, vite] |
| 33 | + database: none |
| 34 | + managed_runtimes: [apache, php, mysql, redis, node] |
| 35 | + infrastructure: [github-actions, github-pages, github-releases] |
| 36 | + package_manager: npm |
| 37 | + test_framework: not-configured |
| 38 | + target_platforms: [windows] |
| 39 | +``` |
| 40 | +
|
| 41 | +Notes: |
| 42 | +- `database: none` means the app itself does not appear to persist state in an application database. |
| 43 | +- MySQL is a managed external runtime exposed to users, not an internal app database. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## Scan Evidence |
| 48 | + |
| 49 | +These detections were inferred from the current codebase during `init --scan`, then refined with direct file inspection: |
| 50 | + |
| 51 | +```text |
| 52 | +- language:rust => found src-tauri/Cargo.toml |
| 53 | +- tauri [high] => package.json -> @tauri-apps/api; found src-tauri/tauri.conf.json; found src-tauri/Cargo.toml |
| 54 | +- react [high] => package.json -> react; package.json -> react-dom |
| 55 | +- zustand [high] => found src/store/*.js and src/store/index.js |
| 56 | +- react-query [high] => package.json -> @tanstack/react-query |
| 57 | +- tailwindcss [high] => tailwind.config.js; postcss.config.js |
| 58 | +- vite [high] => vite.config.js |
| 59 | +- windows-desktop-focus [high] => README.md; Windows-specific PowerShell + Task Scheduler + hosts-file logic in src-tauri/src/lib.rs |
| 60 | +- updater-and-release-flow [high] => tauri-plugin-updater; GitHub releases API fallback; .github/workflows/release.yml referenced by README.md |
| 61 | +- managed-services-domain [high] => pages/components for Services, Sites, Apache, Database, PHP, Node, Logs, Tunnels, Quick Config, Settings |
| 62 | +``` |
| 63 | + |
| 64 | +Strongest evidence files: |
| 65 | +- `README.md` |
| 66 | +- `package.json` |
| 67 | +- `src/App.jsx` |
| 68 | +- `src/store/index.js` |
| 69 | +- `src-tauri/Cargo.toml` |
| 70 | +- `src-tauri/src/lib.rs` |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Product Capabilities |
| 75 | + |
| 76 | +- Manage local service lifecycle for Apache, MySQL, PHP, Redis, and related processes |
| 77 | +- Create and remove local sites / virtual hosts, including Windows hosts-file sync |
| 78 | +- Install or switch Apache, PHP, and Node runtimes |
| 79 | +- Run quick MySQL queries from the app |
| 80 | +- Tail logs and stream runtime output into the UI |
| 81 | +- Configure startup behavior, ports, paths, editor settings, and updater behavior |
| 82 | +- Expose local services through tunnel integrations |
| 83 | +- Ship native Windows releases with tray support and updater integration |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Agent Routing |
| 88 | + |
| 89 | +| Task Type | Agent | Primary Skills | |
| 90 | +|-----------|-------|----------------| |
| 91 | +| Frontend UI | `frontend-specialist` | react-frontend, frontend-design | |
| 92 | +| Backend API / Tauri Commands | `backend-specialist` | rust-pro | |
| 93 | +| Desktop / Windows Integration | `mobile-developer` | rust-pro, desktop-design | |
| 94 | +| Debug | `debugger` | systematic-debugging | |
| 95 | +| Security | `security-auditor` | vulnerability-scanner | |
| 96 | +| Planning | `project-planner` | brainstorming, plan-writing | |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Auto-Resolved Skills |
| 101 | + |
| 102 | +Based on the current repo, these skills are the best fit: |
| 103 | + |
| 104 | +```text |
| 105 | +- clean-code |
| 106 | +- desktop-design |
| 107 | +- frontend-design |
| 108 | +- react-frontend |
| 109 | +- rust-pro |
| 110 | +- systematic-debugging |
| 111 | +``` |
| 112 | + |
| 113 | +Possible additions by task, not auto-assumed: |
| 114 | + |
| 115 | +```text |
| 116 | +- release-engineering |
| 117 | +- windows-automation |
| 118 | +- tauri-desktop |
| 119 | +``` |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +## Project Conventions |
| 124 | + |
| 125 | +- **Max file size:** 300 lines (then modularize) |
| 126 | +- **Code style:** project-standard |
| 127 | +- **Frontend state:** central store via Zustand slices under `src/store/` |
| 128 | +- **Desktop bridge:** business/system operations should live in Tauri commands, not in ad-hoc frontend shell logic |
| 129 | +- **Platform assumption:** Windows-first behavior is acceptable when touching hosts file, Task Scheduler, or service process control |
| 130 | + |
| 131 | +--- |
| 132 | + |
| 133 | +## Architecture Notes |
| 134 | + |
| 135 | +- Frontend is a single desktop shell rooted at `src/App.jsx`, switching views by `activePage` instead of a web-router setup. |
| 136 | +- UI domains are split into page components under `src/components/` and state slices under `src/store/`. |
| 137 | +- Tauri Rust backend in `src-tauri/src/lib.rs` owns privileged/system-facing operations: process inspection, file edits, downloads, update checks, log streaming, hosts-file changes, and Windows startup registration. |
| 138 | +- The app mixes native Tauri updater support with a GitHub Releases fallback for update discovery. |
| 139 | +- Several backend operations are explicitly Windows-specific and rely on PowerShell, Task Scheduler, registry/system APIs, or elevated execution. |
| 140 | +- There is no clear persistence layer beyond files/configs managed on disk and the current in-memory frontend store. |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## Current Phase |
| 145 | + |
| 146 | +- **Done:** Tauri desktop shell, service management surfaces, runtime/version management pages, tray integration, updater wiring, release workflow/docs |
| 147 | +- **In Progress:** product hardening, runtime install flows, Windows-specific operational polish |
| 148 | +- **Next:** modularize oversized areas, add automated tests, tighten release/update confidence, improve onboarding and first-run setup |
| 149 | + |
| 150 | +--- |
58 | 151 |
|
59 | 152 | ## Known Issues / Tasks |
60 | | -- `addExtension` in phpSlice calls `enable_php_extension` Rust command (newly added). |
61 | | -- `uninstallApacheVersion/MySQL/PHP` calls `remove_dir` Rust command (newly added). |
62 | | -- `apacheSlice.fetchApacheVersions` and `phpSlice.fetchPhpVersions` now use static hardcoded URL lists — update manually when new versions are released. |
63 | | -- Tauri config deprecation warning: `trayIcon` in `tauri.conf.json` line 30 (non-critical). |
| 153 | + |
| 154 | +- `src-tauri/src/lib.rs` is a high-concentration file and likely needs decomposition by domain. |
| 155 | +- No clear automated test setup is present in `package.json` or Rust manifests. |
| 156 | +- Repo still contains temporary/debug artifacts (`temp.zip`, `temp80.zip`, `nul`, ad-hoc scripts/tests) that may need cleanup or explicit ignore policy. |
| 157 | +- Update flow depends on GitHub release availability and packaging conventions. |
| 158 | +- Some architecture points are still inferred from code organization rather than explicit internal docs. |
0 commit comments