create-agentic-bp-ds 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.
Files changed (3) hide show
  1. package/README.md +18 -0
  2. package/index.mjs +72 -0
  3. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # create-agentic-bp-ds
2
+
3
+ Start a new prototype from the Agentic BP DS kit in one command.
4
+
5
+ ```bash
6
+ npm create agentic-bp-ds@latest my-prototype
7
+ ```
8
+
9
+ It downloads the latest kit, installs it, and tells you how to start. Then:
10
+
11
+ ```bash
12
+ cd my-prototype
13
+ npm run dev
14
+ ```
15
+
16
+ Open http://localhost:3000 to browse the catalog. Needs Node 20 or newer.
17
+
18
+ Kit repo: https://github.com/borisj74/agentic-bp-ds-kit
package/index.mjs ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ // npm create agentic-bp-ds@latest [folder]
3
+ // Copies the latest kit from GitHub into a new folder, installs it and tells you how to start. No dependencies:
4
+ // it downloads the repo tarball with fetch and unpacks it with the system tar (macOS, Linux and Windows 10+).
5
+
6
+ import { spawnSync } from "node:child_process";
7
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
8
+ import { tmpdir } from "node:os";
9
+ import { basename, join, resolve } from "node:path";
10
+ import { createInterface } from "node:readline/promises";
11
+
12
+ const REPO = "borisj74/agentic-bp-ds-kit";
13
+ const TARBALL = `https://codeload.github.com/${REPO}/tar.gz/refs/heads/main`;
14
+ // Files that belong to the kit's own repo, not to a prototype made from it.
15
+ const DROP = ["packages", "LICENSE"];
16
+
17
+ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
18
+ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
19
+ const fail = (msg) => {
20
+ console.error(`\n ${msg}\n`);
21
+ process.exit(1);
22
+ };
23
+
24
+ const [major] = process.versions.node.split(".").map(Number);
25
+ if (major < 20) fail(`Node ${process.versions.node} is too old. Install Node 20 or newer from https://nodejs.org and try again.`);
26
+
27
+ let name = process.argv[2];
28
+ if (!name) {
29
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
30
+ name = (await rl.question(` Folder name ${dim("(my-prototype)")}: `)).trim() || "my-prototype";
31
+ rl.close();
32
+ }
33
+
34
+ const target = resolve(name);
35
+ if (existsSync(target) && readdirSync(target).length > 0) fail(`The folder "${name}" already exists and is not empty. Pick another name.`);
36
+
37
+ console.log(`\n Downloading the kit into ${bold(name)} ...`);
38
+ const res = await fetch(TARBALL).catch(() => null);
39
+ if (!res?.ok) fail("Could not download the kit. Check your internet connection and try again.");
40
+
41
+ const archive = join(tmpdir(), `agentic-bp-ds-${Date.now()}.tar.gz`);
42
+ writeFileSync(archive, Buffer.from(await res.arrayBuffer()));
43
+ mkdirSync(target, { recursive: true });
44
+ const untar = spawnSync("tar", ["-xzf", archive, "--strip-components=1", "-C", target], { stdio: "inherit" });
45
+ rmSync(archive, { force: true });
46
+ if (untar.status !== 0) fail("Could not unpack the kit. Make sure the tar command is available.");
47
+
48
+ for (const entry of DROP) rmSync(join(target, entry), { recursive: true, force: true });
49
+
50
+ const pkgPath = join(target, "package.json");
51
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
52
+ pkg.name = basename(target).toLowerCase().replace(/[^a-z0-9-_.]/g, "-");
53
+ pkg.version = "0.1.0";
54
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
55
+
56
+ // Install with whichever tool ran this (npm, pnpm, yarn or bun).
57
+ const agent = (process.env.npm_config_user_agent ?? "npm").split("/")[0];
58
+ const pm = ["pnpm", "yarn", "bun"].includes(agent) ? agent : "npm";
59
+ console.log(` Installing with ${pm} ...\n`);
60
+ const install = spawnSync(pm, ["install"], { cwd: target, stdio: "inherit", shell: process.platform === "win32" });
61
+
62
+ const run = pm === "npm" ? "npm run dev" : `${pm} dev`;
63
+ console.log(`
64
+ ${bold("Done.")} Your prototype is in ${bold(name)}.
65
+ ${install.status === 0 ? "" : `\n The install did not finish. Run ${bold(`${pm} install`)} inside the folder first.\n`}
66
+ Start it:
67
+ cd ${name}
68
+ ${run}
69
+
70
+ Then open http://localhost:3000 to browse the catalog.
71
+ Read CLAUDE.md before you build a screen: it has the kit rules your AI assistant follows.
72
+ `);
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "create-agentic-bp-ds",
3
+ "version": "0.1.0",
4
+ "description": "Start a new prototype from the Agentic BP DS kit in one command.",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-agentic-bp-ds": "index.mjs"
8
+ },
9
+ "files": [
10
+ "index.mjs",
11
+ "README.md"
12
+ ],
13
+ "engines": {
14
+ "node": ">=20"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/borisj74/agentic-bp-ds-kit.git",
19
+ "directory": "packages/create-agentic-bp-ds"
20
+ },
21
+ "homepage": "https://github.com/borisj74/agentic-bp-ds-kit#readme",
22
+ "keywords": [
23
+ "create",
24
+ "design-system",
25
+ "prototype",
26
+ "nextjs"
27
+ ],
28
+ "author": "Boris Jovanovic",
29
+ "license": "MIT"
30
+ }