@growthub/create-growthub-local 0.1.45 → 0.1.46

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
@@ -1,79 +1,101 @@
1
1
  # create-growthub-local
2
2
 
3
- Install and run a local Growthub instance GTM or DX surface — in one command.
3
+ `create-growthub-local` is the guided installer for Growthub Local.
4
+
5
+ It supports two installer paths:
6
+
7
+ - profile-driven install for `gtm` or `dx`
8
+ - interactive discovery mode when no profile is passed
4
9
 
5
10
  ## Usage
6
11
 
7
- **Go-to-Market surface:**
12
+ ### Install GTM directly
8
13
 
9
14
  ```bash
10
15
  npm create growthub-local@latest -- --profile gtm
11
16
  ```
12
17
 
13
- **DX (Developer Experience) surface:**
18
+ ### Install DX directly
14
19
 
15
20
  ```bash
16
21
  npm create growthub-local@latest -- --profile dx
17
22
  ```
18
23
 
19
- Both commands install the local runtime into a `growthub-local/` folder in your current directory, onboard a fresh instance, and start the server.
24
+ ### Open the interactive discovery hub
25
+
26
+ ```bash
27
+ npm create growthub-local@latest
28
+ ```
29
+
30
+ When no `--profile` is passed, the installer launches `growthub discover` so the user can choose between:
31
+
32
+ - full local app
33
+ - worker kits
34
+ - shared templates
35
+
36
+ ## CLI Edition User Flows
37
+
38
+ ### 1. Full Local App
39
+
40
+ If `--profile gtm` or `--profile dx` is passed, the installer runs a direct onboarding path for that surface.
41
+
42
+ Flow:
43
+
44
+ 1. Resolve the bundled or installed `@growthub/cli` entrypoint.
45
+ 2. Run `growthub onboard --yes`.
46
+ 3. Save the new instance under the selected data directory.
47
+ 4. Start the local runtime when `--run` is passed.
48
+
49
+ ### 2. Interactive discovery mode
50
+
51
+ If no profile is passed, the installer defers to `growthub discover`.
52
+
53
+ Flow:
54
+
55
+ 1. Launch the CLI discovery hub.
56
+ 2. Choose `Full Local App`, `Worker Kits`, or `Templates`.
57
+ 3. Continue inside the matching CLI workflow.
58
+
59
+ This is the correct path when the user does not yet know whether they want a full app install, a worker kit export, or a shared template pull.
20
60
 
21
61
  ## Options
22
62
 
23
63
  | Flag | Description |
24
64
  |---|---|
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. |
65
+ | `--profile gtm\|dx` | Optional. If provided, install that local app surface directly. |
66
+ | `--run` | Start the local runtime immediately after onboarding. |
67
+ | `--data-dir <path>` | Override the install data directory. Default: `./growthub-local`. |
68
+ | `--config <path>` | Use a custom config path. |
29
69
 
30
- ## What happens
70
+ ## What The Installer Actually Does
31
71
 
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
72
+ 1. Resolves the `@growthub/cli` binary, preferring the local repo build when available.
73
+ 2. Sets installer mode with `GROWTHUB_INSTALLER_MODE=true`.
74
+ 3. If a profile is passed, sets `PAPERCLIP_SURFACE_PROFILE` and runs `growthub onboard --yes`.
75
+ 4. If no profile is passed, runs `growthub discover`.
36
76
 
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.
77
+ ## Starting Again After Install
38
78
 
39
- ## Starting again after install
79
+ If you installed a full local app:
40
80
 
41
81
  ```bash
42
82
  cd growthub-local
43
- npx growthub start
83
+ npx growthub run
44
84
  ```
45
85
 
46
- ## Upgrading
86
+ If you want the interactive CLI again:
47
87
 
48
88
  ```bash
49
- cd growthub-local
50
- npx growthub upgrade
89
+ npx growthub
51
90
  ```
52
91
 
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
92
  ## Requirements
70
93
 
71
94
  - Node.js 20 or later
72
- - npm 7 or later (for `npm create`)
95
+ - npm 7 or later
73
96
 
74
97
  ## Links
