Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .codex/build_all_targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

CODEX_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd $CODEX_DIR

pushd ..
just build-extension
popd
2 changes: 2 additions & 0 deletions .codex/deps_src/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory contains cloned repositories with source code for some
of the development dependencies. This might be useful as a reference.
9 changes: 9 additions & 0 deletions .codex/internet_resources/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

DOWNLOADS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd $DOWNLOADS_DIR

# Download the specification of the CodeTracer trace json format.
# Read the trace_json_spec.md file to understand what json records
# should be produced by the tracers in this repo.
wget https://raw.githubusercontent.com/metacraft-labs/runtime_tracing/refs/heads/master/docs/trace_json_spec.md
14 changes: 14 additions & 0 deletions .codex/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

CODEX_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd $CODEX_DIR

apt-get update
apt-get install -y --no-install-recommends just

pushd deps_src
git clone https://github.com/metacraft-labs/runtime_tracing
popd

./build_all_targets.sh

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
!test/benchmarks/fixtures/*.json
test/tmp/
.direnv/
pkg/
40 changes: 38 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
# Instructions for Codex

To build the Rust native extension, execute:

```
just build-extension
```

To run the test suite, execute:

```
ruby -Itest test/test_tracer.rb
just test
```

The tester executes a number of sample programs in `test/programs` and compares their outputs to the fixtures in `test/fixtures`.

To run the benchmark, execute:

```
ruby test/benchmarks/run_benchmark.rb heavy_work
just bench
```

# You don't have access to the internet

During development, certain commands will fail because you don't have
access to the intenet.

The script `.codex/internet_resources/download.sh` is executed before
your development session stars while your computer is still connected
to the internet.

You can examine this script to see what kind of internet resources
have been downloaded for offline use. If it's difficult for you to
achieve a task without access to additional internet resources, you
can always propose a PR that modifies the download.sh script instead
of completing your main task.

Downloading development dependencies may also fail due to the lack of
internet connectivity. We are trying to maintain the script `.codex/build_all_targets.sh`
that is also executed before your development session starts while
your computer is still connected to the internet. It tries to run
all build commands that need development dependencies in order to
cache the dependencies for offline use. Please propose changes to
this script when you introduce new build targets with dependencies.

When you need to consult the documentation or source code modules
for a particular dependency, always try to find where this dependency
have been downloaded and try to access the necessary files through
the file system (i.e. depending on the programming language, the
operating system and the package manager being used, they should
be in their standard location).

# Code quality guidelines

- Strive to achieve high code quality.
Expand Down
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ test:

bench name="heavy_work":
ruby test/benchmarks/run_benchmark.rb {{name}}

build-extension:
cargo build --release --manifest-path ext/native_tracer/Cargo.toml
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rb_sys/extensiontask'

RbSys::ExtensionTask.new('codetracer_ruby_recorder') do |ext|
ext.ext_dir = 'ext/native_tracer'
ext.lib_dir = 'src'
ext.gem_spec = Gem::Specification.load('codetracer-ruby-recorder.gemspec')
end
17 changes: 17 additions & 0 deletions codetracer-ruby-recorder.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Gem::Specification.new do |spec|
spec.name = 'codetracer-ruby-recorder'
spec.version = '0.1.0'
spec.authors = ['Metacraft Labs']
spec.email = ['info@metacraft-labs.com']

spec.summary = 'CodeTracer Ruby recorder with native extension'
spec.description = 'Ruby tracer that records execution steps via a Rust native extension.'
spec.license = 'MIT'
spec.homepage = 'https://github.com/metacraft-labs/codetracer-ruby-recorder'

spec.files = Dir['src/**/*', 'ext/native_tracer/**/{Cargo.toml,*.rs}', 'ext/native_tracer/extconf.rb', 'README.md', 'LICENSE']
spec.require_paths = ['src']
spec.extensions = ['ext/native_tracer/extconf.rb']

spec.add_development_dependency 'rb_sys', '~> 0.9'
end
1 change: 1 addition & 0 deletions ext/native_tracer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
Loading