Skill v1.0.5
currentAutomated scan100/100~2 modified, -3 removed
version: "1.0.5" name: use-insyra-cli description: Use when a data operation or statistical analysis can be done without writing a full program, by driving Insyra through its CLI, REPL, .isr scripts or the Go DSL. Teaches when to use each mode, how sessions and environments behave, how to keep the work reproducible, and how to find the exact commands for the installed version from the binary and its docs. It deliberately does not list the commands.
Insyra CLI, REPL and .isr scripts
Insyra has one command language, and it runs four ways: one-shot (insyra <command> ...), the REPL (insyra), .isr scripts (insyra run file.isr), and Go code through engine/dsl. Reach for it when the task is analysis rather than a program: load a file, clean it, run a test or a model, save a result. That is often faster than writing a throwaway Python script.
Write Go instead (the insyra skill) when the result has to be a program, run inside a service, or needs logic the commands cannot express. A common path is to prototype with commands and then port the working steps to Go.
This skill does not list the commands, on purpose. The installed binary knows exactly which commands and options it has, and a list here would describe some other version.
Find commands in the binary, not in memory
insyra helplists every command the installed binary has, with a one-line description.insyra help <command>prints the command's usage line. Commands with several shapes also printForms:andExamples:. Run it before any command you have not already checked in this session, and follow the usage line exactly:[...]is optional,<...>is a value you supply,a|bis a choice.insyra versionprints the installed release, for exampleinsyra v0.3.3 (Huashan). The user guide for that release isDocs/cli-dsl.mdat the matching tag,https://github.com/HazelnutParadise/insyra/blob/v0.3.3/Docs/cli-dsl.md. It holds the full command index, the commands grouped by topic, worked workflows and the syntax rules.go mod download -json github.com/HazelnutParadise/insyra@v0.3.3prints the module'sDir, from the module cache when the release is already there (as it is aftergo install), and the same file is at<Dir>/Docs/cli-dsl.md.- When sources disagree, trust
insyra help, then the command's source (cli/commands/*.goat that tag), thenDocs/cli-dsl.md. Prose can drift; the registry the binary prints from cannot. - To find a command by what it does, read the
Command Groupssection ofDocs/cli-dsl.md, or scaninsyra help. - A command runs a library function, so the library's documentation explains its results. For example,
Docs/stats.mdgives a test's assumptions and the meaning of each field it reports. Theinsyraskill tells you how to find those pages.
How a session works
- Everything is a named variable. A command that creates or transforms data takes
as <var>. Without it, the result goes to$result, which the next such command overwrites. Name everything you intend to use again. - Variables live in an environment. An environment keeps its variables in
~/.insyra/envs/<name>/state.jsonand its history inhistory.txt. The environment isdefaultunless you pass--env <name>, which must name an existing environment (env create <name>makes one). Inside the REPL or a script,env open <name>switches; run as a one-shot command it opens the REPL instead. - A one-shot command reloads the environment from disk.
insyra load data.csv as tfollowed by a separateinsyra parsedates t cols when as t2works: tables keep their column order, names and cell types between commands, and fitted scalers andhclusttrees carry over too. A variable the environment cannot store, such as a regression result, is not saved, and the command prints awarning:line saying so. After a one-shot command that variable is gone, so run the steps that use it in the REPL or a script. - Connections do not persist. A database connection made with
db connectlives only in the running process. Reconnect at the top of every script or session that needs it. - Scripts keep going after an error. An
.isrfile holds one command per line. A line starting with#is a comment, but#later in a line is data. Quotes and backslash escapes work. A failing line is reported with its line number and the next line runs, so read the output instead of assuming the script succeeded. - The Go DSL is the same language.
engine/dslruns the same lines inside a program and saves state after each successful command. Unlikerun, itsExecuteFilestops at the first failing line. Use it when a Go program should hand the user a scriptable surface.
Principles
- Choose the mode on purpose. Explore in the REPL. Anything you will rerun or hand over belongs in an
.isrscript. Use one-shot commands for a single step in a shell pipeline, andengine/dslto embed the language in a program. Ask if the user's intent is unclear. - Isolate the work. Create an environment for each task, so you neither read nor overwrite someone's variables in
default.env exporthands the state over. Importing into an environment that already has variables, history or config needs--force, and that replaces what was there; treat it as destructive and confirm first. - Prefer reproducible steps to interactive fixes. Results should come from commands someone can rerun, not from edits made by hand in the REPL. Keep the commands you ran, or write them as a script.
- Look before you trust. After every load or transform,
showordescribethe result. Check the shape, the column types, whether the header was read as data, and whether numbers arrived as text, before you analyse anything. - Read only what you need. Some sources can be read in part, such as chosen columns and row groups of a Parquet file, or a query against a database. Check
insyra help loadbefore loading everything and filtering afterwards. - Save results explicitly, and say where. Write files with
save, write tables to a database withsave <var> sql ..., and export the session withenv export. Tell the user the path or table. - Mind the shell. bash, zsh and PowerShell all expand
$resultinside double quotes or bare, so pass it in single quotes:'$result'. Quote any token that contains spaces. - Read errors, then check usage. An error says what was wrong with the invocation, and a script prefixes it with the line number. Compare the invocation with
insyra help <command>and fix it instead of retrying variations.
Workflow
- Run
insyra versionandinsyra help. Confirm the commands you plan to use exist. - Choose the mode and the environment.
- Load, inspect, transform, analyse, save. Run
insyra help <command>for each command you have not yet checked. - Report the exact commands or the script you ran, and where every output went.