Extract shared engine/pai-paths.ts to dedupe migrator helpers#163
Merged
virtualian merged 1 commit intomainfrom Apr 27, 2026
Merged
Extract shared engine/pai-paths.ts to dedupe migrator helpers#163virtualian merged 1 commit intomainfrom
virtualian merged 1 commit intomainfrom
Conversation
Three migration modules (skill-migration, command-migration, pai-runtime-migration) inlined byte-identical PAI_DIR resolvers and junk-file predicates; actions.ts had a 4th partial copy missing the $HOME-prefix branch. Pure dedup refactor — 25 engine tests still pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
engine/pai-paths.tsexportsgetPaiHome/getPaiSkillsDir/getPaiCommandsDirresolvers, anisJunkEntry(name, opts)predicate, and amakeCpFilter(opts)factory.skill-migration.ts:isJunkEntry(name)(default — backup-suffix is junk)command-migration.ts:isJunkEntry(name, { extraEntries: COMMAND_EXTRA_JUNK })(.gitkeepextension)pai-runtime-migration.ts:makeCpFilter({ allowBackups: true })(no backup-suffix matching, matching its prior localisIgnored)actions.ts:getPaiHome()(replaces a 4th inlined copy that silently dropped the$HOME...prefix branch — latent bug closed as a side-benefit; surfaced by /simplify Reuse agent during review and approved as in-scope)Out-of-scope follow-ups (not addressed here)
The /simplify review surfaced further duplication worth filing as separate issues:
migratePack↔migrateCommand80-line state machines (drift backup → renameSync+EXDEV/ENOTEMPTY fallback → symlinkSync rollback) — near-byte-identicalnew Date().toISOString().replace(/[:.]/g, "-")duplicated inskill-migration.ts:154andcommand-migration.ts:148; lives next toBACKUP_SUFFIX_REsemanticallyclassifySkillDir↔classifyCommandFileparallel structurememory-migration.ts:88-94IGNORED_BASENAMES+isIgnoredNamecould fold intoisJunkEntry({ extraEntries, allowBackups: true })Test plan