Module: Magik

Defined in:
lib/magik.rb,
lib/magik/api.rb,
lib/magik/cli.rb,
lib/magik/pwa.rb,
lib/magik/auth.rb,
lib/magik/core.rb,
lib/magik/i18n.rb,
lib/magik/jobs.rb,
lib/magik/admin.rb,
lib/magik/check.rb,
lib/magik/model.rb,
lib/magik/action.rb,
lib/magik/ledger.rb,
lib/magik/notify.rb,
lib/magik/render.rb,
lib/magik/router.rb,
lib/magik/schema.rb,
lib/magik/billing.rb,
lib/magik/domains.rb,
lib/magik/testing.rb,
lib/magik/version.rb,
lib/magik/realtime.rb

Overview

Magik is an opinionated, full-stack Ruby framework targeting TruffleRuby: one DSL for models, screens, actions, realtime channels, background jobs, ledgers, APIs and admin panels, rendered server-side as HTML + htmx.

Status as of 2026-08-26: spec only. The product specification lives in docs/idea/00-build-spec.md and is entirely unimplemented. What ships in this gem today is:

  • VERSION — the name-reservation version string.
  • Error — the stable MAGIK_* error-code convention.
  • CLI — a working magik version / magik help command line.
  • One documented, spec-only stub module per planned subsystem (see SUBSYSTEMS); every entry point raises NotImplementedError.

Nothing in this gem renders a page, talks to a database, or runs a job.

Defined Under Namespace

Modules: API, Action, Admin, Auth, Billing, CLI, Check, Core, Domains, I18n, Jobs, Ledger, Model, Notify, PWA, Realtime, Render, Router, Schema, Testing Classes: CommandNotImplementedError, Error, InvalidOptionError, UnknownCommandError

Constant Summary collapse

SUBSYSTEMS =

Every planned subsystem, mapped from its file basename under lib/magik/ to the constant it defines. Each entry mirrors one area of the build spec.

The map drives autoload registration below, so requiring magik is cheap: a subsystem file is only read when its constant is first referenced.

Examples:

List the planned subsystems

Magik::SUBSYSTEMS.keys # => [:core, :cli, :model, ...]

Returns:

  • (Hash{Symbol => Symbol})

    file basename => constant name

{
  core: :Core,
  cli: :CLI,
  model: :Model,
  schema: :Schema,
  render: :Render,
  action: :Action,
  router: :Router,
  realtime: :Realtime,
  jobs: :Jobs,
  ledger: :Ledger,
  api: :API,
  auth: :Auth,
  billing: :Billing,
  admin: :Admin,
  i18n: :I18n,
  pwa: :PWA,
  notify: :Notify,
  testing: :Testing,
  domains: :Domains,
  check: :Check
}.freeze
SPEC_ONLY_SUBSYSTEMS =

The subsystems that are documentation-only: their modules load and carry their spec metadata, but every entry point raises NotImplementedError.

CLI is deliberately absent — it is the one subsystem with real, useful behaviour today.

Returns:

  • (Array<Symbol>)

    file basenames, a subset of SUBSYSTEMS keys

(SUBSYSTEMS.keys - [:cli]).freeze
VERSION =

The released version of the magik gem.

0.0.1 is a name-reservation release: the gem name is claimed on RubyGems, the public surface is a CLI shim plus documented, spec-only subsystem stubs. No framework behaviour from docs/idea/00-build-spec.md is implemented.

The value follows Semantic Versioning. While the major version is 0, minor bumps may break the public API.

Examples:

Read the version at runtime

require "magik"
Magik::VERSION # => "0.0.1"

Returns:

  • (String)

    a frozen MAJOR.MINOR.PATCH string

"0.0.1"

Class Method Summary collapse

Class Method Details

.rootPathname

The installed gem's root directory — the parent of lib/.

Useful for locating packaged assets and the specification itself, e.g. Magik.root.join("docs/idea/00-build-spec.md").

Examples:

Magik.root.join("lib", "magik.rb").exist? # => true

Returns:

  • (Pathname)

    an absolute, resolved path



255
256
257
# File 'lib/magik.rb', line 255

def self.root
  @root ||= Pathname.new(File.expand_path("..", __dir__))
end