Skip to content

Commit 6da78a9

Browse files
authored
Merge pull request #15 from Parallel-7/grid-editor
2 parents 5669d69 + 74981a2 commit 6da78a9

168 files changed

Lines changed: 27001 additions & 2375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/changelog.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Generate Professional Changelog
2+
3+
Analyze git changes between two commits and generate a professional changelog suitable for GitHub releases or commit messages.
4+
5+
## Instructions
6+
7+
You are generating a professional changelog from git commit history.
8+
9+
**Arguments**: `#$ARGUMENTS` (optional)
10+
- If one argument provided: Compare that commit/tag to current HEAD
11+
- If two arguments provided: Compare first to second (e.g., `v1.0.0 v2.0.0` or `abc123 def456`)
12+
- If no arguments: Compare last release tag to HEAD (or last 10 commits if no tags)
13+
14+
**CRITICAL REQUIREMENTS**:
15+
16+
1. **COMPREHENSIVE ANALYSIS REQUIRED**:
17+
- You MUST examine EVERY SINGLE COMMIT in the range - no exceptions
18+
- Use `git log --all` or `git log --no-merges` to ensure you capture all commits
19+
- Read the FULL commit message for each commit (not just the title)
20+
- Examine file changes using `git show --stat` or `git diff --name-status` for EACH commit
21+
- DO NOT skip or summarize commits - each one must be analyzed individually
22+
- The goal is to capture the FULL SCOPE of ALL work done between the two commits
23+
- If there are 50 commits, analyze all 50. If there are 500, analyze all 500.
24+
25+
2. **MANDATORY SECTION ORDERING**:
26+
- **FIRST**: Check for New Features - if any exist, create "✨ New Features" section
27+
- **SECOND**: Check for Improvements (refactors, enhancements, optimizations - NOT bug fixes) - if any exist, create "🔨 Improvements" section
28+
- **THIRD**: Check for Bug Fixes - if any exist, create "🐛 Bug Fixes" section
29+
- **AFTER** these three mandatory sections, you may include additional sections as needed:
30+
- 📚 Documentation
31+
- 🧪 Testing
32+
- 🔧 Maintenance
33+
- ⚡ Performance
34+
- 🎨 UI/Styling
35+
- ⚠️ Breaking Changes
36+
- Omit sections that have no content
37+
38+
**Process**:
39+
40+
1. **Determine the commit range**:
41+
- Parse arguments to identify from/to commits
42+
- Use `git log` to get ALL commits in range (consider using `--no-merges` to avoid merge commits)
43+
- Use `git diff --stat` for file change statistics
44+
- Count total commits to ensure you process them all
45+
46+
2. **Analyze EVERY SINGLE CHANGE**:
47+
- Process each commit individually - DO NOT skip any
48+
- Group commits by type using conventional commit prefixes:
49+
- `feat:`/`feature:` → New Features
50+
- `fix:` → Bug Fixes
51+
- `refactor:`/`refine:`/`improve:` → Improvements
52+
- `docs:` → Documentation
53+
- `test:` → Testing
54+
- `chore:` → Maintenance
55+
- `perf:` → Performance
56+
- `style:` → UI/Styling
57+
- For commits without prefixes, categorize by analyzing:
58+
- The full commit message (not just the first line)
59+
- Files changed and their patterns
60+
- Code diff content if needed
61+
- Identify breaking changes (look for `BREAKING CHANGE:` in commit bodies)
62+
63+
3. **Extract meaningful information**:
64+
- Parse FULL commit messages, not just titles
65+
- Identify all files changed and their significance
66+
- Detect new features, bug fixes, and improvements across ALL commits
67+
- Look for dependency updates in package.json changes
68+
- Note architectural or structural changes
69+
- Capture any performance optimizations
70+
71+
4. **Generate professional output**:
72+
73+
Format as:
74+
```markdown
75+
# Changelog
76+
77+
## [Version/Range]
78+
79+
### ✨ New Features
80+
- Feature description (commit hash)
81+
82+
### 🔨 Improvements
83+
- Improvement description (commit hash)
84+
85+
### 🐛 Bug Fixes
86+
- Fix description (commit hash)
87+
88+
### 📚 Documentation
89+
- Documentation changes (commit hash)
90+
91+
### 🧪 Testing
92+
- Testing changes (commit hash)
93+
94+
### 🔧 Maintenance
95+
- Maintenance items (commit hash)
96+
97+
### ⚡ Performance
98+
- Performance improvements (commit hash)
99+
100+
### 🎨 UI/Styling
101+
- UI/styling changes (commit hash)
102+
103+
### ⚠️ Breaking Changes
104+
- Breaking change description
105+
106+
---
107+
**Statistics**: X files changed, Y insertions(+), Z deletions(-)
108+
**Commits analyzed**: N total commits
109+
```
110+
111+
5. **Best practices**:
112+
- Use bullet points for clarity
113+
- Keep descriptions concise but informative
114+
- Include short commit hashes (7 chars) for reference
115+
- Group related changes together when appropriate
116+
- Use emojis for visual categorization
117+
- Focus on user-facing changes, not internal implementation details
118+
- For multiple commits with similar changes, you may combine into single entry
119+
- Always include commit count in statistics to verify comprehensive analysis
120+
121+
**Important**:
122+
- Only use git commands (log, diff, show, etc.) - do NOT use Grep, Read, or other file tools
123+
- Output the changelog directly to the terminal for easy copying
124+
- Make it professional and ready to paste into GitHub releases
125+
- If arguments are invalid or range is empty, provide helpful error message
126+
- VERIFY you have analyzed every commit by checking commit count matches your sections

