nola-lang 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Install as a **devDependency** — your app depends on
10
10
  instead (the scaffold sets all of this up):
11
11
 
12
12
  ```bash
13
- npm create nola my-app # or: npx nola init
13
+ npm create nola my-app # or: npx nola-lang init
14
14
  ```
15
15
 
16
16
  ## Commands
@@ -0,0 +1,33 @@
1
+ import { type ClientInit } from "create-nola-lang";
2
+ export interface AccountOptions extends ClientInit {
3
+ /** the project directory whose .env may hold a key to claim; default "." */
4
+ cwd?: string;
5
+ /** the directory holding .nola/credentials.json; default os.homedir() */
6
+ home?: string;
7
+ /** may the sign-in flow run? default: stdin AND stdout are TTYs */
8
+ interactive?: boolean;
9
+ /** browser opener; default openBrowser */
10
+ open?: (url: string) => boolean;
11
+ out?: (line: string) => void;
12
+ err?: (line: string) => void;
13
+ }
14
+ /** The console's public origin — the fallback when a server's capabilities name none. */
15
+ export declare const CONSOLE_URL = "https://platform.nola.sh";
16
+ /** Where "bring your own provider" is explained; the runtime's missing-key error points here. */
17
+ export declare const PROVIDER_DOCS_URL = "https://nola.sh/docs/reference/providers-api/";
18
+ /** A per-million-token price: two decimals, a third only when the price has one (`$0.25`, `$0.035`). */
19
+ export declare const formatPrice: (microPerMTok: number) => string;
20
+ /** Phase 1: hosted inference is early access. Printed by `nola account`; the account page shows the same text. */
21
+ export declare const EARLY_ACCESS_NOTE = "Early access: The hosted Nola inference service is designed to help you get started quickly. For now, we recommend it for prototyping and development rather than production use.";
22
+ export declare const NOT_SIGNED_IN = "Not signed in. Run `npx nola-lang login` first \u2014 or run `npx nola-lang account` in an interactive terminal to sign in now.";
23
+ /**
24
+ * `nola account` — the signed-in user's account page on the
25
+ * console (spec 2026-09-04-cli-sign-in-design.md §5). Not signed in →
26
+ * interactive: the browser sign-in runs here; non-interactive: exit 1. Signed in
27
+ * (a stored session, refreshed when stale): link the current project's key to
28
+ * the account when there is one, print the account line and balance, open
29
+ * `<consoleUrl>/account` — the browser holds its own Auth0 session, so no
30
+ * CLI-minted session is needed. Works from ANY directory.
31
+ */
32
+ export declare function cmdAccount(opts?: AccountOptions): Promise<number>;
33
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,UAAU,EAmBhB,MAAM,kBAAkB,CAAC;AAiB1B,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAID,yFAAyF;AACzF,eAAO,MAAM,WAAW,6BAA6B,CAAC;AAEtD,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAKjF,wGAAwG;AACxG,eAAO,MAAM,WAAW,GAAI,cAAc,MAAM,KAAG,MAGlD,CAAC;AAEF,kHAAkH;AAClH,eAAO,MAAM,iBAAiB,sLACuJ,CAAC;AAEtL,eAAO,MAAM,aAAa,oIACoG,CAAC;AAE/H;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoD3E"}
@@ -0,0 +1,83 @@
1
+ import { accessTokenFor, claimNote, claimProjectKey, deleteSession, fetchCapabilities, fetchMe, isSessionRejected, nolaApiUrl, openBrowser, SignInError, SignInUnavailableError, signIn, } from "create-nola-lang";
2
+ const WIRE_MIRROR = [true, true, true, true, true, true, true];
3
+ void WIRE_MIRROR;
4
+ const describeError = (e) => (e instanceof Error ? e.message : String(e));
5
+ /** The console's public origin — the fallback when a server's capabilities name none. */
6
+ export const CONSOLE_URL = "https://platform.nola.sh";
7
+ /** Where "bring your own provider" is explained; the runtime's missing-key error points here. */
8
+ export const PROVIDER_DOCS_URL = "https://nola.sh/docs/reference/providers-api/";
9
+ /** `$12.35` from micro-dollars; the console shows the same figure. */
10
+ const formatBalance = (microUsd) => `$${(microUsd / 1_000_000).toFixed(2)}`;
11
+ /** A per-million-token price: two decimals, a third only when the price has one (`$0.25`, `$0.035`). */
12
+ export const formatPrice = (microPerMTok) => {
13
+ const three = (microPerMTok / 1_000_000).toFixed(3);
14
+ return `$${three.endsWith("0") ? three.slice(0, -1) : three}`;
15
+ };
16
+ /** Phase 1: hosted inference is early access. Printed by `nola account`; the account page shows the same text. */
17
+ export const EARLY_ACCESS_NOTE = "Early access: The hosted Nola inference service is designed to help you get started quickly. For now, we recommend it for prototyping and development rather than production use.";
18
+ export const NOT_SIGNED_IN = "Not signed in. Run `npx nola-lang login` first — or run `npx nola-lang account` in an interactive terminal to sign in now.";
19
+ /**
20
+ * `nola account` — the signed-in user's account page on the
21
+ * console (spec 2026-09-04-cli-sign-in-design.md §5). Not signed in →
22
+ * interactive: the browser sign-in runs here; non-interactive: exit 1. Signed in
23
+ * (a stored session, refreshed when stale): link the current project's key to
24
+ * the account when there is one, print the account line and balance, open
25
+ * `<consoleUrl>/account` — the browser holds its own Auth0 session, so no
26
+ * CLI-minted session is needed. Works from ANY directory.
27
+ */
28
+ export async function cmdAccount(opts = {}) {
29
+ const out = opts.out ?? ((line) => console.log(line));
30
+ const err = opts.err ?? ((line) => console.error(line));
31
+ const apiUrl = (opts.baseUrl ?? nolaApiUrl()).replace(/\/$/, "");
32
+ const auth = { ...(opts.home !== undefined ? { home: opts.home } : {}), apiUrl, ...(opts.fetch ? { fetch: opts.fetch } : {}) };
33
+ const client = { ...(opts.fetch ? { fetch: opts.fetch } : {}), baseUrl: apiUrl };
34
+ const interactive = opts.interactive ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
35
+ let accessToken;
36
+ try {
37
+ const stored = await accessTokenFor(auth);
38
+ if (stored) {
39
+ accessToken = stored.token;
40
+ }
41
+ else if (!interactive) {
42
+ err(NOT_SIGNED_IN);
43
+ return 1;
44
+ }
45
+ else {
46
+ ({ accessToken } = await signIn({ ...auth, note: out, open: opts.open ?? openBrowser }));
47
+ }
48
+ }
49
+ catch (e) {
50
+ err(e instanceof SignInUnavailableError || e instanceof SignInError ? e.message : `Could not sign in: ${describeError(e)}`);
51
+ return 1;
52
+ }
53
+ const claim = await claimProjectKey(opts.cwd ?? ".", accessToken, auth);
54
+ if (claim)
55
+ out(claimNote(claim));
56
+ let me;
57
+ let consoleUrl = CONSOLE_URL;
58
+ try {
59
+ me = await fetchMe(accessToken, client);
60
+ consoleUrl = (await fetchCapabilities(client)).consoleUrl?.replace(/\/$/, "") ?? CONSOLE_URL;
61
+ }
62
+ catch (e) {
63
+ if (isSessionRejected(e)) {
64
+ await deleteSession(opts.home, apiUrl);
65
+ err("Your Nola session is no longer valid. Run `npx nola-lang login` to sign in again.");
66
+ return 1;
67
+ }
68
+ err(`Could not read the Nola account: ${describeError(e)}`);
69
+ return 1;
70
+ }
71
+ const who = me.user.email ?? "signed in";
72
+ out(`Nola account: ${who} — ${me.account.trial.runsUsed} / ${me.account.trial.runsLimit} free runs used`);
73
+ out(`Balance ${formatBalance(me.account.balanceMicro)}`);
74
+ out("");
75
+ out(EARLY_ACCESS_NOTE);
76
+ out("");
77
+ const url = `${consoleUrl}/account`;
78
+ out(`Opening ${url}`);
79
+ out("If your browser did not open, visit the link above.");
80
+ (opts.open ?? openBrowser)(url);
81
+ return 0;
82
+ }
83
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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Aa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvC,GAAG,CAAC,mFAAmF,CAAC,CAAC;YACzF,OAAO,CAAC,CAAC;QACX,CAAC;QACD,GAAG,CAAC,oCAAoC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC;IACzC,GAAG,CAAC,iBAAiB,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,iBAAiB,CAAC,CAAC;IAC1G,GAAG,CAAC,YAAY,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1D,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvB,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,MAAM,GAAG,GAAG,GAAG,UAAU,UAAU,CAAC;IACpC,GAAG,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;IACtB,GAAG,CAAC,qDAAqD,CAAC,CAAC;IAC3D,CAAC,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type CliIo, type CommandSpec, type Palette } from "create-nola-lang";
2
+ /**
3
+ * Print a command's diagnostics (styled, exit 1) or its one-line success
4
+ * summary (exit 0): the file count when it writes, "no errors" otherwise.
5
+ */
6
+ export declare function report(label: string, result: {
7
+ written?: string[];
8
+ errors: string[];
9
+ }, separator: string, io?: CliIo, p?: Palette): number;
10
+ export declare const COMMANDS: readonly CommandSpec[];
11
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,KAAK,EAAE,KAAK,WAAW,EAA+B,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAcjH;;;GAGG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAChD,SAAS,EAAE,MAAM,EACjB,EAAE,GAAE,KAAiB,EACrB,CAAC,GAAE,OAAc,GAChB,MAAM,CAQR;AAED,eAAO,MAAM,QAAQ,EAAE,SAAS,WAAW,EAwF1C,CAAC"}
@@ -0,0 +1,119 @@
1
+ // The `nola` command table. Each entry declares its own flags (scoped per
2
+ // command — `nola login --out x` is a usage error) and the help is generated
3
+ // from it, so a new command is one entry here and nothing else.
4
+ import { ansi, defineCommand, FLOW_OPTIONS } from "create-nola-lang";
5
+ import { cmdAccount } from "./account.js";
6
+ import { cmdBuild } from "./build.js";
7
+ import { cmdCheck } from "./check.js";
8
+ import { emitAdjacentDeclarations } from "./declarations.js";
9
+ import { cmdInit } from "./init.js";
10
+ import { cmdKey } from "./key.js";
11
+ import { cmdLogin, cmdLogout } from "./login.js";
12
+ import { cmdRun } from "./run.js";
13
+ import { cmdSkill } from "./skill.js";
14
+ import { styleDiagnostics } from "./style.js";
15
+ const consoleIo = { log: (m) => console.log(m), error: (m) => console.error(m) };
16
+ /**
17
+ * Print a command's diagnostics (styled, exit 1) or its one-line success
18
+ * summary (exit 0): the file count when it writes, "no errors" otherwise.
19
+ */
20
+ export function report(label, result, separator, io = consoleIo, p = ansi) {
21
+ if (result.errors.length > 0) {
22
+ io.error(styleDiagnostics(result.errors.join(separator), p));
23
+ return 1;
24
+ }
25
+ const outcome = result.written ? `${result.written.length} files written` : "no errors";
26
+ io.log(`${p.ok(`nola ${label}:`)} ${outcome}`);
27
+ return 0;
28
+ }
29
+ export const COMMANDS = [
30
+ defineCommand({
31
+ name: "init",
32
+ summary: "scaffold a Nola project, or add Nola to an existing one (same flow as npm create nola-lang)",
33
+ args: "[dir]",
34
+ options: FLOW_OPTIONS,
35
+ run: ({ positionals: [dir], values }) => cmdInit(dir, values),
36
+ }),
37
+ defineCommand({
38
+ name: "key",
39
+ summary: "get a Nola API key for this project (the machine's free trial, else your account) and offer it to .env",
40
+ options: { print: { type: "boolean", description: "write only the key to stdout; sign-in instructions go to stderr" } },
41
+ run: ({ values }) => cmdKey(values.print !== undefined ? { print: values.print } : {}),
42
+ }),
43
+ defineCommand({
44
+ name: "login",
45
+ summary: "sign in to Nola in the browser; links this project's trial key to your account",
46
+ run: () => cmdLogin(),
47
+ }),
48
+ defineCommand({ name: "logout", summary: "sign out of Nola on this machine", run: () => cmdLogout() }),
49
+ defineCommand({
50
+ name: "account",
51
+ summary: "show your Nola account and open it in the browser (signs you in first when needed)",
52
+ run: () => cmdAccount(),
53
+ }),
54
+ defineCommand({
55
+ name: "skill",
56
+ summary: "write agent skill files (Claude Code, Cursor, Copilot, AGENTS.md) into the project",
57
+ args: "install",
58
+ options: {
59
+ agents: { type: "string", description: "claude,cursor,copilot,agents-md | all | none" },
60
+ force: { type: "boolean", description: "replace files stamped by another Nola version" },
61
+ },
62
+ run: ({ positionals: [sub], values }) => cmdSkill(sub, { agents: values.agents, force: values.force }),
63
+ }),
64
+ defineCommand({
65
+ name: "build",
66
+ summary: "compile all .tsi files (js + map + d.ts into --out)",
67
+ args: "[dir]",
68
+ options: { out: { type: "string", default: "dist", description: "output directory" } },
69
+ run: async ({ positionals: [dir], values }) => report("build", await cmdBuild(dir ?? ".", values.out), "\n\n"),
70
+ }),
71
+ defineCommand({
72
+ name: "run",
73
+ summary: "run a .tsi/.js entry with the Nola loader + nola.config.ts",
74
+ args: "<entry>",
75
+ run: ({ positionals: [entry] }) => cmdRun(entry ?? ""),
76
+ }),
77
+ defineCommand({
78
+ name: "console",
79
+ summary: "start the local Nola Console (traces UI/API; loopback only)",
80
+ options: { port: { type: "string", description: "listen port (default 4141)" } },
81
+ run: async ({ values }) => {
82
+ const port = values.port !== undefined ? Number(values.port) : undefined;
83
+ if (port !== undefined && (!Number.isInteger(port) || port < 0 || port > 65535)) {
84
+ console.error(`--port must be an integer in 0..65535 — got ${JSON.stringify(values.port)}.`);
85
+ return 1;
86
+ }
87
+ const { cmdConsole } = await import("./console.js");
88
+ return cmdConsole(port !== undefined ? { port } : {});
89
+ },
90
+ }),
91
+ defineCommand({
92
+ name: "check",
93
+ summary: "type-check lowered .tsi files AND the project's .ts files, positions mapped back",
94
+ args: "[dir]",
95
+ run: async ({ positionals: [dir] }) => report("check", await cmdCheck(dir ?? "."), "\n"),
96
+ }),
97
+ defineCommand({
98
+ name: "declarations",
99
+ summary: "emit <name>.d.tsi.ts next to each .tsi so plain tsc resolves .tsi imports (allowArbitraryExtensions)",
100
+ args: "[dir]",
101
+ options: { watch: { type: "boolean", description: "re-emit whenever a .tsi changes (runs until Ctrl-C)" } },
102
+ run: async ({ positionals: [dir = "."], values }) => {
103
+ const once = async () => report("declarations", await emitAdjacentDeclarations(dir), "\n\n");
104
+ const code = await once();
105
+ if (!values.watch)
106
+ return code;
107
+ const { watch } = await import("node:fs");
108
+ let timer;
109
+ watch(dir, { recursive: true }, (_event, name) => {
110
+ if (name?.endsWith(".tsi")) {
111
+ clearTimeout(timer);
112
+ timer = setTimeout(once, 150);
113
+ }
114
+ });
115
+ return new Promise(() => { }); // watch runs until Ctrl-C
116
+ },
117
+ }),
118
+ ];
119
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,OAAO,EAAE,IAAI,EAAgC,aAAa,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AACjH,OAAO,EAAE,UAAU,EAAE,MA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E,EAAE,EAAE;YAClD,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7F,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAC;YAC/B,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;YAC1C,IAAI,KAAiC,CAAC;YACtC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;gBAC/C,IAAI,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC3B,YAAY,CAAC,KAAK,CAAC,CAAC;oBACpB,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,IAAI,OAAO,CAAS,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,0BAA0B;QAClE,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { formatIngestLine } from "@nola-lang/core";
2
+ import { type Palette } from "create-nola-lang";
3
+ export { formatIngestLine };
4
+ /** True when this Node has unflagged node:sqlite (≥ 22.13). */
5
+ export declare function nodeSupportsConsole(version: string): boolean;
6
+ /**
7
+ * `node:sqlite` announces itself with an ExperimentalWarning the moment it
8
+ * loads — unflagged since 22.13, but still stability 1. The console is the
9
+ * one place we load it on purpose, so that single warning is noise here;
10
+ * every other warning still reaches Node's default printer. Install BEFORE
11
+ * importing `@nola-lang/console` (the import is what triggers it).
12
+ */
13
+ export declare function suppressSqliteExperimentalWarning(): void;
14
+ /** `home` is the console root (`~/.nola/console`) — the folder, never the database file inside it. */
15
+ export declare function formatConsoleBanner(info: {
16
+ url: string;
17
+ home: string;
18
+ }, p?: Palette): string;
19
+ export declare function cmdConsole(opts: {
20
+ port?: number;
21
+ }): Promise<number>;
22
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../src/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAQ,KAAK,OAAO,EAAS,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CASxD;AAED,sGAAsG;AACtG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,GAAE,OAAe,GAAG,MAAM,CAYnG;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE"}
@@ -0,0 +1,63 @@
1
+ import { formatIngestLine } from "@nola-lang/core";
2
+ import { ansi, plain } from "create-nola-lang";
3
+ export { formatIngestLine };
4
+ /** True when this Node has unflagged node:sqlite (≥ 22.13). */
5
+ export function nodeSupportsConsole(version) {
6
+ const [major = 0, minor = 0] = version.split(".").map(Number);
7
+ return major > 22 || (major === 22 && minor >= 13);
8
+ }
9
+ /**
10
+ * `node:sqlite` announces itself with an ExperimentalWarning the moment it
11
+ * loads — unflagged since 22.13, but still stability 1. The console is the
12
+ * one place we load it on purpose, so that single warning is noise here;
13
+ * every other warning still reaches Node's default printer. Install BEFORE
14
+ * importing `@nola-lang/console` (the import is what triggers it).
15
+ */
16
+ export function suppressSqliteExperimentalWarning() {
17
+ const emit = process.emitWarning;
18
+ process.emitWarning = ((warning, ...rest) => {
19
+ const [typeOrOptions] = rest;
20
+ const type = typeof typeOrOptions === "string" ? typeOrOptions : typeOrOptions?.type;
21
+ const message = typeof warning === "string" ? warning : warning.message;
22
+ if (type === "ExperimentalWarning" && message.includes("SQLite"))
23
+ return;
24
+ emit.call(process, warning, ...rest);
25
+ });
26
+ }
27
+ /** `home` is the console root (`~/.nola/console`) — the folder, never the database file inside it. */
28
+ export function formatConsoleBanner(info, p = plain) {
29
+ return [
30
+ "",
31
+ p.heading("Nola Console started"),
32
+ "",
33
+ `${p.dim("Local:")} ${p.command(info.url)}`,
34
+ `${p.dim("Home:")} ${p.path(info.home)}`,
35
+ "",
36
+ p.dim(`Enable tracing with \`telemetry: nola.tracer("${info.url}")\` in nola.config.ts`),
37
+ "",
38
+ p.dim("Press Ctrl+C to stop"),
39
+ ].join("\n");
40
+ }
41
+ export async function cmdConsole(opts) {
42
+ if (!nodeSupportsConsole(process.versions.node)) {
43
+ console.error(`nola console needs Node >= 22.13 (built-in SQLite) — you are running ${process.versions.node}. Upgrade Node and re-run.`);
44
+ return 1;
45
+ }
46
+ suppressSqliteExperimentalWarning();
47
+ const { startConsole } = await import("@nola-lang/console");
48
+ const running = await startConsole(opts.port !== undefined ? { port: opts.port } : {});
49
+ // The console root is per-machine (~/.nola/console), not per-project — show it absolute.
50
+ console.log(formatConsoleBanner({ url: running.url, home: running.path }, ansi));
51
+ console.log("");
52
+ const unsubscribe = running.onEvent((notice) => console.log(formatIngestLine(notice, ansi)));
53
+ await new Promise((resolve) => {
54
+ const stop = () => {
55
+ unsubscribe();
56
+ void running.close().then(resolve, resolve);
57
+ };
58
+ process.once("SIGINT", stop);
59
+ process.once("SIGTERM", stop);
60
+ });
61
+ return 0;
62
+ }
63
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../src/console.ts"],"names":[],"mappings":"AAAA,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,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7F,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,IAAI,GAAG,GAAS,EAAE;YACtB,WAAW,EAAE,CAAC;YACd,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACX,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ export { type AccountOptions, cmdAccount } from "./account.js";
1
2
  export { type BuildResult, cmdBuild } from "./build.js";
