@teambit/host-initializer 0.0.870 → 0.0.872
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/agents-template-git.md +239 -44
- package/agents-template.md +316 -81
- package/dist/agents-template-git.md +239 -44
- package/dist/agents-template.md +316 -81
- package/package.json +3 -3
- /package/dist/{preview-1788878075084.js → preview-1788966965383.js} +0 -0
|
@@ -8,7 +8,7 @@ This file teaches AI agents how to work correctly inside a **Git-integrated Bit
|
|
|
8
8
|
|
|
9
9
|
Bit is a composable development platform where every piece of functionality is an independent, versioned, composed **component**. Components live in **scopes** (remote registries of business domains) and are managed through the `bit` CLI.
|
|
10
10
|
|
|
11
|
-
In this workspace, **Git is the source of truth** for source code and collaboration. Bit's component versioning (`bit snap`, `bit tag`, `bit export`) runs in CI/CD
|
|
11
|
+
In this workspace, **Git is the source of truth** for source code and collaboration. Bit's component versioning (`bit snap`, `bit tag`, `bit export`) runs in CI/CD — not locally.
|
|
12
12
|
|
|
13
13
|
### Component Types
|
|
14
14
|
|
|
@@ -44,20 +44,6 @@ The workspace is defined by `workspace.jsonc`. The owner and default scope are s
|
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
|
-
## Bit Cloud MCP
|
|
48
|
-
|
|
49
|
-
This workspace ships with a `.mcp.json` that wires up the **Bit Cloud MCP** server (`https://mcp.bit.cloud/mcp`). When the MCP is connected and authenticated (the agent will prompt for OAuth on first use), it is the fastest way to discover and inspect components that live in remote scopes — prefer it over reading source files or installing packages just to look around.
|
|
50
|
-
|
|
51
|
-
Key tools to reach for:
|
|
52
|
-
|
|
53
|
-
- **`read_scopes`** — list scopes and their components for a given `owner` (read from `workspace.jsonc`). Prefer this over broad `search` for discovery.
|
|
54
|
-
- **`read_components`** — structured type signatures, dependencies, and metadata for one or more remote components, in a single call. API references are included by default.
|
|
55
|
-
- **`search`** — keyword search across remote scopes.
|
|
56
|
-
|
|
57
|
-
When in doubt, ask the MCP before scaffolding anything new. If the MCP is not connected, fall back to the local `bit` CLI commands (`bit list`, `bit show`, `bit schema`).
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
47
|
## Project Orientation
|
|
62
48
|
|
|
63
49
|
```bash
|
|
@@ -67,18 +53,48 @@ bit status # check for pending changes
|
|
|
67
53
|
bit templates # see what generators are available
|
|
68
54
|
```
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Scopes & the Bit Cloud MCP
|
|
59
|
+
|
|
60
|
+
A **scope** is a remote registry for one business domain — and the unit a full-stack feature ships as (see _Full-Stack Apps_). A component ID is `<owner>.<scope>/<name>`, optionally with a namespace before the name: `<owner>.<scope>/<namespace>/<name>`. The namespace is optional — don't add one to an ID that doesn't have it.
|
|
61
|
+
|
|
62
|
+
This workspace ships with a `.mcp.json` that wires up the **Bit Cloud MCP** server (`https://mcp.bit.cloud/mcp`); the agent will prompt for OAuth on first use. Anything remote — scopes, components, apps — goes through the MCP, not the CLI. The server advertises its own tools; two rules about _ordering_ them:
|
|
63
|
+
|
|
64
|
+
- Start with `orientation` when you don't know the account's topology, then `read_scope` to go deep on one domain. Reach for `search_components` only when you don't know which scope owns something.
|
|
65
|
+
- Always pass the `owner` from `workspace.jsonc`.
|
|
66
|
+
|
|
67
|
+
**If the MCP isn't connected, don't stop** — the CLI can read remotes too, just less efficiently. `bit list <owner>.<scope>` lists a remote scope's components, `bit show <owner>.<scope>/<name> --remote` inspects one, and `bit search <query>` searches by keyword across both the local workspace and Bit Cloud. Say that the MCP is unavailable and carry on; only scope creation has no CLI fallback.
|
|
68
|
+
|
|
69
|
+
### Creating a scope
|
|
70
|
+
|
|
71
|
+
**Don't create a scope up front — create it before the code that needs it reaches CI.** `bit create <template> <name> --scope <owner>.<scope>` only records the scope ID locally, so you can build, validate and iterate against a scope that doesn't exist on Bit Cloud yet. Creating one you never publish to just leaves an empty scope on the account.
|
|
72
|
+
|
|
73
|
+
The gate is the pull request: CI exports as soon as the PR is opened, and an export to a scope that doesn't exist fails. Before you open the PR, confirm every scope your components target exists (`read_scope` → `existsOnCloud`) and create the missing ones.
|
|
74
|
+
|
|
75
|
+
Scopes cannot be created from the CLI — use the `create_scope` MCP tool, or https://bit.cloud/create-scope in the browser.
|
|
76
|
+
|
|
77
|
+
**Look before you create.** Run `orientation` first — if the work fits a domain that already exists, put the components there. Create a scope only when the domain is genuinely new.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
create_scope({ owner: 'acme', scopeName: 'billing', displayName: 'Billing', description: 'Invoicing and subscriptions' })
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- `scopeName` — lowercase letters, digits and dashes, starting with a letter (2 chars minimum). The resulting ID is `<owner>.<scopeName>`.
|
|
84
|
+
- `owner` — defaults to the current account. You must be the account owner or an admin of that organization, otherwise the call is denied.
|
|
85
|
+
- `visibility` — optional, `public` or `private`. Defaults to public on the free plan and private on paid plans.
|
|
86
|
+
- `confirmed` — on paid plans the first call returns a **preview instead of creating**. Show it to the user, get approval, then call again with `confirmed: true`. On the free plan the scope is created on the first call.
|
|
71
87
|
|
|
72
88
|
---
|
|
73
89
|
|
|
74
90
|
## Understanding Component APIs
|
|
75
91
|
|
|
76
|
-
When you need to understand how to **use** a component (its props, function signatures, return types),
|
|
92
|
+
When you need to understand how to **use** a component (its props, function signatures, return types), use structured API data instead of reading source files:
|
|
77
93
|
|
|
78
|
-
- **Remote components
|
|
79
|
-
- **Local workspace components
|
|
94
|
+
- **Remote components**: Use `read_components` (Bit Cloud MCP) — returns structured type signatures, dependencies, and metadata in a single call. API references are included by default. As a CLI fallback, run `bit show <owner>.<scope>/<name> --remote`.
|
|
95
|
+
- **Local workspace components**: Run `bit schema <component-id>` — displays exported types, function signatures, and class methods.
|
|
80
96
|
|
|
81
|
-
For understanding implementation details (how something works internally), read the source directly.
|
|
97
|
+
These structured APIs are significantly more compact than reading source files. For understanding implementation details (how something works internally), use `read-file` or read the source directly.
|
|
82
98
|
|
|
83
99
|
---
|
|
84
100
|
|
|
@@ -96,12 +112,15 @@ bit import "<owner>.<scope>/**" # import all components from a remote scope
|
|
|
96
112
|
bit templates # list available generator templates
|
|
97
113
|
bit create <template> <name> # scaffold a new component
|
|
98
114
|
bit install [pkg1] [pkg2] ... # install package dependencies
|
|
99
|
-
bit compile #
|
|
115
|
+
bit compile # rebuild dist/ — automatic while bit watch/start runs, manual otherwise
|
|
100
116
|
bit validate # lint + type-check + tests (fast build) — preferred check
|
|
101
117
|
bit test # run tests only
|
|
102
118
|
bit lint # run linter only
|
|
103
|
-
bit check-types
|
|
104
|
-
bit ripple <
|
|
119
|
+
bit check-types --strict # TypeScript type checker only (without --strict it exits 0 even on errors)
|
|
120
|
+
bit ripple list --lane <scope>/<lane> # find the Ripple CI jobs for a lane (lane name is the sanitized branch)
|
|
121
|
+
bit ripple log <job-id> # check a Ripple CI build's status
|
|
122
|
+
bit ripple errors <job-id> # show build errors for a Ripple CI job
|
|
123
|
+
bit ripple retry <job-id> # retry a failed Ripple CI job
|
|
105
124
|
```
|
|
106
125
|
|
|
107
126
|
> **Never run `bit build`** unless absolutely necessary. Always use `bit validate` instead — it's faster and sufficient.
|
|
@@ -111,7 +130,7 @@ bit ripple <sub-command> # manage Ripple CI jobs on bit.cloud — li
|
|
|
111
130
|
> **Use Bit for type checking and testing.** Never use `tsc` or `npx tsc` directly. Use `bit validate` for a full check, or scope to specific components:
|
|
112
131
|
>
|
|
113
132
|
> ```bash
|
|
114
|
-
> bit check-types "[component-id1, component-id2]"
|
|
133
|
+
> bit check-types --strict "[component-id1, component-id2]"
|
|
115
134
|
> bit test "[component-id1, component-id2]"
|
|
116
135
|
> bit validate "[component-id1, component-id2]"
|
|
117
136
|
> ```
|
|
@@ -145,9 +164,9 @@ render → identify gap → create ONE component → render again
|
|
|
145
164
|
bit show <owner>.<scope>/<name> # inspect a candidate
|
|
146
165
|
```
|
|
147
166
|
|
|
148
|
-
And via the MCP: `
|
|
167
|
+
And via the MCP: `orientation` for the account's topology, `read_scope` for one domain's components, or `search_components` for keyword discovery. A component may already exist locally or remotely. Don't duplicate.
|
|
149
168
|
|
|
150
|
-
2. **Identify the entry point.** Depending on what you're building, the entry point could be a platform, app, or feature/aspect. Use the MCP (`
|
|
169
|
+
2. **Identify the entry point.** Depending on what you're building, the entry point could be a platform, app, or feature/aspect. Use the MCP (`read_scope` / `read_components`) to list what exists in the scope before creating anything new.
|
|
151
170
|
|
|
152
171
|
3. **Create one component.** Scaffold it, wire it in, verify it compiles and renders.
|
|
153
172
|
|
|
@@ -226,11 +245,11 @@ bit import "<owner>.<scope>/**"
|
|
|
226
245
|
|
|
227
246
|
## Saving and Publishing Changes (Git-Integrated Workflow)
|
|
228
247
|
|
|
229
|
-
**This workspace is Git-integrated.** Git owns version control of source code; Bit's snap/tag/export are handled automatically by CI/CD
|
|
248
|
+
**This workspace is Git-integrated.** Git owns version control of source code; Bit's snap/tag/export are handled automatically by CI/CD. Your collaboration unit is the Git branch, not a Bit lane.
|
|
230
249
|
|
|
231
250
|
**Do not run locally:**
|
|
232
251
|
|
|
233
|
-
- `bit snap`, `bit tag`, `bit export` — CI/CD handles these on merge.
|
|
252
|
+
- `bit snap`, `bit tag`, `bit export` — CI/CD handles these when the PR opens and again on merge.
|
|
234
253
|
- `bit lane create` and `bit lane` management — use Git branches instead.
|
|
235
254
|
|
|
236
255
|
**Your workflow:**
|
|
@@ -241,12 +260,27 @@ git checkout -b <branch-name> # create a feature branch
|
|
|
241
260
|
bit validate # confirm no build errors
|
|
242
261
|
git add . && git commit -m "describe change"
|
|
243
262
|
git push # push your branch
|
|
244
|
-
# open a PR; CI
|
|
263
|
+
# open a PR; CI snaps and exports a preview lane, then tags on merge.
|
|
245
264
|
```
|
|
246
265
|
|
|
266
|
+
`bit validate` is a hard gate — never push a branch that fails it, because CI's build will fail for the same reason. And talk to the user in outcomes, not CLI verbs: "ship this to production", not "tag it".
|
|
267
|
+
|
|
268
|
+
> **Before you open the PR**, make sure every scope your components publish to exists on Bit Cloud — check `existsOnCloud` via `read_scope` and create the missing ones with `create_scope` (see _Creating a scope_). CI's export fails on a scope that doesn't exist.
|
|
269
|
+
|
|
247
270
|
> Focus on development workflows: component creation, modification, testing, and local validation. Leave versioning and publishing to CI.
|
|
248
271
|
|
|
249
|
-
Those CI builds run as Ripple CI jobs on bit.cloud.
|
|
272
|
+
Those CI builds run as Ripple CI jobs on bit.cloud. **Identify the job explicitly** — the bare `bit ripple log` resolves a job from your current lane or from a local export record, and in a Git-integrated workspace you're on main and CI did the exporting, so it has neither to work from. Find the job first, then pass its id:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
bit ripple list --lane <default-scope>/<lane-name> # the lane CI created from your Git branch
|
|
276
|
+
bit ripple log <job-id> # follow that job
|
|
277
|
+
bit ripple errors <job-id> # build errors for a failing job
|
|
278
|
+
bit ripple retry <job-id> # retry a failed job
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The lane name is **not** the raw branch name: CI lowercases the branch and replaces every `/` and `.` with `-`, then prefixes the workspace's default scope. So branch `feature/New.Component` in scope `acme.billing` becomes lane `acme.billing/feature-new-component`. Derive it that way, or read the lane straight out of the CI job output.
|
|
282
|
+
|
|
283
|
+
**Give the user the build link as soon as CI starts a job.** Don't sit silently through the build and don't wait for it to go green — post the link, then report the outcome once it finishes.
|
|
250
284
|
|
|
251
285
|
---
|
|
252
286
|
|
|
@@ -266,6 +300,8 @@ Each component directory follows this convention:
|
|
|
266
300
|
|
|
267
301
|
> Add JSDocs to exported APIs, include two to three usage examples in the `.docs.mdx`, and two to three compositions for the live preview.
|
|
268
302
|
|
|
303
|
+
JSDoc on exported members isn't optional polish — it's what renders as the component's API reference on Bit Cloud, and it's the first thing another agent reads when deciding whether to reuse the component. For the same reason, avoid `any` in a public signature: it erases the API for every consumer, and `bit check-types` gates publishing.
|
|
304
|
+
|
|
269
305
|
---
|
|
270
306
|
|
|
271
307
|
## Import Path Convention
|
|
@@ -296,7 +332,102 @@ Generator environments (React, Vue, Node, Angular, etc.) are configured in `work
|
|
|
296
332
|
|
|
297
333
|
---
|
|
298
334
|
|
|
299
|
-
##
|
|
335
|
+
## Full-Stack Apps
|
|
336
|
+
|
|
337
|
+
There are two ways to compose an app. Decide before creating anything:
|
|
338
|
+
|
|
339
|
+
- **Do NOT default to Harmony/Symphony — most projects do not need it.** For personal sites, MVPs, small-to-medium apps and single-team projects, use the simple `platform` composition below.
|
|
340
|
+
- Use **Harmony** only for large enterprise platforms with multiple teams that need extensibility, plugin architecture and IoC — or when the user explicitly asks for it.
|
|
341
|
+
- To tell what an existing workspace uses: check `workspace.jsonc` for `bitdev.symphony/symphony-platform`, or the code for `symphonyPlatform`. If neither is present, use simple platform composition.
|
|
342
|
+
- When it's unclear which fits, ask: _"Are you building a simple app/site, or an enterprise platform that multiple teams will extend?"_
|
|
343
|
+
|
|
344
|
+
### Simple platform composition
|
|
345
|
+
|
|
346
|
+
Never hand-write boilerplate — scaffold with `bit create <template> <name>`, and run `bit templates` first to see what this workspace offers. If a template you need is missing, enable its env in `workspace.jsonc` generators.
|
|
347
|
+
|
|
348
|
+
A full-stack app is **three components composed by a platform**:
|
|
349
|
+
|
|
350
|
+
1. `bit create platform <name>-platform` — the deployable unit
|
|
351
|
+
2. `bit create react-app <name>-app` — the frontend
|
|
352
|
+
3. `bit create express-server <name>-service` — the backend (name it after its domain; use the `-service` suffix, never `-api` or `-backend`)
|
|
353
|
+
|
|
354
|
+
Then compose the app and the service in the platform and run `bit run <name>-platform`. The platform assigns ports and proxies, so the frontend never needs to know the backend port.
|
|
355
|
+
|
|
356
|
+
**Reaching the backend from the frontend.** The platform exposes the backend base URL to the React app as the `BACKEND_URL` environment variable — read it with `process.env.BACKEND_URL`:
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
fetch(`${process.env.BACKEND_URL}/api/users`, { credentials: 'include' });
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Every cross-origin call to `BACKEND_URL` **must** pass `credentials: 'include'` — `credentials: 'include'` in `fetch`, or in the Apollo `HttpLink`. The platform gateway is configured for credentialed CORS (origin reflection plus `Access-Control-Allow-Credentials: true`), and without it the browser blocks the response. Do NOT add a Vite proxy or switch to relative paths as a workaround — the gateway already handles CORS correctly once credentials are included. This works the same way in Bit Cloud workspaces and in production.
|
|
363
|
+
|
|
364
|
+
MongoDB is already provisioned at `process.env.MONGO_URL`; never add an in-memory store or ask the user to set up a database.
|
|
365
|
+
|
|
366
|
+
Other common templates: `react`, `react-hook`, `react-theme` (UI); `module`, `entity`, `graphql-server` (Node).
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Harmony Platforms
|
|
371
|
+
|
|
372
|
+
**This section applies ONLY when the workspace uses Harmony/Symphony — if it doesn't, ignore everything here and use the simple platform composition above.**
|
|
373
|
+
|
|
374
|
+
Templates: `harmony-platform` (the platform), `aspect` (a domain that plugs into it), `platform-aspect` (the platform's entry aspect), `bit-aspect` (extend Bit itself).
|
|
375
|
+
|
|
376
|
+
An aspect is one domain's full vertical — its `*.node.runtime.ts` holds GraphQL, database and routes, its `*.browser.runtime.tsx` holds pages and routing, and neither may import the other's modules. Features register themselves into the platform; the platform never imports a feature.
|
|
377
|
+
|
|
378
|
+
### Backend Registration
|
|
379
|
+
|
|
380
|
+
All GraphQL schemas and REST routes must be registered through `symphonyPlatform.registerBackendServer`. This is the only correct way — never use `registerMiddlewares` for endpoint logic.
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
symphonyPlatform.registerBackendServer([
|
|
384
|
+
{
|
|
385
|
+
name: 'ai', // sets the gateway prefix: /ai/...
|
|
386
|
+
gql: gqlSchema, // optional — omit if no GraphQL
|
|
387
|
+
routes: [
|
|
388
|
+
{
|
|
389
|
+
path: '/stream',
|
|
390
|
+
method: 'post',
|
|
391
|
+
route: async (req, res) => { ... },
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
},
|
|
395
|
+
]);
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### UI Layout Registration
|
|
399
|
+
|
|
400
|
+
`symphonyPlatform.registerLayoutEntry` registers a component **globally** — it renders on every page. Use it only for truly global sticky chrome like the top navigation header.
|
|
401
|
+
|
|
402
|
+
**Never use it for footers or any element that should appear on specific pages only.** Instead, import the component and render it directly inside the relevant page component(s).
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
// Wrong — makes footer appear on every page, sticky
|
|
406
|
+
symphonyPlatform.registerLayoutEntry([{ position: 'bottom', component: () => <Footer /> }]);
|
|
407
|
+
|
|
408
|
+
// Correct — add Footer directly inside the page
|
|
409
|
+
export function Homepage() {
|
|
410
|
+
return (
|
|
411
|
+
<div>
|
|
412
|
+
{/* page content */}
|
|
413
|
+
<Footer />
|
|
414
|
+
</div>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Gateway Routing
|
|
420
|
+
|
|
421
|
+
The Symphony gateway proxies frontend calls to the backend, stripping the aspect name prefix:
|
|
422
|
+
|
|
423
|
+
```
|
|
424
|
+
Frontend: /api/{name}/{path}
|
|
425
|
+
Backend receives: /{path}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
For example, `POST /api/ai/stream` → backend receives `POST /stream`. The frontend **must always** include the `/api` prefix.
|
|
429
|
+
|
|
430
|
+
### Troubleshooting: Runtime Code Crossing Environment Boundaries
|
|
300
431
|
|
|
301
432
|
Importing frontend modules into Node.js runtime files or Node.js modules into browser runtime files causes app initialization failures. This typically happens when `index.ts` or runtime files import/export cross-environment modules by value instead of by type.
|
|
302
433
|
|
|
@@ -328,18 +459,82 @@ export { User } from './user.js';
|
|
|
328
459
|
|
|
329
460
|
---
|
|
330
461
|
|
|
462
|
+
## Deploying
|
|
463
|
+
|
|
464
|
+
**There is nothing to configure.** Exporting is deploying: Ripple CI builds the exported components, detects the app framework from the build artifacts, and deploys to a managed container automatically. Never add a deployer config or tell the user to set one up.
|
|
465
|
+
|
|
466
|
+
You never run the export yourself — CI does, at two separate points:
|
|
467
|
+
|
|
468
|
+
- **When the pull request is opened or updated** (`bit ci pr`) — CI snaps and exports a feature lane, producing a **preview** deployment before merge.
|
|
469
|
+
- **When the PR merges to main** (`bit ci merge`) — CI tags semantic versions and exports them, producing the **production** deployment.
|
|
470
|
+
|
|
471
|
+
So a build exists from the moment the PR opens. Don't wait for the merge to start reporting: follow the PR build and hand the user its link, then do the same again after the merge.
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
bit ripple list --lane <default-scope>/<lane-name> # find the job CI created (see lane naming above)
|
|
475
|
+
bit ripple log <job-id> # build status
|
|
476
|
+
bit ripple errors <job-id> # why a build failed
|
|
477
|
+
bit ripple retry <job-id> # retry a failed job
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Copy the URL that `bit ripple log` prints; never assemble one by hand. Its last segment is the job's slug, not the display name, so a hand-built link lands on "No CI job found".
|
|
481
|
+
|
|
482
|
+
Once a build succeeds, an app that defines a deployment is live — get its URL with the `list_apps` MCP tool, don't guess or construct it. Production apps are served on `*.composed.app`; the PR preview is deployed separately, so call `list_apps` again after the merge instead of reusing the preview link. Component-only releases have no URL at all, and neither does an app that defines no deployment — a green build on its own is not proof that anything was deployed. If `list_apps` gives you no URL, say so rather than implying the app is live, and point the user at the scope page instead.
|
|
483
|
+
|
|
484
|
+
Custom domains are a Bit Cloud settings flow with no CLI equivalent — send the user to `https://bit.cloud/<owner>/~settings/deployment`. Never claim to have connected a domain yourself.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## Troubleshooting
|
|
489
|
+
|
|
490
|
+
### The app doesn't reflect your change
|
|
491
|
+
|
|
492
|
+
**Most likely the `dist/` is stale.** Consumers import a component through `node_modules/<package>/dist/`, not its source, and `bit validate` type-checks _source_ — so it passes green while the running app still serves the old build. `bit watch` / `bit start` normally recompiles on save, but if either isn't running, or the change landed while it was down, the old `dist/` sits there.
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
bit compile # rebuild dist/
|
|
496
|
+
# then restart the app
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Do this **before** re-reading and re-editing files. If the source is already correct, editing it again cannot help — a passing `bit validate` plus wrong runtime behavior is the signature of this bug, not of a code error.
|
|
500
|
+
|
|
501
|
+
If compiling and restarting doesn't help, run `bit install`, then restart again.
|
|
502
|
+
|
|
503
|
+
### Seeded or mock data doesn't update
|
|
504
|
+
|
|
505
|
+
Seed logic usually writes only into an empty collection, so changing a seed or a `*.model.ts` has no effect on a database that already has rows — the stale documents stay, and may not even match the new shape. Clear the affected collections before restarting, or version the seed (write a marker document and re-seed when the version changes) so it re-runs on its own.
|
|
506
|
+
|
|
507
|
+
### GraphQL data missing or malformed
|
|
508
|
+
|
|
509
|
+
The backend schema and the query the frontend sends have drifted apart. Compare the two directly; don't debug the UI.
|
|
510
|
+
|
|
511
|
+
### Apollo test imports fail to resolve
|
|
512
|
+
|
|
513
|
+
`@apollo/client/testing` is the normal import and works on most versions. Only when it genuinely fails to resolve, import from `@apollo/client/testing/react/index.js` instead — don't rewrite an import that already works.
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
331
517
|
## Common Mistakes to Avoid
|
|
332
518
|
|
|
333
|
-
| Mistake
|
|
334
|
-
|
|
|
335
|
-
| Creating multiple components upfront
|
|
336
|
-
| Modifying an installed (node_modules) component
|
|
337
|
-
| Importing only the target component but not its dependents
|
|
338
|
-
| Treating all components as UI widgets
|
|
339
|
-
| Running `bit build`
|
|
340
|
-
| Running `bit snap`, `bit tag`, or `bit export` locally
|
|
341
|
-
| Creating or managing Bit lanes
|
|
342
|
-
|
|
|
343
|
-
|
|
|
344
|
-
|
|
|
345
|
-
| Using `
|
|
519
|
+
| Mistake | Correct approach |
|
|
520
|
+
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
521
|
+
| Creating multiple components upfront | Create one, validate, then decide what's next |
|
|
522
|
+
| Modifying an installed (node_modules) component | Import it with `bit import` first |
|
|
523
|
+
| Importing only the target component but not its dependents | Import the full chain top-down: platform → app → feature → page → component |
|
|
524
|
+
| Treating all components as UI widgets | Understand the type first — platform, app, feature/aspect, hook, entity, or UI component — it determines the chain |
|
|
525
|
+
| Running `bit build` | Use `bit validate` instead — faster and sufficient |
|
|
526
|
+
| Running `bit snap`, `bit tag`, or `bit export` locally | These are handled by CI/CD — don't run them in the workspace |
|
|
527
|
+
| Creating or managing Bit lanes | Use Git branches instead — this workspace is Git-integrated |
|
|
528
|
+
| Pushing a branch that fails `bit validate` | Fix it first — CI's build fails for the same reason |
|
|
529
|
+
| Guessing a component ID | Check `package.json` under `componentId` or use `bit list` |
|
|
530
|
+
| Creating a component that already exists | Always run `bit list` and check the Bit Cloud MCP (`orientation` / `search_components`) first |
|
|
531
|
+
| Using `npm install`, `yarn`, or `pnpm` | Use `bit install` — unless the workspace uses `externalPackageManager` mode |
|
|
532
|
+
| Using `tsc` or `npx tsc` to check types | Use `bit validate`, `bit check-types`, or `bit test` |
|
|
533
|
+
| Trying to create a scope from the CLI | Scopes only exist on Bit Cloud — use the `create_scope` MCP tool |
|
|
534
|
+
| Creating a scope for a domain that already has one | Run `read_scope` / `list_components` first — reuse the existing scope |
|
|
535
|
+
| Creating a scope up front, before any code exists | Create it before you open the PR — that's the point CI needs it to exist |
|
|
536
|
+
| Creating a scope without asking | Confirm the name, owner and visibility with the user; on paid plans preview first, then call again with `confirmed: true` |
|
|
537
|
+
| Going quiet while CI builds | Post the Ripple CI job link as soon as there is one, then report the result |
|
|
538
|
+
| Making the platform import a feature aspect | Inverted — the feature aspect imports the platform and registers itself |
|
|
539
|
+
| Importing React/SCSS in a node runtime, or Node.js modules in a browser runtime | Keep runtime code on its own side of the boundary and out of `index.ts` |
|
|
540
|
+
| Hand-writing a platform, aspect or app | Scaffold it with `bit create` — run `bit templates` to see what's available |
|