oauth-init 0.8.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.
@@ -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
- To install dependencies:
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 install
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
- To run:
27
+ ## Usage
10
28
 
11
29
  ```bash
12
- bun run src/cli.ts
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
- This project was created using `bun init` in bun v1.3.9. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
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
@@ -9219,10 +9219,49 @@ var globalConfig = {
9219
9219
  quiet: false,
9220
9220
  noOpen: false
9221
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
+ }
9222
9256
 
9223
9257
  class GoogleAuthProvider {
9224
9258
  async run(_appName) {
9225
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
+ }
9226
9265
  const googleLoading = bt2();
9227
9266
  googleLoading.start("Fetching google cloud projects");
9228
9267
  const { stdout: currentProject } = await execa("gcloud", [
@@ -9370,7 +9409,7 @@ class GitHubAuthProvider {
9370
9409
  const saveOption = await this.askSaveOption();
9371
9410
  if (Ct(saveOption))
9372
9411
  return Ne("Setup aborted.");
9373
- const PORT = 3001;
9412
+ const PORT = 3004;
9374
9413
  const REDIRECT_URI = `http://localhost:${PORT}/callback`;
9375
9414
  const manifest = {
9376
9415
  name: "oauth-init-app",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth-init",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "CLI for setting up OAuth providers for your project",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "skills": {
4
+ "crafting-effective-readmes": {
5
+ "source": "softaworks/agent-toolkit",
6
+ "sourceType": "github",
7
+ "computedHash": "c931a8c22160e8925400778fcb2266b5d1df762f3052edba65f72479f79f2d6c"
8
+ }
9
+ }
10
+ }