ai-prompt-guide-mcp 1.0.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/LICENSE +21 -0
- package/README.md +271 -0
- package/dist/__tests__/config-loading.test.d.ts +5 -0
- package/dist/__tests__/config-loading.test.d.ts.map +1 -0
- package/dist/__tests__/config-loading.test.js +127 -0
- package/dist/__tests__/config-loading.test.js.map +1 -0
- package/dist/__tests__/config-logging.test.d.ts +5 -0
- package/dist/__tests__/config-logging.test.d.ts.map +1 -0
- package/dist/__tests__/config-logging.test.js +146 -0
- package/dist/__tests__/config-logging.test.js.map +1 -0
- package/dist/__tests__/config-path-resolution.test.d.ts +5 -0
- package/dist/__tests__/config-path-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/config-path-resolution.test.js +88 -0
- package/dist/__tests__/config-path-resolution.test.js.map +1 -0
- package/dist/__tests__/config-path-validation.test.d.ts +6 -0
- package/dist/__tests__/config-path-validation.test.d.ts.map +1 -0
- package/dist/__tests__/config-path-validation.test.js +203 -0
- package/dist/__tests__/config-path-validation.test.js.map +1 -0
- package/dist/__tests__/config-precedence.test.d.ts +5 -0
- package/dist/__tests__/config-precedence.test.d.ts.map +1 -0
- package/dist/__tests__/config-precedence.test.js +200 -0
- package/dist/__tests__/config-precedence.test.js.map +1 -0
- package/dist/__tests__/config-types.test.d.ts +5 -0
- package/dist/__tests__/config-types.test.d.ts.map +1 -0
- package/dist/__tests__/config-types.test.js +189 -0
- package/dist/__tests__/config-types.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +5 -0
- package/dist/__tests__/config.test.d.ts.map +1 -0
- package/dist/__tests__/config.test.js +229 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/config.d.ts +87 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +498 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/defaults.d.ts +78 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +78 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/document-cache.d.ts +485 -0
- package/dist/document-cache.d.ts.map +1 -0
- package/dist/document-cache.hierarchical.test.d.ts +2 -0
- package/dist/document-cache.hierarchical.test.d.ts.map +1 -0
- package/dist/document-cache.hierarchical.test.js +243 -0
- package/dist/document-cache.hierarchical.test.js.map +1 -0
- package/dist/document-cache.js +965 -0
- package/dist/document-cache.js.map +1 -0
- package/dist/document-cache.test.d.ts +8 -0
- package/dist/document-cache.test.d.ts.map +1 -0
- package/dist/document-cache.test.js +624 -0
- package/dist/document-cache.test.js.map +1 -0
- package/dist/document-manager.d.ts +252 -0
- package/dist/document-manager.d.ts.map +1 -0
- package/dist/document-manager.js +760 -0
- package/dist/document-manager.js.map +1 -0
- package/dist/document-manager.race-condition.test.d.ts +8 -0
- package/dist/document-manager.race-condition.test.d.ts.map +1 -0
- package/dist/document-manager.race-condition.test.js +139 -0
- package/dist/document-manager.race-condition.test.js.map +1 -0
- package/dist/fingerprint-index.d.ts +177 -0
- package/dist/fingerprint-index.d.ts.map +1 -0
- package/dist/fingerprint-index.js +374 -0
- package/dist/fingerprint-index.js.map +1 -0
- package/dist/fingerprint-index.test.d.ts +15 -0
- package/dist/fingerprint-index.test.d.ts.map +1 -0
- package/dist/fingerprint-index.test.js +482 -0
- package/dist/fingerprint-index.test.js.map +1 -0
- package/dist/fsio.d.ts +76 -0
- package/dist/fsio.d.ts.map +1 -0
- package/dist/fsio.js +506 -0
- package/dist/fsio.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown-tools.test.d.ts +5 -0
- package/dist/markdown-tools.test.d.ts.map +1 -0
- package/dist/markdown-tools.test.js +200 -0
- package/dist/markdown-tools.test.js.map +1 -0
- package/dist/parse.d.ts +19 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +144 -0
- package/dist/parse.js.map +1 -0
- package/dist/prompts/__tests__/prompt-loader.test.d.ts +5 -0
- package/dist/prompts/__tests__/prompt-loader.test.d.ts.map +1 -0
- package/dist/prompts/__tests__/prompt-loader.test.js +300 -0
- package/dist/prompts/__tests__/prompt-loader.test.js.map +1 -0
- package/dist/prompts/prompt-loader.d.ts +58 -0
- package/dist/prompts/prompt-loader.d.ts.map +1 -0
- package/dist/prompts/prompt-loader.js +215 -0
- package/dist/prompts/prompt-loader.js.map +1 -0
- package/dist/prompts/prompt-validator.d.ts +30 -0
- package/dist/prompts/prompt-validator.d.ts.map +1 -0
- package/dist/prompts/prompt-validator.js +65 -0
- package/dist/prompts/prompt-validator.js.map +1 -0
- package/dist/prompts/types.d.ts +46 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +14 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/prompts/workflow-prompts.d.ts +42 -0
- package/dist/prompts/workflow-prompts.d.ts.map +1 -0
- package/dist/prompts/workflow-prompts.js +61 -0
- package/dist/prompts/workflow-prompts.js.map +1 -0
- package/dist/sections.d.ts +67 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.hierarchical.test.d.ts +8 -0
- package/dist/sections.hierarchical.test.d.ts.map +1 -0
- package/dist/sections.hierarchical.test.js +397 -0
- package/dist/sections.hierarchical.test.js.map +1 -0
- package/dist/sections.js +1229 -0
- package/dist/sections.js.map +1 -0
- package/dist/server/default-dependencies.d.ts +134 -0
- package/dist/server/default-dependencies.d.ts.map +1 -0
- package/dist/server/default-dependencies.js +176 -0
- package/dist/server/default-dependencies.js.map +1 -0
- package/dist/server/dependencies.d.ts +161 -0
- package/dist/server/dependencies.d.ts.map +1 -0
- package/dist/server/dependencies.js +50 -0
- package/dist/server/dependencies.js.map +1 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/error-handling.d.ts +52 -0
- package/dist/server/middleware/error-handling.d.ts.map +1 -0
- package/dist/server/middleware/error-handling.js +76 -0
- package/dist/server/middleware/error-handling.js.map +1 -0
- package/dist/server/middleware/index.d.ts +7 -0
- package/dist/server/middleware/index.d.ts.map +1 -0
- package/dist/server/middleware/index.js +7 -0
- package/dist/server/middleware/index.js.map +1 -0
- package/dist/server/middleware/logging.d.ts +29 -0
- package/dist/server/middleware/logging.d.ts.map +1 -0
- package/dist/server/middleware/logging.js +49 -0
- package/dist/server/middleware/logging.js.map +1 -0
- package/dist/server/middleware/session-management.d.ts +38 -0
- package/dist/server/middleware/session-management.d.ts.map +1 -0
- package/dist/server/middleware/session-management.js +66 -0
- package/dist/server/middleware/session-management.js.map +1 -0
- package/dist/server/request-handlers/index.d.ts +5 -0
- package/dist/server/request-handlers/index.d.ts.map +1 -0
- package/dist/server/request-handlers/index.js +5 -0
- package/dist/server/request-handlers/index.js.map +1 -0
- package/dist/server/request-handlers/prompt-handlers.d.ts +13 -0
- package/dist/server/request-handlers/prompt-handlers.d.ts.map +1 -0
- package/dist/server/request-handlers/prompt-handlers.js +80 -0
- package/dist/server/request-handlers/prompt-handlers.js.map +1 -0
- package/dist/server/request-handlers/tool-handlers.d.ts +11 -0
- package/dist/server/request-handlers/tool-handlers.d.ts.map +1 -0
- package/dist/server/request-handlers/tool-handlers.js +85 -0
- package/dist/server/request-handlers/tool-handlers.js.map +1 -0
- package/dist/server/server-factory.d.ts +68 -0
- package/dist/server/server-factory.d.ts.map +1 -0
- package/dist/server/server-factory.js +135 -0
- package/dist/server/server-factory.js.map +1 -0
- package/dist/server/transport/stdio-transport.d.ts +9 -0
- package/dist/server/transport/stdio-transport.d.ts.map +1 -0
- package/dist/server/transport/stdio-transport.js +11 -0
- package/dist/server/transport/stdio-transport.js.map +1 -0
- package/dist/session/index.d.ts +5 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +7 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/session-store.d.ts +74 -0
- package/dist/session/session-store.d.ts.map +1 -0
- package/dist/session/session-store.js +150 -0
- package/dist/session/session-store.js.map +1 -0
- package/dist/session/types.d.ts +96 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +9 -0
- package/dist/session/types.js.map +1 -0
- package/dist/shared/__tests__/addressing-system.batch-cache.test.d.ts +12 -0
- package/dist/shared/__tests__/addressing-system.batch-cache.test.d.ts.map +1 -0
- package/dist/shared/__tests__/addressing-system.batch-cache.test.js +306 -0
- package/dist/shared/__tests__/addressing-system.batch-cache.test.js.map +1 -0
- package/dist/shared/__tests__/addressing-system.hierarchical.test.d.ts +6 -0
- package/dist/shared/__tests__/addressing-system.hierarchical.test.d.ts.map +1 -0
- package/dist/shared/__tests__/addressing-system.hierarchical.test.js +205 -0
- package/dist/shared/__tests__/addressing-system.hierarchical.test.js.map +1 -0
- package/dist/shared/__tests__/addressing-system.lru.test.d.ts +6 -0
- package/dist/shared/__tests__/addressing-system.lru.test.d.ts.map +1 -0
- package/dist/shared/__tests__/addressing-system.lru.test.js +159 -0
- package/dist/shared/__tests__/addressing-system.lru.test.js.map +1 -0
- package/dist/shared/__tests__/addressing-system.relative-paths.test.d.ts +14 -0
- package/dist/shared/__tests__/addressing-system.relative-paths.test.d.ts.map +1 -0
- package/dist/shared/__tests__/addressing-system.relative-paths.test.js +249 -0
- package/dist/shared/__tests__/addressing-system.relative-paths.test.js.map +1 -0
- package/dist/shared/__tests__/document-analysis-enhanced.test.d.ts +9 -0
- package/dist/shared/__tests__/document-analysis-enhanced.test.d.ts.map +1 -0
- package/dist/shared/__tests__/document-analysis-enhanced.test.js +419 -0
- package/dist/shared/__tests__/document-analysis-enhanced.test.js.map +1 -0
- package/dist/shared/__tests__/document-analysis.test.d.ts +8 -0
- package/dist/shared/__tests__/document-analysis.test.d.ts.map +1 -0
- package/dist/shared/__tests__/document-analysis.test.js +904 -0
- package/dist/shared/__tests__/document-analysis.test.js.map +1 -0
- package/dist/shared/__tests__/keyword-utils-integration.test.d.ts +9 -0
- package/dist/shared/__tests__/keyword-utils-integration.test.d.ts.map +1 -0
- package/dist/shared/__tests__/keyword-utils-integration.test.js +317 -0
- package/dist/shared/__tests__/keyword-utils-integration.test.js.map +1 -0
- package/dist/shared/__tests__/link-utils.test.d.ts +5 -0
- package/dist/shared/__tests__/link-utils.test.d.ts.map +1 -0
- package/dist/shared/__tests__/link-utils.test.js +560 -0
- package/dist/shared/__tests__/link-utils.test.js.map +1 -0
- package/dist/shared/__tests__/link-validation.test.d.ts +5 -0
- package/dist/shared/__tests__/link-validation.test.d.ts.map +1 -0
- package/dist/shared/__tests__/link-validation.test.js +473 -0
- package/dist/shared/__tests__/link-validation.test.js.map +1 -0
- package/dist/shared/__tests__/reference-extractor.test.d.ts +8 -0
- package/dist/shared/__tests__/reference-extractor.test.d.ts.map +1 -0
- package/dist/shared/__tests__/reference-extractor.test.js +260 -0
- package/dist/shared/__tests__/reference-extractor.test.js.map +1 -0
- package/dist/shared/__tests__/reference-loader.test.d.ts +8 -0
- package/dist/shared/__tests__/reference-loader.test.d.ts.map +1 -0
- package/dist/shared/__tests__/reference-loader.test.js +622 -0
- package/dist/shared/__tests__/reference-loader.test.js.map +1 -0
- package/dist/shared/__tests__/section-operations.append.test.d.ts +8 -0
- package/dist/shared/__tests__/section-operations.append.test.d.ts.map +1 -0
- package/dist/shared/__tests__/section-operations.append.test.js +150 -0
- package/dist/shared/__tests__/section-operations.append.test.js.map +1 -0
- package/dist/shared/__tests__/section-operations.test.d.ts +7 -0
- package/dist/shared/__tests__/section-operations.test.d.ts.map +1 -0
- package/dist/shared/__tests__/section-operations.test.js +118 -0
- package/dist/shared/__tests__/section-operations.test.js.map +1 -0
- package/dist/shared/__tests__/slug-utils.test.d.ts +5 -0
- package/dist/shared/__tests__/slug-utils.test.d.ts.map +1 -0
- package/dist/shared/__tests__/slug-utils.test.js +542 -0
- package/dist/shared/__tests__/slug-utils.test.js.map +1 -0
- package/dist/shared/__tests__/task-operations.test.d.ts +9 -0
- package/dist/shared/__tests__/task-operations.test.d.ts.map +1 -0
- package/dist/shared/__tests__/task-operations.test.js +257 -0
- package/dist/shared/__tests__/task-operations.test.js.map +1 -0
- package/dist/shared/__tests__/task-validation.test.d.ts +6 -0
- package/dist/shared/__tests__/task-validation.test.d.ts.map +1 -0
- package/dist/shared/__tests__/task-validation.test.js +129 -0
- package/dist/shared/__tests__/task-validation.test.js.map +1 -0
- package/dist/shared/__tests__/task-view-utilities.test.d.ts +5 -0
- package/dist/shared/__tests__/task-view-utilities.test.d.ts.map +1 -0
- package/dist/shared/__tests__/task-view-utilities.test.js +312 -0
- package/dist/shared/__tests__/task-view-utilities.test.js.map +1 -0
- package/dist/shared/__tests__/tool-integration.array-validation.test.d.ts +7 -0
- package/dist/shared/__tests__/tool-integration.array-validation.test.d.ts.map +1 -0
- package/dist/shared/__tests__/tool-integration.array-validation.test.js +169 -0
- package/dist/shared/__tests__/tool-integration.array-validation.test.js.map +1 -0
- package/dist/shared/__tests__/tool-integration.hierarchical.test.d.ts +7 -0
- package/dist/shared/__tests__/tool-integration.hierarchical.test.d.ts.map +1 -0
- package/dist/shared/__tests__/tool-integration.hierarchical.test.js +204 -0
- package/dist/shared/__tests__/tool-integration.hierarchical.test.js.map +1 -0
- package/dist/shared/__tests__/workflow-prompt-utilities.test.d.ts +8 -0
- package/dist/shared/__tests__/workflow-prompt-utilities.test.d.ts.map +1 -0
- package/dist/shared/__tests__/workflow-prompt-utilities.test.js +722 -0
- package/dist/shared/__tests__/workflow-prompt-utilities.test.js.map +1 -0
- package/dist/shared/addressing-system.d.ts +799 -0
- package/dist/shared/addressing-system.d.ts.map +1 -0
- package/dist/shared/addressing-system.js +1074 -0
- package/dist/shared/addressing-system.js.map +1 -0
- package/dist/shared/document-analysis/__tests__/keyword-utils.test.d.ts +8 -0
- package/dist/shared/document-analysis/__tests__/keyword-utils.test.d.ts.map +1 -0
- package/dist/shared/document-analysis/__tests__/keyword-utils.test.js +601 -0
- package/dist/shared/document-analysis/__tests__/keyword-utils.test.js.map +1 -0
- package/dist/shared/document-analysis/index.d.ts +67 -0
- package/dist/shared/document-analysis/index.d.ts.map +1 -0
- package/dist/shared/document-analysis/index.js +166 -0
- package/dist/shared/document-analysis/index.js.map +1 -0
- package/dist/shared/document-analysis/keyword-utils.d.ts +405 -0
- package/dist/shared/document-analysis/keyword-utils.d.ts.map +1 -0
- package/dist/shared/document-analysis/keyword-utils.js +1147 -0
- package/dist/shared/document-analysis/keyword-utils.js.map +1 -0
- package/dist/shared/document-analysis/reference-validation.d.ts +27 -0
- package/dist/shared/document-analysis/reference-validation.d.ts.map +1 -0
- package/dist/shared/document-analysis/reference-validation.js +173 -0
- package/dist/shared/document-analysis/reference-validation.js.map +1 -0
- package/dist/shared/document-analysis/related-docs.d.ts +27 -0
- package/dist/shared/document-analysis/related-docs.d.ts.map +1 -0
- package/dist/shared/document-analysis/related-docs.js +459 -0
- package/dist/shared/document-analysis/related-docs.js.map +1 -0
- package/dist/shared/document-analysis/types.d.ts +89 -0
- package/dist/shared/document-analysis/types.d.ts.map +1 -0
- package/dist/shared/document-analysis/types.js +41 -0
- package/dist/shared/document-analysis/types.js.map +1 -0
- package/dist/shared/document-analysis.d.ts +15 -0
- package/dist/shared/document-analysis.d.ts.map +1 -0
- package/dist/shared/document-analysis.js +16 -0
- package/dist/shared/document-analysis.js.map +1 -0
- package/dist/shared/document-manager-factory.d.ts +32 -0
- package/dist/shared/document-manager-factory.d.ts.map +1 -0
- package/dist/shared/document-manager-factory.js +75 -0
- package/dist/shared/document-manager-factory.js.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/link-analysis.d.ts +84 -0
- package/dist/shared/link-analysis.d.ts.map +1 -0
- package/dist/shared/link-analysis.js +213 -0
- package/dist/shared/link-analysis.js.map +1 -0
- package/dist/shared/link-context.d.ts +23 -0
- package/dist/shared/link-context.d.ts.map +1 -0
- package/dist/shared/link-context.js +172 -0
- package/dist/shared/link-context.js.map +1 -0
- package/dist/shared/link-utils.d.ts +33 -0
- package/dist/shared/link-utils.d.ts.map +1 -0
- package/dist/shared/link-utils.js +301 -0
- package/dist/shared/link-utils.js.map +1 -0
- package/dist/shared/link-validation.d.ts +79 -0
- package/dist/shared/link-validation.d.ts.map +1 -0
- package/dist/shared/link-validation.js +340 -0
- package/dist/shared/link-validation.js.map +1 -0
- package/dist/shared/namespace-analysis.d.ts +10 -0
- package/dist/shared/namespace-analysis.d.ts.map +1 -0
- package/dist/shared/namespace-analysis.js +100 -0
- package/dist/shared/namespace-analysis.js.map +1 -0
- package/dist/shared/namespace-constants.d.ts +69 -0
- package/dist/shared/namespace-constants.d.ts.map +1 -0
- package/dist/shared/namespace-constants.js +97 -0
- package/dist/shared/namespace-constants.js.map +1 -0
- package/dist/shared/path-utilities.d.ts +13 -0
- package/dist/shared/path-utilities.d.ts.map +1 -0
- package/dist/shared/path-utilities.js +39 -0
- package/dist/shared/path-utilities.js.map +1 -0
- package/dist/shared/reference-extractor.d.ts +121 -0
- package/dist/shared/reference-extractor.d.ts.map +1 -0
- package/dist/shared/reference-extractor.js +195 -0
- package/dist/shared/reference-extractor.js.map +1 -0
- package/dist/shared/reference-loader.d.ts +163 -0
- package/dist/shared/reference-loader.d.ts.map +1 -0
- package/dist/shared/reference-loader.js +265 -0
- package/dist/shared/reference-loader.js.map +1 -0
- package/dist/shared/section-operations.d.ts +14 -0
- package/dist/shared/section-operations.d.ts.map +1 -0
- package/dist/shared/section-operations.js +115 -0
- package/dist/shared/section-operations.js.map +1 -0
- package/dist/shared/slug-utils.d.ts +109 -0
- package/dist/shared/slug-utils.d.ts.map +1 -0
- package/dist/shared/slug-utils.js +302 -0
- package/dist/shared/slug-utils.js.map +1 -0
- package/dist/shared/task-operations.d.ts +152 -0
- package/dist/shared/task-operations.d.ts.map +1 -0
- package/dist/shared/task-operations.js +416 -0
- package/dist/shared/task-operations.js.map +1 -0
- package/dist/shared/task-utilities.d.ts +63 -0
- package/dist/shared/task-utilities.d.ts.map +1 -0
- package/dist/shared/task-utilities.js +86 -0
- package/dist/shared/task-utilities.js.map +1 -0
- package/dist/shared/task-validation.d.ts +50 -0
- package/dist/shared/task-validation.d.ts.map +1 -0
- package/dist/shared/task-validation.js +97 -0
- package/dist/shared/task-validation.js.map +1 -0
- package/dist/shared/task-view-utilities.d.ts +109 -0
- package/dist/shared/task-view-utilities.d.ts.map +1 -0
- package/dist/shared/task-view-utilities.js +255 -0
- package/dist/shared/task-view-utilities.js.map +1 -0
- package/dist/shared/utilities.d.ts +14 -0
- package/dist/shared/utilities.d.ts.map +1 -0
- package/dist/shared/utilities.js +23 -0
- package/dist/shared/utilities.js.map +1 -0
- package/dist/shared/utilities.test.d.ts +5 -0
- package/dist/shared/utilities.test.d.ts.map +1 -0
- package/dist/shared/utilities.test.js +422 -0
- package/dist/shared/utilities.test.js.map +1 -0
- package/dist/shared/validation-utils.d.ts +57 -0
- package/dist/shared/validation-utils.d.ts.map +1 -0
- package/dist/shared/validation-utils.js +63 -0
- package/dist/shared/validation-utils.js.map +1 -0
- package/dist/shared/workflow-prompt-utilities.d.ts +64 -0
- package/dist/shared/workflow-prompt-utilities.d.ts.map +1 -0
- package/dist/shared/workflow-prompt-utilities.js +163 -0
- package/dist/shared/workflow-prompt-utilities.js.map +1 -0
- package/dist/slug.d.ts +9 -0
- package/dist/slug.d.ts.map +1 -0
- package/dist/slug.js +40 -0
- package/dist/slug.js.map +1 -0
- package/dist/template-loader.d.ts +6 -0
- package/dist/template-loader.d.ts.map +1 -0
- package/dist/template-loader.js +8 -0
- package/dist/template-loader.js.map +1 -0
- package/dist/tools/__tests__/create-document-self-reference.test.d.ts +2 -0
- package/dist/tools/__tests__/create-document-self-reference.test.d.ts.map +1 -0
- package/dist/tools/__tests__/create-document-self-reference.test.js +124 -0
- package/dist/tools/__tests__/create-document-self-reference.test.js.map +1 -0
- package/dist/tools/__tests__/create-document-workflow-regression.test.d.ts +16 -0
- package/dist/tools/__tests__/create-document-workflow-regression.test.d.ts.map +1 -0
- package/dist/tools/__tests__/create-document-workflow-regression.test.js +655 -0
- package/dist/tools/__tests__/create-document-workflow-regression.test.js.map +1 -0
- package/dist/tools/__tests__/create-document.test.d.ts +2 -0
- package/dist/tools/__tests__/create-document.test.d.ts.map +1 -0
- package/dist/tools/__tests__/create-document.test.js +255 -0
- package/dist/tools/__tests__/create-document.test.js.map +1 -0
- package/dist/tools/__tests__/delete-document.test.d.ts +7 -0
- package/dist/tools/__tests__/delete-document.test.d.ts.map +1 -0
- package/dist/tools/__tests__/delete-document.test.js +311 -0
- package/dist/tools/__tests__/delete-document.test.js.map +1 -0
- package/dist/tools/__tests__/edit-document.test.d.ts +2 -0
- package/dist/tools/__tests__/edit-document.test.d.ts.map +1 -0
- package/dist/tools/__tests__/edit-document.test.js +644 -0
- package/dist/tools/__tests__/edit-document.test.js.map +1 -0
- package/dist/tools/__tests__/error-scenarios.test.d.ts +5 -0
- package/dist/tools/__tests__/error-scenarios.test.d.ts.map +1 -0
- package/dist/tools/__tests__/error-scenarios.test.js +105 -0
- package/dist/tools/__tests__/error-scenarios.test.js.map +1 -0
- package/dist/tools/__tests__/mocks/document-manager.mock.d.ts +99 -0
- package/dist/tools/__tests__/mocks/document-manager.mock.d.ts.map +1 -0
- package/dist/tools/__tests__/mocks/document-manager.mock.js +457 -0
- package/dist/tools/__tests__/mocks/document-manager.mock.js.map +1 -0
- package/dist/tools/__tests__/mocks/filesystem.mock.d.ts +103 -0
- package/dist/tools/__tests__/mocks/filesystem.mock.d.ts.map +1 -0
- package/dist/tools/__tests__/mocks/filesystem.mock.js +247 -0
- package/dist/tools/__tests__/mocks/filesystem.mock.js.map +1 -0
- package/dist/tools/__tests__/move-document.test.d.ts +12 -0
- package/dist/tools/__tests__/move-document.test.d.ts.map +1 -0
- package/dist/tools/__tests__/move-document.test.js +214 -0
- package/dist/tools/__tests__/move-document.test.js.map +1 -0
- package/dist/tools/__tests__/move.test.d.ts +13 -0
- package/dist/tools/__tests__/move.test.d.ts.map +1 -0
- package/dist/tools/__tests__/move.test.js +939 -0
- package/dist/tools/__tests__/move.test.js.map +1 -0
- package/dist/tools/__tests__/section.integration.improved.test.d.ts +5 -0
- package/dist/tools/__tests__/section.integration.improved.test.d.ts.map +1 -0
- package/dist/tools/__tests__/section.integration.improved.test.js +199 -0
- package/dist/tools/__tests__/section.integration.improved.test.js.map +1 -0
- package/dist/tools/__tests__/section.integration.test.d.ts +5 -0
- package/dist/tools/__tests__/section.integration.test.d.ts.map +1 -0
- package/dist/tools/__tests__/section.integration.test.js +637 -0
- package/dist/tools/__tests__/section.integration.test.js.map +1 -0
- package/dist/tools/__tests__/setup/test-environment.d.ts +111 -0
- package/dist/tools/__tests__/setup/test-environment.d.ts.map +1 -0
- package/dist/tools/__tests__/setup/test-environment.js +322 -0
- package/dist/tools/__tests__/setup/test-environment.js.map +1 -0
- package/dist/tools/__tests__/suggestion-generator.test.d.ts +8 -0
- package/dist/tools/__tests__/suggestion-generator.test.d.ts.map +1 -0
- package/dist/tools/__tests__/suggestion-generator.test.js +508 -0
- package/dist/tools/__tests__/suggestion-generator.test.js.map +1 -0
- package/dist/tools/__tests__/task-consistency.test.d.ts +11 -0
- package/dist/tools/__tests__/task-consistency.test.d.ts.map +1 -0
- package/dist/tools/__tests__/task-consistency.test.js +93 -0
- package/dist/tools/__tests__/task-consistency.test.js.map +1 -0
- package/dist/tools/__tests__/task-status-parsing.test.d.ts +15 -0
- package/dist/tools/__tests__/task-status-parsing.test.d.ts.map +1 -0
- package/dist/tools/__tests__/task-status-parsing.test.js +126 -0
- package/dist/tools/__tests__/task-status-parsing.test.js.map +1 -0
- package/dist/tools/__tests__/view-section-boundary.test.d.ts +2 -0
- package/dist/tools/__tests__/view-section-boundary.test.d.ts.map +1 -0
- package/dist/tools/__tests__/view-section-boundary.test.js +132 -0
- package/dist/tools/__tests__/view-section-boundary.test.js.map +1 -0
- package/dist/tools/__tests__/write-operations-integration.test.d.ts +8 -0
- package/dist/tools/__tests__/write-operations-integration.test.d.ts.map +1 -0
- package/dist/tools/__tests__/write-operations-integration.test.js +136 -0
- package/dist/tools/__tests__/write-operations-integration.test.js.map +1 -0
- package/dist/tools/browse/content-analyzer.d.ts +27 -0
- package/dist/tools/browse/content-analyzer.d.ts.map +1 -0
- package/dist/tools/browse/content-analyzer.js +150 -0
- package/dist/tools/browse/content-analyzer.js.map +1 -0
- package/dist/tools/browse/dependency-analyzer.d.ts +63 -0
- package/dist/tools/browse/dependency-analyzer.d.ts.map +1 -0
- package/dist/tools/browse/dependency-analyzer.js +261 -0
- package/dist/tools/browse/dependency-analyzer.js.map +1 -0
- package/dist/tools/browse/folder-navigator.d.ts +35 -0
- package/dist/tools/browse/folder-navigator.d.ts.map +1 -0
- package/dist/tools/browse/folder-navigator.js +154 -0
- package/dist/tools/browse/folder-navigator.js.map +1 -0
- package/dist/tools/browse/index.d.ts +10 -0
- package/dist/tools/browse/index.d.ts.map +1 -0
- package/dist/tools/browse/index.js +14 -0
- package/dist/tools/browse/index.js.map +1 -0
- package/dist/tools/browse/relationship-classifier.d.ts +9 -0
- package/dist/tools/browse/relationship-classifier.d.ts.map +1 -0
- package/dist/tools/browse/relationship-classifier.js +38 -0
- package/dist/tools/browse/relationship-classifier.js.map +1 -0
- package/dist/tools/browse/search-engine.d.ts +69 -0
- package/dist/tools/browse/search-engine.d.ts.map +1 -0
- package/dist/tools/browse/search-engine.js +197 -0
- package/dist/tools/browse/search-engine.js.map +1 -0
- package/dist/tools/create/__tests__/file-creator.test.d.ts +6 -0
- package/dist/tools/create/__tests__/file-creator.test.d.ts.map +1 -0
- package/dist/tools/create/__tests__/file-creator.test.js +138 -0
- package/dist/tools/create/__tests__/file-creator.test.js.map +1 -0
- package/dist/tools/create/__tests__/template-processor.test.d.ts +6 -0
- package/dist/tools/create/__tests__/template-processor.test.d.ts.map +1 -0
- package/dist/tools/create/__tests__/template-processor.test.js +130 -0
- package/dist/tools/create/__tests__/template-processor.test.js.map +1 -0
- package/dist/tools/create/file-creator.d.ts +35 -0
- package/dist/tools/create/file-creator.d.ts.map +1 -0
- package/dist/tools/create/file-creator.js +103 -0
- package/dist/tools/create/file-creator.js.map +1 -0
- package/dist/tools/create/index.d.ts +6 -0
- package/dist/tools/create/index.d.ts.map +1 -0
- package/dist/tools/create/index.js +7 -0
- package/dist/tools/create/index.js.map +1 -0
- package/dist/tools/create/pipeline.d.ts +39 -0
- package/dist/tools/create/pipeline.d.ts.map +1 -0
- package/dist/tools/create/pipeline.js +112 -0
- package/dist/tools/create/pipeline.js.map +1 -0
- package/dist/tools/create/suggestion-generator.d.ts +47 -0
- package/dist/tools/create/suggestion-generator.d.ts.map +1 -0
- package/dist/tools/create/suggestion-generator.js +51 -0
- package/dist/tools/create/suggestion-generator.js.map +1 -0
- package/dist/tools/create/template-processor.d.ts +27 -0
- package/dist/tools/create/template-processor.d.ts.map +1 -0
- package/dist/tools/create/template-processor.js +74 -0
- package/dist/tools/create/template-processor.js.map +1 -0
- package/dist/tools/create/validation-processor.d.ts +48 -0
- package/dist/tools/create/validation-processor.d.ts.map +1 -0
- package/dist/tools/create/validation-processor.js +107 -0
- package/dist/tools/create/validation-processor.js.map +1 -0
- package/dist/tools/executor.d.ts +19 -0
- package/dist/tools/executor.d.ts.map +1 -0
- package/dist/tools/executor.js +53 -0
- package/dist/tools/executor.js.map +1 -0
- package/dist/tools/implementations/__tests__/browse-documents.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/browse-documents.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/browse-documents.test.js +319 -0
- package/dist/tools/implementations/__tests__/browse-documents.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/complete-coordinator-task.test.d.ts +7 -0
- package/dist/tools/implementations/__tests__/complete-coordinator-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/complete-coordinator-task.test.js +440 -0
- package/dist/tools/implementations/__tests__/complete-coordinator-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/complete-subagent-task.test.d.ts +14 -0
- package/dist/tools/implementations/__tests__/complete-subagent-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/complete-subagent-task.test.js +851 -0
- package/dist/tools/implementations/__tests__/complete-subagent-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/complete-task-notes.test.d.ts +6 -0
- package/dist/tools/implementations/__tests__/complete-task-notes.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/complete-task-notes.test.js +157 -0
- package/dist/tools/implementations/__tests__/complete-task-notes.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/complete-task.test.d.ts +14 -0
- package/dist/tools/implementations/__tests__/complete-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/complete-task.test.js +867 -0
- package/dist/tools/implementations/__tests__/complete-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/continue-task.test.d.ts +11 -0
- package/dist/tools/implementations/__tests__/continue-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/continue-task.test.js +845 -0
- package/dist/tools/implementations/__tests__/continue-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/coordinator-task.test.d.ts +7 -0
- package/dist/tools/implementations/__tests__/coordinator-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/coordinator-task.test.js +495 -0
- package/dist/tools/implementations/__tests__/coordinator-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/get-guide.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/get-guide.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/get-guide.test.js +242 -0
- package/dist/tools/implementations/__tests__/get-guide.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/get-workflow.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/get-workflow.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/get-workflow.test.js +232 -0
- package/dist/tools/implementations/__tests__/get-workflow.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/search-documents.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/search-documents.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/search-documents.test.js +336 -0
- package/dist/tools/implementations/__tests__/search-documents.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/start-coordinator-task.test.d.ts +7 -0
- package/dist/tools/implementations/__tests__/start-coordinator-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/start-coordinator-task.test.js +177 -0
- package/dist/tools/implementations/__tests__/start-coordinator-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/start-subagent-task.test.d.ts +11 -0
- package/dist/tools/implementations/__tests__/start-subagent-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/start-subagent-task.test.js +846 -0
- package/dist/tools/implementations/__tests__/start-subagent-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/start-task.test.d.ts +11 -0
- package/dist/tools/implementations/__tests__/start-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/start-task.test.js +828 -0
- package/dist/tools/implementations/__tests__/start-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/subagent-task-batch-operations.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/subagent-task-batch-operations.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/subagent-task-batch-operations.test.js +199 -0
- package/dist/tools/implementations/__tests__/subagent-task-batch-operations.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/subagent-task.test.d.ts +7 -0
- package/dist/tools/implementations/__tests__/subagent-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/subagent-task.test.js +720 -0
- package/dist/tools/implementations/__tests__/subagent-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/task-batch-operations.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/task-batch-operations.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/task-batch-operations.test.js +200 -0
- package/dist/tools/implementations/__tests__/task-batch-operations.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/task.test.d.ts +7 -0
- package/dist/tools/implementations/__tests__/task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/task.test.js +578 -0
- package/dist/tools/implementations/__tests__/task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/view-coordinator-task.test.d.ts +13 -0
- package/dist/tools/implementations/__tests__/view-coordinator-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/view-coordinator-task.test.js +1404 -0
- package/dist/tools/implementations/__tests__/view-coordinator-task.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/view-document.linked-context.test.d.ts +8 -0
- package/dist/tools/implementations/__tests__/view-document.linked-context.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/view-document.linked-context.test.js +235 -0
- package/dist/tools/implementations/__tests__/view-document.linked-context.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/view-document.simplification.test.d.ts +9 -0
- package/dist/tools/implementations/__tests__/view-document.simplification.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/view-document.simplification.test.js +160 -0
- package/dist/tools/implementations/__tests__/view-document.simplification.test.js.map +1 -0
- package/dist/tools/implementations/__tests__/view-task.test.d.ts +12 -0
- package/dist/tools/implementations/__tests__/view-task.test.d.ts.map +1 -0
- package/dist/tools/implementations/__tests__/view-task.test.js +1158 -0
- package/dist/tools/implementations/__tests__/view-task.test.js.map +1 -0
- package/dist/tools/implementations/browse-documents.d.ts +36 -0
- package/dist/tools/implementations/browse-documents.d.ts.map +1 -0
- package/dist/tools/implementations/browse-documents.js +123 -0
- package/dist/tools/implementations/browse-documents.js.map +1 -0
- package/dist/tools/implementations/complete-coordinator-task.d.ts +53 -0
- package/dist/tools/implementations/complete-coordinator-task.d.ts.map +1 -0
- package/dist/tools/implementations/complete-coordinator-task.js +159 -0
- package/dist/tools/implementations/complete-coordinator-task.js.map +1 -0
- package/dist/tools/implementations/complete-subagent-task.d.ts +47 -0
- package/dist/tools/implementations/complete-subagent-task.d.ts.map +1 -0
- package/dist/tools/implementations/complete-subagent-task.js +141 -0
- package/dist/tools/implementations/complete-subagent-task.js.map +1 -0
- package/dist/tools/implementations/complete-task.d.ts +32 -0
- package/dist/tools/implementations/complete-task.d.ts.map +1 -0
- package/dist/tools/implementations/complete-task.hierarchical.test.d.ts +8 -0
- package/dist/tools/implementations/complete-task.hierarchical.test.d.ts.map +1 -0
- package/dist/tools/implementations/complete-task.hierarchical.test.js +363 -0
- package/dist/tools/implementations/complete-task.hierarchical.test.js.map +1 -0
- package/dist/tools/implementations/complete-task.js +122 -0
- package/dist/tools/implementations/complete-task.js.map +1 -0
- package/dist/tools/implementations/continue-task.d.ts +48 -0
- package/dist/tools/implementations/continue-task.d.ts.map +1 -0
- package/dist/tools/implementations/continue-task.js +167 -0
- package/dist/tools/implementations/continue-task.js.map +1 -0
- package/dist/tools/implementations/coordinator-task.d.ts +72 -0
- package/dist/tools/implementations/coordinator-task.d.ts.map +1 -0
- package/dist/tools/implementations/coordinator-task.js +169 -0
- package/dist/tools/implementations/coordinator-task.js.map +1 -0
- package/dist/tools/implementations/create-document.d.ts +12 -0
- package/dist/tools/implementations/create-document.d.ts.map +1 -0
- package/dist/tools/implementations/create-document.js +15 -0
- package/dist/tools/implementations/create-document.js.map +1 -0
- package/dist/tools/implementations/delete-document.d.ts +16 -0
- package/dist/tools/implementations/delete-document.d.ts.map +1 -0
- package/dist/tools/implementations/delete-document.js +70 -0
- package/dist/tools/implementations/delete-document.js.map +1 -0
- package/dist/tools/implementations/edit-document.d.ts +8 -0
- package/dist/tools/implementations/edit-document.d.ts.map +1 -0
- package/dist/tools/implementations/edit-document.js +118 -0
- package/dist/tools/implementations/edit-document.js.map +1 -0
- package/dist/tools/implementations/get-guide.d.ts +13 -0
- package/dist/tools/implementations/get-guide.d.ts.map +1 -0
- package/dist/tools/implementations/get-guide.js +64 -0
- package/dist/tools/implementations/get-guide.js.map +1 -0
- package/dist/tools/implementations/get-workflow.d.ts +12 -0
- package/dist/tools/implementations/get-workflow.d.ts.map +1 -0
- package/dist/tools/implementations/get-workflow.js +71 -0
- package/dist/tools/implementations/get-workflow.js.map +1 -0
- package/dist/tools/implementations/index.d.ts +24 -0
- package/dist/tools/implementations/index.d.ts.map +1 -0
- package/dist/tools/implementations/index.js +24 -0
- package/dist/tools/implementations/index.js.map +1 -0
- package/dist/tools/implementations/manage-document.d.ts +8 -0
- package/dist/tools/implementations/manage-document.d.ts.map +1 -0
- package/dist/tools/implementations/manage-document.js +180 -0
- package/dist/tools/implementations/manage-document.js.map +1 -0
- package/dist/tools/implementations/move-document.d.ts +12 -0
- package/dist/tools/implementations/move-document.d.ts.map +1 -0
- package/dist/tools/implementations/move-document.js +72 -0
- package/dist/tools/implementations/move-document.js.map +1 -0
- package/dist/tools/implementations/move.d.ts +24 -0
- package/dist/tools/implementations/move.d.ts.map +1 -0
- package/dist/tools/implementations/move.js +167 -0
- package/dist/tools/implementations/move.js.map +1 -0
- package/dist/tools/implementations/search-documents.d.ts +39 -0
- package/dist/tools/implementations/search-documents.d.ts.map +1 -0
- package/dist/tools/implementations/search-documents.js +246 -0
- package/dist/tools/implementations/search-documents.js.map +1 -0
- package/dist/tools/implementations/section.d.ts +42 -0
- package/dist/tools/implementations/section.d.ts.map +1 -0
- package/dist/tools/implementations/section.hierarchical.test.d.ts +8 -0
- package/dist/tools/implementations/section.hierarchical.test.d.ts.map +1 -0
- package/dist/tools/implementations/section.hierarchical.test.js +299 -0
- package/dist/tools/implementations/section.hierarchical.test.js.map +1 -0
- package/dist/tools/implementations/section.js +244 -0
- package/dist/tools/implementations/section.js.map +1 -0
- package/dist/tools/implementations/section.test.d.ts +5 -0
- package/dist/tools/implementations/section.test.d.ts.map +1 -0
- package/dist/tools/implementations/section.test.js +371 -0
- package/dist/tools/implementations/section.test.js.map +1 -0
- package/dist/tools/implementations/start-coordinator-task.d.ts +44 -0
- package/dist/tools/implementations/start-coordinator-task.d.ts.map +1 -0
- package/dist/tools/implementations/start-coordinator-task.js +125 -0
- package/dist/tools/implementations/start-coordinator-task.js.map +1 -0
- package/dist/tools/implementations/start-subagent-task.d.ts +53 -0
- package/dist/tools/implementations/start-subagent-task.d.ts.map +1 -0
- package/dist/tools/implementations/start-subagent-task.js +179 -0
- package/dist/tools/implementations/start-subagent-task.js.map +1 -0
- package/dist/tools/implementations/start-task.d.ts +48 -0
- package/dist/tools/implementations/start-task.d.ts.map +1 -0
- package/dist/tools/implementations/start-task.js +216 -0
- package/dist/tools/implementations/start-task.js.map +1 -0
- package/dist/tools/implementations/subagent-task.d.ts +98 -0
- package/dist/tools/implementations/subagent-task.d.ts.map +1 -0
- package/dist/tools/implementations/subagent-task.js +277 -0
- package/dist/tools/implementations/subagent-task.js.map +1 -0
- package/dist/tools/implementations/task.d.ts +97 -0
- package/dist/tools/implementations/task.d.ts.map +1 -0
- package/dist/tools/implementations/task.hierarchical.test.d.ts +8 -0
- package/dist/tools/implementations/task.hierarchical.test.d.ts.map +1 -0
- package/dist/tools/implementations/task.hierarchical.test.js +333 -0
- package/dist/tools/implementations/task.hierarchical.test.js.map +1 -0
- package/dist/tools/implementations/task.js +235 -0
- package/dist/tools/implementations/task.js.map +1 -0
- package/dist/tools/implementations/view-coordinator-task.d.ts +61 -0
- package/dist/tools/implementations/view-coordinator-task.d.ts.map +1 -0
- package/dist/tools/implementations/view-coordinator-task.js +295 -0
- package/dist/tools/implementations/view-coordinator-task.js.map +1 -0
- package/dist/tools/implementations/view-document.d.ts +84 -0
- package/dist/tools/implementations/view-document.d.ts.map +1 -0
- package/dist/tools/implementations/view-document.js +287 -0
- package/dist/tools/implementations/view-document.js.map +1 -0
- package/dist/tools/implementations/view-section.d.ts +28 -0
- package/dist/tools/implementations/view-section.d.ts.map +1 -0
- package/dist/tools/implementations/view-section.hierarchical.test.d.ts +8 -0
- package/dist/tools/implementations/view-section.hierarchical.test.d.ts.map +1 -0
- package/dist/tools/implementations/view-section.hierarchical.test.js +318 -0
- package/dist/tools/implementations/view-section.hierarchical.test.js.map +1 -0
- package/dist/tools/implementations/view-section.js +167 -0
- package/dist/tools/implementations/view-section.js.map +1 -0
- package/dist/tools/implementations/view-subagent-task.d.ts +46 -0
- package/dist/tools/implementations/view-subagent-task.d.ts.map +1 -0
- package/dist/tools/implementations/view-subagent-task.js +283 -0
- package/dist/tools/implementations/view-subagent-task.js.map +1 -0
- package/dist/tools/implementations/view-task.d.ts +43 -0
- package/dist/tools/implementations/view-task.d.ts.map +1 -0
- package/dist/tools/implementations/view-task.hierarchical.test.d.ts +8 -0
- package/dist/tools/implementations/view-task.hierarchical.test.d.ts.map +1 -0
- package/dist/tools/implementations/view-task.hierarchical.test.js +420 -0
- package/dist/tools/implementations/view-task.hierarchical.test.js.map +1 -0
- package/dist/tools/implementations/view-task.js +280 -0
- package/dist/tools/implementations/view-task.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +10 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +132 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/schemas/__tests__/get-guide-schemas.test.d.ts +8 -0
- package/dist/tools/schemas/__tests__/get-guide-schemas.test.d.ts.map +1 -0
- package/dist/tools/schemas/__tests__/get-guide-schemas.test.js +216 -0
- package/dist/tools/schemas/__tests__/get-guide-schemas.test.js.map +1 -0
- package/dist/tools/schemas/__tests__/get-workflow-schemas.test.d.ts +8 -0
- package/dist/tools/schemas/__tests__/get-workflow-schemas.test.d.ts.map +1 -0
- package/dist/tools/schemas/__tests__/get-workflow-schemas.test.js +229 -0
- package/dist/tools/schemas/__tests__/get-workflow-schemas.test.js.map +1 -0
- package/dist/tools/schemas/browse-documents-schemas.d.ts +47 -0
- package/dist/tools/schemas/browse-documents-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/browse-documents-schemas.js +48 -0
- package/dist/tools/schemas/browse-documents-schemas.js.map +1 -0
- package/dist/tools/schemas/complete-coordinator-task-schemas.d.ts +41 -0
- package/dist/tools/schemas/complete-coordinator-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/complete-coordinator-task-schemas.js +42 -0
- package/dist/tools/schemas/complete-coordinator-task-schemas.js.map +1 -0
- package/dist/tools/schemas/complete-subagent-task-schemas.d.ts +38 -0
- package/dist/tools/schemas/complete-subagent-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/complete-subagent-task-schemas.js +41 -0
- package/dist/tools/schemas/complete-subagent-task-schemas.js.map +1 -0
- package/dist/tools/schemas/complete-task-schemas.d.ts +33 -0
- package/dist/tools/schemas/complete-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/complete-task-schemas.js +36 -0
- package/dist/tools/schemas/complete-task-schemas.js.map +1 -0
- package/dist/tools/schemas/continue-task-schemas.d.ts +27 -0
- package/dist/tools/schemas/continue-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/continue-task-schemas.js +28 -0
- package/dist/tools/schemas/continue-task-schemas.js.map +1 -0
- package/dist/tools/schemas/coordinator-task-schemas.d.ts +87 -0
- package/dist/tools/schemas/coordinator-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/coordinator-task-schemas.js +80 -0
- package/dist/tools/schemas/coordinator-task-schemas.js.map +1 -0
- package/dist/tools/schemas/create-document-schemas.d.ts +61 -0
- package/dist/tools/schemas/create-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/create-document-schemas.js +143 -0
- package/dist/tools/schemas/create-document-schemas.js.map +1 -0
- package/dist/tools/schemas/delete-document-schemas.d.ts +24 -0
- package/dist/tools/schemas/delete-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/delete-document-schemas.js +25 -0
- package/dist/tools/schemas/delete-document-schemas.js.map +1 -0
- package/dist/tools/schemas/edit-document-schemas.d.ts +27 -0
- package/dist/tools/schemas/edit-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/edit-document-schemas.js +28 -0
- package/dist/tools/schemas/edit-document-schemas.js.map +1 -0
- package/dist/tools/schemas/get-guide-schemas.d.ts +35 -0
- package/dist/tools/schemas/get-guide-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/get-guide-schemas.js +66 -0
- package/dist/tools/schemas/get-guide-schemas.js.map +1 -0
- package/dist/tools/schemas/get-workflow-schemas.d.ts +35 -0
- package/dist/tools/schemas/get-workflow-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/get-workflow-schemas.js +67 -0
- package/dist/tools/schemas/get-workflow-schemas.js.map +1 -0
- package/dist/tools/schemas/manage-document-schemas.d.ts +59 -0
- package/dist/tools/schemas/manage-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/manage-document-schemas.js +83 -0
- package/dist/tools/schemas/manage-document-schemas.js.map +1 -0
- package/dist/tools/schemas/move-document-schemas.d.ts +25 -0
- package/dist/tools/schemas/move-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/move-document-schemas.js +26 -0
- package/dist/tools/schemas/move-document-schemas.js.map +1 -0
- package/dist/tools/schemas/move-schemas.d.ts +43 -0
- package/dist/tools/schemas/move-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/move-schemas.js +43 -0
- package/dist/tools/schemas/move-schemas.js.map +1 -0
- package/dist/tools/schemas/search-documents-schemas.d.ts +77 -0
- package/dist/tools/schemas/search-documents-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/search-documents-schemas.js +78 -0
- package/dist/tools/schemas/search-documents-schemas.js.map +1 -0
- package/dist/tools/schemas/section-schemas.d.ts +361 -0
- package/dist/tools/schemas/section-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/section-schemas.js +182 -0
- package/dist/tools/schemas/section-schemas.js.map +1 -0
- package/dist/tools/schemas/start-coordinator-task-schemas.d.ts +30 -0
- package/dist/tools/schemas/start-coordinator-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/start-coordinator-task-schemas.js +31 -0
- package/dist/tools/schemas/start-coordinator-task-schemas.js.map +1 -0
- package/dist/tools/schemas/start-subagent-task-schemas.d.ts +29 -0
- package/dist/tools/schemas/start-subagent-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/start-subagent-task-schemas.js +40 -0
- package/dist/tools/schemas/start-subagent-task-schemas.js.map +1 -0
- package/dist/tools/schemas/start-task-schemas.d.ts +23 -0
- package/dist/tools/schemas/start-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/start-task-schemas.js +39 -0
- package/dist/tools/schemas/start-task-schemas.js.map +1 -0
- package/dist/tools/schemas/subagent-task-schemas.d.ts +93 -0
- package/dist/tools/schemas/subagent-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/subagent-task-schemas.js +81 -0
- package/dist/tools/schemas/subagent-task-schemas.js.map +1 -0
- package/dist/tools/schemas/task-schemas.d.ts +88 -0
- package/dist/tools/schemas/task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/task-schemas.js +80 -0
- package/dist/tools/schemas/task-schemas.js.map +1 -0
- package/dist/tools/schemas/view-coordinator-task-schemas.d.ts +27 -0
- package/dist/tools/schemas/view-coordinator-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/view-coordinator-task-schemas.js +46 -0
- package/dist/tools/schemas/view-coordinator-task-schemas.js.map +1 -0
- package/dist/tools/schemas/view-document-schemas.d.ts +152 -0
- package/dist/tools/schemas/view-document-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/view-document-schemas.js +70 -0
- package/dist/tools/schemas/view-document-schemas.js.map +1 -0
- package/dist/tools/schemas/view-section-schemas.d.ts +31 -0
- package/dist/tools/schemas/view-section-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/view-section-schemas.js +56 -0
- package/dist/tools/schemas/view-section-schemas.js.map +1 -0
- package/dist/tools/schemas/view-subagent-task-schemas.d.ts +31 -0
- package/dist/tools/schemas/view-subagent-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/view-subagent-task-schemas.js +65 -0
- package/dist/tools/schemas/view-subagent-task-schemas.js.map +1 -0
- package/dist/tools/schemas/view-task-schemas.d.ts +31 -0
- package/dist/tools/schemas/view-task-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/view-task-schemas.js +62 -0
- package/dist/tools/schemas/view-task-schemas.js.map +1 -0
- package/dist/tools/types.d.ts +98 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +9 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools-manager.d.ts +8 -0
- package/dist/tools-manager.d.ts.map +1 -0
- package/dist/tools-manager.js +9 -0
- package/dist/tools-manager.js.map +1 -0
- package/dist/types/core.d.ts +71 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +5 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/linking.d.ts +97 -0
- package/dist/types/linking.d.ts.map +1 -0
- package/dist/types/linking.js +5 -0
- package/dist/types/linking.js.map +1 -0
- package/dist/utils/__tests__/path-handler.archive.test.d.ts +8 -0
- package/dist/utils/__tests__/path-handler.archive.test.d.ts.map +1 -0
- package/dist/utils/__tests__/path-handler.archive.test.js +163 -0
- package/dist/utils/__tests__/path-handler.archive.test.js.map +1 -0
- package/dist/utils/error-formatter.d.ts +32 -0
- package/dist/utils/error-formatter.d.ts.map +1 -0
- package/dist/utils/error-formatter.js +79 -0
- package/dist/utils/error-formatter.js.map +1 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +154 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-handler.d.ts +52 -0
- package/dist/utils/path-handler.d.ts.map +1 -0
- package/dist/utils/path-handler.js +129 -0
- package/dist/utils/path-handler.js.map +1 -0
- package/dist/utils/security-audit-logger.d.ts +64 -0
- package/dist/utils/security-audit-logger.d.ts.map +1 -0
- package/dist/utils/security-audit-logger.js +56 -0
- package/dist/utils/security-audit-logger.js.map +1 -0
- package/dist/utils/virtual-path-resolver.d.ts +126 -0
- package/dist/utils/virtual-path-resolver.d.ts.map +1 -0
- package/dist/utils/virtual-path-resolver.js +171 -0
- package/dist/utils/virtual-path-resolver.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for move tool
|
|
3
|
+
*
|
|
4
|
+
* Tests section/task move functionality including:
|
|
5
|
+
* - Successful moves within same document
|
|
6
|
+
* - Successful moves to different documents
|
|
7
|
+
* - Move sections and tasks with all positions (before, after, child)
|
|
8
|
+
* - Data safety: creates in new location BEFORE deleting from old location
|
|
9
|
+
* - Error handling for non-existent sources, destinations, and references
|
|
10
|
+
* - Cache invalidation after moves
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
|
|
13
|
+
import { promises as fs } from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import os from 'node:os';
|
|
16
|
+
import { move } from '../implementations/move.js';
|
|
17
|
+
import { createDocumentManager } from '../../shared/utilities.js';
|
|
18
|
+
import { DocumentNotFoundError, SectionNotFoundError, AddressingError } from '../../shared/addressing-system.js';
|
|
19
|
+
import * as utilities from '../../shared/utilities.js';
|
|
20
|
+
describe('move tool', () => {
|
|
21
|
+
let manager;
|
|
22
|
+
let tempDir;
|
|
23
|
+
let sessionState;
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
let performSectionEditSpy;
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
// Create temporary directory for test files
|
|
28
|
+
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'move-test-'));
|
|
29
|
+
// Configure MCP_WORKSPACE_PATH for fsio PathHandler to use temp directory
|
|
30
|
+
process.env['MCP_WORKSPACE_PATH'] = tempDir;
|
|
31
|
+
manager = createDocumentManager();
|
|
32
|
+
sessionState = {
|
|
33
|
+
sessionId: `test-${Date.now()}-${Math.random()}`,
|
|
34
|
+
createDocumentStage: 0
|
|
35
|
+
};
|
|
36
|
+
// Mock performSectionEdit to track calls and avoid actual file operations
|
|
37
|
+
performSectionEditSpy = vi.spyOn(utilities, 'performSectionEdit').mockResolvedValue({
|
|
38
|
+
action: 'edited',
|
|
39
|
+
section: 'test-section'
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
// Clean up temporary directory and all its contents
|
|
44
|
+
try {
|
|
45
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Ignore if directory doesn't exist
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
vi.restoreAllMocks();
|
|
53
|
+
});
|
|
54
|
+
describe('Parameter Validation', () => {
|
|
55
|
+
it('should throw error when from parameter missing', async () => {
|
|
56
|
+
await expect(move({
|
|
57
|
+
to: '/docs/api/doc.md',
|
|
58
|
+
reference: 'overview',
|
|
59
|
+
position: 'after'
|
|
60
|
+
}, sessionState, manager))
|
|
61
|
+
.rejects.toThrow('from parameter is required');
|
|
62
|
+
});
|
|
63
|
+
it('should throw error when to parameter missing', async () => {
|
|
64
|
+
await expect(move({
|
|
65
|
+
from: '/docs/api/doc.md#section',
|
|
66
|
+
reference: 'overview',
|
|
67
|
+
position: 'after'
|
|
68
|
+
}, sessionState, manager))
|
|
69
|
+
.rejects.toThrow('to parameter is required');
|
|
70
|
+
});
|
|
71
|
+
it('should throw error when reference parameter missing', async () => {
|
|
72
|
+
await expect(move({
|
|
73
|
+
from: '/docs/api/doc.md#section',
|
|
74
|
+
to: '/docs/api/doc.md',
|
|
75
|
+
position: 'after'
|
|
76
|
+
}, sessionState, manager))
|
|
77
|
+
.rejects.toThrow('reference parameter is required');
|
|
78
|
+
});
|
|
79
|
+
it('should throw error when position parameter missing', async () => {
|
|
80
|
+
await expect(move({
|
|
81
|
+
from: '/docs/api/doc.md#section',
|
|
82
|
+
to: '/docs/api/doc.md',
|
|
83
|
+
reference: 'overview'
|
|
84
|
+
}, sessionState, manager))
|
|
85
|
+
.rejects.toThrow('position parameter is required');
|
|
86
|
+
});
|
|
87
|
+
it('should throw error when position is invalid', async () => {
|
|
88
|
+
await expect(move({
|
|
89
|
+
from: '/docs/api/doc.md#section',
|
|
90
|
+
to: '/docs/api/doc.md',
|
|
91
|
+
reference: 'overview',
|
|
92
|
+
position: 'invalid'
|
|
93
|
+
}, sessionState, manager))
|
|
94
|
+
.rejects.toThrow(AddressingError);
|
|
95
|
+
});
|
|
96
|
+
it('should throw error when from path does not include section', async () => {
|
|
97
|
+
await expect(move({
|
|
98
|
+
from: '/docs/api/doc.md',
|
|
99
|
+
to: '/docs/api/other.md',
|
|
100
|
+
reference: 'overview',
|
|
101
|
+
position: 'after'
|
|
102
|
+
}, sessionState, manager))
|
|
103
|
+
.rejects.toThrow(AddressingError);
|
|
104
|
+
});
|
|
105
|
+
it('should throw error when from path has invalid format', async () => {
|
|
106
|
+
await expect(move({
|
|
107
|
+
from: '/docs/api/doc.md#',
|
|
108
|
+
to: '/docs/api/other.md',
|
|
109
|
+
reference: 'overview',
|
|
110
|
+
position: 'after'
|
|
111
|
+
}, sessionState, manager))
|
|
112
|
+
.rejects.toThrow(AddressingError);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('Source Document and Section Validation', () => {
|
|
116
|
+
it('should throw DocumentNotFoundError when source document does not exist', async () => {
|
|
117
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(null);
|
|
118
|
+
await expect(move({
|
|
119
|
+
from: '/docs/nonexistent/doc.md#section',
|
|
120
|
+
to: '/docs/api/doc.md',
|
|
121
|
+
reference: 'overview',
|
|
122
|
+
position: 'after'
|
|
123
|
+
}, sessionState, manager))
|
|
124
|
+
.rejects.toThrow(DocumentNotFoundError);
|
|
125
|
+
});
|
|
126
|
+
it('should throw SectionNotFoundError when source section does not exist', async () => {
|
|
127
|
+
const mockSourceDoc = {
|
|
128
|
+
content: '# Source\n\n## Overview\n\nContent',
|
|
129
|
+
headings: [
|
|
130
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
131
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
132
|
+
],
|
|
133
|
+
sections: new Map([
|
|
134
|
+
['source', ''],
|
|
135
|
+
['overview', 'Content']
|
|
136
|
+
]),
|
|
137
|
+
metadata: {
|
|
138
|
+
path: '/docs/api/source.md',
|
|
139
|
+
title: 'Source',
|
|
140
|
+
lastModified: new Date(),
|
|
141
|
+
contentHash: 'hash1',
|
|
142
|
+
wordCount: 5
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockSourceDoc);
|
|
146
|
+
await expect(move({
|
|
147
|
+
from: '/docs/api/source.md#nonexistent',
|
|
148
|
+
to: '/docs/api/dest.md',
|
|
149
|
+
reference: 'overview',
|
|
150
|
+
position: 'after'
|
|
151
|
+
}, sessionState, manager))
|
|
152
|
+
.rejects.toThrow(SectionNotFoundError);
|
|
153
|
+
});
|
|
154
|
+
it('should throw error when source content cannot be read', async () => {
|
|
155
|
+
const mockSourceDoc = {
|
|
156
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
157
|
+
headings: [
|
|
158
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
159
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
160
|
+
],
|
|
161
|
+
sections: new Map([
|
|
162
|
+
['source', ''],
|
|
163
|
+
['section', 'Content']
|
|
164
|
+
]),
|
|
165
|
+
metadata: {
|
|
166
|
+
path: '/docs/api/source.md',
|
|
167
|
+
title: 'Source',
|
|
168
|
+
lastModified: new Date(),
|
|
169
|
+
contentHash: 'hash1',
|
|
170
|
+
wordCount: 5
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockSourceDoc);
|
|
174
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue(null);
|
|
175
|
+
await expect(move({
|
|
176
|
+
from: '/docs/api/source.md#section',
|
|
177
|
+
to: '/docs/api/dest.md',
|
|
178
|
+
reference: 'overview',
|
|
179
|
+
position: 'after'
|
|
180
|
+
}, sessionState, manager))
|
|
181
|
+
.rejects.toThrow(AddressingError);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe('Destination Document and Reference Validation', () => {
|
|
185
|
+
it('should throw DocumentNotFoundError when destination document does not exist', async () => {
|
|
186
|
+
const mockSourceDoc = {
|
|
187
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
188
|
+
headings: [
|
|
189
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
190
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
191
|
+
],
|
|
192
|
+
sections: new Map([
|
|
193
|
+
['source', ''],
|
|
194
|
+
['section', 'Content']
|
|
195
|
+
]),
|
|
196
|
+
metadata: {
|
|
197
|
+
path: '/docs/api/source.md',
|
|
198
|
+
title: 'Source',
|
|
199
|
+
lastModified: new Date(),
|
|
200
|
+
contentHash: 'hash1',
|
|
201
|
+
wordCount: 5
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
vi.spyOn(manager, 'getDocument')
|
|
205
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
206
|
+
.mockResolvedValueOnce(null);
|
|
207
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
208
|
+
await expect(move({
|
|
209
|
+
from: '/docs/api/source.md#section',
|
|
210
|
+
to: '/docs/nonexistent/dest.md',
|
|
211
|
+
reference: 'overview',
|
|
212
|
+
position: 'after'
|
|
213
|
+
}, sessionState, manager))
|
|
214
|
+
.rejects.toThrow(DocumentNotFoundError);
|
|
215
|
+
});
|
|
216
|
+
it('should throw SectionNotFoundError when reference section does not exist in destination', async () => {
|
|
217
|
+
const mockSourceDoc = {
|
|
218
|
+
content: '# Source\n\n## Section\n\nSource content',
|
|
219
|
+
headings: [
|
|
220
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
221
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
222
|
+
],
|
|
223
|
+
sections: new Map([
|
|
224
|
+
['source', ''],
|
|
225
|
+
['section', 'Source content']
|
|
226
|
+
]),
|
|
227
|
+
metadata: {
|
|
228
|
+
path: '/docs/api/source.md',
|
|
229
|
+
title: 'Source',
|
|
230
|
+
lastModified: new Date(),
|
|
231
|
+
contentHash: 'hash1',
|
|
232
|
+
wordCount: 5
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const mockDestDoc = {
|
|
236
|
+
content: '# Destination\n\n## Other\n\nDest content',
|
|
237
|
+
headings: [
|
|
238
|
+
{ slug: 'destination', title: 'Destination', depth: 1 },
|
|
239
|
+
{ slug: 'other', title: 'Other', depth: 2 }
|
|
240
|
+
],
|
|
241
|
+
sections: new Map([
|
|
242
|
+
['destination', ''],
|
|
243
|
+
['other', 'Dest content']
|
|
244
|
+
]),
|
|
245
|
+
metadata: {
|
|
246
|
+
path: '/docs/api/dest.md',
|
|
247
|
+
title: 'Destination',
|
|
248
|
+
lastModified: new Date(),
|
|
249
|
+
contentHash: 'hash2',
|
|
250
|
+
wordCount: 5
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
vi.spyOn(manager, 'getDocument')
|
|
254
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
255
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
256
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Source content');
|
|
257
|
+
await expect(move({
|
|
258
|
+
from: '/docs/api/source.md#section',
|
|
259
|
+
to: '/docs/api/dest.md',
|
|
260
|
+
reference: 'nonexistent',
|
|
261
|
+
position: 'after'
|
|
262
|
+
}, sessionState, manager))
|
|
263
|
+
.rejects.toThrow(SectionNotFoundError);
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
describe('Successful Move Operations - Within Same Document', () => {
|
|
267
|
+
it('should move section within same document with position "before"', async () => {
|
|
268
|
+
const mockDoc = {
|
|
269
|
+
content: '# Doc\n\n## Section One\n\nContent one\n\n## Section Two\n\nContent two',
|
|
270
|
+
headings: [
|
|
271
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
272
|
+
{ slug: 'section-one', title: 'Section One', depth: 2 },
|
|
273
|
+
{ slug: 'section-two', title: 'Section Two', depth: 2 }
|
|
274
|
+
],
|
|
275
|
+
sections: new Map([
|
|
276
|
+
['doc', ''],
|
|
277
|
+
['section-one', 'Content one'],
|
|
278
|
+
['section-two', 'Content two']
|
|
279
|
+
]),
|
|
280
|
+
metadata: {
|
|
281
|
+
path: '/docs/api/doc.md',
|
|
282
|
+
title: 'Doc',
|
|
283
|
+
lastModified: new Date(),
|
|
284
|
+
contentHash: 'hash',
|
|
285
|
+
wordCount: 10
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
289
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content two');
|
|
290
|
+
const result = await move({
|
|
291
|
+
from: '/docs/api/doc.md#section-two',
|
|
292
|
+
to: '/docs/api/doc.md',
|
|
293
|
+
reference: 'section-one',
|
|
294
|
+
position: 'before'
|
|
295
|
+
}, sessionState, manager);
|
|
296
|
+
// Verify performSectionEdit was called twice (remove then create for same-document)
|
|
297
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(2);
|
|
298
|
+
// First call: delete from old location (same-document strategy)
|
|
299
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/doc.md', 'section-two', '', 'remove');
|
|
300
|
+
// Second call: create in new location
|
|
301
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(2, manager, '/docs/api/doc.md', 'section-one', 'Content two', 'insert_before', 'Section Two');
|
|
302
|
+
// Verify result structure
|
|
303
|
+
expect(result['success']).toBe(true);
|
|
304
|
+
expect(result['moved_to']).toBe('/docs/api/doc.md#section-two');
|
|
305
|
+
expect(result['position']).toBe('before section-one');
|
|
306
|
+
});
|
|
307
|
+
it('should move section within same document with position "after"', async () => {
|
|
308
|
+
const mockDoc = {
|
|
309
|
+
content: '# Doc\n\n## Section One\n\nContent one\n\n## Section Two\n\nContent two',
|
|
310
|
+
headings: [
|
|
311
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
312
|
+
{ slug: 'section-one', title: 'Section One', depth: 2 },
|
|
313
|
+
{ slug: 'section-two', title: 'Section Two', depth: 2 }
|
|
314
|
+
],
|
|
315
|
+
sections: new Map([
|
|
316
|
+
['doc', ''],
|
|
317
|
+
['section-one', 'Content one'],
|
|
318
|
+
['section-two', 'Content two']
|
|
319
|
+
]),
|
|
320
|
+
metadata: {
|
|
321
|
+
path: '/docs/api/doc.md',
|
|
322
|
+
title: 'Doc',
|
|
323
|
+
lastModified: new Date(),
|
|
324
|
+
contentHash: 'hash',
|
|
325
|
+
wordCount: 10
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
329
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content one');
|
|
330
|
+
const result = await move({
|
|
331
|
+
from: '/docs/api/doc.md#section-one',
|
|
332
|
+
to: '/docs/api/doc.md',
|
|
333
|
+
reference: 'section-two',
|
|
334
|
+
position: 'after'
|
|
335
|
+
}, sessionState, manager);
|
|
336
|
+
// Verify call order for same-document move (remove then create)
|
|
337
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(2);
|
|
338
|
+
// First call: remove from old location
|
|
339
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/doc.md', 'section-one', '', 'remove');
|
|
340
|
+
// Second call: create at new location with insert_after mode
|
|
341
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(2, manager, '/docs/api/doc.md', 'section-two', 'Content one', 'insert_after', 'Section One');
|
|
342
|
+
expect(result['position']).toBe('after section-two');
|
|
343
|
+
});
|
|
344
|
+
it('should move section within same document with position "child"', async () => {
|
|
345
|
+
const mockDoc = {
|
|
346
|
+
content: '# Doc\n\n## Parent\n\nParent content\n\n## Section\n\nSection content',
|
|
347
|
+
headings: [
|
|
348
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
349
|
+
{ slug: 'parent', title: 'Parent', depth: 2 },
|
|
350
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
351
|
+
],
|
|
352
|
+
sections: new Map([
|
|
353
|
+
['doc', ''],
|
|
354
|
+
['parent', 'Parent content'],
|
|
355
|
+
['section', 'Section content']
|
|
356
|
+
]),
|
|
357
|
+
metadata: {
|
|
358
|
+
path: '/docs/api/doc.md',
|
|
359
|
+
title: 'Doc',
|
|
360
|
+
lastModified: new Date(),
|
|
361
|
+
contentHash: 'hash',
|
|
362
|
+
wordCount: 10
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
366
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Section content');
|
|
367
|
+
const result = await move({
|
|
368
|
+
from: '/docs/api/doc.md#section',
|
|
369
|
+
to: '/docs/api/doc.md',
|
|
370
|
+
reference: 'parent',
|
|
371
|
+
position: 'child'
|
|
372
|
+
}, sessionState, manager);
|
|
373
|
+
// Verify call order for same-document move (remove then create)
|
|
374
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(2);
|
|
375
|
+
// First call: remove from old location
|
|
376
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/doc.md', 'section', '', 'remove');
|
|
377
|
+
// Second call: create at new location with append_child mode
|
|
378
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(2, manager, '/docs/api/doc.md', 'parent', 'Section content', 'append_child', 'Section');
|
|
379
|
+
expect(result['position']).toBe('child of parent');
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
describe('Successful Move Operations - Between Documents', () => {
|
|
383
|
+
it('should move section from one document to another', async () => {
|
|
384
|
+
const mockSourceDoc = {
|
|
385
|
+
content: '# Source\n\n## Section\n\nSource content',
|
|
386
|
+
headings: [
|
|
387
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
388
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
389
|
+
],
|
|
390
|
+
sections: new Map([
|
|
391
|
+
['source', ''],
|
|
392
|
+
['section', 'Source content']
|
|
393
|
+
]),
|
|
394
|
+
metadata: {
|
|
395
|
+
path: '/docs/api/source.md',
|
|
396
|
+
title: 'Source',
|
|
397
|
+
lastModified: new Date(),
|
|
398
|
+
contentHash: 'hash1',
|
|
399
|
+
wordCount: 5
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
const mockDestDoc = {
|
|
403
|
+
content: '# Destination\n\n## Overview\n\nDest content',
|
|
404
|
+
headings: [
|
|
405
|
+
{ slug: 'destination', title: 'Destination', depth: 1 },
|
|
406
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
407
|
+
],
|
|
408
|
+
sections: new Map([
|
|
409
|
+
['destination', ''],
|
|
410
|
+
['overview', 'Dest content']
|
|
411
|
+
]),
|
|
412
|
+
metadata: {
|
|
413
|
+
path: '/docs/api/dest.md',
|
|
414
|
+
title: 'Destination',
|
|
415
|
+
lastModified: new Date(),
|
|
416
|
+
contentHash: 'hash2',
|
|
417
|
+
wordCount: 5
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
// First two calls for source doc, next two for dest doc, last for updated dest doc
|
|
421
|
+
vi.spyOn(manager, 'getDocument')
|
|
422
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
423
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
424
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
425
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Source content');
|
|
426
|
+
const result = await move({
|
|
427
|
+
from: '/docs/api/source.md#section',
|
|
428
|
+
to: '/docs/api/dest.md',
|
|
429
|
+
reference: 'overview',
|
|
430
|
+
position: 'after'
|
|
431
|
+
}, sessionState, manager);
|
|
432
|
+
// Verify performSectionEdit was called twice
|
|
433
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(2);
|
|
434
|
+
// First call: create in destination
|
|
435
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/dest.md', 'overview', 'Source content', 'insert_after', 'Section');
|
|
436
|
+
// Second call: delete from source
|
|
437
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(2, manager, '/docs/api/source.md', 'section', '', 'remove');
|
|
438
|
+
// Verify result
|
|
439
|
+
expect(result['success']).toBe(true);
|
|
440
|
+
expect(result['moved_to']).toBe('/docs/api/dest.md#section');
|
|
441
|
+
expect(result['position']).toBe('after overview');
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
describe('Task Move Operations', () => {
|
|
445
|
+
it('should move task same as sections (no type field in response)', async () => {
|
|
446
|
+
const mockSourceDoc = {
|
|
447
|
+
content: '# Source\n\n## Tasks\n\n### Task One\n\n- Status: pending\n\nTask content',
|
|
448
|
+
headings: [
|
|
449
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
450
|
+
{ slug: 'tasks', title: 'Tasks', depth: 2 },
|
|
451
|
+
{ slug: 'task-one', title: 'Task One', depth: 3 }
|
|
452
|
+
],
|
|
453
|
+
sections: new Map([
|
|
454
|
+
['source', ''],
|
|
455
|
+
['tasks', ''],
|
|
456
|
+
['task-one', '- Status: pending\n\nTask content']
|
|
457
|
+
]),
|
|
458
|
+
metadata: {
|
|
459
|
+
path: '/docs/project/source.md',
|
|
460
|
+
title: 'Source',
|
|
461
|
+
lastModified: new Date(),
|
|
462
|
+
contentHash: 'hash1',
|
|
463
|
+
wordCount: 8
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
const mockDestDoc = {
|
|
467
|
+
content: '# Destination\n\n## Tasks\n\n### Task Two\n\n- Status: completed\n\nDone',
|
|
468
|
+
headings: [
|
|
469
|
+
{ slug: 'destination', title: 'Destination', depth: 1 },
|
|
470
|
+
{ slug: 'tasks', title: 'Tasks', depth: 2 },
|
|
471
|
+
{ slug: 'task-two', title: 'Task Two', depth: 3 }
|
|
472
|
+
],
|
|
473
|
+
sections: new Map([
|
|
474
|
+
['destination', ''],
|
|
475
|
+
['tasks', ''],
|
|
476
|
+
['task-two', '- Status: completed\n\nDone']
|
|
477
|
+
]),
|
|
478
|
+
metadata: {
|
|
479
|
+
path: '/docs/project/dest.md',
|
|
480
|
+
title: 'Destination',
|
|
481
|
+
lastModified: new Date(),
|
|
482
|
+
contentHash: 'hash2',
|
|
483
|
+
wordCount: 8
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
vi.spyOn(manager, 'getDocument')
|
|
487
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
488
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
489
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
490
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('- Status: pending\n\nTask content');
|
|
491
|
+
const result = await move({
|
|
492
|
+
from: '/docs/project/source.md#task-one',
|
|
493
|
+
to: '/docs/project/dest.md',
|
|
494
|
+
reference: 'task-two',
|
|
495
|
+
position: 'after'
|
|
496
|
+
}, sessionState, manager);
|
|
497
|
+
// Verify response uses standard minimal format (no type field)
|
|
498
|
+
expect(result['success']).toBe(true);
|
|
499
|
+
expect(result['moved_to']).toBe('/docs/project/dest.md#task-one');
|
|
500
|
+
expect(result['position']).toBe('after task-two');
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
describe('Reference Slug Normalization', () => {
|
|
504
|
+
it('should normalize reference with leading # to slug without #', async () => {
|
|
505
|
+
const mockSourceDoc = {
|
|
506
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
507
|
+
headings: [
|
|
508
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
509
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
510
|
+
],
|
|
511
|
+
sections: new Map([
|
|
512
|
+
['source', ''],
|
|
513
|
+
['section', 'Content']
|
|
514
|
+
]),
|
|
515
|
+
metadata: {
|
|
516
|
+
path: '/docs/api/source.md',
|
|
517
|
+
title: 'Source',
|
|
518
|
+
lastModified: new Date(),
|
|
519
|
+
contentHash: 'hash1',
|
|
520
|
+
wordCount: 5
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
const mockDestDoc = {
|
|
524
|
+
content: '# Dest\n\n## Overview\n\nContent',
|
|
525
|
+
headings: [
|
|
526
|
+
{ slug: 'dest', title: 'Dest', depth: 1 },
|
|
527
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
528
|
+
],
|
|
529
|
+
sections: new Map([
|
|
530
|
+
['dest', ''],
|
|
531
|
+
['overview', 'Content']
|
|
532
|
+
]),
|
|
533
|
+
metadata: {
|
|
534
|
+
path: '/docs/api/dest.md',
|
|
535
|
+
title: 'Dest',
|
|
536
|
+
lastModified: new Date(),
|
|
537
|
+
contentHash: 'hash2',
|
|
538
|
+
wordCount: 5
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
vi.spyOn(manager, 'getDocument')
|
|
542
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
543
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
544
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
545
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
546
|
+
await move({
|
|
547
|
+
from: '/docs/api/source.md#section',
|
|
548
|
+
to: '/docs/api/dest.md',
|
|
549
|
+
reference: '#overview', // With leading #
|
|
550
|
+
position: 'after'
|
|
551
|
+
}, sessionState, manager);
|
|
552
|
+
// Verify normalized slug (without #) was used
|
|
553
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/dest.md', 'overview', // No leading #
|
|
554
|
+
'Content', 'insert_after', 'Section');
|
|
555
|
+
});
|
|
556
|
+
it('should handle reference without leading # correctly', async () => {
|
|
557
|
+
const mockSourceDoc = {
|
|
558
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
559
|
+
headings: [
|
|
560
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
561
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
562
|
+
],
|
|
563
|
+
sections: new Map([
|
|
564
|
+
['source', ''],
|
|
565
|
+
['section', 'Content']
|
|
566
|
+
]),
|
|
567
|
+
metadata: {
|
|
568
|
+
path: '/docs/api/source.md',
|
|
569
|
+
title: 'Source',
|
|
570
|
+
lastModified: new Date(),
|
|
571
|
+
contentHash: 'hash1',
|
|
572
|
+
wordCount: 5
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
const mockDestDoc = {
|
|
576
|
+
content: '# Dest\n\n## Overview\n\nContent',
|
|
577
|
+
headings: [
|
|
578
|
+
{ slug: 'dest', title: 'Dest', depth: 1 },
|
|
579
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
580
|
+
],
|
|
581
|
+
sections: new Map([
|
|
582
|
+
['dest', ''],
|
|
583
|
+
['overview', 'Content']
|
|
584
|
+
]),
|
|
585
|
+
metadata: {
|
|
586
|
+
path: '/docs/api/dest.md',
|
|
587
|
+
title: 'Dest',
|
|
588
|
+
lastModified: new Date(),
|
|
589
|
+
contentHash: 'hash2',
|
|
590
|
+
wordCount: 5
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
vi.spyOn(manager, 'getDocument')
|
|
594
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
595
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
596
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
597
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
598
|
+
await move({
|
|
599
|
+
from: '/docs/api/source.md#section',
|
|
600
|
+
to: '/docs/api/dest.md',
|
|
601
|
+
reference: 'overview', // Without leading #
|
|
602
|
+
position: 'after'
|
|
603
|
+
}, sessionState, manager);
|
|
604
|
+
// Verify slug was used as-is
|
|
605
|
+
expect(performSectionEditSpy).toHaveBeenNthCalledWith(1, manager, '/docs/api/dest.md', 'overview', 'Content', 'insert_after', 'Section');
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
describe('Data Safety - Different Strategies for Same vs Cross-Document', () => {
|
|
609
|
+
it('should use remove-then-create for same-document moves to avoid duplicates', async () => {
|
|
610
|
+
const mockDoc = {
|
|
611
|
+
content: '# Doc\n\n## Section One\n\nContent one\n\n## Section Two\n\nContent two',
|
|
612
|
+
headings: [
|
|
613
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
614
|
+
{ slug: 'section-one', title: 'Section One', depth: 2 },
|
|
615
|
+
{ slug: 'section-two', title: 'Section Two', depth: 2 }
|
|
616
|
+
],
|
|
617
|
+
sections: new Map([
|
|
618
|
+
['doc', ''],
|
|
619
|
+
['section-one', 'Content one'],
|
|
620
|
+
['section-two', 'Content two']
|
|
621
|
+
]),
|
|
622
|
+
metadata: {
|
|
623
|
+
path: '/docs/api/doc.md',
|
|
624
|
+
title: 'Doc',
|
|
625
|
+
lastModified: new Date(),
|
|
626
|
+
contentHash: 'hash',
|
|
627
|
+
wordCount: 10
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
631
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content two');
|
|
632
|
+
await move({
|
|
633
|
+
from: '/docs/api/doc.md#section-two',
|
|
634
|
+
to: '/docs/api/doc.md',
|
|
635
|
+
reference: 'section-one',
|
|
636
|
+
position: 'before'
|
|
637
|
+
}, sessionState, manager);
|
|
638
|
+
// Verify call order for same-document move
|
|
639
|
+
const calls = performSectionEditSpy.mock.calls;
|
|
640
|
+
expect(calls.length).toBe(2);
|
|
641
|
+
// First call should be REMOVE (delete from old location)
|
|
642
|
+
expect(calls[0]?.[4]).toBe('remove');
|
|
643
|
+
expect(calls[0]?.[2]).toBe('section-two');
|
|
644
|
+
// Second call should be CREATE (insert at new location)
|
|
645
|
+
expect(calls[1]?.[4]).toBe('insert_before');
|
|
646
|
+
expect(calls[1]?.[2]).toBe('section-one');
|
|
647
|
+
});
|
|
648
|
+
it('should use create-then-remove for cross-document moves for data safety', async () => {
|
|
649
|
+
const mockSourceDoc = {
|
|
650
|
+
content: '# Source\n\n## Section\n\nSource content',
|
|
651
|
+
headings: [
|
|
652
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
653
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
654
|
+
],
|
|
655
|
+
sections: new Map([
|
|
656
|
+
['source', ''],
|
|
657
|
+
['section', 'Source content']
|
|
658
|
+
]),
|
|
659
|
+
metadata: {
|
|
660
|
+
path: '/docs/api/source.md',
|
|
661
|
+
title: 'Source',
|
|
662
|
+
lastModified: new Date(),
|
|
663
|
+
contentHash: 'hash1',
|
|
664
|
+
wordCount: 5
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
const mockDestDoc = {
|
|
668
|
+
content: '# Destination\n\n## Overview\n\nDest content',
|
|
669
|
+
headings: [
|
|
670
|
+
{ slug: 'destination', title: 'Destination', depth: 1 },
|
|
671
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
672
|
+
],
|
|
673
|
+
sections: new Map([
|
|
674
|
+
['destination', ''],
|
|
675
|
+
['overview', 'Dest content']
|
|
676
|
+
]),
|
|
677
|
+
metadata: {
|
|
678
|
+
path: '/docs/api/dest.md',
|
|
679
|
+
title: 'Destination',
|
|
680
|
+
lastModified: new Date(),
|
|
681
|
+
contentHash: 'hash2',
|
|
682
|
+
wordCount: 5
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
vi.spyOn(manager, 'getDocument')
|
|
686
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
687
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
688
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
689
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Source content');
|
|
690
|
+
await move({
|
|
691
|
+
from: '/docs/api/source.md#section',
|
|
692
|
+
to: '/docs/api/dest.md',
|
|
693
|
+
reference: 'overview',
|
|
694
|
+
position: 'after'
|
|
695
|
+
}, sessionState, manager);
|
|
696
|
+
// Verify call order for cross-document move
|
|
697
|
+
const calls = performSectionEditSpy.mock.calls;
|
|
698
|
+
expect(calls.length).toBe(2);
|
|
699
|
+
// First call should be CREATE (insert at new location)
|
|
700
|
+
expect(calls[0]?.[4]).toBe('insert_after');
|
|
701
|
+
expect(calls[0]?.[1]).toBe('/docs/api/dest.md');
|
|
702
|
+
// Second call should be REMOVE (delete from old location)
|
|
703
|
+
expect(calls[1]?.[4]).toBe('remove');
|
|
704
|
+
expect(calls[1]?.[1]).toBe('/docs/api/source.md');
|
|
705
|
+
});
|
|
706
|
+
it('should rollback same-document move if create fails after remove', async () => {
|
|
707
|
+
const mockDoc = {
|
|
708
|
+
content: '# Doc\n\n## Section One\n\nContent one\n\n## Section Two\n\nContent two',
|
|
709
|
+
headings: [
|
|
710
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
711
|
+
{ slug: 'section-one', title: 'Section One', depth: 2 },
|
|
712
|
+
{ slug: 'section-two', title: 'Section Two', depth: 2 }
|
|
713
|
+
],
|
|
714
|
+
sections: new Map([
|
|
715
|
+
['doc', ''],
|
|
716
|
+
['section-one', 'Content one'],
|
|
717
|
+
['section-two', 'Content two']
|
|
718
|
+
]),
|
|
719
|
+
metadata: {
|
|
720
|
+
path: '/docs/api/doc.md',
|
|
721
|
+
title: 'Doc',
|
|
722
|
+
lastModified: new Date(),
|
|
723
|
+
contentHash: 'hash',
|
|
724
|
+
wordCount: 10
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
728
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content two');
|
|
729
|
+
// Mock performSectionEdit to succeed on remove, fail on create, succeed on rollback
|
|
730
|
+
performSectionEditSpy
|
|
731
|
+
.mockResolvedValueOnce({ action: 'edited' }) // Remove succeeds
|
|
732
|
+
.mockRejectedValueOnce(new Error('Create failed')) // Create fails
|
|
733
|
+
.mockResolvedValueOnce({ action: 'edited' }); // Rollback succeeds
|
|
734
|
+
await expect(move({
|
|
735
|
+
from: '/docs/api/doc.md#section-two',
|
|
736
|
+
to: '/docs/api/doc.md',
|
|
737
|
+
reference: 'section-one',
|
|
738
|
+
position: 'before'
|
|
739
|
+
}, sessionState, manager))
|
|
740
|
+
.rejects.toThrow('Create failed');
|
|
741
|
+
// Verify rollback was attempted (3 calls: remove, create fail, rollback)
|
|
742
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(3);
|
|
743
|
+
// Last call should be rollback (insert_before)
|
|
744
|
+
const calls = performSectionEditSpy.mock.calls;
|
|
745
|
+
expect(calls[2]?.[4]).toBe('insert_before');
|
|
746
|
+
});
|
|
747
|
+
it('should throw detailed error if both create and rollback fail', async () => {
|
|
748
|
+
const mockDoc = {
|
|
749
|
+
content: '# Doc\n\n## Section\n\nContent',
|
|
750
|
+
headings: [
|
|
751
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
752
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
753
|
+
],
|
|
754
|
+
sections: new Map([
|
|
755
|
+
['doc', ''],
|
|
756
|
+
['section', 'Content']
|
|
757
|
+
]),
|
|
758
|
+
metadata: {
|
|
759
|
+
path: '/docs/api/doc.md',
|
|
760
|
+
title: 'Doc',
|
|
761
|
+
lastModified: new Date(),
|
|
762
|
+
contentHash: 'hash',
|
|
763
|
+
wordCount: 5
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
767
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
768
|
+
// Mock performSectionEdit to succeed on remove, fail on both create and rollback
|
|
769
|
+
performSectionEditSpy
|
|
770
|
+
.mockResolvedValueOnce({ action: 'edited' }) // Remove succeeds
|
|
771
|
+
.mockRejectedValueOnce(new Error('Create failed')) // Create fails
|
|
772
|
+
.mockRejectedValueOnce(new Error('Rollback failed')); // Rollback fails
|
|
773
|
+
await expect(move({
|
|
774
|
+
from: '/docs/api/doc.md#section',
|
|
775
|
+
to: '/docs/api/doc.md',
|
|
776
|
+
reference: 'doc',
|
|
777
|
+
position: 'child'
|
|
778
|
+
}, sessionState, manager))
|
|
779
|
+
.rejects.toThrow(AddressingError);
|
|
780
|
+
// Verify error message includes both errors
|
|
781
|
+
try {
|
|
782
|
+
await move({
|
|
783
|
+
from: '/docs/api/doc.md#section',
|
|
784
|
+
to: '/docs/api/doc.md',
|
|
785
|
+
reference: 'doc',
|
|
786
|
+
position: 'child'
|
|
787
|
+
}, sessionState, manager);
|
|
788
|
+
}
|
|
789
|
+
catch (error) {
|
|
790
|
+
if (error instanceof AddressingError) {
|
|
791
|
+
expect(error.message).toContain('rollback failed');
|
|
792
|
+
expect(error.message).toContain('Content may be lost');
|
|
793
|
+
expect(error.code).toBe('MOVE_ROLLBACK_FAILED');
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
it('should throw error if cross-document creation fails but not leave partial state', async () => {
|
|
798
|
+
const mockSourceDoc = {
|
|
799
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
800
|
+
headings: [
|
|
801
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
802
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
803
|
+
],
|
|
804
|
+
sections: new Map([
|
|
805
|
+
['source', ''],
|
|
806
|
+
['section', 'Content']
|
|
807
|
+
]),
|
|
808
|
+
metadata: {
|
|
809
|
+
path: '/docs/api/source.md',
|
|
810
|
+
title: 'Source',
|
|
811
|
+
lastModified: new Date(),
|
|
812
|
+
contentHash: 'hash1',
|
|
813
|
+
wordCount: 5
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
const mockDestDoc = {
|
|
817
|
+
content: '# Dest\n\n## Overview\n\nContent',
|
|
818
|
+
headings: [
|
|
819
|
+
{ slug: 'dest', title: 'Dest', depth: 1 },
|
|
820
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
821
|
+
],
|
|
822
|
+
sections: new Map([
|
|
823
|
+
['dest', ''],
|
|
824
|
+
['overview', 'Content']
|
|
825
|
+
]),
|
|
826
|
+
metadata: {
|
|
827
|
+
path: '/docs/api/dest.md',
|
|
828
|
+
title: 'Dest',
|
|
829
|
+
lastModified: new Date(),
|
|
830
|
+
contentHash: 'hash2',
|
|
831
|
+
wordCount: 5
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
vi.spyOn(manager, 'getDocument')
|
|
835
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
836
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
837
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
838
|
+
// Mock performSectionEdit to fail on first call (creation)
|
|
839
|
+
performSectionEditSpy.mockRejectedValueOnce(new Error('Creation failed'));
|
|
840
|
+
await expect(move({
|
|
841
|
+
from: '/docs/api/source.md#section',
|
|
842
|
+
to: '/docs/api/dest.md',
|
|
843
|
+
reference: 'overview',
|
|
844
|
+
position: 'after'
|
|
845
|
+
}, sessionState, manager))
|
|
846
|
+
.rejects.toThrow();
|
|
847
|
+
// Verify only creation was attempted, deletion was never called
|
|
848
|
+
expect(performSectionEditSpy).toHaveBeenCalledTimes(1);
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
describe('Response Structure', () => {
|
|
852
|
+
it('should return minimal result with all required fields', async () => {
|
|
853
|
+
const mockSourceDoc = {
|
|
854
|
+
content: '# Source\n\n## Section\n\nContent',
|
|
855
|
+
headings: [
|
|
856
|
+
{ slug: 'source', title: 'Source', depth: 1 },
|
|
857
|
+
{ slug: 'section', title: 'Section', depth: 2 }
|
|
858
|
+
],
|
|
859
|
+
sections: new Map([
|
|
860
|
+
['source', ''],
|
|
861
|
+
['section', 'Content']
|
|
862
|
+
]),
|
|
863
|
+
metadata: {
|
|
864
|
+
path: '/docs/api/source.md',
|
|
865
|
+
title: 'Source',
|
|
866
|
+
lastModified: new Date(),
|
|
867
|
+
contentHash: 'hash1',
|
|
868
|
+
wordCount: 5
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
const mockDestDoc = {
|
|
872
|
+
content: '# Dest\n\n## Overview\n\nContent',
|
|
873
|
+
headings: [
|
|
874
|
+
{ slug: 'dest', title: 'Dest', depth: 1 },
|
|
875
|
+
{ slug: 'overview', title: 'Overview', depth: 2 }
|
|
876
|
+
],
|
|
877
|
+
sections: new Map([
|
|
878
|
+
['dest', ''],
|
|
879
|
+
['overview', 'Content']
|
|
880
|
+
]),
|
|
881
|
+
metadata: {
|
|
882
|
+
path: '/docs/api/dest.md',
|
|
883
|
+
title: 'Dest',
|
|
884
|
+
lastModified: new Date(),
|
|
885
|
+
contentHash: 'hash2',
|
|
886
|
+
wordCount: 5
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
vi.spyOn(manager, 'getDocument')
|
|
890
|
+
.mockResolvedValueOnce(mockSourceDoc)
|
|
891
|
+
.mockResolvedValueOnce(mockDestDoc)
|
|
892
|
+
.mockResolvedValueOnce(mockDestDoc);
|
|
893
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Content');
|
|
894
|
+
const result = await move({
|
|
895
|
+
from: '/docs/api/source.md#section',
|
|
896
|
+
to: '/docs/api/dest.md',
|
|
897
|
+
reference: 'overview',
|
|
898
|
+
position: 'after'
|
|
899
|
+
}, sessionState, manager);
|
|
900
|
+
// Verify all required fields
|
|
901
|
+
expect(result['success']).toBe(true);
|
|
902
|
+
expect(result['moved_to']).toBe('/docs/api/dest.md#section');
|
|
903
|
+
expect(result['position']).toBe('after overview');
|
|
904
|
+
});
|
|
905
|
+
it('should return position description in readable format', async () => {
|
|
906
|
+
const mockDoc = {
|
|
907
|
+
content: '# Doc\n\n## Section One\n\nOne\n\n## Section Two\n\nTwo',
|
|
908
|
+
headings: [
|
|
909
|
+
{ slug: 'doc', title: 'Doc', depth: 1 },
|
|
910
|
+
{ slug: 'section-one', title: 'Section One', depth: 2 },
|
|
911
|
+
{ slug: 'section-two', title: 'Section Two', depth: 2 }
|
|
912
|
+
],
|
|
913
|
+
sections: new Map([
|
|
914
|
+
['doc', ''],
|
|
915
|
+
['section-one', 'One'],
|
|
916
|
+
['section-two', 'Two']
|
|
917
|
+
]),
|
|
918
|
+
metadata: {
|
|
919
|
+
path: '/docs/api/doc.md',
|
|
920
|
+
title: 'Doc',
|
|
921
|
+
lastModified: new Date(),
|
|
922
|
+
contentHash: 'hash',
|
|
923
|
+
wordCount: 8
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
vi.spyOn(manager, 'getDocument').mockResolvedValue(mockDoc);
|
|
927
|
+
vi.spyOn(manager, 'getSectionContent').mockResolvedValue('Two');
|
|
928
|
+
const result = await move({
|
|
929
|
+
from: '/docs/api/doc.md#section-two',
|
|
930
|
+
to: '/docs/api/doc.md',
|
|
931
|
+
reference: 'section-one',
|
|
932
|
+
position: 'before'
|
|
933
|
+
}, sessionState, manager);
|
|
934
|
+
expect(result['position']).toBe('before section-one');
|
|
935
|
+
expect(typeof result['position']).toBe('string');
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
//# sourceMappingURL=move.test.js.map
|