@vibecheckai/cli 3.0.2 → 3.0.3
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/package.json +9 -1
- package/bin/cli-hygiene.js +0 -241
- package/bin/guardrail.js +0 -834
- package/bin/runners/cli-utils.js +0 -1070
- package/bin/runners/context/ai-task-decomposer.js +0 -337
- package/bin/runners/context/analyzer.js +0 -462
- package/bin/runners/context/api-contracts.js +0 -427
- package/bin/runners/context/context-diff.js +0 -342
- package/bin/runners/context/context-pruner.js +0 -291
- package/bin/runners/context/dependency-graph.js +0 -414
- package/bin/runners/context/generators/claude.js +0 -107
- package/bin/runners/context/generators/codex.js +0 -108
- package/bin/runners/context/generators/copilot.js +0 -119
- package/bin/runners/context/generators/cursor.js +0 -514
- package/bin/runners/context/generators/mcp.js +0 -151
- package/bin/runners/context/generators/windsurf.js +0 -180
- package/bin/runners/context/git-context.js +0 -302
- package/bin/runners/context/index.js +0 -1042
- package/bin/runners/context/insights.js +0 -173
- package/bin/runners/context/mcp-server/generate-rules.js +0 -337
- package/bin/runners/context/mcp-server/index.js +0 -1176
- package/bin/runners/context/mcp-server/package.json +0 -24
- package/bin/runners/context/memory.js +0 -200
- package/bin/runners/context/monorepo.js +0 -215
- package/bin/runners/context/multi-repo-federation.js +0 -404
- package/bin/runners/context/patterns.js +0 -253
- package/bin/runners/context/proof-context.js +0 -972
- package/bin/runners/context/security-scanner.js +0 -303
- package/bin/runners/context/semantic-search.js +0 -350
- package/bin/runners/context/shared.js +0 -264
- package/bin/runners/context/team-conventions.js +0 -310
- package/bin/runners/lib/ai-bridge.js +0 -416
- package/bin/runners/lib/analysis-core.js +0 -271
- package/bin/runners/lib/analyzers.js +0 -541
- package/bin/runners/lib/audit-bridge.js +0 -391
- package/bin/runners/lib/auth-truth.js +0 -193
- package/bin/runners/lib/auth.js +0 -215
- package/bin/runners/lib/backup.js +0 -62
- package/bin/runners/lib/billing.js +0 -107
- package/bin/runners/lib/claims.js +0 -118
- package/bin/runners/lib/cli-ui.js +0 -540
- package/bin/runners/lib/compliance-bridge-new.js +0 -0
- package/bin/runners/lib/compliance-bridge.js +0 -165
- package/bin/runners/lib/contracts/auth-contract.js +0 -194
- package/bin/runners/lib/contracts/env-contract.js +0 -178
- package/bin/runners/lib/contracts/external-contract.js +0 -198
- package/bin/runners/lib/contracts/guard.js +0 -168
- package/bin/runners/lib/contracts/index.js +0 -89
- package/bin/runners/lib/contracts/plan-validator.js +0 -311
- package/bin/runners/lib/contracts/route-contract.js +0 -192
- package/bin/runners/lib/detect.js +0 -89
- package/bin/runners/lib/doctor/autofix.js +0 -254
- package/bin/runners/lib/doctor/index.js +0 -37
- package/bin/runners/lib/doctor/modules/dependencies.js +0 -325
- package/bin/runners/lib/doctor/modules/index.js +0 -46
- package/bin/runners/lib/doctor/modules/network.js +0 -250
- package/bin/runners/lib/doctor/modules/project.js +0 -312
- package/bin/runners/lib/doctor/modules/runtime.js +0 -224
- package/bin/runners/lib/doctor/modules/security.js +0 -348
- package/bin/runners/lib/doctor/modules/system.js +0 -213
- package/bin/runners/lib/doctor/modules/vibecheck.js +0 -394
- package/bin/runners/lib/doctor/reporter.js +0 -262
- package/bin/runners/lib/doctor/service.js +0 -262
- package/bin/runners/lib/doctor/types.js +0 -113
- package/bin/runners/lib/doctor/ui.js +0 -263
- package/bin/runners/lib/doctor-enhanced.js +0 -233
- package/bin/runners/lib/doctor-v2.js +0 -608
- package/bin/runners/lib/enforcement.js +0 -72
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vibecheck/context-engine",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "MCP Context Engine - Verified repo facts as tool calls for AI agents",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"vibecheck-context": "./index.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"index": "node index.js index",
|
|
11
|
-
"serve": "node index.js serve --http",
|
|
12
|
-
"serve:mcp": "node index.js serve"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"mcp",
|
|
16
|
-
"cursor",
|
|
17
|
-
"windsurf",
|
|
18
|
-
"copilot",
|
|
19
|
-
"ai-context",
|
|
20
|
-
"vibecheck"
|
|
21
|
-
],
|
|
22
|
-
"author": "vibecheck",
|
|
23
|
-
"license": "MIT"
|
|
24
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Memory System Module
|
|
3
|
-
* Self-learning memory that persists across projects
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const os = require("os");
|
|
9
|
-
const crypto = require("crypto");
|
|
10
|
-
|
|
11
|
-
// Global memory directory
|
|
12
|
-
const VIBECHECK_HOME = path.join(os.homedir(), ".vibecheck");
|
|
13
|
-
const MEMORY_FILE = path.join(VIBECHECK_HOME, "global-memory.json");
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Initialize global memory directory
|
|
17
|
-
*/
|
|
18
|
-
function initializeMemory() {
|
|
19
|
-
if (!fs.existsSync(VIBECHECK_HOME)) {
|
|
20
|
-
fs.mkdirSync(VIBECHECK_HOME, { recursive: true });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!fs.existsSync(MEMORY_FILE)) {
|
|
24
|
-
fs.writeFileSync(MEMORY_FILE, JSON.stringify({
|
|
25
|
-
version: "1.0.0",
|
|
26
|
-
created: new Date().toISOString(),
|
|
27
|
-
projects: {},
|
|
28
|
-
learnings: [],
|
|
29
|
-
patterns: {},
|
|
30
|
-
preferences: {},
|
|
31
|
-
}, null, 2));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Load global AI memory
|
|
37
|
-
*/
|
|
38
|
-
function loadMemory() {
|
|
39
|
-
initializeMemory();
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(fs.readFileSync(MEMORY_FILE, "utf-8"));
|
|
42
|
-
} catch {
|
|
43
|
-
return { projects: {}, learnings: [], patterns: {}, preferences: {} };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Save to global AI memory
|
|
49
|
-
*/
|
|
50
|
-
function saveMemory(memory) {
|
|
51
|
-
initializeMemory();
|
|
52
|
-
fs.writeFileSync(MEMORY_FILE, JSON.stringify(memory, null, 2));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Learn from project analysis and update memory
|
|
57
|
-
*/
|
|
58
|
-
function learnFromProject(projectPath, analysis) {
|
|
59
|
-
const memory = loadMemory();
|
|
60
|
-
const projectId = crypto.createHash("md5").update(projectPath).digest("hex").slice(0, 8);
|
|
61
|
-
|
|
62
|
-
// Store project info
|
|
63
|
-
memory.projects[projectId] = {
|
|
64
|
-
path: projectPath,
|
|
65
|
-
name: analysis.name,
|
|
66
|
-
framework: analysis.framework,
|
|
67
|
-
language: analysis.language,
|
|
68
|
-
lastAnalyzed: new Date().toISOString(),
|
|
69
|
-
patterns: analysis.patterns,
|
|
70
|
-
stats: analysis.stats,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// Learn patterns across projects
|
|
74
|
-
if (analysis.patterns?.stateManagement) {
|
|
75
|
-
memory.patterns.stateManagement = memory.patterns.stateManagement || {};
|
|
76
|
-
memory.patterns.stateManagement[analysis.patterns.stateManagement] =
|
|
77
|
-
(memory.patterns.stateManagement[analysis.patterns.stateManagement] || 0) + 1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (analysis.patterns?.validation) {
|
|
81
|
-
memory.patterns.validation = memory.patterns.validation || {};
|
|
82
|
-
memory.patterns.validation[analysis.patterns.validation] =
|
|
83
|
-
(memory.patterns.validation[analysis.patterns.validation] || 0) + 1;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (analysis.framework) {
|
|
87
|
-
memory.patterns.frameworks = memory.patterns.frameworks || {};
|
|
88
|
-
memory.patterns.frameworks[analysis.framework] =
|
|
89
|
-
(memory.patterns.frameworks[analysis.framework] || 0) + 1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Add learning entry
|
|
93
|
-
memory.learnings.push({
|
|
94
|
-
timestamp: new Date().toISOString(),
|
|
95
|
-
project: analysis.name,
|
|
96
|
-
action: "context_generated",
|
|
97
|
-
details: {
|
|
98
|
-
files: analysis.stats?.totalFiles || 0,
|
|
99
|
-
components: analysis.components?.length || 0,
|
|
100
|
-
hooks: analysis.patterns?.hooks?.length || 0,
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Keep only last 100 learnings
|
|
105
|
-
if (memory.learnings.length > 100) {
|
|
106
|
-
memory.learnings = memory.learnings.slice(-100);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
saveMemory(memory);
|
|
110
|
-
return memory;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get recommendations based on learned patterns
|
|
115
|
-
*/
|
|
116
|
-
function getRecommendations(analysis) {
|
|
117
|
-
const memory = loadMemory();
|
|
118
|
-
const recommendations = [];
|
|
119
|
-
|
|
120
|
-
// Recommend popular patterns from other projects
|
|
121
|
-
if (!analysis.patterns?.stateManagement && memory.patterns.stateManagement) {
|
|
122
|
-
const popular = Object.entries(memory.patterns.stateManagement)
|
|
123
|
-
.sort((a, b) => b[1] - a[1])[0];
|
|
124
|
-
if (popular) {
|
|
125
|
-
recommendations.push({
|
|
126
|
-
type: "state_management",
|
|
127
|
-
message: `Consider using ${popular[0]} for state management (used in ${popular[1]} of your projects)`,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!analysis.patterns?.validation && memory.patterns.validation) {
|
|
133
|
-
const popular = Object.entries(memory.patterns.validation)
|
|
134
|
-
.sort((a, b) => b[1] - a[1])[0];
|
|
135
|
-
if (popular) {
|
|
136
|
-
recommendations.push({
|
|
137
|
-
type: "validation",
|
|
138
|
-
message: `Consider using ${popular[0]} for validation (used in ${popular[1]} of your projects)`,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return recommendations;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Get memory statistics
|
|
148
|
-
*/
|
|
149
|
-
function getMemoryStats() {
|
|
150
|
-
const memory = loadMemory();
|
|
151
|
-
return {
|
|
152
|
-
projectCount: Object.keys(memory.projects || {}).length,
|
|
153
|
-
learningCount: memory.learnings?.length || 0,
|
|
154
|
-
patterns: memory.patterns || {},
|
|
155
|
-
created: memory.created,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Clear memory for a specific project
|
|
161
|
-
*/
|
|
162
|
-
function clearProjectMemory(projectPath) {
|
|
163
|
-
const memory = loadMemory();
|
|
164
|
-
const projectId = crypto.createHash("md5").update(projectPath).digest("hex").slice(0, 8);
|
|
165
|
-
|
|
166
|
-
if (memory.projects[projectId]) {
|
|
167
|
-
delete memory.projects[projectId];
|
|
168
|
-
saveMemory(memory);
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Clear all memory
|
|
176
|
-
*/
|
|
177
|
-
function clearAllMemory() {
|
|
178
|
-
const memory = {
|
|
179
|
-
version: "1.0.0",
|
|
180
|
-
created: new Date().toISOString(),
|
|
181
|
-
projects: {},
|
|
182
|
-
learnings: [],
|
|
183
|
-
patterns: {},
|
|
184
|
-
preferences: {},
|
|
185
|
-
};
|
|
186
|
-
saveMemory(memory);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
module.exports = {
|
|
190
|
-
VIBECHECK_HOME,
|
|
191
|
-
MEMORY_FILE,
|
|
192
|
-
initializeMemory,
|
|
193
|
-
loadMemory,
|
|
194
|
-
saveMemory,
|
|
195
|
-
learnFromProject,
|
|
196
|
-
getRecommendations,
|
|
197
|
-
getMemoryStats,
|
|
198
|
-
clearProjectMemory,
|
|
199
|
-
clearAllMemory,
|
|
200
|
-
};
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Monorepo Detection Module
|
|
3
|
-
* Detects monorepo structures and workspaces
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Find workspaces from glob patterns
|
|
11
|
-
*/
|
|
12
|
-
function findWorkspaces(projectPath, patterns) {
|
|
13
|
-
const workspaces = [];
|
|
14
|
-
|
|
15
|
-
for (const pattern of patterns) {
|
|
16
|
-
const baseDir = pattern.replace(/\/\*$/, "").replace(/\*\*$/, "");
|
|
17
|
-
const searchPath = path.join(projectPath, baseDir);
|
|
18
|
-
|
|
19
|
-
if (fs.existsSync(searchPath) && fs.statSync(searchPath).isDirectory()) {
|
|
20
|
-
try {
|
|
21
|
-
const entries = fs.readdirSync(searchPath, { withFileTypes: true });
|
|
22
|
-
for (const entry of entries) {
|
|
23
|
-
if (entry.isDirectory()) {
|
|
24
|
-
const pkgJson = path.join(searchPath, entry.name, "package.json");
|
|
25
|
-
if (fs.existsSync(pkgJson)) {
|
|
26
|
-
try {
|
|
27
|
-
const pkg = JSON.parse(fs.readFileSync(pkgJson, "utf-8"));
|
|
28
|
-
workspaces.push({
|
|
29
|
-
name: pkg.name || entry.name,
|
|
30
|
-
path: path.join(baseDir, entry.name),
|
|
31
|
-
description: pkg.description || "",
|
|
32
|
-
dependencies: Object.keys(pkg.dependencies || {}),
|
|
33
|
-
devDependencies: Object.keys(pkg.devDependencies || {}),
|
|
34
|
-
version: pkg.version,
|
|
35
|
-
});
|
|
36
|
-
} catch {}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
} catch {}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return workspaces;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Find packages used across multiple workspaces
|
|
49
|
-
*/
|
|
50
|
-
function findSharedPackages(projectPath, workspaces) {
|
|
51
|
-
const packageUsage = new Map();
|
|
52
|
-
|
|
53
|
-
for (const workspace of workspaces) {
|
|
54
|
-
const allDeps = [...(workspace.dependencies || []), ...(workspace.devDependencies || [])];
|
|
55
|
-
for (const dep of allDeps) {
|
|
56
|
-
if (dep.startsWith("@") || !dep.includes("/")) {
|
|
57
|
-
packageUsage.set(dep, (packageUsage.get(dep) || 0) + 1);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Return packages used in multiple workspaces
|
|
63
|
-
return Array.from(packageUsage.entries())
|
|
64
|
-
.filter(([_, count]) => count > 1)
|
|
65
|
-
.map(([name, count]) => ({ name, usedIn: count }))
|
|
66
|
-
.sort((a, b) => b.usedIn - a.usedIn)
|
|
67
|
-
.slice(0, 20);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Detect if project is a monorepo and find all workspaces
|
|
72
|
-
*/
|
|
73
|
-
function detectMonorepo(projectPath) {
|
|
74
|
-
const monorepo = {
|
|
75
|
-
isMonorepo: false,
|
|
76
|
-
type: null,
|
|
77
|
-
workspaces: [],
|
|
78
|
-
sharedPackages: [],
|
|
79
|
-
rootConfig: null,
|
|
80
|
-
tools: [],
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const pkgPath = path.join(projectPath, "package.json");
|
|
84
|
-
if (!fs.existsSync(pkgPath)) return monorepo;
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
88
|
-
|
|
89
|
-
// Check for npm/yarn workspaces
|
|
90
|
-
if (pkg.workspaces) {
|
|
91
|
-
monorepo.isMonorepo = true;
|
|
92
|
-
monorepo.type = "npm/yarn";
|
|
93
|
-
const patterns = Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces.packages || [];
|
|
94
|
-
monorepo.workspaces = findWorkspaces(projectPath, patterns);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Check for pnpm workspaces
|
|
98
|
-
const pnpmWorkspace = path.join(projectPath, "pnpm-workspace.yaml");
|
|
99
|
-
if (fs.existsSync(pnpmWorkspace)) {
|
|
100
|
-
monorepo.isMonorepo = true;
|
|
101
|
-
monorepo.type = "pnpm";
|
|
102
|
-
try {
|
|
103
|
-
const content = fs.readFileSync(pnpmWorkspace, "utf-8");
|
|
104
|
-
const patterns = content.match(/- ['"]?([^'"]+)['"]?/g)?.map(m =>
|
|
105
|
-
m.replace(/- ['"]?/, "").replace(/['"]?$/, "")
|
|
106
|
-
) || [];
|
|
107
|
-
monorepo.workspaces = findWorkspaces(projectPath, patterns);
|
|
108
|
-
} catch {}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Check for Turborepo
|
|
112
|
-
if (fs.existsSync(path.join(projectPath, "turbo.json"))) {
|
|
113
|
-
monorepo.tools.push("Turborepo");
|
|
114
|
-
if (!monorepo.type) monorepo.type = "turborepo";
|
|
115
|
-
monorepo.rootConfig = "turbo.json";
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Check for Nx
|
|
119
|
-
if (fs.existsSync(path.join(projectPath, "nx.json"))) {
|
|
120
|
-
monorepo.isMonorepo = true;
|
|
121
|
-
monorepo.tools.push("Nx");
|
|
122
|
-
if (!monorepo.type) monorepo.type = "nx";
|
|
123
|
-
monorepo.rootConfig = "nx.json";
|
|
124
|
-
|
|
125
|
-
// Nx projects are in workspace.json or project.json files
|
|
126
|
-
const workspaceJson = path.join(projectPath, "workspace.json");
|
|
127
|
-
if (fs.existsSync(workspaceJson)) {
|
|
128
|
-
try {
|
|
129
|
-
const workspace = JSON.parse(fs.readFileSync(workspaceJson, "utf-8"));
|
|
130
|
-
if (workspace.projects) {
|
|
131
|
-
for (const [name, config] of Object.entries(workspace.projects)) {
|
|
132
|
-
const projectPath = typeof config === "string" ? config : config.root;
|
|
133
|
-
monorepo.workspaces.push({
|
|
134
|
-
name,
|
|
135
|
-
path: projectPath,
|
|
136
|
-
description: "",
|
|
137
|
-
dependencies: [],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
} catch {}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Check for Lerna
|
|
146
|
-
if (fs.existsSync(path.join(projectPath, "lerna.json"))) {
|
|
147
|
-
monorepo.isMonorepo = true;
|
|
148
|
-
monorepo.tools.push("Lerna");
|
|
149
|
-
if (!monorepo.type) monorepo.type = "lerna";
|
|
150
|
-
monorepo.rootConfig = "lerna.json";
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
const lerna = JSON.parse(fs.readFileSync(path.join(projectPath, "lerna.json"), "utf-8"));
|
|
154
|
-
if (lerna.packages && monorepo.workspaces.length === 0) {
|
|
155
|
-
monorepo.workspaces = findWorkspaces(projectPath, lerna.packages);
|
|
156
|
-
}
|
|
157
|
-
} catch {}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Check for Rush
|
|
161
|
-
if (fs.existsSync(path.join(projectPath, "rush.json"))) {
|
|
162
|
-
monorepo.isMonorepo = true;
|
|
163
|
-
monorepo.tools.push("Rush");
|
|
164
|
-
if (!monorepo.type) monorepo.type = "rush";
|
|
165
|
-
monorepo.rootConfig = "rush.json";
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Find shared packages
|
|
169
|
-
if (monorepo.isMonorepo && monorepo.workspaces.length > 0) {
|
|
170
|
-
monorepo.sharedPackages = findSharedPackages(projectPath, monorepo.workspaces);
|
|
171
|
-
}
|
|
172
|
-
} catch {}
|
|
173
|
-
|
|
174
|
-
return monorepo;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Get workspace by name
|
|
179
|
-
*/
|
|
180
|
-
function getWorkspace(projectPath, workspaceName) {
|
|
181
|
-
const monorepo = detectMonorepo(projectPath);
|
|
182
|
-
return monorepo.workspaces.find(w => w.name === workspaceName);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Get internal dependencies (workspaces that depend on other workspaces)
|
|
187
|
-
*/
|
|
188
|
-
function getInternalDependencies(projectPath) {
|
|
189
|
-
const monorepo = detectMonorepo(projectPath);
|
|
190
|
-
if (!monorepo.isMonorepo) return [];
|
|
191
|
-
|
|
192
|
-
const workspaceNames = new Set(monorepo.workspaces.map(w => w.name));
|
|
193
|
-
const internalDeps = [];
|
|
194
|
-
|
|
195
|
-
for (const workspace of monorepo.workspaces) {
|
|
196
|
-
const deps = [...(workspace.dependencies || []), ...(workspace.devDependencies || [])];
|
|
197
|
-
const internal = deps.filter(d => workspaceNames.has(d));
|
|
198
|
-
if (internal.length > 0) {
|
|
199
|
-
internalDeps.push({
|
|
200
|
-
workspace: workspace.name,
|
|
201
|
-
dependsOn: internal,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return internalDeps;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
module.exports = {
|
|
210
|
-
detectMonorepo,
|
|
211
|
-
findWorkspaces,
|
|
212
|
-
findSharedPackages,
|
|
213
|
-
getWorkspace,
|
|
214
|
-
getInternalDependencies,
|
|
215
|
-
};
|