@ship-cli/core 0.1.9 → 0.1.11

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.
Files changed (3) hide show
  1. package/README.md +11 -1
  2. package/dist/bin.js +2528 -28
  3. package/package.json +2 -1
package/dist/bin.js CHANGED
@@ -8208,6 +8208,1469 @@ var require_printer = __commonJS({
8208
8208
  }
8209
8209
  });
8210
8210
 
8211
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/utils.js
8212
+ var require_utils = __commonJS({
8213
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/utils.js"(exports$1) {
8214
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8215
+ exports$1.assertNever = assertNever;
8216
+ exports$1.pick = pick4;
8217
+ exports$1.isObject = isObject2;
8218
+ function assertNever(value5) {
8219
+ throw new Error(`Unexpected value should never occur: ${value5}`);
8220
+ }
8221
+ function pick4(base, keys6) {
8222
+ const entries2 = keys6.map((key) => [key, base === null || base === void 0 ? void 0 : base[key]]);
8223
+ return Object.fromEntries(entries2);
8224
+ }
8225
+ function isObject2(o2) {
8226
+ return typeof o2 === "object" && o2 !== null;
8227
+ }
8228
+ }
8229
+ });
8230
+
8231
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/logging.js
8232
+ var require_logging = __commonJS({
8233
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/logging.js"(exports$1) {
8234
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8235
+ exports$1.LogLevel = void 0;
8236
+ exports$1.makeConsoleLogger = makeConsoleLogger;
8237
+ exports$1.logLevelSeverity = logLevelSeverity;
8238
+ var utils_1 = require_utils();
8239
+ var LogLevel;
8240
+ (function(LogLevel2) {
8241
+ LogLevel2["DEBUG"] = "debug";
8242
+ LogLevel2["INFO"] = "info";
8243
+ LogLevel2["WARN"] = "warn";
8244
+ LogLevel2["ERROR"] = "error";
8245
+ })(LogLevel || (exports$1.LogLevel = LogLevel = {}));
8246
+ function makeConsoleLogger(name) {
8247
+ return (level, message, extraInfo) => {
8248
+ console[level](`${name} ${level}:`, message, extraInfo);
8249
+ };
8250
+ }
8251
+ function logLevelSeverity(level) {
8252
+ switch (level) {
8253
+ case LogLevel.DEBUG:
8254
+ return 20;
8255
+ case LogLevel.INFO:
8256
+ return 40;
8257
+ case LogLevel.WARN:
8258
+ return 60;
8259
+ case LogLevel.ERROR:
8260
+ return 80;
8261
+ default:
8262
+ return (0, utils_1.assertNever)(level);
8263
+ }
8264
+ }
8265
+ }
8266
+ });
8267
+
8268
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/errors.js
8269
+ var require_errors2 = __commonJS({
8270
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/errors.js"(exports$1) {
8271
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8272
+ exports$1.APIResponseError = exports$1.UnknownHTTPResponseError = exports$1.RequestTimeoutError = exports$1.ClientErrorCode = exports$1.APIErrorCode = void 0;
8273
+ exports$1.isNotionClientError = isNotionClientError2;
8274
+ exports$1.isHTTPResponseError = isHTTPResponseError;
8275
+ exports$1.buildRequestError = buildRequestError;
8276
+ var utils_1 = require_utils();
8277
+ var APIErrorCode2;
8278
+ (function(APIErrorCode3) {
8279
+ APIErrorCode3["Unauthorized"] = "unauthorized";
8280
+ APIErrorCode3["RestrictedResource"] = "restricted_resource";
8281
+ APIErrorCode3["ObjectNotFound"] = "object_not_found";
8282
+ APIErrorCode3["RateLimited"] = "rate_limited";
8283
+ APIErrorCode3["InvalidJSON"] = "invalid_json";
8284
+ APIErrorCode3["InvalidRequestURL"] = "invalid_request_url";
8285
+ APIErrorCode3["InvalidRequest"] = "invalid_request";
8286
+ APIErrorCode3["ValidationError"] = "validation_error";
8287
+ APIErrorCode3["ConflictError"] = "conflict_error";
8288
+ APIErrorCode3["InternalServerError"] = "internal_server_error";
8289
+ APIErrorCode3["ServiceUnavailable"] = "service_unavailable";
8290
+ })(APIErrorCode2 || (exports$1.APIErrorCode = APIErrorCode2 = {}));
8291
+ var ClientErrorCode;
8292
+ (function(ClientErrorCode2) {
8293
+ ClientErrorCode2["RequestTimeout"] = "notionhq_client_request_timeout";
8294
+ ClientErrorCode2["ResponseError"] = "notionhq_client_response_error";
8295
+ })(ClientErrorCode || (exports$1.ClientErrorCode = ClientErrorCode = {}));
8296
+ var NotionClientErrorBase = class extends Error {
8297
+ };
8298
+ function isNotionClientError2(error4) {
8299
+ return (0, utils_1.isObject)(error4) && error4 instanceof NotionClientErrorBase;
8300
+ }
8301
+ function isNotionClientErrorWithCode(error4, codes) {
8302
+ return isNotionClientError2(error4) && error4.code in codes;
8303
+ }
8304
+ var RequestTimeoutError = class _RequestTimeoutError extends NotionClientErrorBase {
8305
+ constructor(message = "Request to Notion API has timed out") {
8306
+ super(message);
8307
+ this.code = ClientErrorCode.RequestTimeout;
8308
+ this.name = "RequestTimeoutError";
8309
+ }
8310
+ static isRequestTimeoutError(error4) {
8311
+ return isNotionClientErrorWithCode(error4, {
8312
+ [ClientErrorCode.RequestTimeout]: true
8313
+ });
8314
+ }
8315
+ static rejectAfterTimeout(promise3, timeoutMS) {
8316
+ return new Promise((resolve3, reject) => {
8317
+ const timeoutId = setTimeout(() => {
8318
+ reject(new _RequestTimeoutError());
8319
+ }, timeoutMS);
8320
+ promise3.then(resolve3).catch(reject).then(() => clearTimeout(timeoutId));
8321
+ });
8322
+ }
8323
+ };
8324
+ exports$1.RequestTimeoutError = RequestTimeoutError;
8325
+ var HTTPResponseError = class extends NotionClientErrorBase {
8326
+ constructor(args2) {
8327
+ super(args2.message);
8328
+ this.name = "HTTPResponseError";
8329
+ const { code: code2, status: status2, headers, rawBodyText, additional_data, request_id } = args2;
8330
+ this.code = code2;
8331
+ this.status = status2;
8332
+ this.headers = headers;
8333
+ this.body = rawBodyText;
8334
+ this.additional_data = additional_data;
8335
+ this.request_id = request_id;
8336
+ }
8337
+ };
8338
+ var httpResponseErrorCodes = {
8339
+ [ClientErrorCode.ResponseError]: true,
8340
+ [APIErrorCode2.Unauthorized]: true,
8341
+ [APIErrorCode2.RestrictedResource]: true,
8342
+ [APIErrorCode2.ObjectNotFound]: true,
8343
+ [APIErrorCode2.RateLimited]: true,
8344
+ [APIErrorCode2.InvalidJSON]: true,
8345
+ [APIErrorCode2.InvalidRequestURL]: true,
8346
+ [APIErrorCode2.InvalidRequest]: true,
8347
+ [APIErrorCode2.ValidationError]: true,
8348
+ [APIErrorCode2.ConflictError]: true,
8349
+ [APIErrorCode2.InternalServerError]: true,
8350
+ [APIErrorCode2.ServiceUnavailable]: true
8351
+ };
8352
+ function isHTTPResponseError(error4) {
8353
+ if (!isNotionClientErrorWithCode(error4, httpResponseErrorCodes)) {
8354
+ return false;
8355
+ }
8356
+ return true;
8357
+ }
8358
+ var UnknownHTTPResponseError = class extends HTTPResponseError {
8359
+ constructor(args2) {
8360
+ var _a;
8361
+ super({
8362
+ ...args2,
8363
+ code: ClientErrorCode.ResponseError,
8364
+ message: (_a = args2.message) !== null && _a !== void 0 ? _a : `Request to Notion API failed with status: ${args2.status}`,
8365
+ additional_data: void 0,
8366
+ request_id: void 0
8367
+ });
8368
+ this.name = "UnknownHTTPResponseError";
8369
+ }
8370
+ static isUnknownHTTPResponseError(error4) {
8371
+ return isNotionClientErrorWithCode(error4, {
8372
+ [ClientErrorCode.ResponseError]: true
8373
+ });
8374
+ }
8375
+ };
8376
+ exports$1.UnknownHTTPResponseError = UnknownHTTPResponseError;
8377
+ var apiErrorCodes = {
8378
+ [APIErrorCode2.Unauthorized]: true,
8379
+ [APIErrorCode2.RestrictedResource]: true,
8380
+ [APIErrorCode2.ObjectNotFound]: true,
8381
+ [APIErrorCode2.RateLimited]: true,
8382
+ [APIErrorCode2.InvalidJSON]: true,
8383
+ [APIErrorCode2.InvalidRequestURL]: true,
8384
+ [APIErrorCode2.InvalidRequest]: true,
8385
+ [APIErrorCode2.ValidationError]: true,
8386
+ [APIErrorCode2.ConflictError]: true,
8387
+ [APIErrorCode2.InternalServerError]: true,
8388
+ [APIErrorCode2.ServiceUnavailable]: true
8389
+ };
8390
+ var APIResponseError = class extends HTTPResponseError {
8391
+ constructor() {
8392
+ super(...arguments);
8393
+ this.name = "APIResponseError";
8394
+ }
8395
+ static isAPIResponseError(error4) {
8396
+ return isNotionClientErrorWithCode(error4, apiErrorCodes);
8397
+ }
8398
+ };
8399
+ exports$1.APIResponseError = APIResponseError;
8400
+ function buildRequestError(response, bodyText2) {
8401
+ const apiErrorResponseBody = parseAPIErrorResponseBody(bodyText2);
8402
+ if (apiErrorResponseBody !== void 0) {
8403
+ return new APIResponseError({
8404
+ code: apiErrorResponseBody.code,
8405
+ message: apiErrorResponseBody.message,
8406
+ headers: response.headers,
8407
+ status: response.status,
8408
+ rawBodyText: bodyText2,
8409
+ additional_data: apiErrorResponseBody.additional_data,
8410
+ request_id: apiErrorResponseBody.request_id
8411
+ });
8412
+ }
8413
+ return new UnknownHTTPResponseError({
8414
+ message: void 0,
8415
+ headers: response.headers,
8416
+ status: response.status,
8417
+ rawBodyText: bodyText2
8418
+ });
8419
+ }
8420
+ function parseAPIErrorResponseBody(body) {
8421
+ if (typeof body !== "string") {
8422
+ return;
8423
+ }
8424
+ let parsed;
8425
+ try {
8426
+ parsed = JSON.parse(body);
8427
+ } catch (parseError2) {
8428
+ return;
8429
+ }
8430
+ if (!(0, utils_1.isObject)(parsed) || typeof parsed["message"] !== "string" || !isAPIErrorCode(parsed["code"])) {
8431
+ return;
8432
+ }
8433
+ const additional_data = parsed["additional_data"];
8434
+ const request_id = parsed["request_id"];
8435
+ return {
8436
+ ...parsed,
8437
+ code: parsed["code"],
8438
+ message: parsed["message"],
8439
+ additional_data,
8440
+ request_id
8441
+ };
8442
+ }
8443
+ function isAPIErrorCode(code2) {
8444
+ return typeof code2 === "string" && code2 in apiErrorCodes;
8445
+ }
8446
+ }
8447
+ });
8448
+
8449
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/api-endpoints.js
8450
+ var require_api_endpoints = __commonJS({
8451
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/api-endpoints.js"(exports$1) {
8452
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8453
+ exports$1.movePage = exports$1.oauthIntrospect = exports$1.oauthRevoke = exports$1.oauthToken = exports$1.getFileUpload = exports$1.completeFileUpload = exports$1.sendFileUpload = exports$1.listFileUploads = exports$1.createFileUpload = exports$1.getComment = exports$1.listComments = exports$1.createComment = exports$1.search = exports$1.createDatabase = exports$1.updateDatabase = exports$1.getDatabase = exports$1.listDataSourceTemplates = exports$1.createDataSource = exports$1.queryDataSource = exports$1.updateDataSource = exports$1.getDataSource = exports$1.appendBlockChildren = exports$1.listBlockChildren = exports$1.deleteBlock = exports$1.updateBlock = exports$1.getBlock = exports$1.getPageProperty = exports$1.updatePage = exports$1.getPage = exports$1.createPage = exports$1.listUsers = exports$1.getUser = exports$1.getSelf = void 0;
8454
+ exports$1.getSelf = {
8455
+ method: "get",
8456
+ pathParams: [],
8457
+ queryParams: [],
8458
+ bodyParams: [],
8459
+ path: () => `users/me`
8460
+ };
8461
+ exports$1.getUser = {
8462
+ method: "get",
8463
+ pathParams: ["user_id"],
8464
+ queryParams: [],
8465
+ bodyParams: [],
8466
+ path: (p4) => `users/${p4.user_id}`
8467
+ };
8468
+ exports$1.listUsers = {
8469
+ method: "get",
8470
+ pathParams: [],
8471
+ queryParams: ["start_cursor", "page_size"],
8472
+ bodyParams: [],
8473
+ path: () => `users`
8474
+ };
8475
+ exports$1.createPage = {
8476
+ method: "post",
8477
+ pathParams: [],
8478
+ queryParams: [],
8479
+ bodyParams: [
8480
+ "parent",
8481
+ "properties",
8482
+ "icon",
8483
+ "cover",
8484
+ "content",
8485
+ "children",
8486
+ "template"
8487
+ ],
8488
+ path: () => `pages`
8489
+ };
8490
+ exports$1.getPage = {
8491
+ method: "get",
8492
+ pathParams: ["page_id"],
8493
+ queryParams: ["filter_properties"],
8494
+ bodyParams: [],
8495
+ path: (p4) => `pages/${p4.page_id}`
8496
+ };
8497
+ exports$1.updatePage = {
8498
+ method: "patch",
8499
+ pathParams: ["page_id"],
8500
+ queryParams: [],
8501
+ bodyParams: [
8502
+ "properties",
8503
+ "icon",
8504
+ "cover",
8505
+ "is_locked",
8506
+ "template",
8507
+ "erase_content",
8508
+ "archived",
8509
+ "in_trash"
8510
+ ],
8511
+ path: (p4) => `pages/${p4.page_id}`
8512
+ };
8513
+ exports$1.getPageProperty = {
8514
+ method: "get",
8515
+ pathParams: ["page_id", "property_id"],
8516
+ queryParams: ["start_cursor", "page_size"],
8517
+ bodyParams: [],
8518
+ path: (p4) => `pages/${p4.page_id}/properties/${p4.property_id}`
8519
+ };
8520
+ exports$1.getBlock = {
8521
+ method: "get",
8522
+ pathParams: ["block_id"],
8523
+ queryParams: [],
8524
+ bodyParams: [],
8525
+ path: (p4) => `blocks/${p4.block_id}`
8526
+ };
8527
+ exports$1.updateBlock = {
8528
+ method: "patch",
8529
+ pathParams: ["block_id"],
8530
+ queryParams: [],
8531
+ bodyParams: [
8532
+ "embed",
8533
+ "type",
8534
+ "archived",
8535
+ "in_trash",
8536
+ "bookmark",
8537
+ "image",
8538
+ "video",
8539
+ "pdf",
8540
+ "file",
8541
+ "audio",
8542
+ "code",
8543
+ "equation",
8544
+ "divider",
8545
+ "breadcrumb",
8546
+ "table_of_contents",
8547
+ "link_to_page",
8548
+ "table_row",
8549
+ "heading_1",
8550
+ "heading_2",
8551
+ "heading_3",
8552
+ "paragraph",
8553
+ "bulleted_list_item",
8554
+ "numbered_list_item",
8555
+ "quote",
8556
+ "to_do",
8557
+ "toggle",
8558
+ "template",
8559
+ "callout",
8560
+ "synced_block",
8561
+ "table",
8562
+ "column"
8563
+ ],
8564
+ path: (p4) => `blocks/${p4.block_id}`
8565
+ };
8566
+ exports$1.deleteBlock = {
8567
+ method: "delete",
8568
+ pathParams: ["block_id"],
8569
+ queryParams: [],
8570
+ bodyParams: [],
8571
+ path: (p4) => `blocks/${p4.block_id}`
8572
+ };
8573
+ exports$1.listBlockChildren = {
8574
+ method: "get",
8575
+ pathParams: ["block_id"],
8576
+ queryParams: ["start_cursor", "page_size"],
8577
+ bodyParams: [],
8578
+ path: (p4) => `blocks/${p4.block_id}/children`
8579
+ };
8580
+ exports$1.appendBlockChildren = {
8581
+ method: "patch",
8582
+ pathParams: ["block_id"],
8583
+ queryParams: [],
8584
+ bodyParams: ["children", "after"],
8585
+ path: (p4) => `blocks/${p4.block_id}/children`
8586
+ };
8587
+ exports$1.getDataSource = {
8588
+ method: "get",
8589
+ pathParams: ["data_source_id"],
8590
+ queryParams: [],
8591
+ bodyParams: [],
8592
+ path: (p4) => `data_sources/${p4.data_source_id}`
8593
+ };
8594
+ exports$1.updateDataSource = {
8595
+ method: "patch",
8596
+ pathParams: ["data_source_id"],
8597
+ queryParams: [],
8598
+ bodyParams: ["title", "icon", "properties", "in_trash", "archived", "parent"],
8599
+ path: (p4) => `data_sources/${p4.data_source_id}`
8600
+ };
8601
+ exports$1.queryDataSource = {
8602
+ method: "post",
8603
+ pathParams: ["data_source_id"],
8604
+ queryParams: ["filter_properties"],
8605
+ bodyParams: [
8606
+ "sorts",
8607
+ "filter",
8608
+ "start_cursor",
8609
+ "page_size",
8610
+ "archived",
8611
+ "in_trash",
8612
+ "result_type"
8613
+ ],
8614
+ path: (p4) => `data_sources/${p4.data_source_id}/query`
8615
+ };
8616
+ exports$1.createDataSource = {
8617
+ method: "post",
8618
+ pathParams: [],
8619
+ queryParams: [],
8620
+ bodyParams: ["parent", "properties", "title", "icon"],
8621
+ path: () => `data_sources`
8622
+ };
8623
+ exports$1.listDataSourceTemplates = {
8624
+ method: "get",
8625
+ pathParams: ["data_source_id"],
8626
+ queryParams: ["name", "start_cursor", "page_size"],
8627
+ bodyParams: [],
8628
+ path: (p4) => `data_sources/${p4.data_source_id}/templates`
8629
+ };
8630
+ exports$1.getDatabase = {
8631
+ method: "get",
8632
+ pathParams: ["database_id"],
8633
+ queryParams: [],
8634
+ bodyParams: [],
8635
+ path: (p4) => `databases/${p4.database_id}`
8636
+ };
8637
+ exports$1.updateDatabase = {
8638
+ method: "patch",
8639
+ pathParams: ["database_id"],
8640
+ queryParams: [],
8641
+ bodyParams: [
8642
+ "parent",
8643
+ "title",
8644
+ "description",
8645
+ "is_inline",
8646
+ "icon",
8647
+ "cover",
8648
+ "in_trash",
8649
+ "is_locked"
8650
+ ],
8651
+ path: (p4) => `databases/${p4.database_id}`
8652
+ };
8653
+ exports$1.createDatabase = {
8654
+ method: "post",
8655
+ pathParams: [],
8656
+ queryParams: [],
8657
+ bodyParams: [
8658
+ "parent",
8659
+ "title",
8660
+ "description",
8661
+ "is_inline",
8662
+ "initial_data_source",
8663
+ "icon",
8664
+ "cover"
8665
+ ],
8666
+ path: () => `databases`
8667
+ };
8668
+ exports$1.search = {
8669
+ method: "post",
8670
+ pathParams: [],
8671
+ queryParams: [],
8672
+ bodyParams: ["sort", "query", "start_cursor", "page_size", "filter"],
8673
+ path: () => `search`
8674
+ };
8675
+ exports$1.createComment = {
8676
+ method: "post",
8677
+ pathParams: [],
8678
+ queryParams: [],
8679
+ bodyParams: [
8680
+ "rich_text",
8681
+ "attachments",
8682
+ "display_name",
8683
+ "parent",
8684
+ "discussion_id"
8685
+ ],
8686
+ path: () => `comments`
8687
+ };
8688
+ exports$1.listComments = {
8689
+ method: "get",
8690
+ pathParams: [],
8691
+ queryParams: ["block_id", "start_cursor", "page_size"],
8692
+ bodyParams: [],
8693
+ path: () => `comments`
8694
+ };
8695
+ exports$1.getComment = {
8696
+ method: "get",
8697
+ pathParams: ["comment_id"],
8698
+ queryParams: [],
8699
+ bodyParams: [],
8700
+ path: (p4) => `comments/${p4.comment_id}`
8701
+ };
8702
+ exports$1.createFileUpload = {
8703
+ method: "post",
8704
+ pathParams: [],
8705
+ queryParams: [],
8706
+ bodyParams: [
8707
+ "mode",
8708
+ "filename",
8709
+ "content_type",
8710
+ "number_of_parts",
8711
+ "external_url"
8712
+ ],
8713
+ path: () => `file_uploads`
8714
+ };
8715
+ exports$1.listFileUploads = {
8716
+ method: "get",
8717
+ pathParams: [],
8718
+ queryParams: ["status", "start_cursor", "page_size"],
8719
+ bodyParams: [],
8720
+ path: () => `file_uploads`
8721
+ };
8722
+ exports$1.sendFileUpload = {
8723
+ method: "post",
8724
+ pathParams: ["file_upload_id"],
8725
+ queryParams: [],
8726
+ bodyParams: [],
8727
+ formDataParams: ["file", "part_number"],
8728
+ path: (p4) => `file_uploads/${p4.file_upload_id}/send`
8729
+ };
8730
+ exports$1.completeFileUpload = {
8731
+ method: "post",
8732
+ pathParams: ["file_upload_id"],
8733
+ queryParams: [],
8734
+ bodyParams: [],
8735
+ path: (p4) => `file_uploads/${p4.file_upload_id}/complete`
8736
+ };
8737
+ exports$1.getFileUpload = {
8738
+ method: "get",
8739
+ pathParams: ["file_upload_id"],
8740
+ queryParams: [],
8741
+ bodyParams: [],
8742
+ path: (p4) => `file_uploads/${p4.file_upload_id}`
8743
+ };
8744
+ exports$1.oauthToken = {
8745
+ method: "post",
8746
+ pathParams: [],
8747
+ queryParams: [],
8748
+ bodyParams: [
8749
+ "grant_type",
8750
+ "code",
8751
+ "redirect_uri",
8752
+ "external_account",
8753
+ "refresh_token"
8754
+ ],
8755
+ path: () => `oauth/token`
8756
+ };
8757
+ exports$1.oauthRevoke = {
8758
+ method: "post",
8759
+ pathParams: [],
8760
+ queryParams: [],
8761
+ bodyParams: ["token"],
8762
+ path: () => `oauth/revoke`
8763
+ };
8764
+ exports$1.oauthIntrospect = {
8765
+ method: "post",
8766
+ pathParams: [],
8767
+ queryParams: [],
8768
+ bodyParams: ["token"],
8769
+ path: () => `oauth/introspect`
8770
+ };
8771
+ exports$1.movePage = {
8772
+ method: "post",
8773
+ pathParams: ["page_id"],
8774
+ queryParams: [],
8775
+ bodyParams: ["parent"],
8776
+ path: (p4) => `pages/${p4.page_id}/move`
8777
+ };
8778
+ }
8779
+ });
8780
+
8781
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/package.json
8782
+ var require_package = __commonJS({
8783
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/package.json"(exports$1, module) {
8784
+ module.exports = {
8785
+ name: "@notionhq/client",
8786
+ version: "5.6.0",
8787
+ description: "A simple and easy to use client for the Notion API",
8788
+ engines: {
8789
+ node: ">=18"
8790
+ },
8791
+ homepage: "https://developers.notion.com/docs/getting-started",
8792
+ bugs: {
8793
+ url: "https://github.com/makenotion/notion-sdk-js/issues"
8794
+ },
8795
+ repository: {
8796
+ type: "git",
8797
+ url: "https://github.com/makenotion/notion-sdk-js/"
8798
+ },
8799
+ keywords: [
8800
+ "notion",
8801
+ "notionapi",
8802
+ "rest",
8803
+ "notion-api"
8804
+ ],
8805
+ main: "./build/src",
8806
+ types: "./build/src/index.d.ts",
8807
+ scripts: {
8808
+ prepare: "husky && npm run build",
8809
+ prepublishOnly: "npm run checkLoggedIn && npm run lint && npm run test",
8810
+ build: "tsc",
8811
+ prettier: "prettier --write .",
8812
+ lint: "prettier --check . && eslint . --ext .ts && cspell '**/*' ",
8813
+ test: "jest ./test",
8814
+ "check-links": "git ls-files | grep md$ | xargs -n 1 markdown-link-check",
8815
+ prebuild: "npm run clean",
8816
+ clean: "rm -rf ./build",
8817
+ checkLoggedIn: "./scripts/verifyLoggedIn.sh"
8818
+ },
8819
+ "lint-staged": {
8820
+ "*.{ts,js,json,md}": "prettier --write",
8821
+ "*.ts": "eslint --fix"
8822
+ },
8823
+ author: "",
8824
+ license: "MIT",
8825
+ files: [
8826
+ "build/package.json",
8827
+ "build/src/**"
8828
+ ],
8829
+ devDependencies: {
8830
+ "@types/jest": "28.1.4",
8831
+ "@typescript-eslint/eslint-plugin": "5.39.0",
8832
+ "@typescript-eslint/parser": "5.39.0",
8833
+ cspell: "5.4.1",
8834
+ eslint: "7.24.0",
8835
+ husky: "^9.1.7",
8836
+ jest: "28.1.2",
8837
+ "lint-staged": "^16.2.6",
8838
+ "markdown-link-check": "3.13.7",
8839
+ prettier: "2.8.8",
8840
+ "ts-jest": "28.0.5",
8841
+ typescript: "5.9.2"
8842
+ }
8843
+ };
8844
+ }
8845
+ });
8846
+
8847
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/Client.js
8848
+ var require_Client = __commonJS({
8849
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/Client.js"(exports$1) {
8850
+ var __classPrivateFieldSet = exports$1 && exports$1.__classPrivateFieldSet || function(receiver, state, value5, kind, f) {
8851
+ if (kind === "m") throw new TypeError("Private method is not writable");
8852
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8853
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
8854
+ return kind === "a" ? f.call(receiver, value5) : f ? f.value = value5 : state.set(receiver, value5), value5;
8855
+ };
8856
+ var __classPrivateFieldGet = exports$1 && exports$1.__classPrivateFieldGet || function(receiver, state, kind, f) {
8857
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8858
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8859
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8860
+ };
8861
+ var _Client_auth;
8862
+ var _Client_logLevel;
8863
+ var _Client_logger;
8864
+ var _Client_prefixUrl;
8865
+ var _Client_timeoutMs;
8866
+ var _Client_notionVersion;
8867
+ var _Client_fetch;
8868
+ var _Client_agent;
8869
+ var _Client_userAgent;
8870
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8871
+ var logging_1 = require_logging();
8872
+ var errors_1 = require_errors2();
8873
+ var utils_1 = require_utils();
8874
+ var api_endpoints_1 = require_api_endpoints();
8875
+ var package_json_1 = require_package();
8876
+ var Client = class _Client {
8877
+ constructor(options5) {
8878
+ var _a, _b, _c, _d, _e, _f;
8879
+ _Client_auth.set(this, void 0);
8880
+ _Client_logLevel.set(this, void 0);
8881
+ _Client_logger.set(this, void 0);
8882
+ _Client_prefixUrl.set(this, void 0);
8883
+ _Client_timeoutMs.set(this, void 0);
8884
+ _Client_notionVersion.set(this, void 0);
8885
+ _Client_fetch.set(this, void 0);
8886
+ _Client_agent.set(this, void 0);
8887
+ _Client_userAgent.set(this, void 0);
8888
+ this.blocks = {
8889
+ /**
8890
+ * Retrieve block
8891
+ */
8892
+ retrieve: (args2) => {
8893
+ return this.request({
8894
+ path: api_endpoints_1.getBlock.path(args2),
8895
+ method: api_endpoints_1.getBlock.method,
8896
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getBlock.queryParams),
8897
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getBlock.bodyParams),
8898
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8899
+ });
8900
+ },
8901
+ /**
8902
+ * Update block
8903
+ */
8904
+ update: (args2) => {
8905
+ return this.request({
8906
+ path: api_endpoints_1.updateBlock.path(args2),
8907
+ method: api_endpoints_1.updateBlock.method,
8908
+ query: (0, utils_1.pick)(args2, api_endpoints_1.updateBlock.queryParams),
8909
+ body: (0, utils_1.pick)(args2, api_endpoints_1.updateBlock.bodyParams),
8910
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8911
+ });
8912
+ },
8913
+ /**
8914
+ * Delete block
8915
+ */
8916
+ delete: (args2) => {
8917
+ return this.request({
8918
+ path: api_endpoints_1.deleteBlock.path(args2),
8919
+ method: api_endpoints_1.deleteBlock.method,
8920
+ query: (0, utils_1.pick)(args2, api_endpoints_1.deleteBlock.queryParams),
8921
+ body: (0, utils_1.pick)(args2, api_endpoints_1.deleteBlock.bodyParams),
8922
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8923
+ });
8924
+ },
8925
+ children: {
8926
+ /**
8927
+ * Append block children
8928
+ */
8929
+ append: (args2) => {
8930
+ return this.request({
8931
+ path: api_endpoints_1.appendBlockChildren.path(args2),
8932
+ method: api_endpoints_1.appendBlockChildren.method,
8933
+ query: (0, utils_1.pick)(args2, api_endpoints_1.appendBlockChildren.queryParams),
8934
+ body: (0, utils_1.pick)(args2, api_endpoints_1.appendBlockChildren.bodyParams),
8935
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8936
+ });
8937
+ },
8938
+ /**
8939
+ * Retrieve block children
8940
+ */
8941
+ list: (args2) => {
8942
+ return this.request({
8943
+ path: api_endpoints_1.listBlockChildren.path(args2),
8944
+ method: api_endpoints_1.listBlockChildren.method,
8945
+ query: (0, utils_1.pick)(args2, api_endpoints_1.listBlockChildren.queryParams),
8946
+ body: (0, utils_1.pick)(args2, api_endpoints_1.listBlockChildren.bodyParams),
8947
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8948
+ });
8949
+ }
8950
+ }
8951
+ };
8952
+ this.databases = {
8953
+ /**
8954
+ * Retrieve a database
8955
+ */
8956
+ retrieve: (args2) => {
8957
+ return this.request({
8958
+ path: api_endpoints_1.getDatabase.path(args2),
8959
+ method: api_endpoints_1.getDatabase.method,
8960
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getDatabase.queryParams),
8961
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getDatabase.bodyParams),
8962
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8963
+ });
8964
+ },
8965
+ /**
8966
+ * Create a database
8967
+ */
8968
+ create: (args2) => {
8969
+ return this.request({
8970
+ path: api_endpoints_1.createDatabase.path(),
8971
+ method: api_endpoints_1.createDatabase.method,
8972
+ query: (0, utils_1.pick)(args2, api_endpoints_1.createDatabase.queryParams),
8973
+ body: (0, utils_1.pick)(args2, api_endpoints_1.createDatabase.bodyParams),
8974
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8975
+ });
8976
+ },
8977
+ /**
8978
+ * Update a database
8979
+ */
8980
+ update: (args2) => {
8981
+ return this.request({
8982
+ path: api_endpoints_1.updateDatabase.path(args2),
8983
+ method: api_endpoints_1.updateDatabase.method,
8984
+ query: (0, utils_1.pick)(args2, api_endpoints_1.updateDatabase.queryParams),
8985
+ body: (0, utils_1.pick)(args2, api_endpoints_1.updateDatabase.bodyParams),
8986
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
8987
+ });
8988
+ }
8989
+ };
8990
+ this.dataSources = {
8991
+ /**
8992
+ * Retrieve a data source
8993
+ */
8994
+ retrieve: (args2) => {
8995
+ return this.request({
8996
+ path: api_endpoints_1.getDataSource.path(args2),
8997
+ method: api_endpoints_1.getDataSource.method,
8998
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getDataSource.queryParams),
8999
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getDataSource.bodyParams),
9000
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9001
+ });
9002
+ },
9003
+ /**
9004
+ * Query a data source
9005
+ */
9006
+ query: (args2) => {
9007
+ return this.request({
9008
+ path: api_endpoints_1.queryDataSource.path(args2),
9009
+ method: api_endpoints_1.queryDataSource.method,
9010
+ query: (0, utils_1.pick)(args2, api_endpoints_1.queryDataSource.queryParams),
9011
+ body: (0, utils_1.pick)(args2, api_endpoints_1.queryDataSource.bodyParams),
9012
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9013
+ });
9014
+ },
9015
+ /**
9016
+ * Create a data source
9017
+ */
9018
+ create: (args2) => {
9019
+ return this.request({
9020
+ path: api_endpoints_1.createDataSource.path(),
9021
+ method: api_endpoints_1.createDataSource.method,
9022
+ query: (0, utils_1.pick)(args2, api_endpoints_1.createDataSource.queryParams),
9023
+ body: (0, utils_1.pick)(args2, api_endpoints_1.createDataSource.bodyParams),
9024
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9025
+ });
9026
+ },
9027
+ /**
9028
+ * Update a data source
9029
+ */
9030
+ update: (args2) => {
9031
+ return this.request({
9032
+ path: api_endpoints_1.updateDataSource.path(args2),
9033
+ method: api_endpoints_1.updateDataSource.method,
9034
+ query: (0, utils_1.pick)(args2, api_endpoints_1.updateDataSource.queryParams),
9035
+ body: (0, utils_1.pick)(args2, api_endpoints_1.updateDataSource.bodyParams),
9036
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9037
+ });
9038
+ },
9039
+ /**
9040
+ * List page templates that are available for a data source
9041
+ */
9042
+ listTemplates: (args2) => {
9043
+ return this.request({
9044
+ path: api_endpoints_1.listDataSourceTemplates.path(args2),
9045
+ method: api_endpoints_1.listDataSourceTemplates.method,
9046
+ query: (0, utils_1.pick)(args2, api_endpoints_1.listDataSourceTemplates.queryParams),
9047
+ body: (0, utils_1.pick)(args2, api_endpoints_1.listDataSourceTemplates.bodyParams),
9048
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9049
+ });
9050
+ }
9051
+ };
9052
+ this.pages = {
9053
+ /**
9054
+ * Create a page
9055
+ */
9056
+ create: (args2) => {
9057
+ return this.request({
9058
+ path: api_endpoints_1.createPage.path(),
9059
+ method: api_endpoints_1.createPage.method,
9060
+ query: (0, utils_1.pick)(args2, api_endpoints_1.createPage.queryParams),
9061
+ body: (0, utils_1.pick)(args2, api_endpoints_1.createPage.bodyParams),
9062
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9063
+ });
9064
+ },
9065
+ /**
9066
+ * Retrieve a page
9067
+ */
9068
+ retrieve: (args2) => {
9069
+ return this.request({
9070
+ path: api_endpoints_1.getPage.path(args2),
9071
+ method: api_endpoints_1.getPage.method,
9072
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getPage.queryParams),
9073
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getPage.bodyParams),
9074
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9075
+ });
9076
+ },
9077
+ /**
9078
+ * Update page properties
9079
+ */
9080
+ update: (args2) => {
9081
+ return this.request({
9082
+ path: api_endpoints_1.updatePage.path(args2),
9083
+ method: api_endpoints_1.updatePage.method,
9084
+ query: (0, utils_1.pick)(args2, api_endpoints_1.updatePage.queryParams),
9085
+ body: (0, utils_1.pick)(args2, api_endpoints_1.updatePage.bodyParams),
9086
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9087
+ });
9088
+ },
9089
+ /**
9090
+ * Move a page
9091
+ */
9092
+ move: (args2) => {
9093
+ return this.request({
9094
+ path: api_endpoints_1.movePage.path(args2),
9095
+ method: api_endpoints_1.movePage.method,
9096
+ query: (0, utils_1.pick)(args2, api_endpoints_1.movePage.queryParams),
9097
+ body: (0, utils_1.pick)(args2, api_endpoints_1.movePage.bodyParams),
9098
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9099
+ });
9100
+ },
9101
+ properties: {
9102
+ /**
9103
+ * Retrieve page property
9104
+ */
9105
+ retrieve: (args2) => {
9106
+ return this.request({
9107
+ path: api_endpoints_1.getPageProperty.path(args2),
9108
+ method: api_endpoints_1.getPageProperty.method,
9109
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getPageProperty.queryParams),
9110
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getPageProperty.bodyParams),
9111
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9112
+ });
9113
+ }
9114
+ }
9115
+ };
9116
+ this.users = {
9117
+ /**
9118
+ * Retrieve a user
9119
+ */
9120
+ retrieve: (args2) => {
9121
+ return this.request({
9122
+ path: api_endpoints_1.getUser.path(args2),
9123
+ method: api_endpoints_1.getUser.method,
9124
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getUser.queryParams),
9125
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getUser.bodyParams),
9126
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9127
+ });
9128
+ },
9129
+ /**
9130
+ * List all users
9131
+ */
9132
+ list: (args2) => {
9133
+ return this.request({
9134
+ path: api_endpoints_1.listUsers.path(),
9135
+ method: api_endpoints_1.listUsers.method,
9136
+ query: (0, utils_1.pick)(args2, api_endpoints_1.listUsers.queryParams),
9137
+ body: (0, utils_1.pick)(args2, api_endpoints_1.listUsers.bodyParams),
9138
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9139
+ });
9140
+ },
9141
+ /**
9142
+ * Get details about bot
9143
+ */
9144
+ me: (args2) => {
9145
+ return this.request({
9146
+ path: api_endpoints_1.getSelf.path(),
9147
+ method: api_endpoints_1.getSelf.method,
9148
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getSelf.queryParams),
9149
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getSelf.bodyParams),
9150
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9151
+ });
9152
+ }
9153
+ };
9154
+ this.comments = {
9155
+ /**
9156
+ * Create a comment
9157
+ */
9158
+ create: (args2) => {
9159
+ return this.request({
9160
+ path: api_endpoints_1.createComment.path(),
9161
+ method: api_endpoints_1.createComment.method,
9162
+ query: (0, utils_1.pick)(args2, api_endpoints_1.createComment.queryParams),
9163
+ body: (0, utils_1.pick)(args2, api_endpoints_1.createComment.bodyParams),
9164
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9165
+ });
9166
+ },
9167
+ /**
9168
+ * List comments
9169
+ */
9170
+ list: (args2) => {
9171
+ return this.request({
9172
+ path: api_endpoints_1.listComments.path(),
9173
+ method: api_endpoints_1.listComments.method,
9174
+ query: (0, utils_1.pick)(args2, api_endpoints_1.listComments.queryParams),
9175
+ body: (0, utils_1.pick)(args2, api_endpoints_1.listComments.bodyParams),
9176
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9177
+ });
9178
+ },
9179
+ /**
9180
+ * Retrieve a comment
9181
+ */
9182
+ retrieve: (args2) => {
9183
+ return this.request({
9184
+ path: api_endpoints_1.getComment.path(args2),
9185
+ method: api_endpoints_1.getComment.method,
9186
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getComment.queryParams),
9187
+ body: (0, utils_1.pick)(args2, api_endpoints_1.getComment.bodyParams),
9188
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9189
+ });
9190
+ }
9191
+ };
9192
+ this.fileUploads = {
9193
+ /**
9194
+ * Create a file upload
9195
+ */
9196
+ create: (args2) => {
9197
+ return this.request({
9198
+ path: api_endpoints_1.createFileUpload.path(),
9199
+ method: api_endpoints_1.createFileUpload.method,
9200
+ query: (0, utils_1.pick)(args2, api_endpoints_1.createFileUpload.queryParams),
9201
+ body: (0, utils_1.pick)(args2, api_endpoints_1.createFileUpload.bodyParams),
9202
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9203
+ });
9204
+ },
9205
+ /**
9206
+ * Retrieve a file upload
9207
+ */
9208
+ retrieve: (args2) => {
9209
+ return this.request({
9210
+ path: api_endpoints_1.getFileUpload.path(args2),
9211
+ method: api_endpoints_1.getFileUpload.method,
9212
+ query: (0, utils_1.pick)(args2, api_endpoints_1.getFileUpload.queryParams),
9213
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9214
+ });
9215
+ },
9216
+ /**
9217
+ * List file uploads
9218
+ */
9219
+ list: (args2) => {
9220
+ return this.request({
9221
+ path: api_endpoints_1.listFileUploads.path(),
9222
+ method: api_endpoints_1.listFileUploads.method,
9223
+ query: (0, utils_1.pick)(args2, api_endpoints_1.listFileUploads.queryParams),
9224
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9225
+ });
9226
+ },
9227
+ /**
9228
+ * Send a file upload
9229
+ *
9230
+ * Requires a `file_upload_id`, obtained from the `id` of the Create File
9231
+ * Upload API response.
9232
+ *
9233
+ * The `file` parameter contains the raw file contents or Blob/File object
9234
+ * under `file.data`, and an optional `file.filename` string.
9235
+ *
9236
+ * Supply a stringified `part_number` parameter when using file uploads
9237
+ * in multi-part mode.
9238
+ *
9239
+ * This endpoint sends HTTP multipart/form-data instead of JSON parameters.
9240
+ */
9241
+ send: (args2) => {
9242
+ return this.request({
9243
+ path: api_endpoints_1.sendFileUpload.path(args2),
9244
+ method: api_endpoints_1.sendFileUpload.method,
9245
+ query: (0, utils_1.pick)(args2, api_endpoints_1.sendFileUpload.queryParams),
9246
+ formDataParams: (0, utils_1.pick)(args2, api_endpoints_1.sendFileUpload.formDataParams),
9247
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9248
+ });
9249
+ },
9250
+ /**
9251
+ * Complete a file upload
9252
+ */
9253
+ complete: (args2) => {
9254
+ return this.request({
9255
+ path: api_endpoints_1.completeFileUpload.path(args2),
9256
+ method: api_endpoints_1.completeFileUpload.method,
9257
+ query: (0, utils_1.pick)(args2, api_endpoints_1.completeFileUpload.queryParams),
9258
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9259
+ });
9260
+ }
9261
+ };
9262
+ this.search = (args2) => {
9263
+ return this.request({
9264
+ path: api_endpoints_1.search.path(),
9265
+ method: api_endpoints_1.search.method,
9266
+ query: (0, utils_1.pick)(args2, api_endpoints_1.search.queryParams),
9267
+ body: (0, utils_1.pick)(args2, api_endpoints_1.search.bodyParams),
9268
+ auth: args2 === null || args2 === void 0 ? void 0 : args2.auth
9269
+ });
9270
+ };
9271
+ this.oauth = {
9272
+ /**
9273
+ * Get token
9274
+ */
9275
+ token: (args2) => {
9276
+ return this.request({
9277
+ path: api_endpoints_1.oauthToken.path(),
9278
+ method: api_endpoints_1.oauthToken.method,
9279
+ query: (0, utils_1.pick)(args2, api_endpoints_1.oauthToken.queryParams),
9280
+ body: (0, utils_1.pick)(args2, api_endpoints_1.oauthToken.bodyParams),
9281
+ auth: {
9282
+ client_id: args2.client_id,
9283
+ client_secret: args2.client_secret
9284
+ }
9285
+ });
9286
+ },
9287
+ /**
9288
+ * Introspect token
9289
+ */
9290
+ introspect: (args2) => {
9291
+ return this.request({
9292
+ path: api_endpoints_1.oauthIntrospect.path(),
9293
+ method: api_endpoints_1.oauthIntrospect.method,
9294
+ query: (0, utils_1.pick)(args2, api_endpoints_1.oauthIntrospect.queryParams),
9295
+ body: (0, utils_1.pick)(args2, api_endpoints_1.oauthIntrospect.bodyParams),
9296
+ auth: {
9297
+ client_id: args2.client_id,
9298
+ client_secret: args2.client_secret
9299
+ }
9300
+ });
9301
+ },
9302
+ /**
9303
+ * Revoke token
9304
+ */
9305
+ revoke: (args2) => {
9306
+ return this.request({
9307
+ path: api_endpoints_1.oauthRevoke.path(),
9308
+ method: api_endpoints_1.oauthRevoke.method,
9309
+ query: (0, utils_1.pick)(args2, api_endpoints_1.oauthRevoke.queryParams),
9310
+ body: (0, utils_1.pick)(args2, api_endpoints_1.oauthRevoke.bodyParams),
9311
+ auth: {
9312
+ client_id: args2.client_id,
9313
+ client_secret: args2.client_secret
9314
+ }
9315
+ });
9316
+ }
9317
+ };
9318
+ __classPrivateFieldSet(this, _Client_auth, options5 === null || options5 === void 0 ? void 0 : options5.auth, "f");
9319
+ __classPrivateFieldSet(this, _Client_logLevel, (_a = options5 === null || options5 === void 0 ? void 0 : options5.logLevel) !== null && _a !== void 0 ? _a : logging_1.LogLevel.WARN, "f");
9320
+ __classPrivateFieldSet(this, _Client_logger, (_b = options5 === null || options5 === void 0 ? void 0 : options5.logger) !== null && _b !== void 0 ? _b : (0, logging_1.makeConsoleLogger)(package_json_1.name), "f");
9321
+ __classPrivateFieldSet(this, _Client_prefixUrl, `${(_c = options5 === null || options5 === void 0 ? void 0 : options5.baseUrl) !== null && _c !== void 0 ? _c : "https://api.notion.com"}/v1/`, "f");
9322
+ __classPrivateFieldSet(this, _Client_timeoutMs, (_d = options5 === null || options5 === void 0 ? void 0 : options5.timeoutMs) !== null && _d !== void 0 ? _d : 6e4, "f");
9323
+ __classPrivateFieldSet(this, _Client_notionVersion, (_e = options5 === null || options5 === void 0 ? void 0 : options5.notionVersion) !== null && _e !== void 0 ? _e : _Client.defaultNotionVersion, "f");
9324
+ __classPrivateFieldSet(this, _Client_fetch, (_f = options5 === null || options5 === void 0 ? void 0 : options5.fetch) !== null && _f !== void 0 ? _f : fetch, "f");
9325
+ __classPrivateFieldSet(this, _Client_agent, options5 === null || options5 === void 0 ? void 0 : options5.agent, "f");
9326
+ __classPrivateFieldSet(this, _Client_userAgent, `notionhq-client/${package_json_1.version}`, "f");
9327
+ }
9328
+ /**
9329
+ * Sends a request.
9330
+ */
9331
+ async request(args2) {
9332
+ const { path: path3, method, query, body, formDataParams, auth } = args2;
9333
+ this.log(logging_1.LogLevel.INFO, "request start", { method, path: path3 });
9334
+ const bodyAsJsonString = !body || Object.entries(body).length === 0 ? void 0 : JSON.stringify(body);
9335
+ const url2 = new URL(`${__classPrivateFieldGet(this, _Client_prefixUrl, "f")}${path3}`);
9336
+ if (query) {
9337
+ for (const [key, value5] of Object.entries(query)) {
9338
+ if (value5 !== void 0) {
9339
+ if (Array.isArray(value5)) {
9340
+ for (const val of value5) {
9341
+ url2.searchParams.append(key, decodeURIComponent(val));
9342
+ }
9343
+ } else {
9344
+ url2.searchParams.append(key, String(value5));
9345
+ }
9346
+ }
9347
+ }
9348
+ }
9349
+ let authorizationHeader;
9350
+ if (typeof auth === "object") {
9351
+ const unencodedCredential = `${auth.client_id}:${auth.client_secret}`;
9352
+ const encodedCredential = Buffer.from(unencodedCredential).toString("base64");
9353
+ authorizationHeader = { authorization: `Basic ${encodedCredential}` };
9354
+ } else {
9355
+ authorizationHeader = this.authAsHeaders(auth);
9356
+ }
9357
+ const headers = {
9358
+ // Request-level custom additional headers can be provided, but
9359
+ // don't allow them to override all other headers, e.g. the
9360
+ // standard user agent.
9361
+ ...args2.headers,
9362
+ ...authorizationHeader,
9363
+ "Notion-Version": __classPrivateFieldGet(this, _Client_notionVersion, "f"),
9364
+ "user-agent": __classPrivateFieldGet(this, _Client_userAgent, "f")
9365
+ };
9366
+ if (bodyAsJsonString !== void 0) {
9367
+ headers["content-type"] = "application/json";
9368
+ }
9369
+ let formData2;
9370
+ if (formDataParams) {
9371
+ delete headers["content-type"];
9372
+ formData2 = new FormData();
9373
+ for (const [key, value5] of Object.entries(formDataParams)) {
9374
+ if (typeof value5 === "string") {
9375
+ formData2.append(key, value5);
9376
+ } else if (typeof value5 === "object") {
9377
+ formData2.append(key, typeof value5.data === "object" ? value5.data : new Blob([value5.data]), value5.filename);
9378
+ }
9379
+ }
9380
+ }
9381
+ try {
9382
+ const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url2.toString(), {
9383
+ method: method.toUpperCase(),
9384
+ headers,
9385
+ body: bodyAsJsonString !== null && bodyAsJsonString !== void 0 ? bodyAsJsonString : formData2,
9386
+ agent: __classPrivateFieldGet(this, _Client_agent, "f")
9387
+ }), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
9388
+ const responseText = await response.text();
9389
+ if (!response.ok) {
9390
+ throw (0, errors_1.buildRequestError)(response, responseText);
9391
+ }
9392
+ const responseJson = JSON.parse(responseText);
9393
+ this.log(logging_1.LogLevel.INFO, "request success", {
9394
+ method,
9395
+ path: path3,
9396
+ ..."request_id" in responseJson && responseJson.request_id ? { requestId: responseJson.request_id } : {}
9397
+ });
9398
+ return responseJson;
9399
+ } catch (error4) {
9400
+ if (!(0, errors_1.isNotionClientError)(error4)) {
9401
+ throw error4;
9402
+ }
9403
+ this.log(logging_1.LogLevel.WARN, "request fail", {
9404
+ code: error4.code,
9405
+ message: error4.message,
9406
+ ..."request_id" in error4 && error4.request_id ? { requestId: error4.request_id } : {}
9407
+ });
9408
+ if ((0, errors_1.isHTTPResponseError)(error4)) {
9409
+ this.log(logging_1.LogLevel.DEBUG, "failed response body", {
9410
+ body: error4.body
9411
+ });
9412
+ }
9413
+ throw error4;
9414
+ }
9415
+ }
9416
+ /**
9417
+ * Emits a log message to the console.
9418
+ *
9419
+ * @param level The level for this message
9420
+ * @param args Arguments to send to the console
9421
+ */
9422
+ log(level, message, extraInfo) {
9423
+ if ((0, logging_1.logLevelSeverity)(level) >= (0, logging_1.logLevelSeverity)(__classPrivateFieldGet(this, _Client_logLevel, "f"))) {
9424
+ __classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo);
9425
+ }
9426
+ }
9427
+ /**
9428
+ * Transforms an API key or access token into a headers object suitable for an HTTP request.
9429
+ *
9430
+ * This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns
9431
+ * an empty object
9432
+ *
9433
+ * @param auth API key or access token
9434
+ * @returns headers key-value object
9435
+ */
9436
+ authAsHeaders(auth) {
9437
+ const headers = {};
9438
+ const authHeaderValue = auth !== null && auth !== void 0 ? auth : __classPrivateFieldGet(this, _Client_auth, "f");
9439
+ if (authHeaderValue !== void 0) {
9440
+ headers["authorization"] = `Bearer ${authHeaderValue}`;
9441
+ }
9442
+ return headers;
9443
+ }
9444
+ };
9445
+ _Client_auth = /* @__PURE__ */ new WeakMap(), _Client_logLevel = /* @__PURE__ */ new WeakMap(), _Client_logger = /* @__PURE__ */ new WeakMap(), _Client_prefixUrl = /* @__PURE__ */ new WeakMap(), _Client_timeoutMs = /* @__PURE__ */ new WeakMap(), _Client_notionVersion = /* @__PURE__ */ new WeakMap(), _Client_fetch = /* @__PURE__ */ new WeakMap(), _Client_agent = /* @__PURE__ */ new WeakMap(), _Client_userAgent = /* @__PURE__ */ new WeakMap();
9446
+ Client.defaultNotionVersion = "2025-09-03";
9447
+ exports$1.default = Client;
9448
+ }
9449
+ });
9450
+
9451
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/helpers.js
9452
+ var require_helpers = __commonJS({
9453
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/helpers.js"(exports$1) {
9454
+ Object.defineProperty(exports$1, "__esModule", { value: true });
9455
+ exports$1.iteratePaginatedAPI = iteratePaginatedAPI;
9456
+ exports$1.collectPaginatedAPI = collectPaginatedAPI;
9457
+ exports$1.iterateDataSourceTemplates = iterateDataSourceTemplates;
9458
+ exports$1.collectDataSourceTemplates = collectDataSourceTemplates;
9459
+ exports$1.isFullBlock = isFullBlock;
9460
+ exports$1.isFullPage = isFullPage;
9461
+ exports$1.isFullDataSource = isFullDataSource;
9462
+ exports$1.isFullDatabase = isFullDatabase;
9463
+ exports$1.isFullPageOrDataSource = isFullPageOrDataSource;
9464
+ exports$1.isFullUser = isFullUser;
9465
+ exports$1.isFullComment = isFullComment;
9466
+ exports$1.isTextRichTextItemResponse = isTextRichTextItemResponse;
9467
+ exports$1.isEquationRichTextItemResponse = isEquationRichTextItemResponse;
9468
+ exports$1.isMentionRichTextItemResponse = isMentionRichTextItemResponse;
9469
+ exports$1.extractNotionId = extractNotionId;
9470
+ exports$1.extractDatabaseId = extractDatabaseId;
9471
+ exports$1.extractPageId = extractPageId;
9472
+ exports$1.extractBlockId = extractBlockId;
9473
+ async function* iteratePaginatedAPI(listFn, firstPageArgs) {
9474
+ let nextCursor = firstPageArgs.start_cursor;
9475
+ do {
9476
+ const response = await listFn({
9477
+ ...firstPageArgs,
9478
+ start_cursor: nextCursor
9479
+ });
9480
+ yield* response.results;
9481
+ nextCursor = response.next_cursor;
9482
+ } while (nextCursor);
9483
+ }
9484
+ async function collectPaginatedAPI(listFn, firstPageArgs) {
9485
+ const results = [];
9486
+ for await (const item of iteratePaginatedAPI(listFn, firstPageArgs)) {
9487
+ results.push(item);
9488
+ }
9489
+ return results;
9490
+ }
9491
+ async function* iterateDataSourceTemplates(client, args2) {
9492
+ let nextCursor = args2.start_cursor;
9493
+ do {
9494
+ const response = await client.dataSources.listTemplates({
9495
+ ...args2,
9496
+ start_cursor: nextCursor
9497
+ });
9498
+ yield* response.templates;
9499
+ nextCursor = response.next_cursor;
9500
+ } while (nextCursor);
9501
+ }
9502
+ async function collectDataSourceTemplates(client, args2) {
9503
+ const results = [];
9504
+ for await (const template of iterateDataSourceTemplates(client, args2)) {
9505
+ results.push(template);
9506
+ }
9507
+ return results;
9508
+ }
9509
+ function isFullBlock(response) {
9510
+ return response.object === "block" && "type" in response;
9511
+ }
9512
+ function isFullPage(response) {
9513
+ return response.object === "page" && "url" in response;
9514
+ }
9515
+ function isFullDataSource(response) {
9516
+ return response.object === "data_source";
9517
+ }
9518
+ function isFullDatabase(response) {
9519
+ return response.object === "database";
9520
+ }
9521
+ function isFullPageOrDataSource(response) {
9522
+ if (response.object === "data_source") {
9523
+ return isFullDataSource(response);
9524
+ } else {
9525
+ return isFullPage(response);
9526
+ }
9527
+ }
9528
+ function isFullUser(response) {
9529
+ return "type" in response;
9530
+ }
9531
+ function isFullComment(response) {
9532
+ return "created_by" in response;
9533
+ }
9534
+ function isTextRichTextItemResponse(richText) {
9535
+ return richText.type === "text";
9536
+ }
9537
+ function isEquationRichTextItemResponse(richText) {
9538
+ return richText.type === "equation";
9539
+ }
9540
+ function isMentionRichTextItemResponse(richText) {
9541
+ return richText.type === "mention";
9542
+ }
9543
+ function extractNotionId(urlOrId) {
9544
+ if (!urlOrId || typeof urlOrId !== "string") {
9545
+ return null;
9546
+ }
9547
+ const trimmed = urlOrId.trim();
9548
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9549
+ if (uuidRegex.test(trimmed)) {
9550
+ return trimmed.toLowerCase();
9551
+ }
9552
+ const compactUuidRegex = /^[0-9a-f]{32}$/i;
9553
+ if (compactUuidRegex.test(trimmed)) {
9554
+ return formatUuid(trimmed);
9555
+ }
9556
+ const pathMatch = trimmed.match(/\/[^/?#]*-([0-9a-f]{32})(?:[/?#]|$)/i);
9557
+ if (pathMatch && pathMatch[1]) {
9558
+ return formatUuid(pathMatch[1]);
9559
+ }
9560
+ const queryMatch = trimmed.match(/[?&](?:p|page_id|database_id)=([0-9a-f]{32})/i);
9561
+ if (queryMatch && queryMatch[1]) {
9562
+ return formatUuid(queryMatch[1]);
9563
+ }
9564
+ const anyMatch = trimmed.match(/([0-9a-f]{32})/i);
9565
+ if (anyMatch && anyMatch[1]) {
9566
+ return formatUuid(anyMatch[1]);
9567
+ }
9568
+ return null;
9569
+ }
9570
+ function formatUuid(compactId) {
9571
+ const clean = compactId.toLowerCase();
9572
+ return `${clean.slice(0, 8)}-${clean.slice(8, 12)}-${clean.slice(12, 16)}-${clean.slice(16, 20)}-${clean.slice(20, 32)}`;
9573
+ }
9574
+ function extractDatabaseId(databaseUrl) {
9575
+ return extractNotionId(databaseUrl);
9576
+ }
9577
+ function extractPageId(pageUrl) {
9578
+ return extractNotionId(pageUrl);
9579
+ }
9580
+ function extractBlockId(urlWithBlock) {
9581
+ if (!urlWithBlock || typeof urlWithBlock !== "string") {
9582
+ return null;
9583
+ }
9584
+ const blockMatch = urlWithBlock.match(/#(?:block-)?([0-9a-f]{32})/i);
9585
+ if (blockMatch && blockMatch[1]) {
9586
+ return formatUuid(blockMatch[1]);
9587
+ }
9588
+ return null;
9589
+ }
9590
+ }
9591
+ });
9592
+
9593
+ // ../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/index.js
9594
+ var require_src2 = __commonJS({
9595
+ "../../node_modules/.pnpm/@notionhq+client@5.6.0/node_modules/@notionhq/client/build/src/index.js"(exports$1) {
9596
+ Object.defineProperty(exports$1, "__esModule", { value: true });
9597
+ exports$1.extractBlockId = exports$1.extractPageId = exports$1.extractDatabaseId = exports$1.extractNotionId = exports$1.isFullPageOrDataSource = exports$1.isFullComment = exports$1.isFullUser = exports$1.isFullPage = exports$1.isFullDatabase = exports$1.isFullDataSource = exports$1.isFullBlock = exports$1.iterateDataSourceTemplates = exports$1.collectDataSourceTemplates = exports$1.iteratePaginatedAPI = exports$1.collectPaginatedAPI = exports$1.isNotionClientError = exports$1.RequestTimeoutError = exports$1.UnknownHTTPResponseError = exports$1.APIResponseError = exports$1.ClientErrorCode = exports$1.APIErrorCode = exports$1.LogLevel = exports$1.Client = void 0;
9598
+ var Client_1 = require_Client();
9599
+ Object.defineProperty(exports$1, "Client", { enumerable: true, get: function() {
9600
+ return Client_1.default;
9601
+ } });
9602
+ var logging_1 = require_logging();
9603
+ Object.defineProperty(exports$1, "LogLevel", { enumerable: true, get: function() {
9604
+ return logging_1.LogLevel;
9605
+ } });
9606
+ var errors_1 = require_errors2();
9607
+ Object.defineProperty(exports$1, "APIErrorCode", { enumerable: true, get: function() {
9608
+ return errors_1.APIErrorCode;
9609
+ } });
9610
+ Object.defineProperty(exports$1, "ClientErrorCode", { enumerable: true, get: function() {
9611
+ return errors_1.ClientErrorCode;
9612
+ } });
9613
+ Object.defineProperty(exports$1, "APIResponseError", { enumerable: true, get: function() {
9614
+ return errors_1.APIResponseError;
9615
+ } });
9616
+ Object.defineProperty(exports$1, "UnknownHTTPResponseError", { enumerable: true, get: function() {
9617
+ return errors_1.UnknownHTTPResponseError;
9618
+ } });
9619
+ Object.defineProperty(exports$1, "RequestTimeoutError", { enumerable: true, get: function() {
9620
+ return errors_1.RequestTimeoutError;
9621
+ } });
9622
+ Object.defineProperty(exports$1, "isNotionClientError", { enumerable: true, get: function() {
9623
+ return errors_1.isNotionClientError;
9624
+ } });
9625
+ var helpers_1 = require_helpers();
9626
+ Object.defineProperty(exports$1, "collectPaginatedAPI", { enumerable: true, get: function() {
9627
+ return helpers_1.collectPaginatedAPI;
9628
+ } });
9629
+ Object.defineProperty(exports$1, "iteratePaginatedAPI", { enumerable: true, get: function() {
9630
+ return helpers_1.iteratePaginatedAPI;
9631
+ } });
9632
+ Object.defineProperty(exports$1, "collectDataSourceTemplates", { enumerable: true, get: function() {
9633
+ return helpers_1.collectDataSourceTemplates;
9634
+ } });
9635
+ Object.defineProperty(exports$1, "iterateDataSourceTemplates", { enumerable: true, get: function() {
9636
+ return helpers_1.iterateDataSourceTemplates;
9637
+ } });
9638
+ Object.defineProperty(exports$1, "isFullBlock", { enumerable: true, get: function() {
9639
+ return helpers_1.isFullBlock;
9640
+ } });
9641
+ Object.defineProperty(exports$1, "isFullDataSource", { enumerable: true, get: function() {
9642
+ return helpers_1.isFullDataSource;
9643
+ } });
9644
+ Object.defineProperty(exports$1, "isFullDatabase", { enumerable: true, get: function() {
9645
+ return helpers_1.isFullDatabase;
9646
+ } });
9647
+ Object.defineProperty(exports$1, "isFullPage", { enumerable: true, get: function() {
9648
+ return helpers_1.isFullPage;
9649
+ } });
9650
+ Object.defineProperty(exports$1, "isFullUser", { enumerable: true, get: function() {
9651
+ return helpers_1.isFullUser;
9652
+ } });
9653
+ Object.defineProperty(exports$1, "isFullComment", { enumerable: true, get: function() {
9654
+ return helpers_1.isFullComment;
9655
+ } });
9656
+ Object.defineProperty(exports$1, "isFullPageOrDataSource", { enumerable: true, get: function() {
9657
+ return helpers_1.isFullPageOrDataSource;
9658
+ } });
9659
+ Object.defineProperty(exports$1, "extractNotionId", { enumerable: true, get: function() {
9660
+ return helpers_1.extractNotionId;
9661
+ } });
9662
+ Object.defineProperty(exports$1, "extractDatabaseId", { enumerable: true, get: function() {
9663
+ return helpers_1.extractDatabaseId;
9664
+ } });
9665
+ Object.defineProperty(exports$1, "extractPageId", { enumerable: true, get: function() {
9666
+ return helpers_1.extractPageId;
9667
+ } });
9668
+ Object.defineProperty(exports$1, "extractBlockId", { enumerable: true, get: function() {
9669
+ return helpers_1.extractBlockId;
9670
+ } });
9671
+ }
9672
+ });
9673
+
8211
9674
  // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js
8212
9675
  var require_constants = __commonJS({
8213
9676
  "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js"(exports$1, module) {
@@ -30271,6 +31734,7 @@ var intersect6 = intersect5;
30271
31734
  var recurWhile2 = recurWhile;
30272
31735
  var recurs2 = recurs;
30273
31736
  var spaced2 = spaced;
31737
+ var whileInput2 = whileInput;
30274
31738
  var CurrentIterationMetadata2 = CurrentIterationMetadata;
30275
31739
 
30276
31740
  // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/stream/emit.js
@@ -38105,6 +39569,7 @@ var UpdateMilestoneInput = class extends Class4(
38105
39569
  var SHIP_WORKSPACES_DIR = "workspaces";
38106
39570
  var DEFAULT_WORKSPACE_NAME = "default";
38107
39571
  var DEFAULT_WORKSPACE_PATH_PATTERN = `.ship/${SHIP_WORKSPACES_DIR}/{stack}`;
39572
+ var TaskProvider = Literal2("linear", "notion");
38108
39573
  var AuthConfig = class extends Class4("AuthConfig")({
38109
39574
  apiKey: String$
38110
39575
  }) {
@@ -38115,6 +39580,40 @@ var LinearConfig = class extends Class4("LinearConfig")({
38115
39580
  projectId: OptionFromNullOr(ProjectId)
38116
39581
  }) {
38117
39582
  };
39583
+ var NotionPropertyMapping = class extends Class4(
39584
+ "NotionPropertyMapping"
39585
+ )({
39586
+ /** Property name for task title (default: "Name") */
39587
+ title: optionalWith(String$, { default: () => "Name" }),
39588
+ /** Property name for task status (default: "Status") */
39589
+ status: optionalWith(String$, { default: () => "Status" }),
39590
+ /** Property name for task priority (default: "Priority") */
39591
+ priority: optionalWith(String$, { default: () => "Priority" }),
39592
+ /** Property name for task description (default: "Description") */
39593
+ description: optionalWith(String$, { default: () => "Description" }),
39594
+ /** Property name for labels/tags (default: "Labels") */
39595
+ labels: optionalWith(String$, { default: () => "Labels" }),
39596
+ /** Property name for blocked-by relation (default: "Blocked By") */
39597
+ blockedBy: optionalWith(String$, { default: () => "Blocked By" }),
39598
+ /** Property name for task type (default: "Type") */
39599
+ type: optionalWith(String$, { default: () => "Type" }),
39600
+ /** Property name for task identifier (default: "ID") */
39601
+ identifier: optionalWith(String$, { default: () => "ID" }),
39602
+ /** Property name for parent task relation (default: "Parent") */
39603
+ parent: optionalWith(String$, { default: () => "Parent" })
39604
+ }) {
39605
+ };
39606
+ var NotionConfig = class extends Class4("NotionConfig")({
39607
+ /** The Notion database ID to use for tasks */
39608
+ databaseId: String$,
39609
+ /** Optional workspace ID (for multi-workspace setups) */
39610
+ workspaceId: OptionFromNullOr(String$),
39611
+ /** Property mapping configuration */
39612
+ propertyMapping: optionalWith(NotionPropertyMapping, {
39613
+ default: () => new NotionPropertyMapping({})
39614
+ })
39615
+ }) {
39616
+ };
38118
39617
  var GitConfig = class extends Class4("GitConfig")({
38119
39618
  defaultBranch: optionalWith(String$, { default: () => "main" })
38120
39619
  }) {
@@ -38150,7 +39649,13 @@ var WorkspaceConfig = class extends Class4("WorkspaceConfig")({
38150
39649
  }) {
38151
39650
  };
38152
39651
  var ShipConfig = class extends Class4("ShipConfig")({
39652
+ /** Task provider to use (default: "linear" for backward compatibility) */
39653
+ provider: optionalWith(TaskProvider, { default: () => "linear" }),
39654
+ /** Linear configuration (required for "linear" provider, which is default) */
38153
39655
  linear: LinearConfig,
39656
+ /** Notion configuration (required when provider is "notion") */
39657
+ notion: OptionFromNullOr(NotionConfig),
39658
+ /** Authentication config */
38154
39659
  auth: AuthConfig,
38155
39660
  git: optionalWith(GitConfig, { default: () => new GitConfig({}) }),
38156
39661
  pr: optionalWith(PrConfig, { default: () => new PrConfig({}) }),
@@ -38159,7 +39664,13 @@ var ShipConfig = class extends Class4("ShipConfig")({
38159
39664
  }) {
38160
39665
  };
38161
39666
  var PartialShipConfig = class extends Class4("PartialShipConfig")({
39667
+ /** Task provider to use (default: "linear" for backward compatibility) */
39668
+ provider: optionalWith(TaskProvider, { default: () => "linear" }),
39669
+ /** Linear configuration (optional during initialization) */
38162
39670
  linear: OptionFromNullOr(LinearConfig),
39671
+ /** Notion configuration (optional during initialization) */
39672
+ notion: OptionFromNullOr(NotionConfig),
39673
+ /** Authentication config (optional during initialization) */
38163
39674
  auth: OptionFromNullOr(AuthConfig),
38164
39675
  git: optionalWith(GitConfig, { default: () => new GitConfig({}) }),
38165
39676
  pr: optionalWith(PrConfig, { default: () => new PrConfig({}) }),
@@ -38167,6 +39678,8 @@ var PartialShipConfig = class extends Class4("PartialShipConfig")({
38167
39678
  workspace: optionalWith(WorkspaceConfig, { default: () => new WorkspaceConfig({}) })
38168
39679
  }) {
38169
39680
  };
39681
+ (class extends TaggedError("ConfigValidationError") {
39682
+ });
38170
39683
  var WorkspaceMetadata = class extends Class4("WorkspaceMetadata")({
38171
39684
  /** Workspace name (matches jj workspace name) */
38172
39685
  name: String$,
@@ -38271,6 +39784,7 @@ var formatApiError = (error4) => pipe(
38271
39784
  error4,
38272
39785
  value4,
38273
39786
  tag4("LinearApiError", (e2) => e2.message),
39787
+ tag4("NotionApiError", (e2) => e2.message),
38274
39788
  tag4("TaskError", (e2) => e2.message),
38275
39789
  exhaustive2
38276
39790
  );
@@ -38320,6 +39834,67 @@ Project: ${partial2.linear.value.projectId.value}` : ""}`,
38320
39834
  Se("Run 'ship task ready' to see available tasks.");
38321
39835
  return;
38322
39836
  }
39837
+ if (isSome2(partial2.auth) && isSome2(partial2.notion)) {
39838
+ Me(
39839
+ `Provider: Notion
39840
+ Database: ${partial2.notion.value.databaseId}`,
39841
+ "Already initialized"
39842
+ );
39843
+ Se("Run 'ship task ready' to see available tasks.");
39844
+ return;
39845
+ }
39846
+ }
39847
+ const provider = yield* prompts.select({
39848
+ message: "Select task provider",
39849
+ options: [
39850
+ { value: "linear", label: "Linear", hint: "recommended" },
39851
+ { value: "notion", label: "Notion", hint: "use Notion database as task backend" }
39852
+ ]
39853
+ });
39854
+ if (provider === "notion") {
39855
+ Me(
39856
+ "Create an integration at:\nhttps://www.notion.so/my-integrations\n\nThen share your task database with the integration.",
39857
+ "Notion Authentication"
39858
+ );
39859
+ const notionToken = yield* prompts.text({
39860
+ message: "Paste your Notion API token",
39861
+ placeholder: "ntn_... or secret_...",
39862
+ validate: (value5) => {
39863
+ if (!value5) return "API token is required";
39864
+ if (!value5.startsWith("ntn_") && !value5.startsWith("secret_"))
39865
+ return "Token should start with ntn_ or secret_";
39866
+ return void 0;
39867
+ }
39868
+ });
39869
+ const databaseId = yield* prompts.text({
39870
+ message: "Paste your Notion database ID",
39871
+ placeholder: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
39872
+ validate: (value5) => {
39873
+ if (!value5) return "Database ID is required";
39874
+ const cleaned = value5.replace(/-/g, "");
39875
+ if (cleaned.length !== 32) return "Invalid database ID format";
39876
+ return void 0;
39877
+ }
39878
+ });
39879
+ yield* config2.saveAuth({ apiKey: notionToken });
39880
+ yield* config2.saveNotion(
39881
+ new NotionConfig({
39882
+ databaseId: databaseId.replace(/-/g, ""),
39883
+ workspaceId: none2(),
39884
+ propertyMapping: new NotionPropertyMapping({})
39885
+ })
39886
+ );
39887
+ yield* config2.ensureGitignore();
39888
+ yield* config2.ensureOpencodeSkill();
39889
+ Me(
39890
+ `Provider: Notion
39891
+ Database: ${databaseId}
39892
+
39893
+ OpenCode skill created at .opencode/skill/ship-cli/SKILL.md`,
39894
+ "Workspace initialized"
39895
+ );
39896
+ Se("Run 'ship task ready' to see available tasks.");
39897
+ return;
38323
39898
  }
38324
39899
  const isAuth = yield* auth.isAuthenticated();
38325
39900
  if (!isAuth) {
@@ -39506,6 +41081,8 @@ var PromptCancelledError = class _PromptCancelledError extends TaggedError("Prom
39506
41081
  };
39507
41082
  var LinearApiError = class extends TaggedError("LinearApiError") {
39508
41083
  };
41084
+ var NotionApiError = class extends TaggedError("NotionApiError") {
41085
+ };
39509
41086
  (class extends TaggedError("RateLimitError") {
39510
41087
  });
39511
41088
  var OpenCodeError = class extends TaggedError("OpenCodeError") {
@@ -191238,7 +192815,7 @@ var command = ship.pipe(
191238
192815
  prCommand
191239
192816
  ])
191240
192817
  );
191241
- var version = "0.1.9" ;
192818
+ var version = "0.1.11" ;
191242
192819
  var run9 = run8(command, {
191243
192820
  name: "ship",
191244
192821
  version
@@ -192987,6 +194564,7 @@ var CONFIG_FILE = "config.yaml";
192987
194564
  var OPENCODE_SKILL_DIR = ".opencode/skill/ship-cli";
192988
194565
  var OPENCODE_SKILL_FILE = "SKILL.md";
192989
194566
  var YamlConfig = Struct({
194567
+ provider: optional(Literal2("linear", "notion")),
192990
194568
  linear: optional(
192991
194569
  Struct({
192992
194570
  teamId: String$,
@@ -192994,6 +194572,25 @@ var YamlConfig = Struct({
192994
194572
  projectId: NullOr(String$)
192995
194573
  })
192996
194574
  ),
194575
+ notion: optional(
194576
+ Struct({
194577
+ databaseId: String$,
194578
+ workspaceId: NullOr(String$),
194579
+ propertyMapping: optional(
194580
+ Struct({
194581
+ title: optional(String$),
194582
+ status: optional(String$),
194583
+ priority: optional(String$),
194584
+ description: optional(String$),
194585
+ labels: optional(String$),
194586
+ blockedBy: optional(String$),
194587
+ type: optional(String$),
194588
+ identifier: optional(String$),
194589
+ parent: optional(String$)
194590
+ })
194591
+ )
194592
+ })
194593
+ ),
192997
194594
  auth: optional(
192998
194595
  Struct({
192999
194596
  apiKey: String$
@@ -193100,10 +194697,12 @@ Details: ${e2.message}`,
193100
194697
  if (!yaml) {
193101
194698
  return new PartialShipConfig({
193102
194699
  linear: none2(),
194700
+ notion: none2(),
193103
194701
  auth: none2()
193104
194702
  });
193105
194703
  }
193106
194704
  return new PartialShipConfig({
194705
+ // provider defaults to "linear" in schema
193107
194706
  linear: yaml.linear ? some2(
193108
194707
  new LinearConfig({
193109
194708
  teamId: asTeamId(yaml.linear.teamId),
@@ -193111,6 +194710,8 @@ Details: ${e2.message}`,
193111
194710
  projectId: yaml.linear.projectId ? some2(asProjectId(yaml.linear.projectId)) : none2()
193112
194711
  })
193113
194712
  ) : none2(),
194713
+ notion: none2(),
194714
+ // TODO: Parse notion config from yaml when implemented
193114
194715
  auth: yaml.auth ? some2(new AuthConfig({ apiKey: yaml.auth.apiKey })) : none2()
193115
194716
  });
193116
194717
  };
@@ -193160,6 +194761,8 @@ Details: ${e2.message}`,
193160
194761
  teamKey: yaml.linear.teamKey,
193161
194762
  projectId: yaml.linear.projectId ? some2(asProjectId(yaml.linear.projectId)) : none2()
193162
194763
  }),
194764
+ notion: none2(),
194765
+ // TODO: Parse notion config from yaml when implemented
193163
194766
  auth: new AuthConfig({ apiKey: yaml.auth.apiKey }),
193164
194767
  git: new GitConfig({ defaultBranch: yaml.git?.defaultBranch ?? "main" }),
193165
194768
  pr: new PrConfig({ openBrowser: yaml.pr?.openBrowser ?? true }),
@@ -193216,6 +194819,36 @@ Details: ${e2.message}`,
193216
194819
  };
193217
194820
  yield* writeYaml(yaml);
193218
194821
  });
194822
+ const saveNotion = (notion) => gen2(function* () {
194823
+ const existingYaml = yield* readYaml();
194824
+ const yaml = {};
194825
+ if (existingYaml?.auth) {
194826
+ yaml.auth = { apiKey: existingYaml.auth.apiKey };
194827
+ }
194828
+ if (existingYaml?.git?.defaultBranch)
194829
+ yaml.git = { defaultBranch: existingYaml.git.defaultBranch };
194830
+ if (existingYaml?.pr?.openBrowser !== void 0)
194831
+ yaml.pr = { openBrowser: existingYaml.pr.openBrowser };
194832
+ if (existingYaml?.commit?.conventionalFormat !== void 0)
194833
+ yaml.commit = { conventionalFormat: existingYaml.commit.conventionalFormat };
194834
+ yaml.provider = "notion";
194835
+ yaml.notion = {
194836
+ databaseId: notion.databaseId,
194837
+ workspaceId: isSome2(notion.workspaceId) ? notion.workspaceId.value : null,
194838
+ propertyMapping: {
194839
+ title: notion.propertyMapping.title,
194840
+ status: notion.propertyMapping.status,
194841
+ priority: notion.propertyMapping.priority,
194842
+ description: notion.propertyMapping.description,
194843
+ labels: notion.propertyMapping.labels,
194844
+ blockedBy: notion.propertyMapping.blockedBy,
194845
+ type: notion.propertyMapping.type,
194846
+ identifier: notion.propertyMapping.identifier,
194847
+ parent: notion.propertyMapping.parent
194848
+ }
194849
+ };
194850
+ yield* writeYaml(yaml);
194851
+ });
193219
194852
  const deleteConfig = () => gen2(function* () {
193220
194853
  const configPath = yield* getConfigPath();
193221
194854
  const fileExists = yield* fs.exists(configPath);
@@ -193250,6 +194883,7 @@ Details: ${e2.message}`,
193250
194883
  savePartial,
193251
194884
  saveAuth,
193252
194885
  saveLinear,
194886
+ saveNotion,
193253
194887
  exists: exists3,
193254
194888
  getConfigDir,
193255
194889
  ensureConfigDir,
@@ -195127,7 +196761,7 @@ var make73 = gen2(function* () {
195127
196761
  }),
195128
196762
  "Getting branch name"
195129
196763
  );
195130
- const SESSION_LABEL_PREFIX = "session:";
196764
+ const SESSION_LABEL_PREFIX2 = "session:";
195131
196765
  const setTypeLabel = (id2, type3) => withRetryAndTimeout3(
195132
196766
  gen2(function* () {
195133
196767
  const client = yield* linearClient.client();
@@ -195153,11 +196787,11 @@ var make73 = gen2(function* () {
195153
196787
  try: () => issue.team,
195154
196788
  catch: (e2) => new LinearApiError({ message: `Failed to fetch team: ${e2}`, cause: e2 })
195155
196789
  });
195156
- const targetLabelName = `${SESSION_LABEL_PREFIX}${sessionId}`;
196790
+ const targetLabelName = `${SESSION_LABEL_PREFIX2}${sessionId}`;
195157
196791
  const allLabels = yield* tryPromise2({
195158
196792
  try: () => client.issueLabels({
195159
196793
  filter: {
195160
- name: { startsWith: SESSION_LABEL_PREFIX }
196794
+ name: { startsWith: SESSION_LABEL_PREFIX2 }
195161
196795
  }
195162
196796
  }),
195163
196797
  catch: (e2) => new LinearApiError({ message: `Failed to fetch session labels: ${e2}`, cause: e2 })
@@ -195190,7 +196824,7 @@ var make73 = gen2(function* () {
195190
196824
  });
195191
196825
  targetLabelId = createdLabel.id;
195192
196826
  }
195193
- const currentLabelIds = currentLabels?.nodes?.filter((l2) => !l2.name.startsWith(SESSION_LABEL_PREFIX)).map((l2) => l2.id) ?? [];
196827
+ const currentLabelIds = currentLabels?.nodes?.filter((l2) => !l2.name.startsWith(SESSION_LABEL_PREFIX2)).map((l2) => l2.id) ?? [];
195194
196828
  const newLabelIds = [...currentLabelIds, targetLabelId];
195195
196829
  const result = yield* tryPromise2({
195196
196830
  try: () => client.updateIssue(id2, { labelIds: newLabelIds }),
@@ -195216,11 +196850,11 @@ var make73 = gen2(function* () {
195216
196850
  try: () => issue.labels(),
195217
196851
  catch: (e2) => new LinearApiError({ message: `Failed to fetch issue labels: ${e2}`, cause: e2 })
195218
196852
  });
195219
- const sessionLabels = currentLabels?.nodes?.filter((l2) => l2.name.startsWith(SESSION_LABEL_PREFIX)) ?? [];
196853
+ const sessionLabels = currentLabels?.nodes?.filter((l2) => l2.name.startsWith(SESSION_LABEL_PREFIX2)) ?? [];
195220
196854
  if (sessionLabels.length === 0) {
195221
196855
  return;
195222
196856
  }
195223
- const nonSessionLabelIds = currentLabels?.nodes?.filter((l2) => !l2.name.startsWith(SESSION_LABEL_PREFIX)).map((l2) => l2.id) ?? [];
196857
+ const nonSessionLabelIds = currentLabels?.nodes?.filter((l2) => !l2.name.startsWith(SESSION_LABEL_PREFIX2)).map((l2) => l2.id) ?? [];
195224
196858
  const result = yield* tryPromise2({
195225
196859
  try: () => client.updateIssue(id2, { labelIds: nonSessionLabelIds }),
195226
196860
  catch: (e2) => new LinearApiError({ message: `Failed to update issue labels: ${e2}`, cause: e2 })
@@ -195473,6 +197107,824 @@ var make74 = gen2(function* () {
195473
197107
  });
195474
197108
  var MilestoneRepositoryLive = effect(MilestoneRepository, make74);
195475
197109
 
197110
+ // src/adapters/driven/notion/NotionClient.ts
197111
+ var import_client = __toESM(require_src2());
197112
+ var NotionClientService = GenericTag(
197113
+ "NotionClientService"
197114
+ );
197115
+ intersect6(
197116
+ exponential3(millis(500)),
197117
+ // Start with 500ms, double each time
197118
+ recurs2(3)
197119
+ // Max 3 retries
197120
+ ).pipe(
197121
+ whileInput2((error4) => error4.statusCode === 429)
197122
+ );
197123
+ var NOTION_DEFAULT_TIMEOUT = seconds(30);
197124
+ var make75 = gen2(function* () {
197125
+ const auth = yield* AuthService;
197126
+ const createClient = gen2(function* () {
197127
+ const apiKey = yield* auth.getApiKey().pipe(
197128
+ mapError2(
197129
+ (e2) => new NotionApiError({
197130
+ message: `Authentication required: ${e2.message}`
197131
+ })
197132
+ )
197133
+ );
197134
+ return new import_client.Client({
197135
+ auth: apiKey,
197136
+ timeoutMs: toMillis(NOTION_DEFAULT_TIMEOUT)
197137
+ });
197138
+ });
197139
+ const cachedClient = yield* cached3(createClient);
197140
+ return { client: () => cachedClient };
197141
+ });
197142
+ var NotionClientLive = effect(NotionClientService, make75);
197143
+
197144
+ // src/adapters/driven/notion/TeamRepositoryNotion.ts
197145
+ var NOTION_TEAM_ID = "notion-workspace";
197146
+ var NOTION_TEAM_KEY = "NOTION";
197147
+ var make76 = gen2(function* () {
197148
+ const notionClientService = yield* NotionClientService;
197149
+ const getClient = () => notionClientService.client();
197150
+ const getWorkspaceTeam = () => gen2(function* () {
197151
+ const client = yield* getClient();
197152
+ const botUser = yield* tryPromise2({
197153
+ try: () => client.users.me({}),
197154
+ catch: (e2) => new NotionApiError({ message: `Failed to fetch bot user: ${e2}`, cause: e2 })
197155
+ });
197156
+ let workspaceName = "Notion Workspace";
197157
+ if (botUser.type === "bot" && botUser.bot && typeof botUser.bot === "object" && "owner" in botUser.bot) {
197158
+ const owner = botUser.bot.owner;
197159
+ if (owner.type === "workspace") {
197160
+ workspaceName = "Notion Workspace";
197161
+ } else if (owner.type === "user" && "user" in owner && owner.user && "name" in owner.user && owner.user.name) {
197162
+ workspaceName = `${owner.user.name}'s Workspace`;
197163
+ }
197164
+ }
197165
+ if (botUser.name) {
197166
+ workspaceName = `${botUser.name} Workspace`;
197167
+ }
197168
+ return new Team({
197169
+ id: NOTION_TEAM_ID,
197170
+ name: workspaceName,
197171
+ key: NOTION_TEAM_KEY
197172
+ });
197173
+ });
197174
+ const getTeams = () => gen2(function* () {
197175
+ const team = yield* getWorkspaceTeam();
197176
+ return [team];
197177
+ });
197178
+ const getTeam = (id2) => gen2(function* () {
197179
+ if (id2 !== NOTION_TEAM_ID && id2 !== "notion" && id2 !== "default") {
197180
+ return yield* fail7(new TeamNotFoundError({ teamId: id2 }));
197181
+ }
197182
+ return yield* getWorkspaceTeam();
197183
+ });
197184
+ const createTeam = (_input) => (
197185
+ // Notion doesn't support creating teams/workspaces via API
197186
+ fail7(
197187
+ new TaskError({
197188
+ message: "Creating teams is not supported in Notion. Notion integrations operate within a single workspace."
197189
+ })
197190
+ )
197191
+ );
197192
+ return {
197193
+ getTeams,
197194
+ getTeam,
197195
+ createTeam
197196
+ };
197197
+ });
197198
+ var TeamRepositoryNotion = effect(TeamRepository, make76);
197199
+
197200
+ // src/adapters/driven/notion/ProjectRepositoryNotion.ts
197201
+ var extractPlainText = (richText) => richText.map((rt) => rt.plain_text).join("");
197202
+ var mapDataSourceToProject = (dataSource, teamId) => new Project({
197203
+ id: dataSource.id,
197204
+ name: extractPlainText(dataSource.title) || "Untitled Database",
197205
+ teamId
197206
+ });
197207
+ var isDataSource = (result) => result.object === "data_source" && "title" in result;
197208
+ var make77 = gen2(function* () {
197209
+ const notionClientService = yield* NotionClientService;
197210
+ const getClient = () => notionClientService.client();
197211
+ const getProjects = (_teamId) => gen2(function* () {
197212
+ const client = yield* getClient();
197213
+ const response = yield* tryPromise2({
197214
+ try: () => client.search({
197215
+ filter: {
197216
+ property: "object",
197217
+ value: "data_source"
197218
+ },
197219
+ page_size: 100
197220
+ }),
197221
+ catch: (e2) => new NotionApiError({ message: `Failed to search databases: ${e2}`, cause: e2 })
197222
+ });
197223
+ const dataSources = response.results.filter(isDataSource);
197224
+ return dataSources.map((ds) => mapDataSourceToProject(ds, NOTION_TEAM_ID));
197225
+ });
197226
+ const createProject = (_teamId, _input) => (
197227
+ // Creating databases in Notion requires a parent page, which is more complex
197228
+ // than what our simple CreateProjectInput supports. For now, fail with an error.
197229
+ // Users should create databases directly in Notion and share them with the integration.
197230
+ fail7(
197231
+ new TaskError({
197232
+ message: "Creating projects (databases) is not supported via ship-cli for Notion. Please create databases directly in Notion and share them with your integration."
197233
+ })
197234
+ )
197235
+ );
197236
+ return {
197237
+ getProjects,
197238
+ createProject
197239
+ };
197240
+ });
197241
+ var ProjectRepositoryNotion = effect(ProjectRepository, make77);
197242
+
197243
+ // src/adapters/driven/notion/NotionMapper.ts
197244
+ new NotionPropertyMapping({});
197245
+ var getProperty = (page, propertyName) => {
197246
+ return page.properties[propertyName];
197247
+ };
197248
+ var extractRichText = (richText) => {
197249
+ return richText.map((item) => item.plain_text).join("");
197250
+ };
197251
+ var extractTitle = (property) => {
197252
+ if (!property || property.type !== "title") {
197253
+ return "";
197254
+ }
197255
+ return extractRichText(property.title);
197256
+ };
197257
+ var extractText = (property) => {
197258
+ if (!property || property.type !== "rich_text") {
197259
+ return void 0;
197260
+ }
197261
+ const text12 = extractRichText(property.rich_text);
197262
+ return text12 || void 0;
197263
+ };
197264
+ var extractStatus = (property) => {
197265
+ if (!property || property.type !== "status") {
197266
+ return void 0;
197267
+ }
197268
+ return property.status?.name;
197269
+ };
197270
+ var extractSelect = (property) => {
197271
+ if (!property || property.type !== "select") {
197272
+ return void 0;
197273
+ }
197274
+ return property.select?.name;
197275
+ };
197276
+ var extractMultiSelect = (property) => {
197277
+ if (!property || property.type !== "multi_select") {
197278
+ return [];
197279
+ }
197280
+ return property.multi_select.map((item) => item.name);
197281
+ };
197282
+ var extractRelation = (property) => {
197283
+ if (!property || property.type !== "relation") {
197284
+ return [];
197285
+ }
197286
+ return property.relation.map((item) => item.id);
197287
+ };
197288
+ var extractFormula = (property) => {
197289
+ if (!property || property.type !== "formula") {
197290
+ return void 0;
197291
+ }
197292
+ const formula = property.formula;
197293
+ switch (formula.type) {
197294
+ case "string":
197295
+ return formula.string ?? void 0;
197296
+ case "number":
197297
+ return formula.number?.toString();
197298
+ case "boolean":
197299
+ return formula.boolean?.toString();
197300
+ case "date":
197301
+ return formula.date?.start;
197302
+ default:
197303
+ return void 0;
197304
+ }
197305
+ };
197306
+ var extractUniqueId = (property) => {
197307
+ if (!property || property.type !== "unique_id") {
197308
+ return void 0;
197309
+ }
197310
+ const prefix = property.unique_id.prefix ?? "";
197311
+ const number5 = property.unique_id.number;
197312
+ return number5 !== null ? `${prefix}${number5}` : void 0;
197313
+ };
197314
+ var mapStatusToStateType = (status2) => {
197315
+ if (!status2) return "unstarted";
197316
+ const normalized = status2.toLowerCase().trim();
197317
+ if (normalized.includes("backlog") || normalized.includes("icebox") || normalized.includes("later")) {
197318
+ return "backlog";
197319
+ }
197320
+ if (normalized.includes("done") || normalized.includes("complete") || normalized.includes("shipped") || normalized.includes("released") || normalized.includes("resolved")) {
197321
+ return "completed";
197322
+ }
197323
+ if (normalized.includes("cancel") || normalized.includes("won't") || normalized.includes("wont") || normalized.includes("duplicate") || normalized.includes("archived")) {
197324
+ return "canceled";
197325
+ }
197326
+ if (normalized.includes("progress") || normalized.includes("doing") || normalized.includes("active") || normalized.includes("review") || normalized.includes("testing") || normalized.includes("started")) {
197327
+ return "started";
197328
+ }
197329
+ return "unstarted";
197330
+ };
197331
+ var mapStatusToWorkflowState = (status2) => {
197332
+ return new WorkflowState({
197333
+ id: status2 ?? "unknown",
197334
+ name: status2 ?? "Unknown",
197335
+ type: mapStatusToStateType(status2)
197336
+ });
197337
+ };
197338
+ var mapPriority2 = (priority) => {
197339
+ if (!priority) return "none";
197340
+ const normalized = priority.toLowerCase().trim();
197341
+ if (normalized.includes("urgent") || normalized.includes("critical") || normalized === "p0") {
197342
+ return "urgent";
197343
+ }
197344
+ if (normalized.includes("high") || normalized === "p1") {
197345
+ return "high";
197346
+ }
197347
+ if (normalized.includes("medium") || normalized.includes("normal") || normalized === "p2") {
197348
+ return "medium";
197349
+ }
197350
+ if (normalized.includes("low") || normalized === "p3" || normalized === "p4") {
197351
+ return "low";
197352
+ }
197353
+ return "none";
197354
+ };
197355
+ var priorityToNotion = (priority) => {
197356
+ switch (priority) {
197357
+ case "urgent":
197358
+ return "Urgent";
197359
+ case "high":
197360
+ return "High";
197361
+ case "medium":
197362
+ return "Medium";
197363
+ case "low":
197364
+ return "Low";
197365
+ case "none":
197366
+ return "None";
197367
+ }
197368
+ };
197369
+ var mapTaskType = (type3) => {
197370
+ if (!type3) return none2();
197371
+ const normalized = type3.toLowerCase().trim();
197372
+ if (normalized.includes("bug") || normalized.includes("defect")) {
197373
+ return some2("bug");
197374
+ }
197375
+ if (normalized.includes("feature") || normalized.includes("enhancement")) {
197376
+ return some2("feature");
197377
+ }
197378
+ if (normalized.includes("epic")) {
197379
+ return some2("epic");
197380
+ }
197381
+ if (normalized.includes("chore") || normalized.includes("maintenance")) {
197382
+ return some2("chore");
197383
+ }
197384
+ if (normalized.includes("task")) {
197385
+ return some2("task");
197386
+ }
197387
+ return none2();
197388
+ };
197389
+ var generateIdentifier = (page, propertyMapping) => {
197390
+ const idProperty = getProperty(page, propertyMapping.identifier);
197391
+ const uniqueId = extractUniqueId(idProperty);
197392
+ if (uniqueId) return uniqueId;
197393
+ const formulaId = extractFormula(idProperty);
197394
+ if (formulaId) return formulaId;
197395
+ const textId = extractText(idProperty);
197396
+ if (textId) return textId;
197397
+ return `N-${page.id.slice(0, 8)}`;
197398
+ };
197399
+ var mapPageToTask = (page, config2) => {
197400
+ const { propertyMapping, teamId, databaseId } = config2;
197401
+ const title = extractTitle(getProperty(page, propertyMapping.title));
197402
+ const description = extractText(getProperty(page, propertyMapping.description));
197403
+ const status2 = extractStatus(getProperty(page, propertyMapping.status));
197404
+ const priority = extractSelect(getProperty(page, propertyMapping.priority));
197405
+ const type3 = extractSelect(getProperty(page, propertyMapping.type));
197406
+ const labels = extractMultiSelect(getProperty(page, propertyMapping.labels));
197407
+ const blockedByIds = extractRelation(getProperty(page, propertyMapping.blockedBy));
197408
+ const identifier2 = generateIdentifier(page, propertyMapping);
197409
+ const url2 = page.url || `https://notion.so/${page.id.replace(/-/g, "")}`;
197410
+ return new Task({
197411
+ id: page.id,
197412
+ identifier: identifier2,
197413
+ title: title || "Untitled",
197414
+ description: description ? some2(description) : none2(),
197415
+ state: mapStatusToWorkflowState(status2),
197416
+ priority: mapPriority2(priority),
197417
+ type: mapTaskType(type3),
197418
+ teamId,
197419
+ projectId: some2(databaseId),
197420
+ // Use database ID as project
197421
+ milestoneId: none2(),
197422
+ // Notion doesn't have milestones concept
197423
+ milestoneName: none2(),
197424
+ branchName: none2(),
197425
+ // Could be extracted from a custom property
197426
+ url: url2,
197427
+ labels,
197428
+ blockedBy: blockedByIds,
197429
+ blocks: [],
197430
+ // Would need reverse lookup
197431
+ subtasks: [],
197432
+ // Would need separate query for child pages
197433
+ createdAt: new Date(page.created_time),
197434
+ updatedAt: new Date(page.last_edited_time)
197435
+ });
197436
+ };
197437
+
197438
+ // src/adapters/driven/notion/IssueRepositoryNotion.ts
197439
+ var SESSION_LABEL_PREFIX = "session:";
197440
+ var TYPE_LABEL_PREFIX2 = "type:";
197441
+ var titleProperty = (content) => ({
197442
+ title: [{ text: { content } }]
197443
+ });
197444
+ var richTextProperty = (content) => ({
197445
+ rich_text: [{ text: { content } }]
197446
+ });
197447
+ var selectProperty = (name) => ({
197448
+ select: { name }
197449
+ });
197450
+ var multiSelectProperty = (names) => ({
197451
+ multi_select: names.map((name) => ({ name }))
197452
+ });
197453
+ var statusProperty = (name) => ({
197454
+ status: { name }
197455
+ });
197456
+ var relationProperty = (ids3) => ({
197457
+ relation: ids3.map((id2) => ({ id: id2 }))
197458
+ });
197459
+ var isPageObjectResponse = (page) => page !== null && typeof page === "object" && "object" in page && page.object === "page" && "properties" in page;
197460
+ var extractStatusCode = (error4) => {
197461
+ if (error4 && typeof error4 === "object") {
197462
+ if ("status" in error4 && typeof error4.status === "number") {
197463
+ return error4.status;
197464
+ }
197465
+ if ("statusCode" in error4 && typeof error4.statusCode === "number") {
197466
+ return error4.statusCode;
197467
+ }
197468
+ }
197469
+ return void 0;
197470
+ };
197471
+ var toNotionApiError = (message, cause2) => {
197472
+ const statusCode = extractStatusCode(cause2);
197473
+ return statusCode !== void 0 ? new NotionApiError({ message, statusCode, cause: cause2 }) : new NotionApiError({ message, cause: cause2 });
197474
+ };
197475
+ var getNotionConfig = (configRepo) => gen2(function* () {
197476
+ const config2 = yield* configRepo.load().pipe(
197477
+ mapError2(
197478
+ (e2) => new NotionApiError({ message: `Failed to load config: ${e2.message}`, cause: e2 })
197479
+ )
197480
+ );
197481
+ if (isNone2(config2.notion)) {
197482
+ return yield* fail7(
197483
+ new NotionApiError({ message: "Notion configuration not found. Run 'ship init' to configure." })
197484
+ );
197485
+ }
197486
+ return getOrThrow2(config2.notion);
197487
+ });
197488
+ var createMapConfig = (notionConfig, teamId) => ({
197489
+ propertyMapping: notionConfig.propertyMapping,
197490
+ teamId,
197491
+ databaseId: notionConfig.databaseId
197492
+ });
197493
+ var isPageBlocked = (page, propertyMapping, allPages) => {
197494
+ const blockedByIds = extractRelation(page.properties[propertyMapping.blockedBy]);
197495
+ if (blockedByIds.length === 0) return false;
197496
+ for (const blockerId of blockedByIds) {
197497
+ const blockerPage = allPages.find((p4) => p4.id === blockerId);
197498
+ if (blockerPage) {
197499
+ const status2 = blockerPage.properties[propertyMapping.status];
197500
+ if (status2 && status2.type === "status" && status2.status) {
197501
+ const stateType = mapStatusToStateType(status2.status.name);
197502
+ if (stateType !== "completed" && stateType !== "canceled") {
197503
+ return true;
197504
+ }
197505
+ }
197506
+ }
197507
+ }
197508
+ return false;
197509
+ };
197510
+ var handleNotFoundError = (taskId) => (e2) => {
197511
+ if (e2.statusCode === 404) {
197512
+ return fail7(new TaskNotFoundError({ taskId }));
197513
+ }
197514
+ return fail7(e2);
197515
+ };
197516
+ var queryDataSource = (client, databaseId, filter12, pageSize = 100) => tryPromise2({
197517
+ try: () => {
197518
+ const params = {
197519
+ data_source_id: databaseId,
197520
+ page_size: pageSize
197521
+ };
197522
+ if (filter12 !== void 0) {
197523
+ params.filter = filter12;
197524
+ }
197525
+ return client.dataSources.query(params);
197526
+ },
197527
+ catch: (e2) => toNotionApiError(`Failed to query database: ${e2}`, e2)
197528
+ });
197529
+ var extractPages = (response) => response.results.filter(
197530
+ (r2) => "properties" in r2 && r2.object === "page"
197531
+ );
197532
+ var make78 = gen2(function* () {
197533
+ const configRepo = yield* ConfigRepository;
197534
+ const notionClientService = yield* NotionClientService;
197535
+ const getClient = () => notionClientService.client();
197536
+ const teamId = "notion";
197537
+ const getTask = (id2) => gen2(function* () {
197538
+ const notionConfig = yield* getNotionConfig(configRepo);
197539
+ const client = yield* getClient();
197540
+ const page = yield* tryPromise2({
197541
+ try: () => client.pages.retrieve({ page_id: id2 }),
197542
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197543
+ }).pipe(catchAll2(handleNotFoundError(id2)));
197544
+ if (!isPageObjectResponse(page)) {
197545
+ return yield* fail7(new TaskNotFoundError({ taskId: id2 }));
197546
+ }
197547
+ return mapPageToTask(page, createMapConfig(notionConfig, teamId));
197548
+ });
197549
+ const getTaskByIdentifier = (identifier2) => gen2(function* () {
197550
+ const notionConfig = yield* getNotionConfig(configRepo);
197551
+ const { propertyMapping, databaseId } = notionConfig;
197552
+ const client = yield* getClient();
197553
+ const response = yield* queryDataSource(client, databaseId, {
197554
+ or: [
197555
+ // Try to match by ID property (if it's a rich_text)
197556
+ {
197557
+ property: propertyMapping.identifier,
197558
+ rich_text: { equals: identifier2 }
197559
+ },
197560
+ // Try to match by title
197561
+ {
197562
+ property: propertyMapping.title,
197563
+ title: { equals: identifier2 }
197564
+ }
197565
+ ]
197566
+ }, 1);
197567
+ const pages = extractPages(response);
197568
+ const page = pages[0];
197569
+ if (!page) {
197570
+ return yield* fail7(new TaskNotFoundError({ taskId: identifier2 }));
197571
+ }
197572
+ return mapPageToTask(page, createMapConfig(notionConfig, teamId));
197573
+ });
197574
+ const createTask = (_teamId, input) => gen2(function* () {
197575
+ const notionConfig = yield* getNotionConfig(configRepo);
197576
+ const { propertyMapping, databaseId } = notionConfig;
197577
+ const client = yield* getClient();
197578
+ const properties = {
197579
+ [propertyMapping.title]: titleProperty(input.title),
197580
+ [propertyMapping.priority]: selectProperty(priorityToNotion(input.priority)),
197581
+ [propertyMapping.labels]: multiSelectProperty([`${TYPE_LABEL_PREFIX2}${input.type}`])
197582
+ };
197583
+ if (isSome2(input.description)) {
197584
+ properties[propertyMapping.description] = richTextProperty(input.description.value);
197585
+ }
197586
+ const page = yield* tryPromise2({
197587
+ try: () => client.pages.create({
197588
+ parent: { database_id: databaseId },
197589
+ properties
197590
+ }),
197591
+ catch: (e2) => toNotionApiError(`Failed to create page: ${e2}`, e2)
197592
+ }).pipe(
197593
+ mapError2((e2) => new TaskError({ message: `Failed to create task: ${e2.message}`, cause: e2 }))
197594
+ );
197595
+ if (!isPageObjectResponse(page)) {
197596
+ return yield* fail7(new TaskError({ message: "Failed to create task: unexpected response" }));
197597
+ }
197598
+ return mapPageToTask(page, createMapConfig(notionConfig, teamId));
197599
+ });
197600
+ const updateTask = (id2, input) => gen2(function* () {
197601
+ const notionConfig = yield* getNotionConfig(configRepo);
197602
+ const { propertyMapping } = notionConfig;
197603
+ const client = yield* getClient();
197604
+ const updateProps = {};
197605
+ if (isSome2(input.title)) {
197606
+ updateProps[propertyMapping.title] = titleProperty(input.title.value);
197607
+ }
197608
+ if (isSome2(input.description)) {
197609
+ updateProps[propertyMapping.description] = richTextProperty(input.description.value);
197610
+ }
197611
+ if (isSome2(input.status)) {
197612
+ const statusMap = {
197613
+ backlog: "Backlog",
197614
+ todo: "To Do",
197615
+ in_progress: "In Progress",
197616
+ in_review: "In Review",
197617
+ done: "Done",
197618
+ cancelled: "Cancelled"
197619
+ };
197620
+ updateProps[propertyMapping.status] = statusProperty(
197621
+ statusMap[input.status.value] ?? input.status.value
197622
+ );
197623
+ }
197624
+ if (isSome2(input.priority)) {
197625
+ updateProps[propertyMapping.priority] = selectProperty(priorityToNotion(input.priority.value));
197626
+ }
197627
+ const page = yield* tryPromise2({
197628
+ try: () => client.pages.update({
197629
+ page_id: id2,
197630
+ properties: updateProps
197631
+ }),
197632
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197633
+ }).pipe(
197634
+ catchAll2((e2) => {
197635
+ if (e2.statusCode === 404) {
197636
+ return fail7(new TaskNotFoundError({ taskId: id2 }));
197637
+ }
197638
+ return fail7(new TaskError({ message: `Failed to update task: ${e2.message}`, cause: e2 }));
197639
+ })
197640
+ );
197641
+ if (!isPageObjectResponse(page)) {
197642
+ return yield* fail7(new TaskError({ message: "Failed to update task: unexpected response" }));
197643
+ }
197644
+ return mapPageToTask(page, createMapConfig(notionConfig, teamId));
197645
+ });
197646
+ const listTasks = (_teamId, filter12) => gen2(function* () {
197647
+ const notionConfig = yield* getNotionConfig(configRepo);
197648
+ const { propertyMapping, databaseId } = notionConfig;
197649
+ const client = yield* getClient();
197650
+ const conditions = [];
197651
+ if (isSome2(filter12.status)) {
197652
+ const statusMap = {
197653
+ backlog: "Backlog",
197654
+ todo: "To Do",
197655
+ in_progress: "In Progress",
197656
+ in_review: "In Review",
197657
+ done: "Done",
197658
+ cancelled: "Cancelled"
197659
+ };
197660
+ conditions.push({
197661
+ property: propertyMapping.status,
197662
+ status: { equals: statusMap[filter12.status.value] ?? filter12.status.value }
197663
+ });
197664
+ } else if (!filter12.includeCompleted) {
197665
+ conditions.push({
197666
+ property: propertyMapping.status,
197667
+ status: { does_not_equal: "Done" }
197668
+ });
197669
+ conditions.push({
197670
+ property: propertyMapping.status,
197671
+ status: { does_not_equal: "Cancelled" }
197672
+ });
197673
+ }
197674
+ if (isSome2(filter12.priority)) {
197675
+ conditions.push({
197676
+ property: propertyMapping.priority,
197677
+ select: { equals: priorityToNotion(filter12.priority.value) }
197678
+ });
197679
+ }
197680
+ const queryFilter = conditions.length > 0 ? { and: conditions } : void 0;
197681
+ const response = yield* queryDataSource(client, databaseId, queryFilter);
197682
+ const pages = extractPages(response);
197683
+ return pages.map(
197684
+ (page) => mapPageToTask(page, createMapConfig(notionConfig, teamId))
197685
+ );
197686
+ });
197687
+ const getReadyTasks = (_teamId, _projectId) => gen2(function* () {
197688
+ const notionConfig = yield* getNotionConfig(configRepo);
197689
+ const { propertyMapping, databaseId } = notionConfig;
197690
+ const client = yield* getClient();
197691
+ const response = yield* queryDataSource(client, databaseId, {
197692
+ and: [
197693
+ { property: propertyMapping.status, status: { does_not_equal: "Done" } },
197694
+ { property: propertyMapping.status, status: { does_not_equal: "Cancelled" } }
197695
+ ]
197696
+ });
197697
+ const pages = extractPages(response);
197698
+ const readyPages = pages.filter(
197699
+ (page) => !isPageBlocked(page, propertyMapping, pages)
197700
+ );
197701
+ return readyPages.map(
197702
+ (page) => mapPageToTask(page, createMapConfig(notionConfig, teamId))
197703
+ );
197704
+ });
197705
+ const getBlockedTasks = (_teamId, _projectId) => gen2(function* () {
197706
+ const notionConfig = yield* getNotionConfig(configRepo);
197707
+ const { propertyMapping, databaseId } = notionConfig;
197708
+ const client = yield* getClient();
197709
+ const response = yield* queryDataSource(client, databaseId, {
197710
+ and: [
197711
+ { property: propertyMapping.status, status: { does_not_equal: "Done" } },
197712
+ { property: propertyMapping.status, status: { does_not_equal: "Cancelled" } }
197713
+ ]
197714
+ });
197715
+ const pages = extractPages(response);
197716
+ const blockedPages = pages.filter(
197717
+ (page) => isPageBlocked(page, propertyMapping, pages)
197718
+ );
197719
+ return blockedPages.map(
197720
+ (page) => mapPageToTask(page, createMapConfig(notionConfig, teamId))
197721
+ );
197722
+ });
197723
+ const addBlocker = (blockedId, blockerId) => gen2(function* () {
197724
+ const notionConfig = yield* getNotionConfig(configRepo);
197725
+ const { propertyMapping } = notionConfig;
197726
+ const client = yield* getClient();
197727
+ const page = yield* tryPromise2({
197728
+ try: () => client.pages.retrieve({ page_id: blockedId }),
197729
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197730
+ }).pipe(catchAll2(handleNotFoundError(blockedId)));
197731
+ if (!isPageObjectResponse(page)) {
197732
+ return yield* fail7(new TaskNotFoundError({ taskId: blockedId }));
197733
+ }
197734
+ const currentBlockers = extractRelation(
197735
+ page.properties[propertyMapping.blockedBy]
197736
+ );
197737
+ if (currentBlockers.includes(blockerId)) {
197738
+ return;
197739
+ }
197740
+ const newBlockers = [...currentBlockers, blockerId];
197741
+ yield* tryPromise2({
197742
+ try: () => client.pages.update({
197743
+ page_id: blockedId,
197744
+ properties: {
197745
+ [propertyMapping.blockedBy]: relationProperty(newBlockers)
197746
+ }
197747
+ }),
197748
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197749
+ }).pipe(
197750
+ mapError2((e2) => new TaskError({ message: `Failed to add blocker: ${e2.message}`, cause: e2 }))
197751
+ );
197752
+ });
197753
+ const removeBlocker = (blockedId, blockerId) => gen2(function* () {
197754
+ const notionConfig = yield* getNotionConfig(configRepo);
197755
+ const { propertyMapping } = notionConfig;
197756
+ const client = yield* getClient();
197757
+ const page = yield* tryPromise2({
197758
+ try: () => client.pages.retrieve({ page_id: blockedId }),
197759
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197760
+ }).pipe(catchAll2(handleNotFoundError(blockedId)));
197761
+ if (!isPageObjectResponse(page)) {
197762
+ return yield* fail7(new TaskNotFoundError({ taskId: blockedId }));
197763
+ }
197764
+ const currentBlockers = extractRelation(
197765
+ page.properties[propertyMapping.blockedBy]
197766
+ );
197767
+ const newBlockers = currentBlockers.filter((id2) => id2 !== blockerId);
197768
+ yield* tryPromise2({
197769
+ try: () => client.pages.update({
197770
+ page_id: blockedId,
197771
+ properties: {
197772
+ [propertyMapping.blockedBy]: relationProperty(newBlockers)
197773
+ }
197774
+ }),
197775
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197776
+ }).pipe(
197777
+ mapError2((e2) => new TaskError({ message: `Failed to remove blocker: ${e2.message}`, cause: e2 }))
197778
+ );
197779
+ });
197780
+ const addRelated = (_taskId, _relatedTaskId) => _void;
197781
+ const getBranchName = (id2) => gen2(function* () {
197782
+ const task = yield* getTask(id2);
197783
+ const slug = task.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 50);
197784
+ return `${task.identifier.toLowerCase()}-${slug}`;
197785
+ });
197786
+ const setSessionLabel = (id2, sessionId) => gen2(function* () {
197787
+ const notionConfig = yield* getNotionConfig(configRepo);
197788
+ const { propertyMapping } = notionConfig;
197789
+ const client = yield* getClient();
197790
+ const page = yield* tryPromise2({
197791
+ try: () => client.pages.retrieve({ page_id: id2 }),
197792
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197793
+ }).pipe(catchAll2(handleNotFoundError(id2)));
197794
+ if (!isPageObjectResponse(page)) {
197795
+ return yield* fail7(new TaskNotFoundError({ taskId: id2 }));
197796
+ }
197797
+ const currentLabels = extractMultiSelect(
197798
+ page.properties[propertyMapping.labels]
197799
+ );
197800
+ const nonSessionLabels = currentLabels.filter(
197801
+ (l2) => !l2.startsWith(SESSION_LABEL_PREFIX)
197802
+ );
197803
+ const newLabels = [...nonSessionLabels, `${SESSION_LABEL_PREFIX}${sessionId}`];
197804
+ yield* tryPromise2({
197805
+ try: () => client.pages.update({
197806
+ page_id: id2,
197807
+ properties: {
197808
+ [propertyMapping.labels]: multiSelectProperty(newLabels)
197809
+ }
197810
+ }),
197811
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197812
+ }).pipe(
197813
+ mapError2((e2) => new TaskError({ message: `Failed to set session label: ${e2.message}`, cause: e2 }))
197814
+ );
197815
+ });
197816
+ const setTypeLabel = (id2, type3) => gen2(function* () {
197817
+ const notionConfig = yield* getNotionConfig(configRepo);
197818
+ const { propertyMapping } = notionConfig;
197819
+ const client = yield* getClient();
197820
+ const page = yield* tryPromise2({
197821
+ try: () => client.pages.retrieve({ page_id: id2 }),
197822
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197823
+ }).pipe(catchAll2(handleNotFoundError(id2)));
197824
+ if (!isPageObjectResponse(page)) {
197825
+ return yield* fail7(new TaskNotFoundError({ taskId: id2 }));
197826
+ }
197827
+ const currentLabels = extractMultiSelect(
197828
+ page.properties[propertyMapping.labels]
197829
+ );
197830
+ const nonTypeLabels = currentLabels.filter(
197831
+ (l2) => !l2.startsWith(TYPE_LABEL_PREFIX2)
197832
+ );
197833
+ const newLabels = [...nonTypeLabels, `${TYPE_LABEL_PREFIX2}${type3}`];
197834
+ yield* tryPromise2({
197835
+ try: () => client.pages.update({
197836
+ page_id: id2,
197837
+ properties: {
197838
+ [propertyMapping.labels]: multiSelectProperty(newLabels)
197839
+ }
197840
+ }),
197841
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197842
+ }).pipe(
197843
+ mapError2((e2) => new TaskError({ message: `Failed to set type label: ${e2.message}`, cause: e2 }))
197844
+ );
197845
+ });
197846
+ const clearSessionLabel = (id2) => gen2(function* () {
197847
+ const notionConfig = yield* getNotionConfig(configRepo);
197848
+ const { propertyMapping } = notionConfig;
197849
+ const client = yield* getClient();
197850
+ const page = yield* tryPromise2({
197851
+ try: () => client.pages.retrieve({ page_id: id2 }),
197852
+ catch: (e2) => toNotionApiError(`Failed to fetch page: ${e2}`, e2)
197853
+ }).pipe(catchAll2(handleNotFoundError(id2)));
197854
+ if (!isPageObjectResponse(page)) {
197855
+ return yield* fail7(new TaskNotFoundError({ taskId: id2 }));
197856
+ }
197857
+ const currentLabels = extractMultiSelect(
197858
+ page.properties[propertyMapping.labels]
197859
+ );
197860
+ const nonSessionLabels = currentLabels.filter(
197861
+ (l2) => !l2.startsWith(SESSION_LABEL_PREFIX)
197862
+ );
197863
+ yield* tryPromise2({
197864
+ try: () => client.pages.update({
197865
+ page_id: id2,
197866
+ properties: {
197867
+ [propertyMapping.labels]: multiSelectProperty(nonSessionLabels)
197868
+ }
197869
+ }),
197870
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197871
+ }).pipe(
197872
+ mapError2((e2) => new TaskError({ message: `Failed to clear session label: ${e2.message}`, cause: e2 }))
197873
+ );
197874
+ });
197875
+ const removeAsBlocker = (blockerId) => gen2(function* () {
197876
+ const notionConfig = yield* getNotionConfig(configRepo);
197877
+ const { propertyMapping, databaseId } = notionConfig;
197878
+ const client = yield* getClient();
197879
+ const response = yield* queryDataSource(client, databaseId, {
197880
+ property: propertyMapping.blockedBy,
197881
+ relation: { contains: blockerId }
197882
+ });
197883
+ const blockedPages = extractPages(response);
197884
+ const unblockedIdentifiers = [];
197885
+ for (const page of blockedPages) {
197886
+ const currentBlockers = extractRelation(page.properties[propertyMapping.blockedBy]);
197887
+ const newBlockers = currentBlockers.filter((id2) => id2 !== blockerId);
197888
+ yield* tryPromise2({
197889
+ try: () => client.pages.update({
197890
+ page_id: page.id,
197891
+ properties: {
197892
+ [propertyMapping.blockedBy]: relationProperty(newBlockers)
197893
+ }
197894
+ }),
197895
+ catch: (e2) => toNotionApiError(`Failed to update page: ${e2}`, e2)
197896
+ }).pipe(
197897
+ tapError2(
197898
+ (e2) => logWarning2(`Failed to remove blocker from page ${page.id}: ${e2.message}`)
197899
+ ),
197900
+ ignore2
197901
+ // Continue even if one fails
197902
+ );
197903
+ const task = mapPageToTask(page, createMapConfig(notionConfig, teamId));
197904
+ unblockedIdentifiers.push(task.identifier);
197905
+ }
197906
+ return unblockedIdentifiers;
197907
+ });
197908
+ return {
197909
+ getTask,
197910
+ getTaskByIdentifier,
197911
+ createTask,
197912
+ updateTask,
197913
+ listTasks,
197914
+ getReadyTasks,
197915
+ getBlockedTasks,
197916
+ addBlocker,
197917
+ removeBlocker,
197918
+ addRelated,
197919
+ getBranchName,
197920
+ setSessionLabel,
197921
+ setTypeLabel,
197922
+ clearSessionLabel,
197923
+ removeAsBlocker
197924
+ };
197925
+ });
197926
+ var IssueRepositoryNotion = effect(IssueRepository, make78);
197927
+
195476
197928
  // src/adapters/driven/vcs/JjParser.ts
195477
197929
  var JJ_LOG_JSON_TEMPLATE = `
195478
197930
  "{" ++
@@ -195763,7 +198215,7 @@ var networkRetryPolicy = intersect6(
195763
198215
  recurs2(3)
195764
198216
  );
195765
198217
  var NETWORK_TIMEOUT = seconds(60);
195766
- var make75 = gen2(function* () {
198218
+ var make79 = gen2(function* () {
195767
198219
  const executor = yield* CommandExecutor2;
195768
198220
  const escapeShellArg = (arg) => `'${arg.replace(/'/g, `'"'"'`)}'`;
195769
198221
  const runJj = (...args2) => {
@@ -196130,7 +198582,7 @@ var make75 = gen2(function* () {
196130
198582
  updateStaleWorkspace
196131
198583
  };
196132
198584
  });
196133
- var VcsServiceLive = effect(VcsService, make75);
198585
+ var VcsServiceLive = effect(VcsService, make79);
196134
198586
 
196135
198587
  // src/adapters/driven/github/PrServiceLive.ts
196136
198588
  var networkRetryPolicy2 = intersect6(
@@ -196182,7 +198634,7 @@ var GhIssueCommentSchema = Struct({
196182
198634
  created_at: String$
196183
198635
  });
196184
198636
  var GhIssueCommentsArraySchema = Array$(GhIssueCommentSchema);
196185
- var make76 = gen2(function* () {
198637
+ var make80 = gen2(function* () {
196186
198638
  const executor = yield* CommandExecutor2;
196187
198639
  const runGh = (...args2) => {
196188
198640
  const cmd = make61("gh", ...args2);
@@ -196493,7 +198945,7 @@ var make76 = gen2(function* () {
196493
198945
  getPrComments
196494
198946
  };
196495
198947
  });
196496
- var PrServiceLive = effect(PrService, make76);
198948
+ var PrServiceLive = effect(PrService, make80);
196497
198949
 
196498
198950
  // ../../node_modules/.pnpm/@effect+platform@0.94.1_effect@3.19.14/node_modules/@effect/platform/dist/esm/Socket.js
196499
198951
  var TypeId36 = /* @__PURE__ */ Symbol.for("@effect/platform/Socket");
@@ -196668,7 +199120,7 @@ var wsReconnectPolicy = intersect6(
196668
199120
  recurs2(3)
196669
199121
  );
196670
199122
  var NETWORK_TIMEOUT3 = seconds(60);
196671
- var make77 = gen2(function* () {
199123
+ var make81 = gen2(function* () {
196672
199124
  const executor = yield* CommandExecutor2;
196673
199125
  const withNetworkRetry = (effect3, operation) => effect3.pipe(
196674
199126
  timeoutFail2({
@@ -196994,7 +199446,7 @@ var make77 = gen2(function* () {
196994
199446
  connectAndStream
196995
199447
  };
196996
199448
  });
196997
- var WebhookServiceLive = effect(WebhookService, make77);
199449
+ var WebhookServiceLive = effect(WebhookService, make81);
196998
199450
 
196999
199451
  // src/adapters/driven/opencode/OpenCodeServiceLive.ts
197000
199452
  var DEFAULT_SERVER_URL = "http://127.0.0.1:4096";
@@ -197017,7 +199469,7 @@ var SessionStatusResponseSchema = Record({
197017
199469
  key: String$,
197018
199470
  value: SessionStatus
197019
199471
  });
197020
- var make78 = gen2(function* () {
199472
+ var make82 = gen2(function* () {
197021
199473
  const serverUrl = yield* sync4(() => process.env.OPENCODE_SERVER_URL ?? DEFAULT_SERVER_URL);
197022
199474
  const withNetworkRetry = (effect3, operation) => effect3.pipe(
197023
199475
  timeoutFail2({
@@ -197170,7 +199622,7 @@ var make78 = gen2(function* () {
197170
199622
  findActiveSession
197171
199623
  };
197172
199624
  });
197173
- var OpenCodeServiceLive = effect(OpenCodeService, make78);
199625
+ var OpenCodeServiceLive = effect(OpenCodeService, make82);
197174
199626
  var SubscriptionEntry = class extends Class3 {
197175
199627
  };
197176
199628
  var isTaggedError = (e2, tag6) => typeof e2 === "object" && e2 !== null && "_tag" in e2 && e2._tag === tag6;
@@ -197745,7 +200197,7 @@ var runDaemonServer = (repo, events, webhookService, openCodeService) => gen2(fu
197745
200197
  yield* interrupt4(commandProcessorFiber).pipe(ignore2);
197746
200198
  yield* logInfo2("Daemon stopped");
197747
200199
  });
197748
- var make79 = gen2(function* () {
200200
+ var make83 = gen2(function* () {
197749
200201
  const webhookService = yield* WebhookService;
197750
200202
  const openCodeService = yield* OpenCodeService;
197751
200203
  const isRunning2 = () => sync4(() => NFS.existsSync(DAEMON_SOCKET_PATH));
@@ -197842,7 +200294,7 @@ var make79 = gen2(function* () {
197842
200294
  startDaemon
197843
200295
  };
197844
200296
  });
197845
- var DaemonServiceLive = effect(DaemonService, make79);
200297
+ var DaemonServiceLive = effect(DaemonService, make83);
197846
200298
 
197847
200299
  // src/adapters/driven/template/TemplateServiceLive.ts
197848
200300
  var YAML2 = __toESM(require_dist());
@@ -197907,7 +200359,7 @@ var YamlTaskTemplate = Struct({
197907
200359
 
197908
200360
  // src/adapters/driven/template/TemplateServiceLive.ts
197909
200361
  var TEMPLATES_DIR = "templates";
197910
- var make80 = gen2(function* () {
200362
+ var make84 = gen2(function* () {
197911
200363
  const fs = yield* FileSystem;
197912
200364
  const path3 = yield* Path2;
197913
200365
  const configRepo = yield* ConfigRepository;
@@ -198003,7 +200455,7 @@ var make80 = gen2(function* () {
198003
200455
  hasTemplates
198004
200456
  };
198005
200457
  });
198006
- var TemplateServiceLive = effect(TemplateService, make80);
200458
+ var TemplateServiceLive = effect(TemplateService, make84);
198007
200459
 
198008
200460
  // src/adapters/driven/prompts/PromptsLive.ts
198009
200461
  var runPrompt = (prompt3) => tryPromise2({
@@ -198048,29 +200500,77 @@ var promptsImpl = {
198048
200500
  };
198049
200501
  var PromptsLive = succeed11(Prompts, promptsImpl);
198050
200502
 
200503
+ // src/infrastructure/MilestoneRepositoryStub.ts
200504
+ var make85 = succeed7({
200505
+ getMilestone: (_id) => fail7(
200506
+ new NotionApiError({
200507
+ message: "Milestones are not supported in Notion. Use Linear for milestone functionality."
200508
+ })
200509
+ ),
200510
+ /**
200511
+ * Returns empty array for listing - allows UI to show "no milestones" state
200512
+ * rather than an error when milestones aren't supported.
200513
+ */
200514
+ listMilestones: (_projectId) => succeed7([]),
200515
+ createMilestone: () => fail7(
200516
+ new NotionApiError({
200517
+ message: "Creating milestones is not supported in Notion. Use Linear for milestone functionality."
200518
+ })
200519
+ ),
200520
+ updateMilestone: () => fail7(
200521
+ new NotionApiError({
200522
+ message: "Updating milestones is not supported in Notion. Use Linear for milestone functionality."
200523
+ })
200524
+ ),
200525
+ deleteMilestone: () => fail7(
200526
+ new NotionApiError({
200527
+ message: "Deleting milestones is not supported in Notion. Use Linear for milestone functionality."
200528
+ })
200529
+ )
200530
+ });
200531
+ var MilestoneRepositoryStub = effect(MilestoneRepository, make85);
200532
+
198051
200533
  // src/infrastructure/Layers.ts
198052
200534
  var ConfigAndAuth = AuthServiceLive.pipe(provideMerge2(ConfigRepositoryLive));
198053
200535
  var ConfigAuthAndLinear = LinearClientLive.pipe(provideMerge2(ConfigAndAuth));
198054
- var RepositoryLayers = mergeAll5(
200536
+ var LinearRepositoryLayers = mergeAll5(
198055
200537
  TeamRepositoryLive,
198056
200538
  ProjectRepositoryLive,
198057
200539
  IssueRepositoryLive,
198058
200540
  MilestoneRepositoryLive
198059
200541
  );
198060
- var BaseServices = mergeAll5(
198061
- RepositoryLayers,
200542
+ var ConfigAuthAndNotion = NotionClientLive.pipe(provideMerge2(ConfigAndAuth));
200543
+ var NotionRepositoryLayers = mergeAll5(
200544
+ TeamRepositoryNotion,
200545
+ ProjectRepositoryNotion,
200546
+ IssueRepositoryNotion.pipe(provide3(ConfigRepositoryLive)),
200547
+ MilestoneRepositoryStub
200548
+ // Notion doesn't have milestones
200549
+ );
200550
+ var ProviderAgnosticServices = mergeAll5(
198062
200551
  VcsServiceLive,
198063
200552
  PrServiceLive,
198064
200553
  WebhookServiceLive,
198065
200554
  OpenCodeServiceLive,
198066
200555
  TemplateServiceLive,
198067
200556
  PromptsLive
198068
- ).pipe(provideMerge2(ConfigAuthAndLinear));
198069
- var AllServices = DaemonServiceLive.pipe(provideMerge2(BaseServices));
198070
- var AppLayer = AllServices.pipe(provideMerge2(layer11));
198071
- var MinimalRepositories = mergeAll5(TeamRepositoryLive, ProjectRepositoryLive, PromptsLive);
198072
- var MinimalServices = MinimalRepositories.pipe(provideMerge2(ConfigAuthAndLinear));
198073
- MinimalServices.pipe(provideMerge2(layer11));
200557
+ );
200558
+ var LinearBaseServices = mergeAll5(LinearRepositoryLayers, ProviderAgnosticServices).pipe(
200559
+ provideMerge2(ConfigAuthAndLinear)
200560
+ );
200561
+ var LinearAllServices = DaemonServiceLive.pipe(provideMerge2(LinearBaseServices));
200562
+ var AppLayer = LinearAllServices.pipe(provideMerge2(layer11));
200563
+ var NotionBaseServices = mergeAll5(NotionRepositoryLayers, ProviderAgnosticServices).pipe(
200564
+ provideMerge2(ConfigAuthAndNotion)
200565
+ );
200566
+ var NotionAllServices = DaemonServiceLive.pipe(provideMerge2(NotionBaseServices));
200567
+ NotionAllServices.pipe(provideMerge2(layer11));
200568
+ var LinearMinimalRepositories = mergeAll5(TeamRepositoryLive, ProjectRepositoryLive, PromptsLive);
200569
+ var LinearMinimalServices = LinearMinimalRepositories.pipe(provideMerge2(ConfigAuthAndLinear));
200570
+ LinearMinimalServices.pipe(provideMerge2(layer11));
200571
+ var NotionMinimalRepositories = mergeAll5(TeamRepositoryNotion, ProjectRepositoryNotion, PromptsLive);
200572
+ var NotionMinimalServices = NotionMinimalRepositories.pipe(provideMerge2(ConfigAuthAndNotion));
200573
+ NotionMinimalServices.pipe(provideMerge2(layer11));
198074
200574
 
198075
200575
  // src/bin.ts
198076
200576
  run9(process.argv).pipe(