E2E Testing Nori Skillsets Subcommands
Use when you need to interactively test a nori-skillsets CLI subcommand end-to-end via tmux, with full filesystem isolation
tilework-tech · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add tilework-tech/nori-skillsets --skill E2E Testing Nori Skillsets Subcommands技能说明
name: E2E Testing Nori Skillsets Subcommands description: Use when you need to interactively test a nori-skillsets CLI subcommand end-to-end via tmux, with full filesystem isolation
- Run
e2e-setupto build the project and create the isolated environment
source {{skills_dir}}/e2e-testing-skillsets/e2e-setup
The script prints the variables it exports. Verify E2E_DIR, SKS, and NORI_GLOBAL_CONFIG are set.
- Read the TUI Puppeteering skill
Read {{skills_dir}}/tui-puppeteering-with-tmux/SKILL.md
Follow its instructions exactly. All tmux interaction goes through its scripts.
- Write a test plan for the specified subcommand
Before touching tmux, write out a concrete plan:
- What subcommand you are testing and what behavior you want to verify
- What seed data you need to create in
$E2E_DIRbefore launching the command - The exact
tui-startcommand you will use (must include theenvwrapper shown below) - The assert-act-assert sequence: what text you expect on screen, what input you will send, what text you expect after
- Seed any required test data in
$E2E_DIR
Many commands need pre-existing state. Create it directly in the filesystem:
# Example: create a fake skillset for switch/fork/edit to find
mkdir -p "$E2E_DIR/.nori/profiles/my-test-skillset"
echo '{"name":"my-test-skillset","version":"1.0.0","type":"skillset"}' > "$E2E_DIR/.nori/profiles/my-test-skillset/nori.json"
- Execute the test using TUI puppeteering
Launch the command inside tmux with isolation env vars:
SCRIPTS="{{skills_dir}}/tui-puppeteering-with-tmux"
SESSION="sks-e2e-$$"
$SCRIPTS/tui-start "$SESSION" "env NORI_GLOBAL_CONFIG=$E2E_DIR node $SKS <subcommand> [args]"
Then follow the assert-act-assert loop from the TUI Puppeteering skill.
- Verify filesystem side effects
After the command completes, check that the expected files were created/modified/deleted inside $E2E_DIR. Also verify that your real home directory was NOT touched.
- Clean up
$SCRIPTS/tui-stop "$SESSION"
{{skills_dir}}/e2e-testing-skillsets/e2e-teardown
Always stop tmux first, then tear down the filesystem.
Isolation Rules
- All commands MUST run with
NORI_GLOBAL_CONFIG=$E2E_DIR. This env var redirects every path thatgetHomeDir()resolves:~/.nori/,~/.nori-config.json,~/.claude/, and anything else rooted at$HOME. Without it, the CLI writes to the real home directory. - Always use
env NORI_GLOBAL_CONFIG=$E2E_DIR node $SKS ...as the command passed totui-start. Never run barenori-skillsetsorsks. - Never run
npm link. The built CLI is executed directly vianode. - The e2e directory is always
/tmp/nori/skillsets-e2e-scenario/. Thee2e-setupscript wipes and recreates it on every run. - After the test, verify isolation. Check that
~/.nori/and~/.claude/were not modified. Thee2e-teardownscript does this automatically.
UI Conventions to Assert
These are the authoritative conventions for nori-skillsets interactive subcommands. Use them to decide what to assert in your test plan.
Framing
- Every interactive subcommand begins with a clack intro line. The intro text is a short, descriptive title in infinitive verb form (e.g., "Switch Skillset", "Initialize Nori"). It appears as a horizontal bar with the title.
- On success, every interactive subcommand ends with a clack outro line. The outro text uses past tense or describes the next step the user should take. It contains the most salient piece of information from the operation (e.g., the email that was logged in, the skillset name that was created).
- On cancellation, no outro is displayed. The flow returns silently after showing a clack cancel message (a short italic line like "Login cancelled.").
- On failure, some commands display an outro with the error and then exit with code 1 (via
exitOnFailure). Others display the error inline (vialog.error) and show a normal outro. Check the specific command's behavior. - Uncaught exceptions always produce an outro prefixed with "Error: " followed by the error message, then exit with code 1.
Prompts
- Text inputs show a message and an optional placeholder. Validation errors appear inline below the prompt.
- Password inputs mask characters. Otherwise identical to text.
- Select menus show a list of options. The user navigates with arrow keys and confirms with Enter.
- Confirm prompts show a yes/no question. The user presses
yorn. - Group prompts collect multiple inputs in sequence. If the user cancels any input in the group, the entire group is cancelled.
- Cancellation at any prompt produces a short cancel message (e.g., "Skillset creation cancelled.") and the command returns without showing an outro.
Spinners
- Long-running operations are wrapped in a clack spinner. The spinner shows a start message (present participle, e.g., "Authenticating...") and a stop message (past tense, e.g., "Authenticated").
- On failure, the spinner stop message describes the failure (e.g., "Authentication failed").
Notes
- Notes (
note(content, title)) are used for multi-line structured information: change summaries, next steps, account details, artifact listings, diffs, warnings. - Notes are never used for single-line errors. Use
log.error()for that. - If a hint or additional context accompanies an error, the error is shown via
log.error()and the hint is shown in a separate note titled "Hint". - Notes always appear before the outro, never after.
Styling
- Bold ANSI (
\x1b[1m...\x1b[22m) is used in success outro messages to highlight the most important dynamic value: a skillset name, an email address, a package@version. Only