.claude/settings.local.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@
7979
"Bash(rm:*)",
8080
"Bash(Select-String -Pattern \"src\\index.ts\" -Context 0,5)",
8181
"Bash(Select-String \"Total console\\.log statements found:\")",
82+
"WebFetch(domain:raw.githubusercontent.com)",
83+
"Bash(git checkout:*)",
84+
"WebFetch(domain:donkie.github.io)",
85+
"WebFetch(domain:fftrac-bg.ffmpeg.org)",
86+
"WebFetch(domain:ffmpeg.org)",
87+
"WebFetch(domain:lucide.dev)",
88+
"mcp__context7__get-library-docs",
89+
"WebFetch(domain:developer.chrome.com)"
8290
"WebFetch(domain:raw.githubusercontent.com)"
8391
],
8492
"deny": [],

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
dist/**/*.dmg
8686
dist/**/*.AppImage
8787
dist/**/*.nupkg
88+
dist/latest*.yml
8889
!dist/**/elevate.exe
8990
!dist/win-unpacked/**
9091
if-no-files-found: warn
@@ -114,7 +115,7 @@ jobs:
114115
shell: bash
115116
run: |
116117
mkdir release_assets
117-
find artifacts/ -type f \( -name "*.zip" -o -name "*.deb" -o -name "*.rpm" -o -name "*Setup*.exe" -o -name "FlashForgeUI*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.nupkg" \) | grep -v "elevate.exe" | while IFS= read -r file; do
118+
find artifacts/ -type f \( -name "*.zip" -o -name "*.deb" -o -name "*.rpm" -o -name "*Setup*.exe" -o -name "FlashForgeUI*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.nupkg" -o -name "latest*.yml" \) | grep -v "elevate.exe" | while IFS= read -r file; do
118119
filename=$(basename "$file")
119120
cp "$file" "release_assets/$filename"
120121
echo "Copied $file to release_assets/$filename"

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dist-electron/
99
*.js.map
1010
*.d.ts.map
1111

12-
# WebUI compiled JavaScript
13-
src/webui/static/app.js
12+
# WebUI compiled JavaScript (generated by build:webui)
13+
src/webui/static/*.js
1414

1515
# Logs
1616
logs

AGENTS.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Codex Agent Handbook
2+
3+
This guide captures project-specific expectations for OpenAI Codex agents assisting in the FlashForgeUI-Electron repository. It summarizes operational guardrails, preferred workflows, and high-value reference points so future Codex sessions can ramp up quickly without depending on Claude-only resources.
4+
5+
## Operating Rules for Codex
6+
7+
- **Shell usage**: Always invoke commands through `["bash","-lc", "<command>"]` and set the `workdir` on every call. Prefer `rg`/`rg --files` for search.
8+
- **File editing**: Use `apply_patch` for hand-written edits; avoid it for auto-generated outputs (e.g., `npm install`, formatters). Never touch files outside user instructions and never revert user-owned changes.
9+
- **Planning discipline**: Create multi-step plans for anything non-trivial and keep the plan in sync as work progresses. Skip planning only for the simplest tasks.
10+
- **Testing mindset**: Favor targeted verification (type checking, linting) over full builds unless the user requests otherwise or build validation is obviously necessary.
11+
- **Escalation etiquette**: Sandbox is `workspace-write`, network is restricted, and approval policy is `on-request`. Request elevation only when essential, providing concise justification.
12+
- **Interaction style**: Keep responses concise, friendly, and actionable. Reference files with `path:line` syntax. Suggest next steps only when they are natural.
13+
14+
## Key Repository Facts
15+
16+
- **Project scope**: FlashForgeUI is an Electron desktop application that supports multiple simultaneous printer contexts with tabbed switching, camera streaming, and backend polling coordination.
17+
- **Architecture anchors**:
18+
- `src/managers/PrinterContextManager.ts`: lifecycle for per-printer contexts.
19+
- `src/services/MultiContextPollingCoordinator.ts`: adjusts polling cadence per context.
20+
- `src/ui/components/printer-tabs/`: renderer-side UI for active context selection.
21+
- `src/utils/PortAllocator.ts`: assigns unique camera proxy ports (8181-8191).
22+
- **Feature status**: Multi-printer support is fully implemented but still untested in runtime scenarios (filament tracking, WebUI flows, simultaneous jobs, camera streams, etc.).
23+
- **Documentation standard**: Every TypeScript/JavaScript source file should carry an `@fileoverview` header describing purpose, responsibilities, dependencies, and usage context.
24+
25+
### Sample `@fileoverview` Blocks
26+
27+
```ts
28+
/**
29+
* @fileoverview Connection flow orchestrator for managing printer discovery and connection workflows.
30+
*
31+
* Provides high-level coordination of printer connection operations in multi-context environment:
32+
* - Network discovery flow management with printer selection
33+
* - Direct IP connection support with check code prompts
34+
* - Auto-connect functionality for previously connected printers
35+
* - Saved printer management and connection restoration
36+
* - Connection state tracking and event forwarding
37+
* - Multi-context connection flow tracking for concurrent connections
38+
*
39+
* Key exports:
40+
* - ConnectionFlowManager class: Main connection orchestrator
41+
* - getPrinterConnectionManager(): Singleton accessor function
42+
*
43+
* The manager coordinates multiple specialized services:
44+
* - PrinterDiscoveryService: Network scanning and printer detection
45+
* - SavedPrinterService: Persistent printer storage
46+
* - AutoConnectService: Automatic connection on startup
47+
* - ConnectionStateManager: Connection state tracking
48+
* - DialogIntegrationService: User interaction dialogs
49+
* - ConnectionEstablishmentService: Low-level connection setup
50+
*
51+
* Supports concurrent connection flows with unique flow IDs and context tracking,
52+
* enabling multi-printer connections while maintaining proper state isolation.
53+
*/
54+
```
55+
56+
```ts
57+
/**
58+
* @fileoverview Central WebUI server coordinator managing Express HTTP server and WebSocket lifecycle.
59+
*
60+
* Provides comprehensive management of the WebUI server including Express HTTP server initialization,
61+
* static file serving, middleware configuration, API route registration, WebSocket server setup,
62+
* and integration with printer backend services. Automatically starts when a printer connects
63+
* (if enabled in settings) and stops on disconnect. Handles administrator privilege requirements
64+
* on Windows platforms, network interface detection for LAN access, and configuration changes
65+
* for dynamic server restart. Coordinates between HTTP API routes, WebSocket real-time updates,
66+
* and polling data from the main process to provide seamless remote printer control and monitoring.
67+
*
68+
* Key exports:
69+
* - WebUIManager class: Main server coordinator with singleton pattern
70+
* - getWebUIManager(): Singleton accessor function
71+
* - Lifecycle: start, stop, initialize, startForPrinter, stopForPrinter
72+
* - Status: getStatus, isServerRunning, getExpressApp, getHttpServer
73+
* - Integration: handlePollingUpdate (receives status from main process)
74+
* - Events: 'server-started', 'server-stopped', 'printer-connected', 'printer-disconnected'
75+
*/
76+
```
77+
78+
```ts
79+
/**
80+
* @fileoverview Printer Tabs Component for Multi-Printer Support
81+
*
82+
* This component provides a tabbed interface for managing multiple printer connections
83+
* similar to Orca-FlashForge's tabbed interface. It extends EventEmitter to notify
84+
* the renderer process of user interactions with tabs.
85+
*
86+
* Key features:
87+
* - Tab management (add, remove, switch, update)
88+
* - Connection status indicators (connected, connecting, disconnected, error)
89+
* - Close buttons on tabs with hover effects
90+
* - "Add Printer" button for creating new connections
91+
* - Event emission for tab interactions (click, close, add)
92+
* - Visual distinction between active and inactive tabs
93+
*
94+
* Events:
95+
* - 'tab-clicked': Emitted when a tab is clicked (contextId: string)
96+
* - 'tab-closed': Emitted when a tab's close button is clicked (contextId: string)
97+
* - 'add-printer-clicked': Emitted when the add printer button is clicked
98+
*/
99+
```
100+
101+
## High-Value Scripts & Commands
102+
103+
Use these npm scripts to enforce quality checks and gather insights:
104+
105+
| Command | Purpose | Notes |
106+
| --- | --- | --- |
107+
| `npm run type-check` | TypeScript validation (`tsc --noEmit`). | Report success/fail clearly; fix root causes before completion. |
108+
| `npm run lint` / `npm run lint:fix` | ESLint checks and auto-fixes on `src/**/*.ts`. | Auto-fix first; re-run lint to confirm clean state. |
109+
| `npm run docs:check` | PowerShell script scanning for missing `@fileoverview`. | Use findings to prioritize documentation updates. |
110+
| `npm run knip` (+ variants) | Dead code and dependency analysis via Knip. | Review results carefully; Electron patterns create false positives. |
111+
| `npm run build:*` | Build main, renderer, WebUI, or platform packages. | Run only when requested or required for verification. |
112+
113+
Remember PowerShell scripts (`docs:*`, `linecount`) assume Windows-friendly environment; confirm availability before invoking.
114+
115+
## Recommended Workflow Templates
116+
117+
### General Code Change
118+
119+
1. **Context**: Review relevant files (`rg`, `codebase exploration`) and check `CLAUDE.md` for recent architecture notes.
120+
2. **Plan**: Outline steps, call out affected modules and validation strategy.
121+
3. **Implement**: Modify files via `apply_patch` with minimal, well-structured commits.
122+
4. **Document**: Ensure new/changed files keep `@fileoverview` headers up to date.
123+
5. **Verify**: Run `npm run type-check` and `npm run lint`; add other checks only if warranted.
124+
6. **Report**: Summarize changes, mention validations, and suggest next steps (e.g., build, documentation review).
125+
126+
### Documentation-Only Task
127+
128+
1. Identify files lacking headers with `npm run docs:check`.
129+
2. Read the target file to understand responsibilities.
130+
3. Add or update the `@fileoverview` block using succinct prose that covers purpose, key exports, dependencies, and usage notes.
131+
4. Re-run `npm run docs:check` if the user requests confirmation.
132+
133+
### Bug Investigation
134+
135+
1. Capture current state with `git status`/`git diff` if necessary (respect sandbox rules).
136+
2. Trace the data flow and key code paths using targeted `rg` queries.
137+
3. Hypothesize root cause; confirm by inspecting adjacent modules (services, managers, IPC handlers).
138+
4. Plan remediation, communicate assumptions, and only then implement.
139+
140+
### Review Request
141+
142+
1. Focus on identifying defects, risky patterns, missing tests, or documentation gaps.
143+
2. Reference findings with precise file locations (`path:line`).
144+
3. Keep high-level summaries short; lead with concrete issues.
145+
146+
## Testing & Runtime Limitations
147+
148+
- Cannot launch the Electron app, manipulate real printers, or validate UI visually.
149+
- Restricted to static analysis, type checking, linting, and script-driven tooling.
150+
- Treat any runtime-dependent assumption as unverified; call it out in deliverables.
151+
152+
## Helpful Reference Files
153+
154+
- `CLAUDE.md`: High-level development guide (multi-printer architecture, testing limitations).
155+
- `ai_reference/ARCHITECTURE.md`: Deep dive into system components and interactions.
156+
- `ai_reference` folder: Central knowledge base for this project. Add new long-form guidance here and consult existing references before tackling related work.
157+
- `ai_reference/typescript-best-practices.md` & `ai_reference/electron-typescript-best-practices.md`: **Mandatory pre-reading before any programming task.** Revisit these documents at the start of every coding session to stay aligned with project standards.
158+
- `.claude/commands/*.md`: Predefined workflows (load changes, lint, type-check, auto-document, dead code analysis).
159+
160+
Consult these resources early in a session to align with established expectations.
161+
162+
## Recent Lessons
163+
164+
- Component dialog preload files must never import `.d.ts` modules at runtime—use `import type {} from '../../types/global';` to keep typings without breaking the window bootstrap.
165+
- The dialog relies on untouched `polling-update` payloads; avoid “fixing” the shape or you risk swallowing updates and rendering an empty dialog.
166+
- GridStack initialization already performs component registration/initialization; removing or duplicating that logic leaves global references (e.g., log panel) unset. Preserve the existing flow unless you have a tested replacement.
167+
168+
## Practical Tips for Codex
169+
170+
- Prefer incremental `rg` searches over full `find`/`grep` when locating files or symbols.
171+
- When editing large files, consider using `sed -n 'start,endp'` to preview relevant sections before patching.
172+
- Keep diffs minimal and purposeful; bundle related changes together.
173+
- If instructions conflict, prioritize user directives → developer message → system message hierarchy.
174+
- Surface uncertainties explicitly and propose validation steps the user can run (e.g., `npm run build`, manual UI tests).
175+
176+
By following this handbook, Codex agents can contribute confidently while honoring repository standards and operational constraints.

CLAUDE.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FlashForgeUI-Electron Development Guide
22

3-
**Last Updated:** 2025-10-03 21:38 ET
3+
**Last Updated:** 2025-10-19 01:24 ET (America/New_York)
44

55
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
66

@@ -81,6 +81,12 @@ For detailed architecture information, see `ARCHITECTURE.md`.
8181
- New dependencies or file organization changes require verification
8282
- Ready to verify final integration before deployment
8383

84+
## Recent Lessons
85+
86+
- Component dialog preloads must import global augmentations via `import type {} from '../../types/global';`—runtime imports of `.d.ts` files will crash the dialog window and leave pinned components blank.
87+
- The component dialog relies on the raw `polling-update` payload; don’t coerce or sanitize it before passing to `ComponentManager.updateAll`, or the dialog will stop updating.
88+
- GridStack initialization already registers and initializes components (including the global log panel reference). Removing that flow causes latent issues; preserve it unless you replace it deliberately.
89+
8490
## Development Tips
8591

8692
### Using Code Context Provider
@@ -161,9 +167,14 @@ The multi-printer implementation is **complete but untested**. The following are
161167
- `src/renderer.ts` - Multi-printer UI integration
162168
- `src/webui/server/api-routes.ts` - WebUI multi-printer API support
163169

170+
**Project Specifications:**
171+
- `ai_specs/` - Active feature specifications and planning documents
172+
- `ai_specs/archive/` - **Completed specifications only** - all specs in this folder have already been implemented
173+
164174
---
165175

166176
External References:
167177

168178
@ai_reference\AGENTS.md
169179
@ai_reference\ARCHITECTURE.md
180+
- Don't add @author to @fileoverview headers when creating docs

ai_reference/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@
6868
- **AUTO-INVOKE code-documenter** when creating new files or working on undocumented code - maintains documentation standards
6969
- **PROACTIVE production-readiness-auditor** use after significant changes prevents build failures and deployment issues
7070
- **PREVENTIVE electron-security-analyst** deployment for authentication, IPC, and external integration work catches vulnerabilities early
71+
72+
## Project Specifications Reference
73+
74+
- **`ai_specs/`**: Contains feature specifications and planning documents for active development work
75+
- **`ai_specs/archive/`**: **Completed specifications only**. All specification files in this folder have already been fully implemented and should not be treated as active work items or TODO tasks

0 commit comments

Comments
 (0)