75
98
 
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)
99
+ - [GitHub](https://github.com/Growthub-ai/growthub-local)
100
+ - [CLI package](https://github.com/Growthub-ai/growthub-local/tree/main/cli)
101
+ - [Contributing](https://github.com/Growthub-ai/growthub-local/blob/main/CONTRIBUTING.md)
@@ -1,13 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawnSync } from "node:child_process";
4
+ import fs from "node:fs";
4
5
  import { createRequire } from "node:module";
5
6
  import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
6
8
 
7
9
  const require = createRequire(import.meta.url);
10
+ const __filename = fileURLToPath(import.meta.url);
8
11
 
9
12
  function printUsage() {
10
- console.log("Usage: create-growthub-local --profile <dx|gtm> [--run] [--data-dir <path>] [--config <path>]");
13
+ console.log("Usage: create-growthub-local [--profile <dx|gtm>] [--run] [--data-dir <path>] [--config <path>]");
11
14
  }
12
15
 
13
16
  function parseArgs(argv) {
@@ -43,9 +46,9 @@ function parseArgs(argv) {
43
46
  }
44
47
  }
45
48
 
46
- if (profile !== "dx" && profile !== "gtm") {
49
+ if (profile !== null && profile !== "dx" && profile !== "gtm") {
47
50
  printUsage();
48
- console.error("create-growthub-local requires --profile dx or --profile gtm");
51
+ console.error("create-growthub-local only accepts --profile dx or --profile gtm");
49
52
  process.exit(1);
50
53
  }
51
54
 
@@ -53,6 +56,16 @@ function parseArgs(argv) {
53
56
  }
54
57
 
55
58
  function resolveGrowthubCliEntrypoint() {
59
+ const overrideEntrypoint = process.env.GROWTHUB_LOCAL_CLI_ENTRYPOINT?.trim();
60
+ if (overrideEntrypoint) {
61
+ return path.resolve(process.cwd(), overrideEntrypoint);
62
+ }
63
+
64
+ const localRepoCliEntrypoint = path.resolve(path.dirname(__filename), "../../../cli/dist/index.js");
65
+ if (fs.existsSync(localRepoCliEntrypoint)) {
66
+ return localRepoCliEntrypoint;
67
+ }
68
+
56
69
  const cliPackageJsonPath = require.resolve("@growthub/cli/package.json");
57
70
  const cliPackageDir = path.dirname(cliPackageJsonPath);
58
71
  const cliPackage = require(cliPackageJsonPath);
@@ -82,21 +95,31 @@ try {
82
95
 
83
96
  const result = spawnSync(
84
97
  process.execPath,
85
- [
86
- growthubCli,
87
- "onboard",
88
- "--yes",
89
- ...(run ? ["--run"] : []),
90
- "--data-dir",
91
- effectiveDataDir,
92
- ...(config ? ["--config", config] : []),
93
- ],
98
+ profile
99
+ ? [
100
+ growthubCli,
101
+ "onboard",
102
+ "--yes",
103
+ ...(run ? ["--run"] : []),
104
+ "--data-dir",
105
+ effectiveDataDir,
106
+ ...(config ? ["--config", config] : []),
107
+ ]
108
+ : [
109
+ growthubCli,
110
+ "discover",
111
+ ...(run ? ["--run"] : []),
112
+ "--data-dir",
113
+ effectiveDataDir,
114
+ ...(config ? ["--config", config] : []),
115
+ ],
94
116
  {
95
117
  cwd: process.cwd(),
96
118
  stdio: "inherit",
97
119
  env: {
98
120
  ...process.env,
99
- PAPERCLIP_SURFACE_PROFILE: profile,
121
+ GROWTHUB_INSTALLER_MODE: "true",
122
+ ...(profile ? { PAPERCLIP_SURFACE_PROFILE: profile } : {}),
100
123
  },
101
124
  },
102
125
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growthub/create-growthub-local",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Growthub local installer for DX and GTM profiles",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "node": ">=20"
24
24
  },
25
25
  "dependencies": {
26
- "@growthub/cli": "0.3.42"
26
+ "@growthub/cli": "0.3.43"
27
27
  },
28
28
  "keywords": [
29
29
  "growthub",