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/doctor.js
ADDED
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
import Ajv2020 from "ajv/dist/2020.js";
|
|
7
|
+
import { SECRET_PATTERNS } from "./sensitive-data.js";
|
|
8
|
+
|
|
9
|
+
const SOURCE_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const DEFAULT_SCHEMA_PATH = path.resolve(
|
|
11
|
+
SOURCE_DIRECTORY,
|
|
12
|
+
"../schemas/project-memory.schema.json"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const MANIFEST_NAMES = [
|
|
16
|
+
"project-memory.json",
|
|
17
|
+
"project-memory.local.json",
|
|
18
|
+
"project-memory.example.json"
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const REQUIRED_DIRECTORIES = [
|
|
22
|
+
"00-INICIO",
|
|
23
|
+
"01-PRODUCTO",
|
|
24
|
+
"02-ARQUITECTURA",
|
|
25
|
+
"03-IMPLEMENTACION",
|
|
26
|
+
"04-DECISIONES",
|
|
27
|
+
"05-ENTREGAS",
|
|
28
|
+
"06-OPERACION",
|
|
29
|
+
"07-AGENTES",
|
|
30
|
+
"08-RECURSOS",
|
|
31
|
+
"09-ARCHIVO"
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const REQUIRED_NOTES = [
|
|
35
|
+
"00-INICIO/Inicio del proyecto.md",
|
|
36
|
+
"00-INICIO/Mapa de la memoria.md",
|
|
37
|
+
"00-INICIO/Estado actual.md",
|
|
38
|
+
"00-INICIO/Fuentes de verdad.md",
|
|
39
|
+
"00-INICIO/Mantenimiento de la memoria.md",
|
|
40
|
+
"00-INICIO/Registro de sincronización.md"
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const IGNORED_DIRECTORIES = new Set([
|
|
44
|
+
".git",
|
|
45
|
+
".obsidian",
|
|
46
|
+
".trash",
|
|
47
|
+
"node_modules"
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const TEXT_EXTENSIONS = new Set([
|
|
51
|
+
".json",
|
|
52
|
+
".md",
|
|
53
|
+
".text",
|
|
54
|
+
".toml",
|
|
55
|
+
".txt",
|
|
56
|
+
".yaml",
|
|
57
|
+
".yml"
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
export async function diagnoseMemory(targetPath, options = {}) {
|
|
61
|
+
const report = createReport();
|
|
62
|
+
const resolvedTarget = path.resolve(targetPath);
|
|
63
|
+
const manifestPath = resolveManifestPath(
|
|
64
|
+
resolvedTarget,
|
|
65
|
+
options.manifestPath
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (!manifestPath) {
|
|
69
|
+
addCheck(
|
|
70
|
+
report,
|
|
71
|
+
"manifest-presence",
|
|
72
|
+
"error",
|
|
73
|
+
"No se encontró un manifiesto de memoria.",
|
|
74
|
+
MANIFEST_NAMES
|
|
75
|
+
);
|
|
76
|
+
return finishReport(report);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
report.manifestPath = manifestPath;
|
|
80
|
+
addCheck(
|
|
81
|
+
report,
|
|
82
|
+
"manifest-presence",
|
|
83
|
+
"pass",
|
|
84
|
+
"Manifiesto encontrado."
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const manifest = readJson(manifestPath, report, "manifest-json");
|
|
88
|
+
if (!manifest) {
|
|
89
|
+
return finishReport(report);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const schemaPath = path.resolve(options.schemaPath ?? DEFAULT_SCHEMA_PATH);
|
|
93
|
+
const schema = readJson(schemaPath, report, "schema-json");
|
|
94
|
+
if (!schema) {
|
|
95
|
+
return finishReport(report);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
validateManifest(manifest, schema, report);
|
|
99
|
+
checkManifestUrls(manifest, report);
|
|
100
|
+
|
|
101
|
+
if (hasErrors(report)) {
|
|
102
|
+
return finishReport(report);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const sourcePath = resolveConfiguredPath(
|
|
106
|
+
path.dirname(manifestPath),
|
|
107
|
+
manifest.source.repositoryPath
|
|
108
|
+
);
|
|
109
|
+
report.sourcePath = sourcePath;
|
|
110
|
+
checkSourceRepository(sourcePath, report);
|
|
111
|
+
|
|
112
|
+
const structure = resolveStructure(manifest.memory.layout);
|
|
113
|
+
report.layoutProfile = structure.profile;
|
|
114
|
+
|
|
115
|
+
const vaultPath = resolveConfiguredPath(
|
|
116
|
+
path.dirname(manifestPath),
|
|
117
|
+
manifest.memory.vaultPath
|
|
118
|
+
);
|
|
119
|
+
report.vaultPath = vaultPath;
|
|
120
|
+
|
|
121
|
+
if (!isDirectory(vaultPath)) {
|
|
122
|
+
addCheck(
|
|
123
|
+
report,
|
|
124
|
+
"vault-presence",
|
|
125
|
+
"error",
|
|
126
|
+
"La ruta configurada para la bóveda no existe o no es un directorio.",
|
|
127
|
+
[vaultPath]
|
|
128
|
+
);
|
|
129
|
+
return finishReport(report);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
addCheck(report, "vault-presence", "pass", "Bóveda accesible.");
|
|
133
|
+
|
|
134
|
+
checkStructure(vaultPath, structure, report);
|
|
135
|
+
|
|
136
|
+
const textFiles = collectTextFiles(vaultPath);
|
|
137
|
+
checkTemplateVariables(textFiles, vaultPath, report);
|
|
138
|
+
checkLinks(textFiles, vaultPath, report);
|
|
139
|
+
checkSecrets(textFiles, vaultPath, report);
|
|
140
|
+
checkGit(vaultPath, manifest.memory.syncMode, report);
|
|
141
|
+
|
|
142
|
+
return finishReport(report);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function createReport() {
|
|
146
|
+
return {
|
|
147
|
+
status: "ok",
|
|
148
|
+
manifestPath: null,
|
|
149
|
+
sourcePath: null,
|
|
150
|
+
vaultPath: null,
|
|
151
|
+
layoutProfile: null,
|
|
152
|
+
checks: [],
|
|
153
|
+
summary: {
|
|
154
|
+
errors: 0,
|
|
155
|
+
warnings: 0,
|
|
156
|
+
passed: 0,
|
|
157
|
+
info: 0
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function addCheck(report, id, level, message, details = []) {
|
|
163
|
+
report.checks.push({ id, level, message, details });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function finishReport(report) {
|
|
167
|
+
report.summary = {
|
|
168
|
+
errors: report.checks.filter((check) => check.level === "error").length,
|
|
169
|
+
warnings: report.checks.filter((check) => check.level === "warning").length,
|
|
170
|
+
passed: report.checks.filter((check) => check.level === "pass").length,
|
|
171
|
+
info: report.checks.filter((check) => check.level === "info").length
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
if (report.summary.errors > 0) {
|
|
175
|
+
report.status = "error";
|
|
176
|
+
} else if (report.summary.warnings > 0) {
|
|
177
|
+
report.status = "warning";
|
|
178
|
+
} else {
|
|
179
|
+
report.status = "ok";
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return report;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function hasErrors(report) {
|
|
186
|
+
return report.checks.some((check) => check.level === "error");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function resolveManifestPath(targetPath, explicitManifestPath) {
|
|
190
|
+
if (explicitManifestPath) {
|
|
191
|
+
const explicit = path.resolve(explicitManifestPath);
|
|
192
|
+
return isFile(explicit) ? explicit : null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (isFile(targetPath)) {
|
|
196
|
+
return targetPath;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!isDirectory(targetPath)) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
for (const name of MANIFEST_NAMES) {
|
|
204
|
+
const candidate = path.join(targetPath, name);
|
|
205
|
+
if (isFile(candidate)) {
|
|
206
|
+
return candidate;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function readJson(filePath, report, checkId) {
|
|
214
|
+
try {
|
|
215
|
+
const value = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
216
|
+
addCheck(report, checkId, "pass", `JSON válido: ${path.basename(filePath)}`);
|
|
217
|
+
return value;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
addCheck(report, checkId, "error", "No se pudo leer JSON válido.", [
|
|
220
|
+
filePath,
|
|
221
|
+
error.message
|
|
222
|
+
]);
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function validateManifest(manifest, schema, report) {
|
|
228
|
+
const ajv = new Ajv2020({ allErrors: true, strict: true });
|
|
229
|
+
const validate = ajv.compile(schema);
|
|
230
|
+
|
|
231
|
+
if (validate(manifest)) {
|
|
232
|
+
addCheck(
|
|
233
|
+
report,
|
|
234
|
+
"manifest-schema",
|
|
235
|
+
"pass",
|
|
236
|
+
"El manifiesto cumple el esquema v1."
|
|
237
|
+
);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const details = (validate.errors ?? []).map((error) => {
|
|
242
|
+
const location = error.instancePath || "/";
|
|
243
|
+
return `${location}: ${error.message}`;
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
addCheck(
|
|
247
|
+
report,
|
|
248
|
+
"manifest-schema",
|
|
249
|
+
"error",
|
|
250
|
+
"El manifiesto no cumple el esquema v1.",
|
|
251
|
+
details
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function checkManifestUrls(manifest, report) {
|
|
256
|
+
const urls = [
|
|
257
|
+
{ field: "source.remoteUrl", value: manifest.source?.remoteUrl },
|
|
258
|
+
{
|
|
259
|
+
field: "memory.repositoryRemote",
|
|
260
|
+
value: manifest.memory?.repositoryRemote
|
|
261
|
+
}
|
|
262
|
+
].filter((candidate) => Boolean(candidate.value));
|
|
263
|
+
const unsafe = urls.filter((candidate) =>
|
|
264
|
+
hasEmbeddedCredentials(candidate.value)
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
if (unsafe.length > 0) {
|
|
268
|
+
addCheck(
|
|
269
|
+
report,
|
|
270
|
+
"manifest-credentials",
|
|
271
|
+
"error",
|
|
272
|
+
"El manifiesto contiene una URL con posibles credenciales.",
|
|
273
|
+
unsafe.map((candidate) => candidate.field)
|
|
274
|
+
);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
addCheck(
|
|
279
|
+
report,
|
|
280
|
+
"manifest-credentials",
|
|
281
|
+
"pass",
|
|
282
|
+
"No se detectaron credenciales incrustadas en URLs."
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function hasEmbeddedCredentials(value) {
|
|
287
|
+
try {
|
|
288
|
+
const url = new URL(value);
|
|
289
|
+
const sensitiveQueryKeys = [
|
|
290
|
+
"access_token",
|
|
291
|
+
"api_key",
|
|
292
|
+
"apikey",
|
|
293
|
+
"auth",
|
|
294
|
+
"password",
|
|
295
|
+
"secret",
|
|
296
|
+
"token"
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
Boolean(url.username || url.password) ||
|
|
301
|
+
sensitiveQueryKeys.some((key) => url.searchParams.has(key))
|
|
302
|
+
);
|
|
303
|
+
} catch {
|
|
304
|
+
return /(?:access_token|api_key|password|secret|token)=/i.test(value);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function resolveConfiguredPath(baseDirectory, configuredPath) {
|
|
309
|
+
return path.isAbsolute(configuredPath)
|
|
310
|
+
? path.normalize(configuredPath)
|
|
311
|
+
: path.resolve(baseDirectory, configuredPath);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function checkSourceRepository(sourcePath, report) {
|
|
315
|
+
if (!isDirectory(sourcePath)) {
|
|
316
|
+
addCheck(
|
|
317
|
+
report,
|
|
318
|
+
"source-repository",
|
|
319
|
+
"warning",
|
|
320
|
+
"El repositorio fuente configurado no está disponible en esta máquina.",
|
|
321
|
+
[sourcePath]
|
|
322
|
+
);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const gitRoot = runGit(sourcePath, ["rev-parse", "--show-toplevel"]);
|
|
327
|
+
if (!gitRoot.ok) {
|
|
328
|
+
addCheck(
|
|
329
|
+
report,
|
|
330
|
+
"source-repository",
|
|
331
|
+
"warning",
|
|
332
|
+
"La ruta fuente existe, pero no pertenece a un repositorio Git.",
|
|
333
|
+
[sourcePath]
|
|
334
|
+
);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
addCheck(
|
|
339
|
+
report,
|
|
340
|
+
"source-repository",
|
|
341
|
+
"pass",
|
|
342
|
+
"Repositorio fuente accesible.",
|
|
343
|
+
[gitRoot.stdout]
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function resolveStructure(layout) {
|
|
348
|
+
if (layout?.profile === "declared") {
|
|
349
|
+
return {
|
|
350
|
+
profile: "declared",
|
|
351
|
+
requiredDirectories: layout.requiredDirectories,
|
|
352
|
+
requiredNotes: layout.requiredNotes
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
profile: "canonical-v1",
|
|
358
|
+
requiredDirectories: REQUIRED_DIRECTORIES,
|
|
359
|
+
requiredNotes: REQUIRED_NOTES
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function checkStructure(vaultPath, structure, report) {
|
|
364
|
+
const missingDirectories = structure.requiredDirectories.filter(
|
|
365
|
+
(relativePath) => !isDirectory(path.join(vaultPath, relativePath))
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
if (missingDirectories.length > 0) {
|
|
369
|
+
addCheck(
|
|
370
|
+
report,
|
|
371
|
+
"vault-directories",
|
|
372
|
+
"error",
|
|
373
|
+
`Faltan carpetas requeridas por el perfil ${structure.profile}.`,
|
|
374
|
+
missingDirectories
|
|
375
|
+
);
|
|
376
|
+
} else {
|
|
377
|
+
addCheck(
|
|
378
|
+
report,
|
|
379
|
+
"vault-directories",
|
|
380
|
+
"pass",
|
|
381
|
+
`Las carpetas requeridas por ${structure.profile} están presentes.`
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const missingNotes = structure.requiredNotes.filter(
|
|
386
|
+
(relativePath) => !isFile(path.join(vaultPath, relativePath))
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
if (missingNotes.length > 0) {
|
|
390
|
+
addCheck(
|
|
391
|
+
report,
|
|
392
|
+
"vault-notes",
|
|
393
|
+
"error",
|
|
394
|
+
"Faltan notas fundamentales.",
|
|
395
|
+
missingNotes
|
|
396
|
+
);
|
|
397
|
+
} else {
|
|
398
|
+
addCheck(
|
|
399
|
+
report,
|
|
400
|
+
"vault-notes",
|
|
401
|
+
"pass",
|
|
402
|
+
"Las notas fundamentales están presentes."
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function collectTextFiles(rootDirectory) {
|
|
408
|
+
const files = [];
|
|
409
|
+
const pending = [rootDirectory];
|
|
410
|
+
|
|
411
|
+
while (pending.length > 0) {
|
|
412
|
+
const current = pending.pop();
|
|
413
|
+
|
|
414
|
+
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
415
|
+
if (entry.isSymbolicLink()) {
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const fullPath = path.join(current, entry.name);
|
|
420
|
+
if (entry.isDirectory()) {
|
|
421
|
+
if (!IGNORED_DIRECTORIES.has(entry.name)) {
|
|
422
|
+
pending.push(fullPath);
|
|
423
|
+
}
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (
|
|
428
|
+
entry.isFile() &&
|
|
429
|
+
TEXT_EXTENSIONS.has(path.extname(entry.name).toLowerCase()) &&
|
|
430
|
+
fs.statSync(fullPath).size <= 1_000_000
|
|
431
|
+
) {
|
|
432
|
+
files.push(fullPath);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return files.sort();
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function checkTemplateVariables(files, vaultPath, report) {
|
|
441
|
+
const findings = [];
|
|
442
|
+
const pattern = /\{\{[A-Z][A-Z0-9_]*\}\}/g;
|
|
443
|
+
|
|
444
|
+
for (const filePath of files) {
|
|
445
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
446
|
+
const matches = [...new Set(content.match(pattern) ?? [])];
|
|
447
|
+
if (matches.length > 0) {
|
|
448
|
+
findings.push(
|
|
449
|
+
`${relativeDisplay(vaultPath, filePath)}: ${matches.join(", ")}`
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (findings.length > 0) {
|
|
455
|
+
addCheck(
|
|
456
|
+
report,
|
|
457
|
+
"template-variables",
|
|
458
|
+
"error",
|
|
459
|
+
"Quedan variables de plantilla sin reemplazar.",
|
|
460
|
+
findings
|
|
461
|
+
);
|
|
462
|
+
} else {
|
|
463
|
+
addCheck(
|
|
464
|
+
report,
|
|
465
|
+
"template-variables",
|
|
466
|
+
"pass",
|
|
467
|
+
"No quedan variables de plantilla."
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function checkLinks(files, vaultPath, report) {
|
|
473
|
+
const markdownFiles = files.filter(
|
|
474
|
+
(filePath) => path.extname(filePath).toLowerCase() === ".md"
|
|
475
|
+
);
|
|
476
|
+
const indexes = buildMarkdownIndexes(markdownFiles, vaultPath);
|
|
477
|
+
const broken = [];
|
|
478
|
+
const ambiguous = [];
|
|
479
|
+
|
|
480
|
+
for (const filePath of markdownFiles) {
|
|
481
|
+
const content = maskMarkdownCode(fs.readFileSync(filePath, "utf8"));
|
|
482
|
+
checkWikiLinks(content, filePath, vaultPath, indexes, broken, ambiguous);
|
|
483
|
+
checkMarkdownLinks(content, filePath, vaultPath, broken);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (broken.length > 0) {
|
|
487
|
+
addCheck(
|
|
488
|
+
report,
|
|
489
|
+
"markdown-links",
|
|
490
|
+
"error",
|
|
491
|
+
"Se encontraron enlaces internos rotos.",
|
|
492
|
+
broken
|
|
493
|
+
);
|
|
494
|
+
} else {
|
|
495
|
+
addCheck(
|
|
496
|
+
report,
|
|
497
|
+
"markdown-links",
|
|
498
|
+
"pass",
|
|
499
|
+
"Los enlaces internos resolvibles son válidos."
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (ambiguous.length > 0) {
|
|
504
|
+
addCheck(
|
|
505
|
+
report,
|
|
506
|
+
"ambiguous-links",
|
|
507
|
+
"warning",
|
|
508
|
+
"Existen enlaces Wiki con destinos ambiguos.",
|
|
509
|
+
ambiguous
|
|
510
|
+
);
|
|
511
|
+
} else {
|
|
512
|
+
addCheck(
|
|
513
|
+
report,
|
|
514
|
+
"ambiguous-links",
|
|
515
|
+
"pass",
|
|
516
|
+
"No se encontraron enlaces Wiki ambiguos."
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function maskMarkdownCode(content) {
|
|
522
|
+
return content
|
|
523
|
+
.replace(/```[\s\S]*?```/g, "")
|
|
524
|
+
.replace(/~~~[\s\S]*?~~~/g, "")
|
|
525
|
+
.replace(/(`+)[^`\n]*?\1/g, "");
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function buildMarkdownIndexes(files, vaultPath) {
|
|
529
|
+
const byRelativePath = new Set();
|
|
530
|
+
const byBaseName = new Map();
|
|
531
|
+
|
|
532
|
+
for (const filePath of files) {
|
|
533
|
+
const relativePath = normalizeRelativePath(
|
|
534
|
+
path.relative(vaultPath, filePath).replace(/\.md$/i, "")
|
|
535
|
+
);
|
|
536
|
+
const baseName = path.basename(filePath, ".md");
|
|
537
|
+
byRelativePath.add(relativePath);
|
|
538
|
+
|
|
539
|
+
const matches = byBaseName.get(baseName) ?? [];
|
|
540
|
+
matches.push(relativePath);
|
|
541
|
+
byBaseName.set(baseName, matches);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return { byRelativePath, byBaseName };
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function checkWikiLinks(
|
|
548
|
+
content,
|
|
549
|
+
filePath,
|
|
550
|
+
vaultPath,
|
|
551
|
+
indexes,
|
|
552
|
+
broken,
|
|
553
|
+
ambiguous
|
|
554
|
+
) {
|
|
555
|
+
const pattern = /\[\[([^\]|#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]/g;
|
|
556
|
+
let match;
|
|
557
|
+
|
|
558
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
559
|
+
const rawTarget = match[1].trim().replace(/\.md$/i, "");
|
|
560
|
+
const normalizedTarget = normalizeRelativePath(rawTarget);
|
|
561
|
+
const source = relativeDisplay(vaultPath, filePath);
|
|
562
|
+
|
|
563
|
+
if (normalizedTarget.includes("/")) {
|
|
564
|
+
if (!indexes.byRelativePath.has(normalizedTarget)) {
|
|
565
|
+
broken.push(`${source} -> [[${rawTarget}]]`);
|
|
566
|
+
}
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const candidates = indexes.byBaseName.get(normalizedTarget) ?? [];
|
|
571
|
+
if (candidates.length === 0) {
|
|
572
|
+
broken.push(`${source} -> [[${rawTarget}]]`);
|
|
573
|
+
} else if (candidates.length > 1) {
|
|
574
|
+
ambiguous.push(`${source} -> [[${rawTarget}]]`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function checkMarkdownLinks(content, filePath, vaultPath, broken) {
|
|
580
|
+
const pattern = /!?\[[^\]]*\]\(([^)]+)\)/g;
|
|
581
|
+
let match;
|
|
582
|
+
|
|
583
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
584
|
+
const target = match[1].trim().replace(/^<|>$/g, "");
|
|
585
|
+
if (
|
|
586
|
+
target.startsWith("#") ||
|
|
587
|
+
/^(?:https?:|mailto:|data:|obsidian:)/i.test(target)
|
|
588
|
+
) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const withoutFragment = target.split(/[?#]/, 1)[0];
|
|
593
|
+
if (!withoutFragment) {
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
let decoded;
|
|
598
|
+
try {
|
|
599
|
+
decoded = decodeURIComponent(withoutFragment);
|
|
600
|
+
} catch {
|
|
601
|
+
decoded = withoutFragment;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
const resolved = path.resolve(path.dirname(filePath), decoded);
|
|
605
|
+
if (!fs.existsSync(resolved)) {
|
|
606
|
+
broken.push(
|
|
607
|
+
`${relativeDisplay(vaultPath, filePath)} -> (${withoutFragment})`
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function checkSecrets(files, vaultPath, report) {
|
|
614
|
+
const findings = [];
|
|
615
|
+
|
|
616
|
+
for (const filePath of files) {
|
|
617
|
+
const lines = fs.readFileSync(filePath, "utf8").split(/\r?\n/);
|
|
618
|
+
lines.forEach((line, index) => {
|
|
619
|
+
for (const candidate of SECRET_PATTERNS) {
|
|
620
|
+
if (candidate.pattern.test(line)) {
|
|
621
|
+
findings.push(
|
|
622
|
+
`${relativeDisplay(vaultPath, filePath)}:${index + 1} (${candidate.name})`
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (findings.length > 0) {
|
|
630
|
+
addCheck(
|
|
631
|
+
report,
|
|
632
|
+
"secret-scan",
|
|
633
|
+
"error",
|
|
634
|
+
"Se detectaron patrones sensibles de alta confianza.",
|
|
635
|
+
findings
|
|
636
|
+
);
|
|
637
|
+
} else {
|
|
638
|
+
addCheck(
|
|
639
|
+
report,
|
|
640
|
+
"secret-scan",
|
|
641
|
+
"pass",
|
|
642
|
+
"No se detectaron secretos de alta confianza."
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function checkGit(vaultPath, syncMode, report) {
|
|
648
|
+
if (syncMode === "none") {
|
|
649
|
+
addCheck(
|
|
650
|
+
report,
|
|
651
|
+
"git",
|
|
652
|
+
"info",
|
|
653
|
+
"El manifiesto no requiere sincronización Git."
|
|
654
|
+
);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const root = runGit(vaultPath, ["rev-parse", "--show-toplevel"]);
|
|
659
|
+
if (!root.ok) {
|
|
660
|
+
addCheck(
|
|
661
|
+
report,
|
|
662
|
+
"git-repository",
|
|
663
|
+
"warning",
|
|
664
|
+
"La bóveda no pertenece a un repositorio Git."
|
|
665
|
+
);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
addCheck(
|
|
670
|
+
report,
|
|
671
|
+
"git-repository",
|
|
672
|
+
"pass",
|
|
673
|
+
"Repositorio Git detectado.",
|
|
674
|
+
[root.stdout]
|
|
675
|
+
);
|
|
676
|
+
|
|
677
|
+
const status = runGit(vaultPath, ["status", "--porcelain"]);
|
|
678
|
+
if (status.ok && status.stdout) {
|
|
679
|
+
addCheck(
|
|
680
|
+
report,
|
|
681
|
+
"git-cleanliness",
|
|
682
|
+
"warning",
|
|
683
|
+
"La bóveda tiene cambios locales.",
|
|
684
|
+
status.stdout.split("\n")
|
|
685
|
+
);
|
|
686
|
+
} else {
|
|
687
|
+
addCheck(
|
|
688
|
+
report,
|
|
689
|
+
"git-cleanliness",
|
|
690
|
+
"pass",
|
|
691
|
+
"El árbol de trabajo está limpio."
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const remotes = runGit(vaultPath, ["remote"]);
|
|
696
|
+
if (!remotes.ok || !remotes.stdout) {
|
|
697
|
+
addCheck(
|
|
698
|
+
report,
|
|
699
|
+
"git-remote",
|
|
700
|
+
"warning",
|
|
701
|
+
"No hay un remoto Git configurado."
|
|
702
|
+
);
|
|
703
|
+
} else {
|
|
704
|
+
addCheck(
|
|
705
|
+
report,
|
|
706
|
+
"git-remote",
|
|
707
|
+
"pass",
|
|
708
|
+
"Existe al menos un remoto Git.",
|
|
709
|
+
remotes.stdout.split("\n")
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const upstream = runGit(vaultPath, [
|
|
714
|
+
"rev-parse",
|
|
715
|
+
"--abbrev-ref",
|
|
716
|
+
"--symbolic-full-name",
|
|
717
|
+
"@{upstream}"
|
|
718
|
+
]);
|
|
719
|
+
|
|
720
|
+
if (!upstream.ok) {
|
|
721
|
+
addCheck(
|
|
722
|
+
report,
|
|
723
|
+
"git-upstream",
|
|
724
|
+
"warning",
|
|
725
|
+
"La rama actual no tiene upstream configurado."
|
|
726
|
+
);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const divergence = runGit(vaultPath, [
|
|
731
|
+
"rev-list",
|
|
732
|
+
"--left-right",
|
|
733
|
+
"--count",
|
|
734
|
+
"HEAD...@{upstream}"
|
|
735
|
+
]);
|
|
736
|
+
|
|
737
|
+
if (!divergence.ok) {
|
|
738
|
+
addCheck(
|
|
739
|
+
report,
|
|
740
|
+
"git-upstream",
|
|
741
|
+
"warning",
|
|
742
|
+
"No se pudo comparar la rama actual con su upstream."
|
|
743
|
+
);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const [ahead = "0", behind = "0"] = divergence.stdout.split(/\s+/);
|
|
748
|
+
const level = behind === "0" ? "pass" : "warning";
|
|
749
|
+
addCheck(
|
|
750
|
+
report,
|
|
751
|
+
"git-upstream",
|
|
752
|
+
level,
|
|
753
|
+
behind === "0"
|
|
754
|
+
? "La rama local no está detrás de su upstream conocido."
|
|
755
|
+
: "La rama local está detrás de su upstream conocido.",
|
|
756
|
+
[`ahead=${ahead}`, `behind=${behind}`]
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function runGit(directory, args) {
|
|
761
|
+
try {
|
|
762
|
+
// Diagnostic status must not refresh the index or acquire optional locks.
|
|
763
|
+
const stdout = execFileSync("git", ["--no-optional-locks", "-c", "core.fsmonitor=false", "-C", directory, ...args], {
|
|
764
|
+
encoding: "utf8",
|
|
765
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
766
|
+
}).trim();
|
|
767
|
+
return { ok: true, stdout };
|
|
768
|
+
} catch {
|
|
769
|
+
return { ok: false, stdout: "" };
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function normalizeRelativePath(value) {
|
|
774
|
+
return value.split(path.sep).join("/").replace(/^\.\//, "");
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function relativeDisplay(rootPath, filePath) {
|
|
778
|
+
return normalizeRelativePath(path.relative(rootPath, filePath));
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function isDirectory(candidate) {
|
|
782
|
+
try {
|
|
783
|
+
return fs.statSync(candidate).isDirectory();
|
|
784
|
+
} catch {
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function isFile(candidate) {
|
|
790
|
+
try {
|
|
791
|
+
return fs.statSync(candidate).isFile();
|
|
792
|
+
} catch {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
}
|