1 Commits
Author SHA1 Message Date
yetone b025fb65d1 commandcode 0.1.16: no request to Command Code names magpie (#352)
The Go catalog (/provider/v1/models) went with User-Agent "magpie" and
every /alpha/generate with x-project-slug "magpie". Both are now what
command-code 1.88.0's cli.mjs sends:
- the catalog: installModelCatalogManager asks with accept alone under
  Node's fetch, whose User-Agent is "node";
- x-project-slug: buildCommandAuthHeaders' projectSlug is
  getCommandCurrentProjectDirName, slugify(basename(cwd)) || "root". The
  plugin takes the working folder magpie names (x-magpie-work-dir, which
  it already strips), else the home folder as before. A Windows path
  splits on "\" as the CLI's win32 basename does. A name past Latin-1 is
  percent-encoded: Node refuses such a header, so the CLI has no value
  there to copy and the request would otherwise throw (found by the
  existing #86 test's "中文" folder).

Test: no-magpie.test.mjs records every request (URL, every header,
body) for a Go chat with and without a folder, a Pro chat and the
catalog, and fails on /magpie/i; red on the old code (3 of 3 fail),
green now.

Run: bun test in packages/commandcode (64 pass, 1 skip, 0 fail);
bun scripts/check.mjs commandcode ok.
Live, sandbox HOME, owner's GOAT key: Provider API chat 200, catalog 62
models, /alpha/generate 200 with x-project-slug "shop" (billing answered
503 locally so the saved Go plan routed it); the second saved key is
dead (401) but its generate request went out clean too. 0 of 9 recorded
requests named magpie.
Not tried: a real Go-plan key; Windows.
2026-10-24 17:07:45 +08:00