Skip to content

Commit 9dc0e16

Browse files
gsmlgGSMLG-BOT
andauthored
refactor: Use Agent to store data. (#2)
Co-authored-by: Jonathan Gao <[email protected]>
1 parent 2f7aae2 commit 9dc0e16

34 files changed

+3762
-192
lines changed

.claude/settings.local.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(mix test)",
5+
"Bash(mix test:*)",
6+
"Bash(iex:*)",
7+
"Bash(mix compile:*)",
8+
"Bash(ls:*)",
9+
"Bash(find:*)",
10+
"Bash(git add:*)",
11+
"Bash(git commit:*)",
12+
"Bash(mix docs:*)",
13+
"Bash(mix format:*)",
14+
"Bash(mix xref:*)",
15+
"Bash(mix help:*)",
16+
"Bash(mix deps.get:*)",
17+
"Bash(mix run:*)"
18+
],
19+
"deny": []
20+
}
21+
}

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
runs-on: ubuntu-latest
6464
needs: [ tests ]
6565
env:
66-
MIX_ENV: prod
6766
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6867
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
6968
steps:

CLAUDE.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is Phoenix.SessionProcess, an Elixir library that creates a process for each user session in Phoenix applications. All user requests go through their dedicated session process, providing session isolation and state management.
8+
9+
## Key Commands
10+
11+
### Development Commands
12+
- `mix deps.get` - Install dependencies
13+
- `mix test` - Run all tests
14+
- `mix test test/path/to/specific_test.exs` - Run a specific test file
15+
- `mix compile` - Compile the project
16+
- `mix docs` - Generate documentation
17+
- `mix hex.publish` - Publish to Hex.pm (requires authentication)
18+
19+
### Testing
20+
The test suite uses ExUnit. Tests are located in the `test/` directory. The test helper starts the supervisor automatically.
21+
22+
## Architecture
23+
24+
### Core Components
25+
26+
1. **Phoenix.SessionProcess** (lib/phoenix/session_process.ex:1)
27+
- Main module providing the public API
28+
- Delegates to ProcessSupervisor for actual process management
29+
- Provides macros for creating session processes
30+
31+
2. **Phoenix.SessionProcess.Supervisor** (lib/phoenix/session_process/superviser.ex)
32+
- Top-level supervisor that manages the Registry and ProcessSupervisor
33+
- Must be added to the application's supervision tree
34+
35+
3. **Phoenix.SessionProcess.ProcessSupervisor** (lib/phoenix/session_process/process_superviser.ex)
36+
- DynamicSupervisor that manages individual session processes
37+
- Handles starting, terminating, and communicating with session processes
38+
39+
4. **Phoenix.SessionProcess.SessionId** (lib/phoenix/session_process/session_id.ex)
40+
- Plug that generates unique session IDs
41+
- Must be placed after `:fetch_session` plug
42+
43+
### Process Management Flow
44+
45+
1. Session ID generation via the SessionId plug
46+
2. Process creation through `Phoenix.SessionProcess.start/1-3`
47+
3. Processes are registered in `Phoenix.SessionProcess.Registry`
48+
4. Communication via `call/2-3` and `cast/2`
49+
5. Automatic cleanup when processes terminate
50+
51+
### Key Design Patterns
52+
53+
- Uses Registry for process lookup by session ID
54+
- DynamicSupervisor for on-demand process creation
55+
- Provides two macros: `:process` (basic) and `:process_link` (with LiveView monitoring)
56+
- Session processes can monitor LiveView processes and notify them on termination
57+
58+
## Configuration
59+
60+
The library uses application configuration:
61+
```elixir
62+
config :phoenix_session_process, session_process: MySessionProcess
63+
```
64+
65+
This sets the default module to use when starting session processes without specifying a module.
66+
67+
## Usage in Phoenix Applications
68+
69+
1. Add supervisor to application supervision tree
70+
2. Add SessionId plug after fetch_session
71+
3. Define custom session process modules using the provided macros
72+
4. Start processes with session IDs
73+
5. Communicate using call/cast operations

GEMINI.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is Phoenix.SessionProcess, an Elixir library that creates a process for each user session in Phoenix applications. All user requests go through their dedicated session process, providing session isolation and state management.
8+
9+
## Key Commands
10+
11+
### Development Commands
12+
- `mix deps.get` - Install dependencies
13+
- `mix test` - Run all tests
14+
- `mix test test/path/to/specific_test.exs` - Run a specific test file
15+
- `mix compile` - Compile the project
16+
- `mix docs` - Generate documentation
17+
- `mix hex.publish` - Publish to Hex.pm (requires authentication)
18+
19+
### Testing
20+
The test suite uses ExUnit. Tests are located in the `test/` directory. The test helper starts the supervisor automatically.
21+
22+
## Architecture
23+
24+
### Core Components
25+
26+
1. **Phoenix.SessionProcess** (lib/phoenix/session_process.ex:1)
27+
- Main module providing the public API
28+
- Delegates to ProcessSupervisor for actual process management
29+
- Provides macros for creating session processes
30+
31+
2. **Phoenix.SessionProcess.Supervisor** (lib/phoenix/session_process/superviser.ex)
32+
- Top-level supervisor that manages the Registry and ProcessSupervisor
33+
- Must be added to the application's supervision tree
34+
35+
3. **Phoenix.SessionProcess.ProcessSupervisor** (lib/phoenix/session_process/process_superviser.ex)
36+
- DynamicSupervisor that manages individual session processes
37+
- Handles starting, terminating, and communicating with session processes
38+
39+
4. **Phoenix.SessionProcess.SessionId** (lib/phoenix/session_process/session_id.ex)
40+
- Plug that generates unique session IDs
41+
- Must be placed after `:fetch_session` plug
42+
43+
### Process Management Flow
44+
45+
1. Session ID generation via the SessionId plug
46+
2. Process creation through `Phoenix.SessionProcess.start/1-3`
47+
3. Processes are registered in `Phoenix.SessionProcess.Registry`
48+
4. Communication via `call/2-3` and `cast/2`
49+
5. Automatic cleanup when processes terminate
50+
51+
### Key Design Patterns
52+
53+
- Uses Registry for process lookup by session ID
54+
- DynamicSupervisor for on-demand process creation
55+
- Provides two macros: `:process` (basic) and `:process_link` (with LiveView monitoring)
56+
- Session processes can monitor LiveView processes and notify them on termination
57+
58+
## Configuration
59+
60+
The library uses application configuration:
61+
```elixir
62+
config :phoenix_session_process, session_process: MySessionProcess
63+
```
64+
65+
This sets the default module to use when starting session processes without specifying a module.
66+
67+
## Usage in Phoenix Applications
68+
69+
1. Add supervisor to application supervision tree
70+
2. Add SessionId plug after fetch_session
71+
3. Define custom session process modules using the provided macros
72+
4. Start processes with session IDs
73+
5. Communicate using call/cast operations

0 commit comments

Comments
 (0)