@makerkit/cli 1.3.18 → 2.0.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/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  The CLI is a set of commands that help you manage your Makerkit SaaS Starter Kits.
4
4
 
5
- The CLI is currently in beta.
6
-
7
- NB: the CLI uses SSH to connect to GitHub. If you are not using SSH on your local machine, it will not work. In that case, please use the manual git commands instead.
5
+ The CLI auto-detects whether you have SSH access to GitHub. If SSH is not available, it falls back to HTTPS URLs automatically.
8
6
 
9
7
  ## Installation
10
8
 
@@ -14,6 +12,12 @@ You can run commands using `npx`:
14
12
  npx @makerkit/cli@latest <command>
15
13
  ```
16
14
 
15
+ If you use PNPM, use:
16
+
17
+ ```
18
+ pnpm dlx @makerkit/cli@latest <command>
19
+ ```
20
+
17
21
  This ensures that you always run the latest version of the CLI.
18
22
 
19
23
  ### Some commands require a Makerkit repository
@@ -37,32 +41,11 @@ Options:
37
41
 
38
42
  Commands:
39
43
  new Initialize a new Makerkit project
40
- plugins List and install plugins.
41
- i18n Manage and translate your i18n files
42
- license Manage Licenses
43
- blog Manage and generate your blog posts
44
+ plugins Manage MakerKit plugins.
45
+ project Manage your MakerKit project.
44
46
  help [command] display help for command
45
47
  ```
46
48
 
47
- ### Adding an OpenAI Key (optional)
48
-
49
- To use the generative AI features of the CLI, you will need to add an OpenAI
50
- key.
51
-
52
- To do so, create a `.env.local` file if it does not exist yet, and add the
53
- following environment variable:
54
-
55
- ```
56
- OPENAI_API_KEY=<your-key>
57
- ```
58
-
59
- This key will be used to generate the prompts for your blog posts. It
60
- remains locally on your computer and is not shared with anyone.
61
-
62
- At the moment of writing, the CLI only uses the OpenAI API to generate:
63
- 1. Translations for your i18n files
64
- 2. Blog Posts
65
-
66
49
  ## Creating a new Makerkit project
67
50
 
68
51
  To create a new Makerkit project, you can use the `new` command:
@@ -77,67 +60,186 @@ pulling the starter kit from GitHub.
77
60
 
78
61
  The command will also install the dependencies.
79
62
 
63
+ ## Project
64
+
65
+ The `project` command group helps you manage your MakerKit project.
66
+
67
+ ### Pulling upstream updates
68
+
69
+ ```
70
+ makerkit project update
71
+ ```
72
+
73
+ This command pulls the latest changes from the official MakerKit repository into your project. It:
74
+
75
+ 1. Detects which kit variant you're using (Next.js Supabase, Next.js Drizzle, etc.)
76
+ 2. Checks for SSH access to GitHub and falls back to HTTPS if unavailable
77
+ 3. Configures the `upstream` git remote if it doesn't exist (prompts for confirmation)
78
+ 4. Warns if the existing `upstream` remote points to the wrong repository
79
+ 5. Runs `git fetch upstream` followed by `git merge upstream/main`
80
+ 6. Reports success, already-up-to-date, or merge conflicts with resolution instructions
81
+
82
+ | Variant | Upstream Repository |
83
+ |---------|-------------------|
84
+ | Next.js Supabase | `makerkit/next-supabase-saas-kit-turbo` |
85
+ | Next.js Drizzle | `makerkit/next-drizzle-saas-kit-turbo` |
86
+ | Next.js Prisma | `makerkit/next-prisma-saas-kit-turbo` |
87
+ | React Router Supabase | `makerkit/react-router-supabase-saas-kit-turbo` |
88
+
80
89
  ## Plugins
81
90
 
82
- The CLI can help you manage plugins in your project. You can list the available plugins, install them, and update them.
91
+ The CLI can help you manage plugins in your project. You can list, install, update, and diff plugins.
83
92
 
