Skip to content

fix: copy user skills and clean up OAuth UX#31

Merged
RealKai42 merged 4 commits into
mainfrom
kaiyi/skill-migration
May 25, 2026
Merged

fix: copy user skills and clean up OAuth UX#31
RealKai42 merged 4 commits into
mainfrom
kaiyi/skill-migration

Conversation

@RealKai42
Copy link
Copy Markdown
Collaborator

Description

Two small fixes to the kimi-cli → kimi-code first-launch migration:

  1. Copy ~/.kimi/skills/ to ~/.kimi-code/skills/. The scanner
    only reads the new path, so legacy skills were silently lost on
    upgrade. Top-level granularity, skip-existing, idempotent.

  2. Stop mentioning OAuth in the migration UI. We never migrate
    refresh tokens (they rotate server-side), so the old ⚠ kimi-cli login not migrated — run /login notice and the
    kimi-cli login (needs /login) summary line read like failures.
    Both are removed; oauth-only installs no longer trigger the
    migration screen at all. kimi-code's normal /login flow handles
    re-auth.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

RealKai42 added 3 commits May 25, 2026 20:33
The first-launch migration previously left ~/.kimi/skills/ behind: the
new scanner only reads ~/.kimi-code/skills/ and ~/.agents/skills/, so any
custom skills authored against kimi-cli silently disappeared after the
upgrade. Adds a skills step that copies top-level entries from
~/.kimi/skills/ into ~/.kimi-code/skills/ with skip-existing semantics,
wires it into the existing run-migration pipeline and result screen, and
surfaces the count alongside config/mcp/REPL-history.
OAuth credentials are deliberately never migrated (refresh tokens
rotate server-side, so two installs sharing one token would fight over
who gets refreshed). The previous UX framed this as a limitation: the
result screen carried a yellow ⚠ "kimi-cli login not migrated — run
/login" line, and the pre-migration summary listed "kimi-cli login
(needs /login)" alongside real migratable data classes, making users
think a login was about to be transferred and only the last step had
failed.

Drops both surfaces and short-circuits the pre-migration screen when
the only legacy data is `credentials/*.json`. kimi-code's own /login
flow handles re-auth on first use, so a dedicated migration notice is
redundant. The `report.notices.oauthLoginsRequiringRelogin` JSON field
is left intact for debugging.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 25, 2026

🦋 Changeset detected

Latest commit: c4371e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/migration-legacy Patch

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

@RealKai42 RealKai42 changed the title migration: copy user skills and clean up OAuth UX fix: copy user skills and clean up OAuth UX May 25, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b58a772e9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 47 to +50
plan.totalSessions === 0 &&
!plan.hasConfig &&
!plan.hasMcp &&
!plan.hasUserHistory &&
plan.oauthCredentials.length === 0;
!plan.hasUserHistory;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include skills in pending-migration detection

This nothingToMigrate check now ignores OAuth (intended) but still only considers sessions/config/MCP/history, so a legacy install that contains only ~/.kimi/skills/ is treated as “nothing to migrate.” In that case detectPendingMigration returns null, the first-launch migration UI is skipped, and kimi migrate (migrateOnly) also exits early with “Nothing to migrate,” so the newly added skills migration path never runs for that user segment.

Useful? React with 👍 / 👎.

Comment on lines +68 to +72
await cp(srcPath, tmpPath, { recursive: true, errorOnExist: false, force: true });
await rename(tmpPath, tgtPath);
} catch (err) {
await rm(tmpPath, { recursive: true, force: true }).catch(() => {});
throw err;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip unsupported skill entries instead of aborting migration

The step intentionally copies every top-level entry in ~/.kimi/skills, but any cp() error is rethrown, which aborts the entire migration run. fs.cp throws on special entries (for example FIFOs with ERR_FS_CP_FIFO_PIPE), so one such item can make the whole migration fail and block unrelated data (sessions/config/history) from being migrated. This should be handled per-entry as a skip/report instead of terminating the run.

Useful? React with 👍 / 👎.

@RealKai42 RealKai42 merged commit 475ebad into main May 25, 2026
4 checks passed
@RealKai42 RealKai42 deleted the kaiyi/skill-migration branch May 25, 2026 13:16
@github-actions github-actions Bot mentioned this pull request May 26, 2026
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.

1 participant