Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ coverage.dat

# --- Editor and OS noise ---
.DS_Store
.vscode/
*~
\#*\#
.\#*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ outside the tested support boundary.
## Development

```sh
nix develop # SBCL + cl-weave + paredit; registry already set
nix develop # SBCL with CL_SOURCE_REGISTRY already set
nix run .#test # run the test suite
nix flake check # full hermetic gate on x86_64-linux CI
nix fmt # format Nix sources (treefmt)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
;;; Literal syntax-highlighting data kept separate from the classifier.
(in-package #:nshell.highlight)
;;; Highlight data tables: builtin names, operator token types, and the
;;; fallback (theme-less) ANSI role palette used by highlight.lisp.
(in-package #:nshell.presentation)

(defparameter +highlight-builtin-names+
(defvar *builtin-commands*
'("echo" "printf" "pwd" "ls" "cd" "exit" "fg" "bg" "jobs" "disown"
"set" "export" "unset" "alias" "abbr" "function" "source" "exec"
"true" "false" "contains" "test" "type" "which" "history" "help")
Expand Down
14 changes: 4 additions & 10 deletions docs/notes/coverage-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ silently removed from the report.
## Reproduce

```sh
NSHELL_COVERAGE_DIR="$PWD/coverage" \
NSHELL_COVERAGE_DIR=/tmp/nshell-coverage \
nix develop 'path:.' --command sbcl --script scripts/coverage.lisp
```

The command writes `cover-index.html` and `coverage-summary.json` below the
selected directory. In a Nix check, where `$out` is provided, the same files
are retained below `$out/coverage/`. Without an explicit directory, the script
uses `$TMPDIR/nshell-coverage/` when `TMPDIR` is available; the dev-shell
`coverage` alias selects the repository's `coverage/` directory explicitly.

The command is release evidence only when the selected test count is non-zero,
the test and error counts are zero, the generated HTML and JSON artifacts
exist, and both the minimum and target fields have been inspected. A passing
minimum with `target-reached=false` is a warning, not a 100% coverage claim.
the test and error counts are zero, the generated report exists, and both the
minimum and target fields have been inspected. A passing minimum with
`target-reached=false` is a warning, not a 100% coverage claim.

## What the suite verifies

Expand Down
6 changes: 3 additions & 3 deletions docs/notes/macro-consolidation-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Beyond `define-value-struct` (`docs/notes/value-struct-audit.md`), 26 other
boilerplate categories this goal targets:

- **Builtin command dispatch.** `define-builtin`
(`application/builtin-macros.lisp`) auto-generates ignore-declarations;
(`application/builtin-commands.lisp`) auto-generates ignore-declarations;
`%with-option-arguments` / `%with-required-argument`
(`application/builtin-runtime.lisp`) capture the shared "parse leading
option flags, validate required args" skeleton; `%table-builtin-case`
Expand All @@ -20,8 +20,8 @@ boilerplate categories this goal targets:
(`application/builtin-string-support.lisp`) cover the `string` subcommand
family; `define-test-predicate-table` (`application/builtin-test.lisp`)
covers `test`/`[`. Registration itself is a single data table
(`+builtin-registry-specs+` in `data/application/builtin-spec-data.lisp`),
not hand-written per-command code.
(`+builtin-registry-specs+` in `application/builtin-spec-data.lisp`), not
hand-written per-command code.
- **Value structs.** 37 value structs generate their
accessor/predicate/constructor boilerplate from `define-value-struct`
instead of by hand (`docs/notes/value-struct-audit.md`).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ git clone https://github.com/nerima-lisp/nshell
cd nshell
nix build # produces ./result/bin/nshell
nix flake check # full hermetic gate on x86_64-linux CI
nix develop # dev shell with SBCL + cl-weave + paredit
nix develop # dev shell with SBCL + cl-weave
```

`flake.nix` declares `x86_64-linux` and `aarch64-darwin`. The full hermetic
Expand Down
23 changes: 3 additions & 20 deletions docs/src/guide/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ Just the focused completion suite (`nshell/weave`):
sbcl --script scripts/weave.lisp
```

All repository entry points use `scripts/asdf-runtime.lisp` for source
discovery and compile policy. The Nix development shell supplies a complete
`CL_SOURCE_REGISTRY`; outside that shell, set `NSHELL_SOURCE_TREE` to an
explicit directory containing sibling Common Lisp systems, or set
`CL_SOURCE_REGISTRY` yourself. When no registry is supplied, the repository
itself is registered and the runtime does not scan a worktree's parent
directory. The shared runtime deliberately ignores inherited ASDF output
translations and writes compiled files below `NSHELL_ASDF_OUTPUT_DIR`, or a
temporary `nshell-asdf/` directory when that variable is unset:

```sh
NSHELL_SOURCE_TREE=/path/to/common-lisp-systems \
sbcl --script run-tests.lisp
```

### The non-sandboxed integration run

Some cases need a real PTY, `stty`, and external binaries, which the Nix
Expand All @@ -85,13 +70,11 @@ job-control lifecycle checks.
## Generate a coverage report

```sh
NSHELL_COVERAGE_DIR="$PWD/coverage" \
nix develop -c sbcl --script scripts/coverage.lisp
nix develop -c sbcl --script scripts/coverage.lisp
```

The report is written to `coverage/cover-index.html`, with the gate result in
`coverage/coverage-summary.json`. Set `NSHELL_COVERAGE_DIR` to redirect both
artifacts. The default Nix check stores them under its `$out/coverage/` output.
The report is written to `coverage/cover-index.html`. Set `NSHELL_COVERAGE_DIR`
to redirect the output.

## Performance evidence

Expand Down
25 changes: 9 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,10 @@
# whole docs tree.
treefmt.evalModule = treefmt-nix.lib.evalModule;

# The cl-weave CLI, which the suites' reporters are documented against,
# and the Paredit CLI used for structural Common Lisp analysis. Both
# come from the same pinned cl-weave input so the development shell does
# not grow a second, independently versioned tooling stack.
devShellPackages = ctx: [
cl-weave.packages.${ctx.system}.default
cl-weave.inputs.paredit-cli.packages.${ctx.system}.default
];
# The cl-weave CLI, which the suites' reporters are documented against.
# Interactive only: the registry the shell exports already carries every
# system, check dependencies included.
devShellPackages = ctx: [ cl-weave.packages.${ctx.system}.default ];

overrideOutputs =
ctx:
Expand All @@ -580,17 +576,14 @@
devShells.default = ctx.generated.devShells.default.overrideAttrs (previous: {
shellHook = previous.shellHook + ''
export NSHELL_ROOT=$PWD
export NSHELL_TIMEOUT_SECONDS=1800
alias test='cd "$NSHELL_ROOT" && timeout --signal=TERM --kill-after=5s "$NSHELL_TIMEOUT_SECONDS" sbcl --script "$NSHELL_ROOT/run-tests.lisp"'
alias coverage='cd "$NSHELL_ROOT" && NSHELL_COVERAGE_DIR="$NSHELL_ROOT/coverage" timeout --signal=TERM --kill-after=5s "$NSHELL_TIMEOUT_SECONDS" sbcl --script "$NSHELL_ROOT/scripts/coverage.lisp"'
alias weave='cd "$NSHELL_ROOT" && timeout --signal=TERM --kill-after=5s "$NSHELL_TIMEOUT_SECONDS" sbcl --script "$NSHELL_ROOT/scripts/weave.lisp"'
alias paredit='paredit'
alias test='cd "$NSHELL_ROOT" && sbcl --script "$NSHELL_ROOT/run-tests.lisp"'
alias coverage='cd "$NSHELL_ROOT" && NSHELL_COVERAGE_DIR="$NSHELL_ROOT/coverage" sbcl --script "$NSHELL_ROOT/scripts/coverage.lisp"'
alias weave='cd "$NSHELL_ROOT" && sbcl --script "$NSHELL_ROOT/scripts/weave.lisp"'
echo ""
echo "nshell development environment"
echo " test - Run the full nshell suite (cl-weave, nshell/test)"
echo " weave - Run the focused completion suite (nshell/weave)"
echo " coverage - Run the test suite and write HTML coverage to coverage/"
echo " paredit - Run Paredit-aware Common Lisp analysis"
echo " sbcl - Interactive Common Lisp (with cl-weave)"
echo ""
'';
Expand Down Expand Up @@ -632,8 +625,8 @@

# Generate the sb-cover report and enforce the configured source
# expression minimum. The report also records the distance from
# the explicit 100% target without claiming that it has been
# reached when executable expressions remain uncovered.
# the aspirational 100% target without making an unsupported
# claim that structural sb-cover forms are executable.
coverage = ctx.cl.mkScriptCheck {
drv = ctx.package;
entryPoint = "scripts/coverage.lisp";
Expand Down
120 changes: 61 additions & 59 deletions nshell.asd
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
;;; This form comes FIRST, before any defsystem. ASDF binds *package* to
;;; ASDF-USER only for a file it loads itself; read any other way — a REPL
;;; `load`, an editor evaluating the buffer, flake.nix parsing :version — the
;;; file is read in whatever package happens to be current, and an unqualified
;;; `defsystem` then fails to read at all. Saying it makes the file
;;; self-contained. See PACKAGE_STANDARD.md "asd の書き方".
(in-package #:asdf-user)

;;; Metadata keys follow the org's canonical order:
;;; :description :long-description :author :maintainer :license :version
;;; :homepage :bug-tracker :source-control :depends-on :pathname :serial
Expand Down Expand Up @@ -37,7 +45,6 @@
(:file "package-domain")
(:file "package-application")
(:file "package-infrastructure")
(:file "package-highlight")
(:file "package-presentation")
(:module "feature-command-line"
:pathname "../packages/feature/command-line/src"
Expand All @@ -55,11 +62,11 @@
(:file "domain/execution/command")
(:file "domain/execution/pipeline")
(:file "domain/execution/job")
(:file "domain/parsing/ast")
(:file "domain/parsing/ast-redirect-split")
(:file "domain/parsing/tokenizer-data")
(:file "domain/parsing/tokenizer-readers")
(:file "domain/parsing/tokenizer-handlers")
(:file "domain/parsing/ast")
(:file "domain/parsing/ast-redirect-split")
(:file "domain/parsing/tokenizer-data")
(:file "domain/parsing/tokenizer-readers")
(:file "domain/parsing/tokenizer-handlers")
(:file "domain/parsing/parse-result")
(:file "domain/parsing/control-flow-data")
(:file "domain/parsing/control-flow")
Expand All @@ -74,18 +81,18 @@
(:file "domain/parsing/parser-here-doc")
(:file "domain/parsing/parser-reduction")
(:file "domain/parsing/parser")
(:file "domain/environment/env")
(:file "domain/expansion/expand")
(:file "domain/expansion/brace")
(:file "domain/expansion/parameter-data")
(:file "domain/expansion/parameter-selection")
(:file "domain/expansion/parameter-braced")
(:file "domain/expansion/parameter")
(:file "domain/expansion/arithmetic")
(:file "domain/expansion/arithmetic-operator-data"
:pathname "../data/domain/expansion/arithmetic-operator-data")
(:file "domain/expansion/fields")
(:file "domain/abbreviation/expansion")
(:file "domain/environment/env")
(:file "domain/expansion/expand")
(:file "domain/expansion/brace")
(:file "domain/expansion/parameter-data")
(:file "domain/expansion/parameter-selection")
(:file "domain/expansion/parameter-braced")
(:file "domain/expansion/parameter")
(:file "domain/expansion/arithmetic")
(:file "domain/expansion/arithmetic-operator-data"
:pathname "../data/domain/expansion/arithmetic-operator-data")
(:file "domain/expansion/fields")
(:file "domain/abbreviation/expansion")
(:file "domain/completion/candidate")
(:file "domain/completion/catalog-build")
(:file "domain/completion/catalog-command-data"
Expand All @@ -111,27 +118,23 @@
(:file "domain/prompting/prompt")
(:file "application/event-dispatcher")
(:file "application/shell-context")
(:file "application/execute-pipeline-expansion")
(:file "application/execute-pipeline-redirect")
(:file "application/execute-pipeline-stage-external")
(:file "application/execute-pipeline-stage-background")
(:file "application/execute-pipeline-stage")
(:file "application/execute-pipeline-control")
(:file "application/execute-pipeline-expansion")
(:file "application/execute-pipeline-redirect")
(:file "application/execute-pipeline-stage-external")
(:file "application/execute-pipeline-stage-background")
(:file "application/execute-pipeline-stage")
(:file "application/execute-pipeline-control")
(:file "application/manage-job")
(:file "application/pipeline-diagram")
(:file "application/builtin-spec-data"
:pathname "../data/application/builtin-spec-data")
(:file "application/builtin-spec")
(:file "application/builtin-runtime")
(:file "application/builtin-macros")
(:file "application/builtin-type-helpers")
(:file "application/builtin-string-support")
(:file "application/builtin-string")
(:file "application/builtin-source-reader")
(:file "application/builtin-source")
(:file "application/builtin-printf-format")
(:file "application/builtin-printf-parser")
(:file "application/builtin-printf")
(:file "application/builtin-commands")
(:file "application/builtin-commands-history")
(:file "application/builtin-jobs")
Expand All @@ -156,17 +159,13 @@
(:file "infrastructure/acl/pty")
(:file "infrastructure/acl/pty-spawn")
(:file "infrastructure/acl/signal-acl")
(:file "infrastructure/acl/process-capabilities")
(:file "infrastructure/persistence/file-history")
(:file "infrastructure/persistence/file-config")
(:file "infrastructure/terminal/raw-mode")
(:file "infrastructure/terminal/ansi")
(:file "infrastructure/terminal/input-core")
(:file "infrastructure/terminal/input-decode")
(:file "infrastructure/terminal/input-read")
(:file "highlight-data"
:pathname "../data/highlight-data")
(:file "highlight")
(:file "presentation/input-state-static-data"
:pathname "../data/presentation/input-state-data")
(:file "presentation/input-state-core")
Expand All @@ -185,20 +184,23 @@
(:file "presentation/input-state-kill-yank")
(:file "presentation/input-state-history-search")
(:file "presentation/input-state-dispatch")
(:file "presentation/input-state-vi-data")
(:file "presentation/input-state-vi")
(:file "presentation/input-state-vi-edit")
(:file "presentation/input-state-vi-data")
(:file "presentation/input-state-vi")
(:file "presentation/input-state-vi-edit")
(:file "presentation/input-state-session")
(:file "presentation/repl-boundaries")
(:file "presentation/prompt-display")
(:file "presentation/completion-ui")
(:file "presentation/autosuggest")
(:file "presentation/repl-state")
(:file "presentation/repl-input-state")
(:file "presentation/repl-completion-seed")
(:file "presentation/repl-environment")
(:file "presentation/repl-session-init")
(:file "presentation/repl-process")
(:file "presentation/highlight-data"
:pathname "../data/presentation/highlight-data")
(:file "presentation/highlight")
(:file "presentation/repl-state")
(:file "presentation/repl-input-state")
(:file "presentation/repl-completion-seed")
(:file "presentation/repl-environment")
(:file "presentation/repl-session-init")
(:file "presentation/repl-process")
(:file "presentation/repl-execution-context")
(:file "presentation/repl-execution-command")
(:file "presentation/repl-execution")
Expand All @@ -210,10 +212,10 @@
(:file "presentation/repl-output-handlers")
(:file "presentation/repl-output-event-handlers")
(:file "presentation/repl-output")
(:file "presentation/repl-session")
(:file "presentation/repl-batch")
(:file "presentation/repl")
(:file "main"))
(:file "presentation/repl-session")
(:file "presentation/repl-batch")
(:file "presentation/repl")
(:file "main"))
;; The three build keys and the :perform below are exempt from the metadata
;; order above -- PACKAGE_STANDARD.md names cl-weave's identical trio and
;; cl-tty-kit's :perform as "はどこに書いても構いません" -- and they sit here,
Expand Down Expand Up @@ -274,16 +276,16 @@
((:file "package")
(:file "support/assertions")
(:file "helpers-runner")
(:file "support/pbt")
(:file "support/pbt-shell")
(:file "support/input-state")
(:file "support/input-state-assertions")
(:file "support/pbt")
(:file "support/pbt-shell")
(:file "support/input-state")
(:file "support/input-state-assertions")
(:file "support/repl")
(:file "support/builtins")
(:file "support/completion")
(:file "support/prompt")
(:file "support/history")
(:file "support/matchers")
(:file "support/prompt")
(:file "support/history")
(:file "support/matchers")
(:file "unit/test-package-by-feature")
(:file "unit/test-domain-events")
(:file "unit/test-signals")
Expand All @@ -300,13 +302,13 @@
(:file "unit/test-expansion-abbreviation")
(:file "unit/test-completion-rules")
(:file "unit/test-completion-rule-prover-boundaries")
(:file "unit/test-completion-rule-prover")
(:file "unit/test-completion-builtins")
(:file "unit/test-completion-knowledge-base")
(:file "unit/test-completion-path-reducer")
(:file "unit/test-completion-knowledge-base-behavior")
(:file "unit/test-completion-properties")
(:file "unit/test-completion-context")
(:file "unit/test-completion-rule-prover")
(:file "unit/test-completion-builtins")
(:file "unit/test-completion-knowledge-base")
(:file "unit/test-completion-path-reducer")
(:file "unit/test-completion-knowledge-base-behavior")
(:file "unit/test-completion-properties")
(:file "unit/test-completion-context")
(:file "unit/test-repl")
(:file "unit/test-repl-completion-data")
(:file "unit/test-repl-background")
Expand Down
Loading
Loading