Skip to content

feat: refactor structure and update deployment#87

Merged
zhu-xiaowei merged 11 commits intomainfrom
refact-structure
Apr 21, 2026
Merged

feat: refactor structure and update deployment#87
zhu-xiaowei merged 11 commits intomainfrom
refact-structure

Conversation

@zhu-xiaowei
Copy link
Copy Markdown
Contributor

Description

  1. Reorganize project into modular directory structure
  2. Support one-command deploy SwiftChat Server via CodeBuild
  3. Support QR scan for SwiftChat server setup
  4. Enable 1M context for Claude models

General Checklist

  • The code changes have been fully tested
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of the least privilege, etc.)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT-0 license.

zhu-xiaowei and others added 11 commits April 19, 2026 11:26
- Move markdown/ to core/markdown/ for cross-module reuse
- Move app generation files to appgen/ (screens, components, service, util)
- Move image generation files to imagegen/
- Move citation components to websearch/components/citation/
- Split chat/component/ into input/, message/, toolbar/ sub-groups
- Move HapticUtils, ToastUtils to core/ (used across all modules)
- Move FaviconUtils, SearchIconUtils to websearch/
- Move BedrockMessageConvertor to api/ (used by 14 files across 4 modules)
- Merge chat/utils/ into chat/util/
- Remove unused CustomScrollToBottomComponent
- Extract ChatScreen hooks: useChatSession, useChatStreaming, useChatScroll, useChatVoice
- Add ChatProvider interface and ChatProviderRouter for pluggable API layer
- Split StorageUtils into domain modules (Chat, Model, Prompt, Preference, Search, App)
- Add README.md with tech stack and project structure

All import paths updated. No logic or UI changes - pure structural refactoring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the two-step build/deploy flow with a single `./install.sh` that
packages source, builds the image remotely via AWS CodeBuild (no local
Docker needed), deploys the CloudFormation stack, and prints the API URL,
API Key, and a scannable QR code for mobile auto-configuration.

Also drop hardcoded `maxTokens` on the Bedrock Converse calls so each
model gets its own maximum output automatically — no regex rules needed
for future Claude/Kimi/DeepSeek/GLM releases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…okens

App now has a scan icon next to the API URL field that opens a 90% bottom
sheet with a full-bleed camera preview. Scanning the QR from install.sh
auto-fills API URL and API Key with a haptic success tap. iOS + Android
(vision-camera v4 + MLKit), macOS gracefully skips the entry.

install.sh no longer prints the raw API Key to the terminal — it points to
the region-specific API Gateway console instead. The QR still embeds the
key for the trusted "your-terminal-to-your-phone" flow.

Server sets maxTokens per Claude model family (Opus 4.7/4.6 → 128K,
Sonnet/Haiku 4 → 64K, etc) so Converse doesn't truncate at Bedrock's
4096 default. Other providers keep their server-side max.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Auto-attach `context-1m-2025-08-07` anthropic_beta header for
Sonnet >= 4 and Opus >= 4.5 on both API-key (app) and server paths.
Also add Opus 4.7 / Haiku 4.5 to thinking models list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New accounts may need longer for IAM role to propagate globally
before CodeBuild can assume it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract inline styles to StyleSheet in App.tsx and ScanQRSheet.tsx
- Update README docs to clarify API Key obtain link
- Remove obsolete UPGRADE_RN_0.83.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add self-bootstrap logic to install.sh so it can be run directly via
curl without manually cloning the repo first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Redirect stdin to /dev/null for git clone to prevent pipe consumption.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bash reads piped scripts line-by-line from stdin; child processes
(git clone) can consume bytes from the same pipe, corrupting execution.
Wrapping in main() forces bash to read the entire script before running.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace simulate-principal-policy (which tests IAM internal consistency
but not CodeBuild's view of the role) with direct retry of the real
create-project/update-project calls. Covers both new and existing
projects, so re-runs after role deletion also work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zhu-xiaowei zhu-xiaowei enabled auto-merge (squash) April 21, 2026 04:59
@zhu-xiaowei zhu-xiaowei merged commit 3e0e8f1 into main Apr 21, 2026
6 checks passed
@zhu-xiaowei zhu-xiaowei deleted the refact-structure branch April 21, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant