[{"data":1,"prerenderedAt":743},["ShallowReactive",2],{"navigation_docs":3,"-guides-capabilities":199,"-guides-capabilities-surround":738},[4,23,65,87,133,159,177],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":22},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",false,{"title":24,"icon":25,"path":26,"stem":27,"children":28,"page":22},"Guides","i-lucide-compass","\u002Fguides","2.guides",[29,33,37,41,45,49,53,57,61],{"title":30,"path":31,"stem":32},"Authenticate","\u002Fguides\u002Fauthentication","2.guides\u002F1.authentication",{"title":34,"path":35,"stem":36},"Work with several forges","\u002Fguides\u002Fmultiple-forges","2.guides\u002F2.multiple-forges",{"title":38,"path":39,"stem":40},"Configure from the environment","\u002Fguides\u002Fenvironment","2.guides\u002F3.environment",{"title":42,"path":43,"stem":44},"Receive webhooks","\u002Fguides\u002Fwebhooks","2.guides\u002F4.webhooks",{"title":46,"path":47,"stem":48},"Check what a forge supports","\u002Fguides\u002Fcapabilities","2.guides\u002F5.capabilities",{"title":50,"path":51,"stem":52},"Handle errors and rate limits","\u002Fguides\u002Ferrors","2.guides\u002F6.errors",{"title":54,"path":55,"stem":56},"Page through results","\u002Fguides\u002Fpagination","2.guides\u002F7.pagination",{"title":58,"path":59,"stem":60},"Browser bundles","\u002Fguides\u002Fbundling","2.guides\u002F8.bundling",{"title":62,"path":63,"stem":64},"Test your code","\u002Fguides\u002Ftesting","2.guides\u002F9.testing",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":22},"Concepts","i-lucide-lightbulb","\u002Fconcepts","3.concepts",[71,75,79,83],{"title":72,"path":73,"stem":74},"Data model","\u002Fconcepts\u002Fdata-model","3.concepts\u002F1.data-model",{"title":76,"path":77,"stem":78},"Capabilities","\u002Fconcepts\u002Fcapabilities","3.concepts\u002F2.capabilities",{"title":80,"path":81,"stem":82},"Providers and factories","\u002Fconcepts\u002Fproviders","3.concepts\u002F3.providers",{"title":84,"path":85,"stem":86},"Events","\u002Fconcepts\u002Fevents","3.concepts\u002F4.events",{"title":88,"icon":89,"path":90,"stem":91,"children":92,"page":22},"Providers","i-lucide-server","\u002Fproviders","4.providers",[93,97,101,105,109,113,117,121,125,129],{"title":94,"path":95,"stem":96},"Azure DevOps","\u002Fproviders\u002Fazure-devops","4.providers\u002Fazure-devops",{"title":98,"path":99,"stem":100},"Bitbucket Cloud","\u002Fproviders\u002Fbitbucket","4.providers\u002Fbitbucket",{"title":102,"path":103,"stem":104},"Cursor Origin","\u002Fproviders\u002Fcursor-origin","4.providers\u002Fcursor-origin",{"title":106,"path":107,"stem":108},"Forgejo and Codeberg","\u002Fproviders\u002Fforgejo","4.providers\u002Fforgejo",{"title":110,"path":111,"stem":112},"Gitea","\u002Fproviders\u002Fgitea","4.providers\u002Fgitea",{"title":114,"path":115,"stem":116},"Gitee","\u002Fproviders\u002Fgitee","4.providers\u002Fgitee",{"title":118,"path":119,"stem":120},"GitHub","\u002Fproviders\u002Fgithub","4.providers\u002Fgithub",{"title":122,"path":123,"stem":124},"GitLab","\u002Fproviders\u002Fgitlab","4.providers\u002Fgitlab",{"title":126,"path":127,"stem":128},"pushin.eu","\u002Fproviders\u002Fpushin","4.providers\u002Fpushin",{"title":130,"path":131,"stem":132},"Tangled","\u002Fproviders\u002Ftangled","4.providers\u002Ftangled",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":22},"Reference","i-lucide-book-marked","\u002Freference","5.reference",[139,143,147,151,155],{"title":140,"path":141,"stem":142},"Provider API","\u002Freference\u002Fprovider-api","5.reference\u002F1.provider-api",{"title":144,"path":145,"stem":146},"Capability matrix","\u002Freference\u002Fcapability-matrix","5.reference\u002F2.capability-matrix",{"title":148,"path":149,"stem":150},"Errors","\u002Freference\u002Ferrors","5.reference\u002F3.errors",{"title":152,"path":153,"stem":154},"Environment variables","\u002Freference\u002Fenvironment-variables","5.reference\u002F4.environment-variables",{"title":156,"path":157,"stem":158},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":160,"icon":161,"path":162,"stem":163,"children":164,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[165,169,173],{"title":166,"path":167,"stem":168},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":170,"path":171,"stem":172},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":174,"path":175,"stem":176},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":178,"icon":179,"path":180,"stem":181,"children":182,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[183,187,191,195],{"title":184,"path":185,"stem":186},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":188,"path":189,"stem":190},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":192,"path":193,"stem":194},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":196,"path":197,"stem":198},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":200,"title":46,"body":201,"description":731,"extension":732,"links":733,"meta":734,"navigation":625,"path":47,"seo":736,"stem":48,"__hash__":737},"docs\u002F2.guides\u002F5.capabilities.md",{"type":202,"value":203,"toc":723},"minimark",[204,216,225,236,346,381,419,423,430,581,585,591,652,656,669,697,701,719],[205,206,207,211,212,215],"p",{},[208,209,210],"code",{},"provider.capabilities"," describes what a provider supports. The provider computes it without a network request. ",[213,214,76],"a",{"href":77}," explains the four values.",[217,218,220,221,224],"h2",{"id":219},"call-can-before-an-operation","Call ",[208,222,223],{},"can()"," before an operation",[205,226,227,228,231,232,235],{},"A verb is the path of the method on the provider, such as ",[208,229,230],{},"threads.addLabels"," or ",[208,233,234],{},"webhooks.create",". Pass the thread kind as well when support differs by kind:",[237,238,243],"pre",{"className":239,"code":240,"language":241,"meta":242,"style":242},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","if (gh.can('threads.addLabels', thread.ref.kind)) {\n  await gh.threads.addLabels(thread.ref, ['triage'])\n}\n","ts","",[208,244,245,296,340],{"__ignoreMap":242},[246,247,250,254,258,262,266,269,272,275,277,280,283,285,288,290,293],"span",{"class":248,"line":249},"line",1,[246,251,253],{"class":252},"s7zQu","if",[246,255,257],{"class":256},"sTEyZ"," (gh",[246,259,261],{"class":260},"sMK4o",".",[246,263,265],{"class":264},"s2Zo4","can",[246,267,268],{"class":256},"(",[246,270,271],{"class":260},"'",[246,273,230],{"class":274},"sfazB",[246,276,271],{"class":260},[246,278,279],{"class":260},",",[246,281,282],{"class":256}," thread",[246,284,261],{"class":260},[246,286,287],{"class":256},"ref",[246,289,261],{"class":260},[246,291,292],{"class":256},"kind)) ",[246,294,295],{"class":260},"{\n",[246,297,299,302,305,307,310,312,315,318,321,323,325,327,330,332,335,337],{"class":248,"line":298},2,[246,300,301],{"class":252},"  await",[246,303,304],{"class":256}," gh",[246,306,261],{"class":260},[246,308,309],{"class":256},"threads",[246,311,261],{"class":260},[246,313,314],{"class":264},"addLabels",[246,316,268],{"class":317},"swJcz",[246,319,320],{"class":256},"thread",[246,322,261],{"class":260},[246,324,287],{"class":256},[246,326,279],{"class":260},[246,328,329],{"class":317}," [",[246,331,271],{"class":260},[246,333,334],{"class":274},"triage",[246,336,271],{"class":260},[246,338,339],{"class":317},"])\n",[246,341,343],{"class":248,"line":342},3,[246,344,345],{"class":260},"}\n",[205,347,348,350,351,354,355,357,358,361,362,365,366,369,370,373,374,376,377,380],{},[208,349,223],{}," returns ",[208,352,353],{},"true"," for ",[208,356,353],{},", ",[208,359,360],{},"'experimental'",", and ",[208,363,364],{},"'emulated'",". To treat experimental or emulated support differently, read the value from ",[208,367,368],{},"capabilities",". Its keys follow the ",[213,371,372],{"href":145},"capability matrix",", so ",[208,375,230],{}," is ",[208,378,379],{},"capabilities.writes.addLabels",":",[237,382,384],{"className":239,"code":383,"language":241,"meta":242,"style":242},"const support = provider.capabilities.writes.addLabels.issue\n",[208,385,386],{"__ignoreMap":242},[246,387,388,392,395,398,401,403,405,407,410,412,414,416],{"class":248,"line":249},[246,389,391],{"class":390},"spNyl","const",[246,393,394],{"class":256}," support ",[246,396,397],{"class":260},"=",[246,399,400],{"class":256}," provider",[246,402,261],{"class":260},[246,404,368],{"class":256},[246,406,261],{"class":260},[246,408,409],{"class":256},"writes",[246,411,261],{"class":260},[246,413,314],{"class":256},[246,415,261],{"class":260},[246,417,418],{"class":256},"issue\n",[217,420,422],{"id":421},"provide-a-fallback","Provide a fallback",[205,424,425,426,429],{},"Every method exists on every provider. A method for an unsupported operation rejects with ",[208,427,428],{},"UnsupportedOperationError",". Check first, and choose what to do instead:",[237,431,433],{"className":239,"code":432,"language":241,"meta":242,"style":242},"if (provider.can('threads.upsertComment', thread.ref.kind)) {\n  await provider.threads.upsertComment(thread.ref, {\n    key: 'ci-report',\n    body,\n  })\n}\nelse {\n  await provider.threads.comment(thread.ref, body)\n}\n",[208,434,435,469,497,515,523,532,537,545,576],{"__ignoreMap":242},[246,436,437,439,442,444,446,448,450,453,455,457,459,461,463,465,467],{"class":248,"line":249},[246,438,253],{"class":252},[246,440,441],{"class":256}," (provider",[246,443,261],{"class":260},[246,445,265],{"class":264},[246,447,268],{"class":256},[246,449,271],{"class":260},[246,451,452],{"class":274},"threads.upsertComment",[246,454,271],{"class":260},[246,456,279],{"class":260},[246,458,282],{"class":256},[246,460,261],{"class":260},[246,462,287],{"class":256},[246,464,261],{"class":260},[246,466,292],{"class":256},[246,468,295],{"class":260},[246,470,471,473,475,477,479,481,484,486,488,490,492,494],{"class":248,"line":298},[246,472,301],{"class":252},[246,474,400],{"class":256},[246,476,261],{"class":260},[246,478,309],{"class":256},[246,480,261],{"class":260},[246,482,483],{"class":264},"upsertComment",[246,485,268],{"class":317},[246,487,320],{"class":256},[246,489,261],{"class":260},[246,491,287],{"class":256},[246,493,279],{"class":260},[246,495,496],{"class":260}," {\n",[246,498,499,502,504,507,510,512],{"class":248,"line":342},[246,500,501],{"class":317},"    key",[246,503,380],{"class":260},[246,505,506],{"class":260}," '",[246,508,509],{"class":274},"ci-report",[246,511,271],{"class":260},[246,513,514],{"class":260},",\n",[246,516,518,521],{"class":248,"line":517},4,[246,519,520],{"class":256},"    body",[246,522,514],{"class":260},[246,524,526,529],{"class":248,"line":525},5,[246,527,528],{"class":260},"  }",[246,530,531],{"class":317},")\n",[246,533,535],{"class":248,"line":534},6,[246,536,345],{"class":260},[246,538,540,543],{"class":248,"line":539},7,[246,541,542],{"class":252},"else",[246,544,496],{"class":260},[246,546,548,550,552,554,556,558,561,563,565,567,569,571,574],{"class":248,"line":547},8,[246,549,301],{"class":252},[246,551,400],{"class":256},[246,553,261],{"class":260},[246,555,309],{"class":256},[246,557,261],{"class":260},[246,559,560],{"class":264},"comment",[246,562,268],{"class":317},[246,564,320],{"class":256},[246,566,261],{"class":260},[246,568,287],{"class":256},[246,570,279],{"class":260},[246,572,573],{"class":256}," body",[246,575,531],{"class":317},[246,577,579],{"class":248,"line":578},9,[246,580,345],{"class":260},[217,582,584],{"id":583},"check-a-stored-capabilities-object","Check a stored capabilities object",[205,586,587,590],{},[208,588,589],{},"supports(capabilities, verb, kind?)"," gives the same answer from a plain capabilities object. Use it with capabilities that you stored or received from another process:",[237,592,594],{"className":239,"code":593,"language":241,"meta":242,"style":242},"import { supports } from 'forges'\n\nconst canMerge = supports(saved, 'threads.merge')\n",[208,595,596,621,627],{"__ignoreMap":242},[246,597,598,601,604,607,610,613,615,618],{"class":248,"line":249},[246,599,600],{"class":252},"import",[246,602,603],{"class":260}," {",[246,605,606],{"class":256}," supports",[246,608,609],{"class":260}," }",[246,611,612],{"class":252}," from",[246,614,506],{"class":260},[246,616,617],{"class":274},"forges",[246,619,620],{"class":260},"'\n",[246,622,623],{"class":248,"line":298},[246,624,626],{"emptyLinePlaceholder":625},true,"\n",[246,628,629,631,634,636,638,641,643,645,648,650],{"class":248,"line":342},[246,630,391],{"class":390},[246,632,633],{"class":256}," canMerge ",[246,635,397],{"class":260},[246,637,606],{"class":264},[246,639,640],{"class":256},"(saved",[246,642,279],{"class":260},[246,644,506],{"class":260},[246,646,647],{"class":274},"threads.merge",[246,649,271],{"class":260},[246,651,531],{"class":256},[217,653,655],{"id":654},"handle-version-dependent-capabilities","Handle version-dependent capabilities",[205,657,658,659,662,663,666,667,380],{},"Some capabilities depend on the version of the instance. GitHub Enterprise Server supports marking notifications done from version 3.13, for example. Pass ",[208,660,661],{},"instanceVersion"," if you know it. Otherwise, call ",[208,664,665],{},"refreshCapabilities()",", which reads the version once per provider and updates ",[208,668,368],{},[237,670,672],{"className":239,"code":671,"language":241,"meta":242,"style":242},"const capabilities = await forge.refreshCapabilities()\n",[208,673,674],{"__ignoreMap":242},[246,675,676,678,681,683,686,689,691,694],{"class":248,"line":249},[246,677,391],{"class":390},[246,679,680],{"class":256}," capabilities ",[246,682,397],{"class":260},[246,684,685],{"class":252}," await",[246,687,688],{"class":256}," forge",[246,690,261],{"class":260},[246,692,693],{"class":264},"refreshCapabilities",[246,695,696],{"class":256},"()\n",[217,698,700],{"id":699},"find-the-scopes-a-verb-needs","Find the scopes a verb needs",[205,702,703,704,376,706,708,709,712,713,261],{},"When ",[208,705,223],{},[208,707,353],{}," but a call fails with ",[208,710,711],{},"InsufficientScopeError",", use ",[213,714,716],{"href":715},"\u002Fguides\u002Fauthentication#show-the-scopes-an-operation-needs",[208,717,718],{},"scopesFor()",[720,721,722],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":242,"searchDepth":298,"depth":298,"links":724},[725,727,728,729,730],{"id":219,"depth":298,"text":726},"Call can() before an operation",{"id":421,"depth":298,"text":422},{"id":583,"depth":298,"text":584},{"id":654,"depth":298,"text":655},{"id":699,"depth":298,"text":700},"Ask a provider whether it supports an operation before you call it.","md",null,{"icon":735},"i-lucide-list-checks",{"title":46,"description":731},"AnqAhPmlSZFl7mj0Ktcs2cziUiFCjpFnbnp5kyFhVSs",[739,741],{"title":42,"path":43,"stem":44,"description":740,"children":-1},"Verify a delivery and turn it into normalised events.",{"title":50,"path":51,"stem":52,"description":742,"children":-1},"Catch typed errors, and see how providers retry rate-limited requests.",1791296694185]