@take-out/docs 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: package-json
3
+ description: Package.json structure guide. INVOKE WHEN: package.json, package configuration, scripts section, npm scripts, env vars, environment variables, workspaces, monorepo, trustedDependencies, dependencies.
4
+ ---
5
+
6
+ # package.json
7
+
8
+ this project uses a single root package.json with workspaces for internal
9
+ packages. understanding its structure helps avoid common mistakes.
10
+
11
+ we use bun generally for scripts we write, and we try and create high level
12
+ groups for scripts that we then run with the `tko` helper.
13
+
14
+ ## scripts section
15
+
16
+ scripts are minimal - most commands use the takeout cli (`tko`).
17
+
18
+ ### patterns
19
+
20
+ **prefer `tko` over direct commands:**
21
+
22
+ ```json
23
+ "check": "tko check",
24
+ "build": "tko run build",
25
+ "clean": "tko run clean"
26
+ ```
27
+
28
+ **use `tko run` for parallel execution:**
29
+
30
+ ```json
31
+ "dev": "tko run run one:dev watch dev-tunnel-if-exist"
32
+ ```
33
+
34
+ ### adding new scripts
35
+
36
+ if this repo has a `./packages/scripts` - this is for scripts that are shared
37
+ between all users of Takeout, basically any script that is useful beyond being a
38
+ demo/example specifically for this repo. but otherwise you want to just put
39
+ scripts into `./scripts`.
40
+
41
+ example - adding a port check before dev:
42
+
43
+ ```bash
44
+ # create the script
45
+ echo '#!/usr/bin/env bun
46
+ /**
47
+ * @description Ensure a port is available
48
+ */
49
+ // implementation...' > scripts/ensure-port.ts
50
+
51
+ # use via tko
52
+ bun tko ensure-port 8081
53
+ ```
54
+
55
+ ## env section
56
+
57
+ the `env` object defines environment variables for the project. this is used by
58
+ `bun tko env:update` to generate typed env files.
59
+
60
+ ```json
61
+ "env": {
62
+ "AWS_ACCESS_KEY_ID": "",
63
+ "BETTER_AUTH_SECRET": true,
64
+ "CLOUDFLARE_R2_ENDPOINT": "http://minio:9000/chat"
65
+ }
66
+ ```
67
+
68
+ values:
69
+
70
+ - `""` - optional, no default
71
+ - `"value"` - optional with default value
72
+ - `true` - required, must be set in .env files
73
+
74
+ **never modify `/src/server/env-server.ts` directly** - it's auto-generated from
75
+ this section.
76
+
77
+ to add a new env var:
78
+
79
+ 1. add to `env` section in package.json
80
+ 2. run `bun env:update`
81
+ 3. optionally add example value to `.env.development`
82
+
83
+ ## trustedDependencies
84
+
85
+ allow postinstall scripts for specific packages:
86
+
87
+ ```json
88
+ "trustedDependencies": [
89
+ "@rocicorp/zero-sqlite3"
90
+ ]
91
+ ```
92
+
93
+ ## takeout section
94
+
95
+ project-specific metadata for onboarding script etc:
96
+
97
+ ```json
98
+ "takeout": {
99
+ "onboarded": false
100
+ }
101
+ ```
102
+
103
+ ## common mistakes
104
+
105
+ 1. **adding scripts that should be in `./scripts/`** - if it's project-specific
106
+ logic, put it in scripts folder
107
+
108
+ 2. **modifying env-server.ts directly** - always use `env` section +
109
+ `bun env:update`
110
+
111
+ 3. **using full paths when tko works** - prefer `tko check/types` over
112
+ `bun ./scripts/check/types.ts`
113
+
114
+ 4. **forgetting workspace:\* for internal packages** - always use `workspace:*`
115
+ for packages in `./packages/*`
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@take-out/docs",
3
+ "version": "0.0.42",
4
+ "description": "Documentation files for Takeout starter kit",
5
+ "type": "module",
6
+ "files": [
7
+ "*.md"
8
+ ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ }
12
+ }
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: react-native-navigation-flow
3
+ description: React Native navigation and mobile routing guide for One framework. INVOKE WHEN: React Native navigation, native navigation, useRouter, useParams on native, drawer layout, drawer navigation, mobile routing, One framework routing, screen transitions, navigation flow.
4
+ ---
5
+
6
+ # React Native Navigation Flow
7
+
8
+ ## Overview
9
+
10
+ This app uses the One framework instead of React Navigation. One provides
11
+ unified routing for both web and React Native platforms using a file-based
12
+ routing system.
13
+
14
+ ## Navigation Architecture
15
+
16
+ ```
17
+ ┌─────────────────────────────────────────────────────────┐
18
+ │ App Entry Point │
19
+ │ (One Framework Bootstrap) │
20
+ └────────────────────┬────────────────────────────────────┘
21
+
22
+
23
+ ┌─────────────────────────────────────────────────────────┐
24
+ │ app/_layout.tsx │
25
+ │ • SafeAreaProvider │
26
+ │ • TamaguiProvider (Theme) │
27
+ │ • SchemeProvider (Color Scheme) │
28
+ │ • DataProvider (Zero sync) │
29
+ │ • AuthEffects │
30
+ │ • <Slot /> (renders current route) │
31
+ └────────────────────┬────────────────────────────────────┘
32
+
33
+
34
+ ┌─────────────────────────────────────────────────────────┐
35
+ │ app/(chat)/_layout.native.tsx │
36
+ │ • Drawer Layout (slide menu) │
37
+ │ • Server/Channel Context Providers │
38
+ │ • Safe Area Insets │
39
+ │ • <Slot /> (renders chat routes) │
40
+ └────────────────────┬────────────────────────────────────┘
41
+
42
+
43
+ ┌────────────┴────────────┬─────────────┐
44
+ │ │ │
45
+ ↓ ↓ ↓
46
+ ┌───────────────┐ ┌─────────────┐ ┌──────────────┐
47
+ │ index.tsx │ │ [serverId]/ │ │ private/ │
48
+ │ (Home Page) │ │ (Channels) │ │ (DMs) │
49
+ └───────────────┘ └─────────────┘ └──────────────┘
50
+ ```
51
+
52
+ ## Navigation Components
53
+
54
+ ### 1. Slot Component
55
+
56
+ - From `one` framework
57
+ - Renders the current route content
58
+ - Similar to React Router's `<Outlet />`
59
+
60
+ ### 2. Drawer Component
61
+
62
+ - From `react-native-drawer-layout`
63
+ - Provides sliding sidebar on mobile
64
+ - Contains server list and channels
65
+
66
+ ### 3. Navigation Hooks
67
+
68
+ ```typescript
69
+ // get current route parameters
70
+ const params = useParams()
71
+ const { serverId, channelId } = useServerParams()
72
+
73
+ // programmatic navigation
74
+ const router = useRouter()
75
+ router.navigate(`/${serverId}/${channelId}`)
76
+
77
+ // current pathname (web only)
78
+ const pathname = usePathname() // must check isWeb first
79
+ ```
80
+
81
+ ## Navigation Flow Examples
82
+
83
+ ### 1. App Launch Flow
84
+
85
+ ```
86
+ App Start → Check Auth →
87
+ ├─ Authenticated → Redirect to last visited page
88
+ └─ Not Authenticated → Show home page
89
+ ```
90
+
91
+ ### 2. Server Navigation Flow
92
+
93
+ ```
94
+ User taps server →
95
+ Update context (serverId) →
96
+ Navigate to default channel →
97
+ Close drawer →
98
+ Render channel messages
99
+ ```
100
+
101
+ ### 3. Deep Link Flow
102
+
103
+ ```
104
+ Deep link received →
105
+ Parse URL parameters →
106
+ Navigate to specific message/thread →
107
+ Scroll to message
108
+ ```
109
+
110
+ ## Platform-Specific Behaviors
111
+
112
+ ### React Native
113
+
114
+ - Drawer navigation for sidebar
115
+ - Safe area handling
116
+ - Touch-based interactions
117
+ - No browser history API
118
+
119
+ ### Web
120
+
121
+ - Fixed sidebar (responsive)
122
+ - Browser history navigation
123
+ - URL-based routing
124
+ - Keyboard shortcuts
125
+
126
+ ## Context Flow
127
+
128
+ ```
129
+ ┌─────────────────────────┐
130
+ │ Navigation Event │
131
+ │ (tap, link, redirect) │
132
+ └───────────┬─────────────┘
133
+
134
+
135
+ ┌─────────────────────────┐
136
+ │ Update URL/Route │
137
+ │ (One Framework) │
138
+ └───────────┬─────────────┘
139
+
140
+
141
+ ┌─────────────────────────┐
142
+ │ Update Contexts │
143
+ │ • CurrentServerId │
144
+ │ • CurrentChannelId │
145
+ │ • CurrentThreadId │
146
+ └───────────┬─────────────┘
147
+
148
+
149
+ ┌─────────────────────────┐
150
+ │ Re-render Components │
151
+ │ • Sidebar highlights │
152
+ │ • Message list │
153
+ │ • Header info │
154
+ └─────────────────────────┘
155
+ ```
156
+
157
+ ## Key Files
158
+
159
+ 1. Navigation Setup
160
+
161
+ - `/app/_layout.tsx` - Root layout
162
+ - `/app/(chat)/_layout.native.tsx` - Native chat layout
163
+ - `/src/interface/app/Link.tsx` - Link component wrapper
164
+
165
+ 2. Navigation Helpers
166
+
167
+ - `/src/features/channel/getChannelLink.ts`
168
+ - `/src/features/message/getMessageLink.ts`
169
+ - `/src/features/server/useServerParams.ts`
170
+
171
+ 3. Context Providers
172
+ - `/src/context/CurrentServerId.tsx`
173
+ - `/src/context/CurrentChannelId.tsx`
174
+ - `/src/context/CurrentThreadId.tsx`
175
+
176
+ ## Important Notes
177
+
178
+ 1. No React Navigation: This app uses One framework's built-in routing, not
179
+ React Navigation
180
+ 2. File-based Routing: Routes are determined by file structure in `/app`
181
+ 3. Platform Parity: Same routing code works on both web and native
182
+ 4. Context-based State: Navigation state is managed through React Context
183
+ 5. URL-driven: Even on native, routing is URL-based (though not visible to
184
+ users)
package/scripts.md ADDED
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: scripts
3
+ description: Scripts guide for tko CLI automation. INVOKE WHEN: scripts, CLI scripts, ./scripts/ directory, tko commands, tko run, parallel execution, script management, bun scripts, npm scripts, automation.
4
+ ---
5
+
6
+ # scripts
7
+
8
+ the takeout cli (`tko`) provides a smart script runner that auto-discovers
9
+ scripts from two locations:
10
+
11
+ 1. **local scripts** in `./scripts/` - project-specific scripts
12
+ 2. **built-in scripts** in `@take-out/scripts` package - shared utilities
13
+
14
+ local scripts override built-in ones with the same name.
15
+
16
+ ## running scripts
17
+
18
+ ```bash
19
+ # run a script directly
20
+ bun tko ensure-port 8081
21
+ bun tko clean
22
+
23
+ # run scripts in a category
24
+ bun tko web/build
25
+ bun tko aws/health
26
+
27
+ # alternate category syntax
28
+ bun tko aws health
29
+ ```
30
+
31
+ ## creating scripts
32
+
33
+ scripts are `.ts` files in `./scripts/`. add a `@description` comment for
34
+ documentation:
35
+
36
+ ```ts
37
+ #!/usr/bin/env bun
38
+
39
+ /**
40
+ * @description Ensure a port is available
41
+ */
42
+
43
+ const port = process.argv[2]
44
+ // ... implementation
45
+ ```
46
+
47
+ use `bun tko script new <path>` to scaffold a new script:
48
+
49
+ ```bash
50
+ bun tko script new check/ports
51
+ # creates ./scripts/check/ports.ts
52
+ ```
53
+
54
+ ## script organization
55
+
56
+ ```
57
+ scripts/
58
+ ├── build-initial.ts # top-level scripts
59
+ ├── node.ts
60
+ ├── aws/ # category folders
61
+ │ ├── configure.ts
62
+ │ └── health.ts
63
+ ├── check/
64
+ │ ├── dependencies.ts
65
+ │ └── types.ts
66
+ ├── ci/
67
+ │ ├── release.ts
68
+ │ └── check.ts
69
+ └── web/
70
+ ├── build.ts
71
+ └── serve.ts
72
+ ```
73
+
74
+ ## helpers directory
75
+
76
+ scripts can share code via `./scripts/helpers/` (or category-level helpers).
77
+ this directory is excluded from script discovery.
78
+
79
+ ```
80
+ scripts/
81
+ ├── helpers/ # shared code, not runnable
82
+ │ └── docker.ts
83
+ ├── ci/
84
+ │ └── helpers/ # ci-specific helpers
85
+ │ └── deploy.ts
86
+ ```
87
+
88
+ ## listing available scripts
89
+
90
+ ```bash
91
+ # show all available scripts
92
+ bun tko
93
+
94
+ # show scripts in a category
95
+ bun tko script aws
96
+
97
+ # list built-in commands
98
+ bun tko --help
99
+ ```
100
+
101
+ ## built-in commands vs scripts
102
+
103
+ built-in commands are always available:
104
+
105
+ - `tko onboard` - setup wizard
106
+ - `tko docs` - view documentation
107
+ - `tko env:setup` - setup environment
108
+ - `tko run` - run scripts in parallel
109
+ - `tko script` - manage scripts
110
+
111
+ everything else routes to the script runner.
112
+
113
+ ## parallel execution
114
+
115
+ use `tko run` to run multiple scripts in parallel:
116
+
117
+ ```bash
118
+ # run three scripts in parallel
119
+ bun tko run build lint typecheck
120
+
121
+ # in package.json
122
+ "dev": "tko run run one:dev watch dev-tunnel-if-exist"
123
+ ```
124
+
125
+ ## script metadata
126
+
127
+ scripts can define metadata via jsdoc comments:
128
+
129
+ ```ts
130
+ /**
131
+ * @description Build docker image for web
132
+ * @args --tag, --push
133
+ */
134
+ ```
135
+
136
+ this metadata is cached in `~/.takeout/script-cache.json` for fast lookups.
137
+
138
+ ## ejecting built-in scripts
139
+
140
+ to customize a built-in script, eject it to your local scripts folder:
141
+
142
+ ```bash
143
+ bun tko script eject
144
+ ```
145
+
146
+ this copies scripts from `@take-out/scripts` to `./scripts/`, letting you modify
147
+ them while keeping the same command interface.
package/sync-prompt.md ADDED
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: sync-prompt
3
+ description: Intelligent sync guide for updating forked Takeout with upstream changes while preserving customizations. INVOKE WHEN: sync, upstream sync, fork sync, merging upstream, git merge, tamagui/takeout3, upstream changes, update from takeout, takeout updates.
4
+ ---
5
+
6
+ # Takeout Repository Sync Prompt
7
+
8
+ You are helping sync a fork of the Takeout starter kit with the latest upstream changes.
9
+
10
+ ## Context
11
+
12
+ This application was forked from Takeout, a full-stack starter kit for building production-ready apps. The upstream repository is at `git@github.com:tamagui/takeout3.git`.
13
+
14
+ ## Your Task
15
+
16
+ Intelligently sync the latest Takeout changes into this repository while preserving all user customizations.
17
+
18
+ ## Process
19
+
20
+ ### 1. Clone Upstream Repository
21
+
22
+ Clone the upstream Takeout repository to a temporary directory:
23
+
24
+ ```bash
25
+ git clone git@github.com:tamagui/takeout3.git /tmp/takeout-upstream
26
+ cd /tmp/takeout-upstream
27
+ ```
28
+
29
+ ### 2. Identify Last Synced Commit
30
+
31
+ Compare the current repository with the upstream to determine the last commit that was synced from Takeout. You can do this by:
32
+
33
+ - Checking git history for merge commits from upstream
34
+ - Comparing file contents and commit messages
35
+ - Looking for a `.takeout` marker file (if it exists) that contains the last synced commit SHA
36
+
37
+ Create or update a `.takeout` file in the project root with the current HEAD SHA after syncing.
38
+
39
+ ### 3. Analyze New Commits
40
+
41
+ Starting from the last synced commit, go through each new commit in the upstream repository:
42
+
43
+ ```bash
44
+ git log --oneline <last-synced-commit>..HEAD
45
+ ```
46
+
47
+ For each commit:
48
+
49
+ 1. **Read the commit message and diff** to understand what changed
50
+ 2. **Categorize the change**:
51
+ - Infrastructure/tooling updates (build scripts, CI/CD, etc.)
52
+ - Feature additions or enhancements
53
+ - Bug fixes
54
+ - Dependency updates
55
+ - Documentation updates
56
+ - Breaking changes
57
+
58
+ 3. **Determine if it's applicable** to this repository:
59
+ - Does this repository still contain the code being modified?
60
+ - Has the user customized this area significantly?
61
+ - Is this a core Takeout feature or something the user likely removed?
62
+
63
+ ### 4. Apply Changes Intelligently
64
+
65
+ For each applicable change:
66
+
67
+ **If the code still exists and hasn't been heavily customized:**
68
+ - Apply the change directly, preserving user modifications where possible
69
+ - Use three-way merge strategies when conflicts arise
70
+
71
+ **If the code has been customized:**
72
+ - Pause and ask the user:
73
+ - Show them the upstream change
74
+ - Show them their current code
75
+ - Ask if they want to: (a) apply the change, (b) skip it, (c) manually merge it, or (d) see more details
76
+
77
+ **If the code doesn't exist anymore:**
78
+ - Skip the change (user likely removed this feature intentionally)
79
+ - Optionally mention it in a summary at the end
80
+
81
+ ### 5. Handle Package Ejection
82
+
83
+ Check if the user has ejected from the monorepo setup:
84
+
85
+ ```bash
86
+ # If ./packages directory doesn't exist, they've ejected
87
+ ```
88
+
89
+ **If ejected:**
90
+ - DO NOT copy any changes from `./packages/*` directories
91
+ - Instead, at the end of syncing, check the latest `@take-out/*` package versions in the upstream `package.json`
92
+ - Run: `bun add @take-out/cli@^X.X.X @take-out/helpers@^X.X.X` (etc.) with the latest versions
93
+
94
+ **If NOT ejected:**
95
+ - Sync changes to `./packages/*` normally
96
+ - Preserve any local modifications to these packages
97
+
98
+ ### 6. Handle Special Cases
99
+
100
+ **Environment variables:**
101
+ - Never overwrite `.env` or `.env.local`
102
+ - For new variables in `.env.development`, notify the user but don't auto-add
103
+
104
+ **Configuration files:**
105
+ - `package.json`: Merge dependencies carefully, don't overwrite user's custom scripts/config
106
+ - `tsconfig.json`, `.oxfmtrc.jsonc`, `.oxlintrc.json`: Merge carefully, preserving user customizations
107
+ - `app.config.ts`: Never overwrite (contains user's app identity)
108
+
109
+ **Database migrations:**
110
+ - Always apply new migrations in `./migrations/*`
111
+ - Never modify existing migrations
112
+
113
+ **Generated files:**
114
+ - Skip `src/data/generated/*` (these are auto-generated)
115
+ - Skip `node_modules/`, `.vxrn/`, `dist/`, etc.
116
+
117
+ ### 7. Pause for Decisions
118
+
119
+ Stop and ask the user whenever:
120
+ - A change conflicts with their customizations
121
+ - A breaking change is detected
122
+ - Multiple valid approaches exist for merging a change
123
+ - The change affects core app functionality they've modified
124
+ - You're uncertain about the best approach
125
+
126
+ When pausing, provide:
127
+ - Clear explanation of the situation
128
+ - The upstream change details
129
+ - Their current code
130
+ - Recommended options with pros/cons
131
+ - A way to skip and continue
132
+
133
+ ### 8. Summary and Completion
134
+
135
+ After processing all commits:
136
+
137
+ 1. Create a summary document showing:
138
+ - Commits applied successfully
139
+ - Changes skipped (with reasons)
140
+ - Manual interventions made
141
+ - New package versions (if ejected)
142
+ - Any recommended follow-up actions
143
+
144
+ 2. Update the `.takeout` marker file with the new HEAD SHA
145
+
146
+ 3. Run post-sync checks:
147
+ ```bash
148
+ bun install
149
+ bun lint:fix
150
+ bun tko check types
151
+ ```
152
+
153
+ 4. If checks fail, report the errors and suggest fixes
154
+
155
+ ## Important Guidelines
156
+
157
+ - **Preserve user intent**: When in doubt, preserve the user's changes over upstream changes
158
+ - **Be transparent**: Always explain what you're doing and why
159
+ - **Ask questions**: Better to pause and ask than to make a wrong assumption
160
+ - **Test incrementally**: After significant changes, suggest running tests
161
+ - **Document decisions**: Keep track of choices made for future reference
162
+ - **Respect customizations**: Recognize that users forked Takeout to make it their own
163
+
164
+ ## Example Decision Points
165
+
166
+ **Example 1: Upstream updates a component the user has heavily customized**
167
+ ```
168
+ ⚠️ Decision needed: Upstream updated ButtonSimple component
169
+
170
+ Upstream changes:
171
+ - Added new 'variant' prop
172
+ - Changed default styling
173
+ - Fixed accessibility issue
174
+
175
+ Your current code:
176
+ - Custom 'theme' prop added
177
+ - Completely different styling approach
178
+ - Same accessibility issue present
179
+
180
+ Options:
181
+ a) Skip upstream changes (keep your customizations)
182
+ b) Apply only the accessibility fix
183
+ c) Manually merge all changes
184
+ d) Show me the full diff
185
+
186
+ What would you like to do? [a/b/c/d]
187
+ ```
188
+
189
+ **Example 2: New dependency in upstream**
190
+ ```
191
+ ℹ️ Upstream added new dependency: @tamagui/animate-presence@1.0.0
192
+
193
+ This is used in the new modal animations feature. You don't currently have
194
+ any modals in your app.
195
+
196
+ Options:
197
+ a) Add dependency and related code (prepare for future use)
198
+ b) Skip (you can add it later if needed)
199
+
200
+ What would you like to do? [a/b]
201
+ ```
202
+
203
+ ## Final Notes
204
+
205
+ - This is a **intelligent sync**, not a blind merge
206
+ - The goal is to **keep you up-to-date** while **respecting your customizations**
207
+ - When uncertain, **always ask** before making changes
208
+ - Keep a **detailed log** of all changes for review