@capyclaw/publisher 0.1.3 → 0.1.4
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/package.json +3 -11
- package/server/archive.mjs +69 -35
- package/server/drop.mjs +9 -3
- package/server/impl.mjs +133 -97
- package/server/tools.mjs +1 -1
- package/node_modules/@capyclaw/foundation/README.md +0 -51
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +0 -86
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +0 -63
- package/node_modules/@capyclaw/foundation/abi/index.mjs +0 -35
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +0 -271
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +0 -345
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +0 -98
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +0 -255
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +0 -24
- package/node_modules/@capyclaw/foundation/abi/version.mjs +0 -82
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +0 -5
- package/node_modules/@capyclaw/foundation/kit/index.mjs +0 -6
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +0 -98
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +0 -35
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +0 -69
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +0 -55
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +0 -113
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +0 -68
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +0 -113
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +0 -77
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +0 -56
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +0 -50
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +0 -64
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +0 -42
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +0 -34
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +0 -85
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +0 -50
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +0 -160
- package/node_modules/@capyclaw/foundation/lib/host.mjs +0 -23
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +0 -185
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +0 -87
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +0 -60
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +0 -51
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +0 -188
- package/node_modules/@capyclaw/foundation/package.json +0 -53
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +0 -20
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +0 -100
- package/node_modules/@capyclaw/plugin-kit/README.md +0 -70
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +0 -103
- package/node_modules/@capyclaw/plugin-kit/package.json +0 -69
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +0 -56
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +0 -142
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +0 -129
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +0 -139
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +0 -219
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +0 -13
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +0 -13
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +0 -230
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +0 -128
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +0 -307
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +0 -45
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +0 -113
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +0 -150
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +0 -131
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +0 -82
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +0 -109
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +0 -17
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +0 -89
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +0 -57
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +0 -150
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +0 -82
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +0 -132
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +0 -130
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +0 -656
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +0 -181
- package/node_modules/@capyclaw/plugin-validator/bin/cli.mjs +0 -49
- package/node_modules/@capyclaw/plugin-validator/lib/index.mjs +0 -303
- package/node_modules/@capyclaw/plugin-validator/package.json +0 -28
- package/node_modules/@capyclaw/tool-host/README.md +0 -56
- package/node_modules/@capyclaw/tool-host/cordis.patch.yml +0 -4
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +0 -30
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +0 -16
- package/node_modules/@capyclaw/tool-host/package.json +0 -59
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +0 -166
- package/node_modules/@capyclaw/tool-host/src/index.mjs +0 -416
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -680
- package/node_modules/semver/bin/semver.js +0 -195
- package/node_modules/semver/classes/comparator.js +0 -143
- package/node_modules/semver/classes/index.js +0 -7
- package/node_modules/semver/classes/range.js +0 -577
- package/node_modules/semver/classes/semver.js +0 -350
- package/node_modules/semver/functions/clean.js +0 -8
- package/node_modules/semver/functions/cmp.js +0 -54
- package/node_modules/semver/functions/coerce.js +0 -62
- package/node_modules/semver/functions/compare-build.js +0 -9
- package/node_modules/semver/functions/compare-loose.js +0 -5
- package/node_modules/semver/functions/compare.js +0 -7
- package/node_modules/semver/functions/diff.js +0 -60
- package/node_modules/semver/functions/eq.js +0 -5
- package/node_modules/semver/functions/gt.js +0 -5
- package/node_modules/semver/functions/gte.js +0 -5
- package/node_modules/semver/functions/inc.js +0 -21
- package/node_modules/semver/functions/lt.js +0 -5
- package/node_modules/semver/functions/lte.js +0 -5
- package/node_modules/semver/functions/major.js +0 -5
- package/node_modules/semver/functions/minor.js +0 -5
- package/node_modules/semver/functions/neq.js +0 -5
- package/node_modules/semver/functions/parse.js +0 -18
- package/node_modules/semver/functions/patch.js +0 -5
- package/node_modules/semver/functions/prerelease.js +0 -8
- package/node_modules/semver/functions/rcompare.js +0 -5
- package/node_modules/semver/functions/rsort.js +0 -5
- package/node_modules/semver/functions/satisfies.js +0 -12
- package/node_modules/semver/functions/sort.js +0 -5
- package/node_modules/semver/functions/truncate.js +0 -48
- package/node_modules/semver/functions/valid.js +0 -8
- package/node_modules/semver/index.js +0 -93
- package/node_modules/semver/internal/constants.js +0 -67
- package/node_modules/semver/internal/debug.js +0 -11
- package/node_modules/semver/internal/identifiers.js +0 -29
- package/node_modules/semver/internal/lrucache.js +0 -42
- package/node_modules/semver/internal/parse-options.js +0 -17
- package/node_modules/semver/internal/re.js +0 -223
- package/node_modules/semver/internal/trim-comparator-whitespace.js +0 -438
- package/node_modules/semver/package.json +0 -78
- package/node_modules/semver/preload.js +0 -4
- package/node_modules/semver/range.bnf +0 -17
- package/node_modules/semver/ranges/gtr.js +0 -6
- package/node_modules/semver/ranges/intersects.js +0 -9
- package/node_modules/semver/ranges/ltr.js +0 -6
- package/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/node_modules/semver/ranges/min-version.js +0 -63
- package/node_modules/semver/ranges/outside.js +0 -82
- package/node_modules/semver/ranges/simplify.js +0 -49
- package/node_modules/semver/ranges/subset.js +0 -249
- package/node_modules/semver/ranges/to-comparators.js +0 -10
- package/node_modules/semver/ranges/valid.js +0 -13
- package/node_modules/yaml/LICENSE +0 -13
- package/node_modules/yaml/README.md +0 -172
- package/node_modules/yaml/bin.mjs +0 -11
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -88
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -43
- package/node_modules/yaml/browser/dist/compose/compose-node.js +0 -109
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -86
- package/node_modules/yaml/browser/dist/compose/composer.js +0 -219
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -115
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -198
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -49
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -37
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -207
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -226
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -146
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -34
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -26
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -15
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -13
- package/node_modules/yaml/browser/dist/doc/Document.js +0 -335
- package/node_modules/yaml/browser/dist/doc/anchors.js +0 -71
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -55
- package/node_modules/yaml/browser/dist/doc/createNode.js +0 -88
- package/node_modules/yaml/browser/dist/doc/directives.js +0 -176
- package/node_modules/yaml/browser/dist/errors.js +0 -57
- package/node_modules/yaml/browser/dist/index.js +0 -17
- package/node_modules/yaml/browser/dist/log.js +0 -11
- package/node_modules/yaml/browser/dist/nodes/Alias.js +0 -118
- package/node_modules/yaml/browser/dist/nodes/Collection.js +0 -147
- package/node_modules/yaml/browser/dist/nodes/Node.js +0 -38
- package/node_modules/yaml/browser/dist/nodes/Pair.js +0 -36
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -144
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -113
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -63
- package/node_modules/yaml/browser/dist/nodes/identity.js +0 -36
- package/node_modules/yaml/browser/dist/nodes/toJS.js +0 -37
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -214
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +0 -61
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -97
- package/node_modules/yaml/browser/dist/parse/cst.js +0 -98
- package/node_modules/yaml/browser/dist/parse/lexer.js +0 -721
- package/node_modules/yaml/browser/dist/parse/line-counter.js +0 -39
- package/node_modules/yaml/browser/dist/parse/parser.js +0 -975
- package/node_modules/yaml/browser/dist/public-api.js +0 -102
- package/node_modules/yaml/browser/dist/schema/Schema.js +0 -37
- package/node_modules/yaml/browser/dist/schema/common/map.js +0 -17
- package/node_modules/yaml/browser/dist/schema/common/null.js +0 -15
- package/node_modules/yaml/browser/dist/schema/common/seq.js +0 -17
- package/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
- package/node_modules/yaml/browser/dist/schema/core/bool.js +0 -19
- package/node_modules/yaml/browser/dist/schema/core/float.js +0 -43
- package/node_modules/yaml/browser/dist/schema/core/int.js +0 -38
- package/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
- package/node_modules/yaml/browser/dist/schema/json/schema.js +0 -62
- package/node_modules/yaml/browser/dist/schema/tags.js +0 -96
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -58
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -26
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -46
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -71
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -67
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -74
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -78
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -93
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -101
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -146
- package/node_modules/yaml/browser/dist/stringify/stringify.js +0 -129
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -153
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -20
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -85
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -25
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -150
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -336
- package/node_modules/yaml/browser/dist/util.js +0 -11
- package/node_modules/yaml/browser/dist/visit.js +0 -233
- package/node_modules/yaml/browser/index.js +0 -5
- package/node_modules/yaml/browser/package.json +0 -3
- package/node_modules/yaml/dist/cli.d.ts +0 -8
- package/node_modules/yaml/dist/cli.mjs +0 -201
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +0 -11
- package/node_modules/yaml/dist/compose/compose-collection.js +0 -90
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +0 -7
- package/node_modules/yaml/dist/compose/compose-doc.js +0 -45
- package/node_modules/yaml/dist/compose/compose-node.d.ts +0 -29
- package/node_modules/yaml/dist/compose/compose-node.js +0 -112
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +0 -5
- package/node_modules/yaml/dist/compose/compose-scalar.js +0 -88
- package/node_modules/yaml/dist/compose/composer.d.ts +0 -63
- package/node_modules/yaml/dist/compose/composer.js +0 -224
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-block-map.js +0 -117
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +0 -11
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +0 -200
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +0 -51
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-end.js +0 -39
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +0 -7
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +0 -209
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +0 -10
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +0 -228
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +0 -23
- package/node_modules/yaml/dist/compose/resolve-props.js +0 -148
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +0 -2
- package/node_modules/yaml/dist/compose/util-contains-newline.js +0 -36
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +0 -2
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +0 -28
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +0 -3
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +0 -17
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +0 -4
- package/node_modules/yaml/dist/compose/util-map-includes.js +0 -15
- package/node_modules/yaml/dist/doc/Document.d.ts +0 -141
- package/node_modules/yaml/dist/doc/Document.js +0 -337
- package/node_modules/yaml/dist/doc/anchors.d.ts +0 -24
- package/node_modules/yaml/dist/doc/anchors.js +0 -76
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +0 -9
- package/node_modules/yaml/dist/doc/applyReviver.js +0 -57
- package/node_modules/yaml/dist/doc/createNode.d.ts +0 -17
- package/node_modules/yaml/dist/doc/createNode.js +0 -90
- package/node_modules/yaml/dist/doc/directives.d.ts +0 -49
- package/node_modules/yaml/dist/doc/directives.js +0 -178
- package/node_modules/yaml/dist/errors.d.ts +0 -21
- package/node_modules/yaml/dist/errors.js +0 -62
- package/node_modules/yaml/dist/index.d.ts +0 -25
- package/node_modules/yaml/dist/index.js +0 -50
- package/node_modules/yaml/dist/log.d.ts +0 -3
- package/node_modules/yaml/dist/log.js +0 -19
- package/node_modules/yaml/dist/nodes/Alias.d.ts +0 -29
- package/node_modules/yaml/dist/nodes/Alias.js +0 -120
- package/node_modules/yaml/dist/nodes/Collection.d.ts +0 -73
- package/node_modules/yaml/dist/nodes/Collection.js +0 -151
- package/node_modules/yaml/dist/nodes/Node.d.ts +0 -53
- package/node_modules/yaml/dist/nodes/Node.js +0 -40
- package/node_modules/yaml/dist/nodes/Pair.d.ts +0 -22
- package/node_modules/yaml/dist/nodes/Pair.js +0 -39
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +0 -47
- package/node_modules/yaml/dist/nodes/Scalar.js +0 -27
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +0 -53
- package/node_modules/yaml/dist/nodes/YAMLMap.js +0 -147
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +0 -60
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +0 -115
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +0 -4
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +0 -65
- package/node_modules/yaml/dist/nodes/identity.d.ts +0 -23
- package/node_modules/yaml/dist/nodes/identity.js +0 -53
- package/node_modules/yaml/dist/nodes/toJS.d.ts +0 -29
- package/node_modules/yaml/dist/nodes/toJS.js +0 -39
- package/node_modules/yaml/dist/options.d.ts +0 -350
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +0 -64
- package/node_modules/yaml/dist/parse/cst-scalar.js +0 -218
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +0 -8
- package/node_modules/yaml/dist/parse/cst-stringify.js +0 -63
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +0 -39
- package/node_modules/yaml/dist/parse/cst-visit.js +0 -99
- package/node_modules/yaml/dist/parse/cst.d.ts +0 -109
- package/node_modules/yaml/dist/parse/cst.js +0 -112
- package/node_modules/yaml/dist/parse/lexer.d.ts +0 -87
- package/node_modules/yaml/dist/parse/lexer.js +0 -723
- package/node_modules/yaml/dist/parse/line-counter.d.ts +0 -22
- package/node_modules/yaml/dist/parse/line-counter.js +0 -41
- package/node_modules/yaml/dist/parse/parser.d.ts +0 -84
- package/node_modules/yaml/dist/parse/parser.js +0 -980
- package/node_modules/yaml/dist/public-api.d.ts +0 -44
- package/node_modules/yaml/dist/public-api.js +0 -107
- package/node_modules/yaml/dist/schema/Schema.d.ts +0 -17
- package/node_modules/yaml/dist/schema/Schema.js +0 -39
- package/node_modules/yaml/dist/schema/common/map.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/map.js +0 -19
- package/node_modules/yaml/dist/schema/common/null.d.ts +0 -4
- package/node_modules/yaml/dist/schema/common/null.js +0 -17
- package/node_modules/yaml/dist/schema/common/seq.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/seq.js +0 -19
- package/node_modules/yaml/dist/schema/common/string.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/string.js +0 -16
- package/node_modules/yaml/dist/schema/core/bool.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/bool.js +0 -21
- package/node_modules/yaml/dist/schema/core/float.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/float.js +0 -47
- package/node_modules/yaml/dist/schema/core/int.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/int.js +0 -42
- package/node_modules/yaml/dist/schema/core/schema.d.ts +0 -1
- package/node_modules/yaml/dist/schema/core/schema.js +0 -25
- package/node_modules/yaml/dist/schema/json/schema.d.ts +0 -2
- package/node_modules/yaml/dist/schema/json/schema.js +0 -64
- package/node_modules/yaml/dist/schema/json-schema.d.ts +0 -69
- package/node_modules/yaml/dist/schema/tags.d.ts +0 -48
- package/node_modules/yaml/dist/schema/tags.js +0 -99
- package/node_modules/yaml/dist/schema/types.d.ts +0 -92
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +0 -2
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +0 -70
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +0 -7
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +0 -29
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +0 -4
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +0 -50
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +0 -5
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +0 -76
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +0 -9
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +0 -71
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +0 -22
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +0 -77
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +0 -10
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +0 -82
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +0 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +0 -41
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +0 -28
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +0 -96
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +0 -6
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +0 -105
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +0 -34
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +0 -151
- package/node_modules/yaml/dist/stringify/stringify.d.ts +0 -21
- package/node_modules/yaml/dist/stringify/stringify.js +0 -132
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +0 -17
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +0 -155
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +0 -10
- package/node_modules/yaml/dist/stringify/stringifyComment.js +0 -24
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +0 -4
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +0 -87
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +0 -2
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +0 -27
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +0 -3
- package/node_modules/yaml/dist/stringify/stringifyPair.js +0 -152
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +0 -9
- package/node_modules/yaml/dist/stringify/stringifyString.js +0 -338
- package/node_modules/yaml/dist/test-events.d.ts +0 -4
- package/node_modules/yaml/dist/test-events.js +0 -134
- package/node_modules/yaml/dist/util.d.ts +0 -16
- package/node_modules/yaml/dist/util.js +0 -28
- package/node_modules/yaml/dist/visit.d.ts +0 -102
- package/node_modules/yaml/dist/visit.js +0 -236
- package/node_modules/yaml/package.json +0 -97
- package/node_modules/yaml/util.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/publisher",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "npm 发布器:插件页里把打包好的插件包拖进来就能发布或更新到 npm,发布后可就地更新本机安装;同时保留 publisher_* 原生工具做批量预演与真发布",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./plugin.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@capyclaw/plugin-kit": "^0.2.0",
|
|
45
45
|
"@capyclaw/plugin-validator": "^1.0.0",
|
|
46
|
-
"@capyclaw/tool-host": "^0.
|
|
46
|
+
"@capyclaw/tool-host": "^0.3.0",
|
|
47
47
|
"@capyclaw/foundation": "^0.1.1"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
@@ -68,13 +68,5 @@
|
|
|
68
68
|
"bugs": {
|
|
69
69
|
"url": "https://github.com/Maple496/capyclaw/issues"
|
|
70
70
|
},
|
|
71
|
-
"homepage": "https://github.com/Maple496/capyclaw/tree/main/B/official/capyclaw-publisher#readme"
|
|
72
|
-
"bundledDependencies": [
|
|
73
|
-
"@capyclaw/foundation",
|
|
74
|
-
"@capyclaw/plugin-kit",
|
|
75
|
-
"@capyclaw/plugin-validator",
|
|
76
|
-
"@capyclaw/tool-host",
|
|
77
|
-
"semver",
|
|
78
|
-
"yaml"
|
|
79
|
-
]
|
|
71
|
+
"homepage": "https://github.com/Maple496/capyclaw/tree/main/B/official/capyclaw-publisher#readme"
|
|
80
72
|
}
|
package/server/archive.mjs
CHANGED
|
@@ -10,14 +10,26 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import path from 'node:path'
|
|
12
12
|
import os from 'node:os'
|
|
13
|
-
import { mkdir, writeFile } from 'node:fs/promises'
|
|
13
|
+
import { mkdir, rename, rm, writeFile } from 'node:fs/promises'
|
|
14
14
|
import { gunzipSync, inflateRawSync } from 'node:zlib'
|
|
15
15
|
|
|
16
16
|
const MAX_DEPTH = 3
|
|
17
|
+
/* 解压上限(与 @capyclaw/plugin-drop 的 archive.js 同源):zip bomb 靠「压缩态很小、
|
|
18
|
+
* 解压态巨大」吃光内存,必须在解压这一步就掐断,而不是等落盘。 */
|
|
19
|
+
const MAX_UNPACKED_BYTES = 128 * 1024 * 1024
|
|
20
|
+
const MAX_ENTRIES = 4096
|
|
21
|
+
|
|
22
|
+
function tooManyEntries() {
|
|
23
|
+
return new Error(`压缩包里的文件太多,超出 ${MAX_ENTRIES} 的上限。`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function tooLarge() {
|
|
27
|
+
return new Error(`压缩包解压后超过 ${Math.round(MAX_UNPACKED_BYTES / 1024 / 1024)} MB 上限。`)
|
|
28
|
+
}
|
|
17
29
|
|
|
18
30
|
/** 读 .zip / .tgz / .tar.gz(或裸 .tar)为一个扁平条目表。 */
|
|
19
31
|
export function unpack(buffer, filename) {
|
|
20
|
-
if (buffer.length > 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) return untar(gunzipSync(buffer))
|
|
32
|
+
if (buffer.length > 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) return untar(gunzipSync(buffer, { maxOutputLength: MAX_UNPACKED_BYTES }))
|
|
21
33
|
if (buffer.length > 4 && buffer[0] === 0x50 && buffer[1] === 0x4b && buffer[2] === 0x03 && buffer[3] === 0x04) {
|
|
22
34
|
return unzip(buffer)
|
|
23
35
|
}
|
|
@@ -33,6 +45,7 @@ function untar(buffer) {
|
|
|
33
45
|
while (offset + 512 <= buffer.length) {
|
|
34
46
|
const header = buffer.subarray(offset, offset + 512)
|
|
35
47
|
if (header.every((byte) => byte === 0)) break
|
|
48
|
+
if (entries.length >= MAX_ENTRIES) throw tooManyEntries()
|
|
36
49
|
|
|
37
50
|
const name = readCString(header, 0, 100)
|
|
38
51
|
const prefix = readCString(header, 345, 155)
|
|
@@ -90,9 +103,11 @@ function unzip(buffer) {
|
|
|
90
103
|
const directoryOffset = buffer.readUInt32LE(eocd + 16)
|
|
91
104
|
const entries = []
|
|
92
105
|
let cursor = directoryOffset
|
|
106
|
+
let total = 0
|
|
93
107
|
|
|
94
108
|
for (let index = 0; index < count; index += 1) {
|
|
95
109
|
if (cursor + 46 > buffer.length || buffer.readUInt32LE(cursor) !== 0x02014b50) break
|
|
110
|
+
if (entries.length >= MAX_ENTRIES) throw tooManyEntries()
|
|
96
111
|
const method = buffer.readUInt16LE(cursor + 10)
|
|
97
112
|
const compressedSize = buffer.readUInt32LE(cursor + 20)
|
|
98
113
|
const nameLength = buffer.readUInt16LE(cursor + 28)
|
|
@@ -114,9 +129,17 @@ function unzip(buffer) {
|
|
|
114
129
|
const raw = buffer.subarray(dataStart, Math.min(dataStart + compressedSize, buffer.length))
|
|
115
130
|
|
|
116
131
|
let data
|
|
117
|
-
if (method === 0)
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
if (method === 0) {
|
|
133
|
+
if (total + raw.length > MAX_UNPACKED_BYTES) throw tooLarge()
|
|
134
|
+
data = Buffer.from(raw)
|
|
135
|
+
total += raw.length
|
|
136
|
+
} else if (method === 8) {
|
|
137
|
+
/* 剩余配额逐条目递减:炸弹不必是单个大文件,几个「看似无害」的条目加起来
|
|
138
|
+
* 也能超限。配额为 0 时 maxOutputLength 会报 ERR_OUT_OF_RANGE,先拦下给可读错误。 */
|
|
139
|
+
if (total >= MAX_UNPACKED_BYTES) throw tooLarge()
|
|
140
|
+
data = inflateRawSync(raw, { maxOutputLength: MAX_UNPACKED_BYTES - total })
|
|
141
|
+
total += data.length
|
|
142
|
+
} else throw new Error(`不支持的 ZIP 压缩方式(method ${method})。`)
|
|
120
143
|
|
|
121
144
|
entries.push({ path: name, data })
|
|
122
145
|
}
|
|
@@ -208,47 +231,58 @@ export function storeRoot() {
|
|
|
208
231
|
}
|
|
209
232
|
|
|
210
233
|
/**
|
|
211
|
-
*
|
|
234
|
+
* 新 staging 目录的候选名。时间戳之外再挂随机后缀:两个请求落在同一毫秒时
|
|
212
235
|
* 不会写进同一个目录(否则后到的包会污染前一个包的文件清单)。
|
|
213
236
|
*/
|
|
214
|
-
|
|
237
|
+
function stageCandidate() {
|
|
238
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-')
|
|
239
|
+
const suffix = Math.random().toString(36).slice(2, 8)
|
|
240
|
+
return path.join(storeRoot(), `${stamp}-${suffix}`)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 把条目表写到 staging 下的一个新目录,返回包目录的绝对路径。
|
|
245
|
+
* 先全部写进 .tmp- 目录、成功后原子 rename 成正式名:写一半失败不会留下
|
|
246
|
+
* 「看似有效却缺文件」的 staging(那会被预检/发布当成真包);失败时清掉 tmp,
|
|
247
|
+
* 磁盘上不落垃圾。与 plugin-drop 的差别:这里每次上传都要独立目录(发布后回收),
|
|
248
|
+
* 不做内容地址化复用。
|
|
249
|
+
*/
|
|
250
|
+
export async function materialize(entries, packageDir) {
|
|
215
251
|
await mkdir(storeRoot(), { recursive: true })
|
|
216
252
|
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const candidate = path.join(storeRoot(), `${stamp}-${suffix}`)
|
|
253
|
+
const base = stageCandidate()
|
|
254
|
+
const tmp = `${base}.tmp-${process.pid}`
|
|
220
255
|
try {
|
|
221
|
-
await mkdir(
|
|
222
|
-
|
|
256
|
+
await mkdir(tmp)
|
|
257
|
+
try {
|
|
258
|
+
for (const entry of entries) {
|
|
259
|
+
const relative = safeRelative(entry.path)
|
|
260
|
+
if (!relative) continue
|
|
261
|
+
const target = path.join(tmp, ...relative.split('/'))
|
|
262
|
+
if (!isInside(tmp, target)) continue
|
|
263
|
+
if (entry.dir) {
|
|
264
|
+
await mkdir(target, { recursive: true })
|
|
265
|
+
continue
|
|
266
|
+
}
|
|
267
|
+
await mkdir(path.dirname(target), { recursive: true })
|
|
268
|
+
await writeFile(target, entry.data)
|
|
269
|
+
}
|
|
270
|
+
if (packageDir) await mkdir(path.join(tmp, ...packageDir.split('/')), { recursive: true })
|
|
271
|
+
await rename(tmp, base)
|
|
272
|
+
} catch (error) {
|
|
273
|
+
await rm(tmp, { recursive: true, force: true }).catch(() => {})
|
|
274
|
+
throw error
|
|
275
|
+
}
|
|
276
|
+
return packageDir ? path.join(base, ...packageDir.split('/')) : base
|
|
223
277
|
} catch (error) {
|
|
224
|
-
|
|
278
|
+
/* 撞名(EEXIST):换一个候选名重试;其它错误原样抛出。 */
|
|
279
|
+
if (error?.code === 'EEXIST' && attempt < 4) continue
|
|
280
|
+
throw error
|
|
225
281
|
}
|
|
226
282
|
}
|
|
227
283
|
throw new Error(`无法在 ${storeRoot()} 下创建临时目录,请检查磁盘权限。`)
|
|
228
284
|
}
|
|
229
285
|
|
|
230
|
-
/** 把条目表写到 staging 下的一个新目录,返回包目录的绝对路径。 */
|
|
231
|
-
export async function materialize(entries, packageDir) {
|
|
232
|
-
const base = await createStageDir()
|
|
233
|
-
|
|
234
|
-
for (const entry of entries) {
|
|
235
|
-
const relative = safeRelative(entry.path)
|
|
236
|
-
if (!relative) continue
|
|
237
|
-
const target = path.join(base, ...relative.split('/'))
|
|
238
|
-
if (!isInside(base, target)) continue
|
|
239
|
-
if (entry.dir) {
|
|
240
|
-
await mkdir(target, { recursive: true })
|
|
241
|
-
continue
|
|
242
|
-
}
|
|
243
|
-
await mkdir(path.dirname(target), { recursive: true })
|
|
244
|
-
await writeFile(target, entry.data)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const target = packageDir ? path.join(base, ...packageDir.split('/')) : base
|
|
248
|
-
await mkdir(target, { recursive: true })
|
|
249
|
-
return target
|
|
250
|
-
}
|
|
251
|
-
|
|
252
286
|
function isInside(parent, target) {
|
|
253
287
|
const relative = path.relative(parent, target)
|
|
254
288
|
return relative !== '' && !relative.startsWith('..') && !path.isAbsolute(relative)
|
package/server/drop.mjs
CHANGED
|
@@ -64,8 +64,9 @@ export function npmRun(args, options = {}) {
|
|
|
64
64
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
65
65
|
})
|
|
66
66
|
} catch (error) {
|
|
67
|
-
finish
|
|
67
|
+
/* 先赋值再 finish:finish 会立刻 resolve Promise,后赋值 stderr 就丢了。 */
|
|
68
68
|
stderr = messageOf(error)
|
|
69
|
+
finish(-1)
|
|
69
70
|
return
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -87,6 +88,11 @@ export function npmRun(args, options = {}) {
|
|
|
87
88
|
})
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
/* 与 routes.mjs 的 messageOf 同形:spawn 同步抛错与 child 'error' 事件都要用它。 */
|
|
92
|
+
function messageOf(error) {
|
|
93
|
+
return error instanceof Error ? error.message : String(error)
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
const delay = (ms) => new Promise((resolve) => { setTimeout(resolve, ms) })
|
|
91
97
|
|
|
92
98
|
// ---------------------------------------------------------------------------
|
|
@@ -266,7 +272,6 @@ export async function previewStage(stage, { npm = npmRun, cacheTtlMs } = {}) {
|
|
|
266
272
|
blocking,
|
|
267
273
|
warnings,
|
|
268
274
|
description: typeof pkg.description === 'string' ? pkg.description : '',
|
|
269
|
-
stagedDir: stage.dir,
|
|
270
275
|
}
|
|
271
276
|
}
|
|
272
277
|
|
|
@@ -334,7 +339,8 @@ export async function publishStage(stage, {
|
|
|
334
339
|
|
|
335
340
|
for (let attempt = 0; attempt < verifyAttempts; attempt += 1) {
|
|
336
341
|
const check = await npm(['view', `${pkg.name}@${version}`, 'version'], { timeout: 30000 })
|
|
337
|
-
|
|
342
|
+
/* 精确匹配:startsWith 会把 1.0.10 当成 1.0.1 回读成功(与 impl.mjs alreadyPublished 同形)。 */
|
|
343
|
+
if (check.status === 0 && String(check.stdout).trim() === version) {
|
|
338
344
|
forgetPublished(pkg.name)
|
|
339
345
|
return {
|
|
340
346
|
ok: true,
|
package/server/impl.mjs
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
* - root(要发布的仓库 checkout)是调用参数,不再是模块常量;
|
|
10
10
|
* - npm view / npm pack 的缓存挂在每次调用的 context 上(服务进程长驻,避免跨调用串味);
|
|
11
11
|
* - 新增轻量 pack 闸(npm pack --dry-run 断言 package.json/main/patch 必在包内),
|
|
12
|
-
* 顶替原 scripts/verify-publishable.mjs
|
|
12
|
+
* 顶替原 scripts/verify-publishable.mjs 的核心保护;
|
|
13
|
+
* - npm/tar 子进程全部异步 spawn(spawnSync 会把宿主事件循环钉死,
|
|
14
|
+
* 与 README「npm 调用全部异步」的承诺矛盾),结果结构与 spawnSync 同形。
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
|
-
import {
|
|
17
|
+
import { spawn } from 'node:child_process'
|
|
16
18
|
import crypto from 'node:crypto'
|
|
17
19
|
import fs from 'node:fs'
|
|
18
20
|
import os from 'node:os'
|
|
@@ -153,39 +155,96 @@ export function pkgOf(dir) {
|
|
|
153
155
|
|
|
154
156
|
/** npm 直调(node npm-cli.js,不走 shell):含空格的临时/用户目录不会被拆词。 */
|
|
155
157
|
const NPM_CLI = path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
156
|
-
|
|
158
|
+
|
|
159
|
+
/** 异步 spawn + 收集 stdout/stderr,resolve 与 spawnSync 同形的结果
|
|
160
|
+
* ({ status, signal, stdout, stderr, error? },stdout/stderr 恒为 utf8 字符串)。
|
|
161
|
+
* 子进程运行期间事件循环不被阻塞——健康探活/聊天流/插件页照常响应。
|
|
162
|
+
* spawn 同步抛错或 child 'error' 事件都不 reject:与 spawnSync 一样返回
|
|
163
|
+
* status: null + error,调用方统一按 status !== 0 判失败,错误文案不变。
|
|
164
|
+
* options.timeout(若传入)与 spawnSync 等价:到点 kill 子进程,返回 ETIMEDOUT;
|
|
165
|
+
* 现有调用点都不传 timeout,不引入新行为。 */
|
|
166
|
+
function spawnCapture(command, args, options = {}) {
|
|
167
|
+
const { timeout, killSignal = 'SIGTERM', encoding, ...spawnOptions } = options
|
|
168
|
+
return new Promise((resolve) => {
|
|
169
|
+
let stdout = ''
|
|
170
|
+
let stderr = ''
|
|
171
|
+
let settled = false
|
|
172
|
+
let timedOut = false
|
|
173
|
+
let timer = null
|
|
174
|
+
let child = null
|
|
175
|
+
const finish = (result) => {
|
|
176
|
+
if (settled) return
|
|
177
|
+
settled = true
|
|
178
|
+
if (timer) clearTimeout(timer)
|
|
179
|
+
resolve(result)
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
child = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true, ...spawnOptions })
|
|
183
|
+
} catch (error) {
|
|
184
|
+
/* 先构造结果再 finish:finish 会立刻 resolve Promise,后赋值就丢了。 */
|
|
185
|
+
finish({ status: null, signal: null, stdout, stderr, error })
|
|
186
|
+
return
|
|
187
|
+
}
|
|
188
|
+
child.stdout?.setEncoding('utf8')
|
|
189
|
+
child.stderr?.setEncoding('utf8')
|
|
190
|
+
child.stdout?.on('data', (chunk) => { stdout += chunk })
|
|
191
|
+
child.stderr?.on('data', (chunk) => { stderr += chunk })
|
|
192
|
+
child.on('error', (error) => {
|
|
193
|
+
finish({ status: null, signal: null, stdout, stderr, error })
|
|
194
|
+
})
|
|
195
|
+
/* 'close' 在 stdio 流结束后才触发,此时 stdout/stderr 已收集完整。 */
|
|
196
|
+
child.on('close', (code, signal) => {
|
|
197
|
+
if (timedOut) {
|
|
198
|
+
const error = Object.assign(new Error(`spawn ${command} ETIMEDOUT`), { code: 'ETIMEDOUT' })
|
|
199
|
+
finish({ status: null, signal: signal || killSignal, stdout, stderr, error })
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
finish({ status: code, signal, stdout, stderr })
|
|
203
|
+
})
|
|
204
|
+
if (typeof timeout === 'number' && timeout > 0) {
|
|
205
|
+
timer = setTimeout(() => {
|
|
206
|
+
timedOut = true
|
|
207
|
+
try { child.kill(killSignal) } catch { /* 已经退出 */ }
|
|
208
|
+
}, timeout)
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** 异步 npm 直调:返回 Promise,结果与 spawnSync 同形(status/stdout/stderr/error)。 */
|
|
214
|
+
export async function rawNpmRun(args, options = {}) {
|
|
157
215
|
if (fs.existsSync(NPM_CLI)) {
|
|
158
|
-
return
|
|
216
|
+
return spawnCapture(process.execPath, [NPM_CLI, ...args], options)
|
|
159
217
|
}
|
|
160
|
-
return
|
|
218
|
+
return spawnCapture('npm', args, { shell: process.platform === 'win32', ...options })
|
|
161
219
|
}
|
|
162
220
|
|
|
163
221
|
function createNpmContext() {
|
|
164
|
-
/** npm view 结果缓存:同一次运行里同一 specifier 只查一次。
|
|
222
|
+
/** npm view 结果缓存:同一次运行里同一 specifier 只查一次。
|
|
223
|
+
* 缓存的是 Promise:并发调用共享同一次查询,语义与同步版一致。 */
|
|
165
224
|
const viewCache = new Map()
|
|
166
225
|
const npmView = (spec, field) => {
|
|
167
226
|
const key = `${spec}|${field}`
|
|
168
227
|
if (!viewCache.has(key)) viewCache.set(key, rawNpmRun(['view', spec, field]))
|
|
169
228
|
return viewCache.get(key)
|
|
170
229
|
}
|
|
171
|
-
const alreadyPublished = (name, version) => {
|
|
172
|
-
const r = npmView(`${name}@${version}`, 'version')
|
|
230
|
+
const alreadyPublished = async (name, version) => {
|
|
231
|
+
const r = await npmView(`${name}@${version}`, 'version')
|
|
173
232
|
if (r.status !== 0) return false
|
|
174
233
|
return String(r.stdout).trim() === version
|
|
175
234
|
}
|
|
176
235
|
/** registry 上已发布 tarball 的 sha1(拿不到返回 null,网络闪断降级为警告)。 */
|
|
177
|
-
const npmShasumOf = (name, version) => {
|
|
178
|
-
const r = npmView(`${name}@${version}`, 'dist.shasum')
|
|
236
|
+
const npmShasumOf = async (name, version) => {
|
|
237
|
+
const r = await npmView(`${name}@${version}`, 'dist.shasum')
|
|
179
238
|
if (r.status !== 0) return null
|
|
180
239
|
return String(r.stdout).trim() || null
|
|
181
240
|
}
|
|
182
241
|
/** 本地 npm pack 产物的 sha1(npm pack 确定性:同内容同哈希)。结果按目录缓存。 */
|
|
183
242
|
const localShasumCache = new Map()
|
|
184
|
-
const localShasumOf = (dir) => {
|
|
243
|
+
const localShasumOf = async (dir) => {
|
|
185
244
|
if (localShasumCache.has(dir)) return localShasumCache.get(dir)
|
|
186
245
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'pub-sha-'))
|
|
187
246
|
try {
|
|
188
|
-
const pack = rawNpmRun(['pack', '--pack-destination', tmp], { cwd: dir })
|
|
247
|
+
const pack = await rawNpmRun(['pack', '--pack-destination', tmp], { cwd: dir })
|
|
189
248
|
if (pack.status !== 0) return null
|
|
190
249
|
const tgz = path.join(tmp, String(pack.stdout).trim().split(/\r?\n/).pop())
|
|
191
250
|
const sha = crypto.createHash('sha1').update(fs.readFileSync(tgz)).digest('hex')
|
|
@@ -204,7 +263,7 @@ function createNpmContext() {
|
|
|
204
263
|
* 自包含例外:列在 bundledDependencies 里的依赖**已经实体在 tarball 内**,
|
|
205
264
|
* 安装时 npm/pnpm 用包内副本、根本不会去 registry 解析。这类依赖不该被本闸拦下
|
|
206
265
|
* ——否则「全自包含」的包反而会因为成员尚未上架而发不出去。 */
|
|
207
|
-
export function orderGate(pkg, localMap, batch, npm) {
|
|
266
|
+
export async function orderGate(pkg, localMap, batch, npm) {
|
|
208
267
|
const errors = []
|
|
209
268
|
const warnings = []
|
|
210
269
|
const bundled = new Set([
|
|
@@ -223,7 +282,7 @@ export function orderGate(pkg, localMap, batch, npm) {
|
|
|
223
282
|
if (local) queue.push(local.pkg) /* 闭包继续沿本仓包展开 */
|
|
224
283
|
/* 已随包携带:安装侧不查 registry,无需顺序约束。 */
|
|
225
284
|
if (bundled.has(name)) continue
|
|
226
|
-
const resolvable = npm.npmView(`${name}@${range}`, 'version')
|
|
285
|
+
const resolvable = await npm.npmView(`${name}@${range}`, 'version')
|
|
227
286
|
if (resolvable.status === 0) continue /* ① registry 已可解析 */
|
|
228
287
|
if (batch.has(name)) {
|
|
229
288
|
warnings.push(`${name}@${range} registry 暂不可解析,依赖同批发布(确认批次包含它)`)
|
|
@@ -240,26 +299,14 @@ export function orderGate(pkg, localMap, batch, npm) {
|
|
|
240
299
|
* 认证令牌字段的模式用拼接构造,注释里也不写整串,
|
|
241
300
|
* 否则扫描器会把自己的源码当成泄漏(自噬假阳性)。) */
|
|
242
301
|
const AUTH_TOKEN_RE = new RegExp('_auth' + 'Token', 'i')
|
|
243
|
-
/* ownOnly=true 的模式只查「我们自己的代码」(包根文件 + node_modules/@capyclaw 成员)。
|
|
244
|
-
* 第三方 vendored 依赖(playwright/@types/pptxgenjs 等)的上游源码天然带构建机目录路径,
|
|
245
|
-
* 那不是本机凭据泄漏,不该拦发布;凭据形态(API key / npm 令牌 / npmrc 令牌字段)则对所有文件一律查。
|
|
246
|
-
* 注意:本文件自身也会被扫描,注释里切勿写出任何完整的凭据或路径模式字面量(自噬假阳性)。 */
|
|
247
302
|
const SECRET_PATTERNS = [
|
|
248
|
-
[/sk-[A-Za-z0-9]{20,}/, 'API key 形态(sk-…)'
|
|
249
|
-
[/npm_[A-Za-z0-9]{20,}/, 'npm token 形态(npm_…)'
|
|
250
|
-
[AUTH_TOKEN_RE, 'npmrc 认证令牌字段'
|
|
251
|
-
[/[A-Za-z]:\\Users\\/i, '本机绝对路径(盘符:\\Users\\)'
|
|
252
|
-
[/\/(home|Users)\/[A-Za-z0-9._-]+\//, '本机绝对路径(/home/ / /Users/)'
|
|
303
|
+
[/sk-[A-Za-z0-9]{20,}/, 'API key 形态(sk-…)'],
|
|
304
|
+
[/npm_[A-Za-z0-9]{20,}/, 'npm token 形态(npm_…)'],
|
|
305
|
+
[AUTH_TOKEN_RE, 'npmrc 认证令牌字段'],
|
|
306
|
+
[/[A-Za-z]:\\Users\\/i, '本机绝对路径(盘符:\\Users\\)'],
|
|
307
|
+
[/\/(home|Users)\/[A-Za-z0-9._-]+\//, '本机绝对路径(/home/ / /Users/)'],
|
|
253
308
|
]
|
|
254
309
|
|
|
255
|
-
/** 相对路径是否落在第三方 vendored 依赖里(最后一个 node_modules 段之后非 @capyclaw)。 */
|
|
256
|
-
function isThirdPartyVendored(rel) {
|
|
257
|
-
const parts = rel.split(/[\\/]/)
|
|
258
|
-
const i = parts.lastIndexOf('node_modules')
|
|
259
|
-
if (i === -1) return false
|
|
260
|
-
return parts[i + 1] !== '@capyclaw'
|
|
261
|
-
}
|
|
262
|
-
|
|
263
310
|
/** 扫描目录内全部文本文件,返回命中的密钥/本机信息描述串。 */
|
|
264
311
|
export function scanDirForSecrets(root) {
|
|
265
312
|
const hits = []
|
|
@@ -271,11 +318,8 @@ export function scanDirForSecrets(root) {
|
|
|
271
318
|
if (entry.isDirectory()) { walk(file); continue }
|
|
272
319
|
let text = null
|
|
273
320
|
try { text = fs.readFileSync(file, 'utf8') } catch { continue } /* 二进制/不可读跳过 */
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
for (const [pattern, label, ownOnly] of SECRET_PATTERNS) {
|
|
277
|
-
if (ownOnly && thirdParty) continue
|
|
278
|
-
if (pattern.test(text)) hits.push(`${rel}: ${label}`)
|
|
321
|
+
for (const [pattern, label] of SECRET_PATTERNS) {
|
|
322
|
+
if (pattern.test(text)) hits.push(`${path.relative(root, file)}: ${label}`)
|
|
279
323
|
}
|
|
280
324
|
}
|
|
281
325
|
}
|
|
@@ -286,21 +330,16 @@ export function scanDirForSecrets(root) {
|
|
|
286
330
|
/** 轻量 pack 闸:① npm pack --dry-run 断言分发必需文件真的会进包;
|
|
287
331
|
* ② 真实 pack + 解包 + 逐文件扫密钥/本机信息(凭据绝不上 npm)。
|
|
288
332
|
* (顶替原 verify-publishable 的核心断言;干净目录安装级检查不在这里重复。) */
|
|
289
|
-
export function packGateErrors(pkg, dir, npm) {
|
|
333
|
+
export async function packGateErrors(pkg, dir, npm) {
|
|
290
334
|
const mustHave = ['package.json']
|
|
291
335
|
if (pkg.main) mustHave.push(String(pkg.main).replace(/^\.\//, ''))
|
|
292
336
|
const patch = pkg.dsh?.bundle?.patch
|
|
293
337
|
for (const rel of Array.isArray(patch) ? patch : patch ? [patch] : []) {
|
|
294
338
|
mustHave.push(String(rel).replace(/^\.\//, ''))
|
|
295
339
|
}
|
|
296
|
-
if (pkg.dsh?.client)
|
|
297
|
-
/* client 入口由包 exports["./client"] 声明(各包不一:client/client.js、根 client.js、lib/client.js),
|
|
298
|
-
* 不能硬编码 client/client.js;无 exports 时回退约定默认值。 */
|
|
299
|
-
const clientEntry = pkg.exports?.['./client'] || 'client/client.js'
|
|
300
|
-
mustHave.push(String(clientEntry).replace(/^\.\//, ''))
|
|
301
|
-
}
|
|
340
|
+
if (pkg.dsh?.client) mustHave.push('client/client.js')
|
|
302
341
|
if (pkg.dsh?.suite) mustHave.push(String(pkg.dsh.suite).replace(/^\.\//, ''))
|
|
303
|
-
const r = npm.rawNpmRun(['pack', '--dry-run', '--json'], { cwd: dir })
|
|
342
|
+
const r = await npm.rawNpmRun(['pack', '--dry-run', '--json'], { cwd: dir })
|
|
304
343
|
if (r.status !== 0) return [`npm pack --dry-run 失败: ${String(r.stderr || r.stdout || '').trim().slice(0, 200)}`]
|
|
305
344
|
let packed = []
|
|
306
345
|
try {
|
|
@@ -314,10 +353,10 @@ export function packGateErrors(pkg, dir, npm) {
|
|
|
314
353
|
/* 真实 pack + 解包 + 密钥扫描:发布产物里不该有任何凭据/本机信息。 */
|
|
315
354
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'pub-scan-'))
|
|
316
355
|
try {
|
|
317
|
-
const pack = npm.rawNpmRun(['pack', '--pack-destination', tmp], { cwd: dir })
|
|
356
|
+
const pack = await npm.rawNpmRun(['pack', '--pack-destination', tmp], { cwd: dir })
|
|
318
357
|
if (pack.status !== 0) return [...errors, 'npm pack 失败(无法做密钥扫描)']
|
|
319
358
|
const tgz = String(pack.stdout).trim().split(/\r?\n/).pop()
|
|
320
|
-
const extract =
|
|
359
|
+
const extract = await spawnCapture('tar', ['-xzf', tgz, '-C', tmp], { cwd: tmp })
|
|
321
360
|
if (extract.status !== 0) return [...errors, 'tarball 解包失败(无法做密钥扫描)']
|
|
322
361
|
const extracted = path.join(tmp, 'package')
|
|
323
362
|
if (fs.existsSync(extracted)) {
|
|
@@ -330,8 +369,8 @@ export function packGateErrors(pkg, dir, npm) {
|
|
|
330
369
|
}
|
|
331
370
|
|
|
332
371
|
/** 发布预检:npm 凭据状态(ambient:宿主已登录或 NODE_AUTH_TOKEN)。 */
|
|
333
|
-
export function npmWhoami() {
|
|
334
|
-
const r = rawNpmRun(['whoami'])
|
|
372
|
+
export async function npmWhoami() {
|
|
373
|
+
const r = await rawNpmRun(['whoami'])
|
|
335
374
|
if (r.status !== 0) {
|
|
336
375
|
return { ok: false, hint: 'npm whoami 失败——在宿主机 npm login,或设置 NODE_AUTH_TOKEN' }
|
|
337
376
|
}
|
|
@@ -355,24 +394,21 @@ function isRealSuite(dir, pkg) {
|
|
|
355
394
|
}
|
|
356
395
|
}
|
|
357
396
|
|
|
358
|
-
/** 在
|
|
359
|
-
* 或旧版 dist/suites/<bridge>/package 里找同名同版本的自包含拼装产物。 */
|
|
397
|
+
/** 在 dist/suites/<bridge>/package 里找同名同版本的自包含拼装产物。 */
|
|
360
398
|
function findAssembledSuite(root, name, version) {
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
} catch { /* 坏包跳过 */ }
|
|
375
|
-
}
|
|
399
|
+
const suitesDir = path.join(root, 'dist', 'suites')
|
|
400
|
+
if (!fs.existsSync(suitesDir)) return null
|
|
401
|
+
let entries = []
|
|
402
|
+
try { entries = fs.readdirSync(suitesDir, { withFileTypes: true }) } catch { return null }
|
|
403
|
+
for (const entry of entries) {
|
|
404
|
+
if (!entry.isDirectory()) continue
|
|
405
|
+
const candidate = path.join(suitesDir, entry.name, 'package')
|
|
406
|
+
const pkgFile = path.join(candidate, 'package.json')
|
|
407
|
+
if (!fs.existsSync(pkgFile)) continue
|
|
408
|
+
try {
|
|
409
|
+
const p = JSON.parse(fs.readFileSync(pkgFile, 'utf8'))
|
|
410
|
+
if (p.name === name && p.version === version) return candidate
|
|
411
|
+
} catch { /* 坏包跳过 */ }
|
|
376
412
|
}
|
|
377
413
|
return null
|
|
378
414
|
}
|
|
@@ -397,7 +433,7 @@ export function preparePublishDir(dir, root, pkg) {
|
|
|
397
433
|
const assembled = findAssembledSuite(root, pkg.name, pkg.version)
|
|
398
434
|
if (!assembled) {
|
|
399
435
|
return {
|
|
400
|
-
error: `找不到自包含拼装产物:${pkg.name}@${pkg.version} 不在
|
|
436
|
+
error: `找不到自包含拼装产物:${pkg.name}@${pkg.version} 不在 dist/suites/*/package 里。`
|
|
401
437
|
+ '先跑 npm run assemble,否则发出去的 suite 里没有成员,安装后要回 registry 拉取。',
|
|
402
438
|
}
|
|
403
439
|
}
|
|
@@ -444,7 +480,21 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
444
480
|
}
|
|
445
481
|
}
|
|
446
482
|
|
|
447
|
-
|
|
483
|
+
if (await npm.alreadyPublished(pkg.name, pkg.version)) {
|
|
484
|
+
/* 同版本漂移闸:npm pack 确定性 ⇒ 本地 sha1 == registry dist.shasum 当且仅当内容一致。
|
|
485
|
+
* 注意这里比的是**源码树**,语义是「源码有没有偷偷改过而没 bump 版本」,
|
|
486
|
+
* 与下面发布时使用的自包含产物无关。 */
|
|
487
|
+
const remoteSha = await npm.npmShasumOf(pkg.name, pkg.version)
|
|
488
|
+
const localSha = remoteSha ? await npm.localShasumOf(dir) : null
|
|
489
|
+
if (remoteSha && localSha && remoteSha !== localSha) {
|
|
490
|
+
log(`✗ ${label} — 同版本内容漂移:registry ${remoteSha.slice(0, 8)} ≠ 本地 ${localSha.slice(0, 8)}`)
|
|
491
|
+
log(' npm 不允许同版本重发,请 bump 版本后再发布')
|
|
492
|
+
return { label, status: 'version-drift', detail: `shasum ${localSha} != ${remoteSha}` }
|
|
493
|
+
}
|
|
494
|
+
if (!remoteSha) log(`! ${label} — 无法获取 registry shasum(网络?),跳过漂移对比`)
|
|
495
|
+
log(`· ${label} — registry 上已存在,跳过`)
|
|
496
|
+
return { label, status: 'skipped-exists' }
|
|
497
|
+
}
|
|
448
498
|
|
|
449
499
|
/* 自包含产物:npm/pnpm 会剥离 node_modules,必须发布「依赖已实体化且写进
|
|
450
500
|
* bundledDependencies」的那一份,否则装出来是瘦包、要回 registry 拉依赖。 */
|
|
@@ -456,26 +506,10 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
456
506
|
}
|
|
457
507
|
|
|
458
508
|
try {
|
|
459
|
-
if (exists) {
|
|
460
|
-
/* 同版本漂移闸:npm pack 确定性 ⇒ 本地 sha1 == registry dist.shasum 当且仅当内容一致。
|
|
461
|
-
* 对比对象是**真正会发布的自包含产物**而非源码树:bundledDependencies 与 vendored
|
|
462
|
-
* 依赖只存在于产物里,直接比源码树会在每次续跑时误报漂移;源码改动若影响产物,
|
|
463
|
-
* 在这里同样会被抓住。 */
|
|
464
|
-
const remoteSha = npm.npmShasumOf(pkg.name, pkg.version)
|
|
465
|
-
const localSha = remoteSha ? npm.localShasumOf(prepared.publishDir) : null
|
|
466
|
-
if (remoteSha && localSha && remoteSha !== localSha) {
|
|
467
|
-
log(`✗ ${label} — 同版本内容漂移:registry ${remoteSha.slice(0, 8)} ≠ 本地 ${localSha.slice(0, 8)}`)
|
|
468
|
-
log(' npm 不允许同版本重发,请 bump 版本后再发布')
|
|
469
|
-
return { label, status: 'version-drift', detail: `shasum ${localSha} != ${remoteSha}` }
|
|
470
|
-
}
|
|
471
|
-
if (!remoteSha) log(`! ${label} — 无法获取 registry shasum(网络?),跳过漂移对比`)
|
|
472
|
-
log(`· ${label} — registry 上已存在,跳过`)
|
|
473
|
-
return { label, status: 'skipped-exists' }
|
|
474
|
-
}
|
|
475
509
|
/* pack 闸只对「真要发布」的包跑(真实 pack + 解包扫描很重,已发布的包由漂移闸把关)。
|
|
476
510
|
* 校验对象是自包含产物——那才是真正上 registry 的内容。 */
|
|
477
511
|
if (kind === 'plugin') {
|
|
478
|
-
const packErrors = packGateErrors(pkg, prepared.publishDir, npm)
|
|
512
|
+
const packErrors = await packGateErrors(pkg, prepared.publishDir, npm)
|
|
479
513
|
if (packErrors.length) {
|
|
480
514
|
log(`✗ ${label} — pack 闸未过`)
|
|
481
515
|
for (const item of packErrors) log(` - ${item}`)
|
|
@@ -486,7 +520,7 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
486
520
|
/* 发布顺序闸(发布成功 ≠ 用户能装上):依赖闭包须 registry 可解析或同批发布。
|
|
487
521
|
* 用**自包含产物**的清单判定:bundledDependencies 在源码树里没有,
|
|
488
522
|
* 只有 staging/拼装产物里才有,拿错清单会把已随包携带的依赖误判成必须上架。 */
|
|
489
|
-
const order = orderGate(pkgOf(prepared.publishDir), localMap, batch, npm)
|
|
523
|
+
const order = await orderGate(pkgOf(prepared.publishDir), localMap, batch, npm)
|
|
490
524
|
if (order.errors.length) {
|
|
491
525
|
log(`✗ ${label} — 发布顺序闸未过(发布后用户 npm install 会失败)`)
|
|
492
526
|
for (const item of order.errors) log(` - ${item}`)
|
|
@@ -495,7 +529,7 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
495
529
|
for (const w of order.warnings) log(`! ${label} — ${w}`)
|
|
496
530
|
|
|
497
531
|
if (!skipTests && pkg.scripts?.test) {
|
|
498
|
-
const t = npm.rawNpmRun(['test'], { cwd: dir })
|
|
532
|
+
const t = await npm.rawNpmRun(['test'], { cwd: dir })
|
|
499
533
|
if (t.status !== 0) {
|
|
500
534
|
log(`✗ ${label} — npm test 失败,跳过发布`)
|
|
501
535
|
return { label, status: 'test-failed', detail: (t.stdout || '') + (t.stderr || '') }
|
|
@@ -508,8 +542,8 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
508
542
|
}
|
|
509
543
|
|
|
510
544
|
const access = pkg.publishConfig?.access || 'public'
|
|
511
|
-
const expectedSha = npm.localShasumOf(prepared.publishDir)
|
|
512
|
-
const pub = npm.rawNpmRun(['publish', '--access', access, '--tag', tag], { cwd: prepared.publishDir })
|
|
545
|
+
const expectedSha = await npm.localShasumOf(prepared.publishDir)
|
|
546
|
+
const pub = await npm.rawNpmRun(['publish', '--access', access, '--tag', tag], { cwd: prepared.publishDir })
|
|
513
547
|
if (pub.status !== 0) {
|
|
514
548
|
log(`✗ ${label} — npm publish 失败`)
|
|
515
549
|
log(String(pub.stderr || pub.stdout || '').trim().slice(0, 500))
|
|
@@ -518,8 +552,9 @@ async function publishOne(dir, { kind, localMap, batch, only, tag, skipTests, dr
|
|
|
518
552
|
/* 发布后复核:registry 收到的 tarball 必须与本地 pack 逐字节一致(shasum)。 */
|
|
519
553
|
let remoteSha = null
|
|
520
554
|
for (let i = 0; i < 5 && !remoteSha; i++) {
|
|
521
|
-
|
|
522
|
-
|
|
555
|
+
/* publishOne 是 async:用 await 睡,别用 Atomics.wait 同步钉住宿主事件循环。 */
|
|
556
|
+
if (i) await new Promise((resolve) => { setTimeout(resolve, 3000) })
|
|
557
|
+
remoteSha = await npm.npmShasumOf(pkg.name, pkg.version)
|
|
523
558
|
}
|
|
524
559
|
if (remoteSha && expectedSha && remoteSha !== expectedSha) {
|
|
525
560
|
log(`✗ ${label} — 发布后复核失败:registry ${remoteSha.slice(0, 8)} ≠ 本地 ${expectedSha.slice(0, 8)}(registry 可能收到脏产物,bump 后重发)`)
|
|
@@ -576,13 +611,14 @@ export async function runPublish(options = {}) {
|
|
|
576
611
|
const pkg = pkgOf(dir)
|
|
577
612
|
localMap.set(pkg.name, { pkg, dir })
|
|
578
613
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
614
|
+
/* alreadyPublished 是异步的:filter 回调里不能 await,改逐包顺序判定
|
|
615
|
+
* (npm view 缓存保证同一 specifier 只查一次,语义与原 filter 链一致)。 */
|
|
616
|
+
const batch = new Set()
|
|
617
|
+
for (const dir of [...usableLibDirs, ...pluginDirs]) {
|
|
618
|
+
const pkg = pkgOf(dir)
|
|
619
|
+
if (only && pkg.name !== only) continue
|
|
620
|
+
if (!(await npm.alreadyPublished(pkg.name, pkg.version))) batch.add(pkg.name)
|
|
621
|
+
}
|
|
586
622
|
|
|
587
623
|
const shared = { localMap, batch, only, tag, skipTests, dryRun, npm, log, root }
|
|
588
624
|
// 先库后插件:plugin-kit 等支撑库必须先上 registry,插件发布时依赖才可解析
|
package/server/tools.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const whoamiTool = defineTool({
|
|
|
31
31
|
description: 'npm 凭据预检:宿主环境是否已登录(npm whoami / NODE_AUTH_TOKEN)。发布前先调用。',
|
|
32
32
|
inputSchema: { type: 'object', additionalProperties: false, properties: {} },
|
|
33
33
|
kind: 'read',
|
|
34
|
-
handler: () =>
|
|
34
|
+
handler: () => npmWhoami().then(text),
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
const previewTool = defineTool({
|