84
- ### Listing plugins
93
+ | Command | Description |
94
+ |---------|-------------|
95
+ | `plugins list` | List available and installed plugins |
96
+ | `plugins add [id...]` | Install one or more plugins |
97
+ | `plugins update [id...]` | Update installed plugins to the latest version |
98
+ | `plugins outdated` | Check which installed plugins have updates |
99
+ | `plugins diff [id]` | Show a git-style diff against the latest version |
100
+ | `plugins init` | Set up your GitHub username for registry access |
85
101
 
86
- To list the available plugins, you can use the `plugins list` command:
102
+ ### Listing plugins
87
103
 
88
104
  ```
89
- > npx @makerkit/cli@latest plugins list
90
-
91
- Available plugins:
92
- - cookie-banner
105
+ makerkit plugins list
93
106
  ```
94
107
 
95
108
  ### Installing plugins
96
109
 
97
- To install a plugin, you can use the `plugins install` command:
110
+ ```
111
+ makerkit plugins add feedback
112
+ ```
113
+
114
+ Install multiple at once:
98
115
 
99
116
  ```
100
- > npx @makerkit/cli@latest plugins install
117
+ makerkit plugins add umami posthog feedback
101
118
  ```
102
119
 
103
- This command will prompt you to select a plugin to install. Once selected, the plugin will be installed in your project.
120
+ Running `plugins add` with no arguments shows a multi-select list of available plugins.
104
121
 
105
122
  ### Updating plugins
106
123
 
107
- To update a plugin, you can use the `plugins update` command:
124
+ ```
125
+ makerkit plugins update
126
+ ```
127
+
128
+ Or specify plugin IDs directly:
129
+
130
+ ```
131
+ makerkit plugins update umami feedback
132
+ ```
133
+
134
+ If your local files differ from the registry, the command lists the modified files and asks for confirmation before overwriting.
135
+
136
+ ### Checking for updates
108
137
 
109
138
  ```
110
- > npx @makerkit/cli@latest plugins update
139
+ makerkit plugins outdated
111
140
  ```
112
141
 
113
- This command will prompt you to select a plugin to update. Once selected, the plugin will be updated in your project.
142
+ ### Diffing plugins
143
+
144
+ ```
145
+ makerkit plugins diff umami
146
+ ```
147
+
148
+ Running `plugins diff` with no arguments prompts you to select an installed plugin. Shows a colored unified diff (via `git diff`) between your local files and the latest registry version.
149
+
150
+ ## MCP Server
114
151
 
115
- ## i18n
152
+ The CLI ships an MCP server (`makerkit-cli-mcp`) that exposes plugin management and project operations as tools for AI agents. This enables AI-powered workflows such as installing plugins, checking for updates, **three-way merge conflict resolution** when updating plugins with local customizations, and **pulling upstream kit updates with AI-assisted conflict resolution**.
116
153
 
117
- The CLI can help you manage your i18n files.
154
+ > **Warning:** AI conflict merging is non-deterministic. Merged output can contain mistakes always review the result and run your test suite before committing.
118
155
 
119
- You can translate from a locale
120
- to another (requires an OpenAI key), and verify that your translations are
121
- in sync between each other.
156
+ ### Available tools
122
157
 
123
- ### Translating
158
+ | Tool | Description |
159
+ |------|-------------|
160
+ | `makerkit_status` | Project introspection: variant, git status, registry config, installed plugins |
161
+ | `makerkit_list_plugins` | List available plugins with install status and metadata |
162
+ | `makerkit_add_plugin` | Install a plugin (codemod, env vars, base version storage) |
163
+ | `makerkit_init_registry` | Cache your GitHub username for registry auth |
164
+ | `makerkit_check_update` | Three-way diff analysis (base/local/remote) with per-file status and content |
165
+ | `makerkit_apply_update` | Write AI-resolved files to disk and update base versions |
166
+ | `makerkit_project_pull` | Pull upstream kit updates, returning conflict details (base/ours/theirs) for AI resolution |
167
+ | `makerkit_project_resolve_conflicts` | Write AI-resolved conflict files, stage them, and complete the merge commit |
124
168
 
