mcp-efficiency-engine 0.1.7 → 0.1.9

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.
@@ -26,6 +26,11 @@ jobs:
26
26
  with:
27
27
  python-version: '3.11'
28
28
 
29
+ - name: Setup Node
30
+ uses: actions/setup-node@v4
31
+ with:
32
+ node-version: '20'
33
+
29
34
  - name: Compile AutoDocs
30
35
  run: py -3 -m scripts.wiki.wiki_compiler
31
36
  shell: pwsh
@@ -119,6 +124,11 @@ jobs:
119
124
  with:
120
125
  python-version: '3.11'
121
126
 
127
+ - name: Setup Node
128
+ uses: actions/setup-node@v4
129
+ with:
130
+ node-version: '20'
131
+
122
132
  - name: Compile AutoDocs
123
133
  run: py -3 -m scripts.wiki.wiki_compiler
124
134
  shell: pwsh
package/README.md CHANGED
@@ -233,19 +233,30 @@ Resumen rapido:
233
233
  - La conexion real de boosts/repos ocurre al ejecutar intake.
234
234
  - Si no configuras repos adicionales, se usa el repo inicial por defecto.
235
235
 
236
+ Flujo recomendado para nuevos usuarios:
237
+
238
+ - `repo-registry/repos.template.json`: plantilla guiada con dominios y ejemplos.
239
+ - `repo-registry/repos.yml`: registry operativo que consume el intake.
240
+ - `scripts/intake/init-template-registry.cmd`: inicializa `repos.yml` desde la plantilla y pregunta owner/prefix/repo inicial.
241
+
236
242
  Pasos recomendados despues de instalar:
237
243
 
238
244
  ```powershell
239
- # 1) (Opcional) editar repos auxiliares/boosts
245
+ # 1) Inicializar registry operativo desde la plantilla (modo asistido)
246
+ .\scripts\intake\init-template-registry.cmd
247
+
248
+ # 2) (Opcional) ajustar repos auxiliares/boosts
240
249
  notepad .\repo-registry\repos.yml
241
250
 
242
- # 2) materializar capacidades de todos los repos del registry
251
+ # 3) materializar capacidades de todos los repos del registry
243
252
  .\scripts\intake\run-repo-intake.cmd
244
253
 
245
- # 3) validar que el router ya los ve
254
+ # 4) validar que el router ya los ve
246
255
  .\scripts\ops\hi.ps1
247
256
  ```
248
257
 
258
+ Si quieres preparar entradas manuales, usa los ejemplos de `repo-registry/repos.template.json` (`local`, `github`, `rag_local_github`, `azure_rag_github`) y copialos a `repos.yml`.
259
+
249
260
  Si quieres que te pregunte por owner/prefix/repo inicial en modo asistido, ejecuta:
250
261
 
