Skip to content

refactor(projects): move projects.json and desktop.json to YAML - #285

Merged
edenreich merged 2 commits into
mainfrom
refactor/projects-desktop-yaml
Sep 18, 2026
Merged

edenreich merged 2 commits into
mainfrom
refactor/projects-desktop-yaml

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Resolves #283.

inference-gateway/cli#1239 records the ~/.infer/ file-format rule: files a human may open are YAML, only opaque caches and cursors stay JSON. projects.json and desktop.json were on the wrong side of it.

projects.yaml earns YAML twice over - people open it to work out why a chat landed in the wrong project, and the CLI carves it out of the agent sandbox (verified in the CLI's config/config.go: isWithinConfigSubdir(absPath, "plans", "projects.yaml")) precisely so the agent can edit it on the user's behalf.

Straight rename: no fallback read, no migration, no dual-format branch. Both files hold regenerable sidebar and app state, so carrying two formats would cost more than re-creating a layout once. serde_norway already backs the config.yaml reader, so this is a serializer swap rather than a new dependency.

Changes

  • projects.json -> projects.yaml across projects.rs, agent.rs and export.rs; desktop.json -> desktop.yaml in export.rs
  • The six hand-rolled read-parse-default / write-serialize copies of the projects file collapse onto one read_projects_in / write_projects_in pair in projects.rs, which every caller now goes through. export.rs nets -24 lines
  • A missing or unparseable file yields an empty mapping, so a fresh install rebuilds its state instead of erroring - the behaviour projects.rs already had (it returned Null, equivalent for every .get() caller) and what export.rs already did
  • read_projects / write_projects keep their JSON-text contract with the frontend and convert at the boundary. The webview needs no YAML parser and store.tsx / tauri.ts are unchanged
  • desktop.yaml goes through serde_norway on the typed DesktopData; its three Tauri commands are unaffected
  • Bundled desktop-projects skill updated: it is the agent's instruction sheet for editing this file, so its example block is now YAML and it no longer tells the agent to write JSON. Its sandbox note is corrected too - projects.yaml is carved out and writable directly, config.yaml still prompts
  • Export/import bundles carry the new names; the export schema is unchanged (field names were never file names), so EXPORT_VERSION stays 1
  • Test fixtures seed genuine YAML rather than JSON-in-a-.yaml-file, so the read path is exercised against the format a human or the agent would actually write

Verification

bun run build, cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (160 passed).

New projects_state_round_trips_yaml covers the missing-file rebuild, the write/read round trip, that the emitted file is YAML and not JSON, and that a hand-edited file is read as written.

Checked live against a real ~/.infer/projects.yaml: read_projects() now returns 37 names, 38 assignments, 37 groups and 2 path overrides, and the sandbox grant computes from them. On the old projects.json path it returned {}.

One-time loss

A user still holding projects.json sees a clean sidebar and re-creates their grouping and path overrides once. Deliberate, per the issue - no BREAKING CHANGE footer, so this stays a patch release.

Cross-repo

CLI side is already done in inference-gateway/cli#1239 and the JSON names are gone from it entirely; the CLI never parses either file. No docs ticket - inference-gateway/docs does not reference either file.

inference-gateway/cli#1239 records the ~/.infer file-format rule: files a
human may open are YAML, only opaque caches stay JSON. projects.yaml is on
the YAML side twice over - people open it to work out why a chat landed in
the wrong project, and the CLI carves it out of the agent sandbox
(config.go isWithinConfigSubdir) so the agent can edit it on the user's
behalf.

Straight rename, no fallback read and no migration: both files hold
regenerable sidebar and app state, so carrying two formats would cost more
than re-creating a layout once. serde_norway already backs the config.yaml
reader, so this is a serializer swap rather than a new dep.

The six hand-rolled read-parse-default / write-serialize copies of
projects.json across projects.rs, agent.rs and export.rs collapse onto one
read_projects_in / write_projects_in pair in projects.rs. The read/write
Tauri commands keep their JSON-text contract with the frontend and convert
at the boundary, so the webview needs no YAML parser and store.tsx is
unchanged.

One-time loss: a user still holding projects.json sees a clean sidebar and
re-creates grouping and path overrides once.

Resolves #283
@edenreich
edenreich marked this pull request as ready for review September 18, 2026 15:25
Comment thread backend/src/projects.rs Resolved
@edenreich
edenreich merged commit ce3ae20 into main Sep 18, 2026
@edenreich
edenreich deleted the refactor/projects-desktop-yaml branch September 18, 2026 15:26
@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.43.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-maintainer inference-gateway-maintainer Bot added the released Shipped in a release label Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor projects.json and desktop.json to YAML

1 participant