@tarunspandit/codexflow 0.29.0

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.
Files changed (92) hide show
  1. package/AGENTS.example.md +18 -0
  2. package/CHANGELOG.md +311 -0
  3. package/CHATGPT_PROMPT.md +12 -0
  4. package/CODEX_PROMPT.md +12 -0
  5. package/CONTRIBUTING.md +51 -0
  6. package/DOMAIN_SETUP.md +241 -0
  7. package/FAQ.md +327 -0
  8. package/FAQ_ZH.md +279 -0
  9. package/LICENSE +21 -0
  10. package/NOTICE +9 -0
  11. package/PUBLIC_LAUNCH_CHECKLIST.md +111 -0
  12. package/README.md +287 -0
  13. package/README_ZH.md +461 -0
  14. package/SECURITY.md +145 -0
  15. package/config.example.env +31 -0
  16. package/dist/analysis/cache.js +27 -0
  17. package/dist/analysis/cache.js.map +1 -0
  18. package/dist/analysis/classify.js +102 -0
  19. package/dist/analysis/classify.js.map +1 -0
  20. package/dist/analysis/extract.js +139 -0
  21. package/dist/analysis/extract.js.map +1 -0
  22. package/dist/analysis/graph.js +22 -0
  23. package/dist/analysis/graph.js.map +1 -0
  24. package/dist/analysis/impact.js +167 -0
  25. package/dist/analysis/impact.js.map +1 -0
  26. package/dist/analysis/index.js +215 -0
  27. package/dist/analysis/index.js.map +1 -0
  28. package/dist/analysis/inventory.js +51 -0
  29. package/dist/analysis/inventory.js.map +1 -0
  30. package/dist/analysis/providers.js +24 -0
  31. package/dist/analysis/providers.js.map +1 -0
  32. package/dist/analysis/rank.js +27 -0
  33. package/dist/analysis/rank.js.map +1 -0
  34. package/dist/analysis/types.js +8 -0
  35. package/dist/analysis/types.js.map +1 -0
  36. package/dist/bashOps.js +233 -0
  37. package/dist/bashOps.js.map +1 -0
  38. package/dist/capabilitiesOps.js +365 -0
  39. package/dist/capabilitiesOps.js.map +1 -0
  40. package/dist/codexSessions.js +379 -0
  41. package/dist/codexSessions.js.map +1 -0
  42. package/dist/config.js +289 -0
  43. package/dist/config.js.map +1 -0
  44. package/dist/fsOps.js +286 -0
  45. package/dist/fsOps.js.map +1 -0
  46. package/dist/gitOps.js +79 -0
  47. package/dist/gitOps.js.map +1 -0
  48. package/dist/guard.js +198 -0
  49. package/dist/guard.js.map +1 -0
  50. package/dist/http.js +1671 -0
  51. package/dist/http.js.map +1 -0
  52. package/dist/proContext.js +274 -0
  53. package/dist/proContext.js.map +1 -0
  54. package/dist/profileStore.js +89 -0
  55. package/dist/profileStore.js.map +1 -0
  56. package/dist/projectCatalog.js +134 -0
  57. package/dist/projectCatalog.js.map +1 -0
  58. package/dist/redact.js +73 -0
  59. package/dist/redact.js.map +1 -0
  60. package/dist/searchOps.js +186 -0
  61. package/dist/searchOps.js.map +1 -0
  62. package/dist/server.js +2502 -0
  63. package/dist/server.js.map +1 -0
  64. package/dist/stdio.js +36 -0
  65. package/dist/stdio.js.map +1 -0
  66. package/dist/toolCardWidget.js +1155 -0
  67. package/dist/toolCardWidget.js.map +1 -0
  68. package/dist/workspaceOps.js +229 -0
  69. package/dist/workspaceOps.js.map +1 -0
  70. package/docs/.nojekyll +1 -0
  71. package/docs/favicon.svg +5 -0
  72. package/docs/index.html +638 -0
  73. package/docs/og.png +0 -0
  74. package/docs/script.js +80 -0
  75. package/docs/star.svg +11 -0
  76. package/docs/styles.css +1229 -0
  77. package/docs/zh.html +436 -0
  78. package/package.json +94 -0
  79. package/scripts/analysis-cli-smoke.mjs +81 -0
  80. package/scripts/analysis-smoke.mjs +179 -0
  81. package/scripts/clean.mjs +6 -0
  82. package/scripts/cli-smoke.mjs +168 -0
  83. package/scripts/codexflow.mjs +4375 -0
  84. package/scripts/doctor-smoke.mjs +90 -0
  85. package/scripts/execute-handoff-smoke.mjs +1110 -0
  86. package/scripts/http-smoke.mjs +812 -0
  87. package/scripts/pro-apply.mjs +141 -0
  88. package/scripts/pro-bundle.mjs +121 -0
  89. package/scripts/pro-smoke.mjs +95 -0
  90. package/scripts/settings-smoke.mjs +756 -0
  91. package/scripts/smoke.mjs +1194 -0
  92. package/scripts/stress.mjs +835 -0
