Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .captain/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-suites:
better-context-bun:
command: bun test --reporter=junit --reporter-outfile bun.xml
results:
language: JavaScript
framework: bun
path: bun.xml
retries:
command: bun test '{{ file }}' --test-name-pattern '{{ testNamePattern }}' --reporter=junit --reporter-outfile bun.xml
78 changes: 78 additions & 0 deletions .rwx/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
on:
cli:
init:
commit-sha: ${{ event.git.sha }}

base:
image: ubuntu:24.04
config: rwx/base 1.0.0
arch: ${{ init.arch }}

aliases:
shared-env: &shared-env # TODO: These must be set somewhere we can't see
PUBLIC_CONVEX_URL: https://example.com
PUBLIC_CLERK_PUBLISHABLE_KEY: abc123

tasks:
- key: code
call: git/clone 2.0.6
with:
repository: https://github.com/davis7dotsh/better-context.git
ref: ${{ init.commit-sha }}

- key: bun-version
use: code
run: jq -r '.packageManager | split("@")[1]' package.json > ${RWX_VALUES}/version
filter:
- package.json

- key: bun
run: |
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}"
echo "${HOME}/.bun" > "${RWX_ENV}/BUN_INSTALL"
echo "${HOME}/.bun/bin" > "${RWX_ENV}/PATH"
~/.bun/bin/bun --print process.version | tr -d 'v' > ${RWX_VALUES}/node-version
env:
BUN_VERSION: ${{ tasks.bun-version.values.version}}

- key: node
use: bun
call: nodejs/install 1.1.13
with:
node-version: ${{ tasks.bun.values.node-version }}

- key: bun-install
use: [code, bun, node]
# TODO: add --frozen-lockfile back once packages are updated
run: bun install
filter:
- bun.lock
- bunfig.toml
- package.json
- apps/**/package.json
- packages/**/package.json

- key: lint
use: bun-install
run: bun run lint:all

- key: install-mintlify
use: bun-install
run: bun add -d @mintlify/cli

- key: bun-check
use: install-mintlify
run: bun run check:all
env: *shared-env

- key: bun-build
use: bun-check
run: bun run build:all
env: *shared-env

- key: captain
call: rwx/install-captain 1.1.5

- key: test
use: [captain, bun-install]
run: captain run better-context-bun
24 changes: 24 additions & 0 deletions .rwx/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
github:
push:
if: ${{ event.git.branch == 'main' }}
init:
ref: ${{ event.git.ref }}
commit-sha: ${{ event.git.sha }}

base:
image: ubuntu:24.04
config: rwx/base 1.0.0

tasks:
- key: ci-x86_64
call: ${{ run.dir }}/ci.yml
init:
arch: x86_64
commit-sha: ${{ init.commit-sha }}

- key: ci-arm64
call: ${{ run.dir }}/ci.yml
init:
arch: arm64
commit-sha: ${{ init.commit-sha }}
73 changes: 73 additions & 0 deletions .rwx/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
on:
cli:
init:
commit-sha: ${{ event.git.sha }}
pr-number: "0"
github:
pull_request:
init:
commit-sha: ${{ event.git.sha }}
pr-number: ${{ event.github.pull_request.number }}

base:
image: ubuntu:24.04
config: rwx/base 1.0.0

concurrency-pools:
- id: davis7dotsh/better-context:pull-request:${{ init.pr-number }}
if: ${{ init.pr-number != "0" }}
capacity: 1
on-overflow: cancel-running

tasks:
- key: code
call: git/clone 2.0.6
with:
repository: https://github.com/davis7dotsh/better-context.git
ref: ${{ init.commit-sha }}

- key: bun-version
use: code
run: jq -r '.packageManager | split("@")[1]' package.json > ${RWX_VALUES}/version
filter:
- package.json

- key: bun
run: |
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}"
echo "${HOME}/.bun" > "${RWX_ENV}/BUN_INSTALL"
echo "${HOME}/.bun/bin" > "${RWX_ENV}/PATH"
~/.bun/bin/bun --print process.version | tr -d 'v' > ${RWX_VALUES}/node-version
env:
BUN_VERSION: ${{ tasks.bun-version.values.version}}

- key: node
use: bun
call: nodejs/install 1.1.13
with:
node-version: ${{ tasks.bun.values.node-version }}

- key: bun-install
use: [code, bun, node]
run: bun install
filter:
- bun.lock
- bunfig.toml
- package.json
- apps/**/package.json
- packages/**/package.json

- key: lint
use: bun-install
run: bun run lint:all

- key: install-mintlify
use: bun-install
run: bun add -d @mintlify/cli

- key: check
use: install-mintlify
run: bun run check:all
env:
PUBLIC_CONVEX_URL: https://example.com
PUBLIC_CLERK_PUBLISHABLE_KEY: abc123
Comment on lines +68 to +73
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests not run on PRs

The PR workflow ends with the check (type-check) step and never calls the test task. By contrast, .rwx/ci.yml does run tests on the main branch. This means broken tests can be merged through a PR without being caught until after they land on main.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .rwx/pr.yml
Line: 68-73

Comment:
**Tests not run on PRs**

The PR workflow ends with the `check` (type-check) step and never calls the `test` task. By contrast, `.rwx/ci.yml` does run tests on the main branch. This means broken tests can be merged through a PR without being caught until after they land on `main`.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex

8 changes: 6 additions & 2 deletions apps/sandbox/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ async function main(): Promise<void> {
console.log('\nRun sandboxes with: bun sandbox');
}

// Only run when executed directly, not when imported
if (import.meta.main) {
// Only run when executed directly, not when imported.
const mainModuleUrl =
process.argv[1] === undefined ? undefined : `file://${encodeURI(process.argv[1])}`;
const isMainModule = mainModuleUrl !== undefined && import.meta.url === mainModuleUrl;

if (isMainModule) {
main().catch((error) => {
console.error('Error:', error);
process.exit(1);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"build:cli": "turbo build --filter=btca",
"build:web": "turbo build --filter=@btca/web",
"check:all": "turbo check",
"lint:all": "turbo lint",
"check:docs": "turbo check --filter=@btca/docs",
"check:cli": "turbo check --filter=btca",
"check:web": "turbo check --filter=@btca/web",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"format": {
"dependsOn": ["^format"]
},
"lint": {
"dependsOn": ["^lint"]
},
"check": {
"dependsOn": ["^check"]
},
Expand Down
Loading