create-agentic-monorepo 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 Fayez Nazzal
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,211 @@
1
+ # Agentic Monorepo
2
+
3
+ [![ci](https://github.com/fayez-nazzal/agentic-monorepo/actions/workflows/ci.yml/badge.svg)](https://github.com/fayez-nazzal/agentic-monorepo/actions/workflows/ci.yml)
4
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ **A monorepo starter for TypeScript, Swift, and Rust that stays clear as it grows, with a CLI that scaffolds it in one command.**
7
+
8
+ Agentic Monorepo is an [Nx](https://nx.dev) and [pnpm](https://pnpm.io) workspace where each business domain lives in its own library behind a small public interface, architecture rules are enforced by an automated boundary check, and every project exposes the same `build`, `typecheck`, `test`, and `lint` targets. Because code is grouped by business capability instead of technical layer, a developer or an AI coding agent can work inside one domain instead of loading the whole repository.
9
+
10
+ Use `create-agentic-monorepo` to generate a new repository with only the starters you pick: a web app, a Node CLI, a native macOS app, an independent Rust library, or nothing but the workspace itself.
11
+
12
+ ## Quick start
13
+
14
+ You need [Node.js](https://nodejs.org) 22.13 or newer and [pnpm](https://pnpm.io/installation) 11.21.0. The web and CLI starters need nothing else and work on macOS, Linux, and Windows.
15
+
16
+ ### 1. Create your repository
17
+
18
+ ```sh
19
+ npx create-agentic-monorepo@latest my-product
20
+ ```
21
+
22
+ Alternatively:
23
+
24
+ ```sh
25
+ pnpm create agentic-monorepo@latest my-product
26
+ ```
27
+
28
+ The wizard asks for the location, the starter, and whether to install dependencies and initialize Git, then shows exactly what it will do before writing a single file. The destination must be a new or empty directory, and nothing is ever overwritten.
29
+
30
+ Already know what you want? Skip the questions:
31
+
32
+ ```sh
33
+ npx --yes create-agentic-monorepo@latest my-product --preset web --yes
34
+ ```
35
+
36
+ ### 2. Start developing
37
+
38
+ ```sh
39
+ cd my-product
40
+ pnpm install --frozen-lockfile
41
+ pnpm nx run web-example-app:dev
42
+ ```
43
+
44
+ Vite prints a local URL. Open it and you will see the example app rendering results from the shared search domain. Replace that domain with your own and keep building.
45
+
46
+ Node >=22.13 runs the creator. Generated-workspace installs need pnpm 11.21.0.
47
+
48
+ > [!TIP]
49
+ > `--list` shows every starter, `--dry-run` prints the plan without creating anything, and `--install --git` lets the CLI run `pnpm install --frozen-lockfile` and `git init` for you.
50
+
51
+ ## Choose a starter
52
+
53
+ | Preset | You get | Also needs |
54
+ | ----------- | ------------------------------------------------------------------------------- | ------------------------------------------ |
55
+ | `web` | `apps/web/example-app` (TypeScript + Vite) and the shared `libs/domains/search` | — |
56
+ | `cli` | `apps/cli/example-app` (Node + TypeScript) and the shared `libs/domains/search` | — |
57
+ | `mac` | `apps/mac/example-app` (SwiftUI) and `libs/platform/mac/filesystem` | macOS 14+, Swift 6, SwiftLint |
58
+ | `web-cli` | The web and CLI apps sharing one search domain | — |
59
+ | `full` | All three apps plus the independent `libs/rust/search-index` | macOS 14+, Swift 6, SwiftLint, Rust 1.97.1 |
60
+ | `workspace` | Workspace tooling, configuration, CI, and architecture docs, with no app yet | — |
61
+
62
+ Every starter includes the pinned toolchain, the boundary check, and a CI workflow matched to your selection. Build your own mix with `--apps web,cli,mac` (or `--apps none`) plus `--rust`, for example `--apps cli --rust`.
63
+
64
+ The Rust library is deliberately independent: it is a standalone crate, not a binding wired into an app.
65
+
66
+ <details>
67
+ <summary>Starters that are listed but not available yet</summary>
68
+
69
+ React, Next.js, Vue, SvelteKit, Astro, Node API, iOS, Android, Expo, Electron, Tauri, and Rust application bindings appear in `--list` as **Coming soon**. No starter exists for them yet, so the CLI rejects them instead of generating something that does not work.
70
+
71
+ </details>
72
+
73
+ ## CLI options
74
+
75
+ | Option | What it does |
76
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
77
+ | `[destination]` | Directory to create; must be new or empty. Its name becomes the default package name. |
78
+ | `--preset <id>` | `web`, `cli`, `mac`, `web-cli`, `full`, or `workspace` |
79
+ | `--apps <csv>` | Any mix of `web`, `cli`, `mac`, or `none` |
80
+ | `--rust`, `--no-rust` | Include or exclude the independent Rust library |
81
+ | `--name <name>` | Root package name in lower-kebab-case |
82
+ | `--install`, `--git` | After the files are written, run `pnpm install --frozen-lockfile` and `git init --initial-branch=main`; both stay off unless you ask |
83
+ | `--config <path>` | Reuse a saved `agentic.config.json` |
84
+ | `--yes`, `-y` | Never prompt; falls back to the `web` preset when no starter is given |
85
+ | `--dry-run` | Print the plan and write nothing |
86
+ | `--json` | Print one machine-readable result on stdout |
87
+ | `--plain` | Line-based ASCII prompts for limited terminals |
88
+ | `--list` | Print the starters and capabilities, then exit |
89
+ | `--help`, `--version` | Usage and version |
90
+
91
+ ## Repeat a setup
92
+
93
+ Every generated repository contains an `agentic.config.json` recording the resolved name, the selected apps, the Rust choice, and the template version and digest it came from. Feed it back to reproduce the same repository:
94
+
95
+ ```sh
96
+ npx create-agentic-monorepo@latest my-other-product --config ./agentic.config.json
97
+ ```
98
+
99
+ Explicit flags win over the file, and a recorded version or digest that no longer matches stops the run instead of quietly generating something different. When replaying an older template, replace `latest` with the config's `templateVersion`. Dependency installation and Git setup are not recorded, so add `--install` or `--git` when you want them.
100
+
101
+ ## Architecture
102
+
103
+ Folders follow the business, not the framework.
104
+
105
+ | Purpose | Location |
106
+ | -------------------------------- | ------------------------------------------------------- |
107
+ | Business rules for one domain | `libs/domains/<domain>` |
108
+ | Wrapper around one OS capability | `libs/platform/<platform>/<capability>` |
109
+ | Persistence and networking | `libs/infrastructure/<capability>` |
110
+ | Rust cores and their bindings | `libs/rust/<crate>` and `libs/rust/<crate>-<ecosystem>` |
111
+ | Product entry points | `apps/<platform>/<app>` |
112
+ | Repository automation | `tools` |
113
+
114
+ - Apps compose libraries and own no reusable business logic.
115
+ - A domain library depends only on libraries in its own domain.
116
+ - Rust cores stay FFI-free; binding crates own the language-crossing edge.
117
+ - Nothing depends on an app.
118
+
119
+ ```mermaid
120
+ graph LR
121
+ apps["apps/*"] --> domains["libs/domains/*"]
122
+ apps --> platform["libs/platform/*"]
123
+ apps --> infra["libs/infrastructure/*"]
124
+ apps --> bindings["libs/rust/*-bindings"]
125
+ infra --> platform
126
+ infra --> domains
127
+ bindings --> cores["libs/rust/* cores"]
128
+ ```
129
+
130
+ `tools/check-boundaries.mjs` reads the Nx graph and project tags, then fails the `lint` target when a dependency breaks these rules. The [architecture guide](docs/architecture.md) is the full placement and dependency reference.
131
+
132
+ ## Example projects
133
+
134
+ | Project | What it is |
135
+ | -------------------------------------------------------------- | ------------------------------------------------------------ |
136
+ | [`apps/web/example-app`](apps/web/example-app) | Vanilla TypeScript browser app built with Vite |
137
+ | [`apps/cli/example-app`](apps/cli/example-app) | Node command-line app that formats a search query |
138
+ | [`apps/mac/example-app`](apps/mac/example-app) | Native SwiftUI app targeting macOS 14+ |
139
+ | [`libs/domains/search`](libs/domains/search) | Pure TypeScript search domain shared by the web and CLI apps |
140
+ | [`libs/platform/mac/filesystem`](libs/platform/mac/filesystem) | SwiftPM library for macOS filesystem locations |
141
+ | [`libs/rust/search-index`](libs/rust/search-index) | Standalone Rust library for search indexing |
142
+
143
+ The examples exist to be replaced. To make the repository yours:
144
+
145
+ 1. Name libraries after business capabilities, not technical layers.
146
+ 2. Keep reusable rules inside domain libraries and let apps compose them.
147
+ 3. Tag every new project with its type, domain, platform, and language so the boundary check protects it.
148
+
149
+ ## Everyday commands
150
+
151
+ | Task | Command |
152
+ | ------------------------------- | ----------------------------------------------- |
153
+ | Install exactly the pinned tree | `pnpm install --frozen-lockfile` |
154
+ | Verify every project | `pnpm nx run-many -t typecheck build test lint` |
155
+ | Format, or check formatting | `pnpm format`, `pnpm format:check` |
156
+ | Explore the project graph | `pnpm nx graph` |
157
+ | Run a single target | `pnpm nx run <project>:<target>` |
158
+
159
+ Each project README lists its own targets. Nx runs upstream builds before `typecheck`, `test`, `lint`, and `build`, and caches those TypeScript tasks; Swift and Rust builds are left to their own toolchains. Development targets are also build-gated through root `targetDefaults`: `dev` and `serve` build upstream dependencies, while `preview`, `start`, and `run` build the project first.
160
+
161
+ ## Toolchain
162
+
163
+ | Tool | Role | Version |
164
+ | -------------------------------- | --------------------------------------------------- | --------------------------------------- |
165
+ | Node.js | Runtime for the workspace tooling and CLI starter | 22.13 or newer |
166
+ | pnpm | Workspace installs with strict dependency isolation | 11.21.0, pinned by `packageManager` |
167
+ | Nx | Project graph, task running, caching | pinned in `package.json` |
168
+ | TypeScript, Vite, Vitest, tsdown | Types, web dev and build, tests, library bundles | pinned in `package.json` |
169
+ | oxlint, oxfmt | Semantic linting, formatting and import order | pinned in `package.json` |
170
+ | Swift, SwiftPM, SwiftLint | Native macOS code, only for the Mac starter | Swift 6 tools, macOS 14 baseline |
171
+ | Rust, Cargo, Clippy, rustfmt | Native library work, only for the Rust selection | 1.97.1, pinned by `rust-toolchain.toml` |
172
+
173
+ JavaScript dependencies are pinned to exact versions, and `minimumReleaseAge: 2880` in `pnpm-workspace.yaml` keeps releases younger than 48 hours out of resolution.
174
+
175
+ ## Working on this repository
176
+
177
+ For an unreleased local CLI, clone and build the repository, then invoke the staged entry point:
178
+
179
+ ```sh
180
+ git clone https://github.com/fayez-nazzal/agentic-monorepo.git
181
+ cd agentic-monorepo
182
+ pnpm install --frozen-lockfile
183
+ pnpm nx run create-agentic-monorepo:build
184
+ node apps/cli/create-agentic-monorepo/dist/package/dist/main.mjs ../my-product
185
+ ```
186
+
187
+ These are the commands CI runs on macOS:
188
+
189
+ ```sh
190
+ pnpm install --frozen-lockfile
191
+ pnpm nx run-many -t typecheck build test lint
192
+ pnpm format:check
193
+ ```
194
+
195
+ The full sweep includes the Swift and Rust projects, so it needs macOS 14 or newer with Swift 6 and SwiftLint plus the pinned Rust 1.97.1 toolchain; the web and CLI projects alone need only Node and pnpm. CI also packs the CLI and creates a repository from the packed artifact on Ubuntu, Windows, and macOS. Read the [architecture guide](docs/architecture.md) before adding a project.
196
+
197
+ ### Publishing the CLI
198
+
199
+ Bootstrap publication requires npm authentication:
200
+
201
+ 1. Run `npm login --registry=https://registry.npmjs.org` and complete any browser or MFA challenge.
202
+ 2. From the repository root, build the staged package with the contributor commands above.
203
+ 3. Publish the tested directory: `npm publish ./apps/cli/create-agentic-monorepo/dist/package --access public --tag latest --registry=https://registry.npmjs.org`.
204
+ 4. In npm package Settings → Trusted publishing, add GitHub Actions for organization/user `fayez-nazzal`, repository `agentic-monorepo`, workflow filename `publish-create-agentic-monorepo.yml`, with no environment restriction. Allow direct `npm publish`, not only the default stage operation.
205
+ 5. Verify the package with `npm view create-agentic-monorepo version --registry=https://registry.npmjs.org`.
206
+
207
+ For future releases, change only the creator's source version, merge with passing CI, then publish a stable GitHub Release tagged `create-agentic-monorepo-v<version>` at that commit. The workflow checks the tag and publishes to `latest` with npm trusted publishing.
208
+
209
+ ## License
210
+
211
+ [MIT](LICENSE). Built to be forked.