oauth-init 0.7.0 → 0.9.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/.agents/skills/crafting-effective-readmes/README.md +180 -0
- package/.agents/skills/crafting-effective-readmes/SKILL.md +78 -0
- package/.agents/skills/crafting-effective-readmes/references/art-of-readme.md +536 -0
- package/.agents/skills/crafting-effective-readmes/references/make-a-readme.md +119 -0
- package/.agents/skills/crafting-effective-readmes/references/standard-readme-example-maximal.md +68 -0
- package/.agents/skills/crafting-effective-readmes/references/standard-readme-example-minimal.md +21 -0
- package/.agents/skills/crafting-effective-readmes/references/standard-readme-spec.md +242 -0
- package/.agents/skills/crafting-effective-readmes/section-checklist.md +17 -0
- package/.agents/skills/crafting-effective-readmes/style-guide.md +13 -0
- package/.agents/skills/crafting-effective-readmes/templates/internal.md +106 -0
- package/.agents/skills/crafting-effective-readmes/templates/oss.md +77 -0
- package/.agents/skills/crafting-effective-readmes/templates/personal.md +51 -0
- package/.agents/skills/crafting-effective-readmes/templates/xdg-config.md +71 -0
- package/.agents/skills/crafting-effective-readmes/using-references.md +35 -0
- package/README.md +61 -5
- package/dist/index.js +53 -9
- package/package.json +1 -1
- package/skills-lock.json +10 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Using References
|
|
2
|
+
|
|
3
|
+
Templates are your primary tool for writing READMEs. References provide depth - use them to refine your understanding or handle edge cases.
|
|
4
|
+
|
|
5
|
+
**Tip:** Don't load all references at once. Pick the one most relevant to your situation.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### art-of-readme.md
|
|
10
|
+
`references/art-of-readme.md`
|
|
11
|
+
|
|
12
|
+
**Why:** The philosophy behind great READMEs - understanding how readers actually scan and evaluate projects
|
|
13
|
+
**What:** Cognitive funneling (broad → specific), brevity as a feature, README as the "one-stop shop" that keeps users out of source code
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### make-a-readme.md
|
|
18
|
+
`references/make-a-readme.md`
|
|
19
|
+
|
|
20
|
+
**Why:** Practical, section-by-section guidance for what to include
|
|
21
|
+
**What:** Walks through each common section (Name, Description, Installation, Usage, etc.) with concrete suggestions. Good reminder: "too long is better than too short"
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### standard-readme-spec.md
|
|
26
|
+
`references/standard-readme-spec.md`
|
|
27
|
+
|
|
28
|
+
**Why:** Formal specification when consistency or compliance matters
|
|
29
|
+
**What:** Required vs optional sections, exact ordering, formatting rules. Useful for OSS projects wanting a standardized format.
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
- `references/standard-readme-example-minimal.md` - Bare minimum compliant README
|
|
33
|
+
- `references/standard-readme-example-maximal.md` - Full-featured with badges, ToC, all optional sections
|
|
34
|
+
|
|
35
|
+
|
package/README.md
CHANGED
|
@@ -1,15 +1,71 @@
|
|
|
1
1
|
# oauth-init
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Interactive CLI tool that guides you through setting up OAuth credentials for Google and GitHub.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
Setting up OAuth involves navigating multiple console pages, copying IDs, and managing credentials. This CLI walks you through the entire process interactively - fetching your Google Cloud projects, opening the right console pages, validating your inputs, and saving credentials wherever you need them.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Google OAuth** - Fetches your GCP projects, opens consent screen and credentials pages, captures client ID/secret
|
|
12
|
+
- **GitHub OAuth Apps** - One-click GitHub App manifest or manual OAuth App setup
|
|
13
|
+
- **Smart defaults** - Remembers your current gcloud project, suggests callback URLs
|
|
14
|
+
- **Flexible output** - Save to `.env`, `.env.local`, `.json`, or just print to console
|
|
15
|
+
- **Non-interactive mode** - `--no-open` flag for CI/automated environments
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
4
18
|
|
|
5
19
|
```bash
|
|
6
|
-
bun
|
|
20
|
+
# Using bun (recommended)
|
|
21
|
+
bun install -g oauth-init
|
|
22
|
+
|
|
23
|
+
# Using npm
|
|
24
|
+
npm install -g oauth-init
|
|
7
25
|
```
|
|
8
26
|
|
|
9
|
-
|
|
27
|
+
## Usage
|
|
10
28
|
|
|
11
29
|
```bash
|
|
12
|
-
|
|
30
|
+
# Run interactive setup
|
|
31
|
+
oauth-init
|
|
32
|
+
|
|
33
|
+
# Run without opening browser pages
|
|
34
|
+
oauth-init --no-open
|
|
35
|
+
|
|
36
|
+
# Minimal output
|
|
37
|
+
oauth-init --quiet
|
|
13
38
|
```
|
|
14
39
|
|
|
15
|
-
|
|
40
|
+
The CLI will:
|
|
41
|
+
1. Ask for your project name
|
|
42
|
+
2. Select which OAuth providers to configure
|
|
43
|
+
3. Guide you through each provider's setup flow
|
|
44
|
+
4. Save credentials to your chosen location
|
|
45
|
+
|
|
46
|
+
## Supported Providers
|
|
47
|
+
|
|
48
|
+
| Provider | Setup Type |
|
|
49
|
+
|----------|------------|
|
|
50
|
+
| Google | OAuth 2.0 (External) |
|
|
51
|
+
| GitHub | OAuth App, GitHub App |
|
|
52
|
+
|
|
53
|
+
## Tech Stack
|
|
54
|
+
|
|
55
|
+
- **Runtime**: Bun
|
|
56
|
+
- **CLI UI**: @clack/prompts
|
|
57
|
+
- **Shell**: execa
|
|
58
|
+
- **Browser**: open
|
|
59
|
+
|
|
60
|
+
## How It Works
|
|
61
|
+
|
|
62
|
+
The CLI orchestrates the OAuth setup by:
|
|
63
|
+
|
|
64
|
+
1. **Discovery** - Uses `gcloud` CLI to fetch your Google Cloud projects
|
|
65
|
+
2. **Navigation** - Opens the correct Google Cloud Console and GitHub pages
|
|
66
|
+
3. **Capture** - Prompts for client ID and secret with validation
|
|
67
|
+
4. **Output** - Writes credentials to the chosen format
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -9171,13 +9171,12 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
9171
9171
|
var open_default = open;
|
|
9172
9172
|
|
|
9173
9173
|
// src/index.ts
|
|
9174
|
-
import { writeFile
|
|
9174
|
+
import { writeFile as writeFile2, unlink } from "fs/promises";
|
|
9175
9175
|
import path7 from "path";
|
|
9176
9176
|
import http from "http";
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
};
|
|
9177
|
+
|
|
9178
|
+
// src/lib/save-credentials.ts
|
|
9179
|
+
import { writeFile, readFile, access } from "fs/promises";
|
|
9181
9180
|
async function saveCredentials(clientId, clientSecret, provider, saveOption) {
|
|
9182
9181
|
const envKeyId = `${provider.toUpperCase()}_CLIENT_ID`;
|
|
9183
9182
|
const envKeySecret = `${provider.toUpperCase()}_CLIENT_SECRET`;
|
|
@@ -9215,9 +9214,54 @@ ${envKeySecret}=${clientSecret}`;
|
|
|
9215
9214
|
R2.success(`Credentials saved to ${envPath}`);
|
|
9216
9215
|
}
|
|
9217
9216
|
|
|
9217
|
+
// src/index.ts
|
|
9218
|
+
var globalConfig = {
|
|
9219
|
+
quiet: false,
|
|
9220
|
+
noOpen: false
|
|
9221
|
+
};
|
|
9222
|
+
async function checkGcloudAuth() {
|
|
9223
|
+
const s = bt2();
|
|
9224
|
+
s.start("Checking gcloud CLI...");
|
|
9225
|
+
try {
|
|
9226
|
+
await execa("gcloud", ["version"]);
|
|
9227
|
+
} catch {
|
|
9228
|
+
s.stop("gcloud CLI not found.");
|
|
9229
|
+
R2.error(`gcloud CLI is required for Google OAuth setup.
|
|
9230
|
+
` + `Install it: https://cloud.google.com/sdk/docs/install
|
|
9231
|
+
` + "Then run: gcloud auth login");
|
|
9232
|
+
return false;
|
|
9233
|
+
}
|
|
9234
|
+
s.stop("gcloud CLI found.");
|
|
9235
|
+
const authSpinner = bt2();
|
|
9236
|
+
authSpinner.start("Checking gcloud authentication...");
|
|
9237
|
+
try {
|
|
9238
|
+
const { stdout } = await execa("gcloud", [
|
|
9239
|
+
"auth",
|
|
9240
|
+
"list",
|
|
9241
|
+
"--format=value(account)",
|
|
9242
|
+
"--filter=status:ACTIVE"
|
|
9243
|
+
]);
|
|
9244
|
+
if (!stdout.trim()) {
|
|
9245
|
+
authSpinner.stop("Not authenticated.");
|
|
9246
|
+
R2.error("Please run: gcloud auth login");
|
|
9247
|
+
return false;
|
|
9248
|
+
}
|
|
9249
|
+
authSpinner.stop(`Authenticated as: ${stdout.trim()}`);
|
|
9250
|
+
return true;
|
|
9251
|
+
} catch {
|
|
9252
|
+
authSpinner.stop("Authentication check failed.");
|
|
9253
|
+
return false;
|
|
9254
|
+
}
|
|
9255
|
+
}
|
|
9256
|
+
|
|
9218
9257
|
class GoogleAuthProvider {
|
|
9219
9258
|
async run(_appName) {
|
|
9220
9259
|
try {
|
|
9260
|
+
const isAuthenticated = await checkGcloudAuth();
|
|
9261
|
+
if (!isAuthenticated) {
|
|
9262
|
+
R2.error("Please install gcloud CLI and authenticate before continuing.");
|
|
9263
|
+
process.exit(1);
|
|
9264
|
+
}
|
|
9221
9265
|
const googleLoading = bt2();
|
|
9222
9266
|
googleLoading.start("Fetching google cloud projects");
|
|
9223
9267
|
const { stdout: currentProject } = await execa("gcloud", [
|
|
@@ -9365,7 +9409,7 @@ class GitHubAuthProvider {
|
|
|
9365
9409
|
const saveOption = await this.askSaveOption();
|
|
9366
9410
|
if (Ct(saveOption))
|
|
9367
9411
|
return Ne("Setup aborted.");
|
|
9368
|
-
const PORT =
|
|
9412
|
+
const PORT = 3004;
|
|
9369
9413
|
const REDIRECT_URI = `http://localhost:${PORT}/callback`;
|
|
9370
9414
|
const manifest = {
|
|
9371
9415
|
name: "oauth-init-app",
|
|
@@ -9389,7 +9433,7 @@ class GitHubAuthProvider {
|
|
|
9389
9433
|
</html>
|
|
9390
9434
|
`;
|
|
9391
9435
|
const tempPath = path7.join(process.cwd(), "github-setup.html");
|
|
9392
|
-
await
|
|
9436
|
+
await writeFile2(tempPath, htmlContent);
|
|
9393
9437
|
R2.step("GitHub App Configuration");
|
|
9394
9438
|
R2.message("Opening GitHub with your manifest...");
|
|
9395
9439
|
if (!globalConfig.noOpen) {
|
|
@@ -9481,7 +9525,7 @@ class Orchestrator {
|
|
|
9481
9525
|
R2.step("Google OAuth Setup");
|
|
9482
9526
|
const googleOauthCallback = await Ze({
|
|
9483
9527
|
message: "Enter the Google OAuth callback URL:",
|
|
9484
|
-
placeholder: "https://
|
|
9528
|
+
placeholder: "https://localhost:3000/oauth/callback/google",
|
|
9485
9529
|
defaultValue: `http://localhost:3000/oauth/callback/google`
|
|
9486
9530
|
});
|
|
9487
9531
|
if (Ct(googleOauthCallback)) {
|
|
@@ -9494,7 +9538,7 @@ class Orchestrator {
|
|
|
9494
9538
|
R2.step("GitHub OAuth Setup");
|
|
9495
9539
|
const githubOauthCallback = await Ze({
|
|
9496
9540
|
message: "Enter the GitHub OAuth callback URL:",
|
|
9497
|
-
placeholder: "
|
|
9541
|
+
placeholder: "http://localhost:3000/oauth/callback/github",
|
|
9498
9542
|
defaultValue: `http://localhost:3000/oauth/callback/github`
|
|
9499
9543
|
});
|
|
9500
9544
|
if (Ct(githubOauthCallback)) {
|
package/package.json
CHANGED