Skip to content

Add optional setup wizard for first-run onboarding#1878

Draft
NatalieNobile wants to merge 1 commit into
box:mainfrom
NatalieNobile:feat/setup-wizard
Draft

Add optional setup wizard for first-run onboarding#1878
NatalieNobile wants to merge 1 commit into
box:mainfrom
NatalieNobile:feat/setup-wizard

Conversation

@NatalieNobile

Copy link
Copy Markdown

Summary

Adds an opt-in setup wizard (./scripts/setup) and read-only doctor (./scripts/doctor) under a new setup/ Python package. Streamlines first-time onboarding without modifying any SDK source files.

This PR is opened as a draft — the wizard is purely additive, but it's a UX decision whether the maintainers want it shipped here vs. as a separate companion repo. Happy to take it any direction.

What the wizard does (3-step picker)

  1. Java + Gradle preflight — verifies JDK 8+ and the Gradle wrapper.
  2. Auth credentials — inner picker for Developer Token / JWT / CCG / OAuth, then captures the right credentials and writes them to box-config.properties at the repo root.
  3. Smoke test snippet — prints a 4-line copy-pasteable Java program that authenticates and calls users.getUserMe(), keyed to the chosen auth mode.

The doctor re-runs each step's check function so users can audit "what's wired up?" without rerunning the wizard.

What this adds

Path What
setup/ Python package (5 modules, ~750 lines) — prompts.py, config.py, checks.py, wizard.py, doctor.py
scripts/setup, scripts/doctor Bash launchers (one-liners that exec the Python entrypoints)
box-config.properties.example Annotated template the wizard's output mirrors
WIZARD_FLOWS.md Decision-tree + step reference (Mermaid diagram)
.gitignore Adds box-config.properties, box-jwt-config.json, __pycache__/

What this does NOT touch

  • src/ — zero SDK source changes
  • build.gradle — no new Gradle tasks
  • README, CONTRIBUTING, docs/* — left alone

The wizard is fully opt-in. Existing flows continue to work; users who prefer the README's manual setup are unaffected.

Design principles

The patterns are distilled in setup-wizard-squared — paced output, picker-first, env injection, doctor-symmetry, idempotence, progress watchdog, self-containment. See that repo's reference/patterns.md for rationale.

Test plan

  • ./scripts/doctor reports 4 OK / 1 WARN / 0 FAIL on a fresh clone (the WARN being "no box-config.properties yet" — the wizard's job to fix).
  • ./scripts/setup walks the picker, accepts 1, 2, 3, 1-3, all, recommended, none, blank.
  • ./scripts/setup followed by step 2 → Developer Token → 64-char fake token → box-config.properties written.
  • ./scripts/doctor after the above reports 5 OK / 0 WARN / 0 FAIL.
  • Re-running ./scripts/setup and picking step 2 again surfaces "Existing auth mode: Developer Token. Re-collect / change auth mode?" — idempotent.
  • python3 -c "from setup import wizard, doctor" from repo root imports cleanly.
  • Round-trip with a real Developer Token + smoke snippet against a Box account (deferred — needs reviewer to mint a token).
  • Test on a fresh machine without the JDK installed — should [FAIL] with a clean install hint.

Open questions for reviewers

  1. Scope: Does this belong in the SDK repo, or as a separate box-java-sdk-onboarding companion?
  2. Python dependency: The wizard uses Python 3.10+ stdlib only (no extra packages). Is "Python on the user's machine" an acceptable wizard prerequisite for a Java SDK? If not, I can rewrite as a Gradle init plugin or shell-only.
  3. Smoke compile: I deliberately did NOT add a gradle smoke task — that's a maintainer decision. Happy to add one if wanted.
  4. JWT key handling: The wizard captures only the path to the JWT config JSON. It doesn't move the file or change permissions on it. Is that the right boundary?

Adds an opt-in `./scripts/setup` wizard and `./scripts/doctor` audit
under a new `setup/` Python package. The wizard streamlines first-time
onboarding without modifying any SDK source files.

What the wizard does (3-step picker):

1. Java + Gradle preflight — verifies JDK 8+ and the Gradle wrapper.
2. Auth credentials — inner picker for Developer Token / JWT / CCG /
   OAuth, then captures the right credentials and writes them to
   `box-config.properties` at the repo root.
3. Smoke test snippet — prints a 4-line copy-pasteable Java program
   that authenticates and calls `users.getUserMe()`, keyed to the
   chosen auth mode.

Doctor is read-only and re-runs each step's check function so users
can see what's wired up without rerunning the wizard.

What this adds:
- setup/                       — Python package (5 modules, ~750 lines)
- scripts/setup, scripts/doctor — bash launchers
- box-config.properties.example — annotated template
- WIZARD_FLOWS.md              — decision tree + step reference
- .gitignore: box-config.properties + box-jwt-config.json + __pycache__

What this does NOT touch:
- src/                         — no SDK source changes
- build.gradle                 — no Gradle task additions
- existing docs                — README, CONTRIBUTING, docs/* unchanged

The wizard is fully opt-in. Existing flows continue to work; users who
prefer the README's manual setup steps are unaffected.

Patterns used (paced output, picker-first, env injection,
doctor-symmetry, idempotence, progress watchdog, self-containment) are
distilled in setup-wizard-squared:
https://github.com/NatalieNobile/setup-wizard-squared

Tested locally: doctor reports 5 OK / 0 WARN / 0 FAIL after a complete
developer-token flow. Picker grammar (1,3 / 1-3 / all / recommended /
none / blank) all parse correctly. Wizard is idempotent — re-running
prompts to keep or change existing values.

Co-authored-by: Cursor <cursoragent@cursor.com>
NatalieNobile added a commit to NatalieNobile/setup-wizard-squared that referenced this pull request Jun 9, 2026
Drops the customized wizard files from the box-java-sdk fork into
examples/box-java-sdk/ as a reference for future agents applying the
scaffold to a new repo. Keeps the scaffold/ untouched.

Updates README.md and SKILL.md to:
- Link to the upstream draft PR (box/box-java-sdk#1878)
- Note that this example exercises every scaffold primitive except
  progress_watch (which the 3-step flow doesn't need)
- Recommend reading the example end-to-end before applying to a new
  repo

Files added:
- examples/box-java-sdk/setup/{prompts,config,checks,wizard,doctor,__init__}.py
- examples/box-java-sdk/scripts/{setup,doctor}
- examples/box-java-sdk/box-config.properties.example
- examples/box-java-sdk/WIZARD_FLOWS.md
- examples/box-java-sdk/README.md (with provenance + customization map)

Tested: scaffold + customizations import cleanly, doctor reports
5 OK / 0 WARN / 0 FAIL after a complete developer-token round-trip.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant