From f0f4dac33fc45893b7aaa64e7a0e86b9aed91255 Mon Sep 17 00:00:00 2001 From: Dalvin Josias Sejour Date: Sun, 9 Nov 2025 01:09:59 -0500 Subject: [PATCH 1/2] Create Foundations for Active Prompt Engine + Contributing MD This PR setups the foundations for the Active Prompt data model for Phase 2 of Active Agent. This uses Rails Engines and adds test to be able to setup the initial foundation. --- CONTRIBUTING.MD | 44 +++++++++++++++++++++++++++++++ lib/active_prompt.rb | 7 +++++ lib/active_prompt/engine.rb | 26 ++++++++++++++++++ lib/active_prompt/version.rb | 5 ++++ lib/activeagent.rb | 1 + test/active_prompt_engine_test.rb | 21 +++++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 CONTRIBUTING.MD create mode 100644 lib/active_prompt.rb create mode 100644 lib/active_prompt/engine.rb create mode 100644 lib/active_prompt/version.rb create mode 100644 test/active_prompt_engine_test.rb diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.MD new file mode 100644 index 00000000..af5eff13 --- /dev/null +++ b/CONTRIBUTING.MD @@ -0,0 +1,44 @@ +## Contributing to Active Agent + +Thanks for your interest in improving Active Agent! This guide covers the basics for setting up your environment, running tests, linting, and doing a quick local verification that things work. + +### Prerequisites +- Ruby with Bundler installed +- Google Chrome/Chromium (recommended for system tests via Cuprite) + +### Setup +git clone https://github.com/activeagents/activeagent.git +cd activeagent +bundle install + +- Full suite: + bin/test + # or + bundle exec rake test + - Single file: + + ruby -Itest test/generation_test.rb + +- Tests use Rails’ plugin test runner and a bundled dummy app under `test/dummy`. +- External API calls are recorded with VCR, so you shouldn’t need API keys to run the suite. + +### Linting +bin/lint # check +bin/lint --fix # safe auto-correct +bin/lint -A # auto-correct including unsafe### Quick local verification + +### Making changes +1. Create a feature branch. +2. Add tests for your change. +3. Run `bin/test` and `bin/lint` until both pass cleanly. +4. Open a pull request with a clear description of the change and motivation. + +### Recording or updating VCR cassettes (optional) +If you need to re-record HTTP interactions for specific tests, set the necessary API keys in your environment and run only those tests. Please avoid committing sensitive data; VCR cassettes should only contain sanitized request/response data. + +### Community and support +- Documentation: https://docs.activeagents.ai +- Issues: https://github.com/activeagents/activeagent/issues +- Discord: https://discord.com/invite/JRUxkkHKmh + +We appreciate your contributions—thank you! \ No newline at end of file diff --git a/lib/active_prompt.rb b/lib/active_prompt.rb new file mode 100644 index 00000000..77166e20 --- /dev/null +++ b/lib/active_prompt.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require "active_prompt/version" +require "active_prompt/engine" if defined?(Rails) + +module ActivePrompt +end diff --git a/lib/active_prompt/engine.rb b/lib/active_prompt/engine.rb new file mode 100644 index 00000000..82069e7a --- /dev/null +++ b/lib/active_prompt/engine.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require "rails" + +module ActivePrompt + class Engine < ::Rails::Engine + isolate_namespace ActivePrompt + + initializer "active_prompt.assets.paths_and_precompile" do |app| + if app.config.respond_to?(:assets) + app.config.assets.paths << root.join("app", "assets") + app.config.assets.precompile += %w[ + active_prompt/* + ] + end + end + + initializer "active_prompt.append_migrations" do |app| + unless app.root.to_s.start_with?(root.to_s) + config.paths["db/migrate"].expanded.each do |expanded_path| + app.config.paths["db/migrate"] << expanded_path + end + end + end + end +end diff --git a/lib/active_prompt/version.rb b/lib/active_prompt/version.rb new file mode 100644 index 00000000..2594fc06 --- /dev/null +++ b/lib/active_prompt/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module ActivePrompt + VERSION = "0.1.0" +end diff --git a/lib/activeagent.rb b/lib/activeagent.rb index 51714549..1b14364e 100644 --- a/lib/activeagent.rb +++ b/lib/activeagent.rb @@ -1 +1,2 @@ require "active_agent" +require "active_prompt" diff --git a/test/active_prompt_engine_test.rb b/test/active_prompt_engine_test.rb new file mode 100644 index 00000000..34dcbd7f --- /dev/null +++ b/test/active_prompt_engine_test.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require "test_helper" +require "active_prompt" + +class ActivePromptEngineTest < ActiveSupport::TestCase + test "ActivePrompt module loads with version" do + assert defined?(ActivePrompt), "ActivePrompt should be defined" + assert_kind_of String, ActivePrompt::VERSION + refute_empty ActivePrompt::VERSION + end + + test "engine is defined and inherits from Rails::Engine" do + assert defined?(ActivePrompt::Engine), "ActivePrompt::Engine should be defined" + assert ActivePrompt::Engine < Rails::Engine + end + + test "engine namespace is isolated" do + assert_equal ActivePrompt, ActivePrompt::Engine.railtie_namespace + end +end From 1514661cc4f19f4f467a55e907cf75f0c9dec4d4 Mon Sep 17 00:00:00 2001 From: Dalvin Josias Sejour Date: Sun, 9 Nov 2025 01:26:37 -0500 Subject: [PATCH 2/2] Update CONTRIBUTING.MD --- CONTRIBUTING.MD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.MD index af5eff13..62fd5711 100644 --- a/CONTRIBUTING.MD +++ b/CONTRIBUTING.MD @@ -23,9 +23,9 @@ bundle install - External API calls are recorded with VCR, so you shouldn’t need API keys to run the suite. ### Linting -bin/lint # check -bin/lint --fix # safe auto-correct -bin/lint -A # auto-correct including unsafe### Quick local verification +- bin/lint # check +- bin/lint --fix # safe auto-correct +- bin/lint -A # auto-correct including unsafe### Quick local verification ### Making changes 1. Create a feature branch.