nexakit 0.0.0-stage → 0.2.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/.claude-plugin/marketplace.json +28 -0
- package/LICENSE +26 -0
- package/README.md +79 -2
- package/agents/claude/docs-researcher.md +9 -0
- package/agents/claude/implementation-tutor.md +9 -0
- package/agents/claude/project-explorer.md +9 -0
- package/agents/claude/quality-reviewer.md +9 -0
- package/agents/claude/requirements-analyst.md +9 -0
- package/agents/claude/solution-architect.md +9 -0
- package/agents/codex/docs-researcher.toml +10 -0
- package/agents/codex/implementation-tutor.toml +10 -0
- package/agents/codex/project-explorer.toml +10 -0
- package/agents/codex/quality-reviewer.toml +10 -0
- package/agents/codex/requirements-analyst.toml +11 -0
- package/agents/codex/solution-architect.toml +10 -0
- package/assets/brand/README.md +38 -0
- package/assets/brand/agent-toolkit-mark.png +0 -0
- package/assets/brand/agent-toolkit-mark.svg +13 -0
- package/assets/brand/agent-toolkit-tui-hero.png +0 -0
- package/assets/brand/nexakit-readme-hero.png +0 -0
- package/assets/brand/nexakit-readme-hero.svg +21 -0
- package/assets/runtime/package-lock.json +1425 -0
- package/bin/agent-task.js +14 -0
- package/bin/agent-toolkit-gemini.js +13 -0
- package/bin/agent-toolkit-inbox.js +14 -0
- package/bin/agent-toolkit-mcp.js +17 -0
- package/bin/agent-toolkit.js +13 -0
- package/bin/nexakit.js +13 -0
- package/bin/project-memory-mcp.js +22 -0
- package/bin/project-memory.js +7 -0
- package/catalogs/skills/api-design-principles/LICENSE.txt +21 -0
- package/catalogs/skills/api-design-principles/SKILL.md +110 -0
- package/catalogs/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/catalogs/skills/api-design-principles/assets/rest-api-template.py +185 -0
- package/catalogs/skills/api-design-principles/references/details.md +413 -0
- package/catalogs/skills/api-design-principles/references/graphql-schema-design.md +589 -0
- package/catalogs/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/catalogs/skills/nodejs-backend-patterns/LICENSE.txt +21 -0
- package/catalogs/skills/nodejs-backend-patterns/SKILL.md +45 -0
- package/catalogs/skills/nodejs-backend-patterns/references/advanced-patterns.md +430 -0
- package/catalogs/skills/nodejs-backend-patterns/references/details.md +599 -0
- package/catalogs/skills/supabase-postgres-best-practices/CHANGELOG.md +73 -0
- package/catalogs/skills/supabase-postgres-best-practices/LICENSE.txt +21 -0
- package/catalogs/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/catalogs/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
- package/catalogs/skills/vercel-composition-patterns/AGENTS.md +946 -0
- package/catalogs/skills/vercel-composition-patterns/LICENSE.txt +27 -0
- package/catalogs/skills/vercel-composition-patterns/README.md +60 -0
- package/catalogs/skills/vercel-composition-patterns/SKILL.md +89 -0
- package/catalogs/skills/vercel-composition-patterns/metadata.json +11 -0
- package/catalogs/skills/vercel-composition-patterns/rules/_sections.md +29 -0
- package/catalogs/skills/vercel-composition-patterns/rules/_template.md +24 -0
- package/catalogs/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/catalogs/skills/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
- package/catalogs/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/catalogs/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/catalogs/skills/vercel-composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/catalogs/skills/vercel-composition-patterns/rules/state-context-interface.md +191 -0
- package/catalogs/skills/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/catalogs/skills/vercel-composition-patterns/rules/state-lift-state.md +125 -0
- package/catalogs/skills/vercel-react-best-practices/AGENTS.md +3810 -0
- package/catalogs/skills/vercel-react-best-practices/LICENSE.txt +27 -0
- package/catalogs/skills/vercel-react-best-practices/README.md +123 -0
- package/catalogs/skills/vercel-react-best-practices/SKILL.md +149 -0
- package/catalogs/skills/vercel-react-best-practices/metadata.json +15 -0
- package/catalogs/skills/vercel-react-best-practices/rules/_sections.md +46 -0
- package/catalogs/skills/vercel-react-best-practices/rules/_template.md +28 -0
- package/catalogs/skills/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/catalogs/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/catalogs/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/catalogs/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-defer-await.md +82 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/catalogs/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/catalogs/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/catalogs/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/catalogs/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/catalogs/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/catalogs/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/catalogs/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/catalogs/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/catalogs/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/catalogs/skills/webapp-testing/LICENSE.txt +202 -0
- package/catalogs/skills/webapp-testing/SKILL.md +96 -0
- package/catalogs/skills/webapp-testing/examples/console_logging.py +35 -0
- package/catalogs/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/catalogs/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/catalogs/skills/webapp-testing/scripts/with_server.py +106 -0
- package/catalogs/skills.json +1115 -0
- package/docs/skills/evidencias/2026-10-28-evaluacion-inicial-mcp-seguridad.md +118 -0
- package/docs/skills/evidencias/2026-10-28-incorporacion-mcp-seguridad.json +152 -0
- package/docs/skills/evidencias/2026-10-28-recomendador-preparacion.md +50 -0
- package/package.json +73 -4
- package/plugins/nexakit-modelo/.claude-plugin/plugin.json +1 -0
- package/plugins/nexakit-modelo/hooks/hooks.json +1 -0
- package/plugins/nexakit-modelo/hooks/register.js +48 -0
- package/plugins/nexakit-modelo/hooks/status.js +8 -0
- package/plugins/nexakit-modelo/tests/register.test.ts +21 -0
- package/plugins/nexakit-panel/.claude-plugin/plugin.json +1 -0
- package/plugins/nexakit-panel/README.md +20 -0
- package/plugins/nexakit-panel/hooks/hooks.json +1 -0
- package/plugins/nexakit-panel/hooks/lienzo.js +382 -0
- package/plugins/nexakit-panel/hooks/panel.js +279 -0
- package/plugins/nexakit-panel/hooks/register.tsx +248 -0
- package/plugins/nexakit-panel/tests/lienzo.test.ts +142 -0
- package/plugins/nexakit-panel/tests/panel.test.ts +240 -0
- package/plugins/nexakit-panel/tests/register.test.ts +167 -0
- package/plugins/nexakit-panel/types/index.d.ts +41 -0
- package/plugins/nexakit-sesion/.claude-plugin/plugin.json +1 -0
- package/plugins/nexakit-sesion/README.md +12 -0
- package/plugins/nexakit-sesion/hooks/aviso.js +38 -0
- package/plugins/nexakit-sesion/hooks/hooks.json +1 -0
- package/plugins/nexakit-sesion/hooks/register.js +28 -0
- package/plugins/nexakit-sesion/tests/register.test.ts +96 -0
- package/plugins/niveles/.claude-plugin/plugin.json +5 -0
- package/plugins/niveles/agents/nivel-alto.md +13 -0
- package/plugins/niveles/agents/nivel-exigente.md +13 -0
- package/plugins/niveles/agents/nivel-ligero.md +13 -0
- package/plugins/niveles/agents/nivel-normal.md +13 -0
- package/schemas/agent-client-adapter.schema.json +786 -0
- package/schemas/agent-client-auth-diagnostic.schema.json +801 -0
- package/schemas/agent-client-isolated-variant.schema.json +105 -0
- package/schemas/agent-client-isolated-verification.schema.json +99 -0
- package/schemas/agent-client-managed-preferences-invocation.schema.json +67 -0
- package/schemas/agent-client-managed-preferences.schema.json +63 -0
- package/schemas/agent-client-native-diagnostics.schema.json +85 -0
- package/schemas/agent-client-native-evaluation.schema.json +171 -0
- package/schemas/agent-client-native-preflight.schema.json +90 -0
- package/schemas/agent-client-output.schema.json +551 -0
- package/schemas/agent-client-runtime-fixture.schema.json +90 -0
- package/schemas/agent-client-runtime-local.schema.json +95 -0
- package/schemas/agent-client-runtime.schema.json +1288 -0
- package/schemas/agent-client-selective-config.schema.json +77 -0
- package/schemas/agent-client-supervised-local.schema.json +135 -0
- package/schemas/agent-client-supervised.schema.json +186 -0
- package/schemas/agent-model-preference.schema.json +573 -0
- package/schemas/agent-model-selection.schema.json +311 -0
- package/schemas/agent-task-approvals.schema.json +362 -0
- package/schemas/agent-task-prepare.schema.json +1324 -0
- package/schemas/agent-task-verify.schema.json +198 -0
- package/schemas/project-memory-update.schema.json +33 -0
- package/schemas/project-memory.schema.json +298 -0
- package/schemas/skill-catalog.schema.json +246 -0
- package/schemas/task-workflow-plan-output.schema.json +35 -0
- package/scripts/prepare-package.js +6 -0
- package/scripts/validate-skill-catalog.js +41 -0
- package/skills/cerrar-avisens/SKILL.md +12 -0
- package/skills/cerrar-memoria/SKILL.md +96 -0
- package/skills/cerrar-memoria/references/cierre.md +76 -0
- package/skills/decision-records/SKILL.md +27 -0
- package/skills/decision-records/agents/openai.yaml +7 -0
- package/skills/decision-records/references/adr-template.md +35 -0
- package/skills/differential-review/LICENSE.txt +427 -0
- package/skills/differential-review/SKILL.md +225 -0
- package/skills/differential-review/adversarial.md +203 -0
- package/skills/differential-review/agents/openai.yaml +6 -0
- package/skills/differential-review/assets/trail-of-bits-mark.svg +1 -0
- package/skills/differential-review/methodology.md +234 -0
- package/skills/differential-review/patterns.md +300 -0
- package/skills/differential-review/reporting.md +369 -0
- package/skills/elegir-modelo/SKILL.md +68 -0
- package/skills/elegir-modelo/modelos.mjs +108 -0
- package/skills/frontend-design/LICENSE.txt +177 -0
- package/skills/frontend-design/SKILL.md +71 -0
- package/skills/gemini/SKILL.md +52 -0
- package/skills/imagen/SKILL.md +12 -0
- package/skills/investigar/SKILL.md +11 -0
- package/skills/mcp-builder/LICENSE.txt +202 -0
- package/skills/mcp-builder/SKILL.md +236 -0
- package/skills/mcp-builder/reference/evaluation.md +602 -0
- package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/skills/mcp-builder/scripts/connections.py +151 -0
- package/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/skills/ordenar-proyecto/SKILL.md +56 -0
- package/skills/project-handoff/SKILL.md +53 -0
- package/skills/project-handoff/agents/openai.yaml +7 -0
- package/skills/project-handoff/references/handoff-template.md +35 -0
- package/skills/quality-gate/LICENSE.txt +26 -0
- package/skills/quality-gate/SKILL.md +44 -0
- package/skills/quality-gate/agents/openai.yaml +7 -0
- package/skills/quality-gate/references/review-checklist.md +42 -0
- package/skills/revisar/SKILL.md +11 -0
- package/skills/revisar-skill/LICENSE-find-skills.txt +26 -0
- package/skills/revisar-skill/SKILL.md +94 -0
- package/skills/revision-cruzada/SKILL.md +59 -0
- package/skills/web-design-guidelines/AGENTS.md +156 -0
- package/skills/web-design-guidelines/LICENSE.txt +21 -0
- package/skills/web-design-guidelines/SKILL.md +29 -0
- package/src/agent-models.js +131 -0
- package/src/brand.js +117 -0
- package/src/claude-code-runner.js +642 -0
- package/src/cli-executable.js +88 -0
- package/src/cli.js +778 -0
- package/src/client-adapter-plan.js +271 -0
- package/src/client-auth-diagnostic-parser.js +211 -0
- package/src/client-auth-diagnostic.js +257 -0
- package/src/client-isolated-variant.js +106 -0
- package/src/client-isolated-verification.js +130 -0
- package/src/client-local-platform.js +14 -0
- package/src/client-managed-preferences-invocation.js +209 -0
- package/src/client-managed-preferences.js +78 -0
- package/src/client-native-access.js +134 -0
- package/src/client-native-diagnostics.js +253 -0
- package/src/client-native-evaluation.js +106 -0
- package/src/client-native-preflight-files.js +68 -0
- package/src/client-native-preflight.js +95 -0
- package/src/client-output-json.js +118 -0
- package/src/client-output-parser.js +278 -0
- package/src/client-runtime-admission.js +80 -0
- package/src/client-runtime-coordinator.js +70 -0
- package/src/client-runtime-core.js +92 -0
- package/src/client-runtime-fixture-permit.js +20 -0
- package/src/client-runtime-fixture-protocol.js +39 -0
- package/src/client-runtime-state.js +67 -0
- package/src/client-runtime-store-files.js +91 -0
- package/src/client-runtime-store.js +239 -0
- package/src/client-runtime-supervisor.js +146 -0
- package/src/client-selective-config.js +195 -0
- package/src/client-selective-files.js +126 -0
- package/src/client-supervised-codes.js +32 -0
- package/src/client-supervised-contract.js +52 -0
- package/src/client-supervised-coordinator.js +36 -0
- package/src/client-supervised-permit.js +20 -0
- package/src/client-supervised-protocol.js +37 -0
- package/src/client-supervised-store.js +167 -0
- package/src/client-supervised-supervisor.js +167 -0
- package/src/client-supervised.js +160 -0
- package/src/codex-cli-runner.js +358 -0
- package/src/codex-delivery.js +101 -0
- package/src/connect.js +703 -0
- package/src/doctor.js +795 -0
- package/src/gemini-cli.js +76 -0
- package/src/gemini-files.js +45 -0
- package/src/gemini-tools.js +249 -0
- package/src/init.js +473 -0
- package/src/install-lock.js +127 -0
- package/src/install-registry.js +61 -0
- package/src/legacy-repair.js +71 -0
- package/src/level-agents.js +111 -0
- package/src/link-states.js +172 -0
- package/src/memory-connection-artifacts.js +192 -0
- package/src/memory-connection-descriptor.js +158 -0
- package/src/memory-connection-diagnostic.js +177 -0
- package/src/memory-connection-files.js +191 -0
- package/src/memory-connection-manifest.js +118 -0
- package/src/memory-connection-package.js +176 -0
- package/src/memory-connection-plan.js +211 -0
- package/src/memory-connection-skill.js +211 -0
- package/src/memory-connection-toml.js +153 -0
- package/src/memory-locator.js +118 -0
- package/src/memory-mcp-policy.js +181 -0
- package/src/memory-mcp-server.js +166 -0
- package/src/memory-mcp-transport.js +59 -0
- package/src/missing-dependencies.js +21 -0
- package/src/model-command.js +147 -0
- package/src/model-preference.js +235 -0
- package/src/model-selection.js +368 -0
- package/src/native/managed-preferences.c +100 -0
- package/src/native/managed-preferences.h +17 -0
- package/src/package-lock-path.js +13 -0
- package/src/panel-cli.js +182 -0
- package/src/peer-handoff.js +27 -0
- package/src/peer-inbox-cli.js +211 -0
- package/src/peer-review-mcp.js +210 -0
- package/src/peer-review-store.js +532 -0
- package/src/platform.js +24 -0
- package/src/project-root.js +41 -0
- package/src/project-signals.js +339 -0
- package/src/recommend-report.js +77 -0
- package/src/review-instructions.js +211 -0
- package/src/review-policy.js +35 -0
- package/src/revision-adapters.js +157 -0
- package/src/revision-context.js +86 -0
- package/src/revision-isolation.js +222 -0
- package/src/revision-process.js +103 -0
- package/src/revision-provenance.js +89 -0
- package/src/revision-snapshot.js +120 -0
- package/src/revision.js +242 -0
- package/src/runtime-fixtures/runtime-supervisor/child.cjs +3 -0
- package/src/runtime-fixtures/runtime-supervisor/fixture.cjs +49 -0
- package/src/runtime-fixtures/supervised/child.cjs +3 -0
- package/src/runtime-fixtures/supervised/fixture.cjs +47 -0
- package/src/sensitive-data.js +21 -0
- package/src/setup-apply.js +231 -0
- package/src/setup-plan.js +231 -0
- package/src/setup-state.js +277 -0
- package/src/setup-tui.js +555 -0
- package/src/skill-catalog-add.js +91 -0
- package/src/skill-catalog-audit.js +68 -0
- package/src/skill-catalog.js +170 -0
- package/src/skill-files.js +39 -0
- package/src/skill-recommendations.js +1673 -0
- package/src/skill-scan-report.js +14 -0
- package/src/skill-scan.js +178 -0
- package/src/stable-command.js +53 -0
- package/src/stable-install.js +222 -0
- package/src/status.js +200 -0
- package/src/superpowers.js +133 -0
- package/src/sync-apply.js +227 -0
- package/src/sync-files.js +109 -0
- package/src/sync-inspect.js +394 -0
- package/src/sync-ledger.js +94 -0
- package/src/sync-markdown.js +151 -0
- package/src/sync-proposal.js +84 -0
- package/src/sync-record.js +459 -0
- package/src/sync.js +360 -0
- package/src/task-approvals.js +367 -0
- package/src/task-cli.js +79 -0
- package/src/task-external-verifier.js +584 -0
- package/src/task-prepare-files.js +115 -0
- package/src/task-prepare.js +180 -0
- package/src/task-verify-cli.js +67 -0
- package/src/task-verify-files.js +188 -0
- package/src/task-verify.js +118 -0
- package/src/task-workflow-mcp.js +544 -0
- package/src/task-workflow-store.js +254 -0
- package/src/terminal-text.js +68 -0
- package/src/toolkit-cli.js +543 -0
- package/src/toolkit-commands-guide.js +107 -0
- package/src/toolkit-setup.js +614 -0
- package/src/usage-metrics.js +43 -0
- package/templates/agent-team/01-encargo.md +158 -0
- package/templates/agent-team/02-propuesta.md +132 -0
- package/templates/agent-team/03-revision.md +150 -0
- package/templates/agent-team/README.md +213 -0
- package/templates/model-inventory/01-inventario.md +154 -0
- package/templates/model-inventory/README.md +115 -0
- package/templates/project-memory/README.md +67 -0
- package/templates/project-memory/project-memory.example.json +53 -0
- package/templates/project-memory/skill/project-id/SKILL.md +37 -0
- package/templates/project-memory/skill/project-id/references/project-profile.md +44 -0
- package/templates/project-memory/vault/00-INICIO/Estado actual.md +44 -0
- package/templates/project-memory/vault/00-INICIO/Fuentes de verdad.md +30 -0
- package/templates/project-memory/vault/00-INICIO/Inicio del proyecto.md +44 -0
- package/templates/project-memory/vault/00-INICIO/Mantenimiento de la memoria.md +26 -0
- package/templates/project-memory/vault/00-INICIO/Mapa de la memoria.md +33 -0
- package/templates/project-memory/vault/00-INICIO/Registro de sincronizaci/303/263n.md" +28 -0
- package/templates/project-memory/vault/01-PRODUCTO/Producto.md +16 -0
- package/templates/project-memory/vault/02-ARQUITECTURA/Arquitectura.md +16 -0
- package/templates/project-memory/vault/03-IMPLEMENTACION/Implementaci/303/263n.md +15 -0
- package/templates/project-memory/vault/04-DECISIONES/Decisiones.md +19 -0
- package/templates/project-memory/vault/05-ENTREGAS/Entregas.md +12 -0
- package/templates/project-memory/vault/06-OPERACION/Operaci/303/263n.md +15 -0
- package/templates/project-memory/vault/07-AGENTES/Protocolo de agentes.md +33 -0
- package/templates/project-memory/vault/08-RECURSOS/Recursos.md +12 -0
- package/templates/project-memory/vault/09-ARCHIVO/README.md +5 -0
package/src/connect.js
ADDED
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
import Ajv2020 from "ajv/dist/2020.js";
|
|
8
|
+
import { IS_WINDOWS } from "./platform.js";
|
|
9
|
+
import { resolveCliInvocation } from "./cli-executable.js";
|
|
10
|
+
|
|
11
|
+
const SOURCE_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const DEFAULT_SCHEMA_PATH = path.resolve(
|
|
13
|
+
SOURCE_DIRECTORY,
|
|
14
|
+
"../schemas/project-memory.schema.json"
|
|
15
|
+
);
|
|
16
|
+
const FILESYSTEM_PACKAGE = "@modelcontextprotocol/server-filesystem";
|
|
17
|
+
const FILESYSTEM_VERSION = "2026.8.31";
|
|
18
|
+
const FILESYSTEM_SPEC = `${FILESYSTEM_PACKAGE}@${FILESYSTEM_VERSION}`;
|
|
19
|
+
|
|
20
|
+
export const READ_TOOLS = Object.freeze([
|
|
21
|
+
"read_text_file",
|
|
22
|
+
"read_media_file",
|
|
23
|
+
"read_multiple_files",
|
|
24
|
+
"list_directory",
|
|
25
|
+
"list_directory_with_sizes",
|
|
26
|
+
"directory_tree",
|
|
27
|
+
"search_files",
|
|
28
|
+
"get_file_info",
|
|
29
|
+
"list_allowed_directories"
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export const WRITE_TOOLS = Object.freeze([
|
|
33
|
+
"create_directory",
|
|
34
|
+
"write_file",
|
|
35
|
+
"edit_file",
|
|
36
|
+
"move_file"
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const ADAPTERS = Object.freeze({
|
|
40
|
+
codex: {
|
|
41
|
+
skillDirectory: ".agents/skills"
|
|
42
|
+
},
|
|
43
|
+
claude: {
|
|
44
|
+
skillDirectory: ".claude/skills"
|
|
45
|
+
},
|
|
46
|
+
antigravity: {
|
|
47
|
+
skillDirectory: ".gemini/antigravity-cli/skills"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// The command each agent is driven with.
|
|
51
|
+
const AGENT_COMMANDS = Object.freeze({ codex: "codex", claude: "claude", antigravity: "agy" });
|
|
52
|
+
const MEMORY_SCRIPT = path.join("bin", "project-memory-mcp.js");
|
|
53
|
+
|
|
54
|
+
export async function connectMemory(options, context = {}) {
|
|
55
|
+
const config = loadConfig(options, context);
|
|
56
|
+
const runner = context.runCommand ?? (IS_WINDOWS ? await windowsCommandRunner(AGENT_COMMANDS[config.agentId]) : runCommand);
|
|
57
|
+
const skill = inspectSkill(config);
|
|
58
|
+
const connection = inspectConnection(config, runner, context);
|
|
59
|
+
const components = [skill, ...connection.components];
|
|
60
|
+
const report = createReport(config, components, options.apply === true);
|
|
61
|
+
|
|
62
|
+
if (components.some((component) => component.action === "conflict")) {
|
|
63
|
+
report.status = "conflict";
|
|
64
|
+
return report;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!options.apply) {
|
|
68
|
+
report.status = "preview";
|
|
69
|
+
return report;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let skillCreated = false;
|
|
73
|
+
try {
|
|
74
|
+
skillCreated = applySkill(skill);
|
|
75
|
+
connection.apply();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (skillCreated && isSymbolicLinkTo(skill.path, skill.source)) {
|
|
78
|
+
fs.unlinkSync(skill.path);
|
|
79
|
+
}
|
|
80
|
+
throw new ConnectionError([
|
|
81
|
+
error instanceof Error ? error.message : String(error)
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
report.status = components.every(
|
|
86
|
+
(component) => component.action === "unchanged"
|
|
87
|
+
)
|
|
88
|
+
? "unchanged"
|
|
89
|
+
: "connected";
|
|
90
|
+
return report;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function loadConfig(options, context) {
|
|
94
|
+
const errors = [];
|
|
95
|
+
const target = path.resolve(options.targetPath ?? process.cwd());
|
|
96
|
+
const manifestPath = resolveManifestPath(target, options.manifestPath);
|
|
97
|
+
const agentId = options.agentId?.trim();
|
|
98
|
+
|
|
99
|
+
if (!manifestPath) {
|
|
100
|
+
errors.push("No se encontró project-memory.json.");
|
|
101
|
+
}
|
|
102
|
+
if (!ADAPTERS[agentId]) {
|
|
103
|
+
errors.push("--agent debe ser codex, claude o antigravity.");
|
|
104
|
+
}
|
|
105
|
+
if (errors.length > 0) {
|
|
106
|
+
throw new ConnectionError(errors);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const manifest = readJson(manifestPath, "manifiesto");
|
|
110
|
+
const schemaPath = path.resolve(context.schemaPath ?? DEFAULT_SCHEMA_PATH);
|
|
111
|
+
const schema = readJson(schemaPath, "esquema");
|
|
112
|
+
const ajv = new Ajv2020({ allErrors: true, strict: true });
|
|
113
|
+
const validate = ajv.compile(schema);
|
|
114
|
+
|
|
115
|
+
if (!validate(manifest)) {
|
|
116
|
+
throw new ConnectionError(
|
|
117
|
+
(validate.errors ?? []).map((error) => {
|
|
118
|
+
const location = error.instancePath || "/";
|
|
119
|
+
return `${location}: ${error.message}`;
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const agent = manifest.agents.find((candidate) => candidate.id === agentId);
|
|
125
|
+
if (!agent) {
|
|
126
|
+
errors.push(`El manifiesto no declara el agente ${agentId}.`);
|
|
127
|
+
} else if (!agent.enabled) {
|
|
128
|
+
errors.push(`El agente ${agentId} está deshabilitado en el manifiesto.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const manifestDirectory = path.dirname(manifestPath);
|
|
132
|
+
const vaultPath = resolveConfiguredPath(
|
|
133
|
+
manifestDirectory,
|
|
134
|
+
manifest.memory.vaultPath
|
|
135
|
+
);
|
|
136
|
+
const skillName = agent?.skillName ?? manifest.project.id;
|
|
137
|
+
const skillSource = path.join(
|
|
138
|
+
vaultPath,
|
|
139
|
+
"07-AGENTES",
|
|
140
|
+
"skills",
|
|
141
|
+
skillName
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
if (!isDirectory(vaultPath)) {
|
|
145
|
+
errors.push(`La bóveda no existe: ${vaultPath}`);
|
|
146
|
+
}
|
|
147
|
+
if (!isDirectory(skillSource) || !isFile(path.join(skillSource, "SKILL.md"))) {
|
|
148
|
+
errors.push(`No se encontró una Skill válida: ${skillSource}`);
|
|
149
|
+
}
|
|
150
|
+
if (manifest.security.mcpAccess !== "read-only") {
|
|
151
|
+
errors.push("La conexión exige security.mcpAccess = read-only.");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (errors.length > 0) {
|
|
155
|
+
throw new ConnectionError(errors);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const homeDirectory = path.resolve(context.homeDirectory ?? os.homedir());
|
|
159
|
+
const adapter = ADAPTERS[agentId];
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
agentId,
|
|
163
|
+
adapter,
|
|
164
|
+
manifest,
|
|
165
|
+
manifestPath,
|
|
166
|
+
vaultPath: fs.realpathSync(vaultPath),
|
|
167
|
+
skillName,
|
|
168
|
+
skillSource: fs.realpathSync(skillSource),
|
|
169
|
+
skillTarget: path.join(homeDirectory, adapter.skillDirectory, skillName),
|
|
170
|
+
homeDirectory,
|
|
171
|
+
mcpName: manifest.memory.mcpServerName
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function inspectSkill(config) {
|
|
176
|
+
const target = config.skillTarget;
|
|
177
|
+
|
|
178
|
+
if (!pathEntryExists(target)) {
|
|
179
|
+
return {
|
|
180
|
+
id: "skill",
|
|
181
|
+
action: "create",
|
|
182
|
+
path: target,
|
|
183
|
+
source: config.skillSource,
|
|
184
|
+
message: "Crear enlace simbólico hacia la Skill canónica."
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const stats = fs.lstatSync(target);
|
|
189
|
+
if (!stats.isSymbolicLink()) {
|
|
190
|
+
return {
|
|
191
|
+
id: "skill",
|
|
192
|
+
action: "conflict",
|
|
193
|
+
path: target,
|
|
194
|
+
source: config.skillSource,
|
|
195
|
+
message: "El destino existe y no es un enlace simbólico."
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let currentSource;
|
|
200
|
+
try {
|
|
201
|
+
currentSource = fs.realpathSync(target);
|
|
202
|
+
} catch {
|
|
203
|
+
return {
|
|
204
|
+
id: "skill",
|
|
205
|
+
action: "conflict",
|
|
206
|
+
path: target,
|
|
207
|
+
source: config.skillSource,
|
|
208
|
+
message: "El destino es un enlace simbólico roto."
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (!samePath(currentSource, config.skillSource)) {
|
|
212
|
+
return {
|
|
213
|
+
id: "skill",
|
|
214
|
+
action: "conflict",
|
|
215
|
+
path: target,
|
|
216
|
+
source: config.skillSource,
|
|
217
|
+
message: `El enlace apunta a otra ubicación: ${currentSource}`
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
id: "skill",
|
|
223
|
+
action: "unchanged",
|
|
224
|
+
path: target,
|
|
225
|
+
source: config.skillSource,
|
|
226
|
+
message: "La Skill ya apunta a la fuente canónica."
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function inspectConnection(config, runner, context) {
|
|
231
|
+
if (config.agentId === "codex") {
|
|
232
|
+
return inspectCodex(config, runner);
|
|
233
|
+
}
|
|
234
|
+
if (config.agentId === "antigravity") {
|
|
235
|
+
return inspectAntigravity(config, runner, context);
|
|
236
|
+
}
|
|
237
|
+
return inspectClaude(config, runner);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function inspectCodex(config, runner) {
|
|
241
|
+
const result = runner("codex", ["mcp", "get", config.mcpName]);
|
|
242
|
+
if (result.errorCode === "ENOENT") {
|
|
243
|
+
return unavailableCommand("codex");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const exists = result.status === 0;
|
|
247
|
+
const matches = exists && outputMatchesFilesystemServer(result.stdout, config);
|
|
248
|
+
const mcp = exists
|
|
249
|
+
? matches
|
|
250
|
+
? component("mcp", "unchanged", "Codex ya usa esta bóveda.")
|
|
251
|
+
: component("mcp", "conflict", "Codex tiene un MCP homónimo diferente.")
|
|
252
|
+
: component("mcp", "create", "Registrar el MCP personal en Codex.");
|
|
253
|
+
|
|
254
|
+
const currentTools = parseCodexEnabledTools(result.stdout);
|
|
255
|
+
const policy = !exists
|
|
256
|
+
? component("policy", "create", "Crear la lista blanca de lectura de Codex.")
|
|
257
|
+
: hasEvery(currentTools, READ_TOOLS) && !hasAny(currentTools, WRITE_TOOLS)
|
|
258
|
+
? component("policy", "unchanged", "Codex ya limita el MCP a lectura.")
|
|
259
|
+
: component("policy", "update", "Limitar el MCP de Codex a herramientas de lectura.");
|
|
260
|
+
|
|
261
|
+
const configPath = path.join(config.homeDirectory, ".codex/config.toml");
|
|
262
|
+
if (
|
|
263
|
+
policy.action !== "unchanged" &&
|
|
264
|
+
pathEntryExists(configPath) &&
|
|
265
|
+
fs.lstatSync(configPath).isSymbolicLink()
|
|
266
|
+
) {
|
|
267
|
+
policy.action = "conflict";
|
|
268
|
+
policy.message = "La configuración de Codex es un enlace simbólico y no se reemplazará.";
|
|
269
|
+
}
|
|
270
|
+
mcp.path = configPath;
|
|
271
|
+
policy.path = configPath;
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
components: [mcp, policy],
|
|
275
|
+
apply() {
|
|
276
|
+
let serverCreated = false;
|
|
277
|
+
try {
|
|
278
|
+
if (mcp.action === "create") {
|
|
279
|
+
requireSuccess(
|
|
280
|
+
runner("codex", [
|
|
281
|
+
"mcp",
|
|
282
|
+
"add",
|
|
283
|
+
config.mcpName,
|
|
284
|
+
"--",
|
|
285
|
+
"npx",
|
|
286
|
+
"-y",
|
|
287
|
+
FILESYSTEM_SPEC,
|
|
288
|
+
config.vaultPath
|
|
289
|
+
]),
|
|
290
|
+
"No se pudo registrar el MCP en Codex."
|
|
291
|
+
);
|
|
292
|
+
serverCreated = true;
|
|
293
|
+
}
|
|
294
|
+
if (policy.action !== "unchanged") {
|
|
295
|
+
updateCodexPolicy(configPath, config.mcpName);
|
|
296
|
+
}
|
|
297
|
+
} catch (error) {
|
|
298
|
+
if (serverCreated) {
|
|
299
|
+
runner("codex", ["mcp", "remove", config.mcpName]);
|
|
300
|
+
}
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function inspectClaude(config, runner) {
|
|
308
|
+
const result = runner("claude", ["mcp", "get", config.mcpName]);
|
|
309
|
+
if (result.errorCode === "ENOENT") {
|
|
310
|
+
return unavailableCommand("claude");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const exists = result.status === 0;
|
|
314
|
+
const matches = exists && outputMatchesFilesystemServer(result.stdout, config);
|
|
315
|
+
const mcp = exists
|
|
316
|
+
? matches
|
|
317
|
+
? component("mcp", "unchanged", "Claude ya usa esta bóveda.")
|
|
318
|
+
: component("mcp", "conflict", "Claude tiene un MCP homónimo diferente.")
|
|
319
|
+
: component("mcp", "create", "Registrar el MCP personal en Claude Code.");
|
|
320
|
+
const settingsPath = path.join(config.homeDirectory, ".claude/settings.json");
|
|
321
|
+
const policyState = inspectClaudePolicy(settingsPath, config.mcpName);
|
|
322
|
+
const policy = component(
|
|
323
|
+
"policy",
|
|
324
|
+
policyState ? "unchanged" : fs.existsSync(settingsPath) ? "update" : "create",
|
|
325
|
+
policyState
|
|
326
|
+
? "Claude ya permite lectura y deniega escritura para este MCP."
|
|
327
|
+
: "Configurar permisos de lectura y bloqueos de escritura en Claude."
|
|
328
|
+
);
|
|
329
|
+
mcp.path = "Claude user MCP configuration";
|
|
330
|
+
policy.path = settingsPath;
|
|
331
|
+
if (
|
|
332
|
+
policy.action !== "unchanged" &&
|
|
333
|
+
pathEntryExists(settingsPath) &&
|
|
334
|
+
fs.lstatSync(settingsPath).isSymbolicLink()
|
|
335
|
+
) {
|
|
336
|
+
policy.action = "conflict";
|
|
337
|
+
policy.message = "La configuración de Claude es un enlace simbólico y no se reemplazará.";
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
components: [mcp, policy],
|
|
342
|
+
apply() {
|
|
343
|
+
let serverCreated = false;
|
|
344
|
+
try {
|
|
345
|
+
if (mcp.action === "create") {
|
|
346
|
+
requireSuccess(
|
|
347
|
+
runner("claude", [
|
|
348
|
+
"mcp",
|
|
349
|
+
"add",
|
|
350
|
+
"--scope",
|
|
351
|
+
"user",
|
|
352
|
+
config.mcpName,
|
|
353
|
+
"--",
|
|
354
|
+
"npx",
|
|
355
|
+
"-y",
|
|
356
|
+
FILESYSTEM_SPEC,
|
|
357
|
+
config.vaultPath
|
|
358
|
+
]),
|
|
359
|
+
"No se pudo registrar el MCP en Claude Code."
|
|
360
|
+
);
|
|
361
|
+
serverCreated = true;
|
|
362
|
+
}
|
|
363
|
+
if (policy.action !== "unchanged") {
|
|
364
|
+
updateClaudePolicy(settingsPath, config.mcpName);
|
|
365
|
+
}
|
|
366
|
+
} catch (error) {
|
|
367
|
+
if (serverCreated) {
|
|
368
|
+
runner("claude", ["mcp", "remove", config.mcpName, "--scope", "user"]);
|
|
369
|
+
}
|
|
370
|
+
throw error;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Antigravity cannot restrict the tools of an MCP server, so it gets nexakit's own memory server, which only has
|
|
377
|
+
// read tools, run from the active nexakit root. Its configuration is read from mcp_config.json, which keeps the
|
|
378
|
+
// exact arguments (the text of `agy mcp list` does not separate paths with spaces).
|
|
379
|
+
function inspectAntigravity(config, runner, context) {
|
|
380
|
+
const probe = runner("agy", ["mcp", "list"]);
|
|
381
|
+
if (probe.errorCode === "ENOENT") {
|
|
382
|
+
const unavailable = unavailableCommand("agy");
|
|
383
|
+
unavailable.components = unavailable.components.filter((item) => item.id === "mcp");
|
|
384
|
+
return unavailable;
|
|
385
|
+
}
|
|
386
|
+
const nodePath = context.nodePath ?? process.execPath;
|
|
387
|
+
const script = path.join(path.resolve(context.toolkitRoot ?? path.resolve(SOURCE_DIRECTORY, "..")), MEMORY_SCRIPT);
|
|
388
|
+
const manifestPath = fs.realpathSync(config.manifestPath);
|
|
389
|
+
const configPath = path.join(config.homeDirectory, ".gemini", "config", "mcp_config.json");
|
|
390
|
+
let current;
|
|
391
|
+
if (pathEntryExists(configPath)) {
|
|
392
|
+
if (fs.lstatSync(configPath).isSymbolicLink()) {
|
|
393
|
+
return { components: [component("mcp", "conflict", "La configuración de Antigravity es un enlace simbólico y no se reemplazará.")], apply() {} };
|
|
394
|
+
}
|
|
395
|
+
current = readJson(configPath, "configuración de Antigravity").mcpServers?.[config.mcpName];
|
|
396
|
+
}
|
|
397
|
+
const same = current && Array.isArray(current.args) && current.args.length === 3 &&
|
|
398
|
+
samePath(current.args[0], script) && current.args[1] === "--manifest" && samePath(current.args[2], manifestPath) &&
|
|
399
|
+
typeof current.command === "string" && /^node(\.exe)?$/iu.test(path.basename(current.command));
|
|
400
|
+
const mcp = !current
|
|
401
|
+
? component("mcp", "create", "Registrar la memoria de solo lectura en Antigravity.")
|
|
402
|
+
: same
|
|
403
|
+
? component("mcp", "unchanged", "Antigravity ya usa esta memoria.")
|
|
404
|
+
: component("mcp", "conflict", "Antigravity tiene un MCP homónimo diferente.");
|
|
405
|
+
mcp.path = configPath;
|
|
406
|
+
return {
|
|
407
|
+
components: [mcp],
|
|
408
|
+
apply() {
|
|
409
|
+
if (mcp.action === "create") {
|
|
410
|
+
requireSuccess(
|
|
411
|
+
runner("agy", ["mcp", "add", config.mcpName, "--", nodePath, script, "--manifest", manifestPath]),
|
|
412
|
+
"No se pudo registrar el MCP en Antigravity."
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function unavailableCommand(command) {
|
|
420
|
+
return {
|
|
421
|
+
components: [
|
|
422
|
+
component("mcp", "conflict", `No se encontró el comando ${command}.`),
|
|
423
|
+
component("policy", "conflict", "No se puede validar la política de acceso.")
|
|
424
|
+
],
|
|
425
|
+
apply() {}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function applySkill(skill) {
|
|
430
|
+
if (skill.action !== "create") {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
fs.mkdirSync(path.dirname(skill.path), { recursive: true });
|
|
434
|
+
fs.symlinkSync(path.resolve(skill.source), skill.path, IS_WINDOWS ? "junction" : "dir");
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function inspectClaudePolicy(settingsPath, mcpName) {
|
|
439
|
+
if (!fs.existsSync(settingsPath)) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
const settings = readJson(settingsPath, "configuración de Claude");
|
|
443
|
+
const allow = settings.permissions?.allow;
|
|
444
|
+
const deny = settings.permissions?.deny;
|
|
445
|
+
return (
|
|
446
|
+
hasEvery(
|
|
447
|
+
allow,
|
|
448
|
+
READ_TOOLS.map((tool) => claudeToolName(mcpName, tool))
|
|
449
|
+
) &&
|
|
450
|
+
hasEvery(
|
|
451
|
+
deny,
|
|
452
|
+
WRITE_TOOLS.map((tool) => claudeToolName(mcpName, tool))
|
|
453
|
+
)
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function updateClaudePolicy(settingsPath, mcpName) {
|
|
458
|
+
const settings = fs.existsSync(settingsPath)
|
|
459
|
+
? readJson(settingsPath, "configuración de Claude")
|
|
460
|
+
: {};
|
|
461
|
+
settings.permissions ??= {};
|
|
462
|
+
settings.permissions.allow = mergeUnique(
|
|
463
|
+
settings.permissions.allow,
|
|
464
|
+
READ_TOOLS.map((tool) => claudeToolName(mcpName, tool))
|
|
465
|
+
);
|
|
466
|
+
settings.permissions.deny = mergeUnique(
|
|
467
|
+
settings.permissions.deny,
|
|
468
|
+
WRITE_TOOLS.map((tool) => claudeToolName(mcpName, tool))
|
|
469
|
+
);
|
|
470
|
+
writeJsonAtomic(settingsPath, settings);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function updateCodexPolicy(configPath, mcpName) {
|
|
474
|
+
if (!isFile(configPath)) {
|
|
475
|
+
throw new Error(`Codex no creó su configuración: ${configPath}`);
|
|
476
|
+
}
|
|
477
|
+
const content = fs.readFileSync(configPath, "utf8");
|
|
478
|
+
const escapedName = escapeRegExp(mcpName);
|
|
479
|
+
const headerPattern = new RegExp(`^\\[mcp_servers\\.${escapedName}\\]\\s*$`, "m");
|
|
480
|
+
const match = headerPattern.exec(content);
|
|
481
|
+
if (!match) {
|
|
482
|
+
throw new Error(`No se encontró el bloque MCP de Codex para ${mcpName}.`);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const blockStart = match.index;
|
|
486
|
+
const contentAfterHeader = match.index + match[0].length;
|
|
487
|
+
const nextHeaderOffset = content.slice(contentAfterHeader).search(/^\[/m);
|
|
488
|
+
const blockEnd =
|
|
489
|
+
nextHeaderOffset === -1 ? content.length : contentAfterHeader + nextHeaderOffset;
|
|
490
|
+
const block = content.slice(blockStart, blockEnd);
|
|
491
|
+
const arrayValue = `[${READ_TOOLS.map((tool) => JSON.stringify(tool)).join(", ")}]`;
|
|
492
|
+
const policyPattern = /^enabled_tools\s*=.*$/m;
|
|
493
|
+
const nextBlock = policyPattern.test(block)
|
|
494
|
+
? block.replace(policyPattern, `enabled_tools = ${arrayValue}`)
|
|
495
|
+
: block.replace(match[0], `${match[0]}\nenabled_tools = ${arrayValue}`);
|
|
496
|
+
const nextContent = `${content.slice(0, blockStart)}${nextBlock}${content.slice(blockEnd)}`;
|
|
497
|
+
writeTextAtomic(configPath, nextContent);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function outputMatchesFilesystemServer(output, config) {
|
|
501
|
+
const commandMatch = output.match(/^\s*Command:\s*(.+)$/im) ??
|
|
502
|
+
output.match(/^\s*command:\s*(.+)$/im);
|
|
503
|
+
const argsMatch = output.match(/^\s*Args:\s*(.+)$/im) ??
|
|
504
|
+
output.match(/^\s*args:\s*(.+)$/im);
|
|
505
|
+
if (!commandMatch || !argsMatch || commandMatch[1].trim() !== "npx") {
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
return argsMatchFilesystem(argsMatch[1].trim(), config.vaultPath);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
function argsMatchFilesystem(args, vaultPath) {
|
|
512
|
+
const values = Array.isArray(args) ? args : splitCommandArguments(args);
|
|
513
|
+
if (values.length !== 3 || values[0] !== "-y" || !samePath(values[2], vaultPath)) {
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
return (
|
|
517
|
+
values[1] === FILESYSTEM_PACKAGE ||
|
|
518
|
+
values[1].startsWith(`${FILESYSTEM_PACKAGE}@`)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function isSymbolicLinkTo(candidate, expectedSource) {
|
|
523
|
+
try {
|
|
524
|
+
return (
|
|
525
|
+
fs.lstatSync(candidate).isSymbolicLink() &&
|
|
526
|
+
samePath(fs.realpathSync(candidate), fs.realpathSync(expectedSource))
|
|
527
|
+
);
|
|
528
|
+
} catch {
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function samePath(left, right) {
|
|
534
|
+
return IS_WINDOWS ? path.resolve(left).toLowerCase() === path.resolve(right).toLowerCase() : left === right;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function splitCommandArguments(value) {
|
|
538
|
+
const marker = value.indexOf(FILESYSTEM_PACKAGE);
|
|
539
|
+
if (marker === -1) {
|
|
540
|
+
return value.trim().split(/\s+/);
|
|
541
|
+
}
|
|
542
|
+
const packageEnd = value.indexOf(" ", marker);
|
|
543
|
+
if (packageEnd === -1) {
|
|
544
|
+
return value.trim().split(/\s+/);
|
|
545
|
+
}
|
|
546
|
+
const before = value.slice(0, packageEnd).trim().split(/\s+/);
|
|
547
|
+
const vault = value.slice(packageEnd + 1).trim();
|
|
548
|
+
return [...before, vault];
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function parseCodexEnabledTools(output) {
|
|
552
|
+
const match = output.match(/^\s*enabled_tools:\s*(.*)$/im);
|
|
553
|
+
return match
|
|
554
|
+
? match[1]
|
|
555
|
+
.split(",")
|
|
556
|
+
.map((value) => value.trim())
|
|
557
|
+
.filter(Boolean)
|
|
558
|
+
: [];
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function createReport(config, components, apply) {
|
|
562
|
+
return {
|
|
563
|
+
command: "connect",
|
|
564
|
+
status: "preview",
|
|
565
|
+
mode: apply ? "apply" : "preview",
|
|
566
|
+
agent: config.agentId,
|
|
567
|
+
manifestPath: config.manifestPath,
|
|
568
|
+
vaultPath: config.vaultPath,
|
|
569
|
+
mcpName: config.mcpName,
|
|
570
|
+
skillName: config.skillName,
|
|
571
|
+
summary: {
|
|
572
|
+
create: components.filter((item) => item.action === "create").length,
|
|
573
|
+
update: components.filter((item) => item.action === "update").length,
|
|
574
|
+
unchanged: components.filter((item) => item.action === "unchanged").length,
|
|
575
|
+
conflicts: components.filter((item) => item.action === "conflict").length
|
|
576
|
+
},
|
|
577
|
+
components
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function component(id, action, message) {
|
|
582
|
+
return { id, action, message };
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function claudeToolName(mcpName, tool) {
|
|
586
|
+
return `mcp__${mcpName}__${tool}`;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function hasEvery(values, expected) {
|
|
590
|
+
return Array.isArray(values) && expected.every((value) => values.includes(value));
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function hasAny(values, expected) {
|
|
594
|
+
return Array.isArray(values) && expected.some((value) => values.includes(value));
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function mergeUnique(current, additions) {
|
|
598
|
+
return [...new Set([...(Array.isArray(current) ? current : []), ...additions])];
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function runCommand(command, args) {
|
|
602
|
+
const result = spawnSync(command, args, { encoding: "utf8", shell: false });
|
|
603
|
+
return {
|
|
604
|
+
status: result.status,
|
|
605
|
+
stdout: result.stdout ?? "",
|
|
606
|
+
stderr: result.stderr ?? "",
|
|
607
|
+
errorCode: result.error?.code
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
async function windowsCommandRunner(name) {
|
|
612
|
+
let invocation;
|
|
613
|
+
try { invocation = await resolveCliInvocation({ name }); }
|
|
614
|
+
catch (error) {
|
|
615
|
+
if (error.code === "ENOENT") return () => ({ status: null, stdout: "", stderr: "", errorCode: "ENOENT" });
|
|
616
|
+
throw new ConnectionError([error instanceof Error ? error.message : String(error)]);
|
|
617
|
+
}
|
|
618
|
+
return (_command, args) => runCommand(invocation.executable, [...invocation.argsPrefix, ...args]);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function requireSuccess(result, message) {
|
|
622
|
+
if (result.status !== 0) {
|
|
623
|
+
const detail = (result.stderr || result.stdout || "").trim();
|
|
624
|
+
throw new Error(detail ? `${message} ${detail}` : message);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function resolveManifestPath(target, explicitManifestPath) {
|
|
629
|
+
if (explicitManifestPath) {
|
|
630
|
+
const explicit = path.resolve(explicitManifestPath);
|
|
631
|
+
return isFile(explicit) ? explicit : null;
|
|
632
|
+
}
|
|
633
|
+
if (isFile(target)) {
|
|
634
|
+
return target;
|
|
635
|
+
}
|
|
636
|
+
const candidate = path.join(target, "project-memory.json");
|
|
637
|
+
return isFile(candidate) ? candidate : null;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function resolveConfiguredPath(baseDirectory, configuredPath) {
|
|
641
|
+
return path.isAbsolute(configuredPath)
|
|
642
|
+
? path.normalize(configuredPath)
|
|
643
|
+
: path.resolve(baseDirectory, configuredPath);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function readJson(filePath, label) {
|
|
647
|
+
try {
|
|
648
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
649
|
+
} catch (error) {
|
|
650
|
+
throw new ConnectionError([
|
|
651
|
+
`No se pudo leer ${label} como JSON válido: ${filePath}`,
|
|
652
|
+
error instanceof Error ? error.message : String(error)
|
|
653
|
+
]);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function writeJsonAtomic(filePath, value) {
|
|
658
|
+
writeTextAtomic(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function writeTextAtomic(filePath, content) {
|
|
662
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
663
|
+
const temporaryPath = `${filePath}.project-memory-${process.pid}.tmp`;
|
|
664
|
+
fs.writeFileSync(temporaryPath, content, { encoding: "utf8", mode: 0o600 });
|
|
665
|
+
fs.renameSync(temporaryPath, filePath);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function escapeRegExp(value) {
|
|
669
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function isDirectory(candidate) {
|
|
673
|
+
try {
|
|
674
|
+
return fs.statSync(candidate).isDirectory();
|
|
675
|
+
} catch {
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
function isFile(candidate) {
|
|
681
|
+
try {
|
|
682
|
+
return fs.statSync(candidate).isFile();
|
|
683
|
+
} catch {
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function pathEntryExists(candidate) {
|
|
689
|
+
try {
|
|
690
|
+
fs.lstatSync(candidate);
|
|
691
|
+
return true;
|
|
692
|
+
} catch {
|
|
693
|
+
return false;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export class ConnectionError extends Error {
|
|
698
|
+
constructor(details) {
|
|
699
|
+
super(details.join("\n"));
|
|
700
|
+
this.name = "ConnectionError";
|
|
701
|
+
this.details = details;
|
|
702
|
+
}
|
|
703
|
+
}
|