2
3
  export { cmdCheck } from "./check.js";
3
4
  export { adjacentDeclarationPath, emitAdjacentDeclarations } from "./declarations.js";
4
5
  export { printDiagnostics } from "./diag.js";
5
6
  export { codeFrame } from "./frame.js";
7
+ export { cmdLogin, cmdLogout, type LoginOptions } from "./login.js";
8
+ export { openUrl, type Spawn } from "./open-url.js";
6
9
  export { cmdRun } from "./run.js";
7
10
  export { createLoweredProgram, type LoweredEntry, type LoweredProgram } from "./tshost.js";
8
11
  export { findNolaFiles } from "./walk.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,11 @@
1
+ export { cmdAccount } from "./account.js";
1
2
  export { cmdBuild } from "./build.js";
2
3
  export { cmdCheck } from "./check.js";
3
4
  export { adjacentDeclarationPath, emitAdjacentDeclarations } from "./declarations.js";
4
5
  export { printDiagnostics } from "./diag.js";
5
6
  export { codeFrame } from "./frame.js";
7
+ export { cmdLogin, cmdLogout } from "./login.js";
8
+ export { openUrl } from "./open-url.js";
6
9
  export { cmdRun } from "./run.js";
7
10
  export { createLoweredProgram } from "./tshost.js";
