Issue #537: nikaia new, and a #! line so a .nika file runs as a script

Open and answer this issue on GitHub.

tools, ready · opened 2026-10-07 · updated 2026-10-09 · 1 comment

Records: Part III 13.1 (nikaia new my_project generates the structure), 13.2 and ADR-260 D4 (nikaia run f.nika, built in #132).

Where it stands. One file already runs on its own: nikaia run f.nika builds it as a project kept in the user’s cache, keyed on its path. What is missing is the two ends around it:

  1. nikaia new is specified and not built. guide/getting-started.md says so (“There is no nikaia new yet, so create the two files by hand”), so the first thing a tester does is type a nikaia.toml from a page.
  2. A file cannot be its own command. Nothing in the parser treats a leading #! line, so a small tool can’t be written as

    #!/usr/bin/env -S nikaia run
    fn main() {
        println("Hello, Nikaia!")
    }

    and started with ./hello.nika. This does not touch the no REPL decision: a file is still a whole program, and the analysis still sees all of it.

To decide

Comments

keywan-ghadami, 2026-10-09

Decided (owner, 2026-10-09)

Checked (0.0.711):

Try Result
nikaia new x unrecognized subcommand 'new'
#!… on line 1 Didn't expect '#' here.
nikaia run s.nika a b unexpected argument 'a' (arguments only after --)
nikaia run s.nika -- a b runs with a b

The third row decided the second question. The kernel starts a script as nikaia run ./s.nika a b, without --, so a #! line alone would not be enough.

Where it is written: ADR-260 D6-D8 and Part III 13.1-13.2 (0.0.712).

To build

  1. D6: arguments after the file go to the program. Tests:
    • nikaia run s.nika a -v b hands the program a -v b;
    • nikaia run --release s.nika x still reads --release as a switch;
    • nikaia run s.nika -- a still works.
  2. D7: the parser skips a first line starting #!. Tests:
    • the script above runs as ./s.nika a b (execute bit, #!/usr/bin/env -S nikaia run);
    • an error on line 3 of a file with #! is reported on line 3;
    • #! in a file without main, or on line 2, is refused.
  3. D8: nikaia new. Tests:
    • nikaia new hello && cd hello && nikaia run prints Hello, Nikaia!;
    • nikaia test passes in it;
    • nikaia new on a non-empty directory is refused and writes nothing.
  4. guide/getting-started.md:
    • step 1 is a single file with nikaia run hello.nika;
    • step 2 is nikaia new, replacing “There is no nikaia new yet”;
    • a short section on #! scripts.

    No version change.


Generated by Claude Code

Back to Open Issues