Skip to content

DietCode v0.4.0: rebrand, compress API fix, config sync + uninstall - #8

Merged
varchanaiyer merged 3 commits into
mainfrom
fix/compress-api-and-config-sync
Jun 28, 2026
Merged

varchanaiyer merged 3 commits into
mainfrom
fix/compress-api-and-config-sync

Conversation

@soham96

@soham96 soham96 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Validated every harness integration against the live Scaledown API and fixed two critical, user-facing bugs plus a Codex regex bug, then added config-sync-on-update, an uninstall command, and the x-source: kode header.

Critical bug fixes

  • /compress/raw/ response was mis-parsed. The API nests fields under results; the client read them at the top level → undefined. Effect was destructive:
    • NIAH prompt compression replaced the user's prompt with the literal string "undefined".
    • PostToolUse compression wiped tool output to {}.
    • sd_compress returned undefined/NaN token counts.
      Fixed by flattening the response and throwing on the HTTP-200 {detail} error shape so callers fail open instead of dropping content.
  • PostToolUse passed an empty prompt, which the endpoint rejects (HTTP 200 + error body). Now passes a non-empty instruction.
  • Codex hook-block regex left an orphaned old block on re-write (also present in original setup.ts). Fixed → idempotent.

Config sync on update

Previously npm install only replaced dist/; harness configs written by setup were never refreshed, so new keys (status line) never reached existing users and absolute hook paths broke on Node-version changes.

  • src/reconcile.ts — re-writes managed config for already-configured harnesses only, resolving hook paths at runtime, preserving user content.
  • postinstall script + once-a-day status-line self-heal.
  • New scaledown-claude uninstall — strips all managed config + unregisters MCP, preserving user content.

Other

  • x-source: kode header on every API call.
  • Test infra: npm test now excludes network tests; .d.ts false positive fixed; compress mocks updated to the real wire shape.
  • README: per-harness install/update/uninstall, full env-var table, corrected status-line scope (Claude Code only — no IDE extension exists).

Verification

  • npm run build clean; 104 tests pass.
  • Live API: all 4 endpoints, NIAH (28815→17227 tok), PostTool (9608→5820 tok), PreCompact (Scaledown summarize model), fail-open, status line, reconcile, and uninstall all verified in sandboxes.

Note: machine-specific .claude/settings.json was intentionally not included.

🤖 Generated with Claude Code

soham96 and others added 2 commits June 28, 2026 18:40
…rce header

Critical fixes
- client: /compress/raw/ nests fields under `results`; reading them at the
  top level returned undefined, which made NIAH prompt compression replace the
  user's prompt with the literal string "undefined" and post-tool-use wipe tool
  output to {}. Flatten the response and throw on the HTTP-200 `{detail}` error
  shape so callers fail open instead of dropping content.
- post-tool-use: the compress endpoint rejects an empty prompt; pass a non-empty
  instruction so tool-output compression works (and fails open on error).
- codex hook block regex left an orphaned old block on re-write; fixed in both
  setup and reconcile so updates are idempotent.

Config sync on update
- reconcile: re-write managed config (Claude settings.json, Codex config.toml,
  Cursor rules) only for harnesses already configured, resolving hook paths at
  runtime so a Node-version change no longer breaks hooks. Preserves user keys.
- postinstall script runs reconcile after npm install; status line self-heals
  once a day as a safety net when postinstall is skipped.
- new `scaledown-claude uninstall` command strips all managed config and
  unregisters the MCP server while preserving user content.

Other
- add `x-source: kode` header to every Scaledown API call.
- test infra: npm test now excludes network tests; ".d.ts in dist" false
  positive fixed; compress mocks updated to the real wire shape.
- README: install/update/uninstall sections per harness, full env-var table,
  corrected status-line scope (Claude Code only; no IDE extension).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Scaledown <ai@scaledown.ai>
Product is now DietCode (backed by the Scaledown API).

- npm package: @scaledown/claude-plugin -> dietcode (v0.4.0)
- CLI bins: scaledown-claude* -> dietcode* (dietcode, dietcode-status,
  dietcode-reconcile, ...)
- MCP server id: scaledown -> dietcode, with migration in setup/uninstall
  (removes the old `scaledown` MCP registration).
- Config markers + filenames migrated, detecting both old and new so existing
  users are upgraded in place on the next reconcile/setup:
    - Claude:  _scaledownVersion -> _dietcodeVersion; hook-entry detection
      matches dietcode, scaledown, and our hook filenames
    - Codex:   `# Scaledown hooks` -> `# DietCode hooks` (regex matches both)
    - Cursor:  scaledown.mdc -> dietcode.mdc (old file removed)
    - Agent:   ~/.claude/agents/scaledown.md -> dietcode.md
- Auto-updater now polls/install `dietcode` on the npm registry.
- Branding updated across CLI output, intent hint label ([DietCode intent:]),
  git trailer (Co-Authored-By: DietCode), templates, and README.

Kept as Scaledown (the backing API/company, not the product): SCALEDOWN_* env
vars, ~/.scaledown data dir, api.scaledown.xyz, ScaledownClient class.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@soham96 soham96 changed the title fix: correct compress API parsing, add config sync + uninstall, x-source header DietCode v0.4.0: rebrand, compress API fix, config sync + uninstall Jun 28, 2026
@varchanaiyer
varchanaiyer merged commit ec1fff2 into main Jun 28, 2026
3 of 6 checks passed
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.

2 participants