@growthub/create-growthub-local 0.1.45

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 ADDED
@@ -0,0 +1,79 @@
1
+ # create-growthub-local
2
+
3
+ Install and run a local Growthub instance — GTM or DX surface — in one command.
4
+
5
+ ## Usage
6
+
7
+ **Go-to-Market surface:**
8
+
9
+ ```bash
10
+ npm create growthub-local@latest -- --profile gtm
11
+ ```
12
+
13
+ **DX (Developer Experience) surface:**
14
+
15
+ ```bash
16
+ npm create growthub-local@latest -- --profile dx
17
+ ```
18
+
19
+ Both commands install the local runtime into a `growthub-local/` folder in your current directory, onboard a fresh instance, and start the server.
20
+
21
+ ## Options
22
+
23
+ | Flag | Description |
24
+ |---|---|
25
+ | `--profile gtm\|dx` | Required. Selects the surface to install. |
26
+ | `--run` | Start the server immediately after install. |
27
+ | `--data-dir <path>` | Custom directory for instance data (default: `./growthub-local`). |
28
+ | `--config <path>` | Path to a custom config file. |
29
+
30
+ ## What happens
31
+
32
+ 1. Installs `@growthub/cli` and provisions a local instance
33
+ 2. Starts an embedded PostgreSQL database on an auto-selected port
34
+ 3. Serves the local UI at `http://localhost:3100` (GTM) or `http://localhost:3101` (DX)
35
+ 4. Opens the Growthub Connection card — complete auth to bridge to hosted Growthub
36
+
37
+ For GTM installs, browser-agent execution is issue-bound through heartbeat. Concurrent browser agents can run on distinct runtime browser slots when launched from real assigned issues.
38
+
39
+ ## Starting again after install
40
+
41
+ ```bash
42
+ cd growthub-local
43
+ npx growthub start
44
+ ```
45
+
46
+ ## Upgrading
47
+
48
+ ```bash
49
+ cd growthub-local
50
+ npx growthub upgrade
51
+ ```
52
+
53
+ Upgrades the CLI and server in place. Runs any pending migrations. No data loss.
54
+
55
+ ## Running two surfaces
56
+
57
+ Each surface needs its own directory:
58
+
59
+ ```bash
60
+ mkdir gtm-fresh && cd gtm-fresh
61
+ npm create growthub-local@latest -- --profile gtm --run
62
+
63
+ mkdir dx-fresh && cd dx-fresh
64
+ npm create growthub-local@latest -- --profile dx --run
65
+ ```
66
+
67
+ Each instance gets an isolated database and port. They share no state.
68
+
69
+ ## Requirements
70
+
71
+ - Node.js 20 or later
72
+ - npm 7 or later (for `npm create`)
73
+
74
+ ## Links
75
+
76
+ - [GitHub](https://github.com/antonioromero1220/growthub-local)
77
+ - [Contributing](https://github.com/antonioromero1220/growthub-local/blob/main/CONTRIBUTING.md)
78
+ - [Frozen browser isolation snapshot](https://github.com/antonioromero1220/growthub-local/blob/main/docs/FROZEN_GTM_BROWSER_AGENT_ISOLATION_STATE.md)
79
+ - [Issues](https://github.com/antonioromero1220/growthub-local/issues)
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import { createRequire } from "node:module";
5
+ import path from "node:path";
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ function printUsage() {
10
+ console.log("Usage: create-growthub-local --profile <dx|gtm> [--run] [--data-dir <path>] [--config <path>]");
11
+ }
12
+
13
+ function parseArgs(argv) {
14
+ let profile = null;
15
+ let run = false;
16
+ let dataDir = null;
17
+ let config = null;
18
+
19
+ for (let index = 0; index < argv.length; index += 1) {
20
+ const value = argv[index];
21
+ if (value === "--profile" && argv[index + 1]) {
22
+ profile = argv[index + 1];
23
+ index += 1;
24
+ continue;
25
+ }
26
+ if (value === "--run") {
27
+ run = true;
28
+ continue;
29
+ }
30
+ if ((value === "-d" || value === "--data-dir") && argv[index + 1]) {
31
+ dataDir = argv[index + 1];
32
+ index += 1;
33
+ continue;
34
+ }
35
+ if ((value === "-c" || value === "--config") && argv[index + 1]) {
36
+ config = argv[index + 1];
37
+ index += 1;
38
+ continue;
39
+ }
40
+ if (value === "-h" || value === "--help") {
41
+ printUsage();
42
+ process.exit(0);
43
+ }
44
+ }
45
+
46
+ if (profile !== "dx" && profile !== "gtm") {
47
+ printUsage();
48
+ console.error("create-growthub-local requires --profile dx or --profile gtm");
49
+ process.exit(1);
50
+ }
51
+
52
+ return { profile, run, dataDir, config };
53
+ }
54
+
55
+ function resolveGrowthubCliEntrypoint() {
56
+ const cliPackageJsonPath = require.resolve("@growthub/cli/package.json");
57
+ const cliPackageDir = path.dirname(cliPackageJsonPath);
58
+ const cliPackage = require(cliPackageJsonPath);
59
+ const growthubBin = cliPackage?.bin?.growthub;
60
+
61
+ if (typeof growthubBin !== "string" || growthubBin.trim().length === 0) {
62
+ throw new Error("Installed @growthub/cli package does not expose a growthub binary");
63
+ }
64
+
65
+ return path.resolve(cliPackageDir, growthubBin);
66
+ }
67
+
68
+ const { profile, run, dataDir, config } = parseArgs(process.argv.slice(2));
69
+ const effectiveDataDir = dataDir ? path.resolve(process.cwd(), dataDir) : path.resolve(process.cwd(), "growthub-local");
70
+ let growthubCli;
71
+
72
+ try {
73
+ growthubCli = resolveGrowthubCliEntrypoint();
74
+ } catch (error) {
75
+ console.error(
76
+ error instanceof Error
77
+ ? `create-growthub-local could not resolve the Growthub CLI: ${error.message}`
78
+ : "create-growthub-local could not resolve the Growthub CLI",
79
+ );
80
+ process.exit(1);
81
+ }
82
+
83
+ const result = spawnSync(
84
+ process.execPath,
85
+ [
86
+ growthubCli,
87
+ "onboard",
88
+ "--yes",
89
+ ...(run ? ["--run"] : []),
90
+ "--data-dir",
91
+ effectiveDataDir,
92
+ ...(config ? ["--config", config] : []),
93
+ ],
94
+ {
95
+ cwd: process.cwd(),
96
+ stdio: "inherit",
97
+ env: {
98
+ ...process.env,
99
+ PAPERCLIP_SURFACE_PROFILE: profile,
100
+ },
101
+ },
102
+ );
103
+
104
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@growthub/create-growthub-local",
3
+ "version": "0.1.45",
4
+ "description": "Growthub local installer for DX and GTM profiles",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Growthub-ai/growthub-local",
10
+ "directory": "packages/create-growthub-local"
11
+ },
12
+ "homepage": "https://github.com/Growthub-ai/growthub-local#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/Growthub-ai/growthub-local/issues"
15
+ },
16
+ "bin": {
17
+ "create-growthub-local": "./bin/create-growthub-local.mjs"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "dependencies": {
26
+ "@growthub/cli": "0.3.42"
27
+ },
28
+ "keywords": [
29
+ "growthub",
30
+ "paperclip",
31
+ "local",
32
+ "gtm",
33
+ "dx",
34
+ "ai-agents",
35
+ "agent-orchestration",
36
+ "local-dev"
37
+ ],
38
+ "files": [
39
+ "bin",
40
+ "README.md"
41
+ ],
42
+ "scripts": {
43
+ "pack:dry-run": "npm pack --dry-run"
44
+ }
45
+ }