Skip to content

Port stack-orchestrator-mcp + proof-lsp adapters: TypeScript → AffineScript #46

@hyperpolymath

Description

@hyperpolymath

Context

Hypatia flags the Deno/TypeScript adapter code in two cartridges as cicd_rules/banned_language_file (critical), per the estate "no new TypeScript — convert to AffineScript" policy. This issue tracks the real fix: porting them to AffineScript.

Interim: the Hypatia finding is non-blocking baseline and is being left as-is — NOT exempted via .hypatia-ignore — so it stays visible as debt until this port lands.

Scope (~28 TS files, two cartridges)

  • cartridges/cross-cutting/orchestration/stack-orchestrator-mcp/adapter/ (12 files: types/parser/planner/executor/lsp_client/rollback + tests, deno.json). State: unwired scaffoldmod.js start() throws "adapter not implemented"; the TS is a WIP port from the archived Elixir in _source-archive/. Porting ≈ implementing the cartridge in AffineScript.
  • cartridges/domains/formal-verification/proof-lsp/adapter/ (16 files: server.ts + handlers + 4 prover backends agda/coq/isabelle/lean + tests). State: live (mod.js spawns adapter/server.ts as a Deno LSP server over stdio). Porting ≈ re-implementing working software — do this LAST.

Toolchain reality (assessed 2026-06-13)

  • AffineScript lives at hyperpolymath/affinescript (alpha). Rich stdlib (Deno, Http, Network, Ipc, json, io, testing, VscodeLanguageClient).
  • The .affine compiler is the OCaml/dune component (dune-project, affinescript.opam) — must be built (opam) and wired into CI to validate ports. The Rust affinescriptiser binary is a WASM-wrapper/manifest tool, not the source compiler.
  • Alpha risk: self-documented miscompiles — effect handlers mis-lowered on 3 backends (affinescript#555), use-after-move soundness hole (affinescript#554). Porting live code onto this carries reliability risk; weigh against the v1 readiness ledger (affinescript#563).

Plan (pilot-first, de-risked)

  1. Stand up the OCaml .affine compiler in cartridges CI (build + typecheck a sample).
  2. Pilot: port one leaf logic module of stack-orchestrator-mcp (typesplanner) to .affine, compile green. Establishes the pattern + proves the pipeline.
  3. Port the rest of stack-orchestrator-mcp; port its tests.
  4. Port proof-lsp last — first verify AffineScript stdlib covers LSP-over-stdio + subprocess spawning.
  5. Remove each TS file once its .affine equivalent is green; cartridge entry stays mod.js.

Unblock conditions

  • OCaml .affine compiler wired into cartridges CI.
  • AffineScript stable enough for live code (affinescript#563; #555/#554 resolved).

Refs: estate "no new TypeScript" policy (boj-server .claude/CLAUDE.md §TypeScript Exemptions).

https://claude.ai/code/session_019tMcRS1Dm1nWjjYP4WvbJa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions