Skip to content

fix(settings): scaffold settings.json template on first run (#202) - #275

Open
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/202-settings-scaffold
Open

fix(settings): scaffold settings.json template on first run (#202)#275
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/202-settings-scaffold

Conversation

@innocarpe

Copy link
Copy Markdown

Summary

  • On first run, Deep Code now creates ~/.deepcode/settings.json with a ready-to-edit template instead of failing with "API key not found" and forcing the user to author the file from scratch.

Why

A fresh install never scaffolds settings.json: the directory exists but the file does not, so the first prompt fails with API key not found. Please configure ~/.deepcode/settings.json — leaving users to guess the schema. This makes onboarding require only pasting their API key.

Changes

  • packages/core/src/settings.ts: add DEFAULT_SETTINGS_TEMPLATE and ensureUserSettingsFile() which creates the file on first run (never overwrites an existing one).
  • packages/core/src/index.ts: export ensureUserSettingsFile.
  • packages/cli/src/cli.tsx: call it at startup and print Created <path> — edit it to add your API key. when scaffolded.
  • packages/core/src/tests/settings-and-notify.test.ts: tests for scaffolding and no-overwrite behavior.

Validation

  • npm run typecheck
  • npm test — new settings tests pass ✅

Closes #202

)

Create ~/.deepcode/settings.json with a ready-to-edit template (empty API_KEY, default BASE_URL/MODEL) on first run so users only have to paste their key instead of authoring the file by hand. Never overwrites an existing file.

(cherry picked from commit b9eb1d79f6c07b8784a6d0caaeb3acc3b5d85188)
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.

Fresh install has no settings.json: first run fails with "API key not found" and forces manual file creation

1 participant