-
Notifications
You must be signed in to change notification settings - Fork 5
chore: add CLAUDE.md for Claude Code development guidance #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
georgexu99
wants to merge
4
commits into
main
Choose a base branch
from
gxu-claudemd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# CLAUDE.md | ||
|
||
This document helps Claude understand the Sleuth repo structure and common development patterns. | ||
|
||
## Project Overview | ||
|
||
Sleuth is an Electron-based Slack Log Viewer application built with React, TypeScript, and MobX for state management. It processes various types of log files (browser, webapp, mobile, installer, etc.) and provides a comprehensive UI for viewing, filtering, and analyzing log data. | ||
|
||
## Development Commands | ||
|
||
IMPORTANT: Never attempt to run `npm`, instead always run the equivalent `yarn` command | ||
|
||
### Core Commands | ||
|
||
- `yarn install` - Install dependencies | ||
- `yarn start` - Start development build with Electron | ||
- `yarn test` - Run tests with Vitest | ||
- `yarn run tsc` - TypeScript type checking | ||
- `yarn run lint` - Run linting (includes TypeScript check, ESLint, and Prettier) | ||
- `yarn run lint:fix` - Fix linting issues automatically | ||
|
||
### Build Commands | ||
|
||
note that you (Claude) should avoid running these commands as they are slow, instead prefer running test, tsc or lint to validate changes rapidly. | ||
|
||
- `yarn run package` - Package the app for current platform | ||
- `yarn run make` - Create distributable for current platform | ||
- `yarn run publish` - Publish to configured distributors | ||
|
||
### Utility Commands | ||
|
||
- `yarn run catapult:update` - Update catapult submodule | ||
|
||
## Architecture | ||
|
||
### Electron Architecture | ||
|
||
The app follows standard Electron patterns with three main processes: | ||
|
||
- **Main Process** (`src/main/index.ts`): Application lifecycle, window management, IPC handling, file system operations | ||
- **Renderer Process** (`src/renderer/renderer.ts`): React UI rendering | ||
- **Preload Script** (`src/preload/preload.ts`): Secure bridge exposing `window.Sleuth` API to renderer | ||
|
||
### Key Components | ||
|
||
#### State Management | ||
|
||
- **SleuthState** (`src/renderer/state/sleuth.ts`): Main MobX store managing log files, selected entries, filters, bookmarks, and UI state | ||
- Uses MobX observables with React integration via `mobx-react` | ||
|
||
#### Log Processing | ||
|
||
- **Processor** (`src/renderer/processor.ts`): Core log file parsing and processing logic | ||
- Handles multiple log types: browser, webapp, mobile, installer, chromium, netlog, trace, state | ||
- Converts raw log files into structured `LogEntry` objects with timestamps, levels, and metadata | ||
|
||
#### UI Structure | ||
|
||
- **App** (`src/renderer/components/app.tsx`): Root component | ||
- **AppCore** (`src/renderer/components/app-core.tsx`): Main application layout | ||
- **LogTable** (`src/renderer/components/log-table.tsx`): Virtualized log entry display | ||
- **Sidebar** (`src/renderer/components/sidebar/`): File tree, bookmarks, and navigation | ||
- **Preferences** (`src/renderer/components/preferences/`): Settings and configuration | ||
|
||
#### Key Interfaces | ||
|
||
- **LogEntry** (`src/interfaces.ts`): Core data structure for log entries | ||
- **UnzippedFile/ProcessedLogFile/MergedLogFile**: File handling abstractions | ||
- **LogType** enum: Defines supported log file types | ||
|
||
### IPC Communication | ||
|
||
- **IpcEvents** (`src/ipc-events.ts`): Defines all IPC channel constants | ||
- **IPC Manager** (`src/main/ipc.ts`): Handles main process IPC routing | ||
- **SleuthAPI** (preload): Exposed renderer API with type safety | ||
|
||
### Specialized Features | ||
|
||
- **Trace Analysis**: Chrome DevTools and Perfetto trace file support | ||
- **State Inspection**: Redux state visualization | ||
- **NetLog Viewing**: Network log analysis | ||
- **Bookmarking**: Save and restore specific log entries | ||
- **Log Merging**: Combine multiple log files chronologically | ||
|
||
## Testing | ||
|
||
- Uses Vitest with jsdom environment | ||
- Test files: `test/**/*.test.[jt]s?(x)` | ||
- Setup: `test/vitest-setup.js` | ||
- Global test utilities available | ||
|
||
## Code Conventions | ||
|
||
### ESLint Rules | ||
|
||
- Strict separation: renderer code cannot import Node.js modules (fs, path, etc.) | ||
- Use `@typescript-eslint` for TypeScript-specific rules | ||
- Unused vars prefixed with `_` are ignored | ||
|
||
### File Organization | ||
|
||
- `src/main/`: Main process Electron code | ||
- `src/renderer/`: React renderer code | ||
- `src/preload/`: Preload script for secure IPC | ||
- `src/utils/`: Shared utilities (renderer-safe only) | ||
- `src/interfaces.ts`: Shared TypeScript interfaces | ||
|
||
### State Patterns | ||
|
||
- Use MobX `@observable` and `@action` decorators | ||
- State mutations only through actions | ||
- Computed values for derived data | ||
- Autorun for side effects | ||
|
||
## Development Notes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two easy notes that are pretty generically helpful:
|
||
|
||
IMPORTANT: never disable a lint rule or add @ts-ignore unless explicitly asked to do so by the user. | ||
If you are unable to solve a problem without disabling a lint rule, stop and ask the user for | ||
guidance first. | ||
|
||
**CRITICAL: NEVER use --no-verify flag with git commands.** This bypasses pre-commit hooks that enforce code quality and can introduce broken code into the repository. Always fix the underlying issues that cause hooks to fail instead of bypassing them. If a hook is failing, address the specific linting, formatting, or test failures it identifies. | ||
|
||
### Security | ||
|
||
- Context isolation enabled - use `contextBridge` in preload | ||
- Renderer process has restricted Node.js access | ||
- File operations must go through IPC to main process | ||
|
||
### Performance | ||
|
||
- Log table uses `react-virtualized` for large datasets | ||
- Log processing happens in chunks to avoid blocking UI | ||
- Background processing for heavy operations | ||
|
||
### Platform Support | ||
|
||
- Cross-platform Electron app (macOS, Windows, Linux) | ||
- Platform-specific code paths handled via `process.platform` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a note here that claude should avoid running these commands as they are slow, instead prefer running
test
,tsc
orlint
to validate changes rapidly. Other you might find claude runningyarn package
after every file edit in rare cases.