Skip to content

Release 2.0.7: amber-lsp API lookup and enforced agent setup - #44

Merged
crimson-knight merged 75 commits into
mainfrom
release/2.0.7-lsp
Oct 6, 2026
Merged

crimson-knight merged 75 commits into
mainfrom
release/2.0.7-lsp

Conversation

@crimson-knight

Copy link
Copy Markdown
Member

Release branch for Amber CLI 2.0.7: amber-lsp API lookup and the agent setup that makes coding agents use it.

Supersedes #43 (sol/setup-agent) and #39 (luna/rule-packs); both are contained in this branch.

What it adds

  • amber-lsp lookup 'Type.method' | 'Type#method': answers from a layered docs index (project, each shard in lib/, Crystal stdlib). It shows the signature, the resolved return type, the source location, and card notes. Exit codes: 0 found, 3 candidates, 4 unknown, 5 absent, 2 failed.
  • amber-lsp hint: reads compiler output on stdin and adds card hints for known errors.
  • API cards (.amber-lsp/api/*.yml): libraries ship their own. A Crystal card is bundled in share/amber_cli/api/, with a compiled-in fallback.
  • amber setup:agent writes:
    • .amber/agent_setup.json
    • a POSIX amber-agent-hook
    • Claude Code hooks, plus a relative-path plugin marketplace so the LSP tool loads
    • Codex hooks
    • Agent-loop blocks in CLAUDE.md and AGENTS.md
  • Enforcement: SessionStart reports readiness. PreToolUse refuses .cr edits while the setup is incomplete, which covers a missing binary, a version below the minimum, or a checksum mismatch.
  • amber doctor shows the same checks to a human, plus workspace trust, Codex hook trust, worktree inheritance of the hook files, and index freshness.
  • Plain Crystal projects work too: lookup and Crystal hints are active, and the Amber rule pack declines cleanly.
  • Version fallback: when Minecart is absent, the version comes from shards-alpha or shards.

Evidence

  • 628 specs pass. Zero-warning release builds of amber and amber-lsp.

  • A/B eval on 40 validated tasks, first-try compile rate:

    No lookup Lookup optional Lookup required
    Haiku 62.5% 70.0% 82.5%
    Sonnet 85.0% 92.5% 97.5%
  • Source archive at dc97420 (git archive --prefix=amber_cli-2.0.7/): sha256 371194246d586c512282ebe286755642edf1adcf69a800c641d5fe190e0d8886. The tap formula on amberframework/homebrew-amber_cli sol/pin-everything-onboarding pins this hash. The CI-built source archive must match it before v2.0.7 is published.

Release order

  1. Publish Minecart v2025.11.25.7 (commit 4fea47ce, source sha256 ec583594…).
  2. Run this repo's release workflow_dispatch on this branch, and confirm the CI source sha256 equals the one above.
  3. Merge, then tag and publish v2.0.7.
  4. Merge the tap PR.

crimson-knight and others added 30 commits September 23, 2026 15:04
…ommit

The fleet gate and setup checks need to prove which amber-lsp build they run;
the server previously ignored --version and printed nothing.
…manager structure, story grammar)

Four diagnostics rules enforcing the FSDD/Amber V2 standards: full method type
interfaces, mandatory doc blocks, process-manager structure (typed initialize + perform),
and feature-story grammar validity. Build 0/0, 44 specs pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The spec/amber_lsp/ suite drives AmberLSP::Server in-process over an
IO::Memory pair. That proves the code but not the artifact: it cannot
catch a stale bin/amber-lsp, a broken build, or a server that goes silent
instead of answering.

scripts/lsp_smoke.rb spawns the real executable, builds a throwaway
Amber-shaped fixture project (shard.yml WITH an `amber` dependency --
ProjectContext.detect keeps the server silent without one), runs a real
framed initialize/initialized/didOpen session, and asserts on the
textDocument/publishDiagnostics notifications that come back: >= 1
diagnostic for the violating controller, exactly 0 for the clean one.

Exit codes are deliberately three-valued: 0 pass, 1 expectations not met,
2 could-not-measure (no binary, handshake failure, timeout). A timeout is
never reported as a pass -- a silent server is not a clean server.

Ruby 2.6 / stdlib only so it runs under macOS system ruby with no setup.

Verified against crystal-alpha 1.21.0 (Crystal 1.21.0 [9c1e8ec64]).
…d ruling)

agent_e2e_spec asserted that after the agent fixes the file, diagnostics are
empty. They were not: the fixture drew 2x fsdd/doc-block-required and 1x
fsdd/method-type-signature. This was never Crystal 1.21 drift -- the spec last
changed in 06cdee5 and the FSDD rules landed later in 8781d5b, so the new rules
correctly fire on a fixture written before they existed.

Two ways to make it green: turn the FSDD rules off by default, or fix the
fixture. Owner's standing directive decides it -- we need to be eating our own
dog food. The rules STAY ON BY DEFAULT; the fixture was wrong, not the rules.

So the corrected code now carries a doc comment on the class and on the action
and an explicit return type, and "clean" in this spec means clean by our own
conventions rather than merely free of the two violations the fixture was
originally written to demonstrate. Anything less and this spec would quietly
assert that our own conventions are optional.

    253 examples, 0 failures, 0 errors, 0 pending
amber-lsp --check declines projects that are not Amber V2 stacks. The
post-edit hook passed that decline through as exit 2, so agents saw a
failure after every .cr edit in a plain Crystal app or shard. Formatting
still runs; Amber findings still fail in covered projects.
amber-lsp with no subcommand runs the language server on stdin, so
--help used to wait silently, lookup --help failed, and context --help
raised. Each now prints its usage; lookup lists its exit codes.
The Homebrew formula installs stock crystal, so every lookup failed
with "crystal-alpha is not available on PATH". Stock crystal builds the
same docs index; crystal-alpha stays preferred when installed.
The README's LSP and agent sections assumed an Amber project. One section
now says the tooling works in any Crystal project and links a full guide:
install, setup and trust, the committed files, what each hook does, every
amber-lsp command with exit codes, API cards, and doctor fixes.
The release candidate now merges Minecart's alpha branch (2025.11.25.6)
and pins its own dependencies by commit, so its commit and tree changed.
CI runners and Homebrew have stock crystal only, so the installer now
uses crystal-alpha when present and crystal otherwise. Minecart .8
compiles on Windows, which the generated-app gate needs.
The lookup spec helper named crystal-alpha, which CI runners do not
have; it now uses the same compiler fallback as amber-lsp. The beta
contract script still read commands/new.cr, renamed to new_command.cr.
…rsion

The macOS install-crystal tarball has no llvm-config, so lookup could
not build standard library docs there; Homebrew's Crystal, which users
install, does. Two specs pinned Crystal 1.21.0 and broke when runners
moved to 1.21.1; they now read the installed compiler's version.
The darwin archive keeps shards only in embedded/bin, so micrate's
postinstall (shards build) failed during the frozen install.
@crimson-knight
crimson-knight merged commit ad24f1c into main Oct 6, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant