@pome-sh/cli 0.1.0 → 0.1.1
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/dist/build-info.json +3 -3
- package/dist/src/doctor/checks.js +2 -2
- package/node_modules/@pome-sh/sdk/dist/db.d.ts +4 -4
- package/node_modules/@pome-sh/sdk/dist/db.js +93 -25
- package/node_modules/@pome-sh/sdk/dist/db.js.map +1 -1
- package/node_modules/@pome-sh/sdk/package.json +2 -6
- package/node_modules/@pome-sh/twin-github/README.md +2 -1
- package/node_modules/@pome-sh/twin-github/package.json +2 -3
- package/node_modules/@pome-sh/twin-slack/package.json +2 -3
- package/node_modules/@pome-sh/twin-stripe/README.md +2 -2
- package/node_modules/@pome-sh/twin-stripe/package.json +2 -3
- package/package.json +6 -7
- package/dist/src/recorder/verdictArtifact.d.ts +0 -71
- package/dist/src/recorder/verdictArtifact.js +0 -207
- package/dist/src/score/view.d.ts +0 -38
- package/dist/src/score/view.js +0 -59
- package/dist/src/twin/github/app.d.ts +0 -10
- package/dist/src/twin/github/app.js +0 -316
- package/dist/src/twin/github/db/migrations.d.ts +0 -2
- package/dist/src/twin/github/db/migrations.js +0 -64
- package/dist/src/twin/github/db/openDatabase.d.ts +0 -2
- package/dist/src/twin/github/db/openDatabase.js +0 -13
- package/dist/src/twin/github/db/queries.d.ts +0 -77
- package/dist/src/twin/github/db/queries.js +0 -93
- package/dist/src/twin/github/domain/seed.d.ts +0 -74
- package/dist/src/twin/github/domain/seed.js +0 -104
- package/dist/src/twin/github/domain/serializers.d.ts +0 -113
- package/dist/src/twin/github/domain/serializers.js +0 -76
- package/dist/src/twin/github/types.d.ts +0 -66
- package/dist/src/twin/github/types.js +0 -1
- package/dist/src/twin-github/app.d.ts +0 -9
- package/dist/src/twin-github/app.js +0 -327
- package/dist/src/twin-github/auth.d.ts +0 -16
- package/dist/src/twin-github/auth.js +0 -142
- package/dist/src/twin-github/build-info.d.ts +0 -7
- package/dist/src/twin-github/build-info.js +0 -52
- package/dist/src/twin-github/db.d.ts +0 -4
- package/dist/src/twin-github/db.js +0 -362
- package/dist/src/twin-github/domain.d.ts +0 -1649
- package/dist/src/twin-github/domain.js +0 -957
- package/dist/src/twin-github/errors.d.ts +0 -14
- package/dist/src/twin-github/errors.js +0 -34
- package/dist/src/twin-github/index.d.ts +0 -9
- package/dist/src/twin-github/index.js +0 -7
- package/dist/src/twin-github/mcp.d.ts +0 -17
- package/dist/src/twin-github/mcp.js +0 -281
- package/dist/src/twin-github/recorder.d.ts +0 -2
- package/dist/src/twin-github/recorder.js +0 -29
- package/dist/src/twin-github/seed.d.ts +0 -74
- package/dist/src/twin-github/seed.js +0 -107
- package/dist/src/twin-github/serializers.d.ts +0 -449
- package/dist/src/twin-github/serializers.js +0 -429
- package/dist/src/twin-github/server.d.ts +0 -1
- package/dist/src/twin-github/server.js +0 -34
- package/dist/src/twin-github/tools.d.ts +0 -1545
- package/dist/src/twin-github/tools.js +0 -347
- package/dist/src/twin-github/types.d.ts +0 -198
- package/dist/src/twin-github/types.js +0 -1
- package/dist/src/twin-github/unsupported-envelope.d.ts +0 -10
- package/dist/src/twin-github/unsupported-envelope.js +0 -29
- package/dist/src/twin-github/util.d.ts +0 -13
- package/dist/src/twin-github/util.js +0 -61
- package/dist/src/twin-slack/app.d.ts +0 -17
- package/dist/src/twin-slack/app.js +0 -683
- package/dist/src/twin-slack/auth.d.ts +0 -38
- package/dist/src/twin-slack/auth.js +0 -219
- package/dist/src/twin-slack/build-info.d.ts +0 -7
- package/dist/src/twin-slack/build-info.js +0 -9
- package/dist/src/twin-slack/db.d.ts +0 -4
- package/dist/src/twin-slack/db.js +0 -213
- package/dist/src/twin-slack/domain.d.ts +0 -236
- package/dist/src/twin-slack/domain.js +0 -1293
- package/dist/src/twin-slack/errors.d.ts +0 -16
- package/dist/src/twin-slack/errors.js +0 -60
- package/dist/src/twin-slack/index.d.ts +0 -8
- package/dist/src/twin-slack/index.js +0 -8
- package/dist/src/twin-slack/mcp.d.ts +0 -17
- package/dist/src/twin-slack/mcp.js +0 -226
- package/dist/src/twin-slack/recorder.d.ts +0 -2
- package/dist/src/twin-slack/recorder.js +0 -15
- package/dist/src/twin-slack/seed.d.ts +0 -49
- package/dist/src/twin-slack/seed.js +0 -139
- package/dist/src/twin-slack/serializers.d.ts +0 -141
- package/dist/src/twin-slack/serializers.js +0 -377
- package/dist/src/twin-slack/tools.d.ts +0 -97
- package/dist/src/twin-slack/tools.js +0 -171
- package/dist/src/twin-slack/types.d.ts +0 -164
- package/dist/src/twin-slack/types.js +0 -1
- package/dist/src/twin-slack/unsupported-envelope.d.ts +0 -12
- package/dist/src/twin-slack/unsupported-envelope.js +0 -61
- package/dist/src/twin-slack/upstream-types.d.ts +0 -19
- package/dist/src/twin-slack/upstream-types.js +0 -1
- package/dist/src/twin-slack/util.d.ts +0 -31
- package/dist/src/twin-slack/util.js +0 -136
- package/node_modules/base64-js/LICENSE +0 -21
- package/node_modules/base64-js/README.md +0 -34
- package/node_modules/base64-js/base64js.min.js +0 -1
- package/node_modules/base64-js/index.d.ts +0 -3
- package/node_modules/base64-js/index.js +0 -150
- package/node_modules/base64-js/package.json +0 -47
- package/node_modules/better-sqlite3/LICENSE +0 -21
- package/node_modules/better-sqlite3/README.md +0 -99
- package/node_modules/better-sqlite3/binding.gyp +0 -38
- package/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/node_modules/better-sqlite3/deps/common.gypi +0 -68
- package/node_modules/better-sqlite3/deps/copy.js +0 -31
- package/node_modules/better-sqlite3/deps/defines.gypi +0 -42
- package/node_modules/better-sqlite3/deps/download.sh +0 -123
- package/node_modules/better-sqlite3/deps/patches/1208.patch +0 -15
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +0 -269395
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +0 -14347
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3ext.h +0 -739
- package/node_modules/better-sqlite3/deps/sqlite3.gyp +0 -80
- package/node_modules/better-sqlite3/deps/test_extension.c +0 -21
- package/node_modules/better-sqlite3/lib/database.js +0 -90
- package/node_modules/better-sqlite3/lib/index.js +0 -3
- package/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/node_modules/better-sqlite3/lib/util.js +0 -12
- package/node_modules/better-sqlite3/package.json +0 -59
- package/node_modules/better-sqlite3/src/addon.cpp +0 -47
- package/node_modules/better-sqlite3/src/better_sqlite3.cpp +0 -74
- package/node_modules/better-sqlite3/src/objects/backup.cpp +0 -120
- package/node_modules/better-sqlite3/src/objects/backup.hpp +0 -36
- package/node_modules/better-sqlite3/src/objects/database.cpp +0 -417
- package/node_modules/better-sqlite3/src/objects/database.hpp +0 -103
- package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +0 -113
- package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +0 -50
- package/node_modules/better-sqlite3/src/objects/statement.cpp +0 -383
- package/node_modules/better-sqlite3/src/objects/statement.hpp +0 -58
- package/node_modules/better-sqlite3/src/util/bind-map.cpp +0 -73
- package/node_modules/better-sqlite3/src/util/binder.cpp +0 -193
- package/node_modules/better-sqlite3/src/util/constants.cpp +0 -172
- package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +0 -121
- package/node_modules/better-sqlite3/src/util/custom-function.cpp +0 -59
- package/node_modules/better-sqlite3/src/util/custom-table.cpp +0 -409
- package/node_modules/better-sqlite3/src/util/data-converter.cpp +0 -17
- package/node_modules/better-sqlite3/src/util/data.cpp +0 -194
- package/node_modules/better-sqlite3/src/util/helpers.cpp +0 -109
- package/node_modules/better-sqlite3/src/util/macros.cpp +0 -90
- package/node_modules/better-sqlite3/src/util/query-macros.cpp +0 -71
- package/node_modules/better-sqlite3/src/util/row-builder.cpp +0 -49
- package/node_modules/bindings/LICENSE.md +0 -22
- package/node_modules/bindings/README.md +0 -98
- package/node_modules/bindings/bindings.js +0 -221
- package/node_modules/bindings/package.json +0 -28
- package/node_modules/bl/.travis.yml +0 -17
- package/node_modules/bl/BufferList.js +0 -396
- package/node_modules/bl/LICENSE.md +0 -13
- package/node_modules/bl/README.md +0 -247
- package/node_modules/bl/bl.js +0 -84
- package/node_modules/bl/package.json +0 -37
- package/node_modules/bl/test/convert.js +0 -21
- package/node_modules/bl/test/indexOf.js +0 -492
- package/node_modules/bl/test/isBufferList.js +0 -32
- package/node_modules/bl/test/test.js +0 -869
- package/node_modules/buffer/AUTHORS.md +0 -70
- package/node_modules/buffer/LICENSE +0 -21
- package/node_modules/buffer/README.md +0 -410
- package/node_modules/buffer/index.d.ts +0 -186
- package/node_modules/buffer/index.js +0 -1817
- package/node_modules/buffer/package.json +0 -96
- package/node_modules/chownr/LICENSE +0 -15
- package/node_modules/chownr/README.md +0 -3
- package/node_modules/chownr/chownr.js +0 -167
- package/node_modules/chownr/package.json +0 -29
- package/node_modules/decompress-response/index.d.ts +0 -22
- package/node_modules/decompress-response/index.js +0 -58
- package/node_modules/decompress-response/license +0 -9
- package/node_modules/decompress-response/package.json +0 -56
- package/node_modules/decompress-response/readme.md +0 -48
- package/node_modules/deep-extend/CHANGELOG.md +0 -46
- package/node_modules/deep-extend/LICENSE +0 -20
- package/node_modules/deep-extend/README.md +0 -91
- package/node_modules/deep-extend/index.js +0 -1
- package/node_modules/deep-extend/lib/deep-extend.js +0 -150
- package/node_modules/deep-extend/package.json +0 -62
- package/node_modules/detect-libc/LICENSE +0 -201
- package/node_modules/detect-libc/README.md +0 -163
- package/node_modules/detect-libc/index.d.ts +0 -14
- package/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/node_modules/detect-libc/lib/elf.js +0 -39
- package/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/node_modules/detect-libc/lib/process.js +0 -24
- package/node_modules/detect-libc/package.json +0 -44
- package/node_modules/end-of-stream/LICENSE +0 -21
- package/node_modules/end-of-stream/README.md +0 -54
- package/node_modules/end-of-stream/index.js +0 -96
- package/node_modules/end-of-stream/package.json +0 -37
- package/node_modules/expand-template/.travis.yml +0 -6
- package/node_modules/expand-template/LICENSE +0 -21
- package/node_modules/expand-template/README.md +0 -43
- package/node_modules/expand-template/index.js +0 -26
- package/node_modules/expand-template/package.json +0 -29
- package/node_modules/expand-template/test.js +0 -67
- package/node_modules/file-uri-to-path/.npmignore +0 -1
- package/node_modules/file-uri-to-path/.travis.yml +0 -30
- package/node_modules/file-uri-to-path/History.md +0 -21
- package/node_modules/file-uri-to-path/LICENSE +0 -20
- package/node_modules/file-uri-to-path/README.md +0 -74
- package/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/node_modules/file-uri-to-path/index.js +0 -66
- package/node_modules/file-uri-to-path/package.json +0 -32
- package/node_modules/file-uri-to-path/test/test.js +0 -24
- package/node_modules/file-uri-to-path/test/tests.json +0 -13
- package/node_modules/fs-constants/LICENSE +0 -21
- package/node_modules/fs-constants/README.md +0 -26
- package/node_modules/fs-constants/browser.js +0 -1
- package/node_modules/fs-constants/index.js +0 -1
- package/node_modules/fs-constants/package.json +0 -19
- package/node_modules/github-from-package/.travis.yml +0 -4
- package/node_modules/github-from-package/LICENSE +0 -18
- package/node_modules/github-from-package/example/package.json +0 -8
- package/node_modules/github-from-package/example/url.js +0 -3
- package/node_modules/github-from-package/index.js +0 -17
- package/node_modules/github-from-package/package.json +0 -30
- package/node_modules/github-from-package/readme.markdown +0 -53
- package/node_modules/github-from-package/test/a.json +0 -8
- package/node_modules/github-from-package/test/b.json +0 -5
- package/node_modules/github-from-package/test/c.json +0 -5
- package/node_modules/github-from-package/test/d.json +0 -7
- package/node_modules/github-from-package/test/e.json +0 -5
- package/node_modules/github-from-package/test/url.js +0 -19
- package/node_modules/ieee754/LICENSE +0 -11
- package/node_modules/ieee754/README.md +0 -51
- package/node_modules/ieee754/index.d.ts +0 -10
- package/node_modules/ieee754/index.js +0 -85
- package/node_modules/ieee754/package.json +0 -52
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/ini/LICENSE +0 -15
- package/node_modules/ini/README.md +0 -102
- package/node_modules/ini/ini.js +0 -206
- package/node_modules/ini/package.json +0 -33
- package/node_modules/mimic-response/index.d.ts +0 -17
- package/node_modules/mimic-response/index.js +0 -77
- package/node_modules/mimic-response/license +0 -9
- package/node_modules/mimic-response/package.json +0 -42
- package/node_modules/mimic-response/readme.md +0 -78
- package/node_modules/minimist/.eslintrc +0 -29
- package/node_modules/minimist/.github/FUNDING.yml +0 -12
- package/node_modules/minimist/.nycrc +0 -14
- package/node_modules/minimist/CHANGELOG.md +0 -298
- package/node_modules/minimist/LICENSE +0 -18
- package/node_modules/minimist/README.md +0 -121
- package/node_modules/minimist/example/parse.js +0 -4
- package/node_modules/minimist/index.js +0 -263
- package/node_modules/minimist/package.json +0 -75
- package/node_modules/minimist/test/all_bool.js +0 -34
- package/node_modules/minimist/test/bool.js +0 -177
- package/node_modules/minimist/test/dash.js +0 -43
- package/node_modules/minimist/test/default_bool.js +0 -37
- package/node_modules/minimist/test/dotted.js +0 -24
- package/node_modules/minimist/test/kv_short.js +0 -32
- package/node_modules/minimist/test/long.js +0 -33
- package/node_modules/minimist/test/num.js +0 -38
- package/node_modules/minimist/test/parse.js +0 -209
- package/node_modules/minimist/test/parse_modified.js +0 -11
- package/node_modules/minimist/test/proto.js +0 -64
- package/node_modules/minimist/test/short.js +0 -69
- package/node_modules/minimist/test/stop_early.js +0 -17
- package/node_modules/minimist/test/unknown.js +0 -104
- package/node_modules/minimist/test/whitespace.js +0 -10
- package/node_modules/mkdirp-classic/LICENSE +0 -21
- package/node_modules/mkdirp-classic/README.md +0 -18
- package/node_modules/mkdirp-classic/index.js +0 -98
- package/node_modules/mkdirp-classic/package.json +0 -18
- package/node_modules/napi-build-utils/.github/workflows/run-npm-tests.yml +0 -31
- package/node_modules/napi-build-utils/LICENSE +0 -21
- package/node_modules/napi-build-utils/README.md +0 -52
- package/node_modules/napi-build-utils/index.js +0 -214
- package/node_modules/napi-build-utils/index.md +0 -0
- package/node_modules/napi-build-utils/package.json +0 -42
- package/node_modules/node-abi/LICENSE +0 -21
- package/node_modules/node-abi/README.md +0 -54
- package/node_modules/node-abi/abi_registry.json +0 -453
- package/node_modules/node-abi/index.js +0 -179
- package/node_modules/node-abi/package.json +0 -45
- package/node_modules/once/LICENSE +0 -15
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -33
- package/node_modules/prebuild-install/CHANGELOG.md +0 -131
- package/node_modules/prebuild-install/CONTRIBUTING.md +0 -6
- package/node_modules/prebuild-install/LICENSE +0 -21
- package/node_modules/prebuild-install/README.md +0 -163
- package/node_modules/prebuild-install/asset.js +0 -44
- package/node_modules/prebuild-install/bin.js +0 -78
- package/node_modules/prebuild-install/download.js +0 -142
- package/node_modules/prebuild-install/error.js +0 -14
- package/node_modules/prebuild-install/help.txt +0 -16
- package/node_modules/prebuild-install/index.js +0 -1
- package/node_modules/prebuild-install/log.js +0 -33
- package/node_modules/prebuild-install/package.json +0 -67
- package/node_modules/prebuild-install/proxy.js +0 -35
- package/node_modules/prebuild-install/rc.js +0 -64
- package/node_modules/prebuild-install/util.js +0 -143
- package/node_modules/pump/.github/FUNDING.yml +0 -2
- package/node_modules/pump/.travis.yml +0 -5
- package/node_modules/pump/LICENSE +0 -21
- package/node_modules/pump/README.md +0 -74
- package/node_modules/pump/SECURITY.md +0 -5
- package/node_modules/pump/empty.js +0 -1
- package/node_modules/pump/index.js +0 -86
- package/node_modules/pump/package.json +0 -30
- package/node_modules/pump/test-browser.js +0 -66
- package/node_modules/pump/test-node.js +0 -53
- package/node_modules/rc/LICENSE.APACHE2 +0 -15
- package/node_modules/rc/LICENSE.BSD +0 -26
- package/node_modules/rc/LICENSE.MIT +0 -24
- package/node_modules/rc/README.md +0 -227
- package/node_modules/rc/browser.js +0 -7
- package/node_modules/rc/cli.js +0 -4
- package/node_modules/rc/index.js +0 -53
- package/node_modules/rc/lib/utils.js +0 -104
- package/node_modules/rc/package.json +0 -29
- package/node_modules/rc/test/ini.js +0 -16
- package/node_modules/rc/test/nested-env-vars.js +0 -50
- package/node_modules/rc/test/test.js +0 -59
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -106
- package/node_modules/readable-stream/errors-browser.js +0 -127
- package/node_modules/readable-stream/errors.js +0 -116
- package/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -190
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -641
- package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
- package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
- package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
- package/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
- package/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
- package/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -68
- package/node_modules/readable-stream/readable-browser.js +0 -9
- package/node_modules/readable-stream/readable.js +0 -16
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/safe-buffer/package.json +0 -51
- 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 -37
- 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/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/simple-concat/.travis.yml +0 -3
- package/node_modules/simple-concat/LICENSE +0 -20
- package/node_modules/simple-concat/README.md +0 -44
- package/node_modules/simple-concat/index.js +0 -15
- package/node_modules/simple-concat/package.json +0 -47
- package/node_modules/simple-concat/test/basic.js +0 -41
- package/node_modules/simple-get/.github/dependabot.yml +0 -15
- package/node_modules/simple-get/.github/workflows/ci.yml +0 -23
- package/node_modules/simple-get/LICENSE +0 -20
- package/node_modules/simple-get/README.md +0 -333
- package/node_modules/simple-get/index.js +0 -108
- package/node_modules/simple-get/package.json +0 -67
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -34
- package/node_modules/strip-json-comments/index.js +0 -70
- package/node_modules/strip-json-comments/license +0 -21
- package/node_modules/strip-json-comments/package.json +0 -42
- package/node_modules/strip-json-comments/readme.md +0 -64
- package/node_modules/tar-fs/.travis.yml +0 -6
- package/node_modules/tar-fs/LICENSE +0 -21
- package/node_modules/tar-fs/README.md +0 -165
- package/node_modules/tar-fs/index.js +0 -392
- package/node_modules/tar-fs/package.json +0 -46
- package/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/node_modules/tar-fs/test/index.js +0 -457
- package/node_modules/tar-stream/LICENSE +0 -21
- package/node_modules/tar-stream/README.md +0 -168
- package/node_modules/tar-stream/extract.js +0 -257
- package/node_modules/tar-stream/headers.js +0 -295
- package/node_modules/tar-stream/index.js +0 -2
- package/node_modules/tar-stream/pack.js +0 -255
- package/node_modules/tar-stream/package.json +0 -58
- package/node_modules/tar-stream/sandbox.js +0 -11
- package/node_modules/tunnel-agent/LICENSE +0 -55
- package/node_modules/tunnel-agent/README.md +0 -4
- package/node_modules/tunnel-agent/index.js +0 -244
- package/node_modules/tunnel-agent/package.json +0 -22
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -29
- package/node_modules/wrappy/wrappy.js +0 -33
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
import { Hono } from "hono";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { bearerAuth, localhostOnly } from "./auth.js";
|
|
5
|
-
import { openGitHubCloneDatabase } from "./db.js";
|
|
6
|
-
import { GitHubDomain } from "./domain.js";
|
|
7
|
-
import { githubError, TwinError, validationFailed } from "./errors.js";
|
|
8
|
-
import { defaultSeedState, parseSeed } from "./seed.js";
|
|
9
|
-
import { requestId } from "./util.js";
|
|
10
|
-
import { executeTool, isMutatingTool, listTools } from "./tools.js";
|
|
11
|
-
import { handleMcpRequest, mcpMethodNotAllowed } from "./mcp.js";
|
|
12
|
-
import { twinBuildInfo } from "./build-info.js";
|
|
13
|
-
import { unsupportedEnvelope } from "./unsupported-envelope.js";
|
|
14
|
-
import { redactSecrets } from "../recorder/redaction.js";
|
|
15
|
-
function captureDelta(fn) {
|
|
16
|
-
let delta = null;
|
|
17
|
-
const value = fn((d) => { delta = d; });
|
|
18
|
-
return { value, delta };
|
|
19
|
-
}
|
|
20
|
-
const jsonRecord = z.record(z.string(), z.unknown());
|
|
21
|
-
const createRepoSchema = z.object({ name: z.string().min(1), owner: z.string().min(1).optional(), description: z.string().optional(), private: z.boolean().optional() });
|
|
22
|
-
const contentSchema = z.object({ message: z.string().min(1), content: z.string(), branch: z.string().optional(), sha: z.string().optional(), encoding: z.enum(["utf-8", "base64"]).optional() });
|
|
23
|
-
const createIssueSchema = z.object({ title: z.string().min(1), body: z.string().optional(), labels: z.array(z.string()).optional(), assignees: z.array(z.string()).optional() });
|
|
24
|
-
const updateIssueSchema = z.object({ title: z.string().optional(), body: z.string().optional(), state: z.enum(["open", "closed"]).optional(), labels: z.array(z.string()).optional(), assignees: z.array(z.string()).optional() });
|
|
25
|
-
const commentSchema = z.object({ body: z.string().min(1) });
|
|
26
|
-
const labelSchema = z.object({ name: z.string().min(1), color: z.string().default("ededed"), description: z.string().default("") });
|
|
27
|
-
const labelsSchema = z.object({ labels: z.array(z.string().min(1)).min(1) });
|
|
28
|
-
const assigneesSchema = z.object({ assignees: z.array(z.string().min(1)).min(1) });
|
|
29
|
-
const createPullSchema = z.object({ title: z.string().min(1), body: z.string().optional(), head: z.string().min(1), base: z.string().optional() });
|
|
30
|
-
const reviewSchema = z.object({ event: z.enum(["APPROVE", "REQUEST_CHANGES", "COMMENT"]), body: z.string().optional() });
|
|
31
|
-
const mergeSchema = z.object({ commit_title: z.string().optional(), commit_message: z.string().optional() });
|
|
32
|
-
const updateBranchSchema = z.object({ expected_head_sha: z.string().optional() });
|
|
33
|
-
export function createGitHubCloneApp(options = {}) {
|
|
34
|
-
const db = options.db ?? openGitHubCloneDatabase();
|
|
35
|
-
const domain = new GitHubDomain(db);
|
|
36
|
-
if (!options.db)
|
|
37
|
-
domain.seed(options.seed ?? defaultSeedState());
|
|
38
|
-
const recorder = options.recorder;
|
|
39
|
-
const runId = options.runId ?? "local";
|
|
40
|
-
const root = new Hono();
|
|
41
|
-
root.get("/healthz", (c) => c.json({
|
|
42
|
-
ok: true,
|
|
43
|
-
twin: "github",
|
|
44
|
-
implementation: "github_clone",
|
|
45
|
-
fidelity: "semantic",
|
|
46
|
-
tools: listTools().length,
|
|
47
|
-
runtime: twinBuildInfo()
|
|
48
|
-
}));
|
|
49
|
-
const adminApp = new Hono();
|
|
50
|
-
adminApp.use("*", localhostOnly());
|
|
51
|
-
adminApp.post("/reset", (c) => handle(c, recorder, runId, async () => {
|
|
52
|
-
const { delta } = captureDelta((onDelta) => {
|
|
53
|
-
domain.seed(defaultSeedState(), onDelta);
|
|
54
|
-
});
|
|
55
|
-
return { status: 200, body: { ok: true, message: "GitHub twin state reset to default seed." }, mutation: true, stateDelta: delta };
|
|
56
|
-
}));
|
|
57
|
-
adminApp.post("/seed", (c) => handle(c, recorder, runId, async () => {
|
|
58
|
-
const parsed = parseSeed(await c.req.json());
|
|
59
|
-
const { delta } = captureDelta((onDelta) => {
|
|
60
|
-
domain.seed(parsed, onDelta);
|
|
61
|
-
});
|
|
62
|
-
return { status: 200, body: { ok: true, repositories: parsed.repositories.length }, mutation: true, stateDelta: delta };
|
|
63
|
-
}));
|
|
64
|
-
root.route("/admin", adminApp);
|
|
65
|
-
const session = new Hono();
|
|
66
|
-
session.use("*", bearerAuth());
|
|
67
|
-
session.get("/healthz", (c) => c.json({ ok: true, sid: c.req.param("sid") }));
|
|
68
|
-
session.get("/_pome/health", (c) => c.json({
|
|
69
|
-
ok: true,
|
|
70
|
-
twin: "github",
|
|
71
|
-
implementation: "github_clone",
|
|
72
|
-
fidelity: "semantic",
|
|
73
|
-
runtime: twinBuildInfo()
|
|
74
|
-
}));
|
|
75
|
-
session.get("/_pome/state", (c) => c.json(redactSecrets(domain.exportState())));
|
|
76
|
-
session.get("/_pome/events", (c) => c.json(recorder?.events() ?? []));
|
|
77
|
-
// Real MCP JSON-RPC endpoint (Streamable HTTP, stateless). The bearerAuth
|
|
78
|
-
// middleware on `session` covers this — auth contract is unchanged. Legacy
|
|
79
|
-
// custom routes below (`/mcp/tools`, `/mcp/tools/:name`, `/mcp/call`) stay
|
|
80
|
-
// mounted at sub-paths; they do not collide with `POST /mcp`.
|
|
81
|
-
session.post("/mcp", (c) => handleMcpRequest(c, { domain, recorder, runId }));
|
|
82
|
-
session.get("/mcp", (c) => mcpMethodNotAllowed(c));
|
|
83
|
-
session.delete("/mcp", (c) => mcpMethodNotAllowed(c));
|
|
84
|
-
session.get("/mcp/tools", (c) => c.json({ tools: listTools() }));
|
|
85
|
-
session.post("/mcp/tools/:name", (c) => handle(c, recorder, runId, async () => {
|
|
86
|
-
const args = await readJson(c);
|
|
87
|
-
const name = requireParam(c, "name");
|
|
88
|
-
const { value, delta } = captureDelta((onDelta) => executeTool(domain, name, args, onDelta));
|
|
89
|
-
return { status: 200, body: value, mutation: isMutatingTool(name), stateDelta: delta };
|
|
90
|
-
}));
|
|
91
|
-
session.post("/mcp/call", (c) => handle(c, recorder, runId, async () => {
|
|
92
|
-
const call = z.object({ tool: z.string().min(1), arguments: jsonRecord.default({}) }).parse(await readJson(c));
|
|
93
|
-
const { value, delta } = captureDelta((onDelta) => executeTool(domain, call.tool, call.arguments, onDelta));
|
|
94
|
-
return { status: 200, body: value, mutation: isMutatingTool(call.tool), stateDelta: delta };
|
|
95
|
-
}));
|
|
96
|
-
session.get("/search/repositories", (c) => handle(c, recorder, runId, () => ok(domain.searchRepositories({ q: c.req.query("q"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
97
|
-
session.get("/search/code", (c) => handle(c, recorder, runId, () => ok(domain.searchCode({ q: c.req.query("q"), owner: c.req.query("owner"), repo: c.req.query("repo"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
98
|
-
session.get("/search/issues", (c) => handle(c, recorder, runId, () => ok(domain.searchIssues({ q: c.req.query("q"), owner: c.req.query("owner"), repo: c.req.query("repo"), state: stateQuery(c), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
99
|
-
session.get("/search/users", (c) => handle(c, recorder, runId, () => ok(domain.searchUsers({ q: c.req.query("q"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
100
|
-
session.get("/repos/:owner/:repo", (c) => handle(c, recorder, runId, () => ok(domain.getRepository(params(c)))));
|
|
101
|
-
session.post("/user/repos", (c) => handle(c, recorder, runId, async () => {
|
|
102
|
-
const args = createRepoSchema.parse(await readJson(c));
|
|
103
|
-
const { value, delta } = captureDelta((onDelta) => domain.createRepository(args, onDelta));
|
|
104
|
-
return created(value, delta);
|
|
105
|
-
}));
|
|
106
|
-
session.post("/orgs/:owner/repos", (c) => handle(c, recorder, runId, async () => {
|
|
107
|
-
const args = { ...createRepoSchema.parse(await readJson(c)), owner: c.req.param("owner") };
|
|
108
|
-
const { value, delta } = captureDelta((onDelta) => domain.createRepository(args, onDelta));
|
|
109
|
-
return created(value, delta);
|
|
110
|
-
}));
|
|
111
|
-
session.post("/repos/:owner/:repo/forks", (c) => handle(c, recorder, runId, async () => {
|
|
112
|
-
const organization = (await maybeJson(c)).organization;
|
|
113
|
-
const { value, delta } = captureDelta((onDelta) => domain.forkRepository({ ...params(c), organization }, onDelta));
|
|
114
|
-
return created(value, delta);
|
|
115
|
-
}));
|
|
116
|
-
session.get("/repos/:owner/:repo/contents", (c) => handle(c, recorder, runId, () => ok(domain.getFileContents({ ...params(c), path: "", ref: c.req.query("ref") }))));
|
|
117
|
-
session.get("/repos/:owner/:repo/contents/*", (c) => handle(c, recorder, runId, () => ok(domain.getFileContents({ ...params(c), path: contentPath(c), ref: c.req.query("ref") }))));
|
|
118
|
-
session.put("/repos/:owner/:repo/contents/*", (c) => handle(c, recorder, runId, async () => {
|
|
119
|
-
const body = contentSchema.parse(await readJson(c));
|
|
120
|
-
const args = { ...params(c), path: contentPath(c), ...body };
|
|
121
|
-
const actor = sessionFrom(c).login;
|
|
122
|
-
const { value, delta } = captureDelta((onDelta) => domain.createOrUpdateFile(args, { actor }, onDelta));
|
|
123
|
-
// GitHub returns 201 Created for a new file, 200 OK for an update
|
|
124
|
-
// (FDRS-596). `before: null` delta = insert (see packages/twin-github).
|
|
125
|
-
const status = delta !== null && delta.before === null ? 201 : 200;
|
|
126
|
-
return { status, body: value, mutation: true, stateDelta: delta };
|
|
127
|
-
}));
|
|
128
|
-
session.get("/repos/:owner/:repo/commits", (c) => handle(c, recorder, runId, () => ok(domain.listCommits({ ...params(c), sha: c.req.query("sha"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
129
|
-
session.post("/repos/:owner/:repo/git/refs", (c) => handle(c, recorder, runId, async () => {
|
|
130
|
-
const body = z.object({ ref: z.string().min(1), sha: z.string().optional() }).parse(await readJson(c));
|
|
131
|
-
const branch = body.ref.replace(/^refs\/heads\//, "");
|
|
132
|
-
const { value, delta } = captureDelta((onDelta) => domain.createBranch({ ...params(c), branch, sha: body.sha }, onDelta));
|
|
133
|
-
return created(value, delta);
|
|
134
|
-
}));
|
|
135
|
-
session.get("/repos/:owner/:repo/issues", (c) => handle(c, recorder, runId, () => ok(domain.listIssues({ ...params(c), state: stateQuery(c), labels: c.req.query("labels"), assignee: c.req.query("assignee"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
136
|
-
session.post("/repos/:owner/:repo/issues", (c) => handle(c, recorder, runId, async () => {
|
|
137
|
-
const args = { ...params(c), ...createIssueSchema.parse(await readJson(c)) };
|
|
138
|
-
const { value, delta } = captureDelta((onDelta) => domain.createIssue(args, onDelta));
|
|
139
|
-
return created(value, delta);
|
|
140
|
-
}));
|
|
141
|
-
session.get("/repos/:owner/:repo/issues/:number", (c) => handle(c, recorder, runId, () => ok(domain.getIssue({ ...params(c), issue_number: numberParam(c, "number") }))));
|
|
142
|
-
session.patch("/repos/:owner/:repo/issues/:number", (c) => handle(c, recorder, runId, async () => {
|
|
143
|
-
const args = { ...params(c), issue_number: numberParam(c, "number"), ...updateIssueSchema.parse(await readJson(c)) };
|
|
144
|
-
const { value, delta } = captureDelta((onDelta) => domain.updateIssue(args, onDelta));
|
|
145
|
-
return ok(value, true, delta);
|
|
146
|
-
}));
|
|
147
|
-
session.get("/repos/:owner/:repo/issues/:number/comments", (c) => handle(c, recorder, runId, () => ok(domain.listIssueComments({ ...params(c), issue_number: numberParam(c, "number"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
148
|
-
session.post("/repos/:owner/:repo/issues/:number/comments", (c) => handle(c, recorder, runId, async () => {
|
|
149
|
-
const args = { ...params(c), issue_number: numberParam(c, "number"), ...commentSchema.parse(await readJson(c)) };
|
|
150
|
-
const { value, delta } = captureDelta((onDelta) => domain.addIssueComment(args, onDelta));
|
|
151
|
-
return created(value, delta);
|
|
152
|
-
}));
|
|
153
|
-
session.get("/repos/:owner/:repo/labels", (c) => handle(c, recorder, runId, () => ok(domain.listRepositoryLabels(params(c)))));
|
|
154
|
-
session.post("/repos/:owner/:repo/labels", (c) => handle(c, recorder, runId, async () => {
|
|
155
|
-
const args = { ...params(c), ...labelSchema.parse(await readJson(c)) };
|
|
156
|
-
const { value, delta } = captureDelta((onDelta) => domain.createRepositoryLabel(args, onDelta));
|
|
157
|
-
return created(value, delta);
|
|
158
|
-
}));
|
|
159
|
-
session.get("/repos/:owner/:repo/issues/:number/labels", (c) => handle(c, recorder, runId, () => ok(domain.listIssueLabelsForIssue({ ...params(c), issue_number: numberParam(c, "number") }))));
|
|
160
|
-
session.post("/repos/:owner/:repo/issues/:number/labels", (c) => handle(c, recorder, runId, async () => {
|
|
161
|
-
const args = { ...params(c), issue_number: numberParam(c, "number"), ...labelsSchema.parse(await readJson(c)) };
|
|
162
|
-
const { value, delta } = captureDelta((onDelta) => domain.addIssueLabels(args, onDelta));
|
|
163
|
-
return ok(value, true, delta);
|
|
164
|
-
}));
|
|
165
|
-
session.delete("/repos/:owner/:repo/issues/:number/labels/:name", (c) => handle(c, recorder, runId, () => {
|
|
166
|
-
const args = { ...params(c), issue_number: numberParam(c, "number"), label: requireParam(c, "name") };
|
|
167
|
-
const { value, delta } = captureDelta((onDelta) => domain.deleteIssueLabel(args, onDelta));
|
|
168
|
-
return ok(value, true, delta);
|
|
169
|
-
}));
|
|
170
|
-
session.get("/repos/:owner/:repo/collaborators", (c) => handle(c, recorder, runId, () => ok(domain.listCollaborators(params(c)))));
|
|
171
|
-
session.get("/repos/:owner/:repo/collaborators/:username", (c) => handle(c, recorder, runId, () => {
|
|
172
|
-
const found = domain.isCollaborator({ ...params(c), username: requireParam(c, "username") });
|
|
173
|
-
if (!found)
|
|
174
|
-
throw new TwinError("Not Found", 404);
|
|
175
|
-
return { status: 204, body: null, mutation: false };
|
|
176
|
-
}));
|
|
177
|
-
session.post("/repos/:owner/:repo/issues/:number/assignees", (c) => handle(c, recorder, runId, async () => {
|
|
178
|
-
const args = { ...params(c), issue_number: numberParam(c, "number"), ...assigneesSchema.parse(await readJson(c)) };
|
|
179
|
-
const { value, delta } = captureDelta((onDelta) => domain.addAssignees(args, onDelta));
|
|
180
|
-
return created(value, delta);
|
|
181
|
-
}));
|
|
182
|
-
session.get("/repos/:owner/:repo/pulls", (c) => handle(c, recorder, runId, () => ok(domain.listPullRequests({ ...params(c), state: stateQuery(c), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
183
|
-
session.post("/repos/:owner/:repo/pulls", (c) => handle(c, recorder, runId, async () => {
|
|
184
|
-
const actor = sessionFrom(c).login;
|
|
185
|
-
const args = { ...params(c), ...createPullSchema.parse(await readJson(c)), actor };
|
|
186
|
-
const { value, delta } = captureDelta((onDelta) => domain.createPullRequest(args, onDelta));
|
|
187
|
-
return created(value, delta);
|
|
188
|
-
}));
|
|
189
|
-
session.get("/repos/:owner/:repo/pulls/:number", (c) => handle(c, recorder, runId, () => ok(domain.getPullRequest({ ...params(c), pull_number: numberParam(c, "number") }))));
|
|
190
|
-
session.get("/repos/:owner/:repo/pulls/:number/files", (c) => handle(c, recorder, runId, () => ok(domain.getPullRequestFiles({ ...params(c), pull_number: numberParam(c, "number"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
191
|
-
session.get("/repos/:owner/:repo/pulls/:number/reviews", (c) => handle(c, recorder, runId, () => ok(domain.getPullRequestReviews({ ...params(c), pull_number: numberParam(c, "number"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
192
|
-
session.post("/repos/:owner/:repo/pulls/:number/reviews", (c) => handle(c, recorder, runId, async () => {
|
|
193
|
-
const args = { ...params(c), pull_number: numberParam(c, "number"), ...reviewSchema.parse(await readJson(c)) };
|
|
194
|
-
const { value, delta } = captureDelta((onDelta) => domain.createPullRequestReview(args, onDelta));
|
|
195
|
-
return created(value, delta);
|
|
196
|
-
}));
|
|
197
|
-
session.get("/repos/:owner/:repo/pulls/:number/comments", (c) => handle(c, recorder, runId, () => ok(domain.getPullRequestComments({ ...params(c), pull_number: numberParam(c, "number"), page: numberQuery(c, "page"), per_page: numberQuery(c, "per_page") }))));
|
|
198
|
-
session.get("/repos/:owner/:repo/pulls/:number/status", (c) => handle(c, recorder, runId, () => ok(domain.getPullRequestStatus({ ...params(c), pull_number: numberParam(c, "number") }))));
|
|
199
|
-
session.put("/repos/:owner/:repo/pulls/:number/merge", (c) => handle(c, recorder, runId, async () => {
|
|
200
|
-
const args = { ...params(c), pull_number: numberParam(c, "number"), ...mergeSchema.parse(await maybeJson(c)) };
|
|
201
|
-
const actor = sessionFrom(c).login;
|
|
202
|
-
if (!actor || !domain.isCollaborator({ owner: args.owner, repo: args.repo, username: actor })) {
|
|
203
|
-
throw new TwinError("Must have push access to the repository to merge pull requests.", 403);
|
|
204
|
-
}
|
|
205
|
-
const { value, delta } = captureDelta((onDelta) => domain.mergePullRequest(args, onDelta));
|
|
206
|
-
return ok(value, true, delta);
|
|
207
|
-
}));
|
|
208
|
-
session.put("/repos/:owner/:repo/pulls/:number/update-branch", (c) => handle(c, recorder, runId, async () => {
|
|
209
|
-
const args = { ...params(c), pull_number: numberParam(c, "number"), ...updateBranchSchema.parse(await maybeJson(c)) };
|
|
210
|
-
const { value, delta } = captureDelta((onDelta) => domain.updatePullRequestBranch(args, onDelta));
|
|
211
|
-
return ok(value, true, delta);
|
|
212
|
-
}));
|
|
213
|
-
session.all("*", (c) => respond(c, recorder, runId, Date.now(), null, unsupportedEnvelope.status, unsupportedEnvelope.body, false, "unsupported"));
|
|
214
|
-
root.route("/s/:sid", session);
|
|
215
|
-
return root;
|
|
216
|
-
}
|
|
217
|
-
function ok(body, mutation = false, stateDelta = null) {
|
|
218
|
-
return { status: 200, body, mutation, stateDelta };
|
|
219
|
-
}
|
|
220
|
-
function created(body, stateDelta = null) {
|
|
221
|
-
return { status: 201, body, mutation: true, stateDelta };
|
|
222
|
-
}
|
|
223
|
-
async function handle(c, recorder, runId, fn) {
|
|
224
|
-
const started = Date.now();
|
|
225
|
-
let requestBody = null;
|
|
226
|
-
try {
|
|
227
|
-
requestBody = c.req.method === "GET" || c.req.method === "HEAD" ? null : await c.req.raw.clone().json().catch(() => null);
|
|
228
|
-
const result = await fn();
|
|
229
|
-
return respond(c, recorder, runId, started, requestBody, result.status, result.body, result.mutation, "semantic", result.stateDelta ?? null);
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
if (error instanceof TwinError) {
|
|
233
|
-
return respond(c, recorder, runId, started, requestBody, error.status, githubError(error.message, error.status, error.errors), false);
|
|
234
|
-
}
|
|
235
|
-
if (error instanceof z.ZodError) {
|
|
236
|
-
return respond(c, recorder, runId, started, requestBody, 422, githubError("Validation Failed", 422, error.issues.map((issue) => ({
|
|
237
|
-
resource: "Request",
|
|
238
|
-
field: issue.path.join("."),
|
|
239
|
-
code: issue.code
|
|
240
|
-
}))), false);
|
|
241
|
-
}
|
|
242
|
-
if (error instanceof SyntaxError) {
|
|
243
|
-
return respond(c, recorder, runId, started, requestBody, 400, githubError("Problems parsing JSON", 400), false);
|
|
244
|
-
}
|
|
245
|
-
return respond(c, recorder, runId, started, requestBody, 500, githubError(error instanceof Error ? error.message : "Internal Server Error", 500), false);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
function respond(c, recorder, runId, started, requestBody, status, responseBody, stateMutation, fidelity = "semantic", stateDelta = null) {
|
|
249
|
-
const reqId = requestId();
|
|
250
|
-
const correlationHeader = c.req.header("x-pome-correlation-id") ?? null;
|
|
251
|
-
recorder?.record({
|
|
252
|
-
ts: new Date().toISOString(),
|
|
253
|
-
run_id: runId,
|
|
254
|
-
twin: "github",
|
|
255
|
-
request_id: reqId,
|
|
256
|
-
// FDRS-402: persist the adapter's x-pome-correlation-id as `correlation_id`
|
|
257
|
-
// (legacy correlator path) and as `tool_call_id` (adapter-rich path).
|
|
258
|
-
// When the header is absent we keep the heuristic-path fallback: reqId for
|
|
259
|
-
// correlation_id, null for tool_call_id.
|
|
260
|
-
correlation_id: correlationHeader ?? reqId,
|
|
261
|
-
scenario_step_id: c.req.header("x-pome-scenario-step-id") ?? null,
|
|
262
|
-
step_id: null,
|
|
263
|
-
tool_call_id: correlationHeader,
|
|
264
|
-
method: c.req.method,
|
|
265
|
-
path: new URL(c.req.url).pathname,
|
|
266
|
-
request_body: requestBody,
|
|
267
|
-
status,
|
|
268
|
-
response_body: responseBody,
|
|
269
|
-
latency_ms: Date.now() - started,
|
|
270
|
-
fidelity,
|
|
271
|
-
state_mutation: stateMutation,
|
|
272
|
-
state_delta: stateDelta,
|
|
273
|
-
error: status >= 400 ? responseBody.message ?? "request failed" : null
|
|
274
|
-
});
|
|
275
|
-
if (status === 204)
|
|
276
|
-
return c.body(null, status);
|
|
277
|
-
return c.json(responseBody, status);
|
|
278
|
-
}
|
|
279
|
-
async function readJson(c) {
|
|
280
|
-
try {
|
|
281
|
-
return await c.req.json();
|
|
282
|
-
}
|
|
283
|
-
catch {
|
|
284
|
-
throw new SyntaxError("Problems parsing JSON");
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
async function maybeJson(c) {
|
|
288
|
-
try {
|
|
289
|
-
return await c.req.json();
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
return {};
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function params(c) {
|
|
296
|
-
return { owner: requireParam(c, "owner"), repo: requireParam(c, "repo") };
|
|
297
|
-
}
|
|
298
|
-
function sessionFrom(c) {
|
|
299
|
-
return c.get("session") ?? { sid: "", team_id: "" };
|
|
300
|
-
}
|
|
301
|
-
function numberParam(c, name) {
|
|
302
|
-
const value = Number(c.req.param(name));
|
|
303
|
-
if (!Number.isInteger(value) || value < 1)
|
|
304
|
-
validationFailed(name, "invalid", c.req.param(name));
|
|
305
|
-
return value;
|
|
306
|
-
}
|
|
307
|
-
function requireParam(c, name) {
|
|
308
|
-
const value = c.req.param(name);
|
|
309
|
-
if (!value)
|
|
310
|
-
throw new TwinError(`Missing route parameter: ${name}`, 400);
|
|
311
|
-
return value;
|
|
312
|
-
}
|
|
313
|
-
function contentPath(c) {
|
|
314
|
-
const { owner, repo } = params(c);
|
|
315
|
-
const sid = c.req.param("sid");
|
|
316
|
-
const pathname = new URL(c.req.url).pathname;
|
|
317
|
-
const prefix = `/s/${sid}/repos/${owner}/${repo}/contents/`;
|
|
318
|
-
return decodeURIComponent(pathname.startsWith(prefix) ? pathname.slice(prefix.length) : "");
|
|
319
|
-
}
|
|
320
|
-
function numberQuery(c, name) {
|
|
321
|
-
const value = c.req.query(name);
|
|
322
|
-
return value ? Number(value) : undefined;
|
|
323
|
-
}
|
|
324
|
-
function stateQuery(c) {
|
|
325
|
-
const state = c.req.query("state");
|
|
326
|
-
return state === "open" || state === "closed" || state === "all" ? state : undefined;
|
|
327
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MiddlewareHandler } from "hono";
|
|
2
|
-
export interface SessionClaims {
|
|
3
|
-
sid: string;
|
|
4
|
-
team_id: string;
|
|
5
|
-
exp: number;
|
|
6
|
-
login?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface Session {
|
|
9
|
-
sid: string;
|
|
10
|
-
team_id: string;
|
|
11
|
-
login?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function resolveAuthSecret(): string;
|
|
14
|
-
export declare function bearerAuth(): MiddlewareHandler;
|
|
15
|
-
export declare function requireAdminAuth(): MiddlewareHandler;
|
|
16
|
-
export declare const localhostOnly: typeof requireAdminAuth;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
-
import { verify } from "hono/jwt";
|
|
3
|
-
export function resolveAuthSecret() {
|
|
4
|
-
const secret = process.env.TWIN_AUTH_SECRET;
|
|
5
|
-
if (!secret && process.env.NODE_ENV === "production") {
|
|
6
|
-
throw new Error("TWIN_AUTH_SECRET required in production");
|
|
7
|
-
}
|
|
8
|
-
return secret ?? "dev-only-insecure-secret";
|
|
9
|
-
}
|
|
10
|
-
function unauthorized(message) {
|
|
11
|
-
return Response.json({ message, documentation_url: "" }, { status: 401 });
|
|
12
|
-
}
|
|
13
|
-
function extractSidFromUrl(rawUrl) {
|
|
14
|
-
try {
|
|
15
|
-
const path = new URL(rawUrl).pathname;
|
|
16
|
-
const match = path.match(/^\/s\/([^/]+)/);
|
|
17
|
-
return match?.[1] ? decodeURIComponent(match[1]) : undefined;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export function bearerAuth() {
|
|
24
|
-
return async (c, next) => {
|
|
25
|
-
const header = c.req.header("Authorization") ?? c.req.header("authorization");
|
|
26
|
-
if (!header || !header.startsWith("Bearer ")) {
|
|
27
|
-
return unauthorized("Bad credentials");
|
|
28
|
-
}
|
|
29
|
-
const token = header.slice("Bearer ".length).trim();
|
|
30
|
-
if (!token)
|
|
31
|
-
return unauthorized("Bad credentials");
|
|
32
|
-
const providerSid = verifyProviderToken("github", token);
|
|
33
|
-
if (providerSid) {
|
|
34
|
-
const pathSid = c.req.param("sid") ?? extractSidFromUrl(c.req.url);
|
|
35
|
-
if (providerSid !== pathSid) {
|
|
36
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 401 });
|
|
37
|
-
}
|
|
38
|
-
c.set("session", { sid: providerSid, team_id: "provider-shaped" });
|
|
39
|
-
await next();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
let claims;
|
|
43
|
-
try {
|
|
44
|
-
claims = (await verify(token, resolveAuthSecret(), "HS256"));
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return unauthorized("Bad credentials");
|
|
48
|
-
}
|
|
49
|
-
if (typeof claims.exp === "number" && claims.exp < Math.floor(Date.now() / 1000)) {
|
|
50
|
-
return unauthorized("Token expired");
|
|
51
|
-
}
|
|
52
|
-
const pathSid = c.req.param("sid") ?? extractSidFromUrl(c.req.url);
|
|
53
|
-
if (!claims.sid || claims.sid !== pathSid) {
|
|
54
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 401 });
|
|
55
|
-
}
|
|
56
|
-
const session = { sid: claims.sid, team_id: claims.team_id };
|
|
57
|
-
if (typeof claims.login === "string" && claims.login.length > 0)
|
|
58
|
-
session.login = claims.login;
|
|
59
|
-
c.set("session", session);
|
|
60
|
-
await next();
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function verifyProviderToken(provider, token) {
|
|
64
|
-
const match = token.match(/^(?:github_pat|ghp)_pome_([^_]+)_(?:(\d+)_)?(.+)$/);
|
|
65
|
-
if (!match)
|
|
66
|
-
return undefined;
|
|
67
|
-
const sid = decodeBase64Url(match[1]);
|
|
68
|
-
if (!sid)
|
|
69
|
-
return undefined;
|
|
70
|
-
const exp = match[2] ? Number(match[2]) : undefined;
|
|
71
|
-
if (exp !== undefined && (!Number.isSafeInteger(exp) || exp < Math.floor(Date.now() / 1000))) {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
const expected = exp === undefined
|
|
75
|
-
? signProvider(provider, sid, resolveAuthSecret())
|
|
76
|
-
: signProviderExp(provider, sid, exp, resolveAuthSecret());
|
|
77
|
-
const actual = match[3];
|
|
78
|
-
if (safeEqual(actual, expected))
|
|
79
|
-
return sid;
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
function signProvider(provider, sid, secret) {
|
|
83
|
-
return createHmac("sha256", secret)
|
|
84
|
-
.update(`${provider}:${sid}`)
|
|
85
|
-
.digest("base64url")
|
|
86
|
-
.slice(0, 22);
|
|
87
|
-
}
|
|
88
|
-
function signProviderExp(provider, sid, exp, secret) {
|
|
89
|
-
return createHmac("sha256", secret)
|
|
90
|
-
.update(`${provider}:${sid}:${exp}`)
|
|
91
|
-
.digest("base64url")
|
|
92
|
-
.slice(0, 22);
|
|
93
|
-
}
|
|
94
|
-
function decodeBase64Url(value) {
|
|
95
|
-
try {
|
|
96
|
-
return Buffer.from(value, "base64url").toString("utf8");
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function safeEqual(a, b) {
|
|
103
|
-
const ab = Buffer.from(a);
|
|
104
|
-
const bb = Buffer.from(b);
|
|
105
|
-
return ab.length === bb.length && timingSafeEqual(ab, bb);
|
|
106
|
-
}
|
|
107
|
-
export function requireAdminAuth() {
|
|
108
|
-
return async (c, next) => {
|
|
109
|
-
const adminToken = process.env.TWIN_ADMIN_TOKEN;
|
|
110
|
-
if (adminToken && adminToken.length > 0) {
|
|
111
|
-
const provided = c.req.header("X-Admin-Token") ?? c.req.header("x-admin-token");
|
|
112
|
-
if (!provided) {
|
|
113
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 403 });
|
|
114
|
-
}
|
|
115
|
-
const a = Buffer.from(provided);
|
|
116
|
-
const b = Buffer.from(adminToken);
|
|
117
|
-
if (a.length !== b.length || !timingSafeEqual(a, b)) {
|
|
118
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 403 });
|
|
119
|
-
}
|
|
120
|
-
await next();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const remote = c.env?.incoming?.socket
|
|
124
|
-
?.remoteAddress;
|
|
125
|
-
if (!remote) {
|
|
126
|
-
if (process.env.NODE_ENV === "production") {
|
|
127
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 403 });
|
|
128
|
-
}
|
|
129
|
-
await next();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const isLocal = remote === "127.0.0.1" ||
|
|
133
|
-
remote === "::1" ||
|
|
134
|
-
remote === "::ffff:127.0.0.1" ||
|
|
135
|
-
remote === "localhost";
|
|
136
|
-
if (!isLocal) {
|
|
137
|
-
return Response.json({ message: "Forbidden", documentation_url: "" }, { status: 403 });
|
|
138
|
-
}
|
|
139
|
-
await next();
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
export const localhostOnly = requireAdminAuth;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
// F6 — read the CI-baked `dist/build-info.json` written by
|
|
6
|
-
// `scripts/copy-prompts.mjs`. The published tarball ships this file under
|
|
7
|
-
// `dist/`, so a `pome health` from `npm install -g pome-sh` resolves the real
|
|
8
|
-
// commit SHA and ISO build timestamp instead of the previous "dev"
|
|
9
|
-
// placeholder. Runtime env vars (POME_TWIN_GIT_SHA / POME_TWIN_VERSION /
|
|
10
|
-
// POME_TWIN_BUILD_TIME) still override — useful for hosted twins that bake
|
|
11
|
-
// versioning in via process env. Final fallback is "dev" so a contributor
|
|
12
|
-
// install without CI baking still produces a working response.
|
|
13
|
-
let cachedBakedInfo = null;
|
|
14
|
-
function loadBakedInfo() {
|
|
15
|
-
if (cachedBakedInfo)
|
|
16
|
-
return cachedBakedInfo;
|
|
17
|
-
try {
|
|
18
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
// From `dist/src/twin-github/build-info.js`, dist/build-info.json is
|
|
20
|
-
// three levels up. From the unbuilt source file the lookup misses and
|
|
21
|
-
// we cleanly fall back. Walk both shapes so tests / direct tsx runs
|
|
22
|
-
// also pick up a sibling-of-source generated file if one exists.
|
|
23
|
-
const candidates = [
|
|
24
|
-
resolve(here, "..", "..", "..", "build-info.json"),
|
|
25
|
-
resolve(here, "..", "..", "build-info.json"),
|
|
26
|
-
];
|
|
27
|
-
for (const candidate of candidates) {
|
|
28
|
-
if (existsSync(candidate)) {
|
|
29
|
-
const raw = readFileSync(candidate, "utf8");
|
|
30
|
-
cachedBakedInfo = JSON.parse(raw);
|
|
31
|
-
return cachedBakedInfo;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
/* fall through */
|
|
37
|
-
}
|
|
38
|
-
cachedBakedInfo = {};
|
|
39
|
-
return cachedBakedInfo;
|
|
40
|
-
}
|
|
41
|
-
export function twinBuildInfo() {
|
|
42
|
-
const baked = loadBakedInfo();
|
|
43
|
-
return {
|
|
44
|
-
package: "@pome-sh/twin-github",
|
|
45
|
-
version: process.env.POME_TWIN_VERSION ?? baked.version ?? "0.1.0",
|
|
46
|
-
git_sha: process.env.POME_TWIN_GIT_SHA ??
|
|
47
|
-
process.env.VERCEL_GIT_COMMIT_SHA ??
|
|
48
|
-
baked.git_sha ??
|
|
49
|
-
"dev",
|
|
50
|
-
build_time: process.env.POME_TWIN_BUILD_TIME ?? baked.build_time ?? "dev",
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { GitHubCloneDatabase } from "./types.js";
|
|
2
|
-
export declare function openGitHubCloneDatabase(path?: string): GitHubCloneDatabase;
|
|
3
|
-
export declare function migrate(db: GitHubCloneDatabase): void;
|
|
4
|
-
export declare function resetDatabase(db: GitHubCloneDatabase): void;
|