feat(cli): install in one command, and call the CLI ludic
Getting started meant cloning the repository, bootstrapping a compiler and
learning a task runner called `x`. That is a contributor's workflow handed to
everyone who wants to try the language.
Installing is now one command:
curl -fsSL https://workshopsoft.pages.workshopsoft.io/ludic/install.sh | sh
install.sh puts a complete toolchain — compiler, CLI, engine runtime, bundled
ludic.* packages, formatter, language server — in ~/.ludic and adds it to PATH.
Prebuilt artifacts are checksum-verified; where a platform has none, or the
release predates this layout, it bootstraps from the compiler's own IR seed with
clang. The docs site publishes the script beside the pages that quote it, so the
page and the script can never come from different releases.
`x` becomes `ludic`, and the surface splits by audience. A user of the language
sees `new`, `run`, `build`, `test`, `add`, `fmt`, `lsp`, `doctor`, `upgrade`;
`ludic new` scaffolds a project that builds and plays as it stands. Everything
the toolchain repo needs moved under `ludic dev` — build, test, reseed,
bootstrap-cfree, docs-gen, release — unchanged apart from the namespace. Those
tasks read arguments one position further along, so dispatch_dev sets a shift
and commands use arg_n()/arg_total() rather than each knowing its own depth.
Release artifacts become complete install roots (bin/ beside runtime/, packages/
and VERSION) rather than bare binaries, which is what the installer unpacks.
`ludic dev test` asserts the whole shape: it stages an install, puts it on PATH
with no LUDIC_HOME, and runs new -> build -> test through it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
005cc39394
commit
aca263642d
54 changed files with 1802 additions and 670 deletions
|
|
@ -21,14 +21,21 @@ tools/editors/
|
|||
neovim/ helix/ emacs/ sublime/ zed/ configuration, no plugin needed
|
||||
```
|
||||
|
||||
## Build it
|
||||
## Getting the server
|
||||
|
||||
An installed toolchain already has it: `curl -fsSL https://workshopsoft.pages.workshopsoft.io/ludic/install.sh | sh`
|
||||
puts `ludic-lsp` and `ludic-fmt` in `~/.ludic/bin`, on your `PATH`, and
|
||||
`ludic lsp` runs the server on stdio — that is what an editor should spawn, since
|
||||
it needs no path configuration.
|
||||
|
||||
From a checkout, build them with:
|
||||
|
||||
```bash
|
||||
bin/x tools
|
||||
bin/ludic dev tools
|
||||
```
|
||||
|
||||
Produces `bin/ludic-fmt` and `bin/ludic-lsp`. Add `--install` to symlink both
|
||||
into `~/.local/bin`, `--test` to run `bin/x test-tools` afterwards.
|
||||
into `~/.local/bin`, `--test` to run `bin/ludic dev test-tools` afterwards.
|
||||
|
||||
## What you get, in any editor
|
||||
|
||||
|
|
@ -63,11 +70,14 @@ and otherwise keywords, builtins, and everything in scope.
|
|||
- **Anything else** that speaks LSP:
|
||||
|
||||
```
|
||||
command: bin/ludic-lsp --stdio
|
||||
command: ludic lsp
|
||||
languages: ludic, markdown
|
||||
initializationOptions: { "compilerPath": "bin/ludicc", "compilerDiagnostics": true, "indentSize": 2 }
|
||||
initializationOptions: { "compilerDiagnostics": true, "indentSize": 2 }
|
||||
```
|
||||
|
||||
(`ludic lsp` is on `PATH` after an install; from a checkout it is
|
||||
`bin/ludic lsp`, and the server finds `ludicc` next to itself.)
|
||||
|
||||
## Markdown
|
||||
|
||||
Markdown fenced-code highlighting is not one standard — it is three mechanisms,
|
||||
|
|
@ -108,7 +118,7 @@ ln -sf ../../tools/git-hooks/pre-commit .git/hooks/pre-commit
|
|||
|
||||
The hook runs `ludic-fmt --check` over the staged `.ludic` and `.md` files only,
|
||||
and does nothing at all when `bin/ludic-fmt` has not been built — so it never
|
||||
blocks a commit on a machine that has not run `bin/x tools`.
|
||||
blocks a commit on a machine that has not run `bin/ludic dev tools`.
|
||||
|
||||
## Why the formatter is not `ludicc --fmt`
|
||||
|
||||
|
|
@ -130,7 +140,7 @@ both spellings are what the language documents and uses:
|
|||
(`const R_DIR: int = 0 # 0 up`) survive a save;
|
||||
- `id=Root` inside a `ui` block and `{Enemy}` inside a query stay tight.
|
||||
|
||||
`bin/x test-tools` checks the property that matters: formatting every file in
|
||||
`bin/ludic dev test-tools` checks the property that matters: formatting every file in
|
||||
the tree and re-running the *compiler's* canonical dump produces byte-identical
|
||||
output. The formatter cannot change what a program means.
|
||||
|
||||
|
|
@ -139,8 +149,8 @@ output. The formatter cannot change what a program means.
|
|||
The vocabulary is written down in five places that cannot include each other —
|
||||
the compiler's two tables, `ludic_syntax.h`, the TextMate grammar (JSON), and the
|
||||
JetBrains lexer (Kotlin). Adding a builtin and forgetting the rest is silent
|
||||
failure, so `bin/x check-vocabulary` (written in Ludic) compares all five, and
|
||||
`bin/x test-tools` runs it.
|
||||
failure, so `bin/ludic dev check-vocabulary` (written in Ludic) compares all five, and
|
||||
`bin/ludic dev test-tools` runs it.
|
||||
|
||||
When you add a keyword or builtin: put it in `ludic_syntax.h`, then run
|
||||
`bin/x test-tools` and let it tell you which copies still need it.
|
||||
`bin/ludic dev test-tools` and let it tell you which copies still need it.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ The first build downloads an IntelliJ IDEA Community distribution (over 1 GB),
|
|||
so expect it to take a while; later builds take seconds. Once the cache is warm,
|
||||
|
||||
```bash
|
||||
LUDIC_TEST_JETBRAINS=1 bin/x test-tools
|
||||
LUDIC_TEST_JETBRAINS=1 bin/ludic dev test-tools
|
||||
```
|
||||
|
||||
includes the plugin build in the toolchain's own test run.
|
||||
|
|
@ -55,4 +55,4 @@ LSP4IJ is a required dependency; the IDE offers to install it for you.
|
|||
|
||||
**Settings -> Languages & Frameworks -> Ludic** — the path to `ludic-lsp` and to
|
||||
`ludicc`. Both default to `bin/` under the project root, which is where
|
||||
`bin/x tools` puts them.
|
||||
`bin/ludic dev tools` puts them.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.io.File
|
|||
|
||||
/**
|
||||
* Where to find the toolchain. Both paths may be left blank, in which case the
|
||||
* plugin looks under the project root for what `bin/x tools` produces —
|
||||
* plugin looks under the project root for what `bin/ludic dev tools` produces —
|
||||
* which is the case for anyone working in the Ludic repository itself.
|
||||
*/
|
||||
@Service(Service.Level.PROJECT)
|
||||
|
|
@ -60,13 +60,23 @@ internal fun findExecutable(root: String?, configured: String, names: List<Strin
|
|||
|
||||
/** Fall back to PATH, so a system-wide install works with no configuration. */
|
||||
private fun searchPath(names: List<String>): String? {
|
||||
val path = System.getenv("PATH") ?: return null
|
||||
for (dir in path.split(File.pathSeparator)) {
|
||||
for (name in names) {
|
||||
val f = File(dir, name)
|
||||
if (f.isFile && f.canExecute()) return f.absolutePath
|
||||
val path = System.getenv("PATH")
|
||||
if (path != null) {
|
||||
for (dir in path.split(File.pathSeparator)) {
|
||||
for (name in names) {
|
||||
val f = File(dir, name)
|
||||
if (f.isFile && f.canExecute()) return f.absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
// The install root, last: an IDE launched from the desktop does not inherit
|
||||
// the PATH the installer wrote to the shell profile, so a working ~/.ludic
|
||||
// install would otherwise look missing.
|
||||
val home = System.getenv("LUDIC_HOME") ?: (System.getProperty("user.home") + "/.ludic")
|
||||
for (name in names) {
|
||||
val f = File(File(home, "bin"), name)
|
||||
if (f.isFile && f.canExecute()) return f.absolutePath
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -108,9 +118,10 @@ class LudicConnectionProvider(private val project: Project) : ProcessStreamConne
|
|||
append(if (root != null) File(File(root, d), "ludic-lsp").path else "<no project root>/$d/ludic-lsp")
|
||||
append('\n')
|
||||
}
|
||||
append(" and on PATH.\n")
|
||||
append(" on PATH, and in ~/.ludic/bin.\n")
|
||||
}
|
||||
append("\nBuild it with `bin/x tools` from the repository root, ")
|
||||
append("\nInstall the toolchain (curl -fsSL https://workshopsoft.pages.workshopsoft.io/ludic/install.sh | sh), ")
|
||||
append("build it with `bin/ludic dev tools` from a checkout, ")
|
||||
append("or set the path in Settings | Languages & Frameworks | Ludic. ")
|
||||
append("Syntax highlighting works without it; completion and diagnostics do not.")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
name="Ludic"
|
||||
factoryClass="io.ludic.ide.LudicLanguageServerFactory">
|
||||
<description><![CDATA[
|
||||
The Ludic language server. Built by <code>bin/x tools</code>.
|
||||
The Ludic language server. Built by <code>bin/ludic dev tools</code>.
|
||||
]]></description>
|
||||
</server>
|
||||
<languageMapping language="Ludic" serverId="ludic"/>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ for the language reference.
|
|||
Build the toolchain once, from the repository root:
|
||||
|
||||
```bash
|
||||
bin/x tools
|
||||
bin/ludic dev tools
|
||||
```
|
||||
|
||||
That produces `bin/ludic-lsp` and `bin/ludic-fmt`, which the extension finds
|
||||
|
|
|
|||
|
|
@ -38,9 +38,21 @@ function resolveServer(folders) {
|
|||
if (isExecutable(p)) return p;
|
||||
}
|
||||
}
|
||||
// The install root, checked last: an editor launched from Finder or a desktop
|
||||
// launcher does not inherit the PATH the installer wrote to the shell profile,
|
||||
// so a perfectly good ~/.ludic install would otherwise look missing.
|
||||
for (const name of names) {
|
||||
const p = path.join(installRoot(), 'bin', name);
|
||||
if (isExecutable(p)) return p;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The toolchain install root: $LUDIC_HOME, else ~/.ludic (what install.sh uses). */
|
||||
function installRoot() {
|
||||
return process.env.LUDIC_HOME || path.join(os.homedir(), '.ludic');
|
||||
}
|
||||
|
||||
function resolveCompiler(folders) {
|
||||
const configured = vscode.workspace.getConfiguration('ludic').get('compilerPath');
|
||||
if (configured) return expand(configured, folders);
|
||||
|
|
@ -54,6 +66,8 @@ function resolveCompiler(folders) {
|
|||
const p = path.join(dir, 'ludicc');
|
||||
if (isExecutable(p)) return p;
|
||||
}
|
||||
const installed = path.join(installRoot(), 'bin', 'ludicc');
|
||||
if (isExecutable(installed)) return installed;
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +98,7 @@ async function start(context) {
|
|||
// Not an error worth a modal: the grammar still highlights, and plenty of
|
||||
// people open a .ludic file without having built the toolchain.
|
||||
output.appendLine(
|
||||
'ludic-lsp not found. Build it with `bin/x tools`, or set "ludic.server.path". ' +
|
||||
'ludic-lsp not found. Install the toolchain (curl -fsSL https://ludic.dev/install.sh | sh), build it from a checkout with `bin/ludic dev tools`, or set "ludic.server.path". ' +
|
||||
'Syntax highlighting works without it; completion and diagnostics do not.'
|
||||
);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue