@growthub/cli 0.3.39 → 0.3.41

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
@@ -16,67 +16,127 @@ Later:
16
16
  npx create-growthub-local --profile gtm
17
17
  ```
18
18
 
19
- ## Worker Kits V1
19
+ ## Worker Kits
20
20
 
21
- The CLI ships a bundled Worker Kit export surface for local adapter environments.
22
- These kits are not server installs or database records. They are frozen, working-directory-ready
23
- artifacts that local adapters can run inside directly.
21
+ Worker kits are frozen, working-directory-ready execution environments for local AI agents.
22
+ Each kit bundles prompts, templates, output standards, brand guides, setup scripts, and a
23
+ `CLAUDE.md` operator contract everything an agent needs to run a vertical workflow immediately.
24
24
 
25
- They should be understood as packaged execution environments. A kit can carry prompts, templates, examples, output standards, and local runtime assumptions together as one reusable environment.
25
+ ### Discovery
26
26
 
27
27
  ```bash
28
+ # Interactive browser — family filter → searchable selector → preview → download
29
+ growthub kit
30
+
31
+ # All kits grouped by family with descriptions and inline download commands
28
32
  growthub kit list
33
+
34
+ # Filter by family (studio · workflow · operator · ops)
35
+ growthub kit list --family studio
36
+ growthub kit list --family studio,operator
37
+
38
+ # Machine-readable output for scripting / agent use
39
+ growthub kit list --json
40
+
41
+ # Official family taxonomy — taglines, surfaces, and examples
42
+ growthub kit families
43
+ ```
44
+
45
+ ### Download
46
+
47
+ ```bash
48
+ # Interactive (picker if no kit-id given)
49
+ growthub kit download
50
+
51
+ # Fuzzy slug — partial IDs resolve automatically
52
+ growthub kit download higgsfield # → growthub-open-higgsfield-studio-v1
53
+ growthub kit download email # → growthub-email-marketing-v1
54
+ growthub kit download studio-v1 # → growthub-open-higgsfield-studio-v1
55
+
56
+ # Full ID
57
+ growthub kit download growthub-open-higgsfield-studio-v1
58
+
59
+ # Custom output directory
60
+ growthub kit download higgsfield --out ~/my-kits
61
+
62
+ # Skip confirmation prompt (scripting / agent use)
63
+ growthub kit download higgsfield --yes
64
+ ```
65
+
66
+ ### Inspect & validate
67
+
68
+ ```bash
69
+ # Pretty manifest output with family badge and required paths
70
+ growthub kit inspect higgsfield-studio-v1
29
71
  growthub kit inspect creative-strategist-v1
30
72
  growthub kit inspect growthub-open-higgsfield-studio-v1
31
- growthub kit download creative-strategist-v1
32
- growthub kit download growthub-open-higgsfield-studio-v1
73
+
74
+ # Raw JSON for scripting
75
+ growthub kit inspect growthub-email-marketing-v1 --json
76
+
77
+ # Resolve export folder path without exporting
33
78
  growthub kit path creative-strategist-v1
79
+
80
+ # Validate a kit directory against the schema
34
81
  growthub kit validate /absolute/path/to/kit
82
+ growthub kit validate ~/kits/growthub-open-higgsfield-studio-v1
35
83
  ```
36
84
 
37
- V1 is intentionally narrow:
85
+ ```bash
86
+ # Full ID download examples
87
+ growthub kit download creative-strategist-v1
88
+ growthub kit download growthub-open-higgsfield-studio-v1
89
+ ```
38
90
 
39
- - bundled catalog plus local export only
40
- - downloadable worker kits for creative strategy, email strategy, and Open Higgsfield AI visual production
41
- - deterministic zip plus expanded export folder
42
- - public example brand kits only
43
- - no heartbeat wiring, app install flow, server registry, plugin lifecycle, or database kit records
91
+ ### After download
44
92
 
45
- ### How local adapters use worker kits
93
+ ```
94
+ 1. Point Growthub local Working Directory at the exported folder
95
+ (or Claude Code Working Directory as an alternative)
96
+ 2. cp .env.example .env → add your API key
97
+ 3. bash setup/clone-fork.sh → boot local fork (studio kits only)
98
+ 4. Open a new session — the operator agent loads automatically from CLAUDE.md
99
+ ```
46
100
 
47
- Local adapters such as Claude, Codex, Cursor, Gemini, and OpenCode execute inside the agent
48
- `Working directory` path.
101
+ ### Kit families
49
102
 
50
- Growthub worker kits are designed to plug into that path directly:
103
+ | Family | Description | Default surface |
104
+ |---|---|---|
105
+ | 🎬 **studio** | AI generation studio backed by a local fork | local-fork |
106
+ | 🔄 **workflow** | Multi-step pipeline operator across tools or APIs | browser-hosted |
107
+ | 🤖 **operator** | Domain vertical specialist — structured deliverables | browser-hosted |
108
+ | ⚙️ **ops** | Infrastructure / toolchain operator | local-fork |
51
109
 
52
- 1. Export a kit with `growthub kit download <kit-id>` or resolve its folder with `growthub kit path <kit-id>`.
53
- 2. Take the expanded folder on disk.
54
- 3. Put that absolute path into the agent's `Working directory` field.
55
- 4. Run the local adapter against that exported environment.
110
+ ### Available kits
56
111
 
57
- This is the current integration surface for worker kits in Growthub. In other words, the worker kit
58
- becomes a specialized local execution environment that an agent can access and work within through
59
- its configured working directory.
112
+ | Kit | Family | Description |
113
+ |---|---|---|
114
+ | `growthub-open-higgsfield-studio-v1` | studio | Open Higgsfield AI visual production (image, video, lip sync, cinema) |
115
+ | `growthub-email-marketing-v1` | operator | Brand-aware email campaigns, nurture sequences, and content pillar plans |
116
+ | `creative-strategist-v1` | workflow | Video creative briefs and campaign strategy |
60
117
 
61
- ### Environment expansion model
118
+ ### How local adapters use worker kits
62
119
 
63
- The packaging model supports more than a single strategy kit.
120
+ Local adapters (Claude Code, Codex, Cursor, Gemini, OpenCode) execute inside the agent
121
+ `Working directory` path. Worker kits are designed to plug into that path directly:
64
122
 
65
- The same packaging model can support:
123
+ 1. `growthub kit download <id>` — exports the kit as a folder + zip
124
+ 2. Point the agent `Working directory` at the exported folder path
125
+ 3. The agent reads `CLAUDE.md` on session start and runs the operator workflow automatically
66
126
 
67
- - strategy environments
68
- - email marketing environments
69
- - browser-heavy GTM environments
70
- - local production environments such as motion or Remotion-based workflows
127
+ ### Adding new kits
71
128
 
72
- That means a new environment should usually be added as:
129
+ Each new kit should be:
73
130
 
74
- 1. a self-contained kit folder
75
- 2. a manifest and bundle contract
76
- 3. registered catalog metadata
77
- 4. a real local adapter validation pass through `Working directory`
131
+ 1. A self-contained kit folder in `cli/assets/worker-kits/`
132
+ 2. A `kit.json` manifest (schema v2) with `family`, `frozenAssetPaths`, and `outputStandard`
133
+ 3. A bundle manifest in `bundles/`
134
+ 4. A catalog entry in `cli/src/kits/catalog.ts`
135
+ 5. Validated with `growthub kit validate ./path/to/kit`
78
136
 
79
- not as a new one-off CLI code path.
137
+ The kit family factory layer (`cli/src/kits/core/factory/`) provides typed `createStudioKitConfig()`,
138
+ `createWorkflowKitConfig()`, `createOperatorKitConfig()`, and `createOpsKitConfig()` builders that
139
+ assemble a fully validated `ForkAdapterCoreConfig` from a small set of options.
80
140
 
81
141
  ## What this is
82
142
 
@@ -7,7 +7,8 @@
7
7
  "description": "Frozen Creative Strategist worker kit for exporting a working-directory-ready video creative brief worker.",
8
8
  "type": "worker",
9
9
  "visibility": "public-open-source",
10
- "sourceRepo": "claude-workers"
10
+ "sourceRepo": "claude-workers",
11
+ "family": "workflow"
11
12
  },
12
13
  "entrypoint": {
13
14
  "workerId": "creative-strategist",
@@ -71,7 +72,9 @@
71
72
  }
72
73
  ],
73
74
  "executionMode": "export",
74
- "activationModes": ["export"],
75
+ "activationModes": [
76
+ "export"
77
+ ],
75
78
  "compatibility": {
76
79
  "cliMinVersion": "0.3.35"
77
80
  },
@@ -7,7 +7,8 @@
7
7
  "description": "Self-contained local execution environment for Growthub-focused email marketing. Produces brand-aware email campaigns, nurture sequences, broadcasts, and content-pillar-driven campaign plans with pluggable email platform integration.",
8
8
  "type": "worker",
9
9
  "visibility": "public-open-source",
10
- "sourceRepo": "growthub-local"
10
+ "sourceRepo": "growthub-local",
11
+ "family": "operator"
11
12
  },
12
13
  "entrypoint": {
13
14
  "workerId": "email-marketing-strategist",
@@ -90,7 +91,9 @@
90
91
  }
91
92
  ],
92
93
  "executionMode": "export",
93
- "activationModes": ["export"],
94
+ "activationModes": [
95
+ "export"
96
+ ],
94
97
  "compatibility": {
95
98
  "cliMinVersion": "0.3.37"
96
99
  },
@@ -50,7 +50,17 @@ Checks for `node`, `npm`, `git`, and `ffmpeg`. All four are required for local-f
50
50
  bash setup/clone-fork.sh
51
51
  ```
52
52
 
53
- Clones the Open Higgsfield AI repo to `~/open-higgsfield-ai`, installs dependencies, and starts the dev server at `http://localhost:3001`. Skip this if you are using browser-hosted or desktop-app mode.
53
+ Clones the Open Higgsfield AI repo to `~/open-higgsfield-ai`, installs dependencies, **automatically applies the CORS proxy patch** (see `setup/patch-cors-proxy.sh`), and starts the dev server at `http://localhost:3001`.
54
+
55
+ The CORS patch is required — the upstream repo calls `api.muapi.ai` directly from the browser, which modern browsers block. The patch routes all API calls through the local Next.js server instead.
56
+
57
+ Skip this step if you are using browser-hosted or desktop-app mode.
58
+
59
+ **Already cloned but hitting CORS errors?** Run the patch standalone:
60
+ ```bash
61
+ bash setup/patch-cors-proxy.sh
62
+ ```
63
+ Then restart your dev server.
54
64
 
55
65
  ---
56
66
 
@@ -7,7 +7,8 @@
7
7
  "description": "Self-contained local execution environment for Open Higgsfield AI visual production. Produces implementation-ready visual briefs, prompt systems, shot plans, generation batches, model selections, and execution handoff artifacts for browser, desktop, and local fork workflows.",
8
8
  "type": "worker",
9
9
  "visibility": "public-open-source",
10
- "sourceRepo": "growthub-local"
10
+ "sourceRepo": "growthub-local",
11
+ "family": "studio"
11
12
  },
12
13
  "entrypoint": {
13
14
  "workerId": "open-higgsfield-studio-operator",
@@ -33,6 +34,7 @@
33
34
  "brands/growthub/brand-kit.md",
34
35
  "brands/NEW-CLIENT.md",
35
36
  "setup/clone-fork.sh",
37
+ "setup/patch-cors-proxy.sh",
36
38
  "setup/verify-env.mjs",
37
39
  "setup/check-deps.sh",
38
40
  "output/README.md",
@@ -79,6 +81,7 @@
79
81
  "brands/growthub/brand-kit.md",
80
82
  "brands/NEW-CLIENT.md",
81
83
  "setup/clone-fork.sh",
84
+ "setup/patch-cors-proxy.sh",
82
85
  "setup/verify-env.mjs",
83
86
  "setup/check-deps.sh",
84
87
  "output/README.md",
@@ -95,7 +98,9 @@
95
98
  }
96
99
  ],
97
100
  "executionMode": "export",
98
- "activationModes": ["export"],
101
+ "activationModes": [
102
+ "export"
103
+ ],
99
104
  "compatibility": {
100
105
  "cliMinVersion": "0.3.37"
101
106
  },
@@ -34,6 +34,43 @@ If the local fork differs, the fork wins.
34
34
 
35
35
  ---
36
36
 
37
+ ## KNOWN FORK ISSUE — CORS POLICY (local-fork mode)
38
+
39
+ **Status:** Fixed. Patch is applied automatically by `setup/clone-fork.sh`.
40
+
41
+ **Root cause:** The upstream repo hardcodes `const BASE_URL = 'https://api.muapi.ai'` in
42
+ `packages/studio/src/muapi.js`. All browser fetch/XHR calls go directly to the external
43
+ API. `api.muapi.ai` does not return `Access-Control-Allow-Origin` headers, so every call
44
+ from `localhost:3001` is blocked by the browser's CORS policy.
45
+
46
+ **Errors you will see without the patch:**
47
+ ```
48
+ Access to fetch at 'https://api.muapi.ai/api/v1/account/balance'
49
+ from origin 'http://localhost:3001' has been blocked by CORS policy:
50
+ No 'Access-Control-Allow-Origin' header is present on the requested resource.
51
+ ```
52
+
53
+ **The fix:**
54
+ 1. `next.config.mjs` — rewrites `/muapi-proxy/:path*` → `https://api.muapi.ai/:path*` server-side
55
+ 2. `packages/studio/src/muapi.js` — `BASE_URL` changed to `'/muapi-proxy'`
56
+
57
+ All browser calls now hit `localhost:3001/muapi-proxy/...` (same origin, no CORS).
58
+ Next.js proxies them to `api.muapi.ai` from the server where CORS does not apply.
59
+
60
+ **To apply manually if not already patched:**
61
+ ```bash
62
+ bash setup/patch-cors-proxy.sh [path-to-fork]
63
+ # defaults to ~/open-higgsfield-ai
64
+ ```
65
+
66
+ **Affected functions in muapi.js:**
67
+ - `getUserBalance` — `/api/v1/account/balance`
68
+ - `submitAndPoll` — `/api/v1/${endpoint}`
69
+ - `pollForResult` — `/api/v1/predictions/${requestId}/result`
70
+ - `uploadFile` (XHR) — `/api/v1/upload_file`
71
+
72
+ ---
73
+
37
74
  ## EXECUTION SURFACES
38
75
 
39
76
  ### Local fork
@@ -20,6 +20,19 @@ cd "$FORK_DIR"
20
20
  echo "Installing dependencies..."
21
21
  npm install
22
22
 
23
+ echo ""
24
+ echo "Applying CORS proxy patch..."
25
+ # The upstream repo calls api.muapi.ai directly from the browser, which is blocked
26
+ # by CORS policy. This patch routes all API calls through the Next.js server.
27
+ # See setup/patch-cors-proxy.sh for full explanation.
28
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29
+ if [ -f "$SCRIPT_DIR/patch-cors-proxy.sh" ]; then
30
+ bash "$SCRIPT_DIR/patch-cors-proxy.sh" "$FORK_DIR"
31
+ else
32
+ echo "WARNING: patch-cors-proxy.sh not found — skipping CORS patch."
33
+ echo "You may hit CORS errors when the studio calls api.muapi.ai from the browser."
34
+ fi
35
+
23
36
  echo ""
24
37
  echo "Starting dev server on http://localhost:$PORT"