@@ -0,0 +1,111 @@
1
+ # Public Launch Checklist
2
+
3
+ codexflow is a local developer bridge. Treat public launch readiness as two separate gates:
4
+
5
+ 1. The npm package is safe and understandable for local developers.
6
+ 2. The ChatGPT app surface is stable enough for users to connect through Developer Mode.
7
+
8
+ Do not present CodexFlow as a fully reviewed public ChatGPT app until it has gone through the current app review flow.
9
+
10
+ ## Release Gate
11
+
12
+ Run these before tagging a release:
13
+
14
+ ```bash
15
+ npm install --package-lock-only
16
+ npm run build
17
+ npm run smoke
18
+ npm pack --dry-run
19
+ codexflow doctor --tunnel none
20
+ npm view CodexFlow version dist-tags --json
21
+ ```
22
+
23
+ After publishing, do not announce npm availability until the `latest` dist-tag matches `package.json`.
24
+
25
+ The tarball must not include:
26
+
27
+ ```text
28
+ .env files
29
+ local tunnel URLs
30
+ codexflow tokens
31
+ Cloudflare or ngrok tokens
32
+ .ai-bridge runtime files
33
+ node_modules
34
+ local screenshots or reports
35
+ ```
36
+
37
+ ## ChatGPT App Gate
38
+
39
+ Before announcing broadly:
40
+
41
+ - Test in ChatGPT Developer Mode with a fresh app install.
42
+ - Test quick tunnel, saved ngrok domain, and local-only mode.
43
+ - Refresh actions after widget URI or metadata changes.
44
+ - Confirm CSP stays enabled in Developer Mode.
45
+ - Capture screenshots for:
46
+ - app connection screen
47
+ - `server_config`
48
+ - `open_current_workspace`
49
+ - one `write`
50
+ - one `edit`
51
+ - one `search`
52
+ - one failure state
53
+ - Run the same golden prompts on each release and compare behavior.
54
+
55
+ Suggested golden prompts:
56
+
57
+ ```text
58
+ Use CodexFlow. Call server_config, then open_current_workspace with include_tree=false. Read README.md and summarize the project without editing files.
59
+ ```
60
+
61
+ ```text
62
+ Use CodexFlow. Create a small static site from PRODUCT.md by writing index.html, styles.css, and README.md. Verify with one targeted search.
63
+ ```
64
+
65
+ ```text
66
+ Use CodexFlow. Try to read .env. Explain why the request is blocked.
67
+ ```
68
+
69
+ ```text
70
+ Use CodexFlow. Run bash with pwd, then run bash with a blocked command. Report both outcomes.
71
+ ```
72
+
73
+ ## Security Gate
74
+
75
+ - Keep auth enabled for public tunnels.
76
+ - Keep `CODEXFLOW_BASH_MODE=safe` by default.
77
+ - Keep `CODEXFLOW_WRITE_MODE=workspace` only for agent mode.
78
+ - Keep blocked path tests for `.env`, `.git`, `node_modules`, private keys, and symlink escapes.
79
+ - Do not broaden allowed roots during setup unless the user explicitly asks.
80
+ - Do not log query strings, tokens, file contents, prompts, or full command output by default.
81
+
82
+ ## Onboarding Gate
83
+
84
+ Fresh-user setup should work with:
85
+
86
+ ```bash
87
+ npx codexflow@latest
88
+ ```
89
+
90
+ The terminal must clearly show:
91
+
92
+ - workspace root
93
+ - current mode
94
+ - public URL strategy
95
+ - that the Server URL is copied
96
+ - that Enter opens ChatGPT connector settings
97
+ - how to stop the process
98
+
99
+ For stable URLs, `codexflow` must save enough profile state so future starts from the same workspace only need:
100
+
101
+ ```bash
102
+ codexflow
103
+ ```
104
+
105
+ ## Known Non-Goals For The Current Local Package
106
+
107
+ - CodexFlow is not an OS sandbox.
108
+ - CodexFlow does not guarantee a ChatGPT model can call MCP tools.
109
+ - CodexFlow does not change ChatGPT, Codex, or OpenAI quota behavior.
110
+ - Quick Cloudflare tunnels are not permanent URLs.
111
+ - A single shared public URL for every user requires a hosted relay architecture, not only a local npm package.
package/README.md ADDED
@@ -0,0 +1,287 @@
1
+ <p align="center">
2
+ <a href="https://tarunspandit.github.io/codexflow/"><img src="docs/og.png" width="900" alt="CodexFlow — One command. Every project. Any chat."></a>
3
+ </p>
4
+
5
+ <h1 align="center">CodexFlow</h1>
6
+
7
+ <p align="center">
8
+ One command turns ChatGPT on the web into a project-aware coding agent for your local machine.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@tarunspandit/codexflow"><img alt="npm" src="https://img.shields.io/npm/v/@tarunspandit/codexflow?style=flat-square"></a>
13
+ <a href="https://github.com/tarunspandit/codexflow/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/tarunspandit/codexflow/ci.yml?branch=main&style=flat-square"></a>
14
+ <a href="https://github.com/tarunspandit/codexflow/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/tarunspandit/codexflow?style=flat-square"></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://tarunspandit.github.io/codexflow/">Website</a> ·
19
+ <a href="https://www.npmjs.com/package/@tarunspandit/codexflow">npm</a> ·
20
+ <a href="FAQ.md">FAQ</a> ·
21
+ <a href="SECURITY.md">Security</a> ·
22
+ <a href="README_ZH.md">中文</a>
23
+ </p>
24
+
25
+ CodexFlow is an independent open-source project. It is not affiliated with, endorsed by, or sponsored by OpenAI. Codex, ChatGPT, and OpenAI are referenced only to explain compatibility and remain the property of their respective owner.
26
+
27
+ ## Install
28
+
29
+ Requirements:
30
+
31
+ - Node.js 20+
32
+ - A ChatGPT account with Apps / Developer Mode access
33
+ - One HTTPS route to your local machine when connecting ChatGPT from the web
34
+
35
+ Install the CLI:
36
+
37
+ ```bash
38
+ npm install -g @tarunspandit/codexflow
39
+ ```
40
+
41
+ Then run exactly one command from anywhere:
42
+
43
+ ```bash
44
+ codexflow
45
+ ```
46
+
47
+ CodexFlow discovers project folders from local Codex metadata, starts the local broker and Cloudflare tunnel, then prints and copies the Server URL. In ChatGPT, open:
48
+
49
+ ```text
50
+ Settings -> Security and login -> Developer mode: on
51
+ Settings -> Plugins -> Create
52
+ ```
53
+
54
+ Paste the Server URL and choose `Authentication: No Authentication / None`.
55
+ CodexFlow uses its own URL token.
56
+
57
+ ## What It Does
58
+
59
+ CodexFlow starts one local MCP server for all discovered projects. Each ChatGPT conversation chooses its own project and can then:
60
+
61
+ - read files and inspect the repo
62
+ - search code
63
+ - make scoped edits with `write`, `edit`, or guarded `apply_patch`
64
+ - run safe verification commands through `bash`
65
+ - review changed files with `show_changes`
66
+ - write handoff plans under `.ai-bridge`
67
+ - export a selected context bundle for model surfaces that cannot call tools
68
+
69
+ CodexFlow is not a hosted service, model proxy, quota bypass, account pool, or OS sandbox.
70
+ It connects your own ChatGPT session to your own local repo through the official Developer Mode / MCP app path.
71
+
72
+ ## Repository Analysis
73
+
74
+ CodexFlow builds a bounded repository map from local manifests, source declarations, imports, tests, and Git state. It provides:
75
+
76
+ - `inspect_workspace` for languages, project types, entrypoints, areas, symbols, and relationships
77
+ - optional structured `search` intents: `text`, `symbol`, `references`, and `impact`
78
+ - affected-area, risk, related-test, and focused-command recommendations in `show_changes`
79
+ - matching read-only terminal views:
80
+
81
+ ```bash
82
+ codexflow inspect --root /path/to/repo
83
+ codexflow review --root /path/to/repo
84
+ codexflow inspect --root /path/to/repo --json
85
+ ```
86
+
87
+ The analysis is deterministic and local. It uses confidence labels instead of claiming compiler precision, stays within configured file/byte/symbol limits, and falls back to normal lexical search and Git review when analysis is incomplete.
88
+
89
+ Set `CODEXFLOW_ANALYSIS=0` to disable repository analysis without changing the rest of the connector.
90
+
91
+ ## Normal Commands
92
+
93
+ ```bash
94
+ codexflow
95
+ codexflow --root /path/to/repo
96
+ codexflow status
97
+ codexflow status --json
98
+ codexflow doctor
99
+ codexflow connection-test --root /path/to/repo
100
+ codexflow settings
101
+ codexflow inspect
102
+ codexflow review
103
+ ```
104
+
105
+ Useful modes:
106
+
107
+ ```bash
108
+ codexflow --no-bash
109
+ codexflow --tool-mode minimal
110
+ codexflow --tool-mode full
111
+ codexflow --mode handoff
112
+ codexflow --mode pro
113
+ ```
114
+
115
+ If ChatGPT cannot create the plugin, run `codexflow connection-test`. It keeps
116
+ the normal read, tree, search, and skill tools, disables writes, bash, and tool
117
+ cards, and logs whether a request reached the local MCP endpoint.
118
+
119
+ Tool cards are opt in:
120
+
121
+ ```bash
122
+ CODEXFLOW_TOOL_CARDS=1 codexflow
123
+ ```
124
+
125
+ ## Public URL Options
126
+
127
+ ChatGPT web needs a public HTTPS Server URL. CodexFlow supports:
128
+
129
+ - Fast demo URL: `codexflow --tunnel cloudflare`
130
+ - Stable ngrok domain: `codexflow ngrok --hostname your-domain.ngrok-free.dev`
131
+ - Stable Cloudflare route: `codexflow stable --hostname codexflow.example.com --tunnel-name codexflow`
132
+ - Tailscale Funnel: `codexflow tailscale --hostname your-device.your-tailnet.ts.net`
133
+ - Local only: `codexflow --tunnel none`
134
+
135
+ Cloudflare quick tunnels honor `HTTPS_PROXY`, `ALL_PROXY`, or `HTTP_PROXY` when those env vars are set.
136
+
137
+ Stable modes should use a stable CodexFlow token:
138
+
139
+ ```bash
140
+ codexflow tailscale \
141
+ --hostname your-device.your-tailnet.ts.net \
142
+ --token keep-this-token-stable
143
+ ```
144
+
145
+ Tailscale Funnel must already be allowed for your tailnet. It requires MagicDNS, HTTPS certificates, and Funnel policy support. CodexFlow runs:
146
+
147
+ ```bash
148
+ tailscale funnel http://127.0.0.1:8787
149
+ ```
150
+
151
+ Then ChatGPT uses:
152
+
153
+ ```text
154
+ https://your-device.your-tailnet.ts.net/mcp?codexflow_token=keep-this-token-stable
155
+ ```
156
+
157
+ ## Safety Defaults
158
+
159
+ - Public tunnel mode requires a CodexFlow HTTP token.
160
+ - Generic writes are hidden unless `CODEXFLOW_WRITE_MODE=workspace`.
161
+ - Safe bash blocks broad shell patterns and secret/build/cache paths.
162
+ - `apply_patch` is workspace-scoped and rejects blocked paths, symlink patches, and secret-looking patch content.
163
+ - `show_changes` keeps a review checkpoint so repeated unchanged reviews collapse.
164
+ - Tool-card metadata is off unless `CODEXFLOW_TOOL_CARDS=1`.
165
+
166
+ Read [SECURITY.md](SECURITY.md) before exposing CodexFlow through any tunnel.
167
+
168
+ ## RAM And ChatGPT Memory
169
+
170
+ codexflow can reduce what it sends to ChatGPT. Current local fixes:
171
+
172
+ - binary-file checks scan with a reusable 64 KiB buffer instead of allocating the whole file
173
+ - ChatGPT tool-card structured payloads are compacted only for card output, not for normal tool data
174
+ - bash chat transcripts stay compact by default
175
+
176
+ That helps avoid oversized MCP/card payloads. It does not force Chrome, ChatGPT, or an old browser iframe to release memory that the client already holds. If the browser tab has already grown, reload the ChatGPT page or restart the browser.
177
+
178
+ ## Repo Context
179
+
180
+ codexflow uses explicit files, not hidden chat memory:
181
+
182
+ ```text
183
+ AGENTS.md
184
+ .ai-bridge/current-plan.md
185
+ .ai-bridge/agent-status.md
186
+ .ai-bridge/decisions.md
187
+ .ai-bridge/open-questions.md
188
+ .ai-bridge/execution-log.jsonl
189
+ ```
190
+
191
+ For non-tool model surfaces:
192
+
193
+ ```bash
194
+ codexflow --mode pro
195
+ ```
196
+
197
+ Or from a local checkout:
198
+
199
+ ```bash
200
+ codexflow pro-bundle --root /path/to/repo --copy
201
+ codexflow pro-apply --root /path/to/repo --file plan.md
202
+ ```
203
+
204
+ ## Handoff
205
+
206
+ ChatGPT can write a plan without executing a local agent:
207
+
208
+ ```bash
209
+ codexflow --mode handoff
210
+ ```
211
+
212
+ For scripts, CI, or a terminal without interactive controls, keep the server running with signals instead of the keyboard panel:
213
+
214
+ ```bash
215
+ codexflow --non-interactive
216
+ codexflow status --json
217
+ ```
218
+
219
+ Then you run execution locally:
220
+
221
+ ```bash
222
+ codexflow execute-handoff --agent codex --yes
223
+ codexflow watch-handoff --agent codex --yes
224
+ ```
225
+
226
+ `handoff_to_agent` is planning-only over MCP. CodexFlow does not expose arbitrary local agent execution as a remote ChatGPT tool.
227
+
228
+ ## Codex-style web chats across projects
229
+
230
+ One CodexFlow process and one tunnel can route many ChatGPT conversations to different local projects. ChatGPT supplies the model; CodexFlow supplies the repository, file, git, terminal, instructions, and skill tools. It never starts or resumes the Codex CLI.
231
+
232
+ ```bash
233
+ codexflow --tool-mode full \
234
+ --root /path/to/default-repo --allow-root /path/to/projects
235
+ ```
236
+
237
+ When CodexFlow is activated in a new ChatGPT conversation, `list_projects` opens a picker. It combines the default project, projects found below configured allowed roots, and recent project folders recorded in local Codex metadata. Choosing one calls `select_project` and binds that MCP conversation to the folder. Later file, search, edit, git, and bash calls can omit `workspace_id`; they route to the selected project. Other ChatGPT conversations keep independent selections through the same tunnel.
238
+
239
+ Project selection also advertises repository instructions, workspace/user/plugin skills, and configured MCP server names. The model can load applicable skills with `load_skill`. CodexFlow does not execute the Codex CLI or claim that these ChatGPT conversations are native Codex sessions.
240
+
241
+ No project registration is required. Local Codex session metadata supplies the project directories automatically; `--root` and `--allow-root` remain optional overrides.
242
+
243
+ ## Troubleshooting
244
+
245
+ Run:
246
+
247
+ ```bash
248
+ codexflow doctor
249
+ ```
250
+
251
+ Common fixes:
252
+
253
+ - Quick tunnel URL changed: rerun `codexflow` and update the ChatGPT app Server URL.
254
+ - Stable URL does not respond: check the tunnel provider first, then the CodexFlow token.
255
+ - ChatGPT cannot call tools in one model/chat: switch to a ChatGPT surface that supports Developer Mode app actions.
256
+ - Local port is busy: start another repo with `--port 8788`.
257
+ - Tool list looks stale: create a new ChatGPT app entry or change the connector URL token.
258
+ - Check whether the launcher is still running with `codexflow status`; a stale runtime record means the original process exited.
259
+
260
+ ## Development
261
+
262
+ ```bash
263
+ npm install
264
+ npm run build
265
+ npm run smoke
266
+ npm run stress
267
+ ```
268
+
269
+ Useful release checks:
270
+
271
+ ```bash
272
+ npm run build
273
+ npm run smoke
274
+ CODEXFLOW_TOOL_CARDS=1 npm run smoke
275
+ npm audit --audit-level=high
276
+ npm pack --dry-run
277
+ git diff --check
278
+ ```
279
+
280
+ ## Docs
281
+
282
+ - [Product website](https://tarunspandit.github.io/codexflow/)
283
+ - [GitHub repository](https://github.com/tarunspandit/codexflow)
284
+ - [FAQ](FAQ.md)
285
+ - [Security](SECURITY.md)
286
+ - [Stable URL guide](DOMAIN_SETUP.md)
287
+ - [Changelog](CHANGELOG.md)