@rozie/cli 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dan Krieger and Rozie.js contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @rozie/cli
2
+
3
+ The Rozie codegen CLI. Compiles `.rozie` files to per-framework source artifacts (plus `.d.ts` sidecars and optional `.map` files) for libraries that prefer to ship pre-compiled per-framework npm packages rather than rely on a consumer-side build plugin.
4
+
5
+ ## Status
6
+
7
+ Shipped. The `rozie` binary exposes `build` and `watch` commands across all six targets (`vue`, `react`, `svelte`, `angular`, `solid`, `lit`). Output is byte-identical to the `@rozie/unplugin` and `@rozie/babel-plugin` entrypoints (gated by the `dist-parity` suite). Marked `@experimental` until v1.0.
8
+
9
+ ## Install
10
+
11
+ Not yet published to npm (current version `0.1.0`; publishing is gated on the public release workflow). Inside the monorepo it is available as the `rozie` bin.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # Compile a directory to React + Vue, emitting to dist/
17
+ rozie build src/components/ \
18
+ --target react,vue \
19
+ --out dist/
20
+
21
+ # Single file, single target (stdout when --out is omitted and only one of each)
22
+ rozie build src/Counter.rozie --target svelte
23
+
24
+ # Watch mode (long-running; --out is required)
25
+ rozie watch src/components/ --target react --out dist/
26
+ ```
27
+
28
+ ### Flags (`build` and `watch`)
29
+
30
+ | Flag | Notes |
31
+ | --- | --- |
32
+ | `-t, --target <names>` | Comma-separated list of `vue\|react\|svelte\|angular\|solid\|lit` (default `vue`). |
33
+ | `-o, --out <path>` | Output directory. Required when compiling multiple files or multiple targets (`ROZ852`); required for `target=react` because it emits sidecars (`ROZ855`); always required for `watch` (`ROZ856`). |
34
+ | `--source-map` | Emit `.map` sidecars (off by default). |
35
+ | `--no-types` | Skip `.d.ts` emission (React-only — inline-typed for Vue/Svelte/Angular). |
36
+ | `--pretty` | Format emitted artefacts with Prettier before write (off by default). |
37
+ | `--no-cva` | Angular-only: suppress the auto `ControlValueAccessor` emit on single-`model` components. No-op for other targets. |
38
+ | `--no-safe-interpolation` | Suppress the safe-interpolation `rozieDisplay` wrap (raw per-target emit; re-exposes the React object-child crash on non-primitive interpolation). No-op for Vue. |
39
+
40
+ ## Public exports
41
+
42
+ - `rozie` binary (`build`, `watch`)
43
+ - Programmatic entry from the package root for embedding the CLI in another tool.
44
+
45
+ For the build-plugin path (HMR, no pre-compile step), see [`@rozie/unplugin`](../unplugin). For Babel pipelines, see [`@rozie/babel-plugin`](../babel-plugin).
46
+
47
+ ## Links
48
+
49
+ - Project orientation: [`CLAUDE.md`](../../CLAUDE.md)
50
+ - Feature reference: [`docs/guide/features.md`](../../docs/guide/features.md)
51
+ - Roadmap: [`.planning/ROADMAP.md`](../../.planning/ROADMAP.md)
package/dist/bin.cjs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ //#region src/bin.ts
3
+ require("./src-CIv3UOaa.cjs").runCli(process.argv).catch((err) => {
4
+ console.error(err instanceof Error ? err.stack ?? err.message : String(err));
5
+ process.exit(1);
6
+ });
7
+ //#endregion
package/dist/bin.mjs ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { t as runCli } from "./src-WZKv4m5y.mjs";
3
+ //#region src/bin.ts
4
+ runCli(process.argv).catch((err) => {
5
+ console.error(err instanceof Error ? err.stack ?? err.message : String(err));
6
+ process.exit(1);
7
+ });
8
+ //#endregion
9
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_src = require("./src-CIv3UOaa.cjs");
3
+ exports.runBuild = require_src.runBuild;
4
+ exports.runBuildMany = require_src.runBuildMany;
5
+ exports.runBuildMatrix = require_src.runBuildMatrix;
6
+ exports.runCli = require_src.runCli;
7
+ exports.runWatch = require_src.runWatch;
@@ -0,0 +1,141 @@
1
+ //#region src/utils/parseTargets.d.ts
2
+ type Target = 'vue' | 'react' | 'svelte' | 'angular' | 'solid' | 'lit';
3
+ //#endregion
4
+ //#region src/commands/build.d.ts
5
+ /**
6
+ * Legacy single-target options shape — preserved for `runBuild` /
7
+ * `runBuildMany` backward-compat. New code should use `BuildOptionsExt`.
8
+ */
9
+ interface BuildOptions {
10
+ target?: string;
11
+ out?: string;
12
+ sourceMap?: boolean;
13
+ }
14
+ /**
15
+ * Phase 6 multi-target options shape consumed by `runBuildMatrix`.
16
+ * Commander's `parseTargets` produces `target: Target[]`; programmatic callers
17
+ * may pass either a single `Target` (e.g., from `runBuild`) or `Target[]`.
18
+ */
19
+ interface BuildOptionsExt {
20
+ target?: Target | Target[];
21
+ out?: string;
22
+ /** D-91 default false — emit .map sidecars only when explicitly opted in. */
23
+ sourceMap?: boolean;
24
+ /** D-90 default true — emit .d.ts sidecars; --no-types maps to false. */
25
+ types?: boolean;
26
+ /** Project root used for source-rel-path computation; defaults to process.cwd(). */
27
+ root?: string;
28
+ /**
29
+ * Opt-in: format emitted artefacts through prettier before write.
30
+ * Off by default per PROJECT.md "Out of Scope" — v1's bar is "just
31
+ * works", not "pretty output". When ON, applies prettier core to .tsx /
32
+ * .ts / .d.ts / .vue / .css sidecars, and prettier-plugin-svelte to
33
+ * .svelte. Source-map sidecars (.map) are never reformatted (spec-
34
+ * required field ordering). Prettier failures degrade gracefully:
35
+ * raw output is written and a warning prints to stderr.
36
+ */
37
+ pretty?: boolean;
38
+ /**
39
+ * Phase 23 — Angular-only opt-out for the auto `ControlValueAccessor` emit.
40
+ * Default ON (undefined/true): single-model Angular components auto-emit the
41
+ * CVA shape. `false` maps to `compile({ angular: { cva: false } })` and
42
+ * suppresses ALL CVA emit. Omitting it entirely exercises the emitter-side
43
+ * `opts.cva ?? true` default — byte-identical to the unplugin/babel-plugin
44
+ * default-ON path (dist-parity contract). No-op for non-Angular targets.
45
+ */
46
+ cva?: boolean;
47
+ /**
48
+ * Phase 26 (D-11) — the GLOBAL safe-interpolation opt-out. Default ON
49
+ * (undefined/true): non-provably-primitive interpolations are wrapped in the
50
+ * injected `rozieDisplay` helper on the five non-Vue targets. `false` maps to
51
+ * `compile({ safeInterpolation: false })` and reverts to raw per-target emit.
52
+ * Omitting it entirely exercises the lowerer-side `?? true` default —
53
+ * byte-identical to the unplugin/babel-plugin default-ON path. No-op for Vue.
54
+ */
55
+ safeInterpolation?: boolean;
56
+ }
57
+ interface RunBuildContext {
58
+ /** When 'throw', exits become thrown BuildExit instead of process.exit. */
59
+ exit?: 'process' | 'throw';
60
+ /** stderr sink override — defaults to process.stderr.write. */
61
+ stderrWrite?: (chunk: string) => void;
62
+ /** stdout sink override — defaults to process.stdout.write. */
63
+ stdoutWrite?: (chunk: string) => void;
64
+ }
65
+ /**
66
+ * Phase 6 D-87/D-88/D-89/D-90/D-91/D-93 — the canonical build coordinator.
67
+ *
68
+ * @param inputArgs positional args (files, directories, or globs)
69
+ * @param opts parsed options (target list, out, sourceMap, types, root)
70
+ * @param ctx test-injection sinks + exit-mode toggle
71
+ */
72
+ declare function runBuildMatrix(inputArgs: string[], opts?: BuildOptionsExt, ctx?: RunBuildContext): Promise<void>;
73
+ /**
74
+ * Single-input single-target build — backward-compat thin wrapper around
75
+ * `runBuildMatrix`. Kept stable for the existing test suite + CLI tests
76
+ * predating Phase 6.
77
+ */
78
+ declare function runBuild(input: string, opts?: BuildOptions, ctx?: RunBuildContext): Promise<void>;
79
+ /**
80
+ * Multi-input single-target build — backward-compat thin wrapper around
81
+ * `runBuildMatrix`. The original semantics required `--out <dir>` for
82
+ * multi-input invocations; runBuildMatrix preserves that via the D-89 guard.
83
+ */
84
+ declare function runBuildMany(inputs: string[], opts?: BuildOptions, ctx?: RunBuildContext): Promise<void>;
85
+ //#endregion
86
+ //#region src/commands/watch.d.ts
87
+ interface WatchOptions {
88
+ target?: Target | Target[];
89
+ out?: string;
90
+ /** D-91 default false. */
91
+ sourceMap?: boolean;
92
+ /** D-90 default true. */
93
+ types?: boolean;
94
+ /** Project root for source-rel-path computation; defaults to process.cwd(). */
95
+ root?: string;
96
+ /**
97
+ * Off by default per PROJECT.md "Out of Scope" carve-out. Pipes the
98
+ * per-change emit through prettier before write. Failures degrade
99
+ * gracefully — raw output still lands on disk + a stderr warning fires.
100
+ */
101
+ pretty?: boolean;
102
+ /**
103
+ * Phase 23 — Angular-only opt-out for the auto `ControlValueAccessor` emit.
104
+ * Default ON; `false` maps to `compile({ angular: { cva: false } })`.
105
+ * Mirrors the `rozie build` flag. No-op for non-Angular targets.
106
+ */
107
+ cva?: boolean;
108
+ /**
109
+ * Phase 26 (D-11) — the GLOBAL safe-interpolation opt-out. Default ON;
110
+ * `false` maps to `compile({ safeInterpolation: false })`. Mirrors the
111
+ * `rozie build` flag. No-op for the Vue target.
112
+ */
113
+ safeInterpolation?: boolean;
114
+ }
115
+ interface RunWatchContext {
116
+ /** When 'throw', invalid-arg exits become thrown errors (vitest-friendly). */
117
+ exit?: 'process' | 'throw';
118
+ stderrWrite?: (chunk: string) => void;
119
+ stdoutWrite?: (chunk: string) => void;
120
+ /**
121
+ * Test injection — when this AbortSignal fires, the watcher closes and
122
+ * runWatch() resolves. Lets vitest drive the lifecycle without sending
123
+ * real OS signals to the test process.
124
+ */
125
+ signal?: AbortSignal;
126
+ }
127
+ /**
128
+ * `rozie watch <inputs...>` entry point. Performs one initial build of
129
+ * the matched input set, then watches for changes and recompiles per
130
+ * file. Resolves on graceful shutdown (SIGINT/SIGTERM or ctx.signal).
131
+ */
132
+ declare function runWatch(inputArgs: string[], opts?: WatchOptions, ctx?: RunWatchContext): Promise<void>;
133
+ //#endregion
134
+ //#region src/index.d.ts
135
+ /**
136
+ * Programmatic entry — constructs the commander program and parses argv.
137
+ * `argv` follows Node's `process.argv` shape (argv[0]=node, argv[1]=script).
138
+ */
139
+ declare function runCli(argv: readonly string[]): Promise<void>;
140
+ //#endregion
141
+ export { type BuildOptions, type BuildOptionsExt, type WatchOptions, runBuild, runBuildMany, runBuildMatrix, runCli, runWatch };
@@ -0,0 +1,141 @@
1
+ //#region src/utils/parseTargets.d.ts
2
+ type Target = 'vue' | 'react' | 'svelte' | 'angular' | 'solid' | 'lit';
3
+ //#endregion
4
+ //#region src/commands/build.d.ts
5
+ /**
6
+ * Legacy single-target options shape — preserved for `runBuild` /
7
+ * `runBuildMany` backward-compat. New code should use `BuildOptionsExt`.
8
+ */
9
+ interface BuildOptions {
10
+ target?: string;
11
+ out?: string;
12
+ sourceMap?: boolean;
13
+ }
14
+ /**
15
+ * Phase 6 multi-target options shape consumed by `runBuildMatrix`.
16
+ * Commander's `parseTargets` produces `target: Target[]`; programmatic callers
17
+ * may pass either a single `Target` (e.g., from `runBuild`) or `Target[]`.
18
+ */
19
+ interface BuildOptionsExt {
20
+ target?: Target | Target[];
21
+ out?: string;
22
+ /** D-91 default false — emit .map sidecars only when explicitly opted in. */
23
+ sourceMap?: boolean;
24
+ /** D-90 default true — emit .d.ts sidecars; --no-types maps to false. */
25
+ types?: boolean;
26
+ /** Project root used for source-rel-path computation; defaults to process.cwd(). */
27
+ root?: string;
28
+ /**
29
+ * Opt-in: format emitted artefacts through prettier before write.
30
+ * Off by default per PROJECT.md "Out of Scope" — v1's bar is "just
31
+ * works", not "pretty output". When ON, applies prettier core to .tsx /
32
+ * .ts / .d.ts / .vue / .css sidecars, and prettier-plugin-svelte to
33
+ * .svelte. Source-map sidecars (.map) are never reformatted (spec-
34
+ * required field ordering). Prettier failures degrade gracefully:
35
+ * raw output is written and a warning prints to stderr.
36
+ */
37
+ pretty?: boolean;
38
+ /**
39
+ * Phase 23 — Angular-only opt-out for the auto `ControlValueAccessor` emit.
40
+ * Default ON (undefined/true): single-model Angular components auto-emit the
41
+ * CVA shape. `false` maps to `compile({ angular: { cva: false } })` and
42
+ * suppresses ALL CVA emit. Omitting it entirely exercises the emitter-side
43
+ * `opts.cva ?? true` default — byte-identical to the unplugin/babel-plugin
44
+ * default-ON path (dist-parity contract). No-op for non-Angular targets.
45
+ */
46
+ cva?: boolean;
47
+ /**
48
+ * Phase 26 (D-11) — the GLOBAL safe-interpolation opt-out. Default ON
49
+ * (undefined/true): non-provably-primitive interpolations are wrapped in the
50
+ * injected `rozieDisplay` helper on the five non-Vue targets. `false` maps to
51
+ * `compile({ safeInterpolation: false })` and reverts to raw per-target emit.
52
+ * Omitting it entirely exercises the lowerer-side `?? true` default —
53
+ * byte-identical to the unplugin/babel-plugin default-ON path. No-op for Vue.
54
+ */
55
+ safeInterpolation?: boolean;
56
+ }
57
+ interface RunBuildContext {
58
+ /** When 'throw', exits become thrown BuildExit instead of process.exit. */
59
+ exit?: 'process' | 'throw';
60
+ /** stderr sink override — defaults to process.stderr.write. */
61
+ stderrWrite?: (chunk: string) => void;
62
+ /** stdout sink override — defaults to process.stdout.write. */
63
+ stdoutWrite?: (chunk: string) => void;
64
+ }
65
+ /**
66
+ * Phase 6 D-87/D-88/D-89/D-90/D-91/D-93 — the canonical build coordinator.
67
+ *
68
+ * @param inputArgs positional args (files, directories, or globs)
69
+ * @param opts parsed options (target list, out, sourceMap, types, root)
70
+ * @param ctx test-injection sinks + exit-mode toggle
71
+ */
72
+ declare function runBuildMatrix(inputArgs: string[], opts?: BuildOptionsExt, ctx?: RunBuildContext): Promise<void>;
73
+ /**
74
+ * Single-input single-target build — backward-compat thin wrapper around
75
+ * `runBuildMatrix`. Kept stable for the existing test suite + CLI tests
76
+ * predating Phase 6.
77
+ */
78
+ declare function runBuild(input: string, opts?: BuildOptions, ctx?: RunBuildContext): Promise<void>;
79
+ /**
80
+ * Multi-input single-target build — backward-compat thin wrapper around
81
+ * `runBuildMatrix`. The original semantics required `--out <dir>` for
82
+ * multi-input invocations; runBuildMatrix preserves that via the D-89 guard.
83
+ */
84
+ declare function runBuildMany(inputs: string[], opts?: BuildOptions, ctx?: RunBuildContext): Promise<void>;
85
+ //#endregion
86
+ //#region src/commands/watch.d.ts
87
+ interface WatchOptions {
88
+ target?: Target | Target[];
89
+ out?: string;
90
+ /** D-91 default false. */
91
+ sourceMap?: boolean;
92
+ /** D-90 default true. */
93
+ types?: boolean;
94
+ /** Project root for source-rel-path computation; defaults to process.cwd(). */
95
+ root?: string;
96
+ /**
97
+ * Off by default per PROJECT.md "Out of Scope" carve-out. Pipes the
98
+ * per-change emit through prettier before write. Failures degrade
99
+ * gracefully — raw output still lands on disk + a stderr warning fires.
100
+ */
101
+ pretty?: boolean;
102
+ /**
103
+ * Phase 23 — Angular-only opt-out for the auto `ControlValueAccessor` emit.
104
+ * Default ON; `false` maps to `compile({ angular: { cva: false } })`.
105
+ * Mirrors the `rozie build` flag. No-op for non-Angular targets.
106
+ */
107
+ cva?: boolean;
108
+ /**
109
+ * Phase 26 (D-11) — the GLOBAL safe-interpolation opt-out. Default ON;
110
+ * `false` maps to `compile({ safeInterpolation: false })`. Mirrors the
111
+ * `rozie build` flag. No-op for the Vue target.
112
+ */
113
+ safeInterpolation?: boolean;
114
+ }
115
+ interface RunWatchContext {
116
+ /** When 'throw', invalid-arg exits become thrown errors (vitest-friendly). */
117
+ exit?: 'process' | 'throw';
118
+ stderrWrite?: (chunk: string) => void;
119
+ stdoutWrite?: (chunk: string) => void;
120
+ /**
121
+ * Test injection — when this AbortSignal fires, the watcher closes and
122
+ * runWatch() resolves. Lets vitest drive the lifecycle without sending
123
+ * real OS signals to the test process.
124
+ */
125
+ signal?: AbortSignal;
126
+ }
127
+ /**
128
+ * `rozie watch <inputs...>` entry point. Performs one initial build of
129
+ * the matched input set, then watches for changes and recompiles per
130
+ * file. Resolves on graceful shutdown (SIGINT/SIGTERM or ctx.signal).
131
+ */
132
+ declare function runWatch(inputArgs: string[], opts?: WatchOptions, ctx?: RunWatchContext): Promise<void>;
133
+ //#endregion
134
+ //#region src/index.d.ts
135
+ /**
136
+ * Programmatic entry — constructs the commander program and parses argv.
137
+ * `argv` follows Node's `process.argv` shape (argv[0]=node, argv[1]=script).
138
+ */
139
+ declare function runCli(argv: readonly string[]): Promise<void>;
140
+ //#endregion
141
+ export { type BuildOptions, type BuildOptionsExt, type WatchOptions, runBuild, runBuildMany, runBuildMatrix, runCli, runWatch };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { a as runBuildMatrix, i as runBuildMany, n as runWatch, r as runBuild, t as runCli } from "./src-WZKv4m5y.mjs";
2
+ export { runBuild, runBuildMany, runBuildMatrix, runCli, runWatch };