@angular/cli 22.2.1 → 22.3.0-next.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/bin/ng.js +7 -10
- package/bin/version.js +98 -0
- package/index.d.ts +19 -0
- package/lib/chunk-5AASRQKS.js +85 -0
- package/lib/chunk-A2VIYA2E.js +165 -0
- package/lib/chunk-CAZUOCTC.js +225 -0
- package/lib/chunk-DHWVZMLH.js +206 -0
- package/lib/chunk-FZ5GFCWU.js +483 -0
- package/lib/chunk-G7TRU43D.js +42 -0
- package/lib/chunk-GHUUJYOY.js +40 -0
- package/lib/chunk-JBLF2TH3.js +267 -0
- package/lib/chunk-Q67GOPL7.js +380 -0
- package/lib/chunk-SN4KY4Z3.js +24 -0
- package/lib/chunk-XFL2J3CJ.js +24 -0
- package/lib/chunk-XG3HVNIL.js +59 -0
- package/lib/chunk-YM7ILCS5.js +2573 -0
- package/lib/cli/index.js +353 -105
- package/lib/cli-4CMZ6KMR.js +48 -0
- package/lib/cli-4Q7DGTBA.js +33 -0
- package/lib/cli-6AHY7ADW.js +96 -0
- package/lib/cli-A5UAJDO6.js +135 -0
- package/lib/cli-ACLGUIBI.js +2531 -0
- package/lib/cli-BQRFWIMG.js +35 -0
- package/lib/cli-CWICUPZW.js +42 -0
- package/lib/cli-DWQUM3M2.js +29 -0
- package/lib/cli-L4TM4JH3.js +88 -0
- package/lib/cli-LYBZEMDR.js +96 -0
- package/lib/cli-PDCEX7HQ.js +605 -0
- package/lib/cli-PJVTDBQM.js +51 -0
- package/lib/cli-PRIRL3WP.js +185 -0
- package/lib/cli-PU5VH7JB.js +189 -0
- package/lib/cli-QUH44NUB.js +68 -0
- package/lib/cli-VVITNTBC.js +50 -0
- package/lib/cli-XM4L4PP4.js +1651 -0
- package/lib/cli-Y2ECUR33.js +33 -0
- package/lib/cli-YDSMJOSO.js +182 -0
- package/lib/color-SJPGXZVA.js +8 -0
- package/lib/config/schema.json +204 -0
- package/lib/config-QXK7SSVG.js +22 -0
- package/lib/init.js +91 -180
- package/package.json +20 -15
- package/lib/cli/index.d.ts +0 -11
- package/lib/cli/index.js.map +0 -1
- package/lib/config/workspace-schema.d.ts +0 -1025
- package/lib/config/workspace-schema.js +0 -131
- package/lib/config/workspace-schema.js.map +0 -1
- package/lib/init.d.ts +0 -8
- package/lib/init.js.map +0 -1
- package/src/analytics/analytics-collector.d.ts +0 -35
- package/src/analytics/analytics-collector.js +0 -195
- package/src/analytics/analytics-collector.js.map +0 -1
- package/src/analytics/analytics-parameters.d.ts +0 -101
- package/src/analytics/analytics-parameters.js +0 -107
- package/src/analytics/analytics-parameters.js.map +0 -1
- package/src/analytics/analytics.d.ts +0 -27
- package/src/analytics/analytics.js +0 -183
- package/src/analytics/analytics.js.map +0 -1
- package/src/command-builder/architect-base-command-module.d.ts +0 -30
- package/src/command-builder/architect-base-command-module.js +0 -244
- package/src/command-builder/architect-base-command-module.js.map +0 -1
- package/src/command-builder/architect-command-module.d.ts +0 -28
- package/src/command-builder/architect-command-module.js +0 -218
- package/src/command-builder/architect-command-module.js.map +0 -1
- package/src/command-builder/command-module.d.ts +0 -73
- package/src/command-builder/command-module.js +0 -260
- package/src/command-builder/command-module.js.map +0 -1
- package/src/command-builder/command-runner.d.ts +0 -9
- package/src/command-builder/command-runner.js +0 -202
- package/src/command-builder/command-runner.js.map +0 -1
- package/src/command-builder/definitions.d.ts +0 -41
- package/src/command-builder/definitions.js +0 -20
- package/src/command-builder/definitions.js.map +0 -1
- package/src/command-builder/schematics-command-module.d.ts +0 -41
- package/src/command-builder/schematics-command-module.js +0 -408
- package/src/command-builder/schematics-command-module.js.map +0 -1
- package/src/command-builder/utilities/command.d.ts +0 -13
- package/src/command-builder/utilities/command.js +0 -39
- package/src/command-builder/utilities/command.js.map +0 -1
- package/src/command-builder/utilities/json-help.d.ts +0 -37
- package/src/command-builder/utilities/json-help.js +0 -92
- package/src/command-builder/utilities/json-help.js.map +0 -1
- package/src/command-builder/utilities/json-schema.d.ts +0 -64
- package/src/command-builder/utilities/json-schema.js +0 -349
- package/src/command-builder/utilities/json-schema.js.map +0 -1
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +0 -18
- package/src/command-builder/utilities/normalize-options-middleware.js +0 -37
- package/src/command-builder/utilities/normalize-options-middleware.js.map +0 -1
- package/src/command-builder/utilities/schematic-engine-host.d.ts +0 -15
- package/src/command-builder/utilities/schematic-engine-host.js +0 -179
- package/src/command-builder/utilities/schematic-engine-host.js.map +0 -1
- package/src/command-builder/utilities/schematic-workflow.d.ts +0 -14
- package/src/command-builder/utilities/schematic-workflow.js +0 -70
- package/src/command-builder/utilities/schematic-workflow.js.map +0 -1
- package/src/commands/add/cli.d.ts +0 -41
- package/src/commands/add/cli.js +0 -705
- package/src/commands/add/cli.js.map +0 -1
- package/src/commands/add/long-description.md +0 -7
- package/src/commands/analytics/cli.d.ts +0 -16
- package/src/commands/analytics/cli.js +0 -34
- package/src/commands/analytics/cli.js.map +0 -1
- package/src/commands/analytics/info/cli.d.ts +0 -16
- package/src/commands/analytics/info/cli.js +0 -25
- package/src/commands/analytics/info/cli.js.map +0 -1
- package/src/commands/analytics/long-description.md +0 -20
- package/src/commands/analytics/settings/cli.d.ts +0 -35
- package/src/commands/analytics/settings/cli.js +0 -54
- package/src/commands/analytics/settings/cli.js.map +0 -1
- package/src/commands/build/cli.d.ts +0 -16
- package/src/commands/build/cli.js +0 -21
- package/src/commands/build/cli.js.map +0 -1
- package/src/commands/build/long-description.md +0 -18
- package/src/commands/cache/clean/cli.d.ts +0 -17
- package/src/commands/cache/clean/cli.js +0 -32
- package/src/commands/cache/clean/cli.js.map +0 -1
- package/src/commands/cache/cli.d.ts +0 -17
- package/src/commands/cache/cli.js +0 -36
- package/src/commands/cache/cli.js.map +0 -1
- package/src/commands/cache/info/cli.d.ts +0 -20
- package/src/commands/cache/info/cli.js +0 -139
- package/src/commands/cache/info/cli.js.map +0 -1
- package/src/commands/cache/long-description.md +0 -53
- package/src/commands/cache/settings/cli.d.ts +0 -27
- package/src/commands/cache/settings/cli.js +0 -41
- package/src/commands/cache/settings/cli.js.map +0 -1
- package/src/commands/cache/utilities.d.ts +0 -11
- package/src/commands/cache/utilities.js +0 -90
- package/src/commands/cache/utilities.js.map +0 -1
- package/src/commands/command-config.d.ts +0 -17
- package/src/commands/command-config.js +0 -116
- package/src/commands/command-config.js.map +0 -1
- package/src/commands/completion/cli.d.ts +0 -16
- package/src/commands/completion/cli.js +0 -61
- package/src/commands/completion/cli.js.map +0 -1
- package/src/commands/completion/long-description.md +0 -67
- package/src/commands/config/cli.d.ts +0 -24
- package/src/commands/config/cli.js +0 -150
- package/src/commands/config/cli.js.map +0 -1
- package/src/commands/config/long-description.md +0 -13
- package/src/commands/deploy/cli.d.ts +0 -17
- package/src/commands/deploy/cli.js +0 -38
- package/src/commands/deploy/cli.js.map +0 -1
- package/src/commands/deploy/long-description.md +0 -22
- package/src/commands/e2e/cli.d.ts +0 -18
- package/src/commands/e2e/cli.js +0 -42
- package/src/commands/e2e/cli.js.map +0 -1
- package/src/commands/extract-i18n/cli.d.ts +0 -17
- package/src/commands/extract-i18n/cli.js +0 -48
- package/src/commands/extract-i18n/cli.js.map +0 -1
- package/src/commands/generate/cli.d.ts +0 -47
- package/src/commands/generate/cli.js +0 -189
- package/src/commands/generate/cli.js.map +0 -1
- package/src/commands/lint/cli.d.ts +0 -17
- package/src/commands/lint/cli.js +0 -25
- package/src/commands/lint/cli.js.map +0 -1
- package/src/commands/lint/long-description.md +0 -20
- package/src/commands/make-this-awesome/cli.d.ts +0 -17
- package/src/commands/make-this-awesome/cli.js +0 -36
- package/src/commands/make-this-awesome/cli.js.map +0 -1
- package/src/commands/mcp/cli.d.ts +0 -21
- package/src/commands/mcp/cli.js +0 -74
- package/src/commands/mcp/cli.js.map +0 -1
- package/src/commands/mcp/constants.d.ts +0 -10
- package/src/commands/mcp/constants.js +0 -16
- package/src/commands/mcp/constants.js.map +0 -1
- package/src/commands/mcp/devserver.d.ts +0 -85
- package/src/commands/mcp/devserver.js +0 -109
- package/src/commands/mcp/devserver.js.map +0 -1
- package/src/commands/mcp/host.d.ts +0 -103
- package/src/commands/mcp/host.js +0 -270
- package/src/commands/mcp/host.js.map +0 -1
- package/src/commands/mcp/mcp-server.d.ts +0 -38
- package/src/commands/mcp/mcp-server.js +0 -176
- package/src/commands/mcp/mcp-server.js.map +0 -1
- package/src/commands/mcp/resources/ai-tutor.md +0 -822
- package/src/commands/mcp/resources/best-practices.md +0 -59
- package/src/commands/mcp/resources/instructions.d.ts +0 -9
- package/src/commands/mcp/resources/instructions.js +0 -26
- package/src/commands/mcp/resources/instructions.js.map +0 -1
- package/src/commands/mcp/shared-options.d.ts +0 -12
- package/src/commands/mcp/shared-options.js +0 -22
- package/src/commands/mcp/shared-options.js.map +0 -1
- package/src/commands/mcp/tools/ai-tutor.d.ts +0 -12
- package/src/commands/mcp/tools/ai-tutor.js +0 -59
- package/src/commands/mcp/tools/ai-tutor.js.map +0 -1
- package/src/commands/mcp/tools/best-practices.d.ts +0 -13
- package/src/commands/mcp/tools/best-practices.js +0 -196
- package/src/commands/mcp/tools/best-practices.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +0 -32
- package/src/commands/mcp/tools/devserver/devserver-start.js +0 -110
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +0 -31
- package/src/commands/mcp/tools/devserver/devserver-stop.js +0 -69
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +0 -41
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +0 -105
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +0 -1
- package/src/commands/mcp/tools/doc-search.d.ts +0 -21
- package/src/commands/mcp/tools/doc-search.js +0 -307
- package/src/commands/mcp/tools/doc-search.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +0 -17
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +0 -62
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +0 -70
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +0 -60
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +0 -15
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +0 -238
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +0 -9
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +0 -14
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +0 -36
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +0 -135
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +0 -13
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +0 -10
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +0 -16
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +0 -215
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +0 -1
- package/src/commands/mcp/tools/projects.d.ts +0 -48
- package/src/commands/mcp/tools/projects.js +0 -541
- package/src/commands/mcp/tools/projects.js.map +0 -1
- package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/build-target-strategy.js +0 -53
- package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js +0 -63
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/options-serializer.d.ts +0 -13
- package/src/commands/mcp/tools/run-target/options-serializer.js +0 -41
- package/src/commands/mcp/tools/run-target/options-serializer.js.map +0 -1
- package/src/commands/mcp/tools/run-target/run-target.d.ts +0 -34
- package/src/commands/mcp/tools/run-target/run-target.js +0 -69
- package/src/commands/mcp/tools/run-target/run-target.js.map +0 -1
- package/src/commands/mcp/tools/run-target/strategy.d.ts +0 -15
- package/src/commands/mcp/tools/run-target/strategy.js +0 -10
- package/src/commands/mcp/tools/run-target/strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/types.d.ts +0 -39
- package/src/commands/mcp/tools/run-target/types.js +0 -41
- package/src/commands/mcp/tools/run-target/types.js.map +0 -1
- package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js +0 -56
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +0 -1
- package/src/commands/mcp/tools/tool-registry.d.ts +0 -40
- package/src/commands/mcp/tools/tool-registry.js +0 -40
- package/src/commands/mcp/tools/tool-registry.js.map +0 -1
- package/src/commands/mcp/utils.d.ts +0 -25
- package/src/commands/mcp/utils.js +0 -44
- package/src/commands/mcp/utils.js.map +0 -1
- package/src/commands/mcp/workspace-utils.d.ts +0 -55
- package/src/commands/mcp/workspace-utils.js +0 -181
- package/src/commands/mcp/workspace-utils.js.map +0 -1
- package/src/commands/new/cli.d.ts +0 -27
- package/src/commands/new/cli.js +0 -76
- package/src/commands/new/cli.js.map +0 -1
- package/src/commands/new/long-description.md +0 -15
- package/src/commands/run/cli.d.ts +0 -25
- package/src/commands/run/cli.js +0 -89
- package/src/commands/run/cli.js.map +0 -1
- package/src/commands/run/long-description.md +0 -10
- package/src/commands/serve/cli.d.ts +0 -16
- package/src/commands/serve/cli.js +0 -20
- package/src/commands/serve/cli.js.map +0 -1
- package/src/commands/test/cli.d.ts +0 -16
- package/src/commands/test/cli.js +0 -21
- package/src/commands/test/cli.js.map +0 -1
- package/src/commands/test/long-description.md +0 -2
- package/src/commands/update/cli.d.ts +0 -50
- package/src/commands/update/cli.js +0 -586
- package/src/commands/update/cli.js.map +0 -1
- package/src/commands/update/long-description.md +0 -22
- package/src/commands/update/update-resolver.d.ts +0 -75
- package/src/commands/update/update-resolver.js +0 -918
- package/src/commands/update/update-resolver.js.map +0 -1
- package/src/commands/update/utilities/cli-version.d.ts +0 -48
- package/src/commands/update/utilities/cli-version.js +0 -196
- package/src/commands/update/utilities/cli-version.js.map +0 -1
- package/src/commands/update/utilities/constants.d.ts +0 -12
- package/src/commands/update/utilities/constants.js +0 -16
- package/src/commands/update/utilities/constants.js.map +0 -1
- package/src/commands/update/utilities/git.d.ts +0 -36
- package/src/commands/update/utilities/git.js +0 -148
- package/src/commands/update/utilities/git.js.map +0 -1
- package/src/commands/update/utilities/migration.d.ts +0 -32
- package/src/commands/update/utilities/migration.js +0 -271
- package/src/commands/update/utilities/migration.js.map +0 -1
- package/src/commands/version/cli.d.ts +0 -36
- package/src/commands/version/cli.js +0 -117
- package/src/commands/version/cli.js.map +0 -1
- package/src/commands/version/version-info.d.ts +0 -46
- package/src/commands/version/version-info.js +0 -101
- package/src/commands/version/version-info.js.map +0 -1
- package/src/package-managers/discovery.d.ts +0 -23
- package/src/package-managers/discovery.js +0 -104
- package/src/package-managers/discovery.js.map +0 -1
- package/src/package-managers/error.d.ts +0 -43
- package/src/package-managers/error.js +0 -41
- package/src/package-managers/error.js.map +0 -1
- package/src/package-managers/factory.d.ts +0 -30
- package/src/package-managers/factory.js +0 -137
- package/src/package-managers/factory.js.map +0 -1
- package/src/package-managers/host.d.ts +0 -86
- package/src/package-managers/host.js +0 -91
- package/src/package-managers/host.js.map +0 -1
- package/src/package-managers/index.d.ts +0 -13
- package/src/package-managers/index.js +0 -17
- package/src/package-managers/index.js.map +0 -1
- package/src/package-managers/logger.d.ts +0 -27
- package/src/package-managers/logger.js +0 -10
- package/src/package-managers/logger.js.map +0 -1
- package/src/package-managers/package-manager-descriptor.d.ts +0 -269
- package/src/package-managers/package-manager-descriptor.js +0 -210
- package/src/package-managers/package-manager-descriptor.js.map +0 -1
- package/src/package-managers/package-manager.d.ts +0 -200
- package/src/package-managers/package-manager.js +0 -720
- package/src/package-managers/package-manager.js.map +0 -1
- package/src/package-managers/package-metadata.d.ts +0 -91
- package/src/package-managers/package-metadata.js +0 -10
- package/src/package-managers/package-metadata.js.map +0 -1
- package/src/package-managers/package-tree.d.ts +0 -23
- package/src/package-managers/package-tree.js +0 -10
- package/src/package-managers/package-tree.js.map +0 -1
- package/src/package-managers/parsers.d.ts +0 -167
- package/src/package-managers/parsers.js +0 -674
- package/src/package-managers/parsers.js.map +0 -1
- package/src/utilities/color.d.ts +0 -23
- package/src/utilities/color.js +0 -41
- package/src/utilities/color.js.map +0 -1
- package/src/utilities/completion.d.ts +0 -30
- package/src/utilities/completion.js +0 -270
- package/src/utilities/completion.js.map +0 -1
- package/src/utilities/config.d.ts +0 -38
- package/src/utilities/config.js +0 -368
- package/src/utilities/config.js.map +0 -1
- package/src/utilities/environment-options.d.ts +0 -25
- package/src/utilities/environment-options.js +0 -60
- package/src/utilities/environment-options.js.map +0 -1
- package/src/utilities/eol.d.ts +0 -20
- package/src/utilities/eol.js +0 -35
- package/src/utilities/eol.js.map +0 -1
- package/src/utilities/error.d.ts +0 -18
- package/src/utilities/error.js +0 -41
- package/src/utilities/error.js.map +0 -1
- package/src/utilities/find-up.d.ts +0 -21
- package/src/utilities/find-up.js +0 -67
- package/src/utilities/find-up.js.map +0 -1
- package/src/utilities/json-file.d.ts +0 -24
- package/src/utilities/json-file.js +0 -179
- package/src/utilities/json-file.js.map +0 -1
- package/src/utilities/log-file.d.ts +0 -13
- package/src/utilities/log-file.js +0 -28
- package/src/utilities/log-file.js.map +0 -1
- package/src/utilities/memoize.d.ts +0 -15
- package/src/utilities/memoize.js +0 -64
- package/src/utilities/memoize.js.map +0 -1
- package/src/utilities/node-version.d.ts +0 -21
- package/src/utilities/node-version.js +0 -65
- package/src/utilities/node-version.js.map +0 -1
- package/src/utilities/prettier.d.ts +0 -19
- package/src/utilities/prettier.js +0 -105
- package/src/utilities/prettier.js.map +0 -1
- package/src/utilities/project.d.ts +0 -8
- package/src/utilities/project.js +0 -81
- package/src/utilities/project.js.map +0 -1
- package/src/utilities/prompt.d.ts +0 -17
- package/src/utilities/prompt.js +0 -90
- package/src/utilities/prompt.js.map +0 -1
- package/src/utilities/tty.d.ts +0 -16
- package/src/utilities/tty.js +0 -23
- package/src/utilities/tty.js.map +0 -1
- package/src/utilities/version.d.ts +0 -16
- package/src/utilities/version.js +0 -26
- package/src/utilities/version.js.map +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.DEVSERVER_STOP_TOOL = void 0;
|
|
11
|
-
exports.stopDevserver = stopDevserver;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
const devserver_1 = require("../../devserver");
|
|
14
|
-
const shared_options_1 = require("../../shared-options");
|
|
15
|
-
const utils_1 = require("../../utils");
|
|
16
|
-
const workspace_utils_1 = require("../../workspace-utils");
|
|
17
|
-
const tool_registry_1 = require("../tool-registry");
|
|
18
|
-
const devserverStopToolInputSchema = zod_1.z.object({
|
|
19
|
-
...shared_options_1.workspaceAndProjectOptions,
|
|
20
|
-
});
|
|
21
|
-
const devserverStopToolOutputSchema = zod_1.z.object({
|
|
22
|
-
message: zod_1.z.string().describe('A message indicating the result of the operation.'),
|
|
23
|
-
logs: zod_1.z.array(zod_1.z.string()).optional().describe('The full logs from the dev server.'),
|
|
24
|
-
});
|
|
25
|
-
async function stopDevserver(input, context) {
|
|
26
|
-
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
27
|
-
host: context.host,
|
|
28
|
-
server: context.server,
|
|
29
|
-
workspacePathInput: input.workspace,
|
|
30
|
-
projectNameInput: input.project,
|
|
31
|
-
mcpWorkspace: context.workspace,
|
|
32
|
-
});
|
|
33
|
-
const key = (0, devserver_1.getDevserverKey)(workspacePath, projectName);
|
|
34
|
-
const devserver = context.devservers.get(key);
|
|
35
|
-
if (!devserver) {
|
|
36
|
-
throw (0, devserver_1.createDevServerNotFoundError)(context.devservers);
|
|
37
|
-
}
|
|
38
|
-
devserver.stop();
|
|
39
|
-
context.devservers.delete(key);
|
|
40
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
41
|
-
message: `Development server for project '${projectName}' stopped.`,
|
|
42
|
-
logs: devserver.getServerLogs(),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
exports.DEVSERVER_STOP_TOOL = (0, tool_registry_1.declareTool)({
|
|
46
|
-
name: 'devserver_stop',
|
|
47
|
-
title: 'Stop Development Server',
|
|
48
|
-
description: `
|
|
49
|
-
<Purpose>
|
|
50
|
-
Stops a running Angular development server ("ng serve") that was started with the "devserver_start" tool.
|
|
51
|
-
</Purpose>
|
|
52
|
-
<Use Cases>
|
|
53
|
-
* **Stopping the Server:** Use this tool to terminate a running development server and retrieve the logs.
|
|
54
|
-
</Use Cases>
|
|
55
|
-
<Operational Notes>
|
|
56
|
-
* This should be called to gracefully shut down the server and access the full log output.
|
|
57
|
-
* This just sends a SIGTERM to the server and returns immediately; so the server might still be functional for a short
|
|
58
|
-
time after this is called. However note that this is not a blocker for starting a new devserver.
|
|
59
|
-
</Operational Notes>
|
|
60
|
-
`,
|
|
61
|
-
isReadOnly: false,
|
|
62
|
-
isLocalOnly: true,
|
|
63
|
-
inputSchema: devserverStopToolInputSchema.shape,
|
|
64
|
-
outputSchema: devserverStopToolOutputSchema.shape,
|
|
65
|
-
factory: (context) => (input) => {
|
|
66
|
-
return stopDevserver(input, context);
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
//# sourceMappingURL=devserver-stop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devserver-stop.js","sourceRoot":"","sources":["devserver-stop.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAsBH,sCAsBC;AA1CD,6BAAwB;AACxB,+CAAgF;AAChF,yDAAkE;AAClE,uCAA4D;AAC5D,2DAAmE;AACnE,oDAA6F;AAE7F,MAAM,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,2CAA0B;CAC9B,CAAC,CAAC;AAIH,MAAM,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACjF,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CACpF,CAAC,CAAC;AAII,KAAK,UAAU,aAAa,CAAC,KAA6B,EAAE,OAAuB;IACxF,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,4CAA0B,EAAC;QACtE,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,kBAAkB,EAAE,KAAK,CAAC,SAAS;QACnC,gBAAgB,EAAE,KAAK,CAAC,OAAO;QAC/B,YAAY,EAAE,OAAO,CAAC,SAAS;KAChC,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,IAAA,2BAAe,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAA,wCAA4B,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAE/B,OAAO,IAAA,qCAA6B,EAAC;QACnC,OAAO,EAAE,mCAAmC,WAAW,YAAY;QACnE,IAAI,EAAE,SAAS,CAAC,aAAa,EAAE;KAChC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,mBAAmB,GAG5B,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE;;;;;;;;;;;;CAYd;IACC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,4BAA4B,CAAC,KAAK;IAC/C,YAAY,EAAE,6BAA6B,CAAC,KAAK;IACjD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
10
|
-
/**
|
|
11
|
-
* How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
|
|
12
|
-
*/
|
|
13
|
-
export declare const WATCH_DELAY = 1000;
|
|
14
|
-
declare const devserverWaitForBuildToolInputSchema: z.ZodObject<{
|
|
15
|
-
timeout: z.ZodDefault<z.ZodNumber>;
|
|
16
|
-
workspace: z.ZodOptional<z.ZodString>;
|
|
17
|
-
project: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
export type DevserverWaitForBuildToolInput = z.infer<typeof devserverWaitForBuildToolInputSchema>;
|
|
20
|
-
declare const devserverWaitForBuildToolOutputSchema: z.ZodObject<{
|
|
21
|
-
status: z.ZodEnum<{
|
|
22
|
-
timeout: "timeout";
|
|
23
|
-
success: "success";
|
|
24
|
-
failure: "failure";
|
|
25
|
-
unknown: "unknown";
|
|
26
|
-
}>;
|
|
27
|
-
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
-
}, z.core.$strip>;
|
|
29
|
-
export type DevserverWaitForBuildToolOutput = z.infer<typeof devserverWaitForBuildToolOutputSchema>;
|
|
30
|
-
export declare function waitForDevserverBuild(input: DevserverWaitForBuildToolInput, context: McpToolContext): Promise<{
|
|
31
|
-
content: {
|
|
32
|
-
type: "text";
|
|
33
|
-
text: string;
|
|
34
|
-
}[];
|
|
35
|
-
structuredContent: {
|
|
36
|
-
status: "timeout" | "success" | "failure" | "unknown";
|
|
37
|
-
logs?: string[] | undefined;
|
|
38
|
-
};
|
|
39
|
-
}>;
|
|
40
|
-
export declare const DEVSERVER_WAIT_FOR_BUILD_TOOL: McpToolDeclaration<typeof devserverWaitForBuildToolInputSchema.shape, typeof devserverWaitForBuildToolOutputSchema.shape>;
|
|
41
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.DEVSERVER_WAIT_FOR_BUILD_TOOL = exports.WATCH_DELAY = void 0;
|
|
11
|
-
exports.waitForDevserverBuild = waitForDevserverBuild;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
const devserver_1 = require("../../devserver");
|
|
14
|
-
const shared_options_1 = require("../../shared-options");
|
|
15
|
-
const utils_1 = require("../../utils");
|
|
16
|
-
const workspace_utils_1 = require("../../workspace-utils");
|
|
17
|
-
const tool_registry_1 = require("../tool-registry");
|
|
18
|
-
/**
|
|
19
|
-
* How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
|
|
20
|
-
*/
|
|
21
|
-
exports.WATCH_DELAY = 1000;
|
|
22
|
-
/**
|
|
23
|
-
* Default timeout for waiting for the build to complete.
|
|
24
|
-
*/
|
|
25
|
-
const DEFAULT_TIMEOUT = 180_000; // In milliseconds
|
|
26
|
-
const devserverWaitForBuildToolInputSchema = zod_1.z.object({
|
|
27
|
-
...shared_options_1.workspaceAndProjectOptions,
|
|
28
|
-
timeout: zod_1.z
|
|
29
|
-
.number()
|
|
30
|
-
.default(DEFAULT_TIMEOUT)
|
|
31
|
-
.describe(`The maximum time to wait for the build to complete, in milliseconds. This can't be lower than ${exports.WATCH_DELAY}.`),
|
|
32
|
-
});
|
|
33
|
-
const devserverWaitForBuildToolOutputSchema = zod_1.z.object({
|
|
34
|
-
status: zod_1.z
|
|
35
|
-
.enum(['success', 'failure', 'unknown', 'timeout'])
|
|
36
|
-
.describe("The status of the build if it's complete, or a status indicating why the wait operation failed."),
|
|
37
|
-
logs: zod_1.z
|
|
38
|
-
.array(zod_1.z.string())
|
|
39
|
-
.optional()
|
|
40
|
-
.describe('The logs from the most recent build, if one exists.'),
|
|
41
|
-
});
|
|
42
|
-
function wait(ms) {
|
|
43
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
44
|
-
}
|
|
45
|
-
async function waitForDevserverBuild(input, context) {
|
|
46
|
-
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
47
|
-
host: context.host,
|
|
48
|
-
server: context.server,
|
|
49
|
-
workspacePathInput: input.workspace,
|
|
50
|
-
projectNameInput: input.project,
|
|
51
|
-
mcpWorkspace: context.workspace,
|
|
52
|
-
});
|
|
53
|
-
const key = (0, devserver_1.getDevserverKey)(workspacePath, projectName);
|
|
54
|
-
const devserver = context.devservers.get(key);
|
|
55
|
-
if (!devserver) {
|
|
56
|
-
throw (0, devserver_1.createDevServerNotFoundError)(context.devservers);
|
|
57
|
-
}
|
|
58
|
-
return performWait(devserver, input.timeout);
|
|
59
|
-
}
|
|
60
|
-
async function performWait(devserver, timeout) {
|
|
61
|
-
const deadline = Date.now() + timeout;
|
|
62
|
-
await wait(exports.WATCH_DELAY);
|
|
63
|
-
while (devserver.isBuilding()) {
|
|
64
|
-
if (Date.now() > deadline) {
|
|
65
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
66
|
-
status: 'timeout',
|
|
67
|
-
logs: undefined,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
await wait(exports.WATCH_DELAY);
|
|
71
|
-
}
|
|
72
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
73
|
-
...devserver.getMostRecentBuild(),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
exports.DEVSERVER_WAIT_FOR_BUILD_TOOL = (0, tool_registry_1.declareTool)({
|
|
77
|
-
name: 'devserver_wait_for_build',
|
|
78
|
-
title: 'Wait for Devserver Build',
|
|
79
|
-
description: `
|
|
80
|
-
<Purpose>
|
|
81
|
-
Waits for a dev server that was started with the "devserver_start" tool to complete its build, then reports the build logs from its most
|
|
82
|
-
recent build.
|
|
83
|
-
</Purpose>
|
|
84
|
-
<Use Cases>
|
|
85
|
-
* **Waiting for a build:** As long as a devserver is alive ("devserver_start" was called for this project and "devserver_stop" wasn't
|
|
86
|
-
called yet), then if you're making a file change and want to ensure it was successfully built, call this tool instead of any other build
|
|
87
|
-
tool or command. When it retuns you'll get build logs back **and** you'll know the user's devserver is up-to-date with the latest changes.
|
|
88
|
-
</Use Cases>
|
|
89
|
-
<Operational Notes>
|
|
90
|
-
* This tool expects that a dev server was launched on the same project with the "devserver_start" tool, otherwise the tool will fail.
|
|
91
|
-
* This tool will block until the build is complete or the timeout is reached. If you expect a long build process, consider increasing the
|
|
92
|
-
timeout. Timeouts on initial run (right after "devserver_start" calls) or after a big change are not necessarily indicative of an error.
|
|
93
|
-
* If you encountered a timeout and it might be reasonable, just call this tool again.
|
|
94
|
-
* If the dev server is not building, it will return quickly, with the logs from the last build.
|
|
95
|
-
</Operational Notes>
|
|
96
|
-
`,
|
|
97
|
-
isReadOnly: true,
|
|
98
|
-
isLocalOnly: true,
|
|
99
|
-
inputSchema: devserverWaitForBuildToolInputSchema.shape,
|
|
100
|
-
outputSchema: devserverWaitForBuildToolOutputSchema.shape,
|
|
101
|
-
factory: (context) => (input) => {
|
|
102
|
-
return waitForDevserverBuild(input, context);
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=devserver-wait-for-build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devserver-wait-for-build.js","sourceRoot":"","sources":["devserver-wait-for-build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiDH,sDAmBC;AAlED,6BAAwB;AACxB,+CAA2F;AAC3F,yDAAkE;AAClE,uCAA4D;AAC5D,2DAAmE;AACnE,oDAA6F;AAE7F;;GAEG;AACU,QAAA,WAAW,GAAG,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,eAAe,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
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
export declare const DOC_SEARCH_TOOL: import("./tool-registry").McpToolDeclaration<{
|
|
10
|
-
query: z.ZodString;
|
|
11
|
-
includeTopContent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
-
version: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
}, {
|
|
14
|
-
searchedVersion: z.ZodNumber;
|
|
15
|
-
results: z.ZodArray<z.ZodObject<{
|
|
16
|
-
title: z.ZodString;
|
|
17
|
-
breadcrumb: z.ZodString;
|
|
18
|
-
url: z.ZodString;
|
|
19
|
-
content: z.ZodOptional<z.ZodString>;
|
|
20
|
-
}, z.core.$strip>>;
|
|
21
|
-
}>;
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.DOC_SEARCH_TOOL = void 0;
|
|
44
|
-
const node_crypto_1 = require("node:crypto");
|
|
45
|
-
const node_stream_1 = require("node:stream");
|
|
46
|
-
const zod_1 = require("zod");
|
|
47
|
-
const constants_1 = require("../constants");
|
|
48
|
-
const tool_registry_1 = require("./tool-registry");
|
|
49
|
-
const ALGOLIA_APP_ID = 'L1XWT2UJ7F';
|
|
50
|
-
// https://www.algolia.com/doc/guides/security/api-keys/#search-only-api-key
|
|
51
|
-
// This is a search only, rate limited key. It is sent within the URL of the query request.
|
|
52
|
-
// This is not the actual key.
|
|
53
|
-
const ALGOLIA_API_E = '34738e8ae1a45e58bbce7b0f9810633d8b727b44a6479cf5e14b6a337148bd50';
|
|
54
|
-
/**
|
|
55
|
-
* The minimum major version of Angular for which a version-specific documentation index is known to exist.
|
|
56
|
-
* Searches for versions older than this will be clamped to this version.
|
|
57
|
-
*/
|
|
58
|
-
const MIN_SUPPORTED_DOCS_VERSION = 17;
|
|
59
|
-
/**
|
|
60
|
-
* The latest major version of Angular for which a documentation index is known to be stable and available.
|
|
61
|
-
* This acts as a "safe harbor" fallback. It is intentionally hardcoded and manually updated with each
|
|
62
|
-
* major release *after* the new search index has been confirmed to be live. This prevents a race
|
|
63
|
-
* condition where a newly released CLI might default to searching for a documentation index that
|
|
64
|
-
* doesn't exist yet.
|
|
65
|
-
*/
|
|
66
|
-
const LATEST_KNOWN_DOCS_VERSION = 22;
|
|
67
|
-
const docSearchInputSchema = zod_1.z.object({
|
|
68
|
-
query: zod_1.z
|
|
69
|
-
.string()
|
|
70
|
-
.describe('Concise search keywords or API names (e.g., "ngFor trackBy" or "NgModule").'),
|
|
71
|
-
includeTopContent: zod_1.z
|
|
72
|
-
.boolean()
|
|
73
|
-
.optional()
|
|
74
|
-
.default(false)
|
|
75
|
-
.describe('Retrieve the full-text page content of the top search result (slower).'),
|
|
76
|
-
version: zod_1.z
|
|
77
|
-
.number()
|
|
78
|
-
.optional()
|
|
79
|
-
.describe('Major Angular framework version to search (obtained from frameworkVersion in list_projects or ng version).'),
|
|
80
|
-
});
|
|
81
|
-
exports.DOC_SEARCH_TOOL = (0, tool_registry_1.declareTool)({
|
|
82
|
-
name: 'search_documentation',
|
|
83
|
-
title: 'Search Angular Documentation (angular.dev)',
|
|
84
|
-
description: `
|
|
85
|
-
<Purpose>
|
|
86
|
-
Searches the official Angular documentation (angular.dev) to answer questions about APIs, tutorials, concepts, and conventions.
|
|
87
|
-
</Purpose>
|
|
88
|
-
<Use Cases>
|
|
89
|
-
* Answering questions about Angular concepts (e.g., standalone components).
|
|
90
|
-
* Finding correct API signatures or syntax (e.g., ngFor trackBy).
|
|
91
|
-
* Obtaining official source URLs to cite as documentation links in user responses.
|
|
92
|
-
</Use Cases>
|
|
93
|
-
<Operational Notes>
|
|
94
|
-
* Provide the major Angular version in the 'version' parameter (obtained from 'frameworkVersion'
|
|
95
|
-
in 'list_projects' or from 'ng version') to ensure version-aligned results.
|
|
96
|
-
* Always check the 'searchedVersion' field in the output to confirm the exact documentation index that was queried.
|
|
97
|
-
* For best results, provide a concise keyword query (e.g., "NgModule") rather than a natural language sentence.
|
|
98
|
-
</Operational Notes>`,
|
|
99
|
-
inputSchema: docSearchInputSchema.shape,
|
|
100
|
-
outputSchema: {
|
|
101
|
-
searchedVersion: zod_1.z
|
|
102
|
-
.number()
|
|
103
|
-
.describe('The major version of the documentation that was searched.'),
|
|
104
|
-
results: zod_1.z.array(zod_1.z.object({
|
|
105
|
-
title: zod_1.z.string().describe('The title of the documentation page.'),
|
|
106
|
-
breadcrumb: zod_1.z
|
|
107
|
-
.string()
|
|
108
|
-
.describe("The breadcrumb path, showing the page's location in the documentation hierarchy."),
|
|
109
|
-
url: zod_1.z.string().describe('The direct URL to the documentation page.'),
|
|
110
|
-
content: zod_1.z
|
|
111
|
-
.string()
|
|
112
|
-
.optional()
|
|
113
|
-
.describe('A snippet of the main content from the page. Only provided for the top result.'),
|
|
114
|
-
})),
|
|
115
|
-
},
|
|
116
|
-
isReadOnly: true,
|
|
117
|
-
isLocalOnly: false,
|
|
118
|
-
factory: createDocSearchHandler,
|
|
119
|
-
});
|
|
120
|
-
function createDocSearchHandler({ logger }) {
|
|
121
|
-
let apiKey;
|
|
122
|
-
async function performSearch(query, version) {
|
|
123
|
-
if (!apiKey) {
|
|
124
|
-
const dcip = (0, node_crypto_1.createDecipheriv)('aes-256-gcm', (constants_1.k1 + ALGOLIA_APP_ID).padEnd(32, '^'), constants_1.iv).setAuthTag(Buffer.from(constants_1.at, 'base64'));
|
|
125
|
-
apiKey = dcip.update(ALGOLIA_API_E, 'hex', 'utf-8') + dcip.final('utf-8');
|
|
126
|
-
}
|
|
127
|
-
const url = `https://${ALGOLIA_APP_ID}-dsn.algolia.net/1/indexes/angular_v${version}/query`;
|
|
128
|
-
const response = await fetch(url, {
|
|
129
|
-
method: 'POST',
|
|
130
|
-
headers: {
|
|
131
|
-
'Content-Type': 'application/json',
|
|
132
|
-
'X-Algolia-Application-Id': ALGOLIA_APP_ID,
|
|
133
|
-
'X-Algolia-API-Key': apiKey,
|
|
134
|
-
},
|
|
135
|
-
body: JSON.stringify({
|
|
136
|
-
query,
|
|
137
|
-
attributesToRetrieve: [
|
|
138
|
-
'hierarchy.lvl0',
|
|
139
|
-
'hierarchy.lvl1',
|
|
140
|
-
'hierarchy.lvl2',
|
|
141
|
-
'hierarchy.lvl3',
|
|
142
|
-
'hierarchy.lvl4',
|
|
143
|
-
'hierarchy.lvl5',
|
|
144
|
-
'hierarchy.lvl6',
|
|
145
|
-
'content',
|
|
146
|
-
'type',
|
|
147
|
-
'url',
|
|
148
|
-
],
|
|
149
|
-
hitsPerPage: 10,
|
|
150
|
-
}),
|
|
151
|
-
signal: AbortSignal.timeout(5000), // Timeout after 5 seconds
|
|
152
|
-
});
|
|
153
|
-
if (!response.ok) {
|
|
154
|
-
throw new Error(`Search request failed with status ${response.status} (${response.statusText})`);
|
|
155
|
-
}
|
|
156
|
-
const data = (await response.json());
|
|
157
|
-
return data.hits;
|
|
158
|
-
}
|
|
159
|
-
return async ({ query, includeTopContent, version }) => {
|
|
160
|
-
let finalSearchedVersion = Math.max(version ?? LATEST_KNOWN_DOCS_VERSION, MIN_SUPPORTED_DOCS_VERSION);
|
|
161
|
-
let allHits;
|
|
162
|
-
try {
|
|
163
|
-
allHits = await performSearch(query, finalSearchedVersion);
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
logger.warn(`Error searching Angular v${finalSearchedVersion} documentation: ${error}`);
|
|
167
|
-
}
|
|
168
|
-
// If the initial search for a newer-than-stable version returns no results, it may be because
|
|
169
|
-
// the index for that version doesn't exist yet. In this case, fall back to the latest known
|
|
170
|
-
// stable version.
|
|
171
|
-
if ((!allHits || allHits.length === 0) && finalSearchedVersion > LATEST_KNOWN_DOCS_VERSION) {
|
|
172
|
-
logger.warn(`Documentation index for v${finalSearchedVersion} not found or empty. Falling back to v${LATEST_KNOWN_DOCS_VERSION}.`);
|
|
173
|
-
finalSearchedVersion = LATEST_KNOWN_DOCS_VERSION;
|
|
174
|
-
try {
|
|
175
|
-
allHits = await performSearch(query, finalSearchedVersion);
|
|
176
|
-
}
|
|
177
|
-
catch (error) {
|
|
178
|
-
logger.warn(`Error searching fallback Angular v${finalSearchedVersion} documentation: ${error}`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (!allHits?.length) {
|
|
182
|
-
return {
|
|
183
|
-
content: [
|
|
184
|
-
{
|
|
185
|
-
type: 'text',
|
|
186
|
-
text: `No results found for query "${query}" in Angular v${finalSearchedVersion} documentation.`,
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
structuredContent: { results: [], searchedVersion: finalSearchedVersion },
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
const structuredResults = [];
|
|
193
|
-
const textContent = [
|
|
194
|
-
{
|
|
195
|
-
type: 'text',
|
|
196
|
-
text: `Showing results for Angular v${finalSearchedVersion} documentation.`,
|
|
197
|
-
annotations: {
|
|
198
|
-
audience: ['assistant'],
|
|
199
|
-
priority: 0.9,
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
];
|
|
203
|
-
// Process top hit first
|
|
204
|
-
const topHit = allHits[0];
|
|
205
|
-
const { title: topTitle, breadcrumb: topBreadcrumb } = formatHitToParts(topHit);
|
|
206
|
-
let topContent;
|
|
207
|
-
if (includeTopContent && typeof topHit.url === 'string') {
|
|
208
|
-
const url = new URL(topHit.url);
|
|
209
|
-
try {
|
|
210
|
-
// Only fetch content from angular.dev
|
|
211
|
-
if (url.hostname === 'angular.dev' || url.hostname.endsWith('.angular.dev')) {
|
|
212
|
-
const response = await fetch(url);
|
|
213
|
-
if (response.ok && response.body) {
|
|
214
|
-
topContent = await extractMainContent(node_stream_1.Readable.fromWeb(response.body, { encoding: 'utf-8' }));
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
logger.warn(`Failed to fetch or parse content from ${url}: ${e}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
structuredResults.push({
|
|
223
|
-
title: topTitle,
|
|
224
|
-
breadcrumb: topBreadcrumb,
|
|
225
|
-
url: topHit.url,
|
|
226
|
-
content: topContent,
|
|
227
|
-
});
|
|
228
|
-
let topText = `## ${topTitle}\n${topBreadcrumb}\nURL: ${topHit.url}`;
|
|
229
|
-
if (topContent) {
|
|
230
|
-
topText += `\n\n--- DOCUMENTATION CONTENT ---\n${topContent}`;
|
|
231
|
-
}
|
|
232
|
-
textContent.push({ type: 'text', text: topText });
|
|
233
|
-
// Process remaining hits
|
|
234
|
-
for (const hit of allHits.slice(1)) {
|
|
235
|
-
const { title, breadcrumb } = formatHitToParts(hit);
|
|
236
|
-
structuredResults.push({
|
|
237
|
-
title,
|
|
238
|
-
breadcrumb,
|
|
239
|
-
url: hit.url,
|
|
240
|
-
});
|
|
241
|
-
textContent.push({
|
|
242
|
-
type: 'text',
|
|
243
|
-
text: `## ${title}\n${breadcrumb}\nURL: ${hit.url}`,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
content: textContent,
|
|
248
|
-
structuredContent: { results: structuredResults, searchedVersion: finalSearchedVersion },
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Extracts the text content of the `<main>` element by streaming an HTML response.
|
|
254
|
-
*
|
|
255
|
-
* @param htmlStream A readable stream of the HTML content of a page.
|
|
256
|
-
* @returns A promise that resolves to the text content of the `<main>` element, or `undefined` if not found.
|
|
257
|
-
*/
|
|
258
|
-
async function extractMainContent(htmlStream) {
|
|
259
|
-
const { RewritingStream } = await Promise.resolve().then(() => __importStar(require('parse5-html-rewriting-stream')));
|
|
260
|
-
const rewriter = new RewritingStream();
|
|
261
|
-
let mainTextContent = '';
|
|
262
|
-
let inMainElement = false;
|
|
263
|
-
let mainTagFound = false;
|
|
264
|
-
rewriter.on('startTag', (tag) => {
|
|
265
|
-
if (tag.tagName === 'main') {
|
|
266
|
-
inMainElement = true;
|
|
267
|
-
mainTagFound = true;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
rewriter.on('endTag', (tag) => {
|
|
271
|
-
if (tag.tagName === 'main') {
|
|
272
|
-
inMainElement = false;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
// Only capture text content, and only when inside the <main> element.
|
|
276
|
-
rewriter.on('text', (text) => {
|
|
277
|
-
if (inMainElement) {
|
|
278
|
-
mainTextContent += text.text;
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
return new Promise((resolve, reject) => {
|
|
282
|
-
htmlStream
|
|
283
|
-
.pipe(rewriter)
|
|
284
|
-
.on('finish', () => {
|
|
285
|
-
if (!mainTagFound) {
|
|
286
|
-
resolve(undefined);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
resolve(mainTextContent.trim());
|
|
290
|
-
})
|
|
291
|
-
.on('error', reject);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Formats an Algolia search hit into its constituent parts.
|
|
296
|
-
*
|
|
297
|
-
* @param hit The Algolia search hit object, which should contain a `hierarchy` property.
|
|
298
|
-
* @returns An object containing the title and breadcrumb string.
|
|
299
|
-
*/
|
|
300
|
-
function formatHitToParts(hit) {
|
|
301
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
302
|
-
const hierarchy = Object.values(hit.hierarchy).filter((x) => typeof x === 'string');
|
|
303
|
-
const title = hierarchy.pop() ?? '';
|
|
304
|
-
const breadcrumb = hierarchy.join(' > ');
|
|
305
|
-
return { title, breadcrumb };
|
|
306
|
-
}
|
|
307
|
-
//# sourceMappingURL=doc-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc-search.js","sourceRoot":"","sources":["doc-search.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;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AO;YACT,CAAC;YAED,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,GAA4B;IACpD,8DAA8D;IAC9D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC"}
|
package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
import type { ImportSpecifier, Node, SourceFile } from 'typescript';
|
|
9
|
-
import type { MigrationResponse } from './types';
|
|
10
|
-
export declare function analyzeForUnsupportedZoneUses(sourceFile: SourceFile): Promise<MigrationResponse | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Finds usages of `NgZone` that are not supported in zoneless applications.
|
|
13
|
-
* @param sourceFile The source file to check.
|
|
14
|
-
* @param ngZoneImport The import specifier for `NgZone`.
|
|
15
|
-
* @returns A list of nodes that are unsupported `NgZone` usages.
|
|
16
|
-
*/
|
|
17
|
-
export declare function findUnsupportedZoneUsages(sourceFile: SourceFile, ngZoneImport: ImportSpecifier): Promise<Node[]>;
|
package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.analyzeForUnsupportedZoneUses = analyzeForUnsupportedZoneUses;
|
|
11
|
-
exports.findUnsupportedZoneUsages = findUnsupportedZoneUsages;
|
|
12
|
-
const prompts_1 = require("./prompts");
|
|
13
|
-
const ts_utils_1 = require("./ts-utils");
|
|
14
|
-
async function analyzeForUnsupportedZoneUses(sourceFile) {
|
|
15
|
-
const ngZoneImport = await (0, ts_utils_1.getImportSpecifier)(sourceFile, '@angular/core', 'NgZone');
|
|
16
|
-
if (!ngZoneImport) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
const unsupportedUsages = await findUnsupportedZoneUsages(sourceFile, ngZoneImport);
|
|
20
|
-
if (unsupportedUsages.length === 0) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const locations = unsupportedUsages.map((node) => {
|
|
24
|
-
const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
25
|
-
return `line ${line + 1}, character ${character + 1}: ${node.getText()}`;
|
|
26
|
-
});
|
|
27
|
-
return (0, prompts_1.createUnsupportedZoneUsagesMessage)(locations, sourceFile.fileName);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Finds usages of `NgZone` that are not supported in zoneless applications.
|
|
31
|
-
* @param sourceFile The source file to check.
|
|
32
|
-
* @param ngZoneImport The import specifier for `NgZone`.
|
|
33
|
-
* @returns A list of nodes that are unsupported `NgZone` usages.
|
|
34
|
-
*/
|
|
35
|
-
async function findUnsupportedZoneUsages(sourceFile, ngZoneImport) {
|
|
36
|
-
const unsupportedUsages = [];
|
|
37
|
-
const ngZoneClassName = ngZoneImport.name.text;
|
|
38
|
-
const staticMethods = new Set([
|
|
39
|
-
'isInAngularZone',
|
|
40
|
-
'assertInAngularZone',
|
|
41
|
-
'assertNotInAngularZone',
|
|
42
|
-
]);
|
|
43
|
-
const instanceMethods = new Set(['onMicrotaskEmpty', 'onStable']);
|
|
44
|
-
const ts = await (0, ts_utils_1.loadTypescript)();
|
|
45
|
-
ts.forEachChild(sourceFile, function visit(node) {
|
|
46
|
-
if (ts.isPropertyAccessExpression(node)) {
|
|
47
|
-
const propertyName = node.name.text;
|
|
48
|
-
const expressionText = node.expression.getText(sourceFile);
|
|
49
|
-
// Static: NgZone.method()
|
|
50
|
-
if (expressionText === ngZoneClassName && staticMethods.has(propertyName)) {
|
|
51
|
-
unsupportedUsages.push(node);
|
|
52
|
-
}
|
|
53
|
-
// Instance: zone.method() or this.zone.method()
|
|
54
|
-
if (instanceMethods.has(propertyName)) {
|
|
55
|
-
unsupportedUsages.push(node);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
ts.forEachChild(node, visit);
|
|
59
|
-
});
|
|
60
|
-
return unsupportedUsages;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=analyze-for-unsupported-zone-uses.js.map
|
package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-for-unsupported-zone-uses.js","sourceRoot":"","sources":["analyze-for-unsupported-zone-uses.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,sEAoBC;AAQD,8DAkCC;AAlED,uCAA+D;AAC/D,yCAAgE;AAGzD,KAAK,UAAU,6BAA6B,CACjD,UAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,IAAA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