Commit Graph

1114 Commits

Author SHA1 Message Date
Michael Bolin
3d4700832f merge commit for archive created by Sapling 2025-05-13 20:16:24 -07:00
Michael Bolin
ab8b7d4d13 fix: change EventMsg enum so every variant takes a single struct 2025-05-13 20:16:10 -07:00
Michael Bolin
12ff868b98 Merge 001a24460d into sapling-pr-archive-bolinfest 2025-05-13 20:08:52 -07:00
Michael Bolin
001a24460d fix: change EventMsg enum so every variant takes a single struct 2025-05-13 20:08:43 -07:00
Michael Bolin
e6c206d19d fix: tighten up some logic around session timestamps and ids (#922)
* update `SessionConfigured` event to include the UUID for the session
* show the UUID in the Rust TUI
* use local timestamps in log files instead of UTC
* include timestamps in log file names for easier discovery
2025-05-13 19:22:16 -07:00
Michael Bolin
2a7f2c7d16 Merge 1723bffa19 into sapling-pr-archive-bolinfest 2025-05-13 19:17:17 -07:00
Michael Bolin
1723bffa19 fix: test_dev_null_write() was not using echo as intended 2025-05-13 19:17:10 -07:00
Michael Bolin
f2cf8967f3 Merge 16be257bcc into sapling-pr-archive-bolinfest 2025-05-13 18:07:58 -07:00
Michael Bolin
16be257bcc fix: use local timestamps in log files instead of UTC 2025-05-13 18:07:51 -07:00
Michael Bolin
3c03c25e56 feat: introduce --profile for Rust CLI (#921)
This introduces a much-needed "profile" concept where users can specify
a collection of options under one name and then pass that via
`--profile` to the CLI.

This PR introduces the `ConfigProfile` struct and makes it a field of
`CargoToml`. It further updates
`Config::load_from_base_config_with_overrides()` to respect
`ConfigProfile`, overriding default values where appropriate. A detailed
unit test is added at the end of `config.rs` to verify this behavior.

Details on how to use this feature have also been added to
`codex-rs/README.md`.
2025-05-13 16:52:52 -07:00
Michael Bolin
395d932531 Merge b42b59e45e into sapling-pr-archive-bolinfest 2025-05-13 16:44:42 -07:00
Michael Bolin
b42b59e45e feat: introduce --profile for Rust CLI 2025-05-13 16:44:36 -07:00
Adeeb
ae809f3721 restructure flake for codex-rs (#888)
Right now since the repo is having two different implementations of
codex, flake was updated to work with both typescript implementation and
rust implementation
2025-05-13 13:08:42 -07:00
Michael Bolin
a786c1d188 feat: auto-approve nl and support piping to sed (#920)
Auto-approved:

```
["nl", "-ba", "README.md"]
["sed", "-n", "1,200p", "filename.txt"]
["bash", "-lc", "sed -n '1,200p' filename.txt"]
["bash", "-lc", "nl -ba README.md | sed -n '1,200p'"]
```

Not auto approved:

```
["sed", "-n", "'1,200p'", "filename.txt"]
["sed", "-n", "1,200p", "file1.txt", "file2.txt"]
```
2025-05-13 13:06:35 -07:00
Michael Bolin
ef0bd3b1bf Merge a2fa531c14 into sapling-pr-archive-bolinfest 2025-05-13 13:04:23 -07:00
Michael Bolin
a2fa531c14 feat: auto-approve nl and support piping to sed 2025-05-13 13:04:18 -07:00
Michael Bolin
fae1491d09 Merge 9603bb3bdc into sapling-pr-archive-bolinfest 2025-05-13 13:04:14 -07:00
Michael Bolin
9603bb3bdc feat: auto-approve nl and support piping to sed 2025-05-13 13:04:07 -07:00
Michael Bolin
0ac7e8d55b fix: tweak the label for citations for better rendering (#919)
Adds a space so that sequential citations have some more breathing room.

As I had to update the tests for this change, I also introduced a
`toDiffableString()` helper to make the test easier to update as we make
formatting changes to the output.
2025-05-13 12:46:21 -07:00
Michael Bolin
3893834a8c merge commit for archive created by Sapling 2025-05-13 12:41:34 -07:00
Michael Bolin
a3f10b8798 fix: tweak the label for citations for better rendering 2025-05-13 12:41:26 -07:00
Michael Bolin
1ff3e14d5a fix: patch in #366 and #367 for marked-terminal (#916)
This PR uses [`pnpm
patch`](https://www.petermekhaeil.com/til/pnpm-patch/) to pull in the
following proposed fixes for `marked-terminal`:

* https://github.com/mikaelbr/marked-terminal/pull/366
* https://github.com/mikaelbr/marked-terminal/pull/367

This adds a substantial test to `codex-cli/tests/markdown.test.tsx` to
verify the new behavior.

Note that one of the tests shows two citations being split across a line
even though the rendered version would fit comfortably on one line.
Changing this likely requires a subtle fix to `marked-terminal` to
account for "rendered length" when determining line breaks.
2025-05-13 12:29:17 -07:00
Michael Bolin
b96cf39f79 merge commit for archive created by Sapling 2025-05-13 12:21:38 -07:00
Michael Bolin
1dcc200b50 fix: patch in #366 and #367 for marked-terminal 2025-05-13 12:21:32 -07:00
Michael Bolin
8a297e4623 merge commit for archive created by Sapling 2025-05-13 12:20:16 -07:00
Michael Bolin
735a7eefd3 fix: patch in #366 and #367 for marked-terminal 2025-05-13 12:20:07 -07:00
Michael Bolin
dd354e2134 fix: remember to set lastIndex = 0 on shared RegExp (#918)
I had not observed an issue in the wild because of this yet, but it
feels like it was only a matter of time...
2025-05-13 12:01:06 -07:00
Michael Bolin
1f177a209b Merge 0e470f424b into sapling-pr-archive-bolinfest 2025-05-13 11:58:38 -07:00
Michael Bolin
0e470f424b fix: remember to set lastIndex = 0 on shared RegExp 2025-05-13 11:58:26 -07:00
Michael Bolin
2ae15cad9e merge commit for archive created by Sapling 2025-05-13 10:51:24 -07:00
Michael Bolin
1963882fe4 fix: patch in #366 and #367 for marked-terminal 2025-05-13 10:51:14 -07:00
Michael Bolin
1e12b2a511 Merge 70e9ff2fd7 into sapling-pr-archive-bolinfest 2025-05-13 10:27:54 -07:00
Michael Bolin
70e9ff2fd7 fix: patch in #366 and #367 for marked-terminal 2025-05-13 10:27:42 -07:00
Michael Bolin
557f608f25 fix: add support for fileOpener in config.json (#911)
This PR introduces the following type:

```typescript
export type FileOpenerScheme = "vscode" | "cursor" | "windsurf";
```

and uses it as the new type for a `fileOpener` option in `config.json`.
If set, this will be used to linkify file annotations in the output
using the URI-based file opener supported in VS Code-based IDEs.

Currently, this does not pass:

Updated `codex-cli/tests/markdown.test.tsx` to verify the new behavior.
Note it required mocking `supports-hyperlinks` and temporarily modifying
`chalk.level` to yield the desired output.
2025-05-13 09:45:46 -07:00
Michael Bolin
f86a4749f4 Merge 86759c99ec into sapling-pr-archive-bolinfest 2025-05-13 09:34:37 -07:00
Michael Bolin
86759c99ec fix: add support for fileOpener in config.json 2025-05-13 09:34:31 -07:00
Michael Bolin
75fe7bb887 merge commit for archive created by Sapling 2025-05-13 09:32:43 -07:00
Michael Bolin
70daeb45ef fix: add support for fileOpener in config.json 2025-05-13 09:32:37 -07:00
Michael Bolin
d079bce3eb merge commit for archive created by Sapling 2025-05-13 09:32:20 -07:00
Michael Bolin
15e6c36f74 fix: add support for fileOpener in config.json 2025-05-13 09:32:13 -07:00
Michael Bolin
bfb522b493 merge commit for archive created by Sapling 2025-05-13 09:29:37 -07:00
Michael Bolin
1427b6df06 fix: add support for fileOpener in config.json 2025-05-13 09:29:32 -07:00
Michael Bolin
0a92c7228c merge commit for archive created by Sapling 2025-05-13 09:28:39 -07:00
Michael Bolin
3a8039886f fix: add support for fileOpener in config.json 2025-05-13 09:28:34 -07:00
Michael Bolin
e9809cec05 Merge fa138db8fb into sapling-pr-archive-bolinfest 2025-05-12 23:41:15 -07:00
Michael Bolin
fa138db8fb fix: add support for fileOpener in config.json 2025-05-12 23:41:06 -07:00
Michael Bolin
05bb5d7d46 fix: always load version from package.json at runtime (#909)
Note the high-level motivation behind this change is to avoid the need
to make temporary changes in the source tree in order to cut a release
build since that runs the risk of leaving things in an inconsistent
state in the event of a failure. The existing code:

```
import pkg from "../../package.json" assert { type: "json" };
```

did not work as intended because, as written, ESBuild would bake the
contents of the local `package.json` into the release build at build
time whereas we want it to read the contents at runtime so we can use
the `package.json` in the tree to build the code and later inject a
modified version into the release package with a timestamped build
version.

Changes:

* move `CLI_VERSION` out of `src/utils/session.ts` and into
`src/version.ts` so `../package.json` is a correct relative path both
from `src/version.ts` in the source tree and also in the final
`dist/cli.js` build output
* change `assert` to `with` in `import pkg` as apparently `with` became
standard in Node 22
* mark `"../package.json"` as external in `build.mjs` so the version is
not baked into the `.js` at build time

After using `pnpm stage-release` to build a release version, if I use
Node 22.0 to run Codex, I see the following printed to stderr at
startup:

```
(node:71308) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
```

Note it is a warning and does not prevent Codex from running.

In Node 22.12, the warning goes away, but the warning still appears in
Node 22.11. For Node 22, 22.15.0 is the current LTS version, so LTS
users will not see this.

Also, something about moving the definition of `CLI_VERSION` caused a
problem with the mocks in `check-updates.test.ts`. I asked Codex to fix
it, and it came up with the change to the test configs. I don't know
enough about vitest to understand what it did, but the tests seem
healthy again, so I'm going with it.
2025-05-12 21:27:15 -07:00
Michael Bolin
3287fa3a94 merge commit for archive created by Sapling 2025-05-12 21:11:38 -07:00
Michael Bolin
8e1450fd52 fix: always load version from package.json at runtime 2025-05-12 21:11:32 -07:00
Michael Bolin
0371b57292 Merge a741d32013 into sapling-pr-archive-bolinfest 2025-05-12 21:08:42 -07:00