25
38
  echo "Press Ctrl+C to stop."
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env bash
2
+ # patch-cors-proxy.sh — Apply Next.js CORS proxy patch to the Open Higgsfield AI local fork
3
+ #
4
+ # WHY THIS EXISTS
5
+ # ---------------
6
+ # The upstream repo calls api.muapi.ai directly from the browser (BASE_URL in muapi.js).
7
+ # api.muapi.ai does not return Access-Control-Allow-Origin headers, so every browser
8
+ # request from localhost:3001 is blocked by CORS policy.
9
+ #
10
+ # THE FIX
11
+ # -------
12
+ # 1. next.config.mjs — adds a rewrites() block:
13
+ # /muapi-proxy/:path* → https://api.muapi.ai/:path* (server-side, no CORS)
14
+ #
15
+ # 2. packages/studio/src/muapi.js — changes BASE_URL:
16
+ # 'https://api.muapi.ai' → '/muapi-proxy'
17
+ #
18
+ # All fetch/XHR calls now hit the local Next.js server which proxies them server-side.
19
+ # No browser cross-origin request is made. CORS policy never fires.
20
+ #
21
+ # USAGE
22
+ # -----
23
+ # bash setup/patch-cors-proxy.sh [path-to-fork]
24
+ #
25
+ # Defaults to ~/open-higgsfield-ai if no path given.
26
+ # Safe to run multiple times — idempotent.
27
+
28
+ set -e
29
+
30
+ FORK_DIR="${1:-$HOME/open-higgsfield-ai}"
31
+ NEXT_CONFIG="$FORK_DIR/next.config.mjs"
32
+ MUAPI_JS="$FORK_DIR/packages/studio/src/muapi.js"
33
+
34
+ echo ""
35
+ echo "=== CORS Proxy Patch ==="
36
+ echo "Fork: $FORK_DIR"
37
+ echo ""
38
+
39
+ # ── Guard: fork must exist ──────────────────────────────────────────────────
40
+ if [ ! -d "$FORK_DIR" ]; then
41
+ echo "ERROR: Fork not found at $FORK_DIR"
42
+ echo "Run setup/clone-fork.sh first."
43
+ exit 1
44
+ fi
45
+
46
+ if [ ! -f "$NEXT_CONFIG" ]; then
47
+ echo "ERROR: next.config.mjs not found at $NEXT_CONFIG"
48
+ exit 1
49
+ fi
50
+
51
+ if [ ! -f "$MUAPI_JS" ]; then
52
+ echo "ERROR: muapi.js not found at $MUAPI_JS"
53
+ exit 1
54
+ fi
55
+
56
+ # ── Idempotency check ───────────────────────────────────────────────────────
57
+ if grep -q "muapi-proxy" "$NEXT_CONFIG" 2>/dev/null; then
58
+ echo "✓ next.config.mjs already patched — skipping."
59
+ NEXT_DONE=1
60
+ else
61
+ NEXT_DONE=0
62
+ fi
63
+
64
+ if grep -q "muapi-proxy" "$MUAPI_JS" 2>/dev/null; then
65
+ echo "✓ muapi.js already patched — skipping."
66
+ MUAPI_DONE=1
67
+ else
68
+ MUAPI_DONE=0
69
+ fi
70
+
71
+ if [ "$NEXT_DONE" -eq 1 ] && [ "$MUAPI_DONE" -eq 1 ]; then
72
+ echo ""
73
+ echo "Both files already patched. Nothing to do."
74
+ exit 0
75
+ fi
76
+
77
+ # ── Backup originals ────────────────────────────────────────────────────────
78
+ if [ "$NEXT_DONE" -eq 0 ]; then
79
+ cp "$NEXT_CONFIG" "$NEXT_CONFIG.orig"
80
+ fi
81
+ if [ "$MUAPI_DONE" -eq 0 ]; then
82
+ cp "$MUAPI_JS" "$MUAPI_JS.orig"
83
+ fi
84
+
85
+ # ── Patch next.config.mjs ───────────────────────────────────────────────────
86
+ if [ "$NEXT_DONE" -eq 0 ]; then
87
+ cat > "$NEXT_CONFIG" << 'NEXTEOF'
88
+ /** @type {import('next').NextConfig} */
89
+ const nextConfig = {
90
+ transpilePackages: ['studio'],
91
+
92
+ // CORS proxy — forward all Muapi API calls through the Next.js server so
93
+ // the browser never makes cross-origin requests to api.muapi.ai directly.
94
+ // muapi.js uses BASE_URL = '/muapi-proxy', so every fetch/XHR hits
95
+ // /muapi-proxy/api/v1/... which Next.js rewrites to api.muapi.ai server-side.
96
+ async rewrites() {
97
+ return [
98
+ {
99
+ source: '/muapi-proxy/:path*',
100
+ destination: 'https://api.muapi.ai/:path*',
101
+ },
102
+ ];
103
+ },
104
+ };
105
+
106
+ export default nextConfig;
107
+ NEXTEOF
108
+ echo "✓ next.config.mjs patched — added /muapi-proxy rewrites()"
109
+ fi
110
+
111
+ # ── Patch muapi.js ──────────────────────────────────────────────────────────
112
+ if [ "$MUAPI_DONE" -eq 0 ]; then
113
+ # Replace the BASE_URL line only (targeted sed, not full file rewrite)
114
+ sed -i.bak \
115
+ "s|const BASE_URL = 'https://api.muapi.ai';|// Proxy through Next.js to avoid CORS. All calls route through /muapi-proxy/:path*\n// which next.config.mjs rewrites to api.muapi.ai server-side — no CORS headers needed.\nconst BASE_URL = '/muapi-proxy';|" \
116
+ "$MUAPI_JS"
117
+ # Remove sed backup (we already made our own)
118
+ rm -f "$MUAPI_JS.bak"
119
+ echo "✓ muapi.js patched — BASE_URL changed to '/muapi-proxy'"
120
+ fi
121
+
122
+ # ── Verify ───────────────────────────────────────────────────────────────────
123
+ echo ""
124
+ echo "Verifying patch..."
125
+
126
+ if grep -q "muapi-proxy" "$NEXT_CONFIG" && grep -q "muapi-proxy" "$MUAPI_JS"; then
127
+ echo "✓ Patch verified. Both files updated correctly."
128
+ else
129
+ echo "ERROR: Patch verification failed. Check the files manually."
130
+ echo " $NEXT_CONFIG"
131
+ echo " $MUAPI_JS"
132
+ exit 1
133
+ fi
134
+
135
+ echo ""
136
+ echo "CORS proxy patch complete."
137
+ echo "Restart the dev server to pick up next.config.mjs changes:"
138
+ echo " npm run dev -- --port 3001"
139
+ echo ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growthub/cli",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "description": "Growthub CLI — orchestrate AI agent teams to run a business",
5
5
  "type": "module",
6
6
  "bin": {