8
11
  export { findNolaFiles } from "./walk.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAA0C,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAA0C,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
package/dist/init.d.ts CHANGED
@@ -3,7 +3,11 @@ export interface InitOptions {
3
3
  add?: boolean;
4
4
  ide?: string;
5
5
  agents?: string;
6
+ /** --provider nola|openai|anthropic|google|none; undefined = ask interactively, none otherwise */
7
+ provider?: string;
8
+ /** --trial / --no-trial: shorthand for --provider nola / none */
9
+ trial?: boolean;
6
10
  }
7
- /** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>]` — the same flow `npm create nola-lang` runs. */
11
+ /** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>] [--provider <id>|--trial|--no-trial]` — the same flow `npm create nola-lang` runs. */
8
12
  export declare function cmdInit(dir: string | undefined, opts: InitOptions): Promise<number>;
9
13
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qIAAqI;AACrI,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzF"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,0KAA0K;AAC1K,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzF"}
package/dist/init.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { runFlow } from "create-nola-lang";
2
- /** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>]` — the same flow `npm create nola-lang` runs. */
2
+ /** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>] [--provider <id>|--trial|--no-trial]` — the same flow `npm create nola-lang` runs. */
3
3
  export async function cmdInit(dir, opts) {
4
4
  return runFlow({ dir, ...opts }, { intro: "nola init" });
5
5
  }
