Skip to content

feat: migrate to pkl-swift 0.8.0 + Pkl 0.31 - #68

Merged
alexey1312 merged 4 commits into
mainfrom
feat/pkl-swift-0.8.0
Feb 28, 2026
Merged

feat: migrate to pkl-swift 0.8.0 + Pkl 0.31#68
alexey1312 merged 4 commits into
mainfrom
feat/pkl-swift-0.8.0

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrade pkl-swift from 0.7.2 to 0.8.0 and Pkl CLI from 0.30.2 to 0.31.0
  • Add registerPklTypes() with all 41 generated types — bypasses O(N) type scanning on first evaluation
  • Migrate codegen from removed pkl-gen-swift binary to pkl run @pkl.swift/gen.pkl
  • Replace !isEmpty with isNotEmpty in PKL schemas (Pkl 0.31 builtin constraint)

Breaking changes for consumers

No breaking changes for existing users. Consumer exfig.pkl configs continue to work as-is.

The isNotEmpty constraint change only affects PKL schema validation (server-side). Consumer configs that reference the published package URI won't see this until a new package version is published.

Test plan

  • swift build — compiles with pkl-swift 0.8.0
  • ./bin/mise run codegen:pkl — new codegen tool produces correct output
  • swift test --parallel — all 138 tests pass (15 suites)
  • swiftlint lint — 0 violations
  • pkl eval --format json — schemas validate with Pkl 0.31

- Update pkl-swift dependency from 0.7.2 to 0.8.0
- Update Pkl CLI from 0.30.2 to 0.31.0
- Add registerPklTypes() with 41 types for O(N) type scanning bypass
- Migrate codegen from pkl-gen-swift to pkl run @pkl.swift/gen.pkl
- Replace !isEmpty with isNotEmpty in PKL schemas (Pkl 0.31 builtin)
- Regenerate Swift types from updated schemas
- Update CLAUDE.md documentation
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly updates the project's Pkl integration, bringing it in line with the latest versions of pkl-swift and the Pkl CLI. These changes streamline the configuration evaluation process, modernize the code generation workflow, and ensure compatibility with new Pkl language features, ultimately enhancing performance and maintainability.

Highlights

  • Dependency Upgrades: Upgraded pkl-swift to version 0.8.0 and the Pkl CLI to 0.31.0, ensuring compatibility with the latest Pkl features and improvements.
  • Performance Optimization: Implemented registerPklTypes() with all 41 generated types to bypass O(N) type scanning, significantly improving the initial evaluation performance.
  • Codegen Migration: Migrated the code generation process from the removed pkl-gen-swift binary to the new pkl run @pkl.swift/gen.pkl command, modernizing the build workflow.
  • Schema Constraint Update: Replaced the !isEmpty constraint with isNotEmpty in PKL schemas, aligning with a new built-in constraint introduced in Pkl 0.31.
Changelog
  • .claude/rules/pkl-codegen.md
    • Updated instructions for Pkl codegen to reflect the new pkl run command and Pkl 0.31+ requirements.
  • CLAUDE.md
    • Updated the pkl-swift dependency version in the project dependencies table.
    • Added new troubleshooting entries related to Pkl 0.31 and codegen errors.
  • Package.resolved
    • Updated the resolved version of the pkl-swift package to 0.8.0.
  • Package.swift
    • Updated the pkl-swift package dependency to require version 0.8.0.
  • Sources/ExFigCLI/Resources/Schemas/Android.pkl
    • Replaced the !isEmpty constraint with isNotEmpty for string properties in ThemeAttributes, IconsEntry, ImagesEntry, and AndroidConfig.
  • Sources/ExFigCLI/Resources/Schemas/Common.pkl
    • Replaced the !isEmpty constraint with isNotEmpty for string properties in TokensFile and VariablesColors.
  • Sources/ExFigCLI/Resources/Schemas/Flutter.pkl
    • Replaced the !isEmpty constraint with isNotEmpty for string properties in IconsEntry, ImagesEntry, and FlutterConfig.
  • Sources/ExFigCLI/Resources/Schemas/PklProject
    • Added a dependencies block to declare the pkl.swift package dependency at version 0.8.0.
  • Sources/ExFigCLI/Resources/Schemas/PklProject.deps.json
    • Added a new file to resolve the pkl.swift package dependency, including its URI and SHA256 checksum.
  • Sources/ExFigCLI/Resources/Schemas/Web.pkl
    • Replaced the !isEmpty constraint with isNotEmpty for string properties in IconsEntry, ImagesEntry, and WebConfig.
  • Sources/ExFigCLI/Resources/Schemas/generator-settings.pkl
    • Added a new file that amends GeneratorSettings.pkl from the pkl.swift package.
  • Sources/ExFigCLI/Resources/Schemas/iOS.pkl
    • Replaced the !isEmpty constraint with isNotEmpty for string properties in ImagesEntry and iOSConfig.
  • Sources/ExFigConfig/CLAUDE.md
    • Updated documentation to reflect the new pkl run @pkl.swift/gen.pkl codegen method.
    • Added a section explaining the registerPklTypes pattern.
  • Sources/ExFigConfig/Generated/Android.pkl.swift
    • Regenerated the file, resulting in reordered and potentially restructured Module, NameTransform, and ThemeAttributes structs.
    • Moved AndroidConfig to a later position within the file.
  • Sources/ExFigConfig/PKL/PKLEvaluator.swift
    • Introduced a _typeRegistration static property to call registerPklTypes with a comprehensive list of all generated PKL types, optimizing initial evaluation.
  • mise.lock
    • Updated the locked version of the pkl tool to 0.31.0.
    • Adjusted platform-specific checksums and URLs for the pkl tool.
  • mise.toml
    • Updated the pkl tool version to 0.31.0.
    • Modified the codegen:pkl task to use the new pkl run command with --project-dir and --generator-settings flags.
Activity
  • Verified successful compilation with pkl-swift 0.8.0 using swift build.
  • Confirmed the new codegen tool produces correct output via ./bin/mise run codegen:pkl.
  • Ensured all 138 tests across 15 suites pass with swift test --parallel.
  • Validated zero swiftlint violations.
  • Confirmed schemas validate correctly with Pkl 0.31 using pkl eval --format json.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request effectively migrates the project to pkl-swift 0.8.0 and Pkl 0.31.0. The changes are comprehensive, including dependency updates, adapting to the new isNotEmpty constraint in PKL schemas, and migrating the codegen script to use pkl run. The introduction of registerPklTypes for performance optimization is a great addition. I've added one suggestion to improve the maintainability of the codegen script in mise.toml.

- Fix misleading doc comment in PKLEvaluator (claimed embedded evaluator,
  actually spawns pkl CLI subprocess)
- Add missing platform checksums in mise.lock (linux, macos-x64, windows)
- Remove stale pkl-gen-swift references from CLAUDE.md docs (3 places)
- Add registerPklTypes canary test to catch missing type registrations
- Make codegen:pkl safer by generating to temp dir before replacing
- Fix stale "locator" references in module descriptions
- Add clarifying comment at _typeRegistration call site
Document the breaking runtime dependency change: Pkl 0.31+ is now
required due to isNotEmpty/isNotBlank constraint builtins in schemas.
Include upgrade instructions for mise, Homebrew, and manual installs.
@alexey1312
alexey1312 merged commit fef8cb6 into main Feb 28, 2026
3 checks passed
@alexey1312
alexey1312 deleted the feat/pkl-swift-0.8.0 branch February 28, 2026 17:38
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