251
262
  ```powershell
@@ -270,7 +270,7 @@ function initializeTemplateRegistry(targetRoot, options) {
270
270
  "-InitialRepoName",
271
271
  deriveDefaultRepoName(targetRoot, options),
272
272
  "-InitialRepoDomain",
273
- options.initialRepoDomain || "dev",
273
+ options.initialRepoDomain || "backend",
274
274
  "-InitialRepoLocation",
275
275
  options.initialRepoLocation || ".",
276
276
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-efficiency-engine",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Motor de orquestacion para agentes MCP con routing por dominio y bootstrap portable.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "registry_mode": "template",
3
3
  "schema_version": "2.0",
4
+ "onboarding_help": {
5
+ "what_is_this": "Define aqui los repos/boosts que quieres conectar al motor de routing.",
6
+ "quick_start": [
7
+ "1) Duplica un ejemplo de repo_examples dentro de repos[]",
8
+ "2) Ajusta domain, type y location/repo_url",
9
+ "3) Ejecuta scripts/intake/run-repo-intake.cmd",
10
+ "4) Ejecuta scripts/ops/hi.ps1 para validar"
11
+ ],
12
+ "required_fields": [
13
+ "name",
14
+ "domain",
15
+ "type",
16
+ "location (si type=local)",
17
+ "repo_url (si type=github)"
18
+ ],
19
+ "domain_reference": {
20
+ "backend": "Codigo backend en repo unico (CodeGraph)",
21
+ "frontend": "Codigo frontend en repo unico (CodeGraph)",
22
+ "community-content": "Contenido/comunidad/documentacion de apoyo",
23
+ "legacy": "Migracion/impacto multi-repo (GitNexus)",
24
+ "dba": "SQL, esquema y conocimiento de base de datos",
25
+ "iot": "IoT/edge/telemetria",
26
+ "ux-ui": "Patrones de diseno, UX y design system",
27
+ "azure-rag": "Contratos/politicas enterprise con Azure RAG",
28
+ "rag": "RAG local con docs tecnicas"
29
+ }
30
+ },
4
31
  "governance": {
5
32
  "owner": "your-team",
6
33
  "approval_required": false,
@@ -12,7 +39,14 @@
12
39
  "name": "your-prefix_backend_local",
13
40
  "domain": "backend",
14
41
  "type": "local",
15
- "location": "../your-backend-repo"
42
+ "location": "../your-backend-repo",
43
+ "optional": false,
44
+ "dependencies": [],
45
+ "engines": {
46
+ "knowledge": "codegraph",
47
+ "execution": "none",
48
+ "snapshot": "repomix"
49
+ }
16
50
  },
17
51
  "github": {
18
52
  "name": "your-prefix_backend_remote",
@@ -20,7 +54,44 @@
20
54
  "type": "github",
21
55
  "repo_url": "https://github.com/your-org/your-repo.git",
22
56
  "branch": "main",
23
- "cache_location": ".cache/github-repos/your-prefix_backend_remote"
57
+ "cache_location": ".cache/github-repos/your-prefix_backend_remote",
58
+ "optional": false,
59
+ "dependencies": [],
60
+ "engines": {
61
+ "knowledge": "codegraph",
62
+ "execution": "none",
63
+ "snapshot": "repomix"
64
+ }
65
+ },
66
+ "rag_local_github": {
67
+ "name": "your-prefix_rag_local",
68
+ "domain": "rag",
69
+ "type": "github",
70
+ "repo_url": "https://github.com/your-org/your-rag-docs.git",
71
+ "branch": "main",
72
+ "cache_location": ".cache/github-repos/your-prefix_rag_local",
73
+ "optional": true,
74
+ "dependencies": [],
75
+ "engines": {
76
+ "knowledge": "graphify",
77
+ "execution": "none",
78
+ "snapshot": "repomix"
79
+ }
80
+ },
81
+ "azure_rag_github": {
82
+ "name": "your-prefix_azure_rag",
83
+ "domain": "azure-rag",
84
+ "type": "github",
85
+ "repo_url": "https://github.com/your-org/your-enterprise-docs.git",
86
+ "branch": "main",
87
+ "cache_location": ".cache/github-repos/your-prefix_azure_rag",
88
+ "optional": true,
89
+ "dependencies": [],
90
+ "engines": {
91
+ "knowledge": "azure-rag-builder",
92
+ "execution": "none",
93
+ "snapshot": "repomix"
94
+ }
24
95
  }
25
96
  }
26
97
  }
@@ -124,17 +124,35 @@ function Read-YesNoValue {
124
124
  function Get-DefaultEnginesForDomain {
125
125
  param([Parameter(Mandatory = $true)][string]$Domain)
126
126
 
127
+ if ($Domain -eq 'dev') {
128
+ $Domain = 'backend'
129
+ }
130
+
127
131
  switch ($Domain) {
128
- 'dev' {
132
+ 'backend' {
129
133
  return [pscustomobject]@{
130
134
  knowledge = 'codegraph'
131
135
  execution = 'none'
132
136
  snapshot = 'repomix'
133
137
  }
134
138
  }
135
- 'legacy' {
139
+ 'frontend' {
140
+ return [pscustomobject]@{
141
+ knowledge = 'codegraph'
142
+ execution = 'none'
143
+ snapshot = 'repomix'
144
+ }
145
+ }
146
+ 'community-content' {
136
147
  return [pscustomobject]@{
137
148
  knowledge = 'graphify'
149
+ execution = 'none'
150
+ snapshot = 'repomix'
151
+ }
152
+ }
153
+ 'legacy' {
154
+ return [pscustomobject]@{
155
+ knowledge = 'gitnexus'
138
156
  execution = 'gitnexus'
139
157
  snapshot = 'repomix'
140
158
  }
@@ -160,6 +178,20 @@ function Get-DefaultEnginesForDomain {
160
178
  snapshot = 'repomix'
161
179
  }
162
180
  }
181
+ 'rag' {
182
+ return [pscustomobject]@{
183
+ knowledge = 'graphify'
184
+ execution = 'none'
185
+ snapshot = 'repomix'
186
+ }
187
+ }
188
+ 'ux-ui' {
189
+ return [pscustomobject]@{
190
+ knowledge = 'graphify'
191
+ execution = 'none'
192
+ snapshot = 'repomix'
193
+ }
194
+ }
163
195
  default {
164
196
  return [pscustomobject]@{
165
197
  knowledge = 'codegraph'
@@ -218,11 +250,19 @@ else {
218
250
  $templateRegistry.repos = @()
219
251
  if ($addInitialRepo) {
220
252
  $defaultRepoName = if ([string]::IsNullOrWhiteSpace($InitialRepoName)) { "$resolvedPrefix$((Split-Path $repoRoot -Leaf).ToLowerInvariant())" } else { $InitialRepoName }
221
- $defaultRepoDomain = if ([string]::IsNullOrWhiteSpace($InitialRepoDomain)) { 'dev' } else { $InitialRepoDomain }
253
+ $defaultRepoDomain = if ([string]::IsNullOrWhiteSpace($InitialRepoDomain)) { 'backend' } else { $InitialRepoDomain }
222
254
  $defaultRepoLocation = if ([string]::IsNullOrWhiteSpace($InitialRepoLocation)) { '.' } else { $InitialRepoLocation }
223
255
 
256
+ if ($defaultRepoDomain -eq 'dev') {
257
+ $defaultRepoDomain = 'backend'
258
+ }
259
+
224
260
  $resolvedRepoName = Read-RequiredValue -Prompt 'Initial repo name' -DefaultValue $defaultRepoName -ProvidedValue $InitialRepoName
225
- $resolvedRepoDomain = Read-ChoiceValue -Prompt 'Initial repo domain' -AllowedValues @('dev', 'legacy', 'dba', 'iot', 'azure-rag') -DefaultValue $defaultRepoDomain -ProvidedValue $InitialRepoDomain
261
+ $resolvedRepoDomain = Read-ChoiceValue -Prompt 'Initial repo domain' -AllowedValues @('dev', 'backend', 'frontend', 'community-content', 'legacy', 'dba', 'iot', 'ux-ui', 'azure-rag', 'rag') -DefaultValue $defaultRepoDomain -ProvidedValue $InitialRepoDomain
262
+ if ($resolvedRepoDomain -eq 'dev') {
263
+ Write-Host "[info] Domain 'dev' is a legacy alias. Normalizing to 'backend'."
264
+ $resolvedRepoDomain = 'backend'
265
+ }
226
266
  $resolvedRepoLocation = Read-RequiredValue -Prompt 'Initial repo location' -DefaultValue $defaultRepoLocation -ProvidedValue $InitialRepoLocation
227
267
  $resolvedEngines = Get-DefaultEnginesForDomain -Domain $resolvedRepoDomain
228
268
 
@@ -569,6 +569,10 @@ function Ensure-CodegraphInitialized {
569
569
  }
570
570
 
571
571
  function Ensure-SetupPrerequisites {
572
+ param(
573
+ [string]$Reason = 'missing prerequisite'
574
+ )
575
+
572
576
  if ($script:SetupAttempted) {
573
577
  if (-not $script:SetupSucceeded) {
574
578
  throw 'setup-prerequisites was already attempted and failed earlier in this run'
@@ -577,11 +581,15 @@ function Ensure-SetupPrerequisites {
577
581
  }
578
582
 
579
583
  $script:SetupAttempted = $true
580
- Write-Host '[info] Missing prerequisite detected. Running setup-prerequisites automatically...' -ForegroundColor DarkYellow
581
- & pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup\setup-prerequisites.ps1
582
- if ($LASTEXITCODE -ne 0) {
584
+ Write-Host ("[info] Missing prerequisite detected ({0}). Running setup-prerequisites automatically..." -f $Reason) -ForegroundColor DarkYellow
585
+ try {
586
+ $script:StepLogs['setup-prerequisites-auto'] = Invoke-LoggedAction -StepName 'setup-prerequisites-auto' -InfoLines @("Auto-recovery reason: $Reason") -Action {
587
+ & pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup\setup-prerequisites.ps1 -VerboseTrace
588
+ }
589
+ }
590
+ catch {
583
591
  $script:SetupSucceeded = $false
584
- throw "setup-prerequisites failed with exit code $LASTEXITCODE"
592
+ throw $_.Exception.Message
585
593
  }
586
594
 
587
595
  $script:SetupSucceeded = $true
@@ -656,7 +664,7 @@ Invoke-Step -Name 'Validate context' -Action $validateContextAction -Required $t
656
664
  if ($script:HasFailures) {
657
665
  $script:HasFailures = $false
658
666
  Invoke-Step -Name 'Setup prerequisites' -Action {
659
- [void](Ensure-SetupPrerequisites)
667
+ [void](Ensure-SetupPrerequisites -Reason 'validate-context failed')
660
668
  } -Required $true
661
669
 
662
670
  Invoke-Step -Name 'Validate context (retry)' -Action $validateContextAction -Required $true
@@ -691,7 +699,7 @@ Invoke-Step -Name 'Validate memory/cache artifacts' -Action {
691
699
  }
692
700
 
693
701
  if (-not (Get-Command codebase-memory-mcp -ErrorAction SilentlyContinue)) {
694
- [void](Ensure-SetupPrerequisites)
702
+ [void](Ensure-SetupPrerequisites -Reason 'codebase-memory-mcp command not found')
695
703
  }
696
704
 
697
705
  if (-not (Get-Command codebase-memory-mcp -ErrorAction SilentlyContinue)) {
@@ -701,7 +709,7 @@ Invoke-Step -Name 'Validate memory/cache artifacts' -Action {
701
709
 
702
710
  Invoke-Step -Name 'Activate token-saver mode' -Action {
703
711
  if (-not (Test-CommandAvailable -Name 'token-saver-mcp')) {
704
- [void](Ensure-SetupPrerequisites)
712
+ [void](Ensure-SetupPrerequisites -Reason 'token-saver-mcp command not found')
705
713
  }
706
714
 
707
715
  if (-not (Test-CommandAvailable -Name 'token-saver-mcp')) {
@@ -5,7 +5,8 @@ param(
5
5
  [switch]$SkipGitnexus,
6
6
  [switch]$SkipGraphify,
7
7
  [switch]$SkipRepomix,
8
- [switch]$PortableMode
8
+ [switch]$PortableMode,
9
+ [switch]$VerboseTrace
9
10
  )
10
11
 
11
12
  $ErrorActionPreference = 'Stop'
@@ -20,6 +21,17 @@ function Test-Command {
20
21
  return [bool](Get-Command -Name $Name -ErrorAction SilentlyContinue)
21
22
  }
22
23
 
24
+ function Write-TraceStep {
25
+ param(
26
+ [Parameter(Mandatory = $true)][string]$Message
27
+ )
28
+
29
+ if ($VerboseTrace) {
30
+ $stamp = (Get-Date).ToString('HH:mm:ss')
31
+ Write-Host ("[trace {0}] {1}" -f $stamp, $Message) -ForegroundColor DarkGray
32
+ }
33
+ }
34
+
23
35
  function Install-NpmGlobalPackage {
24
36
  param(
25
37
  [Parameter(Mandatory = $true)][string]$Package,
@@ -165,6 +177,7 @@ function Sync-GraphifyArtifactsFromScripts {
165
177
  }
166
178
 
167
179
  Write-Host '== MCP platform prerequisites setup =='
180
+ Write-TraceStep -Message ("repoRoot={0}" -f $repoRoot)
168
181
 
169
182
  $toolingManifest = Get-ToolingManifest -Path $toolingManifestPath
170
183
  $externalCliEntries = @($toolingManifest.external_clis)
@@ -174,14 +187,17 @@ foreach ($tool in $externalCliEntries) {
174
187
  }
175
188
 
176
189
  if (-not $SkipCodebaseMemory) {
190
+ Write-TraceStep -Message 'Installing codebase-memory-mcp from tooling manifest'
177
191
  Install-ToolFromManifest -Tool $toolByCommand['codebase-memory-mcp']
178
192
  }
179
193
 
180
194
  if (-not $SkipTokenSaver) {
195
+ Write-TraceStep -Message 'Installing token-saver-mcp from tooling manifest'
181
196
  Install-ToolFromManifest -Tool $toolByCommand['token-saver-mcp']
182
197
  }
183
198
 
184
199
  if (-not $SkipCodegraph) {
200
+ Write-TraceStep -Message 'Installing/verifying codegraph'
185
201
  Install-ToolFromManifest -Tool $toolByCommand['codegraph']
186
202
  Write-Host '[setup] codegraph install'
187
203
  codegraph install
@@ -195,12 +211,14 @@ if (-not $SkipCodegraph) {
195
211
  }
196
212
 
197
213
  if (-not $SkipGitnexus) {
214
+ Write-TraceStep -Message 'Installing/verifying gitnexus'
198
215
  Install-ToolFromManifest -Tool $toolByCommand['gitnexus']
199
216
  Write-Host '[setup] gitnexus setup'
200
217
  gitnexus setup
201
218
  }
202
219
 
203
220
  if (-not $SkipRepomix) {
221
+ Write-TraceStep -Message 'Installing/verifying repomix'
204
222
  Install-ToolFromManifest -Tool $toolByCommand['repomix']
205
223
  }
206
224
 
@@ -219,9 +237,11 @@ else {
219
237
  }
220
238
 
221
239
  # Core observability dependency used by KPI publishing and telemetry export.
240
+ Write-TraceStep -Message 'Ensuring Python module langsmith'
222
241
  Ensure-PythonModuleInstalled -PythonCommand $pyCmd -PythonArgs $pyArgs -Module 'langsmith' -Package 'langsmith'
223
242
 
224
243
  if (-not $SkipGraphify) {
244
+ Write-TraceStep -Message 'Installing Python requirements for graphify runtime'
225
245
  Install-PythonRequirements -PythonCommand $pyCmd -PythonArgs $pyArgs -RequirementsPath 'requirements.txt'
226
246
 
227
247
  if (-not (Test-PythonImport -PythonCommand $pyCmd -PythonArgs $pyArgs -Module 'graphify.serve')) {
@@ -234,6 +254,7 @@ if (-not $SkipGraphify) {
234
254
 
235
255
  if (-not (Test-Path 'context/graphify-out/graph.json')) {
236
256
  Write-Host '[setup] graphify update scripts --no-cluster'
257
+ Write-TraceStep -Message ("Running: {0} {1} -m graphify update scripts --no-cluster" -f $pyCmd, ($pyArgs -join ' '))
237
258
  & $pyCmd @pyArgs -m graphify update scripts --no-cluster
238
259
  if ($LASTEXITCODE -ne 0) {
239
260
  throw "graphify update failed with exit code $LASTEXITCODE"
@@ -245,6 +266,7 @@ if (-not $SkipGraphify) {
245
266
  }
246
267
  else {
247
268
  Write-Host '[ok] context/graphify-out/graph.json already exists'
269
+ Write-TraceStep -Message 'Skipping graphify update because context graph already exists'
248
270
  }
249
271
  }
250
272
 
@@ -87,6 +87,26 @@ function Sync-GraphifyArtifactsIfNeeded {
87
87
  }
88
88
  }
89
89
 
90
+ function Resolve-PythonLauncher {
91
+ if (Get-Command py -ErrorAction SilentlyContinue) {
92
+ return [pscustomobject]@{
93
+ command = 'py'
94
+ args = @('-3')
95
+ printable = 'py -3'
96
+ }
97
+ }
98
+
99
+ if (Get-Command python -ErrorAction SilentlyContinue) {
100
+ return [pscustomobject]@{
101
+ command = 'python'
102
+ args = @()
103
+ printable = 'python'
104
+ }
105
+ }
106
+
107
+ return $null
108
+ }
109
+
90
110
  # Ensure report directory exists
91
111
  $reportDir = Split-Path -Parent $setupValidationReportPath
92
112
  if (-not (Test-Path $reportDir)) {
@@ -333,29 +353,32 @@ if (-not (Get-Command py -ErrorAction SilentlyContinue) -and -not (Get-Command p
333
353
  }
334
354
  }
335
355
  else {
336
- $pythonCmd = "python"
337
- $pythonArgs = @("-c", "import graphify.serve, mcp; print('ok')")
338
- if (Get-Command py -ErrorAction SilentlyContinue) {
339
- $pythonCmd = "py"
340
- $pythonArgs = @("-3.14", "-c", "import graphify.serve, mcp; print('ok')")
341
- }
356
+ $pythonLauncher = Resolve-PythonLauncher
357
+ $pythonCmd = [string]$pythonLauncher.command
358
+ $pythonArgs = @($pythonLauncher.args + @("-c", "import graphify.serve, mcp; print('ok')"))
342
359
 
343
360
  & $pythonCmd @pythonArgs *> $null
344
361
  $setupValidationReport.python_modules += @{
345
- launcher = $pythonCmd
362
+ launcher = [string]$pythonLauncher.printable
346
363
  args = $pythonArgs
347
364
  import_ok = ($LASTEXITCODE -eq 0)
348
365
  }
349
366
  if ($LASTEXITCODE -ne 0) {
350
367
  if (-not ($CIMode)) {
351
- $errors += 'Graphify MCP runtime missing. Run: py -3.14 -m pip install -r requirements.txt'
368
+ $errors += "Graphify MCP runtime missing. Run: $($pythonLauncher.printable) -m pip install -r requirements.txt"
352
369
  }
353
370
  }
354
371
  }
355
372
 
356
373
  if ((-not (Test-Path "context/graphify-out/graph.json")) -and (-not (Test-Path "scripts/graphify-out/graph.json"))) {
357
374
  if (-not ($CIMode)) {
358
- $errors += "Missing graphify graph output. Run: py -3.14 -m graphify update scripts --no-cluster"
375
+ $pythonLauncher = Resolve-PythonLauncher
376
+ if ($null -ne $pythonLauncher) {
377
+ $errors += "Missing graphify graph output. Run: $($pythonLauncher.printable) -m graphify update scripts --no-cluster"
378
+ }
379
+ else {
380
+ $errors += 'Missing graphify graph output. Run: python -m graphify update scripts --no-cluster'
381
+ }
359
382
  }
360
383
  }
361
384