Ysra CLI on Windows
Use the Ysra CLI on Windows: install it with PowerShell, choose how commands run, and contain them with WSL.
On this page
The CLI on Windows is the same ysra program as on macOS and Linux, from
CLI 1.1.0, with one difference: Windows can’t contain commands to a folder the
way macOS and Linux do, so by default Ysra asks before each command. This page
covers installing, the card commands show, and the two ways to change that:
one session without asking, or WSL.
The rule#
| How commands run | Contained? | Asks before a command? |
|---|---|---|
| Default (approval mode) | No | Yes, except safe reads inside the folder |
/auto on, for one session |
No | No, except risky commands |
ysra wsl |
Yes, inside WSL | No |
ysra contain (alpha) |
No: paused for now | Yes, as in approval mode |
ysra doctor shows which one is in effect on its commands line.
Install#
In PowerShell:
irm https://ysra.ai/install.ps1 | iex
| Rule | Value |
|---|---|
| Administrator rights | Not needed |
| Check | The download is checked against its published checksum before it is installed |
| Where | ysra.exe in %LOCALAPPDATA%\Ysra\bin, added to PATH. Open a new terminal afterwards |
| Sign-in | Stored encrypted for your Windows account |
ysra login
cd C:\code\billing-service
ysra
ysra update and ysra uninstall work as on other systems.
How commands work on Windows#
On macOS and Linux Ysra runs commands contained to your folder. Windows has no equivalent, so there commands aren't contained: a command can reach the network and anything your account can. Without WSL, three rules decide whether Ysra asks first.
Safe read-only commands run without asking#
Commands that only look, inside your folder, run straight away:
| Kind | Commands |
|---|---|
| Looking at files | dir, type, where, findstr, more, tree |
| Reading Git | git status, git diff, git log, git show, git branch, git rev-parse, git ls-files |
| Version checks | node --version and the like |
| Reading npm | npm ls, npm view, npm config get |
The timeline marks them Ran git status without asking (safe read).
A command stops being safe, and asks, when it redirects output, goes through a
shell or inline code, searches recursively, touches a secret file such as
.env, or names a path outside the folder. env and set always ask.
Everything else shows a card#
Run this command?
npm test
in C:\code\billing-service
Commands on Windows aren't contained: this can reach the network and anything
your account can.
[Run once] [Allow `npm` for this session] [Don't run]
| Answer | What it does |
|---|---|
| Run once | Runs this command, this time |
Allow npm for this session |
Runs it, and every later npm command in this session without asking. It covers the whole program, not just this one command |
| Don't run | Ysra doesn't run it, and doesn't try it again |
- Allow for this session is never offered for a shell or inline code
(
cmd,powershell,pwsh,bash,node -e,python -c…), because that could run anything. - Even for an allowed program, these always ask: pushing, publishing, deploying, signing in or handling tokens, and changing Git remotes.
- A card left unanswered for a while counts as Don't run.
- Stopping ends everything a command started.
Run commands without asking, for one session#
If the cards get in the way, you can let commands run without asking for the rest of a session. It is never remembered: every new session starts with commands asking again. How to switch it is below.
Warning
With this on, uncontained commands run without asking. Only use it on a project you trust.
Even then Ysra still asks before:
- pushing, publishing or deploying;
- anything that names a path outside the folder;
- a shell or inline code.
The timeline marks these commands Ran npm test without asking (auto).
Contained commands with WSL#
If you have WSL, Ysra can run commands inside it, contained to your folder as on Linux, with no cards and none of the rules above. WSL runs a real Linux system beside Windows; see What WSL is, and why it helps.
- Install WSL yourself if you don't have it (
wsl --installin PowerShell). Ysra never installs it for you. -
Inside WSL, install what Ysra needs:
sudo apt install bubblewrap socat ripgrep -
Turn it on (see below).
Your project's tools then have to exist inside WSL too: Node.js, Python and so on are the WSL ones, not the Windows ones.
Other Windows behaviour#
- Files keep their line endings. A CRLF file stays CRLF; an LF file stays LF.
- Ysra refuses names Windows treats specially, such as
CON.txtor a name ending in a dot, and it won't work on a drive root or onC:\Usersitself. Pick the project folder.
Let commands run without asking#
It is the same switch as auto mode:
/auto on
/auto on on Windows |
Lasts |
|---|---|
| Auto mode, as on any system: Ysra goes ahead inside the folder without asking | Remembered |
| Commands run without asking; the status line reads auto: commands run without asking | This session only. In a new session commands ask again; type /auto on again |
/auto off turns both off. Some commands always ask, even then:
| Command | What the card says |
|---|---|
| One that deletes or can’t be undone | In red, “This deletes files or stops programs, and it can’t be undone.”, with Run it anyway and no way to allow it for the session |
| One that touches paths outside the folder | In red, “This works outside the folder.” |
Network tools: curl, wget, ssh, scp, rsync |
Always asks |
Ysra never deletes a file it didn’t create. When commands aren’t contained, it also refuses commands that overwrite files that already existed. A file it made itself, unchanged since, is deleted only after it asks.
Turn WSL on or off#
ysra wsl # run commands contained inside WSL
ysra wsl off # back to asking before each command
Contain commands (alpha)#
Contained commands are paused for now: setting folder permissions could make
Ysra stop responding. A saved choice reads as asking, and ysra contain says
so. ysra contain status, ysra contain off and ysra contain uninstall
(which removes Ysra’s Windows account) still work. Use ysra wsl to run
commands contained, without asking each one.
Opening the home folder or the whole disk#
Where the service offers it (/computer look on), commands there only ever
run contained, read-only and with no network. On Windows that needs WSL;
in approval mode such a command is refused with the reason
instead of running uncontained.
If it doesn’t work#
| Symptom | What to do |
|---|---|
ysra isn’t found after installing |
Open a new terminal so the new PATH is read |
| Every command shows a card | Expected in approval mode. Use /auto on for one session, or ysra wsl |
| Commands fail inside WSL | Install the project’s tools inside WSL too, and bubblewrap socat ripgrep |
| “Allow for this session” isn’t offered | The command is a shell or inline code (cmd, powershell, node -e…); it always asks |
Related#
- Work in a folder — what Ysra does and asks in a session.
- Tools, setup and Docker — containment on macOS and Linux, and
ysra doctor. - Install the CLI — manual download and checksums for Windows.