@g3nomaly/ui 0.3.2 → 0.3.4

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.
Files changed (125) hide show
  1. package/README.md +145 -0
  2. package/dist/cli/adapter.d.ts +14 -6
  3. package/dist/cli/adapter.d.ts.map +1 -1
  4. package/dist/cli/adapter.js +23 -18
  5. package/dist/cli/adapter.js.map +1 -1
  6. package/dist/cli/afterInstall.d.ts +26 -0
  7. package/dist/cli/afterInstall.d.ts.map +1 -0
  8. package/dist/cli/afterInstall.js +54 -0
  9. package/dist/cli/afterInstall.js.map +1 -0
  10. package/dist/cli/commands/add.d.ts +8 -2
  11. package/dist/cli/commands/add.d.ts.map +1 -1
  12. package/dist/cli/commands/add.js +9 -4
  13. package/dist/cli/commands/add.js.map +1 -1
  14. package/dist/cli/commands/index.d.ts +1 -0
  15. package/dist/cli/commands/index.d.ts.map +1 -1
  16. package/dist/cli/commands/index.js +1 -0
  17. package/dist/cli/commands/index.js.map +1 -1
  18. package/dist/cli/commands/init.d.ts +16 -5
  19. package/dist/cli/commands/init.d.ts.map +1 -1
  20. package/dist/cli/commands/init.js +59 -13
  21. package/dist/cli/commands/init.js.map +1 -1
  22. package/dist/cli/commands/ls.d.ts +1 -1
  23. package/dist/cli/commands/manifest.js +1 -1
  24. package/dist/cli/commands/manifest.js.map +1 -1
  25. package/dist/cli/commands/source.d.ts +2 -1
  26. package/dist/cli/commands/source.d.ts.map +1 -1
  27. package/dist/cli/commands/source.js +29 -2
  28. package/dist/cli/commands/source.js.map +1 -1
  29. package/dist/cli/commands/sourceInit.d.ts +9 -0
  30. package/dist/cli/commands/sourceInit.d.ts.map +1 -0
  31. package/dist/cli/commands/sourceInit.js +77 -0
  32. package/dist/cli/commands/sourceInit.js.map +1 -0
  33. package/dist/cli/commands/update.d.ts +10 -3
  34. package/dist/cli/commands/update.d.ts.map +1 -1
  35. package/dist/cli/commands/update.js +9 -4
  36. package/dist/cli/commands/update.js.map +1 -1
  37. package/dist/cli/index.js +15 -5
  38. package/dist/cli/index.js.map +1 -1
  39. package/dist/cli/npmDependencies.d.ts +11 -0
  40. package/dist/cli/npmDependencies.d.ts.map +1 -0
  41. package/dist/cli/npmDependencies.js +67 -0
  42. package/dist/cli/npmDependencies.js.map +1 -0
  43. package/dist/cli/packageFiles.d.ts +15 -0
  44. package/dist/cli/packageFiles.d.ts.map +1 -0
  45. package/dist/cli/packageFiles.js +54 -0
  46. package/dist/cli/packageFiles.js.map +1 -0
  47. package/dist/cli/themeTokens.d.ts +12 -0
  48. package/dist/cli/themeTokens.d.ts.map +1 -0
  49. package/dist/cli/themeTokens.js +52 -0
  50. package/dist/cli/themeTokens.js.map +1 -0
  51. package/dist/packages/dependencies.d.ts +44 -0
  52. package/dist/packages/dependencies.d.ts.map +1 -0
  53. package/dist/packages/dependencies.js +60 -0
  54. package/dist/packages/dependencies.js.map +1 -0
  55. package/dist/packages/install.d.ts +10 -0
  56. package/dist/packages/install.d.ts.map +1 -0
  57. package/dist/packages/install.js +21 -0
  58. package/dist/packages/install.js.map +1 -0
  59. package/dist/registry/adapters/shadcn.adapter.d.ts +32 -7
  60. package/dist/registry/adapters/shadcn.adapter.d.ts.map +1 -1
  61. package/dist/registry/adapters/shadcn.adapter.js +75 -20
  62. package/dist/registry/adapters/shadcn.adapter.js.map +1 -1
  63. package/dist/registry/adapters/shadcnImports.d.ts +10 -0
  64. package/dist/registry/adapters/shadcnImports.d.ts.map +1 -0
  65. package/dist/registry/adapters/shadcnImports.js +18 -0
  66. package/dist/registry/adapters/shadcnImports.js.map +1 -0
  67. package/dist/registry/componentsJson.d.ts +3 -1
  68. package/dist/registry/componentsJson.d.ts.map +1 -1
  69. package/dist/registry/componentsJson.js +15 -1
  70. package/dist/registry/componentsJson.js.map +1 -1
  71. package/dist/registry/index.d.ts +1 -1
  72. package/dist/registry/index.d.ts.map +1 -1
  73. package/dist/registry/index.js +1 -1
  74. package/dist/registry/index.js.map +1 -1
  75. package/dist/registry/manifest.d.ts +2 -13
  76. package/dist/registry/manifest.d.ts.map +1 -1
  77. package/dist/registry/manifest.js +4 -76
  78. package/dist/registry/manifest.js.map +1 -1
  79. package/dist/registry/packageExports.d.ts +9 -0
  80. package/dist/registry/packageExports.d.ts.map +1 -0
  81. package/dist/registry/packageExports.js +50 -0
  82. package/dist/registry/packageExports.js.map +1 -0
  83. package/dist/registry/readSource.d.ts +4 -2
  84. package/dist/registry/readSource.d.ts.map +1 -1
  85. package/dist/registry/readSource.js +27 -3
  86. package/dist/registry/readSource.js.map +1 -1
  87. package/dist/registry/types.d.ts +86 -3
  88. package/dist/registry/types.d.ts.map +1 -1
  89. package/dist/registry/types.js +46 -3
  90. package/dist/registry/types.js.map +1 -1
  91. package/dist/sources/builtins.d.ts +1 -5
  92. package/dist/sources/builtins.d.ts.map +1 -1
  93. package/dist/sources/builtins.js +2 -7
  94. package/dist/sources/builtins.js.map +1 -1
  95. package/dist/theme/cssVars.d.ts +30 -0
  96. package/dist/theme/cssVars.d.ts.map +1 -0
  97. package/dist/theme/cssVars.js +92 -0
  98. package/dist/theme/cssVars.js.map +1 -0
  99. package/dist/theme/detectCssFile.d.ts +9 -0
  100. package/dist/theme/detectCssFile.d.ts.map +1 -0
  101. package/dist/theme/detectCssFile.js +41 -0
  102. package/dist/theme/detectCssFile.js.map +1 -0
  103. package/package.json +8 -21
  104. package/template/build.ts +25 -0
  105. package/template/package.json +18 -0
  106. package/template/src/components/example/Example.css +20 -0
  107. package/template/src/components/example/Example.tsx +26 -0
  108. package/template/src/components/example/example.meta.ts +61 -0
  109. package/dist/components/basic/Card.css +0 -32
  110. package/dist/components/basic/Card.debug.ts +0 -5
  111. package/dist/components/basic/Card.tsx +0 -31
  112. package/dist/components/basic/CardFooter.css +0 -16
  113. package/dist/components/basic/CardFooter.debug.ts +0 -5
  114. package/dist/components/basic/CardFooter.tsx +0 -29
  115. package/dist/components/basic/CardHeader.css +0 -14
  116. package/dist/components/basic/CardHeader.debug.ts +0 -5
  117. package/dist/components/basic/CardHeader.tsx +0 -29
  118. package/dist/components/basic/card.meta.ts +0 -14
  119. package/dist/components/basic/cardfooter.meta.ts +0 -14
  120. package/dist/components/basic/cardheader.meta.ts +0 -14
  121. package/dist/components/input/Button.css +0 -34
  122. package/dist/components/input/Button.debug.ts +0 -5
  123. package/dist/components/input/Button.tsx +0 -28
  124. package/dist/components/input/button.meta.ts +0 -14
  125. package/dist/components.json +0 -138
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # @g3nomaly/ui
2
+
3
+ `@g3nomaly/ui` copies React components into your project as source files, the way shadcn does. You own the copied files and can edit them. This package is the installer only. The g3n components live in [`@g3nomaly/g3n-ui`](https://www.npmjs.com/package/@g3nomaly/g3n-ui), which is built in as a source and always available. The installer can also install shadcn components, and you can register other sources: a git repository, an npm package or a local folder.
4
+
5
+ ## Requirements
6
+
7
+ - [Bun](https://bun.sh). The CLI runs on Bun only.
8
+ - A git repository. The installer anchors every command to the repository root.
9
+ - React, for the components you install.
10
+
11
+ For shadcn components you also need:
12
+
13
+ - the `shadcn` package next to `@g3nomaly/ui` in your project: `bun add -d @g3nomaly/ui shadcn@latest`
14
+ - Tailwind CSS, because shadcn components are styled with Tailwind classes
15
+ - network access, since the installer reads the component list from `ui.shadcn.com`
16
+
17
+ No `components.json` is needed. The installer keeps its own config.
18
+
19
+ ## Install components
20
+
21
+ Run these from the root of your project:
22
+
23
+ ```sh
24
+ bunx @g3nomaly/ui init # writes .g3n.config.json and asks where components go
25
+ bunx @g3nomaly/ui ls # lists the components you can install
26
+ bunx @g3nomaly/ui add button # installs one component
27
+ bunx @g3nomaly/ui add basic # or every component in the basic group
28
+ bunx @g3nomaly/ui add # or pick from a list
29
+ ```
30
+
31
+ `init` asks for the install directory, `src/components/ui` by default, whether to copy the `.debug.ts` and `.meta.ts` files that come with each component, and for your global stylesheet, which it finds itself when shadcn's `components.json` names it or it sits in a usual place such as `src/index.css`. When your `package.json` lists `shadcn`, it also asks whether to install shadcn components. Pass `--install-dir <path>` to skip the questions, which turns shadcn on when `package.json` lists it, or `-f` to reconfigure without being asked first.
32
+
33
+ `add` installs the dependencies of a component too, so `add cardheader` also installs `card`. When more than one source offers a name, as a group or a component, `add` asks which source to take it from. Name the source yourself to skip the question: `g3n-ui:basic` for a group, `button@g3n-ui` for a component. Without a terminal, as in CI, `add` prints these forms and stops. Files keep their group folder: `button` lands in `src/components/ui/input/Button.tsx`. The `--debug` and `--meta` flags include the optional files for one run.
34
+
35
+ Some files stay in their source package, such as a store that manages a component's data. The installer never copies them, and the component imports them from the package, so they update with `bun install`. Such a source must be installed with `bun add` (not `-d`, since your app imports it at runtime) and registered as `npm:<package>`. `add --include-unsafe` copies them next to the component anyway, as an unsafe copy: the component keeps importing the package's version until you point the import at the copy yourself, and `update` and `remove` leave the copy alone.
36
+
37
+ A component can declare theme tokens its CSS needs, such as shadcn's sidebar colours. After `add` and `update`, the installer adds the ones your stylesheet lacks: to `:root`, `.dark` and `@theme inline`, the blocks a shadcn or tweakcn `globals.css` has. A token your stylesheet already defines keeps your value. Without a stylesheet set, the installer prints the tokens to add by hand.
38
+
39
+ A component can list the npm packages its files import, such as `radix-ui` or `recharts@3.8.0`. After `add` and `update`, the installer prints each package that your `package.json` does not list, and each installed package whose version is outside the range a component asks for, with the `bun add` command that fixes it. Pass `--install` to run that command for you.
40
+
41
+ The installer records what it installed, and the sources you registered, in `.g3n/ui.json`. Commit it with `.g3n.config.json` so your team gets the same components and sources.
42
+
43
+ The g3n components the built-in `g3n-ui` source offers are listed in the [`@g3nomaly/g3n-ui` README](https://www.npmjs.com/package/@g3nomaly/g3n-ui). The installer reads them from `node_modules/@g3nomaly/g3n-ui` when your project has that package, and downloads the latest release otherwise.
44
+
45
+ ## shadcn components
46
+
47
+ Add the `shadcn` package with `bun add -d shadcn@latest` before you run `init`, and `init` turns shadcn on for you. To turn it on later, run `init` again, or add `"shadcn"` to `registeredPackages` in `.g3n.config.json`:
48
+
49
+ ```json
50
+ {
51
+ "ui": {
52
+ "settings": {
53
+ "registeredPackages": ["shadcn"]
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ shadcn components then show up in `ls` with an `@shadcn/` prefix:
60
+
61
+ ```sh
62
+ bunx @g3nomaly/ui ls --source shadcn
63
+ bunx @g3nomaly/ui add @shadcn/button @shadcn/dialog
64
+ ```
65
+
66
+ Every shadcn file goes to a `shadcn/` folder in your install directory, for example `src/components/ui/shadcn/button.tsx`. The installer also installs the shadcn components it depends on. The registry serves files with imports such as `@/registry/new-york-v4/ui/button`, which only resolve inside the shadcn repository, so the installer rewrites them to the sibling file, `./button`. No path alias is needed.
67
+
68
+ shadcn components list their npm packages, such as `cn` and `radix-ui`, and the installer checks them like any other component's. Pass `--install` to add them.
69
+
70
+ The installed `shadcn` package decides the version: each shadcn component records it, and `update` shows the change, such as `@shadcn/button 4.21.1 → 4.22.1`. To move to newer shadcn components, upgrade the package with `bun add -d shadcn@latest`, then run `update`. The shadcn registry only serves its latest files, so an older version cannot be installed again. Your git history keeps the files you had.
71
+
72
+ Keep formatters and lint fixers away from the `shadcn/` folder and the rest of your install directory. A reformatted file counts as a local change, and `update` then leaves it alone.
73
+
74
+ ## Keep components up to date
75
+
76
+ ```sh
77
+ bunx @g3nomaly/ui update # every installed component
78
+ bunx @g3nomaly/ui update button # one component
79
+ bunx @g3nomaly/ui update --dry-run # shows what would change
80
+ bunx @g3nomaly/ui remove cardheader
81
+ bunx @g3nomaly/ui ls --installed
82
+ ```
83
+
84
+ `update` reinstalls each component from the source it came from and shows the version change, such as `button 0.1.0 → 0.2.0`. A component that gained a dependency since you installed it gets that dependency installed too. `--dry-run` names it instead. When you have changed an installed file, `update` asks whether to restore the source version, fork the component under a new key that updates leave alone, or skip it and ask again next time. Pass `-f` to restore without asking. `add -f` does the same for files `add` would overwrite.
85
+
86
+ `remove` offers to remove the installed components that depend on the one you remove. It asks before deleting a file you changed, unless you pass `-f`.
87
+
88
+ If the manifest is lost or out of date, `manifest` scans the install directory and records every component it finds there that a source offers:
89
+
90
+ ```sh
91
+ bunx @g3nomaly/ui manifest
92
+ ```
93
+
94
+ ## Other sources
95
+
96
+ ```sh
97
+ bunx @g3nomaly/ui source add owner/repo # a GitHub repository
98
+ bunx @g3nomaly/ui source add https://git.example.com/ui.git --ref v1
99
+ bunx @g3nomaly/ui source add npm:some-components # an npm package in your package.json
100
+ bunx @g3nomaly/ui source add ./my-components --name mine # a local folder
101
+ bunx @g3nomaly/ui source ls
102
+ bunx @g3nomaly/ui add card@mine # a component from one source
103
+ bunx @g3nomaly/ui source remove mine
104
+ ```
105
+
106
+ The built-in `g3n-ui` source cannot be removed. `source remove` also refuses a source that installed components came from, unless you pass `-f`.
107
+
108
+ Every registered source is stored in `.g3n/ui.json`, so it stays registered for everyone who clones the project. Which kind to use:
109
+
110
+ | Kind | Register | Version | For |
111
+ |---|---|---|---|
112
+ | npm | `bun add -d <pkg>`, then `source add npm:<pkg>` | `package.json` and `bun.lock`, like any dependency. `update` reads the installed copy | Teams. The package can come from npm, from git (`bun add -d github:me/my-ui#v1.2.0`) or from a folder (`bun add -d file:../my-ui`) |
113
+ | git | `source add owner/repo`, optionally `--ref <tag>` | The branch or tag, cloned on each command | Sources not installed as a package |
114
+ | local | `source add ../my-ui` | Whatever the folder holds | Working on a source next to an app. The path is stored relative to the project, so teammates need the same folder layout |
115
+
116
+ An npm source must be in your `package.json` before you register it. When `package.json` lists it but `node_modules` does not hold it, commands stop and ask you to run `bun install`. They never download a different version. Unscoped package names need the `npm:` prefix. Scoped names such as `@me/my-ui` work without it.
117
+
118
+ ## Write your own source
119
+
120
+ ```sh
121
+ bunx @g3nomaly/ui source init my-ui # a package.json, a build script and one example component
122
+ cd my-ui && bun install && bun run build
123
+ ```
124
+
125
+ The comments in the example component explain how a source works: the meta file, how files land in an app, relative imports, files that stay in the package (`install: "package"`, reached through the `exports` field), depending on shadcn components and npm packages, theme colours, versions and publishing. Start in `src/components/example/example.meta.ts`. [`@g3nomaly/g3n-ui`](https://www.npmjs.com/package/@g3nomaly/g3n-ui) is built the same way.
126
+
127
+ A built source holds `dist/components.json` next to its files in `dist/components/<group>/`. `writeComponentsJson` from `@g3nomaly/ui/registry` writes it from the `.meta.ts` files, and `PackagedComponent` from `@g3nomaly/ui/types` types them.
128
+
129
+ ## Development
130
+
131
+ Run `bun install` at the repository root first, then every command from this directory.
132
+
133
+ ```sh
134
+ bun run ui -- ls # the CLI from source
135
+ bun run typecheck
136
+ bun run lint
137
+ bun test tests/unit
138
+ bun run build # the CLI and its types into dist/
139
+ ```
140
+
141
+ `@g3nomaly/ui` depends on [`@g3nomaly/core`](https://www.npmjs.com/package/@g3nomaly/core), which holds the install logic it shares with [`@g3nomaly/skills`](https://www.npmjs.com/package/@g3nomaly/skills) and [`@g3nomaly/mods`](https://www.npmjs.com/package/@g3nomaly/mods).
142
+
143
+ ## License
144
+
145
+ Elastic License 2.0. The full text is in the `LICENSE` file of this package.
@@ -3,6 +3,7 @@ import type { G3nConfig } from "@g3nomaly/core/config";
3
3
  import type { InstallCommandContext, ManifestTarget, SourceCommandContext } from "@g3nomaly/core/cli";
4
4
  import type { SourceRegistry } from "@g3nomaly/core/installer";
5
5
  import type { RegisteredSource, SourceRecord } from "@g3nomaly/core/sources";
6
+ import type { FetchedComponentFields } from "../registry/adapters/shadcn.adapter";
6
7
  import type { ComponentFileFlags } from "../registry/readSource";
7
8
  import type { ComponentMeta, ComponentRegistry } from "../registry/types";
8
9
  /**
@@ -16,7 +17,7 @@ export interface ProjectDeps {
16
17
  builtins?: SourceRecord;
17
18
  }
18
19
  /**
19
- * @brief A project opened for a g3nui command: its root, config, the one install target and the built-in sources.
20
+ * @brief A project opened for a g3n-ui command: its root, config, the one install target and the built-in sources.
20
21
  *
21
22
  * @property projectRoot - Absolute project root.
22
23
  * @property config - Loaded g3n config.
@@ -29,12 +30,19 @@ export interface UiProject {
29
30
  target: ManifestTarget;
30
31
  builtins: SourceRecord;
31
32
  }
32
- /** What the core install commands print, check and fetch for components. */
33
+ /** What the core commands print and check for components. */
33
34
  export declare const UI_CONTEXT: InstallCommandContext<ComponentMeta>;
34
35
  /**
35
- * @brief Anchors the command to the git project, loads its config, migrates a
36
- * manifest from before the shared shape, and opens the manifest; exits when
37
- * outside a repo or when the manifest cannot be read.
36
+ * @brief What the core install commands print, check and fetch for components: shadcn components are
37
+ * fetched from the shadcn registry, every other component is copied out of its source.
38
+ *
39
+ * @param fetchedByKey - Filled with the npm packages and theme tokens of each shadcn component fetched, by component key.
40
+ * @returns The install context.
41
+ */
42
+ export declare function uiInstallContext(fetchedByKey: Map<string, FetchedComponentFields>): InstallCommandContext<ComponentMeta>;
43
+ /**
44
+ * @brief Anchors the command to the git project, loads its config and opens the
45
+ * manifest; exits when outside a repo or when the manifest cannot be read.
38
46
  *
39
47
  * @param deps - Test injection.
40
48
  * @returns The opened project.
@@ -67,7 +75,7 @@ export declare function fileFlags(project: UiProject, options?: {
67
75
  }): ComponentFileFlags;
68
76
  /**
69
77
  * @brief Reads the components of the project's sources, plus shadcn's when it is in
70
- * `g3nui.settings.registeredPackages`, and prints what could not be read;
78
+ * `ui.settings.registeredPackages`, and prints what could not be read;
71
79
  * the caller disposes the result.
72
80
  *
73
81
  * @param project - The opened project.
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB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G,gBAAgB,EAAE,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,GAAG,iBAAiB,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,kBAAkB,CAKnH;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAkBhJ;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAEvF"}
@@ -1,25 +1,33 @@
1
1
  // packages/ui/src/cli/adapter.ts
2
2
  import path from "node:path";
3
3
  import { loadConfig, resolveProjectRoot } from "@g3nomaly/core/config";
4
- import { c, lineError, lineInfo, narrowSources, orExit, reportSourceRegistry } from "@g3nomaly/core/cli";
4
+ import { lineError, narrowSources, orExit, reportSourceRegistry } from "@g3nomaly/core/cli";
5
5
  import { entrySource, installedEntries, loadInstallManifest, loadSourceRegistry, manifestSources } from "@g3nomaly/core/installer";
6
6
  import { createRegistryStore, register } from "@g3nomaly/core/registry";
7
7
  import { readShadcnEntries, shadcnFileSource } from "../registry/adapters/shadcn.adapter";
8
- import { SHADCN_SOURCE, migrateLegacyManifest, uiManifestPath } from "../registry/manifest";
8
+ import { SHADCN_SOURCE, uiManifestPath } from "../registry/manifest";
9
9
  import { readComponentSource } from "../registry/readSource";
10
10
  import { ComponentMetaSchema } from "../registry/types";
11
11
  import { BUILTIN_SOURCES } from "../sources/builtins";
12
- /** What the core install commands print, check and fetch for components. */
12
+ /** What the core commands print and check for components. */
13
13
  export const UI_CONTEXT = {
14
- bin: "g3nui",
14
+ bin: "g3n-ui",
15
15
  noun: "component",
16
16
  entrySchema: ComponentMetaSchema,
17
- fileSource: (registry) => shadcnFileSource(entrySource(registry)),
18
17
  };
19
18
  /**
20
- * @brief Anchors the command to the git project, loads its config, migrates a
21
- * manifest from before the shared shape, and opens the manifest; exits when
22
- * outside a repo or when the manifest cannot be read.
19
+ * @brief What the core install commands print, check and fetch for components: shadcn components are
20
+ * fetched from the shadcn registry, every other component is copied out of its source.
21
+ *
22
+ * @param fetchedByKey - Filled with the npm packages and theme tokens of each shadcn component fetched, by component key.
23
+ * @returns The install context.
24
+ */
25
+ export function uiInstallContext(fetchedByKey) {
26
+ return { ...UI_CONTEXT, fileSource: (registry) => shadcnFileSource(entrySource(registry), fetchedByKey) };
27
+ }
28
+ /**
29
+ * @brief Anchors the command to the git project, loads its config and opens the
30
+ * manifest; exits when outside a repo or when the manifest cannot be read.
23
31
  *
24
32
  * @param deps - Test injection.
25
33
  * @returns The opened project.
@@ -27,18 +35,15 @@ export const UI_CONTEXT = {
27
35
  export async function openUiProject(deps = {}) {
28
36
  const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
29
37
  if (projectRoot === null) {
30
- console.error(lineError("No g3n project found: run `g3nui init` inside a git repository."));
38
+ console.error(lineError("No g3n project found: run `g3n-ui init` inside a git repository."));
31
39
  process.exit(1);
32
40
  }
33
41
  const config = await loadConfig(projectRoot);
34
- const migrated = await migrateLegacyManifest(projectRoot);
35
- if (migrated !== null)
36
- console.log(lineInfo(`Migrated ${c.file(path.relative(projectRoot, migrated))} to the shared manifest shape`));
37
42
  const manifest = orExit(() => loadInstallManifest(uiManifestPath(projectRoot), ComponentMetaSchema));
38
43
  return {
39
44
  projectRoot,
40
45
  config,
41
- target: { label: "", installDir: path.join(projectRoot, config.g3nui.settings.componentsDir), store: manifest.store, manifest },
46
+ target: { label: "", installDir: path.join(projectRoot, config.ui.settings.componentsDir), store: manifest.store, manifest },
42
47
  builtins: deps.builtins ?? BUILTIN_SOURCES,
43
48
  };
44
49
  }
@@ -69,13 +74,13 @@ export function installedComponents(project) {
69
74
  */
70
75
  export function fileFlags(project, options = {}) {
71
76
  return {
72
- includeDebug: options.debug ?? project.config.g3nui.settings.includeDebugFiles,
73
- includeMeta: options.meta ?? project.config.g3nui.settings.includeMetaFiles,
77
+ includeDebug: options.debug ?? project.config.ui.settings.includeDebugFiles,
78
+ includeMeta: options.meta ?? project.config.ui.settings.includeMetaFiles,
74
79
  };
75
80
  }
76
81
  /**
77
82
  * @brief Reads the components of the project's sources, plus shadcn's when it is in
78
- * `g3nui.settings.registeredPackages`, and prints what could not be read;
83
+ * `ui.settings.registeredPackages`, and prints what could not be read;
79
84
  * the caller disposes the result.
80
85
  *
81
86
  * @param project - The opened project.
@@ -84,9 +89,9 @@ export function fileFlags(project, options = {}) {
84
89
  * @returns The components per source; dispose it once read.
85
90
  */
86
91
  export async function openComponentRegistry(project, flags, only) {
87
- const packages = project.config.g3nui.settings.registeredPackages;
92
+ const packages = project.config.ui.settings.registeredPackages;
88
93
  const shadcnOn = packages.includes(SHADCN_SOURCE);
89
- const named = narrowSources([...uiSources(project), ...(shadcnOn ? [{ name: SHADCN_SOURCE }] : [])], only, "g3nui").map((s) => s.name);
94
+ const named = narrowSources([...uiSources(project), ...(shadcnOn ? [{ name: SHADCN_SOURCE }] : [])], only, "g3n-ui").map((s) => s.name);
90
95
  const sources = uiSources(project).filter((s) => named.includes(s.name));
91
96
  const registry = await loadSourceRegistry(sources, project.projectRoot, readComponentSource(flags));
92
97
  if (shadcnOn && named.includes(SHADCN_SOURCE)) {
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,CAAC,EAAE,SAA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IAC/B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkB;IAChD,OAAO,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;AAC9I,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { AfterTarget } from "@g3nomaly/core/cli";
2
+ import type { FetchedComponentFields } from "../registry/adapters/shadcn.adapter";
3
+ import type { UiProject } from "./adapter";
4
+ /**
5
+ * @brief What runs after components are installed or updated, beside the files.
6
+ *
7
+ * @property install - Add missing npm packages with `bun add` instead of only reporting them.
8
+ * @property includeUnsafe - Also copy the files that stay in the package, such as stores, as unsafe copies.
9
+ */
10
+ export interface AfterInstallOptions {
11
+ install: boolean;
12
+ includeUnsafe: boolean;
13
+ }
14
+ /**
15
+ * @brief Hook for `add` and `update` that runs once a manifest is saved: records the fields of the
16
+ * shadcn components just fetched, then, for every component just installed or updated, checks its npm
17
+ * packages against the app's `package.json`, adds its theme tokens to the app's stylesheet, and with
18
+ * `includeUnsafe` copies the files it keeps in its package.
19
+ *
20
+ * @param project - The opened project, whose settings name the stylesheet.
21
+ * @param fetchedByKey - Fields per shadcn component key, filled while the files are fetched.
22
+ * @param options - Install and include-unsafe flags.
23
+ * @returns The hook to pass to `addFromSources` or `updateFromSources`.
24
+ */
25
+ export declare function afterComponentInstall(project: UiProject, fetchedByKey: ReadonlyMap<string, FetchedComponentFields>, options: AfterInstallOptions): AfterTarget;
26
+ //# sourceMappingURL=afterInstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"afterInstall.d.ts","sourceRoot":"","sources":["../../src/cli/afterInstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAwB3C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAQ,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAAE,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAc9J"}
@@ -0,0 +1,54 @@
1
+ import { installedEntries, saveInstallManifest } from "@g3nomaly/core/installer";
2
+ import { register } from "@g3nomaly/core/registry";
3
+ import { ComponentMetaSchema } from "../registry/types";
4
+ import { reportNpmDependencies } from "./npmDependencies";
5
+ import { copyPackageFiles } from "./packageFiles";
6
+ import { applyThemeTokens } from "./themeTokens";
7
+ /**
8
+ * @brief Writes what was fetched with shadcn components, their npm packages and theme tokens, into
9
+ * their manifest entries, since the shadcn index lacks both and the entries were recorded without them.
10
+ *
11
+ * @param target - Target whose manifest holds the entries.
12
+ * @param fetchedByKey - Fields per shadcn component key, as fetched during the install.
13
+ */
14
+ function recordFetchedFields(target, fetchedByKey) {
15
+ const installed = installedEntries(target.manifest, ComponentMetaSchema);
16
+ let changed = false;
17
+ for (const [key, fields] of fetchedByKey) {
18
+ const entry = installed[key];
19
+ if (entry === undefined)
20
+ continue;
21
+ register(target.manifest.store, key, { ...entry, ...fields });
22
+ changed = true;
23
+ }
24
+ if (changed)
25
+ saveInstallManifest(target.manifest, ComponentMetaSchema);
26
+ }
27
+ /**
28
+ * @brief Hook for `add` and `update` that runs once a manifest is saved: records the fields of the
29
+ * shadcn components just fetched, then, for every component just installed or updated, checks its npm
30
+ * packages against the app's `package.json`, adds its theme tokens to the app's stylesheet, and with
31
+ * `includeUnsafe` copies the files it keeps in its package.
32
+ *
33
+ * @param project - The opened project, whose settings name the stylesheet.
34
+ * @param fetchedByKey - Fields per shadcn component key, filled while the files are fetched.
35
+ * @param options - Install and include-unsafe flags.
36
+ * @returns The hook to pass to `addFromSources` or `updateFromSources`.
37
+ */
38
+ export function afterComponentInstall(project, fetchedByKey, options) {
39
+ return async (target, keys) => {
40
+ recordFetchedFields(target, fetchedByKey);
41
+ const installed = installedEntries(target.manifest, ComponentMetaSchema);
42
+ const touched = {};
43
+ for (const key of keys) {
44
+ const entry = installed[key];
45
+ if (entry !== undefined)
46
+ touched[key] = entry;
47
+ }
48
+ if (options.includeUnsafe)
49
+ copyPackageFiles(project, target, touched);
50
+ await reportNpmDependencies(project.projectRoot, touched, options.install);
51
+ applyThemeTokens(project.projectRoot, project.config.ui.settings.cssFile, touched);
52
+ };
53
+ }
54
+ //# sourceMappingURL=afterInstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"afterInstall.js","sourceRoot":"","sources":["../../src/cli/afterInstall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,MAAsB,EAAE,YAAyD;IAC5G,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;IACzE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QACzC,MAAM,KAAK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adapter";
5
5
  *
6
6
  * @property debug - Install `.debug.ts` files; the project setting when absent.
7
7
  * @property meta - Install `.meta.ts` files; the project setting when absent.
8
+ * @property install - Add the npm packages the components need with `bun add`, instead of only reporting them.
9
+ * @property includeUnsafe - Also copy the files the components keep in their package, such as stores, as unsafe copies they do not import.
8
10
  */
9
11
  export interface AddOptions extends InstallOptions {
10
12
  debug?: boolean;
11
13
  meta?: boolean;
14
+ install?: boolean;
15
+ includeUnsafe?: boolean;
12
16
  }
13
17
  /**
14
18
  * @brief Installs components or whole groups from the registered sources, each with
15
19
  * the components it depends on, keeping locally modified files. A name more
16
20
  * than one source offers is picked as `<name>@<source>`; with no names the
17
- * user picks from what the sources offer.
21
+ * user picks from what the sources offer. npm packages the components need and
22
+ * the app lacks are reported afterwards, or added with `install`, and their
23
+ * theme tokens are added to the app's stylesheet.
18
24
  *
19
25
  * @param names - Component keys or groups to install, e.g. `button`; empty to pick from the sources.
20
- * @param options - Force, debug and meta flags.
26
+ * @param options - Force, debug, meta, install and include-unsafe flags.
21
27
  * @param deps - Test injection.
22
28
  */
23
29
  export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAG,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjH"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;;;;GAOG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAU,OAAO,CAAC;IACxB,IAAI,CAAC,EAAW,OAAO,CAAC;IACxB,OAAO,CAAC,EAAQ,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAUjH"}
@@ -1,21 +1,26 @@
1
1
  // packages/ui/src/cli/commands/add.ts
2
2
  import { addFromSources } from "@g3nomaly/core/cli";
3
- import { UI_CONTEXT, fileFlags, openComponentRegistry, openUiProject } from "../adapter";
3
+ import { fileFlags, openComponentRegistry, openUiProject, uiInstallContext } from "../adapter";
4
+ import { afterComponentInstall } from "../afterInstall";
4
5
  /**
5
6
  * @brief Installs components or whole groups from the registered sources, each with
6
7
  * the components it depends on, keeping locally modified files. A name more
7
8
  * than one source offers is picked as `<name>@<source>`; with no names the
8
- * user picks from what the sources offer.
9
+ * user picks from what the sources offer. npm packages the components need and
10
+ * the app lacks are reported afterwards, or added with `install`, and their
11
+ * theme tokens are added to the app's stylesheet.
9
12
  *
10
13
  * @param names - Component keys or groups to install, e.g. `button`; empty to pick from the sources.
11
- * @param options - Force, debug and meta flags.
14
+ * @param options - Force, debug, meta, install and include-unsafe flags.
12
15
  * @param deps - Test injection.
13
16
  */
14
17
  export async function addCommand(names, options = {}, deps = {}) {
15
18
  const project = await openUiProject(deps);
16
19
  const registry = await openComponentRegistry(project, fileFlags(project, options));
20
+ const fetchedByKey = new Map();
17
21
  try {
18
- await addFromSources([project.target], names, registry, options, UI_CONTEXT);
22
+ const check = afterComponentInstall(project, fetchedByKey, { install: options.install === true, includeUnsafe: options.includeUnsafe === true });
23
+ await addFromSources([project.target], names, registry, options, uiInstallContext(fetchedByKey), check);
19
24
  }
20
25
  finally {
21
26
  registry.dispose();
@@ -1 +1 @@
1
- {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAczF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,OAAO,GAAI,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAiBxD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,OAAO,GAAI,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnF,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC,CAAC;QACjJ,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1G,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -10,6 +10,7 @@ export { lsCommand } from "./ls";
10
10
  export type { LsOptions } from "./ls";
11
11
  export { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./source";
12
12
  export type { SourceAddOptions } from "./source";
13
+ export { sourceInitCommand } from "./sourceInit";
13
14
  export { manifestCommand } from "./manifest";
14
15
  export type { ManifestDeps } from "./manifest";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAAQ,CA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E,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAClF,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -5,5 +5,6 @@ export { removeCommand } from "./remove";
5
5
  export { updateCommand } from "./update";
6
6
  export { lsCommand } from "./ls";
7
7
  export { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./source";
8
+ export { sourceInitCommand } from "./sourceInit";
8
9
  export { manifestCommand } from "./manifest";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { G3nuiSettings } from "@g3nomaly/core/config";
2
+ import type { UiSettings } from "@g3nomaly/core/config";
3
3
  import type { Dialogue, DialogueAnswers } from "@g3nomaly/core/cli";
4
4
  import type { ProjectDeps } from "../adapter";
5
5
  /**
@@ -18,27 +18,38 @@ declare const UiInitAnswersSchema: z.ZodObject<{
18
18
  componentsDir: z.ZodString;
19
19
  includeDebugFiles: z.ZodBoolean;
20
20
  includeMetaFiles: z.ZodBoolean;
21
+ cssFile: z.ZodOptional<z.ZodString>;
22
+ useShadcn: z.ZodOptional<z.ZodBoolean>;
21
23
  }, z.core.$strip>;
22
24
  /**
23
- * @brief Answers of the init dialogue, parsed into the g3nui settings.
25
+ * @brief Answers of the init dialogue, parsed into the ui settings.
24
26
  *
25
27
  * @property componentsDir - Install directory, relative to the project root, e.g. `src/components`.
26
28
  * @property includeDebugFiles - Whether `.debug.ts` files are installed with components.
27
29
  * @property includeMetaFiles - Whether `.meta.ts` files are installed with components.
30
+ * @property cssFile - Global stylesheet theme tokens go into, relative to the project root; absent for none.
31
+ * @property useShadcn - Whether shadcn components are offered; asked only when `package.json` lists shadcn,
32
+ * absent to leave the setting as it is.
28
33
  */
29
34
  export type UiInitAnswers = z.infer<typeof UiInitAnswersSchema>;
30
35
  /**
31
36
  * @brief Input of the init dialogue: the settings its steps start from.
32
37
  *
33
- * @property settings - Current g3nui settings, the initial value of each step.
38
+ * @property settings - Current ui settings, the initial value of each step.
39
+ * @property shadcnInstalled - Whether the project's `package.json` lists the `shadcn` package.
40
+ * @property detectedCssFile - Global stylesheet found in the project, offered when none is set.
34
41
  */
35
42
  interface UiInitInput extends Record<string, unknown> {
36
- settings: G3nuiSettings;
43
+ settings: UiSettings;
44
+ shadcnInstalled: boolean;
45
+ detectedCssFile?: string;
37
46
  }
38
47
  export declare const orphanDialogue: Dialogue;
39
48
  export declare const initDialogue: Dialogue<UiInitInput>;
40
49
  /**
41
- * @brief Initializes the g3nui config in this project.
50
+ * @brief Initializes the ui config in this project. The global stylesheet is detected and offered.
51
+ * When the project's `package.json` lists shadcn, shadcn components are offered too: after asking, or
52
+ * without asking when the install dir is preset.
42
53
  *
43
54
  * @param options - Force flag, install dir and preset answers.
44
55
  * @param deps - Test injection.
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAO,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,QAAA,MAAM,mBAAmB;;;;iBAIvB,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,UAAU,WAAY,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,QAAQ,EAAE,aAAa,CAAC;CACzB;AAYD,eAAO,MAAM,cAAc,EAAE,QAQ5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QA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