cnippet-stack 0.0.0 → 0.2.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/index.js +15 -11
  4. package/package.json +20 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cnippet
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 OF ANY OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # cnippet-stack
2
+
3
+ Install full integrations — auth, database, payments, email, storage — into your **existing** Next.js app in minutes.
4
+
5
+ ```bash
6
+ npx cnippet-stack init better-auth
7
+ ```
8
+
9
+ Unlike boilerplates you fork or greenfield generators, cnippet-stack injects working integrations into the project you already have. It detects your setup (App Router, `src/` dir, package manager, ORM, path aliases), asks only the questions it can't answer itself, and writes production-quality code with safe merge strategies — never blindly overwriting your files.
10
+
11
+ ## How it works
12
+
13
+ 1. **Detects** your project: Next.js version, router, TypeScript, package manager, Prisma, aliases — all read statically, nothing executed.
14
+ 2. **Asks** a few questions (e.g. which OAuth providers) — everything detectable is never prompted.
15
+ 3. **Plans** the install and shows you a full diff preview before touching anything.
16
+ 4. **Applies** files with per-file strategies: `create` (fails if the file exists), `append` (idempotent, markered blocks — e.g. Prisma schema models), and AST-based injection (e.g. wrapping a provider in your `layout.tsx`).
17
+ 5. **Finishes** the plumbing: appends env placeholders (auto-generating secrets), installs dependencies with your package manager, runs post-install commands, and lists the manual steps no CLI can do for you (like OAuth console setup).
18
+
19
+ Backups of every modified file are kept in `.cnippet/backup/<timestamp>/`.
20
+
21
+ ## Commands
22
+
23
+ | Command | Description |
24
+ |---|---|
25
+ | `npx cnippet-stack init <recipe>` | Install a recipe into the current project |
26
+ | `npx cnippet-stack list` | List available recipes |
27
+ | `npx cnippet-stack login` | Log in (required for pro recipes) |
28
+ | `npx cnippet-stack logout` | Log out and revoke this device's token |
29
+ | `npx cnippet-stack whoami` | Show the logged-in user |
30
+
31
+ ### Useful flags for `init`
32
+
33
+ | Flag | Effect |
34
+ |---|---|
35
+ | `--dry-run` | Show the full install plan without writing anything |
36
+ | `--yes` | Skip prompts and confirmation, use recipe defaults |
37
+ | `--overwrite` | Allow overwriting files that already exist |
38
+ | `--cwd <path>` | Install into a different directory |
39
+ | `--json` | Machine-readable output (for scripts and AI agents), answers via `--answers '<json>'` |
40
+
41
+ ## Recipes
42
+
43
+ Recipes are versioned, Zod-validated manifests rendered server-side by the registry — browse them at [stack.cnippet.dev/recipes](https://stack.cnippet.dev/recipes). Free recipes need no account; pro recipes require `cnippet-stack login` and a license.
44
+
45
+ Current lineup includes `better-auth` (email/password + OAuth, Prisma models, middleware, starter UI), `prisma`, `biome`, and more shipping continuously — no CLI update needed when recipes are added or improved.
46
+
47
+ ## Requirements
48
+
49
+ - Node.js 18+
50
+ - A Next.js project using the App Router
51
+
52
+ ## Telemetry
53
+
54
+ The CLI sends anonymous install events (recipe name, version, success, duration). Opt out with `CNIPPET_TELEMETRY=0`.
55
+
56
+ ## Ecosystem
57
+
58
+ - [stack.cnippet.dev](https://stack.cnippet.dev) — recipe browser, dashboard, licensing
59
+ - [next.cnippet.dev](https://next.cnippet.dev) — in-depth written integration guides
60
+ - [ui.cnippet.dev](https://ui.cnippet.dev) — component library
61
+
62
+ ## License
63
+
64
+ MIT — see [LICENSE](https://github.com/cnippet-dev/cnippet-stack/blob/main/packages/cli/LICENSE). Recipe templates are rendered by the registry service and are subject to their own tiers/terms.
package/dist/index.js CHANGED
@@ -5930,6 +5930,13 @@ var require_lib = __commonJS({
5930
5930
  import { Command } from "commander";
5931
5931
  import pc7 from "picocolors";
5932
5932
 
5933
+ // src/commands/doctor.ts
5934
+ function runDoctor(recipe) {
5935
+ console.log(
5936
+ `\`cnippet-stack doctor ${recipe}\` isn't implemented yet \u2014 post-install verification lands in Phase 7.`
5937
+ );
5938
+ }
5939
+
5933
5940
  // src/commands/init.ts
5934
5941
  import * as clack2 from "@clack/prompts";
5935
5942
  import pc2 from "picocolors";
@@ -11536,13 +11543,6 @@ async function runInit(options) {
11536
11543
  return { applied: true, preview, recipeVersion: plan.manifest.version, result };
11537
11544
  }
11538
11545
 
11539
- // src/commands/doctor.ts
11540
- function runDoctor(recipe) {
11541
- console.log(
11542
- `\`cnippet-stack doctor ${recipe}\` isn't implemented yet \u2014 post-install verification lands in Phase 7.`
11543
- );
11544
- }
11545
-
11546
11546
  // src/commands/list.ts
11547
11547
  import pc3 from "picocolors";
11548
11548
  async function runList(options = {}) {
@@ -11672,8 +11672,9 @@ async function runWhoami() {
11672
11672
  // src/program.ts
11673
11673
  function resolveRegistrySource(opts) {
11674
11674
  if (opts.localRegistry) return new LocalRegistrySource();
11675
- const url = opts.registry ?? process.env.CNIPPET_REGISTRY_URL;
11676
- return url ? new HttpRegistrySource(url) : void 0;
11675
+ return new HttpRegistrySource(
11676
+ opts.registry ?? process.env.CNIPPET_REGISTRY_URL ?? DEFAULT_REGISTRY_URL
11677
+ );
11677
11678
  }
11678
11679
  function sendTelemetry(registrySource, event) {
11679
11680
  if (process.env.CNIPPET_TELEMETRY === "0") return;
@@ -11729,7 +11730,7 @@ ${pc7.bold("Manual steps:")}`);
11729
11730
  }
11730
11731
  function createProgram() {
11731
11732
  const program = new Command();
11732
- program.name("cnippet-stack").description("Integration installer for Next.js apps.").version("0.0.0");
11733
+ program.name("cnippet-stack").description("Integration installer for Next.js apps.").version(cliVersion());
11733
11734
  program.command("init <recipe>").description("Install a recipe into the current project.").option("--cwd <path>", "Project directory to install into.", process.cwd()).option(
11734
11735
  "--dry-run",
11735
11736
  "Show the install plan without writing anything.",
@@ -11814,7 +11815,10 @@ function createProgram() {
11814
11815
  false
11815
11816
  ).action(async (opts) => {
11816
11817
  try {
11817
- await runList({ json: opts.json, registrySource: resolveRegistrySource(opts) });
11818
+ await runList({
11819
+ json: opts.json,
11820
+ registrySource: resolveRegistrySource(opts)
11821
+ });
11818
11822
  } catch (error) {
11819
11823
  if (error instanceof RegistryHttpError) {
11820
11824
  console.error(pc7.red(`\u2716 ${error.message}`));
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
+ "author": "cnippet <cnippet.dev@gmail.com>",
2
3
  "bin": {
3
4
  "cnippet-stack": "./dist/index.js"
4
5
  },
6
+ "bugs": "https://github.com/cnippet-dev/cnippet-stack/issues",
5
7
  "dependencies": {
6
8
  "@clack/prompts": "^0.10.0",
7
9
  "commander": "^13.1.0",
8
10
  "picocolors": "^1.1.1",
9
11
  "ts-morph": "^25.0.1"
10
12
  },
13
+ "description": "CLI that installs full integrations (auth, payments, email, storage) into your existing Next.js app — detection, prompts, safe file injection, env setup.",
11
14
  "devDependencies": {
12
15
  "@cnippet/registry": "workspace:*",
13
16
  "@cnippet/validators": "workspace:*",
@@ -28,12 +31,28 @@
28
31
  "files": [
29
32
  "dist"
30
33
  ],
34
+ "homepage": "https://stack.cnippet.dev",
35
+ "keywords": [
36
+ "nextjs",
37
+ "cli",
38
+ "integrations",
39
+ "installer",
40
+ "scaffold",
41
+ "better-auth",
42
+ "prisma",
43
+ "cnippet"
44
+ ],
31
45
  "license": "MIT",
32
46
  "main": "./dist/index.js",
33
47
  "name": "cnippet-stack",
34
48
  "publishConfig": {
35
49
  "access": "public"
36
50
  },
51
+ "repository": {
52
+ "directory": "packages/cli",
53
+ "type": "git",
54
+ "url": "git+https://github.com/cnippet-dev/cnippet-stack.git"
55
+ },
37
56
  "scripts": {
38
57
  "build": "tsup",
39
58
  "check-types": "tsc --noEmit",
@@ -43,5 +62,5 @@
43
62
  },
44
63
  "type": "module",
45
64
  "types": "./dist/index.d.ts",
46
- "version": "0.0.0"
65
+ "version": "0.2.0"
47
66
  }