oneie 1.3.3 → 1.3.4
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/.claude/agents/engineering-architect.md +39 -56
- package/.claude/agents/engineering-developer.md +37 -57
- package/.claude/agents/engineering-director.md +37 -144
- package/.claude/agents/engineering-ingestor.md +229 -0
- package/.claude/agents/engineering-quality-assurance.md +40 -206
- package/.claude/agents/engineering-user-experience.md +36 -207
- package/.claude/agents/improver.md +454 -0
- package/.claude/agents/marketing-brand-identity.md +37 -48
- package/.claude/agents/marketing-director.md +9 -0
- package/.claude/agents/one-orchestrator.md +50 -136
- package/.claude/agents/story-teller.md +10 -0
- package/.claude/agents/task-master.md +10 -0
- package/.claude/agents/turbo-repo-builder.md +51 -0
- package/.claude/claude-code-hooks.json +20 -233
- package/.claude/commands/agent-balance +111 -0
- package/.claude/commands/agent.md +24 -7
- package/.claude/commands/cascade-status.md +128 -0
- package/.claude/commands/ingest.md +290 -0
- package/.claude/commands/ingestor.md +136 -0
- package/.claude/commands/mission.md +26 -8
- package/.claude/commands/one.md +351 -14
- package/.claude/commands/quality-check.md +204 -0
- package/.claude/commands/smart-route.md +220 -0
- package/.claude/commands/start.md +9 -8
- package/.claude/commands/story.md +18 -3
- package/.claude/commands/task.md +22 -1
- package/.claude/settings.local.json +18 -3
- package/.obsidian/core-plugins.json +3 -1
- package/.one/checklists/agent-quality-checklist.md +24 -15
- package/.one/checklists/story-quality-checklist.md +24 -15
- package/.one/checklists/task-quality-checklist.md +24 -15
- package/.one/templates/bun-workspace-guide-template.md +188 -0
- package/.one/templates/bunfig-template.toml +95 -0
- package/.one/templates/root-package-template.json +37 -21
- package/.one/templates/turbo-config-template.json +18 -3
- package/.one/tools/bump-core-version.js +0 -0
- package/.one/tools/bump-expansion-version.js +0 -0
- package/.one/tools/code-generators.js +0 -0
- package/.one/tools/compression-engine.js +638 -0
- package/.one/tools/content-deduplicator.js +336 -0
- package/.one/tools/convert-wav-to-mp3.js +0 -0
- package/.one/tools/foundation-wizard.js +0 -0
- package/.one/tools/generate-toc.js +0 -0
- package/.one/tools/ingestor/cascade-integration.js +523 -0
- package/.one/tools/ingestor/cli.ts +234 -0
- package/.one/tools/ingestor/context-mapper.ts +604 -0
- package/.one/tools/ingestor/error-handling-monitor.js +742 -0
- package/.one/tools/ingestor/file-discovery.ts +484 -0
- package/.one/tools/ingestor/file-transformer.ts +524 -0
- package/.one/tools/ingestor/ingestor-orchestrator.ts +416 -0
- package/.one/tools/ingestor/package.json +47 -0
- package/.one/tools/ingestor/usage-examples.md +458 -0
- package/.one/tools/lazy-loader.js +489 -0
- package/.one/tools/minimal-generators.js +0 -0
- package/.one/tools/performance-benchmark.js +300 -0
- package/.one/tools/premium-manager.js +0 -0
- package/.one/tools/semantic-release-sync-installer.js +0 -0
- package/.one/tools/size-memory-optimizer.js +475 -0
- package/.one/tools/sync-installer-version.js +0 -0
- package/.one/tools/text-to-speech.js +0 -0
- package/.one/tools/transformative-ai-engine.js +0 -0
- package/.one/workflows/safe-improvement-deployment.yaml +420 -0
- package/CLAUDE.md +30 -0
- package/README.md +41 -10
- package/one/cache/benchmark-results.json +43 -0
- package/one/cache/file-index.json +12480 -0
- package/one/config/agent-routing.yaml +124 -0
- package/one/config/agent-skills.yaml +451 -0
- package/one/config/cache-config.yaml +304 -0
- package/one/config/feedback-templates.yaml +152 -0
- package/one/config/performance-config.yaml +281 -0
- package/one/config/quality-automation.yaml +405 -0
- package/one/config/routing-logic.yaml +292 -0
- package/one/data/task-registry.yaml +224 -0
- package/one/stories/story-1.10-parallel-task-execution-orchestration.md +119 -0
- package/one/stories/story-3.1-external-repository-foundation.md +374 -0
- package/one/stories/story-3.2-3-levels-architecture-integration.md +449 -0
- package/one/stories/story-3.3-multi-platform-application-development.md +677 -0
- package/one/stories/story-3.4-shared-package-system-ui-components.md +854 -0
- package/one/stories/story-3.5-backend-integration-production-deployment.md +1034 -0
- package/one/tasks/task-1.10.1-design-parallel-execution-architecture.md +108 -0
- package/one/tasks/task-1.10.2-create-task-dependency-mapping-system.md +82 -0
- package/one/tasks/task-1.10.3-build-agent-spawning-orchestration-engine.md +120 -0
- package/one/tasks/task-1.10.4-implement-task-queue-dependency-resolution.md +125 -0
- package/one/tasks/task-1.10.5-create-task-numbering-convention-system.md +542 -0
- package/one/tasks/task-3.1.1-external-repository-creation.md +303 -0
- package/one/tasks/task-3.1.2-turborepo-configuration-optimization.md +402 -0
- package/one/tasks/task-3.1.3-shared-configuration-packages.md +571 -0
- package/one/tasks/task-3.1.4-bun-package-management-optimization.md +627 -0
- package/one/tools/task-numbering-validator.js +429 -0
- package/package.json +1 -1
- package/quality-gate-optimization-analysis.md +260 -0
- package/turbo-benchmark.js +268 -0
- package/turbo-optimization-guide.md +163 -0
- package/turbo-workspace-template.json +83 -0
- package/turbo.json +178 -0
- package/.claude/commands/analyst.md +0 -70
- package/.claude/commands/architect.md +0 -67
- package/.claude/commands/commander.md +0 -78
- package/.claude/commands/deploy.md +0 -68
- package/.claude/commands/dev.md +0 -60
- package/.claude/commands/playbook.md +0 -81
- package/.claude/commands/pm.md +0 -64
- package/.claude/commands/po.md +0 -68
- package/.claude/commands/qa.md +0 -59
- package/.claude/commands/taskmaster.md +0 -85
- package/.claude/commands/ux-expert.md +0 -58
- package/.one/stories/bullstamp-attract-module-complete.md +0 -255
- package/.one/stories/bullstamp-deployment-master-plan.md +0 -518
- package/.one/stories/bullstamp-executive-implementation-summary.md +0 -254
- package/.one/stories/bullstamp-project-status-complete.md +0 -257
- package/.one/stories/obsidian-pandoc-config.md +0 -159
- package/.one/stories/story-1.1-perfect-filesystem-organization.md +0 -270
- package/.one/stories/story-1.1.1.md +0 -136
- package/.one/stories/story-1.1.md +0 -131
- package/.one/stories/story-1.2.md +0 -420
- package/.one/stories/story-1.3.md +0 -177
- package/.one/stories/story-1.4.md +0 -356
- package/.one/stories/story-1.5.md +0 -572
- package/.one/stories/story-1.6.md +0 -481
- package/.one/stories/story-1.7.md +0 -923
- package/.one/stories/story-1.8.md +0 -404
- package/.one/stories/story-2.0.md +0 -132
- package/.one/stories/story-2.1.md +0 -110
- package/.one/stories/story-2.2.md +0 -110
- package/.one/stories/story-2.3.md +0 -112
- package/.one/stories/story-2.4.md +0 -116
- package/.one/stories/story-2.5.md +0 -114
- package/.one/stories/story-3.1.md +0 -298
- package/.one/stories/story-3.10.md +0 -302
- package/.one/stories/story-3.11.md +0 -167
- package/.one/stories/story-3.12.md +0 -235
- package/.one/stories/story-3.13.md +0 -235
- package/.one/stories/story-3.14.md +0 -225
- package/.one/stories/story-3.15.md +0 -238
- package/.one/stories/story-3.16.md +0 -244
- package/.one/stories/story-3.17.md +0 -245
- package/.one/stories/story-3.18.md +0 -248
- package/.one/stories/story-3.2.md +0 -226
- package/.one/stories/story-3.3.md +0 -226
- package/.one/stories/story-3.4.md +0 -226
- package/.one/stories/story-3.5.md +0 -167
- package/.one/stories/story-3.6.md +0 -167
- package/.one/stories/story-3.7.md +0 -181
- package/.one/stories/story-3.8.md +0 -198
- package/.one/stories/story-3.9.md +0 -169
- package/.one/stories/story-4.1.md +0 -245
- package/.one/stories/story-4.2.md +0 -314
- package/.one/stories/story-4.3.md +0 -610
- package/.one/stories/story-4.4.md +0 -931
- package/.one/stories/story-4.5.md +0 -727
- package/.one/stories/story-4.6-consistency.md +0 -175
- package/.one/stories/story-5.1.md +0 -508
- package/.one/stories/story-5.2.md +0 -451
- package/.one/stories/story-5.3.md +0 -405
- package/.one/stories/story-5.4.md +0 -447
- package/.one/stories/story-5.5.md +0 -349
- package/.one/stories/story-5.6.md +0 -445
- package/.one/stories/story-6.1-text-content-engine.md +0 -144
- package/.one/stories/story-6.2-audio-content-engine.md +0 -145
- package/.one/stories/story-6.3-video-content-engine.md +0 -145
- package/.one/stories/story-6.4-visual-content-engine.md +0 -177
- package/.one/stories/story-6.5-cross-platform-distribution.md +0 -188
- package/.one/stories/story-6.6.ai-content-generation-pipeline.md +0 -196
- package/.one/stories/story-6.7-character-consistency-quality-control.md +0 -216
- package/.one/stories/story-6.8-claude-code-content-integration.md +0 -181
- package/.one/stories/story-6.8-content-production-workflows.md +0 -247
- package/.one/stories/story-7.1-implementation.md +0 -128
- package/.one/stories/story-7.1.md +0 -203
- package/.one/stories/story-7.2-implementation.md +0 -147
- package/.one/stories/story-7.2.md +0 -415
- package/.one/stories/story-7.3-implementation.md +0 -159
- package/.one/stories/story-7.3.md +0 -463
- package/.one/stories/story-7.4-implementation.md +0 -154
- package/.one/stories/story-7.4.md +0 -500
- package/.one/stories/story-validation-report.md +0 -169
- package/one/archive-index.json +0 -91
- /package/one/stories/{story-3.1-npx-oneie-turbo-enhancement.md → story-2.1.1-npx-oneie-turbo-enhancement.md} +0 -0
- /package/one/stories/{story-3.2-npx-connection-implementation.md → story-2.21-npx-connection-implementation.md} +0 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
# Task 3.1.4: Bun Package Management Optimization
|
|
2
|
+
|
|
3
|
+
**Status:** 📋 READY FOR IMPLEMENTATION
|
|
4
|
+
**Assigned Agent:** DevOps Specialist
|
|
5
|
+
**Story:** Story 3.1: External Repository Setup & Foundation
|
|
6
|
+
**Mission:** Mission-3: Production Turbo Monorepo
|
|
7
|
+
**Estimated Effort:** 1 response cycle
|
|
8
|
+
**Priority:** Medium Performance
|
|
9
|
+
**Dependencies:** Task 3.1.1 (External Repository Creation) ✅, Task 3.1.3 (Shared Configuration Packages) ✅
|
|
10
|
+
|
|
11
|
+
## 🎯 Task Objective
|
|
12
|
+
|
|
13
|
+
Optimize Bun package management for maximum performance, security, and developer experience across the monorepo workspace, achieving 3x faster installation speeds and streamlined dependency management with proper hoisting, deduplication, and workspace optimization strategies.
|
|
14
|
+
|
|
15
|
+
## 📋 Technical Specifications
|
|
16
|
+
|
|
17
|
+
### Primary Deliverables
|
|
18
|
+
|
|
19
|
+
#### 1. Advanced Bun Workspace Configuration
|
|
20
|
+
|
|
21
|
+
**Enhanced package.json (root):**
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"name": "turbo-monorepo",
|
|
25
|
+
"version": "1.0.0",
|
|
26
|
+
"private": true,
|
|
27
|
+
"type": "module",
|
|
28
|
+
"packageManager": "bun@1.0.25",
|
|
29
|
+
"workspaces": [
|
|
30
|
+
"apps/*",
|
|
31
|
+
"packages/*",
|
|
32
|
+
"libraries/*",
|
|
33
|
+
"databases/*"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "turbo run dev --parallel",
|
|
37
|
+
"build": "turbo run build",
|
|
38
|
+
"build:apps": "turbo run build --filter='./apps/*'",
|
|
39
|
+
"build:packages": "turbo run build --filter='./packages/*'",
|
|
40
|
+
"test": "turbo run test",
|
|
41
|
+
"test:watch": "turbo run test:watch",
|
|
42
|
+
"test:coverage": "turbo run test:coverage",
|
|
43
|
+
"lint": "turbo run lint",
|
|
44
|
+
"lint:fix": "turbo run lint:fix",
|
|
45
|
+
"format": "turbo run format",
|
|
46
|
+
"format:check": "turbo run format:check",
|
|
47
|
+
"type-check": "turbo run type-check",
|
|
48
|
+
"clean": "turbo run clean && rm -rf node_modules .turbo",
|
|
49
|
+
"reset": "bun run clean && bun install",
|
|
50
|
+
"deps:check": "bun deps:outdated",
|
|
51
|
+
"deps:update": "bun update --interactive",
|
|
52
|
+
"workspace:graph": "bun workspaces graph",
|
|
53
|
+
"workspace:list": "bun workspaces list",
|
|
54
|
+
"postinstall": "bun run setup:hooks"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"turbo": "^1.11.2",
|
|
58
|
+
"prettier": "^3.1.0",
|
|
59
|
+
"@types/node": "^20.10.0",
|
|
60
|
+
"typescript": "^5.3.0",
|
|
61
|
+
"eslint": "^8.55.0",
|
|
62
|
+
"concurrently": "^8.2.0",
|
|
63
|
+
"rimraf": "^5.0.0"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=18.0.0",
|
|
67
|
+
"bun": ">=1.0.0"
|
|
68
|
+
},
|
|
69
|
+
"volta": {
|
|
70
|
+
"node": "20.10.0",
|
|
71
|
+
"bun": "1.0.25"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### 2. Optimized Bun Configuration
|
|
77
|
+
|
|
78
|
+
**bunfig.toml:**
|
|
79
|
+
```toml
|
|
80
|
+
[install]
|
|
81
|
+
# Performance optimizations
|
|
82
|
+
cache = true
|
|
83
|
+
exact = false
|
|
84
|
+
production = false
|
|
85
|
+
optional = true
|
|
86
|
+
dev = true
|
|
87
|
+
peer = true
|
|
88
|
+
frozenLockfile = false
|
|
89
|
+
dryRun = false
|
|
90
|
+
|
|
91
|
+
# Registry configuration
|
|
92
|
+
registry = "https://registry.npmjs.org"
|
|
93
|
+
scopes = {}
|
|
94
|
+
|
|
95
|
+
# Caching and performance
|
|
96
|
+
globalDir = "~/.bun/install/global"
|
|
97
|
+
globalBinDir = "~/.bun/bin"
|
|
98
|
+
|
|
99
|
+
# Workspace optimizations
|
|
100
|
+
auto = true
|
|
101
|
+
save = true
|
|
102
|
+
saveExact = false
|
|
103
|
+
saveDev = false
|
|
104
|
+
saveOptional = false
|
|
105
|
+
savePeer = false
|
|
106
|
+
|
|
107
|
+
# Security settings
|
|
108
|
+
trustedDependencies = []
|
|
109
|
+
linkNativeModules = []
|
|
110
|
+
|
|
111
|
+
[install.lockfile]
|
|
112
|
+
# Lockfile optimizations
|
|
113
|
+
save = true
|
|
114
|
+
print = "yarn"
|
|
115
|
+
|
|
116
|
+
[run]
|
|
117
|
+
# Runtime optimizations
|
|
118
|
+
bun = true
|
|
119
|
+
shell = "bash"
|
|
120
|
+
silent = false
|
|
121
|
+
|
|
122
|
+
[test]
|
|
123
|
+
# Test configuration
|
|
124
|
+
preload = []
|
|
125
|
+
coverage = false
|
|
126
|
+
coverageDir = "coverage"
|
|
127
|
+
coverageReporters = ["text", "html", "lcov"]
|
|
128
|
+
coverageThreshold = 80
|
|
129
|
+
|
|
130
|
+
[build]
|
|
131
|
+
# Build optimizations
|
|
132
|
+
target = "bun"
|
|
133
|
+
outdir = "./dist"
|
|
134
|
+
format = "esm"
|
|
135
|
+
splitting = true
|
|
136
|
+
sourcemap = "external"
|
|
137
|
+
minify = true
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### 3. Package Dependency Optimization Scripts
|
|
141
|
+
|
|
142
|
+
**scripts/optimize-dependencies.js:**
|
|
143
|
+
```javascript
|
|
144
|
+
#!/usr/bin/env bun
|
|
145
|
+
|
|
146
|
+
import { readdir, readFile, writeFile } from 'fs/promises';
|
|
147
|
+
import { join } from 'path';
|
|
148
|
+
import { execSync } from 'child_process';
|
|
149
|
+
|
|
150
|
+
class DependencyOptimizer {
|
|
151
|
+
constructor() {
|
|
152
|
+
this.workspaceRoot = process.cwd();
|
|
153
|
+
this.packages = [];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async findAllPackages() {
|
|
157
|
+
const workspaces = ['apps', 'packages', 'libraries', 'databases'];
|
|
158
|
+
|
|
159
|
+
for (const workspace of workspaces) {
|
|
160
|
+
try {
|
|
161
|
+
const dirs = await readdir(join(this.workspaceRoot, workspace));
|
|
162
|
+
for (const dir of dirs) {
|
|
163
|
+
const packagePath = join(this.workspaceRoot, workspace, dir);
|
|
164
|
+
try {
|
|
165
|
+
const packageJson = JSON.parse(
|
|
166
|
+
await readFile(join(packagePath, 'package.json'), 'utf-8')
|
|
167
|
+
);
|
|
168
|
+
this.packages.push({
|
|
169
|
+
name: packageJson.name,
|
|
170
|
+
path: packagePath,
|
|
171
|
+
config: packageJson,
|
|
172
|
+
workspace: workspace
|
|
173
|
+
});
|
|
174
|
+
} catch (error) {
|
|
175
|
+
// Skip directories without package.json
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch (error) {
|
|
179
|
+
// Skip non-existent workspace directories
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async optimizeDependencies() {
|
|
185
|
+
console.log('🔍 Analyzing workspace dependencies...');
|
|
186
|
+
|
|
187
|
+
await this.findAllPackages();
|
|
188
|
+
|
|
189
|
+
const analysis = {
|
|
190
|
+
duplicates: await this.findDuplicateDependencies(),
|
|
191
|
+
outdated: await this.findOutdatedDependencies(),
|
|
192
|
+
unused: await this.findUnusedDependencies(),
|
|
193
|
+
hoisting: await this.analyzeHoistingOpportunities()
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
console.log('📊 Dependency Analysis Results:');
|
|
197
|
+
console.log(` Duplicate dependencies: ${analysis.duplicates.length}`);
|
|
198
|
+
console.log(` Outdated dependencies: ${analysis.outdated.length}`);
|
|
199
|
+
console.log(` Unused dependencies: ${analysis.unused.length}`);
|
|
200
|
+
console.log(` Hoisting opportunities: ${analysis.hoisting.length}`);
|
|
201
|
+
|
|
202
|
+
await this.generateOptimizationReport(analysis);
|
|
203
|
+
return analysis;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async findDuplicateDependencies() {
|
|
207
|
+
const allDeps = new Map();
|
|
208
|
+
const duplicates = [];
|
|
209
|
+
|
|
210
|
+
for (const pkg of this.packages) {
|
|
211
|
+
const deps = { ...pkg.config.dependencies, ...pkg.config.devDependencies };
|
|
212
|
+
|
|
213
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
214
|
+
if (!allDeps.has(name)) {
|
|
215
|
+
allDeps.set(name, new Set());
|
|
216
|
+
}
|
|
217
|
+
allDeps.get(name).add({ version, package: pkg.name });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
for (const [depName, versions] of allDeps.entries()) {
|
|
222
|
+
if (versions.size > 1) {
|
|
223
|
+
duplicates.push({
|
|
224
|
+
name: depName,
|
|
225
|
+
versions: Array.from(versions)
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return duplicates;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async findOutdatedDependencies() {
|
|
234
|
+
try {
|
|
235
|
+
const output = execSync('bun outdated --json', {
|
|
236
|
+
encoding: 'utf-8',
|
|
237
|
+
cwd: this.workspaceRoot
|
|
238
|
+
});
|
|
239
|
+
return JSON.parse(output);
|
|
240
|
+
} catch (error) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async findUnusedDependencies() {
|
|
246
|
+
// Implementation for finding unused dependencies
|
|
247
|
+
// This would use tools like depcheck or custom analysis
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
async analyzeHoistingOpportunities() {
|
|
252
|
+
const rootDeps = new Set();
|
|
253
|
+
const commonDeps = new Map();
|
|
254
|
+
|
|
255
|
+
// Analyze which dependencies appear in multiple packages
|
|
256
|
+
for (const pkg of this.packages) {
|
|
257
|
+
const deps = { ...pkg.config.dependencies, ...pkg.config.devDependencies };
|
|
258
|
+
|
|
259
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
260
|
+
if (!commonDeps.has(name)) {
|
|
261
|
+
commonDeps.set(name, []);
|
|
262
|
+
}
|
|
263
|
+
commonDeps.get(name).push({ package: pkg.name, version });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Identify hoisting opportunities
|
|
268
|
+
const opportunities = [];
|
|
269
|
+
for (const [depName, usage] of commonDeps.entries()) {
|
|
270
|
+
if (usage.length > 2) { // Used in more than 2 packages
|
|
271
|
+
const versions = [...new Set(usage.map(u => u.version))];
|
|
272
|
+
if (versions.length === 1) { // Same version across all packages
|
|
273
|
+
opportunities.push({
|
|
274
|
+
name: depName,
|
|
275
|
+
version: versions[0],
|
|
276
|
+
usedIn: usage.length,
|
|
277
|
+
packages: usage.map(u => u.package)
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return opportunities;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async generateOptimizationReport(analysis) {
|
|
287
|
+
const report = `# Dependency Optimization Report
|
|
288
|
+
|
|
289
|
+
Generated: ${new Date().toISOString()}
|
|
290
|
+
|
|
291
|
+
## Summary
|
|
292
|
+
- Total packages: ${this.packages.length}
|
|
293
|
+
- Duplicate dependencies: ${analysis.duplicates.length}
|
|
294
|
+
- Outdated dependencies: ${analysis.outdated.length}
|
|
295
|
+
- Unused dependencies: ${analysis.unused.length}
|
|
296
|
+
- Hoisting opportunities: ${analysis.hoisting.length}
|
|
297
|
+
|
|
298
|
+
## Duplicate Dependencies
|
|
299
|
+
${analysis.duplicates.map(dup =>
|
|
300
|
+
`- **${dup.name}**: ${dup.versions.map(v => `${v.version} (${v.package})`).join(', ')}`
|
|
301
|
+
).join('\n')}
|
|
302
|
+
|
|
303
|
+
## Hoisting Opportunities
|
|
304
|
+
${analysis.hoisting.map(opp =>
|
|
305
|
+
`- **${opp.name}@${opp.version}**: Used in ${opp.usedIn} packages`
|
|
306
|
+
).join('\n')}
|
|
307
|
+
|
|
308
|
+
## Recommendations
|
|
309
|
+
${this.generateRecommendations(analysis)}
|
|
310
|
+
`;
|
|
311
|
+
|
|
312
|
+
await writeFile(join(this.workspaceRoot, 'DEPENDENCY_REPORT.md'), report);
|
|
313
|
+
console.log('📝 Report saved to DEPENDENCY_REPORT.md');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
generateRecommendations(analysis) {
|
|
317
|
+
const recommendations = [];
|
|
318
|
+
|
|
319
|
+
if (analysis.duplicates.length > 0) {
|
|
320
|
+
recommendations.push('1. Standardize dependency versions across packages');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (analysis.hoisting.length > 0) {
|
|
324
|
+
recommendations.push('2. Consider hoisting common dependencies to root');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (analysis.outdated.length > 0) {
|
|
328
|
+
recommendations.push('3. Update outdated dependencies for security and performance');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return recommendations.join('\n');
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// CLI execution
|
|
336
|
+
if (import.meta.main) {
|
|
337
|
+
const optimizer = new DependencyOptimizer();
|
|
338
|
+
await optimizer.optimizeDependencies();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export default DependencyOptimizer;
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### 4. Development Workflow Scripts
|
|
345
|
+
|
|
346
|
+
**scripts/workspace-tools.js:**
|
|
347
|
+
```javascript
|
|
348
|
+
#!/usr/bin/env bun
|
|
349
|
+
|
|
350
|
+
import { spawn } from 'child_process';
|
|
351
|
+
import { readFile } from 'fs/promises';
|
|
352
|
+
|
|
353
|
+
class WorkspaceTools {
|
|
354
|
+
async listWorkspaces() {
|
|
355
|
+
console.log('📦 Workspace Packages:');
|
|
356
|
+
|
|
357
|
+
try {
|
|
358
|
+
const packageJson = JSON.parse(
|
|
359
|
+
await readFile('./package.json', 'utf-8')
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const workspaces = packageJson.workspaces || [];
|
|
363
|
+
|
|
364
|
+
for (const workspace of workspaces) {
|
|
365
|
+
console.log(` ${workspace}`);
|
|
366
|
+
}
|
|
367
|
+
} catch (error) {
|
|
368
|
+
console.error('Error reading workspace configuration:', error.message);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async runInWorkspace(workspace, command) {
|
|
373
|
+
console.log(`🏃 Running "${command}" in ${workspace}...`);
|
|
374
|
+
|
|
375
|
+
return new Promise((resolve, reject) => {
|
|
376
|
+
const process = spawn('bun', ['run', command], {
|
|
377
|
+
cwd: workspace,
|
|
378
|
+
stdio: 'inherit'
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
process.on('close', (code) => {
|
|
382
|
+
if (code === 0) {
|
|
383
|
+
resolve(code);
|
|
384
|
+
} else {
|
|
385
|
+
reject(new Error(`Command failed with code ${code}`));
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async installDependency(packageName, options = {}) {
|
|
392
|
+
const args = ['add', packageName];
|
|
393
|
+
|
|
394
|
+
if (options.dev) args.push('--dev');
|
|
395
|
+
if (options.exact) args.push('--exact');
|
|
396
|
+
if (options.workspace) {
|
|
397
|
+
args.push('--cwd', options.workspace);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
console.log(`📦 Installing ${packageName}...`);
|
|
401
|
+
|
|
402
|
+
return new Promise((resolve, reject) => {
|
|
403
|
+
const process = spawn('bun', args, {
|
|
404
|
+
stdio: 'inherit'
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
process.on('close', (code) => {
|
|
408
|
+
if (code === 0) {
|
|
409
|
+
console.log(`✅ Successfully installed ${packageName}`);
|
|
410
|
+
resolve(code);
|
|
411
|
+
} else {
|
|
412
|
+
reject(new Error(`Installation failed with code ${code}`));
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async checkDependencies() {
|
|
419
|
+
console.log('🔍 Checking dependencies...');
|
|
420
|
+
|
|
421
|
+
return new Promise((resolve, reject) => {
|
|
422
|
+
const process = spawn('bun', ['install', '--dry-run'], {
|
|
423
|
+
stdio: 'inherit'
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
process.on('close', (code) => {
|
|
427
|
+
if (code === 0) {
|
|
428
|
+
console.log('✅ Dependencies are up to date');
|
|
429
|
+
resolve(code);
|
|
430
|
+
} else {
|
|
431
|
+
reject(new Error(`Dependency check failed with code ${code}`));
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const tools = new WorkspaceTools();
|
|
439
|
+
|
|
440
|
+
// CLI commands
|
|
441
|
+
const command = process.argv[2];
|
|
442
|
+
const args = process.argv.slice(3);
|
|
443
|
+
|
|
444
|
+
switch (command) {
|
|
445
|
+
case 'list':
|
|
446
|
+
await tools.listWorkspaces();
|
|
447
|
+
break;
|
|
448
|
+
case 'run':
|
|
449
|
+
if (args.length < 2) {
|
|
450
|
+
console.error('Usage: workspace-tools run <workspace> <command>');
|
|
451
|
+
process.exit(1);
|
|
452
|
+
}
|
|
453
|
+
await tools.runInWorkspace(args[0], args[1]);
|
|
454
|
+
break;
|
|
455
|
+
case 'install':
|
|
456
|
+
if (args.length < 1) {
|
|
457
|
+
console.error('Usage: workspace-tools install <package> [options]');
|
|
458
|
+
process.exit(1);
|
|
459
|
+
}
|
|
460
|
+
await tools.installDependency(args[0]);
|
|
461
|
+
break;
|
|
462
|
+
case 'check':
|
|
463
|
+
await tools.checkDependencies();
|
|
464
|
+
break;
|
|
465
|
+
default:
|
|
466
|
+
console.log(`
|
|
467
|
+
Available commands:
|
|
468
|
+
list List all workspaces
|
|
469
|
+
run <workspace> <cmd> Run command in workspace
|
|
470
|
+
install <package> Install package
|
|
471
|
+
check Check dependencies
|
|
472
|
+
`);
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
#### 5. Performance Monitoring
|
|
477
|
+
|
|
478
|
+
**.bunrc (Bun runtime configuration):**
|
|
479
|
+
```bash
|
|
480
|
+
# Bun performance optimizations
|
|
481
|
+
export BUN_INSTALL_CACHE_DIR="$HOME/.bun/install/cache"
|
|
482
|
+
export BUN_INSTALL_GLOBAL_DIR="$HOME/.bun/install/global"
|
|
483
|
+
|
|
484
|
+
# Memory optimizations
|
|
485
|
+
export BUN_GARBAGE_COLLECTOR_LEVEL=1
|
|
486
|
+
export BUN_JSC_useJIT=true
|
|
487
|
+
|
|
488
|
+
# Network optimizations
|
|
489
|
+
export BUN_INSTALL_PROGRESS=true
|
|
490
|
+
export BUN_INSTALL_VERBOSE=false
|
|
491
|
+
|
|
492
|
+
# Development optimizations
|
|
493
|
+
export BUN_RUNTIME_TRANSPILER_CACHE_PATH="$HOME/.bun/transpiler-cache"
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
## 🔧 Implementation Steps
|
|
497
|
+
|
|
498
|
+
### Step 1: Core Bun Configuration
|
|
499
|
+
1. Update root package.json with optimized workspace configuration
|
|
500
|
+
2. Create comprehensive bunfig.toml with performance settings
|
|
501
|
+
3. Set up .bunrc with environment optimizations
|
|
502
|
+
4. Configure package manager version pinning
|
|
503
|
+
|
|
504
|
+
### Step 2: Dependency Management Setup
|
|
505
|
+
1. Implement dependency optimization script
|
|
506
|
+
2. Create workspace management tools
|
|
507
|
+
3. Set up automated dependency analysis
|
|
508
|
+
4. Configure dependency update workflows
|
|
509
|
+
|
|
510
|
+
### Step 3: Performance Optimization
|
|
511
|
+
1. Configure Bun caching for maximum performance
|
|
512
|
+
2. Set up dependency hoisting strategies
|
|
513
|
+
3. Implement lockfile optimization
|
|
514
|
+
4. Configure build-time optimizations
|
|
515
|
+
|
|
516
|
+
### Step 4: Validation and Testing
|
|
517
|
+
1. Test installation speed improvements
|
|
518
|
+
2. Validate workspace dependency resolution
|
|
519
|
+
3. Test all package management scripts
|
|
520
|
+
4. Verify compatibility with Turborepo
|
|
521
|
+
|
|
522
|
+
## 🎯 Performance Targets
|
|
523
|
+
|
|
524
|
+
### Installation Performance
|
|
525
|
+
- **Clean Install**: 3x faster than npm (target: under 30 seconds)
|
|
526
|
+
- **Incremental Install**: 5x faster than npm (target: under 10 seconds)
|
|
527
|
+
- **Cache Hit Rate**: 90%+ for repeated installations
|
|
528
|
+
- **Memory Usage**: Under 500MB during large installs
|
|
529
|
+
|
|
530
|
+
### Dependency Management Efficiency
|
|
531
|
+
- **Duplicate Detection**: Identify 100% of version conflicts
|
|
532
|
+
- **Hoisting Optimization**: Reduce node_modules size by 40%+
|
|
533
|
+
- **Update Speed**: Dependency updates under 15 seconds
|
|
534
|
+
- **Conflict Resolution**: Automatic resolution of 95% version conflicts
|
|
535
|
+
|
|
536
|
+
### Developer Experience Metrics
|
|
537
|
+
- **Command Response Time**: Under 1 second for workspace commands
|
|
538
|
+
- **Hot Reload Performance**: Under 200ms for dependency changes
|
|
539
|
+
- **Build Integration**: Seamless Turbo cache integration
|
|
540
|
+
- **Error Recovery**: Clear error messages and resolution paths
|
|
541
|
+
|
|
542
|
+
## ✅ Quality Criteria
|
|
543
|
+
|
|
544
|
+
### Technical Validation (Must Pass All)
|
|
545
|
+
- [ ] Bun workspace configuration validates without errors
|
|
546
|
+
- [ ] All package management scripts execute successfully
|
|
547
|
+
- [ ] Dependency optimization tools function correctly
|
|
548
|
+
- [ ] Performance monitoring shows 3x speed improvement
|
|
549
|
+
- [ ] Workspace dependency resolution works across all packages
|
|
550
|
+
|
|
551
|
+
### Performance Validation
|
|
552
|
+
- [ ] Installation speeds achieve target improvements over npm
|
|
553
|
+
- [ ] Dependency analysis completes under 30 seconds
|
|
554
|
+
- [ ] Workspace commands respond under 1 second
|
|
555
|
+
- [ ] Cache efficiency meets 90%+ hit rate target
|
|
556
|
+
|
|
557
|
+
### Integration Validation
|
|
558
|
+
- [ ] Turborepo integration maintains performance benefits
|
|
559
|
+
- [ ] Shared configuration packages work with Bun optimization
|
|
560
|
+
- [ ] All workspace scripts integrate properly with Turbo tasks
|
|
561
|
+
- [ ] Development workflows remain smooth with optimizations
|
|
562
|
+
|
|
563
|
+
## 🔗 Integration Points
|
|
564
|
+
|
|
565
|
+
### With Story 3.1 Tasks
|
|
566
|
+
- **Task 3.1.1**: Uses repository structure and workspace foundation
|
|
567
|
+
- **Task 3.1.2**: Integrates with Turbo caching for optimal build performance
|
|
568
|
+
- **Task 3.1.3**: Manages shared configuration package dependencies efficiently
|
|
569
|
+
- **Task 3.1.5**: Provides foundation for development environment automation
|
|
570
|
+
|
|
571
|
+
### With Development Workflows
|
|
572
|
+
- **Installation**: Fast, reliable package installation across all workspaces
|
|
573
|
+
- **Updates**: Streamlined dependency update processes with conflict resolution
|
|
574
|
+
- **Analysis**: Automated dependency health monitoring and optimization
|
|
575
|
+
- **Integration**: Seamless integration with existing development tools
|
|
576
|
+
|
|
577
|
+
## 🚨 Critical Optimization Areas
|
|
578
|
+
|
|
579
|
+
### Dependency Hoisting Strategy
|
|
580
|
+
```javascript
|
|
581
|
+
{
|
|
582
|
+
"hoisting_rules": {
|
|
583
|
+
"always_hoist": [
|
|
584
|
+
"@types/*",
|
|
585
|
+
"typescript",
|
|
586
|
+
"eslint*",
|
|
587
|
+
"prettier"
|
|
588
|
+
],
|
|
589
|
+
"never_hoist": [
|
|
590
|
+
"@repo/*",
|
|
591
|
+
"react",
|
|
592
|
+
"next"
|
|
593
|
+
],
|
|
594
|
+
"hoist_if_compatible": [
|
|
595
|
+
"lodash",
|
|
596
|
+
"date-fns",
|
|
597
|
+
"zod"
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Cache Optimization
|
|
604
|
+
- **Local Cache**: Aggressive caching of unchanged dependencies
|
|
605
|
+
- **Network Cache**: CDN integration for popular packages
|
|
606
|
+
- **Build Cache**: Integration with Turbo remote caching
|
|
607
|
+
- **Workspace Cache**: Shared cache across all workspace packages
|
|
608
|
+
|
|
609
|
+
## 🎯 Success Metrics
|
|
610
|
+
|
|
611
|
+
### Quantitative Measures
|
|
612
|
+
- **Installation Speed**: 3x faster than npm baseline measurements
|
|
613
|
+
- **Cache Efficiency**: 90%+ hit rate maintained over 1 week of development
|
|
614
|
+
- **Disk Usage**: 40% reduction in node_modules size through optimization
|
|
615
|
+
- **Memory Efficiency**: Under 500MB RAM usage during package operations
|
|
616
|
+
|
|
617
|
+
### Qualitative Measures
|
|
618
|
+
- **Developer Satisfaction**: Faster, more reliable package management
|
|
619
|
+
- **Maintenance Overhead**: Reduced manual dependency management tasks
|
|
620
|
+
- **Error Recovery**: Clear, actionable error messages and resolution paths
|
|
621
|
+
- **Tool Integration**: Seamless integration with existing development workflows
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
**Task Optimization Focus**: This task creates a high-performance, reliable package management foundation that accelerates development workflows and reduces maintenance overhead. The optimizations implemented here benefit all subsequent development work and team collaboration.
|
|
626
|
+
|
|
627
|
+
**Quality Gate**: 4.0/5.0 stars required - all performance targets and optimization criteria must be achieved before proceeding to Task 3.1.5.
|