Initial commit
Seto Elkahfi committed
Apr 11, 2026 at 15:37 UTC
80e971239b2fc0dc4863172d597d786871cae29b
112 files changed
+5598
.dockerignore
+51
new file mode 100644
index 0000000..325bfc0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,51 @@
+# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
+
+# Ignore git directory.
+/.git/
+/.gitignore
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files.
+/.env*
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore assets.
+/node_modules/
+/app/assets/builds/*
+!/app/assets/builds/.keep
+/public/assets
+
+# Ignore CI service files.
+/.github
+
+# Ignore Kamal files.
+/config/deploy*.yml
+/.kamal
+
+# Ignore development files
+/.devcontainer
+
+# Ignore Docker-related files
+/.dockerignore
+/Dockerfile*
.env.example
+70
new file mode 100644
index 0000000..10a6a6d
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,70 @@
+# =============================================================================
+# siGit si — Environment Variables
+# Copy this file to .env and fill in the values before running the app.
+#
+# cp .env.example .env
+#
+# .env is git-ignored. Never commit real secrets.
+# =============================================================================
+
+
+# -----------------------------------------------------------------------------
+# smbCloud Auth (required)
+# Register your application at https://smbcloud.xyz to obtain these values.
+# -----------------------------------------------------------------------------
+
+# Your smbCloud app identifier
+SMBCLOUD_APP_ID=your-app-id-here
+
+# Your smbCloud app secret
+SMBCLOUD_APP_SECRET=your-app-secret-here
+
+# Auth environment: "production" (default) or "dev" (local smbCloud Auth server)
+SMBCLOUD_ENVIRONMENT=production
+
+
+# -----------------------------------------------------------------------------
+# Database (PostgreSQL)
+# The defaults below work with a local Postgres.app installation.
+# -----------------------------------------------------------------------------
+
+# Full connection URL takes precedence over individual vars when set.
+# DATABASE_URL=postgres://sigitsi:password@localhost/sigitsi_development
+
+# Individual vars (used when DATABASE_URL is not set)
+# DB_HOST=localhost
+# DB_PORT=5432
+# DB_USERNAME=sigitsi
+# DB_PASSWORD=
+
+
+# -----------------------------------------------------------------------------
+# Git repository storage
+# Bare repos are stored under this directory, organised as:
+# <SIGITSI_REPOS_PATH>/<username>/<reponame>.git
+#
+# Defaults to Rails.root/repos when not set.
+# -----------------------------------------------------------------------------
+
+# SIGITSI_REPOS_PATH=/var/sigitsi/repos
+
+
+# -----------------------------------------------------------------------------
+# Rails
+# -----------------------------------------------------------------------------
+
+# Must be set to a long random string in production.
+# Generate one with: bin/rails secret
+SECRET_KEY_BASE=
+
+# "development", "test", or "production"
+RAILS_ENV=development
+
+# Number of Puma threads (also controls DB connection pool size)
+RAILS_MAX_THREADS=5
+
+# Set to "1" to serve static files from public/ in production
+# RAILS_SERVE_STATIC_FILES=1
+
+# Set to "1" to write logs to stdout in production (recommended for containers)
+# RAILS_LOG_TO_STDOUT=1
.github/dependabot.yml
+12
new file mode 100644
index 0000000..83610cf
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+version: 2
+updates:
+- package-ecosystem: bundler
+ directory: "/"
+ schedule:
+ interval: weekly
+ open-pull-requests-limit: 10
+- package-ecosystem: github-actions
+ directory: "/"
+ schedule:
+ interval: weekly
+ open-pull-requests-limit: 10
.github/workflows/ci.yml
+67
new file mode 100644
index 0000000..d58c2aa
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,67 @@
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [ main ]
+
+jobs:
+ scan_ruby:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+
+ - name: Scan for common Rails security vulnerabilities using static analysis
+ run: bin/brakeman --no-pager
+
+ - name: Scan for known security vulnerabilities in gems used
+ run: bin/bundler-audit
+
+ scan_js:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+
+ - name: Scan for security vulnerabilities in JavaScript dependencies
+ run: bin/importmap audit
+
+ lint:
+ runs-on: ubuntu-latest
+ env:
+ RUBOCOP_CACHE_ROOT: tmp/rubocop
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+
+ - name: Prepare RuboCop cache
+ uses: actions/cache@v4
+ env:
+ DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
+ with:
+ path: ${{ env.RUBOCOP_CACHE_ROOT }}
+ key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
+ restore-keys: |
+ rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-
+
+ - name: Lint code for consistent style
+ run: bin/rubocop -f github
+
.gitignore
+38
new file mode 100644
index 0000000..a7fd80d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files.
+/.env*
+!/.env.example
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore precompiled assets (rebuild with `rails assets:precompile`).
+/public/assets
+
+# Ignore Tailwind CSS build output (rebuild with `rails tailwindcss:build`).
+/app/assets/builds/*
+!/app/assets/builds/.keep
+
+# Ignore node_modules.
+/node_modules/
.rubocop.yml
+8
new file mode 100644
index 0000000..f9d86d4
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,8 @@
+# Omakase Ruby styling for Rails
+inherit_gem: { rubocop-rails-omakase: rubocop.yml }
+
+# Overwrite or add rules to create your own house style
+#
+# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
+# Layout/SpaceInsideArrayLiteralBrackets:
+# Enabled: false
.ruby-version
+1
new file mode 100644
index 0000000..a07bf72
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+ruby-3.4.2
Dockerfile
+77
new file mode 100644
index 0000000..178d07c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,77 @@
+# syntax=docker/dockerfile:1
+# check=error=true
+
+# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
+# docker build -t sigitsi .
+# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name sigitsi sigitsi
+
+# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
+
+# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
+ARG RUBY_VERSION=3.4.2
+FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
+
+# Rails app lives here
+WORKDIR /rails
+
+# Install base packages
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
+ ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Set production environment variables and enable jemalloc for reduced memory usage and latency.
+ENV RAILS_ENV="production" \
+ BUNDLE_DEPLOYMENT="1" \
+ BUNDLE_PATH="/usr/local/bundle" \
+ BUNDLE_WITHOUT="development" \
+ LD_PRELOAD="/usr/local/lib/libjemalloc.so"
+
+# Throw-away build stage to reduce size of final image
+FROM base AS build
+
+# Install packages needed to build gems
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y build-essential git libpq-dev libvips libyaml-dev pkg-config && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Install application gems
+COPY vendor/* ./vendor/
+COPY Gemfile Gemfile.lock ./
+
+RUN bundle install && \
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
+ # -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
+ bundle exec bootsnap precompile -j 1 --gemfile
+
+# Copy application code
+COPY . .
+
+# Precompile bootsnap code for faster boot times.
+# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
+RUN bundle exec bootsnap precompile -j 1 app/ lib/
+
+# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
+RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
+
+
+
+
+# Final stage for app image
+FROM base
+
+# Run and own only the runtime files as a non-root user for security
+RUN groupadd --system --gid 1000 rails && \
+ useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
+USER 1000:1000
+
+# Copy built artifacts: gems, application
+COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
+COPY --chown=rails:rails --from=build /rails /rails
+
+# Entrypoint prepares the database.
+ENTRYPOINT ["/rails/bin/docker-entrypoint"]
+
+# Start server via Thruster by default, this can be overwritten at runtime
+EXPOSE 80
+CMD ["./bin/thrust", "./bin/rails", "server"]
Gemfile
+71
new file mode 100644
index 0000000..8f86961
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,71 @@
+source "https://rubygems.org"
+
+# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
+gem "rails", "~> 8.1.3"
+# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
+gem "propshaft"
+# Use postgresql as the database for Active Record
+gem "pg", "~> 1.1"
+# Use the Puma web server [https://github.com/puma/puma]
+gem "puma", ">= 5.0"
+# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
+gem "importmap-rails"
+# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
+gem "turbo-rails"
+# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
+gem "stimulus-rails"
+# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
+gem "tailwindcss-rails"
+# Build JSON APIs with ease [https://github.com/rails/jbuilder]
+gem "jbuilder"
+
+# smbCloud Auth — native Rust/Magnus extension for login, signup, me, logout
+gem "smbcloud-auth", path: "../smbcloud-cli/sdk/gems/auth"
+
+# Markdown rendering for README files
+gem "redcarpet", "~> 3.6"
+
+# Syntax highlighting for code files
+gem "rouge", "~> 4.5"
+
+# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
+# gem "bcrypt", "~> 3.1.7"
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem "tzinfo-data", platforms: %i[ windows jruby ]
+
+# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
+gem "solid_cache"
+gem "solid_queue"
+gem "solid_cable"
+
+# Reduces boot times through caching; required in config/boot.rb
+gem "bootsnap", require: false
+
+# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
+gem "kamal", require: false
+
+# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
+gem "thruster", require: false
+
+# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
+gem "image_processing", "~> 1.2"
+
+group :development, :test do
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
+ gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
+
+ # Audits gems for known security defects (use config/bundler-audit.yml to ignore issues)
+ gem "bundler-audit", require: false
+
+ # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
+ gem "brakeman", require: false
+
+ # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
+ gem "rubocop-rails-omakase", require: false
+end
+
+group :development do
+ # Use console on exceptions pages [https://github.com/rails/web-console]
+ gem "web-console"
+end
Gemfile.lock
+377
new file mode 100644
index 0000000..f49f9ce
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,377 @@
+PATH
+ remote: ../smbcloud-cli/sdk/gems/auth
+ specs:
+ smbcloud-auth (0.3.33)
+ json
+ rb_sys (~> 0.9.91)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ action_text-trix (2.1.18)
+ railties
+ actioncable (8.1.3)
+ actionpack (= 8.1.3)
+ activesupport (= 8.1.3)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ zeitwerk (~> 2.6)
+ actionmailbox (8.1.3)
+ actionpack (= 8.1.3)
+ activejob (= 8.1.3)
+ activerecord (= 8.1.3)
+ activestorage (= 8.1.3)
+ activesupport (= 8.1.3)
+ mail (>= 2.8.0)
+ actionmailer (8.1.3)
+ actionpack (= 8.1.3)
+ actionview (= 8.1.3)
+ activejob (= 8.1.3)
+ activesupport (= 8.1.3)
+ mail (>= 2.8.0)
+ rails-dom-testing (~> 2.2)
+ actionpack (8.1.3)
+ actionview (= 8.1.3)
+ activesupport (= 8.1.3)
+ nokogiri (>= 1.8.5)
+ rack (>= 2.2.4)
+ rack-session (>= 1.0.1)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ useragent (~> 0.16)
+ actiontext (8.1.3)
+ action_text-trix (~> 2.1.15)
+ actionpack (= 8.1.3)
+ activerecord (= 8.1.3)
+ activestorage (= 8.1.3)
+ activesupport (= 8.1.3)
+ globalid (>= 0.6.0)
+ nokogiri (>= 1.8.5)
+ actionview (8.1.3)
+ activesupport (= 8.1.3)
+ builder (~> 3.1)
+ erubi (~> 1.11)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ activejob (8.1.3)
+ activesupport (= 8.1.3)
+ globalid (>= 0.3.6)
+ activemodel (8.1.3)
+ activesupport (= 8.1.3)
+ activerecord (8.1.3)
+ activemodel (= 8.1.3)
+ activesupport (= 8.1.3)
+ timeout (>= 0.4.0)
+ activestorage (8.1.3)
+ actionpack (= 8.1.3)
+ activejob (= 8.1.3)
+ activerecord (= 8.1.3)
+ activesupport (= 8.1.3)
+ marcel (~> 1.0)
+ activesupport (8.1.3)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.3.1)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ json
+ logger (>= 1.4.2)
+ minitest (>= 5.1)
+ securerandom (>= 0.3)
+ tzinfo (~> 2.0, >= 2.0.5)
+ uri (>= 0.13.1)
+ ast (2.4.3)
+ base64 (0.3.0)
+ bcrypt_pbkdf (1.1.2)
+ bigdecimal (4.1.1)
+ bindex (0.8.1)
+ bootsnap (1.23.0)
+ msgpack (~> 1.2)
+ brakeman (8.0.4)
+ racc
+ builder (3.3.0)
+ bundler-audit (0.9.3)
+ bundler (>= 1.2.0)
+ thor (~> 1.0)
+ concurrent-ruby (1.3.6)
+ connection_pool (3.0.2)
+ crass (1.0.6)
+ date (3.5.1)
+ debug (1.11.1)
+ irb (~> 1.10)
+ reline (>= 0.3.8)
+ dotenv (3.2.0)
+ drb (2.2.3)
+ ed25519 (1.4.0)
+ erb (6.0.2)
+ erubi (1.13.1)
+ et-orbi (1.4.0)
+ tzinfo
+ ffi (1.17.4-arm64-darwin)
+ fugit (1.12.1)
+ et-orbi (~> 1.4)
+ raabro (~> 1.4)
+ globalid (1.3.0)
+ activesupport (>= 6.1)
+ i18n (1.14.8)
+ concurrent-ruby (~> 1.0)
+ image_processing (1.14.0)
+ mini_magick (>= 4.9.5, < 6)
+ ruby-vips (>= 2.0.17, < 3)
+ importmap-rails (2.2.3)
+ actionpack (>= 6.0.0)
+ activesupport (>= 6.0.0)
+ railties (>= 6.0.0)
+ io-console (0.8.2)
+ irb (1.17.0)
+ pp (>= 0.6.0)
+ prism (>= 1.3.0)
+ rdoc (>= 4.0.0)
+ reline (>= 0.4.2)
+ jbuilder (2.14.1)
+ actionview (>= 7.0.0)
+ activesupport (>= 7.0.0)
+ json (2.19.3)
+ kamal (2.11.0)
+ activesupport (>= 7.0)
+ base64 (~> 0.2)
+ bcrypt_pbkdf (~> 1.0)
+ concurrent-ruby (~> 1.2)
+ dotenv (~> 3.1)
+ ed25519 (~> 1.4)
+ net-ssh (~> 7.3)
+ sshkit (>= 1.23.0, < 2.0)
+ thor (~> 1.3)
+ zeitwerk (>= 2.6.18, < 3.0)
+ language_server-protocol (3.17.0.5)
+ lint_roller (1.1.0)
+ logger (1.7.0)
+ loofah (2.25.1)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
+ mail (2.9.0)
+ logger
+ mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
+ marcel (1.1.0)
+ mini_magick (5.3.1)
+ logger
+ mini_mime (1.1.5)
+ minitest (6.0.3)
+ drb (~> 2.0)
+ prism (~> 1.5)
+ msgpack (1.8.0)
+ net-imap (0.6.3)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.2)
+ timeout
+ net-scp (4.1.0)
+ net-ssh (>= 2.6.5, < 8.0.0)
+ net-sftp (4.0.0)
+ net-ssh (>= 5.0.0, < 8.0.0)
+ net-smtp (0.5.1)
+ net-protocol
+ net-ssh (7.3.2)
+ nio4r (2.7.5)
+ nokogiri (1.19.2-arm64-darwin)
+ racc (~> 1.4)
+ ostruct (0.6.3)
+ parallel (2.0.1)
+ parser (3.3.11.1)
+ ast (~> 2.4.1)
+ racc
+ pg (1.6.3-arm64-darwin)
+ pp (0.6.3)
+ prettyprint
+ prettyprint (0.2.0)
+ prism (1.9.0)
+ propshaft (1.3.1)
+ actionpack (>= 7.0.0)
+ activesupport (>= 7.0.0)
+ rack
+ psych (5.3.1)
+ date
+ stringio
+ puma (8.0.0)
+ nio4r (~> 2.0)
+ raabro (1.4.0)
+ racc (1.8.1)
+ rack (3.2.6)
+ rack-session (2.1.2)
+ base64 (>= 0.1.0)
+ rack (>= 3.0.0)
+ rack-test (2.2.0)
+ rack (>= 1.3)
+ rackup (2.3.1)
+ rack (>= 3)
+ rails (8.1.3)
+ actioncable (= 8.1.3)
+ actionmailbox (= 8.1.3)
+ actionmailer (= 8.1.3)
+ actionpack (= 8.1.3)
+ actiontext (= 8.1.3)
+ actionview (= 8.1.3)
+ activejob (= 8.1.3)
+ activemodel (= 8.1.3)
+ activerecord (= 8.1.3)
+ activestorage (= 8.1.3)
+ activesupport (= 8.1.3)
+ bundler (>= 1.15.0)
+ railties (= 8.1.3)
+ rails-dom-testing (2.3.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.7.0)
+ loofah (~> 2.25)
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
+ railties (8.1.3)
+ actionpack (= 8.1.3)
+ activesupport (= 8.1.3)
+ irb (~> 1.13)
+ rackup (>= 1.0.0)
+ rake (>= 12.2)
+ thor (~> 1.0, >= 1.2.2)
+ tsort (>= 0.2)
+ zeitwerk (~> 2.6)
+ rainbow (3.1.1)
+ rake (13.3.1)
+ rake-compiler-dock (1.11.0)
+ rb_sys (0.9.126)
+ json (>= 2)
+ rake-compiler-dock (= 1.11.0)
+ rdoc (7.2.0)
+ erb
+ psych (>= 4.0.0)
+ tsort
+ redcarpet (3.6.1)
+ regexp_parser (2.12.0)
+ reline (0.6.3)
+ io-console (~> 0.5)
+ rouge (4.7.0)
+ rubocop (1.86.1)
+ json (~> 2.3)
+ language_server-protocol (~> 3.17.0.2)
+ lint_roller (~> 1.1.0)
+ parallel (>= 1.10)
+ parser (>= 3.3.0.2)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 2.9.3, < 3.0)
+ rubocop-ast (>= 1.49.0, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 4.0)
+ rubocop-ast (1.49.1)
+ parser (>= 3.3.7.2)
+ prism (~> 1.7)
+ rubocop-performance (1.26.1)
+ lint_roller (~> 1.1)
+ rubocop (>= 1.75.0, < 2.0)
+ rubocop-ast (>= 1.47.1, < 2.0)
+ rubocop-rails (2.34.3)
+ activesupport (>= 4.2.0)
+ lint_roller (~> 1.1)
+ rack (>= 1.1)
+ rubocop (>= 1.75.0, < 2.0)
+ rubocop-ast (>= 1.44.0, < 2.0)
+ rubocop-rails-omakase (1.1.0)
+ rubocop (>= 1.72)
+ rubocop-performance (>= 1.24)
+ rubocop-rails (>= 2.30)
+ ruby-progressbar (1.13.0)
+ ruby-vips (2.3.0)
+ ffi (~> 1.12)
+ logger
+ securerandom (0.4.1)
+ solid_cable (3.0.12)
+ actioncable (>= 7.2)
+ activejob (>= 7.2)
+ activerecord (>= 7.2)
+ railties (>= 7.2)
+ solid_cache (1.0.10)
+ activejob (>= 7.2)
+ activerecord (>= 7.2)
+ railties (>= 7.2)
+ solid_queue (1.4.0)
+ activejob (>= 7.1)
+ activerecord (>= 7.1)
+ concurrent-ruby (>= 1.3.1)
+ fugit (~> 1.11)
+ railties (>= 7.1)
+ thor (>= 1.3.1)
+ sshkit (1.25.0)
+ base64
+ logger
+ net-scp (>= 1.1.2)
+ net-sftp (>= 2.1.2)
+ net-ssh (>= 2.8.0)
+ ostruct
+ stimulus-rails (1.3.4)
+ railties (>= 6.0.0)
+ stringio (3.2.0)
+ tailwindcss-rails (3.3.2)
+ railties (>= 7.0.0)
+ tailwindcss-ruby (~> 3.0)
+ tailwindcss-ruby (3.4.19-arm64-darwin)
+ thor (1.5.0)
+ thruster (0.1.20-arm64-darwin)
+ timeout (0.6.1)
+ tsort (0.2.0)
+ turbo-rails (2.0.23)
+ actionpack (>= 7.1.0)
+ railties (>= 7.1.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (3.2.0)
+ unicode-emoji (~> 4.1)
+ unicode-emoji (4.2.0)
+ uri (1.1.1)
+ useragent (0.16.11)
+ web-console (4.3.0)
+ actionview (>= 8.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 8.0.0)
+ websocket-driver (0.8.0)
+ base64
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ zeitwerk (2.7.5)
+
+PLATFORMS
+ arm64-darwin
+
+DEPENDENCIES
+ bootsnap
+ brakeman
+ bundler-audit
+ debug
+ image_processing (~> 1.2)
+ importmap-rails
+ jbuilder
+ kamal
+ pg (~> 1.1)
+ propshaft
+ puma (>= 5.0)
+ rails (~> 8.1.3)
+ redcarpet (~> 3.6)
+ rouge (~> 4.5)
+ rubocop-rails-omakase
+ smbcloud-auth!
+ solid_cable
+ solid_cache
+ solid_queue
+ stimulus-rails
+ tailwindcss-rails
+ thruster
+ turbo-rails
+ tzinfo-data
+ web-console
+
+BUNDLED WITH
+ 2.7.2
README.md
+1
new file mode 100644
index 0000000..cc9c948
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# siGit sí!
Rakefile
+6
new file mode 100644
index 0000000..9a5ea73
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative "config/application"
+
+Rails.application.load_tasks
app/assets/builds/.keep
new file mode 100644
index 0000000..e69de29
app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
app/assets/stylesheets/application.css
+10
new file mode 100644
index 0000000..fe93333
--- /dev/null
+++ b/app/assets/stylesheets/application.css
@@ -0,0 +1,10 @@
+/*
+ * This is a manifest file that'll be compiled into application.css.
+ *
+ * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
+ * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
+ * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
+ * depending on specificity.
+ *
+ * Consider organizing styles into separate files for maintainability.
+ */
app/assets/stylesheets/application.tailwind.css
+164
new file mode 100644
index 0000000..983bff2
--- /dev/null
+++ b/app/assets/stylesheets/application.tailwind.css
@@ -0,0 +1,164 @@
+@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
+@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');
+
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+@layer base {
+ html { @apply antialiased; }
+ body { @apply bg-surface-900 text-gray-300 font-sans text-sm leading-relaxed; }
+ a { @apply text-brand-500; }
+ code { @apply font-mono text-xs; }
+}
+
+@layer components {
+ .nav-link {
+ @apply text-gray-400 hover:text-gray-100 text-sm font-medium transition-colors duration-150;
+ }
+
+ .btn-primary {
+ @apply inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white text-sm
+ font-medium rounded hover:bg-brand-400 transition-colors duration-150 cursor-pointer;
+ }
+ .btn-secondary {
+ @apply inline-flex items-center gap-2 px-4 py-2 bg-surface-700 text-gray-300 text-sm
+ font-medium rounded border border-surface-500 hover:bg-surface-600
+ transition-colors duration-150 cursor-pointer;
+ }
+ .btn-danger {
+ @apply inline-flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm
+ font-medium rounded hover:bg-red-500 transition-colors duration-150 cursor-pointer;
+ }
+ .btn-ghost {
+ @apply inline-flex items-center gap-2 px-3 py-1.5 text-gray-400 text-sm
+ font-medium rounded hover:bg-surface-700 transition-colors duration-150 cursor-pointer;
+ }
+
+ .form-input {
+ @apply w-full px-3 py-2 border border-surface-500 rounded text-sm text-gray-200
+ bg-surface-800 placeholder-gray-500 focus:outline-none focus:ring-2
+ focus:ring-brand-500 focus:border-transparent transition-all duration-150;
+ }
+ .form-label {
+ @apply block text-sm font-medium text-gray-300 mb-1;
+ }
+
+ .card {
+ @apply bg-surface-700 border border-surface-500 rounded-sm;
+ }
+
+ .code-container {
+ @apply bg-surface-800 border border-surface-500 rounded-sm font-mono text-xs overflow-x-auto;
+ }
+
+ .file-row {
+ @apply flex items-center gap-3 px-4 py-2.5 border-b border-surface-600
+ hover:bg-surface-600 transition-colors duration-100 text-sm;
+ }
+ .file-row:last-child { @apply border-b-0; }
+
+ .breadcrumb-item {
+ @apply text-brand-500 hover:underline text-sm;
+ }
+
+ .commit-row {
+ @apply flex items-start justify-between px-4 py-3 border-b border-surface-600
+ hover:bg-surface-600 transition-colors duration-100;
+ }
+ .commit-row:last-child { @apply border-b-0; }
+
+ .badge {
+ @apply inline-flex items-center px-2 py-0.5 rounded text-xs font-medium;
+ }
+ .badge-gray { @apply badge bg-surface-600 text-gray-300; }
+ .badge-blue { @apply badge bg-brand-500/10 text-brand-400; }
+
+ .tab-item {
+ @apply px-4 py-2.5 text-sm font-medium text-gray-500 border-b-2 border-transparent
+ hover:text-gray-300 hover:border-gray-600 transition-all duration-150;
+ }
+ .tab-item.active {
+ @apply text-gray-100 border-brand-500;
+ }
+
+ .prose-readme h1 { @apply text-2xl font-semibold mb-4 mt-6 pb-2 border-b border-surface-600; }
+ .prose-readme h2 { @apply text-xl font-semibold mb-3 mt-5 pb-2 border-b border-surface-600; }
+ .prose-readme h3 { @apply text-lg font-medium mb-2 mt-4; }
+ .prose-readme p { @apply mb-4 leading-7; }
+ .prose-readme ul { @apply list-disc pl-6 mb-4 space-y-1; }
+ .prose-readme ol { @apply list-decimal pl-6 mb-4 space-y-1; }
+ .prose-readme li { @apply leading-7; }
+ .prose-readme a { @apply text-brand-500 hover:underline; }
+ .prose-readme code { @apply bg-surface-600 px-1.5 py-0.5 rounded text-xs font-mono text-gray-200; }
+ .prose-readme pre { @apply bg-surface-800 border border-surface-500 rounded-sm p-4 overflow-x-auto mb-4; }
+ .prose-readme pre code { @apply bg-transparent p-0; }
+ .prose-readme table { @apply w-full mb-4 border-collapse border border-surface-500; }
+ .prose-readme th { @apply bg-surface-600 border border-surface-500 px-3 py-2 text-left font-medium text-sm; }
+ .prose-readme td { @apply border border-surface-500 px-3 py-2 text-sm; }
+ .prose-readme blockquote { @apply border-l-4 border-surface-500 pl-4 italic text-gray-400 my-4; }
+ .prose-readme hr { @apply border-surface-600 my-6; }
+ .prose-readme img { @apply max-w-full; }
+
+ .diff-add { @apply bg-green-900/30 text-green-300; }
+ .diff-remove { @apply bg-red-900/30 text-red-300; }
+ .diff-header { @apply bg-blue-900/30 text-blue-300; }
+}
+
+.highlight .c { color: #8b949e; font-style: italic }
+.highlight .err { color: #f85149; background-color: #3d1117 }
+.highlight .k { color: #ff7b72; font-weight: bold }
+.highlight .o { color: #ff7b72 }
+.highlight .cm { color: #8b949e; font-style: italic }
+.highlight .cp { color: #ff7b72 }
+.highlight .c1 { color: #8b949e; font-style: italic }
+.highlight .cs { color: #8b949e; font-weight: bold; font-style: italic }
+.highlight .gd { color: #ffa198; background-color: #3d1117 }
+.highlight .ge { font-style: italic }
+.highlight .gr { color: #f85149 }
+.highlight .gh { color: #79c0ff; font-weight: bold }
+.highlight .gi { color: #aff5b4; background-color: #1a4721 }
+.highlight .go { color: #8b949e }
+.highlight .gp { color: #8b949e }
+.highlight .gs { font-weight: bold }
+.highlight .gu { color: #79c0ff }
+.highlight .gt { color: #f85149 }
+.highlight .kc { color: #ff7b72; font-weight: bold }
+.highlight .kd { color: #ff7b72; font-weight: bold }
+.highlight .kp { color: #ff7b72; font-weight: bold }
+.highlight .kr { color: #ff7b72; font-weight: bold }
+.highlight .kt { color: #ffa657; font-weight: bold }
+.highlight .m { color: #79c0ff }
+.highlight .s { color: #a5d6ff }
+.highlight .na { color: #79c0ff }
+.highlight .nb { color: #ffa657 }
+.highlight .nc { color: #ffa657; font-weight: bold }
+.highlight .no { color: #79c0ff }
+.highlight .ni { color: #d2a8ff }
+.highlight .ne { color: #ffa657; font-weight: bold }
+.highlight .nf { color: #d2a8ff; font-weight: bold }
+.highlight .nn { color: #ffa657 }
+.highlight .nt { color: #7ee787 }
+.highlight .nv { color: #ffa657 }
+.highlight .ow { color: #ff7b72; font-weight: bold }
+.highlight .w { color: #484f58 }
+.highlight .mf { color: #79c0ff }
+.highlight .mh { color: #79c0ff }
+.highlight .mi { color: #79c0ff }
+.highlight .mo { color: #79c0ff }
+.highlight .sb { color: #a5d6ff }
+.highlight .sc { color: #a5d6ff }
+.highlight .sd { color: #a5d6ff }
+.highlight .s2 { color: #a5d6ff }
+.highlight .se { color: #79c0ff }
+.highlight .sh { color: #a5d6ff }
+.highlight .si { color: #a5d6ff }
+.highlight .sx { color: #a5d6ff }
+.highlight .sr { color: #7ee787 }
+.highlight .s1 { color: #a5d6ff }
+.highlight .ss { color: #79c0ff }
+.highlight .bp { color: #79c0ff }
+.highlight .vc { color: #ffa657 }
+.highlight .vg { color: #ffa657 }
+.highlight .vi { color: #ffa657 }
+.highlight .il { color: #79c0ff }
app/controllers/application_controller.rb
+28
new file mode 100644
index 0000000..2fcb6a4
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,28 @@
+class ApplicationController < ActionController::Base
+ include ActionView::Helpers::SanitizeHelper
+
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
+ allow_browser versions: :modern
+
+ # Changes to the importmap will invalidate the etag for HTML responses
+ stale_when_importmap_changes
+
+ helper_method :current_user, :signed_in?
+
+ private
+
+ def current_user
+ @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
+ end
+
+ def signed_in?
+ current_user.present?
+ end
+
+ def require_sign_in!
+ unless signed_in?
+ session[:return_to] = request.fullpath
+ redirect_to signin_path, alert: "Please sign in to continue."
+ end
+ end
+end
app/controllers/blobs_controller.rb
+76
new file mode 100644
index 0000000..8817e31
--- /dev/null
+++ b/app/controllers/blobs_controller.rb
@@ -0,0 +1,76 @@
+class BlobsController < ApplicationController
+ before_action :load_owner
+ before_action :load_repository
+ before_action :ensure_can_read!
+
+ def show
+ @branch = params[:branch]
+ @file_path = params[:path]
+ @path_parts = @file_path.to_s.split("/").reject(&:blank?)
+
+ content = GitRepositoryService.file_content(@repository.disk_path, @branch, @file_path)
+ if content.nil?
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ return
+ end
+
+ @raw_content = content
+ @filename = File.basename(@file_path)
+ @extension = File.extname(@filename).delete_prefix(".")
+ @is_binary = content.encoding != Encoding::UTF_8 || !content.valid_encoding? || binary_content?(content)
+ @file_size = content.bytesize
+
+ unless @is_binary
+ @highlighted = highlight_code(content, @filename)
+ @line_count = content.lines.count
+ end
+ end
+
+ def raw
+ @branch = params[:branch]
+ @file_path = params[:path]
+
+ content = GitRepositoryService.file_content(@repository.disk_path, @branch, @file_path)
+ if content.nil?
+ head :not_found
+ return
+ end
+
+ send_data content,
+ type: "text/plain; charset=utf-8",
+ disposition: "inline",
+ filename: File.basename(@file_path)
+ end
+
+ private
+
+ def load_owner
+ @owner = User.find_by!(username: params[:username])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def load_repository
+ @repository = @owner.repositories.find_by!(name: params[:repository])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def ensure_can_read!
+ unless !@repository.is_private || (signed_in? && current_user == @owner)
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+ end
+
+ def binary_content?(content)
+ content.bytes.first(8192).include?(0)
+ end
+
+ def highlight_code(content, filename)
+ lexer = Rouge::Lexer.guess(filename: filename, source: content)
+ formatter = Rouge::Formatters::HTML.new
+ formatter.format(lexer.lex(content)).html_safe
+ rescue StandardError
+ Rouge::Formatters::HTML.new.format(Rouge::Lexers::PlainText.new.lex(content)).html_safe
+ end
+end
app/controllers/commits_controller.rb
+58
new file mode 100644
index 0000000..e3e80fc
--- /dev/null
+++ b/app/controllers/commits_controller.rb
@@ -0,0 +1,58 @@
+class CommitsController < ApplicationController
+ before_action :load_owner
+ before_action :load_repository
+ before_action :ensure_can_read!
+
+ def index
+ @branch = params[:branch] || @repository.default_branch
+ @page = (params[:page] || 1).to_i
+ @per_page = 20
+ @offset = (@page - 1) * @per_page
+
+ unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, @branch)
+ redirect_to repository_path(@owner.username, @repository.name)
+ return
+ end
+
+ @commits = GitRepositoryService.commits(
+ @repository.disk_path, @branch,
+ limit: @per_page, offset: @offset
+ )
+ @total = GitRepositoryService.commit_count(@repository.disk_path, @branch)
+ @total_pages = (@total.to_f / @per_page).ceil
+ end
+
+ def show
+ @sha = params[:sha]
+
+ unless @repository.initialized?
+ redirect_to repository_path(@owner.username, @repository.name)
+ return
+ end
+
+ @commit = GitRepositoryService.commit(@repository.disk_path, @sha)
+ if @commit.nil?
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+ end
+
+ private
+
+ def load_owner
+ @owner = User.find_by!(username: params[:username])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def load_repository
+ @repository = @owner.repositories.find_by!(name: params[:repository])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def ensure_can_read!
+ unless !@repository.is_private || (signed_in? && current_user == @owner)
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+ end
+end
app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
app/controllers/dev/panel_controller.rb
+35
new file mode 100644
index 0000000..f11c17e
--- /dev/null
+++ b/app/controllers/dev/panel_controller.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+module Dev
+ class PanelController < ApplicationController
+ CACHE_KEY = "dev:smbcloud_environment"
+ VALID_ENVIRONMENTS = %w[dev production].freeze
+
+ skip_before_action :require_sign_in!, raise: false
+ skip_before_action :verify_authenticity_token
+
+ # GET /dev/environment
+ def show
+ render json: { environment: current_environment }
+ end
+
+ # PUT /dev/environment
+ def update
+ env = params[:environment].to_s.strip.downcase
+
+ unless VALID_ENVIRONMENTS.include?(env)
+ return render json: { error: "Invalid environment. Must be one of: #{VALID_ENVIRONMENTS.join(', ')}" },
+ status: :unprocessable_entity
+ end
+
+ Rails.cache.write(CACHE_KEY, env, expires_in: 24.hours)
+ render json: { environment: env }
+ end
+
+ private
+
+ def current_environment
+ Rails.cache.read(CACHE_KEY) || ENV.fetch("SMBCLOUD_ENVIRONMENT", "dev")
+ end
+ end
+end
app/controllers/pages_controller.rb
+8
new file mode 100644
index 0000000..aac3dfe
--- /dev/null
+++ b/app/controllers/pages_controller.rb
@@ -0,0 +1,8 @@
+class PagesController < ApplicationController
+ def home
+ if signed_in?
+ @repositories = current_user.repositories.order(updated_at: :desc).limit(10)
+ render :dashboard
+ end
+ end
+end
app/controllers/registrations_controller.rb
+70
new file mode 100644
index 0000000..cac70e7
--- /dev/null
+++ b/app/controllers/registrations_controller.rb
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+class RegistrationsController < ApplicationController
+ before_action :redirect_if_signed_in
+
+ # GET /auth/signup
+ def new
+ end
+
+ # POST /auth/signup
+ def create
+ email = params[:email].to_s.strip.downcase
+ password = params[:password].to_s
+ password_confirm = params[:password_confirmation].to_s
+
+ if email.blank? || password.blank?
+ flash.now[:alert] = "Email and password are required."
+ return render :new, status: :unprocessable_entity
+ end
+
+ if password != password_confirm
+ flash.now[:alert] = "Passwords do not match."
+ return render :new, status: :unprocessable_entity
+ end
+
+ if password.length < 8
+ flash.now[:alert] = "Password must be at least 8 characters."
+ return render :new, status: :unprocessable_entity
+ end
+
+ # Step 1 — create the account on smbCloud
+ SmbcloudAuthService.signup(email: email, password: password)
+
+ # Step 2 — log straight in
+ access_token = SmbcloudAuthService.login(email: email, password: password)
+ profile = SmbcloudAuthService.me(access_token: access_token)
+ user = User.find_or_create_from_smbcloud(profile.merge(access_token: access_token))
+
+ reset_session
+ session[:user_id] = user.id
+
+ redirect_to root_path, notice: "Welcome to siGit, #{user.display_name_or_username}!"
+
+ rescue SmbcloudAuthService::AccountIncompleteError
+ # Account created but requires email verification before first login
+ redirect_to signin_path,
+ notice: "Account created. Check your email to verify it, then sign in."
+
+ rescue SmbcloudAuthService::AuthenticationError => e
+ flash.now[:alert] = e.message.presence || "Sign-up failed. Please try again."
+ render :new, status: :unprocessable_entity
+
+ rescue KeyError => e
+ Rails.logger.error("smbCloud configuration error during signup: #{e.message}")
+ flash.now[:alert] = "Authentication service is not configured. Please contact support."
+ render :new, status: :internal_server_error
+
+ rescue => e
+ Rails.logger.error("Unexpected signup error for #{email.inspect}: #{e.message}\n" \
+ "#{e.backtrace.first(5).join("\n")}")
+ flash.now[:alert] = "An unexpected error occurred. Please try again."
+ render :new, status: :internal_server_error
+ end
+
+ private
+
+ def redirect_if_signed_in
+ redirect_to root_path, notice: "You are already signed in." if signed_in?
+ end
+end
app/controllers/repositories_controller.rb
+115
new file mode 100644
index 0000000..21538be
--- /dev/null
+++ b/app/controllers/repositories_controller.rb
@@ -0,0 +1,115 @@
+class RepositoriesController < ApplicationController
+ before_action :require_sign_in!, only: [ :new, :create ]
+ before_action :load_owner, only: [ :show, :tree ]
+ before_action :load_repository, only: [ :show, :tree ]
+ before_action :ensure_can_read!, only: [ :show, :tree ]
+
+ def new
+ @repository = Repository.new
+ end
+
+ def create
+ @repository = current_user.repositories.new(repository_params)
+ @repository.disk_path = GitRepositoryService.repo_path(
+ current_user.username, @repository.name
+ )
+
+ if @repository.save
+ GitRepositoryService.create_bare_repo(current_user.username, @repository.name)
+ GitRepositoryService.initialize_with_readme(
+ current_user.username, @repository.name,
+ default_branch: @repository.default_branch
+ )
+ redirect_to repository_path(current_user.username, @repository.name),
+ notice: "Repository created successfully."
+ else
+ render :new, status: :unprocessable_entity
+ end
+ rescue => e
+ Rails.logger.error("Repo create error: #{e.message}")
+ @repository.errors.add(:base, "Failed to initialize repository on disk.")
+ render :new, status: :unprocessable_entity
+ end
+
+ def show
+ branch = params[:branch] || @repository.default_branch
+ @branch = branch
+ @branches = GitRepositoryService.branches(@repository.disk_path) rescue []
+
+ unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, branch)
+ @empty = true
+ return
+ end
+
+ @tree = GitRepositoryService.list_tree(@repository.disk_path, branch)
+ readme = GitRepositoryService.readme_content(@repository.disk_path, branch)
+ if readme
+ @readme_html = render_markdown(readme[:content])
+ @readme_filename = readme[:filename]
+ end
+ @commit_count = GitRepositoryService.commit_count(@repository.disk_path, branch)
+ @recent_commits = GitRepositoryService.commits(@repository.disk_path, branch, limit: 3)
+ end
+
+ def tree
+ branch = params[:branch] || @repository.default_branch
+ @branch = branch
+ tree_path = params[:path]
+
+ unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, branch)
+ redirect_to repository_path(@owner.username, @repository.name)
+ return
+ end
+
+ @tree = GitRepositoryService.list_tree(@repository.disk_path, branch, tree_path)
+ @current_path = tree_path
+ @path_parts = tree_path.to_s.split("/").reject(&:blank?)
+
+ # If it's actually a file, redirect to the blob view
+ if @tree.empty?
+ redirect_to repository_blob_path(@owner.username, @repository.name, branch, tree_path)
+ end
+ end
+
+ private
+
+ def repository_params
+ params.require(:repository).permit(:name, :description, :default_branch, :is_private)
+ end
+
+ def load_owner
+ @owner = User.find_by!(username: params[:username])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def load_repository
+ @repository = @owner.repositories.find_by!(name: params[:repository])
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def ensure_can_read!
+ unless !@repository.is_private || (signed_in? && current_user == @owner)
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+ end
+
+ def render_markdown(text)
+ renderer = Redcarpet::Render::HTML.new(
+ hard_wrap: false,
+ link_attributes: { target: "_blank", rel: "noopener noreferrer" },
+ no_images: false,
+ safe_links_only: true
+ )
+ markdown = Redcarpet::Markdown.new(
+ renderer,
+ autolink: true,
+ tables: true,
+ fenced_code_blocks: true,
+ strikethrough: true,
+ space_after_headers: true
+ )
+ markdown.render(text).html_safe
+ end
+end
app/controllers/sessions_controller.rb
+80
new file mode 100644
index 0000000..0c45db7
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+class SessionsController < ApplicationController
+ before_action :redirect_if_signed_in, only: [:new, :create]
+
+ # GET /auth/smbcloud
+ # Shows the email/password sign-in form.
+ def new
+ end
+
+ # POST /auth/smbcloud
+ # Authenticates against smbCloud Auth using the native gem, then
+ # fetches the user's profile and upserts a local User record.
+ def create
+ email = params[:email].to_s.strip
+ password = params[:password].to_s
+
+ if email.blank? || password.blank?
+ flash.now[:alert] = "Email and password are required."
+ render :new, status: :unprocessable_entity
+ return
+ end
+
+ # Step 1 — authenticate; raises SmbcloudAuthService::AuthenticationError on failure
+ access_token = SmbcloudAuthService.login(email: email, password: password)
+
+ # Step 2 — fetch profile: { id: Integer, email: String, created_at:, updated_at: }
+ profile = SmbcloudAuthService.me(access_token: access_token)
+
+ # Step 3 — upsert local user
+ user = User.find_or_create_from_smbcloud(profile.merge(access_token: access_token))
+
+ # Step 4 — establish session
+ reset_session
+ session[:user_id] = user.id
+
+ return_to = session.delete(:return_to)
+ redirect_to(return_to || root_path, notice: "Welcome, #{user.display_name_or_username}!")
+
+ rescue SmbcloudAuthService::AccountNotFoundError
+ flash.now[:alert] = "No account found for that email address."
+ render :new, status: :unprocessable_entity
+
+ rescue SmbcloudAuthService::AccountIncompleteError => e
+ flash.now[:alert] = e.message.presence ||
+ "Your account is not yet active. Please check your email for a verification link."
+ render :new, status: :unprocessable_entity
+
+ rescue SmbcloudAuthService::AuthenticationError => e
+ Rails.logger.warn("smbCloud auth error for #{email.inspect}: #{e.message}")
+ flash.now[:alert] = "Sign-in failed. Please check your credentials and try again."
+ render :new, status: :unprocessable_entity
+
+ rescue KeyError => e
+ # Missing SMBCLOUD_APP_ID / SMBCLOUD_APP_SECRET env vars
+ Rails.logger.error("smbCloud configuration error: #{e.message}")
+ flash.now[:alert] = "Authentication service is not configured. Please contact support."
+ render :new, status: :internal_server_error
+
+ rescue => e
+ Rails.logger.error("Unexpected sign-in error for #{email.inspect}: #{e.message}\n" \
+ "#{e.backtrace.first(5).join("\n")}")
+ flash.now[:alert] = "An unexpected error occurred. Please try again."
+ render :new, status: :internal_server_error
+ end
+
+ # DELETE /auth/signout
+ def destroy
+ access_token = current_user&.access_token
+ SmbcloudAuthService.logout(access_token: access_token) if access_token.present?
+ reset_session
+ redirect_to root_path, notice: "You have been signed out."
+ end
+
+ private
+
+ def redirect_if_signed_in
+ redirect_to root_path, notice: "You are already signed in." if signed_in?
+ end
+end
app/controllers/users_controller.rb
+33
new file mode 100644
index 0000000..d3d1204
--- /dev/null
+++ b/app/controllers/users_controller.rb
@@ -0,0 +1,33 @@
+class UsersController < ApplicationController
+ before_action :require_sign_in!, only: [ :settings, :update_settings ]
+
+ def show
+ @profile_user = User.find_by!(username: params[:username])
+ @repositories = if signed_in? && current_user == @profile_user
+ @profile_user.repositories.order(updated_at: :desc)
+ else
+ @profile_user.repositories.where(is_private: false).order(updated_at: :desc)
+ end
+ rescue ActiveRecord::RecordNotFound
+ render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
+ end
+
+ def settings
+ @user = current_user
+ end
+
+ def update_settings
+ @user = current_user
+ if @user.update(user_settings_params)
+ redirect_to settings_path, notice: "Settings updated."
+ else
+ render :settings, status: :unprocessable_entity
+ end
+ end
+
+ private
+
+ def user_settings_params
+ params.require(:user).permit(:display_name, :avatar_url)
+ end
+end
app/helpers/application_helper.rb
+2
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
app/javascript/application.js
+2
new file mode 100644
index 0000000..76c8ec2
--- /dev/null
+++ b/app/javascript/application.js
@@ -0,0 +1,2 @@
+import "@hotwired/turbo-rails"
+import "controllers"
app/javascript/controllers/application.js
+9
new file mode 100644
index 0000000..1213e85
--- /dev/null
+++ b/app/javascript/controllers/application.js
@@ -0,0 +1,9 @@
+import { Application } from "@hotwired/stimulus"
+
+const application = Application.start()
+
+// Configure Stimulus development experience
+application.debug = false
+window.Stimulus = application
+
+export { application }
app/javascript/controllers/dev_panel_controller.js
+113
new file mode 100644
index 0000000..e850925
--- /dev/null
+++ b/app/javascript/controllers/dev_panel_controller.js
@@ -0,0 +1,113 @@
+import { Controller } from "@hotwired/stimulus"
+
+const PRESETS = [
+ { label: "Dev", env: "dev", dot: "bg-amber-400" },
+ { label: "Production", env: "production", dot: "bg-emerald-400" },
+]
+
+export default class extends Controller {
+ static targets = ["panel"]
+ static values = { open: Boolean, environment: String, loading: Boolean }
+
+ connect() {
+ this.loadEnvironment()
+ }
+
+ toggle() {
+ this.openValue = !this.openValue
+ this.render()
+ }
+
+ async select(event) {
+ const env = event.currentTarget.dataset.env
+ if (env === this.environmentValue || this.loadingValue) return
+ this.loadingValue = true
+ this.render()
+ try {
+ const res = await fetch("/dev/environment", {
+ method: "PUT",
+ headers: { "Content-Type": "application/json", "X-CSRF-Token": this.csrfToken },
+ body: JSON.stringify({ environment: env }),
+ })
+ const data = await res.json()
+ this.environmentValue = data.environment
+ } catch (_) {}
+ finally {
+ this.loadingValue = false
+ this.render()
+ }
+ }
+
+ async loadEnvironment() {
+ try {
+ const res = await fetch("/dev/environment")
+ const data = await res.json()
+ this.environmentValue = data.environment
+ } catch (_) {
+ this.environmentValue = "dev"
+ }
+ this.render()
+ }
+
+ render() {
+ const panel = this.panelTarget
+ const current = this.environmentValue
+ const loading = this.loadingValue
+
+ if (!this.openValue) {
+ panel.classList.add("hidden")
+ panel.innerHTML = ""
+ return
+ }
+
+ panel.classList.remove("hidden")
+
+ const rows = PRESETS.map((p, i) => {
+ const isActive = p.env === current
+ const isLast = i === PRESETS.length - 1
+ const activeBg = isActive ? "bg-brand-500/10" : "hover:bg-surface-600"
+ const border = isLast ? "" : "border-b border-surface-600"
+ const checkFill = isActive ? "bg-brand-500 border-brand-500" : "border-surface-400"
+ const labelCol = isActive ? "text-brand-400" : "text-gray-200"
+ const check = isActive
+ ? `<svg class="w-2.5 h-2.5 text-white" viewBox="0 0 12 12" fill="currentColor"><path d="M10.28 2.28a.75.75 0 0 0-1.06 0L4.5 7 2.78 5.28a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0 0-1.06Z"/></svg>`
+ : ""
+ const dot = isActive
+ ? `<span class="ml-auto h-1.5 w-1.5 rounded-full ${p.dot}"></span>`
+ : ""
+ return `<button data-env="${p.env}"
+ data-action="click->dev-panel#select"
+ ${loading ? "disabled" : ""}
+ class="flex w-full items-center gap-3 px-3 py-2.5 text-left transition ${border} ${activeBg} disabled:opacity-50">
+ <span class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${checkFill}">${check}</span>
+ <div class="min-w-0">
+ <p class="text-sm font-medium leading-tight ${labelCol}">${p.label}</p>
+ <p class="mt-0.5 text-[11px] text-gray-500">${p.env}</p>
+ </div>
+ ${dot}
+ </button>`
+ }).join("")
+
+ panel.innerHTML = `
+ <div class="w-52 overflow-hidden rounded border border-surface-500 bg-surface-700 shadow-xl">
+ <div class="flex items-center justify-between px-3 py-2 border-b border-surface-600">
+ <div class="flex items-center gap-2">
+ <span class="rounded bg-brand-500/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-brand-400">dev</span>
+ <span class="text-xs text-gray-400">Auth Target</span>
+ </div>
+ <button data-action="click->dev-panel#toggle"
+ class="rounded p-0.5 text-gray-500 hover:bg-surface-600 hover:text-gray-300 transition-colors">
+ <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 1 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06z"/>
+ </svg>
+ </button>
+ </div>
+ <div>${rows}</div>
+ </div>
+ `
+ }
+
+ get csrfToken() {
+ return document.querySelector("meta[name=csrf-token]")?.content ?? ""
+ }
+}
app/javascript/controllers/index.js
+3
new file mode 100644
index 0000000..6ffb4e9
--- /dev/null
+++ b/app/javascript/controllers/index.js
@@ -0,0 +1,3 @@
+import { application } from "controllers/application"
+import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
+eagerLoadControllersFrom("controllers", application)
app/jobs/application_job.rb
+7
new file mode 100644
index 0000000..d394c3d
--- /dev/null
+++ b/app/jobs/application_job.rb
@@ -0,0 +1,7 @@
+class ApplicationJob < ActiveJob::Base
+ # Automatically retry jobs that encountered a deadlock
+ # retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer available
+ # discard_on ActiveJob::DeserializationError
+end
app/mailers/application_mailer.rb
+4
new file mode 100644
index 0000000..3c34c81
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: "from@example.com"
+ layout "mailer"
+end
app/models/application_record.rb
+3
new file mode 100644
index 0000000..b63caeb
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ primary_abstract_class
+end
app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
app/models/repository.rb
+43
new file mode 100644
index 0000000..8fc44b9
--- /dev/null
+++ b/app/models/repository.rb
@@ -0,0 +1,43 @@
+class Repository < ApplicationRecord
+ belongs_to :user
+
+ validates :name, presence: true,
+ format: {
+ with: /\A(?!\.)[a-zA-Z0-9_.\-]+(?<!\.)(?<!\.\.)\z/,
+ message: "may only contain letters, numbers, hyphens, underscores, and dots; must not start or end with a dot; must not contain consecutive dots"
+ },
+ uniqueness: { scope: :user_id, case_sensitive: false }
+ validates :default_branch, presence: true
+
+ validate :no_consecutive_dots_in_name
+ validate :no_leading_hyphen_in_name
+
+ def to_param
+ name
+ end
+
+ def full_name
+ "#{user.username}/#{name}"
+ end
+
+ def git_path
+ disk_path
+ end
+
+ def initialized?
+ return false if git_path.blank?
+ Dir.exist?(git_path) && File.exist?(File.join(git_path, "HEAD"))
+ end
+
+ private
+
+ def no_consecutive_dots_in_name
+ return if name.blank?
+ errors.add(:name, "must not contain consecutive dots") if name.include?("..")
+ end
+
+ def no_leading_hyphen_in_name
+ return if name.blank?
+ errors.add(:name, "must not start with a hyphen") if name.start_with?("-")
+ end
+end
app/models/ssh_key.rb
+7
new file mode 100644
index 0000000..f89117f
--- /dev/null
+++ b/app/models/ssh_key.rb
@@ -0,0 +1,7 @@
+class SshKey < ApplicationRecord
+ belongs_to :user
+
+ validates :title, presence: true
+ validates :key_text, presence: true
+ validates :fingerprint, presence: true, uniqueness: { scope: :user_id }
+end
app/models/user.rb
+104
new file mode 100644
index 0000000..16d6bbc
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,104 @@
+# frozen_string_literal: true
+
+class User < ApplicationRecord
+ has_many :repositories, dependent: :destroy
+ has_many :ssh_keys, dependent: :destroy
+
+ validates :smbcloud_id,
+ presence: true,
+ uniqueness: true,
+ numericality: { only_integer: true, greater_than: 0 }
+
+ validates :email,
+ presence: true,
+ uniqueness: { case_sensitive: false },
+ format: { with: URI::MailTo::EMAIL_REGEXP, message: "is not a valid email address" }
+
+ validates :username,
+ presence: true,
+ uniqueness: { case_sensitive: false },
+ format: {
+ with: /\A[a-z0-9][a-z0-9\-]{0,37}[a-z0-9]?\z|\A[a-z0-9]\z/,
+ message: "may only contain lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen"
+ },
+ length: { minimum: 1, maximum: 39 }
+
+ # ---------------------------------------------------------------------------
+ # URL helpers
+ # ---------------------------------------------------------------------------
+
+ def to_param
+ username
+ end
+
+ # ---------------------------------------------------------------------------
+ # Display helpers
+ # ---------------------------------------------------------------------------
+
+ def display_name_or_username
+ display_name.presence || username
+ end
+
+ def avatar_url_or_default
+ return avatar_url if avatar_url.present?
+
+ encoded_name = URI.encode_www_form_component(display_name_or_username)
+ "https://ui-avatars.com/api/?name=#{encoded_name}&background=0057B8&color=fff&size=128"
+ end
+
+ # ---------------------------------------------------------------------------
+ # smbCloud Auth integration
+ # ---------------------------------------------------------------------------
+
+ # Upserts a user record from the data returned by:
+ # 1. SmbcloudAuthService.me(access_token:)
+ # → { id: Integer, email: String, created_at: String, updated_at: String }
+ # 2. The access_token passed through from login.
+ #
+ # Accepts either string or symbol keys.
+ #
+ # Returns the persisted User. Raises ActiveRecord::RecordInvalid on failure.
+ def self.find_or_create_from_smbcloud(userinfo, access_token: nil)
+ smbcloud_id = Integer(userinfo[:id] || userinfo["id"])
+ email = (userinfo[:email] || userinfo["email"]).to_s.strip.downcase
+
+ user = find_or_initialize_by(smbcloud_id: smbcloud_id)
+
+ # Always sync email and token in case they changed on the auth server.
+ user.email = email if email.present?
+ user.access_token = access_token if access_token.present?
+
+ # Derive a username only for new records.
+ user.username = generate_username_from_email(email) if user.new_record?
+
+ user.save!
+ user
+ end
+
+ # ---------------------------------------------------------------------------
+ # Private helpers
+ # ---------------------------------------------------------------------------
+
+ def self.generate_username_from_email(email)
+ base = email.to_s
+ .split("@")
+ .first
+ .to_s
+ .downcase
+ .gsub(/[^a-z0-9\-]/, "-") # replace non-slug chars with hyphens
+ .gsub(/-{2,}/, "-") # collapse consecutive hyphens
+ .gsub(/\A-+|-+\z/, "") # strip leading/trailing hyphens
+ .slice(0, 39)
+ .presence || "user"
+
+ return base unless exists?(username: base)
+
+ # Append a random 4-char suffix until we find an available handle.
+ loop do
+ suffix = SecureRandom.alphanumeric(4).downcase
+ candidate = "#{base.slice(0, 34)}-#{suffix}"
+ break candidate unless exists?(username: candidate)
+ end
+ end
+ private_class_method :generate_username_from_email
+end
app/services/git_repository_service.rb
+132
new file mode 100644
index 0000000..b8dbb1e
--- /dev/null
+++ b/app/services/git_repository_service.rb
@@ -0,0 +1,132 @@
+require "open3"
+require "fileutils"
+
+class GitRepositoryService
+ REPOS_BASE = ENV.fetch("SIGITSI_REPOS_PATH", Rails.root.join("repos").to_s)
+
+ def self.repo_path(username, reponame)
+ File.join(REPOS_BASE, username, "#{reponame}.git")
+ end
+
+ def self.create_bare_repo(username, reponame)
+ path = repo_path(username, reponame)
+ FileUtils.mkdir_p(path)
+ _stdout, _stderr, status = Open3.capture3("git", "init", "--bare", path)
+ raise "git init failed" unless status.success?
+ path
+ end
+
+ def self.initialize_with_readme(username, reponame, default_branch: "main")
+ bare_path = repo_path(username, reponame)
+ Dir.mktmpdir do |tmpdir|
+ system("git", "-C", tmpdir, "init", "-b", default_branch, exception: true)
+ system("git", "-C", tmpdir, "config", "user.email", "sigitsi@localhost", exception: true)
+ system("git", "-C", tmpdir, "config", "user.name", "siGit", exception: true)
+ readme = File.join(tmpdir, "README.md")
+ File.write(readme, "# #{reponame}\n\nWelcome to #{reponame}.\n")
+ system("git", "-C", tmpdir, "add", ".", exception: true)
+ system("git", "-C", tmpdir, "commit", "-m", "Initial commit", exception: true)
+ system("git", "-C", tmpdir, "remote", "add", "origin", bare_path, exception: true)
+ system("git", "-C", tmpdir, "push", "origin", default_branch, exception: true)
+ end
+ end
+
+ def self.default_branch(path)
+ out, _err, status = Open3.capture3("git", "--git-dir", path, "symbolic-ref", "--short", "HEAD")
+ return "main" unless status.success?
+ out.strip
+ end
+
+ def self.list_tree(path, branch, tree_path = "")
+ prefix = tree_path.blank? ? "" : "#{tree_path.chomp("/")}/"
+ args = ["git", "--git-dir", path, "ls-tree", "--long", "#{branch}:#{prefix}"]
+ out, _err, status = Open3.capture3(*args)
+ return [] unless status.success?
+ out.lines.filter_map do |line|
+ parts = line.split
+ next unless parts.length >= 5
+ mode, type, _sha, _size, name = parts[0], parts[1], parts[2], parts[3], parts[4..]&.join(" ")&.strip
+ { mode: mode, type: type, name: name, path: prefix + name }
+ end.sort_by { |e| [e[:type] == "tree" ? 0 : 1, e[:name].downcase] }
+ end
+
+ def self.file_content(path, branch, file_path)
+ out, _err, status = Open3.capture3("git", "--git-dir", path, "show", "#{branch}:#{file_path}")
+ return nil unless status.success?
+ out
+ end
+
+ def self.commits(path, branch, limit: 20, offset: 0)
+ format = "%H%x00%h%x00%s%x00%an%x00%ae%x00%ad%x00%cn"
+ out, _err, status = Open3.capture3(
+ "git", "--git-dir", path, "log",
+ "--format=#{format}", "--date=iso-strict",
+ "--skip=#{offset}", "-n", limit.to_s,
+ branch
+ )
+ return [] unless status.success?
+ out.lines.filter_map do |line|
+ parts = line.chomp.split("\x00")
+ next unless parts.length == 7
+ sha, short_sha, subject, author_name, author_email, authored_date, committer_name = parts
+ {
+ sha: sha,
+ short_sha: short_sha,
+ subject: subject,
+ author_name: author_name,
+ author_email: author_email,
+ authored_date: Time.parse(authored_date),
+ committer_name: committer_name
+ }
+ end
+ end
+
+ def self.commit(path, sha)
+ format = "%H%x00%h%x00%s%x00%B%x00%an%x00%ae%x00%ad%x00%T"
+ out, _err, status = Open3.capture3(
+ "git", "--git-dir", path, "show",
+ "--format=#{format}", "--stat", "--no-patch",
+ sha
+ )
+ return nil unless status.success?
+ lines = out.split("\n")
+ parts = lines.first.to_s.split("\x00")
+ return nil unless parts.length == 8
+ diff_out, _e, _s = Open3.capture3("git", "--git-dir", path, "show", "--format=", sha)
+ {
+ sha: parts[0],
+ short_sha: parts[1],
+ subject: parts[2],
+ body: parts[3],
+ author_name: parts[4],
+ author_email: parts[5],
+ authored_date: (Time.parse(parts[6]) rescue nil),
+ diff: diff_out
+ }
+ end
+
+ def self.readme_content(path, branch)
+ %w[README.md README.txt README readme.md].each do |name|
+ content = file_content(path, branch, name)
+ return { content: content, filename: name } if content
+ end
+ nil
+ end
+
+ def self.branch_exists?(path, branch)
+ _out, _err, status = Open3.capture3("git", "--git-dir", path, "rev-parse", "--verify", branch)
+ status.success?
+ end
+
+ def self.branches(path)
+ out, _err, status = Open3.capture3("git", "--git-dir", path, "branch", "--format=%(refname:short)")
+ return [] unless status.success?
+ out.lines.map(&:strip).reject(&:blank?)
+ end
+
+ def self.commit_count(path, branch)
+ out, _err, status = Open3.capture3("git", "--git-dir", path, "rev-list", "--count", branch)
+ return 0 unless status.success?
+ out.strip.to_i
+ end
+end
app/services/smbcloud_auth_service.rb
+150
new file mode 100644
index 0000000..d161c68
--- /dev/null
+++ b/app/services/smbcloud_auth_service.rb
@@ -0,0 +1,150 @@
+# frozen_string_literal: true
+
+# Thin wrapper around the smbcloud-auth native gem.
+#
+# The gem (`smbcloud-auth`) is a Magnus/Rust extension that provides
+# direct credential-based auth against the smbCloud Auth API. It exposes:
+#
+# client.login(email:, password:)
+# → { status: "ready"|"not_found"|"incomplete",
+# access_token: String|nil,
+# error_code: Integer|nil,
+# message: String|nil }
+#
+# client.me(access_token:)
+# → { id: Integer, email: String, created_at: String, updated_at: String }
+#
+# client.signup(email:, password:)
+# client.logout(access_token:)
+# client.remove(access_token:)
+#
+# Required env vars:
+# SMBCLOUD_APP_ID – your smbCloud app ID
+# SMBCLOUD_APP_SECRET – your smbCloud app secret
+# SMBCLOUD_ENVIRONMENT – "production" (default) or "dev"
+#
+require "auth"
+
+class SmbcloudAuthService
+ class AuthenticationError < StandardError
+ attr_reader :error_code
+
+ def initialize(message, error_code: nil)
+ super(message)
+ @error_code = error_code
+ end
+ end
+
+ class AccountNotFoundError < AuthenticationError; end
+ class AccountIncompleteError < AuthenticationError; end
+
+ # ---------------------------------------------------------------------------
+ # Client factory
+ # ---------------------------------------------------------------------------
+
+ def self.client
+ SmbCloud::Auth::Client.new(
+ environment: smbcloud_environment,
+ app_id: smbcloud_app_id,
+ app_secret: smbcloud_app_secret
+ )
+ end
+
+ # ---------------------------------------------------------------------------
+ # Public API
+ # ---------------------------------------------------------------------------
+
+ # Authenticates an email/password pair.
+ #
+ # Returns the access_token String on success.
+ # Raises AuthenticationError (or a subclass) on failure.
+ def self.login(email:, password:)
+ result = client.login(email: email, password: password)
+
+ case result[:status]
+ when "ready"
+ result[:access_token]
+ when "not_found"
+ raise AccountNotFoundError.new("No account found for that email address.")
+ when "incomplete"
+ raise AccountIncompleteError.new(
+ result[:message] || "Account setup is incomplete. Please check your email.",
+ error_code: result[:error_code]
+ )
+ else
+ raise AuthenticationError.new("Unexpected authentication response: #{result[:status]}")
+ end
+ rescue SmbCloud::Auth::Error => e
+ raise AuthenticationError.new(e.message, error_code: e.error_code)
+ end
+
+ # Fetches the current user's profile from the smbCloud Auth API.
+ #
+ # Returns a symbolized hash:
+ # { id: Integer, email: String, created_at: String, updated_at: String }
+ def self.me(access_token:)
+ client.me(access_token: access_token)
+ rescue SmbCloud::Auth::Error => e
+ raise AuthenticationError.new(e.message, error_code: e.error_code)
+ end
+
+ # Registers a new account.
+ #
+ # Returns the signup result hash on success.
+ # Raises AuthenticationError on failure.
+ def self.signup(email:, password:)
+ client.signup(email: email, password: password)
+ rescue SmbCloud::Auth::Error => e
+ raise AuthenticationError.new(e.message, error_code: e.error_code)
+ end
+
+ # Invalidates the given access_token on the smbCloud Auth server.
+ def self.logout(access_token:)
+ client.logout(access_token: access_token)
+ rescue SmbCloud::Auth::Error => e
+ Rails.logger.warn("smbCloud logout error (non-fatal): #{e.message}")
+ false
+ end
+
+ # Permanently removes the account from smbCloud Auth.
+ def self.remove(access_token:)
+ client.remove(access_token: access_token)
+ rescue SmbCloud::Auth::Error => e
+ raise AuthenticationError.new(e.message, error_code: e.error_code)
+ end
+
+ # ---------------------------------------------------------------------------
+ # Private helpers
+ # ---------------------------------------------------------------------------
+
+ def self.smbcloud_environment
+ raw = if Rails.env.development?
+ Rails.cache.read("dev:smbcloud_environment") ||
+ ENV.fetch("SMBCLOUD_ENVIRONMENT", "dev")
+ else
+ ENV.fetch("SMBCLOUD_ENVIRONMENT", "production")
+ end.strip.downcase
+
+ case raw
+ when "dev", "development" then SmbCloud::Auth::Environment::DEV
+ when "production" then SmbCloud::Auth::Environment::PRODUCTION
+ else
+ Rails.logger.warn("Unknown SMBCLOUD_ENVIRONMENT '#{raw}', defaulting to production.")
+ SmbCloud::Auth::Environment::PRODUCTION
+ end
+ end
+
+ def self.smbcloud_app_id
+ ENV.fetch("SMBCLOUD_APP_ID") do
+ raise KeyError, "Missing required env var: SMBCLOUD_APP_ID"
+ end
+ end
+
+ def self.smbcloud_app_secret
+ ENV.fetch("SMBCLOUD_APP_SECRET") do
+ raise KeyError, "Missing required env var: SMBCLOUD_APP_SECRET"
+ end
+ end
+
+ private_class_method :client, :smbcloud_environment, :smbcloud_app_id, :smbcloud_app_secret
+end
app/views/blobs/show.html.erb
+63
new file mode 100644
index 0000000..07946e3
--- /dev/null
+++ b/app/views/blobs/show.html.erb
@@ -0,0 +1,63 @@
+<% content_for :title, "#{@filename} · #{@repository.full_name}" %>
+
+<div class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
+ <div class="flex items-center gap-2 text-sm mb-4">
+ <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
+ <span class="text-gray-500">/</span>
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
+ </div>
+ <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "breadcrumb-item font-medium" %>
+ <span class="text-gray-500">/</span>
+ <% @path_parts[0..-2].each_with_index do |part, i| %>
+ <% partial_path = @path_parts[0..i].join("/") %>
+ <%= link_to part, repository_tree_path(@owner.username, @repository.name, @branch, partial_path), class: "breadcrumb-item" %>
+ <span class="text-gray-500">/</span>
+ <% end %>
+ <span class="font-medium text-gray-100"><%= @filename %></span>
+ </nav>
+ <div class="flex items-center gap-0 -mb-px">
+ <div class="tab-item active">Code</div>
+ </div>
+ </div>
+</div>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
+ <div class="card">
+ <div class="px-4 py-2.5 border-b border-surface-600 flex items-center justify-between bg-surface-600">
+ <div class="flex items-center gap-3 text-xs text-gray-400">
+ <span class="font-mono badge-gray"><%= @extension.presence || "text" %></span>
+ <% unless @is_binary %>
+ <span><%= number_with_delimiter(@line_count) %> lines</span>
+ <% end %>
+ <span><%= number_to_human_size(@file_size) %></span>
+ </div>
+ <div class="flex items-center gap-2">
+ <%= link_to "Raw", repository_blob_raw_path(@owner.username, @repository.name, @branch, @file_path),
+ class: "btn-ghost text-xs py-1 px-2.5", target: "_blank" %>
+ </div>
+ </div>
+
+ <% if @is_binary %>
+ <div class="px-6 py-10 text-center text-sm text-gray-400">
+ Binary file — <%= number_to_human_size(@file_size) %>
+ </div>
+ <% else %>
+ <div class="code-container rounded-none border-0 relative">
+ <table class="w-full">
+ <tbody>
+ <% @raw_content.lines.each_with_index do |line, i| %>
+ <tr class="hover:bg-brand-500/10">
+ <td class="text-right text-gray-500 pr-4 pl-4 py-0 select-none w-10 text-xs border-r border-surface-600 align-top" id="L<%= i+1 %>">
+ <a href="#L<%= i+1 %>" class="hover:text-brand-500"><%= i+1 %></a>
+ </td>
+ <td class="pl-4 pr-4 py-0 font-mono text-xs leading-5 whitespace-pre-wrap break-all text-gray-200"><%= line %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+ <% end %>
+ </div>
+</div>
app/views/commits/index.html.erb
+62
new file mode 100644
index 0000000..ba18a7f
--- /dev/null
+++ b/app/views/commits/index.html.erb
@@ -0,0 +1,62 @@
+<% content_for :title, "Commits · #{@repository.full_name}" %>
+
+<div class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
+ <div class="flex items-center gap-2 text-sm mb-4">
+ <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
+ <span class="text-gray-500">/</span>
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
+ </div>
+ <div class="flex items-center gap-0 -mb-px">
+ <%= link_to repository_path(@owner.username, @repository.name), class: "tab-item flex items-center gap-1.5" do %>Code<% end %>
+ <div class="tab-item active flex items-center gap-1.5">
+ Commits
+ <span class="badge-gray"><%= number_with_delimiter(@total) %></span>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
+ <div class="card">
+ <% @commits.each do |commit| %>
+ <div class="commit-row">
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-gray-100 truncate">
+ <%= link_to commit[:subject],
+ repository_commit_path(@owner.username, @repository.name, commit[:sha]),
+ class: "hover:text-brand-500" %>
+ </p>
+ <p class="text-xs text-gray-400 mt-0.5">
+ <span class="font-medium"><%= commit[:author_name] %></span>
+ committed <%= time_ago_in_words(commit[:authored_date]) %> ago
+ </p>
+ </div>
+ <div class="shrink-0 ml-4 flex items-center gap-3">
+ <%= link_to commit[:short_sha],
+ repository_commit_path(@owner.username, @repository.name, commit[:sha]),
+ class: "font-mono text-xs badge-gray hover:bg-surface-500" %>
+ </div>
+ </div>
+ <% end %>
+
+ <% if @commits.empty? %>
+ <div class="px-4 py-12 text-center text-sm text-gray-400">No commits yet.</div>
+ <% end %>
+ </div>
+
+ <!-- Pagination -->
+ <% if @total_pages > 1 %>
+ <div class="mt-6 flex items-center justify-center gap-2">
+ <% if @page > 1 %>
+ <%= link_to "← Newer", repository_commits_path(@owner.username, @repository.name, @branch, page: @page - 1),
+ class: "btn-secondary text-xs" %>
+ <% end %>
+ <span class="text-xs text-gray-400">Page <%= @page %> of <%= @total_pages %></span>
+ <% if @page < @total_pages %>
+ <%= link_to "Older →", repository_commits_path(@owner.username, @repository.name, @branch, page: @page + 1),
+ class: "btn-secondary text-xs" %>
+ <% end %>
+ </div>
+ <% end %>
+</div>
app/views/commits/show.html.erb
+44
new file mode 100644
index 0000000..49e7ce3
--- /dev/null
+++ b/app/views/commits/show.html.erb
@@ -0,0 +1,44 @@
+<% content_for :title, "#{@commit[:short_sha]} · #{@repository.full_name}" %>
+
+<div class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-4">
+ <div class="flex items-center gap-2 text-sm mb-3">
+ <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
+ <span class="text-gray-500">/</span>
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
+ </div>
+ <h1 class="text-xl font-semibold text-gray-100 mb-1"><%= @commit[:subject] %></h1>
+ <% if @commit[:body].present? && @commit[:body] != @commit[:subject] %>
+ <p class="text-sm text-gray-400 whitespace-pre-line mb-3"><%= @commit[:body].delete_prefix(@commit[:subject]).strip %></p>
+ <% end %>
+ <div class="flex items-center gap-4 text-xs text-gray-400">
+ <span><strong class="text-gray-300"><%= @commit[:author_name] %></strong> committed</span>
+ <% if @commit[:authored_date] %>
+ <span><%= @commit[:authored_date].strftime("%b %-d, %Y at %H:%M UTC") %></span>
+ <% end %>
+ <span class="font-mono badge-gray"><%= @commit[:sha] %></span>
+ </div>
+ </div>
+</div>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
+ <% if @commit[:diff].present? %>
+ <div class="card">
+ <div class="px-4 py-2.5 border-b border-surface-600 bg-surface-600 text-xs font-medium text-gray-400">Diff</div>
+ <div class="code-container rounded-none border-0 font-mono text-xs leading-5 overflow-x-auto">
+ <% @commit[:diff].lines.each do |line| %>
+ <% css = if line.start_with?("+") && !line.start_with?("+++")
+ "diff-add block px-4"
+ elsif line.start_with?("-") && !line.start_with?("---")
+ "diff-remove block px-4"
+ elsif line.start_with?("@@")
+ "diff-header block px-4"
+ else
+ "block px-4 text-gray-400"
+ end %>
+ <span class="<%= css %>"><%= line %></span>
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+</div>
app/views/layouts/application.html.erb
+42
new file mode 100644
index 0000000..b76324e
--- /dev/null
+++ b/app/views/layouts/application.html.erb
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en" class="h-full">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark">
+ <meta name="theme-color" content="#1a1d21">
+ <meta name="description" content="siGit — quiet Git hosting">
+ <title><%= content_for?(:title) ? "#{yield(:title)} · siGit" : "siGit" %></title>
+ <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
+ <%= javascript_importmap_tags %>
+ <%= csrf_meta_tags %>
+ </head>
+
+ <body class="h-full bg-surface-900">
+ <%= render "shared/navbar" %>
+
+ <% if notice.present? %>
+ <div class="bg-green-900/20 border-b border-green-800/40 px-4 py-3 text-sm text-green-300 text-center" role="alert">
+ <%= notice %>
+ </div>
+ <% end %>
+ <% if alert.present? %>
+ <div class="bg-amber-900/20 border-b border-amber-800/40 px-4 py-3 text-sm text-amber-300 text-center" role="alert">
+ <%= alert %>
+ </div>
+ <% end %>
+
+ <main>
+ <%= yield %>
+ </main>
+
+ <%= render "shared/dev_panel" if Rails.env.development? %>
+
+ <footer class="border-t border-surface-600 mt-16">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 py-8 flex items-center justify-between text-xs text-gray-500">
+ <span>siGit</span>
+ <span>Made with <a href="https://rubyonrails.org" class="hover:text-gray-300">Rails 8</a></span>
+ </div>
+ </footer>
+ </body>
+</html>
app/views/layouts/mailer.html.erb
+13
new file mode 100644
index 0000000..3aac900
--- /dev/null
+++ b/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <style>
+ /* Email styles need to be inline */
+ </style>
+ </head>
+
+ <body>
+ <%= yield %>
+ </body>
+</html>
app/views/layouts/mailer.text.erb
+1
new file mode 100644
index 0000000..37f0bdd
--- /dev/null
+++ b/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
app/views/pages/dashboard.html.erb
+67
new file mode 100644
index 0000000..ead4c12
--- /dev/null
+++ b/app/views/pages/dashboard.html.erb
@@ -0,0 +1,67 @@
+<% content_for :title, "Dashboard" %>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-8">
+ <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
+
+ <aside class="lg:col-span-1">
+ <div class="text-center sm:text-left">
+ <img src="<%= current_user.avatar_url_or_default %>"
+ alt="<%= current_user.display_name_or_username %>"
+ class="w-20 h-20 rounded-full border border-surface-600 mx-auto sm:mx-0 mb-4">
+ <h2 class="font-semibold text-gray-100 text-base"><%= current_user.display_name_or_username %></h2>
+ <p class="text-sm text-gray-400"><%= current_user.username %></p>
+ </div>
+ <div class="mt-6">
+ <%= link_to new_repository_path, class: "btn-secondary w-full justify-center" do %>
+ <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z"/>
+ </svg>
+ New repository
+ <% end %>
+ </div>
+ </aside>
+
+ <main class="lg:col-span-3">
+ <div class="flex items-center justify-between mb-4">
+ <h1 class="text-base font-semibold text-gray-100">Your repositories</h1>
+ <%= link_to user_profile_path(current_user.username),
+ class: "text-xs text-brand-500 hover:underline" do %>View all<% end %>
+ </div>
+
+ <% if @repositories.any? %>
+ <div class="card divide-y divide-surface-600">
+ <% @repositories.each do |repo| %>
+ <div class="px-4 py-3 hover:bg-surface-600 transition-colors">
+ <div class="flex items-start justify-between gap-4">
+ <div class="min-w-0 flex-1">
+ <%= link_to repository_path(current_user.username, repo.name),
+ class: "font-medium text-brand-500 hover:underline text-sm" do %><%= repo.name %><% end %>
+ <% if repo.description.present? %>
+ <p class="text-xs text-gray-400 mt-0.5 truncate"><%= repo.description %></p>
+ <% end %>
+ </div>
+ <div class="flex items-center gap-3 text-xs text-gray-500 shrink-0">
+ <% if repo.is_private %>
+ <span class="badge-gray">Private</span>
+ <% end %>
+ <span><%= time_ago_in_words(repo.updated_at) %> ago</span>
+ </div>
+ </div>
+ </div>
+ <% end %>
+ </div>
+ <% else %>
+ <div class="card px-6 py-12 text-center">
+ <svg class="w-12 h-12 mx-auto text-gray-600 mb-4" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="1">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ d="M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"/>
+ </svg>
+ <p class="text-sm text-gray-400 mb-4">No repositories yet.</p>
+ <%= link_to new_repository_path, class: "btn-primary" do %>Create your first repository<% end %>
+ </div>
+ <% end %>
+ </main>
+
+ </div>
+</div>
app/views/pages/home.html.erb
+62
new file mode 100644
index 0000000..f244352
--- /dev/null
+++ b/app/views/pages/home.html.erb
@@ -0,0 +1,62 @@
+<% content_for :title, "Welcome" %>
+
+<div class="min-h-screen bg-surface-900">
+ <section class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 py-20 sm:py-28">
+ <div class="max-w-3xl">
+ <div class="mb-8 inline-flex items-center gap-3 rounded-full border border-surface-500 bg-surface-700 px-3 py-1.5 text-xs font-medium uppercase tracking-[0.18em] text-gray-400">
+ <img src="/icon.png" alt="siGit" class="h-5 w-auto shrink-0">
+ <span>Quiet Git hosting</span>
+ </div>
+
+ <h1 class="max-w-2xl text-4xl font-semibold tracking-tight text-gray-100 sm:text-6xl">
+ Git hosting that stays out of the way.
+ </h1>
+
+ <p class="mt-6 max-w-xl text-base leading-7 text-gray-400 sm:text-lg">
+ siGit gives you repositories, history, diffs, and a calm place to read code.
+ Nothing loud. Nothing extra.
+ </p>
+
+ <div class="mt-10 flex flex-col gap-3 sm:flex-row">
+ <%= link_to "Sign in", signin_path, class: "btn-primary px-6 py-3 text-sm justify-center" %>
+ <a href="#features" class="btn-secondary px-6 py-3 text-sm justify-center">See what it does</a>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section id="features" class="max-w-6xl mx-auto px-4 sm:px-6 py-16 sm:py-20">
+ <div class="grid grid-cols-1 gap-px overflow-hidden rounded-sm border border-surface-500 bg-surface-500 sm:grid-cols-3">
+ <div class="bg-surface-800 p-8 sm:p-10">
+ <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
+ <span class="text-lg font-semibold">01</span>
+ </div>
+ <h2 class="text-lg font-semibold text-gray-100">Host your repos</h2>
+ <p class="mt-3 text-sm leading-6 text-gray-400">
+ Create repositories, keep them public or private, and get on with the work.
+ </p>
+ </div>
+
+ <div class="bg-surface-800 p-8 sm:p-10">
+ <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
+ <span class="text-lg font-semibold">02</span>
+ </div>
+ <h2 class="text-lg font-semibold text-gray-100">Read your code</h2>
+ <p class="mt-3 text-sm leading-6 text-gray-400">
+ Browse files, inspect commits, and read diffs without fighting the interface.
+ </p>
+ </div>
+
+ <div class="bg-surface-800 p-8 sm:p-10">
+ <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
+ <span class="text-lg font-semibold">03</span>
+ </div>
+ <h2 class="text-lg font-semibold text-gray-100">Keep it simple</h2>
+ <p class="mt-3 text-sm leading-6 text-gray-400">
+ A dark, steady workspace built for long sessions and fewer distractions.
+ </p>
+ </div>
+ </div>
+ </section>
+</div>
app/views/pwa/manifest.json.erb
+22
new file mode 100644
index 0000000..5220fa6
--- /dev/null
+++ b/app/views/pwa/manifest.json.erb
@@ -0,0 +1,22 @@
+{
+ "name": "Sigitsi",
+ "icons": [
+ {
+ "src": "/icon.png",
+ "type": "image/png",
+ "sizes": "512x512"
+ },
+ {
+ "src": "/icon.png",
+ "type": "image/png",
+ "sizes": "512x512",
+ "purpose": "maskable"
+ }
+ ],
+ "start_url": "/",
+ "display": "standalone",
+ "scope": "/",
+ "description": "Sigitsi.",
+ "theme_color": "red",
+ "background_color": "red"
+}
app/views/pwa/service-worker.js
+26
new file mode 100644
index 0000000..b3a13fb
--- /dev/null
+++ b/app/views/pwa/service-worker.js
@@ -0,0 +1,26 @@
+// Add a service worker for processing Web Push notifications:
+//
+// self.addEventListener("push", async (event) => {
+// const { title, options } = await event.data.json()
+// event.waitUntil(self.registration.showNotification(title, options))
+// })
+//
+// self.addEventListener("notificationclick", function(event) {
+// event.notification.close()
+// event.waitUntil(
+// clients.matchAll({ type: "window" }).then((clientList) => {
+// for (let i = 0; i < clientList.length; i++) {
+// let client = clientList[i]
+// let clientPath = (new URL(client.url)).pathname
+//
+// if (clientPath == event.notification.data.path && "focus" in client) {
+// return client.focus()
+// }
+// }
+//
+// if (clients.openWindow) {
+// return clients.openWindow(event.notification.data.path)
+// }
+// })
+// )
+// })
app/views/registrations/new.html.erb
+69
new file mode 100644
index 0000000..71df018
--- /dev/null
+++ b/app/views/registrations/new.html.erb
@@ -0,0 +1,69 @@
+<% content_for :title, "Create account" %>
+
+<div class="min-h-screen bg-surface-900 flex flex-col items-center justify-center px-4 py-16">
+
+ <div class="mb-10 flex flex-col items-center gap-3">
+ <%= link_to root_path, class: "flex items-center gap-3 text-gray-100 hover:text-brand-500 transition-colors" do %>
+ <img src="/icon.png" alt="siGit" class="h-9 w-auto">
+ <span class="text-xl font-semibold tracking-tight">siGit</span>
+ <% end %>
+ <p class="text-sm text-gray-500">Create your account</p>
+ </div>
+
+ <div class="w-full max-w-sm">
+ <div class="border border-surface-500 rounded bg-surface-700 px-8 py-8">
+
+ <% if flash[:alert].present? %>
+ <div class="mb-5 flex items-start gap-2.5 rounded border border-red-800/40 bg-red-900/20 px-3.5 py-3 text-sm text-red-400" role="alert">
+ <svg class="w-4 h-4 mt-0.5 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 3.75a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0v-3.5A.75.75 0 0 0 8 4.75zm0 7.5a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75z"/>
+ </svg>
+ <span><%= flash[:alert] %></span>
+ </div>
+ <% end %>
+
+ <%= form_tag signup_create_path, method: :post, class: "space-y-5" do %>
+
+ <div>
+ <label for="email" class="form-label">Email</label>
+ <input type="email" id="email" name="email"
+ class="form-input"
+ autocomplete="email"
+ value="<%= params[:email].to_s %>"
+ placeholder="you@example.com"
+ autofocus required>
+ </div>
+
+ <div>
+ <label for="password" class="form-label">Password</label>
+ <input type="password" id="password" name="password"
+ class="form-input"
+ autocomplete="new-password"
+ minlength="8"
+ placeholder="At least 8 characters"
+ required>
+ </div>
+
+ <div>
+ <label for="password_confirmation" class="form-label">Confirm password</label>
+ <input type="password" id="password_confirmation" name="password_confirmation"
+ class="form-input"
+ autocomplete="new-password"
+ placeholder="Same password again"
+ required>
+ </div>
+
+ <button type="submit" class="btn-primary w-full justify-center py-2.5 mt-2">
+ Create account
+ </button>
+
+ <% end %>
+ </div>
+
+ <p class="mt-6 text-center text-xs text-gray-500">
+ Already have an account?
+ <%= link_to "Sign in", signin_path, class: "text-gray-400 hover:text-gray-200 underline underline-offset-2" %>
+ </p>
+ </div>
+
+</div>
app/views/repositories/new.html.erb
+80
new file mode 100644
index 0000000..1b6a33f
--- /dev/null
+++ b/app/views/repositories/new.html.erb
@@ -0,0 +1,80 @@
+<% content_for :title, "New repository" %>
+
+<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">
+ <h1 class="text-xl font-semibold text-gray-100 mb-2">Create a new repository</h1>
+ <p class="text-sm text-gray-400 mb-8">All your files and their history, in one place.</p>
+
+ <%= form_with model: @repository, url: "/new", method: :post, class: "space-y-6" do |f| %>
+ <% if @repository.errors.any? %>
+ <div class="border border-red-800/40 bg-red-900/20 rounded px-4 py-3">
+ <p class="text-sm font-medium text-red-300 mb-1">Please fix the following errors:</p>
+ <ul class="list-disc pl-4 space-y-0.5">
+ <% @repository.errors.full_messages.each do |msg| %>
+ <li class="text-sm text-red-400"><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="flex items-end gap-2">
+ <div class="flex-1 min-w-0">
+ <label class="form-label">Owner</label>
+ <div class="flex items-center gap-2 form-input bg-surface-700 text-gray-400 cursor-not-allowed">
+ <img src="<%= current_user.avatar_url_or_default %>" class="w-4 h-4 rounded-full">
+ <span><%= current_user.username %></span>
+ </div>
+ </div>
+ <div class="flex items-center pb-2.5 text-gray-500 font-light text-lg">/</div>
+ <div class="flex-1 min-w-0">
+ <%= f.label :name, "Repository name", class: "form-label" %>
+ <%= f.text_field :name, class: "form-input", placeholder: "my-project", autofocus: true,
+ pattern: "[a-zA-Z0-9._-]+",
+ title: "Letters, numbers, hyphens, underscores, and dots only" %>
+ </div>
+ </div>
+
+ <div>
+ <%= f.label :description, "Description", class: "form-label" %>
+ <span class="text-xs text-gray-500 ml-1">(optional)</span>
+ <%= f.text_area :description, class: "form-input", rows: 2,
+ placeholder: "Short description of your project" %>
+ </div>
+
+ <div class="border border-surface-500 rounded divide-y divide-surface-600">
+ <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-surface-600">
+ <%= f.radio_button :is_private, false, class: "mt-0.5" %>
+ <div>
+ <div class="flex items-center gap-2">
+ <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
+ </svg>
+ <span class="text-sm font-medium text-gray-100">Public</span>
+ </div>
+ <p class="text-xs text-gray-400 mt-0.5">Anyone can see this repository.</p>
+ </div>
+ </label>
+ <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-surface-600">
+ <%= f.radio_button :is_private, true, class: "mt-0.5" %>
+ <div>
+ <div class="flex items-center gap-2">
+ <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"/>
+ </svg>
+ <span class="text-sm font-medium text-gray-100">Private</span>
+ </div>
+ <p class="text-xs text-gray-400 mt-0.5">Only you can see this repository.</p>
+ </div>
+ </label>
+ </div>
+
+ <div>
+ <%= f.label :default_branch, "Default branch", class: "form-label" %>
+ <%= f.text_field :default_branch, class: "form-input max-w-xs", value: "main" %>
+ </div>
+
+ <div class="pt-2 border-t border-surface-600 flex items-center gap-3">
+ <%= f.submit "Create repository", class: "btn-primary cursor-pointer" %>
+ <%= link_to "Cancel", root_path, class: "btn-ghost" %>
+ </div>
+ <% end %>
+</div>
app/views/repositories/show.html.erb
+138
new file mode 100644
index 0000000..b6d906f
--- /dev/null
+++ b/app/views/repositories/show.html.erb
@@ -0,0 +1,138 @@
+<% content_for :title, @repository.full_name %>
+
+<div class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
+
+ <div class="flex items-center gap-2 text-sm mb-4">
+ <svg class="w-4 h-4 text-gray-500" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
+ </svg>
+ <%= link_to @owner.username, user_profile_path(@owner.username),
+ class: "text-brand-500 hover:underline font-medium" %>
+ <span class="text-gray-500">/</span>
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
+ class: "text-brand-500 hover:underline font-semibold" %>
+ <% if @repository.is_private %>
+ <span class="badge-gray ml-1">Private</span>
+ <% end %>
+ </div>
+
+ <% if @repository.description.present? %>
+ <p class="text-sm text-gray-400 mb-4"><%= @repository.description %></p>
+ <% end %>
+
+ <div class="flex items-center gap-0 -mb-px">
+ <%= link_to repository_path(@owner.username, @repository.name),
+ class: "tab-item active flex items-center gap-1.5" do %>
+ <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
+ </svg>
+ Code
+ <% end %>
+ <% if @repository.initialized? %>
+ <%= link_to repository_commits_path(@owner.username, @repository.name,
+ @branch || @repository.default_branch),
+ class: "tab-item flex items-center gap-1.5" do %>
+ <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"/>
+ </svg>
+ Commits
+ <% if @commit_count&.> 0 %>
+ <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span>
+ <% end %>
+ <% end %>
+ <% end %>
+ </div>
+ </div>
+</div>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
+ <% if @empty %>
+ <div class="card p-8 text-center max-w-2xl mx-auto">
+ <svg class="w-16 h-16 mx-auto text-gray-600 mb-5" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="1"
+ stroke-linecap="round" stroke-linejoin="round">
+ <path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>
+ </svg>
+ <h2 class="text-lg font-semibold text-gray-100 mb-2">This repository is empty</h2>
+ <p class="text-sm text-gray-400 mb-6">Push something and it'll show up here.</p>
+ <div class="code-container text-left p-4 max-w-lg mx-auto text-xs font-mono space-y-0.5">
+ <p class="text-gray-500 mb-1"># Clone and push</p>
+ <p class="text-gray-300">git clone git@sigitsi.com:<%= @owner.username %>/<%= @repository.name %></p>
+ <p class="text-gray-300">cd <%= @repository.name %></p>
+ <p class="text-gray-300">echo "# <%= @repository.name %>" > README.md</p>
+ <p class="text-gray-300">git add . && git commit -m "Initial commit"</p>
+ <p class="text-gray-300">git push origin main</p>
+ </div>
+ </div>
+ <% else %>
+
+ <div class="card rounded-b-none border-b-0 px-4 py-2.5
+ flex items-center justify-between gap-4 bg-surface-600">
+ <div class="flex items-center gap-3">
+ <span class="btn-secondary py-1 px-3 text-xs font-mono flex items-center gap-1.5 cursor-default">
+ <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/>
+ </svg>
+ <%= @branch %>
+ </span>
+ <% if @recent_commits.first %>
+ <% commit = @recent_commits.first %>
+ <span class="text-xs text-gray-400">
+ <%= link_to commit[:short_sha],
+ repository_commit_path(@owner.username, @repository.name, commit[:sha]),
+ class: "font-mono text-brand-500 hover:underline" %>
+ · <%= commit[:subject] %>
+ · <span class="text-gray-500"><%= time_ago_in_words(commit[:authored_date]) %> ago</span>
+ </span>
+ <% end %>
+ </div>
+ <div class="flex items-center gap-3 text-xs text-gray-400">
+ <%= link_to repository_commits_path(@owner.username, @repository.name, @branch),
+ class: "flex items-center gap-1 hover:text-gray-200" do %>
+ <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"/>
+ </svg>
+ <%= number_with_delimiter(@commit_count) %> commits
+ <% end %>
+ </div>
+ </div>
+
+ <div class="card rounded-t-none">
+ <% @tree.each do |entry| %>
+ <div class="file-row">
+ <% if entry[:type] == "tree" %>
+ <svg class="w-4 h-4 text-brand-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"/>
+ </svg>
+ <%= link_to entry[:name],
+ repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),
+ class: "text-brand-500 hover:underline font-medium flex-1" %>
+ <% else %>
+ <svg class="w-4 h-4 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"/>
+ </svg>
+ <%= link_to entry[:name],
+ repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),
+ class: "text-gray-200 hover:text-brand-500 hover:underline flex-1" %>
+ <% end %>
+ </div>
+ <% end %>
+ </div>
+
+ <% if @readme_html %>
+ <div class="card mt-6">
+ <div class="px-4 py-3 border-b border-surface-600 flex items-center gap-2 bg-surface-600">
+ <svg class="w-4 h-4 text-gray-500" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"/>
+ </svg>
+ <span class="text-xs font-medium text-gray-400"><%= @readme_filename %></span>
+ </div>
+ <div class="px-6 py-6 prose-readme">
+ <%= @readme_html %>
+ </div>
+ </div>
+ <% end %>
+
+ <% end %>
+</div>
app/views/repositories/tree.html.erb
+65
new file mode 100644
index 0000000..8be3d47
--- /dev/null
+++ b/app/views/repositories/tree.html.erb
@@ -0,0 +1,65 @@
+<% content_for :title, "#{@current_path} · #{@repository.full_name}" %>
+
+<div class="border-b border-surface-600 bg-surface-800">
+ <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
+
+ <div class="flex items-center gap-2 text-sm mb-3">
+ <%= link_to @owner.username, user_profile_path(@owner.username),
+ class: "text-brand-500 hover:underline font-medium" %>
+ <span class="text-gray-500">/</span>
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
+ class: "text-brand-500 hover:underline font-semibold" %>
+ </div>
+
+ <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">
+ <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
+ class: "breadcrumb-item font-medium" %>
+ <span class="text-gray-500">/</span>
+ <% @path_parts.each_with_index do |part, i| %>
+ <% partial_path = @path_parts[0..i].join("/") %>
+ <% if i < @path_parts.length - 1 %>
+ <%= link_to part,
+ repository_tree_path(@owner.username, @repository.name, @branch, partial_path),
+ class: "breadcrumb-item" %>
+ <span class="text-gray-500">/</span>
+ <% else %>
+ <span class="font-medium text-gray-100"><%= part %></span>
+ <% end %>
+ <% end %>
+ </nav>
+
+ <div class="flex items-center gap-0 -mb-px">
+ <%= link_to repository_path(@owner.username, @repository.name),
+ class: "tab-item flex items-center gap-1.5" do %>
+ <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
+ </svg>
+ Code
+ <% end %>
+ </div>
+ </div>
+</div>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
+ <div class="card">
+ <% @tree.each do |entry| %>
+ <div class="file-row">
+ <% if entry[:type] == "tree" %>
+ <svg class="w-4 h-4 text-brand-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"/>
+ </svg>
+ <%= link_to entry[:name],
+ repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),
+ class: "text-brand-500 hover:underline font-medium flex-1" %>
+ <% else %>
+ <svg class="w-4 h-4 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"/>
+ </svg>
+ <%= link_to entry[:name],
+ repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),
+ class: "text-gray-200 hover:text-brand-500 hover:underline flex-1" %>
+ <% end %>
+ </div>
+ <% end %>
+ </div>
+</div>
app/views/sessions/new.html.erb
+56
new file mode 100644
index 0000000..3c2a4f8
--- /dev/null
+++ b/app/views/sessions/new.html.erb
@@ -0,0 +1,56 @@
+<% content_for :title, "Sign in" %>
+
+<div class="min-h-screen bg-surface-900 flex flex-col items-center justify-center px-4 py-16">
+
+ <div class="mb-10 flex flex-col items-center gap-3">
+ <%= link_to root_path, class: "flex items-center gap-3 text-gray-100 hover:text-brand-500 transition-colors" do %>
+ <img src="/icon.png" alt="siGit" class="h-9 w-auto">
+ <span class="text-xl font-semibold tracking-tight">siGit</span>
+ <% end %>
+ <p class="text-sm text-gray-500">Sign in to continue</p>
+ </div>
+
+ <div class="w-full max-w-sm">
+ <div class="border border-surface-500 rounded bg-surface-700 px-8 py-8">
+
+ <% if flash[:alert].present? %>
+ <div class="mb-5 flex items-start gap-2.5 rounded border border-red-800/40 bg-red-900/20 px-3.5 py-3 text-sm text-red-400" role="alert">
+ <svg class="w-4 h-4 mt-0.5 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 3.75a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0v-3.5A.75.75 0 0 0 8 4.75zm0 7.5a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75z"/>
+ </svg>
+ <span><%= flash[:alert] %></span>
+ </div>
+ <% end %>
+
+ <%= form_tag auth_create_path, method: :post, class: "space-y-5" do %>
+
+ <div>
+ <label for="email" class="form-label">Email</label>
+ <input type="email" id="email" name="email"
+ class="form-input" autocomplete="email"
+ value="<%= params[:email].to_s %>"
+ placeholder="you@example.com"
+ autofocus required>
+ </div>
+
+ <div>
+ <label for="password" class="form-label">Password</label>
+ <input type="password" id="password" name="password"
+ class="form-input" autocomplete="current-password"
+ required>
+ </div>
+
+ <button type="submit" class="btn-primary w-full justify-center py-2.5 mt-2">
+ Sign in
+ </button>
+
+ <% end %>
+ </div>
+
+ <p class="mt-6 text-center text-xs text-gray-500">
+ No account?
+ <%= link_to "Create one", signup_path, class: "text-gray-400 hover:text-gray-200 underline underline-offset-2" %>
+ </p>
+ </div>
+
+</div>
app/views/shared/_dev_panel.html.erb
+15
new file mode 100644
index 0000000..e501939
--- /dev/null
+++ b/app/views/shared/_dev_panel.html.erb
@@ -0,0 +1,15 @@
+<div data-controller="dev-panel"
+ class="fixed bottom-4 right-4 z-[9999] flex flex-col items-end gap-2">
+
+ <%# The dropdown — Stimulus renders content into this target %>
+ <div data-dev-panel-target="panel" class="hidden"></div>
+
+ <%# Toggle button — terminal icon %>
+ <button data-action="click->dev-panel#toggle"
+ aria-label="Toggle dev panel"
+ class="flex h-8 w-8 items-center justify-center rounded-full border border-surface-500 bg-surface-700 text-gray-400 shadow-lg transition-colors hover:border-brand-500 hover:text-brand-500">
+ <svg class="h-4 w-4" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
+ <path fill-rule="evenodd" d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25V2.75A1.75 1.75 0 0 0 14.25 1ZM2.5 4.75a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H3.25a.75.75 0 0 1-.75-.75Zm1.28 2.97a.75.75 0 1 0-1.06 1.06l1.72 1.72-1.72 1.72a.75.75 0 1 0 1.06 1.06l2.25-2.25a.75.75 0 0 0 0-1.06L3.78 7.72ZM7.25 10a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5Z" clip-rule="evenodd"/>
+ </svg>
+ </button>
+</div>
app/views/shared/_navbar.html.erb
+63
new file mode 100644
index 0000000..9f9ee67
--- /dev/null
+++ b/app/views/shared/_navbar.html.erb
@@ -0,0 +1,63 @@
+<header class="border-b border-surface-600 bg-surface-800 sticky top-0 z-50">
+ <nav class="max-w-6xl mx-auto px-4 sm:px-6 h-14 flex items-center justify-between gap-6">
+
+ <div class="flex items-center gap-6">
+ <%= link_to root_path, class: "flex items-center gap-2 text-gray-100 hover:text-brand-500 transition-colors" do %>
+ <img src="/icon.png" alt="siGit" class="h-6 w-auto">
+ <span class="font-semibold text-base tracking-tight">siGit</span>
+ <% end %>
+
+ <% if signed_in? %>
+ <div class="hidden sm:flex items-center gap-1">
+ <%= link_to "Explore", "#", class: "nav-link px-2 py-1 rounded hover:bg-surface-600" %>
+ </div>
+ <% end %>
+ </div>
+
+ <div class="flex items-center gap-3">
+ <% if signed_in? %>
+ <%= link_to new_repository_path, class: "btn-secondary text-xs py-1.5 px-3 hidden sm:inline-flex" do %>
+ <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z"/>
+ </svg>
+ New
+ <% end %>
+
+ <div class="relative group">
+ <button class="flex items-center gap-2 hover:opacity-80 transition-opacity">
+ <img src="<%= current_user.avatar_url_or_default %>"
+ alt="<%= current_user.display_name_or_username %>"
+ class="w-7 h-7 rounded-full border border-surface-500">
+ <span class="text-sm font-medium text-gray-300 hidden sm:block"><%= current_user.username %></span>
+ <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 16 16"
+ stroke="currentColor" stroke-width="2">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 6l4 4 4-4"/>
+ </svg>
+ </button>
+
+ <div class="absolute right-0 top-full mt-1 w-48 bg-surface-700 border border-surface-500
+ rounded shadow-lg py-1 opacity-0 invisible
+ group-hover:opacity-100 group-hover:visible
+ transition-all duration-150 z-50">
+ <div class="px-3 py-2 border-b border-surface-600">
+ <p class="text-xs font-medium text-gray-100"><%= current_user.display_name_or_username %></p>
+ <p class="text-xs text-gray-400"><%= current_user.email %></p>
+ </div>
+ <%= link_to user_profile_path(current_user.username),
+ class: "block px-3 py-1.5 text-sm text-gray-300 hover:bg-surface-600" do %>Your repositories<% end %>
+ <%= link_to settings_path,
+ class: "block px-3 py-1.5 text-sm text-gray-300 hover:bg-surface-600" do %>Settings<% end %>
+ <div class="border-t border-surface-600 mt-1">
+ <%= button_to signout_path, method: :delete,
+ class: "block w-full text-left px-3 py-1.5 text-sm text-red-400 hover:bg-red-900/30 transition-colors" do %>
+ Sign out
+ <% end %>
+ </div>
+ </div>
+ </div>
+ <% else %>
+ <%= link_to "Sign in", signin_path, class: "btn-primary text-xs py-1.5 px-4" %>
+ <% end %>
+ </div>
+ </nav>
+</header>
app/views/users/settings.html.erb
+34
new file mode 100644
index 0000000..ee67e96
--- /dev/null
+++ b/app/views/users/settings.html.erb
@@ -0,0 +1,34 @@
+<% content_for :title, "Settings" %>
+
+<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">
+ <h1 class="text-xl font-semibold text-gray-100 mb-8">Settings</h1>
+
+ <div class="card">
+ <div class="px-6 py-4 border-b border-surface-600">
+ <h2 class="text-sm font-semibold text-gray-100">Profile</h2>
+ </div>
+ <div class="px-6 py-6">
+ <%= form_with model: @user, url: settings_path, method: :patch do |f| %>
+ <div class="space-y-5">
+ <div>
+ <label class="form-label">Username</label>
+ <div class="form-input bg-surface-700 text-gray-400 cursor-not-allowed"><%= @user.username %></div>
+ <p class="text-xs text-gray-500 mt-1">Username cannot be changed.</p>
+ </div>
+ <div>
+ <%= f.label :display_name, "Display name", class: "form-label" %>
+ <%= f.text_field :display_name, class: "form-input", placeholder: @user.username %>
+ </div>
+ <div>
+ <label class="form-label">Email</label>
+ <div class="form-input bg-surface-700 text-gray-400 cursor-not-allowed"><%= @user.email %></div>
+ <p class="text-xs text-gray-500 mt-1">Managed with your account settings.</p>
+ </div>
+ <div class="pt-2">
+ <%= f.submit "Save changes", class: "btn-primary cursor-pointer" %>
+ </div>
+ </div>
+ <% end %>
+ </div>
+ </div>
+</div>
app/views/users/show.html.erb
+66
new file mode 100644
index 0000000..de5063b
--- /dev/null
+++ b/app/views/users/show.html.erb
@@ -0,0 +1,66 @@
+<% content_for :title, @profile_user.display_name_or_username %>
+
+<div class="max-w-6xl mx-auto px-4 sm:px-6 py-10">
+ <div class="grid grid-cols-1 lg:grid-cols-4 gap-10">
+
+ <aside class="lg:col-span-1">
+ <img src="<%= @profile_user.avatar_url_or_default %>"
+ alt="<%= @profile_user.display_name_or_username %>"
+ class="w-full max-w-[200px] rounded-full border border-surface-600 mb-4">
+ <h1 class="text-xl font-semibold text-gray-100"><%= @profile_user.display_name_or_username %></h1>
+ <p class="text-gray-400 text-sm"><%= @profile_user.username %></p>
+ <% if @profile_user.email.present? %>
+ <div class="flex items-center gap-2 mt-3 text-sm text-gray-400">
+ <svg class="w-4 h-4 shrink-0" viewBox="0 0 16 16" fill="currentColor">
+ <path d="M1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25v-8.5C0 2.784.784 2 1.75 2ZM1.5 12.251c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V5.809L8.38 9.397a.75.75 0 0 1-.76 0L1.5 5.809v6.442Zm13-8.181v-.32a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25v.32L8 7.88Z"/>
+ </svg>
+ <%= @profile_user.email %>
+ </div>
+ <% end %>
+ </aside>
+
+ <main class="lg:col-span-3">
+ <div class="flex items-center justify-between mb-4">
+ <h2 class="text-base font-semibold text-gray-100">
+ Repositories
+ <span class="badge-gray ml-1 align-middle"><%= @repositories.count %></span>
+ </h2>
+ <% if signed_in? && current_user == @profile_user %>
+ <%= link_to new_repository_path, class: "btn-secondary text-xs" do %>New<% end %>
+ <% end %>
+ </div>
+
+ <% if @repositories.any? %>
+ <div class="space-y-3">
+ <% @repositories.each do |repo| %>
+ <div class="card px-5 py-4 hover:border-surface-400 transition-colors">
+ <div class="flex items-start justify-between gap-4">
+ <div class="min-w-0 flex-1">
+ <div class="flex items-center gap-2 mb-1">
+ <%= link_to repo.name,
+ repository_path(@profile_user.username, repo.name),
+ class: "font-semibold text-brand-500 hover:underline" %>
+ <% if repo.is_private %>
+ <span class="badge-gray">Private</span>
+ <% end %>
+ </div>
+ <% if repo.description.present? %>
+ <p class="text-sm text-gray-400"><%= repo.description %></p>
+ <% end %>
+ </div>
+ <div class="text-xs text-gray-500 shrink-0">
+ <%= time_ago_in_words(repo.updated_at) %> ago
+ </div>
+ </div>
+ </div>
+ <% end %>
+ </div>
+ <% else %>
+ <div class="card px-6 py-12 text-center">
+ <p class="text-sm text-gray-500">No public repositories.</p>
+ </div>
+ <% end %>
+ </main>
+
+ </div>
+</div>
bin/brakeman
+7
new file mode 100755
index 0000000..ace1c9b
--- /dev/null
+++ b/bin/brakeman
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+ARGV.unshift("--ensure-latest")
+
+load Gem.bin_path("brakeman", "brakeman")
bin/bundler-audit
+6
new file mode 100755
index 0000000..e2ef226
--- /dev/null
+++ b/bin/bundler-audit
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "bundler/audit/cli"
+
+ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
+Bundler::Audit::CLI.start
bin/ci
+6
new file mode 100755
index 0000000..4137ad5
--- /dev/null
+++ b/bin/ci
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "active_support/continuous_integration"
+
+CI = ActiveSupport::ContinuousIntegration
+require_relative "../config/ci.rb"
bin/dev
+2
new file mode 100755
index 0000000..5f91c20
--- /dev/null
+++ b/bin/dev
@@ -0,0 +1,2 @@
+#!/usr/bin/env ruby
+exec "./bin/rails", "server", *ARGV
bin/docker-entrypoint
+8
new file mode 100755
index 0000000..ed31659
--- /dev/null
+++ b/bin/docker-entrypoint
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# If running the rails server then create or migrate existing database
+if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
bin/rails
+4
new file mode 100755
index 0000000..efc0377
--- /dev/null
+++ b/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
bin/rake
+4
new file mode 100755
index 0000000..4fbf10b
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
bin/rubocop
+8
new file mode 100755
index 0000000..5a20504
--- /dev/null
+++ b/bin/rubocop
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+# Explicit RuboCop config increases performance slightly while avoiding config confusion.
+ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
+
+load Gem.bin_path("rubocop", "rubocop")
bin/setup
+35
new file mode 100755
index 0000000..81be011
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+require "fileutils"
+
+APP_ROOT = File.expand_path("..", __dir__)
+
+def system!(*args)
+ system(*args, exception: true)
+end
+
+FileUtils.chdir APP_ROOT do
+ # This script is a way to set up or update your development environment automatically.
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
+ # Add necessary setup steps to this file.
+
+ puts "== Installing dependencies =="
+ system("bundle check") || system!("bundle install")
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system! "bin/rails db:prepare"
+ system! "bin/rails db:reset" if ARGV.include?("--reset")
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! "bin/rails log:clear tmp:clear"
+
+ unless ARGV.include?("--skip-server")
+ puts "\n== Starting development server =="
+ STDOUT.flush # flush the output before exec(2) so that it displays
+ exec "bin/dev"
+ end
+end
bin/thrust
+5
new file mode 100755
index 0000000..36bde2d
--- /dev/null
+++ b/bin/thrust
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("thruster", "thrust")
config.ru
+6
new file mode 100644
index 0000000..4a3c09a
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,6 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
config/application.rb
+42
new file mode 100644
index 0000000..c888276
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,42 @@
+require_relative "boot"
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "active_storage/engine"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_mailbox/engine"
+require "action_text/engine"
+require "action_view/railtie"
+require "action_cable/engine"
+# require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module Sigitsi
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 8.1
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w[assets tasks])
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+
+ # Don't generate system test files.
+ config.generators.system_tests = nil
+ end
+end
config/boot.rb
+4
new file mode 100644
index 0000000..988a5dd
--- /dev/null
+++ b/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
config/bundler-audit.yml
+5
new file mode 100644
index 0000000..e74b3af
--- /dev/null
+++ b/config/bundler-audit.yml
@@ -0,0 +1,5 @@
+# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
+# CVEs that are not relevant to the application can be enumerated on the ignore list below.
+
+ignore:
+ - CVE-THAT-DOES-NOT-APPLY
config/cable.yml
+10
new file mode 100644
index 0000000..0637b7e
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: sigitsi_production
config/ci.rb
+20
new file mode 100644
index 0000000..239b343
--- /dev/null
+++ b/config/ci.rb
@@ -0,0 +1,20 @@
+# Run using bin/ci
+
+CI.run do
+ step "Setup", "bin/setup --skip-server"
+
+ step "Style: Ruby", "bin/rubocop"
+
+ step "Security: Gem audit", "bin/bundler-audit"
+ step "Security: Importmap vulnerability audit", "bin/importmap audit"
+ step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
+
+
+ # Optional: set a green GitHub commit status to unblock PR merge.
+ # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
+ # if success?
+ # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
+ # else
+ # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
+ # end
+end
config/credentials.yml.enc
+1
new file mode 100644
index 0000000..6b894af
--- /dev/null
+++ b/config/credentials.yml.enc
@@ -0,0 +1 @@
+4FBLgT4lqYn6Xq573rcAdqYW8uoCip65xOaJcs9uI4+4GjgUy6mVxbbs9drNMkeR/hT1bmWxcc2yGahuZ4HCnCTHongcYSeRN+tq3ZKK6uBRtJ5n4VoF8bb79Y11XzpWYJRzI4+qI9XIwNBiCgB0LrLjJE1+1OPrphA26JBYPGq1CuepuIC1uhF6tRBTj3+mxjMLb9TZK/xnQPttlhPCryt4IC6Rl1223Yj7Hp3J4OKOOYisuK7PfpO/1HhCCnHVffeWfjOA+bunX0CMycaPQPNNgzEDQNy+3sr6pCRDU4PmIlQv2ED4ZNoldIyrdqvvXj7cyWmj8qe5nhoRRfskaLm3Pm6abN29DFxw9AnU/z4EXUCrcnd+dhfLPd2rW5X3qWGgHwRMounOc+HWHFR4snJR9gNAGbNrBZt9kfRPinB+pJDNVpvsKX+RUDsZ3HamouD4t951pc6MdzzSsAOYLXyeoNxkgK9pHAvfSHbGxnPwNR4X03wjhK/8--2sl/oC/jkTHhawD8--aK/HddPgwwngDeBQyxNY3g==
\ No newline at end of file
config/database.yml
+104
new file mode 100644
index 0000000..085c061
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,104 @@
+# PostgreSQL. Versions 9.5 and up are supported.
+#
+# Install the pg driver:
+# gem install pg
+# On macOS with Homebrew:
+# gem install pg -- --with-pg-config=/opt/homebrew/bin/pg_config
+# On Windows:
+# gem install pg
+# Choose the win32 build.
+# Install PostgreSQL and put its /bin directory on your path.
+#
+# Configure Using Gemfile
+# gem "pg"
+#
+default: &default
+ adapter: postgresql
+ encoding: unicode
+ # For details on connection pooling, see Rails configuration guide
+ # https://guides.rubyonrails.org/configuring.html#database-pooling
+ max_connections: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+
+
+development:
+ <<: *default
+ database: sigitsi_development
+
+ # The specified database role being used to connect to PostgreSQL.
+ # To create additional roles in PostgreSQL see `$ createuser --help`.
+ # When left blank, PostgreSQL will use the default role. This is
+ # the same name as the operating system user running Rails.
+ #username: sigitsi
+
+ # The password associated with the PostgreSQL role (username).
+ #password:
+
+ # Connect on a TCP socket. Omitted by default since the client uses a
+ # domain socket that doesn't need configuration. Windows does not have
+ # domain sockets, so uncomment these lines.
+ #host: localhost
+
+ # The TCP port the server listens on. Defaults to 5432.
+ # If your server runs on a different port number, change accordingly.
+ #port: 5432
+
+ # Schema search path. The server defaults to $user,public
+ #schema_search_path: myapp,sharedapp,public
+
+ # Minimum log levels, in increasing order:
+ # debug5, debug4, debug3, debug2, debug1,
+ # log, notice, warning, error, fatal, and panic
+ # Defaults to warning.
+ #min_messages: notice
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: sigitsi_test
+
+# As with config/credentials.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password or a full connection URL as an environment
+# variable when you boot the app. For example:
+#
+# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# If the connection URL is provided in the special DATABASE_URL environment
+# variable, Rails will automatically merge its configuration values on top of
+# the values provided in this file. Alternatively, you can specify a connection
+# URL environment variable explicitly:
+#
+# production:
+# url: <%= ENV["MY_APP_DATABASE_URL"] %>
+#
+# Connection URLs for non-primary databases can also be configured using
+# environment variables. The variable name is formed by concatenating the
+# connection name with `_DATABASE_URL`. For example:
+#
+# CACHE_DATABASE_URL="postgres://cacheuser:cachepass@localhost/cachedatabase"
+#
+# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full overview on how database connection configuration can be specified.
+#
+production:
+ primary: &primary_production
+ <<: *default
+ database: sigitsi_production
+ username: sigitsi
+ password: <%= ENV["SIGITSI_DATABASE_PASSWORD"] %>
+ cache:
+ <<: *primary_production
+ database: sigitsi_production_cache
+ migrations_paths: db/cache_migrate
+ queue:
+ <<: *primary_production
+ database: sigitsi_production_queue
+ migrations_paths: db/queue_migrate
+ cable:
+ <<: *primary_production
+ database: sigitsi_production_cable
+ migrations_paths: db/cable_migrate
config/environment.rb
+5
new file mode 100644
index 0000000..cac5315
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
config/environments/development.rb
+78
new file mode 100644
index 0000000..75243c3
--- /dev/null
+++ b/config/environments/development.rb
@@ -0,0 +1,78 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Make code changes take effect immediately without server restart.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing.
+ config.server_timing = true
+
+ # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
+ # Run rails dev:cache to toggle Action Controller caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
+ else
+ config.action_controller.perform_caching = false
+ end
+
+ # Change to :null_store to avoid any caching.
+ config.cache_store = :memory_store
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Make template changes take effect immediately.
+ config.action_mailer.perform_caching = false
+
+ # Set localhost to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Append comments with runtime information tags to SQL queries in logs.
+ config.active_record.query_log_tags_enabled = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Highlight code that triggered redirect in logs.
+ config.action_dispatch.verbose_redirect_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
+ # config.generators.apply_rubocop_autocorrect_after_generate!
+end
config/environments/production.rb
+89
new file mode 100644
index 0000000..cb0241d
--- /dev/null
+++ b/config/environments/production.rb
@@ -0,0 +1,89 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
+ config.eager_load = true
+
+ # Full error reports are disabled.
+ config.consider_all_requests_local = false
+
+ # Turn on fragment caching in view templates.
+ config.action_controller.perform_caching = true
+
+ # Cache assets for far-future expiry since they are all digest stamped.
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Skip http-to-https redirect for the default health check endpoint.
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
+
+ # Log to STDOUT with the current request id as a default log tag.
+ config.log_tags = [ :request_id ]
+ config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
+
+ # Change to "debug" to log everything (including potentially personally-identifiable information!).
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Prevent health checks from clogging up the logs.
+ config.silence_healthcheck_path = "/up"
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Replace the default in-process memory cache store with a durable alternative.
+ # config.cache_store = :mem_cache_store
+
+ # Replace the default in-process and non-durable queuing backend for Active Job.
+ # config.active_job.queue_adapter = :resque
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Set host to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "example.com" }
+
+ # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
+ # config.action_mailer.smtp_settings = {
+ # user_name: Rails.application.credentials.dig(:smtp, :user_name),
+ # password: Rails.application.credentials.dig(:smtp, :password),
+ # address: "smtp.example.com",
+ # port: 587,
+ # authentication: :plain
+ # }
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Only use :id for inspections in production.
+ config.active_record.attributes_for_inspect = [ :id ]
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ #
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
config/environments/test.rb
+53
new file mode 100644
index 0000000..c2095b1
--- /dev/null
+++ b/config/environments/test.rb
@@ -0,0 +1,53 @@
+# 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 space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with cache-control for performance.
+ config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+ config.cache_store = :null_store
+
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Set host to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "example.com" }
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+end
config/importmap.rb
+9
new file mode 100644
index 0000000..c31219b
--- /dev/null
+++ b/config/importmap.rb
@@ -0,0 +1,9 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application", preload: true
+
+pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
+pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
+
+pin_all_from "app/javascript/controllers", under: "controllers"
config/initializers/assets.rb
+7
new file mode 100644
index 0000000..4873244
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
config/initializers/content_security_policy.rb
+29
new file mode 100644
index 0000000..d51d713
--- /dev/null
+++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,29 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
+# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
+# # config.content_security_policy_nonce_auto = true
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
config/initializers/filter_parameter_logging.rb
+8
new file mode 100644
index 0000000..c0b717f
--- /dev/null
+++ b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
+]
config/initializers/inflections.rb
+16
new file mode 100644
index 0000000..3860f65
--- /dev/null
+++ b/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
config/locales/en.yml
+31
new file mode 100644
index 0000000..6c349ae
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,31 @@
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
config/puma.rb
+42
new file mode 100644
index 0000000..38c4b86
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,42 @@
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+#
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
+#
+# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
+# should only set this value when you want to run 2 or more workers. The
+# default is already 1. You can set it to `auto` to automatically start a worker
+# for each available processor.
+#
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# prioritize throughput over latency.
+#
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
+#
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
+#
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT", 3000)
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
+
+# Run the Solid Queue supervisor inside of Puma for single-server deployments.
+plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
+
+# Specify the PID file. Defaults to tmp/pids/server.pid in development.
+# In other environments, only set the PID file if requested.
+pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
config/routes.rb
+56
new file mode 100644
index 0000000..36dfbc5
--- /dev/null
+++ b/config/routes.rb
@@ -0,0 +1,56 @@
+Rails.application.routes.draw do
+ root "pages#home"
+
+ # Dev panel — only mounted in development
+ if Rails.env.development?
+ namespace :dev do
+ get "environment", to: "panel#show"
+ put "environment", to: "panel#update"
+ end
+ end
+
+ # Auth — email/password form
+ get "/auth", to: "sessions#new", as: :signin
+ post "/auth", to: "sessions#create", as: :auth_create
+ delete "/auth/signout", to: "sessions#destroy", as: :signout
+
+ # Signup
+ get "/auth/signup", to: "registrations#new", as: :signup
+ post "/auth/signup", to: "registrations#create", as: :signup_create
+
+ # Repository creation
+ get "/new", to: "repositories#new", as: :new_repository
+ post "/new", to: "repositories#create"
+
+ # Settings
+ get "/settings", to: "users#settings", as: :settings
+ patch "/settings", to: "users#update_settings"
+
+ # User profile (must come before repository routes)
+ get "/@:username", to: "users#show", as: :at_user_profile,
+ constraints: { username: /[a-z0-9][a-z0-9\-]{0,38}/ }
+ get "/:username", to: "users#show", as: :user_profile,
+ constraints: { username: /[a-z0-9][a-z0-9\-]{0,38}/ }
+
+ # Repository routes (in order of specificity)
+ get "/@:username/:repository/commits/:branch", to: "commits#index", as: :at_repository_commits,
+ constraints: { branch: /[^\/]+/, repository: /[^\/.][^\/]*/ }
+ get "/@:username/:repository/commit/:sha", to: "commits#show", as: :at_repository_commit
+ get "/@:username/:repository/blob/:branch/*path", to: "blobs#show", as: :at_repository_blob
+ get "/@:username/:repository/raw/:branch/*path", to: "blobs#raw", as: :at_repository_blob_raw
+ get "/@:username/:repository/tree/:branch/*path", to: "repositories#tree", as: :at_repository_tree
+ get "/@:username/:repository/tree/:branch", to: "repositories#tree", as: :at_repository_branch
+ get "/@:username/:repository", to: "repositories#show", as: :at_repository
+
+ get "/:username/:repository/commits/:branch", to: "commits#index", as: :repository_commits,
+ constraints: { branch: /[^\/]+/, repository: /[^\/.][^\/]*/ }
+ get "/:username/:repository/commit/:sha", to: "commits#show", as: :repository_commit
+ get "/:username/:repository/blob/:branch/*path", to: "blobs#show", as: :repository_blob
+ get "/:username/:repository/raw/:branch/*path", to: "blobs#raw", as: :repository_blob_raw
+ get "/:username/:repository/tree/:branch/*path", to: "repositories#tree", as: :repository_tree
+ get "/:username/:repository/tree/:branch", to: "repositories#tree", as: :repository_branch
+ get "/:username/:repository", to: "repositories#show", as: :repository
+
+ # Health check
+ get "up" => "rails/health#show", as: :rails_health_check
+end
config/storage.yml
+27
new file mode 100644
index 0000000..927dc53
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,27 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
config/tailwind.config.js
+57
new file mode 100644
index 0000000..aa541a3
--- /dev/null
+++ b/config/tailwind.config.js
@@ -0,0 +1,57 @@
+const defaultTheme = require('tailwindcss/defaultTheme')
+
+module.exports = {
+ content: [
+ './public/*.html',
+ './app/helpers/**/*.rb',
+ './app/javascript/**/*.js',
+ './app/views/**/*.{erb,haml,html,slim}'
+ ],
+ theme: {
+ extend: {
+ fontFamily: {
+ sans: [
+ 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system',
+ 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',
+ ...defaultTheme.fontFamily.sans
+ ],
+ mono: [
+ 'JetBrains Mono', 'ui-monospace', 'SFMono-Regular',
+ 'Menlo', 'Monaco', 'Consolas',
+ ...defaultTheme.fontFamily.mono
+ ],
+ },
+ colors: {
+ brand: {
+ 50: '#FFF5F0',
+ 100: '#FFE8DB',
+ 200: '#FFD0B5',
+ 300: '#FFB088',
+ 400: '#FF8F5A',
+ 500: '#FE6D36',
+ 600: '#E55A24',
+ 700: '#C04A1A',
+ 800: '#993B15',
+ 900: '#732D10',
+ },
+ surface: {
+ 50: '#f5f6f7',
+ 100: '#e0e2e5',
+ 200: '#c1c5cb',
+ 300: '#9ca3ae',
+ 400: '#6b7280',
+ 500: '#383d44',
+ 600: '#2d3238',
+ 700: '#1e2126',
+ 800: '#1a1d21',
+ 900: '#15171a',
+ 950: '#0f1012',
+ },
+ },
+ maxWidth: {
+ '8xl': '88rem',
+ },
+ },
+ },
+ plugins: [],
+}
db/migrate/20250101000001_create_users.rb
+18
new file mode 100644
index 0000000..a8db4d8
--- /dev/null
+++ b/db/migrate/20250101000001_create_users.rb
@@ -0,0 +1,18 @@
+class CreateUsers < ActiveRecord::Migration[8.1]
+ def change
+ create_table :users do |t|
+ t.integer :smbcloud_id, null: false
+ t.string :email, null: false
+ t.string :username, null: false
+ t.string :display_name
+ t.string :avatar_url
+ t.string :access_token
+
+ t.timestamps
+ end
+
+ add_index :users, :smbcloud_id, unique: true
+ add_index :users, :username, unique: true
+ add_index :users, :email, unique: true
+ end
+end
db/migrate/20250101000002_create_repositories.rb
+16
new file mode 100644
index 0000000..6f435d6
--- /dev/null
+++ b/db/migrate/20250101000002_create_repositories.rb
@@ -0,0 +1,16 @@
+class CreateRepositories < ActiveRecord::Migration[8.1]
+ def change
+ create_table :repositories do |t|
+ t.references :user, null: false, foreign_key: true
+ t.string :name, null: false
+ t.text :description
+ t.string :default_branch, null: false, default: "main"
+ t.boolean :is_private, null: false, default: false
+ t.string :disk_path, null: false
+
+ t.timestamps
+ end
+
+ add_index :repositories, [ :user_id, :name ], unique: true
+ end
+end
db/migrate/20250101000003_create_ssh_keys.rb
+12
new file mode 100644
index 0000000..5c1f078
--- /dev/null
+++ b/db/migrate/20250101000003_create_ssh_keys.rb
@@ -0,0 +1,12 @@
+class CreateSshKeys < ActiveRecord::Migration[8.1]
+ def change
+ create_table :ssh_keys do |t|
+ t.references :user, null: false, foreign_key: true
+ t.string :title, null: false
+ t.text :key_text, null: false
+ t.string :fingerprint, null: false
+
+ t.timestamps
+ end
+ end
+end
db/schema.rb
+56
new file mode 100644
index 0000000..64c28ec
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,56 @@
+# 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.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[8.1].define(version: 2025_01_01_000003) do
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "pg_catalog.plpgsql"
+
+ create_table "repositories", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "default_branch", default: "main", null: false
+ t.text "description"
+ t.string "disk_path", null: false
+ t.boolean "is_private", default: false, null: false
+ t.string "name", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.index ["user_id", "name"], name: "index_repositories_on_user_id_and_name", unique: true
+ t.index ["user_id"], name: "index_repositories_on_user_id"
+ end
+
+ create_table "ssh_keys", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "fingerprint", null: false
+ t.text "key_text", null: false
+ t.string "title", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.index ["user_id"], name: "index_ssh_keys_on_user_id"
+ end
+
+ create_table "users", force: :cascade do |t|
+ t.string "access_token"
+ t.string "avatar_url"
+ t.datetime "created_at", null: false
+ t.string "display_name"
+ t.string "email", null: false
+ t.integer "smbcloud_id", null: false
+ t.datetime "updated_at", null: false
+ t.string "username", null: false
+ t.index ["email"], name: "index_users_on_email", unique: true
+ t.index ["smbcloud_id"], name: "index_users_on_smbcloud_id", unique: true
+ t.index ["username"], name: "index_users_on_username", unique: true
+ end
+
+ add_foreign_key "repositories", "users"
+ add_foreign_key "ssh_keys", "users"
+end
db/seeds.rb
+9
new file mode 100644
index 0000000..4fbd6ed
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,9 @@
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
log/.keep
new file mode 100644
index 0000000..e69de29
public/400.html
+135
new file mode 100644
index 0000000..640de03
--- /dev/null
+++ b/public/400.html
@@ -0,0 +1,135 @@
+<!doctype html>
+
+<html lang="en">
+
+ <head>
+
+ <title>The server cannot process the request due to a client error (400 Bad Request)</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1, width=device-width">
+ <meta name="robots" content="noindex, nofollow">
+
+ <style>
+
+ *, *::before, *::after {
+ box-sizing: border-box;
+ }
+
+ * {
+ margin: 0;
+ }
+
+ html {
+ font-size: 16px;
+ }
+
+ body {
+ background: #FFF;
+ color: #261B23;
+ display: grid;
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ font-size: clamp(1rem, 2.5vw, 2rem);
+ -webkit-font-smoothing: antialiased;
+ font-style: normal;
+ font-weight: 400;
+ letter-spacing: -0.0025em;
+ line-height: 1.4;
+ min-height: 100dvh;
+ place-items: center;
+ text-rendering: optimizeLegibility;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
+ a {
+ color: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-underline-offset: 0.0925em;
+ }
+
+ b, strong {
+ font-weight: 700;
+ }
+
+ i, em {
+ font-style: italic;
+ }
+
+ main {
+ display: grid;
+ gap: 1em;
+ padding: 2em;
+ place-items: center;
+ text-align: center;
+ }
+
+ main header {
+ width: min(100%, 12em);
+ }
+
+ main header svg {
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+ }
+
+ main article {
+ width: min(100%, 30em);
+ }
+
+ main article p {
+ font-size: 75%;
+ }
+
+ main article br {
+ display: none;
+
+ @media(min-width: 48em) {
+ display: inline;
+ }
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <!-- This file lives in public/400.html -->
+
+ <main>
+ <header>
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" id="error-description"/></svg>
+ </header>
+ <article>
+ <p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you're the application owner check the logs for more information.</p>
+ </article>
+ </main>
+
+ </body>
+
+</html>
public/404.html
+135
new file mode 100644
index 0000000..d7f0f14
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,135 @@
+<!doctype html>
+
+<html lang="en">
+
+ <head>
+
+ <title>The page you were looking for doesn't exist (404 Not found)</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1, width=device-width">
+ <meta name="robots" content="noindex, nofollow">
+
+ <style>
+
+ *, *::before, *::after {
+ box-sizing: border-box;
+ }
+
+ * {
+ margin: 0;
+ }
+
+ html {
+ font-size: 16px;
+ }
+
+ body {
+ background: #FFF;
+ color: #261B23;
+ display: grid;
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ font-size: clamp(1rem, 2.5vw, 2rem);
+ -webkit-font-smoothing: antialiased;
+ font-style: normal;
+ font-weight: 400;
+ letter-spacing: -0.0025em;
+ line-height: 1.4;
+ min-height: 100dvh;
+ place-items: center;
+ text-rendering: optimizeLegibility;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
+ a {
+ color: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-underline-offset: 0.0925em;
+ }
+
+ b, strong {
+ font-weight: 700;
+ }
+
+ i, em {
+ font-style: italic;
+ }
+
+ main {
+ display: grid;
+ gap: 1em;
+ padding: 2em;
+ place-items: center;
+ text-align: center;
+ }
+
+ main header {
+ width: min(100%, 12em);
+ }
+
+ main header svg {
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+ }
+
+ main article {
+ width: min(100%, 30em);
+ }
+
+ main article p {
+ font-size: 75%;
+ }
+
+ main article br {
+ display: none;
+
+ @media(min-width: 48em) {
+ display: inline;
+ }
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <!-- This file lives in public/404.html -->
+
+ <main>
+ <header>
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm165.328-35.41581-45.689 100.02991h26.224v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.184v-31.901l50.285-103.27391z" id="error-id"/><path d="m157.758 68.9967v34.0033h-7.199l-14.233-19.8814v19.8814h-8.584v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm13.184 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm37.027 8.5839h-8.806v-34.0033h23.924v7.6978h-15.118v6.7564h13.9v7.5316h-13.9zm41.876-12.4605c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm35.337-12.4605v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.997 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm4.076 24.921v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.156.9969-3.6 2.7136v15.0634zm44.113 0v-1.994c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.8151-11.132-13.0145s3.932-13.0143 11.132-13.0143c2.547 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.665-1.3291-2.16-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.717 0 3.156-.9415 3.821-2.326z" id="error-description"/></svg>
+ </header>
+ <article>
+ <p><strong>The page you were looking for doesn't exist.</strong> You may have mistyped the address or the page may have moved. If you're the application owner check the logs for more information.</p>
+ </article>
+ </main>
+
+ </body>
+
+</html>
public/406-unsupported-browser.html
+135
new file mode 100644
index 0000000..43d2811
--- /dev/null
+++ b/public/406-unsupported-browser.html
@@ -0,0 +1,135 @@
+<!doctype html>
+
+<html lang="en">
+
+ <head>
+
+ <title>Your browser is not supported (406 Not Acceptable)</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1, width=device-width">
+ <meta name="robots" content="noindex, nofollow">
+
+ <style>
+
+ *, *::before, *::after {
+ box-sizing: border-box;
+ }
+
+ * {
+ margin: 0;
+ }
+
+ html {
+ font-size: 16px;
+ }
+
+ body {
+ background: #FFF;
+ color: #261B23;
+ display: grid;
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ font-size: clamp(1rem, 2.5vw, 2rem);
+ -webkit-font-smoothing: antialiased;
+ font-style: normal;
+ font-weight: 400;
+ letter-spacing: -0.0025em;
+ line-height: 1.4;
+ min-height: 100dvh;
+ place-items: center;
+ text-rendering: optimizeLegibility;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
+ a {
+ color: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-underline-offset: 0.0925em;
+ }
+
+ b, strong {
+ font-weight: 700;
+ }
+
+ i, em {
+ font-style: italic;
+ }
+
+ main {
+ display: grid;
+ gap: 1em;
+ padding: 2em;
+ place-items: center;
+ text-align: center;
+ }
+
+ main header {
+ width: min(100%, 12em);
+ }
+
+ main header svg {
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+ }
+
+ main article {
+ width: min(100%, 30em);
+ }
+
+ main article p {
+ font-size: 75%;
+ }
+
+ main article br {
+ display: none;
+
+ @media(min-width: 48em) {
+ display: inline;
+ }
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <!-- This file lives in public/406-unsupported-browser.html -->
+
+ <main>
+ <header>
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm202.906 9.7326h-41.093c-2.433-7.2994-7.84-12.4361-17.302-12.4361-16.221 0-25.413 17.5728-25.954 34.8752v1.3517c5.137-7.0291 16.221-12.4361 30.82-12.4361 33.524 0 54.881 24.0612 54.881 53.7998 0 33.253-23.791 58.396-61.64 58.396-21.628 0-39.741-10.003-50.825-27.576-9.733-14.599-13.788-32.442-13.788-54.3406 0-51.9072 24.331-89.485807 66.236-89.485807 32.712 0 53.258 18.654107 58.665 47.851907zm-82.727 66.2355c0 13.247 9.463 22.439 22.71 22.439 12.977 0 22.439-9.192 22.439-22.439 0-13.517-9.462-22.7091-22.439-22.7091-13.247 0-22.71 9.1921-22.71 22.7091z" id="error-id"/><path d="m100.761 68.9967v34.0033h-7.1991l-14.2326-19.8814v19.8814h-8.5839v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm13.185 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.02-25.4194h9.083l12.958 34.0033h-9.027l-2.436-6.5902h-12.35l-2.381 6.5902h-8.806zm4.431 10.5222-3.489 9.5807h6.978zm17.44 11.0206c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm25.676 0c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm42.013 3.7658h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm23.4 16.7244v10.799h-8.694v-33.726h8.694v1.9937c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8703 11.131 13.0143 0 7.0886-3.932 13.0145-11.131 13.0145-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.16 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.717 0-3.157.9969-3.822 2.326zm21.892 7.1994v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.458 8.5839h-8.363v-1.274c-.83.831-3.322 1.717-5.981 1.717-4.928 0-9.082-2.769-9.082-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.045-2.9905-1.606 0-2.548.7199-2.936 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.553-1.0522-2.049-1.7167-3.655-1.7167-1.716 0-3.433.7199-3.433 2.3813 0 1.7168 1.717 2.4367 3.433 2.4367 1.606 0 3.102-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.694v-35.997h8.694v13.0697c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8149 11.131 13.0143s-3.932 13.0145-11.131 13.0145c-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.662 0-3.157.9969-3.822 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997z" id="error-description"/></svg>
+ </header>
+ <article>
+ <p><strong>Your browser is not supported.</strong><br> Please upgrade your browser to continue.</p>
+ </article>
+ </main>
+
+ </body>
+
+</html>
public/422.html
+135
new file mode 100644
index 0000000..f12fb4a
--- /dev/null
+++ b/public/422.html
@@ -0,0 +1,135 @@
+<!doctype html>
+
+<html lang="en">
+
+ <head>
+
+ <title>The change you wanted was rejected (422 Unprocessable Entity)</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1, width=device-width">
+ <meta name="robots" content="noindex, nofollow">
+
+ <style>
+
+ *, *::before, *::after {
+ box-sizing: border-box;
+ }
+
+ * {
+ margin: 0;
+ }
+
+ html {
+ font-size: 16px;
+ }
+
+ body {
+ background: #FFF;
+ color: #261B23;
+ display: grid;
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ font-size: clamp(1rem, 2.5vw, 2rem);
+ -webkit-font-smoothing: antialiased;
+ font-style: normal;
+ font-weight: 400;
+ letter-spacing: -0.0025em;
+ line-height: 1.4;
+ min-height: 100dvh;
+ place-items: center;
+ text-rendering: optimizeLegibility;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
+ a {
+ color: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-underline-offset: 0.0925em;
+ }
+
+ b, strong {
+ font-weight: 700;
+ }
+
+ i, em {
+ font-style: italic;
+ }
+
+ main {
+ display: grid;
+ gap: 1em;
+ padding: 2em;
+ place-items: center;
+ text-align: center;
+ }
+
+ main header {
+ width: min(100%, 12em);
+ }
+
+ main header svg {
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+ }
+
+ main article {
+ width: min(100%, 30em);
+ }
+
+ main article p {
+ font-size: 75%;
+ }
+
+ main article br {
+ display: none;
+
+ @media(min-width: 48em) {
+ display: inline;
+ }
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <!-- This file lives in public/422.html -->
+
+ <main>
+ <header>
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm130.453 51.63681c0-8.9215-6.218-15.4099-15.681-15.4099-10.273 0-15.95 7.5698-16.491 16.4913h-44.608c3.244-30.8199 25.683-55.421707 61.099-55.421707 36.498 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.869 36.7676-31.901 52.7186l-27.305 27.035h59.747v37.308h-120.306v-27.846l57.044-56.7736c11.084-11.8954 18.925-20.0059 18.925-29.7385zm140.455 0c0-8.9215-6.218-15.4099-15.68-15.4099-10.274 0-15.951 7.5698-16.492 16.4913h-44.608c3.245-30.8199 25.684-55.421707 61.1-55.421707 36.497 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.87 36.7676-31.902 52.7186l-27.305 27.035h59.747v37.308h-120.305v-27.846l57.043-56.7736c11.085-11.8954 18.925-20.0059 18.925-29.7385z" id="error-id"/><path d="m19.3936 103.554c-8.9715 0-14.84183-5.0952-14.84183-14.4544v-20.1029h8.86083v19.3276c0 4.8181 2.2706 7.3102 5.981 7.3102 3.6551 0 5.9257-2.4921 5.9257-7.3102v-19.3276h8.8608v20.1583c0 9.3038-5.8149 14.399-14.7865 14.399zm18.734-.554v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm36.8584-1.994v10.799h-8.6946v-33.726h8.6946v1.9937c1.163-1.3291 3.5997-2.5475 6.1472-2.5475 7.1994 0 11.1314 5.8703 11.1314 13.0143 0 7.0886-3.932 13.0145-11.1314 13.0145-2.5475 0-4.9842-1.219-6.1472-2.548zm0-13.7893v6.5902c.6646 1.3845 2.1599 2.326 3.8213 2.326 2.9905 0 4.7626-2.3814 4.7626-5.5934s-1.7721-5.6488-4.7626-5.6488c-1.7168 0-3.1567.9969-3.8213 2.326zm36.789-9.2485v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.6949v-24.921h8.6949v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm10.352 0c0-7.6978 5.095-13.0143 12.571-13.0143 6.701 0 10.855 3.9874 11.574 9.8023h-8.417c-.222-1.4953-1.385-2.6029-3.157-2.6029-2.437 0-3.987 2.2706-3.987 5.8149s1.55 5.7595 3.987 5.7595c1.772 0 2.935-1.0522 3.157-2.5475h8.417c-.719 5.7596-4.873 9.8025-11.574 9.8025-7.476 0-12.571-5.3167-12.571-13.0145zm42.013 3.7658h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.544-3.5997zm13.428 11.0206h8.473c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.938-1.5506l-4.874-.9969c-4.153-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.74-8.2518zm24.269 0h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm47.918 7.6978h-8.363v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.695v-35.997h8.695v13.0697c1.163-1.3291 3.6-2.5475 6.147-2.5475 7.2 0 11.132 5.8149 11.132 13.0143s-3.932 13.0145-11.132 13.0145c-2.547 0-4.984-1.219-6.147-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.821 2.326 2.991 0 4.763-2.3814 4.763-5.5934s-1.772-5.6488-4.763-5.6488c-1.661 0-3.156.9969-3.821 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm25.461-15.2849h24.311v7.6424h-15.561v5.3165h14.232v7.4763h-14.232v5.8703h15.561v7.6978h-24.311zm27.942 34.0033v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm29.991-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm26.161-16.3371v24.921h-8.694v-24.921zm.61-6.7564c0 2.8244-2.271 4.652-4.929 4.652s-4.929-1.8276-4.929-4.652c0-2.8797 2.271-4.7073 4.929-4.7073s4.929 1.8276 4.929 4.7073zm5.382 23.0935v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm29.22 17.3889h-8.584l3.655-9.414-9.303-24.312h9.026l4.763 14.1773 4.652-14.1773h8.639z" id="error-description"/></svg>
+ </header>
+ <article>
+ <p><strong>The change you wanted was rejected.</strong> Maybe you tried to change something you didn't have access to. If you're the application owner check the logs for more information.</p>
+ </article>
+ </main>
+
+ </body>
+
+</html>
public/500.html
+135
new file mode 100644
index 0000000..e4eb18a
--- /dev/null
+++ b/public/500.html
@@ -0,0 +1,135 @@
+<!doctype html>
+
+<html lang="en">
+
+ <head>
+
+ <title>We're sorry, but something went wrong (500 Internal Server Error)</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1, width=device-width">
+ <meta name="robots" content="noindex, nofollow">
+
+ <style>
+
+ *, *::before, *::after {
+ box-sizing: border-box;
+ }
+
+ * {
+ margin: 0;
+ }
+
+ html {
+ font-size: 16px;
+ }
+
+ body {
+ background: #FFF;
+ color: #261B23;
+ display: grid;
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ font-size: clamp(1rem, 2.5vw, 2rem);
+ -webkit-font-smoothing: antialiased;
+ font-style: normal;
+ font-weight: 400;
+ letter-spacing: -0.0025em;
+ line-height: 1.4;
+ min-height: 100dvh;
+ place-items: center;
+ text-rendering: optimizeLegibility;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
+ a {
+ color: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-underline-offset: 0.0925em;
+ }
+
+ b, strong {
+ font-weight: 700;
+ }
+
+ i, em {
+ font-style: italic;
+ }
+
+ main {
+ display: grid;
+ gap: 1em;
+ padding: 2em;
+ place-items: center;
+ text-align: center;
+ }
+
+ main header {
+ width: min(100%, 12em);
+ }
+
+ main header svg {
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+ }
+
+ main article {
+ width: min(100%, 30em);
+ }
+
+ main article p {
+ font-size: 75%;
+ }
+
+ main article br {
+ display: none;
+
+ @media(min-width: 48em) {
+ display: inline;
+ }
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <!-- This file lives in public/500.html -->
+
+ <main>
+ <header>
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m101.23 93.8427c-8.1103 0-15.4098 3.7849-19.7354 8.3813h-36.2269v-99.21891h103.8143v37.03791h-68.3984v24.8722c5.1366-2.7035 15.1396-5.9477 24.6014-5.9477 35.146 0 56.233 22.7094 56.233 55.4215 0 34.605-23.791 57.315-60.558 57.315-37.8492 0-61.64-22.169-63.8028-55.963h42.9857c1.0814 10.814 9.1919 19.195 21.6281 19.195 11.355 0 19.465-8.381 19.465-20.547 0-11.625-7.299-20.5463-20.006-20.5463zm138.833 77.8613c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m23.1377 68.9967v34.0033h-8.9162v-34.0033zm4.3157 34.0033v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm29.9913-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.5839v6.8671h5.2058v6.7564h-5.2058v8.307c0 1.9383.9415 2.769 2.6583 2.769.9414 0 1.9937-.2216 2.769-.5538v7.3654c-.9969.443-2.8798.775-4.8181.775-5.8703 0-9.1931-2.769-9.1931-9.0819zm32.3666-.1108h8.0301c-.8861 5.7597-5.2057 9.2487-11.6852 9.2487-7.6424 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.3165-13.0143 12.5159-13.0143 7.6424 0 11.9621 5.095 11.9621 12.5159v2.1598h-16.1156c.2769 2.9905 1.8275 4.5965 4.3196 4.5965 1.7722 0 3.1567-.7753 3.6551-2.4921zm-3.8212-10.0237c-2.0491 0-3.4336 1.2737-3.9874 3.5997h7.5317c-.1107-2.0491-1.3845-3.5997-3.5443-3.5997zm31.4299-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.599-.7753-2.382 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.381.443zm2.949 25.0318v-24.921h8.694v2.1598c1.385-1.5506 3.821-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.64v-14.2327c0-2.049-1.052-3.5443-3.267-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm50.371 0h-8.363v-1.274c-.83.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.433.7199-3.433 2.3813 0 1.7168 1.716 2.4367 3.433 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742-29.0191v35.997h-8.694v-35.997zm13.036 25.9178h9.248c.72 2.326 2.714 3.489 5.483 3.489 2.713 0 4.596-1.163 4.596-3.2674 0-1.6061-1.052-2.326-3.212-2.8244l-6.534-1.3845c-4.985-1.1076-8.751-3.7105-8.751-9.47 0-6.6456 5.538-11.0206 13.07-11.0206 8.307 0 13.014 4.5411 13.956 10.4114h-8.695c-.72-1.8829-2.27-3.3228-5.205-3.3228-2.548 0-4.265 1.1076-4.265 2.9905 0 1.4953 1.052 2.326 2.825 2.7137l6.645 1.5506c5.815 1.3845 9.027 4.5412 9.027 9.8023 0 6.9778-5.87 10.9654-13.291 10.9654-8.141 0-13.679-3.9322-14.897-10.6332zm46.509 1.3845h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm31.431-6.3134v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.382.443zm18.288 25.0318h-7.809l-9.47-24.921h8.861l4.763 14.288 4.652-14.288h8.528zm25.614-8.6947h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997zm31.43-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443zm13.703-8.9715h24.312v7.6424h-15.562v5.3165h14.232v7.4763h-14.232v5.8703h15.562v7.6978h-24.312zm44.667 8.9715v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm19.673 0v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm28.082-12.5713v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443z" id="error-description"/></svg>
+ </header>
+ <article>
+ <p><strong>We're sorry, but something went wrong.</strong><br> If you're the application owner check the logs for more information.</p>
+ </article>
+ </main>
+
+ </body>
+
+</html>
public/icon-bak.png
new file mode 100644
index 0000000..c4c9dbf
Binary files /dev/null and b/public/icon-bak.png differ
public/icon.png
new file mode 100644
index 0000000..db96f14
Binary files /dev/null and b/public/icon.png differ
public/icon.svg
+3
new file mode 100644
index 0000000..04b34bf
--- /dev/null
+++ b/public/icon.svg
@@ -0,0 +1,3 @@
+<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="256" cy="256" r="256" fill="red"/>
+</svg>
public/robots.txt
+1
new file mode 100644
index 0000000..c19f78a
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1 @@
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
script/.keep
new file mode 100644
index 0000000..e69de29
scripts/write_views.py
+1001
new file mode 100644
index 0000000..50f0f68
--- /dev/null
+++ b/scripts/write_views.py
@@ -0,0 +1,1001 @@
+#!/usr/bin/env python3
+"""Write all truncated ERB views for the siGit si Rails app."""
+
+import os
+
+# Reusable SVG path fragments
+GIT_PATH = (
+ "M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61"
+ "c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 "
+ "5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0"
+ "C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77"
+ "a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7"
+ "A3.37 3.37 0 0 0 9 18.13V22"
+)
+
+REPO_PATH_16 = (
+ "M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5"
+ "a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8"
+ "a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5"
+ "Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"
+)
+
+COMMIT_PATH_16 = (
+ "M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32"
+ "a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5"
+ "Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"
+)
+
+BRANCH_PATH_16 = (
+ "M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6"
+ "a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372"
+ "a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4"
+ "a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25"
+ "Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0"
+ "Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5"
+ "ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"
+)
+
+FOLDER_PATH_16 = (
+ "M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5"
+ "A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5"
+ "a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"
+)
+
+FILE_PATH_16 = (
+ "M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513"
+ "l2.914 2.914c.329.328.513.773.513 1.237v9.586"
+ "A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25"
+ "Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5"
+ "a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5"
+ "Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"
+)
+
+README_PATH_16 = (
+ "M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501"
+ "A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5"
+ "a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621"
+ "a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75"
+ "a.75.75 0 0 1-.75-.75"
+ "Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9"
+ "h3.757a3.75 3.75 0 0 1 1.994.574"
+ "ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9"
+ "h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"
+)
+
+PLUS_PATH_16 = (
+ "M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25"
+ "a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75"
+ "A.75.75 0 0 1 7.75 2Z"
+)
+
+CHEVRON_PATH = "M4 6l4 4 4-4"
+
+EMAIL_PATH_16 = (
+ "M1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5"
+ "A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25v-8.5"
+ "C0 2.784.784 2 1.75 2"
+ "ZM1.5 12.251c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V5.809"
+ "L8.38 9.397a.75.75 0 0 1-.76 0L1.5 5.809v6.442"
+ "Zm13-8.181v-.32a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25v.32L8 7.88Z"
+)
+
+LOCK_PATH_16 = (
+ "M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5"
+ "A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5"
+ "C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5"
+ "c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5"
+ "a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"
+)
+
+SHIELD_PATH_24 = (
+ "M9 12.75 11.25 15 15 9.75"
+ "m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749"
+ "c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622"
+ "0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"
+)
+
+FOLDER_OPEN_PATH = (
+ "M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026"
+ "m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932"
+ "H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542"
+ "m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44"
+ "l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"
+)
+
+files = {}
+
+# ---------------------------------------------------------------------------
+# layouts/application.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/layouts/application.html.erb"] = (
+ "<!DOCTYPE html>\n"
+ '<html lang="en" class="h-full">\n'
+ " <head>\n"
+ ' <meta charset="utf-8">\n'
+ ' <meta name="viewport" content="width=device-width, initial-scale=1">\n'
+ ' <meta name="description" content="siGit \u2014 cloud repository hosting">\n'
+ ' <title><%= content_for?(:title) ? "#{yield(:title)} \u00b7 siGit" : "siGit" %></title>\n'
+ ' <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>\n'
+ " <%= javascript_importmap_tags %>\n"
+ " <%= csrf_meta_tags %>\n"
+ " </head>\n"
+ "\n"
+ ' <body class="h-full bg-white">\n'
+ ' <%= render "shared/navbar" %>\n'
+ "\n"
+ " <% if notice.present? %>\n"
+ ' <div class="bg-green-50 border-b border-green-200 px-4 py-3 text-sm text-green-800 text-center" role="alert">\n'
+ " <%= notice %>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " <% if alert.present? %>\n"
+ ' <div class="bg-amber-50 border-b border-amber-200 px-4 py-3 text-sm text-amber-800 text-center" role="alert">\n'
+ " <%= alert %>\n"
+ " </div>\n"
+ " <% end %>\n"
+ "\n"
+ " <main>\n"
+ " <%= yield %>\n"
+ " </main>\n"
+ "\n"
+ ' <footer class="border-t border-gray-100 mt-16">\n'
+ ' <div class="max-w-6xl mx-auto px-4 sm:px-6 py-8 flex items-center justify-between text-xs text-gray-400">\n'
+ " <span>siGit si — cloud repository hosting</span>\n"
+ ' <span>Built with <a href="https://rubyonrails.org" class="hover:text-gray-600">Rails 8</a></span>\n'
+ " </div>\n"
+ " </footer>\n"
+ " </body>\n"
+ "</html>\n"
+)
+
+# ---------------------------------------------------------------------------
+# shared/_navbar.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/shared/_navbar.html.erb"] = (
+ '<header class="border-b border-gray-200 bg-white sticky top-0 z-50">\n'
+ ' <nav class="max-w-6xl mx-auto px-4 sm:px-6 h-14 flex items-center justify-between gap-6">\n'
+ "\n"
+ ' <div class="flex items-center gap-6">\n'
+ ' <%= link_to root_path, class: "flex items-center gap-2 text-gray-900 hover:text-brand-500 transition-colors" do %>\n'
+ ' <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n'
+ ' stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n'
+ f' <path d="{GIT_PATH}"/>\n'
+ " </svg>\n"
+ ' <span class="font-semibold text-base tracking-tight">siGit</span>\n'
+ " <% end %>\n"
+ "\n"
+ " <% if signed_in? %>\n"
+ ' <div class="hidden sm:flex items-center gap-1">\n'
+ ' <%= link_to "Explore", "#", class: "nav-link px-2 py-1 rounded hover:bg-gray-50" %>\n'
+ " </div>\n"
+ " <% end %>\n"
+ " </div>\n"
+ "\n"
+ ' <div class="flex items-center gap-3">\n'
+ " <% if signed_in? %>\n"
+ ' <%= link_to new_repository_path, class: "btn-secondary text-xs py-1.5 px-3 hidden sm:inline-flex" do %>\n'
+ ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{PLUS_PATH_16}"/>\n'
+ " </svg>\n"
+ " New\n"
+ " <% end %>\n"
+ "\n"
+ ' <div class="relative group">\n'
+ ' <button class="flex items-center gap-2 hover:opacity-80 transition-opacity">\n'
+ ' <img src="<%= current_user.avatar_url_or_default %>"\n'
+ ' alt="<%= current_user.display_name_or_username %>"\n'
+ ' class="w-7 h-7 rounded-full border border-gray-200">\n'
+ ' <span class="text-sm font-medium text-gray-700 hidden sm:block"><%= current_user.username %></span>\n'
+ ' <svg class="w-3.5 h-3.5 text-gray-400" fill="none" viewBox="0 0 16 16"\n'
+ ' stroke="currentColor" stroke-width="2">\n'
+ f' <path stroke-linecap="round" stroke-linejoin="round" d="{CHEVRON_PATH}"/>\n'
+ " </svg>\n"
+ " </button>\n"
+ "\n"
+ ' <div class="absolute right-0 top-full mt-1 w-48 bg-white border border-gray-200\n'
+ " rounded shadow-lg py-1 opacity-0 invisible\n"
+ " group-hover:opacity-100 group-hover:visible\n"
+ ' transition-all duration-150 z-50">\n'
+ ' <div class="px-3 py-2 border-b border-gray-100">\n'
+ ' <p class="text-xs font-medium text-gray-900"><%= current_user.display_name_or_username %></p>\n'
+ ' <p class="text-xs text-gray-500"><%= current_user.email %></p>\n'
+ " </div>\n"
+ " <%= link_to user_profile_path(current_user.username),\n"
+ ' class: "block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50" do %>Your repositories<% end %>\n'
+ " <%= link_to settings_path,\n"
+ ' class: "block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50" do %>Settings<% end %>\n'
+ ' <div class="border-t border-gray-100 mt-1">\n'
+ " <%= button_to signout_path, method: :delete,\n"
+ ' class: "block w-full text-left px-3 py-1.5 text-sm text-red-600 hover:bg-red-50 transition-colors" do %>\n'
+ " Sign out\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <% else %>\n"
+ ' <%= link_to "Sign in", signin_path, class: "btn-primary text-xs py-1.5 px-4" %>\n'
+ " <% end %>\n"
+ " </div>\n"
+ " </nav>\n"
+ "</header>\n"
+)
+
+# ---------------------------------------------------------------------------
+# pages/home.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/pages/home.html.erb"] = (
+ '<% content_for :title, "Welcome" %>\n'
+ "\n"
+ '<div class="min-h-screen">\n'
+ ' <section class="border-b border-gray-100 bg-white">\n'
+ ' <div class="max-w-4xl mx-auto px-4 sm:px-6 py-24 text-center">\n'
+ ' <h1 class="text-4xl sm:text-5xl font-semibold text-gray-900 tracking-tight mb-6 leading-tight">\n'
+ " Code, together.<br>\n"
+ ' <span class="text-brand-500">Simply.</span>\n'
+ " </h1>\n"
+ ' <p class="text-lg text-gray-500 max-w-xl mx-auto mb-10 font-light leading-relaxed">\n'
+ " siGit is a minimal cloud repository host built for clarity and speed.\n"
+ " Host your Git repositories without noise.\n"
+ " </p>\n"
+ ' <%= link_to signin_path, class: "btn-primary px-8 py-3 text-base" do %>\n'
+ ' <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n'
+ ' stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n'
+ f' <path d="{GIT_PATH}"/>\n'
+ " </svg>\n"
+ " Sign in with smbCloud\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </section>\n"
+ "\n"
+ ' <section class="max-w-4xl mx-auto px-4 sm:px-6 py-20">\n'
+ ' <div class="grid grid-cols-1 sm:grid-cols-3 gap-12">\n'
+ "\n"
+ " <div>\n"
+ ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
+ ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
+ ' <path stroke-linecap="round" stroke-linejoin="round"\n'
+ f' d="{FOLDER_OPEN_PATH}"/>\n'
+ " </svg>\n"
+ " </div>\n"
+ ' <h3 class="font-semibold text-gray-900 mb-2">Repository Hosting</h3>\n'
+ ' <p class="text-sm text-gray-500 leading-relaxed">Create and manage Git repositories\n'
+ " with a clean, distraction-free interface.</p>\n"
+ " </div>\n"
+ "\n"
+ " <div>\n"
+ ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
+ ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
+ ' <path stroke-linecap="round" stroke-linejoin="round"\n'
+ ' d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"/>\n'
+ " </svg>\n"
+ " </div>\n"
+ ' <h3 class="font-semibold text-gray-900 mb-2">Code Browsing</h3>\n'
+ ' <p class="text-sm text-gray-500 leading-relaxed">Browse your code with syntax\n'
+ " highlighting, file tree navigation, and commit history.</p>\n"
+ " </div>\n"
+ "\n"
+ " <div>\n"
+ ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
+ ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
+ ' <path stroke-linecap="round" stroke-linejoin="round"\n'
+ ' d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026'
+ "-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591"
+ 'l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 0 1 21.75 8.25Z"/>\n'
+ " </svg>\n"
+ " </div>\n"
+ ' <h3 class="font-semibold text-gray-900 mb-2">Secure Auth</h3>\n'
+ ' <p class="text-sm text-gray-500 leading-relaxed">Authentication via smbCloud Auth\n'
+ " — secure and token-based. No passwords stored by siGit.</p>\n"
+ " </div>\n"
+ "\n"
+ " </div>\n"
+ " </section>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# pages/dashboard.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/pages/dashboard.html.erb"] = (
+ '<% content_for :title, "Dashboard" %>\n'
+ "\n"
+ '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-8">\n'
+ ' <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">\n'
+ "\n"
+ ' <aside class="lg:col-span-1">\n'
+ ' <div class="text-center sm:text-left">\n'
+ ' <img src="<%= current_user.avatar_url_or_default %>"\n'
+ ' alt="<%= current_user.display_name_or_username %>"\n'
+ ' class="w-20 h-20 rounded-full border border-gray-200 mx-auto sm:mx-0 mb-4">\n'
+ ' <h2 class="font-semibold text-gray-900 text-base"><%= current_user.display_name_or_username %></h2>\n'
+ ' <p class="text-sm text-gray-500"><%= current_user.username %></p>\n'
+ " </div>\n"
+ ' <div class="mt-6">\n'
+ ' <%= link_to new_repository_path, class: "btn-secondary w-full justify-center" do %>\n'
+ ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{PLUS_PATH_16}"/>\n'
+ " </svg>\n"
+ " New repository\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </aside>\n"
+ "\n"
+ ' <main class="lg:col-span-3">\n'
+ ' <div class="flex items-center justify-between mb-4">\n'
+ ' <h1 class="text-base font-semibold text-gray-900">Your repositories</h1>\n'
+ " <%= link_to user_profile_path(current_user.username),\n"
+ ' class: "text-xs text-brand-500 hover:underline" do %>View all<% end %>\n'
+ " </div>\n"
+ "\n"
+ " <% if @repositories.any? %>\n"
+ ' <div class="card divide-y divide-gray-100">\n'
+ " <% @repositories.each do |repo| %>\n"
+ ' <div class="px-4 py-3 hover:bg-gray-50 transition-colors">\n'
+ ' <div class="flex items-start justify-between gap-4">\n'
+ ' <div class="min-w-0 flex-1">\n'
+ " <%= link_to repository_path(current_user.username, repo.name),\n"
+ ' class: "font-medium text-brand-500 hover:underline text-sm" do %><%= repo.name %><% end %>\n'
+ " <% if repo.description.present? %>\n"
+ ' <p class="text-xs text-gray-500 mt-0.5 truncate"><%= repo.description %></p>\n'
+ " <% end %>\n"
+ " </div>\n"
+ ' <div class="flex items-center gap-3 text-xs text-gray-400 shrink-0">\n'
+ " <% if repo.is_private %>\n"
+ ' <span class="badge-gray">Private</span>\n'
+ " <% end %>\n"
+ " <span><%= time_ago_in_words(repo.updated_at) %> ago</span>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " </div>\n"
+ " <% else %>\n"
+ ' <div class="card px-6 py-12 text-center">\n'
+ ' <svg class="w-12 h-12 mx-auto text-gray-300 mb-4" viewBox="0 0 24 24"\n'
+ ' fill="none" stroke="currentColor" stroke-width="1">\n'
+ ' <path stroke-linecap="round" stroke-linejoin="round"\n'
+ f' d="{FOLDER_OPEN_PATH}"/>\n'
+ " </svg>\n"
+ ' <p class="text-sm text-gray-500 mb-4">No repositories yet.</p>\n'
+ ' <%= link_to new_repository_path, class: "btn-primary" do %>Create your first repository<% end %>\n'
+ " </div>\n"
+ " <% end %>\n"
+ " </main>\n"
+ "\n"
+ " </div>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# users/show.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/users/show.html.erb"] = (
+ "<% content_for :title, @profile_user.display_name_or_username %>\n"
+ "\n"
+ '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-10">\n'
+ ' <div class="grid grid-cols-1 lg:grid-cols-4 gap-10">\n'
+ "\n"
+ ' <aside class="lg:col-span-1">\n'
+ ' <img src="<%= @profile_user.avatar_url_or_default %>"\n'
+ ' alt="<%= @profile_user.display_name_or_username %>"\n'
+ ' class="w-full max-w-[200px] rounded-full border border-gray-200 mb-4">\n'
+ ' <h1 class="text-xl font-semibold text-gray-900"><%= @profile_user.display_name_or_username %></h1>\n'
+ ' <p class="text-gray-500 text-sm"><%= @profile_user.username %></p>\n'
+ " <% if @profile_user.email.present? %>\n"
+ ' <div class="flex items-center gap-2 mt-3 text-sm text-gray-500">\n'
+ ' <svg class="w-4 h-4 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{EMAIL_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= @profile_user.email %>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " </aside>\n"
+ "\n"
+ ' <main class="lg:col-span-3">\n'
+ ' <div class="flex items-center justify-between mb-4">\n'
+ ' <h2 class="text-base font-semibold text-gray-900">\n'
+ " Repositories\n"
+ ' <span class="badge-gray ml-1 align-middle"><%= @repositories.count %></span>\n'
+ " </h2>\n"
+ " <% if signed_in? && current_user == @profile_user %>\n"
+ ' <%= link_to new_repository_path, class: "btn-secondary text-xs" do %>New<% end %>\n'
+ " <% end %>\n"
+ " </div>\n"
+ "\n"
+ " <% if @repositories.any? %>\n"
+ ' <div class="space-y-3">\n'
+ " <% @repositories.each do |repo| %>\n"
+ ' <div class="card px-5 py-4 hover:border-gray-300 transition-colors">\n'
+ ' <div class="flex items-start justify-between gap-4">\n'
+ ' <div class="min-w-0 flex-1">\n'
+ ' <div class="flex items-center gap-2 mb-1">\n'
+ " <%= link_to repo.name,\n"
+ " repository_path(@profile_user.username, repo.name),\n"
+ ' class: "font-semibold text-brand-500 hover:underline" %>\n'
+ " <% if repo.is_private %>\n"
+ ' <span class="badge-gray">Private</span>\n'
+ " <% end %>\n"
+ " </div>\n"
+ " <% if repo.description.present? %>\n"
+ ' <p class="text-sm text-gray-500"><%= repo.description %></p>\n'
+ " <% end %>\n"
+ " </div>\n"
+ ' <div class="text-xs text-gray-400 shrink-0">\n'
+ " <%= time_ago_in_words(repo.updated_at) %> ago\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " </div>\n"
+ " <% else %>\n"
+ ' <div class="card px-6 py-12 text-center">\n'
+ ' <p class="text-sm text-gray-400">No public repositories.</p>\n'
+ " </div>\n"
+ " <% end %>\n"
+ " </main>\n"
+ "\n"
+ " </div>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# repositories/show.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/repositories/show.html.erb"] = (
+ "<% content_for :title, @repository.full_name %>\n"
+ "\n"
+ '<div class="border-b border-gray-200 bg-white">\n'
+ ' <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">\n'
+ "\n"
+ ' <div class="flex items-center gap-2 text-sm mb-4">\n'
+ ' <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{REPO_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= link_to @owner.username, user_profile_path(@owner.username),\n"
+ ' class: "text-brand-500 hover:underline font-medium" %>\n'
+ ' <span class="text-gray-400">/</span>\n'
+ " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
+ ' class: "text-brand-500 hover:underline font-semibold" %>\n'
+ " <% if @repository.is_private %>\n"
+ ' <span class="badge-gray ml-1">Private</span>\n'
+ " <% end %>\n"
+ " </div>\n"
+ "\n"
+ " <% if @repository.description.present? %>\n"
+ ' <p class="text-sm text-gray-600 mb-4"><%= @repository.description %></p>\n'
+ " <% end %>\n"
+ "\n"
+ ' <div class="flex items-center gap-0 -mb-px">\n'
+ " <%= link_to repository_path(@owner.username, @repository.name),\n"
+ ' class: "tab-item active flex items-center gap-1.5" do %>\n'
+ ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{REPO_PATH_16}"/>\n'
+ " </svg>\n"
+ " Code\n"
+ " <% end %>\n"
+ " <% if @repository.initialized? %>\n"
+ " <%= link_to repository_commits_path(@owner.username, @repository.name,\n"
+ " @branch || @repository.default_branch),\n"
+ ' class: "tab-item flex items-center gap-1.5" do %>\n'
+ ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{COMMIT_PATH_16}"/>\n'
+ " </svg>\n"
+ " Commits\n"
+ " <% if @commit_count&.> 0 %>\n"
+ ' <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span>\n'
+ " <% end %>\n"
+ " <% end %>\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </div>\n"
+ "</div>\n"
+ "\n"
+ '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">\n'
+ " <% if @empty %>\n"
+ ' <div class="card p-8 text-center max-w-2xl mx-auto">\n'
+ ' <svg class="w-16 h-16 mx-auto text-gray-200 mb-5" viewBox="0 0 24 24"\n'
+ ' fill="none" stroke="currentColor" stroke-width="1"\n'
+ ' stroke-linecap="round" stroke-linejoin="round">\n'
+ f' <path d="{GIT_PATH}"/>\n'
+ " </svg>\n"
+ ' <h2 class="text-lg font-semibold text-gray-900 mb-2">This repository is empty</h2>\n'
+ ' <p class="text-sm text-gray-500 mb-6">Get started by pushing your first commit.</p>\n'
+ ' <div class="code-container text-left p-4 max-w-lg mx-auto text-xs font-mono space-y-0.5">\n'
+ ' <p class="text-gray-400 mb-1"># Clone and push</p>\n'
+ ' <p class="text-gray-700">git clone git@sigitsi.com:<%= @owner.username %>/<%= @repository.name %></p>\n'
+ ' <p class="text-gray-700">cd <%= @repository.name %></p>\n'
+ ' <p class="text-gray-700">echo "# <%= @repository.name %>" > README.md</p>\n'
+ ' <p class="text-gray-700">git add . && git commit -m "Initial commit"</p>\n'
+ ' <p class="text-gray-700">git push origin main</p>\n'
+ " </div>\n"
+ " </div>\n"
+ " <% else %>\n"
+ "\n"
+ ' <div class="card rounded-b-none border-b-0 px-4 py-2.5\n'
+ ' flex items-center justify-between gap-4 bg-gray-50">\n'
+ ' <div class="flex items-center gap-3">\n'
+ ' <span class="btn-secondary py-1 px-3 text-xs font-mono flex items-center gap-1.5 cursor-default">\n'
+ ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{BRANCH_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= @branch %>\n"
+ " </span>\n"
+ " <% if @recent_commits.first %>\n"
+ " <% commit = @recent_commits.first %>\n"
+ ' <span class="text-xs text-gray-500">\n'
+ " <%= link_to commit[:short_sha],\n"
+ " repository_commit_path(@owner.username, @repository.name, commit[:sha]),\n"
+ ' class: "font-mono text-brand-500 hover:underline" %>\n'
+ " · <%= commit[:subject] %>\n"
+ ' · <span class="text-gray-400"><%= time_ago_in_words(commit[:authored_date]) %> ago</span>\n'
+ " </span>\n"
+ " <% end %>\n"
+ " </div>\n"
+ ' <div class="flex items-center gap-3 text-xs text-gray-500">\n'
+ " <%= link_to repository_commits_path(@owner.username, @repository.name, @branch),\n"
+ ' class: "flex items-center gap-1 hover:text-gray-700" do %>\n'
+ ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{COMMIT_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= number_with_delimiter(@commit_count) %> commits\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </div>\n"
+ "\n"
+ ' <div class="card rounded-t-none">\n'
+ " <% @tree.each do |entry| %>\n"
+ ' <div class="file-row">\n'
+ ' <% if entry[:type] == "tree" %>\n'
+ ' <svg class="w-4 h-4 text-brand-300 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{FOLDER_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= link_to entry[:name],\n"
+ " repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
+ ' class: "text-brand-500 hover:underline font-medium flex-1" %>\n'
+ " <% else %>\n"
+ ' <svg class="w-4 h-4 text-gray-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{FILE_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= link_to entry[:name],\n"
+ " repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
+ ' class: "text-gray-800 hover:text-brand-500 hover:underline flex-1" %>\n'
+ " <% end %>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " </div>\n"
+ "\n"
+ " <% if @readme_html %>\n"
+ ' <div class="card mt-6">\n'
+ ' <div class="px-4 py-3 border-b border-gray-100 flex items-center gap-2 bg-gray-50">\n'
+ ' <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{README_PATH_16}"/>\n'
+ " </svg>\n"
+ ' <span class="text-xs font-medium text-gray-600"><%= @readme_filename %></span>\n'
+ " </div>\n"
+ ' <div class="px-6 py-6 prose-readme">\n'
+ " <%= @readme_html %>\n"
+ " </div>\n"
+ " </div>\n"
+ " <% end %>\n"
+ "\n"
+ " <% end %>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# repositories/new.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/repositories/new.html.erb"] = (
+ '<% content_for :title, "New repository" %>\n'
+ "\n"
+ '<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">\n'
+ ' <h1 class="text-xl font-semibold text-gray-900 mb-2">Create a new repository</h1>\n'
+ ' <p class="text-sm text-gray-500 mb-8">A repository contains all project files, including revision history.</p>\n'
+ "\n"
+ ' <%= form_with model: @repository, url: "/new", method: :post, class: "space-y-6" do |f| %>\n'
+ " <% if @repository.errors.any? %>\n"
+ ' <div class="border border-red-200 bg-red-50 rounded px-4 py-3">\n'
+ ' <p class="text-sm font-medium text-red-800 mb-1">Please fix the following errors:</p>\n'
+ ' <ul class="list-disc pl-4 space-y-0.5">\n'
+ " <% @repository.errors.full_messages.each do |msg| %>\n"
+ ' <li class="text-sm text-red-700"><%= msg %></li>\n'
+ " <% end %>\n"
+ " </ul>\n"
+ " </div>\n"
+ " <% end %>\n"
+ "\n"
+ ' <div class="flex items-end gap-2">\n'
+ ' <div class="flex-1 min-w-0">\n'
+ ' <label class="form-label">Owner</label>\n'
+ ' <div class="flex items-center gap-2 form-input bg-gray-50 text-gray-600 cursor-not-allowed">\n'
+ ' <img src="<%= current_user.avatar_url_or_default %>" class="w-4 h-4 rounded-full">\n'
+ " <span><%= current_user.username %></span>\n"
+ " </div>\n"
+ " </div>\n"
+ ' <div class="flex items-center pb-2.5 text-gray-400 font-light text-lg">/</div>\n'
+ ' <div class="flex-1 min-w-0">\n'
+ ' <%= f.label :name, "Repository name", class: "form-label" %>\n'
+ ' <%= f.text_field :name, class: "form-input", placeholder: "my-project", autofocus: true,\n'
+ ' pattern: "[a-zA-Z0-9._-]+",\n'
+ ' title: "Letters, numbers, hyphens, underscores, and dots only" %>\n'
+ " </div>\n"
+ " </div>\n"
+ "\n"
+ " <div>\n"
+ ' <%= f.label :description, "Description", class: "form-label" %>\n'
+ ' <span class="text-xs text-gray-400 ml-1">(optional)</span>\n'
+ ' <%= f.text_area :description, class: "form-input", rows: 2,\n'
+ ' placeholder: "Short description of your project" %>\n'
+ " </div>\n"
+ "\n"
+ ' <div class="border border-gray-200 rounded divide-y divide-gray-100">\n'
+ ' <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50">\n'
+ ' <%= f.radio_button :is_private, false, class: "mt-0.5" %>\n'
+ " <div>\n"
+ ' <div class="flex items-center gap-2">\n'
+ ' <svg class="w-4 h-4 text-gray-600" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{REPO_PATH_16}"/>\n'
+ " </svg>\n"
+ ' <span class="text-sm font-medium text-gray-900">Public</span>\n'
+ " </div>\n"
+ ' <p class="text-xs text-gray-500 mt-0.5">Anyone can see this repository.</p>\n'
+ " </div>\n"
+ " </label>\n"
+ ' <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50">\n'
+ ' <%= f.radio_button :is_private, true, class: "mt-0.5" %>\n'
+ " <div>\n"
+ ' <div class="flex items-center gap-2">\n'
+ ' <svg class="w-4 h-4 text-gray-600" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{LOCK_PATH_16}"/>\n'
+ " </svg>\n"
+ ' <span class="text-sm font-medium text-gray-900">Private</span>\n'
+ " </div>\n"
+ ' <p class="text-xs text-gray-500 mt-0.5">Only you can see this repository.</p>\n'
+ " </div>\n"
+ " </label>\n"
+ " </div>\n"
+ "\n"
+ " <div>\n"
+ ' <%= f.label :default_branch, "Default branch", class: "form-label" %>\n'
+ ' <%= f.text_field :default_branch, class: "form-input max-w-xs", value: "main" %>\n'
+ " </div>\n"
+ "\n"
+ ' <div class="pt-2 border-t border-gray-100 flex items-center gap-3">\n'
+ ' <%= f.submit "Create repository", class: "btn-primary cursor-pointer" %>\n'
+ ' <%= link_to "Cancel", root_path, class: "btn-ghost" %>\n'
+ " </div>\n"
+ " <% end %>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# repositories/tree.html.erb
+# ---------------------------------------------------------------------------
+files["app/views/repositories/tree.html.erb"] = (
+ '<% content_for :title, "#{@current_path} \u00b7 #{@repository.full_name}" %>\n'
+ "\n"
+ '<div class="border-b border-gray-200 bg-white">\n'
+ ' <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">\n'
+ "\n"
+ ' <div class="flex items-center gap-2 text-sm mb-3">\n'
+ " <%= link_to @owner.username, user_profile_path(@owner.username),\n"
+ ' class: "text-brand-500 hover:underline font-medium" %>\n'
+ ' <span class="text-gray-400">/</span>\n'
+ " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
+ ' class: "text-brand-500 hover:underline font-semibold" %>\n'
+ " </div>\n"
+ "\n"
+ ' <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">\n'
+ " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
+ ' class: "breadcrumb-item font-medium" %>\n'
+ ' <span class="text-gray-400">/</span>\n'
+ " <% @path_parts.each_with_index do |part, i| %>\n"
+ ' <% partial_path = @path_parts[0..i].join("/") %>\n'
+ " <% if i < @path_parts.length - 1 %>\n"
+ " <%= link_to part,\n"
+ " repository_tree_path(@owner.username, @repository.name, @branch, partial_path),\n"
+ ' class: "breadcrumb-item" %>\n'
+ ' <span class="text-gray-400">/</span>\n'
+ " <% else %>\n"
+ ' <span class="font-medium text-gray-900"><%= part %></span>\n'
+ " <% end %>\n"
+ " <% end %>\n"
+ " </nav>\n"
+ "\n"
+ ' <div class="flex items-center gap-0 -mb-px">\n'
+ " <%= link_to repository_path(@owner.username, @repository.name),\n"
+ ' class: "tab-item flex items-center gap-1.5" do %>\n'
+ ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{REPO_PATH_16}"/>\n'
+ " </svg>\n"
+ " Code\n"
+ " <% end %>\n"
+ " </div>\n"
+ " </div>\n"
+ "</div>\n"
+ "\n"
+ '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">\n'
+ ' <div class="card">\n'
+ " <% @tree.each do |entry| %>\n"
+ ' <div class="file-row">\n'
+ ' <% if entry[:type] == "tree" %>\n'
+ ' <svg class="w-4 h-4 text-brand-300 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{FOLDER_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= link_to entry[:name],\n"
+ " repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
+ ' class: "text-brand-500 hover:underline font-medium flex-1" %>\n'
+ " <% else %>\n"
+ ' <svg class="w-4 h-4 text-gray-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
+ f' <path d="{FILE_PATH_16}"/>\n'
+ " </svg>\n"
+ " <%= link_to entry[:name],\n"
+ " repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
+ ' class: "text-gray-800 hover:text-brand-500 hover:underline flex-1" %>\n'
+ " <% end %>\n"
+ " </div>\n"
+ " <% end %>\n"
+ " </div>\n"
+ "</div>\n"
+)
+
+# ---------------------------------------------------------------------------
+# config/tailwind.config.js
+# ---------------------------------------------------------------------------
+files["config/tailwind.config.js"] = (
+ "const defaultTheme = require('tailwindcss/defaultTheme')\n"
+ "\n"
+ "module.exports = {\n"
+ " content: [\n"
+ " './public/*.html',\n"
+ " './app/helpers/**/*.rb',\n"
+ " './app/javascript/**/*.js',\n"
+ " './app/views/**/*.{erb,haml,html,slim}'\n"
+ " ],\n"
+ " theme: {\n"
+ " extend: {\n"
+ " fontFamily: {\n"
+ " sans: [\n"
+ " 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system',\n"
+ " 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',\n"
+ " ...defaultTheme.fontFamily.sans\n"
+ " ],\n"
+ " mono: [\n"
+ " 'JetBrains Mono', 'ui-monospace', 'SFMono-Regular',\n"
+ " 'Menlo', 'Monaco', 'Consolas',\n"
+ " ...defaultTheme.fontFamily.mono\n"
+ " ],\n"
+ " },\n"
+ " colors: {\n"
+ " brand: {\n"
+ " 50: '#EEF4FF',\n"
+ " 100: '#D6E6FF',\n"
+ " 200: '#B3CEFF',\n"
+ " 300: '#80ADFF',\n"
+ " 400: '#4D8CFF',\n"
+ " 500: '#0057B8',\n"
+ " 600: '#004A9E',\n"
+ " 700: '#003D84',\n"
+ " 800: '#002F6A',\n"
+ " 900: '#002050',\n"
+ " },\n"
+ " },\n"
+ " maxWidth: {\n"
+ " '8xl': '88rem',\n"
+ " },\n"
+ " },\n"
+ " },\n"
+ " plugins: [],\n"
+ "}\n"
+)
+
+# ---------------------------------------------------------------------------
+# app/assets/stylesheets/application.tailwind.css
+# ---------------------------------------------------------------------------
+files["app/assets/stylesheets/application.tailwind.css"] = (
+ "@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');\n"
+ "@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');\n"
+ "\n"
+ "@tailwind base;\n"
+ "@tailwind components;\n"
+ "@tailwind utilities;\n"
+ "\n"
+ "@layer base {\n"
+ " html { @apply antialiased; }\n"
+ " body { @apply bg-white text-gray-900 font-sans text-sm leading-relaxed; }\n"
+ " a { @apply text-brand-500; }\n"
+ " code { @apply font-mono text-xs; }\n"
+ "}\n"
+ "\n"
+ "@layer components {\n"
+ " /* ---- Navigation ---- */\n"
+ " .nav-link {\n"
+ " @apply text-gray-600 hover:text-gray-900 text-sm font-medium transition-colors duration-150;\n"
+ " }\n"
+ "\n"
+ " /* ---- Buttons ---- */\n"
+ " .btn-primary {\n"
+ " @apply inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white text-sm\n"
+ " font-medium rounded hover:bg-brand-600 transition-colors duration-150 cursor-pointer;\n"
+ " }\n"
+ " .btn-secondary {\n"
+ " @apply inline-flex items-center gap-2 px-4 py-2 bg-white text-gray-700 text-sm\n"
+ " font-medium rounded border border-gray-300 hover:bg-gray-50\n"
+ " transition-colors duration-150 cursor-pointer;\n"
+ " }\n"
+ " .btn-danger {\n"
+ " @apply inline-flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm\n"
+ " font-medium rounded hover:bg-red-700 transition-colors duration-150 cursor-pointer;\n"
+ " }\n"
+ " .btn-ghost {\n"
+ " @apply inline-flex items-center gap-2 px-3 py-1.5 text-gray-600 text-sm\n"
+ " font-medium rounded hover:bg-gray-100 transition-colors duration-150 cursor-pointer;\n"
+ " }\n"
+ "\n"
+ " /* ---- Forms ---- */\n"
+ " .form-input {\n"
+ " @apply w-full px-3 py-2 border border-gray-300 rounded text-sm text-gray-900\n"
+ " placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-brand-500\n"
+ " focus:border-transparent transition-all duration-150;\n"
+ " }\n"
+ " .form-label {\n"
+ " @apply block text-sm font-medium text-gray-700 mb-1;\n"
+ " }\n"
+ "\n"
+ " /* ---- Cards ---- */\n"
+ " .card {\n"
+ " @apply bg-white border border-gray-200 rounded-sm;\n"
+ " }\n"
+ "\n"
+ " /* ---- Code ---- */\n"
+ " .code-container {\n"
+ " @apply bg-gray-50 border border-gray-200 rounded-sm font-mono text-xs overflow-x-auto;\n"
+ " }\n"
+ "\n"
+ " /* ---- File tree rows ---- */\n"
+ " .file-row {\n"
+ " @apply flex items-center gap-3 px-4 py-2.5 border-b border-gray-100\n"
+ " hover:bg-gray-50 transition-colors duration-100 text-sm;\n"
+ " }\n"
+ " .file-row:last-child { @apply border-b-0; }\n"
+ "\n"
+ " /* ---- Breadcrumb ---- */\n"
+ " .breadcrumb-item {\n"
+ " @apply text-brand-500 hover:underline text-sm;\n"
+ " }\n"
+ "\n"
+ " /* ---- Commit rows ---- */\n"
+ " .commit-row {\n"
+ " @apply flex items-start justify-between px-4 py-3 border-b border-gray-100\n"
+ " hover:bg-gray-50 transition-colors duration-100;\n"
+ " }\n"
+ " .commit-row:last-child { @apply border-b-0; }\n"
+ "\n"
+ " /* ---- Badges ---- */\n"
+ " .badge {\n"
+ " @apply inline-flex items-center px-2 py-0.5 rounded text-xs font-medium;\n"
+ " }\n"
+ " .badge-gray { @apply badge bg-gray-100 text-gray-600; }\n"
+ " .badge-blue { @apply badge bg-brand-50 text-brand-600; }\n"
+ "\n"
+ " /* ---- Tabs ---- */\n"
+ " .tab-item {\n"
+ " @apply px-4 py-2.5 text-sm font-medium text-gray-500 border-b-2 border-transparent\n"
+ " hover:text-gray-700 hover:border-gray-300 transition-all duration-150;\n"
+ " }\n"
+ " .tab-item.active {\n"
+ " @apply text-gray-900 border-brand-500;\n"
+ " }\n"
+ "\n"
+ " /* ---- README prose ---- */\n"
+ " .prose-readme h1 { @apply text-2xl font-semibold mb-4 mt-6 pb-2 border-b border-gray-200; }\n"
+ " .prose-readme h2 { @apply text-xl font-semibold mb-3 mt-5 pb-2 border-b border-gray-100; }\n"
+ " .prose-readme h3 { @apply text-lg font-medium mb-2 mt-4; }\n"
+ " .prose-readme p { @apply mb-4 leading-7; }\n"
+ " .prose-readme ul { @apply list-disc pl-6 mb-4 space-y-1; }\n"
+ " .prose-readme ol { @apply list-decimal pl-6 mb-4 space-y-1; }\n"
+ " .prose-readme li { @apply leading-7; }\n"
+ " .prose-readme a { @apply text-brand-500 hover:underline; }\n"
+ " .prose-readme code { @apply bg-gray-100 px-1.5 py-0.5 rounded text-xs font-mono text-gray-800; }\n"
+ " .prose-readme pre { @apply bg-gray-50 border border-gray-200 rounded-sm p-4 overflow-x-auto mb-4; }\n"
+ " .prose-readme pre code { @apply bg-transparent p-0; }\n"
+ " .prose-readme table { @apply w-full mb-4 border-collapse border border-gray-200; }\n"
+ " .prose-readme th { @apply bg-gray-50 border border-gray-200 px-3 py-2 text-left font-medium text-sm; }\n"
+ " .prose-readme td { @apply border border-gray-200 px-3 py-2 text-sm; }\n"
+ " .prose-readme blockquote { @apply border-l-4 border-gray-300 pl-4 italic text-gray-600 my-4; }\n"
+ " .prose-readme hr { @apply border-gray-200 my-6; }\n"
+ " .prose-readme img { @apply max-w-full; }\n"
+ "\n"
+ " /* ---- Diff ---- */\n"
+ " .diff-add { @apply bg-green-50 text-green-800; }\n"
+ " .diff-remove { @apply bg-red-50 text-red-800; }\n"
+ " .diff-header { @apply bg-blue-50 text-blue-700; }\n"
+ "}\n"
+ "\n"
+ "/* ---- Rouge syntax highlighting ---- */\n"
+ ".highlight .c { color: #998; font-style: italic }\n"
+ ".highlight .err { color: #a61717; background-color: #e3d2d2 }\n"
+ ".highlight .k { color: #000; font-weight: bold }\n"
+ ".highlight .o { font-weight: bold }\n"
+ ".highlight .cm { color: #998; font-style: italic }\n"
+ ".highlight .cp { color: #999; font-weight: bold }\n"
+ ".highlight .c1 { color: #998; font-style: italic }\n"
+ ".highlight .cs { color: #999; font-weight: bold; font-style: italic }\n"
+ ".highlight .gd { color: #000; background-color: #fdd }\n"
+ ".highlight .ge { font-style: italic }\n"
+ ".highlight .gr { color: #a00 }\n"
+ ".highlight .gh { color: #999 }\n"
+ ".highlight .gi { color: #000; background-color: #dfd }\n"
+ ".highlight .go { color: #888 }\n"
+ ".highlight .gp { color: #555 }\n"
+ ".highlight .gs { font-weight: bold }\n"
+ ".highlight .gu { color: #aaa }\n"
+ ".highlight .gt { color: #a00 }\n"
+ ".highlight .kc { color: #000; font-weight: bold }\n"
+ ".highlight .kd { color: #000; font-weight: bold }\n"
+ ".highlight .kp { color: #000; font-weight: bold }\n"
+ ".highlight .kr { color: #000; font-weight: bold }\n"
+ ".highlight .kt { color: #458; font-weight: bold }\n"
+ ".highlight .m { color: #099 }\n"
+ ".highlight .s { color: #d14 }\n"
+ ".highlight .na { color: #008080 }\n"
+ ".highlight .nb { color: #0086B3 }\n"
+ ".highlight .nc { color: #458; font-weight: bold }\n"
+ ".highlight .no { color: #008080 }\n"
+ ".highlight .ni { color: #800080 }\n"
+ ".highlight .ne { color: #900; font-weight: bold }\n"
+ ".highlight .nf { color: #900; font-weight: bold }\n"
+ ".highlight .nn { color: #555 }\n"
+ ".highlight .nt { color: #000080 }\n"
+ ".highlight .nv { color: #008080 }\n"
+ ".highlight .ow { font-weight: bold }\n"
+ ".highlight .w { color: #bbb }\n"
+ ".highlight .mf { color: #099 }\n"
+ ".highlight .mh { color: #099 }\n"
+ ".highlight .mi { color: #099 }\n"
+ ".highlight .mo { color: #099 }\n"
+ ".highlight .sb { color: #d14 }\n"
+ ".highlight .sc { color: #d14 }\n"
+ ".highlight .sd { color: #d14 }\n"
+ ".highlight .s2 { color: #d14 }\n"
+ ".highlight .se { color: #d14 }\n"
+ ".highlight .sh { color: #d14 }\n"
+ ".highlight .si { color: #d14 }\n"
+ ".highlight .sx { color: #d14 }\n"
+ ".highlight .sr { color: #009926 }\n"
+ ".highlight .s1 { color: #d14 }\n"
+ ".highlight .ss { color: #990073 }\n"
+ ".highlight .bp { color: #999 }\n"
+ ".highlight .vc { color: #008080 }\n"
+ ".highlight .vg { color: #008080 }\n"
+ ".highlight .vi { color: #008080 }\n"
+ ".highlight .il { color: #099 }\n"
+)
+
+# ---------------------------------------------------------------------------
+# config/importmap.rb
+# ---------------------------------------------------------------------------
+files["config/importmap.rb"] = (
+ "# Pin npm packages by running ./bin/importmap\n"
+ "\n"
+ 'pin "application", preload: true\n'
+ "\n"
+ 'pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true\n'
+ 'pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true\n'
+ 'pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true\n'
+ "\n"
+ 'pin_all_from "app/javascript/controllers", under: "controllers"\n'
+)
+
+# ---------------------------------------------------------------------------
+# Write all files
+# ---------------------------------------------------------------------------
+for path, content in files.items():
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(path, "w", encoding="utf-8") as fh:
+ fh.write(content)
+ lines = content.count("\n")
+ print(f" wrote {path} ({lines} lines)")
+
+print("\nDone.")
storage/.keep
new file mode 100644
index 0000000..e69de29
tmp/.keep
new file mode 100644
index 0000000..e69de29
vendor/.keep
new file mode 100644
index 0000000..e69de29