plan method

Future<ProfileResolutionPlan> plan(
  1. String project, {
  2. bool upgrade = false,
  3. bool lockedOnly = false,
  4. bool skills = true,
  5. ProfileFetchPolicy? allowFetch,
  6. WayfinderCancellation? cancel,
})

Resolves every binding's chain, composes it so a broken chain fails here rather than at validation, locks one revision per Profile id, and reads each locked package's skill from its locked commit. Fetches only when the mirror is missing, a ref must move, or upgrade asks, and only what allowFetch allows (every fetch when it is null); never writes in the project.

With lockedOnly, the plan resolves exactly the commits wayfinder.lock pins and leaves the lock as it is, as a host does to bring a project's locked Profiles onto a machine. It fetches a source only when its mirror is missing or lacks the locked commit, and never re-resolves a ref, so the lock's commits stay as written; the refresh that fetches a missing commit still updates the mirror's own refs. Before any Git command it throws ProfileLockChangeRequiredException (lock-change-required) when the lock as written would change: when it is missing, its configuration hash is stale, it lacks a binding's chain or records another source for it, or it holds a package no chain reaches. A package whose own file disagrees with the lock it was locked from, as only an edited lock has, is refused the same way once it is read. upgrade cannot be set with it. ProfileLockChangeRequiredException.change says what would change.

With skills false, the plan leaves Profile skills alone, as a host does to fill the Profile cache without touching .claude/skills or .agents/skills: it reads no skill file from a mirror, refuses no skill directory, and its apply writes and deletes none. ProfileResolutionPlan.skillDirectories still reports each skill directory's state, unmarked and outside ones included, rather than throwing ProfileSkillDirectoriesException for them.

Implementation

Future<ProfileResolutionPlan> plan(
  String project, {
  bool upgrade = false,
  bool lockedOnly = false,
  bool skills = true,
  ProfileFetchPolicy? allowFetch,
  WayfinderCancellation? cancel,
}) async {
  if (upgrade && lockedOnly) {
    throw ArgumentError('A locked-only plan does not upgrade.', 'upgrade');
  }
  final (:projectRoot, :configFile) = await _locate(project);
  return _planFile(
    projectRoot,
    configFile,
    upgrade: upgrade,
    lockedOnly: lockedOnly,
    skills: skills,
    allowFetch: allowFetch,
    cancel: cancel,
  );
}