@8gi-foundation/8gent-code 0.6.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.
- package/LICENSE +228 -0
- package/README.md +714 -0
- package/README.pdf +0 -0
- package/bin/8gent-run.js +47 -0
- package/dist/cli.js +488918 -0
- package/dist/skills/billiondollarboardroom/SKILL.md +180 -0
- package/dist/skills/clone-react/SKILL.md +106 -0
- package/dist/skills/design-excellence/SKILL.md +97 -0
- package/dist/skills/dogfood-qa/SKILL.md +99 -0
- package/dist/skills/motion-design/SKILL.md +104 -0
- package/dist/skills/team-validation/SKILL.md +86 -0
- package/dist/skills/vercel-react/SKILL.md +81 -0
- package/package.json +114 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vercel-react
|
|
3
|
+
description: React and Next.js performance rules for 8gent web tasks. Apply when writing, reviewing, or refactoring React/Next.js code.
|
|
4
|
+
type: skill
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Vercel React Best Practices
|
|
8
|
+
|
|
9
|
+
Reference when writing Next.js components, data fetching, or reviewing bundles.
|
|
10
|
+
|
|
11
|
+
## Eliminating Waterfalls (CRITICAL)
|
|
12
|
+
|
|
13
|
+
- **Parallel fetches**: Use `Promise.all()` for independent async operations. Never chain `await` calls that don't depend on each other.
|
|
14
|
+
- **Start early, await late**: In API routes, kick off promises at the top, await at the point of use.
|
|
15
|
+
- **Suspense boundaries**: Wrap independent data-fetching components so they stream concurrently.
|
|
16
|
+
- **Partial dependencies**: Use `Promise.allSettled()` or structured parallel fetching when some calls depend on others.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// Wrong - waterfall
|
|
20
|
+
const user = await getUser(id);
|
|
21
|
+
const posts = await getPosts(id);
|
|
22
|
+
|
|
23
|
+
// Right - parallel
|
|
24
|
+
const [user, posts] = await Promise.all([getUser(id), getPosts(id)]);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Bundle Size (CRITICAL)
|
|
28
|
+
|
|
29
|
+
- **No barrel imports**: Import directly from the module file, not `index.ts` re-exports.
|
|
30
|
+
- **Dynamic imports**: Use `next/dynamic` for heavy components (charts, editors, rich text).
|
|
31
|
+
- **Defer third-party**: Load analytics, logging, chat widgets after hydration (`useEffect` or `next/script` with `afterInteractive`).
|
|
32
|
+
- **Conditional loading**: Load a module only when the feature is activated, not at page load.
|
|
33
|
+
- **Preload on hover**: For critical paths, preload on `onMouseEnter` / `onFocus` for perceived speed.
|
|
34
|
+
|
|
35
|
+
## Server Components (default)
|
|
36
|
+
|
|
37
|
+
- **Server by default**: Every component is a Server Component unless it needs interactivity or browser APIs.
|
|
38
|
+
- **Client boundary at the leaf**: Push `'use client'` as deep as possible. Don't make a whole page client just for one button.
|
|
39
|
+
- **Minimize serialized props**: Only pass what the client component needs. Don't forward large objects.
|
|
40
|
+
- **`React.cache()`**: Deduplicate identical fetches within a single request.
|
|
41
|
+
- **`unstable_cache` / ISR**: Cache cross-request data at the Next.js layer. Use `revalidate` to control staleness.
|
|
42
|
+
|
|
43
|
+
## Re-render Optimization
|
|
44
|
+
|
|
45
|
+
- **Don't subscribe to state you only use in callbacks**: Read from refs or pass values into handlers instead.
|
|
46
|
+
- **Memoize expensive components**: `React.memo` + stable props. Only when profiling proves it helps.
|
|
47
|
+
- **Primitive deps in effects**: Destructure objects before listing as `useEffect` deps to avoid infinite loops.
|
|
48
|
+
- **Functional `setState`**: Use `setState(prev => ...)` for stable callbacks that don't close over stale state.
|
|
49
|
+
- **`startTransition`**: Wrap non-urgent state updates (search, filter) to keep input responsive.
|
|
50
|
+
- **Lazy state init**: Pass a function to `useState(() => expensiveInit())` — runs once, not on every render.
|
|
51
|
+
|
|
52
|
+
## Rendering Performance
|
|
53
|
+
|
|
54
|
+
- **Hoist static JSX**: Define JSX that never changes outside the component function.
|
|
55
|
+
- **`content-visibility`**: Apply to off-screen sections of long pages.
|
|
56
|
+
- **Animate SVG wrapper**: Animate a `<div>` wrapper, not the SVG element directly.
|
|
57
|
+
- **Ternary, not `&&`**: Use `condition ? <A /> : null` not `condition && <A />` to avoid rendering `0`.
|
|
58
|
+
|
|
59
|
+
## JavaScript Performance
|
|
60
|
+
|
|
61
|
+
- **`Map` for lookups**: Build a `Map` once for repeated O(1) access instead of repeated `Array.find`.
|
|
62
|
+
- **Early return**: Exit functions as soon as the answer is known.
|
|
63
|
+
- **Combine iterations**: One `reduce` over an array instead of chained `.filter().map()`.
|
|
64
|
+
- **Hoist RegExp**: Define `const RE = /pattern/` outside the function, not inside a loop.
|
|
65
|
+
- **Cache storage reads**: `const val = localStorage.getItem('key')` once, not on every access.
|
|
66
|
+
|
|
67
|
+
## Image Optimization
|
|
68
|
+
|
|
69
|
+
- Always use `next/image`. Never raw `<img>` for content images.
|
|
70
|
+
- Provide explicit `width` and `height` to prevent layout shift.
|
|
71
|
+
- Use `priority` on above-the-fold images. Use `loading="lazy"` (default) for everything else.
|
|
72
|
+
- Serve WebP/AVIF via Next.js image config.
|
|
73
|
+
|
|
74
|
+
## Checklist Before Shipping
|
|
75
|
+
|
|
76
|
+
- [ ] No sequential awaits for independent fetches
|
|
77
|
+
- [ ] Heavy components use `next/dynamic`
|
|
78
|
+
- [ ] No unnecessary `'use client'` at layout/page level
|
|
79
|
+
- [ ] Images use `next/image` with explicit dimensions
|
|
80
|
+
- [ ] ISR or `React.cache` applied to repeated fetches
|
|
81
|
+
- [ ] No barrel imports from component libraries
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@8gi-foundation/8gent-code",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Autonomous coding agent. Runs locally on Ollama. Zero API cost. Your code stays on your machine. Open source.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"8": "./bin/8gent-run.js",
|
|
9
|
+
"8gent": "./bin/8gent-run.js",
|
|
10
|
+
"8gent-code": "./bin/8gent-run.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/cli.js",
|
|
14
|
+
"dist/skills",
|
|
15
|
+
"bin/8gent-run.js",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "bun run packages/eight/index.ts",
|
|
21
|
+
"agent": "bun run packages/eight/index.ts",
|
|
22
|
+
"tui": "bun run apps/tui/src/index.tsx",
|
|
23
|
+
"pet": "bash apps/lil-eight/build.sh && open 'apps/lil-eight/build/Lil Eight.app'",
|
|
24
|
+
"pet:build": "bash apps/lil-eight/build.sh",
|
|
25
|
+
"pet:open": "open 'apps/lil-eight/build/Lil Eight.app'",
|
|
26
|
+
"pet:kill": "pkill -f LilEight",
|
|
27
|
+
"pet:log": "tail -f ~/.8gent/lil-eight.log",
|
|
28
|
+
"install-wizard": "bun run apps/installer/src/index.tsx",
|
|
29
|
+
"install:apple-foundation": "bun run scripts/install-apple-foundation.ts",
|
|
30
|
+
"cli": "bun run bin/8gent.ts",
|
|
31
|
+
"dev": "next dev",
|
|
32
|
+
"build": "bun build bin/8gent.ts --outfile dist/cli.js --target bun && node -e \"const fs=require('fs');const f='dist/cli.js';const c=fs.readFileSync(f,'utf-8');if(!c.startsWith('#!'))fs.writeFileSync(f,'#!/usr/bin/env bun\\n'+c);\" && chmod +x dist/cli.js && bash scripts/copy-bundled-skills.sh",
|
|
33
|
+
"build:tui": "bun build apps/tui/src/index.tsx --outdir dist/tui --target node",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"postinstall": "node -e \"console.log('\\n✨ 8gent installed! Just type: 8gent\\n\\n8gent auto-detects LM Studio, Ollama, and local models on first run.\\nIf no model is found, a setup menu will walk you through it.\\n')\" && npx bmad-method init --no-interactive 2>/dev/null || true",
|
|
36
|
+
"test": "bun test",
|
|
37
|
+
"lint": "biome check .",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"typecheck:tui": "tsc --noEmit -p apps/tui/tsconfig.json",
|
|
40
|
+
"check:harness": "tsc --noEmit -p tsconfig.harness.json",
|
|
41
|
+
"benchmark": "bun run scripts/benchmark.ts",
|
|
42
|
+
"benchmark:suite": "bun run benchmarks/runner.ts",
|
|
43
|
+
"benchmark:category": "bun run benchmarks/runner.ts --category",
|
|
44
|
+
"benchmark:single": "bun run benchmarks/runner.ts --bench",
|
|
45
|
+
"benchmark:swebench": "bun run benchmarks/swebench/run.ts",
|
|
46
|
+
"demo": "bun run scripts/demo-savings.ts",
|
|
47
|
+
"harness": "bun run packages/harness-cli/index.ts",
|
|
48
|
+
"harness:run": "bun run packages/harness-cli/index.ts run",
|
|
49
|
+
"harness:sessions": "bun run packages/harness-cli/index.ts sessions",
|
|
50
|
+
"harness:inspect": "bun run packages/harness-cli/index.ts inspect",
|
|
51
|
+
"harness:doctor": "bun run packages/harness-cli/index.ts doctor",
|
|
52
|
+
"demos:studio": "cd apps/demos && bun run studio",
|
|
53
|
+
"demos:render": "cd apps/demos && bun run render:all",
|
|
54
|
+
"demos:media": "cd apps/demos && bun run media",
|
|
55
|
+
"debug": "bun run bin/debug.ts"
|
|
56
|
+
},
|
|
57
|
+
"workspaces": [
|
|
58
|
+
"apps/*",
|
|
59
|
+
"packages/*"
|
|
60
|
+
],
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@biomejs/biome": "^1.5.0",
|
|
63
|
+
"@changesets/cli": "^2.30.0",
|
|
64
|
+
"@napi-rs/canvas": "^0.1.97",
|
|
65
|
+
"@types/bun": "latest",
|
|
66
|
+
"@types/jsdom": "^28.0.0",
|
|
67
|
+
"@types/ws": "^8.18.1",
|
|
68
|
+
"bmad-method": "^6.1.0",
|
|
69
|
+
"typescript": "^5.0.0"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
73
|
+
"@mozilla/readability": "^0.6.0",
|
|
74
|
+
"@types/pdf-parse": "^1.1.5",
|
|
75
|
+
"@types/react": "^19.2.14",
|
|
76
|
+
"ai": "^6.0.116",
|
|
77
|
+
"better-sqlite3": "^12.8.0",
|
|
78
|
+
"cheerio": "^1.2.0",
|
|
79
|
+
"glob": "^13.0.6",
|
|
80
|
+
"ink": "^6.8.0",
|
|
81
|
+
"ink-big-text": "^2.0.0",
|
|
82
|
+
"ink-gradient": "^4.0.0",
|
|
83
|
+
"ink-select-input": "^6.2.0",
|
|
84
|
+
"ink-spinner": "^5.0.0",
|
|
85
|
+
"jsdom": "^28.1.0",
|
|
86
|
+
"miniflare": "^4.20260317.1",
|
|
87
|
+
"next": "^16.1.6",
|
|
88
|
+
"next-themes": "^0.4.6",
|
|
89
|
+
"node-pty": "^1.1.0",
|
|
90
|
+
"pdf-parse": "^2.4.5",
|
|
91
|
+
"sharp": "^0.34.5",
|
|
92
|
+
"stripe": "^17.7.0",
|
|
93
|
+
"tree-sitter": "^0.21.0",
|
|
94
|
+
"tree-sitter-go": "^0.21.0",
|
|
95
|
+
"tree-sitter-javascript": "^0.21.0",
|
|
96
|
+
"tree-sitter-python": "^0.21.0",
|
|
97
|
+
"tree-sitter-rust": "^0.21.0",
|
|
98
|
+
"tree-sitter-typescript": "^0.21.0",
|
|
99
|
+
"zod": "^4.3.6"
|
|
100
|
+
},
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"access": "public"
|
|
103
|
+
},
|
|
104
|
+
"author": "James Spalding",
|
|
105
|
+
"license": "Apache-2.0",
|
|
106
|
+
"repository": {
|
|
107
|
+
"type": "git",
|
|
108
|
+
"url": "https://github.com/8gi-foundation/8gent-code.git"
|
|
109
|
+
},
|
|
110
|
+
"homepage": "https://8gent.dev",
|
|
111
|
+
"bugs": {
|
|
112
|
+
"url": "https://github.com/8gi-foundation/8gent-code/issues"
|
|
113
|
+
}
|
|
114
|
+
}
|