oauth-init 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.lock +0 -104
- package/dist/index.js +296 -171
- package/package.json +1 -3
package/bun.lock
CHANGED
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@clack/prompts": "^1.0.1",
|
|
9
9
|
"@types/bun": "^1.3.9",
|
|
10
|
-
"chalk": "^5.3.0",
|
|
11
10
|
"execa": "^9.6.1",
|
|
12
|
-
"inquirer": "^9.2.12",
|
|
13
11
|
"open": "^11.0.0",
|
|
14
12
|
},
|
|
15
13
|
"devDependencies": {
|
|
@@ -22,10 +20,6 @@
|
|
|
22
20
|
|
|
23
21
|
"@clack/prompts": ["@clack/prompts@1.0.1", "", { "dependencies": { "@clack/core": "1.0.1", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-/42G73JkuYdyWZ6m8d/CJtBrGl1Hegyc7Fy78m5Ob+jF85TOUmLR5XLce/U3LxYAw0kJ8CT5aI99RIvPHcGp/Q=="],
|
|
24
22
|
|
|
25
|
-
"@inquirer/external-editor": ["@inquirer/external-editor@1.0.3", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="],
|
|
26
|
-
|
|
27
|
-
"@inquirer/figures": ["@inquirer/figures@1.0.15", "", {}, "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g=="],
|
|
28
|
-
|
|
29
23
|
"@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="],
|
|
30
24
|
|
|
31
25
|
"@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],
|
|
@@ -34,78 +28,32 @@
|
|
|
34
28
|
|
|
35
29
|
"@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="],
|
|
36
30
|
|
|
37
|
-
"ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
|
|
38
|
-
|
|
39
|
-
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
40
|
-
|
|
41
|
-
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
|
42
|
-
|
|
43
|
-
"base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
|
|
44
|
-
|
|
45
|
-
"bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
|
|
46
|
-
|
|
47
|
-
"buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
|
48
|
-
|
|
49
31
|
"bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
|
|
50
32
|
|
|
51
33
|
"bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="],
|
|
52
34
|
|
|
53
|
-
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
54
|
-
|
|
55
|
-
"chardet": ["chardet@2.1.1", "", {}, "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ=="],
|
|
56
|
-
|
|
57
|
-
"cli-cursor": ["cli-cursor@3.1.0", "", { "dependencies": { "restore-cursor": "^3.1.0" } }, "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw=="],
|
|
58
|
-
|
|
59
|
-
"cli-spinners": ["cli-spinners@2.9.2", "", {}, "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg=="],
|
|
60
|
-
|
|
61
|
-
"cli-width": ["cli-width@4.1.0", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="],
|
|
62
|
-
|
|
63
|
-
"clone": ["clone@1.0.4", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="],
|
|
64
|
-
|
|
65
|
-
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
|
66
|
-
|
|
67
|
-
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
|
68
|
-
|
|
69
35
|
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
|
|
70
36
|
|
|
71
37
|
"default-browser": ["default-browser@5.5.0", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw=="],
|
|
72
38
|
|
|
73
39
|
"default-browser-id": ["default-browser-id@5.0.1", "", {}, "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q=="],
|
|
74
40
|
|
|
75
|
-
"defaults": ["defaults@1.0.4", "", { "dependencies": { "clone": "^1.0.2" } }, "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A=="],
|
|
76
|
-
|
|
77
41
|
"define-lazy-prop": ["define-lazy-prop@3.0.0", "", {}, "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="],
|
|
78
42
|
|
|
79
|
-
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
80
|
-
|
|
81
43
|
"execa": ["execa@9.6.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="],
|
|
82
44
|
|
|
83
45
|
"figures": ["figures@6.1.0", "", { "dependencies": { "is-unicode-supported": "^2.0.0" } }, "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg=="],
|
|
84
46
|
|
|
85
47
|
"get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="],
|
|
86
48
|
|
|
87
|
-
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
|
|
88
|
-
|
|
89
49
|
"human-signals": ["human-signals@8.0.1", "", {}, "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ=="],
|
|
90
50
|
|
|
91
|
-
"iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
|
|
92
|
-
|
|
93
|
-
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
|
|
94
|
-
|
|
95
|
-
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
|
96
|
-
|
|
97
|
-
"inquirer": ["inquirer@9.3.8", "", { "dependencies": { "@inquirer/external-editor": "^1.0.2", "@inquirer/figures": "^1.0.3", "ansi-escapes": "^4.3.2", "cli-width": "^4.1.0", "mute-stream": "1.0.0", "ora": "^5.4.1", "run-async": "^3.0.0", "rxjs": "^7.8.1", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "wrap-ansi": "^6.2.0", "yoctocolors-cjs": "^2.1.2" } }, "sha512-pFGGdaHrmRKMh4WoDDSowddgjT1Vkl90atobmTeSmcPGdYiwikch/m/Ef5wRaiamHejtw0cUUMMerzDUXCci2w=="],
|
|
98
|
-
|
|
99
51
|
"is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="],
|
|
100
52
|
|
|
101
|
-
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
|
102
|
-
|
|
103
53
|
"is-in-ssh": ["is-in-ssh@1.0.0", "", {}, "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw=="],
|
|
104
54
|
|
|
105
55
|
"is-inside-container": ["is-inside-container@1.0.0", "", { "dependencies": { "is-docker": "^3.0.0" }, "bin": { "is-inside-container": "cli.js" } }, "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA=="],
|
|
106
56
|
|
|
107
|
-
"is-interactive": ["is-interactive@1.0.0", "", {}, "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="],
|
|
108
|
-
|
|
109
57
|
"is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="],
|
|
110
58
|
|
|
111
59
|
"is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="],
|
|
@@ -116,20 +64,10 @@
|
|
|
116
64
|
|
|
117
65
|
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
|
118
66
|
|
|
119
|
-
"log-symbols": ["log-symbols@4.1.0", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="],
|
|
120
|
-
|
|
121
|
-
"mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
|
|
122
|
-
|
|
123
|
-
"mute-stream": ["mute-stream@1.0.0", "", {}, "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA=="],
|
|
124
|
-
|
|
125
67
|
"npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="],
|
|
126
68
|
|
|
127
|
-
"onetime": ["onetime@5.1.2", "", { "dependencies": { "mimic-fn": "^2.1.0" } }, "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg=="],
|
|
128
|
-
|
|
129
69
|
"open": ["open@11.0.0", "", { "dependencies": { "default-browser": "^5.4.0", "define-lazy-prop": "^3.0.0", "is-in-ssh": "^1.0.0", "is-inside-container": "^1.0.0", "powershell-utils": "^0.1.0", "wsl-utils": "^0.3.0" } }, "sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw=="],
|
|
130
70
|
|
|
131
|
-
"ora": ["ora@5.4.1", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="],
|
|
132
|
-
|
|
133
71
|
"parse-ms": ["parse-ms@4.0.0", "", {}, "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw=="],
|
|
134
72
|
|
|
135
73
|
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
|
|
@@ -140,20 +78,8 @@
|
|
|
140
78
|
|
|
141
79
|
"pretty-ms": ["pretty-ms@9.3.0", "", { "dependencies": { "parse-ms": "^4.0.0" } }, "sha512-gjVS5hOP+M3wMm5nmNOucbIrqudzs9v/57bWRHQWLYklXqoXKrVfYW2W9+glfGsqtPgpiz5WwyEEB+ksXIx3gQ=="],
|
|
142
80
|
|
|
143
|
-
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
|
144
|
-
|
|
145
|
-
"restore-cursor": ["restore-cursor@3.1.0", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="],
|
|
146
|
-
|
|
147
81
|
"run-applescript": ["run-applescript@7.1.0", "", {}, "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q=="],
|
|
148
82
|
|
|
149
|
-
"run-async": ["run-async@3.0.0", "", {}, "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q=="],
|
|
150
|
-
|
|
151
|
-
"rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="],
|
|
152
|
-
|
|
153
|
-
"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
|
154
|
-
|
|
155
|
-
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
|
156
|
-
|
|
157
83
|
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
|
|
158
84
|
|
|
159
85
|
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
|
|
@@ -162,50 +88,20 @@
|
|
|
162
88
|
|
|
163
89
|
"sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
|
|
164
90
|
|
|
165
|
-
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
166
|
-
|
|
167
|
-
"string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],
|
|
168
|
-
|
|
169
|
-
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
170
|
-
|
|
171
91
|
"strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="],
|
|
172
92
|
|
|
173
|
-
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
|
174
|
-
|
|
175
|
-
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
|
176
|
-
|
|
177
|
-
"type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
|
|
178
|
-
|
|
179
93
|
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
|
|
180
94
|
|
|
181
95
|
"unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="],
|
|
182
96
|
|
|
183
|
-
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
|
184
|
-
|
|
185
|
-
"wcwidth": ["wcwidth@1.0.1", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="],
|
|
186
|
-
|
|
187
97
|
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
|
188
98
|
|
|
189
|
-
"wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
|
190
|
-
|
|
191
99
|
"wsl-utils": ["wsl-utils@0.3.1", "", { "dependencies": { "is-wsl": "^3.1.0", "powershell-utils": "^0.1.0" } }, "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg=="],
|
|
192
100
|
|
|
193
101
|
"yoctocolors": ["yoctocolors@2.1.2", "", {}, "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug=="],
|
|
194
102
|
|
|
195
|
-
"yoctocolors-cjs": ["yoctocolors-cjs@2.1.3", "", {}, "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw=="],
|
|
196
|
-
|
|
197
103
|
"@types/bun/bun-types": ["bun-types@1.3.9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="],
|
|
198
104
|
|
|
199
|
-
"log-symbols/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
|
200
|
-
|
|
201
|
-
"log-symbols/is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
|
|
202
|
-
|
|
203
105
|
"npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
|
|
204
|
-
|
|
205
|
-
"ora/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
|
206
|
-
|
|
207
|
-
"ora/is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
|
|
208
|
-
|
|
209
|
-
"restore-cursor/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
|
|
210
106
|
}
|
|
211
107
|
}
|
package/dist/index.js
CHANGED
|
@@ -7785,6 +7785,25 @@ class Vt extends x {
|
|
|
7785
7785
|
}
|
|
7786
7786
|
}
|
|
7787
7787
|
}
|
|
7788
|
+
|
|
7789
|
+
class kt extends x {
|
|
7790
|
+
get cursor() {
|
|
7791
|
+
return this.value ? 0 : 1;
|
|
7792
|
+
}
|
|
7793
|
+
get _value() {
|
|
7794
|
+
return this.cursor === 0;
|
|
7795
|
+
}
|
|
7796
|
+
constructor(e) {
|
|
7797
|
+
super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
|
|
7798
|
+
this.value = this._value;
|
|
7799
|
+
}), this.on("confirm", (s) => {
|
|
7800
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
7801
|
+
}), this.on("cursor", () => {
|
|
7802
|
+
this.value = !this.value;
|
|
7803
|
+
});
|
|
7804
|
+
}
|
|
7805
|
+
}
|
|
7806
|
+
|
|
7788
7807
|
class yt extends x {
|
|
7789
7808
|
options;
|
|
7790
7809
|
cursor = 0;
|
|
@@ -8232,6 +8251,33 @@ var X2 = (t) => {
|
|
|
8232
8251
|
B2.push(w);
|
|
8233
8252
|
return h2 && B2.push(g), B2;
|
|
8234
8253
|
};
|
|
8254
|
+
var Re = (t) => {
|
|
8255
|
+
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
8256
|
+
return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
|
|
8257
|
+
const i2 = t.withGuide ?? _.withGuide, a2 = `${i2 ? `${import_picocolors2.default.gray(d)}
|
|
8258
|
+
` : ""}${W2(this.state)} ${t.message}
|
|
8259
|
+
`, o2 = this.value ? r : s;
|
|
8260
|
+
switch (this.state) {
|
|
8261
|
+
case "submit": {
|
|
8262
|
+
const u2 = i2 ? `${import_picocolors2.default.gray(d)} ` : "";
|
|
8263
|
+
return `${a2}${u2}${import_picocolors2.default.dim(o2)}`;
|
|
8264
|
+
}
|
|
8265
|
+
case "cancel": {
|
|
8266
|
+
const u2 = i2 ? `${import_picocolors2.default.gray(d)} ` : "";
|
|
8267
|
+
return `${a2}${u2}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o2))}${i2 ? `
|
|
8268
|
+
${import_picocolors2.default.gray(d)}` : ""}`;
|
|
8269
|
+
}
|
|
8270
|
+
default: {
|
|
8271
|
+
const u2 = i2 ? `${import_picocolors2.default.cyan(d)} ` : "", l = i2 ? import_picocolors2.default.cyan(x2) : "";
|
|
8272
|
+
return `${a2}${u2}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i2 ? `
|
|
8273
|
+
${import_picocolors2.default.cyan(d)} ` : `
|
|
8274
|
+
` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
|
|
8275
|
+
${l}
|
|
8276
|
+
`;
|
|
8277
|
+
}
|
|
8278
|
+
}
|
|
8279
|
+
} }).prompt();
|
|
8280
|
+
};
|
|
8235
8281
|
var R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i2 = process.stdout, spacing: a2 = 1, withGuide: o2 } = {}) => {
|
|
8236
8282
|
const u2 = [], l = o2 ?? _.withGuide, n2 = l ? s : "", c3 = l ? `${r} ` : "", g = l ? `${s} ` : "";
|
|
8237
8283
|
for (let p = 0;p < a2; p++)
|
|
@@ -9125,12 +9171,57 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
9125
9171
|
var open_default = open;
|
|
9126
9172
|
|
|
9127
9173
|
// src/index.ts
|
|
9128
|
-
import { writeFile
|
|
9174
|
+
import { writeFile as writeFile2, unlink } from "fs/promises";
|
|
9129
9175
|
import path7 from "path";
|
|
9130
9176
|
import http from "http";
|
|
9131
9177
|
|
|
9178
|
+
// src/lib/save-credentials.ts
|
|
9179
|
+
import { writeFile, readFile, access } from "fs/promises";
|
|
9180
|
+
async function saveCredentials(clientId, clientSecret, provider, saveOption) {
|
|
9181
|
+
const envKeyId = `${provider.toUpperCase()}_CLIENT_ID`;
|
|
9182
|
+
const envKeySecret = `${provider.toUpperCase()}_CLIENT_SECRET`;
|
|
9183
|
+
const newEnvContent = `${envKeyId}=${clientId}
|
|
9184
|
+
${envKeySecret}=${clientSecret}`;
|
|
9185
|
+
if (saveOption === "print") {
|
|
9186
|
+
R2.message(newEnvContent);
|
|
9187
|
+
R2.success("Credentials printed to console");
|
|
9188
|
+
return;
|
|
9189
|
+
}
|
|
9190
|
+
if (saveOption === "json") {
|
|
9191
|
+
const jsonContent = JSON.stringify({ clientId, clientSecret }, null, 2);
|
|
9192
|
+
const jsonPath = `${provider}-credentials.json`;
|
|
9193
|
+
await writeFile(jsonPath, jsonContent);
|
|
9194
|
+
R2.success(`Credentials saved to ${jsonPath}`);
|
|
9195
|
+
return;
|
|
9196
|
+
}
|
|
9197
|
+
const envPath = saveOption === "dot-env" ? ".env" : ".env.local";
|
|
9198
|
+
try {
|
|
9199
|
+
await access(envPath);
|
|
9200
|
+
const shouldAppend = await Re({
|
|
9201
|
+
message: `${envPath} already exists. Append credentials?`,
|
|
9202
|
+
initialValue: true
|
|
9203
|
+
});
|
|
9204
|
+
if (Ct(shouldAppend) || !shouldAppend) {
|
|
9205
|
+
R2.warn("Credentials not saved.");
|
|
9206
|
+
return;
|
|
9207
|
+
}
|
|
9208
|
+
const existingContent = await readFile(envPath, "utf-8");
|
|
9209
|
+
await writeFile(envPath, existingContent + `
|
|
9210
|
+
` + newEnvContent);
|
|
9211
|
+
} catch {
|
|
9212
|
+
await writeFile(envPath, newEnvContent);
|
|
9213
|
+
}
|
|
9214
|
+
R2.success(`Credentials saved to ${envPath}`);
|
|
9215
|
+
}
|
|
9216
|
+
|
|
9217
|
+
// src/index.ts
|
|
9218
|
+
var globalConfig = {
|
|
9219
|
+
quiet: false,
|
|
9220
|
+
noOpen: false
|
|
9221
|
+
};
|
|
9222
|
+
|
|
9132
9223
|
class GoogleAuthProvider {
|
|
9133
|
-
async run(
|
|
9224
|
+
async run(_appName) {
|
|
9134
9225
|
try {
|
|
9135
9226
|
const googleLoading = bt2();
|
|
9136
9227
|
googleLoading.start("Fetching google cloud projects");
|
|
@@ -9166,7 +9257,9 @@ class GoogleAuthProvider {
|
|
|
9166
9257
|
const brandUrl = `https://console.cloud.google.com/apis/credentials/consent?project=${projectId}`;
|
|
9167
9258
|
R2.message(`Google requires manual setup for personal projects.
|
|
9168
9259
|
Opening: ${brandUrl}`);
|
|
9169
|
-
|
|
9260
|
+
if (!globalConfig.noOpen) {
|
|
9261
|
+
await open_default(brandUrl);
|
|
9262
|
+
}
|
|
9170
9263
|
Ve(`1. Choose 'External'
|
|
9171
9264
|
2. Fill App Name & Email
|
|
9172
9265
|
3. Click 'Save and Continue' through to the end.`, "Action Required");
|
|
@@ -9178,7 +9271,9 @@ Opening: ${brandUrl}`);
|
|
|
9178
9271
|
R2.step("Step 2: Create OAuth Client ID");
|
|
9179
9272
|
const clientUrl = `https://console.cloud.google.com/apis/credentials/oauthclient?project=${projectId}`;
|
|
9180
9273
|
R2.message(`Opening: ${clientUrl}`);
|
|
9181
|
-
|
|
9274
|
+
if (!globalConfig.noOpen) {
|
|
9275
|
+
await open_default(clientUrl);
|
|
9276
|
+
}
|
|
9182
9277
|
Ve(`1. Select 'Web Application'
|
|
9183
9278
|
2. Add your Redirect URIs
|
|
9184
9279
|
3. Click 'Create'`, "Action Required");
|
|
@@ -9194,7 +9289,7 @@ Opening: ${brandUrl}`);
|
|
|
9194
9289
|
});
|
|
9195
9290
|
if (Ct(clientSecret))
|
|
9196
9291
|
return Ne("Setup aborted.");
|
|
9197
|
-
R2.step("Step 3: Save credentials
|
|
9292
|
+
R2.step("Step 3: Save credentials");
|
|
9198
9293
|
const saveOption = await Je({
|
|
9199
9294
|
message: "Where do you want to save the credentials?",
|
|
9200
9295
|
options: [
|
|
@@ -9216,17 +9311,9 @@ Opening: ${brandUrl}`);
|
|
|
9216
9311
|
}
|
|
9217
9312
|
]
|
|
9218
9313
|
});
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
try {
|
|
9223
|
-
await access(envPath);
|
|
9224
|
-
const existingContent = await readFile(envPath, "utf-8");
|
|
9225
|
-
await writeFile(envPath, existingContent + `
|
|
9226
|
-
` + newEnvContent);
|
|
9227
|
-
} catch {
|
|
9228
|
-
await writeFile(envPath, newEnvContent);
|
|
9229
|
-
}
|
|
9314
|
+
if (Ct(saveOption))
|
|
9315
|
+
return Ne("Setup aborted.");
|
|
9316
|
+
await saveCredentials(clientId, clientSecret, "google", saveOption);
|
|
9230
9317
|
} catch (err) {
|
|
9231
9318
|
R2.error(`Setup Failed: ${err.message}`);
|
|
9232
9319
|
process.exit(1);
|
|
@@ -9237,8 +9324,13 @@ GOOGLE_CLIENT_SECRET=${clientSecret}`;
|
|
|
9237
9324
|
s.start("Verifying Client ID with Google...");
|
|
9238
9325
|
try {
|
|
9239
9326
|
const res = await fetch(`https://oauth2.googleapis.com/tokeninfo?client_id=${clientId}`);
|
|
9240
|
-
|
|
9241
|
-
|
|
9327
|
+
const isValid = res.status === 200;
|
|
9328
|
+
if (isValid) {
|
|
9329
|
+
s.stop("Client ID verified.");
|
|
9330
|
+
} else {
|
|
9331
|
+
s.stop("Invalid Client ID.");
|
|
9332
|
+
}
|
|
9333
|
+
return isValid;
|
|
9242
9334
|
} catch {
|
|
9243
9335
|
s.stop("Validation service unreachable.");
|
|
9244
9336
|
return false;
|
|
@@ -9246,176 +9338,206 @@ GOOGLE_CLIENT_SECRET=${clientSecret}`;
|
|
|
9246
9338
|
}
|
|
9247
9339
|
}
|
|
9248
9340
|
|
|
9341
|
+
class GitHubAuthProvider {
|
|
9342
|
+
async run(callbackUrl) {
|
|
9343
|
+
try {
|
|
9344
|
+
const appType = await Je({
|
|
9345
|
+
message: "What type of GitHub app you want to create?",
|
|
9346
|
+
options: [
|
|
9347
|
+
{
|
|
9348
|
+
value: "gh-app",
|
|
9349
|
+
label: "GitHub App (One click setup)"
|
|
9350
|
+
},
|
|
9351
|
+
{
|
|
9352
|
+
value: "oauth-app",
|
|
9353
|
+
label: "OAuth App (You need to fill a form for this)"
|
|
9354
|
+
}
|
|
9355
|
+
]
|
|
9356
|
+
});
|
|
9357
|
+
if (Ct(appType))
|
|
9358
|
+
return Ne("Setup aborted.");
|
|
9359
|
+
if (appType === "gh-app") {
|
|
9360
|
+
await this.setupGitHubApp(callbackUrl);
|
|
9361
|
+
} else if (appType === "oauth-app") {
|
|
9362
|
+
await this.setupOAuthApp(callbackUrl);
|
|
9363
|
+
}
|
|
9364
|
+
} catch (err) {
|
|
9365
|
+
R2.error(`Setup Failed: ${err.message}`);
|
|
9366
|
+
process.exit(1);
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
async setupGitHubApp(callbackUrl) {
|
|
9370
|
+
const saveOption = await this.askSaveOption();
|
|
9371
|
+
if (Ct(saveOption))
|
|
9372
|
+
return Ne("Setup aborted.");
|
|
9373
|
+
const PORT = 3001;
|
|
9374
|
+
const REDIRECT_URI = `http://localhost:${PORT}/callback`;
|
|
9375
|
+
const manifest = {
|
|
9376
|
+
name: "oauth-init-app",
|
|
9377
|
+
url: "http://localhost:3000",
|
|
9378
|
+
callback_url: callbackUrl,
|
|
9379
|
+
public: false,
|
|
9380
|
+
default_permissions: {
|
|
9381
|
+
contents: "read",
|
|
9382
|
+
metadata: "read"
|
|
9383
|
+
},
|
|
9384
|
+
redirect_url: REDIRECT_URI
|
|
9385
|
+
};
|
|
9386
|
+
const htmlContent = `
|
|
9387
|
+
<html>
|
|
9388
|
+
<body>
|
|
9389
|
+
<form id="gh-form" action="https://github.com/settings/apps/new" method="post">
|
|
9390
|
+
<input type="hidden" name="manifest" value='${JSON.stringify(manifest)}'>
|
|
9391
|
+
</form>
|
|
9392
|
+
<script>document.getElementById("gh-form").submit();</script>
|
|
9393
|
+
</body>
|
|
9394
|
+
</html>
|
|
9395
|
+
`;
|
|
9396
|
+
const tempPath = path7.join(process.cwd(), "github-setup.html");
|
|
9397
|
+
await writeFile2(tempPath, htmlContent);
|
|
9398
|
+
R2.step("GitHub App Configuration");
|
|
9399
|
+
R2.message("Opening GitHub with your manifest...");
|
|
9400
|
+
if (!globalConfig.noOpen) {
|
|
9401
|
+
await open_default(tempPath);
|
|
9402
|
+
}
|
|
9403
|
+
return new Promise((resolve) => {
|
|
9404
|
+
const server = http.createServer(async (req, res) => {
|
|
9405
|
+
const url = new URL(req.url, `http://localhost:${PORT}`);
|
|
9406
|
+
const code = url.searchParams.get("code");
|
|
9407
|
+
if (code) {
|
|
9408
|
+
res.end("<h1>Success!</h1><p>You can close this tab and return to the CLI.</p>");
|
|
9409
|
+
const s = bt2();
|
|
9410
|
+
s.start("Exchanging code for secrets...");
|
|
9411
|
+
try {
|
|
9412
|
+
const { stdout } = await execa("curl", [
|
|
9413
|
+
"-X",
|
|
9414
|
+
"POST",
|
|
9415
|
+
`https://api.github.com/app-manifests/${code}/conversions`
|
|
9416
|
+
]);
|
|
9417
|
+
const credentials = JSON.parse(stdout);
|
|
9418
|
+
const { client_id, client_secret } = credentials;
|
|
9419
|
+
s.stop("Credentials received!");
|
|
9420
|
+
await unlink(tempPath);
|
|
9421
|
+
await saveCredentials(client_id, client_secret, "github", saveOption);
|
|
9422
|
+
server.close();
|
|
9423
|
+
resolve();
|
|
9424
|
+
} catch {
|
|
9425
|
+
s.error("Failed to convert manifest code.");
|
|
9426
|
+
server.close();
|
|
9427
|
+
resolve();
|
|
9428
|
+
}
|
|
9429
|
+
}
|
|
9430
|
+
}).listen(PORT);
|
|
9431
|
+
});
|
|
9432
|
+
}
|
|
9433
|
+
async setupOAuthApp(callbackUrl) {
|
|
9434
|
+
R2.step("Step 1: Create OAuth App on GitHub");
|
|
9435
|
+
const oauthAppUrl = "https://github.com/settings/applications/new";
|
|
9436
|
+
R2.message(`Opening: ${oauthAppUrl}`);
|
|
9437
|
+
if (!globalConfig.noOpen) {
|
|
9438
|
+
await open_default(oauthAppUrl);
|
|
9439
|
+
}
|
|
9440
|
+
Ve(`1. Fill Application Name and Homepage URL
|
|
9441
|
+
2. Enter Authorization callback URL: ` + callbackUrl + `
|
|
9442
|
+
3. Click 'Register application'`, "Action Required");
|
|
9443
|
+
const brandDone = await Ze({
|
|
9444
|
+
message: "Press Enter once you've created the OAuth App (or type 'skip' if done previously)"
|
|
9445
|
+
});
|
|
9446
|
+
if (Ct(brandDone))
|
|
9447
|
+
return Ne("Setup aborted.");
|
|
9448
|
+
R2.step("Step 2: Save credentials");
|
|
9449
|
+
const clientId = await Ze({
|
|
9450
|
+
message: "Paste your Client ID:",
|
|
9451
|
+
placeholder: "Iv1.xxx"
|
|
9452
|
+
});
|
|
9453
|
+
if (Ct(clientId))
|
|
9454
|
+
return Ne("Setup aborted.");
|
|
9455
|
+
const clientSecret = await He({
|
|
9456
|
+
message: "Paste your Client Secret:"
|
|
9457
|
+
});
|
|
9458
|
+
if (Ct(clientSecret))
|
|
9459
|
+
return Ne("Setup aborted.");
|
|
9460
|
+
const saveOption = await this.askSaveOption();
|
|
9461
|
+
if (Ct(saveOption))
|
|
9462
|
+
return Ne("Setup aborted.");
|
|
9463
|
+
await saveCredentials(clientId, clientSecret, "github", saveOption);
|
|
9464
|
+
}
|
|
9465
|
+
async askSaveOption() {
|
|
9466
|
+
return Je({
|
|
9467
|
+
message: "Where do you want to save the credentials?",
|
|
9468
|
+
options: [
|
|
9469
|
+
{ label: ".env", value: "dot-env" },
|
|
9470
|
+
{ label: ".env.local", value: "dot-env-dot-local" },
|
|
9471
|
+
{ label: ".json", value: "json" },
|
|
9472
|
+
{ label: "print to the console", value: "print" }
|
|
9473
|
+
]
|
|
9474
|
+
});
|
|
9475
|
+
}
|
|
9476
|
+
}
|
|
9477
|
+
|
|
9249
9478
|
class Orchestrator {
|
|
9250
|
-
|
|
9251
|
-
constructor(
|
|
9252
|
-
this.
|
|
9479
|
+
projectName;
|
|
9480
|
+
constructor(projectName) {
|
|
9481
|
+
this.projectName = projectName;
|
|
9253
9482
|
}
|
|
9254
9483
|
async setupOAuthServices(oauthServices) {
|
|
9255
9484
|
for (const service of oauthServices) {
|
|
9256
9485
|
if (service === "google") {
|
|
9257
|
-
R2.step("Google
|
|
9486
|
+
R2.step("Google OAuth Setup");
|
|
9258
9487
|
const googleOauthCallback = await Ze({
|
|
9259
9488
|
message: "Enter the Google OAuth callback URL:",
|
|
9260
|
-
placeholder: "https://
|
|
9489
|
+
placeholder: "https://localhost:3000/oauth/callback/google",
|
|
9261
9490
|
defaultValue: `http://localhost:3000/oauth/callback/google`
|
|
9262
9491
|
});
|
|
9263
|
-
|
|
9492
|
+
if (Ct(googleOauthCallback)) {
|
|
9493
|
+
Ne("Setup aborted.");
|
|
9494
|
+
return;
|
|
9495
|
+
}
|
|
9496
|
+
const googleProvider = new GoogleAuthProvider;
|
|
9497
|
+
await googleProvider.run(googleOauthCallback);
|
|
9264
9498
|
} else if (service === "github") {
|
|
9265
|
-
R2.step("
|
|
9499
|
+
R2.step("GitHub OAuth Setup");
|
|
9266
9500
|
const githubOauthCallback = await Ze({
|
|
9267
|
-
message: "Enter the
|
|
9268
|
-
placeholder: "
|
|
9501
|
+
message: "Enter the GitHub OAuth callback URL:",
|
|
9502
|
+
placeholder: "http://localhost:3000/oauth/callback/github",
|
|
9269
9503
|
defaultValue: `http://localhost:3000/oauth/callback/github`
|
|
9270
9504
|
});
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
Le("OAuth setup completed! Thank you for using oauth-init client!");
|
|
9275
|
-
}
|
|
9276
|
-
async setupGoogleOAuth(callbackUrl) {
|
|
9277
|
-
const googleAuthProvider = new GoogleAuthProvider;
|
|
9278
|
-
await googleAuthProvider.run(callbackUrl);
|
|
9279
|
-
}
|
|
9280
|
-
async setupGithubOAuth(callbackUrl) {
|
|
9281
|
-
const appType = await Je({
|
|
9282
|
-
message: "What type of github app you want to create?",
|
|
9283
|
-
options: [
|
|
9284
|
-
{
|
|
9285
|
-
value: "gh-app",
|
|
9286
|
-
label: "Github App (One click setup)"
|
|
9287
|
-
},
|
|
9288
|
-
{
|
|
9289
|
-
value: "oauth-app",
|
|
9290
|
-
label: "OAuth App (You need to fill a form for this)"
|
|
9505
|
+
if (Ct(githubOauthCallback)) {
|
|
9506
|
+
Ne("Setup aborted.");
|
|
9507
|
+
return;
|
|
9291
9508
|
}
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
if (appType === "gh-app") {
|
|
9295
|
-
const PORT = 3001;
|
|
9296
|
-
const REDIRECT_URI = `http://localhost:${PORT}/callback`;
|
|
9297
|
-
const manifest = {
|
|
9298
|
-
name: "superblogger",
|
|
9299
|
-
url: "http://localhost:3000",
|
|
9300
|
-
callback_url: callbackUrl,
|
|
9301
|
-
public: false,
|
|
9302
|
-
default_permissions: {
|
|
9303
|
-
contents: "read",
|
|
9304
|
-
metadata: "read"
|
|
9305
|
-
},
|
|
9306
|
-
redirect_url: REDIRECT_URI
|
|
9307
|
-
};
|
|
9308
|
-
const htmlContent = `
|
|
9309
|
-
<html>
|
|
9310
|
-
<body>
|
|
9311
|
-
<form id="gh-form" action="https://github.com/settings/apps/new" method="post">
|
|
9312
|
-
<input type="hidden" name="manifest" value='${JSON.stringify(manifest)}'>
|
|
9313
|
-
</form>
|
|
9314
|
-
<script>document.getElementById("gh-form").submit();</script>
|
|
9315
|
-
</body>
|
|
9316
|
-
</html>
|
|
9317
|
-
`;
|
|
9318
|
-
const tempPath = path7.join(process.cwd(), "github-setup.html");
|
|
9319
|
-
await writeFile(tempPath, htmlContent);
|
|
9320
|
-
R2.step("GitHub App Configuration");
|
|
9321
|
-
R2.message("Opening GitHub with your manifest...");
|
|
9322
|
-
await open_default(tempPath);
|
|
9323
|
-
return new Promise((resolve) => {
|
|
9324
|
-
const server = http.createServer(async (req, res) => {
|
|
9325
|
-
const url = new URL(req.url, `http://localhost:${PORT}`);
|
|
9326
|
-
const code = url.searchParams.get("code");
|
|
9327
|
-
if (code) {
|
|
9328
|
-
res.end("<h1>Success!</h1><p>You can close this tab and return to the CLI.</p>");
|
|
9329
|
-
const s = bt2();
|
|
9330
|
-
s.start("Exchanging code for secrets...");
|
|
9331
|
-
try {
|
|
9332
|
-
const { stdout } = await execa("curl", [
|
|
9333
|
-
"-X",
|
|
9334
|
-
"POST",
|
|
9335
|
-
`https://api.github.com/app-manifests/${code}/conversions`
|
|
9336
|
-
]);
|
|
9337
|
-
const credentials = JSON.parse(stdout);
|
|
9338
|
-
const { client_id, client_secret } = credentials;
|
|
9339
|
-
s.stop("Credentials received!");
|
|
9340
|
-
await unlink(tempPath);
|
|
9341
|
-
const newEnvContent = `GITHUB_CLIENT_ID=${client_id}
|
|
9342
|
-
GITHUB_CLIENT_SECRET=${client_secret}
|
|
9343
|
-
`;
|
|
9344
|
-
await writeFile(".env", newEnvContent, { flag: "a" });
|
|
9345
|
-
R2.success("GitHub credentials saved to .env");
|
|
9346
|
-
server.close();
|
|
9347
|
-
resolve();
|
|
9348
|
-
} catch (err) {
|
|
9349
|
-
s.error("Failed to convert manifest code.");
|
|
9350
|
-
server.close();
|
|
9351
|
-
resolve();
|
|
9352
|
-
}
|
|
9353
|
-
}
|
|
9354
|
-
}).listen(PORT);
|
|
9355
|
-
});
|
|
9356
|
-
}
|
|
9357
|
-
if (appType === "oauth-app") {
|
|
9358
|
-
R2.step("Step 1: Create OAuth App on GitHub");
|
|
9359
|
-
const oauthAppUrl = "https://github.com/settings/applications/new";
|
|
9360
|
-
R2.message(`Opening: ${oauthAppUrl}`);
|
|
9361
|
-
await open_default(oauthAppUrl);
|
|
9362
|
-
Ve(`1. Fill Application Name and Homepage URL
|
|
9363
|
-
2. Enter Authorization callback URL: ` + callbackUrl + `
|
|
9364
|
-
3. Click 'Register application'`, "Action Required");
|
|
9365
|
-
const brandDone = await Ze({
|
|
9366
|
-
message: "Press Enter once you've created the OAuth App (or type 'skip' if done previously)"
|
|
9367
|
-
});
|
|
9368
|
-
if (Ct(brandDone))
|
|
9369
|
-
return Ne("Setup aborted.");
|
|
9370
|
-
R2.step("Step 2: Save credentials");
|
|
9371
|
-
const clientId = await Ze({
|
|
9372
|
-
message: "Paste your Client ID:",
|
|
9373
|
-
placeholder: "Iv1.xxx"
|
|
9374
|
-
});
|
|
9375
|
-
if (Ct(clientId))
|
|
9376
|
-
return Ne("Setup aborted.");
|
|
9377
|
-
const clientSecret = await He({
|
|
9378
|
-
message: "Paste your Client Secret:"
|
|
9379
|
-
});
|
|
9380
|
-
if (Ct(clientSecret))
|
|
9381
|
-
return Ne("Setup aborted.");
|
|
9382
|
-
const saveOption = await Je({
|
|
9383
|
-
message: "Where do you want to save the credentials?",
|
|
9384
|
-
options: [
|
|
9385
|
-
{
|
|
9386
|
-
label: ".env",
|
|
9387
|
-
value: "dot-env"
|
|
9388
|
-
},
|
|
9389
|
-
{
|
|
9390
|
-
label: ".env.local",
|
|
9391
|
-
value: "dot-env-dot-local"
|
|
9392
|
-
},
|
|
9393
|
-
{
|
|
9394
|
-
label: ".json",
|
|
9395
|
-
value: "json"
|
|
9396
|
-
},
|
|
9397
|
-
{
|
|
9398
|
-
label: "print to the console",
|
|
9399
|
-
value: "print"
|
|
9400
|
-
}
|
|
9401
|
-
]
|
|
9402
|
-
});
|
|
9403
|
-
const envPath = saveOption === "dot-env" ? ".env" : ".env.local";
|
|
9404
|
-
const newEnvContent = `GITHUB_CLIENT_ID=${clientId}
|
|
9405
|
-
GITHUB_CLIENT_SECRET=${clientSecret}`;
|
|
9406
|
-
try {
|
|
9407
|
-
await access(envPath);
|
|
9408
|
-
const existingContent = await readFile(envPath, "utf-8");
|
|
9409
|
-
await writeFile(envPath, existingContent + `
|
|
9410
|
-
` + newEnvContent);
|
|
9411
|
-
} catch {
|
|
9412
|
-
await writeFile(envPath, newEnvContent);
|
|
9509
|
+
const githubProvider = new GitHubAuthProvider;
|
|
9510
|
+
await githubProvider.run(githubOauthCallback);
|
|
9413
9511
|
}
|
|
9414
|
-
R2.success("GitHub OAuth App credentials saved!");
|
|
9415
9512
|
}
|
|
9513
|
+
Le("OAuth setup completed! Thank you for using oauth-init client!");
|
|
9416
9514
|
}
|
|
9417
9515
|
}
|
|
9418
9516
|
async function main() {
|
|
9517
|
+
const args = process.argv.slice(2);
|
|
9518
|
+
const flags = {
|
|
9519
|
+
help: args.includes("--help") || args.includes("-h"),
|
|
9520
|
+
quiet: args.includes("--quiet") || args.includes("-q"),
|
|
9521
|
+
noOpen: args.includes("--no-open") || args.includes("-n")
|
|
9522
|
+
};
|
|
9523
|
+
if (flags.help) {
|
|
9524
|
+
console.log(`
|
|
9525
|
+
Usage: oauth-init [options]
|
|
9526
|
+
|
|
9527
|
+
Options:
|
|
9528
|
+
-h, --help Show this help message
|
|
9529
|
+
-q, --quiet Reduce output verbosity
|
|
9530
|
+
-n, --no-open Don't open browser URLs automatically
|
|
9531
|
+
|
|
9532
|
+
Examples:
|
|
9533
|
+
oauth-init # Run interactive setup
|
|
9534
|
+
oauth-init --quiet # Run with minimal output
|
|
9535
|
+
oauth-init --no-open # Get URLs but don't open them
|
|
9536
|
+
`);
|
|
9537
|
+
process.exit(0);
|
|
9538
|
+
}
|
|
9539
|
+
globalConfig.quiet = flags.quiet;
|
|
9540
|
+
globalConfig.noOpen = flags.noOpen;
|
|
9419
9541
|
const projectDirectoryName = path7.basename(process.cwd());
|
|
9420
9542
|
We(`
|
|
9421
9543
|
▗▄▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖ ▗▄▄▄▖▗▖ ▗▖▗▄▄▄▖▗▄▄▄▖
|
|
@@ -9442,9 +9564,12 @@ async function main() {
|
|
|
9442
9564
|
Ne("Operation cancelled.");
|
|
9443
9565
|
process.exit(0);
|
|
9444
9566
|
}
|
|
9445
|
-
const orchestrator = new Orchestrator(projectName)
|
|
9567
|
+
const orchestrator = new Orchestrator(projectName);
|
|
9568
|
+
await orchestrator.setupOAuthServices(oauthToSetup);
|
|
9569
|
+
process.exit(0);
|
|
9446
9570
|
}
|
|
9447
9571
|
main();
|
|
9448
9572
|
export {
|
|
9449
|
-
GoogleAuthProvider
|
|
9573
|
+
GoogleAuthProvider,
|
|
9574
|
+
GitHubAuthProvider
|
|
9450
9575
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oauth-init",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "CLI for setting up OAuth providers for your project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@clack/prompts": "^1.0.1",
|
|
18
18
|
"@types/bun": "^1.3.9",
|
|
19
|
-
"chalk": "^5.3.0",
|
|
20
19
|
"execa": "^9.6.1",
|
|
21
|
-
"inquirer": "^9.2.12",
|
|
22
20
|
"open": "^11.0.0"
|
|
23
21
|
},
|
|
24
22
|
"devDependencies": {
|