@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
package/dist/src/score/view.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
//
|
|
3
|
-
// Cloud-verdict DISPLAY model + pure label/render helpers (FDRS-656/657).
|
|
4
|
-
//
|
|
5
|
-
// The OSS CLI is CAPTURE-ONLY: it never computes a score, never runs a judge,
|
|
6
|
-
// and never correlates locally. Every helper here operates on a score object
|
|
7
|
-
// that ORIGINATES FROM THE CLOUD (a hosted `pome run` /finalize response, or a
|
|
8
|
-
// `pome eval` upload verdict — see `scoreFromFinalizeResponse`). Nothing in
|
|
9
|
-
// this module derives a verdict from twin state, events, or a judge call.
|
|
10
|
-
//
|
|
11
|
-
// This is the relocation of the former `src/evaluator/score.ts` + the
|
|
12
|
-
// verdict-rendering half of `src/cli/render.ts`. The local scoring engine
|
|
13
|
-
// (`scoreResults`, the deterministic matchers, the BYOK LLM judge) was deleted
|
|
14
|
-
// under FDRS-657; only the pure display model survives, moved out of the
|
|
15
|
-
// `evaluator/` tree so the `no-eval-in-oss` gate can assert that tree is gone.
|
|
16
|
-
// Derive the four-state outcome from a cloud result. Prefers the explicit
|
|
17
|
-
// `outcome` field; falls back to the legacy passed/skipped booleans. PURE.
|
|
18
|
-
export function outcomeOf(result) {
|
|
19
|
-
if (result.outcome)
|
|
20
|
-
return result.outcome;
|
|
21
|
-
if (result.skipped)
|
|
22
|
-
return "skipped";
|
|
23
|
-
return result.passed ? "passed" : "failed";
|
|
24
|
-
}
|
|
25
|
-
// Single source of truth for "did this run pass?", applied to a CLOUD score.
|
|
26
|
-
// Encodes the A5 guard: a run is only a PASS when it was evaluated, every
|
|
27
|
-
// required criterion was evaluated (can_pass), AND satisfaction cleared the
|
|
28
|
-
// threshold. PURE — no computation of the score itself.
|
|
29
|
-
export function scoreStatus(score, passThreshold) {
|
|
30
|
-
if (!score.evaluated || !score.can_pass)
|
|
31
|
-
return "unevaluated";
|
|
32
|
-
return score.satisfaction >= passThreshold ? "pass" : "fail";
|
|
33
|
-
}
|
|
34
|
-
export function scenarioPassed(score, passThreshold) {
|
|
35
|
-
return scoreStatus(score, passThreshold) === "pass";
|
|
36
|
-
}
|
|
37
|
-
// FDRS-591/611 per-criterion marker: ✓ passed, ✗ failed, - skipped, ! errored.
|
|
38
|
-
export function markerFor(outcome) {
|
|
39
|
-
switch (outcome) {
|
|
40
|
-
case "passed":
|
|
41
|
-
return "✓";
|
|
42
|
-
case "failed":
|
|
43
|
-
return "✗";
|
|
44
|
-
case "errored":
|
|
45
|
-
return "!";
|
|
46
|
-
default:
|
|
47
|
-
return "-";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function scoreCountsSummary(score) {
|
|
51
|
-
return `${score.passed ?? 0} passed, ${score.failed ?? 0} failed, ${score.skipped ?? 0} skipped, ${score.errored ?? 0} errored`;
|
|
52
|
-
}
|
|
53
|
-
export function runScoreLine(score, passThreshold, unevaluatedNumericLabel) {
|
|
54
|
-
const status = scoreStatus(score, passThreshold);
|
|
55
|
-
if (status === "unevaluated") {
|
|
56
|
-
return `score: un-evaluated (cannot pass) — ${scoreCountsSummary(score)}; ${unevaluatedNumericLabel}: ${score.satisfaction}/100`;
|
|
57
|
-
}
|
|
58
|
-
return `score: ${score.satisfaction}/100`;
|
|
59
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import type { GitHubTwinDatabase, Recorder, SeedState } from "./types.js";
|
|
3
|
-
type AppOptions = {
|
|
4
|
-
db?: GitHubTwinDatabase;
|
|
5
|
-
seed?: SeedState;
|
|
6
|
-
recorder?: Recorder;
|
|
7
|
-
runId?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function createGitHubTwinApp(options?: AppOptions): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
10
|
-
export {};
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
import { Hono } from "hono";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { createRequestId } from "../../recorder/recorder.js";
|
|
5
|
-
import { openGitHubTwinDatabase } from "./db/openDatabase.js";
|
|
6
|
-
import { addIssueLabel, createComment, createLabel, deleteIssueLabel, exportState, getIssue, getLabel, getRepo, hasCollaborator, listCollaborators, listIssueLabels, listIssues, listLabels, seedDatabase, updateIssue } from "./db/queries.js";
|
|
7
|
-
import { defaultSeedState } from "./domain/seed.js";
|
|
8
|
-
import { collaboratorJson, commentJson, issueJson, labelJson, repoJson } from "./domain/serializers.js";
|
|
9
|
-
const issuePatchSchema = z.object({
|
|
10
|
-
title: z.string().min(1).optional(),
|
|
11
|
-
body: z.string().optional(),
|
|
12
|
-
state: z.enum(["open", "closed"]).optional(),
|
|
13
|
-
assignee: z.string().nullable().optional(),
|
|
14
|
-
assignees: z.array(z.string().min(1)).optional()
|
|
15
|
-
});
|
|
16
|
-
const createCommentSchema = z.object({
|
|
17
|
-
body: z.string().min(1)
|
|
18
|
-
});
|
|
19
|
-
const createLabelSchema = z.object({
|
|
20
|
-
name: z.string().min(1),
|
|
21
|
-
color: z.string().default("ededed"),
|
|
22
|
-
description: z.string().default("")
|
|
23
|
-
});
|
|
24
|
-
const addLabelsSchema = z.object({
|
|
25
|
-
labels: z.array(z.string().min(1)).min(1)
|
|
26
|
-
});
|
|
27
|
-
const addAssigneesSchema = z.object({
|
|
28
|
-
assignees: z.array(z.string().min(1)).min(1)
|
|
29
|
-
});
|
|
30
|
-
export function createGitHubTwinApp(options = {}) {
|
|
31
|
-
const db = options.db ?? openGitHubTwinDatabase();
|
|
32
|
-
if (!options.db) {
|
|
33
|
-
seedDatabase(db, options.seed ?? defaultSeedState());
|
|
34
|
-
}
|
|
35
|
-
const recorder = options.recorder;
|
|
36
|
-
const runId = options.runId ?? "local";
|
|
37
|
-
const app = new Hono();
|
|
38
|
-
app.get("/_pome/health", (c) => c.json({
|
|
39
|
-
ok: true,
|
|
40
|
-
twin: "github",
|
|
41
|
-
fidelity: "semantic"
|
|
42
|
-
}));
|
|
43
|
-
app.get("/_pome/state", (c) => c.json(exportState(db)));
|
|
44
|
-
app.get("/_pome/events", (c) => c.json(recorder?.events() ?? []));
|
|
45
|
-
app.get("/repos/:owner/:repo", (c) => {
|
|
46
|
-
const started = Date.now();
|
|
47
|
-
const repo = getRepoForRequest(c, db);
|
|
48
|
-
if (!repo) {
|
|
49
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
50
|
-
}
|
|
51
|
-
return respond(c, recorder, runId, started, null, 200, repoJson(repo), false);
|
|
52
|
-
});
|
|
53
|
-
app.get("/repos/:owner/:repo/issues", (c) => {
|
|
54
|
-
const started = Date.now();
|
|
55
|
-
const repo = getRepoForRequest(c, db);
|
|
56
|
-
if (!repo) {
|
|
57
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
58
|
-
}
|
|
59
|
-
const issues = listIssues(db, repo.id).map((issue) => issueJson(issue, listIssueLabels(db, repo.id, issue.number), repo));
|
|
60
|
-
return respond(c, recorder, runId, started, null, 200, issues, false);
|
|
61
|
-
});
|
|
62
|
-
app.get("/repos/:owner/:repo/issues/:number", (c) => {
|
|
63
|
-
const started = Date.now();
|
|
64
|
-
const found = getIssueForRequest(c, db);
|
|
65
|
-
if (!found.repo) {
|
|
66
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
67
|
-
}
|
|
68
|
-
if (!found.issue) {
|
|
69
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Issue not found", 404), false);
|
|
70
|
-
}
|
|
71
|
-
const body = issueJson(found.issue, listIssueLabels(db, found.repo.id, found.issue.number), found.repo);
|
|
72
|
-
return respond(c, recorder, runId, started, null, 200, body, false);
|
|
73
|
-
});
|
|
74
|
-
app.patch("/repos/:owner/:repo/issues/:number", async (c) => {
|
|
75
|
-
const started = Date.now();
|
|
76
|
-
const parsed = await parseBody(c, issuePatchSchema);
|
|
77
|
-
if (!parsed.ok) {
|
|
78
|
-
return respond(c, recorder, runId, started, parsed.raw, parsed.status, parsed.body, false);
|
|
79
|
-
}
|
|
80
|
-
const found = getIssueForRequest(c, db);
|
|
81
|
-
if (!found.repo) {
|
|
82
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Not Found", 404), false);
|
|
83
|
-
}
|
|
84
|
-
if (!found.issue) {
|
|
85
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Issue not found", 404), false);
|
|
86
|
-
}
|
|
87
|
-
const requestedAssignee = parsed.data.assignee ?? parsed.data.assignees?.[0];
|
|
88
|
-
if (requestedAssignee && !hasCollaborator(db, found.repo.id, requestedAssignee)) {
|
|
89
|
-
return respond(c, recorder, runId, started, parsed.raw, 422, githubError("Validation Failed", 422, [
|
|
90
|
-
{ resource: "Issue", field: "assignees", code: "invalid" }
|
|
91
|
-
]), false);
|
|
92
|
-
}
|
|
93
|
-
const issue = updateIssue(db, found.repo.id, found.issue.number, {
|
|
94
|
-
title: parsed.data.title,
|
|
95
|
-
body: parsed.data.body,
|
|
96
|
-
state: parsed.data.state,
|
|
97
|
-
assignee_login: requestedAssignee
|
|
98
|
-
});
|
|
99
|
-
const body = issueJson(issue, listIssueLabels(db, found.repo.id, found.issue.number), found.repo);
|
|
100
|
-
return respond(c, recorder, runId, started, parsed.raw, 200, body, true);
|
|
101
|
-
});
|
|
102
|
-
app.post("/repos/:owner/:repo/issues/:number/comments", async (c) => {
|
|
103
|
-
const started = Date.now();
|
|
104
|
-
const parsed = await parseBody(c, createCommentSchema);
|
|
105
|
-
if (!parsed.ok) {
|
|
106
|
-
return respond(c, recorder, runId, started, parsed.raw, parsed.status, parsed.body, false);
|
|
107
|
-
}
|
|
108
|
-
const found = getIssueForRequest(c, db);
|
|
109
|
-
if (!found.repo) {
|
|
110
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Not Found", 404), false);
|
|
111
|
-
}
|
|
112
|
-
if (!found.issue) {
|
|
113
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Issue not found", 404), false);
|
|
114
|
-
}
|
|
115
|
-
const comment = createComment(db, found.repo.id, found.issue.number, parsed.data.body);
|
|
116
|
-
return respond(c, recorder, runId, started, parsed.raw, 201, commentJson(comment, found.repo, found.issue.number), true);
|
|
117
|
-
});
|
|
118
|
-
app.get("/repos/:owner/:repo/labels", (c) => {
|
|
119
|
-
const started = Date.now();
|
|
120
|
-
const repo = getRepoForRequest(c, db);
|
|
121
|
-
if (!repo) {
|
|
122
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
123
|
-
}
|
|
124
|
-
return respond(c, recorder, runId, started, null, 200, listLabels(db, repo.id).map(labelJson), false);
|
|
125
|
-
});
|
|
126
|
-
app.post("/repos/:owner/:repo/labels", async (c) => {
|
|
127
|
-
const started = Date.now();
|
|
128
|
-
const parsed = await parseBody(c, createLabelSchema);
|
|
129
|
-
if (!parsed.ok) {
|
|
130
|
-
return respond(c, recorder, runId, started, parsed.raw, parsed.status, parsed.body, false);
|
|
131
|
-
}
|
|
132
|
-
const repo = getRepoForRequest(c, db);
|
|
133
|
-
if (!repo) {
|
|
134
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Not Found", 404), false);
|
|
135
|
-
}
|
|
136
|
-
if (getLabel(db, repo.id, parsed.data.name)) {
|
|
137
|
-
return respond(c, recorder, runId, started, parsed.raw, 422, githubError("Validation Failed", 422, [
|
|
138
|
-
{ resource: "Label", field: "name", code: "already_exists" }
|
|
139
|
-
]), false);
|
|
140
|
-
}
|
|
141
|
-
const label = createLabel(db, repo.id, parsed.data.name, parsed.data.color, parsed.data.description);
|
|
142
|
-
return respond(c, recorder, runId, started, parsed.raw, 201, labelJson(label), true);
|
|
143
|
-
});
|
|
144
|
-
app.get("/repos/:owner/:repo/issues/:number/labels", (c) => {
|
|
145
|
-
const started = Date.now();
|
|
146
|
-
const found = getIssueForRequest(c, db);
|
|
147
|
-
if (!found.repo) {
|
|
148
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
149
|
-
}
|
|
150
|
-
if (!found.issue) {
|
|
151
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Issue not found", 404), false);
|
|
152
|
-
}
|
|
153
|
-
return respond(c, recorder, runId, started, null, 200, listIssueLabels(db, found.repo.id, found.issue.number).map(labelJson), false);
|
|
154
|
-
});
|
|
155
|
-
app.post("/repos/:owner/:repo/issues/:number/labels", async (c) => {
|
|
156
|
-
const started = Date.now();
|
|
157
|
-
const parsed = await parseBody(c, addLabelsSchema);
|
|
158
|
-
if (!parsed.ok) {
|
|
159
|
-
return respond(c, recorder, runId, started, parsed.raw, parsed.status, parsed.body, false);
|
|
160
|
-
}
|
|
161
|
-
const found = getIssueForRequest(c, db);
|
|
162
|
-
if (!found.repo) {
|
|
163
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Not Found", 404), false);
|
|
164
|
-
}
|
|
165
|
-
if (!found.issue) {
|
|
166
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Issue not found", 404), false);
|
|
167
|
-
}
|
|
168
|
-
for (const labelName of parsed.data.labels) {
|
|
169
|
-
if (!getLabel(db, found.repo.id, labelName)) {
|
|
170
|
-
return respond(c, recorder, runId, started, parsed.raw, 422, githubError("Validation Failed", 422, [
|
|
171
|
-
{ resource: "Label", field: "name", code: "missing", value: labelName }
|
|
172
|
-
]), false);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
for (const labelName of parsed.data.labels) {
|
|
176
|
-
addIssueLabel(db, found.repo.id, found.issue.number, labelName);
|
|
177
|
-
}
|
|
178
|
-
return respond(c, recorder, runId, started, parsed.raw, 200, listIssueLabels(db, found.repo.id, found.issue.number).map(labelJson), true);
|
|
179
|
-
});
|
|
180
|
-
app.delete("/repos/:owner/:repo/issues/:number/labels/:name", (c) => {
|
|
181
|
-
const started = Date.now();
|
|
182
|
-
const found = getIssueForRequest(c, db);
|
|
183
|
-
if (!found.repo) {
|
|
184
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
185
|
-
}
|
|
186
|
-
if (!found.issue) {
|
|
187
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Issue not found", 404), false);
|
|
188
|
-
}
|
|
189
|
-
const changes = deleteIssueLabel(db, found.repo.id, found.issue.number, c.req.param("name"));
|
|
190
|
-
if (!changes) {
|
|
191
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Label not found", 404), false);
|
|
192
|
-
}
|
|
193
|
-
return respond(c, recorder, runId, started, null, 200, listIssueLabels(db, found.repo.id, found.issue.number).map(labelJson), true);
|
|
194
|
-
});
|
|
195
|
-
app.get("/repos/:owner/:repo/collaborators", (c) => {
|
|
196
|
-
const started = Date.now();
|
|
197
|
-
const repo = getRepoForRequest(c, db);
|
|
198
|
-
if (!repo) {
|
|
199
|
-
return respond(c, recorder, runId, started, null, 404, githubError("Not Found", 404), false);
|
|
200
|
-
}
|
|
201
|
-
return respond(c, recorder, runId, started, null, 200, listCollaborators(db, repo.id).map(collaboratorJson), false);
|
|
202
|
-
});
|
|
203
|
-
app.post("/repos/:owner/:repo/issues/:number/assignees", async (c) => {
|
|
204
|
-
const started = Date.now();
|
|
205
|
-
const parsed = await parseBody(c, addAssigneesSchema);
|
|
206
|
-
if (!parsed.ok) {
|
|
207
|
-
return respond(c, recorder, runId, started, parsed.raw, parsed.status, parsed.body, false);
|
|
208
|
-
}
|
|
209
|
-
const found = getIssueForRequest(c, db);
|
|
210
|
-
if (!found.repo) {
|
|
211
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Not Found", 404), false);
|
|
212
|
-
}
|
|
213
|
-
if (!found.issue) {
|
|
214
|
-
return respond(c, recorder, runId, started, parsed.raw, 404, githubError("Issue not found", 404), false);
|
|
215
|
-
}
|
|
216
|
-
const assignee = parsed.data.assignees[0];
|
|
217
|
-
if (!hasCollaborator(db, found.repo.id, assignee)) {
|
|
218
|
-
return respond(c, recorder, runId, started, parsed.raw, 422, githubError("Validation Failed", 422, [
|
|
219
|
-
{ resource: "Issue", field: "assignees", code: "invalid", value: assignee }
|
|
220
|
-
]), false);
|
|
221
|
-
}
|
|
222
|
-
const issue = updateIssue(db, found.repo.id, found.issue.number, { assignee_login: assignee });
|
|
223
|
-
return respond(c, recorder, runId, started, parsed.raw, 201, issueJson(issue, listIssueLabels(db, found.repo.id, issue.number), found.repo), true);
|
|
224
|
-
});
|
|
225
|
-
app.all("*", (c) => {
|
|
226
|
-
const started = Date.now();
|
|
227
|
-
return respond(c, recorder, runId, started, null, 404, {
|
|
228
|
-
message: "This endpoint is not supported by this twin.",
|
|
229
|
-
fidelity: "unsupported",
|
|
230
|
-
supported_endpoints: [
|
|
231
|
-
"GET /repos/:owner/:repo",
|
|
232
|
-
"GET /repos/:owner/:repo/issues",
|
|
233
|
-
"GET /repos/:owner/:repo/issues/:number",
|
|
234
|
-
"PATCH /repos/:owner/:repo/issues/:number",
|
|
235
|
-
"POST /repos/:owner/:repo/issues/:number/comments",
|
|
236
|
-
"GET /repos/:owner/:repo/labels",
|
|
237
|
-
"POST /repos/:owner/:repo/labels",
|
|
238
|
-
"GET /repos/:owner/:repo/issues/:number/labels",
|
|
239
|
-
"POST /repos/:owner/:repo/issues/:number/labels",
|
|
240
|
-
"DELETE /repos/:owner/:repo/issues/:number/labels/:name",
|
|
241
|
-
"GET /repos/:owner/:repo/collaborators",
|
|
242
|
-
"POST /repos/:owner/:repo/issues/:number/assignees"
|
|
243
|
-
]
|
|
244
|
-
}, false, "unsupported");
|
|
245
|
-
});
|
|
246
|
-
return app;
|
|
247
|
-
}
|
|
248
|
-
function getRepoForRequest(c, db) {
|
|
249
|
-
const owner = c.req.param("owner");
|
|
250
|
-
const repo = c.req.param("repo");
|
|
251
|
-
if (!owner || !repo)
|
|
252
|
-
return undefined;
|
|
253
|
-
return getRepo(db, owner, repo);
|
|
254
|
-
}
|
|
255
|
-
function getIssueForRequest(c, db) {
|
|
256
|
-
const repo = getRepoForRequest(c, db);
|
|
257
|
-
const issueNumber = Number(c.req.param("number"));
|
|
258
|
-
return {
|
|
259
|
-
repo,
|
|
260
|
-
issue: repo && Number.isInteger(issueNumber) ? getIssue(db, repo.id, issueNumber) : undefined
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
function githubError(message, status, errors) {
|
|
264
|
-
return {
|
|
265
|
-
message,
|
|
266
|
-
documentation_url: "https://docs.github.com/rest",
|
|
267
|
-
status,
|
|
268
|
-
...(errors ? { errors } : {})
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
async function parseBody(c, schema) {
|
|
272
|
-
let raw;
|
|
273
|
-
try {
|
|
274
|
-
raw = await c.req.json();
|
|
275
|
-
}
|
|
276
|
-
catch {
|
|
277
|
-
return {
|
|
278
|
-
ok: false,
|
|
279
|
-
status: 400,
|
|
280
|
-
body: githubError("Problems parsing JSON", 400),
|
|
281
|
-
raw: null
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
const parsed = schema.safeParse(raw);
|
|
285
|
-
if (!parsed.success) {
|
|
286
|
-
return {
|
|
287
|
-
ok: false,
|
|
288
|
-
status: 422,
|
|
289
|
-
body: githubError("Validation Failed", 422, parsed.error.issues.map((issue) => ({
|
|
290
|
-
resource: "Request",
|
|
291
|
-
field: issue.path.join("."),
|
|
292
|
-
code: issue.code
|
|
293
|
-
}))),
|
|
294
|
-
raw
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
return { ok: true, data: parsed.data, raw };
|
|
298
|
-
}
|
|
299
|
-
function respond(c, recorder, runId, started, requestBody, status, responseBody, stateMutation, fidelity = "semantic") {
|
|
300
|
-
recorder?.record({
|
|
301
|
-
ts: new Date().toISOString(),
|
|
302
|
-
run_id: runId,
|
|
303
|
-
twin: "github",
|
|
304
|
-
request_id: createRequestId(),
|
|
305
|
-
method: c.req.method,
|
|
306
|
-
path: new URL(c.req.url).pathname,
|
|
307
|
-
request_body: requestBody,
|
|
308
|
-
status,
|
|
309
|
-
response_body: responseBody,
|
|
310
|
-
latency_ms: Date.now() - started,
|
|
311
|
-
fidelity,
|
|
312
|
-
state_mutation: stateMutation,
|
|
313
|
-
error: status >= 400 ? responseBody.message ?? "request failed" : null
|
|
314
|
-
});
|
|
315
|
-
return c.json(responseBody, status);
|
|
316
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const MIGRATION_SQL = `
|
|
2
|
-
CREATE TABLE IF NOT EXISTS repositories (
|
|
3
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
-
owner TEXT NOT NULL,
|
|
5
|
-
name TEXT NOT NULL,
|
|
6
|
-
full_name TEXT NOT NULL UNIQUE,
|
|
7
|
-
description TEXT NOT NULL DEFAULT '',
|
|
8
|
-
created_at TEXT NOT NULL,
|
|
9
|
-
updated_at TEXT NOT NULL
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE TABLE IF NOT EXISTS labels (
|
|
13
|
-
repo_id INTEGER NOT NULL,
|
|
14
|
-
name TEXT NOT NULL,
|
|
15
|
-
color TEXT NOT NULL,
|
|
16
|
-
description TEXT NOT NULL DEFAULT '',
|
|
17
|
-
PRIMARY KEY (repo_id, name),
|
|
18
|
-
FOREIGN KEY (repo_id) REFERENCES repositories(id) ON DELETE CASCADE
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
CREATE TABLE IF NOT EXISTS collaborators (
|
|
22
|
-
repo_id INTEGER NOT NULL,
|
|
23
|
-
login TEXT NOT NULL,
|
|
24
|
-
PRIMARY KEY (repo_id, login),
|
|
25
|
-
FOREIGN KEY (repo_id) REFERENCES repositories(id) ON DELETE CASCADE
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
CREATE TABLE IF NOT EXISTS issues (
|
|
29
|
-
repo_id INTEGER NOT NULL,
|
|
30
|
-
number INTEGER NOT NULL,
|
|
31
|
-
title TEXT NOT NULL,
|
|
32
|
-
body TEXT NOT NULL DEFAULT '',
|
|
33
|
-
state TEXT NOT NULL,
|
|
34
|
-
assignee_login TEXT,
|
|
35
|
-
created_at TEXT NOT NULL,
|
|
36
|
-
updated_at TEXT NOT NULL,
|
|
37
|
-
PRIMARY KEY (repo_id, number),
|
|
38
|
-
FOREIGN KEY (repo_id) REFERENCES repositories(id) ON DELETE CASCADE,
|
|
39
|
-
FOREIGN KEY (repo_id, assignee_login) REFERENCES collaborators(repo_id, login)
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
CREATE TABLE IF NOT EXISTS issue_labels (
|
|
43
|
-
repo_id INTEGER NOT NULL,
|
|
44
|
-
issue_number INTEGER NOT NULL,
|
|
45
|
-
label_name TEXT NOT NULL,
|
|
46
|
-
PRIMARY KEY (repo_id, issue_number, label_name),
|
|
47
|
-
FOREIGN KEY (repo_id, issue_number) REFERENCES issues(repo_id, number) ON DELETE CASCADE,
|
|
48
|
-
FOREIGN KEY (repo_id, label_name) REFERENCES labels(repo_id, name) ON DELETE CASCADE
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
CREATE TABLE IF NOT EXISTS comments (
|
|
52
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
53
|
-
repo_id INTEGER NOT NULL,
|
|
54
|
-
issue_number INTEGER NOT NULL,
|
|
55
|
-
body TEXT NOT NULL,
|
|
56
|
-
user_login TEXT NOT NULL,
|
|
57
|
-
created_at TEXT NOT NULL,
|
|
58
|
-
FOREIGN KEY (repo_id, issue_number) REFERENCES issues(repo_id, number) ON DELETE CASCADE
|
|
59
|
-
);
|
|
60
|
-
`;
|
|
61
|
-
export function migrate(db) {
|
|
62
|
-
db.exec("PRAGMA foreign_keys = ON;");
|
|
63
|
-
db.exec(MIGRATION_SQL);
|
|
64
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
import Database from "better-sqlite3";
|
|
3
|
-
import { dirname } from "node:path";
|
|
4
|
-
import { mkdirSync } from "node:fs";
|
|
5
|
-
import { migrate } from "./migrations.js";
|
|
6
|
-
export function openGitHubTwinDatabase(path = ":memory:") {
|
|
7
|
-
if (path !== ":memory:") {
|
|
8
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
9
|
-
}
|
|
10
|
-
const db = new Database(path);
|
|
11
|
-
migrate(db);
|
|
12
|
-
return db;
|
|
13
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { GitHubTwinDatabase, SeedState } from "../types.js";
|
|
2
|
-
export type RepoRow = {
|
|
3
|
-
id: number;
|
|
4
|
-
owner: string;
|
|
5
|
-
name: string;
|
|
6
|
-
full_name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
created_at: string;
|
|
9
|
-
updated_at: string;
|
|
10
|
-
};
|
|
11
|
-
export type IssueRow = {
|
|
12
|
-
repo_id: number;
|
|
13
|
-
number: number;
|
|
14
|
-
title: string;
|
|
15
|
-
body: string;
|
|
16
|
-
state: "open" | "closed";
|
|
17
|
-
assignee_login: string | null;
|
|
18
|
-
created_at: string;
|
|
19
|
-
updated_at: string;
|
|
20
|
-
};
|
|
21
|
-
export type LabelRow = {
|
|
22
|
-
repo_id: number;
|
|
23
|
-
name: string;
|
|
24
|
-
color: string;
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
export type CommentRow = {
|
|
28
|
-
id: number;
|
|
29
|
-
repo_id: number;
|
|
30
|
-
issue_number: number;
|
|
31
|
-
body: string;
|
|
32
|
-
user_login: string;
|
|
33
|
-
created_at: string;
|
|
34
|
-
};
|
|
35
|
-
export declare function seedDatabase(db: GitHubTwinDatabase, seed: SeedState): void;
|
|
36
|
-
export declare function getRepo(db: GitHubTwinDatabase, owner: string, name: string): RepoRow | undefined;
|
|
37
|
-
export declare function listIssues(db: GitHubTwinDatabase, repoId: number): IssueRow[];
|
|
38
|
-
export declare function getIssue(db: GitHubTwinDatabase, repoId: number, number: number): IssueRow | undefined;
|
|
39
|
-
export declare function listLabels(db: GitHubTwinDatabase, repoId: number): LabelRow[];
|
|
40
|
-
export declare function getLabel(db: GitHubTwinDatabase, repoId: number, name: string): LabelRow | undefined;
|
|
41
|
-
export declare function createLabel(db: GitHubTwinDatabase, repoId: number, name: string, color: string, description: string): LabelRow | undefined;
|
|
42
|
-
export declare function listIssueLabels(db: GitHubTwinDatabase, repoId: number, issueNumber: number): LabelRow[];
|
|
43
|
-
export declare function addIssueLabel(db: GitHubTwinDatabase, repoId: number, issueNumber: number, labelName: string): void;
|
|
44
|
-
export declare function deleteIssueLabel(db: GitHubTwinDatabase, repoId: number, issueNumber: number, labelName: string): number;
|
|
45
|
-
export declare function listCollaborators(db: GitHubTwinDatabase, repoId: number): string[];
|
|
46
|
-
export declare function hasCollaborator(db: GitHubTwinDatabase, repoId: number, login: string): boolean;
|
|
47
|
-
export declare function updateIssue(db: GitHubTwinDatabase, repoId: number, issueNumber: number, patch: {
|
|
48
|
-
title?: string;
|
|
49
|
-
body?: string;
|
|
50
|
-
state?: "open" | "closed";
|
|
51
|
-
assignee_login?: string | null;
|
|
52
|
-
}): IssueRow | undefined;
|
|
53
|
-
export declare function createComment(db: GitHubTwinDatabase, repoId: number, issueNumber: number, body: string): CommentRow;
|
|
54
|
-
export declare function exportState(db: GitHubTwinDatabase): {
|
|
55
|
-
repositories: {
|
|
56
|
-
labels: LabelRow[];
|
|
57
|
-
collaborators: string[];
|
|
58
|
-
issues: {
|
|
59
|
-
labels: LabelRow[];
|
|
60
|
-
repo_id: number;
|
|
61
|
-
number: number;
|
|
62
|
-
title: string;
|
|
63
|
-
body: string;
|
|
64
|
-
state: "open" | "closed";
|
|
65
|
-
assignee_login: string | null;
|
|
66
|
-
created_at: string;
|
|
67
|
-
updated_at: string;
|
|
68
|
-
}[];
|
|
69
|
-
id: number;
|
|
70
|
-
owner: string;
|
|
71
|
-
name: string;
|
|
72
|
-
full_name: string;
|
|
73
|
-
description: string;
|
|
74
|
-
created_at: string;
|
|
75
|
-
updated_at: string;
|
|
76
|
-
}[];
|
|
77
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export function seedDatabase(db, seed) {
|
|
2
|
-
const now = new Date().toISOString();
|
|
3
|
-
const tx = db.transaction(() => {
|
|
4
|
-
db.exec("DELETE FROM comments; DELETE FROM issue_labels; DELETE FROM issues; DELETE FROM collaborators; DELETE FROM labels; DELETE FROM repositories;");
|
|
5
|
-
for (const repo of seed.repositories) {
|
|
6
|
-
const fullName = `${repo.owner}/${repo.name}`;
|
|
7
|
-
db.prepare("INSERT INTO repositories (owner, name, full_name, description, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(repo.owner, repo.name, fullName, repo.description ?? "", now, now);
|
|
8
|
-
const repoRow = getRepo(db, repo.owner, repo.name);
|
|
9
|
-
if (!repoRow)
|
|
10
|
-
continue;
|
|
11
|
-
for (const label of repo.labels ?? []) {
|
|
12
|
-
createLabel(db, repoRow.id, label.name, label.color ?? "ededed", label.description ?? "");
|
|
13
|
-
}
|
|
14
|
-
for (const login of repo.collaborators ?? []) {
|
|
15
|
-
db.prepare("INSERT OR IGNORE INTO collaborators (repo_id, login) VALUES (?, ?)").run(repoRow.id, login);
|
|
16
|
-
}
|
|
17
|
-
for (const issue of repo.issues ?? []) {
|
|
18
|
-
db.prepare("INSERT INTO issues (repo_id, number, title, body, state, assignee_login, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(repoRow.id, issue.number, issue.title, issue.body ?? "", issue.state ?? "open", issue.assignee ?? null, now, now);
|
|
19
|
-
for (const labelName of issue.labels ?? []) {
|
|
20
|
-
db.prepare("INSERT OR IGNORE INTO issue_labels (repo_id, issue_number, label_name) VALUES (?, ?, ?)").run(repoRow.id, issue.number, labelName);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
tx();
|
|
26
|
-
}
|
|
27
|
-
export function getRepo(db, owner, name) {
|
|
28
|
-
return db.prepare("SELECT * FROM repositories WHERE owner = ? AND name = ?").get(owner, name);
|
|
29
|
-
}
|
|
30
|
-
export function listIssues(db, repoId) {
|
|
31
|
-
return db.prepare("SELECT * FROM issues WHERE repo_id = ? ORDER BY number ASC").all(repoId);
|
|
32
|
-
}
|
|
33
|
-
export function getIssue(db, repoId, number) {
|
|
34
|
-
return db.prepare("SELECT * FROM issues WHERE repo_id = ? AND number = ?").get(repoId, number);
|
|
35
|
-
}
|
|
36
|
-
export function listLabels(db, repoId) {
|
|
37
|
-
return db.prepare("SELECT * FROM labels WHERE repo_id = ? ORDER BY name ASC").all(repoId);
|
|
38
|
-
}
|
|
39
|
-
export function getLabel(db, repoId, name) {
|
|
40
|
-
return db.prepare("SELECT * FROM labels WHERE repo_id = ? AND name = ?").get(repoId, name);
|
|
41
|
-
}
|
|
42
|
-
export function createLabel(db, repoId, name, color, description) {
|
|
43
|
-
db.prepare("INSERT INTO labels (repo_id, name, color, description) VALUES (?, ?, ?, ?)").run(repoId, name, color, description);
|
|
44
|
-
return getLabel(db, repoId, name);
|
|
45
|
-
}
|
|
46
|
-
export function listIssueLabels(db, repoId, issueNumber) {
|
|
47
|
-
return db
|
|
48
|
-
.prepare("SELECT labels.* FROM labels INNER JOIN issue_labels ON labels.repo_id = issue_labels.repo_id AND labels.name = issue_labels.label_name WHERE issue_labels.repo_id = ? AND issue_labels.issue_number = ? ORDER BY labels.name ASC")
|
|
49
|
-
.all(repoId, issueNumber);
|
|
50
|
-
}
|
|
51
|
-
export function addIssueLabel(db, repoId, issueNumber, labelName) {
|
|
52
|
-
db.prepare("INSERT OR IGNORE INTO issue_labels (repo_id, issue_number, label_name) VALUES (?, ?, ?)").run(repoId, issueNumber, labelName);
|
|
53
|
-
}
|
|
54
|
-
export function deleteIssueLabel(db, repoId, issueNumber, labelName) {
|
|
55
|
-
return db
|
|
56
|
-
.prepare("DELETE FROM issue_labels WHERE repo_id = ? AND issue_number = ? AND label_name = ?")
|
|
57
|
-
.run(repoId, issueNumber, labelName).changes;
|
|
58
|
-
}
|
|
59
|
-
export function listCollaborators(db, repoId) {
|
|
60
|
-
const rows = db.prepare("SELECT login FROM collaborators WHERE repo_id = ? ORDER BY login ASC").all(repoId);
|
|
61
|
-
return rows.map((row) => row.login);
|
|
62
|
-
}
|
|
63
|
-
export function hasCollaborator(db, repoId, login) {
|
|
64
|
-
return Boolean(db.prepare("SELECT 1 FROM collaborators WHERE repo_id = ? AND login = ?").get(repoId, login));
|
|
65
|
-
}
|
|
66
|
-
export function updateIssue(db, repoId, issueNumber, patch) {
|
|
67
|
-
const current = getIssue(db, repoId, issueNumber);
|
|
68
|
-
if (!current)
|
|
69
|
-
return undefined;
|
|
70
|
-
db.prepare("UPDATE issues SET title = ?, body = ?, state = ?, assignee_login = ?, updated_at = ? WHERE repo_id = ? AND number = ?").run(patch.title ?? current.title, patch.body ?? current.body, patch.state ?? current.state, Object.prototype.hasOwnProperty.call(patch, "assignee_login") ? patch.assignee_login ?? null : current.assignee_login, new Date().toISOString(), repoId, issueNumber);
|
|
71
|
-
return getIssue(db, repoId, issueNumber);
|
|
72
|
-
}
|
|
73
|
-
export function createComment(db, repoId, issueNumber, body) {
|
|
74
|
-
const createdAt = new Date().toISOString();
|
|
75
|
-
const result = db
|
|
76
|
-
.prepare("INSERT INTO comments (repo_id, issue_number, body, user_login, created_at) VALUES (?, ?, ?, ?, ?)")
|
|
77
|
-
.run(repoId, issueNumber, body, "pome-agent", createdAt);
|
|
78
|
-
return db.prepare("SELECT * FROM comments WHERE id = ?").get(result.lastInsertRowid);
|
|
79
|
-
}
|
|
80
|
-
export function exportState(db) {
|
|
81
|
-
const repos = db.prepare("SELECT * FROM repositories ORDER BY full_name ASC").all();
|
|
82
|
-
return {
|
|
83
|
-
repositories: repos.map((repo) => ({
|
|
84
|
-
...repo,
|
|
85
|
-
labels: listLabels(db, repo.id),
|
|
86
|
-
collaborators: listCollaborators(db, repo.id),
|
|
87
|
-
issues: listIssues(db, repo.id).map((issue) => ({
|
|
88
|
-
...issue,
|
|
89
|
-
labels: listIssueLabels(db, repo.id, issue.number)
|
|
90
|
-
}))
|
|
91
|
-
}))
|
|
92
|
-
};
|
|
93
|
-
}
|