Skip to content

docs(nushell): adopt project conventions - #21

Merged
hakula139 merged 3 commits into
mainfrom
docs/nushell-project-conventions
Nov 10, 2026
Merged

hakula139 merged 3 commits into
mainfrom
docs/nushell-project-conventions

Conversation

@hakula139

Copy link
Copy Markdown
Member

Summary

Two projects documented general Nushell conventions in their own docs/conventions/nushell.md, and the nushell skill now holds them, worded without project names, so those pages can keep only their project-specific rules:

  • Scripts: export only what another module or the module's own test calls, layer imports one way from the entry through domain modules to generic helpers, import a module by name when its commands share verbs with siblings and otherwise list the imported commands, and order a module's sections as the pipeline first reaches them with callees before callers. The Quoting bullet now makes double quotes the default, with single quotes for text holding a literal backslash or double quote, as a regex does, which agrees with the dynamic regex trap.
  • Testing: tests sit beside their module as <module>.test.nu, an entry script runs through ^$nu.current-exe, an assertion compares the whole shape the test owns, and fixtures use a fixed day in UTC while the test sets TZ for the child process.
  • Linting: don't format with nufmt. It reindents to four spaces by default, and even with indent: 2 it joins a pipeline split one stage per line, or a call split one option per line, onto one line, against the code-layout skill.

The stream trap now names skip beside get <n> and last, since it too runs and discards a skipped item's error, and links the upstream issue, nushell/nushell#19463. Its fix, nushell/nushell#19467, is in no release yet.

The skill had grown long, so a second commit groups it under task headings without changing a bullet: Scripts splits into entry and help, modules and imports, layout and order, quoting and strings, and paths. The two long trap groups split into #### subsections, and Testing into layout and assertions, inputs and fixtures, and the nu-test runner. No link in this repository or in devkit points at an anchor in the skill.

Project-specific items stay in their projects: module lists and dependency graphs, external tools, the config record, real git init repositories, the edit-file and file-URI url encode traps, and the $env.HOME override.

Bump hakula-languages to 1.0.6, and add nufmt to the spelling dictionary.

Test plan

  • Commit and push hooks
  • nix develop -c run-hooks
  • nix flake check --all-systems
  • claude plugin validate .
  • On Nushell 0.116.1, $nu.current-exe names the dev shell's nu, the same path as which nu
  • A child started with with-env {TZ: ...} { ^$nu.current-exe entry.nu } formats date now in that zone: +00:00 for UTC, +09:00 for Asia/Tokyo, and -05:00 for America/New_York
  • With use ./cache.nu and use ./index.nu, cache read and index read both resolve, use ./paths.nu [path-map path-match] leaves an unlisted export undefined, and use ./cache.nu * leaves a non-exported helper undefined
  • 'a\d' == "a\\d" and 'say "hi"' == "say \"hi\"" hold, and "\d+" fails to parse with unrecognized escape sequence
  • assert equal fails on an extra record field and on an extra table row
  • nix shell nixpkgs#nufmt -c nufmt (0.1.0) reindents a two-space file to four spaces, and with {indent: 2} as its config it still joins a split pipeline and a split ^git log call onto one line each
  • [1 2 3] | each {|x| if $x == 1 { error make {msg: boom} } else { $x } } | skip 1 | to nuon prints [2, 3] and exits 0
  • The reorganization changes no content line, since the sorted non-heading lines before and after it are identical. Against main, the sorted bullet labels differ only by the six added here (Assertions, Imports, Layout, Modules, Order, and Timestamps) and the stream trap's head that now names skip

Move the general Nushell conventions that two projects documented
locally into the skill: module exports and one-way imports, importing by
module name or by command list, section order, the double-quote default,
test placement, running an entry script through `$nu.current-exe`,
whole-shape assertions, fixed-day UTC fixtures with `TZ` set for the
child, and not formatting with `nufmt`. Bump hakula-languages to 1.0.6.
Split Scripts into entry and help, modules and imports, layout and
order, quoting and strings, and paths. Split the two long trap groups
into h4 subsections, and Testing into layout and assertions, inputs and
fixtures, and the nu-test runner. Every bullet moves unchanged.
@hakula139 hakula139 added the documentation Documentation changes label Nov 10, 2026
@hakula139 hakula139 self-assigned this Nov 10, 2026
@hakula139
hakula139 merged commit 9c44641 into main Nov 10, 2026
3 checks passed
@hakula139
hakula139 deleted the docs/nushell-project-conventions branch November 10, 2026 11:05
hakula139 added a commit to hakulab/agent-project-move that referenced this pull request Nov 11, 2026
## Summary

Trim `AGENTS.md` and the convention docs to the project rules an agent
cannot discover from the code, the tools, or the shared instructions.
The shared [`nushell`
skill](https://github.com/hakula139/plugins/blob/main/plugins/hakula-languages/skills/nushell/SKILL.md)
now owns the general Nushell rules (hakulab/plugins#21), and agents
load it on their own for `.nu` changes, so `docs/conventions/nushell.md`
and its routing row go.

`AGENTS.md` keeps the routing table and three sections:

- **Code**: the 100-column limit, and building home paths from
`$env.HOME`, which overrides the skill's `$nu.home-dir` advice so tests
can swap `HOME`.
- **Skill directory**: installers copy only
`skills/agent-project-move/`, so it stays self-contained, and `SKILL.md`
leaves out `${CLAUDE_SKILL_DIR}`.
- **Verification**: install the hooks with `nix develop -c true` in each
new worktree, since the hook config is a gitignored link, and never
bypass them. Then the three check commands.

### Removed or moved

| Rule | Outcome | Reason |
| --- | --- | --- |
| Nushell exports, layering, and imports | Removed | The skill states
them, and the `use` lines show the layering |
| `edit-file` and `binary` trap | Removed | The skill's `open --raw`
trap and the check in `edit-file` cover it |
| `url encode` and file URIs | Removed | The skill's `url encode` trap
and the comment on `file-uri` cover it |
| Test coverage targets and invented test paths | Removed | Inferable,
and covered by general privacy reasoning |
| Banners at column 100 and whole string literals | Removed | Every
banner shows the width, and code layout rules keep literals whole |
| Fix the cause of failing checks | Removed | General engineering
practice |
| Update whatever goes stale | Removed | General practice. The one
hidden coupling, the README's Tested with table, moves to the stores
reference |
| Store formats change with assistant releases | Moved to
`docs/reference/stores.md` | Store changes already route there |
| Public material only in issues and PRs | Removed | The publication
rules for commits and descriptions cover it |
| Documentation maintenance section | Removed | The one-home rule and
the audience split restate general documentation practice, and the
README's headings show its scope |
| Cross-store parity in Code review | Removed | The store modules show
the shared shape, and review covers consistency |

## Test plan

- [x] `nix develop -c run-hooks`: markdownlint, dprint, and cspell
passed
- [x] A flagship reviewer checked the rewrite against the code and the
shared instructions, and its findings are applied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant