memory-journal-mcp 8.0.1 → 9.1.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/README.md +278 -353
- package/dist/audit/audit-logger.d.ts +89 -0
- package/dist/audit/audit-logger.d.ts.map +1 -0
- package/dist/audit/audit-resource.d.ts +28 -0
- package/dist/audit/audit-resource.d.ts.map +1 -0
- package/dist/audit/index.d.ts +12 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/interceptor.d.ts +44 -0
- package/dist/audit/interceptor.d.ts.map +1 -0
- package/dist/audit/types.d.ts +68 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/auth/auth-context.d.ts +42 -0
- package/dist/auth/auth-context.d.ts.map +1 -0
- package/dist/auth/authorization-server-discovery.d.ts +90 -0
- package/dist/auth/authorization-server-discovery.d.ts.map +1 -0
- package/dist/auth/errors.d.ts +90 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/index.d.ts +16 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/middleware.d.ts +77 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/oauth-resource-server.d.ts +73 -0
- package/dist/auth/oauth-resource-server.d.ts.map +1 -0
- package/dist/auth/scope-map.d.ts +14 -0
- package/dist/auth/scope-map.d.ts.map +1 -0
- package/dist/auth/scopes.d.ts +112 -0
- package/dist/auth/scopes.d.ts.map +1 -0
- package/dist/auth/token-validator.d.ts +64 -0
- package/dist/auth/token-validator.d.ts.map +1 -0
- package/dist/auth/transport-agnostic.d.ts +47 -0
- package/dist/auth/transport-agnostic.d.ts.map +1 -0
- package/dist/auth/types.d.ts +256 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/validation.d.ts +15 -0
- package/dist/auth/validation.d.ts.map +1 -0
- package/dist/chunk-4FZCHFB5.js +216 -0
- package/dist/chunk-D2FY6XS5.js +313 -0
- package/dist/chunk-E6IQP6PE.js +252 -0
- package/dist/chunk-FZLB6NAV.js +746 -0
- package/dist/chunk-LE6ZWUPK.js +2667 -0
- package/dist/chunk-SGJU2DHU.js +2102 -0
- package/dist/chunk-T7SROBBV.js +34066 -0
- package/dist/chunk-Y6MMKR2Z.js +3766 -0
- package/dist/cli/commands/admin.d.ts +123 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/analytics.d.ts +21 -0
- package/dist/cli/commands/analytics.d.ts.map +1 -0
- package/dist/cli/commands/entry-payload.d.ts +38 -0
- package/dist/cli/commands/entry-payload.d.ts.map +1 -0
- package/dist/cli/commands/entry.d.ts +130 -0
- package/dist/cli/commands/entry.d.ts.map +1 -0
- package/dist/cli/commands/exec.d.ts +31 -0
- package/dist/cli/commands/exec.d.ts.map +1 -0
- package/dist/cli/commands/io.d.ts +76 -0
- package/dist/cli/commands/io.d.ts.map +1 -0
- package/dist/cli/commands/project.d.ts +6 -0
- package/dist/cli/commands/project.d.ts.map +1 -0
- package/dist/cli/commands/search.d.ts +30 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/serve.d.ts +84 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/visualize.d.ts +20 -0
- package/dist/cli/commands/visualize.d.ts.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/option-groups.d.ts +18 -0
- package/dist/cli/option-groups.d.ts.map +1 -0
- package/dist/cli/program.d.ts +7 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/schemas.d.ts +648 -0
- package/dist/cli/schemas.d.ts.map +1 -0
- package/dist/cli/server-options-builder.d.ts +13 -0
- package/dist/cli/server-options-builder.d.ts.map +1 -0
- package/dist/cli.js +9 -433
- package/dist/codemode/api/git-api.d.ts +9 -0
- package/dist/codemode/api/git-api.d.ts.map +1 -0
- package/dist/codemode/api/group-factory.d.ts +30 -0
- package/dist/codemode/api/group-factory.d.ts.map +1 -0
- package/dist/codemode/api/index.d.ts +10 -0
- package/dist/codemode/api/index.d.ts.map +1 -0
- package/dist/codemode/api/journal-api.d.ts +39 -0
- package/dist/codemode/api/journal-api.d.ts.map +1 -0
- package/dist/codemode/api/key-normalizer.d.ts +8 -0
- package/dist/codemode/api/key-normalizer.d.ts.map +1 -0
- package/dist/codemode/api/param-normalizer.d.ts +15 -0
- package/dist/codemode/api/param-normalizer.d.ts.map +1 -0
- package/dist/codemode/api/project-registry-ops.d.ts +26 -0
- package/dist/codemode/api/project-registry-ops.d.ts.map +1 -0
- package/dist/codemode/api/sandbox-bindings.d.ts +25 -0
- package/dist/codemode/api/sandbox-bindings.d.ts.map +1 -0
- package/dist/codemode/api/types.d.ts +21 -0
- package/dist/codemode/api/types.d.ts.map +1 -0
- package/dist/codemode/api-constants.d.ts +6 -0
- package/dist/codemode/api-constants.d.ts.map +1 -0
- package/dist/codemode/auto-return.d.ts +25 -0
- package/dist/codemode/auto-return.d.ts.map +1 -0
- package/dist/codemode/constants/examples-and-params.d.ts +31 -0
- package/dist/codemode/constants/examples-and-params.d.ts.map +1 -0
- package/dist/codemode/constants/method-aliases.d.ts +8 -0
- package/dist/codemode/constants/method-aliases.d.ts.map +1 -0
- package/dist/codemode/index.d.ts +12 -0
- package/dist/codemode/index.d.ts.map +1 -0
- package/dist/codemode/normalizers/domain-tool-interceptions.d.ts +6 -0
- package/dist/codemode/normalizers/domain-tool-interceptions.d.ts.map +1 -0
- package/dist/codemode/normalizers/entry-and-search-interceptions.d.ts +6 -0
- package/dist/codemode/normalizers/entry-and-search-interceptions.d.ts.map +1 -0
- package/dist/codemode/normalizers/generic-interceptions.d.ts +6 -0
- package/dist/codemode/normalizers/generic-interceptions.d.ts.map +1 -0
- package/dist/codemode/normalizers/github-and-backup-interceptions.d.ts +6 -0
- package/dist/codemode/normalizers/github-and-backup-interceptions.d.ts.map +1 -0
- package/dist/codemode/normalizers/shared-utils.d.ts +31 -0
- package/dist/codemode/normalizers/shared-utils.d.ts.map +1 -0
- package/dist/codemode/param-normalizer.d.ts +11 -0
- package/dist/codemode/param-normalizer.d.ts.map +1 -0
- package/dist/codemode/proxy-helpers.d.ts +34 -0
- package/dist/codemode/proxy-helpers.d.ts.map +1 -0
- package/dist/codemode/proxy-namespaces.d.ts +30 -0
- package/dist/codemode/proxy-namespaces.d.ts.map +1 -0
- package/dist/codemode/sandbox-factory.d.ts +52 -0
- package/dist/codemode/sandbox-factory.d.ts.map +1 -0
- package/dist/codemode/security.d.ts +54 -0
- package/dist/codemode/security.d.ts.map +1 -0
- package/dist/codemode/type-generator.d.ts +11 -0
- package/dist/codemode/type-generator.d.ts.map +1 -0
- package/dist/codemode/types.d.ts +165 -0
- package/dist/codemode/types.d.ts.map +1 -0
- package/dist/codemode/worker/mj-shim-domains.d.ts +15 -0
- package/dist/codemode/worker/mj-shim-domains.d.ts.map +1 -0
- package/dist/codemode/worker/mj-shim-proxy.d.ts +18 -0
- package/dist/codemode/worker/mj-shim-proxy.d.ts.map +1 -0
- package/dist/codemode/worker/namespace-shims.d.ts +32 -0
- package/dist/codemode/worker/namespace-shims.d.ts.map +1 -0
- package/dist/codemode/worker/node-shims.d.ts +65 -0
- package/dist/codemode/worker/node-shims.d.ts.map +1 -0
- package/dist/codemode/worker/prototype-hardening.d.ts +18 -0
- package/dist/codemode/worker/prototype-hardening.d.ts.map +1 -0
- package/dist/codemode/worker/result-compactor.d.ts +20 -0
- package/dist/codemode/worker/result-compactor.d.ts.map +1 -0
- package/dist/codemode/worker/sandbox-globals.d.ts +19 -0
- package/dist/codemode/worker/sandbox-globals.d.ts.map +1 -0
- package/dist/codemode/worker-api-proxy.d.ts +12 -0
- package/dist/codemode/worker-api-proxy.d.ts.map +1 -0
- package/dist/codemode/worker-result-proxy.d.ts +12 -0
- package/dist/codemode/worker-result-proxy.d.ts.map +1 -0
- package/dist/codemode/worker-sandbox.d.ts +58 -0
- package/dist/codemode/worker-sandbox.d.ts.map +1 -0
- package/dist/codemode/worker-script.d.ts +9 -0
- package/dist/codemode/worker-script.d.ts.map +1 -0
- package/dist/constants/icons.d.ts +58 -0
- package/dist/constants/icons.d.ts.map +1 -0
- package/dist/constants/instructions/admin.d.ts +2 -0
- package/dist/constants/instructions/admin.d.ts.map +1 -0
- package/dist/constants/instructions/analytics.d.ts +2 -0
- package/dist/constants/instructions/analytics.d.ts.map +1 -0
- package/dist/constants/instructions/backup.d.ts +2 -0
- package/dist/constants/instructions/backup.d.ts.map +1 -0
- package/dist/constants/instructions/base.d.ts +3 -0
- package/dist/constants/instructions/base.d.ts.map +1 -0
- package/dist/constants/instructions/codemode.d.ts +2 -0
- package/dist/constants/instructions/codemode.d.ts.map +1 -0
- package/dist/constants/instructions/core.d.ts +2 -0
- package/dist/constants/instructions/core.d.ts.map +1 -0
- package/dist/constants/instructions/git.d.ts +2 -0
- package/dist/constants/instructions/git.d.ts.map +1 -0
- package/dist/constants/instructions/github.d.ts +2 -0
- package/dist/constants/instructions/github.d.ts.map +1 -0
- package/dist/constants/instructions/gotchas.d.ts +2 -0
- package/dist/constants/instructions/gotchas.d.ts.map +1 -0
- package/dist/constants/instructions/io.d.ts +2 -0
- package/dist/constants/instructions/io.d.ts.map +1 -0
- package/dist/constants/instructions/relationships.d.ts +2 -0
- package/dist/constants/instructions/relationships.d.ts.map +1 -0
- package/dist/constants/instructions/search.d.ts +2 -0
- package/dist/constants/instructions/search.d.ts.map +1 -0
- package/dist/constants/instructions/team.d.ts +2 -0
- package/dist/constants/instructions/team.d.ts.map +1 -0
- package/dist/constants/instructions/templates.d.ts +2 -0
- package/dist/constants/instructions/templates.d.ts.map +1 -0
- package/dist/constants/server-instructions.d.ts +64 -0
- package/dist/constants/server-instructions.d.ts.map +1 -0
- package/dist/database/adapter-factory.d.ts +9 -0
- package/dist/database/adapter-factory.d.ts.map +1 -0
- package/dist/database/core/DatabaseAdapterProxy.d.ts +5 -0
- package/dist/database/core/DatabaseAdapterProxy.d.ts.map +1 -0
- package/dist/database/core/interfaces.d.ts +455 -0
- package/dist/database/core/interfaces.d.ts.map +1 -0
- package/dist/database/migrations/001-init.d.ts +3 -0
- package/dist/database/migrations/001-init.d.ts.map +1 -0
- package/dist/database/migrations/002-add-significance-and-context.d.ts +3 -0
- package/dist/database/migrations/002-add-significance-and-context.d.ts.map +1 -0
- package/dist/database/migrations/003-add-deleted-and-archived.d.ts +3 -0
- package/dist/database/migrations/003-add-deleted-and-archived.d.ts.map +1 -0
- package/dist/database/migrations/004-add-github-and-workflow-integration.d.ts +3 -0
- package/dist/database/migrations/004-add-github-and-workflow-integration.d.ts.map +1 -0
- package/dist/database/migrations/005-add-entry-revisions.d.ts +3 -0
- package/dist/database/migrations/005-add-entry-revisions.d.ts.map +1 -0
- package/dist/database/migrations/006-add-analytics-snapshots.d.ts +3 -0
- package/dist/database/migrations/006-add-analytics-snapshots.d.ts.map +1 -0
- package/dist/database/migrations/007-add-team-author.d.ts +3 -0
- package/dist/database/migrations/007-add-team-author.d.ts.map +1 -0
- package/dist/database/migrations/008-add-team-members.d.ts +3 -0
- package/dist/database/migrations/008-add-team-members.d.ts.map +1 -0
- package/dist/database/migrations/009-add-entry-version.d.ts +3 -0
- package/dist/database/migrations/009-add-entry-version.d.ts.map +1 -0
- package/dist/database/migrations/010-add-author-aliases.d.ts +3 -0
- package/dist/database/migrations/010-add-author-aliases.d.ts.map +1 -0
- package/dist/database/migrations/011-add-workspace-id.d.ts +3 -0
- package/dist/database/migrations/011-add-workspace-id.d.ts.map +1 -0
- package/dist/database/migrations/012-add-trust-and-anchors.d.ts +3 -0
- package/dist/database/migrations/012-add-trust-and-anchors.d.ts.map +1 -0
- package/dist/database/migrations/013-add-session-id.d.ts +3 -0
- package/dist/database/migrations/013-add-session-id.d.ts.map +1 -0
- package/dist/database/migrations/migration-list.d.ts +3 -0
- package/dist/database/migrations/migration-list.d.ts.map +1 -0
- package/dist/database/migrations/migration-manager.d.ts +14 -0
- package/dist/database/migrations/migration-manager.d.ts.map +1 -0
- package/dist/database/migrations/migration.d.ts +23 -0
- package/dist/database/migrations/migration.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/adapter-delegates.d.ts +161 -0
- package/dist/database/sqlite-adapter/adapter-delegates.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/aliases.d.ts +14 -0
- package/dist/database/sqlite-adapter/aliases.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/backup.d.ts +27 -0
- package/dist/database/sqlite-adapter/backup.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/database-adapter.d.ts +192 -0
- package/dist/database/sqlite-adapter/database-adapter.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/anchors.d.ts +9 -0
- package/dist/database/sqlite-adapter/entries/anchors.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/crud-read.d.ts +16 -0
- package/dist/database/sqlite-adapter/entries/crud-read.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/crud-write.d.ts +62 -0
- package/dist/database/sqlite-adapter/entries/crud-write.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/crud.d.ts +4 -0
- package/dist/database/sqlite-adapter/entries/crud.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/digest.d.ts +60 -0
- package/dist/database/sqlite-adapter/entries/digest.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/fuzzy-matcher.d.ts +27 -0
- package/dist/database/sqlite-adapter/entries/fuzzy-matcher.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/importance.d.ts +38 -0
- package/dist/database/sqlite-adapter/entries/importance.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/index.d.ts +186 -0
- package/dist/database/sqlite-adapter/entries/index.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/revisions.d.ts +16 -0
- package/dist/database/sqlite-adapter/entries/revisions.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/cursor.d.ts +15 -0
- package/dist/database/sqlite-adapter/entries/search/cursor.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/date-and-pagination.d.ts +37 -0
- package/dist/database/sqlite-adapter/entries/search/date-and-pagination.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/entity-lookups.d.ts +31 -0
- package/dist/database/sqlite-adapter/entries/search/entity-lookups.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/fts-and-hybrid.d.ts +44 -0
- package/dist/database/sqlite-adapter/entries/search/fts-and-hybrid.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/fts-sanitizer.d.ts +15 -0
- package/dist/database/sqlite-adapter/entries/search/fts-sanitizer.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/index.d.ts +8 -0
- package/dist/database/sqlite-adapter/entries/search/index.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/search/query.d.ts +4 -0
- package/dist/database/sqlite-adapter/entries/search/query.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/shared.d.ts +39 -0
- package/dist/database/sqlite-adapter/entries/shared.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/entries/statistics.d.ts +3 -0
- package/dist/database/sqlite-adapter/entries/statistics.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/health-operations.d.ts +10 -0
- package/dist/database/sqlite-adapter/health-operations.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/index.d.ts +2 -0
- package/dist/database/sqlite-adapter/index.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/insights/cross-project.d.ts +42 -0
- package/dist/database/sqlite-adapter/insights/cross-project.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/insights/entry-digest-queries.d.ts +17 -0
- package/dist/database/sqlite-adapter/insights/entry-digest-queries.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/insights/team-collaboration.d.ts +29 -0
- package/dist/database/sqlite-adapter/insights/team-collaboration.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/insights-operations.d.ts +47 -0
- package/dist/database/sqlite-adapter/insights-operations.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/lifecycle-operations.d.ts +32 -0
- package/dist/database/sqlite-adapter/lifecycle-operations.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/members.d.ts +23 -0
- package/dist/database/sqlite-adapter/members.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/native-connection.d.ts +46 -0
- package/dist/database/sqlite-adapter/native-connection.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/relationships.d.ts +26 -0
- package/dist/database/sqlite-adapter/relationships.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/tags.d.ts +16 -0
- package/dist/database/sqlite-adapter/tags.d.ts.map +1 -0
- package/dist/database/sqlite-adapter/vector-operations.d.ts +24 -0
- package/dist/database/sqlite-adapter/vector-operations.d.ts.map +1 -0
- package/dist/errors-MHAM6AKR.js +1 -0
- package/dist/filtering/tool-constants.d.ts +33 -0
- package/dist/filtering/tool-constants.d.ts.map +1 -0
- package/dist/filtering/tool-filter.d.ts +65 -0
- package/dist/filtering/tool-filter.d.ts.map +1 -0
- package/dist/fts-YHUVPPYF.js +2 -0
- package/dist/github/commit-references/enricher.d.ts +12 -0
- package/dist/github/commit-references/enricher.d.ts.map +1 -0
- package/dist/github/commit-references/index.d.ts +4 -0
- package/dist/github/commit-references/index.d.ts.map +1 -0
- package/dist/github/commit-references/parser.d.ts +10 -0
- package/dist/github/commit-references/parser.d.ts.map +1 -0
- package/dist/github/commit-references/resolver.d.ts +14 -0
- package/dist/github/commit-references/resolver.d.ts.map +1 -0
- package/dist/github/github-integration/client.d.ts +29 -0
- package/dist/github/github-integration/client.d.ts.map +1 -0
- package/dist/github/github-integration/index.d.ts +83 -0
- package/dist/github/github-integration/index.d.ts.map +1 -0
- package/dist/github/github-integration/insights.d.ts +11 -0
- package/dist/github/github-integration/insights.d.ts.map +1 -0
- package/dist/github/github-integration/issues.d.ts +25 -0
- package/dist/github/github-integration/issues.d.ts.map +1 -0
- package/dist/github/github-integration/milestones.d.ts +20 -0
- package/dist/github/github-integration/milestones.d.ts.map +1 -0
- package/dist/github/github-integration/projects.d.ts +21 -0
- package/dist/github/github-integration/projects.d.ts.map +1 -0
- package/dist/github/github-integration/pull-requests.d.ts +16 -0
- package/dist/github/github-integration/pull-requests.d.ts.map +1 -0
- package/dist/github/github-integration/repository.d.ts +14 -0
- package/dist/github/github-integration/repository.d.ts.map +1 -0
- package/dist/github/github-integration/types.d.ts +77 -0
- package/dist/github/github-integration/types.d.ts.map +1 -0
- package/dist/handlers/prompts/adversarial-helpers.d.ts +75 -0
- package/dist/handlers/prompts/adversarial-helpers.d.ts.map +1 -0
- package/dist/handlers/prompts/adversarial.d.ts +13 -0
- package/dist/handlers/prompts/adversarial.d.ts.map +1 -0
- package/dist/handlers/prompts/analytics.d.ts +12 -0
- package/dist/handlers/prompts/analytics.d.ts.map +1 -0
- package/dist/handlers/prompts/cms-supervisor.d.ts +8 -0
- package/dist/handlers/prompts/cms-supervisor.d.ts.map +1 -0
- package/dist/handlers/prompts/git.d.ts +8 -0
- package/dist/handlers/prompts/git.d.ts.map +1 -0
- package/dist/handlers/prompts/github.d.ts +12 -0
- package/dist/handlers/prompts/github.d.ts.map +1 -0
- package/dist/handlers/prompts/index.d.ts +53 -0
- package/dist/handlers/prompts/index.d.ts.map +1 -0
- package/dist/handlers/prompts/load-briefing.d.ts +3 -0
- package/dist/handlers/prompts/load-briefing.d.ts.map +1 -0
- package/dist/handlers/prompts/optimizer.d.ts +8 -0
- package/dist/handlers/prompts/optimizer.d.ts.map +1 -0
- package/dist/handlers/prompts/workflow.d.ts +15 -0
- package/dist/handlers/prompts/workflow.d.ts.map +1 -0
- package/dist/handlers/resources/core/agent-context.d.ts +4 -0
- package/dist/handlers/resources/core/agent-context.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/context-section.d.ts +57 -0
- package/dist/handlers/resources/core/briefing/context-section.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/github-repo-and-kanban.d.ts +57 -0
- package/dist/handlers/resources/core/briefing/github-repo-and-kanban.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/github-section.d.ts +88 -0
- package/dist/handlers/resources/core/briefing/github-section.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/index.d.ts +11 -0
- package/dist/handlers/resources/core/briefing/index.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/insights-section.d.ts +35 -0
- package/dist/handlers/resources/core/briefing/insights-section.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/system-section.d.ts +85 -0
- package/dist/handlers/resources/core/briefing/system-section.d.ts.map +1 -0
- package/dist/handlers/resources/core/briefing/user-message.d.ts +46 -0
- package/dist/handlers/resources/core/briefing/user-message.d.ts.map +1 -0
- package/dist/handlers/resources/core/health.d.ts +3 -0
- package/dist/handlers/resources/core/health.d.ts.map +1 -0
- package/dist/handlers/resources/core/index.d.ts +6 -0
- package/dist/handlers/resources/core/index.d.ts.map +1 -0
- package/dist/handlers/resources/core/instructions.d.ts +3 -0
- package/dist/handlers/resources/core/instructions.d.ts.map +1 -0
- package/dist/handlers/resources/core/metrics-resource.d.ts +23 -0
- package/dist/handlers/resources/core/metrics-resource.d.ts.map +1 -0
- package/dist/handlers/resources/core/utilities.d.ts +7 -0
- package/dist/handlers/resources/core/utilities.d.ts.map +1 -0
- package/dist/handlers/resources/github.d.ts +11 -0
- package/dist/handlers/resources/github.d.ts.map +1 -0
- package/dist/handlers/resources/graph.d.ts +12 -0
- package/dist/handlers/resources/graph.d.ts.map +1 -0
- package/dist/handlers/resources/help.d.ts +39 -0
- package/dist/handlers/resources/help.d.ts.map +1 -0
- package/dist/handlers/resources/index.d.ts +37 -0
- package/dist/handlers/resources/index.d.ts.map +1 -0
- package/dist/handlers/resources/insights.d.ts +16 -0
- package/dist/handlers/resources/insights.d.ts.map +1 -0
- package/dist/handlers/resources/shared.d.ts +136 -0
- package/dist/handlers/resources/shared.d.ts.map +1 -0
- package/dist/handlers/resources/staleness.d.ts +3 -0
- package/dist/handlers/resources/staleness.d.ts.map +1 -0
- package/dist/handlers/resources/team.d.ts +6 -0
- package/dist/handlers/resources/team.d.ts.map +1 -0
- package/dist/handlers/resources/templates.d.ts +13 -0
- package/dist/handlers/resources/templates.d.ts.map +1 -0
- package/dist/handlers/resources/tools-catalog.d.ts +3 -0
- package/dist/handlers/resources/tools-catalog.d.ts.map +1 -0
- package/dist/handlers/tools/admin/batch-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/batch-tools.d.ts.map +1 -0
- package/dist/handlers/tools/admin/core-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/core-tools.d.ts.map +1 -0
- package/dist/handlers/tools/admin/index.d.ts +3 -0
- package/dist/handlers/tools/admin/index.d.ts.map +1 -0
- package/dist/handlers/tools/admin/lifecycle-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/lifecycle-tools.d.ts.map +1 -0
- package/dist/handlers/tools/admin/misc-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/misc-tools.d.ts.map +1 -0
- package/dist/handlers/tools/admin/project-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/project-tools.d.ts.map +1 -0
- package/dist/handlers/tools/admin/schemas/crud-batch-schemas.d.ts +609 -0
- package/dist/handlers/tools/admin/schemas/crud-batch-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/admin/schemas/project-and-ops-schemas.d.ts +136 -0
- package/dist/handlers/tools/admin/schemas/project-and-ops-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/admin/schemas.d.ts +3 -0
- package/dist/handlers/tools/admin/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/admin/update_configuration.d.ts +36 -0
- package/dist/handlers/tools/admin/update_configuration.d.ts.map +1 -0
- package/dist/handlers/tools/admin/vector-tools.d.ts +3 -0
- package/dist/handlers/tools/admin/vector-tools.d.ts.map +1 -0
- package/dist/handlers/tools/analytics.d.ts +8 -0
- package/dist/handlers/tools/analytics.d.ts.map +1 -0
- package/dist/handlers/tools/arg-interceptions.d.ts +51 -0
- package/dist/handlers/tools/arg-interceptions.d.ts.map +1 -0
- package/dist/handlers/tools/backup.d.ts +8 -0
- package/dist/handlers/tools/backup.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/code-healer.d.ts +11 -0
- package/dist/handlers/tools/codemode/code-healer.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/handler.d.ts +7 -0
- package/dist/handlers/tools/codemode/handler.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/index.d.ts +2 -0
- package/dist/handlers/tools/codemode/index.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/json-entry-recovery.d.ts +13 -0
- package/dist/handlers/tools/codemode/json-entry-recovery.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/payload-synthesizer.d.ts +17 -0
- package/dist/handlers/tools/codemode/payload-synthesizer.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/schemas.d.ts +77 -0
- package/dist/handlers/tools/codemode/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/secure-dispatcher.d.ts +25 -0
- package/dist/handlers/tools/codemode/secure-dispatcher.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/singleton-state.d.ts +11 -0
- package/dist/handlers/tools/codemode/singleton-state.d.ts.map +1 -0
- package/dist/handlers/tools/codemode/sql-recovery.d.ts +14 -0
- package/dist/handlers/tools/codemode/sql-recovery.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing/alias-catalog.d.ts +21 -0
- package/dist/handlers/tools/core/dummy-healing/alias-catalog.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing/entry-fallbacks.d.ts +4 -0
- package/dist/handlers/tools/core/dummy-healing/entry-fallbacks.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing/fs-fallbacks.d.ts +19 -0
- package/dist/handlers/tools/core/dummy-healing/fs-fallbacks.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing/index.d.ts +7 -0
- package/dist/handlers/tools/core/dummy-healing/index.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing/mcp-fallbacks.d.ts +12 -0
- package/dist/handlers/tools/core/dummy-healing/mcp-fallbacks.d.ts.map +1 -0
- package/dist/handlers/tools/core/dummy-healing.d.ts +2 -0
- package/dist/handlers/tools/core/dummy-healing.d.ts.map +1 -0
- package/dist/handlers/tools/core/index.d.ts +5 -0
- package/dist/handlers/tools/core/index.d.ts.map +1 -0
- package/dist/handlers/tools/core/schemas.d.ts +417 -0
- package/dist/handlers/tools/core/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/core/staleness-tools.d.ts +33 -0
- package/dist/handlers/tools/core/staleness-tools.d.ts.map +1 -0
- package/dist/handlers/tools/core/tools.d.ts +3 -0
- package/dist/handlers/tools/core/tools.d.ts.map +1 -0
- package/dist/handlers/tools/error-fields-mixin.d.ts +10 -0
- package/dist/handlers/tools/error-fields-mixin.d.ts.map +1 -0
- package/dist/handlers/tools/git.d.ts +62 -0
- package/dist/handlers/tools/git.d.ts.map +1 -0
- package/dist/handlers/tools/github/close-issue-tool.d.ts +6 -0
- package/dist/handlers/tools/github/close-issue-tool.d.ts.map +1 -0
- package/dist/handlers/tools/github/copilot-tools.d.ts +8 -0
- package/dist/handlers/tools/github/copilot-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/create-issue-tool.d.ts +6 -0
- package/dist/handlers/tools/github/create-issue-tool.d.ts.map +1 -0
- package/dist/handlers/tools/github/helpers.d.ts +38 -0
- package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
- package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/issue-tools.d.ts +11 -0
- package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/read-tools.d.ts +8 -0
- package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/schemas.d.ts +823 -0
- package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/github.d.ts +15 -0
- package/dist/handlers/tools/github.d.ts.map +1 -0
- package/dist/handlers/tools/index.d.ts +29 -0
- package/dist/handlers/tools/index.d.ts.map +1 -0
- package/dist/handlers/tools/io/index.d.ts +2 -0
- package/dist/handlers/tools/io/index.d.ts.map +1 -0
- package/dist/handlers/tools/io/schemas.d.ts +291 -0
- package/dist/handlers/tools/io/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/io/tools.d.ts +3 -0
- package/dist/handlers/tools/io/tools.d.ts.map +1 -0
- package/dist/handlers/tools/relationships.d.ts +8 -0
- package/dist/handlers/tools/relationships.d.ts.map +1 -0
- package/dist/handlers/tools/schemas/constants-and-primitives.d.ts +53 -0
- package/dist/handlers/tools/schemas/constants-and-primitives.d.ts.map +1 -0
- package/dist/handlers/tools/schemas/hallucination-healer.d.ts +8 -0
- package/dist/handlers/tools/schemas/hallucination-healer.d.ts.map +1 -0
- package/dist/handlers/tools/schemas/output-schemas.d.ts +247 -0
- package/dist/handlers/tools/schemas/output-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/schemas.d.ts +7 -0
- package/dist/handlers/tools/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/search/auto.d.ts +38 -0
- package/dist/handlers/tools/search/auto.d.ts.map +1 -0
- package/dist/handlers/tools/search/cross-team.d.ts +132 -0
- package/dist/handlers/tools/search/cross-team.d.ts.map +1 -0
- package/dist/handlers/tools/search/date-range-search.d.ts +3 -0
- package/dist/handlers/tools/search/date-range-search.d.ts.map +1 -0
- package/dist/handlers/tools/search/fts.d.ts +50 -0
- package/dist/handlers/tools/search/fts.d.ts.map +1 -0
- package/dist/handlers/tools/search/helpers.d.ts +52 -0
- package/dist/handlers/tools/search/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/search/hybrid.d.ts +45 -0
- package/dist/handlers/tools/search/hybrid.d.ts.map +1 -0
- package/dist/handlers/tools/search/index.d.ts +3 -0
- package/dist/handlers/tools/search/index.d.ts.map +1 -0
- package/dist/handlers/tools/search/misc-tools.d.ts +3 -0
- package/dist/handlers/tools/search/misc-tools.d.ts.map +1 -0
- package/dist/handlers/tools/search/schemas.d.ts +352 -0
- package/dist/handlers/tools/search/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/search/search-entries.d.ts +3 -0
- package/dist/handlers/tools/search/search-entries.d.ts.map +1 -0
- package/dist/handlers/tools/search/semantic-search.d.ts +3 -0
- package/dist/handlers/tools/search/semantic-search.d.ts.map +1 -0
- package/dist/handlers/tools/team/admin-tools/batch.d.ts +8 -0
- package/dist/handlers/tools/team/admin-tools/batch.d.ts.map +1 -0
- package/dist/handlers/tools/team/admin-tools/crud.d.ts +8 -0
- package/dist/handlers/tools/team/admin-tools/crud.d.ts.map +1 -0
- package/dist/handlers/tools/team/admin-tools/index.d.ts +9 -0
- package/dist/handlers/tools/team/admin-tools/index.d.ts.map +1 -0
- package/dist/handlers/tools/team/alias-tools.d.ts +3 -0
- package/dist/handlers/tools/team/alias-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/analytics-tools.d.ts +8 -0
- package/dist/handlers/tools/team/analytics-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/backup-tools.d.ts +8 -0
- package/dist/handlers/tools/team/backup-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/core-tools.d.ts +8 -0
- package/dist/handlers/tools/team/core-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/export-tools.d.ts +8 -0
- package/dist/handlers/tools/team/export-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/helpers.d.ts +30 -0
- package/dist/handlers/tools/team/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/team/index.d.ts +31 -0
- package/dist/handlers/tools/team/index.d.ts.map +1 -0
- package/dist/handlers/tools/team/io-tools.d.ts +11 -0
- package/dist/handlers/tools/team/io-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/member-tools.d.ts +8 -0
- package/dist/handlers/tools/team/member-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/rbac.d.ts +28 -0
- package/dist/handlers/tools/team/rbac.d.ts.map +1 -0
- package/dist/handlers/tools/team/relationship-tools.d.ts +8 -0
- package/dist/handlers/tools/team/relationship-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/schemas/admin-batch-schemas.d.ts +618 -0
- package/dist/handlers/tools/team/schemas/admin-batch-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/team/schemas/analytics-vector-schemas.d.ts +464 -0
- package/dist/handlers/tools/team/schemas/analytics-vector-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/team/schemas/core-search-schemas.d.ts +525 -0
- package/dist/handlers/tools/team/schemas/core-search-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/team/schemas/io-backup-schemas.d.ts +419 -0
- package/dist/handlers/tools/team/schemas/io-backup-schemas.d.ts.map +1 -0
- package/dist/handlers/tools/team/schemas.d.ts +8 -0
- package/dist/handlers/tools/team/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/team/search-tools.d.ts +8 -0
- package/dist/handlers/tools/team/search-tools.d.ts.map +1 -0
- package/dist/handlers/tools/team/vector-tools.d.ts +9 -0
- package/dist/handlers/tools/team/vector-tools.d.ts.map +1 -0
- package/dist/index.d.ts +10 -823
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -13
- package/dist/markdown/converters/index.d.ts +26 -0
- package/dist/markdown/converters/index.d.ts.map +1 -0
- package/dist/markdown/converters/logseq.d.ts +14 -0
- package/dist/markdown/converters/logseq.d.ts.map +1 -0
- package/dist/markdown/converters/notion.d.ts +14 -0
- package/dist/markdown/converters/notion.d.ts.map +1 -0
- package/dist/markdown/converters/obsidian.d.ts +14 -0
- package/dist/markdown/converters/obsidian.d.ts.map +1 -0
- package/dist/markdown/converters/utils.d.ts +4 -0
- package/dist/markdown/converters/utils.d.ts.map +1 -0
- package/dist/markdown/converters/yaml-parser.d.ts +32 -0
- package/dist/markdown/converters/yaml-parser.d.ts.map +1 -0
- package/dist/markdown/exporter.d.ts +54 -0
- package/dist/markdown/exporter.d.ts.map +1 -0
- package/dist/markdown/frontmatter.d.ts +47 -0
- package/dist/markdown/frontmatter.d.ts.map +1 -0
- package/dist/markdown/importer.d.ts +81 -0
- package/dist/markdown/importer.d.ts.map +1 -0
- package/dist/markdown/index.d.ts +14 -0
- package/dist/markdown/index.d.ts.map +1 -0
- package/dist/observability/index.d.ts +19 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/interceptor.d.ts +27 -0
- package/dist/observability/interceptor.d.ts.map +1 -0
- package/dist/observability/latency-tracker.d.ts +47 -0
- package/dist/observability/latency-tracker.d.ts.map +1 -0
- package/dist/observability/metrics-server.d.ts +3 -0
- package/dist/observability/metrics-server.d.ts.map +1 -0
- package/dist/observability/metrics.d.ts +138 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/prometheus-formatter.d.ts +14 -0
- package/dist/observability/prometheus-formatter.d.ts.map +1 -0
- package/dist/observability/token-estimator.d.ts +44 -0
- package/dist/observability/token-estimator.d.ts.map +1 -0
- package/dist/security-utils-P4P6A2DG.js +2 -0
- package/dist/server/auto-prune.d.ts +48 -0
- package/dist/server/auto-prune.d.ts.map +1 -0
- package/dist/server/digest-reporter.d.ts +16 -0
- package/dist/server/digest-reporter.d.ts.map +1 -0
- package/dist/server/mcp-server/core.d.ts +3 -0
- package/dist/server/mcp-server/core.d.ts.map +1 -0
- package/dist/server/mcp-server/index.d.ts +4 -0
- package/dist/server/mcp-server/index.d.ts.map +1 -0
- package/dist/server/mcp-server/initialization.d.ts +13 -0
- package/dist/server/mcp-server/initialization.d.ts.map +1 -0
- package/dist/server/mcp-server/tool-registration/call-interceptor.d.ts +6 -0
- package/dist/server/mcp-server/tool-registration/call-interceptor.d.ts.map +1 -0
- package/dist/server/mcp-server/tool-registration/index.d.ts +4 -0
- package/dist/server/mcp-server/tool-registration/index.d.ts.map +1 -0
- package/dist/server/mcp-server/tool-registration/list-interceptor.d.ts +4 -0
- package/dist/server/mcp-server/tool-registration/list-interceptor.d.ts.map +1 -0
- package/dist/server/mcp-server/tool-registration/register-tools.d.ts +18 -0
- package/dist/server/mcp-server/tool-registration/register-tools.d.ts.map +1 -0
- package/dist/server/mcp-server/tool-registration.d.ts +2 -0
- package/dist/server/mcp-server/tool-registration.d.ts.map +1 -0
- package/dist/server/mcp-server/types.d.ts +78 -0
- package/dist/server/mcp-server/types.d.ts.map +1 -0
- package/dist/server/registration.d.ts +73 -0
- package/dist/server/registration.d.ts.map +1 -0
- package/dist/server/scheduler.d.ts +129 -0
- package/dist/server/scheduler.d.ts.map +1 -0
- package/dist/server/subscription-manager.d.ts +46 -0
- package/dist/server/subscription-manager.d.ts.map +1 -0
- package/dist/tools-BOQV7QD3.js +6 -0
- package/dist/transports/http/handlers.d.ts +25 -0
- package/dist/transports/http/handlers.d.ts.map +1 -0
- package/dist/transports/http/index.d.ts +8 -0
- package/dist/transports/http/index.d.ts.map +1 -0
- package/dist/transports/http/security.d.ts +43 -0
- package/dist/transports/http/security.d.ts.map +1 -0
- package/dist/transports/http/server/http-transport.d.ts +25 -0
- package/dist/transports/http/server/http-transport.d.ts.map +1 -0
- package/dist/transports/http/server/index.d.ts +4 -0
- package/dist/transports/http/server/index.d.ts.map +1 -0
- package/dist/transports/http/server/legacy-sse.d.ts +30 -0
- package/dist/transports/http/server/legacy-sse.d.ts.map +1 -0
- package/dist/transports/http/server/protocol-handlers.d.ts +9 -0
- package/dist/transports/http/server/protocol-handlers.d.ts.map +1 -0
- package/dist/transports/http/types.d.ts +95 -0
- package/dist/transports/http/types.d.ts.map +1 -0
- package/dist/types/auto-context.d.ts +44 -0
- package/dist/types/auto-context.d.ts.map +1 -0
- package/dist/types/entities.d.ts +180 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/error-types.d.ts +48 -0
- package/dist/types/error-types.d.ts.map +1 -0
- package/dist/types/errors.d.ts +108 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/filtering.d.ts +34 -0
- package/dist/types/filtering.d.ts.map +1 -0
- package/dist/types/github.d.ts +202 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/index.d.ts +326 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/config-manager.d.ts +24 -0
- package/dist/utils/config-manager.d.ts.map +1 -0
- package/dist/utils/config-resolver.d.ts +41 -0
- package/dist/utils/config-resolver.d.ts.map +1 -0
- package/dist/utils/error-helpers.d.ts +38 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/errors/error-response-fields.d.ts +28 -0
- package/dist/utils/errors/error-response-fields.d.ts.map +1 -0
- package/dist/utils/errors/suggestions.d.ts +29 -0
- package/dist/utils/errors/suggestions.d.ts.map +1 -0
- package/dist/utils/github-helpers.d.ts +12 -0
- package/dist/utils/github-helpers.d.ts.map +1 -0
- package/dist/utils/issue-logger.d.ts +10 -0
- package/dist/utils/issue-logger.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +30 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/maintenance-lock.d.ts +34 -0
- package/dist/utils/maintenance-lock.d.ts.map +1 -0
- package/dist/utils/mcp-logger.d.ts +73 -0
- package/dist/utils/mcp-logger.d.ts.map +1 -0
- package/dist/utils/progress-utils.d.ts +53 -0
- package/dist/utils/progress-utils.d.ts.map +1 -0
- package/dist/utils/query-helpers.d.ts +43 -0
- package/dist/utils/query-helpers.d.ts.map +1 -0
- package/dist/utils/request-context.d.ts +9 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/resource-annotations.d.ts +36 -0
- package/dist/utils/resource-annotations.d.ts.map +1 -0
- package/dist/utils/security-utils.d.ts +113 -0
- package/dist/utils/security-utils.d.ts.map +1 -0
- package/dist/utils/vector-index-helpers.d.ts +14 -0
- package/dist/utils/vector-index-helpers.d.ts.map +1 -0
- package/dist/utils/workspace-resolver.d.ts +40 -0
- package/dist/utils/workspace-resolver.d.ts.map +1 -0
- package/dist/vector/vector-search-manager/VectorSearchManagerProxy.d.ts +5 -0
- package/dist/vector/vector-search-manager/VectorSearchManagerProxy.d.ts.map +1 -0
- package/dist/vector/vector-search-manager/index.d.ts +3 -0
- package/dist/vector/vector-search-manager/index.d.ts.map +1 -0
- package/dist/vector/vector-search-manager/manager.d.ts +75 -0
- package/dist/vector/vector-search-manager/manager.d.ts.map +1 -0
- package/dist/vector/vector-search-manager/rebuild.d.ts +20 -0
- package/dist/vector/vector-search-manager/rebuild.d.ts.map +1 -0
- package/dist/vector/vector-search-manager/types.d.ts +12 -0
- package/dist/vector/vector-search-manager/types.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/agent-exec.d.ts +2 -0
- package/dist/vendor/lib-agent-exec/agent-exec.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/command-builder.d.ts +11 -0
- package/dist/vendor/lib-agent-exec/command-builder.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/command-utils.d.ts +29 -0
- package/dist/vendor/lib-agent-exec/command-utils.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/environment.d.ts +4 -0
- package/dist/vendor/lib-agent-exec/environment.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/eval-healer.d.ts +15 -0
- package/dist/vendor/lib-agent-exec/eval-healer.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/execution-engine.d.ts +4 -0
- package/dist/vendor/lib-agent-exec/execution-engine.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/help.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/help.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/cloud-cli-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/cloud-cli-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/docker-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/docker-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/git-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/git-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/index.d.ts +9 -0
- package/dist/vendor/lib-agent-exec/interceptors/index.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/mutating-interceptors.d.ts +7 -0
- package/dist/vendor/lib-agent-exec/interceptors/mutating-interceptors.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/package-manager-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/package-manager-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/repl-tui-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/repl-tui-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/search-interceptor.d.ts +15 -0
- package/dist/vendor/lib-agent-exec/interceptors/search-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/structural-interceptors.d.ts +15 -0
- package/dist/vendor/lib-agent-exec/interceptors/structural-interceptors.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/system-interceptor.d.ts +3 -0
- package/dist/vendor/lib-agent-exec/interceptors/system-interceptor.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/types.d.ts +11 -0
- package/dist/vendor/lib-agent-exec/interceptors/types.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/interceptors/utils.d.ts +5 -0
- package/dist/vendor/lib-agent-exec/interceptors/utils.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/io-controller.d.ts +48 -0
- package/dist/vendor/lib-agent-exec/io-controller.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/io-utils.d.ts +12 -0
- package/dist/vendor/lib-agent-exec/io-utils.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/path-healer.d.ts +15 -0
- package/dist/vendor/lib-agent-exec/path-healer.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/process-controller.d.ts +38 -0
- package/dist/vendor/lib-agent-exec/process-controller.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/process-manager.d.ts +6 -0
- package/dist/vendor/lib-agent-exec/process-manager.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/prompt-detector.d.ts +2 -0
- package/dist/vendor/lib-agent-exec/prompt-detector.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/schema.d.ts +182 -0
- package/dist/vendor/lib-agent-exec/schema.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/stream-manager.d.ts +20 -0
- package/dist/vendor/lib-agent-exec/stream-manager.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/utils.d.ts +17 -0
- package/dist/vendor/lib-agent-exec/utils.d.ts.map +1 -0
- package/dist/vendor/lib-agent-exec/webhook-template.d.ts +2 -0
- package/dist/vendor/lib-agent-exec/webhook-template.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/cache.d.ts +56 -0
- package/dist/vendor/lib-git-history/cache.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/cli.d.ts +147 -0
- package/dist/vendor/lib-git-history/cli.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/constants.d.ts +36 -0
- package/dist/vendor/lib-git-history/constants.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/git-numstat.d.ts +7 -0
- package/dist/vendor/lib-git-history/git-numstat.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/git-patch.d.ts +3 -0
- package/dist/vendor/lib-git-history/git-patch.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/git-runner.d.ts +25 -0
- package/dist/vendor/lib-git-history/git-runner.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/parser-batch.d.ts +5 -0
- package/dist/vendor/lib-git-history/parser-batch.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/parser-metadata.d.ts +3 -0
- package/dist/vendor/lib-git-history/parser-metadata.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/parser-record.d.ts +37 -0
- package/dist/vendor/lib-git-history/parser-record.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/parser-utils.d.ts +22 -0
- package/dist/vendor/lib-git-history/parser-utils.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/parser.d.ts +4 -0
- package/dist/vendor/lib-git-history/parser.d.ts.map +1 -0
- package/dist/vendor/lib-git-history/schema.d.ts +131 -0
- package/dist/vendor/lib-git-history/schema.d.ts.map +1 -0
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/worker-script.js +2937 -342
- package/package.json +130 -106
- package/skills/memory-journal-mcp/SKILL.md +41 -0
- package/dist/chunk-6OHRCNYW.js +0 -3231
- package/dist/chunk-JFMITANR.js +0 -5168
- package/dist/chunk-UHSO65A4.js +0 -8937
- package/dist/chunk-V3UTFQQK.js +0 -5538
- package/dist/cli.d.ts +0 -2
- package/dist/resources-IJVKDFGS.js +0 -2
- package/dist/tools-44DGXE3V.js +0 -2
- package/dist/worker-script.d.ts +0 -2
- package/skills/README.md +0 -121
- package/skills/adversarial-performance/SKILL.md +0 -139
- package/skills/adversarial-performance/references/audit-categories.md +0 -462
- package/skills/adversarial-performance/references/copilot-performance-prompts.md +0 -44
- package/skills/adversarial-performance/references/copilot-usage.md +0 -16
- package/skills/adversarial-performance/references/feedback-loop.md +0 -177
- package/skills/adversarial-performance/references/multi-pass-performance-protocol.md +0 -398
- package/skills/adversarial-planner/SKILL.md +0 -89
- package/skills/adversarial-planner/references/copilot-integration.md +0 -83
- package/skills/adversarial-planner/references/copilot-usage.md +0 -16
- package/skills/adversarial-planner/references/feedback-loop.md +0 -148
- package/skills/adversarial-planner/references/multi-pass-protocol.md +0 -229
- package/skills/adversarial-security/SKILL.md +0 -149
- package/skills/adversarial-security/references/adversarial-base-protocol.md +0 -44
- package/skills/adversarial-security/references/audit-categories.md +0 -723
- package/skills/adversarial-security/references/copilot-security-prompts.md +0 -142
- package/skills/adversarial-security/references/copilot-usage.md +0 -16
- package/skills/adversarial-security/references/feedback-loop.md +0 -206
- package/skills/adversarial-security/references/journal-opt-out.md +0 -7
- package/skills/adversarial-security/references/multi-pass-security-protocol.md +0 -403
- package/skills/adversarial-skill-audit/SKILL.md +0 -118
- package/skills/adversarial-skill-audit/references/audit-categories.md +0 -308
- package/skills/adversarial-skill-audit/references/copilot-skill-prompts.md +0 -68
- package/skills/adversarial-skill-audit/references/copilot-usage.md +0 -16
- package/skills/adversarial-skill-audit/references/feedback-loop.md +0 -155
- package/skills/adversarial-skill-audit/references/multi-pass-skill-protocol.md +0 -367
- package/skills/adversarial-skill-audit/scripts/check-skills.ps1 +0 -48
- package/skills/adversarial-skill-audit/scripts/run-copilot.ps1 +0 -52
- package/skills/adversarial-workflow-audit/SKILL.md +0 -82
- package/skills/adversarial-workflow-audit/references/audit-categories.md +0 -28
- package/skills/adversarial-workflow-audit/references/copilot-usage.md +0 -16
- package/skills/adversarial-workflow-audit/scripts/check-workflows.ps1 +0 -24
- package/skills/agents-sdk/SKILL.md +0 -220
- package/skills/agents-sdk/references/callable.md +0 -92
- package/skills/agents-sdk/references/codemode.md +0 -209
- package/skills/agents-sdk/references/email.md +0 -144
- package/skills/agents-sdk/references/mcp/SKILL.md +0 -65
- package/skills/agents-sdk/references/mcp/code-mode-reference.md +0 -245
- package/skills/agents-sdk/references/mcp/oauth-reference.md +0 -359
- package/skills/agents-sdk/references/mcp/references/architecture-reference.md +0 -208
- package/skills/agents-sdk/references/mcp/references/cloudflare-quickstart.md +0 -156
- package/skills/agents-sdk/references/mcp/references/error-handling.md +0 -343
- package/skills/agents-sdk/references/mcp/references/http-security.md +0 -164
- package/skills/agents-sdk/references/mcp/references/implementation-guide.md +0 -507
- package/skills/agents-sdk/references/mcp/references/testing-reference.md +0 -171
- package/skills/agents-sdk/references/mcp.md +0 -157
- package/skills/agents-sdk/references/state-scheduling.md +0 -164
- package/skills/agents-sdk/references/streaming-chat.md +0 -168
- package/skills/agents-sdk/references/workflows.md +0 -136
- package/skills/auth-identity/SKILL.md +0 -48
- package/skills/autonomous-dev/SKILL.md +0 -79
- package/skills/autonomous-dev/references/workflow_orchestration.md +0 -22
- package/skills/aws/SKILL.md +0 -39
- package/skills/azure/SKILL.md +0 -38
- package/skills/bin/sync.js +0 -56
- package/skills/biome/SKILL.md +0 -59
- package/skills/bun/SKILL.md +0 -162
- package/skills/cloudflare/SKILL.md +0 -37
- package/skills/cloudflare/references/agents-sdk/README.md +0 -95
- package/skills/cloudflare/references/agents-sdk/api.md +0 -195
- package/skills/cloudflare/references/agents-sdk/configuration.md +0 -178
- package/skills/cloudflare/references/agents-sdk/gotchas.md +0 -173
- package/skills/cloudflare/references/agents-sdk/patterns.md +0 -215
- package/skills/cloudflare/references/ai-gateway/README.md +0 -176
- package/skills/cloudflare/references/ai-gateway/configuration.md +0 -117
- package/skills/cloudflare/references/ai-gateway/dynamic-routing.md +0 -88
- package/skills/cloudflare/references/ai-gateway/features.md +0 -96
- package/skills/cloudflare/references/ai-gateway/sdk-integration.md +0 -110
- package/skills/cloudflare/references/ai-gateway/troubleshooting.md +0 -90
- package/skills/cloudflare/references/ai-search/README.md +0 -145
- package/skills/cloudflare/references/ai-search/api.md +0 -87
- package/skills/cloudflare/references/ai-search/configuration.md +0 -91
- package/skills/cloudflare/references/ai-search/gotchas.md +0 -92
- package/skills/cloudflare/references/ai-search/patterns.md +0 -87
- package/skills/cloudflare/references/analytics-engine/README.md +0 -96
- package/skills/cloudflare/references/analytics-engine/api.md +0 -112
- package/skills/cloudflare/references/analytics-engine/configuration.md +0 -107
- package/skills/cloudflare/references/analytics-engine/gotchas.md +0 -87
- package/skills/cloudflare/references/analytics-engine/patterns.md +0 -83
- package/skills/cloudflare/references/api/README.md +0 -66
- package/skills/cloudflare/references/api/api.md +0 -205
- package/skills/cloudflare/references/api/configuration.md +0 -158
- package/skills/cloudflare/references/api/gotchas.md +0 -231
- package/skills/cloudflare/references/api/patterns.md +0 -208
- package/skills/cloudflare/references/api-shield/README.md +0 -44
- package/skills/cloudflare/references/api-shield/api.md +0 -153
- package/skills/cloudflare/references/api-shield/configuration.md +0 -210
- package/skills/cloudflare/references/api-shield/gotchas.md +0 -132
- package/skills/cloudflare/references/api-shield/patterns.md +0 -185
- package/skills/cloudflare/references/argo-smart-routing/README.md +0 -96
- package/skills/cloudflare/references/argo-smart-routing/api.md +0 -253
- package/skills/cloudflare/references/argo-smart-routing/configuration.md +0 -205
- package/skills/cloudflare/references/argo-smart-routing/gotchas.md +0 -115
- package/skills/cloudflare/references/argo-smart-routing/patterns.md +0 -107
- package/skills/cloudflare/references/bindings/README.md +0 -127
- package/skills/cloudflare/references/bindings/api.md +0 -214
- package/skills/cloudflare/references/bindings/configuration.md +0 -200
- package/skills/cloudflare/references/bindings/gotchas.md +0 -210
- package/skills/cloudflare/references/bindings/patterns.md +0 -205
- package/skills/cloudflare/references/bot-management/README.md +0 -95
- package/skills/cloudflare/references/bot-management/api.md +0 -175
- package/skills/cloudflare/references/bot-management/configuration.md +0 -175
- package/skills/cloudflare/references/bot-management/gotchas.md +0 -116
- package/skills/cloudflare/references/bot-management/patterns.md +0 -181
- package/skills/cloudflare/references/browser-rendering/README.md +0 -84
- package/skills/cloudflare/references/browser-rendering/api.md +0 -108
- package/skills/cloudflare/references/browser-rendering/configuration.md +0 -78
- package/skills/cloudflare/references/browser-rendering/gotchas.md +0 -91
- package/skills/cloudflare/references/browser-rendering/patterns.md +0 -93
- package/skills/cloudflare/references/c3/README.md +0 -111
- package/skills/cloudflare/references/c3/api.md +0 -71
- package/skills/cloudflare/references/c3/configuration.md +0 -85
- package/skills/cloudflare/references/c3/gotchas.md +0 -97
- package/skills/cloudflare/references/c3/patterns.md +0 -84
- package/skills/cloudflare/references/cache-reserve/README.md +0 -150
- package/skills/cloudflare/references/cache-reserve/api.md +0 -184
- package/skills/cloudflare/references/cache-reserve/configuration.md +0 -170
- package/skills/cloudflare/references/cache-reserve/gotchas.md +0 -136
- package/skills/cloudflare/references/cache-reserve/patterns.md +0 -197
- package/skills/cloudflare/references/containers/README.md +0 -87
- package/skills/cloudflare/references/containers/api.md +0 -197
- package/skills/cloudflare/references/containers/configuration.md +0 -191
- package/skills/cloudflare/references/containers/gotchas.md +0 -182
- package/skills/cloudflare/references/containers/patterns.md +0 -204
- package/skills/cloudflare/references/cron-triggers/README.md +0 -101
- package/skills/cloudflare/references/cron-triggers/api.md +0 -224
- package/skills/cloudflare/references/cron-triggers/configuration.md +0 -190
- package/skills/cloudflare/references/cron-triggers/gotchas.md +0 -207
- package/skills/cloudflare/references/cron-triggers/patterns.md +0 -274
- package/skills/cloudflare/references/d1/README.md +0 -137
- package/skills/cloudflare/references/d1/api.md +0 -213
- package/skills/cloudflare/references/d1/configuration.md +0 -198
- package/skills/cloudflare/references/d1/gotchas.md +0 -98
- package/skills/cloudflare/references/d1/patterns.md +0 -240
- package/skills/cloudflare/references/ddos/README.md +0 -42
- package/skills/cloudflare/references/ddos/api.md +0 -158
- package/skills/cloudflare/references/ddos/configuration.md +0 -94
- package/skills/cloudflare/references/ddos/gotchas.md +0 -114
- package/skills/cloudflare/references/ddos/patterns.md +0 -220
- package/skills/cloudflare/references/decision-trees.md +0 -95
- package/skills/cloudflare/references/do-storage/README.md +0 -79
- package/skills/cloudflare/references/do-storage/api.md +0 -107
- package/skills/cloudflare/references/do-storage/configuration.md +0 -114
- package/skills/cloudflare/references/do-storage/gotchas.md +0 -153
- package/skills/cloudflare/references/do-storage/patterns.md +0 -210
- package/skills/cloudflare/references/do-storage/testing.md +0 -186
- package/skills/cloudflare/references/durable-objects/README.md +0 -194
- package/skills/cloudflare/references/durable-objects/api.md +0 -205
- package/skills/cloudflare/references/durable-objects/configuration.md +0 -160
- package/skills/cloudflare/references/durable-objects/gotchas.md +0 -200
- package/skills/cloudflare/references/durable-objects/patterns.md +0 -205
- package/skills/cloudflare/references/email-routing/README.md +0 -89
- package/skills/cloudflare/references/email-routing/api.md +0 -192
- package/skills/cloudflare/references/email-routing/configuration.md +0 -187
- package/skills/cloudflare/references/email-routing/gotchas.md +0 -203
- package/skills/cloudflare/references/email-routing/patterns.md +0 -241
- package/skills/cloudflare/references/email-workers/README.md +0 -153
- package/skills/cloudflare/references/email-workers/api.md +0 -227
- package/skills/cloudflare/references/email-workers/configuration.md +0 -115
- package/skills/cloudflare/references/email-workers/gotchas.md +0 -133
- package/skills/cloudflare/references/email-workers/patterns.md +0 -108
- package/skills/cloudflare/references/graphql-api/README.md +0 -147
- package/skills/cloudflare/references/graphql-api/api.md +0 -175
- package/skills/cloudflare/references/graphql-api/configuration.md +0 -151
- package/skills/cloudflare/references/graphql-api/gotchas.md +0 -111
- package/skills/cloudflare/references/graphql-api/patterns.md +0 -276
- package/skills/cloudflare/references/hyperdrive/README.md +0 -84
- package/skills/cloudflare/references/hyperdrive/api.md +0 -149
- package/skills/cloudflare/references/hyperdrive/configuration.md +0 -166
- package/skills/cloudflare/references/hyperdrive/gotchas.md +0 -77
- package/skills/cloudflare/references/hyperdrive/patterns.md +0 -203
- package/skills/cloudflare/references/images/README.md +0 -65
- package/skills/cloudflare/references/images/api.md +0 -101
- package/skills/cloudflare/references/images/configuration.md +0 -206
- package/skills/cloudflare/references/images/gotchas.md +0 -106
- package/skills/cloudflare/references/images/patterns.md +0 -126
- package/skills/cloudflare/references/kv/README.md +0 -90
- package/skills/cloudflare/references/kv/api.md +0 -163
- package/skills/cloudflare/references/kv/configuration.md +0 -148
- package/skills/cloudflare/references/kv/gotchas.md +0 -133
- package/skills/cloudflare/references/kv/patterns.md +0 -195
- package/skills/cloudflare/references/miniflare/README.md +0 -113
- package/skills/cloudflare/references/miniflare/api.md +0 -204
- package/skills/cloudflare/references/miniflare/configuration.md +0 -174
- package/skills/cloudflare/references/miniflare/gotchas.md +0 -179
- package/skills/cloudflare/references/miniflare/patterns.md +0 -187
- package/skills/cloudflare/references/network-interconnect/README.md +0 -104
- package/skills/cloudflare/references/network-interconnect/api.md +0 -220
- package/skills/cloudflare/references/network-interconnect/configuration.md +0 -123
- package/skills/cloudflare/references/network-interconnect/gotchas.md +0 -175
- package/skills/cloudflare/references/network-interconnect/patterns.md +0 -174
- package/skills/cloudflare/references/observability/README.md +0 -93
- package/skills/cloudflare/references/observability/api.md +0 -168
- package/skills/cloudflare/references/observability/configuration.md +0 -178
- package/skills/cloudflare/references/observability/gotchas.md +0 -125
- package/skills/cloudflare/references/observability/patterns.md +0 -105
- package/skills/cloudflare/references/pages/README.md +0 -92
- package/skills/cloudflare/references/pages/api.md +0 -205
- package/skills/cloudflare/references/pages/configuration.md +0 -216
- package/skills/cloudflare/references/pages/gotchas.md +0 -218
- package/skills/cloudflare/references/pages/patterns.md +0 -215
- package/skills/cloudflare/references/pages-functions/README.md +0 -104
- package/skills/cloudflare/references/pages-functions/api.md +0 -159
- package/skills/cloudflare/references/pages-functions/configuration.md +0 -130
- package/skills/cloudflare/references/pages-functions/gotchas.md +0 -102
- package/skills/cloudflare/references/pages-functions/patterns.md +0 -148
- package/skills/cloudflare/references/pipelines/README.md +0 -109
- package/skills/cloudflare/references/pipelines/api.md +0 -214
- package/skills/cloudflare/references/pipelines/configuration.md +0 -98
- package/skills/cloudflare/references/pipelines/gotchas.md +0 -84
- package/skills/cloudflare/references/pipelines/patterns.md +0 -87
- package/skills/cloudflare/references/product-index.md +0 -112
- package/skills/cloudflare/references/pulumi/README.md +0 -113
- package/skills/cloudflare/references/pulumi/api.md +0 -230
- package/skills/cloudflare/references/pulumi/configuration.md +0 -213
- package/skills/cloudflare/references/pulumi/gotchas.md +0 -205
- package/skills/cloudflare/references/pulumi/patterns.md +0 -260
- package/skills/cloudflare/references/queues/README.md +0 -99
- package/skills/cloudflare/references/queues/api.md +0 -211
- package/skills/cloudflare/references/queues/configuration.md +0 -151
- package/skills/cloudflare/references/queues/gotchas.md +0 -210
- package/skills/cloudflare/references/queues/patterns.md +0 -220
- package/skills/cloudflare/references/r2/README.md +0 -97
- package/skills/cloudflare/references/r2/api.md +0 -235
- package/skills/cloudflare/references/r2/configuration.md +0 -176
- package/skills/cloudflare/references/r2/gotchas.md +0 -190
- package/skills/cloudflare/references/r2/patterns.md +0 -203
- package/skills/cloudflare/references/r2-data-catalog/README.md +0 -157
- package/skills/cloudflare/references/r2-data-catalog/api.md +0 -199
- package/skills/cloudflare/references/r2-data-catalog/configuration.md +0 -205
- package/skills/cloudflare/references/r2-data-catalog/gotchas.md +0 -170
- package/skills/cloudflare/references/r2-data-catalog/patterns.md +0 -191
- package/skills/cloudflare/references/r2-sql/README.md +0 -138
- package/skills/cloudflare/references/r2-sql/SKILL.md.backup +0 -512
- package/skills/cloudflare/references/r2-sql/api.md +0 -159
- package/skills/cloudflare/references/r2-sql/configuration.md +0 -152
- package/skills/cloudflare/references/r2-sql/gotchas.md +0 -228
- package/skills/cloudflare/references/r2-sql/patterns.md +0 -230
- package/skills/cloudflare/references/realtime-sfu/README.md +0 -66
- package/skills/cloudflare/references/realtime-sfu/api.md +0 -164
- package/skills/cloudflare/references/realtime-sfu/configuration.md +0 -141
- package/skills/cloudflare/references/realtime-sfu/gotchas.md +0 -138
- package/skills/cloudflare/references/realtime-sfu/patterns.md +0 -187
- package/skills/cloudflare/references/realtimekit/README.md +0 -118
- package/skills/cloudflare/references/realtimekit/api.md +0 -234
- package/skills/cloudflare/references/realtimekit/configuration.md +0 -226
- package/skills/cloudflare/references/realtimekit/gotchas.md +0 -206
- package/skills/cloudflare/references/realtimekit/patterns.md +0 -240
- package/skills/cloudflare/references/sandbox/README.md +0 -104
- package/skills/cloudflare/references/sandbox/api.md +0 -200
- package/skills/cloudflare/references/sandbox/configuration.md +0 -154
- package/skills/cloudflare/references/sandbox/gotchas.md +0 -201
- package/skills/cloudflare/references/sandbox/patterns.md +0 -195
- package/skills/cloudflare/references/secrets-store/README.md +0 -77
- package/skills/cloudflare/references/secrets-store/api.md +0 -199
- package/skills/cloudflare/references/secrets-store/configuration.md +0 -187
- package/skills/cloudflare/references/secrets-store/gotchas.md +0 -97
- package/skills/cloudflare/references/secrets-store/patterns.md +0 -218
- package/skills/cloudflare/references/smart-placement/README.md +0 -143
- package/skills/cloudflare/references/smart-placement/api.md +0 -192
- package/skills/cloudflare/references/smart-placement/configuration.md +0 -202
- package/skills/cloudflare/references/smart-placement/gotchas.md +0 -180
- package/skills/cloudflare/references/smart-placement/patterns.md +0 -190
- package/skills/cloudflare/references/snippets/README.md +0 -74
- package/skills/cloudflare/references/snippets/api.md +0 -214
- package/skills/cloudflare/references/snippets/configuration.md +0 -239
- package/skills/cloudflare/references/snippets/gotchas.md +0 -104
- package/skills/cloudflare/references/snippets/patterns.md +0 -135
- package/skills/cloudflare/references/spectrum/README.md +0 -52
- package/skills/cloudflare/references/spectrum/api.md +0 -184
- package/skills/cloudflare/references/spectrum/configuration.md +0 -203
- package/skills/cloudflare/references/spectrum/gotchas.md +0 -155
- package/skills/cloudflare/references/spectrum/patterns.md +0 -206
- package/skills/cloudflare/references/static-assets/README.md +0 -65
- package/skills/cloudflare/references/static-assets/api.md +0 -201
- package/skills/cloudflare/references/static-assets/configuration.md +0 -186
- package/skills/cloudflare/references/static-assets/gotchas.md +0 -164
- package/skills/cloudflare/references/static-assets/patterns.md +0 -189
- package/skills/cloudflare/references/stream/README.md +0 -123
- package/skills/cloudflare/references/stream/api-live.md +0 -202
- package/skills/cloudflare/references/stream/api.md +0 -206
- package/skills/cloudflare/references/stream/configuration.md +0 -151
- package/skills/cloudflare/references/stream/gotchas.md +0 -139
- package/skills/cloudflare/references/stream/patterns.md +0 -217
- package/skills/cloudflare/references/tail-workers/README.md +0 -92
- package/skills/cloudflare/references/tail-workers/api.md +0 -203
- package/skills/cloudflare/references/tail-workers/configuration.md +0 -178
- package/skills/cloudflare/references/tail-workers/gotchas.md +0 -206
- package/skills/cloudflare/references/tail-workers/patterns.md +0 -190
- package/skills/cloudflare/references/terraform/README.md +0 -100
- package/skills/cloudflare/references/terraform/api.md +0 -178
- package/skills/cloudflare/references/terraform/configuration.md +0 -197
- package/skills/cloudflare/references/terraform/gotchas.md +0 -150
- package/skills/cloudflare/references/terraform/patterns.md +0 -174
- package/skills/cloudflare/references/tunnel/README.md +0 -137
- package/skills/cloudflare/references/tunnel/api.md +0 -205
- package/skills/cloudflare/references/tunnel/configuration.md +0 -163
- package/skills/cloudflare/references/tunnel/gotchas.md +0 -159
- package/skills/cloudflare/references/tunnel/networking.md +0 -174
- package/skills/cloudflare/references/tunnel/patterns.md +0 -199
- package/skills/cloudflare/references/turn/README.md +0 -86
- package/skills/cloudflare/references/turn/api.md +0 -236
- package/skills/cloudflare/references/turn/configuration.md +0 -181
- package/skills/cloudflare/references/turn/gotchas.md +0 -236
- package/skills/cloudflare/references/turn/patterns.md +0 -228
- package/skills/cloudflare/references/turnstile/README.md +0 -102
- package/skills/cloudflare/references/turnstile/api.md +0 -253
- package/skills/cloudflare/references/turnstile/configuration.md +0 -242
- package/skills/cloudflare/references/turnstile/gotchas.md +0 -253
- package/skills/cloudflare/references/turnstile/patterns.md +0 -195
- package/skills/cloudflare/references/vectorize/README.md +0 -133
- package/skills/cloudflare/references/vectorize/api.md +0 -89
- package/skills/cloudflare/references/vectorize/configuration.md +0 -91
- package/skills/cloudflare/references/vectorize/gotchas.md +0 -83
- package/skills/cloudflare/references/vectorize/patterns.md +0 -92
- package/skills/cloudflare/references/waf/README.md +0 -125
- package/skills/cloudflare/references/waf/api.md +0 -203
- package/skills/cloudflare/references/waf/configuration.md +0 -215
- package/skills/cloudflare/references/waf/gotchas.md +0 -208
- package/skills/cloudflare/references/waf/patterns.md +0 -236
- package/skills/cloudflare/references/web-analytics/README.md +0 -149
- package/skills/cloudflare/references/web-analytics/configuration.md +0 -81
- package/skills/cloudflare/references/web-analytics/gotchas.md +0 -86
- package/skills/cloudflare/references/web-analytics/integration.md +0 -63
- package/skills/cloudflare/references/web-analytics/patterns.md +0 -98
- package/skills/cloudflare/references/workerd/README.md +0 -85
- package/skills/cloudflare/references/workerd/api.md +0 -219
- package/skills/cloudflare/references/workerd/configuration.md +0 -200
- package/skills/cloudflare/references/workerd/gotchas.md +0 -151
- package/skills/cloudflare/references/workerd/patterns.md +0 -205
- package/skills/cloudflare/references/workers/README.md +0 -110
- package/skills/cloudflare/references/workers/api.md +0 -197
- package/skills/cloudflare/references/workers/configuration.md +0 -184
- package/skills/cloudflare/references/workers/frameworks.md +0 -200
- package/skills/cloudflare/references/workers/gotchas.md +0 -145
- package/skills/cloudflare/references/workers/patterns.md +0 -220
- package/skills/cloudflare/references/workers-ai/README.md +0 -206
- package/skills/cloudflare/references/workers-ai/api.md +0 -115
- package/skills/cloudflare/references/workers-ai/configuration.md +0 -98
- package/skills/cloudflare/references/workers-ai/gotchas.md +0 -130
- package/skills/cloudflare/references/workers-ai/patterns.md +0 -122
- package/skills/cloudflare/references/workers-for-platforms/README.md +0 -95
- package/skills/cloudflare/references/workers-for-platforms/api.md +0 -212
- package/skills/cloudflare/references/workers-for-platforms/configuration.md +0 -178
- package/skills/cloudflare/references/workers-for-platforms/gotchas.md +0 -134
- package/skills/cloudflare/references/workers-for-platforms/patterns.md +0 -210
- package/skills/cloudflare/references/workers-playground/README.md +0 -131
- package/skills/cloudflare/references/workers-playground/api.md +0 -101
- package/skills/cloudflare/references/workers-playground/configuration.md +0 -169
- package/skills/cloudflare/references/workers-playground/gotchas.md +0 -88
- package/skills/cloudflare/references/workers-playground/patterns.md +0 -134
- package/skills/cloudflare/references/workers-vpc/README.md +0 -130
- package/skills/cloudflare/references/workers-vpc/api.md +0 -196
- package/skills/cloudflare/references/workers-vpc/configuration.md +0 -151
- package/skills/cloudflare/references/workers-vpc/gotchas.md +0 -171
- package/skills/cloudflare/references/workers-vpc/patterns.md +0 -235
- package/skills/cloudflare/references/workflows/README.md +0 -72
- package/skills/cloudflare/references/workflows/api.md +0 -237
- package/skills/cloudflare/references/workflows/configuration.md +0 -158
- package/skills/cloudflare/references/workflows/gotchas.md +0 -97
- package/skills/cloudflare/references/workflows/patterns.md +0 -245
- package/skills/cloudflare/references/wrangler/README.md +0 -143
- package/skills/cloudflare/references/wrangler/api.md +0 -188
- package/skills/cloudflare/references/wrangler/configuration.md +0 -198
- package/skills/cloudflare/references/wrangler/gotchas.md +0 -212
- package/skills/cloudflare/references/wrangler/patterns.md +0 -211
- package/skills/cloudflare/references/zaraz/IMPLEMENTATION_SUMMARY.md +0 -131
- package/skills/cloudflare/references/zaraz/README.md +0 -114
- package/skills/cloudflare/references/zaraz/api.md +0 -118
- package/skills/cloudflare/references/zaraz/configuration.md +0 -94
- package/skills/cloudflare/references/zaraz/gotchas.md +0 -88
- package/skills/cloudflare/references/zaraz/patterns.md +0 -77
- package/skills/docker/SKILL.md +0 -168
- package/skills/docker/references/advanced-examples.md +0 -71
- package/skills/docker/references/templates.md +0 -34
- package/skills/docs-marketer/SKILL.md +0 -178
- package/skills/docs-marketer/references/audit-categories.md +0 -328
- package/skills/docs-marketer/references/copilot-docs-prompts.md +0 -88
- package/skills/docs-marketer/references/copilot-usage.md +0 -16
- package/skills/docs-marketer/references/feedback-loop.md +0 -155
- package/skills/docs-marketer/references/multi-pass-docs-protocol.md +0 -410
- package/skills/drizzle-orm/SKILL.md +0 -82
- package/skills/durable-objects/SKILL.md +0 -167
- package/skills/durable-objects/references/advanced_features.md +0 -29
- package/skills/durable-objects/references/rules.md +0 -300
- package/skills/durable-objects/references/testing.md +0 -261
- package/skills/durable-objects/references/workers.md +0 -336
- package/skills/gcp/SKILL.md +0 -37
- package/skills/github-actions/SKILL.md +0 -262
- package/skills/github-actions/references/templates.md +0 -65
- package/skills/github-commander/SKILL.md +0 -144
- package/skills/github-commander/config/project-config.example.md +0 -125
- package/skills/github-commander/workflows/code-quality-audit.md +0 -82
- package/skills/github-commander/workflows/copilot-audit.md +0 -50
- package/skills/github-commander/workflows/issue-triage.md +0 -248
- package/skills/github-commander/workflows/milestone-sprint.md +0 -89
- package/skills/github-commander/workflows/perf-audit.md +0 -144
- package/skills/github-commander/workflows/pr-review.md +0 -129
- package/skills/github-commander/workflows/roadmap-kickoff.md +0 -79
- package/skills/github-commander/workflows/security-audit.md +0 -170
- package/skills/github-commander/workflows/update-deps.md +0 -109
- package/skills/github-copilot-cli/SKILL.md +0 -59
- package/skills/github-repo-setup/SKILL.md +0 -136
- package/skills/github-repo-setup/references/community-standards.md +0 -136
- package/skills/github-repo-setup/references/github-automation.md +0 -490
- package/skills/github-repo-setup/references/inline-templates.md +0 -205
- package/skills/github-repo-setup/references/project-config.md +0 -320
- package/skills/gitlab/SKILL.md +0 -120
- package/skills/gitlab/package-lock.json +0 -392
- package/skills/gitlab/package.json +0 -14
- package/skills/gitlab/scripts/gitlab-client.ts +0 -125
- package/skills/gitlab/scripts/gitlab-helper.ts +0 -80
- package/skills/golang/SKILL.md +0 -61
- package/skills/graphql/SKILL.md +0 -30
- package/skills/hono/SKILL.md +0 -82
- package/skills/journal-optimizer/SKILL.md +0 -206
- package/skills/journal-optimizer/references/optimizer-scripts.md +0 -169
- package/skills/llm-app-engineering/SKILL.md +0 -18
- package/skills/monorepo/SKILL.md +0 -56
- package/skills/multi-agent-orchestration/SKILL.md +0 -14
- package/skills/mysql/SKILL.md +0 -34
- package/skills/next-best-practices/README.md +0 -127
- package/skills/next-best-practices/SKILL.md +0 -86
- package/skills/next-best-practices/metadata.json +0 -17
- package/skills/next-best-practices/references/cache-components-examples.md +0 -234
- package/skills/next-best-practices/references/cache-components.md +0 -210
- package/skills/next-best-practices/references/upgrade-decision-tree.md +0 -33
- package/skills/next-best-practices/references/upgrade.md +0 -43
- package/skills/next-best-practices/rules/_sections.md +0 -46
- package/skills/next-best-practices/rules/_template.md +0 -28
- package/skills/next-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/skills/next-best-practices/rules/advanced-init-once.md +0 -42
- package/skills/next-best-practices/rules/advanced-use-latest.md +0 -39
- package/skills/next-best-practices/rules/async-api-routes.md +0 -35
- package/skills/next-best-practices/rules/async-defer-await.md +0 -80
- package/skills/next-best-practices/rules/async-dependencies.md +0 -48
- package/skills/next-best-practices/rules/async-parallel.md +0 -24
- package/skills/next-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/skills/next-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/skills/next-best-practices/rules/bundle-conditional.md +0 -37
- package/skills/next-best-practices/rules/bundle-defer-third-party.md +0 -48
- package/skills/next-best-practices/rules/bundle-dynamic-imports.md +0 -34
- package/skills/next-best-practices/rules/bundle-preload.md +0 -44
- package/skills/next-best-practices/rules/client-event-listeners.md +0 -78
- package/skills/next-best-practices/rules/client-localstorage-schema.md +0 -74
- package/skills/next-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/skills/next-best-practices/rules/client-swr-dedup.md +0 -56
- package/skills/next-best-practices/rules/js-batch-dom-css.md +0 -110
- package/skills/next-best-practices/rules/js-cache-function-results.md +0 -80
- package/skills/next-best-practices/rules/js-cache-property-access.md +0 -28
- package/skills/next-best-practices/rules/js-cache-storage.md +0 -68
- package/skills/next-best-practices/rules/js-combine-iterations.md +0 -32
- package/skills/next-best-practices/rules/js-early-exit.md +0 -50
- package/skills/next-best-practices/rules/js-hoist-regexp.md +0 -45
- package/skills/next-best-practices/rules/js-index-maps.md +0 -37
- package/skills/next-best-practices/rules/js-length-check-first.md +0 -50
- package/skills/next-best-practices/rules/js-min-max-loop.md +0 -82
- package/skills/next-best-practices/rules/js-set-map-lookups.md +0 -24
- package/skills/next-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/skills/next-best-practices/rules/rendering-activity.md +0 -24
- package/skills/next-best-practices/rules/rendering-animate-svg-wrapper.md +0 -38
- package/skills/next-best-practices/rules/rendering-conditional-render.md +0 -32
- package/skills/next-best-practices/rules/rendering-content-visibility.md +0 -38
- package/skills/next-best-practices/rules/rendering-hoist-jsx.md +0 -36
- package/skills/next-best-practices/rules/rendering-hydration-no-flicker.md +0 -72
- package/skills/next-best-practices/rules/rendering-hydration-suppress-warning.md +0 -26
- package/skills/next-best-practices/rules/rendering-svg-precision.md +0 -28
- package/skills/next-best-practices/rules/rendering-usetransition-loading.md +0 -75
- package/skills/next-best-practices/rules/rerender-defer-reads.md +0 -39
- package/skills/next-best-practices/rules/rerender-dependencies.md +0 -45
- package/skills/next-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
- package/skills/next-best-practices/rules/rerender-derived-state.md +0 -29
- package/skills/next-best-practices/rules/rerender-functional-setstate.md +0 -77
- package/skills/next-best-practices/rules/rerender-lazy-state-init.md +0 -56
- package/skills/next-best-practices/rules/rerender-memo-with-default-value.md +0 -36
- package/skills/next-best-practices/rules/rerender-memo.md +0 -44
- package/skills/next-best-practices/rules/rerender-move-effect-to-event.md +0 -45
- package/skills/next-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
- package/skills/next-best-practices/rules/rerender-transitions.md +0 -40
- package/skills/next-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
- package/skills/next-best-practices/rules/server-after-nonblocking.md +0 -73
- package/skills/next-best-practices/rules/server-auth-actions.md +0 -96
- package/skills/next-best-practices/rules/server-cache-lru.md +0 -41
- package/skills/next-best-practices/rules/server-cache-react.md +0 -76
- package/skills/next-best-practices/rules/server-dedup-props.md +0 -65
- package/skills/next-best-practices/rules/server-parallel-fetching.md +0 -83
- package/skills/next-best-practices/rules/server-serialization.md +0 -38
- package/skills/next-cache-components/SKILL.md +0 -441
- package/skills/next-upgrade/SKILL.md +0 -43
- package/skills/next-upgrade/references/decision-tree.md +0 -33
- package/skills/nodejs/SKILL.md +0 -46
- package/skills/opentelemetry/SKILL.md +0 -62
- package/skills/package.json +0 -89
- package/skills/playwright-standard/SKILL.md +0 -53
- package/skills/playwright-standard/examples/fixtures.ts +0 -66
- package/skills/playwright-standard/examples/type-stubs.d.ts +0 -10
- package/skills/playwright-standard/references/advanced-scenarios.md +0 -59
- package/skills/playwright-standard/references/infrastructure.md +0 -43
- package/skills/playwright-standard/references/locators.md +0 -7
- package/skills/postgres/SKILL.md +0 -38
- package/skills/python/SKILL.md +0 -195
- package/skills/python/references/advanced-patterns.md +0 -37
- package/skills/python/references/config-templates.md +0 -48
- package/skills/rag-pipelines/SKILL.md +0 -14
- package/skills/redis/SKILL.md +0 -31
- package/skills/render/SKILL.md +0 -35
- package/skills/rust/SKILL.md +0 -76
- package/skills/rust/references/borrow-checker.md +0 -13
- package/skills/rust/references/ecosystem.md +0 -11
- package/skills/sandbox-sdk/SKILL.md +0 -186
- package/skills/sandbox-sdk/references/api-quick-ref.md +0 -113
- package/skills/sandbox-sdk/references/examples.md +0 -52
- package/skills/shadcn-ui/SKILL.md +0 -37
- package/skills/skill-builder/SKILL.md +0 -56
- package/skills/skill-builder/checklist.md +0 -65
- package/skills/skill-builder/references/tutorial.md +0 -457
- package/skills/sqlite/SKILL.md +0 -49
- package/skills/table.md +0 -59
- package/skills/tailwind-css/SKILL.md +0 -219
- package/skills/tailwind-css/references/component-patterns.md +0 -52
- package/skills/trpc/SKILL.md +0 -56
- package/skills/typescript/SKILL.md +0 -50
- package/skills/typescript/assets/eslint-template.js +0 -102
- package/skills/typescript/assets/tsconfig-template.json +0 -45
- package/skills/typescript/references/enterprise-patterns.md +0 -531
- package/skills/typescript/references/generics.md +0 -493
- package/skills/typescript/references/nestjs-integration.md +0 -579
- package/skills/typescript/references/react-integration.md +0 -616
- package/skills/typescript/references/toolchain.md +0 -547
- package/skills/typescript/references/tutorial.md +0 -453
- package/skills/typescript/references/type-system.md +0 -481
- package/skills/vercel-ai-sdk/SKILL.md +0 -48
- package/skills/vitest-standard/SKILL.md +0 -76
- package/skills/vitest-standard/examples/service-mock.ts +0 -60
- package/skills/vitest-standard/examples/tdd-calculator.ts +0 -41
- package/skills/vitest-standard/examples/type-stubs.d.ts +0 -18
- package/skills/vitest-standard/references/assertions.md +0 -11
- package/skills/vitest-standard/references/async-and-errors.md +0 -58
- package/skills/vitest-standard/references/coverage-and-config.md +0 -53
- package/skills/vitest-standard/references/mocking.md +0 -61
- package/skills/vitest-standard/references/tdd-patterns.md +0 -60
- package/skills/web-perf/SKILL.md +0 -207
- package/skills/workers-best-practices/SKILL.md +0 -120
- package/skills/workers-best-practices/references/anti-patterns.md +0 -18
- package/skills/workers-best-practices/references/review.md +0 -174
- package/skills/workers-best-practices/references/rules.md +0 -485
- package/skills/wrangler/SKILL.md +0 -43
- package/skills/wrangler/references/cli-commands.md +0 -861
- package/skills/zod/SKILL.md +0 -48
|
@@ -0,0 +1,2667 @@
|
|
|
1
|
+
import { createServer, initializeDependencies, VectorSearchManager } from './chunk-Y6MMKR2Z.js';
|
|
2
|
+
import { logAgentIssue, DatabaseAdapterFactory, DEFAULT_AUDIT_LOG_MAX_SIZE_BYTES, logger, callTool, globalSubscriptionManager, runAutoPrune, AuditLogger, exportEntriesToMarkdown, importMarkdownEntries, convertFile, processImportBatch } from './chunk-T7SROBBV.js';
|
|
3
|
+
import { VERSION } from './chunk-SGJU2DHU.js';
|
|
4
|
+
import { ConfigurationError } from './chunk-E6IQP6PE.js';
|
|
5
|
+
import { resolveProjectNumberFromPath, resolveWorkspaceId } from './chunk-D2FY6XS5.js';
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { match, P } from 'ts-pattern';
|
|
8
|
+
import { z, ZodError } from 'zod';
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import { readFileSync, constants } from 'fs';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
import * as os from 'os';
|
|
13
|
+
import * as yaml from 'yaml';
|
|
14
|
+
import { parse } from 'yaml';
|
|
15
|
+
import * as p from '@clack/prompts';
|
|
16
|
+
import * as fs4 from 'fs/promises';
|
|
17
|
+
|
|
18
|
+
var optionGroups = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
var commandAiInstructions = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
function withGroup(command, groupName, configurer) {
|
|
21
|
+
const beforeCount = command.options.length;
|
|
22
|
+
configurer(command);
|
|
23
|
+
for (let i = beforeCount; i < command.options.length; i++) {
|
|
24
|
+
const opt = command.options[i];
|
|
25
|
+
if (opt) optionGroups.set(opt, groupName);
|
|
26
|
+
}
|
|
27
|
+
return command;
|
|
28
|
+
}
|
|
29
|
+
function addAgentInstructions(command, text2) {
|
|
30
|
+
commandAiInstructions.set(command, text2);
|
|
31
|
+
}
|
|
32
|
+
function withValidation(schema, action) {
|
|
33
|
+
return async (...args2) => {
|
|
34
|
+
const command = args2[args2.length - 1];
|
|
35
|
+
const rawOptions = args2.length > 1 ? args2[args2.length - 2] : {};
|
|
36
|
+
try {
|
|
37
|
+
const validOptions = schema.parse(rawOptions);
|
|
38
|
+
const newArgs = [...args2];
|
|
39
|
+
if (newArgs.length > 1) {
|
|
40
|
+
newArgs[newArgs.length - 2] = validOptions;
|
|
41
|
+
}
|
|
42
|
+
await action(...newArgs);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (err instanceof ZodError) {
|
|
45
|
+
const errorMessages = err.issues.map((e) => {
|
|
46
|
+
const path5 = e.path.length > 0 ? e.path.map(String).join(".") + ": " : "";
|
|
47
|
+
return `${path5}${e.message}`;
|
|
48
|
+
}).join("; ");
|
|
49
|
+
logAgentIssue({
|
|
50
|
+
source: "CLI",
|
|
51
|
+
action: command.name(),
|
|
52
|
+
input: rawOptions,
|
|
53
|
+
error: `Validation Error: ${errorMessages}`
|
|
54
|
+
});
|
|
55
|
+
process.stderr.write(`\x1B[31mValidation Error:\x1B[0m
|
|
56
|
+
`);
|
|
57
|
+
err.issues.forEach((e) => {
|
|
58
|
+
const path5 = e.path.length > 0 ? e.path.map(String).join(".") + ": " : "";
|
|
59
|
+
process.stderr.write(` - ${path5}${e.message}
|
|
60
|
+
`);
|
|
61
|
+
});
|
|
62
|
+
process.stderr.write("\n");
|
|
63
|
+
command.help({ error: true });
|
|
64
|
+
} else {
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function createProgram() {
|
|
71
|
+
const program2 = new Command();
|
|
72
|
+
program2.name("memory-journal-mcp").description("Project context management for AI-assisted development").version(VERSION).configureOutput({
|
|
73
|
+
// Ensure error messages strictly go to stderr to maintain stdout discipline
|
|
74
|
+
writeErr: (str) => process.stderr.write(str),
|
|
75
|
+
outputError: (str, write) => {
|
|
76
|
+
logAgentIssue({
|
|
77
|
+
source: "CLI",
|
|
78
|
+
action: "commander-parsing",
|
|
79
|
+
input: process.argv.slice(2),
|
|
80
|
+
error: str.trim()
|
|
81
|
+
});
|
|
82
|
+
if (str.includes("unknown option")) {
|
|
83
|
+
write(`\\x1b[31mError:\\x1b[0m \u{1F6E0}\uFE0F AUTONOMOUS HEALING: CLI parsing failed. Read the error below and fix your flags immediately.\\n${str}`);
|
|
84
|
+
} else {
|
|
85
|
+
write(`\\x1b[31mError:\\x1b[0m \u{1F6E0}\uFE0F AUTONOMOUS HEALING: ${str}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
program2.configureHelp({
|
|
90
|
+
formatHelp: (cmd, helper) => {
|
|
91
|
+
const isJsonHelp = process.argv.includes("--json") || process.argv.includes("--json=true");
|
|
92
|
+
if (isJsonHelp) {
|
|
93
|
+
const buildCommandTree = (c) => {
|
|
94
|
+
const rawAiInstructions = commandAiInstructions.get(c);
|
|
95
|
+
const cleanedAiInstructions = rawAiInstructions ? rawAiInstructions.replace(/^\n*🤖 AI AGENT INSTRUCTIONS:\n*/, "").split("\n").map((s) => s.trim().replace(/^- /, "")).filter(Boolean) : null;
|
|
96
|
+
return {
|
|
97
|
+
name: c.name(),
|
|
98
|
+
description: helper.commandDescription(c),
|
|
99
|
+
usage: helper.commandUsage(c),
|
|
100
|
+
commands: helper.visibleCommands(c).map((subCmd) => buildCommandTree(subCmd)),
|
|
101
|
+
options: helper.visibleOptions(c).map((opt) => ({
|
|
102
|
+
term: helper.optionTerm(opt),
|
|
103
|
+
description: helper.optionDescription(opt),
|
|
104
|
+
group: match([optionGroups.get(opt), opt.name()]).with([P.string, P._], ([name]) => name).with([P.nullish, P.union("help", "version")], () => "Standard Options").with([P.nullish, P._], () => "Command Options").exhaustive()
|
|
105
|
+
})),
|
|
106
|
+
arguments: helper.visibleArguments(c).map((arg) => ({
|
|
107
|
+
term: helper.argumentTerm(arg),
|
|
108
|
+
description: helper.argumentDescription(arg)
|
|
109
|
+
})),
|
|
110
|
+
aiInstructions: cleanedAiInstructions
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const envelope = {
|
|
114
|
+
status: "success",
|
|
115
|
+
data: buildCommandTree(cmd),
|
|
116
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
117
|
+
};
|
|
118
|
+
return JSON.stringify(envelope) + "\n";
|
|
119
|
+
}
|
|
120
|
+
let output = "";
|
|
121
|
+
output += `Usage: ${helper.commandUsage(cmd)}
|
|
122
|
+
`;
|
|
123
|
+
const desc = helper.commandDescription(cmd);
|
|
124
|
+
if (desc) output += `
|
|
125
|
+
${desc}
|
|
126
|
+
`;
|
|
127
|
+
const args2 = helper.visibleArguments(cmd);
|
|
128
|
+
if (args2.length > 0) {
|
|
129
|
+
output += "\nArguments:\n";
|
|
130
|
+
args2.forEach((arg) => {
|
|
131
|
+
const term = helper.argumentTerm(arg);
|
|
132
|
+
const argumentDesc = helper.argumentDescription(arg);
|
|
133
|
+
output += ` ${term.padEnd(helper.padWidth(cmd, helper))} ${argumentDesc}
|
|
134
|
+
`;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const options = helper.visibleOptions(cmd);
|
|
138
|
+
if (options.length > 0) {
|
|
139
|
+
const groups = /* @__PURE__ */ new Map();
|
|
140
|
+
options.forEach((opt) => {
|
|
141
|
+
const groupName = match([optionGroups.get(opt), opt.name()]).with([P.string, P._], ([name]) => name).with([P.nullish, P.union("help", "version")], () => "Standard Options").with([P.nullish, P._], () => "Command Options").exhaustive();
|
|
142
|
+
if (!groups.has(groupName)) groups.set(groupName, []);
|
|
143
|
+
const group = groups.get(groupName);
|
|
144
|
+
if (group) group.push(opt);
|
|
145
|
+
});
|
|
146
|
+
const padWidth = helper.padWidth(cmd, helper);
|
|
147
|
+
const standardOptions = groups.get("Standard Options");
|
|
148
|
+
groups.delete("Standard Options");
|
|
149
|
+
for (const [groupName, groupOpts] of groups.entries()) {
|
|
150
|
+
output += `
|
|
151
|
+
${groupName}:
|
|
152
|
+
`;
|
|
153
|
+
groupOpts.forEach((opt) => {
|
|
154
|
+
const term = helper.optionTerm(opt);
|
|
155
|
+
const optionDesc = helper.optionDescription(opt);
|
|
156
|
+
output += ` ${term.padEnd(padWidth)} ${optionDesc}
|
|
157
|
+
`;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (standardOptions) {
|
|
161
|
+
output += `
|
|
162
|
+
Standard Options:
|
|
163
|
+
`;
|
|
164
|
+
standardOptions.forEach((opt) => {
|
|
165
|
+
const term = helper.optionTerm(opt);
|
|
166
|
+
const optionDesc = helper.optionDescription(opt);
|
|
167
|
+
output += ` ${term.padEnd(padWidth)} ${optionDesc}
|
|
168
|
+
`;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const commands = helper.visibleCommands(cmd);
|
|
173
|
+
if (commands.length > 0) {
|
|
174
|
+
output += "\nCommands:\n";
|
|
175
|
+
commands.forEach((c) => {
|
|
176
|
+
const term = helper.subcommandTerm(c);
|
|
177
|
+
const subcommandDesc = helper.subcommandDescription(c);
|
|
178
|
+
output += ` ${term.padEnd(helper.padWidth(cmd, helper))} ${subcommandDesc}
|
|
179
|
+
`;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const aiInstructions = commandAiInstructions.get(cmd);
|
|
183
|
+
if (aiInstructions) {
|
|
184
|
+
output += `
|
|
185
|
+
${aiInstructions}
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
return output;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return program2;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/cli/option-groups.ts
|
|
195
|
+
var defaultDbPath = "./memory_journal.db";
|
|
196
|
+
var defaultTeamDbPath = void 0;
|
|
197
|
+
function addCoreOptions(command) {
|
|
198
|
+
return withGroup(command, "Core Options", (cmd) => {
|
|
199
|
+
cmd.option("--config <path>", "Path to configuration file (.yaml, .yml, .json) (env: MEMORY_JOURNAL_CONFIG)").option("--dump-config", "Print effective configuration and exit").option("--log-level <level>", "Log level: debug, info, warning, error", "info").option(
|
|
200
|
+
"--max-tool-input-elements <count>",
|
|
201
|
+
"Maximum number of array/object elements allowed in tool input arguments (default: 25000, 0 = disabled, env: MAX_TOOL_INPUT_ELEMENTS)"
|
|
202
|
+
).option(
|
|
203
|
+
"--no-agent-healing",
|
|
204
|
+
"Disable autonomous MCP tool and parameter healing/interception (env: MCP_AGENT_HEALING=false)"
|
|
205
|
+
);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function addDatabaseOptions(command) {
|
|
209
|
+
return withGroup(command, "Database Options", (cmd) => {
|
|
210
|
+
cmd.option("--db <path>", "Database path (env: DB_PATH)", defaultDbPath).option("--database <path>", "Alias for --db (env: DB_PATH)").option("--team-db <path>", "Team database path (env: TEAM_DB_PATH)", defaultTeamDbPath).option("--team-database <path>", "Alias for --team-db (env: TEAM_DB_PATH)").option(
|
|
211
|
+
"--additional-team-dbs <json>",
|
|
212
|
+
"Additional team database mappings (label -> path) as JSON for cross-team discovery (env: ADDITIONAL_TEAM_DBS)"
|
|
213
|
+
).option(
|
|
214
|
+
"--team-default-role <role>",
|
|
215
|
+
"Default role for unrecognized team authors: admin, member, viewer, denied (env: TEAM_DEFAULT_ROLE)",
|
|
216
|
+
"denied"
|
|
217
|
+
).option(
|
|
218
|
+
"--team-admin <author>",
|
|
219
|
+
"Bootstrap this author as admin if team_members table is empty (env: TEAM_ADMIN)"
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function addWorkspaceOptions(command) {
|
|
224
|
+
return withGroup(command, "Workspace Options", (cmd) => {
|
|
225
|
+
cmd.option("--default-project <number>", "Default GitHub Project number (env: DEFAULT_PROJECT_NUMBER)").option("--default-workspace-id <string>", "Default workspace ID for isolating journal entries (env: DEFAULT_WORKSPACE_ID)");
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
function addVectorOptions(command) {
|
|
229
|
+
return withGroup(command, "Vector Options", (cmd) => {
|
|
230
|
+
cmd.option(
|
|
231
|
+
"--embedding-model <model>",
|
|
232
|
+
"HuggingFace model name for semantic search embeddings (env: EMBEDDING_MODEL)"
|
|
233
|
+
).option("--auto-rebuild-index", "Rebuild vector index on server startup (env: AUTO_REBUILD_INDEX)");
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function addNetworkOptions(command) {
|
|
237
|
+
return withGroup(command, "Network Options", (cmd) => {
|
|
238
|
+
cmd.option("--transport <type>", "Transport type: stdio or http", "stdio").option("--http", "Start server with HTTP transport (alias for --transport http)").option("--stdio", "Start server with stdio transport (alias for --transport stdio)").option("--port <number>", "HTTP port (for http transport)", "3000").option("--server-host <host>", "Server bind host for HTTP transport (default: localhost) (env: MCP_HOST)").option("--stateless", "Use stateless HTTP mode (no session management) (env: STATELESS)").option("--cors-origin <origin>", "CORS allowed origin for HTTP transport (default: none) (env: CORS_ORIGIN)").option("--enable-hsts", "Enable HSTS header for HTTP transport (use when behind HTTPS) (env: MCP_ENABLE_HSTS)").option(
|
|
239
|
+
"--auth-token <token>",
|
|
240
|
+
"Bearer token for HTTP transport authentication (env: MCP_AUTH_TOKEN)"
|
|
241
|
+
).option("--auth-scopes <scopes>", "Comma-separated required OAuth scopes (env: MCP_AUTH_SCOPES)").option("--trust-proxy", "Trust reverse proxy headers (e.g. X-Forwarded-For env: TRUST_PROXY)").option(
|
|
242
|
+
"--public-origin <url>",
|
|
243
|
+
"Public origin URL for webhook verification and OAuth redirects (env: PUBLIC_ORIGIN)"
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function addOAuthOptions(command) {
|
|
248
|
+
return withGroup(command, "OAuth Options", (cmd) => {
|
|
249
|
+
cmd.option("--oauth-enabled", "Enable OAuth 2.1 authentication (env: OAUTH_ENABLED)").option("--oauth-issuer <url>", "OAuth issuer URL (env: OAUTH_ISSUER)").option("--oauth-audience <audience>", "OAuth audience (env: OAUTH_AUDIENCE)").option("--oauth-jwks-uri <uri>", "OAuth JWKS URI (env: OAUTH_JWKS_URI)").option(
|
|
250
|
+
"--oauth-clock-tolerance <seconds>",
|
|
251
|
+
"OAuth clock tolerance in seconds (default: 60) (env: OAUTH_CLOCK_TOLERANCE)",
|
|
252
|
+
"60"
|
|
253
|
+
).option(
|
|
254
|
+
"--oauth-allow-plaintext-loopback",
|
|
255
|
+
"Allow plaintext loopback OAuth issuer (env: OAUTH_ALLOW_PLAINTEXT_LOOPBACK)"
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function addAuditOptions(command) {
|
|
260
|
+
return withGroup(command, "Audit Options", (cmd) => {
|
|
261
|
+
cmd.option(
|
|
262
|
+
"--audit-log <path>",
|
|
263
|
+
'Enable audit logging to the specified JSONL file path, or "stderr" for container mode (env: AUDIT_LOG_PATH)'
|
|
264
|
+
).option(
|
|
265
|
+
"--no-audit-redact",
|
|
266
|
+
"Disable redaction of tool arguments from audit entries (env: AUDIT_REDACT=false)"
|
|
267
|
+
).option(
|
|
268
|
+
"--audit-reads",
|
|
269
|
+
"Enable audit logging for read-scoped tool calls (default: off, env: AUDIT_READS)"
|
|
270
|
+
).option(
|
|
271
|
+
"--audit-log-max-size <bytes>",
|
|
272
|
+
"Maximum audit log file size in bytes before rotation (default: 10485760 / 10MB, env: AUDIT_LOG_MAX_SIZE)",
|
|
273
|
+
String(DEFAULT_AUDIT_LOG_MAX_SIZE_BYTES)
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function addCodeModeOptions(command) {
|
|
278
|
+
return withGroup(command, "Code Mode Options", (cmd) => {
|
|
279
|
+
cmd.option(
|
|
280
|
+
"--allowed-io-roots <paths>",
|
|
281
|
+
"Comma-separated absolute paths or JSON array of paths for strict filesystem jailing (env: ALLOWED_IO_ROOTS)"
|
|
282
|
+
).option(
|
|
283
|
+
"--codemode-internal-full-access",
|
|
284
|
+
"Bypass tool filter constraints within the Code Mode sandbox (all groups accessible via mj.*) (env: CODEMODE_INTERNAL_FULL_ACCESS)",
|
|
285
|
+
false
|
|
286
|
+
).option(
|
|
287
|
+
"--codemode-max-result-size <bytes>",
|
|
288
|
+
"Maximum Code Mode result size in bytes (default: 102400 / 100KB, env: CODE_MODE_MAX_RESULT_SIZE)"
|
|
289
|
+
).option("--tool-filter <filter>", 'Tool filter string (e.g., "starter", "core,search") (env: MEMORY_JOURNAL_MCP_TOOL_FILTER)');
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function addSchedulerOptions(command) {
|
|
293
|
+
return withGroup(command, "Scheduler Options", (cmd) => {
|
|
294
|
+
cmd.option(
|
|
295
|
+
"--backup-interval <minutes>",
|
|
296
|
+
"Automated backup interval in minutes, HTTP only (0 = disabled)",
|
|
297
|
+
"0"
|
|
298
|
+
).option("--keep-backups <count>", "Max backups to retain during automated cleanup", "5").option(
|
|
299
|
+
"--vacuum-interval <minutes>",
|
|
300
|
+
"Database optimize interval in minutes, HTTP only (0 = disabled)",
|
|
301
|
+
"0"
|
|
302
|
+
).option(
|
|
303
|
+
"--rebuild-index-interval <minutes>",
|
|
304
|
+
"Vector index rebuild interval in minutes, HTTP only (0 = disabled)",
|
|
305
|
+
"0"
|
|
306
|
+
).option(
|
|
307
|
+
"--digest-interval <minutes>",
|
|
308
|
+
"Analytics digest interval in minutes, HTTP only (0 = disabled; recommended: 1440 for daily)",
|
|
309
|
+
"0"
|
|
310
|
+
).option(
|
|
311
|
+
"--report-interval <minutes>",
|
|
312
|
+
"Scheduled report generation interval in minutes, HTTP only (0 = disabled)",
|
|
313
|
+
"0"
|
|
314
|
+
).option(
|
|
315
|
+
"--report-webhook-url <url>",
|
|
316
|
+
"Webhook URL for report delivery (POST) (env: REPORT_WEBHOOK_URL)"
|
|
317
|
+
).option(
|
|
318
|
+
"--report-webhook-auth <token>",
|
|
319
|
+
"Optional Authorization header value for the report webhook (env: REPORT_WEBHOOK_AUTH)"
|
|
320
|
+
).option(
|
|
321
|
+
"--report-content-type <type>",
|
|
322
|
+
"Webhook payload format: slack, discord, or json (env: REPORT_CONTENT_TYPE)",
|
|
323
|
+
"slack"
|
|
324
|
+
);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function addPruningOptions(command) {
|
|
328
|
+
return withGroup(command, "Pruning Options", (cmd) => {
|
|
329
|
+
cmd.option(
|
|
330
|
+
"--auto-prune-interval <minutes>",
|
|
331
|
+
"Interval to run autonomous pruning in background (env: AUTO_PRUNE_INTERVAL_MINUTES, 0 = disabled)",
|
|
332
|
+
"0"
|
|
333
|
+
).option(
|
|
334
|
+
"--archive-older-than-days <days>",
|
|
335
|
+
"Archive active entries older than N days with importance below threshold (env: ARCHIVE_OLDER_THAN_DAYS, 0 = disabled)",
|
|
336
|
+
"0"
|
|
337
|
+
).option(
|
|
338
|
+
"--prune-older-than-days <days>",
|
|
339
|
+
"Soft-delete entries older than N days with importance below threshold (env: PRUNE_OLDER_THAN_DAYS, 0 = disabled)",
|
|
340
|
+
"0"
|
|
341
|
+
).option(
|
|
342
|
+
"--hard-delete-older-than-days <days>",
|
|
343
|
+
"Permanently delete soft-deleted entries that have been dead for N days (env: HARD_DELETE_OLDER_THAN_DAYS, 0 = disabled)",
|
|
344
|
+
"0"
|
|
345
|
+
).option(
|
|
346
|
+
"--prune-importance-threshold <n>",
|
|
347
|
+
"Importance score threshold for pruning (env: PRUNE_IMPORTANCE_THRESHOLD, default: 0.15)",
|
|
348
|
+
"0.15"
|
|
349
|
+
).option(
|
|
350
|
+
"--prune-dry-run",
|
|
351
|
+
"Log auto-prune candidates without actually deleting them (env: PRUNE_DRY_RUN)"
|
|
352
|
+
).option(
|
|
353
|
+
"--prune-exclude-tags <tags>",
|
|
354
|
+
"Comma-separated list of tags to exclude from auto-prune (env: PRUNE_EXCLUDE_TAGS)"
|
|
355
|
+
);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function addBriefingOptions(command) {
|
|
359
|
+
return withGroup(command, "Briefing Options", (cmd) => {
|
|
360
|
+
cmd.option(
|
|
361
|
+
"--briefing-importance-threshold <threshold>",
|
|
362
|
+
"Minimum importance score (0.0 to 1.0) for an entry to be included in the briefing (env: BRIEFING_IMPORTANCE_THRESHOLD)"
|
|
363
|
+
).option(
|
|
364
|
+
"--briefing-pr-count <count>",
|
|
365
|
+
"Number of PRs to include in briefing (env: BRIEFING_PR_COUNT)"
|
|
366
|
+
).option(
|
|
367
|
+
"--briefing-entries <count>",
|
|
368
|
+
"Number of journal entries in briefing (env: BRIEFING_ENTRY_COUNT)",
|
|
369
|
+
"3"
|
|
370
|
+
).option(
|
|
371
|
+
"--briefing-commits <count>",
|
|
372
|
+
"Number of commits to include in briefing (env: BRIEFING_COMMIT_COUNT)",
|
|
373
|
+
"3"
|
|
374
|
+
).option(
|
|
375
|
+
"--briefing-summaries <count>",
|
|
376
|
+
"Number of session summaries to show in briefing (env: BRIEFING_SUMMARY_COUNT)",
|
|
377
|
+
"1"
|
|
378
|
+
).option(
|
|
379
|
+
"--briefing-include-team",
|
|
380
|
+
"Include team DB entries in briefing (env: BRIEFING_INCLUDE_TEAM)"
|
|
381
|
+
).option(
|
|
382
|
+
"--briefing-issues <count>",
|
|
383
|
+
"Number of issues to list in briefing; 0 = count only (env: BRIEFING_ISSUE_COUNT)",
|
|
384
|
+
"0"
|
|
385
|
+
).option(
|
|
386
|
+
"--briefing-prs <count>",
|
|
387
|
+
"Number of PRs to list in briefing; 0 = count only (env: BRIEFING_PR_COUNT)",
|
|
388
|
+
"0"
|
|
389
|
+
).option(
|
|
390
|
+
"--briefing-pr-status",
|
|
391
|
+
"Show PR status breakdown in briefing (env: BRIEFING_PR_STATUS)"
|
|
392
|
+
).option(
|
|
393
|
+
"--briefing-milestones <count>",
|
|
394
|
+
"Number of milestones to list in briefing; 0 = hide (env: BRIEFING_MILESTONE_COUNT)",
|
|
395
|
+
"3"
|
|
396
|
+
).option(
|
|
397
|
+
"--rules-file <path>",
|
|
398
|
+
"Path to user rules file for awareness in briefing (env: RULES_FILE_PATH)"
|
|
399
|
+
).option(
|
|
400
|
+
"--skills-dir <path>",
|
|
401
|
+
"Path to skills directory for awareness in briefing (env: SKILLS_DIR_PATH)"
|
|
402
|
+
).option(
|
|
403
|
+
"--briefing-workflows <count>",
|
|
404
|
+
"Number of workflow runs to list in briefing; 0 = status only (env: BRIEFING_WORKFLOW_COUNT)",
|
|
405
|
+
"0"
|
|
406
|
+
).option(
|
|
407
|
+
"--briefing-workflow-status",
|
|
408
|
+
"Show workflow run status breakdown in briefing (env: BRIEFING_WORKFLOW_STATUS)"
|
|
409
|
+
).option(
|
|
410
|
+
"--briefing-copilot",
|
|
411
|
+
"Aggregate Copilot review state across recent PRs in briefing (env: BRIEFING_COPILOT_REVIEWS)"
|
|
412
|
+
).option(
|
|
413
|
+
"--workflow-summary <text>",
|
|
414
|
+
"Workflow summary for memory://workflows resource (env: MEMORY_JOURNAL_WORKFLOW_SUMMARY)"
|
|
415
|
+
);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function addMetricsOptions(command) {
|
|
419
|
+
return withGroup(command, "Metrics Options", (cmd) => {
|
|
420
|
+
cmd.option(
|
|
421
|
+
"--metrics-export <format>",
|
|
422
|
+
"Metrics export format: prometheus (env: METRICS_EXPORT)"
|
|
423
|
+
).option("--persist-metrics", "Persist metrics to disk across server restarts (env: PERSIST_METRICS)").option("--metrics-path <path>", "Custom path to the metrics JSON file (env: METRICS_PATH)").option("--metrics-port <port>", "Standalone metrics server port (env: MJ_METRICS_PORT)");
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function addOutputOptions(command) {
|
|
427
|
+
return withGroup(command, "Command Options", (cmd) => {
|
|
428
|
+
cmd.option("--json", "Output results as a structured JSON envelope");
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
function addServerOptions(command) {
|
|
432
|
+
addCoreOptions(command);
|
|
433
|
+
addDatabaseOptions(command);
|
|
434
|
+
addWorkspaceOptions(command);
|
|
435
|
+
addVectorOptions(command);
|
|
436
|
+
addNetworkOptions(command);
|
|
437
|
+
addOAuthOptions(command);
|
|
438
|
+
addAuditOptions(command);
|
|
439
|
+
addCodeModeOptions(command);
|
|
440
|
+
addSchedulerOptions(command);
|
|
441
|
+
addPruningOptions(command);
|
|
442
|
+
addBriefingOptions(command);
|
|
443
|
+
addMetricsOptions(command);
|
|
444
|
+
return command;
|
|
445
|
+
}
|
|
446
|
+
var ConfigResolver = class {
|
|
447
|
+
constructor(command, cliOptions, configPathOverride) {
|
|
448
|
+
this.command = command;
|
|
449
|
+
this.cliOptions = cliOptions;
|
|
450
|
+
this.loadEnvFiles();
|
|
451
|
+
this.loadConfigFile(configPathOverride);
|
|
452
|
+
}
|
|
453
|
+
command;
|
|
454
|
+
cliOptions;
|
|
455
|
+
configFileOptions = {};
|
|
456
|
+
loadedConfigPath;
|
|
457
|
+
loadEnvFiles() {
|
|
458
|
+
const envPaths = [
|
|
459
|
+
path.resolve(process.cwd(), ".env"),
|
|
460
|
+
path.resolve(process.cwd(), "secrets.env"),
|
|
461
|
+
path.resolve(os.homedir(), ".gemini", "config", "secrets.env"),
|
|
462
|
+
path.resolve(os.homedir(), ".gemini", "config", ".env")
|
|
463
|
+
];
|
|
464
|
+
const loadedKeys = /* @__PURE__ */ new Set();
|
|
465
|
+
for (const filePath of envPaths) {
|
|
466
|
+
if (!fs.existsSync(filePath)) continue;
|
|
467
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
468
|
+
for (const line of content.split("\n")) {
|
|
469
|
+
const trimmed = line.trim();
|
|
470
|
+
if (trimmed && !trimmed.startsWith("#")) {
|
|
471
|
+
const idx = trimmed.indexOf("=");
|
|
472
|
+
if (idx > 0) {
|
|
473
|
+
const key = trimmed.slice(0, idx).trim();
|
|
474
|
+
const val = trimmed.slice(idx + 1).trim();
|
|
475
|
+
if (!(key in process.env) || loadedKeys.has(key)) {
|
|
476
|
+
process.env[key] = val.replace(/^["'](.*)["']$/, "$1");
|
|
477
|
+
loadedKeys.add(key);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
loadConfigFile(configPathOverride) {
|
|
485
|
+
const pathsToTry = configPathOverride ? [path.resolve(configPathOverride)] : [
|
|
486
|
+
path.resolve(process.cwd(), "memory-journal.config.yaml"),
|
|
487
|
+
path.resolve(process.cwd(), "memory-journal.config.yml"),
|
|
488
|
+
path.resolve(process.cwd(), "memory-journal.config.json"),
|
|
489
|
+
path.resolve(os.homedir(), ".gemini", "config", "memory-journal.config.json"),
|
|
490
|
+
path.resolve(os.homedir(), ".gemini", "config", "memory-journal.config.yaml"),
|
|
491
|
+
path.resolve(os.homedir(), ".memory-journal", "config.json")
|
|
492
|
+
];
|
|
493
|
+
for (const filePath of pathsToTry) {
|
|
494
|
+
if (!fs.existsSync(filePath)) {
|
|
495
|
+
if (configPathOverride) {
|
|
496
|
+
throw new ConfigurationError(`Failed to load config file ${filePath}: File does not exist`);
|
|
497
|
+
}
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
try {
|
|
501
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
502
|
+
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
|
|
503
|
+
this.configFileOptions = parse(content) ?? {};
|
|
504
|
+
} else {
|
|
505
|
+
this.configFileOptions = JSON.parse(content) ?? {};
|
|
506
|
+
}
|
|
507
|
+
this.loadedConfigPath = filePath;
|
|
508
|
+
logger.info("Loaded configuration from file", {
|
|
509
|
+
module: "ConfigResolver",
|
|
510
|
+
path: filePath
|
|
511
|
+
});
|
|
512
|
+
return;
|
|
513
|
+
} catch (error) {
|
|
514
|
+
if (configPathOverride) {
|
|
515
|
+
throw new ConfigurationError(`Failed to load config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error instanceof Error ? error : void 0 });
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Resolves a configuration option following precedence:
|
|
522
|
+
* CLI flag > Env Var > Config File > Default
|
|
523
|
+
*/
|
|
524
|
+
resolve(cliKey, envKey, parser) {
|
|
525
|
+
let value;
|
|
526
|
+
let source = "default";
|
|
527
|
+
let isCliSource;
|
|
528
|
+
try {
|
|
529
|
+
isCliSource = this.command.getOptionValueSource(cliKey) === "cli";
|
|
530
|
+
} catch {
|
|
531
|
+
isCliSource = false;
|
|
532
|
+
}
|
|
533
|
+
if (isCliSource) {
|
|
534
|
+
value = this.cliOptions[cliKey];
|
|
535
|
+
source = "cli";
|
|
536
|
+
} else if (envKey && process.env[envKey] !== void 0 && process.env[envKey] !== "") {
|
|
537
|
+
value = process.env[envKey];
|
|
538
|
+
source = "env";
|
|
539
|
+
} else if (this.configFileOptions[cliKey] !== void 0) {
|
|
540
|
+
value = this.configFileOptions[cliKey];
|
|
541
|
+
source = "config";
|
|
542
|
+
} else {
|
|
543
|
+
value = this.cliOptions[cliKey];
|
|
544
|
+
}
|
|
545
|
+
if (value === void 0) {
|
|
546
|
+
return void 0;
|
|
547
|
+
}
|
|
548
|
+
try {
|
|
549
|
+
return parser ? parser(value) : value;
|
|
550
|
+
} catch (err) {
|
|
551
|
+
throw new ConfigurationError(`Failed to parse configuration for ${cliKey} (source: ${source}): ${err instanceof Error ? err.message : String(err)}`, { cause: err instanceof Error ? err : void 0 });
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
_parseNumeric(val, cliKey, min, max, isFloat = false) {
|
|
555
|
+
const valStr = typeof val === "string" || typeof val === "number" || typeof val === "boolean" ? String(val) : JSON.stringify(val);
|
|
556
|
+
const parsed = typeof val === "number" ? val : isFloat ? parseFloat(valStr) : parseInt(valStr, 10);
|
|
557
|
+
if (Number.isNaN(parsed)) {
|
|
558
|
+
throw new ConfigurationError(`Invalid numeric configuration for ${cliKey}: ${valStr}`);
|
|
559
|
+
}
|
|
560
|
+
if (min !== void 0 && parsed < min) {
|
|
561
|
+
throw new ConfigurationError(`Configuration ${cliKey} must be at least ${min}`);
|
|
562
|
+
}
|
|
563
|
+
if (max !== void 0 && parsed > max) {
|
|
564
|
+
throw new ConfigurationError(`Configuration ${cliKey} must be at most ${max}`);
|
|
565
|
+
}
|
|
566
|
+
return parsed;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Helper to resolve a required numeric value
|
|
570
|
+
*/
|
|
571
|
+
resolveIntRequired(cliKey, envKey, min, max) {
|
|
572
|
+
const val = this.resolve(cliKey, envKey);
|
|
573
|
+
if (val === void 0 || val === null) {
|
|
574
|
+
throw new ConfigurationError(`Missing required numeric configuration for ${cliKey}`);
|
|
575
|
+
}
|
|
576
|
+
return this._parseNumeric(val, cliKey, min, max, false);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Helper to resolve an optional numeric value
|
|
580
|
+
*/
|
|
581
|
+
resolveInt(cliKey, envKey, min, max) {
|
|
582
|
+
const val = this.resolve(cliKey, envKey);
|
|
583
|
+
if (val === void 0 || val === null || typeof val === "string" && val.trim() === "") {
|
|
584
|
+
return void 0;
|
|
585
|
+
}
|
|
586
|
+
return this._parseNumeric(val, cliKey, min, max, false);
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Helper to resolve an optional numeric value (supports floats)
|
|
590
|
+
*/
|
|
591
|
+
resolveNumber(cliKey, envKey, min, max) {
|
|
592
|
+
const val = this.resolve(cliKey, envKey);
|
|
593
|
+
if (val === void 0 || val === null || typeof val === "string" && val.trim() === "") {
|
|
594
|
+
return void 0;
|
|
595
|
+
}
|
|
596
|
+
return this._parseNumeric(val, cliKey, min, max, true);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Helper to resolve a boolean value
|
|
600
|
+
*/
|
|
601
|
+
resolveBool(cliKey, envKey) {
|
|
602
|
+
const val = this.resolve(cliKey, envKey);
|
|
603
|
+
if (val === void 0 || val === null || typeof val === "string" && val.trim() === "") return void 0;
|
|
604
|
+
if (typeof val === "boolean") return val;
|
|
605
|
+
if (typeof val === "string") return val.toLowerCase() === "true";
|
|
606
|
+
return Boolean(val);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Helper to resolve a string array (e.g. from comma separated string or actual array)
|
|
610
|
+
*/
|
|
611
|
+
resolveStringArray(cliKey, envKey) {
|
|
612
|
+
const val = this.resolve(cliKey, envKey);
|
|
613
|
+
if (val === void 0 || val === "") return void 0;
|
|
614
|
+
if (Array.isArray(val)) {
|
|
615
|
+
return val.map(String).map((s) => s.trim()).filter(Boolean);
|
|
616
|
+
}
|
|
617
|
+
if (typeof val === "string") {
|
|
618
|
+
return val.split(",").map((s) => s.trim()).filter(Boolean);
|
|
619
|
+
}
|
|
620
|
+
return [typeof val === "string" || typeof val === "number" || typeof val === "boolean" ? String(val) : JSON.stringify(val)];
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
function buildServerOptions(resolver, _options, _command, configErrors) {
|
|
624
|
+
const catchConfig = (fn, fallback) => {
|
|
625
|
+
try {
|
|
626
|
+
return fn();
|
|
627
|
+
} catch (e) {
|
|
628
|
+
configErrors.push(e instanceof Error ? e.message : String(e));
|
|
629
|
+
return fallback;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
const host = catchConfig(() => resolver.resolve("serverHost", "MCP_HOST") ?? process.env["HOST"] ?? void 0, void 0);
|
|
633
|
+
const transport = catchConfig(() => {
|
|
634
|
+
if (resolver.resolveBool("http")) return "http";
|
|
635
|
+
if (resolver.resolveBool("stdio")) return "stdio";
|
|
636
|
+
return resolver.resolve("transport", "TRANSPORT") ?? "stdio";
|
|
637
|
+
}, "stdio");
|
|
638
|
+
const stateless = catchConfig(() => resolver.resolveBool("stateless", "STATELESS") ?? false, false);
|
|
639
|
+
const configDbPath = catchConfig(() => resolver.resolve("dbPath"), void 0);
|
|
640
|
+
const cliDatabase = catchConfig(() => resolver.resolve("database"), void 0);
|
|
641
|
+
const rawDb = catchConfig(() => resolver.resolve("db", "DB_PATH"), defaultDbPath);
|
|
642
|
+
let db = rawDb;
|
|
643
|
+
if ((db === defaultDbPath || db === void 0) && cliDatabase) {
|
|
644
|
+
db = cliDatabase;
|
|
645
|
+
} else if ((db === defaultDbPath || db === void 0) && configDbPath) {
|
|
646
|
+
db = configDbPath;
|
|
647
|
+
}
|
|
648
|
+
const configTestDbPath = catchConfig(() => resolver.resolve("testDbPath"), void 0);
|
|
649
|
+
const rawTestDb = catchConfig(() => resolver.resolve("testDb", "TEST_DB_PATH"), void 0);
|
|
650
|
+
const testDb = rawTestDb ?? configTestDbPath;
|
|
651
|
+
const configTeamDbPath = catchConfig(() => resolver.resolve("teamDbPath"), void 0);
|
|
652
|
+
const cliTeamDatabase = catchConfig(() => resolver.resolve("teamDatabase"), void 0);
|
|
653
|
+
const rawTeamDb = catchConfig(() => resolver.resolve("teamDb", "TEAM_DB_PATH"), defaultTeamDbPath);
|
|
654
|
+
let teamDb = rawTeamDb;
|
|
655
|
+
if ((teamDb === defaultTeamDbPath || teamDb === void 0) && cliTeamDatabase) {
|
|
656
|
+
teamDb = cliTeamDatabase;
|
|
657
|
+
} else if ((teamDb === defaultTeamDbPath || teamDb === void 0) && configTeamDbPath) {
|
|
658
|
+
teamDb = configTeamDbPath;
|
|
659
|
+
}
|
|
660
|
+
const configTestTeamDbPath = catchConfig(() => resolver.resolve("testTeamDbPath"), void 0);
|
|
661
|
+
const rawTestTeamDb = catchConfig(() => resolver.resolve("testTeamDb", "TEST_TEAM_DB_PATH"), void 0);
|
|
662
|
+
const testTeamDb = rawTestTeamDb ?? configTestTeamDbPath;
|
|
663
|
+
const codemodeMaxResultSize = catchConfig(() => resolver.resolve("codemodeMaxResultSize", "CODE_MODE_MAX_RESULT_SIZE"), void 0);
|
|
664
|
+
if (codemodeMaxResultSize) {
|
|
665
|
+
process.env["CODE_MODE_MAX_RESULT_SIZE"] = codemodeMaxResultSize;
|
|
666
|
+
}
|
|
667
|
+
const metricsPort = catchConfig(() => resolver.resolve("metricsPort", "MJ_METRICS_PORT"), void 0);
|
|
668
|
+
if (metricsPort) {
|
|
669
|
+
process.env["MJ_METRICS_PORT"] = metricsPort;
|
|
670
|
+
}
|
|
671
|
+
const authScopes = catchConfig(() => resolver.resolve("authScopes", "MCP_AUTH_SCOPES"), void 0);
|
|
672
|
+
if (authScopes !== void 0 && authScopes.trim() !== "") {
|
|
673
|
+
process.env["MCP_AUTH_SCOPES"] = authScopes.trim();
|
|
674
|
+
}
|
|
675
|
+
const auditLogPath = catchConfig(() => resolver.resolve("auditLog", "AUDIT_LOG_PATH"), void 0);
|
|
676
|
+
const auditConfig = auditLogPath ? {
|
|
677
|
+
enabled: true,
|
|
678
|
+
logPath: auditLogPath,
|
|
679
|
+
redact: catchConfig(() => resolver.resolveBool("auditRedact", "AUDIT_REDACT") ?? true, true),
|
|
680
|
+
auditReads: catchConfig(() => resolver.resolveBool("auditReads", "AUDIT_READS") ?? false, false),
|
|
681
|
+
maxSizeBytes: catchConfig(() => resolver.resolveInt("auditLogMaxSize", "AUDIT_LOG_MAX_SIZE", 1024) ?? 10485760, 10485760)
|
|
682
|
+
} : void 0;
|
|
683
|
+
const serverOptions = {
|
|
684
|
+
transport,
|
|
685
|
+
port: catchConfig(() => resolver.resolveInt("port", "PORT", 1, 65535) ?? 3e3, 3e3),
|
|
686
|
+
host,
|
|
687
|
+
statelessHttp: stateless,
|
|
688
|
+
dbPath: db ?? defaultDbPath,
|
|
689
|
+
testDbPath: testDb,
|
|
690
|
+
teamDbPath: teamDb,
|
|
691
|
+
testTeamDbPath: testTeamDb,
|
|
692
|
+
teamDefaultRole: catchConfig(() => resolver.resolve("teamDefaultRole", "TEAM_DEFAULT_ROLE") ?? "denied", "denied"),
|
|
693
|
+
teamAdmin: catchConfig(() => resolver.resolve("teamAdmin", "TEAM_ADMIN"), void 0),
|
|
694
|
+
toolFilter: catchConfig(() => resolver.resolve("toolFilter", "MEMORY_JOURNAL_MCP_TOOL_FILTER"), void 0),
|
|
695
|
+
defaultProjectNumber: catchConfig(() => {
|
|
696
|
+
const configVal = resolver.resolve("defaultProjectNumber");
|
|
697
|
+
const val = resolver.resolve("defaultProject", "DEFAULT_PROJECT_NUMBER") ?? configVal;
|
|
698
|
+
return val !== void 0 && val !== null ? parseInt(String(val), 10) : void 0;
|
|
699
|
+
}, void 0),
|
|
700
|
+
defaultWorkspaceId: catchConfig(() => resolver.resolve("defaultWorkspaceId", "DEFAULT_WORKSPACE_ID"), void 0),
|
|
701
|
+
autoRebuildIndex: catchConfig(() => resolver.resolveBool("autoRebuildIndex", "AUTO_REBUILD_INDEX") ?? false, false),
|
|
702
|
+
corsOrigins: catchConfig(() => resolver.resolveStringArray("corsOrigin", "CORS_ORIGIN"), void 0),
|
|
703
|
+
enableHSTS: catchConfig(() => resolver.resolveBool("enableHsts", "MCP_ENABLE_HSTS") ?? false, false),
|
|
704
|
+
authToken: catchConfig(() => resolver.resolve("authToken", "MCP_AUTH_TOKEN"), void 0),
|
|
705
|
+
scheduler: {
|
|
706
|
+
backupIntervalMinutes: catchConfig(() => resolver.resolveInt("backupInterval", "BACKUP_INTERVAL", 0) ?? 0, 0),
|
|
707
|
+
keepBackups: catchConfig(() => resolver.resolveInt("keepBackups", "KEEP_BACKUPS", 1, 100) ?? 5, 5),
|
|
708
|
+
vacuumIntervalMinutes: catchConfig(() => resolver.resolveInt("vacuumInterval", "VACUUM_INTERVAL", 0) ?? 0, 0),
|
|
709
|
+
rebuildIndexIntervalMinutes: catchConfig(() => resolver.resolveInt("rebuildIndexInterval", "REBUILD_INDEX_INTERVAL", 0) ?? 0, 0),
|
|
710
|
+
digestIntervalMinutes: catchConfig(() => resolver.resolveInt("digestInterval", "DIGEST_INTERVAL", 0) ?? 0, 0),
|
|
711
|
+
pruneIntervalMinutes: catchConfig(() => resolver.resolveInt("autoPruneInterval", "AUTO_PRUNE_INTERVAL_MINUTES", 0) ?? 0, 0),
|
|
712
|
+
reportIntervalMinutes: catchConfig(() => resolver.resolveInt("reportInterval", "REPORT_INTERVAL", 0) ?? 0, 0),
|
|
713
|
+
reportDeliveryOptions: {
|
|
714
|
+
webhookUrl: catchConfig(() => resolver.resolve("reportWebhookUrl", "REPORT_WEBHOOK_URL") ?? "", ""),
|
|
715
|
+
webhookAuth: catchConfig(() => resolver.resolve("reportWebhookAuth", "REPORT_WEBHOOK_AUTH"), void 0),
|
|
716
|
+
contentType: catchConfig(() => resolver.resolve("reportContentType", "REPORT_CONTENT_TYPE") ?? "slack", "slack")
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
oauthEnabled: catchConfig(() => resolver.resolveBool("oauthEnabled", "OAUTH_ENABLED") ?? false, false),
|
|
720
|
+
oauthIssuer: catchConfig(() => resolver.resolve("oauthIssuer", "OAUTH_ISSUER"), void 0),
|
|
721
|
+
oauthAudience: catchConfig(() => resolver.resolve("oauthAudience", "OAUTH_AUDIENCE"), void 0),
|
|
722
|
+
oauthJwksUri: catchConfig(() => resolver.resolve("oauthJwksUri", "OAUTH_JWKS_URI"), void 0),
|
|
723
|
+
oauthClockTolerance: catchConfig(() => resolver.resolveInt("oauthClockTolerance", "OAUTH_CLOCK_TOLERANCE", 0) ?? 60, 60),
|
|
724
|
+
allowPlaintextLoopbackOAuth: catchConfig(() => resolver.resolveBool("oauthAllowPlaintextLoopback", "OAUTH_ALLOW_PLAINTEXT_LOOPBACK") ?? false, false),
|
|
725
|
+
trustProxy: catchConfig(() => resolver.resolveBool("trustProxy", "TRUST_PROXY") ?? false, false),
|
|
726
|
+
publicOrigin: catchConfig(() => resolver.resolve("publicOrigin", "PUBLIC_ORIGIN"), void 0),
|
|
727
|
+
codemodeInternalFullAccess: catchConfig(() => resolver.resolveBool("codemodeInternalFullAccess", "CODEMODE_INTERNAL_FULL_ACCESS") ?? false, false),
|
|
728
|
+
projectRegistry: catchConfig(() => {
|
|
729
|
+
const raw = resolver.resolve("projectRegistry", "PROJECT_REGISTRY");
|
|
730
|
+
if (raw === void 0 || raw === null || raw === "") return void 0;
|
|
731
|
+
if (typeof raw === "string" && raw.length > 51200) throw new Error("PROJECT_REGISTRY environment variable exceeds size limit (50KB)");
|
|
732
|
+
try {
|
|
733
|
+
const registrySchema = z.record(z.string(), z.object({ path: z.string().min(1), project_number: z.number().nullable().optional() }).strict());
|
|
734
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
735
|
+
const safeParsed = JSON.parse(JSON.stringify(parsed));
|
|
736
|
+
const validated = registrySchema.parse(safeParsed);
|
|
737
|
+
for (const key of Object.keys(validated)) {
|
|
738
|
+
const entry = validated[key];
|
|
739
|
+
if (!entry?.path) continue;
|
|
740
|
+
if (!path.isAbsolute(entry.path)) throw new Error(`Project registry path must be an absolute path: ${entry.path}`);
|
|
741
|
+
const resolvedPath = path.resolve(entry.path);
|
|
742
|
+
try {
|
|
743
|
+
const stat = fs.lstatSync(resolvedPath);
|
|
744
|
+
if (stat.isSymbolicLink()) throw new Error(`Project registry path cannot be a symlink: ${resolvedPath}`);
|
|
745
|
+
if (!stat.isDirectory()) throw new Error(`Project registry path is not a directory: ${resolvedPath}`);
|
|
746
|
+
} catch (e) {
|
|
747
|
+
throw new Error(`Project registry path error: ${resolvedPath}`, { cause: e });
|
|
748
|
+
}
|
|
749
|
+
entry.path = resolvedPath;
|
|
750
|
+
}
|
|
751
|
+
process.env["PROJECT_REGISTRY"] = JSON.stringify(validated);
|
|
752
|
+
return validated;
|
|
753
|
+
} catch (e) {
|
|
754
|
+
throw new Error(`Failed to parse PROJECT_REGISTRY: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
755
|
+
}
|
|
756
|
+
}, void 0),
|
|
757
|
+
additionalTeamDbs: catchConfig(() => {
|
|
758
|
+
const raw = resolver.resolve("additionalTeamDbs", "ADDITIONAL_TEAM_DBS");
|
|
759
|
+
if (raw === void 0 || raw === null || raw === "") return void 0;
|
|
760
|
+
if (typeof raw === "string" && raw.length > 51200) throw new Error("ADDITIONAL_TEAM_DBS exceeds size limit");
|
|
761
|
+
try {
|
|
762
|
+
const dbSchema = z.record(z.string().min(1), z.string().min(1));
|
|
763
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
764
|
+
const validated = dbSchema.parse(JSON.parse(JSON.stringify(parsed)));
|
|
765
|
+
for (const [label, dbPath] of Object.entries(validated)) {
|
|
766
|
+
if (!path.isAbsolute(dbPath)) throw new Error(`Additional team DB path must be absolute: ${dbPath}`);
|
|
767
|
+
const resolvedPath = path.resolve(dbPath);
|
|
768
|
+
try {
|
|
769
|
+
if (fs.existsSync(resolvedPath)) {
|
|
770
|
+
const stat = fs.lstatSync(resolvedPath);
|
|
771
|
+
if (stat.isSymbolicLink()) throw new Error(`Additional team DB path cannot be a symlink: ${resolvedPath}`);
|
|
772
|
+
}
|
|
773
|
+
} catch {
|
|
774
|
+
}
|
|
775
|
+
validated[label] = resolvedPath;
|
|
776
|
+
}
|
|
777
|
+
return validated;
|
|
778
|
+
} catch (e) {
|
|
779
|
+
throw new Error(`Failed to parse ADDITIONAL_TEAM_DBS: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
780
|
+
}
|
|
781
|
+
}, void 0),
|
|
782
|
+
allowedIoRoots: catchConfig(() => {
|
|
783
|
+
const raw = resolver.resolve("allowedIoRoots", "ALLOWED_IO_ROOTS");
|
|
784
|
+
if (raw === void 0 || raw === null || raw === "") return void 0;
|
|
785
|
+
if (typeof raw === "string" && raw.length > 51200) throw new Error("ALLOWED_IO_ROOTS configuration exceeds size limit (50KB)");
|
|
786
|
+
try {
|
|
787
|
+
let parsed = raw;
|
|
788
|
+
if (typeof raw === "string") {
|
|
789
|
+
if (raw.trim().startsWith("[")) {
|
|
790
|
+
parsed = JSON.parse(raw);
|
|
791
|
+
} else {
|
|
792
|
+
parsed = raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
if (Array.isArray(parsed) && parsed.every((p2) => typeof p2 === "string" && path.isAbsolute(p2))) {
|
|
796
|
+
return parsed;
|
|
797
|
+
}
|
|
798
|
+
if (Array.isArray(parsed)) {
|
|
799
|
+
throw new Error("All paths must be absolute");
|
|
800
|
+
}
|
|
801
|
+
throw new Error("Must be an array of absolute paths");
|
|
802
|
+
} catch (e) {
|
|
803
|
+
throw new Error(`Invalid ALLOWED_IO_ROOTS configuration: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
804
|
+
}
|
|
805
|
+
}, void 0),
|
|
806
|
+
briefingConfig: {
|
|
807
|
+
commitCount: catchConfig(() => resolver.resolveInt("briefingCommits", "BRIEFING_COMMIT_COUNT") ?? 3, 3),
|
|
808
|
+
entryCount: catchConfig(() => resolver.resolveInt("briefingEntries", "BRIEFING_ENTRY_COUNT") ?? 3, 3),
|
|
809
|
+
summaryCount: catchConfig(() => resolver.resolveInt("briefingSummaries", "BRIEFING_SUMMARY_COUNT") ?? 1, 1),
|
|
810
|
+
includeTeam: catchConfig(() => resolver.resolveBool("briefingIncludeTeam", "BRIEFING_INCLUDE_TEAM") ?? false, false),
|
|
811
|
+
issueCount: catchConfig(() => resolver.resolveInt("briefingIssues", "BRIEFING_ISSUE_COUNT") ?? 0, 0),
|
|
812
|
+
prCount: catchConfig(() => resolver.resolveInt("briefingPrCount") ?? resolver.resolveInt("briefingPrs", "BRIEFING_PR_COUNT") ?? 0, 0),
|
|
813
|
+
prStatusBreakdown: catchConfig(() => resolver.resolveBool("briefingPrStatus", "BRIEFING_PR_STATUS") ?? false, false),
|
|
814
|
+
milestoneCount: catchConfig(() => resolver.resolveInt("briefingMilestones", "BRIEFING_MILESTONE_COUNT") ?? 3, 3),
|
|
815
|
+
rulesFilePath: catchConfig(() => {
|
|
816
|
+
const val = resolver.resolve("rulesFile", "RULES_FILE_PATH");
|
|
817
|
+
return val ? path.resolve(process.cwd(), val) : void 0;
|
|
818
|
+
}, void 0),
|
|
819
|
+
skillsDirPath: catchConfig(() => {
|
|
820
|
+
const val = resolver.resolve("skillsDir", "SKILLS_DIR_PATH");
|
|
821
|
+
return val ? path.resolve(process.cwd(), val) : void 0;
|
|
822
|
+
}, void 0),
|
|
823
|
+
workflowCount: catchConfig(() => resolver.resolveInt("briefingWorkflows", "BRIEFING_WORKFLOW_COUNT") ?? 0, 0),
|
|
824
|
+
workflowStatusBreakdown: catchConfig(() => resolver.resolveBool("briefingWorkflowStatus", "BRIEFING_WORKFLOW_STATUS") ?? false, false),
|
|
825
|
+
copilotReviews: catchConfig(() => resolver.resolveBool("briefingCopilot", "BRIEFING_COPILOT_REVIEWS") ?? false, false),
|
|
826
|
+
workflowSummary: catchConfig(() => resolver.resolve("workflowSummary", "MEMORY_JOURNAL_WORKFLOW_SUMMARY"), void 0),
|
|
827
|
+
defaultProjectNumber: catchConfig(() => {
|
|
828
|
+
const val = resolver.resolve("defaultProject", "DEFAULT_PROJECT_NUMBER");
|
|
829
|
+
return val ? parseInt(val, 10) : void 0;
|
|
830
|
+
}, void 0),
|
|
831
|
+
briefingImportanceThreshold: catchConfig(() => {
|
|
832
|
+
const val = resolver.resolve("briefingImportanceThreshold", "BRIEFING_IMPORTANCE_THRESHOLD");
|
|
833
|
+
if (typeof val === "number") return val;
|
|
834
|
+
if (typeof val === "string") return parseFloat(val);
|
|
835
|
+
return 0.3;
|
|
836
|
+
}, 0.3)
|
|
837
|
+
},
|
|
838
|
+
auditConfig,
|
|
839
|
+
autoPruneIntervalMinutes: catchConfig(() => resolver.resolveInt("autoPruneInterval", "AUTO_PRUNE_INTERVAL_MINUTES", 0) ?? 0, 0),
|
|
840
|
+
archiveOlderThanDays: catchConfig(() => resolver.resolveNumber("archiveOlderThanDays", "ARCHIVE_OLDER_THAN_DAYS", 0) ?? 0, 0),
|
|
841
|
+
pruneOlderThanDays: catchConfig(() => resolver.resolveNumber("pruneOlderThanDays", "PRUNE_OLDER_THAN_DAYS", 0) ?? 0, 0),
|
|
842
|
+
hardDeleteOlderThanDays: catchConfig(() => resolver.resolveNumber("hardDeleteOlderThanDays", "HARD_DELETE_OLDER_THAN_DAYS", 0) ?? 0, 0),
|
|
843
|
+
pruneImportanceThreshold: catchConfig(() => {
|
|
844
|
+
const val = resolver.resolve("pruneImportanceThreshold", "PRUNE_IMPORTANCE_THRESHOLD");
|
|
845
|
+
if (typeof val === "number") return val;
|
|
846
|
+
if (typeof val === "string") return parseFloat(val);
|
|
847
|
+
return 0.15;
|
|
848
|
+
}, 0.15),
|
|
849
|
+
pruneDryRun: catchConfig(() => resolver.resolveBool("pruneDryRun", "PRUNE_DRY_RUN") ?? false, false),
|
|
850
|
+
pruneExcludeTags: catchConfig(() => resolver.resolveStringArray("pruneExcludeTags", "PRUNE_EXCLUDE_TAGS"), void 0),
|
|
851
|
+
embeddingModel: catchConfig(() => resolver.resolve("embeddingModel", "EMBEDDING_MODEL"), void 0),
|
|
852
|
+
metricsExport: catchConfig(() => {
|
|
853
|
+
const raw = resolver.resolve("metricsExport", "METRICS_EXPORT");
|
|
854
|
+
if (raw) {
|
|
855
|
+
if (raw !== "prometheus") throw new Error(`Unsupported metrics export format: ${raw}`);
|
|
856
|
+
return "prometheus";
|
|
857
|
+
}
|
|
858
|
+
return void 0;
|
|
859
|
+
}, void 0),
|
|
860
|
+
persistMetrics: catchConfig(() => resolver.resolveBool("persistMetrics", "PERSIST_METRICS") ?? false, false),
|
|
861
|
+
metricsPath: catchConfig(() => resolver.resolve("metricsPath", "METRICS_PATH"), void 0),
|
|
862
|
+
metricsPort: catchConfig(() => resolver.resolveInt("metricsPort", "MJ_METRICS_PORT", 0, 65535), void 0),
|
|
863
|
+
configFilePath: catchConfig(() => resolver.loadedConfigPath, void 0),
|
|
864
|
+
maxToolInputElements: catchConfig(() => {
|
|
865
|
+
const raw = resolver.resolve("maxToolInputElements", "MAX_TOOL_INPUT_ELEMENTS");
|
|
866
|
+
if (raw === void 0 || raw === null || raw === "") return void 0;
|
|
867
|
+
if (raw === Infinity || typeof raw === "string" && raw.trim().toLowerCase() === "infinity") {
|
|
868
|
+
return Infinity;
|
|
869
|
+
}
|
|
870
|
+
return resolver.resolveInt("maxToolInputElements", "MAX_TOOL_INPUT_ELEMENTS", 0);
|
|
871
|
+
}, void 0),
|
|
872
|
+
agentHealing: catchConfig(() => resolver.resolveBool("agentHealing", "MCP_AGENT_HEALING") ?? true, true)
|
|
873
|
+
};
|
|
874
|
+
return { serverOptions, transport, db, teamDb, host };
|
|
875
|
+
}
|
|
876
|
+
var safeCoerceNumber = z.preprocess((val) => {
|
|
877
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
878
|
+
const num = Number(val);
|
|
879
|
+
return isNaN(num) ? void 0 : num;
|
|
880
|
+
}, z.number().optional());
|
|
881
|
+
var safeCoerceValidationStatus = z.preprocess((val) => {
|
|
882
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
883
|
+
if (typeof val === "boolean") {
|
|
884
|
+
return val ? "passed" : "failed";
|
|
885
|
+
}
|
|
886
|
+
if (typeof val === "string") {
|
|
887
|
+
const lower = val.trim().toLowerCase();
|
|
888
|
+
if (["passed", "pass", "success", "ok", "validated", "valid", "verified", "true", "1"].includes(lower)) {
|
|
889
|
+
return "passed";
|
|
890
|
+
}
|
|
891
|
+
if (["failed", "fail", "error", "failing", "false", "0"].includes(lower)) {
|
|
892
|
+
return "failed";
|
|
893
|
+
}
|
|
894
|
+
if (["none", "null", "undefined", "skip", "skipped", "unknown", "pending"].includes(lower)) {
|
|
895
|
+
return "none";
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return "none";
|
|
899
|
+
}, z.enum(["passed", "failed", "none"]).optional());
|
|
900
|
+
var coreOptionsSchema = z.object({
|
|
901
|
+
config: z.string().optional(),
|
|
902
|
+
dumpConfig: z.boolean().optional(),
|
|
903
|
+
logLevel: z.string().optional(),
|
|
904
|
+
maxToolInputElements: z.string().optional(),
|
|
905
|
+
agentHealing: z.boolean().optional()
|
|
906
|
+
});
|
|
907
|
+
var databaseOptionsSchema = z.object({
|
|
908
|
+
db: z.string().optional(),
|
|
909
|
+
database: z.string().optional(),
|
|
910
|
+
teamDb: z.string().optional(),
|
|
911
|
+
teamDatabase: z.string().optional(),
|
|
912
|
+
additionalTeamDbs: z.string().optional(),
|
|
913
|
+
teamDefaultRole: z.string().optional(),
|
|
914
|
+
teamAdmin: z.string().optional()
|
|
915
|
+
});
|
|
916
|
+
var workspaceOptionsSchema = z.object({
|
|
917
|
+
defaultProject: safeCoerceNumber,
|
|
918
|
+
defaultWorkspaceId: z.string().optional()
|
|
919
|
+
});
|
|
920
|
+
var vectorOptionsSchema = z.object({
|
|
921
|
+
embeddingModel: z.string().optional(),
|
|
922
|
+
autoRebuildIndex: z.boolean().optional()
|
|
923
|
+
});
|
|
924
|
+
var networkOptionsSchema = z.object({
|
|
925
|
+
transport: z.string().optional(),
|
|
926
|
+
http: z.boolean().optional(),
|
|
927
|
+
stdio: z.boolean().optional(),
|
|
928
|
+
port: z.string().optional(),
|
|
929
|
+
serverHost: z.string().optional(),
|
|
930
|
+
stateless: z.boolean().optional(),
|
|
931
|
+
corsOrigin: z.string().optional(),
|
|
932
|
+
enableHsts: z.boolean().optional(),
|
|
933
|
+
authToken: z.string().optional(),
|
|
934
|
+
authScopes: z.string().optional(),
|
|
935
|
+
trustProxy: z.boolean().optional(),
|
|
936
|
+
publicOrigin: z.string().optional()
|
|
937
|
+
});
|
|
938
|
+
var oauthOptionsSchema = z.object({
|
|
939
|
+
oauthEnabled: z.boolean().optional(),
|
|
940
|
+
oauthIssuer: z.string().optional(),
|
|
941
|
+
oauthAudience: z.string().optional(),
|
|
942
|
+
oauthJwksUri: z.string().optional(),
|
|
943
|
+
oauthClockTolerance: z.string().optional(),
|
|
944
|
+
oauthAllowPlaintextLoopback: z.boolean().optional()
|
|
945
|
+
});
|
|
946
|
+
var auditOptionsSchema = z.object({
|
|
947
|
+
auditLog: z.string().optional(),
|
|
948
|
+
auditRedact: z.boolean().optional(),
|
|
949
|
+
auditReads: z.boolean().optional(),
|
|
950
|
+
auditLogMaxSize: z.string().optional()
|
|
951
|
+
});
|
|
952
|
+
var codeModeOptionsSchema = z.object({
|
|
953
|
+
allowedIoRoots: z.string().optional(),
|
|
954
|
+
codemodeInternalFullAccess: z.boolean().optional(),
|
|
955
|
+
codemodeMaxResultSize: z.string().optional(),
|
|
956
|
+
toolFilter: z.string().optional()
|
|
957
|
+
});
|
|
958
|
+
var schedulerOptionsSchema = z.object({
|
|
959
|
+
backupInterval: z.string().optional(),
|
|
960
|
+
keepBackups: z.string().optional(),
|
|
961
|
+
vacuumInterval: z.string().optional(),
|
|
962
|
+
rebuildIndexInterval: z.string().optional(),
|
|
963
|
+
digestInterval: z.string().optional(),
|
|
964
|
+
reportInterval: z.string().optional(),
|
|
965
|
+
reportWebhookUrl: z.string().optional(),
|
|
966
|
+
reportWebhookAuth: z.string().optional(),
|
|
967
|
+
reportContentType: z.string().optional()
|
|
968
|
+
});
|
|
969
|
+
var pruningOptionsSchema = z.object({
|
|
970
|
+
autoPruneInterval: z.string().optional(),
|
|
971
|
+
archiveOlderThanDays: z.string().optional(),
|
|
972
|
+
pruneOlderThanDays: z.string().optional(),
|
|
973
|
+
hardDeleteOlderThanDays: z.string().optional(),
|
|
974
|
+
pruneImportanceThreshold: z.string().optional(),
|
|
975
|
+
pruneDryRun: z.boolean().optional(),
|
|
976
|
+
pruneExcludeTags: z.string().optional()
|
|
977
|
+
});
|
|
978
|
+
var briefingOptionsSchema = z.object({
|
|
979
|
+
briefingImportanceThreshold: z.string().optional(),
|
|
980
|
+
briefingPrCount: z.string().optional(),
|
|
981
|
+
briefingEntries: z.string().optional(),
|
|
982
|
+
briefingCommits: z.string().optional(),
|
|
983
|
+
briefingSummaries: z.string().optional(),
|
|
984
|
+
briefingIncludeTeam: z.boolean().optional(),
|
|
985
|
+
briefingIssues: z.string().optional(),
|
|
986
|
+
briefingPrs: z.string().optional(),
|
|
987
|
+
briefingPrStatus: z.boolean().optional(),
|
|
988
|
+
briefingMilestones: z.string().optional(),
|
|
989
|
+
rulesFile: z.string().optional(),
|
|
990
|
+
skillsDir: z.string().optional(),
|
|
991
|
+
briefingWorkflows: z.string().optional(),
|
|
992
|
+
briefingWorkflowStatus: z.boolean().optional(),
|
|
993
|
+
briefingCopilot: z.boolean().optional(),
|
|
994
|
+
workflowSummary: z.string().optional()
|
|
995
|
+
});
|
|
996
|
+
var metricsOptionsSchema = z.object({
|
|
997
|
+
metricsExport: z.string().optional(),
|
|
998
|
+
persistMetrics: z.boolean().optional(),
|
|
999
|
+
metricsPath: z.string().optional(),
|
|
1000
|
+
metricsPort: z.string().optional()
|
|
1001
|
+
});
|
|
1002
|
+
var outputOptionsSchema = z.object({
|
|
1003
|
+
json: z.boolean().optional()
|
|
1004
|
+
});
|
|
1005
|
+
var serverOptionsSchema = coreOptionsSchema.extend(databaseOptionsSchema.shape).extend(workspaceOptionsSchema.shape).extend(vectorOptionsSchema.shape).extend(networkOptionsSchema.shape).extend(oauthOptionsSchema.shape).extend(auditOptionsSchema.shape).extend(codeModeOptionsSchema.shape).extend(schedulerOptionsSchema.shape).extend(pruningOptionsSchema.shape).extend(briefingOptionsSchema.shape).extend(metricsOptionsSchema.shape);
|
|
1006
|
+
var execOptionsSchema = coreOptionsSchema.extend(databaseOptionsSchema.shape).extend(workspaceOptionsSchema.shape).extend(vectorOptionsSchema.shape).extend(codeModeOptionsSchema.shape).extend(auditOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1007
|
+
var adminBackupOptionsSchema = z.object({
|
|
1008
|
+
dest: z.string().optional()
|
|
1009
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1010
|
+
var adminRestoreOptionsSchema = coreOptionsSchema.extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1011
|
+
var adminVacuumOptionsSchema = coreOptionsSchema.extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1012
|
+
var adminPruneOptionsSchema = pruningOptionsSchema.extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape).extend({
|
|
1013
|
+
// Specific overrides from prune command
|
|
1014
|
+
archiveOlderThanDays: z.coerce.number().optional(),
|
|
1015
|
+
pruneOlderThanDays: z.coerce.number().optional(),
|
|
1016
|
+
hardDeleteOlderThanDays: z.coerce.number().optional(),
|
|
1017
|
+
importanceThreshold: z.coerce.number().optional(),
|
|
1018
|
+
pruneImportanceThreshold: z.coerce.number().optional(),
|
|
1019
|
+
dryRun: z.boolean().optional(),
|
|
1020
|
+
excludeTags: z.string().optional()
|
|
1021
|
+
});
|
|
1022
|
+
var baseEntryOptionsSchema = z.object({
|
|
1023
|
+
file: z.string().optional(),
|
|
1024
|
+
contentFile: z.string().optional(),
|
|
1025
|
+
content: z.string().optional(),
|
|
1026
|
+
body: z.string().optional(),
|
|
1027
|
+
description: z.string().optional(),
|
|
1028
|
+
title: z.string().optional(),
|
|
1029
|
+
summary: z.string().optional(),
|
|
1030
|
+
type: z.string().optional(),
|
|
1031
|
+
category: z.string().optional(),
|
|
1032
|
+
tags: z.string().optional(),
|
|
1033
|
+
tag: z.string().optional(),
|
|
1034
|
+
project: safeCoerceNumber,
|
|
1035
|
+
projectNumber: safeCoerceNumber,
|
|
1036
|
+
project_number: safeCoerceNumber,
|
|
1037
|
+
trustScore: safeCoerceNumber,
|
|
1038
|
+
trust_score: safeCoerceNumber,
|
|
1039
|
+
confidence: safeCoerceNumber,
|
|
1040
|
+
impactScore: safeCoerceNumber,
|
|
1041
|
+
impact_score: safeCoerceNumber,
|
|
1042
|
+
validationStatus: safeCoerceValidationStatus,
|
|
1043
|
+
validation_status: safeCoerceValidationStatus,
|
|
1044
|
+
validation: safeCoerceValidationStatus,
|
|
1045
|
+
workspace: z.string().optional(),
|
|
1046
|
+
workspaceId: z.string().optional(),
|
|
1047
|
+
workspace_id: z.string().optional(),
|
|
1048
|
+
sessionId: z.string().optional(),
|
|
1049
|
+
session_id: z.string().optional(),
|
|
1050
|
+
relatedTo: z.string().optional(),
|
|
1051
|
+
relationships: z.string().optional(),
|
|
1052
|
+
relFile: z.string().optional(),
|
|
1053
|
+
autoContext: z.string().optional(),
|
|
1054
|
+
autoContextFile: z.string().optional(),
|
|
1055
|
+
metadata: z.string().optional(),
|
|
1056
|
+
team: z.boolean().optional()
|
|
1057
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1058
|
+
var createEntryOptionsSchema = baseEntryOptionsSchema;
|
|
1059
|
+
var updateEntryOptionsSchema = baseEntryOptionsSchema.extend({
|
|
1060
|
+
id: z.coerce.number(),
|
|
1061
|
+
expectedVersion: z.coerce.number()
|
|
1062
|
+
});
|
|
1063
|
+
var searchOptionsSchema = z.object({
|
|
1064
|
+
query: z.string().optional(),
|
|
1065
|
+
term: z.string().optional(),
|
|
1066
|
+
keyword: z.string().optional(),
|
|
1067
|
+
mode: z.enum(["auto", "fts", "semantic", "hybrid"]).optional(),
|
|
1068
|
+
team: z.boolean().optional(),
|
|
1069
|
+
limit: z.coerce.number().optional()
|
|
1070
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1071
|
+
var ioExportJsonOptionsSchema = z.object({
|
|
1072
|
+
dest: z.string().optional()
|
|
1073
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1074
|
+
var ioExportMarkdownOptionsSchema = z.object({
|
|
1075
|
+
dir: z.string().optional()
|
|
1076
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1077
|
+
var ioImportMarkdownOptionsSchema = z.object({
|
|
1078
|
+
dir: z.string().optional()
|
|
1079
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1080
|
+
var ioImportExternalOptionsSchema = z.object({
|
|
1081
|
+
dir: z.string().optional(),
|
|
1082
|
+
format: z.enum(["notion", "obsidian", "logseq"]).optional()
|
|
1083
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1084
|
+
var visualizeOptionsSchema = z.object({
|
|
1085
|
+
out: z.string().optional(),
|
|
1086
|
+
team: z.boolean().optional()
|
|
1087
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape);
|
|
1088
|
+
var analyticsOptionsSchema = z.object({
|
|
1089
|
+
team: z.boolean().optional()
|
|
1090
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1091
|
+
var adminAuditSearchOptionsSchema = z.object({
|
|
1092
|
+
limit: z.coerce.number().optional(),
|
|
1093
|
+
tool: z.string().optional(),
|
|
1094
|
+
user: z.string().optional(),
|
|
1095
|
+
category: z.string().optional(),
|
|
1096
|
+
status: z.enum(["success", "error"]).optional()
|
|
1097
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(auditOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1098
|
+
var adminRebuildIndexOptionsSchema = z.object({
|
|
1099
|
+
team: z.boolean().optional()
|
|
1100
|
+
}).extend(coreOptionsSchema.shape).extend(databaseOptionsSchema.shape).extend(outputOptionsSchema.shape);
|
|
1101
|
+
|
|
1102
|
+
// src/cli/commands/serve.ts
|
|
1103
|
+
var serveSchema = serverOptionsSchema;
|
|
1104
|
+
async function serveAction(options, command) {
|
|
1105
|
+
let resolver;
|
|
1106
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1107
|
+
const configErrors = [];
|
|
1108
|
+
try {
|
|
1109
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1110
|
+
} catch (err) {
|
|
1111
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1112
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1113
|
+
}
|
|
1114
|
+
let logLevel = "info";
|
|
1115
|
+
try {
|
|
1116
|
+
logLevel = resolver.resolve("logLevel", "LOG_LEVEL") ?? "info";
|
|
1117
|
+
} catch (e) {
|
|
1118
|
+
configErrors.push(e instanceof Error ? e.message : String(e));
|
|
1119
|
+
}
|
|
1120
|
+
if (options.dumpConfig !== true) {
|
|
1121
|
+
logger.setLevel(logLevel);
|
|
1122
|
+
}
|
|
1123
|
+
const sensitiveEnvVars = ["GITHUB_TOKEN", "MCP_AUTH_TOKEN", "OAUTH_ISSUER", "OAUTH_JWKS_URI"];
|
|
1124
|
+
for (const envVar of sensitiveEnvVars) {
|
|
1125
|
+
const envValue = process.env[envVar];
|
|
1126
|
+
if (typeof envValue === "string" && envValue.startsWith("CHANGEME_")) {
|
|
1127
|
+
configErrors.push(
|
|
1128
|
+
`FATAL: Insecure configuration detected. ${envVar} contains default placeholder value. Please update your environment variables.`
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const { serverOptions, transport, db, teamDb, host } = buildServerOptions(
|
|
1133
|
+
resolver,
|
|
1134
|
+
options,
|
|
1135
|
+
command,
|
|
1136
|
+
configErrors
|
|
1137
|
+
);
|
|
1138
|
+
if (configErrors.length > 0) {
|
|
1139
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1140
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1141
|
+
`));
|
|
1142
|
+
process.exit(1);
|
|
1143
|
+
}
|
|
1144
|
+
if (options.dumpConfig === true) {
|
|
1145
|
+
const redactedOptions = JSON.parse(JSON.stringify(serverOptions));
|
|
1146
|
+
const maskSensitive = (obj) => {
|
|
1147
|
+
for (const key of Object.keys(obj)) {
|
|
1148
|
+
const lowerKey = key.toLowerCase();
|
|
1149
|
+
if (typeof obj[key] === "string" && (lowerKey.includes("token") || lowerKey.includes("secret") || lowerKey.includes("issuer") || lowerKey.includes("uri") || lowerKey.includes("password") || lowerKey.includes("key"))) {
|
|
1150
|
+
obj[key] = "[REDACTED]";
|
|
1151
|
+
} else if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
1152
|
+
maskSensitive(obj[key]);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
maskSensitive(redactedOptions);
|
|
1157
|
+
process.stdout.write(JSON.stringify(redactedOptions, null, 2) + "\n");
|
|
1158
|
+
process.exit(0);
|
|
1159
|
+
}
|
|
1160
|
+
logger.info("Starting Memory Journal MCP Server", {
|
|
1161
|
+
module: "CLI",
|
|
1162
|
+
transport,
|
|
1163
|
+
stateless: serverOptions.statelessHttp,
|
|
1164
|
+
db,
|
|
1165
|
+
...teamDb ? { teamDb } : {},
|
|
1166
|
+
...host ? { host } : {}
|
|
1167
|
+
});
|
|
1168
|
+
try {
|
|
1169
|
+
await createServer(serverOptions);
|
|
1170
|
+
} catch (error) {
|
|
1171
|
+
logger.error("Failed to start server", {
|
|
1172
|
+
module: "CLI",
|
|
1173
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1174
|
+
});
|
|
1175
|
+
process.exit(1);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
var execSchema = execOptionsSchema;
|
|
1179
|
+
async function execAction(scriptPath, options, command) {
|
|
1180
|
+
let resolver;
|
|
1181
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1182
|
+
const configErrors = [];
|
|
1183
|
+
try {
|
|
1184
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1185
|
+
} catch (err) {
|
|
1186
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1187
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1188
|
+
}
|
|
1189
|
+
const { serverOptions } = buildServerOptions(resolver, options, command, configErrors);
|
|
1190
|
+
if (configErrors.length > 0) {
|
|
1191
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1192
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1193
|
+
`));
|
|
1194
|
+
process.exit(1);
|
|
1195
|
+
}
|
|
1196
|
+
serverOptions.testDbPath = void 0;
|
|
1197
|
+
serverOptions.testTeamDbPath = void 0;
|
|
1198
|
+
const scriptContent = readFileSync(scriptPath, "utf8");
|
|
1199
|
+
const context = await initializeDependencies(serverOptions);
|
|
1200
|
+
const {
|
|
1201
|
+
db,
|
|
1202
|
+
teamDb,
|
|
1203
|
+
runtime,
|
|
1204
|
+
vectorManager,
|
|
1205
|
+
teamVectorManager,
|
|
1206
|
+
github,
|
|
1207
|
+
configManager,
|
|
1208
|
+
allowedIoRoots
|
|
1209
|
+
} = context;
|
|
1210
|
+
const filterConfig = configManager.getConfig().toolFilterConfig;
|
|
1211
|
+
const baseConfig = {
|
|
1212
|
+
defaultProjectNumber: serverOptions.defaultProjectNumber,
|
|
1213
|
+
defaultWorkspaceId: serverOptions.defaultWorkspaceId,
|
|
1214
|
+
projectRegistry: serverOptions.projectRegistry,
|
|
1215
|
+
additionalTeamDbs: serverOptions.additionalTeamDbs,
|
|
1216
|
+
allowedIoRoots,
|
|
1217
|
+
filterConfig,
|
|
1218
|
+
authEnabled: Boolean(serverOptions.authToken ?? process.env["MCP_AUTH_TOKEN"]),
|
|
1219
|
+
oauthEnabled: serverOptions.oauthEnabled,
|
|
1220
|
+
codemodeEnabled: true,
|
|
1221
|
+
// Force enabled for the exec command
|
|
1222
|
+
codemodeInternalFullAccess: serverOptions.codemodeInternalFullAccess,
|
|
1223
|
+
teamDefaultRole: serverOptions.teamDefaultRole,
|
|
1224
|
+
teamAdmin: serverOptions.teamAdmin,
|
|
1225
|
+
runtime,
|
|
1226
|
+
subscriptionManager: globalSubscriptionManager
|
|
1227
|
+
};
|
|
1228
|
+
const dispatch = (name, args2) => callTool(name, args2, db, vectorManager, github, baseConfig, void 0, teamDb ?? void 0, teamVectorManager ?? void 0);
|
|
1229
|
+
const customToolHandlerConfig = { ...baseConfig, dispatch };
|
|
1230
|
+
try {
|
|
1231
|
+
const result = await callTool(
|
|
1232
|
+
"mj_execute_code",
|
|
1233
|
+
{ code: scriptContent },
|
|
1234
|
+
db,
|
|
1235
|
+
vectorManager,
|
|
1236
|
+
github,
|
|
1237
|
+
customToolHandlerConfig,
|
|
1238
|
+
void 0,
|
|
1239
|
+
teamDb ?? void 0,
|
|
1240
|
+
teamVectorManager ?? void 0
|
|
1241
|
+
);
|
|
1242
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
process.stderr.write("Execution failed: " + (error instanceof Error ? error.message : String(error)) + "\n");
|
|
1245
|
+
process.exit(1);
|
|
1246
|
+
} finally {
|
|
1247
|
+
configManager.close();
|
|
1248
|
+
if (runtime.auditLogger) await runtime.auditLogger.close();
|
|
1249
|
+
if (context.activeMetricsPath) await runtime.metrics.saveToFile(context.activeMetricsPath);
|
|
1250
|
+
db.close();
|
|
1251
|
+
teamDb?.close();
|
|
1252
|
+
process.exit(0);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
// src/cli/commands/admin.ts
|
|
1257
|
+
var backupSchema = adminBackupOptionsSchema;
|
|
1258
|
+
var restoreSchema = adminRestoreOptionsSchema;
|
|
1259
|
+
var vacuumSchema = adminVacuumOptionsSchema;
|
|
1260
|
+
var pruneSchema = adminPruneOptionsSchema;
|
|
1261
|
+
var auditSchema = adminAuditSearchOptionsSchema;
|
|
1262
|
+
var rebuildIndexSchema = adminRebuildIndexOptionsSchema;
|
|
1263
|
+
async function getDb(options, command) {
|
|
1264
|
+
let resolver;
|
|
1265
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1266
|
+
const configErrors = [];
|
|
1267
|
+
try {
|
|
1268
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1269
|
+
} catch (err) {
|
|
1270
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1271
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1272
|
+
}
|
|
1273
|
+
const { serverOptions, teamDb } = buildServerOptions(resolver, options, command, configErrors);
|
|
1274
|
+
if (configErrors.length > 0) {
|
|
1275
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1276
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1277
|
+
`));
|
|
1278
|
+
process.exit(1);
|
|
1279
|
+
}
|
|
1280
|
+
const dbPath = options.team ? teamDb ?? serverOptions.dbPath : serverOptions.dbPath;
|
|
1281
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
1282
|
+
await db.initialize();
|
|
1283
|
+
return { db, serverOptions };
|
|
1284
|
+
}
|
|
1285
|
+
async function backupAction(options, command) {
|
|
1286
|
+
const { db } = await getDb(options, command);
|
|
1287
|
+
const dest = options.dest;
|
|
1288
|
+
try {
|
|
1289
|
+
const result = await db.exportToFile(dest);
|
|
1290
|
+
if (options.json === true) {
|
|
1291
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
1292
|
+
} else {
|
|
1293
|
+
process.stderr.write(`Backup successful: ${result.path} (${result.sizeBytes} bytes)
|
|
1294
|
+
`);
|
|
1295
|
+
}
|
|
1296
|
+
} catch (e) {
|
|
1297
|
+
process.stderr.write("Backup failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1298
|
+
process.exit(1);
|
|
1299
|
+
} finally {
|
|
1300
|
+
db.close();
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
async function restoreAction(file, options, command) {
|
|
1304
|
+
const { db } = await getDb(options, command);
|
|
1305
|
+
try {
|
|
1306
|
+
const result = await db.restoreFromFile(file);
|
|
1307
|
+
if (options.json === true) {
|
|
1308
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
1309
|
+
} else {
|
|
1310
|
+
process.stderr.write(`Restore successful from ${result.restoredFrom}. Previous entries: ${result.previousEntryCount}, New entries: ${result.newEntryCount}
|
|
1311
|
+
`);
|
|
1312
|
+
}
|
|
1313
|
+
} catch (e) {
|
|
1314
|
+
process.stderr.write("Restore failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1315
|
+
process.exit(1);
|
|
1316
|
+
} finally {
|
|
1317
|
+
db.close();
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
async function vacuumAction(options, command) {
|
|
1321
|
+
const { db } = await getDb(options, command);
|
|
1322
|
+
try {
|
|
1323
|
+
db.pragma("optimize");
|
|
1324
|
+
db.flushSave();
|
|
1325
|
+
if (options.json === true) {
|
|
1326
|
+
process.stdout.write(JSON.stringify({ status: "success", action: "vacuum" }) + "\n");
|
|
1327
|
+
} else {
|
|
1328
|
+
process.stderr.write("Vacuum and optimize successful.\n");
|
|
1329
|
+
}
|
|
1330
|
+
} catch (e) {
|
|
1331
|
+
process.stderr.write("Vacuum failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1332
|
+
process.exit(1);
|
|
1333
|
+
} finally {
|
|
1334
|
+
db.close();
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
async function pruneAction(options, command) {
|
|
1338
|
+
const { db } = await getDb(options, command);
|
|
1339
|
+
try {
|
|
1340
|
+
const rawExcludeTags = options.excludeTags ?? options.pruneExcludeTags;
|
|
1341
|
+
const result = await runAutoPrune(db, {
|
|
1342
|
+
archiveOlderThanDays: options.archiveOlderThanDays ?? 0,
|
|
1343
|
+
pruneOlderThanDays: options.pruneOlderThanDays ?? 0,
|
|
1344
|
+
hardDeleteOlderThanDays: options.hardDeleteOlderThanDays ?? 0,
|
|
1345
|
+
importanceThreshold: options.importanceThreshold ?? options.pruneImportanceThreshold ?? 0.15,
|
|
1346
|
+
dryRun: options.dryRun === true || options.pruneDryRun === true,
|
|
1347
|
+
excludeTags: rawExcludeTags ? rawExcludeTags.split(",") : []
|
|
1348
|
+
});
|
|
1349
|
+
if (options.json === true) {
|
|
1350
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
1351
|
+
} else {
|
|
1352
|
+
process.stderr.write(`Prune result:
|
|
1353
|
+
`);
|
|
1354
|
+
process.stderr.write(` Archived: ${result.archivedCount}
|
|
1355
|
+
`);
|
|
1356
|
+
process.stderr.write(` Soft Deleted: ${result.prunedCount}
|
|
1357
|
+
`);
|
|
1358
|
+
process.stderr.write(` Hard Deleted: ${result.hardDeletedCount}
|
|
1359
|
+
`);
|
|
1360
|
+
if (result.backupFile) {
|
|
1361
|
+
process.stderr.write(` Safety backup created: ${result.backupFile}
|
|
1362
|
+
`);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
} catch (e) {
|
|
1366
|
+
process.stderr.write("Prune failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1367
|
+
process.exit(1);
|
|
1368
|
+
} finally {
|
|
1369
|
+
db.close();
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
async function auditAction(options, command) {
|
|
1373
|
+
const { db } = await getDb(options, command);
|
|
1374
|
+
try {
|
|
1375
|
+
const auditLogPath = options.auditLog ?? process.env["AUDIT_LOG_PATH"] ?? process.env["MEMORY_JOURNAL_AUDIT_LOG"];
|
|
1376
|
+
if (!auditLogPath) {
|
|
1377
|
+
throw new Error("Audit log path not configured (--audit-log or AUDIT_LOG_PATH)");
|
|
1378
|
+
}
|
|
1379
|
+
const logger2 = new AuditLogger({
|
|
1380
|
+
logPath: auditLogPath,
|
|
1381
|
+
enabled: true,
|
|
1382
|
+
redact: options.auditRedact ?? true,
|
|
1383
|
+
auditReads: options.auditReads ?? false,
|
|
1384
|
+
maxSizeBytes: options.auditLogMaxSize ? parseInt(options.auditLogMaxSize) : DEFAULT_AUDIT_LOG_MAX_SIZE_BYTES
|
|
1385
|
+
});
|
|
1386
|
+
const statusFilter = options.status === "success" ? true : options.status === "error" ? false : void 0;
|
|
1387
|
+
const result = await logger2.search({
|
|
1388
|
+
limit: options.limit,
|
|
1389
|
+
tool_name: options.tool,
|
|
1390
|
+
user: options.user,
|
|
1391
|
+
category: options.category,
|
|
1392
|
+
status: statusFilter
|
|
1393
|
+
});
|
|
1394
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
1395
|
+
} catch (e) {
|
|
1396
|
+
process.stderr.write("Audit search failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1397
|
+
process.exit(1);
|
|
1398
|
+
} finally {
|
|
1399
|
+
db.close();
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
async function rebuildIndexAction(options, command) {
|
|
1403
|
+
const { db, serverOptions } = await getDb(options, command);
|
|
1404
|
+
try {
|
|
1405
|
+
const vectorManager = new VectorSearchManager(db, { modelName: serverOptions.embeddingModel });
|
|
1406
|
+
process.stderr.write("Rebuilding vector index...\n");
|
|
1407
|
+
await vectorManager.rebuildIndex();
|
|
1408
|
+
const stats = vectorManager.getStats();
|
|
1409
|
+
process.stdout.write(JSON.stringify({ status: "success", stats }, null, 2) + "\n");
|
|
1410
|
+
} catch (e) {
|
|
1411
|
+
process.stderr.write("Rebuild index failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1412
|
+
process.exit(1);
|
|
1413
|
+
} finally {
|
|
1414
|
+
db.close();
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
async function getDb2(options, command) {
|
|
1418
|
+
let resolver;
|
|
1419
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1420
|
+
const configErrors = [];
|
|
1421
|
+
try {
|
|
1422
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1423
|
+
} catch (err) {
|
|
1424
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1425
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1426
|
+
}
|
|
1427
|
+
const { serverOptions } = buildServerOptions(resolver, options, command, configErrors);
|
|
1428
|
+
if (configErrors.length > 0) {
|
|
1429
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1430
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1431
|
+
`));
|
|
1432
|
+
process.exit(1);
|
|
1433
|
+
}
|
|
1434
|
+
const useTeamDb = options.team === true;
|
|
1435
|
+
if (useTeamDb && typeof serverOptions.teamDbPath !== "string") {
|
|
1436
|
+
process.stderr.write(
|
|
1437
|
+
"Error: Cannot use --team flag because no team database is configured.\n"
|
|
1438
|
+
);
|
|
1439
|
+
process.exit(1);
|
|
1440
|
+
}
|
|
1441
|
+
const dbPath = useTeamDb ? String(serverOptions.teamDbPath) : serverOptions.dbPath;
|
|
1442
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
1443
|
+
await db.initialize();
|
|
1444
|
+
return { db, config: serverOptions };
|
|
1445
|
+
}
|
|
1446
|
+
async function parseContent(options) {
|
|
1447
|
+
const file = options.file;
|
|
1448
|
+
const contentStr = options.content;
|
|
1449
|
+
if (file) {
|
|
1450
|
+
return readFileSync(file, "utf-8");
|
|
1451
|
+
}
|
|
1452
|
+
if (contentStr !== void 0) {
|
|
1453
|
+
return contentStr;
|
|
1454
|
+
}
|
|
1455
|
+
if (!process.stdin.isTTY) {
|
|
1456
|
+
let stdinStr = "";
|
|
1457
|
+
const timeout = setTimeout(() => {
|
|
1458
|
+
if (stdinStr.length === 0) {
|
|
1459
|
+
process.stderr.write(
|
|
1460
|
+
"Error: Timed out waiting for stdin. You must provide --file or --content when running in a non-interactive shell.\n"
|
|
1461
|
+
);
|
|
1462
|
+
process.exit(1);
|
|
1463
|
+
}
|
|
1464
|
+
}, 3e3);
|
|
1465
|
+
for await (const chunk of process.stdin) {
|
|
1466
|
+
stdinStr += chunk;
|
|
1467
|
+
}
|
|
1468
|
+
clearTimeout(timeout);
|
|
1469
|
+
if (stdinStr.trim().length > 0) {
|
|
1470
|
+
return stdinStr;
|
|
1471
|
+
}
|
|
1472
|
+
} else if (!process.env["CI"] && !process.env["NonInteractive"]) {
|
|
1473
|
+
p.intro("Interactive Entry Creation");
|
|
1474
|
+
const titlePrompt = await p.text({
|
|
1475
|
+
message: "Title (optional):",
|
|
1476
|
+
placeholder: "My entry title"
|
|
1477
|
+
});
|
|
1478
|
+
if (p.isCancel(titlePrompt)) {
|
|
1479
|
+
p.cancel("Operation cancelled.");
|
|
1480
|
+
process.exit(0);
|
|
1481
|
+
}
|
|
1482
|
+
const contentPrompt = await p.text({
|
|
1483
|
+
message: "Content (for multiline, use --file):",
|
|
1484
|
+
placeholder: "Write your short journal entry here...",
|
|
1485
|
+
validate: (value) => {
|
|
1486
|
+
if (!value) return "Content is required.";
|
|
1487
|
+
return void 0;
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
if (p.isCancel(contentPrompt)) {
|
|
1491
|
+
p.cancel("Operation cancelled.");
|
|
1492
|
+
process.exit(0);
|
|
1493
|
+
}
|
|
1494
|
+
if (titlePrompt) {
|
|
1495
|
+
options.title = titlePrompt;
|
|
1496
|
+
}
|
|
1497
|
+
p.outro("Proceeding with entry creation...");
|
|
1498
|
+
return contentPrompt;
|
|
1499
|
+
}
|
|
1500
|
+
process.stderr.write(
|
|
1501
|
+
"Error: Must provide either --file, --content, pipe data to stdin, or run interactively\n"
|
|
1502
|
+
);
|
|
1503
|
+
process.exit(1);
|
|
1504
|
+
}
|
|
1505
|
+
function parseFrontmatter(rawContent) {
|
|
1506
|
+
if (rawContent.startsWith("---\n") || rawContent.startsWith("---\r\n")) {
|
|
1507
|
+
const endOfFrontmatter = rawContent.indexOf("\n---\n", 3);
|
|
1508
|
+
const endOfFrontmatterWindows = rawContent.indexOf("\r\n---\r\n", 4);
|
|
1509
|
+
let endIdx = -1;
|
|
1510
|
+
let skip = 5;
|
|
1511
|
+
if (endOfFrontmatter !== -1 && (endOfFrontmatterWindows === -1 || endOfFrontmatter < endOfFrontmatterWindows)) {
|
|
1512
|
+
endIdx = endOfFrontmatter;
|
|
1513
|
+
skip = 5;
|
|
1514
|
+
} else if (endOfFrontmatterWindows !== -1) {
|
|
1515
|
+
endIdx = endOfFrontmatterWindows;
|
|
1516
|
+
skip = 7;
|
|
1517
|
+
}
|
|
1518
|
+
if (endIdx !== -1) {
|
|
1519
|
+
const yamlStr = rawContent.slice(rawContent.indexOf("\n") + 1, endIdx);
|
|
1520
|
+
const body = rawContent.slice(endIdx + skip).trimStart();
|
|
1521
|
+
try {
|
|
1522
|
+
const parsed = yaml.parse(yamlStr);
|
|
1523
|
+
const parsedRec = z.record(z.string(), z.unknown()).safeParse(parsed);
|
|
1524
|
+
return { frontmatter: parsedRec.success ? parsedRec.data : {}, body };
|
|
1525
|
+
} catch {
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return { frontmatter: {}, body: rawContent };
|
|
1530
|
+
}
|
|
1531
|
+
function parseRelatedTo(relatedToStr) {
|
|
1532
|
+
if (typeof relatedToStr !== "string") return [];
|
|
1533
|
+
return relatedToStr.split(",").map((s) => s.trim()).filter(Boolean).map(Number);
|
|
1534
|
+
}
|
|
1535
|
+
function parseRelationships(relationshipsStr, relFileStr) {
|
|
1536
|
+
let str = relationshipsStr;
|
|
1537
|
+
if (typeof relFileStr === "string") {
|
|
1538
|
+
try {
|
|
1539
|
+
str = readFileSync(relFileStr, "utf-8");
|
|
1540
|
+
} catch (e) {
|
|
1541
|
+
process.stderr.write(
|
|
1542
|
+
`Warning: Failed to read --rel-file: ${e instanceof Error ? e.message : String(e)}
|
|
1543
|
+
`
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if (typeof str !== "string") return [];
|
|
1548
|
+
try {
|
|
1549
|
+
const parsed = JSON.parse(str);
|
|
1550
|
+
if (Array.isArray(parsed)) {
|
|
1551
|
+
return parsed.map((r) => {
|
|
1552
|
+
if (typeof r !== "object" || r === null) return null;
|
|
1553
|
+
const rec = z.record(z.string(), z.unknown()).parse(r);
|
|
1554
|
+
return {
|
|
1555
|
+
target_id: Number(rec["target_id"]),
|
|
1556
|
+
relation_type: String(rec["relation_type"])
|
|
1557
|
+
};
|
|
1558
|
+
}).filter(
|
|
1559
|
+
(r) => r !== null && !isNaN(r.target_id) && Boolean(r.relation_type)
|
|
1560
|
+
);
|
|
1561
|
+
}
|
|
1562
|
+
} catch (e) {
|
|
1563
|
+
process.stderr.write(
|
|
1564
|
+
`Warning: Failed to parse relationships JSON: ${e instanceof Error ? e.message : String(e)}
|
|
1565
|
+
`
|
|
1566
|
+
);
|
|
1567
|
+
}
|
|
1568
|
+
return [];
|
|
1569
|
+
}
|
|
1570
|
+
function parseMetadata(metadataFile) {
|
|
1571
|
+
if (typeof metadataFile !== "string") return {};
|
|
1572
|
+
try {
|
|
1573
|
+
const str = readFileSync(metadataFile, "utf-8");
|
|
1574
|
+
const parsed = JSON.parse(str);
|
|
1575
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
1576
|
+
return z.record(z.string(), z.unknown()).parse(parsed);
|
|
1577
|
+
}
|
|
1578
|
+
} catch (e) {
|
|
1579
|
+
process.stderr.write(
|
|
1580
|
+
`Warning: Failed to parse --metadata JSON: ${e instanceof Error ? e.message : String(e)}
|
|
1581
|
+
`
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
return {};
|
|
1585
|
+
}
|
|
1586
|
+
function buildEntryPayload(options, metadata, config) {
|
|
1587
|
+
const entryTypeStr = options.type ?? options.category ?? metadata["type"] ?? metadata["entry_type"] ?? metadata["entryType"];
|
|
1588
|
+
const entryType = entryTypeStr;
|
|
1589
|
+
const tagsStr = options.tags;
|
|
1590
|
+
let tags;
|
|
1591
|
+
if (tagsStr !== void 0) {
|
|
1592
|
+
tags = tagsStr.split(/[,\s]+/).map((t) => t.trim()).filter(Boolean);
|
|
1593
|
+
} else if (metadata["tags"] !== void 0 && metadata["tags"] !== null) {
|
|
1594
|
+
tags = Array.isArray(metadata["tags"]) ? metadata["tags"].map(String) : void 0;
|
|
1595
|
+
}
|
|
1596
|
+
const projectRaw = options.project ?? options.projectNumber ?? options.project_number ?? metadata["project"] ?? metadata["projectNumber"] ?? metadata["project_number"];
|
|
1597
|
+
let projectNumber = projectRaw !== void 0 ? Number(projectRaw) : void 0;
|
|
1598
|
+
if (projectNumber === void 0 || isNaN(projectNumber)) {
|
|
1599
|
+
projectNumber = resolveProjectNumberFromPath(process.cwd());
|
|
1600
|
+
}
|
|
1601
|
+
const optsRec = z.record(z.string(), z.unknown()).parse(options);
|
|
1602
|
+
const explicitWorkspaceId = optsRec["workspaceId"] ?? optsRec["workspace_id"] ?? metadata["workspaceId"] ?? metadata["workspace_id"];
|
|
1603
|
+
const workspaceId = resolveWorkspaceId(
|
|
1604
|
+
explicitWorkspaceId,
|
|
1605
|
+
projectNumber,
|
|
1606
|
+
config
|
|
1607
|
+
);
|
|
1608
|
+
const trustRaw = options.trustScore ?? options.trust_score ?? options.confidence ?? metadata["trust"] ?? metadata["trustScore"] ?? metadata["trust_score"] ?? metadata["confidence"];
|
|
1609
|
+
const trustScore = trustRaw !== void 0 ? Number(trustRaw) : void 0;
|
|
1610
|
+
const impactRaw = options.impactScore ?? options.impact_score ?? metadata["impact"] ?? metadata["impactScore"] ?? metadata["impact_score"];
|
|
1611
|
+
const impactScore = impactRaw !== void 0 ? Number(impactRaw) : void 0;
|
|
1612
|
+
const valStatusRaw = options.validationStatus ?? options.validation_status ?? options.validation ?? metadata["validation_status"] ?? metadata["validationStatus"] ?? metadata["validation"];
|
|
1613
|
+
let validationStatus = void 0;
|
|
1614
|
+
if (valStatusRaw !== void 0 && valStatusRaw !== null) {
|
|
1615
|
+
if (typeof valStatusRaw === "boolean") {
|
|
1616
|
+
validationStatus = valStatusRaw ? "passed" : "failed";
|
|
1617
|
+
} else if (typeof valStatusRaw === "string") {
|
|
1618
|
+
const lower = valStatusRaw.trim().toLowerCase();
|
|
1619
|
+
if ([
|
|
1620
|
+
"passed",
|
|
1621
|
+
"pass",
|
|
1622
|
+
"success",
|
|
1623
|
+
"ok",
|
|
1624
|
+
"validated",
|
|
1625
|
+
"valid",
|
|
1626
|
+
"verified",
|
|
1627
|
+
"true",
|
|
1628
|
+
"1"
|
|
1629
|
+
].includes(lower)) {
|
|
1630
|
+
validationStatus = "passed";
|
|
1631
|
+
} else if (["failed", "fail", "error", "failing", "false", "0"].includes(lower)) {
|
|
1632
|
+
validationStatus = "failed";
|
|
1633
|
+
} else {
|
|
1634
|
+
validationStatus = "none";
|
|
1635
|
+
}
|
|
1636
|
+
} else if (typeof valStatusRaw === "number") {
|
|
1637
|
+
validationStatus = valStatusRaw === 1 ? "passed" : valStatusRaw === 0 ? "failed" : "none";
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
const sessionIdRaw = options.sessionId ?? options.session_id ?? metadata["session_id"] ?? metadata["sessionId"];
|
|
1641
|
+
const sessionId = sessionIdRaw;
|
|
1642
|
+
let autoContextStr = options.autoContext;
|
|
1643
|
+
const autoContextFile = options.autoContextFile;
|
|
1644
|
+
if (autoContextFile) {
|
|
1645
|
+
try {
|
|
1646
|
+
autoContextStr = readFileSync(autoContextFile, "utf-8");
|
|
1647
|
+
} catch (e) {
|
|
1648
|
+
process.stderr.write(
|
|
1649
|
+
`Warning: Failed to read --auto-context-file: ${e instanceof Error ? e.message : String(e)}
|
|
1650
|
+
`
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
} else if (autoContextStr === void 0 && metadata["auto_context"] !== void 0 && metadata["auto_context"] !== null) {
|
|
1654
|
+
autoContextStr = typeof metadata["auto_context"] === "string" ? metadata["auto_context"] : JSON.stringify(metadata["auto_context"]);
|
|
1655
|
+
} else if (autoContextStr === void 0 && metadata["autoContext"] !== void 0 && metadata["autoContext"] !== null) {
|
|
1656
|
+
autoContextStr = typeof metadata["autoContext"] === "string" ? metadata["autoContext"] : JSON.stringify(metadata["autoContext"]);
|
|
1657
|
+
}
|
|
1658
|
+
let relationships;
|
|
1659
|
+
if (metadata["relationships"] !== void 0 && metadata["relationships"] !== null && Array.isArray(metadata["relationships"])) {
|
|
1660
|
+
relationships = metadata["relationships"].map((r) => {
|
|
1661
|
+
const rec = r != null ? z.record(z.string(), z.unknown()).parse(r) : null;
|
|
1662
|
+
return {
|
|
1663
|
+
target_id: Number(rec?.["target_id"]),
|
|
1664
|
+
relation_type: String(rec?.["relation_type"])
|
|
1665
|
+
};
|
|
1666
|
+
}).filter(
|
|
1667
|
+
(r) => !isNaN(r.target_id) && Boolean(r.relation_type) && r.relation_type !== "undefined"
|
|
1668
|
+
);
|
|
1669
|
+
} else {
|
|
1670
|
+
relationships = parseRelationships(options.relationships, options.relFile);
|
|
1671
|
+
}
|
|
1672
|
+
let relatedIds = parseRelatedTo(options.relatedTo);
|
|
1673
|
+
if (relatedIds.length === 0 && Array.isArray(metadata["related_to"])) {
|
|
1674
|
+
relatedIds = metadata["related_to"].map(Number).filter((n) => !isNaN(n));
|
|
1675
|
+
}
|
|
1676
|
+
return {
|
|
1677
|
+
entryType,
|
|
1678
|
+
tags,
|
|
1679
|
+
projectNumber,
|
|
1680
|
+
workspaceId,
|
|
1681
|
+
trustScore,
|
|
1682
|
+
impactScore,
|
|
1683
|
+
validationStatus,
|
|
1684
|
+
sessionId,
|
|
1685
|
+
autoContextStr,
|
|
1686
|
+
relationships,
|
|
1687
|
+
relatedIds
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// src/cli/commands/entry.ts
|
|
1692
|
+
var createEntrySchema = createEntryOptionsSchema;
|
|
1693
|
+
var updateEntrySchema = updateEntryOptionsSchema;
|
|
1694
|
+
function applyCliEntryFlagAliases(options, restArgs) {
|
|
1695
|
+
if (options.tag !== void 0 && options.tags === void 0) options.tags = options.tag;
|
|
1696
|
+
if (options.contentFile !== void 0 && options.file === void 0) {
|
|
1697
|
+
options.file = options.contentFile;
|
|
1698
|
+
}
|
|
1699
|
+
if (options.body !== void 0 && options.content === void 0) options.content = options.body;
|
|
1700
|
+
if (options.validation !== void 0 && options.validationStatus === void 0) {
|
|
1701
|
+
options.validationStatus = options.validation;
|
|
1702
|
+
}
|
|
1703
|
+
if (options.validation_status !== void 0 && options.validationStatus === void 0) {
|
|
1704
|
+
options.validationStatus = options.validation_status;
|
|
1705
|
+
}
|
|
1706
|
+
if (options.workspace !== void 0 && options.workspaceId === void 0) {
|
|
1707
|
+
options.workspaceId = options.workspace;
|
|
1708
|
+
}
|
|
1709
|
+
if (options.summary !== void 0 && options.title === void 0) {
|
|
1710
|
+
options.title = options.summary;
|
|
1711
|
+
}
|
|
1712
|
+
if (restArgs.length > 0 && typeof restArgs[0] === "string" && options.content === void 0) {
|
|
1713
|
+
options.content = restArgs.map(String).join(" ");
|
|
1714
|
+
}
|
|
1715
|
+
if (options.description !== void 0 && options.content === void 0) {
|
|
1716
|
+
options.content = options.description;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
function handleCliEntryError(e, actionLabel) {
|
|
1720
|
+
if (e instanceof z.ZodError) {
|
|
1721
|
+
const issues = e.issues;
|
|
1722
|
+
if (issues.length > 0) {
|
|
1723
|
+
process.stderr.write(
|
|
1724
|
+
`Validation Error:
|
|
1725
|
+
${issues.map((err) => `- ${err.path.join(".")}: ${err.message}`).join("\n")}
|
|
1726
|
+
`
|
|
1727
|
+
);
|
|
1728
|
+
} else {
|
|
1729
|
+
process.stderr.write(`Validation Error:
|
|
1730
|
+
${e.message}
|
|
1731
|
+
`);
|
|
1732
|
+
}
|
|
1733
|
+
} else if (e instanceof Error && e.message.includes("FOREIGN KEY constraint failed")) {
|
|
1734
|
+
process.stderr.write(
|
|
1735
|
+
`\u{1F6E0}\uFE0F AUTONOMOUS HEALING: A FOREIGN KEY constraint failed. This usually means a target_id specified in relationships (or relatedIds) does not exist, or the project ID is invalid. Ensure you are passing a valid Entry ID (not a project ID) for relationships, and a valid project ID.
|
|
1736
|
+
`
|
|
1737
|
+
);
|
|
1738
|
+
} else {
|
|
1739
|
+
process.stderr.write(
|
|
1740
|
+
`Failed to ${actionLabel} entry: ${e instanceof Error ? e.message : String(e)}
|
|
1741
|
+
`
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
process.exit(1);
|
|
1745
|
+
}
|
|
1746
|
+
async function createEntryAction(...args2) {
|
|
1747
|
+
const command = args2[args2.length - 1];
|
|
1748
|
+
const options = args2.length > 1 ? args2[args2.length - 2] : {};
|
|
1749
|
+
applyCliEntryFlagAliases(options, args2.slice(0, args2.length - 2));
|
|
1750
|
+
const { db, config } = await getDb2(options, command);
|
|
1751
|
+
try {
|
|
1752
|
+
const rawContent = await parseContent(options);
|
|
1753
|
+
const { frontmatter, body } = parseFrontmatter(rawContent);
|
|
1754
|
+
let content = body;
|
|
1755
|
+
const title = options.title;
|
|
1756
|
+
if (title && !content.startsWith("# ")) {
|
|
1757
|
+
content = `# ${title}
|
|
1758
|
+
|
|
1759
|
+
${content}`;
|
|
1760
|
+
}
|
|
1761
|
+
const metadata = { ...frontmatter, ...parseMetadata(options.metadata) };
|
|
1762
|
+
const payload = buildEntryPayload(options, metadata, config);
|
|
1763
|
+
let resolvedWs = payload.workspaceId;
|
|
1764
|
+
if (resolvedWs === "default" && config.defaultWorkspaceId !== "default") {
|
|
1765
|
+
const optsRec = z.record(z.string(), z.unknown()).parse(options);
|
|
1766
|
+
const explicitWs = optsRec["workspaceId"] ?? optsRec["workspace_id"] ?? metadata["workspaceId"] ?? metadata["workspace_id"];
|
|
1767
|
+
if (explicitWs !== "default") {
|
|
1768
|
+
resolvedWs = void 0;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
z.object({
|
|
1772
|
+
workspace_id: z.string().min(
|
|
1773
|
+
1,
|
|
1774
|
+
"workspace_id (repository name) is required. It could not be auto-resolved from project_number or current directory."
|
|
1775
|
+
),
|
|
1776
|
+
project_number: z.number({
|
|
1777
|
+
message: "project_number is required. Entries must be assigned to a valid project."
|
|
1778
|
+
})
|
|
1779
|
+
}).parse({ workspace_id: resolvedWs, project_number: payload.projectNumber });
|
|
1780
|
+
const entryInput = {
|
|
1781
|
+
content,
|
|
1782
|
+
entryType: payload.entryType,
|
|
1783
|
+
tags: payload.tags,
|
|
1784
|
+
projectNumber: payload.projectNumber,
|
|
1785
|
+
workspaceId: payload.workspaceId,
|
|
1786
|
+
trustScore: payload.trustScore,
|
|
1787
|
+
impactScore: payload.impactScore,
|
|
1788
|
+
validationStatus: payload.validationStatus,
|
|
1789
|
+
sessionId: payload.sessionId,
|
|
1790
|
+
autoContext: payload.autoContextStr
|
|
1791
|
+
};
|
|
1792
|
+
const newEntry = db.createEntry(entryInput);
|
|
1793
|
+
for (const targetId of payload.relatedIds) {
|
|
1794
|
+
db.linkEntries(newEntry.id, targetId, "references");
|
|
1795
|
+
}
|
|
1796
|
+
for (const rel of payload.relationships) {
|
|
1797
|
+
db.linkEntries(newEntry.id, rel.target_id, rel.relation_type);
|
|
1798
|
+
}
|
|
1799
|
+
db.flushSave();
|
|
1800
|
+
if (options.json === true) {
|
|
1801
|
+
process.stdout.write(
|
|
1802
|
+
JSON.stringify({ status: "success", id: newEntry.id, version: newEntry.version }) + "\n"
|
|
1803
|
+
);
|
|
1804
|
+
} else {
|
|
1805
|
+
process.stderr.write(`Successfully created entry #${newEntry.id}
|
|
1806
|
+
`);
|
|
1807
|
+
}
|
|
1808
|
+
} catch (e) {
|
|
1809
|
+
handleCliEntryError(e, "create");
|
|
1810
|
+
} finally {
|
|
1811
|
+
db.close();
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
async function updateEntryAction(...args2) {
|
|
1815
|
+
const command = args2[args2.length - 1];
|
|
1816
|
+
const options = args2.length > 1 ? args2[args2.length - 2] : {};
|
|
1817
|
+
applyCliEntryFlagAliases(options, args2.slice(0, args2.length - 2));
|
|
1818
|
+
const { db, config } = await getDb2(options, command);
|
|
1819
|
+
try {
|
|
1820
|
+
const entryId = options.id;
|
|
1821
|
+
if (entryId === void 0 || isNaN(entryId)) {
|
|
1822
|
+
process.stderr.write("Error: Must provide a valid --id\n");
|
|
1823
|
+
process.exit(1);
|
|
1824
|
+
}
|
|
1825
|
+
const version = options.expectedVersion;
|
|
1826
|
+
if (version === void 0 || isNaN(version)) {
|
|
1827
|
+
process.stderr.write(
|
|
1828
|
+
"Error: Must provide a valid --expected-version (expected version) to prevent concurrent overwrites\n"
|
|
1829
|
+
);
|
|
1830
|
+
process.exit(1);
|
|
1831
|
+
}
|
|
1832
|
+
const rawContent = await parseContent(options);
|
|
1833
|
+
const { frontmatter, body } = parseFrontmatter(rawContent);
|
|
1834
|
+
let content = body;
|
|
1835
|
+
const title = options.title;
|
|
1836
|
+
if (title && !content.startsWith("# ")) {
|
|
1837
|
+
content = `# ${title}
|
|
1838
|
+
|
|
1839
|
+
${content}`;
|
|
1840
|
+
}
|
|
1841
|
+
const metadata = { ...frontmatter, ...parseMetadata(options.metadata) };
|
|
1842
|
+
const payload = buildEntryPayload(options, metadata, config);
|
|
1843
|
+
const updates = {
|
|
1844
|
+
content,
|
|
1845
|
+
expectedVersion: version
|
|
1846
|
+
};
|
|
1847
|
+
if (payload.entryType !== void 0) updates.entryType = payload.entryType;
|
|
1848
|
+
if (payload.tags !== void 0) updates.tags = payload.tags;
|
|
1849
|
+
if (payload.projectNumber !== void 0) updates.projectNumber = payload.projectNumber;
|
|
1850
|
+
if (payload.workspaceId !== void 0) updates.workspaceId = payload.workspaceId;
|
|
1851
|
+
if (payload.trustScore !== void 0) updates.trustScore = payload.trustScore;
|
|
1852
|
+
if (payload.impactScore !== void 0) updates.impactScore = payload.impactScore;
|
|
1853
|
+
if (payload.validationStatus !== void 0) {
|
|
1854
|
+
updates.validationStatus = payload.validationStatus;
|
|
1855
|
+
}
|
|
1856
|
+
if (payload.sessionId !== void 0) updates.sessionId = payload.sessionId;
|
|
1857
|
+
if (payload.autoContextStr !== void 0) updates.autoContext = payload.autoContextStr;
|
|
1858
|
+
const result = db.updateEntry(entryId, updates);
|
|
1859
|
+
if (result === null) {
|
|
1860
|
+
process.stderr.write(`Error: Entry #${entryId} not found or version mismatch.
|
|
1861
|
+
`);
|
|
1862
|
+
process.exit(1);
|
|
1863
|
+
}
|
|
1864
|
+
for (const targetId of payload.relatedIds) {
|
|
1865
|
+
db.linkEntries(entryId, targetId, "references");
|
|
1866
|
+
}
|
|
1867
|
+
for (const rel of payload.relationships) {
|
|
1868
|
+
db.linkEntries(entryId, rel.target_id, rel.relation_type);
|
|
1869
|
+
}
|
|
1870
|
+
db.flushSave();
|
|
1871
|
+
if (options.json === true) {
|
|
1872
|
+
process.stdout.write(
|
|
1873
|
+
JSON.stringify({ status: "success", id: result.id, version: result.version }) + "\n"
|
|
1874
|
+
);
|
|
1875
|
+
} else {
|
|
1876
|
+
process.stderr.write(
|
|
1877
|
+
`Successfully updated entry #${result.id} to version ${result.version}
|
|
1878
|
+
`
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
} catch (e) {
|
|
1882
|
+
handleCliEntryError(e, "update");
|
|
1883
|
+
} finally {
|
|
1884
|
+
db.close();
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// src/cli/commands/search.ts
|
|
1889
|
+
var searchSchema = searchOptionsSchema;
|
|
1890
|
+
async function getDb3(options, command) {
|
|
1891
|
+
let resolver;
|
|
1892
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1893
|
+
const configErrors = [];
|
|
1894
|
+
try {
|
|
1895
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1896
|
+
} catch (err) {
|
|
1897
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1898
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1899
|
+
}
|
|
1900
|
+
const { serverOptions, teamDb } = buildServerOptions(resolver, options, command, configErrors);
|
|
1901
|
+
if (configErrors.length > 0) {
|
|
1902
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1903
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1904
|
+
`));
|
|
1905
|
+
process.exit(1);
|
|
1906
|
+
}
|
|
1907
|
+
const dbPath = options.team ? teamDb ?? serverOptions.dbPath : serverOptions.dbPath;
|
|
1908
|
+
if (options.team && !teamDb) {
|
|
1909
|
+
process.stderr.write("Warning: --team specified but no TEAM_DB_PATH configured. Using core database.\n");
|
|
1910
|
+
}
|
|
1911
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
1912
|
+
await db.initialize();
|
|
1913
|
+
return { db, serverOptions };
|
|
1914
|
+
}
|
|
1915
|
+
async function searchAction(query, options, command) {
|
|
1916
|
+
const finalQuery = query ?? options.query ?? options.term ?? options.keyword;
|
|
1917
|
+
if (!finalQuery) {
|
|
1918
|
+
process.stderr.write('\u{1F6E0}\uFE0F AUTONOMOUS HEALING: Missing search query. You must provide a query as a positional argument (e.g. `mj search "query"`) or via a flag (e.g. `mj search --query "query"`).\n');
|
|
1919
|
+
process.exit(1);
|
|
1920
|
+
}
|
|
1921
|
+
const { db, serverOptions } = await getDb3(options, command);
|
|
1922
|
+
try {
|
|
1923
|
+
const mode = options.mode || "auto";
|
|
1924
|
+
const limit = options.limit ?? 100;
|
|
1925
|
+
let result;
|
|
1926
|
+
if (mode === "semantic") {
|
|
1927
|
+
const vectorManager = new VectorSearchManager(db, { modelName: serverOptions.embeddingModel });
|
|
1928
|
+
result = await vectorManager.search(finalQuery, limit);
|
|
1929
|
+
} else {
|
|
1930
|
+
result = db.searchEntries(finalQuery, {
|
|
1931
|
+
limit,
|
|
1932
|
+
fuzzy_match: mode === "auto",
|
|
1933
|
+
auto_correct: mode === "auto"
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
1937
|
+
} catch (e) {
|
|
1938
|
+
process.stderr.write("Search failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
1939
|
+
process.exit(1);
|
|
1940
|
+
} finally {
|
|
1941
|
+
db.close();
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
var visualizeSchema = visualizeOptionsSchema;
|
|
1945
|
+
async function getDb4(options, command) {
|
|
1946
|
+
let resolver;
|
|
1947
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
1948
|
+
const configErrors = [];
|
|
1949
|
+
try {
|
|
1950
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
1951
|
+
} catch (err) {
|
|
1952
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
1953
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
1954
|
+
}
|
|
1955
|
+
const { serverOptions, teamDb } = buildServerOptions(resolver, options, command, configErrors);
|
|
1956
|
+
if (configErrors.length > 0) {
|
|
1957
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
1958
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
1959
|
+
`));
|
|
1960
|
+
process.exit(1);
|
|
1961
|
+
}
|
|
1962
|
+
const dbPath = options.team ? teamDb ?? serverOptions.dbPath : serverOptions.dbPath;
|
|
1963
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
1964
|
+
await db.initialize();
|
|
1965
|
+
return { db, serverOptions };
|
|
1966
|
+
}
|
|
1967
|
+
async function visualizeAction(options, command) {
|
|
1968
|
+
const { db } = await getDb4(options, command);
|
|
1969
|
+
try {
|
|
1970
|
+
const graph = db.visualizeRelationships({
|
|
1971
|
+
depth: 3,
|
|
1972
|
+
limit: 200
|
|
1973
|
+
});
|
|
1974
|
+
const MERMAID_CONTENT_PREVIEW_LENGTH = 40;
|
|
1975
|
+
const mermaidLines = ["```mermaid", "graph TD"];
|
|
1976
|
+
if (graph.nodes.length === 0) {
|
|
1977
|
+
mermaidLines.push(
|
|
1978
|
+
' NoData["No entries found with relationships matching your criteria"]'
|
|
1979
|
+
);
|
|
1980
|
+
} else {
|
|
1981
|
+
for (const node of graph.nodes) {
|
|
1982
|
+
const rawContent = typeof node.metadata?.["content"] === "string" ? node.metadata["content"] : "";
|
|
1983
|
+
if (rawContent !== "") {
|
|
1984
|
+
let contentPreview = rawContent.slice(0, MERMAID_CONTENT_PREVIEW_LENGTH).replace(/\n/g, " ");
|
|
1985
|
+
if (rawContent.length > MERMAID_CONTENT_PREVIEW_LENGTH) {
|
|
1986
|
+
contentPreview += "...";
|
|
1987
|
+
}
|
|
1988
|
+
contentPreview = contentPreview.replace(/"/g, "'").replace(/\[/g, "(").replace(/\]/g, ")");
|
|
1989
|
+
const entryTypeShort = node.group.slice(0, 20);
|
|
1990
|
+
mermaidLines.push(
|
|
1991
|
+
` E${String(node.id)}["#${String(node.id)}: ${contentPreview}<br/>${entryTypeShort}"]`
|
|
1992
|
+
);
|
|
1993
|
+
} else {
|
|
1994
|
+
const safeLabel = node.label.replace(/"/g, "'").substring(0, 50);
|
|
1995
|
+
mermaidLines.push(` E${String(node.id)}["#${String(node.id)}: ${safeLabel}"]`);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
mermaidLines.push("");
|
|
1999
|
+
const relSymbols = {
|
|
2000
|
+
references: "-->",
|
|
2001
|
+
implements: "==>",
|
|
2002
|
+
clarifies: "-.->",
|
|
2003
|
+
evolves_from: "-->",
|
|
2004
|
+
response_to: "<-->",
|
|
2005
|
+
blocked_by: "--x",
|
|
2006
|
+
resolved: "==>",
|
|
2007
|
+
caused: "-.->"
|
|
2008
|
+
};
|
|
2009
|
+
for (const edge of graph.edges) {
|
|
2010
|
+
const arrow = relSymbols[edge.type] ?? "-->";
|
|
2011
|
+
mermaidLines.push(
|
|
2012
|
+
` E${String(edge.from)} ${arrow}|${edge.type}| E${String(edge.to)}`
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
mermaidLines.push("");
|
|
2016
|
+
for (const node of graph.nodes) {
|
|
2017
|
+
const isPersonal = node.metadata !== void 0 && "is_personal" in node.metadata ? Boolean(node.metadata["is_personal"]) : node.group === "target";
|
|
2018
|
+
if (isPersonal) {
|
|
2019
|
+
mermaidLines.push(` style E${String(node.id)} fill:#E3F2FD`);
|
|
2020
|
+
} else {
|
|
2021
|
+
mermaidLines.push(` style E${String(node.id)} fill:#FFF3E0`);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
mermaidLines.push("```");
|
|
2026
|
+
const mermaid = mermaidLines.join("\n");
|
|
2027
|
+
if (options.out) {
|
|
2028
|
+
await fs4.writeFile(options.out, mermaid, "utf8");
|
|
2029
|
+
process.stderr.write(`Visualization written to ${options.out}
|
|
2030
|
+
`);
|
|
2031
|
+
} else {
|
|
2032
|
+
process.stdout.write(mermaid + "\n");
|
|
2033
|
+
}
|
|
2034
|
+
} catch (e) {
|
|
2035
|
+
process.stderr.write("Visualize failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2036
|
+
process.exit(1);
|
|
2037
|
+
} finally {
|
|
2038
|
+
db.close();
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
// src/cli/commands/analytics.ts
|
|
2043
|
+
var analyticsSchema = analyticsOptionsSchema;
|
|
2044
|
+
async function getDb5(options, command) {
|
|
2045
|
+
let resolver;
|
|
2046
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
2047
|
+
const configErrors = [];
|
|
2048
|
+
try {
|
|
2049
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
2050
|
+
} catch (err) {
|
|
2051
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
2052
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
2053
|
+
}
|
|
2054
|
+
const { serverOptions, teamDb } = buildServerOptions(resolver, options, command, configErrors);
|
|
2055
|
+
if (configErrors.length > 0) {
|
|
2056
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
2057
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
2058
|
+
`));
|
|
2059
|
+
process.exit(1);
|
|
2060
|
+
}
|
|
2061
|
+
const dbPath = options.team ? teamDb ?? serverOptions.dbPath : serverOptions.dbPath;
|
|
2062
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
2063
|
+
await db.initialize();
|
|
2064
|
+
return { db, serverOptions };
|
|
2065
|
+
}
|
|
2066
|
+
async function analyticsStatsAction(options, command) {
|
|
2067
|
+
const { db } = await getDb5(options, command);
|
|
2068
|
+
try {
|
|
2069
|
+
const result = db.getStatistics();
|
|
2070
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2071
|
+
} catch (e) {
|
|
2072
|
+
process.stderr.write("Analytics stats failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2073
|
+
process.exit(1);
|
|
2074
|
+
} finally {
|
|
2075
|
+
db.close();
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
async function analyticsInsightsAction(options, command) {
|
|
2079
|
+
const { db } = await getDb5(options, command);
|
|
2080
|
+
try {
|
|
2081
|
+
const result = db.getCrossProjectInsights({ minEntries: 1, inactiveThresholdDays: 30 });
|
|
2082
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2083
|
+
} catch (e) {
|
|
2084
|
+
process.stderr.write("Analytics insights failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2085
|
+
process.exit(1);
|
|
2086
|
+
} finally {
|
|
2087
|
+
db.close();
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
var exportJsonSchema = ioExportJsonOptionsSchema;
|
|
2091
|
+
var exportMarkdownSchema = ioExportMarkdownOptionsSchema;
|
|
2092
|
+
var importMarkdownSchema = ioImportMarkdownOptionsSchema;
|
|
2093
|
+
var importExternalSchema = ioImportExternalOptionsSchema;
|
|
2094
|
+
async function getDb6(options, command) {
|
|
2095
|
+
let resolver;
|
|
2096
|
+
const configPath2 = options.config ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
2097
|
+
const configErrors = [];
|
|
2098
|
+
try {
|
|
2099
|
+
resolver = new ConfigResolver(command, options, configPath2);
|
|
2100
|
+
} catch (err) {
|
|
2101
|
+
configErrors.push(err instanceof Error ? err.message : String(err));
|
|
2102
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
2103
|
+
}
|
|
2104
|
+
const { serverOptions, teamDb } = buildServerOptions(resolver, options, command, configErrors);
|
|
2105
|
+
if (configErrors.length > 0) {
|
|
2106
|
+
process.stderr.write("Startup Configuration Errors:\n");
|
|
2107
|
+
configErrors.forEach((err) => process.stderr.write(` - ${err}
|
|
2108
|
+
`));
|
|
2109
|
+
process.exit(1);
|
|
2110
|
+
}
|
|
2111
|
+
const dbPath = options.team ? teamDb ?? serverOptions.dbPath : serverOptions.dbPath;
|
|
2112
|
+
const db = await DatabaseAdapterFactory.create(dbPath, serverOptions);
|
|
2113
|
+
await db.initialize();
|
|
2114
|
+
return { db, serverOptions };
|
|
2115
|
+
}
|
|
2116
|
+
async function exportJsonAction(options, command) {
|
|
2117
|
+
const { db } = await getDb6(options, command);
|
|
2118
|
+
try {
|
|
2119
|
+
const dest = options.dest;
|
|
2120
|
+
const result = await db.exportToFile(dest);
|
|
2121
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2122
|
+
} catch (e) {
|
|
2123
|
+
process.stderr.write("Export failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2124
|
+
process.exit(1);
|
|
2125
|
+
} finally {
|
|
2126
|
+
db.close();
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
async function exportMarkdownAction(options, command) {
|
|
2130
|
+
const { db } = await getDb6(options, command);
|
|
2131
|
+
try {
|
|
2132
|
+
if (!options.dir) {
|
|
2133
|
+
throw new Error("--dir is required for markdown export");
|
|
2134
|
+
}
|
|
2135
|
+
const entries = db.getRecentEntries(1e5).entries;
|
|
2136
|
+
const exportable = entries.map((e) => ({
|
|
2137
|
+
id: e.id,
|
|
2138
|
+
content: e.content,
|
|
2139
|
+
entryType: e.entryType,
|
|
2140
|
+
timestamp: e.timestamp,
|
|
2141
|
+
tags: e.tags,
|
|
2142
|
+
significance: e.significanceType ?? void 0
|
|
2143
|
+
}));
|
|
2144
|
+
const result = await exportEntriesToMarkdown(exportable, options.dir, db, [path.resolve(options.dir)]);
|
|
2145
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2146
|
+
} catch (e) {
|
|
2147
|
+
process.stderr.write("Export markdown failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2148
|
+
process.exit(1);
|
|
2149
|
+
} finally {
|
|
2150
|
+
db.close();
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
async function importMarkdownAction(options, command) {
|
|
2154
|
+
const { db, serverOptions } = await getDb6(options, command);
|
|
2155
|
+
try {
|
|
2156
|
+
if (!options.dir) {
|
|
2157
|
+
throw new Error("--dir is required for markdown import");
|
|
2158
|
+
}
|
|
2159
|
+
const vectorManager = new VectorSearchManager(db, { modelName: serverOptions.embeddingModel });
|
|
2160
|
+
const result = await importMarkdownEntries(options.dir, db, { limit: 1e5 }, vectorManager, [path.resolve(options.dir)]);
|
|
2161
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2162
|
+
} catch (e) {
|
|
2163
|
+
process.stderr.write("Import markdown failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2164
|
+
process.exit(1);
|
|
2165
|
+
} finally {
|
|
2166
|
+
db.close();
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
async function importExternalAction(options, command) {
|
|
2170
|
+
const { db, serverOptions } = await getDb6(options, command);
|
|
2171
|
+
try {
|
|
2172
|
+
if (!options.dir) {
|
|
2173
|
+
throw new Error("--dir is required for external import");
|
|
2174
|
+
}
|
|
2175
|
+
if (!options.format) {
|
|
2176
|
+
throw new Error("--format is required for external import");
|
|
2177
|
+
}
|
|
2178
|
+
const vectorManager = new VectorSearchManager(db, { modelName: serverOptions.embeddingModel });
|
|
2179
|
+
const mdFiles = [];
|
|
2180
|
+
const dir = await fs4.opendir(options.dir);
|
|
2181
|
+
for await (const dirent of dir) {
|
|
2182
|
+
if (dirent.isFile() && dirent.name.endsWith(".md")) {
|
|
2183
|
+
mdFiles.push(dirent.name);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
const parsedFiles = [];
|
|
2187
|
+
const errors = [];
|
|
2188
|
+
for (const filename of mdFiles) {
|
|
2189
|
+
let handle;
|
|
2190
|
+
try {
|
|
2191
|
+
const filepath = path.join(options.dir, filename);
|
|
2192
|
+
handle = await fs4.open(filepath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
2193
|
+
const content = await handle.readFile("utf-8");
|
|
2194
|
+
const converted = convertFile(content, filename, options.format);
|
|
2195
|
+
if (!converted.body.trim()) {
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
parsedFiles.push({
|
|
2199
|
+
filename,
|
|
2200
|
+
body: converted.body,
|
|
2201
|
+
metadata: converted.metadata
|
|
2202
|
+
});
|
|
2203
|
+
} catch (err) {
|
|
2204
|
+
errors.push({
|
|
2205
|
+
file: filename,
|
|
2206
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2207
|
+
});
|
|
2208
|
+
} finally {
|
|
2209
|
+
if (handle) {
|
|
2210
|
+
await handle.close();
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
const result = await processImportBatch(parsedFiles, db, {}, vectorManager);
|
|
2215
|
+
if (errors.length > 0) {
|
|
2216
|
+
result.success = false;
|
|
2217
|
+
result.errors.push(...errors);
|
|
2218
|
+
}
|
|
2219
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2220
|
+
} catch (e) {
|
|
2221
|
+
process.stderr.write("Import external failed: " + (e instanceof Error ? e.message : String(e)) + "\n");
|
|
2222
|
+
process.exit(1);
|
|
2223
|
+
} finally {
|
|
2224
|
+
db.close();
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
var configPath = path.resolve(os.homedir(), ".gemini", "config", "memory-journal.config.json");
|
|
2228
|
+
function getConfigPath(options) {
|
|
2229
|
+
const custom = options?.["config"] ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
2230
|
+
return custom ? path.resolve(custom) : configPath;
|
|
2231
|
+
}
|
|
2232
|
+
function loadConfig(options) {
|
|
2233
|
+
const targetPath = getConfigPath(options);
|
|
2234
|
+
if (!fs.existsSync(targetPath)) {
|
|
2235
|
+
return { projectRegistry: {} };
|
|
2236
|
+
}
|
|
2237
|
+
try {
|
|
2238
|
+
const content = fs.readFileSync(targetPath, "utf-8");
|
|
2239
|
+
return JSON.parse(content);
|
|
2240
|
+
} catch (e) {
|
|
2241
|
+
process.stderr.write(`Error reading config file ${targetPath}: ${String(e)}
|
|
2242
|
+
`);
|
|
2243
|
+
return { projectRegistry: {} };
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
function saveConfig(config, options) {
|
|
2247
|
+
const targetPath = getConfigPath(options);
|
|
2248
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
2249
|
+
fs.writeFileSync(targetPath, JSON.stringify(config, null, 4), "utf-8");
|
|
2250
|
+
}
|
|
2251
|
+
function projectListAction(options, _command) {
|
|
2252
|
+
const config = loadConfig(options);
|
|
2253
|
+
const registry = config["projectRegistry"] ?? {};
|
|
2254
|
+
if (Object.keys(registry).length === 0) {
|
|
2255
|
+
process.stdout.write("No projects registered.\n");
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
if (options["json"] === true) {
|
|
2259
|
+
process.stdout.write(JSON.stringify(registry, null, 2) + "\n");
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
for (const [name, data] of Object.entries(registry)) {
|
|
2263
|
+
process.stdout.write(`${name}: ${data.path} (Project Number: ${data.project_number ?? "None"})
|
|
2264
|
+
`);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
async function projectCreateAction(name, options, command) {
|
|
2268
|
+
if (!name || name.trim() === "") {
|
|
2269
|
+
process.stderr.write("Project name is required.\n");
|
|
2270
|
+
process.exit(1);
|
|
2271
|
+
}
|
|
2272
|
+
if (options["path"] == null) {
|
|
2273
|
+
process.stderr.write("Project path is required (--path).\n");
|
|
2274
|
+
process.exit(1);
|
|
2275
|
+
}
|
|
2276
|
+
const config = loadConfig(options);
|
|
2277
|
+
config["projectRegistry"] ??= {};
|
|
2278
|
+
const registry = config["projectRegistry"];
|
|
2279
|
+
const absPath = path.resolve(process.cwd(), options["path"]);
|
|
2280
|
+
registry[name] = {
|
|
2281
|
+
path: absPath
|
|
2282
|
+
};
|
|
2283
|
+
if (options["number"] != null) {
|
|
2284
|
+
const num = parseInt(options["number"], 10);
|
|
2285
|
+
if (isNaN(num)) {
|
|
2286
|
+
process.stderr.write("Invalid project number.\n");
|
|
2287
|
+
process.exit(1);
|
|
2288
|
+
}
|
|
2289
|
+
registry[name].project_number = num;
|
|
2290
|
+
}
|
|
2291
|
+
saveConfig(config, options);
|
|
2292
|
+
process.stdout.write(`Project '${name}' successfully registered at ${absPath}.
|
|
2293
|
+
`);
|
|
2294
|
+
if (options["skipInit"] === true) {
|
|
2295
|
+
process.stdout.write(`
|
|
2296
|
+
Skipping automated database initialization (--skip-init).
|
|
2297
|
+
`);
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
const projNum = options["number"] != null ? parseInt(options["number"], 10) : 0;
|
|
2301
|
+
let resolver;
|
|
2302
|
+
const cliConfigPath = options["config"] ?? process.env["MEMORY_JOURNAL_CONFIG"];
|
|
2303
|
+
try {
|
|
2304
|
+
resolver = new ConfigResolver(command, options, cliConfigPath);
|
|
2305
|
+
} catch {
|
|
2306
|
+
resolver = new ConfigResolver(command, {}, void 0);
|
|
2307
|
+
}
|
|
2308
|
+
const { serverOptions } = buildServerOptions(resolver, options, command, []);
|
|
2309
|
+
try {
|
|
2310
|
+
const db = await DatabaseAdapterFactory.create(serverOptions.dbPath, serverOptions);
|
|
2311
|
+
await db.initialize();
|
|
2312
|
+
db.createEntry({
|
|
2313
|
+
entryType: "project_decision",
|
|
2314
|
+
significanceType: "architecture",
|
|
2315
|
+
content: `Initialized project ${name}`,
|
|
2316
|
+
tags: ["project-initialization", "setup"],
|
|
2317
|
+
projectNumber: projNum,
|
|
2318
|
+
trustScore: 1,
|
|
2319
|
+
impactScore: 0.5,
|
|
2320
|
+
validationStatus: "passed"
|
|
2321
|
+
});
|
|
2322
|
+
db.close();
|
|
2323
|
+
process.stdout.write(`Database initialization entry successfully created.
|
|
2324
|
+
`);
|
|
2325
|
+
} catch (e) {
|
|
2326
|
+
process.stderr.write(`
|
|
2327
|
+
Failed to automatically initialize database entry: ${e instanceof Error ? e.message : String(e)}
|
|
2328
|
+
`);
|
|
2329
|
+
process.stderr.write(`You may need to run 'memory-journal-mcp entry create' manually.
|
|
2330
|
+
`);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
function projectUpdateAction(name, options, _command) {
|
|
2334
|
+
if (!name || name.trim() === "") {
|
|
2335
|
+
process.stderr.write("Project name is required.\n");
|
|
2336
|
+
process.exit(1);
|
|
2337
|
+
}
|
|
2338
|
+
const config = loadConfig(options);
|
|
2339
|
+
const registry = config["projectRegistry"] ?? {};
|
|
2340
|
+
if (!registry[name]) {
|
|
2341
|
+
process.stderr.write(`\u{1F6E0}\uFE0F AUTONOMOUS HEALING: Project '${name}' not found.
|
|
2342
|
+
`);
|
|
2343
|
+
process.exit(1);
|
|
2344
|
+
}
|
|
2345
|
+
const project = registry[name] ?? { path: "" };
|
|
2346
|
+
let modified = false;
|
|
2347
|
+
if (options["path"] != null) {
|
|
2348
|
+
project.path = path.resolve(process.cwd(), options["path"]);
|
|
2349
|
+
modified = true;
|
|
2350
|
+
}
|
|
2351
|
+
if (options["number"] != null) {
|
|
2352
|
+
const num = parseInt(options["number"], 10);
|
|
2353
|
+
if (!isNaN(num)) {
|
|
2354
|
+
project.project_number = num;
|
|
2355
|
+
modified = true;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
const targetName = options["rename"] ?? name;
|
|
2359
|
+
if (targetName !== name) {
|
|
2360
|
+
modified = true;
|
|
2361
|
+
}
|
|
2362
|
+
if (!modified) {
|
|
2363
|
+
process.stdout.write("No updates specified.\n");
|
|
2364
|
+
return;
|
|
2365
|
+
}
|
|
2366
|
+
const rest = Object.fromEntries(Object.entries(registry).filter(([key]) => key !== name));
|
|
2367
|
+
const newRegistry = { ...rest, [targetName]: project };
|
|
2368
|
+
config["projectRegistry"] = newRegistry;
|
|
2369
|
+
saveConfig(config, options);
|
|
2370
|
+
process.stdout.write(`Project '${targetName}' successfully updated.
|
|
2371
|
+
`);
|
|
2372
|
+
}
|
|
2373
|
+
function projectDeleteAction(name, options, _command) {
|
|
2374
|
+
if (!name || name.trim() === "") {
|
|
2375
|
+
process.stderr.write("Project name is required.\n");
|
|
2376
|
+
process.exit(1);
|
|
2377
|
+
}
|
|
2378
|
+
const config = loadConfig(options);
|
|
2379
|
+
const registry = config["projectRegistry"] ?? {};
|
|
2380
|
+
if (!registry[name]) {
|
|
2381
|
+
process.stderr.write(`\u{1F6E0}\uFE0F AUTONOMOUS HEALING: Project '${name}' not found.
|
|
2382
|
+
`);
|
|
2383
|
+
process.exit(1);
|
|
2384
|
+
}
|
|
2385
|
+
const rest = Object.fromEntries(Object.entries(registry).filter(([key]) => key !== name));
|
|
2386
|
+
config["projectRegistry"] = rest;
|
|
2387
|
+
saveConfig(config, options);
|
|
2388
|
+
process.stdout.write(`Project '${name}' successfully deleted.
|
|
2389
|
+
`);
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
// src/cli/index.ts
|
|
2393
|
+
var program = createProgram();
|
|
2394
|
+
program.option("--json", "Output help as structured JSON (agent-native)");
|
|
2395
|
+
var serveCmd = program.command("serve [args...]", { isDefault: true }).description("Start the Memory Journal MCP Server");
|
|
2396
|
+
addServerOptions(serveCmd);
|
|
2397
|
+
serveCmd.action(withValidation(serveSchema, async (argsArray, options, cmd) => {
|
|
2398
|
+
if (Array.isArray(argsArray) && argsArray.length > 0 && typeof argsArray[0] === "string") {
|
|
2399
|
+
process.stderr.write(`\u{1F6E0}\uFE0F AUTONOMOUS HEALING: The 'serve' command does not take arguments. You passed: ${argsArray.join(" ")}. If you are trying to search or run prompts, use the MCP client or the 'search' CLI command.
|
|
2400
|
+
`);
|
|
2401
|
+
process.exit(1);
|
|
2402
|
+
}
|
|
2403
|
+
await serveAction(options, cmd);
|
|
2404
|
+
}));
|
|
2405
|
+
addAgentInstructions(
|
|
2406
|
+
program,
|
|
2407
|
+
`
|
|
2408
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2409
|
+
- This is an agent-native CLI.
|
|
2410
|
+
- ALWAYS use valid JSON strings for JSON arguments (e.g. \`--rel '[{"target_id":1,"relation_type":"relates_to"}]'\`).
|
|
2411
|
+
- If you forget project details, DO NOT hallucinate. Query \`memory://agent-context/{+repo}\`.
|
|
2412
|
+
- \u{1F6E0}\uFE0F AUTONOMOUS HEALING: DO NOT attempt to run \`node .../build/index.js\`. ALWAYS use the global \`memory-journal-mcp\` wrapper or \`bun src/cli/index.ts\`.`
|
|
2413
|
+
);
|
|
2414
|
+
var projectCmd = program.command("project").description("Manage projects in the memory-journal-mcp global registry");
|
|
2415
|
+
projectCmd.command("list").description("List all registered projects").option("--json", "Output as JSON").action(projectListAction);
|
|
2416
|
+
var projectCreateCmd = projectCmd.command("create <name>").description("Register a new project in the global registry");
|
|
2417
|
+
withGroup(projectCreateCmd, "Command Options", (cmd) => {
|
|
2418
|
+
cmd.option("--path <path>", "Absolute path to the local repository (required)").option("--number <number>", "GitHub Project number (optional)").option("--skip-init", "Skip automated database initialization entry");
|
|
2419
|
+
});
|
|
2420
|
+
addCoreOptions(projectCreateCmd);
|
|
2421
|
+
addDatabaseOptions(projectCreateCmd);
|
|
2422
|
+
addOutputOptions(projectCreateCmd);
|
|
2423
|
+
addAgentInstructions(
|
|
2424
|
+
projectCreateCmd,
|
|
2425
|
+
`
|
|
2426
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2427
|
+
- Run this command first when initializing a new codebase.
|
|
2428
|
+
- The command will AUTOMATICALLY initialize the project in the database. You no longer need to run a secondary 'entry create' command.`
|
|
2429
|
+
);
|
|
2430
|
+
projectCreateCmd.action(projectCreateAction);
|
|
2431
|
+
var projectUpdateCmd = projectCmd.command("update <name>").description("Update an existing project in the registry");
|
|
2432
|
+
withGroup(projectUpdateCmd, "Command Options", (cmd) => {
|
|
2433
|
+
cmd.option("--path <path>", "New absolute path to the local repository").option("--number <number>", "New GitHub Project number").option("--rename <name>", "Rename the project key");
|
|
2434
|
+
});
|
|
2435
|
+
projectUpdateCmd.action(projectUpdateAction);
|
|
2436
|
+
var projectDeleteCmd = projectCmd.command("delete <name>").alias("remove").description("Remove a project from the global registry");
|
|
2437
|
+
projectDeleteCmd.action(projectDeleteAction);
|
|
2438
|
+
var execCmd = program.command("exec <file>").description("Execute a Code Mode script locally without starting a server");
|
|
2439
|
+
addOutputOptions(execCmd);
|
|
2440
|
+
addCoreOptions(execCmd);
|
|
2441
|
+
addDatabaseOptions(execCmd);
|
|
2442
|
+
addWorkspaceOptions(execCmd);
|
|
2443
|
+
addVectorOptions(execCmd);
|
|
2444
|
+
addCodeModeOptions(execCmd);
|
|
2445
|
+
addAuditOptions(execCmd);
|
|
2446
|
+
addAgentInstructions(
|
|
2447
|
+
execCmd,
|
|
2448
|
+
`
|
|
2449
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2450
|
+
- ALWAYS provide the path to a valid script file. Scripts execute within the same execution environment as Code Mode tools.
|
|
2451
|
+
- Do NOT use this command to start the server. Use \`serve\` instead.`
|
|
2452
|
+
);
|
|
2453
|
+
execCmd.action(withValidation(execSchema, execAction));
|
|
2454
|
+
var adminCmd = program.command("admin").description("Database administration utilities");
|
|
2455
|
+
addAgentInstructions(
|
|
2456
|
+
adminCmd,
|
|
2457
|
+
`
|
|
2458
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2459
|
+
- These are dangerous administrative utilities. ALWAYS verify the target database before executing.`
|
|
2460
|
+
);
|
|
2461
|
+
var backupCmd = adminCmd.command("backup").description("Export the database to a timestamped backup file");
|
|
2462
|
+
withGroup(backupCmd, "Command Options", (cmd) => {
|
|
2463
|
+
cmd.option("--dest <path>", "Destination path or filename for the backup");
|
|
2464
|
+
});
|
|
2465
|
+
addOutputOptions(backupCmd);
|
|
2466
|
+
addCoreOptions(backupCmd);
|
|
2467
|
+
addDatabaseOptions(backupCmd);
|
|
2468
|
+
addAgentInstructions(
|
|
2469
|
+
backupCmd,
|
|
2470
|
+
`
|
|
2471
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2472
|
+
- If \`--dest\` is omitted, a timestamped backup will be created in the backups directory.`
|
|
2473
|
+
);
|
|
2474
|
+
backupCmd.action(withValidation(backupSchema, backupAction));
|
|
2475
|
+
var restoreCmd = adminCmd.command("restore <file>").description("Restore the database from a backup file");
|
|
2476
|
+
addOutputOptions(restoreCmd);
|
|
2477
|
+
addCoreOptions(restoreCmd);
|
|
2478
|
+
addDatabaseOptions(restoreCmd);
|
|
2479
|
+
addAgentInstructions(
|
|
2480
|
+
restoreCmd,
|
|
2481
|
+
`
|
|
2482
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2483
|
+
- This will overwrite the CURRENT database. ALWAYS take a backup before running restore.`
|
|
2484
|
+
);
|
|
2485
|
+
restoreCmd.action(withValidation(restoreSchema, restoreAction));
|
|
2486
|
+
var vacuumCmd = adminCmd.command("vacuum").description("Optimize database query planner and flush WAL");
|
|
2487
|
+
addOutputOptions(vacuumCmd);
|
|
2488
|
+
addCoreOptions(vacuumCmd);
|
|
2489
|
+
addDatabaseOptions(vacuumCmd);
|
|
2490
|
+
vacuumCmd.action(withValidation(vacuumSchema, vacuumAction));
|
|
2491
|
+
var pruneCmd = adminCmd.command("prune").description("Run autonomous database pruning");
|
|
2492
|
+
withGroup(pruneCmd, "Command Options", (cmd) => {
|
|
2493
|
+
cmd.option("--dry-run", "Log candidates without modifying the database").option("--exclude-tags <tags>", "Comma-separated tags to exclude");
|
|
2494
|
+
});
|
|
2495
|
+
addOutputOptions(pruneCmd);
|
|
2496
|
+
addCoreOptions(pruneCmd);
|
|
2497
|
+
addDatabaseOptions(pruneCmd);
|
|
2498
|
+
addPruningOptions(pruneCmd);
|
|
2499
|
+
addAgentInstructions(
|
|
2500
|
+
pruneCmd,
|
|
2501
|
+
`
|
|
2502
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2503
|
+
- ALWAYS run with \`--dry-run\` first to verify what will be pruned.`
|
|
2504
|
+
);
|
|
2505
|
+
pruneCmd.action(withValidation(pruneSchema, pruneAction));
|
|
2506
|
+
var auditCmd = adminCmd.command("audit").description("Search operational telemetry audit logs");
|
|
2507
|
+
withGroup(auditCmd, "Command Options", (cmd) => {
|
|
2508
|
+
cmd.option("--limit <number>", "Maximum number of results to return").option("--tool <string>", "Filter by tool name").option("--user <string>", "Filter by user").option("--category <string>", "Filter by category").option("--status <string>", "Filter by status (success|error)");
|
|
2509
|
+
});
|
|
2510
|
+
addOutputOptions(auditCmd);
|
|
2511
|
+
addCoreOptions(auditCmd);
|
|
2512
|
+
addDatabaseOptions(auditCmd);
|
|
2513
|
+
addAuditOptions(auditCmd);
|
|
2514
|
+
auditCmd.action(withValidation(auditSchema, auditAction));
|
|
2515
|
+
var rebuildIndexCmd = adminCmd.command("rebuild-index").description("Rebuild semantic search vector index");
|
|
2516
|
+
withGroup(rebuildIndexCmd, "Command Options", (cmd) => {
|
|
2517
|
+
cmd.option("--team", "Rebuild index for team database");
|
|
2518
|
+
});
|
|
2519
|
+
addOutputOptions(rebuildIndexCmd);
|
|
2520
|
+
addCoreOptions(rebuildIndexCmd);
|
|
2521
|
+
addDatabaseOptions(rebuildIndexCmd);
|
|
2522
|
+
rebuildIndexCmd.action(withValidation(rebuildIndexSchema, rebuildIndexAction));
|
|
2523
|
+
var entryCmd = program.command("entry").description("Manage journal entries");
|
|
2524
|
+
var createEntryCmd = entryCmd.command("create [args...]").description("Create a new journal entry directly in the database");
|
|
2525
|
+
withGroup(createEntryCmd, "Command Options", (cmd) => {
|
|
2526
|
+
cmd.option("-f, --file <path>", "Load markdown content from a file").option("--content-file <file>", "Alias for --file (Auto-healing agent hallucination)").option("-c, --content <string>", "Raw markdown content string").option("--body <string>", "Alias for --content (Auto-healing agent hallucination)").option("-s, --summary <summary>", "Alias for --title (Auto-healing agent hallucination)").option("--title <title>", "Optional title (will be prepended as an H1 to content if provided, for agent compatibility)").option("-t, --type <type>", "Entry type (e.g., retrospective, personal_reflection)").option("--category <type>", "Entry type (alias)").option("--tags <tags>", "Comma-separated tags (e.g., session-summary)").option("--tag <tags>", "Alias for --tags (Auto-healing agent hallucination)").option("-p, --project <number>", "Project number (alias)").option("--project-number <number>", "Project number").option("--project_number <number>", "Project number (alias)").option("--trust, --trust-score <number>", "Trust score (0.0 to 1.0)").option("--trust_score <number>", "Trust score (0.0 to 1.0) (alias)").option("--confidence <number>", "Trust score (0.0 to 1.0) (alias)").option("--impact, --impact-score <number>", "Impact score (0.0 to 1.0)").option("--impact_score <number>", "Impact score (0.0 to 1.0) (alias)").option("--validation-status <status>", "Validation status (passed|none|failed)").option("--validation_status <status>", "Validation status (passed|none|failed) (alias)").option("--validation <status>", "Validation status (passed|none|failed) (alias)").option("-w, --workspace <id>", "Workspace ID").option("--workspace-id <id>", "Workspace ID (alias)").option("--workspace_id <id>", "Workspace ID (alias)").option("--session, --session-id <id>", "Session ID").option("--session_id <id>", "Session ID (alias)").option("--related-to <ids>", "Comma-separated entry IDs to relate to").option("--rel, --relationships <json>", "JSON string of relationships").option("--rel-file <path>", "Load relationships JSON from a file").option("--auto-context <json>", "JSON string for auto context").option("--auto-context-file <path>", "Load auto context JSON from a file").option("--metadata <path>", "Load unified metadata JSON from a file (overrides individual flags)").option("--team", "Route to team database");
|
|
2527
|
+
});
|
|
2528
|
+
addOutputOptions(createEntryCmd);
|
|
2529
|
+
addCoreOptions(createEntryCmd);
|
|
2530
|
+
addDatabaseOptions(createEntryCmd);
|
|
2531
|
+
addAgentInstructions(
|
|
2532
|
+
createEntryCmd,
|
|
2533
|
+
`
|
|
2534
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2535
|
+
- METADATA PAYLOAD: ALWAYS prefer using \`--metadata <path>\` to pass tags, scores, auto_context, and relationships in a single JSON file.
|
|
2536
|
+
- MULTI-LINE CONTENT: ALWAYS write long content to a scratch file and use \`-f <path>\` instead of \`-c\` to prevent shell quoting failures.
|
|
2537
|
+
- SNAKE_CASE FLAGS: Do not hallucinate snake_case CLI flags (like --project_number or --session_id). The CLI expects kebab-case (--project-number).`
|
|
2538
|
+
);
|
|
2539
|
+
createEntryCmd.action(withValidation(createEntrySchema, createEntryAction));
|
|
2540
|
+
var updateEntryCmd = entryCmd.command("update [content]").description("Update an existing journal entry");
|
|
2541
|
+
withGroup(updateEntryCmd, "Command Options", (cmd) => {
|
|
2542
|
+
cmd.option("--id <number>", "ID of the entry to update").option("--expected-version <number>", "Expected version of the entry (for concurrent modification safety)").option("-f, --file <path>", "Load new markdown content from a file").option("--content-file <file>", "Alias for --file (Auto-healing agent hallucination)").option("-c, --content <string>", "Raw new markdown content string").option("--body <string>", "Alias for --content (Auto-healing agent hallucination)").option("-d, --description <string>", "Alias for --content (Auto-healing agent hallucination)").option("--title <title>", "Optional title (will be prepended as an H1 to content if provided, for agent compatibility)").option("-t, --type <type>", "Entry type (e.g., retrospective, personal_reflection)").option("--category <type>", "Entry type (alias)").option("--tags <tags>", "Comma-separated tags (e.g., session-summary)").option("--tag <tags>", "Alias for --tags (Auto-healing agent hallucination)").option("-p, --project <number>", "Project number (alias)").option("--project-number <number>", "Project number").option("--project_number <number>", "Project number (alias)").option("--trust, --trust-score <number>", "Trust score (0.0 to 1.0)").option("--trust_score <number>", "Trust score (0.0 to 1.0) (alias)").option("--impact, --impact-score <number>", "Impact score (0.0 to 1.0)").option("--impact_score <number>", "Impact score (0.0 to 1.0) (alias)").option("--validation-status <status>", "Validation status (passed|none|failed)").option("--validation_status <status>", "Validation status (passed|none|failed) (alias)").option("--validation <status>", "Validation status (passed|none|failed) (alias)").option("--session, --session-id <id>", "Session ID").option("--session_id <id>", "Session ID (alias)").option("--related-to <ids>", "Comma-separated entry IDs to relate to").option("--rel, --relationships <json>", "JSON string of relationships").option("--rel-file <path>", "Load relationships JSON from a file").option("--auto-context <json>", "JSON string for auto context").option("--auto-context-file <path>", "Load auto context JSON from a file").option("--metadata <path>", "Load unified metadata JSON from a file (overrides individual flags)").option("--team", "Route to team database");
|
|
2543
|
+
});
|
|
2544
|
+
addOutputOptions(updateEntryCmd);
|
|
2545
|
+
addCoreOptions(updateEntryCmd);
|
|
2546
|
+
addDatabaseOptions(updateEntryCmd);
|
|
2547
|
+
addAgentInstructions(
|
|
2548
|
+
updateEntryCmd,
|
|
2549
|
+
`
|
|
2550
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2551
|
+
- METADATA PAYLOAD: ALWAYS prefer using \`--metadata <path>\` to pass tags, scores, auto_context, and relationships in a single JSON file.
|
|
2552
|
+
- MULTI-LINE CONTENT: ALWAYS write long content to a scratch file and use \`-f <path>\` instead of \`-c\` to prevent shell quoting failures.
|
|
2553
|
+
- SNAKE_CASE FLAGS: Do not hallucinate snake_case CLI flags (like --project_number or --session_id). The CLI expects kebab-case (--project-number).`
|
|
2554
|
+
);
|
|
2555
|
+
updateEntryCmd.action(withValidation(updateEntrySchema, updateEntryAction));
|
|
2556
|
+
entryCmd.command("delete [args...]", { hidden: true }).allowUnknownOption().action(() => {
|
|
2557
|
+
process.stderr.write(`\u{1F6E0}\uFE0F AUTONOMOUS HEALING: The 'entry delete' command does not exist in the CLI. Deleting entries is an admin-level operation. Please use the MCP tool 'mj_execute_code' with 'mj.admin.batchDeleteEntries({ entry_ids: [...] })' instead.
|
|
2558
|
+
`);
|
|
2559
|
+
process.exit(1);
|
|
2560
|
+
});
|
|
2561
|
+
var searchCmd = program.command("search [query]").description("Search journal entries");
|
|
2562
|
+
withGroup(searchCmd, "Command Options", (cmd) => {
|
|
2563
|
+
cmd.option("-q, --query <string>", "Search query (alias for positional argument)").option("--term <string>", "Search query (alias)").option("--keyword <string>", "Search query (alias)").option("--mode <mode>", "Search mode: auto, fts, semantic, hybrid", "auto").option("--limit <number>", "Maximum number of results to return", "50").option("--team", "Search team database");
|
|
2564
|
+
});
|
|
2565
|
+
addOutputOptions(searchCmd);
|
|
2566
|
+
addCoreOptions(searchCmd);
|
|
2567
|
+
addDatabaseOptions(searchCmd);
|
|
2568
|
+
addAgentInstructions(
|
|
2569
|
+
searchCmd,
|
|
2570
|
+
`
|
|
2571
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2572
|
+
- Search output defaults to a JSON representation since it is optimized for agents. No need to parse a table.`
|
|
2573
|
+
);
|
|
2574
|
+
searchCmd.action(withValidation(searchSchema, searchAction));
|
|
2575
|
+
var ioCmd = program.command("io").description("Import and export tools");
|
|
2576
|
+
var exportJsonCmd = ioCmd.command("export-json").description("Export database entries to a JSON file");
|
|
2577
|
+
withGroup(exportJsonCmd, "Command Options", (cmd) => {
|
|
2578
|
+
cmd.option("--dest <path>", "Destination file path (optional)");
|
|
2579
|
+
});
|
|
2580
|
+
addCoreOptions(exportJsonCmd);
|
|
2581
|
+
addDatabaseOptions(exportJsonCmd);
|
|
2582
|
+
addOutputOptions(exportJsonCmd);
|
|
2583
|
+
exportJsonCmd.action(withValidation(exportJsonSchema, exportJsonAction));
|
|
2584
|
+
var exportMarkdownCmd = ioCmd.command("export-markdown").description("Export entries to a directory of markdown files");
|
|
2585
|
+
withGroup(exportMarkdownCmd, "Command Options", (cmd) => {
|
|
2586
|
+
cmd.option("--dir <path>", "Destination directory for markdown files (required)");
|
|
2587
|
+
});
|
|
2588
|
+
addCoreOptions(exportMarkdownCmd);
|
|
2589
|
+
addDatabaseOptions(exportMarkdownCmd);
|
|
2590
|
+
addOutputOptions(exportMarkdownCmd);
|
|
2591
|
+
exportMarkdownCmd.action(withValidation(exportMarkdownSchema, exportMarkdownAction));
|
|
2592
|
+
var importMarkdownCmd = ioCmd.command("import-markdown").description("Import entries from a directory of markdown files");
|
|
2593
|
+
withGroup(importMarkdownCmd, "Command Options", (cmd) => {
|
|
2594
|
+
cmd.option("--dir <path>", "Source directory of markdown files (required)");
|
|
2595
|
+
});
|
|
2596
|
+
addCoreOptions(importMarkdownCmd);
|
|
2597
|
+
addDatabaseOptions(importMarkdownCmd);
|
|
2598
|
+
addOutputOptions(importMarkdownCmd);
|
|
2599
|
+
importMarkdownCmd.action(withValidation(importMarkdownSchema, importMarkdownAction));
|
|
2600
|
+
var importExternalCmd = ioCmd.command("import-external").description("Import entries from external knowledge bases");
|
|
2601
|
+
withGroup(importExternalCmd, "Command Options", (cmd) => {
|
|
2602
|
+
cmd.option("--dir <path>", "Source directory (required)").option("--format <format>", "External format: notion, obsidian, or logseq (required)");
|
|
2603
|
+
});
|
|
2604
|
+
addCoreOptions(importExternalCmd);
|
|
2605
|
+
addDatabaseOptions(importExternalCmd);
|
|
2606
|
+
addOutputOptions(importExternalCmd);
|
|
2607
|
+
importExternalCmd.action(withValidation(importExternalSchema, importExternalAction));
|
|
2608
|
+
var visualizeCmd = program.command("visualize").description("Generate Mermaid relationship graph");
|
|
2609
|
+
withGroup(visualizeCmd, "Command Options", (cmd) => {
|
|
2610
|
+
cmd.option("--out <path>", "Output file path (optional, will print to stdout if omitted)").option("--team", "Visualize team database");
|
|
2611
|
+
});
|
|
2612
|
+
addCoreOptions(visualizeCmd);
|
|
2613
|
+
addDatabaseOptions(visualizeCmd);
|
|
2614
|
+
addAgentInstructions(
|
|
2615
|
+
visualizeCmd,
|
|
2616
|
+
`
|
|
2617
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2618
|
+
- ALWAYS use \`--out\` to write massive Mermaid diagrams to a file instead of raw stdout.`
|
|
2619
|
+
);
|
|
2620
|
+
visualizeCmd.action(withValidation(visualizeSchema, visualizeAction));
|
|
2621
|
+
var analyticsCmd = program.command("analytics").description("Database analytics and insights");
|
|
2622
|
+
addAgentInstructions(
|
|
2623
|
+
analyticsCmd,
|
|
2624
|
+
`
|
|
2625
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2626
|
+
- Analytics commands return massive JSON objects optimized for automated consumption.`
|
|
2627
|
+
);
|
|
2628
|
+
var analyticsStatsCmd = analyticsCmd.command("stats").description("Get basic database statistics");
|
|
2629
|
+
withGroup(analyticsStatsCmd, "Command Options", (cmd) => {
|
|
2630
|
+
cmd.option("--team", "Get stats for team database");
|
|
2631
|
+
});
|
|
2632
|
+
addOutputOptions(analyticsStatsCmd);
|
|
2633
|
+
addCoreOptions(analyticsStatsCmd);
|
|
2634
|
+
addDatabaseOptions(analyticsStatsCmd);
|
|
2635
|
+
analyticsStatsCmd.action(withValidation(analyticsSchema, analyticsStatsAction));
|
|
2636
|
+
var analyticsInsightsCmd = analyticsCmd.command("insights").description("Get cross-project insights");
|
|
2637
|
+
withGroup(analyticsInsightsCmd, "Command Options", (cmd) => {
|
|
2638
|
+
cmd.option("--team", "Get insights for team database");
|
|
2639
|
+
});
|
|
2640
|
+
addOutputOptions(analyticsInsightsCmd);
|
|
2641
|
+
addCoreOptions(analyticsInsightsCmd);
|
|
2642
|
+
addDatabaseOptions(analyticsInsightsCmd);
|
|
2643
|
+
analyticsInsightsCmd.action(withValidation(analyticsSchema, analyticsInsightsAction));
|
|
2644
|
+
var sessionCmd = program.command("session [args...]").description('Search for session summaries (Alias for search "session summary")');
|
|
2645
|
+
withGroup(sessionCmd, "Command Options", (cmd) => {
|
|
2646
|
+
cmd.option("--mode <mode>", "Search mode: auto, fts, semantic, hybrid", "auto").option("--limit <number>", "Maximum number of results to return", "50").option("--team", "Search team database");
|
|
2647
|
+
});
|
|
2648
|
+
addOutputOptions(sessionCmd);
|
|
2649
|
+
addCoreOptions(sessionCmd);
|
|
2650
|
+
addDatabaseOptions(sessionCmd);
|
|
2651
|
+
addAgentInstructions(
|
|
2652
|
+
sessionCmd,
|
|
2653
|
+
`
|
|
2654
|
+
\u{1F916} AI AGENT INSTRUCTIONS:
|
|
2655
|
+
- This is a convenience alias. It behaves exactly like the 'search' command, but prepends 'session ' to your query if arguments are provided, or defaults to 'session summary'.`
|
|
2656
|
+
);
|
|
2657
|
+
sessionCmd.action(withValidation(searchSchema, async (args2, options, command) => {
|
|
2658
|
+
const query = args2.length > 0 ? "session " + args2.join(" ") : "session summary";
|
|
2659
|
+
await searchAction(query, options, command);
|
|
2660
|
+
}));
|
|
2661
|
+
var args = process.argv.map((arg) => {
|
|
2662
|
+
if (arg.startsWith("--") && arg.includes("_")) {
|
|
2663
|
+
return arg.replace(/_/g, "-");
|
|
2664
|
+
}
|
|
2665
|
+
return arg;
|
|
2666
|
+
});
|
|
2667
|
+
program.parse(args);
|