@wonderwhy-er/desktop-commander 0.2.37 → 0.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +290 -100
- package/dist/command-manager.js +6 -3
- package/dist/config-field-definitions.d.ts +41 -0
- package/dist/config-field-definitions.js +37 -0
- package/dist/config-manager.d.ts +2 -0
- package/dist/config-manager.js +22 -2
- package/dist/handlers/filesystem-handlers.d.ts +5 -0
- package/dist/handlers/filesystem-handlers.js +19 -12
- package/dist/remote-device/desktop-commander-integration.js +1 -1
- package/dist/remote-device/remote-channel.js +1 -1
- package/dist/search-manager.js +31 -38
- package/dist/server.js +11 -4
- package/dist/terminal-manager.js +4 -2
- package/dist/tools/config.d.ts +71 -0
- package/dist/tools/config.js +117 -2
- package/dist/tools/edit.js +34 -1
- package/dist/tools/filesystem.js +91 -3
- package/dist/tools/improved-process-tools.js +2 -1
- package/dist/tools/schemas.d.ts +3 -0
- package/dist/tools/schemas.js +1 -0
- package/dist/types.d.ts +0 -1
- package/dist/ui/config-editor/app.d.ts +43 -0
- package/dist/ui/config-editor/app.js +840 -0
- package/dist/ui/config-editor/array-modal.d.ts +19 -0
- package/dist/ui/config-editor/array-modal.js +185 -0
- package/dist/ui/config-editor/config-editor-runtime.js +150 -0
- package/dist/ui/config-editor/index.html +13 -0
- package/dist/ui/config-editor/main.js +2 -0
- package/dist/ui/config-editor/src/App.d.ts +43 -0
- package/dist/ui/config-editor/src/App.js +840 -0
- package/dist/ui/config-editor/src/array-modal.d.ts +19 -0
- package/dist/ui/config-editor/src/array-modal.js +185 -0
- package/dist/ui/config-editor/src/components/layout.d.ts +4 -0
- package/dist/ui/config-editor/src/components/layout.js +83 -0
- package/dist/ui/config-editor/src/components/toolbar.d.ts +1 -0
- package/dist/ui/config-editor/src/components/toolbar.js +21 -0
- package/dist/ui/config-editor/src/config-values.d.ts +6 -0
- package/dist/ui/config-editor/src/config-values.js +61 -0
- package/dist/ui/config-editor/src/contracts.d.ts +14 -0
- package/dist/ui/config-editor/src/contracts.js +3 -0
- package/dist/ui/config-editor/src/directory-browser.d.ts +6 -0
- package/dist/ui/config-editor/src/directory-browser.js +71 -0
- package/dist/ui/config-editor/src/layout.d.ts +5 -0
- package/dist/ui/config-editor/src/layout.js +90 -0
- package/dist/ui/config-editor/src/main.js +2 -0
- package/dist/ui/config-editor/src/parsing.d.ts +5 -0
- package/dist/ui/config-editor/src/parsing.js +50 -0
- package/dist/ui/config-editor/src/toolbar.d.ts +1 -0
- package/dist/ui/config-editor/src/toolbar.js +18 -0
- package/dist/ui/config-editor/src/types.d.ts +17 -0
- package/dist/ui/config-editor/src/types.js +3 -0
- package/dist/ui/config-editor/src/utils/config-values.d.ts +9 -0
- package/dist/ui/config-editor/src/utils/config-values.js +61 -0
- package/dist/ui/config-editor/src/utils/directory-browser.d.ts +31 -0
- package/dist/ui/config-editor/src/utils/directory-browser.js +201 -0
- package/dist/ui/config-editor/src/utils/parsing.d.ts +8 -0
- package/dist/ui/config-editor/src/utils/parsing.js +50 -0
- package/dist/ui/config-editor/styles.css +587 -0
- package/dist/ui/file-preview/app.d.ts +8 -0
- package/dist/ui/file-preview/app.js +2020 -0
- package/dist/ui/file-preview/components/code-viewer.d.ts +6 -0
- package/dist/ui/file-preview/components/code-viewer.js +73 -0
- package/dist/ui/file-preview/components/highlighting.d.ts +2 -0
- package/dist/ui/file-preview/components/highlighting.js +54 -0
- package/dist/ui/file-preview/components/html-renderer.d.ts +5 -0
- package/dist/ui/file-preview/components/html-renderer.js +47 -0
- package/dist/ui/file-preview/components/markdown-renderer.d.ts +1 -0
- package/dist/ui/file-preview/components/markdown-renderer.js +67 -0
- package/dist/ui/file-preview/components/toolbar.d.ts +6 -0
- package/dist/ui/file-preview/components/toolbar.js +75 -0
- package/dist/ui/file-preview/image-preview.d.ts +3 -0
- package/dist/ui/file-preview/image-preview.js +21 -0
- package/dist/ui/file-preview/main.js +5 -0
- package/dist/ui/file-preview/markdown/editor.d.ts +36 -0
- package/dist/ui/file-preview/markdown/editor.js +643 -0
- package/dist/ui/file-preview/markdown/linking.d.ts +9 -0
- package/dist/ui/file-preview/markdown/linking.js +210 -0
- package/dist/ui/file-preview/markdown/outline.d.ts +7 -0
- package/dist/ui/file-preview/markdown/outline.js +40 -0
- package/dist/ui/file-preview/markdown/preview.d.ts +8 -0
- package/dist/ui/file-preview/markdown/preview.js +33 -0
- package/dist/ui/file-preview/markdown/slugify.d.ts +3 -0
- package/dist/ui/file-preview/markdown/slugify.js +31 -0
- package/dist/ui/file-preview/markdown/toc.d.ts +11 -0
- package/dist/ui/file-preview/markdown/toc.js +75 -0
- package/dist/ui/file-preview/markdown/utils.d.ts +1 -0
- package/dist/ui/file-preview/markdown/utils.js +15 -0
- package/dist/ui/file-preview/markdown/workspace-controller.d.ts +25 -0
- package/dist/ui/file-preview/markdown/workspace-controller.js +40 -0
- package/dist/ui/file-preview/preview-runtime.js +399 -13969
- package/dist/ui/file-preview/shared/preview-file-types.d.ts +1 -1
- package/dist/ui/file-preview/shared/preview-file-types.js +3 -1
- package/dist/ui/file-preview/src/App.d.ts +4 -0
- package/dist/ui/file-preview/src/App.js +564 -0
- package/dist/ui/file-preview/src/components/CodeViewer.d.ts +6 -0
- package/dist/ui/file-preview/src/components/CodeViewer.js +60 -0
- package/dist/ui/file-preview/src/components/HtmlRenderer.d.ts +8 -0
- package/dist/ui/file-preview/src/components/HtmlRenderer.js +45 -0
- package/dist/ui/file-preview/src/components/MarkdownRenderer.d.ts +1 -0
- package/dist/ui/file-preview/src/components/MarkdownRenderer.js +15 -0
- package/dist/ui/file-preview/src/components/editor-toolbar.d.ts +15 -0
- package/dist/ui/file-preview/src/components/editor-toolbar.js +384 -0
- package/dist/ui/file-preview/src/components/html-renderer.d.ts +1 -5
- package/dist/ui/file-preview/src/components/html-renderer.js +11 -27
- package/dist/ui/file-preview/src/components/markdown-editor.d.ts +29 -0
- package/dist/ui/file-preview/src/components/markdown-editor.js +535 -0
- package/dist/ui/file-preview/src/components/markdown-renderer.js +47 -9
- package/dist/ui/file-preview/src/directory-controller.d.ts +8 -0
- package/dist/ui/file-preview/src/directory-controller.js +233 -0
- package/dist/ui/file-preview/src/document-layout.d.ts +20 -0
- package/dist/ui/file-preview/src/document-layout.js +109 -0
- package/dist/ui/file-preview/src/document-outline.d.ts +17 -0
- package/dist/ui/file-preview/src/document-outline.js +97 -0
- package/dist/ui/file-preview/src/document-workspace.d.ts +19 -0
- package/dist/ui/file-preview/src/document-workspace.js +33 -0
- package/dist/ui/file-preview/src/file-type-handlers.d.ts +10 -0
- package/dist/ui/file-preview/src/file-type-handlers.js +98 -0
- package/dist/ui/file-preview/src/host/external-actions.d.ts +19 -0
- package/dist/ui/file-preview/src/host/external-actions.js +94 -0
- package/dist/ui/file-preview/src/host/selection-context.d.ts +9 -0
- package/dist/ui/file-preview/src/host/selection-context.js +106 -0
- package/dist/ui/file-preview/src/markdown/block-merge.d.ts +25 -0
- package/dist/ui/file-preview/src/markdown/block-merge.js +86 -0
- package/dist/ui/file-preview/src/markdown/conflict-dialog.d.ts +40 -0
- package/dist/ui/file-preview/src/markdown/conflict-dialog.js +163 -0
- package/dist/ui/file-preview/src/markdown/controller.d.ts +38 -0
- package/dist/ui/file-preview/src/markdown/controller.js +921 -0
- package/dist/ui/file-preview/src/markdown/editor.d.ts +35 -0
- package/dist/ui/file-preview/src/markdown/editor.js +691 -0
- package/dist/ui/file-preview/src/markdown/link-modal.d.ts +13 -0
- package/dist/ui/file-preview/src/markdown/link-modal.js +213 -0
- package/dist/ui/file-preview/src/markdown/linking.d.ts +16 -0
- package/dist/ui/file-preview/src/markdown/linking.js +228 -0
- package/dist/ui/file-preview/src/markdown/outline.d.ts +2 -0
- package/dist/ui/file-preview/src/markdown/outline.js +16 -0
- package/dist/ui/file-preview/src/markdown/parser.d.ts +30 -0
- package/dist/ui/file-preview/src/markdown/parser.js +38 -0
- package/dist/ui/file-preview/src/markdown/preview.d.ts +1 -0
- package/dist/ui/file-preview/src/markdown/preview.js +20 -0
- package/dist/ui/file-preview/src/markdown/raw-editor.d.ts +8 -0
- package/dist/ui/file-preview/src/markdown/raw-editor.js +61 -0
- package/dist/ui/file-preview/src/markdown/selection-toolbar.d.ts +14 -0
- package/dist/ui/file-preview/src/markdown/selection-toolbar.js +128 -0
- package/dist/ui/file-preview/src/markdown/slugify.d.ts +3 -0
- package/dist/ui/file-preview/src/markdown/slugify.js +31 -0
- package/dist/ui/file-preview/src/markdown/toc.d.ts +11 -0
- package/dist/ui/file-preview/src/markdown/toc.js +75 -0
- package/dist/ui/file-preview/src/markdown/utils.d.ts +1 -0
- package/dist/ui/file-preview/src/markdown/utils.js +15 -0
- package/dist/ui/file-preview/src/markdown-workspace/editor.d.ts +36 -0
- package/dist/ui/file-preview/src/markdown-workspace/editor.js +643 -0
- package/dist/ui/file-preview/src/markdown-workspace/linking.d.ts +9 -0
- package/dist/ui/file-preview/src/markdown-workspace/linking.js +210 -0
- package/dist/ui/file-preview/src/markdown-workspace/outline.d.ts +7 -0
- package/dist/ui/file-preview/src/markdown-workspace/outline.js +40 -0
- package/dist/ui/file-preview/src/markdown-workspace/preview.d.ts +8 -0
- package/dist/ui/file-preview/src/markdown-workspace/preview.js +33 -0
- package/dist/ui/file-preview/src/markdown-workspace/slugify.d.ts +3 -0
- package/dist/ui/file-preview/src/markdown-workspace/slugify.js +31 -0
- package/dist/ui/file-preview/src/markdown-workspace/toc.d.ts +11 -0
- package/dist/ui/file-preview/src/markdown-workspace/toc.js +75 -0
- package/dist/ui/file-preview/src/markdown-workspace/utils.d.ts +1 -0
- package/dist/ui/file-preview/src/markdown-workspace/utils.js +15 -0
- package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.d.ts +25 -0
- package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.js +40 -0
- package/dist/ui/file-preview/src/model.d.ts +34 -0
- package/dist/ui/file-preview/src/panel-actions.d.ts +17 -0
- package/dist/ui/file-preview/src/panel-actions.js +182 -0
- package/dist/ui/file-preview/src/path-utils.d.ts +6 -0
- package/dist/ui/file-preview/src/path-utils.js +64 -0
- package/dist/ui/file-preview/src/payload-utils.d.ts +11 -0
- package/dist/ui/file-preview/src/payload-utils.js +94 -0
- package/dist/ui/file-preview/styles.css +1144 -277
- package/dist/ui/file-preview/types.d.ts +1 -0
- package/dist/ui/file-preview/types.js +1 -0
- package/dist/ui/resources.d.ts +7 -0
- package/dist/ui/resources.js +16 -2
- package/dist/ui/server-integration.d.ts +13 -0
- package/dist/ui/server-integration.js +31 -0
- package/dist/ui/shared/ToolHeader.d.ts +9 -0
- package/dist/ui/shared/ToolHeader.js +29 -0
- package/dist/ui/shared/app-bootstrap.d.ts +9 -0
- package/dist/ui/shared/app-bootstrap.js +15 -0
- package/dist/ui/shared/compact-row.d.ts +11 -0
- package/dist/ui/shared/compact-row.js +18 -0
- package/dist/ui/shared/guards.d.ts +1 -0
- package/dist/ui/shared/guards.js +3 -0
- package/dist/ui/shared/host-context.d.ts +15 -0
- package/dist/ui/shared/host-context.js +51 -0
- package/dist/ui/shared/host-lifecycle.d.ts +1 -0
- package/dist/ui/shared/host-lifecycle.js +8 -2
- package/dist/ui/shared/tool-bridge.d.ts +30 -0
- package/dist/ui/shared/tool-bridge.js +137 -0
- package/dist/ui/shared/tool-shell.d.ts +9 -0
- package/dist/ui/shared/tool-shell.js +46 -4
- package/dist/ui/shared/ui-event-tracker.d.ts +9 -0
- package/dist/ui/shared/ui-event-tracker.js +27 -0
- package/dist/ui/shared/widget-state.d.ts +6 -1
- package/dist/ui/shared/widget-state.js +102 -4
- package/dist/utils/capture.js +3 -3
- package/dist/utils/files/base.d.ts +2 -0
- package/dist/utils/open-browser.js +1 -1
- package/dist/utils/ui-call-context.d.ts +8 -0
- package/dist/utils/ui-call-context.js +72 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -4
- package/dist/data/spec-kit-prompts.json +0 -123
- package/dist/handlers/node-handlers.d.ts +0 -6
- package/dist/handlers/node-handlers.js +0 -73
- package/dist/handlers/test-crash-handler.d.ts +0 -11
- package/dist/handlers/test-crash-handler.js +0 -26
- package/dist/http-index.d.ts +0 -45
- package/dist/http-index.js +0 -51
- package/dist/http-server-auto-tunnel.js +0 -667
- package/dist/http-server-named-tunnel.d.ts +0 -2
- package/dist/http-server-named-tunnel.js +0 -167
- package/dist/http-server-tunnel.d.ts +0 -2
- package/dist/http-server-tunnel.js +0 -111
- package/dist/http-server.d.ts +0 -2
- package/dist/http-server.js +0 -270
- package/dist/index-oauth.d.ts +0 -2
- package/dist/index-oauth.js +0 -201
- package/dist/oauth/auth-middleware.d.ts +0 -20
- package/dist/oauth/auth-middleware.js +0 -62
- package/dist/oauth/index.d.ts +0 -3
- package/dist/oauth/index.js +0 -3
- package/dist/oauth/oauth-manager.d.ts +0 -80
- package/dist/oauth/oauth-manager.js +0 -179
- package/dist/oauth/oauth-routes.d.ts +0 -3
- package/dist/oauth/oauth-routes.js +0 -377
- package/dist/oauth/provider.d.ts +0 -22
- package/dist/oauth/provider.js +0 -124
- package/dist/oauth/server.d.ts +0 -18
- package/dist/oauth/server.js +0 -160
- package/dist/oauth/types.d.ts +0 -54
- package/dist/oauth/types.js +0 -2
- package/dist/remote-device/templates/auth-success.d.ts +0 -1
- package/dist/remote-device/templates/auth-success.js +0 -30
- package/dist/setup.log +0 -275
- package/dist/test-setup.js +0 -14
- package/dist/tools/docx/builders/html-builder.d.ts +0 -17
- package/dist/tools/docx/builders/html-builder.js +0 -92
- package/dist/tools/docx/builders/image.d.ts +0 -14
- package/dist/tools/docx/builders/image.js +0 -84
- package/dist/tools/docx/builders/index.d.ts +0 -11
- package/dist/tools/docx/builders/index.js +0 -11
- package/dist/tools/docx/builders/markdown-builder.d.ts +0 -2
- package/dist/tools/docx/builders/markdown-builder.js +0 -260
- package/dist/tools/docx/builders/paragraph.d.ts +0 -12
- package/dist/tools/docx/builders/paragraph.js +0 -29
- package/dist/tools/docx/builders/table.d.ts +0 -10
- package/dist/tools/docx/builders/table.js +0 -138
- package/dist/tools/docx/builders/utils.d.ts +0 -5
- package/dist/tools/docx/builders/utils.js +0 -18
- package/dist/tools/docx/constants.d.ts +0 -32
- package/dist/tools/docx/constants.js +0 -61
- package/dist/tools/docx/converters/markdown-to-html.d.ts +0 -17
- package/dist/tools/docx/converters/markdown-to-html.js +0 -111
- package/dist/tools/docx/create.d.ts +0 -21
- package/dist/tools/docx/create.js +0 -386
- package/dist/tools/docx/dom.d.ts +0 -139
- package/dist/tools/docx/dom.js +0 -448
- package/dist/tools/docx/errors.d.ts +0 -28
- package/dist/tools/docx/errors.js +0 -48
- package/dist/tools/docx/extractors/images.d.ts +0 -14
- package/dist/tools/docx/extractors/images.js +0 -40
- package/dist/tools/docx/extractors/metadata.d.ts +0 -14
- package/dist/tools/docx/extractors/metadata.js +0 -64
- package/dist/tools/docx/extractors/sections.d.ts +0 -14
- package/dist/tools/docx/extractors/sections.js +0 -61
- package/dist/tools/docx/html.d.ts +0 -17
- package/dist/tools/docx/html.js +0 -111
- package/dist/tools/docx/index.d.ts +0 -10
- package/dist/tools/docx/index.js +0 -10
- package/dist/tools/docx/markdown.d.ts +0 -84
- package/dist/tools/docx/markdown.js +0 -507
- package/dist/tools/docx/modify.d.ts +0 -28
- package/dist/tools/docx/modify.js +0 -271
- package/dist/tools/docx/operations/handlers/index.d.ts +0 -39
- package/dist/tools/docx/operations/handlers/index.js +0 -152
- package/dist/tools/docx/operations/html-manipulator.d.ts +0 -24
- package/dist/tools/docx/operations/html-manipulator.js +0 -352
- package/dist/tools/docx/operations/index.d.ts +0 -14
- package/dist/tools/docx/operations/index.js +0 -61
- package/dist/tools/docx/operations/operation-handlers.d.ts +0 -3
- package/dist/tools/docx/operations/operation-handlers.js +0 -67
- package/dist/tools/docx/operations/preprocessor.d.ts +0 -14
- package/dist/tools/docx/operations/preprocessor.js +0 -44
- package/dist/tools/docx/operations/xml-replacer.d.ts +0 -9
- package/dist/tools/docx/operations/xml-replacer.js +0 -35
- package/dist/tools/docx/operations.d.ts +0 -13
- package/dist/tools/docx/operations.js +0 -13
- package/dist/tools/docx/ops/delete-paragraph-at-body-index.d.ts +0 -11
- package/dist/tools/docx/ops/delete-paragraph-at-body-index.js +0 -23
- package/dist/tools/docx/ops/header-replace-text-exact.d.ts +0 -13
- package/dist/tools/docx/ops/header-replace-text-exact.js +0 -55
- package/dist/tools/docx/ops/index.d.ts +0 -17
- package/dist/tools/docx/ops/index.js +0 -70
- package/dist/tools/docx/ops/insert-image-after-text.d.ts +0 -24
- package/dist/tools/docx/ops/insert-image-after-text.js +0 -128
- package/dist/tools/docx/ops/insert-paragraph-after-text.d.ts +0 -12
- package/dist/tools/docx/ops/insert-paragraph-after-text.js +0 -74
- package/dist/tools/docx/ops/insert-table-after-text.d.ts +0 -19
- package/dist/tools/docx/ops/insert-table-after-text.js +0 -57
- package/dist/tools/docx/ops/replace-hyperlink-url.d.ts +0 -12
- package/dist/tools/docx/ops/replace-hyperlink-url.js +0 -37
- package/dist/tools/docx/ops/replace-paragraph-at-body-index.d.ts +0 -9
- package/dist/tools/docx/ops/replace-paragraph-at-body-index.js +0 -25
- package/dist/tools/docx/ops/replace-paragraph-text-exact.d.ts +0 -21
- package/dist/tools/docx/ops/replace-paragraph-text-exact.js +0 -36
- package/dist/tools/docx/ops/replace-table-cell-text.d.ts +0 -25
- package/dist/tools/docx/ops/replace-table-cell-text.js +0 -85
- package/dist/tools/docx/ops/set-color-for-paragraph-exact.d.ts +0 -9
- package/dist/tools/docx/ops/set-color-for-paragraph-exact.js +0 -24
- package/dist/tools/docx/ops/set-color-for-style.d.ts +0 -13
- package/dist/tools/docx/ops/set-color-for-style.js +0 -31
- package/dist/tools/docx/ops/set-paragraph-style-at-body-index.d.ts +0 -8
- package/dist/tools/docx/ops/set-paragraph-style-at-body-index.js +0 -57
- package/dist/tools/docx/ops/table-set-cell-text.d.ts +0 -9
- package/dist/tools/docx/ops/table-set-cell-text.js +0 -40
- package/dist/tools/docx/parsers/image-extractor.d.ts +0 -18
- package/dist/tools/docx/parsers/image-extractor.js +0 -61
- package/dist/tools/docx/parsers/index.d.ts +0 -9
- package/dist/tools/docx/parsers/index.js +0 -9
- package/dist/tools/docx/parsers/paragraph-parser.d.ts +0 -2
- package/dist/tools/docx/parsers/paragraph-parser.js +0 -88
- package/dist/tools/docx/parsers/table-parser.d.ts +0 -9
- package/dist/tools/docx/parsers/table-parser.js +0 -72
- package/dist/tools/docx/parsers/xml-parser.d.ts +0 -25
- package/dist/tools/docx/parsers/xml-parser.js +0 -71
- package/dist/tools/docx/parsers/zip-reader.d.ts +0 -23
- package/dist/tools/docx/parsers/zip-reader.js +0 -52
- package/dist/tools/docx/read.d.ts +0 -27
- package/dist/tools/docx/read.js +0 -308
- package/dist/tools/docx/relationships.d.ts +0 -22
- package/dist/tools/docx/relationships.js +0 -76
- package/dist/tools/docx/structure.d.ts +0 -25
- package/dist/tools/docx/structure.js +0 -102
- package/dist/tools/docx/styled-html-parser.d.ts +0 -23
- package/dist/tools/docx/styled-html-parser.js +0 -1262
- package/dist/tools/docx/types.d.ts +0 -213
- package/dist/tools/docx/types.js +0 -5
- package/dist/tools/docx/utils/escaping.d.ts +0 -13
- package/dist/tools/docx/utils/escaping.js +0 -26
- package/dist/tools/docx/utils/images.d.ts +0 -9
- package/dist/tools/docx/utils/images.js +0 -26
- package/dist/tools/docx/utils/index.d.ts +0 -12
- package/dist/tools/docx/utils/index.js +0 -17
- package/dist/tools/docx/utils/markdown.d.ts +0 -13
- package/dist/tools/docx/utils/markdown.js +0 -32
- package/dist/tools/docx/utils/paths.d.ts +0 -15
- package/dist/tools/docx/utils/paths.js +0 -27
- package/dist/tools/docx/utils/versioning.d.ts +0 -25
- package/dist/tools/docx/utils/versioning.js +0 -55
- package/dist/tools/docx/utils.d.ts +0 -101
- package/dist/tools/docx/utils.js +0 -299
- package/dist/tools/docx/validate.d.ts +0 -33
- package/dist/tools/docx/validate.js +0 -49
- package/dist/tools/docx/validators.d.ts +0 -13
- package/dist/tools/docx/validators.js +0 -40
- package/dist/tools/docx/write.d.ts +0 -17
- package/dist/tools/docx/write.js +0 -88
- package/dist/tools/docx/xml-view-test.js +0 -63
- package/dist/tools/docx/xml-view.d.ts +0 -56
- package/dist/tools/docx/xml-view.js +0 -169
- package/dist/tools/docx/zip.d.ts +0 -21
- package/dist/tools/docx/zip.js +0 -35
- package/dist/tools/pdf-processor.js +0 -3
- package/dist/tools/search.d.ts +0 -32
- package/dist/tools/search.js +0 -202
- package/dist/ui/file-preview/src/app.d.ts +0 -4
- package/dist/ui/file-preview/src/app.js +0 -800
- package/dist/utils/crash-logger.d.ts +0 -18
- package/dist/utils/crash-logger.js +0 -44
- package/dist/utils/dedent.d.ts +0 -8
- package/dist/utils/dedent.js +0 -38
- /package/dist/{http-server-auto-tunnel.d.ts → ui/config-editor/main.d.ts} +0 -0
- /package/dist/{test-docx.d.ts → ui/config-editor/src/main.d.ts} +0 -0
- /package/dist/{tools/docx/xml-view-test.d.ts → ui/file-preview/main.d.ts} +0 -0
- /package/dist/ui/file-preview/src/components/{toolbar.d.ts → Toolbar.d.ts} +0 -0
- /package/dist/ui/file-preview/src/components/{toolbar.js → Toolbar.js} +0 -0
- /package/dist/{tools/pdf-processor.d.ts → ui/file-preview/src/model.js} +0 -0
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOCX XML View
|
|
3
|
-
*
|
|
4
|
-
* Exposes word/document.xml from a DOCX file as pretty-printed XML that can be
|
|
5
|
-
* read with offset/length pagination and edited with find/replace, just like a
|
|
6
|
-
* text file. All formatting is preserved because we operate on the actual XML.
|
|
7
|
-
*
|
|
8
|
-
* Round-trip: DOCX → unzip → pretty-print → edit → compact → repack → DOCX
|
|
9
|
-
*/
|
|
10
|
-
import fs from 'fs/promises';
|
|
11
|
-
import PizZip from 'pizzip';
|
|
12
|
-
// ════════════════════════════════════════════════════════════════
|
|
13
|
-
// XML pretty-print / compact
|
|
14
|
-
// ════════════════════════════════════════════════════════════════
|
|
15
|
-
/**
|
|
16
|
-
* Pretty-print XML by splitting tags onto separate lines with indentation.
|
|
17
|
-
*
|
|
18
|
-
* Preserves content inside text nodes exactly. Self-closing tags, inline
|
|
19
|
-
* open+close tags (e.g. <w:t>text</w:t>), and pure closing tags are all
|
|
20
|
-
* handled so that compact→pretty→compact is lossless.
|
|
21
|
-
*/
|
|
22
|
-
export function prettyPrintXml(xml) {
|
|
23
|
-
// Split between adjacent tags: "><" → ">\n<"
|
|
24
|
-
// But NOT inside text content — we only split where > is immediately followed by <
|
|
25
|
-
const parts = xml.split(/(?<=>)(?=<)/);
|
|
26
|
-
const lines = [];
|
|
27
|
-
let depth = 0;
|
|
28
|
-
for (const part of parts) {
|
|
29
|
-
const trimmed = part.trim();
|
|
30
|
-
if (!trimmed)
|
|
31
|
-
continue;
|
|
32
|
-
const isClosing = trimmed.startsWith('</');
|
|
33
|
-
const isSelfClosing = trimmed.endsWith('/>');
|
|
34
|
-
const isProcessingInstruction = trimmed.startsWith('<?');
|
|
35
|
-
// Inline: opens and closes on same fragment, e.g. <w:t>foo</w:t>
|
|
36
|
-
const isInline = !isClosing && !isSelfClosing && trimmed.includes('</');
|
|
37
|
-
if (isClosing) {
|
|
38
|
-
depth = Math.max(0, depth - 1);
|
|
39
|
-
}
|
|
40
|
-
lines.push(' '.repeat(depth) + trimmed);
|
|
41
|
-
if (!isClosing && !isSelfClosing && !isInline && !isProcessingInstruction) {
|
|
42
|
-
depth++;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return lines.join('\n');
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Compact pretty-printed XML back to a single line.
|
|
49
|
-
*
|
|
50
|
-
* CRITICAL: Must not introduce or remove whitespace inside <w:t> text nodes
|
|
51
|
-
* or break xml:space="preserve" semantics. We achieve this by only stripping
|
|
52
|
-
* leading indentation (which we added) and joining lines. The original XML
|
|
53
|
-
* had no newlines between tags, so this restores the original form.
|
|
54
|
-
*/
|
|
55
|
-
export function compactXml(prettyXml) {
|
|
56
|
-
const lines = prettyXml.split('\n');
|
|
57
|
-
return lines.map(l => l.trimStart()).join('');
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Read the document.xml from a DOCX as pretty-printed, line-based XML.
|
|
61
|
-
* Supports offset/length pagination just like text file reading.
|
|
62
|
-
*/
|
|
63
|
-
export async function readDocxXml(filePath, offset = 0, length) {
|
|
64
|
-
const buf = await fs.readFile(filePath);
|
|
65
|
-
const zip = new PizZip(buf);
|
|
66
|
-
const docFile = zip.file('word/document.xml');
|
|
67
|
-
if (!docFile)
|
|
68
|
-
throw new Error('Invalid DOCX: missing word/document.xml');
|
|
69
|
-
const rawXml = docFile.asText();
|
|
70
|
-
const pretty = prettyPrintXml(rawXml);
|
|
71
|
-
const allLines = pretty.split('\n');
|
|
72
|
-
const totalLines = allLines.length;
|
|
73
|
-
// Apply pagination
|
|
74
|
-
let startLine;
|
|
75
|
-
let sliceLength;
|
|
76
|
-
if (offset < 0) {
|
|
77
|
-
// Negative offset = tail (last N lines)
|
|
78
|
-
startLine = Math.max(0, totalLines + offset);
|
|
79
|
-
sliceLength = totalLines - startLine;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
startLine = offset;
|
|
83
|
-
sliceLength = length ?? totalLines;
|
|
84
|
-
}
|
|
85
|
-
const slicedLines = allLines.slice(startLine, startLine + sliceLength);
|
|
86
|
-
const content = slicedLines.join('\n');
|
|
87
|
-
return {
|
|
88
|
-
content,
|
|
89
|
-
lineCount: totalLines,
|
|
90
|
-
path: filePath,
|
|
91
|
-
rawSize: rawXml.length,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Apply a find/replace edit to a DOCX file's XML and write a new DOCX.
|
|
96
|
-
*
|
|
97
|
-
* The edit operates on the pretty-printed XML so that line-based context
|
|
98
|
-
* from read_file can be used directly as the search string. After editing,
|
|
99
|
-
* the XML is compacted back and repacked into the DOCX zip.
|
|
100
|
-
*
|
|
101
|
-
* @returns result with status, match count, and output path
|
|
102
|
-
*/
|
|
103
|
-
export async function editDocxXml(inputPath, outputPath, oldStr, newStr, expectedReplacements = 1) {
|
|
104
|
-
// 1. Read + pretty-print
|
|
105
|
-
const buf = await fs.readFile(inputPath);
|
|
106
|
-
const zip = new PizZip(buf);
|
|
107
|
-
const docFile = zip.file('word/document.xml');
|
|
108
|
-
if (!docFile)
|
|
109
|
-
throw new Error('Invalid DOCX: missing word/document.xml');
|
|
110
|
-
const rawXml = docFile.asText();
|
|
111
|
-
const pretty = prettyPrintXml(rawXml);
|
|
112
|
-
// 2. Normalize the search string's indentation to match our pretty-print.
|
|
113
|
-
// The caller might copy lines from read_file output which uses the same
|
|
114
|
-
// indentation, but just in case, we also try trimStart normalization.
|
|
115
|
-
let matchCount = countOccurrences(pretty, oldStr);
|
|
116
|
-
if (matchCount === 0) {
|
|
117
|
-
return {
|
|
118
|
-
status: 'no_match',
|
|
119
|
-
matchCount: 0,
|
|
120
|
-
outputPath,
|
|
121
|
-
message: `Search string not found in ${inputPath}`,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
if (matchCount !== expectedReplacements) {
|
|
125
|
-
return {
|
|
126
|
-
status: 'unexpected_count',
|
|
127
|
-
matchCount,
|
|
128
|
-
outputPath,
|
|
129
|
-
message: `Expected ${expectedReplacements} occurrence(s) but found ${matchCount}. ` +
|
|
130
|
-
`Add more surrounding context to make the search string unique, ` +
|
|
131
|
-
`or set expected_replacements to ${matchCount} to replace all.`,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
// 3. Apply edit(s)
|
|
135
|
-
let edited = pretty;
|
|
136
|
-
if (expectedReplacements === 1) {
|
|
137
|
-
const idx = edited.indexOf(oldStr);
|
|
138
|
-
edited = edited.substring(0, idx) + newStr + edited.substring(idx + oldStr.length);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
edited = edited.split(oldStr).join(newStr);
|
|
142
|
-
}
|
|
143
|
-
// 4. Compact + repack
|
|
144
|
-
const compacted = compactXml(edited);
|
|
145
|
-
zip.file('word/document.xml', compacted);
|
|
146
|
-
const outBuf = zip.generate({
|
|
147
|
-
type: 'nodebuffer',
|
|
148
|
-
compression: 'DEFLATE',
|
|
149
|
-
compressionOptions: { level: 6 },
|
|
150
|
-
});
|
|
151
|
-
await fs.writeFile(outputPath, outBuf);
|
|
152
|
-
return {
|
|
153
|
-
status: 'applied',
|
|
154
|
-
matchCount,
|
|
155
|
-
outputPath,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
// ════════════════════════════════════════════════════════════════
|
|
159
|
-
// Helpers
|
|
160
|
-
// ════════════════════════════════════════════════════════════════
|
|
161
|
-
function countOccurrences(haystack, needle) {
|
|
162
|
-
let count = 0;
|
|
163
|
-
let pos = haystack.indexOf(needle);
|
|
164
|
-
while (pos !== -1) {
|
|
165
|
-
count++;
|
|
166
|
-
pos = haystack.indexOf(needle, pos + 1);
|
|
167
|
-
}
|
|
168
|
-
return count;
|
|
169
|
-
}
|
package/dist/tools/docx/zip.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOCX ZIP I/O — Single Responsibility: file ↔ zip ↔ xml.
|
|
3
|
-
*
|
|
4
|
-
* Every other module depends on these three functions for disk I/O;
|
|
5
|
-
* none of them touch the file system directly.
|
|
6
|
-
*/
|
|
7
|
-
import PizZip from 'pizzip';
|
|
8
|
-
/**
|
|
9
|
-
* Read a .docx file from disk and return a PizZip instance.
|
|
10
|
-
*/
|
|
11
|
-
export declare function loadDocxZip(filePath: string): Promise<PizZip>;
|
|
12
|
-
/**
|
|
13
|
-
* Extract the raw XML string from word/document.xml inside the zip.
|
|
14
|
-
* Throws if the entry is missing.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getDocumentXml(zip: PizZip): string;
|
|
17
|
-
/**
|
|
18
|
-
* Replace word/document.xml in the zip with new XML,
|
|
19
|
-
* then write the whole archive to outputPath.
|
|
20
|
-
*/
|
|
21
|
-
export declare function saveDocxZip(zip: PizZip, newDocumentXml: string, outputPath: string): Promise<void>;
|
package/dist/tools/docx/zip.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOCX ZIP I/O — Single Responsibility: file ↔ zip ↔ xml.
|
|
3
|
-
*
|
|
4
|
-
* Every other module depends on these three functions for disk I/O;
|
|
5
|
-
* none of them touch the file system directly.
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'fs/promises';
|
|
8
|
-
import PizZip from 'pizzip';
|
|
9
|
-
/**
|
|
10
|
-
* Read a .docx file from disk and return a PizZip instance.
|
|
11
|
-
*/
|
|
12
|
-
export async function loadDocxZip(filePath) {
|
|
13
|
-
const buf = await fs.readFile(filePath);
|
|
14
|
-
return new PizZip(buf);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Extract the raw XML string from word/document.xml inside the zip.
|
|
18
|
-
* Throws if the entry is missing.
|
|
19
|
-
*/
|
|
20
|
-
export function getDocumentXml(zip) {
|
|
21
|
-
const entry = zip.file('word/document.xml');
|
|
22
|
-
if (!entry) {
|
|
23
|
-
throw new Error('Invalid DOCX: missing word/document.xml');
|
|
24
|
-
}
|
|
25
|
-
return entry.asText();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Replace word/document.xml in the zip with new XML,
|
|
29
|
-
* then write the whole archive to outputPath.
|
|
30
|
-
*/
|
|
31
|
-
export async function saveDocxZip(zip, newDocumentXml, outputPath) {
|
|
32
|
-
zip.file('word/document.xml', newDocumentXml);
|
|
33
|
-
const buf = zip.generate({ type: 'nodebuffer' });
|
|
34
|
-
await fs.writeFile(outputPath, buf);
|
|
35
|
-
}
|
package/dist/tools/search.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface SearchResult {
|
|
2
|
-
file: string;
|
|
3
|
-
line: number;
|
|
4
|
-
match: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function searchCode(options: {
|
|
7
|
-
rootPath: string;
|
|
8
|
-
pattern: string;
|
|
9
|
-
filePattern?: string;
|
|
10
|
-
ignoreCase?: boolean;
|
|
11
|
-
maxResults?: number;
|
|
12
|
-
includeHidden?: boolean;
|
|
13
|
-
contextLines?: number;
|
|
14
|
-
}): Promise<SearchResult[]>;
|
|
15
|
-
export declare function searchCodeFallback(options: {
|
|
16
|
-
rootPath: string;
|
|
17
|
-
pattern: string;
|
|
18
|
-
filePattern?: string;
|
|
19
|
-
ignoreCase?: boolean;
|
|
20
|
-
maxResults?: number;
|
|
21
|
-
excludeDirs?: string[];
|
|
22
|
-
contextLines?: number;
|
|
23
|
-
}): Promise<SearchResult[]>;
|
|
24
|
-
export declare function searchTextInFiles(options: {
|
|
25
|
-
rootPath: string;
|
|
26
|
-
pattern: string;
|
|
27
|
-
filePattern?: string;
|
|
28
|
-
ignoreCase?: boolean;
|
|
29
|
-
maxResults?: number;
|
|
30
|
-
includeHidden?: boolean;
|
|
31
|
-
contextLines?: number;
|
|
32
|
-
}): Promise<SearchResult[]>;
|
package/dist/tools/search.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs/promises';
|
|
4
|
-
import { validatePath } from './filesystem.js';
|
|
5
|
-
import { rgPath } from '@vscode/ripgrep';
|
|
6
|
-
import { capture } from "../utils/capture.js";
|
|
7
|
-
// Function to search file contents using ripgrep
|
|
8
|
-
export async function searchCode(options) {
|
|
9
|
-
const { rootPath, pattern, filePattern, ignoreCase = true, maxResults = 1000, includeHidden = false, contextLines = 0 } = options;
|
|
10
|
-
// Validate path for security
|
|
11
|
-
const validPath = await validatePath(rootPath);
|
|
12
|
-
// Build command arguments
|
|
13
|
-
const args = [
|
|
14
|
-
'--json', // Output in JSON format for easier parsing
|
|
15
|
-
'--line-number', // Include line numbers
|
|
16
|
-
];
|
|
17
|
-
if (ignoreCase) {
|
|
18
|
-
args.push('-i');
|
|
19
|
-
}
|
|
20
|
-
if (maxResults) {
|
|
21
|
-
args.push('-m', maxResults.toString());
|
|
22
|
-
}
|
|
23
|
-
if (includeHidden) {
|
|
24
|
-
args.push('--hidden');
|
|
25
|
-
}
|
|
26
|
-
if (contextLines > 0) {
|
|
27
|
-
args.push('-C', contextLines.toString());
|
|
28
|
-
}
|
|
29
|
-
if (filePattern) {
|
|
30
|
-
const patterns = filePattern
|
|
31
|
-
.split('|')
|
|
32
|
-
.map(p => p.trim()) // remove surrounding spaces
|
|
33
|
-
.filter(Boolean); // drop empty tokens
|
|
34
|
-
// If all patterns were empty, return no results
|
|
35
|
-
if (patterns.length === 0) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
patterns.forEach(p => args.push('-g', p));
|
|
39
|
-
}
|
|
40
|
-
// Add pattern and path
|
|
41
|
-
args.push(pattern, validPath);
|
|
42
|
-
// Run ripgrep command
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
const results = [];
|
|
45
|
-
const rg = spawn(rgPath, args);
|
|
46
|
-
let stdoutBuffer = '';
|
|
47
|
-
// Store a reference to the child process for potential termination
|
|
48
|
-
const childProcess = rg;
|
|
49
|
-
// Store in a process list - this could be expanded to a global registry
|
|
50
|
-
// of running search processes if needed for management
|
|
51
|
-
globalThis.currentSearchProcess = childProcess;
|
|
52
|
-
rg.stdout.on('data', (data) => {
|
|
53
|
-
stdoutBuffer += data.toString();
|
|
54
|
-
});
|
|
55
|
-
rg.stderr.on('data', (data) => {
|
|
56
|
-
console.error(`ripgrep error: ${data}`);
|
|
57
|
-
});
|
|
58
|
-
rg.on('close', (code) => {
|
|
59
|
-
// Clean up the global reference
|
|
60
|
-
if (globalThis.currentSearchProcess === childProcess) {
|
|
61
|
-
delete globalThis.currentSearchProcess;
|
|
62
|
-
}
|
|
63
|
-
if (code === 0 || code === 1) {
|
|
64
|
-
// Process the buffered output
|
|
65
|
-
const lines = stdoutBuffer.trim().split('\n');
|
|
66
|
-
for (const line of lines) {
|
|
67
|
-
if (!line)
|
|
68
|
-
continue;
|
|
69
|
-
try {
|
|
70
|
-
const result = JSON.parse(line);
|
|
71
|
-
if (result.type === 'match') {
|
|
72
|
-
result.data.submatches.forEach((submatch) => {
|
|
73
|
-
results.push({
|
|
74
|
-
file: result.data.path.text,
|
|
75
|
-
line: result.data.line_number,
|
|
76
|
-
match: submatch.match.text
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
else if (result.type === 'context' && contextLines > 0) {
|
|
81
|
-
results.push({
|
|
82
|
-
file: result.data.path.text,
|
|
83
|
-
line: result.data.line_number,
|
|
84
|
-
match: result.data.lines.text.trim()
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
90
|
-
capture('server_request_error', { error: `Error parsing ripgrep output: ${errorMessage}` });
|
|
91
|
-
console.error(`Error parsing ripgrep output: ${errorMessage}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
resolve(results);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
reject(new Error(`ripgrep process exited with code ${code}`));
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
// Fallback implementation using Node.js for environments without ripgrep
|
|
103
|
-
export async function searchCodeFallback(options) {
|
|
104
|
-
const { rootPath, pattern, filePattern, ignoreCase = true, maxResults = 1000, excludeDirs = ['node_modules', '.git'], contextLines = 0 } = options;
|
|
105
|
-
const validPath = await validatePath(rootPath);
|
|
106
|
-
const results = [];
|
|
107
|
-
const regex = new RegExp(pattern, ignoreCase ? 'i' : '');
|
|
108
|
-
// Handle filePattern similarly to main implementation
|
|
109
|
-
let fileRegex = null;
|
|
110
|
-
if (filePattern) {
|
|
111
|
-
const patterns = filePattern
|
|
112
|
-
.split('|')
|
|
113
|
-
.map(p => p.trim())
|
|
114
|
-
.filter(Boolean);
|
|
115
|
-
// If all patterns were empty, return no results
|
|
116
|
-
if (patterns.length === 0) {
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
// Create a regex that matches any of the patterns
|
|
120
|
-
const combinedPattern = patterns.map(p => p.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.')).join('|');
|
|
121
|
-
fileRegex = new RegExp(`^(${combinedPattern})$`);
|
|
122
|
-
}
|
|
123
|
-
async function searchDir(dirPath) {
|
|
124
|
-
if (results.length >= maxResults)
|
|
125
|
-
return;
|
|
126
|
-
try {
|
|
127
|
-
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
128
|
-
for (const entry of entries) {
|
|
129
|
-
if (results.length >= maxResults)
|
|
130
|
-
break;
|
|
131
|
-
const fullPath = path.join(dirPath, entry.name);
|
|
132
|
-
try {
|
|
133
|
-
await validatePath(fullPath);
|
|
134
|
-
if (entry.isDirectory()) {
|
|
135
|
-
if (!excludeDirs.includes(entry.name)) {
|
|
136
|
-
await searchDir(fullPath);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else if (entry.isFile()) {
|
|
140
|
-
if (!fileRegex || fileRegex.test(entry.name)) {
|
|
141
|
-
const content = await fs.readFile(fullPath, 'utf-8');
|
|
142
|
-
const lines = content.split('\n');
|
|
143
|
-
for (let i = 0; i < lines.length; i++) {
|
|
144
|
-
if (regex.test(lines[i])) {
|
|
145
|
-
// Add the matched line
|
|
146
|
-
results.push({
|
|
147
|
-
file: fullPath,
|
|
148
|
-
line: i + 1,
|
|
149
|
-
match: lines[i].trim()
|
|
150
|
-
});
|
|
151
|
-
// Add context lines
|
|
152
|
-
if (contextLines > 0) {
|
|
153
|
-
const startIdx = Math.max(0, i - contextLines);
|
|
154
|
-
const endIdx = Math.min(lines.length - 1, i + contextLines);
|
|
155
|
-
for (let j = startIdx; j <= endIdx; j++) {
|
|
156
|
-
if (j !== i) { // Skip the match line as it's already added
|
|
157
|
-
results.push({
|
|
158
|
-
file: fullPath,
|
|
159
|
-
line: j + 1,
|
|
160
|
-
match: lines[j].trim()
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (results.length >= maxResults)
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
// Skip files/directories we can't access
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
// Skip directories we can't read
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
await searchDir(validPath);
|
|
183
|
-
return results;
|
|
184
|
-
}
|
|
185
|
-
// Main function that tries ripgrep first, falls back to native implementation
|
|
186
|
-
export async function searchTextInFiles(options) {
|
|
187
|
-
try {
|
|
188
|
-
// For better performance and consistency, prefer the search session manager
|
|
189
|
-
// when doing content search, but keep the original direct ripgrep approach as primary
|
|
190
|
-
return await searchCode(options);
|
|
191
|
-
}
|
|
192
|
-
catch (error) {
|
|
193
|
-
capture('searchTextInFiles_ripgrep_fallback', {
|
|
194
|
-
error: error instanceof Error ? error.message : 'Unknown error'
|
|
195
|
-
});
|
|
196
|
-
// Use consistent exclusions - remove 'dist' to match ripgrep behavior
|
|
197
|
-
return searchCodeFallback({
|
|
198
|
-
...options,
|
|
199
|
-
excludeDirs: ['node_modules', '.git']
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { FilePreviewStructuredContent } from '../../../types.js';
|
|
2
|
-
import type { HtmlPreviewMode } from './types.js';
|
|
3
|
-
export declare function renderApp(container: HTMLElement, payload?: FilePreviewStructuredContent, htmlMode?: HtmlPreviewMode, expandedState?: boolean): void;
|
|
4
|
-
export declare function bootstrapApp(): void;
|