125
- To translate your i18n files, you can use the `i18n translate` command:
169
+ ### Installation
170
+
171
+ Install the package globally (or use `npx`/`pnpm dlx`):
126
172
 
127
173
  ```
128
- > npx @makerkit/cli@latest i18n translate en es
174
+ npm i -g @makerkit/cli@latest
129
175
  ```
130
176
 
131
- This command will translate all the keys in your `en/*.json` file to `es/*.
132
- json`. It will use the OpenAI API to translate the keys. You will need to
133
- add a valid OpenAI API key in the `.env.local` file of your Makerkit repository.
177
+ Then configure your AI client to use the MCP server.
178
+
179
+ **Claude Desktop** (`~/.claude/claude_desktop_config.json`):
134
180
 
135
- ### Verifying
181
+ ```json
182
+ {
183
+ "mcpServers": {
184
+ "makerkit-cli": {
185
+ "command": "makerkit-cli-mcp"
186
+ }
187
+ }
188
+ }
189
+ ```
136
190
 
137
- To verify that your i18n files are in sync, you can use the `i18n verify` command:
191
+ **Cursor** (`.cursor/mcp.json` in your project root):
138
192
 
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "makerkit-cli": {
197
+ "command": "makerkit-cli-mcp"
198
+ }
199
+ }
200
+ }
139
201
  ```
140
- > npx @makerkit/cli@latest i18n verify <base-locale>
202
+
203
+ If you haven't installed the package globally, use `npx` instead:
204
+
205
+ ```json
206
+ {
207
+ "mcpServers": {
208
+ "makerkit-cli": {
209
+ "command": "npx",
210
+ "args": ["-y", "@makerkit/cli@latest", "makerkit-cli-mcp"]
211
+ }
212
+ }
213
+ }
141
214
  ```
142
215
 
143
- If you omit the `base-locale` argument, the command will use `en` as the base.
216
+ ### Three-way merge workflow
217
+
218
+ When a plugin is installed or updated, the CLI stores the original registry files as **base versions** in `./node_modules/.cache/makerkit/bases/`. On the next update, the `makerkit_check_update` tool computes a three-way diff (base vs. local vs. remote) for each file and returns one of these statuses:
219
+
220
+ | Status | Meaning |
221
+ |--------|---------|
222
+ | `unchanged` | Local matches remote — nothing to do |
223
+ | `updated` | Only the registry changed — safe to auto-apply |
224
+ | `conflict` | Both sides changed — AI merge needed |
225
+ | `no_base` | Legacy install (no stored base) — two-way diff |
226
+ | `added` | New file from registry |
227
+ | `deleted_locally` | You deleted the file, but registry still ships it |
228
+
229
+ The AI agent reads the base, local, and remote content for `conflict` files, produces a merged version, then calls `makerkit_apply_update` to write the resolved files.
230
+
231
+ Base versions are stored in `node_modules/.cache/makerkit/bases/` — already gitignored by default. They get cleared on `npm ci` or deleting `node_modules/`, in which case plugins fall back to two-way diff (`no_base`) until the next apply restores them.
232
+
233
+ ### Upstream pull workflow
234
+
235
+ The `makerkit_project_pull` and `makerkit_project_resolve_conflicts` tools automate pulling updates from the official MakerKit repository with AI-assisted conflict resolution.
236
+
237
+ **How it works:**
238
+
239
+ 1. The agent calls `makerkit_project_pull` with the project path
240
+ 2. The tool detects the kit variant, configures the `upstream` remote (SSH or HTTPS), fetches, and attempts a merge
241
+ 3. If the merge succeeds, it returns a success response
242
+ 4. If merge conflicts occur, it returns the **base**, **ours** (local), and **theirs** (upstream) content for each conflicting file
243
+ 5. The agent reviews the three versions, produces resolved content, and asks the user for guidance when the intent behind local changes is unclear
244
+ 6. The agent calls `makerkit_project_resolve_conflicts` with the resolved files to write them, stage them, and complete the merge commit
245
+ 7. If some conflicts remain unresolved, the tool reports them so the agent can resolve them in another round