func plan()

in SwiftEvolve/Sources/SwiftEvolve/SwiftEvolveTool.swift [113:136]


  func plan(withSeed seed: UInt64, options: Step.Options) throws -> AbsolutePath {
    let planner = Planner(
      rng: LinearCongruentialGenerator(seed: seed),
      rules: try readRules(options: options),
      includeLineAndColumn: options.verbose
    )

    for file in options.files {
      let parsed = try parsedSource(at: file)
      try planner.planEvolution(in: parsed, at: URL(file))
    }

    let planFile = localFileSystem.currentWorkingDirectory!.appending(component: "evolution.json")
    
    let jsonEncoder = JSONEncoder()
    if #available(macOS 10.13, *) {
      jsonEncoder.outputFormatting = [.prettyPrinted, .sortedKeys]
    }
    let data = try jsonEncoder.encode(planner.plan)

    try data.write(to: URL(planFile))

    return planFile
  }