@take-out/docs 0.0.52 → 0.0.57

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.
package/package-json.md DELETED
@@ -1,115 +0,0 @@
1
- ---
2
- name: takeout-package-json
3
- description: Package.json structure guide. 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/*`
@@ -1,184 +0,0 @@
1
- ---
2
- name: takeout-react-native-navigation-flow
3
- description: React Native navigation and mobile routing guide for One framework. 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 DELETED
@@ -1,144 +0,0 @@
1
- ---
2
- name: takeout-scripts
3
- description: Scripts guide for tko CLI automation. 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
-
28
- ## creating scripts
29
-
30
- scripts are `.ts` files in `./scripts/`. add a `@description` comment for
31
- documentation:
32
-
33
- ```ts
34
- #!/usr/bin/env bun
35
-
36
- /**
37
- * @description Ensure a port is available
38
- */
39
-
40
- const port = process.argv[2]
41
- // ... implementation
42
- ```
43
-
44
- use `bun tko script new <path>` to scaffold a new script:
45
-
46
- ```bash
47
- bun tko script new check/ports
48
- # creates ./scripts/check/ports.ts
49
- ```
50
-
51
- ## script organization
52
-
53
- ```
54
- scripts/
55
- ├── build-initial.ts # top-level scripts
56
- ├── node.ts
57
- ├── aws/ # category folders
58
- │ ├── configure.ts
59
- │ └── health.ts
60
- ├── check/
61
- │ ├── dependencies.ts
62
- │ └── types.ts
63
- ├── ci/
64
- │ ├── release.ts
65
- │ └── check.ts
66
- └── web/
67
- ├── build.ts
68
- └── serve.ts
69
- ```
70
-
71
- ## helpers directory
72
-
73
- scripts can share code via `./scripts/helpers/` (or category-level helpers).
74
- this directory is excluded from script discovery.
75
-
76
- ```
77
- scripts/
78
- ├── helpers/ # shared code, not runnable
79
- │ └── docker.ts
80
- ├── ci/
81
- │ └── helpers/ # ci-specific helpers
82
- │ └── deploy.ts
83
- ```
84
-
85
- ## listing available scripts
86
-
87
- ```bash
88
- # show all available scripts
89
- bun tko
90
-
91
- # show scripts in a category
92
- bun tko script aws
93
-
94
- # list built-in commands
95
- bun tko --help
96
- ```
97
-
98
- ## built-in commands vs scripts
99
-
100
- built-in commands are always available:
101
-
102
- - `tko onboard` - setup wizard
103
- - `tko docs` - view documentation
104
- - `tko env:setup` - setup environment
105
- - `tko run` - run scripts in parallel
106
- - `tko script` - manage scripts
107
-
108
- everything else routes to the script runner.
109
-
110
- ## parallel execution
111
-
112
- use `tko run` to run multiple scripts in parallel:
113
-
114
- ```bash
115
- # run three scripts in parallel
116
- bun tko run build lint typecheck
117
-
118
- # in package.json
119
- "dev": "tko run run one:dev watch dev-tunnel-if-exist"
120
- ```
121
-
122
- ## script metadata
123
-
124
- scripts can define metadata via jsdoc comments:
125
-
126
- ```ts
127
- /**
128
- * @description Build docker image for web
129
- * @args --tag, --push
130
- */
131
- ```
132
-
133
- this metadata is cached in `~/.takeout/script-cache.json` for fast lookups.
134
-
135
- ## ejecting built-in scripts
136
-
137
- to customize a built-in script, eject it to your local scripts folder:
138
-
139
- ```bash
140
- bun tko script eject
141
- ```
142
-
143
- this copies scripts from `@take-out/scripts` to `./scripts/`, letting you modify
144
- them while keeping the same command interface.