Repository navigation
Phase 9: Flip CLI default API URL to api.nemar.org - #352
Merged
Merged
Conversation
Source changes: - src/lib/api.ts, src/lib/config.ts, src/commands/auth.ts: DEFAULT_API_URL is now https://api.nemar.org. IS_DEV_BUILD detection (workers.dev substring) is unchanged and still flips for CI-injected dev builds. - src/lib/config.ts: new migrateApiUrl() runs on module load and silently rewrites stored apiUrl entries that match the legacy default. Custom URLs (workers.dev, self-hosted) are untouched. The legacy redirect on the personal Cloudflare worker keeps stale configs working through Phase 11. Test: - test/config-migrate-api-url.test.ts: real integration test against a temp config dir, covers legacy rewrite, idempotent rewrite of already-new URL, and pass-through of dev/custom URLs. - test/setup.ts default updated to api.nemar.org. CI: - .github/workflows/npm-publish.yml: dev-branch sed pattern updated to source from api.nemar.org and target nemar-api-dev.sccn-org.workers.dev (SCCN dev worker, not the personal one). Without this dev npm publishes would silently keep pointing at api.nemar.org. Docs: - scripts/generate-docs.ts: API reference base URL updated. Refs #330
- Export DEFAULT_API_URL from src/lib/config and use it in auth.ts (was: duplicate hardcoded literal). Eliminates drift risk on the next URL change. Build dedupes the literal too. - Add idempotency note on migrateApiUrl() per reviewer ask. - Test: cover account with no apiUrl field (legacy-flat migration result) to guard the optional-chaining guard. Refs #330
Contributor
Author
Review pass: addressedThree findings actioned in commit
Deferred per agent ratings ≤ 3:
Reviews:
|
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR352Version: 🤖 Updated on each push. |
This was referenced Apr 25, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEFAULT_API_URLinsrc/lib/api.ts,src/lib/config.ts,src/commands/auth.tsfromhttps://api.osc.earth/nemartohttps://api.nemar.orgmigrateApiUrl()tosrc/lib/config.ts: silently rewrites storedapiUrlentries on existing user configs that still point at the legacy URL. Untouched: workers.dev URLs, self-hosted custom URLs, anything that's not an exact matchnemar-api-dev.sccn-org.workers.dev)0.8.0-dev(release minor bump happens on dev branch after merge)This is Phase 9 of the SCCN migration epic (#314). The personal
api.osc.earth/nemarworker stays inMAINTENANCE_MODE=read-onlyas a buffer for users on older CLIs, until Phase 11 retires it.Why a migration shim
~/.config/nemar/config.jsonsnapshot the activeapiUrlon login (auth.ts:146); without the migration, users would keep hittingapi.osc.earth/nemareven after upgrading.Test plan
test/config-migrate-api-url.test.tsexercises legacy rewrite, idempotent rewrite, and pass-through cases against a real temp config dir (no mocks).bun test test/api.test.ts61/61 pass.bun run buildproduces adist/index.jscontaining 3api.nemar.orginstances + 1api.osc.earth/nemar(theLEGACY_DEFAULT_API_URLconstant for the migration check). Verified.IS_DEV_BUILDdetection still works: prod default has noworkers.devsubstring, dev-injected URL does.test/datalad-commands.test.ts > clone fails for non-existent datasetreproduces ondevbefore this PR — not a Phase 9 regression.0.8.0on dev branch via./scripts/bump-version.sh minor, then PRdev->mainfor the npm release.Sed pattern note
The CI dev-URL injection in
npm-publish.ymlliterallysed-replaces the prod URL string in the bundleddist/index.js. After this PR the source URL isapi.nemar.org; without updating the sed, dev npm publishes would silently keep pointing at the prod URL. Updated to source-fromapi.nemar.organd targetnemar-api-dev.sccn-org.workers.dev.Refs