You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b6e9fa9
Browse filesBrowse the repository at this point in the historyBrowse files
Move the remaining TypeScript package tests to Node built-in test runner so Vitest and its transitive dependency tree can leave the workspace.
Use oxlint type-aware type checking as the root typecheck entry point and remove tsgo from the dev shell. Keep hermetic Nix formatter/check paths on a lightweight oxlint config because pure Nix checks do not include npm dependencies.
Refresh repo-local skills and agent guidance for Node tests and Nushell scripts.
description: Guides ccusage Nushell scripts. Use when adding, editing, formatting, or validating .nu scripts, Nix shebangs, GitHub Actions script calls, or just recipes that invoke Nushell.
4
+
paths:
5
+
- '**/*.nu'
6
+
globs: '*.nu'
7
+
---
8
+
9
+
# ccusage Nushell
10
+
11
+
Use this skill for repository scripts written in Nushell, especially under
12
+
`.github/scripts/` and `apps/ccusage/scripts/`.
13
+
14
+
## Runtime Shape
15
+
16
+
- Prefer executable `.nu` scripts with a Nix shebang over adding `nushell` to a
17
+
GitHub Actions profile install.
18
+
- Use `#!/usr/bin/env nix` plus a `nix shell --inputs-from` line when the script
19
+
needs tools that should be pinned by the flake.
20
+
- Keep the shebang tool list to commands the script directly invokes.
21
+
- It is acceptable for a Nu script to call external tools such as `gh`, `jq`,
22
+
`git`, `hyperfine`, `pnpm`, `node`, or `bun` when those tools are the right
23
+
boundary. Prefer the shebang Nix shell to global installs.
24
+
25
+
Example:
26
+
27
+
```nu
28
+
#!/usr/bin/env nix
29
+
#! nix shell --inputs-from ../../.. nixpkgs#nushell nixpkgs#git --command nu
30
+
```
31
+
32
+
Adjust the `--inputs-from` relative path to the script location.
33
+
34
+
## Style
35
+
36
+
- Use structured Nushell data operations (`open`, records, lists, `from json`,
37
+
`to json`, `transpose`, `where`, `each`) instead of ad hoc string parsing.
38
+
- Use `run-external` for commands where flags may be parsed by Nushell, and quote
39
+
short flags such as `'-L'`, `'-x'`, `'-c'`, and `'-change'`.
40
+
- Keep command arguments as lists until the external boundary. When a string
41
+
command is required, quote arguments that may contain spaces.
42
+
- Use `complete` when you need exit code, stdout, and stderr without throwing.
43
+
- Print progress to stderr for CI scripts whose stdout is a data artifact.
44
+
45
+
## Validation
46
+
47
+
Run syntax checks through Nix instead of assuming `nu` is on `PATH`:
48
+
49
+
```sh
50
+
nix shell --inputs-from . nixpkgs#nushell --command nu --commands 'nu-check path/to/script.nu'
51
+
```
52
+
53
+
Run formatting after edits:
54
+
55
+
```sh
56
+
just fmt
57
+
```
58
+
59
+
For behavior changes, add a focused smoke command that invokes the script via
60
+
its executable shebang, then run the repo check that owns the caller.
Copy file name to clipboardExpand all lines: .agents/skills/tdd/SKILL.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Example prompts:
12
12
13
13
You are following strict t-wada style Test-Driven Development. All code changes that involve logic (bug fixes, new features, refactors) **must** follow Red-Green-Refactor. No exceptions.
14
14
15
-
**Project test environment:** ccusage uses Vitest for TypeScript/package
15
+
**Project test environment:** ccusage uses Node's built-in test runner for TypeScript/package
16
16
tooling tests and `cargo test` for Rust CLI tests. Use the `testing` skill for
17
17
ccusage-specific fixture, adapter, pricing, model, schema, and CLI-output test
18
18
rules.
@@ -39,7 +39,7 @@ Repeat until the feature or fix is complete.
39
39
40
40
## Workflow
41
41
42
-
1.**Sketch behaviors** — Before writing any code, list the behaviors to implement as placeholder tests, such as `it.todo(...)` in Vitest or `#[ignore]` in Rust.
42
+
1.**Sketch behaviors** — Before writing any code, list the behaviors to implement as placeholder tests, such as `it.todo(...)` in Node test or `#[ignore]` in Rust.
43
43
2.**Pick one behavior** — Start with the simplest or most fundamental one.
44
44
3.**Red** — Write the test. Run it. Confirm it fails for the right reason.
45
45
4.**Green** — Write the minimum code to pass. Run the test. Confirm it passes.
@@ -52,7 +52,7 @@ Prefer running only the tests affected by your changes during the Red-Green-Refa
52
52
53
53
**Runner-specific guidance** — Read the relevant example file alongside this skill for detailed test modifiers, idioms, and runner-specific tips:
54
54
55
-
-**Vitest**: See `references/vitest.md` for focused commands, modifiers, a
55
+
-**Node test**: See `references/node-test.md` for focused commands, modifiers, a
56
56
compact Red-Green-Refactor example, and assertion/readability examples.
57
57
-**Rust (cargo test)**: See `references/rust.md` for focused cargo commands,
58
58
attributes, Result tests, doc tests, and a compact Red-Green-Refactor example.
0 commit comments