cronus-ui 0.6.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 +21 -0
- package/README.md +90 -0
- package/dist/commands/add-page.d.ts +108 -0
- package/dist/commands/add-page.js +642 -0
- package/dist/commands/add.d.ts +9 -0
- package/dist/commands/add.js +114 -0
- package/dist/commands/ai.d.ts +14 -0
- package/dist/commands/ai.js +69 -0
- package/dist/commands/compose.d.ts +82 -0
- package/dist/commands/compose.js +403 -0
- package/dist/commands/diff.d.ts +8 -0
- package/dist/commands/diff.js +55 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +53 -0
- package/dist/commands/list.d.ts +7 -0
- package/dist/commands/list.js +28 -0
- package/dist/commands/theme.d.ts +23 -0
- package/dist/commands/theme.js +735 -0
- package/dist/commands/upgrade.d.ts +51 -0
- package/dist/commands/upgrade.js +840 -0
- package/dist/compose/data-slots.d.ts +71 -0
- package/dist/compose/data-slots.js +104 -0
- package/dist/compose/manifest.d.ts +90 -0
- package/dist/compose/manifest.js +224 -0
- package/dist/compose/plan.d.ts +164 -0
- package/dist/compose/plan.js +506 -0
- package/dist/compose/preview.d.ts +10 -0
- package/dist/compose/preview.js +48 -0
- package/dist/compose/reload.d.ts +56 -0
- package/dist/compose/reload.js +138 -0
- package/dist/compose/render.d.ts +123 -0
- package/dist/compose/render.js +404 -0
- package/dist/compose/templates.d.ts +22 -0
- package/dist/compose/templates.js +76 -0
- package/dist/compose.d.ts +10 -0
- package/dist/compose.js +8 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.js +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +184 -0
- package/dist/registry.d.ts +59 -0
- package/dist/registry.js +96 -0
- package/dist/utils.d.ts +72 -0
- package/dist/utils.js +186 -0
- package/package.json +68 -0
- package/templates/apps/chat.json +44 -0
- package/templates/apps/finance.json +44 -0
- package/templates/apps/landing-agency.json +31 -0
- package/templates/apps/landing-agents.json +32 -0
- package/templates/apps/landing-broadcast.json +29 -0
- package/templates/apps/landing-care.json +28 -0
- package/templates/apps/landing-coverage.json +23 -0
- package/templates/apps/landing-docs.json +29 -0
- package/templates/apps/landing-glass.json +28 -0
- package/templates/apps/landing-ops.json +29 -0
- package/templates/apps/landing-premium.json +31 -0
- package/templates/apps/landing-secure.json +31 -0
- package/templates/apps/landing-shop.json +27 -0
- package/templates/apps/landing-studio.json +30 -0
- package/templates/apps/landing.json +23 -0
- package/templates/apps/mail.json +44 -0
- package/templates/apps/saas.json +64 -0
- package/templates/apps/store.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cronus
|
|
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,90 @@
|
|
|
1
|
+
# cronus-ui (CLI)
|
|
2
|
+
|
|
3
|
+
Add Cronus UI to a project: copy components in, compose an app from validated
|
|
4
|
+
blocks, switch theme, and upgrade without losing local edits.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npx cronus-ui init
|
|
8
|
+
npx cronus-ui add button card
|
|
9
|
+
npx cronus-ui compose saas --brand Acme
|
|
10
|
+
npx cronus-ui add-page --route /faq --blocks faq,cta --nav FAQ
|
|
11
|
+
npx cronus-ui theme set aurora --mode dark
|
|
12
|
+
npx cronus-ui upgrade --all --dry-run
|
|
13
|
+
npx cronus-ui list
|
|
14
|
+
npx cronus-ui diff
|
|
15
|
+
npx cronus-ui ai
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The canonical product start is `npx create-cronus-app my-app --template saas`,
|
|
19
|
+
which scaffolds and then composes. This CLI is what that path calls, and what
|
|
20
|
+
you keep using after.
|
|
21
|
+
|
|
22
|
+
## Commands & flags
|
|
23
|
+
|
|
24
|
+
| Command | Args | Flags |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `init` | — | `-c, --cwd <dir>` · `-r, --registry <source>` · `-y, --yes` · `--skip-install` |
|
|
27
|
+
| `add` | `[components...]` | `-c, --cwd <dir>` · `-r, --registry <source>` · `-o, --overwrite` · `--skip-install` |
|
|
28
|
+
| `compose` | `[template]` | `-c, --cwd <dir>` · `-r, --registry <source>` · `-m, --manifest <file>` · `--pages <list>` · `--variant <pair...>` · `-b, --brand <name>` · `-s, --seed <n>` · `-o, --overwrite` · `--skip-install` · `--dry-run` · `-y, --yes` |
|
|
29
|
+
| `add-page` | — | `--route <route>` (required) · `--blocks <list>` (required) · `-c, --cwd <dir>` · `-r, --registry <source>` · `--chrome <group>` · `--title <title>` · `--nav <label>` · `--app <name>` · `-m, --manifest <file>` · `-o, --overwrite` · `--skip-install` · `--dry-run` |
|
|
30
|
+
| `list` (`ls`) | — | `-c, --cwd <dir>` · `-r, --registry <source>` |
|
|
31
|
+
| `diff` | `[components...]` | `-c, --cwd <dir>` · `-r, --registry <source>` |
|
|
32
|
+
| `upgrade` | `[components...]` | `-c, --cwd <dir>` · `-r, --registry <source>` · `-a, --all` · `--dry-run` · `-y, --yes` · `-o, --overwrite` |
|
|
33
|
+
| `theme set` | `<name>` | `-m, --mode <mode>` · `-c, --cwd <dir>` |
|
|
34
|
+
| `theme add` | `<source>` | `-c, --cwd <dir>` · `--css <file>` · `--dry-run` |
|
|
35
|
+
| `ai` | — | `-c, --cwd <dir>` · `-a, --assistants <list>` · `-p, --preset <name>` · `-s, --skills <list>` |
|
|
36
|
+
|
|
37
|
+
Notes that match the commander surface:
|
|
38
|
+
|
|
39
|
+
- `compose [template]` — bundled names include `store`, `landing`, `saas`. `--pages` is a comma-separated route subset (e.g. `/,products,login`). `--variant` is repeatable (`login=split`). `--dry-run` prints the validated plan and writes nothing. `-y` picks the first template when none is given.
|
|
40
|
+
- `add-page` grows an already-composed app. `--blocks` is comma-separated (`faq,cta` or `login=split`). `--app` is required when the project has more than one composed app.
|
|
41
|
+
- `theme set <name>` — `aurora`, `neutral`, `midnight`, `sunset`, `emerald`. `--mode` is `dark` or `light`.
|
|
42
|
+
- `theme add <source>` — a Create Studio permalink, a bare `c=` payload, or a path to an exported theme JSON file.
|
|
43
|
+
- `upgrade` 3-way merges each installed file against the release recorded in `cronus-ui.json`. `-a, --all` upgrades every recorded component and 3-way-merges composed pages/layouts against `.cronus-ui/base`. `-o, --overwrite` replaces files installed before the manifest existed. Unresolved files get a prompt in `CRONUS-UPGRADE.md`.
|
|
44
|
+
- `ai --assistants` is comma-separated `claude`, `cursor`, `copilot`, `windsurf`, `gemini` (or `all` / `none`). `--preset` is `standard` (default), `fintech`, `saas`, `oss`, `agency`, or `none`. `--skills` is comma-separated Claude Code skills (or `all` / `none`).
|
|
45
|
+
|
|
46
|
+
## How it works
|
|
47
|
+
|
|
48
|
+
- The registry (`registry/*.json`) is generated from the real `@cronus-ui/ui` sources by
|
|
49
|
+
`packages/cli/scripts/build-registry.ts` — each item carries its source, its npm
|
|
50
|
+
`dependencies`, and its `registryDependencies` (other components it imports),
|
|
51
|
+
derived by parsing imports.
|
|
52
|
+
- The default registry is pinned to the CLI package version (`v0.6.0` here), not
|
|
53
|
+
mutable `main`, so a published CLI reads the registry snapshot it was released
|
|
54
|
+
with. Use `-r, --registry ./registry` when testing local registry changes before
|
|
55
|
+
a release tag exists.
|
|
56
|
+
- `init` installs only the base copy dependencies used by generated components
|
|
57
|
+
(`clsx`, `tailwind-merge`, `class-variance-authority`, and Radix Slot). It does
|
|
58
|
+
not install the public Cronus token and theme packages unless you add them
|
|
59
|
+
separately for runtime theming.
|
|
60
|
+
- `add` resolves the transitive closure of `registryDependencies`, writes the files
|
|
61
|
+
into your project, and **rewrites imports to your aliases**:
|
|
62
|
+
`../lib/cn.js → @/lib/cn`, `./button.js → @/components/ui/button`.
|
|
63
|
+
- It then installs the collected npm dependencies with your package manager
|
|
64
|
+
(bun / pnpm / yarn / npm, auto-detected).
|
|
65
|
+
- `compose` generates pages that are only imports of installed blocks plus a
|
|
66
|
+
`<main>` that stacks them. Visible UI comes from registry items, not from
|
|
67
|
+
composer-emitted JSX.
|
|
68
|
+
|
|
69
|
+
## Config (`cronus-ui.json`)
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"aliases": {
|
|
74
|
+
"ui": "@/components/ui",
|
|
75
|
+
"lib": "@/lib",
|
|
76
|
+
"blocks": "@/components/blocks"
|
|
77
|
+
},
|
|
78
|
+
"paths": {
|
|
79
|
+
"ui": "components/ui",
|
|
80
|
+
"lib": "lib",
|
|
81
|
+
"blocks": "components/blocks"
|
|
82
|
+
},
|
|
83
|
+
"registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.0/registry"
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Point `-r, --registry <path-or-url>` at a local `registry/` directory for offline use
|
|
88
|
+
or testing. Regenerate the registry after changing components:
|
|
89
|
+
`bun run -F cronus-ui registry`. Verify it is in sync locally with
|
|
90
|
+
`bun run -F cronus-ui registry:check`.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cronus-ui add-page` — incrementally add ONE page to an already-composed app
|
|
3
|
+
* (D3 graft, F2). It reuses the exact compose plan/render/install core: it
|
|
4
|
+
* reconstructs the app's manifest (chrome + already-composed pages), appends the
|
|
5
|
+
* new page, re-plans + re-validates the WHOLE app (so the new page's chrome ref,
|
|
6
|
+
* route uniqueness, and block kinds are checked against the real chrome and its
|
|
7
|
+
* siblings), then applies ONLY the incremental delta:
|
|
8
|
+
* - install any new blocks the page needs (unchanged install core);
|
|
9
|
+
* - write the new page.tsx (+ its layout/chrome wrappers when the page uses a
|
|
10
|
+
* chrome group the app did not have yet);
|
|
11
|
+
* - RE-INJECT the affected chrome block's nav data-slot so the new `--nav`
|
|
12
|
+
* entry appears in the navbar/footer/sidebar;
|
|
13
|
+
* - grow `composed{}.choices.pages` + `composed{}.files` (union) + the base
|
|
14
|
+
* snapshot for the new/rewritten files.
|
|
15
|
+
*
|
|
16
|
+
* It never re-writes untouched sibling pages (their bytes are unchanged), and it
|
|
17
|
+
* fails loud when there is no composed app, the app cannot be reloaded, or the
|
|
18
|
+
* route collides (unless `--overwrite`). Determinism + the golden rule are
|
|
19
|
+
* inherited wholesale from the shared renderer.
|
|
20
|
+
*/
|
|
21
|
+
import { type BlockRef } from "../compose/manifest.js";
|
|
22
|
+
/** Options accepted by the addPage library entry + the CLI command. */
|
|
23
|
+
export interface AddPageOptions {
|
|
24
|
+
/** Project root (must contain cronus-ui.json with a composed app). */
|
|
25
|
+
targetDir: string;
|
|
26
|
+
/** New route to add, e.g. "/faq". */
|
|
27
|
+
route: string;
|
|
28
|
+
/** Block refs stacked in the page (strings or `{ block, variant }`). */
|
|
29
|
+
blocks: BlockRef[];
|
|
30
|
+
/** Chrome group key for the page; defaults to the app's first chrome group. */
|
|
31
|
+
chrome?: string;
|
|
32
|
+
/** <title> for the page; defaults to a Title-Cased slug from the route. */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Nav label; when set the page joins the chrome nav (data-slot re-injected). */
|
|
35
|
+
nav?: string;
|
|
36
|
+
/** Which composed app to extend (its `composed{}` key); required if >1 exists. */
|
|
37
|
+
app?: string;
|
|
38
|
+
/** Reload the manifest from this file instead of a bundled template. */
|
|
39
|
+
manifestPath?: string;
|
|
40
|
+
/** Overwrite an existing page file at the route (default false). */
|
|
41
|
+
overwrite?: boolean;
|
|
42
|
+
/** Skip the npm install step (default false). */
|
|
43
|
+
skipInstall?: boolean;
|
|
44
|
+
/** Override the registry source (else the project config's). */
|
|
45
|
+
registry?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Result of a successful add-page (for programmatic callers / tests). */
|
|
48
|
+
export interface AddPageResult {
|
|
49
|
+
/** The composed app the page was added to (the `composed{}` key). */
|
|
50
|
+
appName: string;
|
|
51
|
+
/** The added route. */
|
|
52
|
+
route: string;
|
|
53
|
+
/** Files freshly written (new page, any new layout/wrapper, rewritten chrome). */
|
|
54
|
+
generatedFiles: string[];
|
|
55
|
+
/** Files skipped (already existed, no --overwrite). */
|
|
56
|
+
skippedFiles: string[];
|
|
57
|
+
/** Registry block items newly installed for the page. */
|
|
58
|
+
installedBlocks: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Add one page to an already-composed app. Reloads the manifest, appends the new
|
|
62
|
+
* page, re-plans + re-validates the whole app, then writes ONLY the incremental
|
|
63
|
+
* delta (new page + any new layout/wrapper + the re-injected chrome nav) and
|
|
64
|
+
* grows `composed{}` + the base snapshot. Throws {@link ComposePlanError} /
|
|
65
|
+
* {@link Error} on invalid input.
|
|
66
|
+
*/
|
|
67
|
+
export declare function addPage(options: AddPageOptions): Promise<AddPageResult>;
|
|
68
|
+
/** CLI-facing options (flags parsed by commander in index.ts). */
|
|
69
|
+
export interface AddPageCommandOptions {
|
|
70
|
+
cwd: string;
|
|
71
|
+
route?: string;
|
|
72
|
+
blocks?: string;
|
|
73
|
+
chrome?: string;
|
|
74
|
+
title?: string;
|
|
75
|
+
nav?: string;
|
|
76
|
+
app?: string;
|
|
77
|
+
manifest?: string;
|
|
78
|
+
overwrite?: boolean;
|
|
79
|
+
skipInstall?: boolean;
|
|
80
|
+
dryRun?: boolean;
|
|
81
|
+
registry?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Parse the `--blocks hero,cta` / `--blocks login=split,cta` spec into block refs.
|
|
85
|
+
* A `slug=variant` token becomes `{ block, variant }`; a bare token stays a string
|
|
86
|
+
* (default variant). Empty tokens are dropped; an empty spec throws.
|
|
87
|
+
*/
|
|
88
|
+
export declare function parseBlockRefs(spec: string | undefined): BlockRef[];
|
|
89
|
+
/**
|
|
90
|
+
* The `cronus-ui add-page` command: adds ONE page to a composed app, or previews
|
|
91
|
+
* it with `--dry-run` (writes nothing). Aggregated plan errors are printed as a
|
|
92
|
+
* list, like `compose`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function addPageCommand(options: AddPageCommandOptions): Promise<void>;
|
|
95
|
+
/** A dry-run preview of an add-page: the files it would write + blocks it would install. */
|
|
96
|
+
export interface AddPagePreview {
|
|
97
|
+
appName: string;
|
|
98
|
+
route: string;
|
|
99
|
+
wouldWrite: string[];
|
|
100
|
+
wouldInstall: string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Plan the add-page (validating everything) and return the files it WOULD write
|
|
104
|
+
* and blocks it WOULD install, without touching the filesystem. Reuses the same
|
|
105
|
+
* reload + synthesize + plan path as {@link addPage}.
|
|
106
|
+
*/
|
|
107
|
+
export declare function previewAddPage(options: Omit<AddPageOptions, "skipInstall">): Promise<AddPagePreview>;
|
|
108
|
+
//# sourceMappingURL=add-page.d.ts.map
|