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/cli.js
ADDED
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
import { connectMemory, ConnectionError } from "./connect.js";
|
|
4
|
+
import { diagnoseMemory } from "./doctor.js";
|
|
5
|
+
import { initializeMemory, InitializationError } from "./init.js";
|
|
6
|
+
import { inspectMemoryStatus } from "./status.js";
|
|
7
|
+
import { planMemorySync, SyncPlanningError } from "./sync.js";
|
|
8
|
+
import { inspectMemorySync, inspectionErrorReport, formatSyncInspectionReport } from "./sync-inspect.js";
|
|
9
|
+
import { recordMemorySync, recordErrorReport, formatSyncRecordReport } from "./sync-record.js";
|
|
10
|
+
import { applyMemorySync, applyErrorReport, formatSyncApplyReport } from "./sync-apply.js";
|
|
11
|
+
|
|
12
|
+
const HELP = `project-memory
|
|
13
|
+
|
|
14
|
+
Uso:
|
|
15
|
+
project-memory init <destino> [opciones]
|
|
16
|
+
project-memory connect [ruta] --agent <agente> [opciones]
|
|
17
|
+
project-memory doctor [ruta] [opciones]
|
|
18
|
+
project-memory status [ruta] [opciones]
|
|
19
|
+
project-memory sync plan [ruta] [opciones]
|
|
20
|
+
project-memory sync inspect [ruta] --pr <número> [opciones]
|
|
21
|
+
project-memory sync record [ruta] --pr <número> --outcome <valor> --reviewed [opciones]
|
|
22
|
+
project-memory sync apply [ruta] --proposal <archivo> [opciones]
|
|
23
|
+
|
|
24
|
+
Opciones de init:
|
|
25
|
+
--project-id <id> Identificador del proyecto.
|
|
26
|
+
--project-name <nombre> Nombre visible del proyecto.
|
|
27
|
+
--description <texto> Descripción breve de la memoria.
|
|
28
|
+
--source <ruta> Repositorio fuente existente.
|
|
29
|
+
--default-branch <rama> Rama principal; por defecto main.
|
|
30
|
+
--integration-branch <rama> Rama de integración.
|
|
31
|
+
--source-remote <url> Remoto del repositorio fuente.
|
|
32
|
+
--memory-remote <url> Remoto previsto para la memoria.
|
|
33
|
+
--sync-mode <modo> none, git-manual o git-automated.
|
|
34
|
+
--mcp-name <nombre> Nombre del servidor MCP.
|
|
35
|
+
--apply Aplica el plan; sin esta opción solo previsualiza.
|
|
36
|
+
|
|
37
|
+
Opciones de doctor:
|
|
38
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
39
|
+
--strict Devuelve error cuando existan advertencias.
|
|
40
|
+
|
|
41
|
+
Opciones de connect:
|
|
42
|
+
--agent <agente> Agente a conectar: codex, claude o antigravity.
|
|
43
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
44
|
+
--apply Aplica el plan; sin esta opción solo previsualiza.
|
|
45
|
+
|
|
46
|
+
Opciones de status:
|
|
47
|
+
--agent <agente> Limita la inspección a un agente declarado.
|
|
48
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
49
|
+
--strict Devuelve error cuando existan advertencias.
|
|
50
|
+
|
|
51
|
+
Opciones de sync plan:
|
|
52
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
53
|
+
--limit <número> Máximo de PR fusionados; por defecto 100.
|
|
54
|
+
--strict Devuelve error cuando existan PR pendientes.
|
|
55
|
+
|
|
56
|
+
Opciones de sync inspect:
|
|
57
|
+
--pr <número> PR fusionado explícito del repositorio configurado.
|
|
58
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
59
|
+
--max-files <n> Máximo de archivos visibles; 200 por defecto, rango 1–1000.
|
|
60
|
+
--strict Devuelve error si la evidencia es partial o blocked.
|
|
61
|
+
|
|
62
|
+
Opciones comunes:
|
|
63
|
+
--json Imprime la salida como JSON.
|
|
64
|
+
-h, --help Muestra esta ayuda.
|
|
65
|
+
|
|
66
|
+
Opciones de sync record:
|
|
67
|
+
--pr <número> PR fusionado explícito del repositorio configurado.
|
|
68
|
+
--outcome <valor> no-documentation-change o documentation-updated.
|
|
69
|
+
--reviewed Declara que la revisión semántica está terminada.
|
|
70
|
+
--summary <texto> Resumen seguro; obligatorio cuando cambian notas.
|
|
71
|
+
--note <ruta> Nota ya actualizada, relativa y exacta; repetible.
|
|
72
|
+
--ack-warning <código> text-limit o unsafe-reference revisada; repetible.
|
|
73
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
74
|
+
--apply Añade únicamente la fila validada del registro.
|
|
75
|
+
|
|
76
|
+
Opciones de sync apply:
|
|
77
|
+
--proposal <archivo> Propuesta JSON revisada, externa a la bóveda.
|
|
78
|
+
--manifest <ruta> Selecciona un manifiesto concreto.
|
|
79
|
+
--ack-warning <código> text-limit o unsafe-reference observada; repetible.
|
|
80
|
+
--apply Reemplaza solo las notas pendientes enumeradas.
|
|
81
|
+
--reviewed Declara revisión semántica; obligatorio al aplicar.
|
|
82
|
+
--expect <sha256> Huella de la vista previa aprobada; exige --apply.
|
|
83
|
+
|
|
84
|
+
init y connect no sobrescriben configuraciones diferentes. doctor, status,
|
|
85
|
+
sync plan e inspect son de solo lectura. sync record y apply escriben con --apply.
|
|
86
|
+
Evita editar o sincronizar la memoria durante --apply: su bloqueo no controla
|
|
87
|
+
editores externos. Ni record ni apply crean commits o hacen push. apply puede
|
|
88
|
+
quedar parcial entre notas: no revierte ni registra automáticamente el PR.`;
|
|
89
|
+
|
|
90
|
+
// Invoked as `npx nexakit memoria`, the help names that command and keeps project-memory as the compatible executable.
|
|
91
|
+
const DEFAULT_COMMAND = "project-memory";
|
|
92
|
+
function helpFor(commandName = DEFAULT_COMMAND) {
|
|
93
|
+
if (commandName === DEFAULT_COMMAND) return HELP;
|
|
94
|
+
return `${HELP.replaceAll(DEFAULT_COMMAND, commandName)}\n\nEl ejecutable ${DEFAULT_COMMAND} es compatible y acepta los mismos subcomandos.`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function runCli(argv, io = defaultIo(), context = {}) {
|
|
98
|
+
if (argv.length === 0 || argv.includes("--help") || argv.includes("-h")) {
|
|
99
|
+
io.out(helpFor(context.commandName));
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const [command, ...rest] = argv;
|
|
104
|
+
if (command === "doctor") {
|
|
105
|
+
return runDoctorCommand(rest, io);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (command === "init") {
|
|
109
|
+
return runInitCommand(rest, io);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (command === "connect") {
|
|
113
|
+
return runConnectCommand(rest, io, context);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (command === "status") {
|
|
117
|
+
return runStatusCommand(rest, io, context);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (command === "sync") {
|
|
121
|
+
return runSyncCommand(rest, io, context);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
io.err(`Comando desconocido: ${command}`);
|
|
125
|
+
io.err(helpFor(context.commandName));
|
|
126
|
+
return 2;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function runSyncCommand(rest, io, context) {
|
|
130
|
+
const [operation, ...argumentsRest] = rest;
|
|
131
|
+
if (operation === "inspect") return runSyncInspectCommand(argumentsRest, io, context);
|
|
132
|
+
if (operation === "record") return runSyncRecordCommand(argumentsRest, io, context);
|
|
133
|
+
if (operation === "apply") return runSyncApplyCommand(argumentsRest, io, context);
|
|
134
|
+
if (operation !== "plan") {
|
|
135
|
+
io.err(
|
|
136
|
+
operation
|
|
137
|
+
? `Operación de sync desconocida: ${operation}`
|
|
138
|
+
: "Debes indicar una operación de sync: plan, inspect, record o apply."
|
|
139
|
+
);
|
|
140
|
+
return 2;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const options = {
|
|
144
|
+
targetPath: process.cwd()
|
|
145
|
+
};
|
|
146
|
+
let json = false;
|
|
147
|
+
let strict = false;
|
|
148
|
+
let targetProvided = false;
|
|
149
|
+
|
|
150
|
+
for (let index = 0; index < argumentsRest.length; index += 1) {
|
|
151
|
+
const argument = argumentsRest[index];
|
|
152
|
+
if (argument === "--json") {
|
|
153
|
+
json = true;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (argument === "--strict") {
|
|
157
|
+
strict = true;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (argument === "--manifest" || argument === "--limit") {
|
|
161
|
+
const value = argumentsRest[index + 1];
|
|
162
|
+
if (!value || value.startsWith("--")) {
|
|
163
|
+
io.err(`La opción ${argument} requiere un valor.`);
|
|
164
|
+
return 2;
|
|
165
|
+
}
|
|
166
|
+
if (argument === "--manifest") {
|
|
167
|
+
options.manifestPath = path.resolve(value);
|
|
168
|
+
} else {
|
|
169
|
+
options.limit = value;
|
|
170
|
+
}
|
|
171
|
+
index += 1;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (argument.startsWith("--")) {
|
|
175
|
+
io.err(`Opción desconocida: ${argument}`);
|
|
176
|
+
return 2;
|
|
177
|
+
}
|
|
178
|
+
if (targetProvided) {
|
|
179
|
+
io.err(`Ruta adicional no esperada: ${argument}`);
|
|
180
|
+
return 2;
|
|
181
|
+
}
|
|
182
|
+
options.targetPath = path.resolve(argument);
|
|
183
|
+
targetProvided = true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
let report;
|
|
187
|
+
try {
|
|
188
|
+
report = await planMemorySync(options, context);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
if (error instanceof SyncPlanningError) {
|
|
191
|
+
for (const detail of error.details) {
|
|
192
|
+
io.err(`- ${detail}`);
|
|
193
|
+
}
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
197
|
+
io.err(`No se pudo preparar la sincronización: ${message}`);
|
|
198
|
+
return 1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (json) {
|
|
202
|
+
io.out(JSON.stringify(report, null, 2));
|
|
203
|
+
} else {
|
|
204
|
+
io.out(formatSyncPlanReport(report));
|
|
205
|
+
}
|
|
206
|
+
return strict && report.status === "pending" ? 1 : 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function runSyncInspectCommand(args, io, context) {
|
|
210
|
+
const options = { targetPath: process.cwd() };
|
|
211
|
+
const values = new Map([["--pr", "pr"], ["--manifest", "manifestPath"], ["--max-files", "maxFiles"]]);
|
|
212
|
+
const seen = new Map();
|
|
213
|
+
const json = args.includes("--json");
|
|
214
|
+
const strict = args.includes("--strict");
|
|
215
|
+
let targetProvided = false;
|
|
216
|
+
const invalid = (message) => {
|
|
217
|
+
const report = { command: "sync inspect", status: "error", code: "invalid-option", details: [message] };
|
|
218
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else io.err(message);
|
|
219
|
+
return 2;
|
|
220
|
+
};
|
|
221
|
+
for (let index = 0; index < args.length; index++) {
|
|
222
|
+
const argument = args[index];
|
|
223
|
+
if (argument === "--json" || argument === "--strict") continue;
|
|
224
|
+
if (values.has(argument)) {
|
|
225
|
+
const value = args[++index];
|
|
226
|
+
if (!value || value.startsWith("-")) return invalid("Una opción de inspect requiere un valor válido.");
|
|
227
|
+
if (seen.has(argument) && seen.get(argument) !== value) return invalid("Una opción repetida tiene valores diferentes.");
|
|
228
|
+
seen.set(argument, value);
|
|
229
|
+
options[values.get(argument)] = argument === "--manifest" ? path.resolve(value) : value;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (argument.startsWith("-")) return invalid("Opción desconocida de sync inspect.");
|
|
233
|
+
if (targetProvided) return invalid("Solo se admite una ruta de memoria.");
|
|
234
|
+
options.targetPath = path.resolve(argument);
|
|
235
|
+
targetProvided = true;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
const report = await inspectMemorySync(options, context);
|
|
239
|
+
io.out(json ? JSON.stringify(report, null, 2) : formatSyncInspectionReport(report));
|
|
240
|
+
return strict && report.status !== "ready" ? 1 : 0;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
const report = inspectionErrorReport(error);
|
|
243
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else for (const message of report.details) io.err(`- ${message}`);
|
|
244
|
+
return report.code === "invalid-option" ? 2 : 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async function runSyncRecordCommand(args, io, context) {
|
|
249
|
+
const options = { targetPath: process.cwd(), notes: [], ackWarnings: [] };
|
|
250
|
+
const values = new Map([["--pr", "pr"], ["--outcome", "outcome"], ["--summary", "summary"],
|
|
251
|
+
["--manifest", "manifestPath"], ["--note", "notes"], ["--ack-warning", "ackWarnings"]]);
|
|
252
|
+
const seen = new Map();
|
|
253
|
+
const json = args.includes("--json");
|
|
254
|
+
let targetProvided = false;
|
|
255
|
+
const invalid = () => {
|
|
256
|
+
const report = { command: "sync record", status: "error", code: "invalid-option",
|
|
257
|
+
details: ["Opción desconocida, incompleta o contradictoria de sync record."], wrote: false };
|
|
258
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else io.err(report.details[0]);
|
|
259
|
+
return 2;
|
|
260
|
+
};
|
|
261
|
+
for (let index = 0; index < args.length; index++) {
|
|
262
|
+
const argument = args[index];
|
|
263
|
+
if (argument === "--json") continue;
|
|
264
|
+
if (argument === "--apply" || argument === "--reviewed") {
|
|
265
|
+
options[argument === "--apply" ? "apply" : "reviewed"] = true;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (values.has(argument)) {
|
|
269
|
+
const value = args[++index];
|
|
270
|
+
if (!value || value.startsWith("-")) return invalid();
|
|
271
|
+
const key = values.get(argument);
|
|
272
|
+
if (key === "notes" || key === "ackWarnings") options[key].push(value);
|
|
273
|
+
else {
|
|
274
|
+
if (seen.has(argument) && seen.get(argument) !== value) return invalid();
|
|
275
|
+
seen.set(argument, value);
|
|
276
|
+
options[key] = key === "manifestPath" ? path.resolve(value) : value;
|
|
277
|
+
}
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (argument.startsWith("-") || targetProvided) return invalid();
|
|
281
|
+
options.targetPath = path.resolve(argument);
|
|
282
|
+
targetProvided = true;
|
|
283
|
+
}
|
|
284
|
+
try {
|
|
285
|
+
const report = await recordMemorySync(options, context);
|
|
286
|
+
io.out(json ? JSON.stringify(report, null, 2) : formatSyncRecordReport(report));
|
|
287
|
+
return ["preview", "recorded", "unchanged"].includes(report.status) ? 0 : 1;
|
|
288
|
+
} catch (error) {
|
|
289
|
+
const report = recordErrorReport(error);
|
|
290
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else io.err(formatSyncRecordReport(report));
|
|
291
|
+
return report.code === "invalid-option" ? 2 : 1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async function runSyncApplyCommand(args, io, context) {
|
|
296
|
+
const options = { targetPath: process.cwd(), ackWarnings: [] }, json = args.includes("--json"), seen = new Map();
|
|
297
|
+
const values = new Map([["--proposal", "proposalPath"], ["--manifest", "manifestPath"], ["--expect", "expect"], ["--ack-warning", "ackWarnings"]]);
|
|
298
|
+
let targetProvided = false;
|
|
299
|
+
const invalid = () => {
|
|
300
|
+
const report = { command: "sync apply", status: "error", code: "invalid-option", details: ["Opción desconocida, incompleta o contradictoria de sync apply."], wrote: false };
|
|
301
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else io.err(report.details[0]);
|
|
302
|
+
return 2;
|
|
303
|
+
};
|
|
304
|
+
for (let index = 0; index < args.length; index++) {
|
|
305
|
+
const arg = args[index];
|
|
306
|
+
if (arg === "--json") continue;
|
|
307
|
+
if (arg === "--apply" || arg === "--reviewed") { options[arg.slice(2)] = true; continue; }
|
|
308
|
+
if (values.has(arg)) {
|
|
309
|
+
const value = args[++index]; if (!value || value.startsWith("-")) return invalid();
|
|
310
|
+
const key = values.get(arg);
|
|
311
|
+
if (key === "ackWarnings") options.ackWarnings.push(value);
|
|
312
|
+
else { if (seen.has(arg) && seen.get(arg) !== value) return invalid(); seen.set(arg, value); options[key] = value; }
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (arg.startsWith("-") || targetProvided) return invalid();
|
|
316
|
+
options.targetPath = path.resolve(arg); targetProvided = true;
|
|
317
|
+
}
|
|
318
|
+
try {
|
|
319
|
+
const report = await applyMemorySync(options, context);
|
|
320
|
+
io.out(json ? JSON.stringify(report, null, 2) : formatSyncApplyReport(report));
|
|
321
|
+
return ["preview", "applied", "unchanged"].includes(report.status) ? 0 : 1;
|
|
322
|
+
} catch (error) {
|
|
323
|
+
const report = applyErrorReport(error);
|
|
324
|
+
if (json) io.out(JSON.stringify(report, null, 2)); else io.err(formatSyncApplyReport(report));
|
|
325
|
+
return report.code === "invalid-option" ? 2 : 1;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
async function runStatusCommand(rest, io, context = {}) {
|
|
330
|
+
const options = {
|
|
331
|
+
targetPath: process.cwd()
|
|
332
|
+
};
|
|
333
|
+
let json = false;
|
|
334
|
+
let strict = false;
|
|
335
|
+
let targetProvided = false;
|
|
336
|
+
|
|
337
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
338
|
+
const argument = rest[index];
|
|
339
|
+
|
|
340
|
+
if (argument === "--json") {
|
|
341
|
+
json = true;
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
if (argument === "--strict") {
|
|
345
|
+
strict = true;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
if (argument === "--agent" || argument === "--manifest") {
|
|
349
|
+
const value = rest[index + 1];
|
|
350
|
+
if (!value || value.startsWith("--")) {
|
|
351
|
+
io.err(`La opción ${argument} requiere un valor.`);
|
|
352
|
+
return 2;
|
|
353
|
+
}
|
|
354
|
+
if (argument === "--agent") {
|
|
355
|
+
options.agentId = value;
|
|
356
|
+
} else {
|
|
357
|
+
options.manifestPath = path.resolve(value);
|
|
358
|
+
}
|
|
359
|
+
index += 1;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (argument.startsWith("--")) {
|
|
363
|
+
io.err(`Opción desconocida: ${argument}`);
|
|
364
|
+
return 2;
|
|
365
|
+
}
|
|
366
|
+
if (targetProvided) {
|
|
367
|
+
io.err(`Ruta adicional no esperada: ${argument}`);
|
|
368
|
+
return 2;
|
|
369
|
+
}
|
|
370
|
+
options.targetPath = path.resolve(argument);
|
|
371
|
+
targetProvided = true;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
let report;
|
|
375
|
+
try {
|
|
376
|
+
report = await inspectMemoryStatus(options, context);
|
|
377
|
+
} catch (error) {
|
|
378
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
379
|
+
io.err(`No se pudo inspeccionar el estado: ${message}`);
|
|
380
|
+
return 1;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (json) {
|
|
384
|
+
io.out(JSON.stringify(report, null, 2));
|
|
385
|
+
} else {
|
|
386
|
+
io.out(formatStatusReport(report));
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (report.status === "error") {
|
|
390
|
+
return 1;
|
|
391
|
+
}
|
|
392
|
+
if (strict && report.status === "warning") {
|
|
393
|
+
return 1;
|
|
394
|
+
}
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async function runConnectCommand(rest, io, context = {}) {
|
|
399
|
+
const options = {
|
|
400
|
+
apply: false,
|
|
401
|
+
targetPath: process.cwd()
|
|
402
|
+
};
|
|
403
|
+
let json = false;
|
|
404
|
+
let targetProvided = false;
|
|
405
|
+
|
|
406
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
407
|
+
const argument = rest[index];
|
|
408
|
+
|
|
409
|
+
if (argument === "--apply") {
|
|
410
|
+
options.apply = true;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (argument === "--json") {
|
|
414
|
+
json = true;
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (argument === "--agent" || argument === "--manifest") {
|
|
418
|
+
const value = rest[index + 1];
|
|
419
|
+
if (!value || value.startsWith("--")) {
|
|
420
|
+
io.err(`La opción ${argument} requiere un valor.`);
|
|
421
|
+
return 2;
|
|
422
|
+
}
|
|
423
|
+
if (argument === "--agent") {
|
|
424
|
+
options.agentId = value;
|
|
425
|
+
} else {
|
|
426
|
+
options.manifestPath = path.resolve(value);
|
|
427
|
+
}
|
|
428
|
+
index += 1;
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (argument.startsWith("--")) {
|
|
432
|
+
io.err(`Opción desconocida: ${argument}`);
|
|
433
|
+
return 2;
|
|
434
|
+
}
|
|
435
|
+
if (targetProvided) {
|
|
436
|
+
io.err(`Ruta adicional no esperada: ${argument}`);
|
|
437
|
+
return 2;
|
|
438
|
+
}
|
|
439
|
+
options.targetPath = path.resolve(argument);
|
|
440
|
+
targetProvided = true;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
let report;
|
|
444
|
+
try {
|
|
445
|
+
report = await connectMemory(options, context);
|
|
446
|
+
} catch (error) {
|
|
447
|
+
if (error instanceof ConnectionError) {
|
|
448
|
+
for (const detail of error.details) {
|
|
449
|
+
io.err(`- ${detail}`);
|
|
450
|
+
}
|
|
451
|
+
return 1;
|
|
452
|
+
}
|
|
453
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
454
|
+
io.err(`No se pudo preparar la conexión: ${message}`);
|
|
455
|
+
return 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (json) {
|
|
459
|
+
io.out(JSON.stringify(report, null, 2));
|
|
460
|
+
} else {
|
|
461
|
+
io.out(formatConnectReport(report));
|
|
462
|
+
}
|
|
463
|
+
return report.status === "conflict" ? 1 : 0;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
async function runDoctorCommand(rest, io) {
|
|
467
|
+
|
|
468
|
+
let targetPath = process.cwd();
|
|
469
|
+
let manifestPath;
|
|
470
|
+
let json = false;
|
|
471
|
+
let strict = false;
|
|
472
|
+
let targetProvided = false;
|
|
473
|
+
|
|
474
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
475
|
+
const argument = rest[index];
|
|
476
|
+
|
|
477
|
+
if (argument === "--json") {
|
|
478
|
+
json = true;
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (argument === "--strict") {
|
|
483
|
+
strict = true;
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (argument === "--manifest") {
|
|
488
|
+
const value = rest[index + 1];
|
|
489
|
+
if (!value || value.startsWith("--")) {
|
|
490
|
+
io.err("La opción --manifest requiere una ruta.");
|
|
491
|
+
return 2;
|
|
492
|
+
}
|
|
493
|
+
manifestPath = path.resolve(value);
|
|
494
|
+
index += 1;
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (argument.startsWith("--")) {
|
|
499
|
+
io.err(`Opción desconocida: ${argument}`);
|
|
500
|
+
return 2;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (targetProvided) {
|
|
504
|
+
io.err(`Ruta adicional no esperada: ${argument}`);
|
|
505
|
+
return 2;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
targetPath = path.resolve(argument);
|
|
509
|
+
targetProvided = true;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
let report;
|
|
513
|
+
try {
|
|
514
|
+
report = await diagnoseMemory(targetPath, { manifestPath });
|
|
515
|
+
} catch (error) {
|
|
516
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
517
|
+
io.err(`No se pudo completar el diagnóstico: ${message}`);
|
|
518
|
+
return 1;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (json) {
|
|
522
|
+
io.out(JSON.stringify(report, null, 2));
|
|
523
|
+
} else {
|
|
524
|
+
io.out(formatReport(report));
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (report.status === "error") {
|
|
528
|
+
return 1;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (strict && report.status === "warning") {
|
|
532
|
+
return 1;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return 0;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function runInitCommand(rest, io) {
|
|
539
|
+
const options = {
|
|
540
|
+
apply: false
|
|
541
|
+
};
|
|
542
|
+
let json = false;
|
|
543
|
+
let destinationProvided = false;
|
|
544
|
+
const valueOptions = new Map([
|
|
545
|
+
["--project-id", "projectId"],
|
|
546
|
+
["--project-name", "projectName"],
|
|
547
|
+
["--source", "sourcePath"],
|
|
548
|
+
["--default-branch", "defaultBranch"],
|
|
549
|
+
["--integration-branch", "integrationBranch"],
|
|
550
|
+
["--source-remote", "sourceRemote"],
|
|
551
|
+
["--memory-remote", "memoryRemote"],
|
|
552
|
+
["--sync-mode", "syncMode"],
|
|
553
|
+
["--mcp-name", "mcpName"],
|
|
554
|
+
["--description", "description"]
|
|
555
|
+
]);
|
|
556
|
+
|
|
557
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
558
|
+
const argument = rest[index];
|
|
559
|
+
|
|
560
|
+
if (argument === "--apply") {
|
|
561
|
+
options.apply = true;
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (argument === "--json") {
|
|
566
|
+
json = true;
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (valueOptions.has(argument)) {
|
|
571
|
+
const value = rest[index + 1];
|
|
572
|
+
if (!value || value.startsWith("--")) {
|
|
573
|
+
io.err(`La opción ${argument} requiere un valor.`);
|
|
574
|
+
return 2;
|
|
575
|
+
}
|
|
576
|
+
options[valueOptions.get(argument)] = value;
|
|
577
|
+
index += 1;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if (argument.startsWith("--")) {
|
|
582
|
+
io.err(`Opción desconocida: ${argument}`);
|
|
583
|
+
return 2;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (destinationProvided) {
|
|
587
|
+
io.err(`Destino adicional no esperado: ${argument}`);
|
|
588
|
+
return 2;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
options.destination = path.resolve(argument);
|
|
592
|
+
destinationProvided = true;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
let report;
|
|
596
|
+
try {
|
|
597
|
+
report = initializeMemory(options);
|
|
598
|
+
} catch (error) {
|
|
599
|
+
if (error instanceof InitializationError) {
|
|
600
|
+
for (const detail of error.details) {
|
|
601
|
+
io.err(`- ${detail}`);
|
|
602
|
+
}
|
|
603
|
+
return 1;
|
|
604
|
+
}
|
|
605
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
606
|
+
io.err(`No se pudo preparar la memoria: ${message}`);
|
|
607
|
+
return 1;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (json) {
|
|
611
|
+
io.out(JSON.stringify(report, null, 2));
|
|
612
|
+
} else {
|
|
613
|
+
io.out(formatInitReport(report));
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return report.status === "conflict" ? 1 : 0;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function formatInitReport(report) {
|
|
620
|
+
const lines = [
|
|
621
|
+
`Project Memory Init: ${report.status.toUpperCase()}`,
|
|
622
|
+
`Modo: ${report.mode}`,
|
|
623
|
+
`Destino: ${report.destination}`,
|
|
624
|
+
`Proyecto: ${report.project.name} (${report.project.id})`,
|
|
625
|
+
"",
|
|
626
|
+
`${report.summary.create} por crear, ${report.summary.unchanged} sin cambios, ${report.summary.conflicts} conflictos`
|
|
627
|
+
];
|
|
628
|
+
|
|
629
|
+
for (const file of report.files) {
|
|
630
|
+
const symbol = file.action === "create" ? "+" : file.action === "unchanged" ? "=" : "!";
|
|
631
|
+
lines.push(`${symbol} ${file.path}${file.reason ? ` — ${file.reason}` : ""}`);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
if (report.status === "preview") {
|
|
635
|
+
lines.push("");
|
|
636
|
+
lines.push("Vista previa: repite el comando con --apply para crear los archivos.");
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return lines.join("\n");
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function formatConnectReport(report) {
|
|
643
|
+
const lines = [
|
|
644
|
+
`Project Memory Connect: ${report.status.toUpperCase()}`,
|
|
645
|
+
`Modo: ${report.mode}`,
|
|
646
|
+
`Agente: ${report.agent}`,
|
|
647
|
+
`Bóveda: ${report.vaultPath}`,
|
|
648
|
+
`MCP: ${report.mcpName}`,
|
|
649
|
+
`Skill: ${report.skillName}`,
|
|
650
|
+
"",
|
|
651
|
+
`${report.summary.create} por crear, ${report.summary.update} por actualizar, ${report.summary.unchanged} sin cambios, ${report.summary.conflicts} conflictos`
|
|
652
|
+
];
|
|
653
|
+
|
|
654
|
+
const symbols = {
|
|
655
|
+
create: "+",
|
|
656
|
+
update: "~",
|
|
657
|
+
unchanged: "=",
|
|
658
|
+
conflict: "!"
|
|
659
|
+
};
|
|
660
|
+
for (const component of report.components) {
|
|
661
|
+
lines.push(
|
|
662
|
+
`${symbols[component.action]} ${component.id}: ${component.message}${component.path ? ` (${component.path})` : ""}`
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
if (report.status === "preview") {
|
|
666
|
+
lines.push("");
|
|
667
|
+
lines.push("Vista previa: repite el comando con --apply para conectar el agente.");
|
|
668
|
+
}
|
|
669
|
+
return lines.join("\n");
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function formatStatusReport(report) {
|
|
673
|
+
const lines = [
|
|
674
|
+
`Project Memory Status: ${report.status.toUpperCase()}`,
|
|
675
|
+
`Proyecto: ${report.project?.name ?? "no determinado"}${report.project?.id ? ` (${report.project.id})` : ""}`,
|
|
676
|
+
`Manifiesto: ${report.manifestPath ?? "no encontrado"}`,
|
|
677
|
+
`Bóveda: ${report.memory.vaultPath ?? "no determinada"}`,
|
|
678
|
+
`Memoria: ${report.memory.status.toUpperCase()} — ${report.memory.summary.errors} errores, ${report.memory.summary.warnings} advertencias`,
|
|
679
|
+
""
|
|
680
|
+
];
|
|
681
|
+
|
|
682
|
+
const symbols = {
|
|
683
|
+
ok: "✓",
|
|
684
|
+
warning: "!",
|
|
685
|
+
error: "✗",
|
|
686
|
+
disabled: "-"
|
|
687
|
+
};
|
|
688
|
+
for (const agent of report.agents) {
|
|
689
|
+
lines.push(`${symbols[agent.status]} ${agent.id}: ${agent.summary}`);
|
|
690
|
+
for (const component of agent.components) {
|
|
691
|
+
if (component.action !== "unchanged") {
|
|
692
|
+
lines.push(` - ${component.id}: ${component.message}`);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
for (const detail of agent.details ?? []) {
|
|
696
|
+
lines.push(` - ${detail}`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
for (const finding of report.findings) {
|
|
701
|
+
lines.push(`${symbols[finding.level] ?? "!"} ${finding.message}`);
|
|
702
|
+
for (const detail of finding.details ?? []) {
|
|
703
|
+
lines.push(` - ${detail}`);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
lines.push("");
|
|
708
|
+
lines.push(
|
|
709
|
+
`${report.summary.errors} errores, ${report.summary.warnings} advertencias, ${report.summary.healthyAgents} agentes saludables, ${report.summary.pendingAgents} pendientes`
|
|
710
|
+
);
|
|
711
|
+
return lines.join("\n");
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function formatSyncPlanReport(report) {
|
|
715
|
+
const lines = [
|
|
716
|
+
`Project Memory Sync Plan: ${report.status.toUpperCase()}`,
|
|
717
|
+
`Repositorio: ${report.repository}`,
|
|
718
|
+
`Rama revisada: ${report.branch}`,
|
|
719
|
+
`Registro: ${report.ledgerPath}`,
|
|
720
|
+
`Línea base: ${report.baseline ? `#${report.baseline.number} (${report.baseline.mergedAt})` : "no disponible"}`,
|
|
721
|
+
"",
|
|
722
|
+
`${report.reviewed.length} PR revisados, ${report.pending.length} pendientes`
|
|
723
|
+
];
|
|
724
|
+
|
|
725
|
+
for (const pullRequest of report.pending) {
|
|
726
|
+
lines.push(
|
|
727
|
+
`#${pullRequest.number} ${pullRequest.title} — ${pullRequest.mergedAt}`
|
|
728
|
+
);
|
|
729
|
+
lines.push(` ${pullRequest.url}`);
|
|
730
|
+
}
|
|
731
|
+
if (report.pending.length === 0) {
|
|
732
|
+
lines.push("No hay Pull Requests fusionados pendientes de revisión.");
|
|
733
|
+
}
|
|
734
|
+
return lines.join("\n");
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function formatReport(report) {
|
|
738
|
+
const lines = [
|
|
739
|
+
`Project Memory Doctor: ${report.status.toUpperCase()}`,
|
|
740
|
+
`Manifiesto: ${report.manifestPath ?? "no encontrado"}`,
|
|
741
|
+
`Repositorio fuente: ${report.sourcePath ?? "no determinado"}`,
|
|
742
|
+
`Bóveda: ${report.vaultPath ?? "no determinada"}`,
|
|
743
|
+
`Estructura: ${report.layoutProfile ?? "no determinada"}`,
|
|
744
|
+
""
|
|
745
|
+
];
|
|
746
|
+
|
|
747
|
+
const symbols = {
|
|
748
|
+
pass: "✓",
|
|
749
|
+
info: "i",
|
|
750
|
+
warning: "!",
|
|
751
|
+
error: "✗"
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
for (const check of report.checks) {
|
|
755
|
+
lines.push(`${symbols[check.level]} [${check.id}] ${check.message}`);
|
|
756
|
+
for (const detail of check.details ?? []) {
|
|
757
|
+
lines.push(` - ${detail}`);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
lines.push("");
|
|
762
|
+
lines.push(
|
|
763
|
+
`${report.summary.errors} errores, ${report.summary.warnings} advertencias, ${report.summary.passed} comprobaciones correctas`
|
|
764
|
+
);
|
|
765
|
+
|
|
766
|
+
return lines.join("\n");
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function defaultIo() {
|
|
770
|
+
return {
|
|
771
|
+
out(message) {
|
|
772
|
+
console.log(message);
|
|
773
|
+
},
|
|
774
|
+
err(message) {
|
|
775
|
+
console.error(message);
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
}
|