@raycast/api 1.93.0 → 1.93.2

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.
@@ -33,7 +33,7 @@ To automate this process, you have to authenticate with GitHub.
33
33
  First copy your one-time code: ${r.user_code}
34
34
  Press Enter to open github.com in your browser...`),process.stdin.setRawMode(!0),process.stdin.resume(),await new Promise(i=>process.stdin.once("data",u=>{let l=[...u];l.length>0&&l[0]===3&&(console.log("^C"),process.exit(1)),process.stdin.setRawMode(!1),i(void 0)})),va(r.verification_uri);let o=r.interval*1e3;for(;;){await new Promise(i=>setTimeout(i,o));try{let i=await Ie("https://github.com/login/oauth/access_token",{method:"POST",body:JSON.stringify({client_id:e,device_code:r.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!i.error){tn("githubAccessToken",i.access_token);return}if(i.error!=="authorization_pending")throw new Error(i.error_description)}catch(i){throw new Error(`failed to get the access token (${i.message})`)}}}async function Ra(e,r){let o=pe("githubAccessToken"),i=await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}/forks`,{method:"POST",token:o,body:JSON.stringify({name:r,default_branch_only:!0})});for(let u=0;u<=30;u++){try{await Ie(`https://api.github.com/repos/${i.owner.login}/${i.name}/commits?per_page=1`,{token:o});break}catch(l){if(u===30)throw new Error(`fork not ready after 1min (${l.message})`)}await new Promise(l=>setTimeout(l,2e3))}return i}async function Ba(e){let r=pe("githubAccessToken");try{await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}/merge-upstream`,{method:"POST",token:r,body:JSON.stringify({branch:"main"})})}catch(o){throw new Error(`could not get the latest changes. Head to https://github.com/${e.owner.login}/${e.name}, select the Sync fork dropdown menu above the list of files, and then click Update branch. Once you've done that, try running this command again
35
35
 
36
- Error: ${o.message}`)}}async function Ta(e){let r=pe("githubAccessToken");await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function Pa(e,r){return gu(`https://oauth2:${pe("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ii(e,r){return bu(e,`https://oauth2:${pe("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function Oa(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=pe("githubAccessToken"),f=(await Ie(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:u})).items.filter(d=>d.name==="package.json");if(f.length===0)return oi.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return oi.default.dirname(f[0].path)}async function xa(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=pe("githubAccessToken");return(await Ie(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var ka=!1;async function ui(e){if(!await mu())throw new Error("please create a git repository first (git init)");if(await Xt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await Aa();let r={owner:{login:"raycast"},name:"extensions"},o=si.default.join(Io(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await bt("getting fork",async()=>{try{l=await Ra(r,"raycast-extensions"),await Ba(l),await Ta(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(ka)throw new Error("fork extensions repo: not authorized");return ka=!0,tn("githubAccessToken",void 0),ui(e)}throw f}else l=l;if(!Ia.default.existsSync(o)){let d=await bt("cloning repo",async()=>{await Pa(l,o)},{printError:!1});if(d)throw d}if(et(o),await ii("origin",l),await ii("upstream",r),f=await bt("preparing clone",async()=>{let d=await Oa(r,e.name,e.author);u=si.default.join(o,d),et(void 0);let p=await Ao("user.name"),g=await Ao("user.email");if(et(o),await Ro("user.name",p),await Ro("user.email",g),await Fu(d),await Oe("main"),await To("upstream","main"),await yu("upstream/main"),await en(i)){await Ft(i),await To("origin",i);let x=await pu();await xa(x)&&(await _u(i),await Ft(i))}else await Bo(i),await Ft(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function gd(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await ui(e),u=$a.default.existsSync(Wa.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=Ru(i);et(r),await bt("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await en(i)?await Eu(i)||(await Oe(i),await vu(i)):(await Oe("main"),await wu(f,"Used by the Ray CLI to track the latest commit that was pulled")),et(void 0),await Cu(l)?await Oe(l):await Oe(hu),xo(o,process.cwd()),await Xt()){let p=`contributions/merge-${new Date().getTime()}`;await Ft(p),await Su("Pull contributions"),await Oe("@{-2}");try{await Au(p)}catch(g){if(await Xt())return"Some contributions conflict with your changes.\n\nYou can do two things:\n\n- Decide not to merge but you won't be able to publish your changes. The only clean-ups you need are to run `git merge --abort`.\n\n- Resolve the conflicts. Edit the files into shape and `git add` them. Use `git merge --continue` to seal the deal. You will be able to run `npm run publish` afterwards.";throw g}throw new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`")}else return await Oe(Du),"no new contributions"})&&process.exit(1)}0&&(module.exports={pullContributions});
36
+ Error: ${o.message}`)}}async function Ta(e){let r=pe("githubAccessToken");await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function Pa(e,r){return gu(`https://oauth2:${pe("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ii(e,r){return bu(e,`https://oauth2:${pe("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function Oa(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=pe("githubAccessToken"),f=(await Ie(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:u})).items.filter(d=>d.name==="package.json");if(f.length===0)return oi.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return oi.default.dirname(f[0].path)}async function xa(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=pe("githubAccessToken");return(await Ie(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var ka=!1;async function ui(e){if(!await mu())throw new Error("please create a git repository first (git init)");if(await Xt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await Aa();let r={owner:{login:"raycast"},name:"extensions"},o=si.default.join(Io(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await bt("getting fork",async()=>{try{l=await Ra(r,"raycast-extensions"),await Ba(l),await Ta(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(ka)throw new Error("fork extensions repo: not authorized");return ka=!0,tn("githubAccessToken",void 0),ui(e)}throw f}else l=l;if(!Ia.default.existsSync(o)){let d=await bt("cloning repo",async()=>{await Pa(l,o)},{printError:!1});if(d)throw d}if(et(o),await ii("origin",l),await ii("upstream",r),f=await bt("preparing clone",async()=>{let d=await Oa(r,e.name,e.author);u=si.default.join(o,d),et(void 0);let p=await Ao("user.name"),g=await Ao("user.email");if(et(o),await Ro("user.name",p),await Ro("user.email",g),await Fu(d),await Oe("main"),await To("upstream","main"),await yu("upstream/main"),await en(i)){await Ft(i),await To("origin",i);let x=await pu();await xa(x)&&(await _u(i),await Ft(i))}else await Bo(i),await Ft(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function gd(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await ui(e),u=$a.default.existsSync(Wa.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=Ru(i);et(r),await bt("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await en(i)?await Eu(i)||(await Oe(i),await vu(i)):(await Oe("main"),await wu(f,"Used by the Ray CLI to track the latest commit that was pulled")),et(void 0),await Cu(l)?await Oe(l):await Oe(hu),xo(o,process.cwd()),await Xt()){let p=`contributions/merge-${new Date().getTime()}`;await Ft(p),await Su("Pull contributions"),await Oe("@{-2}");try{await Au(p)}catch(g){if(await Xt())return"Some contributions conflict with your changes.\n\nYou can do two things:\n\n- Decide not to merge but you won't be able to publish your changes. The only clean-ups you need are to run `git merge --abort`.\n\n- Resolve the conflicts. Edit the files into shape and `git add` them. Use `git merge --continue` to seal the deal. You will be able to run `npm run publish` afterwards.";throw g}return"contributions merged. You can now run `npm run publish` again"}else return await Oe(Du),"no new contributions"})&&process.exit(1)}0&&(module.exports={pullContributions});
37
37
  /*! Bundled license information:
38
38
 
39
39
  node-fetch-cjs/dist/index.js:
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "commands": {
3
- "build": {
4
- "aliases": [],
3
+ "develop": {
4
+ "aliases": [
5
+ "dev"
6
+ ],
5
7
  "args": {},
6
- "description": "Build the extension to the output directory",
8
+ "description": "Start the extension in development mode and watches for changes",
7
9
  "flags": {
8
10
  "exit-on-error": {
9
11
  "aliases": [
@@ -53,45 +55,31 @@
53
55
  ],
54
56
  "type": "option"
55
57
  },
56
- "environment": {
57
- "char": "e",
58
- "description": "Environment to build for",
59
- "name": "environment",
60
- "default": "dev",
61
- "hasDynamicHelp": false,
62
- "multiple": false,
63
- "options": [
64
- "dev",
65
- "dist"
66
- ],
67
- "type": "option"
68
- },
69
- "output": {
70
- "char": "o",
71
- "description": "Output path",
72
- "name": "output",
73
- "hasDynamicHelp": false,
74
- "multiple": false,
75
- "type": "option"
58
+ "print-tool-schemas": {
59
+ "description": "Indicates whether to print the schema tools \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
60
+ "hidden": true,
61
+ "name": "print-tool-schemas",
62
+ "allowNo": false,
63
+ "type": "boolean"
76
64
  },
77
- "skip-types": {
78
- "description": "Indicates whether to skip types generation \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
65
+ "print-instructions": {
66
+ "description": "Indicates whether to print the extension's instructions \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
79
67
  "hidden": true,
80
- "name": "skip-types",
68
+ "name": "print-instructions",
81
69
  "allowNo": false,
82
70
  "type": "boolean"
83
71
  },
84
- "print-tool-schemas": {
85
- "description": "Indicates whether to print the schema tools \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
72
+ "print-tool-calls": {
73
+ "description": "Indicates whether to print the inputs and outputs of tools when they are called from Raycast \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
86
74
  "hidden": true,
87
- "name": "print-tool-schemas",
75
+ "name": "print-tool-calls",
88
76
  "allowNo": false,
89
77
  "type": "boolean"
90
78
  }
91
79
  },
92
80
  "hasDynamicHelp": false,
93
81
  "hiddenAliases": [],
94
- "id": "build",
82
+ "id": "develop",
95
83
  "pluginAlias": "ray",
96
84
  "pluginName": "ray",
97
85
  "pluginType": "core",
@@ -101,16 +89,14 @@
101
89
  "relativePath": [
102
90
  "dist",
103
91
  "commands",
104
- "build",
92
+ "develop",
105
93
  "index.js"
106
94
  ]
107
95
  },
108
- "develop": {
109
- "aliases": [
110
- "dev"
111
- ],
96
+ "build": {
97
+ "aliases": [],
112
98
  "args": {},
113
- "description": "Start the extension in development mode and watches for changes",
99
+ "description": "Build the extension to the output directory",
114
100
  "flags": {
115
101
  "exit-on-error": {
116
102
  "aliases": [
@@ -160,31 +146,45 @@
160
146
  ],
161
147
  "type": "option"
162
148
  },
163
- "print-tool-schemas": {
164
- "description": "Indicates whether to print the schema tools \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
165
- "hidden": true,
166
- "name": "print-tool-schemas",
167
- "allowNo": false,
168
- "type": "boolean"
149
+ "environment": {
150
+ "char": "e",
151
+ "description": "Environment to build for",
152
+ "name": "environment",
153
+ "default": "dev",
154
+ "hasDynamicHelp": false,
155
+ "multiple": false,
156
+ "options": [
157
+ "dev",
158
+ "dist"
159
+ ],
160
+ "type": "option"
169
161
  },
170
- "print-instructions": {
171
- "description": "Indicates whether to print the extension's instructions \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
162
+ "output": {
163
+ "char": "o",
164
+ "description": "Output path",
165
+ "name": "output",
166
+ "hasDynamicHelp": false,
167
+ "multiple": false,
168
+ "type": "option"
169
+ },
170
+ "skip-types": {
171
+ "description": "Indicates whether to skip types generation \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
172
172
  "hidden": true,
173
- "name": "print-instructions",
173
+ "name": "skip-types",
174
174
  "allowNo": false,
175
175
  "type": "boolean"
176
176
  },
177
- "print-tool-calls": {
178
- "description": "Indicates whether to print the inputs and outputs of tools when they are called from Raycast \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
177
+ "print-tool-schemas": {
178
+ "description": "Indicates whether to print the schema tools \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
179
179
  "hidden": true,
180
- "name": "print-tool-calls",
180
+ "name": "print-tool-schemas",
181
181
  "allowNo": false,
182
182
  "type": "boolean"
183
183
  }
184
184
  },
185
185
  "hasDynamicHelp": false,
186
186
  "hiddenAliases": [],
187
- "id": "develop",
187
+ "id": "build",
188
188
  "pluginAlias": "ray",
189
189
  "pluginName": "ray",
190
190
  "pluginType": "core",
@@ -194,7 +194,7 @@
194
194
  "relativePath": [
195
195
  "dist",
196
196
  "commands",
197
- "develop",
197
+ "build",
198
198
  "index.js"
199
199
  ]
200
200
  },
@@ -694,10 +694,10 @@
694
694
  "index.js"
695
695
  ]
696
696
  },
697
- "pull-contributions": {
697
+ "publish": {
698
698
  "aliases": [],
699
699
  "args": {},
700
- "description": "Pull contributions of the extension",
700
+ "description": "Publish the extension on the Raycast Store.\nPrivate extension are a team feature. Sign up for it here: https://www.raycast.com/pricing (​https://www.raycast.com/pricing​)",
701
701
  "flags": {
702
702
  "exit-on-error": {
703
703
  "aliases": [
@@ -746,28 +746,51 @@
746
746
  "release"
747
747
  ],
748
748
  "type": "option"
749
+ },
750
+ "clipboard": {
751
+ "char": "C",
752
+ "description": "Copy the extension link to the clipboard upon publishing",
753
+ "name": "clipboard",
754
+ "allowNo": false,
755
+ "type": "boolean"
756
+ },
757
+ "skip-validation": {
758
+ "char": "s",
759
+ "description": "Skip validation and always publish \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
760
+ "hidden": true,
761
+ "name": "skip-validation",
762
+ "allowNo": false,
763
+ "type": "boolean"
764
+ },
765
+ "skip-notify-raycast": {
766
+ "description": "Skip notifying Raycast after publishing \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
767
+ "hidden": true,
768
+ "name": "skip-notify-raycast",
769
+ "allowNo": false,
770
+ "type": "boolean"
749
771
  }
750
772
  },
751
773
  "hasDynamicHelp": false,
752
774
  "hiddenAliases": [],
753
- "id": "pull-contributions",
775
+ "id": "publish",
754
776
  "pluginAlias": "ray",
755
777
  "pluginName": "ray",
756
778
  "pluginType": "core",
757
779
  "strict": true,
780
+ "summary": "Publish the extension",
758
781
  "enableJsonFlag": false,
759
782
  "isESM": false,
760
783
  "relativePath": [
761
784
  "dist",
762
785
  "commands",
763
- "pull-contributions",
786
+ "publish",
764
787
  "index.js"
765
788
  ]
766
789
  },
767
- "publish": {
790
+ "pull-contributions": {
768
791
  "aliases": [],
769
792
  "args": {},
770
- "description": "Publish the extension on the Raycast Store.\nPrivate extension are a team feature. Sign up for it here: https://www.raycast.com/pricing (​https://www.raycast.com/pricing​)",
793
+ "description": "Pull contributions of the extension",
771
794
  "flags": {
772
795
  "exit-on-error": {
773
796
  "aliases": [
@@ -816,44 +839,21 @@
816
839
  "release"
817
840
  ],
818
841
  "type": "option"
819
- },
820
- "clipboard": {
821
- "char": "C",
822
- "description": "Copy the extension link to the clipboard upon publishing",
823
- "name": "clipboard",
824
- "allowNo": false,
825
- "type": "boolean"
826
- },
827
- "skip-validation": {
828
- "char": "s",
829
- "description": "Skip validation and always publish \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
830
- "hidden": true,
831
- "name": "skip-validation",
832
- "allowNo": false,
833
- "type": "boolean"
834
- },
835
- "skip-notify-raycast": {
836
- "description": "Skip notifying Raycast after publishing \u001b[34m\u001b[2minternal only\u001b[22m\u001b[39m",
837
- "hidden": true,
838
- "name": "skip-notify-raycast",
839
- "allowNo": false,
840
- "type": "boolean"
841
842
  }
842
843
  },
843
844
  "hasDynamicHelp": false,
844
845
  "hiddenAliases": [],
845
- "id": "publish",
846
+ "id": "pull-contributions",
846
847
  "pluginAlias": "ray",
847
848
  "pluginName": "ray",
848
849
  "pluginType": "core",
849
850
  "strict": true,
850
- "summary": "Publish the extension",
851
851
  "enableJsonFlag": false,
852
852
  "isESM": false,
853
853
  "relativePath": [
854
854
  "dist",
855
855
  "commands",
856
- "publish",
856
+ "pull-contributions",
857
857
  "index.js"
858
858
  ]
859
859
  },
@@ -1099,5 +1099,5 @@
1099
1099
  ]
1100
1100
  }
1101
1101
  },
1102
- "version": "1.93.0"
1102
+ "version": "1.93.2"
1103
1103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.93.0",
3
+ "version": "1.93.2",
4
4
  "description": "Build extensions for Raycast with React and Node.js.",
5
5
  "author": "Raycast Technologies Ltd.",
6
6
  "homepage": "https://developers.raycast.com",