feat(config)!: default config files to YAML with ordered detection#337
feat(config)!: default config files to YAML with ordered detection#337wyattjoh wants to merge 7 commits into
Conversation
|
Stack: config-yaml Part of a stacked-prs chain. Do not merge manually. |
🦋 Changeset detectedLatest commit: 3324d9c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f40c0db to
34c41e9
Compare
📝 WalkthroughWalkthroughThe PR introduces YAML as the default output format for Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/cli-core/src/lib/config-file.test.ts (1)
2-11: Use Bun-native file writes in this test helper.The
makeClerkDirhelper useswriteFileSyncfromnode:fs; per the Bun guideline for TS/JS files, preferBun.write()instead. All call sites are already in async test functions, so converting the helper to async is compatible.♻️ Proposed refactor
-import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs"; +import { mkdtempSync, mkdirSync } from "node:fs"; @@ -function makeClerkDir(files: string[]): string { +async function makeClerkDir(files: string[]): Promise<string> { const dir = mkdtempSync(join(tmpdir(), "clerk-cfg-")); mkdirSync(join(dir, ".clerk"), { recursive: true }); - for (const f of files) writeFileSync(join(dir, f), "x"); + for (const f of files) await Bun.write(join(dir, f), "x"); return dir; } @@ - const dir = makeClerkDir([".clerk/config.yaml", ".clerk/config.json"]); + const dir = await makeClerkDir([".clerk/config.yaml", ".clerk/config.json"]); @@ - const dir = makeClerkDir([".clerk/config.json"]); + const dir = await makeClerkDir([".clerk/config.json"]); @@ - const dir = makeClerkDir([]); + const dir = await makeClerkDir([]);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli-core/src/lib/config-file.test.ts` around lines 2 - 11, The makeClerkDir helper function should use Bun-native file writing instead of node:fs. Convert the makeClerkDir function to async, replace the writeFileSync import and calls with Bun.write(), and update the loop to await the Bun.write() calls since they are asynchronous. Since all test call sites are already async, this change is compatible and aligns with Bun guidelines.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/cli-core/src/lib/config-file.test.ts`:
- Around line 2-11: The makeClerkDir helper function should use Bun-native file
writing instead of node:fs. Convert the makeClerkDir function to async, replace
the writeFileSync import and calls with Bun.write(), and update the loop to
await the Bun.write() calls since they are asynchronous. Since all test call
sites are already async, this change is compatible and aligns with Bun
guidelines.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 72a47eb3-d05b-49eb-8cbd-7258bdcba923
📒 Files selected for processing (11)
.changeset/config-yaml-default.mdpackages/cli-core/src/cli-program.tspackages/cli-core/src/commands/config/README.mdpackages/cli-core/src/commands/config/pull.test.tspackages/cli-core/src/commands/config/pull.tspackages/cli-core/src/commands/config/push.test.tspackages/cli-core/src/commands/config/push.tspackages/cli-core/src/lib/config-file.test.tspackages/cli-core/src/lib/config-file.tspackages/cli-core/src/test/integration/config-management.test.tspackages/cli-core/src/test/integration/input-json.test.ts
c48f7b1 to
3324d9c
Compare
|
!snapshot |
Snapshot publishednpm install -g clerk@2.0.1-snapshot.3324d9c
|
What & why
Makes YAML the default config format for
clerk config, with ordered filedetection. YAML is friendlier to hand-edit and review than JSON for
config-as-code.
config pulloutputs YAML by default (was JSON). Pass--jsonfor JSON;a
--outputpath ending in.jsonalso writes JSON.config patch/config putaccept YAML input (a superset of JSON, soexisting JSON files and
--json '{...}'keep working) and auto-detect aconfig file when none is given, in order:
.clerk/config.yaml→.clerk/config.yml→.clerk/config.json.No wire-format change — input is parsed to an object and the Platform API still
receives JSON. Uses the existing
yamldependency.Breaking
config pull's default output flips from JSON to YAML, soclerk config pull | jqand any agent/script assuming JSON will break.
Migration: add
--jsonto anyclerk config pullwhose output is consumed as JSON.Testing
format/lint/typecheck/testpass. Added coverage for the resolverprecedence, YAML input, default-file detection, and the
--json/extension outputrules; verified a pull → patch round-trip against a local instance.