Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1655 commits
Select commit Hold shift + click to select a range
96feee2
fix: add missing exports to code-core for TUI support
shtse8 Nov 4, 2025
668b8c2
refactor: implement stateless server architecture with per-session ag…
shtse8 Nov 4, 2025
bd69a61
fix: correct tRPC v11 client API syntax
shtse8 Nov 4, 2025
1fb6508
fix: add missing text input utility functions
shtse8 Nov 4, 2025
7facd9a
fix: correct tRPC v11 client API syntax in app-store
shtse8 Nov 5, 2025
f585ec8
fix: correct MessagePart field name and add MarkdownText guard
shtse8 Nov 5, 2025
ea4ee84
fix: improve React key uniqueness in MarkdownText component
shtse8 Nov 5, 2025
d8ab11d
fix: resolve React duplicate key warning in MessageList
shtse8 Nov 5, 2025
db00ae3
chore: add .turbo build cache to .gitignore
shtse8 Nov 5, 2025
4af5169
feat: migrate to in-process tRPC architecture
shtse8 Nov 5, 2025
2828565
docs: add migration summary for in-process tRPC architecture
shtse8 Nov 5, 2025
3f66460
fix: correct in-process tRPC procedure lookup
shtse8 Nov 5, 2025
4dc9ab9
refactor: simplify in-process link procedure lookup
shtse8 Nov 5, 2025
6166c05
fix: use tRPC server-side caller API for in-process link
shtse8 Nov 5, 2025
19b940c
refactor: modernize tRPC provider with React Context API
shtse8 Nov 5, 2025
48ad314
refactor: implement functional provider pattern via AppContext
shtse8 Nov 5, 2025
42dd848
refactor: move AppContext from code-core to code-server
shtse8 Nov 5, 2025
3f13d80
refactor: remove all global state from code-core (pure SDK)
shtse8 Nov 5, 2025
4bbccb1
fix: add embedded context bridge for TUI client
shtse8 Nov 5, 2025
0361f22
feat: implement lazy session creation
shtse8 Nov 5, 2025
89836c7
feat: disable auto-resume of last session on TUI startup
shtse8 Nov 5, 2025
c49b3a3
fix: improve no-provider handling for lazy sessions
shtse8 Nov 5, 2025
6c38dd5
fix: show status bar when no session exists (lazy session)
shtse8 Nov 5, 2025
d15aabf
refactor: StatusBar now uses ProviderConfig instead of apiKey
shtse8 Nov 5, 2025
4c8e918
security: mask sensitive config fields using provider schema
shtse8 Nov 5, 2025
f66b89a
refactor: redesign tRPC endpoints with Data on Demand and cursor-base…
shtse8 Nov 5, 2025
f5d6f9f
security: implement authentication middleware (OWASP API2)
shtse8 Nov 5, 2025
3c746a5
security: implement rate limiting middleware (OWASP API4)
shtse8 Nov 5, 2025
18eae09
security: implement function level authorization (OWASP API5)
shtse8 Nov 5, 2025
d8100c7
security: implement API inventory and documentation (OWASP API9)
shtse8 Nov 5, 2025
9b5d1c8
client: add API key authentication support
shtse8 Nov 5, 2025
3e294b2
fix(tui): improve UX when AI provider is not configured
shtse8 Nov 5, 2025
6e4f193
fix: add missing await for async functions and resolve tRPC errors
shtse8 Nov 5, 2025
45eda93
fix: handle paginated result and invalid API response
shtse8 Nov 5, 2025
e2b77cc
fix: correct variable name and reduce console output
shtse8 Nov 5, 2025
6327de4
fix(commands): resolve agent and rules loading issues
shtse8 Nov 5, 2025
f280809
fix(hooks): resolve missing command types import
shtse8 Nov 5, 2025
01a19c4
fix: add missing await for all addMessage calls
shtse8 Nov 5, 2025
e00b157
fix: correct all async function type definitions
shtse8 Nov 5, 2025
52aea93
fix: make sendMessage async and await all calls
shtse8 Nov 5, 2025
672c463
refactor: remove empty session creation pattern
shtse8 Nov 5, 2025
695bc06
fix: update all addMessage calls to use new signature
shtse8 Nov 5, 2025
3af6807
fix: define getAIConfig in Chat.tsx
shtse8 Nov 5, 2025
8e9cd48
fix: remove createSession fallbacks from /provider and /model
shtse8 Nov 5, 2025
0994212
fix: refactor /notifications command to use new execute pattern
shtse8 Nov 5, 2025
c3e5f24
fix: correct createSession type definition and await all calls
shtse8 Nov 5, 2025
d96c304
refactor: remove createSession from useKeyboardNavigation, use lazy s…
shtse8 Nov 5, 2025
cf5ad2a
refactor: add settings mode architecture for interactive UI
shtse8 Nov 5, 2025
578faf9
refactor: integrate ProviderSettings UI with keyboard navigation
shtse8 Nov 5, 2025
45b4c6a
feat: add /provider2 prototype command with settings mode integration
shtse8 Nov 5, 2025
8d57807
fix: add eventsource dependency to code-client
shtse8 Nov 5, 2025
438f91f
refactor: remove hardcoded settings mode parsing, use modular approach
shtse8 Nov 5, 2025
006fafe
feat: refactor /provider command with multi-step interactive UI
shtse8 Nov 5, 2025
6e24186
refactor: migrate to component-based input architecture
shtse8 Nov 5, 2025
84aae9c
chore: remove obsolete settings mode files
shtse8 Nov 5, 2025
89dfc48
refactor: migrate selection input to component-based architecture
shtse8 Nov 5, 2025
51d6dd3
chore: remove /provider2 prototype command
shtse8 Nov 5, 2025
9d087e9
refactor: use .tsx and direct JSX for provider command
shtse8 Nov 5, 2025
7b12965
feat: redesign provider configuration UI with interactive form
shtse8 Nov 5, 2025
18272f8
refactor: remove emoji and simplify TUI styling for consistency
shtse8 Nov 5, 2025
a51f581
feat: implement dynamic context-aware input headers
shtse8 Nov 5, 2025
3c35e2d
feat: improve UI spacing and add contextual descriptions
shtse8 Nov 5, 2025
14500ca
refactor: create InputContentLayout for consistent UI structure
shtse8 Nov 5, 2025
1e48d93
fix: add consistent indentation to input content
shtse8 Nov 5, 2025
be4e452
fix: remove unnecessary config from Claude Code provider
shtse8 Nov 5, 2025
c4c2b4f
refactor: optimize core.md using minimal effective prompt principles
claude Nov 6, 2025
7a03c3a
refactor: apply minimal effective prompt principles to core.md
claude Nov 6, 2025
55439cb
fix: restore missing critical triggers in core.md
claude Nov 6, 2025
9d3be6d
feat: add powerful behavioral triggers to core.md
claude Nov 6, 2025
b2c035b
Merge pull request #3 from sylphxltd/claude/optimize-core-rules-011CU…
shtse8 Nov 6, 2025
3c299f8
feat: enhance coder.md with actionable behavioral triggers
claude Nov 6, 2025
b384539
refactor: remove role-specific rules from core.md
claude Nov 6, 2025
6d6ee5a
feat: comprehensive minimal effective prompt optimization
claude Nov 6, 2025
39220a8
feat: add frontmatter rules support to agent system
claude Nov 6, 2025
921e645
Merge pull request #4 from sylphxltd/claude/optimize-core-rules-011CU…
shtse8 Nov 6, 2025
e4c4d56
fix: refactor client to use tRPC instead of direct code-core imports
shtse8 Nov 5, 2025
870609c
refactor: migrate to hook-based architecture, remove client-side prov…
shtse8 Nov 5, 2025
d51c303
fix: handle missing defaultModel in session initialization
shtse8 Nov 5, 2025
f8173cb
fix: /provider command now saves config to server
shtse8 Nov 5, 2025
a1f2af6
refactor: remove getProvider import from ProviderManagement
shtse8 Nov 5, 2025
54a4695
fix: update defaultModel when switching providers
shtse8 Nov 5, 2025
36258f1
refactor: remove top-level defaultModel, unify to provider.defaultModel
shtse8 Nov 5, 2025
a72ddb4
fix: remove remaining references to top-level defaultModel
shtse8 Nov 5, 2025
3d21a49
fix: use selectedAgentId instead of currentAgentId in StatusBar
shtse8 Nov 5, 2025
70f5db1
fix: copy agents and rules assets to code-core package
shtse8 Nov 5, 2025
283b02c
feat: add filter functionality to provider selection
shtse8 Nov 5, 2025
4c7b49f
feat: implement composition-based selection architecture
shtse8 Nov 5, 2025
803596d
fix: use unique keys for SelectionOptionsList items
shtse8 Nov 5, 2025
a287330
feat: improve provider configured status display
shtse8 Nov 5, 2025
61efab1
feat: improve provider list alignment and descriptions
shtse8 Nov 5, 2025
3366721
feat: move provider descriptions to server-side
shtse8 Nov 5, 2025
5804df8
chore: remove old duplicated selection code
shtse8 Nov 5, 2025
b14bc01
feat: move provider status indicator to end of name
shtse8 Nov 5, 2025
b14f0da
feat: simplify provider status display
shtse8 Nov 5, 2025
24ebf1e
fix: conditionally show filter hint in help text
shtse8 Nov 5, 2025
311b3fb
feat: add green badge support for configured providers
shtse8 Nov 5, 2025
54839f8
feat: use provider isConfigured() for status detection
shtse8 Nov 5, 2025
6e7c975
refactor: use claude --version instead of which claude
shtse8 Nov 5, 2025
7393177
refactor: use which package for CLI detection
shtse8 Nov 5, 2025
d66a917
fix: properly detect provider configuration with Result type and supp…
shtse8 Nov 5, 2025
b1b7fb6
refactor: standardize config keys to camelCase format
shtse8 Nov 5, 2025
b7921ea
fix: update defaultModel references to use camelCase
shtse8 Nov 5, 2025
4a8fef6
fix: remove broken SelectionInput import in commandContext
shtse8 Nov 5, 2025
8d5b485
fix: remove duplicate question text in /model command
shtse8 Nov 5, 2025
3b1e6bb
refactor: migrate /model command to component-based UI
shtse8 Nov 5, 2025
50a351d
feat: restore args and autocomplete to /provider command
shtse8 Nov 5, 2025
9a26e47
refactor: migrate /agent command to component-based UI
shtse8 Nov 5, 2025
658fe4e
refactor: migrate /notifications command to component-based UI
shtse8 Nov 5, 2025
ff5da2b
fix: prevent arrow keys from triggering history when autocomplete is …
shtse8 Nov 5, 2025
b82bbaf
feat: integrate lazy-loading completion system for provider command
shtse8 Nov 5, 2025
6f40163
feat: extract completion logic into modular completion system
shtse8 Nov 5, 2025
71ba65c
feat: record slash command results in session history
shtse8 Nov 5, 2025
828db6f
fix: update currentSession when slash commands create new session
shtse8 Nov 5, 2025
435b4fe
feat: add server-side persistence for enabled rules
shtse8 Nov 5, 2025
a8b934f
fix: persist enabled rules to session database
shtse8 Nov 5, 2025
288f446
feat: add global default enabled rules for new sessions
shtse8 Nov 5, 2025
ec25259
fix: persist enabled rules to global config when no session exists
shtse8 Nov 5, 2025
7df204a
feat: persist agent selection and fix rules/agent config schema
shtse8 Nov 5, 2025
e61df39
fix: add enabledRuleIds to session-updated event schema
shtse8 Nov 5, 2025
674c6b8
fix: loadConfig bypassing setAIConfig logic
shtse8 Nov 5, 2025
0b9619e
fix: auto-load default provider and model from config on startup
shtse8 Nov 5, 2025
a3da194
fix: correct model extraction from nested provider config
shtse8 Nov 6, 2025
544d39a
refactor: centralize provider/model resolution and fix imports
shtse8 Nov 6, 2025
7aeeb60
refactor: replace all relative imports with package imports in chat s…
shtse8 Nov 6, 2025
78e72a7
fix: StatusBar now reads from selectedProvider/selectedModel state
shtse8 Nov 6, 2025
fbcf227
Refactor orchestrator, reviewer, and writer agent documentation for c…
shtse8 Nov 6, 2025
545c584
fix: use selectedProvider/selectedModel in subscriptionAdapter
shtse8 Nov 6, 2025
a4cbaae
fix: add getSelectedProvider/Model to CommandContext for commands
shtse8 Nov 6, 2025
33e3818
fix: import getTRPCClient from code-client instead of code-server
shtse8 Nov 6, 2025
4231390
refactor: import getTRPCClient at top level instead of dynamic import
shtse8 Nov 6, 2025
feb0795
refactor: move session API calls to code-client package
shtse8 Nov 6, 2025
6fcaac4
feat(sessions): add useSessionList hook and fix /sessions command
shtse8 Nov 6, 2025
75ebbf6
refactor: remove CommandContext getters, commands use store directly
shtse8 Nov 6, 2025
dcf1a49
refactor(commands): drastically simplify CommandContext interface
shtse8 Nov 6, 2025
5639c05
refactor(commands): update all remaining commands to use store directly
shtse8 Nov 6, 2025
8634a43
fix: resolve TypeScript errors across monorepo packages
shtse8 Nov 6, 2025
044f7f4
chore: remove compiled files from src directories and update .gitignore
shtse8 Nov 6, 2025
1be5442
refactor(client): make trPC client generic and add server endpoints
shtse8 Nov 6, 2025
0948b94
refactor: complete thin client architecture
shtse8 Nov 6, 2025
32f6fa5
feat(client-server): implement complete client-server separation arch…
shtse8 Nov 6, 2025
c5d30c6
fix(types): resolve all TypeScript errors in code-client (42 errors f…
shtse8 Nov 6, 2025
7a383ba
fix(commands): update commands to use new store structure (currentSes…
shtse8 Nov 6, 2025
416932b
fix(ui): add scroll viewport to SelectionOptionsList (max 5 visible i…
shtse8 Nov 6, 2025
82d1a8d
fix(selection): handle ESC and Enter in filter mode
shtse8 Nov 6, 2025
f53bad3
fix(selection): enable navigation in filter mode
shtse8 Nov 6, 2025
017799a
fix(selection): separate filter mode from selection mode
shtse8 Nov 6, 2025
b558f56
fix(selection): keep filter value when exiting filter mode
shtse8 Nov 6, 2025
f8ce4f9
fix(selection): show filter value in normal mode
shtse8 Nov 6, 2025
26cde6b
fix(selection): add missing Box and Text imports
shtse8 Nov 6, 2025
20035ff
fix(input): support async onSubmit to enable message submission
shtse8 Nov 6, 2025
30e0bbf
fix(input): prevent Chat useInput from blocking Enter key submission
shtse8 Nov 6, 2025
233079d
debug: add comprehensive logging to trace message submission flow
shtse8 Nov 6, 2025
ec7b433
debug: add tRPC client and subscription logging
shtse8 Nov 6, 2025
b5dec6f
debug: add inProcessLink subscription logging
shtse8 Nov 6, 2025
4bc8c65
fix(streaming): remove await from subscription call - subscriptions r…
shtse8 Nov 6, 2025
e489139
debug: add detailed observable inspection logging
shtse8 Nov 6, 2025
d42575b
debug: add comprehensive error catching and caller inspection
shtse8 Nov 6, 2025
fdccac2
fix(streaming): use tRPC v11 .subscribe() API instead of observable p…
shtse8 Nov 6, 2025
e9bcecd
feat: add environment-based debug logging system
shtse8 Nov 6, 2025
adc2472
feat: add log file support and non-interactive test harness
shtse8 Nov 6, 2025
510413a
feat: add comprehensive Vitest testing infrastructure
shtse8 Nov 6, 2025
1d05a57
refactor: replace custom logger with industry-standard 'debug' package
shtse8 Nov 6, 2025
f67a52d
refactor(logging): migrate subscriptionAdapter to debug package
shtse8 Nov 6, 2025
bd0f027
refactor(search): migrate all search service logging to debug package
shtse8 Nov 6, 2025
517df95
docs(optimization): update report with completed migration work
shtse8 Nov 6, 2025
d6be45c
refactor(trpc): migrate in-process-link logging to debug package
shtse8 Nov 6, 2025
43e2261
docs(optimization): final report with comprehensive analysis
shtse8 Nov 6, 2025
4d6b19b
chore: update dependencies with bun update
shtse8 Nov 6, 2025
f9dcaf7
feat(build): migrate to bunup for all packages
shtse8 Nov 6, 2025
b2ddddf
chore: separate code and flow projects
shtse8 Nov 6, 2025
e33d0dd
fix(flow): replace @sylphx/code-core with local debug-logger
shtse8 Nov 6, 2025
d3a2ea6
feat(flow): add debug-logger utility
shtse8 Nov 6, 2025
6e1487c
chore(flow): add debug package dependency
shtse8 Nov 6, 2025
7656445
fix(flow): resolve monorepo asset paths and improve spawn debugging
shtse8 Nov 6, 2025
028789c
fix(cli): resolve process hanging issue by adding beforeExit handler
shtse8 Nov 12, 2025
cc548a0
chore: remove legacy src folder after monorepo migration
shtse8 Nov 12, 2025
7759439
feat: cleanup slash commands and simplify hooks for Claude Code
shtse8 Nov 12, 2025
f6b4714
feat(notification): add cross-platform icon support
shtse8 Nov 12, 2025
29ba400
refactor: rename config to .sylphx-flow.json and add intelligent flow…
shtse8 Nov 12, 2025
ef58843
refactor: implement modular target/provider/agent selection with impr…
shtse8 Nov 13, 2025
f2da06a
feat: add flow orchestrator to separate concerns and reduce complexity
shtse8 Nov 13, 2025
f9b9018
fix: remove duplicate 'default' provider in selection list
shtse8 Nov 13, 2025
a0b9df9
fix: remove duplicate environment setup call
shtse8 Nov 13, 2025
5c91e40
feat: always show all provider options with inline API key setup
shtse8 Nov 13, 2025
886bbae
fix: pass environment variables to spawned target processes
shtse8 Nov 13, 2025
3d068ab
fix: use ANTHROPIC_AUTH_TOKEN instead of ANTHROPIC_API_KEY for Claude…
shtse8 Nov 13, 2025
9edd9d0
feat(ux): optimize UI/UX with smart defaults and better progress indi…
shtse8 Nov 13, 2025
ba0f81c
feat(upgrade): add automatic target update detection and use native u…
shtse8 Nov 13, 2025
ecb8424
feat(integrity): add component integrity check with automatic repair
shtse8 Nov 13, 2025
2c12084
feat(execution): add headless modes and fix prompt passing
shtse8 Nov 13, 2025
a2c0271
fix(execution): enforce print mode when using continue flag
shtse8 Nov 13, 2025
c08c9aa
feat(opencode): use --agent flag instead of system prompt
shtse8 Nov 13, 2025
4930764
feat(dry-run): show complete command in dry run mode
shtse8 Nov 13, 2025
2d17142
fix(dry-run): continue to execution phase to show command
shtse8 Nov 13, 2025
aa8aae6
fix(state-detector): add target-aware component detection for OpenCode
shtse8 Nov 13, 2025
97e43f8
fix: resolve init command never executing - agents now install properly
shtse8 Nov 13, 2025
cfef40a
refactor: consolidate init/run into flow command, remove duplicate de…
shtse8 Nov 13, 2025
19cd509
fix(cli): restore default action to support direct argument passing
shtse8 Nov 13, 2025
42a9577
refactor(init): deeply integrate init logic into flow command
shtse8 Nov 13, 2025
7498567
fix: only check components when target is known
shtse8 Nov 13, 2025
a4582c2
fix: handle undefined state in launch phase
shtse8 Nov 13, 2025
2626fc0
fix(opencode): use singular 'command' directory instead of 'commands'
shtse8 Nov 13, 2025
23c4f83
fix(opencode): remove unsupported YAML fields from agent metadata
shtse8 Nov 13, 2025
b391057
fix(opencode): fix state detection and repair flow for OpenCode
shtse8 Nov 13, 2025
189eb57
fix(opencode): auto-cleanup legacy commands directory to prevent crash
shtse8 Nov 13, 2025
48d0759
fix(opencode): remove unsupported YAML fields from installed agents
shtse8 Nov 13, 2025
4444063
fix(state-detector): properly parse OpenCode JSONC config for MCP det…
shtse8 Nov 13, 2025
6f2af11
fix(flow): use positive logic for initialization decision
shtse8 Nov 13, 2025
97c9b64
fix(smart-config): use smart defaults instead of always prompting
shtse8 Nov 13, 2025
c78b874
feat(loop): add autonomous loop mode for continuous execution
shtse8 Nov 13, 2025
e4f2bea
refactor(loop): simplify to core concept - continuous execution
shtse8 Nov 13, 2025
c35e881
feat(loop): make interval optional with 60s default
shtse8 Nov 13, 2025
f5d2be0
feat(flow): add file input support for prompts and translate docs to …
shtse8 Nov 13, 2025
d312598
refactor(loop): optimize loop mode to only repeat command execution
shtse8 Nov 13, 2025
bf56082
feat(loop): change default interval from 60s to 0s (no cooldown)
shtse8 Nov 13, 2025
ac768fa
docs: improve wording clarity - "interval/cooldown" → "wait time"
shtse8 Nov 13, 2025
cc1c483
chore: prepare for 1.0.0 release
shtse8 Nov 13, 2025
a9c3eac
docs: add release preparation summary
shtse8 Nov 13, 2025
3a1fb07
chore: configure package for npm publishing
shtse8 Nov 13, 2025
d0ca865
fix(docs): ignore dead links in VitePress build
shtse8 Nov 13, 2025
ad8aab7
feat(docs): add branding assets and meta tags
shtse8 Nov 13, 2025
4416425
chore: add .vercel to .gitignore
shtse8 Nov 13, 2025
cbf1e9f
feat(branding): redesign icon system with modern flow infinity symbol
shtse8 Nov 13, 2025
1059794
docs: update CLI commands from 'init/run' to 'setup' and direct execu…
shtse8 Nov 13, 2025
2817451
fix(opencode): remove problematic flags from headless run mode
shtse8 Nov 13, 2025
85ceb7c
feat(flow): implement --sync flag to synchronize with Flow templates
shtse8 Nov 13, 2025
89a070e
fix(flow): resolve targetId undefined in loop mode initialization
shtse8 Nov 13, 2025
c1150d4
feat(opencode): print command in headless/loop mode for debugging
shtse8 Nov 13, 2025
dd34226
docs: update for auto-initialization and Claude Code-only loop mode
shtse8 Nov 13, 2025
2ee21db
chore(changeset): add v1.0.0 release changeset
shtse8 Nov 13, 2025
1822609
chore(release): v1.0.0
shtse8 Nov 13, 2025
150b720
docs: add comprehensive feature documentation and update all pages
shtse8 Nov 13, 2025
7d761b2
fix(flow): add prepublishOnly script to ensure build before publish
shtse8 Nov 13, 2025
061a41e
chore(release): version packages
shtse8 Nov 13, 2025
c4af276
fix(flow): publish source code instead of bundle to avoid build issues
shtse8 Nov 13, 2025
a4dd8c4
chore(release): version packages
shtse8 Nov 13, 2025
63b3c24
fix(state-detector): check if component directories have files, not j…
shtse8 Nov 13, 2025
897d01d
chore(release): version packages
shtse8 Nov 13, 2025
7094daf
fix(state-detector): correctly handle Claude Code component detection
shtse8 Nov 13, 2025
5333f08
chore(release): version packages
shtse8 Nov 13, 2025
2fd7d9a
fix(build): include assets directory in npm package
shtse8 Nov 13, 2025
841929e
chore(release): version packages
shtse8 Nov 13, 2025
c8476e4
chore(release): version packages
shtse8 Nov 13, 2025
7e00530
fix(config): improve provider selection UX and respect user preferences
shtse8 Nov 13, 2025
963171f
refactor(config): simplify provider selection - always ask, never sav…
shtse8 Nov 13, 2025
7fdb9f2
chore: add changeset for simplified provider selection
shtse8 Nov 13, 2025
2825fcb
chore(release): version packages
shtse8 Nov 13, 2025
5b1adfb
fix(flow): add missing runtime dependencies to package.json
shtse8 Nov 14, 2025
edd89f4
chore: version packages (#5)
github-actions[bot] Nov 14, 2025
07307ee
fix(config): update saveHomeSettings to use USER_CONFIG_DIR for direc…
shwuhk Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions .archive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 📦 Archive

This folder contains historical documentation from previous refactoring sessions.

These documents are kept for reference but are no longer actively maintained.

## Contents

### Refactoring History
Historical documentation from systematic code refactoring sessions:
- Phase-based refactoring summaries
- Session completion reports
- Analysis and planning documents

### Purpose
- Historical reference
- Learning from past decisions
- Understanding code evolution

### Note
For current documentation, see:
- Project root: `README.md`, `CHANGELOG.md`
- `.github/`: Current analysis and optimization reports
- `docs/`: Technical documentation
- `wiki-pages/`: Project wiki
264 changes: 264 additions & 0 deletions .archive/old-refactoring-docs/ARCHITECTURE_REFACTOR_STATUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
# 🏗️ Server-Client Architecture Refactor Status

**日期:** 2025-01-04
**目標:** 重構為 server-client 架構,支持多客戶端實時數據共享

---

## ✅ 已完成

### 1. 依賴關係修正
- ✅ 移除 flow 對 `@sylphx/code-core` 的依賴(完全獨立項目)
- ✅ 移除 flow-mcp 對 `@sylphx/code-core` 的依賴(完全獨立項目)
- ✅ 修改 code-web 使用 `@sylphx/code-client` 而非直接依賴 core/server
- ✅ code-client re-export AppRouter 類型

### 2. 包合併
- ✅ 合併 code-cli + code-tui → `@sylphx/code`(統一 CLI 工具)
- ✅ 支持 TUI 和 headless 兩種模式

### 3. code-server 獨立運行
- ✅ code-server 可以作為 background daemon 運行
- ✅ Server 啟動時初始化所有資源(database, agent/rule managers)
- ✅ 提供 HTTP + tRPC endpoint (`http://localhost:3000/trpc`)
- ✅ 支持 SSE (Server-Sent Events) for subscriptions

### 4. code-web 架構
- ✅ 完全使用 HTTP tRPC 與 server 通信
- ✅ 使用 tRPC React Query integration
- ✅ SSE streaming for real-time updates

---

## ⚠️ 待完成(需深度重構)

### 問題:code-client 設計為 in-process

**現狀:**
```typescript
// code-client/src/stores/app-store.ts
import { getTRPCClient } from '@sylphx/code-server'; // ❌ in-process client
```

code-client 內部直接使用 `getTRPCClient()`(in-process tRPC caller),這導致:
1. code TUI 必須 in-process 調用 server(無法與 code-web 共享數據)
2. 無法實現多客戶端實時數據同步

**目標架構:**
```
┌────────────────────────────┐
│ code-server (Daemon) │ ← 獨立運行
│ - Database (SQLite) │
│ - AI providers │
│ - Session management │
│ - HTTP Server (port 3000) │
└────────────┬───────────────┘
┌──────┴──────┐
│ tRPC │ (HTTP/SSE)
└──────┬──────┘
┌────────┴─────────┐
│ │
┌───▼────┐ ┌────▼────┐
│ code │ │code-web │
│ (TUI) │ │ (GUI) │
└────────┘ └─────────┘

實時數據共享:
- TUI 創建 session → Web 立即看到
- Web 發送 message → TUI 立即看到
```

### 需要重構的部分

#### 1. code-client 重構 ⚠️ 大工程

**問題:**
- `app-store.ts` 使用 `getTRPCClient()` (in-process)
- `useAIConfig.ts` 使用 `getTRPCClient()`
- `useSessionPersistence.ts` 使用 `getTRPCClient()`

**方案 A: 可配置 client(推薦)**
```typescript
// code-client/src/trpc-context.ts
let globalClient: any = null;

export function setTRPCClient(client: any) {
globalClient = client;
}

export function getTRPC() {
if (!globalClient) {
throw new Error('tRPC client not initialized');
}
return globalClient;
}

// code (TUI) 啟動時
import { createClient } from './trpc-client.js'; // HTTP client
import { setTRPCClient } from '@sylphx/code-client';

const client = createClient(); // HTTP tRPC
setTRPCClient(client);

// code-web 使用 React Query wrapper
// 不需要改動
```

**方案 B: React Context(僅 React 環境)**
- 創建 TRPCContext
- code TUI 和 code-web 都使用 Provider
- 更符合 React 模式,但不支持非 React 環境

#### 2. code TUI 修改

**當前:**
```typescript
// App.tsx
import { initializeAgentManager } from '@sylphx/code-core'; // ❌ 直接使用 core
```

**需要改為:**
```typescript
// index.ts
import { createClient } from './trpc-client.js';
import { setTRPCClient } from '@sylphx/code-client';

// 檢查 server 是否運行
if (!await checkServer()) {
console.error('請先啟動 code-server');
process.exit(1);
}

// 設置 HTTP client
const client = createClient();
setTRPCClient(client);

// 啟動 TUI
render(<App />);
```

#### 3. code headless 修改

**當前:**
```typescript
// headless.ts
import { getProvider, createAIStream } from '@sylphx/code-core'; // ❌ 直接使用 core
```

**需要改為:**
```typescript
// 使用 tRPC client 調用 server
const client = createClient();
const response = await client.message.streamResponse.subscribe({
sessionId: null,
userMessage: prompt,
});
```

---

## 📋 剩餘工作清單

### Phase 1: code-client 重構(優先)
1. [ ] 創建 `src/trpc-context.ts` - 全局 client 配置
2. [ ] 修改 `app-store.ts` 使用可配置 client
3. [ ] 修改 `useAIConfig.ts` 使用可配置 client
4. [ ] 修改 `useSessionPersistence.ts` 使用可配置 client
5. [ ] 添加類型支持(in-process vs HTTP client)

### Phase 2: code TUI 重構
1. [ ] 修改 `src/index.ts` 設置 HTTP tRPC client
2. [ ] 移除 `src/App.tsx` 中的 code-core 直接調用
3. [ ] 測試 TUI 連接到 server
4. [ ] 添加 server 自動啟動邏輯(可選)

### Phase 3: code headless 重構
1. [ ] 修改 `src/headless.ts` 使用 tRPC client
2. [ ] 移除 code-core 直接調用
3. [ ] 測試 headless 連接到 server

### Phase 4: 多客戶端測試
1. [ ] 啟動 code-server
2. [ ] 同時打開 code TUI 和 code-web
3. [ ] 驗證:TUI 創建 session → Web 看到
4. [ ] 驗證:Web 發送 message → TUI 看到
5. [ ] 驗證:實時數據同步

---

## 🎯 最終架構(目標)

```
# Terminal 1: 啟動 server
$ sylphx-code-server
🚀 Sylphx Code Server (Background Daemon)
HTTP Server: http://localhost:3000
tRPC Endpoint: http://localhost:3000/trpc

📡 Accepting connections from:
- code (TUI): HTTP tRPC
- code-web (GUI): HTTP/SSE tRPC

💾 All clients share same data source

# Terminal 2: 啟動 TUI
$ sylphx-code
✅ Connected to code-server (http://localhost:3000)
[TUI 界面]

# Browser: 打開 Web GUI
http://localhost:3000
✅ Connected to code-server
[Web 界面]

# 數據共享測試
TUI 創建 session "測試" → Web 立即顯示 "測試" session
Web 發送 message → TUI 立即更新
```

---

## 💡 技術決策

### 為何使用 HTTP tRPC 而非 in-process?

**優點:**
1. ✅ 多客戶端實時數據共享(核心需求)
2. ✅ Server 可獨立運行(background daemon)
3. ✅ 客戶端可以隨時連接/斷開
4. ✅ 更好的隔離性(server crash 不影響 client)

**缺點:**
1. ❌ 需要網絡連接(即使 localhost)
2. ❌ 略微增加延遲(但 localhost 可忽略)
3. ❌ 需要 server 先啟動

### 為何不同時支持兩種模式?

可以,但會增加複雜度:
- 需要兩套 client 配置
- 需要模式切換邏輯
- 用戶體驗混亂

建議:**統一使用 HTTP模式**,簡化架構。

---

## 🚧 當前限制

1. **code TUI 仍使用 in-process** - 無法與 Web 共享數據
2. **code headless 直接調用 core** - 無法與其他客戶端共享數據
3. **需要手動啟動 server** - 未實現自動啟動

---

## 📝 Notes

- 這是一個**大型重構**,預計需要 4-8 小時
- 需要修改 code-client 的核心架構
- 建議分階段完成,每個 phase 獨立測試
- 完成後,所有客戶端將真正實現實時數據共享

**最後更新:** 2025-01-04 23:00
Loading