feat(port): move five bash entry points to Python and drop bash from .mcp.json

jobbsok could not start on stock Windows. `.mcp.json` named `bash` as the
command, and the five entry points behind it reached for grep, sed, find, awk,
zip and unzip. `bootstrap.sh` built the virtualenv, so a Windows adopter could
not even reach an interpreter. Two adopters are waiting and neither is
guaranteed to be on macOS, so this is the install, not a rough edge.

The Python layer was already clean -- no /tmp, no /usr, no os.uname, no home
directory assumption -- so only the shell layer moved. Behaviour is carried
over unchanged; the deliberate exceptions are listed in docs/.

THE ONE OPEN DECISION, AND WHY IT WAS FORCED

How does .mcp.json start an interpreter without a POSIX shell, when it is
called python3 on macOS and python or py on Windows? Measured against the
installed CLI, not assumed:

  - The plugin mcpServers stdio schema has NO platform-conditional form. A
    config carrying invented windows/darwin/platform keys was accepted and the
    keys were silently discarded -- it fails quietly, not loudly.
  - ${VAR:-default} IS expanded, in command, args and env.
  - ${VAR} without a default is not safe: unset, it is passed through
    unexpanded, so the spawn would try to run a program named ${VAR}.
  - Windows spawns with shell:false, so a .py path as command is out.
  - No single literal works. On this Mac, python and py are not on PATH.

So the default form is the only lever the schema offers:
"${JOBBSOK_LAUNCH_PYTHON:-python3}". macOS and Linux keep working with nothing
set; Windows sets one variable and needs no shell.

A SECOND VARIABLE, NOT A REUSE OF JOBBSOK_PYTHON

JOBBSOK_PYTHON names the interpreter to SERVE on: the launcher treats it as an
explicit operator choice, so it wins over the bootstrapped virtualenv. A
Windows adopter setting it merely to spell `python` would silently bypass that
virtualenv and serve WITHOUT the ingestion guard. JOBBSOK_LAUNCH_PYTHON only
says how to start the launcher. A test asserts the two never collapse into one.

O4 IS LEFT STANDING

The launcher still gates on the interpreter's version rather than on the guard
being importable. That is the shell version's semantics carried over on
purpose: harmless while nothing writes, a defect from M2, and an M2 decision.

VERIFY

  - pytest tests/                      -> 124 passed, exit 0 (was 112)
  - grep -c '"command": "bash"' .mcp.json -> 0
  - git ls-files 'scripts/*.sh'        -> 0
  - README install block names Windows, and neither WSL nor Git Bash
  - server started end to end exactly as .mcp.json expands, and answered
    initialize and tools/list
  - the ported probe checker reproduces the shell version's output and exits 0

NOT MEASURED, AND NOT ASSUMED

Nothing here has ever run on Windows. Whether Cowork on Windows bridges to a
host-side stdio MCP as it does on this Mac is unmeasured -- docs/cowork-probe.md
covered macOS only. docs/cross-platform-port.md says what a Windows probe would
have to measure, and records two findings left deliberately untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-05 21:02:03 +02:00
commit dcd3eae534
20 changed files with 1523 additions and 542 deletions

View file

@ -39,12 +39,12 @@ will not, and that is not a cosmetic loss: the guard is the boundary every
untrusted listing and email body passes at the write, so an install without it
is a reader rather than a workspace.
**Platform support.** macOS and Linux work today. **Windows does not yet**, and
the reason is specific rather than general: this plugin's entry points are shell
scripts and `.mcp.json` starts the tool server through `bash`, which stock
Windows does not have. The Python underneath is already platform-clean, so this
is a packaging gap being closed rather than a rewrite. Until it is closed,
Windows needs a POSIX shell (WSL or Git Bash) and is not a supported target.
**Platform support.** macOS, Linux and Windows. Every entry point is Python
and the standard library; nothing here needs a POSIX shell, `zip` or the
coreutils. On Windows the interpreter is normally called `python` or `py` --
`python3` is not a stock Windows name -- so the commands below are given in
both spellings, and the one setting that needs saying is in *Windows: name the
interpreter* further down.
The plugin runs on two surfaces, and they install differently.
@ -53,7 +53,8 @@ build the archive from this repository's explicit include list, then upload it
through *Customize -> Plugins*:
```bash
bash scripts/package_plugin.sh # writes jobbsok.plugin
python3 scripts/package_plugin.py # writes jobbsok.plugin
python scripts\package_plugin.py # Windows
```
Never build that archive with a recursive zip of the repository root: it would
@ -72,20 +73,41 @@ and the host tool server run on. This is also the step that installs the
ingestion guard, and it prints the version it resolved:
```bash
bash scripts/bootstrap.sh # add --med-xlsx for the spreadsheet export
python3 scripts/bootstrap.py # add --med-xlsx for the spreadsheet export
python scripts\bootstrap.py # Windows
```
In an installed copy this builds the environment under `$CLAUDE_PLUGIN_DATA`,
which survives a plugin update; the packaged archive deliberately excludes the
virtualenv, so the bootstrap is the supported route there. Without it the
`jobbsok-tools` server has no interpreter to run on and refuses to start
rather than serving on whatever `python3` the PATH offers. `JOBBSOK_PYTHON`
overrides the interpreter choice.
rather than serving on whatever interpreter the PATH offers.
**Windows: name the interpreter.** `.mcp.json` has to spell the interpreter
that starts the tool server, and the plugin format offers no way to spell it
differently per platform -- so it reads `${JOBBSOK_LAUNCH_PYTHON:-python3}`.
macOS and Linux need nothing. On Windows, set it once:
```
setx JOBBSOK_LAUNCH_PYTHON python
```
Then restart the app, because a process reads its environment at startup.
Without this the connector will not appear: `python3` is not a Windows name,
and where the Microsoft Store alias is enabled it is worse than absent -- it
opens the Store rather than running anything.
`JOBBSOK_LAUNCH_PYTHON` and `JOBBSOK_PYTHON` are different settings and are not
interchangeable. The first only says how to *start* the launcher. The second
overrides which interpreter the server *runs on*, and it wins over the
environment the bootstrap built -- so setting it to work around a spelling
problem would quietly leave the server without the ingestion guard.
**Finally, the workspace** -- the plugin never guesses at a location:
```bash
export JOBBSOK_WORKSPACE=~/jobbsok-workspace # or pass --workspace
setx JOBBSOK_WORKSPACE %USERPROFILE%\jobbsok-workspace # Windows
```
The `kandidatprofil` skill scaffolds the tree on first run. The workspace is