Phase 1: POSIX command lines, job control and the prompt
- (bjosh syntax): a part of POSIX sh, parsed with (text
parser-combinators). Syntax that is not supported raises an error that
names it.
- (bjosh expand): variables, ~ and globs. Values are not split.
- (bjosh exec): pipes as (std run) jobs, && || ; &, redirections, and
NAME=value through env.
- (bjosh shell) and (bjosh builtins): the job table and cd, pwd, exit,
export, unset, jobs, fg, bg, kill, type, help, history.
- (bjosh editor): Enter waits for open quotes and trailing operators;
completion of commands and files.
- -c LINE, FILE, and stdin. A Native AOT build too.
- Tests: the parser, expansion, the editor, lines through -c, and job
control under script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:19:45 +01:00
|
|
|
# bjosh
|
|
|
|
|
|
|
|
|
|
A shell in Bjolang. The design and the phases are in `plan.org`.
|
|
|
|
|
|
|
|
|
|
## Comments
|
|
|
|
|
|
|
|
|
|
Write clear, direct engineering comments, as in the Bjolang repo's
|
|
|
|
|
CLAUDE.md: "returns" and "raises", contracts and invariants, bullets for
|
|
|
|
|
non-trivial functions. No essays.
|
|
|
|
|
|
|
|
|
|
## This package
|
|
|
|
|
|
2026-12-01 10:38:40 +01:00
|
|
|
- `bjo build` builds the shell: `src/main.exe`. `bin/bjosh` starts it with
|
|
|
|
|
dotnet. No Native AOT: it cannot load the user's commands.
|
Phase 1: POSIX command lines, job control and the prompt
- (bjosh syntax): a part of POSIX sh, parsed with (text
parser-combinators). Syntax that is not supported raises an error that
names it.
- (bjosh expand): variables, ~ and globs. Values are not split.
- (bjosh exec): pipes as (std run) jobs, && || ; &, redirections, and
NAME=value through env.
- (bjosh shell) and (bjosh builtins): the job table and cd, pwd, exit,
export, unset, jobs, fg, bg, kill, type, help, history.
- (bjosh editor): Enter waits for open quotes and trailing operators;
completion of commands and files.
- -c LINE, FILE, and stdin. A Native AOT build too.
- Tests: the parser, expansion, the editor, lines through -c, and job
control under script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:19:45 +01:00
|
|
|
- `bjo test` runs the tests. `tests/run.bjo` and `tests/interactive.bjo`
|
|
|
|
|
run `src/main.exe`, so run `bjo build` first.
|
2026-12-01 10:48:37 +01:00
|
|
|
- It depends on bjoterm, fetched from rikspucko by its version tag and
|
|
|
|
|
pinned in `bjo.lock`. A change in bjoterm needs a new tag there, and a
|
|
|
|
|
higher `version-at-least` here. To work on both at once, put the path
|
|
|
|
|
source `(source (path (dir "../bjoterm")))` in the manifest for the time
|
|
|
|
|
being.
|
Phase 1: POSIX command lines, job control and the prompt
- (bjosh syntax): a part of POSIX sh, parsed with (text
parser-combinators). Syntax that is not supported raises an error that
names it.
- (bjosh expand): variables, ~ and globs. Values are not split.
- (bjosh exec): pipes as (std run) jobs, && || ; &, redirections, and
NAME=value through env.
- (bjosh shell) and (bjosh builtins): the job table and cd, pwd, exit,
export, unset, jobs, fg, bg, kill, type, help, history.
- (bjosh editor): Enter waits for open quotes and trailing operators;
completion of commands and files.
- -c LINE, FILE, and stdin. A Native AOT build too.
- Tests: the parser, expansion, the editor, lines through -c, and job
control under script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:19:45 +01:00
|
|
|
- Modules:
|
|
|
|
|
- `(bjosh syntax)`: the parser, with `(text parser-combinators)`.
|
Phase 3: $(...), aliases, a start-up file, PROMPT, Done lines, >&2
- $(...) runs in a subshell. A word that is only an unquoted $(...) is
one word per line. X=$(cmd) sets $? to its status.
- alias, unalias, and command NAME. An alias is one pipe.
- ~/.config/bjosh/rc runs before the first prompt.
- PROMPT, expanded as in double quotes, with \w \W \u \h \$ \e \n.
- "Done" lines are written above the input while the prompt waits.
- >&2, for programs and value commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:50:15 +01:00
|
|
|
- `(bjosh expand)`: variables, `~`, `$(...)` and globs.
|
|
|
|
|
- `(bjosh shell)`: the state, variables, aliases and the job table.
|
Phase 1: POSIX command lines, job control and the prompt
- (bjosh syntax): a part of POSIX sh, parsed with (text
parser-combinators). Syntax that is not supported raises an error that
names it.
- (bjosh expand): variables, ~ and globs. Values are not split.
- (bjosh exec): pipes as (std run) jobs, && || ; &, redirections, and
NAME=value through env.
- (bjosh shell) and (bjosh builtins): the job table and cd, pwd, exit,
export, unset, jobs, fg, bg, kill, type, help, history.
- (bjosh editor): Enter waits for open quotes and trailing operators;
completion of commands and files.
- -c LINE, FILE, and stdin. A Native AOT build too.
- Tests: the parser, expansion, the editor, lines through -c, and job
control under script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:19:45 +01:00
|
|
|
- `(bjosh builtins)`: the shell commands.
|
Phase 3: $(...), aliases, a start-up file, PROMPT, Done lines, >&2
- $(...) runs in a subshell. A word that is only an unquoted $(...) is
one word per line. X=$(cmd) sets $? to its status.
- alias, unalias, and command NAME. An alias is one pipe.
- ~/.config/bjosh/rc runs before the first prompt.
- PROMPT, expanded as in double quotes, with \w \W \u \h \$ \e \n.
- "Done" lines are written above the input while the prompt waits.
- >&2, for programs and value commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:50:15 +01:00
|
|
|
- `(bjosh exec)`: lines to `(std run)` forms and jobs, aliases, and
|
|
|
|
|
the subshell of `$(...)`.
|
Phase 2, first part: values and value commands
- Values are Json of (text json); a record is JsonFields.
- Value commands: files, procs, open, where, select, get, sort-by,
first, last, count, reverse, uniq, lines, from-json, to-json,
from-csv, to-csv, each with a short name.
- Value commands next to each other run as one unit: a (std run)
filter in a job, or in the shell when a line has no program.
- Records are shown as a table; values go to programs as lines.
- A name is a shell command, a short name, a program on PATH, then a
long name.
- 2>&1, with >FILE 2>&1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 07:05:09 +01:00
|
|
|
- `(bjosh values)`: values (`Json`), streams of them, text and tables.
|
|
|
|
|
- `(bjosh commands)`: the value commands, and their table.
|
|
|
|
|
- `(bjosh pipeline)`: value commands next to each other, as one unit.
|
2026-12-01 13:30:23 +01:00
|
|
|
- `(bjosh editor)`: when Enter runs a line, the completer (fish's
|
|
|
|
|
completions when fish is on PATH), and the suggester.
|
2026-12-01 15:00:15 +01:00
|
|
|
- `(bjosh highlight)`: the highlighter of the input, with fish's colors.
|
2026-12-01 13:30:23 +01:00
|
|
|
- `(bjosh dirs)`: the visited directories, ranked by frecency, saved in
|
|
|
|
|
`$XDG_STATE_HOME/bjosh/dirs`.
|
2026-12-01 10:38:40 +01:00
|
|
|
- `(bjosh api)`: what a package of user commands imports: `Extension`,
|
|
|
|
|
`ShellCommand`, `ShellView`.
|
|
|
|
|
- `(bjosh user)`: builds and loads the package of user commands, in
|
|
|
|
|
`$XDG_CONFIG_HOME/bjosh/commands`, with `(std plugin)`.
|
Phase 1: POSIX command lines, job control and the prompt
- (bjosh syntax): a part of POSIX sh, parsed with (text
parser-combinators). Syntax that is not supported raises an error that
names it.
- (bjosh expand): variables, ~ and globs. Values are not split.
- (bjosh exec): pipes as (std run) jobs, && || ; &, redirections, and
NAME=value through env.
- (bjosh shell) and (bjosh builtins): the job table and cd, pwd, exit,
export, unset, jobs, fg, bg, kill, type, help, history.
- (bjosh editor): Enter waits for open quotes and trailing operators;
completion of commands and files.
- -c LINE, FILE, and stdin. A Native AOT build too.
- Tests: the parser, expansion, the editor, lines through -c, and job
control under script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:19:45 +01:00
|
|
|
- Tests:
|
|
|
|
|
- `tests/syntax.bjo`, `tests/expand.bjo`, `tests/editor.bjo`: unit tests.
|
|
|
|
|
- `tests/run.bjo`: lines through `bjosh -c`, a file, and stdin.
|
Phase 2, first part: values and value commands
- Values are Json of (text json); a record is JsonFields.
- Value commands: files, procs, open, where, select, get, sort-by,
first, last, count, reverse, uniq, lines, from-json, to-json,
from-csv, to-csv, each with a short name.
- Value commands next to each other run as one unit: a (std run)
filter in a job, or in the shell when a line has no program.
- Records are shown as a table; values go to programs as lines.
- A name is a shell command, a short name, a program on PATH, then a
long name.
- 2>&1, with >FILE 2>&1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 07:05:09 +01:00
|
|
|
- `tests/values.bjo`: the value commands through `bjosh -c`.
|
Phase 3: $(...), aliases, a start-up file, PROMPT, Done lines, >&2
- $(...) runs in a subshell. A word that is only an unquoted $(...) is
one word per line. X=$(cmd) sets $? to its status.
- alias, unalias, and command NAME. An alias is one pipe.
- ~/.config/bjosh/rc runs before the first prompt.
- PROMPT, expanded as in double quotes, with \w \W \u \h \$ \e \n.
- "Done" lines are written above the input while the prompt waits.
- >&2, for programs and value commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:50:15 +01:00
|
|
|
- `tests/interactive.bjo`: job control, the prompt and the start-up
|
|
|
|
|
file under `script`.
|
2026-12-01 10:38:40 +01:00
|
|
|
- `tests/extension.bjo`: user commands and their prompt, in a package
|
|
|
|
|
that the test writes.
|
|
|
|
|
- The tests that run bjosh with `-c` load the user commands of your own
|
|
|
|
|
`XDG_CONFIG_HOME`, when there are any. `tests/extension.bjo` and
|
|
|
|
|
`tests/interactive.bjo` set it to a directory of their own.
|