package/dist/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,qIAAqI;AACrI,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAuB,EAAE,IAAiB;IACtE,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AAC3D,CAAC"}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAa3C,0KAA0K;AAC1K,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAuB,EAAE,IAAiB;IACtE,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AAC3D,CAAC"}
package/dist/key.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { type ClientInit } from "create-nola-lang";
2
+ /**
3
+ * `nola key [--print]` — get a Nola API key and offer it to the project's
4
+ * `.env` (spec 2026-09-04-nola-key-command-design.md, ladder per
5
+ * 2026-09-04-cli-sign-in-design.md §4): signed in → a key on the account; the
6
+ * machine's trial used → sign in first (interactive) or exit 1; a fresh
7
+ * machine → the anonymous trial. The key comes FIRST; then, interactively,
8
+ * "Add it to .env?" (Yes highlighted) and — when `.env` already has a key —
9
+ * "replace it?" (No highlighted). Esc/Ctrl+C at either question leaves the
10
+ * file alone. `--print` puts the key ALONE on stdout; anything the sign-in
11
+ * has to say goes to stderr. On a used machine the browser never opens
12
+ * unasked: the scaffold's sign-in question comes first (Yes highlighted), and
13
+ * a no or Esc is the sign-in note + exit 1.
14
+ */
15
+ export interface KeyOptions extends ClientInit {
16
+ /** stdout = the key, nothing else; never touches .env */
17
+ print?: boolean;
18
+ /** the project directory holding .env; default "." */
19
+ cwd?: string;
20
+ /** the directory holding .nola/; default os.homedir() */
21
+ home?: string;
22
+ /** default: stdin AND stdout are TTYs */
23
+ interactive?: boolean;
24
+ /** the Yes/No questions; null = cancelled (Esc / Ctrl+C). Default: the scaffold's clack confirm */
25
+ confirm?: (question: string, initialValue: boolean) => Promise<boolean | null>;
26
+ /** browser opener for the sign-in; default openBrowser */
27
+ open?: (url: string) => boolean;
28
+ out?: (line: string) => void;
29
+ err?: (line: string) => void;
30
+ }
31
+ export declare const ADD_TO_ENV_QUESTION = "Add it to .env?";
32
+ export declare const REPLACE_ENV_QUESTION = ".env already sets NOLA_API_KEY \u2014 replace it with the new key?";
33
+ export declare function cmdKey(opts?: KeyOptions): Promise<number>;
34
+ //# sourceMappingURL=key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAUhB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mGAAmG;IACnG,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC/E,0DAA0D;IAC1D,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,oBAAoB,uEAAkE,CAAC;AAQpG,wBAAsB,MAAM,CAAC,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDnE"}
package/dist/key.js ADDED
@@ -0,0 +1,62 @@
1
+ import { acquireKey, hasEnvKey, nolaApiUrl, openBrowser, SIGN_IN_QUESTION, SignInError, SignInRequiredError, SignInUnavailableError, writeEnvKey, } from "create-nola-lang";
2
+ export const ADD_TO_ENV_QUESTION = "Add it to .env?";
3
+ export const REPLACE_ENV_QUESTION = ".env already sets NOLA_API_KEY — replace it with the new key?";
4
+ const NOT_WRITTEN = "Not written — add the line above to .env yourself.";
5
+ async function clackConfirm(question, initialValue) {
6
+ const { clackPrompter } = await import("create-nola-lang");
7
+ return clackPrompter().confirm(question, initialValue);
8
+ }
9
+ export async function cmdKey(opts = {}) {
10
+ const out = opts.out ?? ((line) => console.log(line));
11
+ const err = opts.err ?? ((line) => console.error(line));
12
+ const cwd = opts.cwd ?? ".";
13
+ const print = opts.print === true;
14
+ const interactive = opts.interactive ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
15
+ const confirm = opts.confirm ?? clackConfirm;
16
+ let grant;
17
+ try {
18
+ grant = await acquireKey({
19
+ confirmSignIn: () => confirm(SIGN_IN_QUESTION, true),
20
+ ...(opts.home !== undefined ? { home: opts.home } : {}),
21
+ apiUrl: (opts.baseUrl ?? nolaApiUrl()).replace(/\/$/, ""),
22
+ ...(opts.fetch ? { fetch: opts.fetch } : {}),
23
+ interactive,
24
+ note: print ? err : out,
25
+ open: opts.open ?? openBrowser,
26
+ });
27
+ }
28
+ catch (e) {
29
+ err(e instanceof SignInRequiredError || e instanceof SignInUnavailableError || e instanceof SignInError
30
+ ? e.message
31
+ : `Could not get a Nola API key: ${e instanceof Error ? e.message : String(e)}`);
32
+ return 1;
33
+ }
34
+ if (print) {
35
+ out(grant.apiKey);
36
+ return 0;
37
+ }
38
+ out(grant.source === "trial" ? `New Nola account — ${grant.runs ?? 25} free runs.` : "Key minted on your Nola account.");
39
+ out(`NOLA_API_KEY=${grant.apiKey}`);
40
+ if (!interactive) {
41
+ out(NOT_WRITTEN);
42
+ return 0;
43
+ }
44
+ if ((await confirm(ADD_TO_ENV_QUESTION, true)) !== true) {
45
+ out(NOT_WRITTEN);
46
+ return 0;
47
+ }
48
+ const replace = (await hasEnvKey(cwd)) ? await confirm(REPLACE_ENV_QUESTION, false) : false;
49
+ if (replace === null) {
50
+ out(NOT_WRITTEN);
51
+ return 0;
52
+ }
53
+ const result = await writeEnvKey(cwd, grant.apiKey, { replace });
54
+ if (!result.wrote.includes(".env")) {
55
+ // only reachable when the existing key was kept
56
+ out(NOT_WRITTEN);
57
+ return 0;
58
+ }
59
+ out(`${replace ? "Replaced in" : "Added to"} .env.`);
60
+ return 0;
61
+ }
62
+ //# sourceMappingURL=key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.js","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,SAAS,EAET,UAAU,EACV,WAAW,E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QACjB,GAAG,CAAC,WAAW,CAAC,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,MAAM,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACxD,GAAG,CAAC,WAAW,CAAC,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5F,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,GAAG,CAAC,WAAW,CAAC,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,gDAAgD;QAChD,GAAG,CAAC,WAAW,CAAC,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,QAAQ,CAAC,CAAC;IACrD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type ClientInit } from "create-nola-lang";
2
+ /**
3
+ * `nola login` / `nola logout` (spec 2026-09-04-cli-sign-in-design.md §5).
4
+ * Login runs the Auth0 Authorization Code + PKCE flow (the browser opened
5
+ * best-effort onto a loopback callback, then waits; platform spec 2026-09-07),
6
+ * stores the session in ~/.nola/credentials.json, and — when the
7
+ * current directory's .env holds a NOLA_API_KEY — links that key's account to
8
+ * the user's account. Logout revokes best-effort and forgets the session.
9
+ */
10
+ export interface LoginOptions extends ClientInit {
11
+ /** the project directory whose .env may hold a key to claim; default "." */
12
+ cwd?: string;
13
+ /** the directory holding .nola/; default os.homedir() */
14
+ home?: string;
15
+ /** browser opener; default openBrowser */
16
+ open?: (url: string) => boolean;
17
+ out?: (line: string) => void;
18
+ err?: (line: string) => void;
19
+ }
20
+ export declare function cmdLogin(opts?: LoginOptions): Promise<number>;
21
+ export declare function cmdLogout(opts?: LoginOptions): Promise<number>;
22
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAShB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAID,wBAAsB,QAAQ,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAevE;AAED,wBAAsB,SAAS,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE"}
package/dist/login.js ADDED
@@ -0,0 +1,28 @@
1
+ import { claimNote, claimProjectKey, nolaApiUrl, openBrowser, SignInError, SignInUnavailableError, signIn, signOut, } from "create-nola-lang";
2
+ const describe = (e) => (e instanceof Error ? e.message : String(e));
3
+ export async function cmdLogin(opts = {}) {
4
+ const out = opts.out ?? ((line) => console.log(line));
5
+ const err = opts.err ?? ((line) => console.error(line));
6
+ const apiUrl = (opts.baseUrl ?? nolaApiUrl()).replace(/\/$/, "");
7
+ const auth = { ...(opts.home !== undefined ? { home: opts.home } : {}), apiUrl, ...(opts.fetch ? { fetch: opts.fetch } : {}) };
8
+ let accessToken;
9
+ try {
10
+ ({ accessToken } = await signIn({ ...auth, note: out, open: opts.open ?? openBrowser }));
11
+ }
12
+ catch (e) {
13
+ err(e instanceof SignInUnavailableError || e instanceof SignInError ? e.message : `Could not sign in: ${describe(e)}`);
14
+ return 1;
15
+ }
16
+ const claim = await claimProjectKey(opts.cwd ?? ".", accessToken, auth);
17
+ if (claim)
18
+ out(claimNote(claim));
19
+ return 0;
20
+ }
21
+ export async function cmdLogout(opts = {}) {
22
+ const out = opts.out ?? ((line) => console.log(line));
23
+ const apiUrl = (opts.baseUrl ?? nolaApiUrl()).replace(/\/$/, "");
24
+ const result = await signOut({ ...(opts.home !== undefined ? { home: opts.home } : {}), apiUrl, ...(opts.fetch ? { fetch: opts.fetch } : {}) });
25
+ out(result === "signed-out" ? "Signed out of Nola." : "Not signed in.");
26
+ return 0;
27
+ }
28
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,MAAM,EACN,OAAO,GACR,MAAM,kBAAkB,CAAC;AAqB1B,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtF,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAqB,EAAE;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,G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CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAqB,EAAE;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAChJ,GAAG,CAAC,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACxE,OAAO,CAAC,CAAC;AACX,CAAC"}
package/dist/main.js CHANGED
@@ -1,89 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { parseArgs } from "node:util";
3
- import { cmdBuild } from "./build.js";
4
- import { cmdCheck } from "./check.js";
5
- import { emitAdjacentDeclarations } from "./declarations.js";
6
- import { cmdInit } from "./init.js";
7
- import { cmdRun } from "./run.js";
8
- import { cmdSkill } from "./skill.js";
9
- const HELP = `nola <command>
10
-
11
- Commands:
12
- init [dir] [--template <t>|--add] [--ide vscode] [--agents <list>] scaffold or retrofit a Nola project
13
- skill install [--agents <list>] [--force] write agent skill files (Claude Code, Cursor, Copilot, AGENTS.md) into the project
14
- build [dir] [--out <dir>] compile all .tsi files (js+map+d.ts to --out)
15
- run <entry> run a .tsi/.js entry with the Nola loader + nola.config.ts
16
- check [dir] type-check lowered .tsi files AND the project's .ts files, positions mapped back
17
- declarations [dir] [--watch] emit <name>.d.tsi.ts next to each .tsi so plain tsc resolves .tsi imports (allowArbitraryExtensions)
18
- `;
19
- async function main() {
20
- const { positionals, values } = parseArgs({
21
- allowPositionals: true,
22
- options: {
23
- out: { type: "string", default: "dist" },
24
- template: { type: "string" },
25
- add: { type: "boolean" },
26
- ide: { type: "string" },
27
- watch: { type: "boolean" },
28
- agents: { type: "string" },
29
- force: { type: "boolean" },
30
- },
31
- });
32
- const [command, arg] = positionals;
33
- switch (command) {
34
- case "build": {
35
- const { written, errors } = await cmdBuild(arg ?? ".", values.out);
36
- if (errors.length > 0) {
37
- console.error(errors.join("\n\n"));
38
- return 1;
39
- }
40
- console.log(`nola build: ${written.length} files written`);
41
- return 0;
42
- }
43
- case "check": {
44
- const { errors } = await cmdCheck(arg ?? ".");
45
- if (errors.length > 0) {
46
- console.error(errors.join("\n"));
47
- return 1;
48
- }
49
- console.log("nola check: no errors");
50
- return 0;
51
- }
52
- case "declarations": {
53
- const run = async () => {
54
- const { written, errors } = await emitAdjacentDeclarations(arg ?? ".");
55
- if (errors.length > 0) {
56
- console.error(errors.join("\n\n"));
57
- return 1;
58
- }
59
- console.log(`nola declarations: ${written.length} files written`);
60
- return 0;
61
- };
62
- const code = await run();
63
- if (!values.watch)
64
- return code;
65
- const { watch } = await import("node:fs");
66
- let timer;
67
- watch(arg ?? ".", { recursive: true }, (_event, name) => {
68
- if (name?.endsWith(".tsi")) {
69
- clearTimeout(timer);
70
- timer = setTimeout(run, 150);
71
- }
72
- });
73
- return await new Promise(() => { }); // watch runs until Ctrl-C
74
- }
75
- case "run":
76
- return cmdRun(arg ?? "");
77
- case "init":
78
- return cmdInit(arg, { template: values.template, add: values.add, ide: values.ide, agents: values.agents });
79
- case "skill":
80
- return cmdSkill(arg, { agents: values.agents, force: values.force });
81
- default:
82
- console.log(HELP);
83
- return command ? 1 : 0;
84
- }
85
- }
86
- main().then((code) => process.exit(code), (err) => {
2
+ import { NOLA_VERSION } from "@nola-lang/runtime";
3
+ import { dispatch } from "create-nola-lang";
4
+ import { COMMANDS } from "./commands.js";
5
+ dispatch(process.argv.slice(2), COMMANDS, { name: "nola", version: NOLA_VERSION }).then((code) => process.exit(code), (err) => {
87
6
  console.error(err instanceof Error ? err.message : String(err));
88
7
  process.exit(1);
89
8
  });
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,IAAI,GAAG;;;;;;;;;CASZ,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QACxC,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACP,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE;YACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5B,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YACxB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ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 @@
1
+ import { spawn as nodeSpawn } from "node:child_process";
2
+ export type Spawn = typeof nodeSpawn;
3
+ /**
4
+ * Open a URL in the user's default browser, detached, without waiting. Returns
5
+ * false when the opener could not be spawned — callers always print the URL
6
+ * too, so that is the fallback. (`cmd /c start "" <url>`: the empty string is
7
+ * the window title `start` would otherwise steal from the first quoted arg.)
8
+ */
9
+ export declare function openUrl(url: string, platform?: NodeJS.Platform, spawn?: Spawn): boolean;
10
+ //# sourceMappingURL=open-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../src/open-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,KAAK,GAAG,OAAO,SAAS,CAAC;AASrC;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,KAAK,GAAE,KAAiB,GAAG,OAAO,CAWpH"}
@@ -0,0 +1,26 @@
1
+ import { spawn as nodeSpawn } from "node:child_process";
2
+ /**
3
+ * `cmd /c` parses its command line: a bare `&` ends the command (`|`, `<`, `>`, `^`
4
+ * likewise), so an /authorize URL would reach `start` cut at its first `&`. A caret
5
+ * escapes each; `%` needs nothing (undefined %names% stay literal on a command line).
6
+ */
7
+ const forCmd = (url) => url.replace(/[&|<>^]/g, "^$&");
8
+ /**
9
+ * Open a URL in the user's default browser, detached, without waiting. Returns
10
+ * false when the opener could not be spawned — callers always print the URL
11
+ * too, so that is the fallback. (`cmd /c start "" <url>`: the empty string is
12
+ * the window title `start` would otherwise steal from the first quoted arg.)
13
+ */
14
+ export function openUrl(url, platform = process.platform, spawn = nodeSpawn) {
15
+ const [cmd, args] = platform === "win32" ? ["cmd", ["/c", "start", "", forCmd(url)]] : platform === "darwin" ? ["open", [url]] : ["xdg-open", [url]];
16
+ try {
17
+ const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
18
+ child.on("error", () => undefined);
19
+ child.unref();
20
+ return true;
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ }
26
+ //# sourceMappingURL=open-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-url.js","sourceRoot":"","sources":["../src/open-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW,EAAE,WAA4B,OAAO,CAAC,QAAQ,EAAE,QAAe,SAAS;IACzG,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GACf,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnI,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACnC,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Palette } from "create-nola-lang";
2
+ /**
3
+ * Colour the plain diagnostic text the commands compose (`printDiagnostics`
4
+ * output and `check`'s tsc lines) at print time, the way `styleOutro` does for
5
+ * the scaffold outro: the text itself stays colour-free — it is what tests
6
+ * and library callers see — and only the bin styles it. Lines that match no
7
+ * diagnostic shape pass through untouched.
8
+ */
9
+ export declare function styleDiagnostics(text: string, p: Palette): string;
10
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAShD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAgBjE"}
package/dist/style.js ADDED
@@ -0,0 +1,33 @@
1
+ // `path:line:col CODE: message` (build/check/declarations), or `path CODE: message`
2
+ // for the position-less reserved-companion refusal. The path is everything
3
+ // before the last `:line:col` — a Windows drive letter carries its own colon.
4
+ const HEAD = /^(.+?)(:\d+:\d+)? ((?:NOLA|TS)\d+): /;
5
+ const GUTTER = /^(\d+ \|)( .*)?$/;
6
+ const CARET = /^( *)\^$/;
7
+ /**
8
+ * Colour the plain diagnostic text the commands compose (`printDiagnostics`
9
+ * output and `check`'s tsc lines) at print time, the way `styleOutro` does for
10
+ * the scaffold outro: the text itself stays colour-free — it is what tests
11
+ * and library callers see — and only the bin styles it. Lines that match no
12
+ * diagnostic shape pass through untouched.
13
+ */
14
+ export function styleDiagnostics(text, p) {
15
+ return text
16
+ .split("\n")
17
+ .map((line) => {
18
+ const head = HEAD.exec(line);
19
+ if (head) {
20
+ const [whole, file, pos, code] = head;
21
+ return `${p.path(file)}${pos ? p.dim(pos) : ""} ${p.error(code)}: ${line.slice(whole.length)}`;
22
+ }
23
+ const gutter = GUTTER.exec(line);
24
+ if (gutter)
25
+ return `${p.dim(gutter[1])}${gutter[2] ?? ""}`;
26
+ const caret = CARET.exec(line);
27
+ if (caret)
28
+ return `${caret[1]}${p.error("^")}`;
29
+ return line;
30
+ })
31
+ .join("\n");
32
+ }
33
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,2EAA2E;AAC3E,8EAA8E;AAC9E,MAAM,IAAI,GAAG,sCAAsC,CAAC;AACpD,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAClC,MAAM,KAAK,GAAG,UAAU,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,CAAU;IACvD,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;YACtC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAc,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACrH,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM;YAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAW,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACrE,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK;YAAE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nola-lang",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "The Nola language toolchain: nola init/build/run/check and the Node loader for .tsi files",
5
5
  "keywords": [
6
6
  "nola",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "license": "Apache-2.0",
15
15
  "author": "Evgen Mykhailenko",
16
- "homepage": "https://github.com/nola-lang/nola#readme",
16
+ "homepage": "https://nola.sh",
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/nola-lang/nola.git",
@@ -43,12 +43,14 @@
43
43
  "dependencies": {
44
44
  "@ampproject/remapping": "^2.3.0",
45
45
  "@jridgewell/trace-mapping": "^0.3.25",
46
- "@nola-lang/ast": "0.1.4",
47
- "@nola-lang/compiler": "0.1.4",
48
- "@nola-lang/node-loader": "0.1.4",
49
- "@nola-lang/parser": "0.1.4",
50
- "@nola-lang/runtime": "0.1.4",
51
- "create-nola-lang": "0.1.4",
46
+ "@nola-lang/ast": "0.1.5",
47
+ "@nola-lang/compiler": "0.1.5",
48
+ "@nola-lang/console": "0.1.5",
49
+ "@nola-lang/core": "0.1.5",
50
+ "@nola-lang/node-loader": "0.1.5",
51
+ "@nola-lang/parser": "0.1.5",
52
+ "@nola-lang/runtime": "0.1.5",
53
+ "create-nola-lang": "0.1.5",
52
54
  "esbuild": "^0.25.0",
53
55
  "typescript": "^5.6.0"
54
56
  },