source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | config/application.rb | Ruby | mit | 204 | master | 1,944 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module CafeTownsendAngularRails
class Application < Rails::Application
# Settings in config/en... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | config/initializers/secret_token.rb | Ruby | mit | 204 | master | 678 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | config/environments/test.rb | Ruby | mit | 204 | master | 1,662 | CafeTownsendAngularRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch spac... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | config/environments/production.rb | Ruby | mit | 204 | master | 3,267 | CafeTownsendAngularRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing bot... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | config/environments/development.rb | Ruby | mit | 204 | master | 1,209 | CafeTownsendAngularRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to ... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | db/seeds.rb | Ruby | mit | 204 | master | 1,237 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | db/schema.rb | Ruby | mit | 204 | master | 1,187 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | db/migrate/20140126143356_create_employees.rb | Ruby | mit | 204 | master | 234 | class CreateEmployees < ActiveRecord::Migration
def change
create_table :employees do |t|
t.string :first_name
t.string :last_name
t.string :email
t.date :start_date
t.timestamps
end
end
end |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | app/controllers/application_controller.rb | Ruby | mit | 204 | master | 360 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_filter :render_single_page
private
def ensure_authenticated
if session[:user_id].blank?
render :json => { authorized: false }
end
end
def render_single_page
render 'layouts/application' if ... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | app/controllers/sessions_controller.rb | Ruby | mit | 204 | master | 500 | class SessionsController < ApplicationController
respond_to :json
# POST /sessions
def create
user = User.find_by(name: params[:name])
if user && user.authenticate(params[:password])
session[:user_id] = user.id
render json: { user: user, authorized: 'true' }
else
#raise StandardErr... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | app/controllers/employees_controller.rb | Ruby | mit | 204 | master | 1,079 | class EmployeesController < ApplicationController
before_filter :ensure_authenticated
before_filter :set_employee, :except => [:index, :create]
respond_to :json
# GET /employees
# GET /employees.json
def index
@employees = Employee.all
end
# GET /employees/new
def new
end
# GET /employees... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | app/models/employee.rb | Ruby | mit | 204 | master | 230 | class Employee < ActiveRecord::Base
validates_presence_of :first_name, on: :create
validates_presence_of :last_name, on: :create
validates_presence_of :email, on: :create
validates_presence_of :start_date, on: :create
end |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/teaspoon_env.rb | Ruby | mit | 204 | master | 8,545 | # Set RAILS_ROOT and load the environment if it's not already loaded.
unless defined?(Rails)
ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
require File.expand_path("../../config/environment", __FILE__)
end
Teaspoon.configure do |config|
# Determines where the Teaspoon routes will be mounted. Changing... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/spec_helper.rb | Ruby | mit | 204 | master | 1,062 | require 'rubygems'
require 'database_cleaner'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.infer_ba... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/controllers/sessions_controller_spec.rb | Ruby | mit | 204 | master | 1,789 | require 'spec_helper'
describe SessionsController, :type => :controller do
let!(:user_created) { create(:user) } # saved in db
before :each do
# avoid rendering html of single page app (RSpec only)
request.env["HTTP_ACCEPT"] = "application/json"
end
# create
# -------------------------------------... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/controllers/employees_controller_spec.rb | Ruby | mit | 204 | master | 2,595 | require 'spec_helper'
describe EmployeesController, :type => :controller do
let!(:employee_built) { build(:employee) } # saved in memory only
let!(:employee_created) { create(:employee) } # saved in db
let(:valid_attributes) { attributes_for(:employee) }
let(:invalid_attributes) { {halli: 'galli'} }
before... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/models/employee_spec.rb | Ruby | mit | 204 | master | 658 | require 'spec_helper'
describe 'Employee' do
it 'should be valid' do
expect(build(:employee)).to be_valid
end
it "should invalid without a first name" do
expect(build(:employee, first_name: '')).to_not be_valid
end
it "should invalid without a last name" do
expect(build(:employee, last_name: ''... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/models/user_spec.rb | Ruby | mit | 204 | master | 657 | require 'spec_helper'
describe 'User' do
context "valid params" do
it 'build an user' do
user = build(:user)
expect(user).to be_valid
end
end
context "invalid params" do
it "without a password" do
user = build(:user, password: '')
expect(user).to_not be_valid
end
it ... |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/factories/users.rb | Ruby | mit | 204 | master | 210 | require 'faker'
FactoryGirl.define do
fake_password = Faker::Lorem.words(5)
factory :user do
name { Faker::Name.first_name }
password fake_password
password_confirmation fake_password
end
end |
github | sectore/CafeTownsend-Angular-Rails | https://github.com/sectore/CafeTownsend-Angular-Rails | spec/factories/employees.rb | Ruby | mit | 204 | master | 232 | require 'faker'
FactoryGirl.define do
factory :employee do
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
email { Faker::Internet.email }
start_date { Date.today-rand(10_000) }
end
end |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | sublayer.gemspec | Ruby | mit | 204 | main | 1,871 | # frozen_string_literal: true
require_relative "lib/sublayer/version"
Gem::Specification.new do |spec|
spec.name = "sublayer"
spec.version = Sublayer::VERSION
spec.authors = ["Scott Werner"]
spec.email = ["scott@sublayer.com"]
spec.license = "MIT"
spec.summary = "A model-agnostic Ruby GenerativeAI DSL an... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/spec_helper.rb | Ruby | mit | 204 | main | 1,232 | # frozen_string_literal: true
require "dotenv/load"
unless ENV["OPENAI_API_KEY"] && ENV["ANTHROPIC_API_KEY"] && ENV["GEMINI_API_KEY"]
puts <<~EOS
Some API keys are missing from the environment.
You can run `bin/setup` to configure dummy API keys.
If you need to add or update any VCR cassettes then you w... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/logging/json_logger_spec.rb | Ruby | mit | 204 | main | 670 | require "spec_helper"
require "tempfile"
RSpec.describe Sublayer::Logging::JsonLogger do
let(:message) { "Test message" }
let(:data) { { key: "value" } }
let(:log_file) { Tempfile.new("sublayer_test_log") }
let(:logger) { described_class.new(log_file.path) }
after { log_file.unlink }
it "logs messages in... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/logging/null_logger_spec.rb | Ruby | mit | 204 | main | 310 | require "spec_helper"
RSpec.describe Sublayer::Logging::NullLogger do
let(:message) { "Test message" }
let(:data) { { key: "value" } }
let(:logger) { described_class.new }
it "does not produce any output" do
expect {
logger.log(:info, message, data)
}.not_to output.to_stdout
end
end |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/logging/debug_logger_spec.rb | Ruby | mit | 204 | main | 606 | require "spec_helper"
RSpec.describe Sublayer::Logging::DebugLogger do
let(:message) { "Test message" }
let(:data) { { key: "value" } }
let(:logger) { described_class.new }
it "outputs messages to stdout" do
expect {
logger.log(:info, message, data)
}.to output(/\[.*\] INFO: #{message}/).to_stdo... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/agents/base_spec.rb | Ruby | mit | 204 | main | 1,726 | require "spec_helper"
RSpec.describe Sublayer::Agents::Base do
let(:test_agent_class) do
Class.new(described_class) do
trigger_on_files_changed { ["test_file.txt"] }
goal_condition { @goal_reached }
check_status { @status_checked = true }
step { @step_taken = true }
attr_accessor :... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/agents/rspec_agent_spec.rb | Ruby | mit | 204 | main | 3,783 | require "spec_helper"
require "agents/examples/rspec_agent"
RSpec.describe RSpecAgent do
let!(:run_command_action) { class_double("Sublayer::Actions::RunTestCommandAction").as_stubbed_const }
let!(:modified_implementation_generator) { class_double("Sublayer::Generators::ModifiedImplementationToPassTestsGenerator"... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/agents/examples/rspec_agent.rb | Ruby | mit | 204 | main | 1,023 | class RSpecAgent < Sublayer::Agents::Base
def initialize(implementation_file_path:, test_file_path:)
@implementation_file_path = implementation_file_path
@test_file_path = test_file_path
@tests_passing = false
end
trigger_on_files_changed { [@implementation_file_path, @test_file_path] }
goal_condi... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/triggers/file_change_spec.rb | Ruby | mit | 204 | main | 1,086 | require "spec_helper"
RSpec.describe Sublayer::Triggers::FileChange do
let(:test_agent) { double("Agent") }
let(:block) { -> { ["file1.txt", "file2.txt"] } }
let(:trigger) { described_class.new(&block) }
describe "#initialize" do
it "stores the provided block" do
expect(trigger.instance_variable_get... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/triggers/base_spec.rb | Ruby | mit | 204 | main | 485 | require "spec_helper"
RSpec.describe Sublayer::Triggers::Base do
let(:test_trigger) { described_class.new }
let(:test_agent) { double("Agent") }
describe "#setup" do
it "raises NotImplementedError" do
expect { test_trigger.setup(test_agent) }.to raise_error(NotImplementedError)
end
end
descri... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/providers/claude_spec.rb | Ruby | mit | 204 | main | 2,973 | require "spec_helper"
RSpec.describe Sublayer::Providers::Claude do
let(:basic_output_adapter) {
Sublayer::Components::OutputAdapters.create(
type: :single_string,
name: "the_answer",
description: "The answer to the given question"
).extend(Sublayer::Components::OutputAdapters::Formattable)... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/providers/gemini_spec.rb | Ruby | mit | 204 | main | 1,627 | require "spec_helper"
RSpec.describe Sublayer::Providers::Gemini do
let(:basic_output_adapter) {
Sublayer::Components::OutputAdapters.create(
type: :single_string,
name: "the_answer",
description: "The answer to the given question"
).extend(Sublayer::Components::OutputAdapters::Formattable)... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/providers/open_ai_spec.rb | Ruby | mit | 204 | main | 3,481 | require "spec_helper"
RSpec.describe Sublayer::Providers::OpenAI do
before do
Sublayer.configuration.ai_provider = described_class
Sublayer.configuration.ai_model = "gpt-4o"
end
let(:basic_output_adapter) {
Sublayer::Components::OutputAdapters.create(
type: :single_string,
name: "the_ans... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapter_spec.rb | Ruby | mit | 204 | main | 3,730 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters do
describe ".create" do
context "with a built in adapter" do
context "when given a string for a name" do
it "creates the adapter successfully" do
adapter = described_class.create(
type: :single_string,
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/formattable_spec.rb | Ruby | mit | 204 | main | 6,636 | require 'spec_helper'
RSpec.describe Sublayer::Components::OutputAdapters::Formattable do
let(:test_class) do
Class.new do
include Sublayer::Components::OutputAdapters::Formattable
attr_reader :properties
def initialize
@properties = []
end
def add_property(property)
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/named_strings_spec.rb | Ruby | mit | 204 | main | 1,914 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters::NamedStrings do
let(:name) { 'test_adapter' }
let(:description) { 'Test adapter description' }
let(:attributes) do
[
{ name: "field1", description: "Description of field1" },
{ name: "field2", description: "Description of... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/list_of_named_strings_spec.rb | Ruby | mit | 204 | main | 2,819 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters::ListOfNamedStrings do
let(:name) { 'test_adapter' }
let(:description) { 'Test adapter description' }
let(:attributes) do
[
{ name: "field1", description: "Description of field1" },
{ name: "field2", description: "Descripti... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/single_integer_spec.rb | Ruby | mit | 204 | main | 1,282 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters::SingleInteger do
let(:name) { 'output_adapter_name' }
let(:description) { 'output_adapter_description' }
let(:output_adapter) { Sublayer::Components::OutputAdapters::SingleInteger.new(name: name, description: description) }
describe '#... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/single_string_spec.rb | Ruby | mit | 204 | main | 1,279 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters::SingleString do
let(:name) { 'output_adapter_name' }
let(:description) { 'output_adapter_description' }
let(:output_adapter) { Sublayer::Components::OutputAdapters::SingleString.new(name: name, description: description) }
describe '#na... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/components/output_adapters/list_of_strings_spec.rb | Ruby | mit | 204 | main | 1,493 | require "spec_helper"
RSpec.describe Sublayer::Components::OutputAdapters::ListOfStrings do
describe "#initialize" do
it "sets the name and description" do
adapter = Sublayer::Components::OutputAdapters::ListOfStrings.new(name: "test_list", description: "A test list of strings")
expect(adapter.name)... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/cli/generators/action_generator_spec.rb | Ruby | mit | 204 | main | 2,165 | require "spec_helper"
require_relative "../../../lib/sublayer/cli/commands/generators/sublayer_action_generator"
RSpec.describe SublayerActionGenerator do
def generate(description)
described_class.new(description: description).generate
end
context "Claude" do
before do
Sublayer.configuration.ai_p... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/cli/generators/command_generator_spec.rb | Ruby | mit | 204 | main | 2,640 | require "spec_helper"
require_relative "../../../lib/sublayer/cli/commands/generators/sublayer_command_generator"
RSpec.describe SublayerCommandGenerator do
def generate
described_class.new(generator_code: File.read("spec/generators/examples/task_steps_generator.rb")).generate
end
context "OpenAI" do
b... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/cli/generators/generator_generator_spec.rb | Ruby | mit | 204 | main | 2,261 | require "spec_helper"
require_relative "../../../lib/sublayer/cli/commands/generators/sublayer_generator_generator"
RSpec.describe SublayerGeneratorGenerator do
def generate(description)
described_class.new(description: description).generate
end
context "Claude" do
before do
Sublayer.configuratio... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/cli/generators/agent_generator_spec.rb | Ruby | mit | 204 | main | 3,612 | require "spec_helper"
require_relative "../../../lib/sublayer/cli/commands/generators/sublayer_agent_generator"
RSpec.describe SublayerAgentGenerator do
def generate(description, trigger, goal, check_status, step)
described_class.new(
description: description,
trigger: trigger,
goal: goal,
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/integration/cli_project_creation_spec.rb | Ruby | mit | 204 | main | 2,393 | require "spec_helper"
require "fileutils"
require "open3"
require "tmpdir"
TMP_DIR = ENV['RUNNER_TEMP'] || Dir.tmpdir
RSpec.describe "CLI Project Creation" do
let(:project_name) { "test_project" }
let(:project_path) { File.join(TMP_DIR, project_name) }
before(:all) do
FileUtils.mkdir_p(TMP_DIR)
end
a... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/integration/quick_script_creation_spec.rb | Ruby | mit | 204 | main | 1,949 | require "spec_helper"
require "fileutils"
require "open3"
require "tmpdir"
TMP_DIR = ENV['RUNNER_TEMP'] || Dir.tmpdir
RSpec.describe "Quick Script Project Creation" do
let(:project_name) { "test_project" }
let(:project_path) { File.join(TMP_DIR, project_name) }
before(:all) do
FileUtils.mkdir_p(TMP_DIR)
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/integration/github_action_creation_spec.rb | Ruby | mit | 204 | main | 2,440 | require "spec_helper"
require "fileutils"
require "open3"
require "tmpdir"
TMP_DIR = ENV['RUNNER_TEMP'] || Dir.tmpdir
RSpec.describe "Github Action Project Creation" do
let(:project_name) { "test_action" }
let(:project_path) { File.join(TMP_DIR, ".github", "workflows") }
before(:all) do
FileUtils.mkdir_p(T... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/route_selection_from_user_intent_generator_spec.rb | Ruby | mit | 204 | main | 1,809 | require "spec_helper"
require "generators/examples/route_selection_from_user_intent_generator"
RSpec.describe RouteSelectionFromUserIntentGenerator do
def generate(text)
described_class.new(user_intent: text).generate
end
def available_routes
described_class.new(user_intent: "").available_routes
end
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/invalid_to_valid_json_generator_spec.rb | Ruby | mit | 204 | main | 1,713 | require "spec_helper"
require "generators/examples/invalid_to_valid_json_generator"
RSpec.describe InvalidToValidJsonGenerator do
def generate(json)
described_class.new(invalid_json: json).generate
end
context "Claude" do
before do
Sublayer.configuration.ai_provider = Sublayer::Providers::Claude
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/four_digit_passcode_generator_spec.rb | Ruby | mit | 204 | main | 1,447 | require "spec_helper"
require "generators/examples/four_digit_passcode_generator"
RSpec.describe FourDigitPasscodeGenerator do
def generate
described_class.new.generate
end
context "OpenAI" do
before do
Sublayer.configuration.ai_provider = Sublayer::Providers::OpenAI
Sublayer.configuration.... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/sentiment_from_text_generator_spec.rb | Ruby | mit | 204 | main | 1,782 | require "spec_helper"
require "generators/examples/sentiment_from_text_generator"
RSpec.describe SentimentFromTextGenerator do
def generate(text)
described_class.new(text: text, sentiment_options: %w[positive negative neutral]).generate
end
context "OpenAI" do
before do
Sublayer.configuration.ai_... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/code_from_description_generator_spec.rb | Ruby | mit | 204 | main | 2,396 | require "spec_helper"
require "generators/examples/code_from_description_generator"
RSpec.describe CodeFromDescriptionGenerator do
def generate(description:, technologies: ["ruby"])
described_class.new(
description: description,
technologies: technologies
).generate
end
context "claude" do
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/description_from_code_generator_spec.rb | Ruby | mit | 204 | main | 3,254 | require "spec_helper"
require "generators/examples/description_from_code_generator"
RSpec.describe DescriptionFromCodeGenerator do
def generate(code)
described_class.new(code: code).generate
end
context "Claude" do
before do
Sublayer.configuration.ai_provider = Sublayer::Providers::Claude
S... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/imaginary_movie_review_generator_spec.rb | Ruby | mit | 204 | main | 2,960 | require "spec_helper"
require "generators/examples/imaginary_movie_review_generator"
RSpec.describe ImaginaryMovieReviewGenerator do
subject { described_class.new(num_reviews: 3) }
context "OpenAI" do
before do
Sublayer.configuration.ai_provider = Sublayer::Providers::OpenAI
Sublayer.configuratio... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/blog_post_keyword_suggestions_generator_spec.rb | Ruby | mit | 204 | main | 1,673 | require "spec_helper"
require "generators/examples/blog_post_keyword_suggestions_generator"
RSpec.describe BlogPostKeywordSuggestionGenerator do
let(:topic) { "Artificial Intelligence in Healthcare" }
let(:num_keywords) { 5 }
subject { described_class.new(topic: topic, num_keywords: num_keywords) }
context ... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/product_description_generator_spec.rb | Ruby | mit | 204 | main | 2,006 | require "spec_helper"
require "generators/examples/product_description_generator"
RSpec.describe ProductDescriptionGenerator do
def generate
described_class.new(product_name: "Super Gadget", product_category: "Electronics").generate
end
context "OpenAI" do
before do
Sublayer.configuration.ai_prov... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/task_steps_generator_spec.rb | Ruby | mit | 204 | main | 2,248 | require "spec_helper"
require "generators/examples/task_steps_generator"
RSpec.describe TaskStepsGenerator do
subject { described_class.new(task: "Set up a new Ruby on Rails project") }
context "OpenAI" do
before do
Sublayer.configuration.ai_provider = Sublayer::Providers::OpenAI
Sublayer.configu... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/description_from_code_generator.rb | Ruby | mit | 204 | main | 639 | class DescriptionFromCodeGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: "code_description",
description: "A description of what the code does, its purpose,functionality, and any noteworthy details"
def initialize(code:)
@code = code
end
def generate
super... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/route_selection_from_user_intent_generator.rb | Ruby | mit | 204 | main | 702 | class RouteSelectionFromUserIntentGenerator < Sublayer::Generators::Base
llm_output_adapter type: :string_selection_from_list,
name: "route",
description: "A route selected from the list",
options: :available_routes
def initialize(user_intent:)
@user_intent = user_intent
end
def generate
s... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/sentiment_from_text_generator.rb | Ruby | mit | 204 | main | 626 | class SentimentFromTextGenerator < Sublayer::Generators::Base
llm_output_adapter type: :string_selection_from_list,
name: "sentiment_value",
description: "A sentiment value from the list",
options: -> { @sentiment_options }
def initialize(text:, sentiment_options:)
@text = text
@sentiment_optio... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/code_from_blueprint_generator.rb | Ruby | mit | 204 | main | 955 | class CodeFromBlueprintGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: "generated_code",
description: "The generated code for the description"
def initialize(blueprint_description:, blueprint_code:, description:)
@blueprint_description = blueprint_description
@... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/imaginary_movie_review_generator.rb | Ruby | mit | 204 | main | 1,160 | class ImaginaryMovieReviewGenerator < Sublayer::Generators::Base
llm_output_adapter type: :list_of_named_strings,
name: "review_summaries",
description: "List of movie reviews",
item_name: "review",
attributes: [
{ name: "movie_title", description: "The title of the movie" },
{ name: "revi... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/code_from_description_generator.rb | Ruby | mit | 204 | main | 703 | class CodeFromDescriptionGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: "generated_code",
description: "The generated code in the requested language"
def initialize(description:, technologies:)
@description = description
@technologies = technologies
end
d... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/blog_post_keyword_suggestions_generator.rb | Ruby | mit | 204 | main | 675 | class BlogPostKeywordSuggestionGenerator < Sublayer::Generators::Base
llm_output_adapter type: :list_of_strings,
name: "suggestions",
description: "List of keyword suggestions"
def initialize(topic:, num_keywords: 5)
@topic = topic
end
def generate
super
end
def prompt
<<-PROMPT
Y... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/invalid_to_valid_json_generator.rb | Ruby | mit | 204 | main | 470 | class InvalidToValidJsonGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: "valid_json",
description: "The valid JSON string"
def initialize(invalid_json:)
@invalid_json = invalid_json
end
def generate
super
end
def prompt
<<-PROMPT
You are an ex... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/product_description_generator.rb | Ruby | mit | 204 | main | 1,269 | class ProductDescriptionGenerator < Sublayer::Generators::Base
llm_output_adapter type: :named_strings,
name: "product_description",
description: "Generate product descriptions",
attributes: [
{ name: "short_description", description: "A brief one-sentence description of the product" },
{ name... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/task_steps_generator.rb | Ruby | mit | 204 | main | 1,054 | class TaskStepsGenerator < Sublayer::Generators::Base
llm_output_adapter type: :list_of_named_strings,
name: "steps",
description: "List of steps to complete a task",
item_name: "step",
attributes: [ { name: "description", description: "A brief description of the step" }, { name: "command", descriptio... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | spec/generators/examples/four_digit_passcode_generator.rb | Ruby | mit | 204 | main | 441 | class FourDigitPasscodeGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_integer,
name: "four_digit_passcode",
description: "an uncommon and difficult to guess four digit passcode"
def initialize
end
def generate
super
end
def prompt
<<-PROMPT
You are an expert o... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer.rb | Ruby | mit | 204 | main | 879 | # frozen_string_literal: true
require "zeitwerk"
require 'active_support'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/inflector'
require 'ostruct'
require "httparty"
require "openai"
require "listen"
require "securerandom"
require "time"
require_relative "sublayer/version"
loade... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli.rb | Ruby | mit | 204 | main | 2,085 | require "thor"
require "sublayer"
require "sublayer/version"
require "yaml"
require "fileutils"
require "active_support/inflector"
require_relative "cli/commands/subcommand_base"
require_relative "cli/commands/new_project"
require_relative "cli/commands/generator"
require_relative "cli/commands/agent"
require_relativ... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/providers/claude.rb | Ruby | mit | 204 | main | 2,780 | # Sublayer.configuration.ai_provider = Sublayer::Providers::Claude
# Sublayer.configuration.ai_model ="claude-3-5-sonnet-20240620"
module Sublayer
module Providers
class Claude
def self.call(prompt:, output_adapter:)
request_id = SecureRandom.uuid
Sublayer.configuration.logger.log(:info, "C... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/providers/gemini.rb | Ruby | mit | 204 | main | 2,018 | # Sublayer.configuration.ai_provider = Sublayer::Providers::Gemini
# Sublayer.configuration.ai_model = "gemini-1.5-flash-latest"
module Sublayer
module Providers
class Gemini
def self.call(prompt:, output_adapter:)
request_id = SecureRandom.uuid
before_request = Time.now
Sublayer.c... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/providers/open_ai.rb | Ruby | mit | 204 | main | 2,512 | # Sublayer.configuration.ai_provider = Sublayer::Providers::OpenAI
# Sublayer.configuration.ai_model = "gpt-4o"
module Sublayer
module Providers
class OpenAI
def self.call(prompt:, output_adapter:)
client = ::OpenAI::Client.new(access_token: ENV.fetch("OPENAI_API_KEY"))
request_id = Secure... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/agents/base.rb | Ruby | mit | 204 | main | 1,305 | module Sublayer
module Agents
class Base
class << self
attr_reader :triggers, :goal_condition_block, :check_status_block, :step_block, :listeners
def trigger(trigger_instance = nil)
@triggers ||= []
if trigger_instance
@triggers << trigger_instance
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/triggers/file_change.rb | Ruby | mit | 204 | main | 525 | module Sublayer
module Triggers
class FileChange < Base
def initialize(&block)
@block = block
end
def setup(agent)
files_to_watch = agent.instance_eval(&@block)
folders = files_to_watch.map { |file| File.dirname(File.expand_path(file)) }.uniq
Listen.to(*folders)... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/triggers/base.rb | Ruby | mit | 204 | main | 244 | module Sublayer
module Triggers
class Base
def setup(agent)
raise NotImplementedError, "Subclasses must implement setup method"
end
def activate(agent)
agent.send(:take_step)
end
end
end
end |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters.rb | Ruby | mit | 204 | main | 736 | module Sublayer
module Components
module OutputAdapters
attr_reader :name
def self.create(options)
klass = if options.has_key?(:class)
klass = options[:class]
if klass.is_a?(String)
klass.constantize
elsif klass.is_a?(Class)
klass
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/single_integer.rb | Ruby | mit | 204 | main | 511 | module Sublayer
module Components
module OutputAdapters
class SingleInteger
attr_reader :name, :description
def initialize(options)
@name = options[:name]
@description = options[:description]
end
def properties
[
OpenStruct.new(
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/single_string.rb | Ruby | mit | 204 | main | 415 | module Sublayer
module Components
module OutputAdapters
class SingleString
attr_reader :name, :description
def initialize(options)
@name = options[:name]
@description = options[:description]
end
def properties
[OpenStruct.new(name: @name, type:... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/list_of_strings.rb | Ruby | mit | 204 | main | 580 | module Sublayer
module Components
module OutputAdapters
class ListOfStrings
attr_reader :name, :description
def initialize(options)
@name = options[:name]
@description = options[:description]
end
def properties
[
OpenStruct.new(
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/list_of_named_strings.rb | Ruby | mit | 204 | main | 1,363 | module Sublayer
module Components
module OutputAdapters
class ListOfNamedStrings
attr_reader :name, :description, :attributes, :item_name
def initialize(options)
@name = options[:name]
@item_name = options[:item_name]
@description = options[:description]
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/named_strings.rb | Ruby | mit | 204 | main | 935 | module Sublayer
module Components
module OutputAdapters
class NamedStrings
attr_reader :name, :description, :attributes
def initialize(options)
@name = options[:name]
@description = options[:description]
@attributes = options[:attributes]
end
d... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/string_selection_from_list.rb | Ruby | mit | 204 | main | 744 | module Sublayer
module Components
module OutputAdapters
class StringSelectionFromList
attr_reader :name, :description, :options
def initialize(options)
@name = options[:name]
@description = options[:description]
@list = options[:options]
end
de... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/components/output_adapters/formattable.rb | Ruby | mit | 204 | main | 1,584 | module Sublayer
module Components
module OutputAdapters
module Formattable
def format_properties
build_json_schema(self.properties)
end
def build_json_schema(props)
formatted_properties = {}
props.map do |prop|
formatted_property = format_p... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/templates/quick_script/%project_name%.rb | Ruby | mit | 204 | main | 296 | require "yaml"
require "sublayer"
# Load any Actions, Generators, and Agents
Dir[File.join(__dir__, "actions", "*.rb")].each { |file| require file }
Dir[File.join(__dir__, "generators", "*.rb")].each { |file| require file }
Dir[File.join(__dir__, "agents", "*.rb")].each { |file| require file } |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/templates/quick_script/agents/example_agent.rb | Ruby | mit | 204 | main | 323 | # frozen_string_literal: true
class ExampleAgent < Sublayer::Agents::Base
trigger_on_files_changed { ["example_file.txt"] }
goal_condition { @goal_reached }
check_status do
@status_checked = true
end
step do
@step_taken = true
@goal_reached = true
puts "Example agent step executed"
end
e... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/templates/quick_script/generators/example_generator.rb | Ruby | mit | 204 | main | 394 | # frozen_string_literal: true
class ExampleGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: "generated_text",
description: "A simple generated text"
def initialize(input:)
@input = input
end
def generate
super
end
def prompt
<<-PROMPT
Ge... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/templates/quick_script/actions/example_action.rb | Ruby | mit | 204 | main | 200 | # frozen_string_literal: true
class ExampleAction < Sublayer::Actions::Base
def initialize(input:)
@input = input
end
def call
puts "Performing action with input: #{@input}"
end
end |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/generator.rb | Ruby | mit | 204 | main | 4,800 | require_relative "generators/sublayer_generator_generator"
require_relative "generators/sublayer_command_generator"
module Sublayer
module Commands
class Generator < Thor::Group
include Thor::Actions
class_option :description, type: :string, desc: "Description of the generator you want to generate",... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/github_action_project.rb | Ruby | mit | 204 | main | 2,396 | module Sublayer
module Commands
class GithubActionProject < Thor::Group
attr_reader :ai_provider_key
include Thor::Actions
argument :project_name
class_option :provider, type: :string, desc: "AI provider (OpenAI, Claude, or Gemini)", aliases: :p
class_option :model, type: :string,... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/subcommand_base.rb | Ruby | mit | 204 | main | 402 | module Sublayer
module Commands
class SubCommandBase < Thor
def self.banner(command, namespace = nil, subcommand = false)
"#{basename} #{subcommand_prefix} #{command.usage}"
end
def self.subcommand_prefix
self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase ... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/new_project.rb | Ruby | mit | 204 | main | 1,413 | module Sublayer
module Commands
class NewProject < Thor::Group
include Thor::Actions
argument :project_name, type: :string, desc: "The name of your project"
class_option :template, type: :string, desc: "Type of project (CLI, GithubAction, QuickScript)", aliases: :t
class_option :provider... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/action.rb | Ruby | mit | 204 | main | 2,654 | require_relative "./generators/sublayer_action_generator"
module Sublayer
module Commands
class Action < Thor::Group
include Thor::Actions
class_option :description, type: :string, desc: "Description of the action you want to generate", aliases: :d
class_option :provider, type: :string, desc: ... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/agent.rb | Ruby | mit | 204 | main | 3,275 | require_relative "./generators/sublayer_agent_generator"
module Sublayer
module Commands
class Agent < Thor::Group
include Thor::Actions
class_option :description, type: :string, desc: "Description of the agent you want to generate", aliases: :d
class_option :provider, type: :string, desc: "AI... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/cli_project.rb | Ruby | mit | 204 | main | 2,611 | module Sublayer
module Commands
class CLIProject < Thor::Group
include Thor::Actions
argument :project_name
class_option :provider, type: :string, desc: "AI provider (OpenAI, Claude, or Gemini)", aliases: :p
class_option :model, type: :string, desc: "AI model name to use (e.g. gpt-4o, cl... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/quick_script_project.rb | Ruby | mit | 204 | main | 2,770 | module Sublayer
module Commands
class QuickScriptProject < Thor::Group
include Thor::Actions
argument :project_name
class_option :provider, type: :string, desc: "AI provider (OpenAI, Claude, or Gemini)", aliases: :p
class_option :model, type: :string, desc: "AI model name to use (e.g. gp... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/generators/sublayer_action_generator.rb | Ruby | mit | 204 | main | 2,264 | class SublayerActionGenerator < Sublayer::Generators::Base
llm_output_adapter type: :named_strings,
name: "sublayer_action",
description: "The new sublayer action based on the description and supporting information",
attributes: [
{ name: "code", description: "The code of the generated Sublayer acti... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/generators/sublayer_agent_generator.rb | Ruby | mit | 204 | main | 3,128 | class SublayerAgentGenerator < Sublayer::Generators::Base
llm_output_adapter type: :named_strings,
name: "sublayer_agent",
description: "The new sublayer agent based on the description and supporting information",
attributes: [
{ name: "code", description: "The code of the generated Sublayer agent" ... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/generators/example_action_api_call.rb | Ruby | mit | 204 | main | 485 | class TextToSpeechAction < Sublayer::Actions::Base
def initialize(text)
@text = text
end
def call
speech = HTTParty.post(
"https://api.openai.com/v1/audio/speech",
headers: {
"Authorization" => "Bearer #{ENV["OPENAI_API_KEY"]}",
"Content-Type" => "application/json",
},
... |
github | sublayerapp/sublayer | https://github.com/sublayerapp/sublayer | lib/sublayer/cli/commands/generators/sublayer_generator_generator.rb | Ruby | mit | 204 | main | 4,230 | class SublayerGeneratorGenerator < Sublayer::Generators::Base
llm_output_adapter type: :named_strings,
name: "sublayer_generator",
description: "The new Sublayer generator code based on the description",
attributes: [
{ name: "code", description: "The code of the generated Sublayer generator" },
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.