Skip to content

Enhance MSI build process with custom output and file associations - #81

Merged
logbie merged 4 commits into
mainfrom
Dev
May 20, 2025
Merged

Enhance MSI build process with custom output and file associations#81
logbie merged 4 commits into
mainfrom
Dev

Conversation

@logbie

@logbie logbie commented May 19, 2025

Copy link
Copy Markdown
Collaborator

Adds parameter support to build_msi.ps1 for custom output directory Extracts version dynamically from wix.toml instead of hardcoding Implements .wfl file association in MSI installer with Open/Edit verbs Adds --edit command to open .wfl files in default editor Creates new launch_msi_build.py script for coordinated build process

This improves the installation experience by allowing users to open .wfl files directly from Windows Explorer, while making the build process more flexible and maintainable.

Summary by CodeRabbit

  • New Features

    • Added support for associating .wfl files with the application in the Windows installer, including custom icons and context menu options to open or edit files directly.
    • Introduced a new command-line flag --edit to open or create files in the system's default editor from the CLI.
    • Provided a new MSI build launcher tool with version management and build documentation features.
    • Enhanced MSI build script to support dynamic output directory and version-based naming.
    • Added a new parser syntax allowing open file at "path" as variable alongside the existing syntax.
    • Introduced a step-by-step execution mode in the interpreter activated via a new --step CLI flag for interactive debugging.
  • Documentation

    • Expanded deployment and tools documentation to cover file association setup, the new MSI build launcher, and updated project structure.
    • Added detailed logs of MSI build attempts and configuration settings documentation.
    • Documented the new step-by-step execution mode and parser syntax enhancements.
  • Chores

    • Updated version information to 2025.6.
    • Added new configuration files for tool settings.

Adds parameter support to build_msi.ps1 for custom output directory
Extracts version dynamically from wix.toml instead of hardcoding
Implements .wfl file association in MSI installer with Open/Edit verbs
Adds --edit command to open .wfl files in default editor
Creates new launch_msi_build.py script for coordinated build process

This improves the installation experience by allowing users to open
.wfl files directly from Windows Explorer, while making the build
process more flexible and maintainable.
Copilot AI review requested due to automatic review settings May 19, 2025 17:07
@coderabbitai

coderabbitai Bot commented May 19, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The updates introduce .wfl file association support in the MSI installer, enabling double-click and context menu actions for WFL scripts. A new MSI build launcher script with version management, documentation updates, and configuration support is added. Documentation is expanded to cover these features, and configuration files are introduced for build and runtime settings. The CLI gains an --edit flag to open or create files in the system editor. The MSI build script now supports dynamic output directories and version-based naming. Parser enhancements add support for a new file open syntax variant.

Changes

File(s) Change Summary
Docs/implementation_progress_2025-05-19.md, Docs/wfl-deployment.md Documentation updated: Added details on .wfl file association in the MSI, technical notes on the new build launcher, and logs of build attempts. Deployment docs now include a new section on file association configuration and updated MSI features list.
README.md, Tools/README.md Expanded documentation: README's Tools section now lists new utility scripts, and Tools/README.md adds usage and feature documentation for the MSI Build Launcher (launch_msi_build.py).
Tools/launch_msi_build.py New script: Automates MSI build process, manages versioning, updates progress docs, and provides CLI options for output directory, skipping tests, and verbosity. Enforces Windows usage and integrates with other build tools.
Tools/.wflcfg, Tools/target/x86_64-pc-windows-msvc/release/package/.wflcfg New configuration files: Define timeout, logging, debug report, and log level settings for build and runtime environments.
build_msi.ps1 Enhanced script: Accepts an optional output directory, dynamically determines MSI filename based on version from wix.toml, and updates output paths and messages accordingly.
src/main.rs CLI enhancement: Adds --edit flag to open or create a file in the system editor, with platform-specific handling. Updates help text and ensures flag exclusivity with other operations.
src/parser/mod.rs, src/parser/tests.rs Parser enhancement: Supports new syntax open file at "path" as variable alongside existing open file at "path" and read content as variable. Added tests for new syntax.
test.wfl New workflow file demonstrating the new file open syntax with variable assignment.
wix.toml Version update: Bumps MSI package version from 2025.4.0.0 to 2025.6.0.0 and updates version source comment.
wix/main.wxs Installer update: Adds .wfl file association with custom icon, open/edit verbs, and product icon configuration.
dhat-heap.json New heap profile data file capturing detailed memory allocation during runtime.
Docs/wfl-step.md New design document outlining a step-by-step execution mode for the interpreter, including CLI flag, interpreter modifications, and user prompts.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Launcher (launch_msi_build.py)
    participant VersionManager (bump_version.py)
    participant MSIBuilder (build_msi.ps1)
    participant Docs

    User->>Launcher: Run build command (with options)
    Launcher->>VersionManager: (Optional) Bump or override version
    VersionManager-->>Launcher: Return updated version
    Launcher->>MSIBuilder: Invoke build_msi.ps1 (with version/output dir)
    MSIBuilder-->>Launcher: Build result (success/failure, MSI path)
    Launcher->>Docs: Update progress doc with build status
    Launcher-->>User: Print build summary and exit
Loading
sequenceDiagram
    participant User
    participant WFL CLI (main.rs)
    participant OS

    User->>WFL CLI: wfl --edit myscript.wfl
    WFL CLI->>OS: Open default editor for myscript.wfl
    OS-->>User: Editor launches with file
Loading

Poem

Oh, what a hop in the build today,
MSI now knows .wfl’s way!
With icons and verbs, it’s quite the delight,
Double-click magic, edit with might.
The launcher script’s clever, the docs are so neat—
This bunny’s proud of a build so complete!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Enhance the MSI build workflow by extracting versions dynamically, adding custom output and file-association support, and introducing a wrapper build launcher.

  • Parameterize build_msi.ps1 to accept an output directory and derive version from wix.toml
  • Implement .wfl file associations in the installer and add a --edit flag to the Rust CLI
  • Add launch_msi_build.py to coordinate version bumps, MSI builds, and progress docs; update related documentation

Reviewed Changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wix.toml Bump version source changed to bump_version.py
src/main.rs Add --edit CLI flag and open file in system default editor
Tools/launch_msi_build.py New Python script coordinating MSI builds, versioning, and docs
Tools/README.md Document MSI build launcher usage
README.md List new Tools scripts in project README
Docs/wfl-deployment.md Add file association config sample in WiX docs
Docs/implementation_progress_2025-05-19.md Record new progress entries for MSI builds
Files not reviewed (4)
  • Tools/.wflcfg: Language not supported
  • Tools/target/x86_64-pc-windows-msvc/release/package/.wflcfg: Language not supported
  • build_msi.ps1: Language not supported
  • wix/main.wxs: Language not supported

Comment thread Tools/launch_msi_build.py
build_group = parser.add_argument_group("Build Options")
build_group.add_argument("--output-dir",
help="Custom output directory for the MSI file")
build_group.add_argument("--skip-tests", action="store_true",

Copilot AI May 19, 2025

Copy link

Choose a reason for hiding this comment

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

The --skip-tests flag is parsed but never applied; either implement test execution logic that respects this flag or remove it to avoid dead code.

Copilot uses AI. Check for mistakes.
Comment thread Docs/wfl-deployment.md
- `ProgId`: Defines the program identifier for the file type
- `Extension`: Specifies the file extension to associate (.wfl)
- `Verb`: Defines actions that can be performed (Open, Edit)
- `Icon` attribute on ProgId: References the executable file (with IconIndex) to use as the file type icon

Copilot AI May 19, 2025

Copy link

Choose a reason for hiding this comment

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

The bullet mentions an Icon attribute on ProgId, but the example snippet doesn’t include it. Update the code sample to show the Icon attribute or remove this item to keep docs in sync.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +167 to +170
- `launch_msi_build.py`: MSI build launcher with version management
- `wfl_config_checker.py`: Configuration validation tool
- `rust_loc_counter.py`: Statistics for Rust code
- `wfl_md_combiner.py`: Markdown documentation combiner

Copilot AI May 19, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] For clarity and consistency with the project structure, prefix this entry with Tools/ (e.g., Tools/launch_msi_build.py).

Suggested change
- `launch_msi_build.py`: MSI build launcher with version management
- `wfl_config_checker.py`: Configuration validation tool
- `rust_loc_counter.py`: Statistics for Rust code
- `wfl_md_combiner.py`: Markdown documentation combiner
- `Tools/launch_msi_build.py`: MSI build launcher with version management
- `Tools/wfl_config_checker.py`: Configuration validation tool
- `Tools/rust_loc_counter.py`: Statistics for Rust code
- `Tools/wfl_md_combiner.py`: Markdown documentation combiner

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
Tools/.wflcfg (1)

1-4: Configuration file appears complete but consider adding comments

The configuration file includes essential settings for timeout, logging, and debug reports with sensible defaults. Consider adding comments to explain each setting's purpose and possible values, especially for users who might need to adjust these values.

-timeout_seconds = 60
-logging_enabled = false
-debug_report_enabled = true
-log_level = info
+# Maximum execution time before timeout (in seconds)
+timeout_seconds = 60
+# Enable/disable structured logging output (true/false)
+logging_enabled = false
+# Enable/disable automatic debug reports on errors (true/false)
+debug_report_enabled = true
+# Log verbosity level (debug, info, warn, error)
+log_level = info
Docs/implementation_progress_2025-05-19.md (1)

99-159: Consider consolidating build logs.

The implementation progress document now includes multiple similar MSI build logs. While it's valuable to track builds, having 8 consecutive successful builds with identical version numbers creates unnecessary clutter in the documentation.

Consider either:

  1. Consolidating these into a single summary entry, or
  2. Moving detailed build logs to a separate log file and just keeping a summary in this document

This would make the document more maintainable while still preserving the build history.

Tools/launch_msi_build.py (2)

16-16: Remove unused import.

The re module is imported but not used anywhere in the script.

-import re
🧰 Tools
🪛 Ruff (0.11.9)

16-16: re imported but unused

Remove unused import: re

(F401)


70-100:

Details

❓ Verification inconclusive

Version update logic could be simplified.

The version override logic directly modifies the build metadata file before calling the version update script, which then reads and possibly modifies the same file again. This approach could lead to inconsistencies.

Consider passing the version override directly to the version update script instead of manually modifying the build metadata file.

Additionally, the script doesn't check if the version override is in a valid format before trying to parse it. Add validation to ensure the version string is properly formatted.

def run_version_update(bump=False, override=None):
    """Run the version update script with appropriate arguments."""
    cmd = [sys.executable, str(BUMP_VERSION_SCRIPT)]
    
    if not bump:
        cmd.append("--skip-bump")
    
    if override:
        print(f"Using version override: {override}")
-        # We'll need to manually update the build metadata
-        try:
-            with open(BUILD_META_FILE, "r") as f:
-                meta = json.load(f)
-            
-            parts = override.split(".")
-            if len(parts) >= 2:
-                meta["year"] = int(parts[0])
-                meta["build"] = int(parts[1])
-                
-                with open(BUILD_META_FILE, "w") as f:
-                    json.dump(meta, f, indent=2)
-        except Exception as e:
-            print(f"Error updating version metadata: {e}")
-            return False
+        # Validate version format (YYYY.MM)
+        if not re.match(r"^\d{4}\.\d+$", override):
+            print(f"Error: Invalid version format '{override}'. Expected format: YYYY.MM")
+            return False
+        
+        # Add version override parameter to the command
+        # Note: This requires adding support for version override in the bump_version.py script
+        cmd.extend(["--version-override", override])
    
    cmd.extend(["--update-all", "--skip-git"])
    
    print(f"Running: {' '.join(cmd)}")
    result = subprocess.run(cmd, check=False)
    return result.returncode == 0

Note: This refactoring would require adding --version-override support to the bump_version.py script, which appears to be outside the scope of this PR.

Does the scripts/bump_version.py script currently support a version override parameter?


🏁 Script executed:

#!/bin/bash
cat "${PROJECT_ROOT}/scripts/bump_version.py" | grep -A 10 "parse_args"

Length of output: 111


I couldn’t locate the bump_version.py file at the expected path. Let’s search for it and inspect its parse_args definition:

#!/bin/bash
# Locate bump_version.py anywhere in the repo
FILE=$(fd bump_version.py)
echo "Found bump_version.py at: $FILE"
# Show the parse_args section to see supported CLI flags
grep -R "def parse_args" -A 10 "$FILE"

Let's locate the bump_version.py script and inspect its parse_args definition to see if it already supports a version-override flag:

#!/bin/bash
set -e

# Find the bump_version.py file anywhere in the repo
FILE=$(fd -t f bump_version.py | head -n1)

if [[ -z "$FILE" ]]; then
  echo "bump_version.py not found"
  exit 1
fi

echo "Found bump_version.py at: $FILE"
echo
echo "Showing parse_args definition and following lines:"
grep -R "def parse_args" -A10 "$FILE"

Let’s locate any bump_version.py in the repo and inspect its CLI flags:

#!/bin/bash
set -e

# List all tracked files matching bump_version.py
FILES=$(git ls-files | grep -i bump_version.py || true)

if [[ -z "$FILES" ]]; then
  echo "No bump_version.py file found in the repository."
  exit 1
fi

for FILE in $FILES; do
  echo "Found bump_version script at: $FILE"
  echo
  echo "---- parse_args definition & next 10 lines ----"
  grep -R -n "def parse_args" -A10 "$FILE"
  echo
  echo "---- add_argument usages ----"
  grep -R -n "add_argument" "$FILE"
  echo
done

To confirm whether bump_version.py already supports a --version-override flag, let’s locate the script and inspect its CLI arguments:

#!/bin/bash
set -e

# Find bump_version.py in the repo
SCRIPT=$(git ls-files | grep -i 'bump_version.py' | head -n1)
if [[ -z "$SCRIPT" ]]; then
  echo "bump_version.py not found in repository."
  exit 1
fi

echo "Found bump_version.py at: $SCRIPT"
echo
# Show the parse_args function and the following lines
grep -R "def parse_args" -A 10 "$SCRIPT"
echo
# List all add_argument occurrences to see supported flags
grep -R "add_argument" -n "$SCRIPT"

Simplify version override handling & add validation

Revise run_version_update to:

  • Validate the override format up front (expecting YYYY.MM).
  • Pass the override via --version-override to the bump script instead of manually editing BUILD_META_FILE.
  • Confirm (or add) support for --version-override in bump_version.py.

Suggested diff sketch:

 def run_version_update(bump=False, override=None):
@@
     if override:
-        print(f"Using version override: {override}")
-        # We'll need to manually update the build metadata
-        try:
-            with open(BUILD_META_FILE, "r") as f:
-                meta = json.load(f)
-            parts = override.split(".")
-            if len(parts) >= 2:
-                meta["year"] = int(parts[0])
-                meta["build"] = int(parts[1])
-                with open(BUILD_META_FILE, "w") as f:
-                    json.dump(meta, f, indent=2)
-        except Exception as e:
-            print(f"Error updating version metadata: {e}")
-            return False
+        print(f"Using version override: {override}")
+        # Validate override format (YYYY.MM)
+        if not re.match(r"^\d{4}\.\d+$", override):
+            print(f"Error: Invalid version format '{override}'. Expected YYYY.MM")
+            return False
+        # Pass override to bump_version.py instead of manual metadata edits
+        cmd.extend(["--version-override", override])

Before merging, please verify that bump_version.py (referenced by BUMP_VERSION_SCRIPT) accepts --version-override or update it accordingly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between e93b754 and d867c36.

📒 Files selected for processing (11)
  • Docs/implementation_progress_2025-05-19.md (3 hunks)
  • Docs/wfl-deployment.md (2 hunks)
  • README.md (1 hunks)
  • Tools/.wflcfg (1 hunks)
  • Tools/README.md (1 hunks)
  • Tools/launch_msi_build.py (1 hunks)
  • Tools/target/x86_64-pc-windows-msvc/release/package/.wflcfg (1 hunks)
  • build_msi.ps1 (2 hunks)
  • src/main.rs (4 hunks)
  • wix.toml (1 hunks)
  • wix/main.wxs (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
Tools/launch_msi_build.py (1)
scripts/bump_version.py (2)
  • parse_args (18-26)
  • bump_version (43-76)
🪛 Ruff (0.11.9)
Tools/launch_msi_build.py

16-16: re imported but unused

Remove unused import: re

(F401)

🪛 GitHub Actions: CI
src/main.rs

[error] 153-314: Prettier formatting check failed. Code formatting differences detected by 'cargo fmt --all -- --check'. Please run 'cargo fmt --all' to fix code style issues.

🔇 Additional comments (28)
wix.toml (1)

6-6: Version update matches PR scope

Version update from 2025.4.0.0 to 2025.6.0.0 aligns with the comment indicating the version is now managed by bump_version.py rather than build_msi.ps1, which is consistent with the PR's goal of enhancing the MSI build process.

README.md (1)

167-170: Documentation update is comprehensive

The README additions clearly document the new utility scripts, particularly the MSI build launcher which is central to this PR. Well-documented with descriptive explanations of each tool's purpose.

wix/main.wxs (1)

126-132: File association implementation is well structured

The .wfl file association is correctly implemented using the ProgId element, properly associating .wfl files with the installed executable and defining both Open and Edit verbs. This aligns with the PR objective to enhance the MSI installer with file associations.

build_msi.ps1 (5)

1-4: Well-structured parameter support added.

The parameter support is correctly implemented, allowing for an optional output directory parameter that can be passed to the script.


136-142: Version extraction implementation looks good.

The script now dynamically reads the version from wix.toml using regex pattern matching, which is more maintainable than hardcoding. It correctly extracts the major and minor version components for naming the MSI file.


144-154: Output path handling is implemented properly.

The script properly constructs the output path and creates the output directory if needed. Good error handling with appropriate user feedback when creating a new directory.


157-157: MSI output path correctly specified.

The cargo wix command now uses the custom output path, which is consistent with the PR's objective to support custom output locations.


161-165: Good post-build verification with dynamic path.

The script correctly verifies the MSI file existence using the dynamic output path and provides appropriate feedback to the user.

src/main.rs (6)

34-34: Help documentation updated for new feature.

The help text now includes information about the new --edit flag, correctly documenting its purpose.


79-79: New edit mode flag declared.

The edit_mode flag is correctly initialized as false, consistent with other mode flags in the file.


147-163: Edit mode command-line handling implemented properly.

The edit mode handling follows the same pattern as other commands, with appropriate parameter validation and error messages. It correctly checks for conflicts with other operation flags.


289-294: Windows file opening implementation looks good.

The code correctly uses the Windows cmd /C start command to open files in the default editor.


297-302: macOS file opening implementation looks good.

The code correctly uses the macOS open command to handle files with the default application.


305-310: Linux file opening implementation looks good.

The code correctly uses the Linux xdg-open command to handle files with the default application.

Tools/README.md (1)

7-46: Well-documented MSI Build Launcher tool.

The documentation for the new launch_msi_build.py tool is clear and comprehensive. It includes:

  • Overview of features
  • Usage syntax and options
  • Multiple examples showing different usage scenarios

This documentation will help users understand and utilize the new MSI build tool effectively.

Docs/wfl-deployment.md (2)

94-119: Excellent file association documentation.

The new section on file association configuration is clear and helpful. It:

  • Identifies the potential issue
  • Provides a solution with XML code example
  • Explains the key components (ProgId, Extension, Verb, Icon)

This will help developers understand how the .wfl file associations are implemented in the MSI installer.


200-202: Updated MSI features list accurately reflects new capabilities.

The additions to the MSI features list correctly document the new file association capabilities:

  • .wfl file association with application icon
  • Double-click execution
  • Right-click context menu options

This ensures users are aware of the new functionality provided by the installer.

Docs/implementation_progress_2025-05-19.md (2)

5-6: Documentation coherently reflects new functionality.

The addition of these two completed items clearly documents the new features implemented in this PR: file association for .wfl files and the MSI build launcher script. This matches with the PR objectives and provides clear tracking of project progress.


28-34: Well-structured technical details section.

The technical details effectively document the key functionality added in this PR:

  1. The MSI build launcher with version management
  2. Automatic progress tracking
  3. Unified CLI for version control and MSI building
  4. .wfl file association with both Open and Edit verbs

This provides a clear reference for team members and future maintainers.

Tools/launch_msi_build.py (9)

1-20: Good initial structure and documentation.

The script header, imports, and docstring are well-organized. The docstring clearly explains the purpose of the script and how it coordinates with existing tools.

🧰 Tools
🪛 Ruff (0.11.9)

16-16: re imported but unused

Remove unused import: re

(F401)


21-26: Well-defined constants for path management.

Using constants for file paths makes the code more maintainable and less prone to errors. The use of the Path object from the pathlib module is a modern approach and provides cross-platform compatibility.


28-51: Well-structured command-line argument parsing.

The argument parser is well-organized with logical grouping of related options (version management, build options, output options). The help text for each option is clear and descriptive.


53-58: Proper platform validation.

The script correctly checks if it's running on Windows, which is necessary since the MSI build process depends on Windows-specific tools like WiX Toolset. The error message is informative and explains why the script only works on Windows.


60-68: Robust version retrieval with proper error handling.

The function correctly handles potential errors when reading the version from the build metadata file and provides a clear error message if something goes wrong.


101-128: MSI build execution is well-implemented.

The function handles the MSI build process cleanly with these noteworthy aspects:

  1. Properly sets PowerShell execution policy
  2. Handles custom output directory if specified
  3. Preserves and restores the current working directory
  4. Returns a success status based on the command's return code

This implementation ensures the build process is robust and flexible.


129-159: Progress documentation function effectively tracks build history.

The update_progress_doc function creates or updates a daily progress document with build information including timestamp, version, status, and output path. The function avoids potential encoding issues by using plain text status instead of emoji.

This automated documentation approach effectively maintains a history of build attempts and their outcomes, which is valuable for troubleshooting and progress tracking.


160-202: Main execution flow is well-structured and robust.

The main function effectively orchestrates the entire build process:

  1. Parses arguments and validates platform
  2. Updates version information if requested
  3. Runs the MSI build
  4. Updates documentation
  5. Reports results and exits with appropriate status codes

The code is well-organized, with clear section comments and meaningful output at each stage.


203-205: Standard Python script entry point.

The script uses the standard idiom for Python script entry points, ensuring the main() function is only called when the script is executed directly.

Comment on lines +1 to +4
timeout_seconds = 60
logging_enabled = false
debug_report_enabled = true
log_level = info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Configuration duplication should be addressed

This file is identical to Tools/.wflcfg but located in a different directory. Consider implementing a mechanism to generate this file from a single source of truth to avoid divergence over time.

The build process should generate this file from the primary .wflcfg configuration to ensure consistency across environments. This could be implemented in the launch_msi_build.py script.

🤖 Prompt for AI Agents
In Tools/target/x86_64-pc-windows-msvc/release/package/.wflcfg lines 1 to 4, the
configuration file duplicates the content of Tools/.wflcfg, risking divergence.
To fix this, modify the build process, specifically the launch_msi_build.py
script, to generate this .wflcfg file dynamically by copying or templating from
the primary Tools/.wflcfg file. This ensures a single source of truth and
consistent configuration across environments.

Comment thread wix/main.wxs
Comment on lines +169 to +171
<!-- Icons for the application -->
<Icon Id='ProductICO' SourceFile='icons\wfl.png'/>
<Property Id='ARPPRODUCTICON' Value='ProductICO' />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Product icon configuration may need revision

The product icon uses a PNG file (icons\wfl.png), but Windows typically expects ICO files for application icons. The WiX documentation recommends using ICO files for ARPPRODUCTICON.


🏁 Script executed:

#!/bin/bash
# Verify if the icon file exists and check its format
ls -la icons/wfl.png icons/wfl.ico 2>/dev/null || echo "One or both icon files not found"

# Check if ICO file exists in the project
fd -e ico -p icons/

Length of output: 195


Replace PNG icon with ICO for Windows installer

Windows installer icons must be in ICO format. No *.ico file was found in the icons/ directory, so the PNG won’t work as the ARPPRODUCTICON.

• Add or generate an ICO version of your icon (e.g. icons\wfl.ico).
• Update the WiX snippet to reference the ICO file:

-   <!-- Icons for the application -->
-   <Icon Id='ProductICO' SourceFile='icons\wfl.png'/>
+   <!-- Icons for the application -->
+   <Icon Id='ProductICO' SourceFile='icons\wfl.ico'/>
    <Property Id='ARPPRODUCTICON' Value='ProductICO' />
🤖 Prompt for AI Agents
In wix/main.wxs around lines 169 to 171, the product icon is currently set to a
PNG file, but Windows installers require ICO files for application icons. To fix
this, create or add an ICO version of the icon (e.g., icons\wfl.ico) and update
the Icon element's SourceFile attribute to point to this ICO file instead of the
PNG. This ensures the ARPPRODUCTICON property references a valid ICO file as
expected by Windows.

Comment thread src/main.rs
Comment on lines +274 to +314
// Handle edit mode - launch the default editor for the file
if edit_mode {
let path = Path::new(&file_path);

// Ensure the file exists
if !path.exists() {
// Create an empty file if it doesn't exist
println!("File doesn't exist. Creating empty file: {}", file_path);
fs::write(&file_path, "")?;
}

// Use the system's default program to open the file
println!("Opening file in default editor: {}", file_path);

#[cfg(target_os = "windows")]
{
use std::process::Command;
Command::new("cmd")
.args(["/C", "start", "", &file_path])
.spawn()?;
}

#[cfg(target_os = "macos")]
{
use std::process::Command;
Command::new("open")
.arg(&file_path)
.spawn()?;
}

#[cfg(target_os = "linux")]
{
use std::process::Command;
Command::new("xdg-open")
.arg(&file_path)
.spawn()?;
}

println!("Editor launched. Exiting WFL.");
return Ok(());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix formatting issues in the edit mode implementation.

The implementation logic for the edit mode is correct, but there are formatting issues that caused the pipeline failure.

Run cargo fmt to fix the formatting issues flagged by the CI pipeline:

# No code changes needed, just run:
cargo fmt --all

The edit mode implementation correctly:

  1. Checks if the file exists and creates it if needed
  2. Uses platform-specific code for Windows, macOS, and Linux
  3. Exits after launching the editor

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: CI

[error] 153-314: Prettier formatting check failed. Code formatting differences detected by 'cargo fmt --all -- --check'. Please run 'cargo fmt --all' to fix code style issues.

🤖 Prompt for AI Agents
In src/main.rs around lines 274 to 314, the edit mode code has formatting issues
causing CI pipeline failure. Run `cargo fmt` on the file to automatically fix
indentation, spacing, and line break inconsistencies according to Rust's
standard formatting rules. This will resolve the formatting problems without
changing the logic.

@logbie
logbie enabled auto-merge May 19, 2025 17:15
logbie added 2 commits May 19, 2025 23:33
Files changed:
- Cargo.lock

Adds the dhat crate (v0.3.3) and its dependencies to the project:
- mintex (v0.1.4)
- rustc-hash (v1.1.0)
- thousands (v0.2.0)

This will enable heap profiling and memory usage analysis capabilities.
Enhances the parser to support a more direct file handling syntax:
- Adds "open file at [path] as [variable]" alternative syntax
- Maintains backward compatibility with existing syntax
- Updates error messages to be more descriptive
- Adds comprehensive tests for the new syntax

The implementation allows users to directly get a file handle rather than
requiring the more verbose "and read content as" syntax when just needing
a file reference.

Updates progress document to reflect this enhancement.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
Docs/wfl-step.md (1)

1-264: ⚠️ Potential issue

Out-of-Scope Documentation Detected
This document details a step-by-step execution mode for the WFL interpreter, which is unrelated to the MSI build enhancements described in this PR (custom output directories, dynamic version extraction, file associations, --edit support). Please remove or relocate this file to a dedicated branch/PR for the step-mode feature.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~95-~95: A comma may be missing after the conjunctive/linking adverb ‘Currently’.
Context: ...terpret` method’s loop will be updated. Currently it iterates through program statements ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~147-~147: Possible missing comma found.
Context: ...orlike"Execution aborted by user". Then in main.rs`, detect this case and avoi...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~157-~157: Consider using the synonym “brief” (= concise, using a few words, not lasting long) to strengthen your wording.
Context: ...ame. * For boot steps, we’ll print a short description (as shown above: e.g., "Con...

(QUICK_BRIEF)


[uncategorized] ~158-~158: Possible missing comma found.
Context: ...ized"). * For script execution steps, ideally we print the actual source line or a su...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~182-~182: Possible missing comma found.
Context: ...The Environment stores variables in a HashMap which we can snapshot. However, impleme...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~182-~182: The modal verb ‘can’ requires the verb’s base form.
Context: ...res variables in a HashMap which we can snapshot. However, implementing a full diff may ...

(MD_BASEFORM)


[uncategorized] ~215-~215: Possible missing comma found.
Context: ...er’s performance in normal mode remains unaffected aside from trivial boolean checks. * **...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~224-~224: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... interpreter mostly runs single-threaded and we’re waiting on user input deliberatel...

(COMMA_COMPOUND_SENTENCE)


[uncategorized] ~227-~227: Possible missing comma found.
Context: ...atement already. We may insert one more prompt like *“Top-level script execution compl...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 markdownlint-cli2 (0.17.2)

189-189: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


198-198: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


203-203: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


237-237: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🧹 Nitpick comments (4)
Docs/wfl-step.md (4)

1-4: Use a formal, objective tone
The introduction reads informally (“Alright, I’ll engineer…”). To align with the project’s documentation style, consider rephrasing in a more formal, objective voice.


6-6: Consider adding a Table of Contents
Given the length of this plan, a TOC would improve navigation and help readers jump to specific sections quickly.


95-95: Minor punctuation corrections
A few sentences would benefit from added commas for readability:

  • Line 95: change “Currently it iterates…” to “Currently, it iterates…”
  • Line 147: add a comma after the quoted error message.
  • Line 158: insert a comma after transitional phrases.

Also applies to: 147-147, 158-158

🧰 Tools
🪛 LanguageTool

[uncategorized] ~95-~95: A comma may be missing after the conjunctive/linking adverb ‘Currently’.
Context: ...terpret` method’s loop will be updated. Currently it iterates through program statements ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


189-189: Add language specifiers to fenced code blocks
Several examples use triple backticks without a language tag. Please update them to include identifiers (e.g., rust, text, ```shell) for proper syntax highlighting.

Also applies to: 198-198, 203-203, 237-237

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

189-189: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 274bf9c and 81dfabe.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • nexus.log is excluded by !**/*.log
  • wfl_exec.log is excluded by !**/*.log
📒 Files selected for processing (6)
  • Docs/implementation_progress_2025-05-19.md (3 hunks)
  • Docs/wfl-step.md (1 hunks)
  • dhat-heap.json (1 hunks)
  • src/parser/mod.rs (1 hunks)
  • src/parser/tests.rs (1 hunks)
  • test.wfl (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • dhat-heap.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/parser/mod.rs (1)
src/parser/ast.rs (2)
  • new (9-11)
  • new (303-309)
🪛 GitHub Actions: CI
src/parser/tests.rs

[error] 162-163: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.


[error] 182-191: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.

src/parser/mod.rs

[error] 1671-1679: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.


[error] 1716-1725: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.


[error] 1737-1746: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.

🪛 LanguageTool
Docs/wfl-step.md

[uncategorized] ~95-~95: A comma may be missing after the conjunctive/linking adverb ‘Currently’.
Context: ...terpret` method’s loop will be updated. Currently it iterates through program statements ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~147-~147: Possible missing comma found.
Context: ...orlike"Execution aborted by user". Then in main.rs`, detect this case and avoi...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~157-~157: Consider using the synonym “brief” (= concise, using a few words, not lasting long) to strengthen your wording.
Context: ...ame. * For boot steps, we’ll print a short description (as shown above: e.g., "Con...

(QUICK_BRIEF)


[uncategorized] ~158-~158: Possible missing comma found.
Context: ...ized"). * For script execution steps, ideally we print the actual source line or a su...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~182-~182: Possible missing comma found.
Context: ...The Environment stores variables in a HashMap which we can snapshot. However, impleme...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~182-~182: The modal verb ‘can’ requires the verb’s base form.
Context: ...res variables in a HashMap which we can snapshot. However, implementing a full diff may ...

(MD_BASEFORM)


[uncategorized] ~215-~215: Possible missing comma found.
Context: ...er’s performance in normal mode remains unaffected aside from trivial boolean checks. * **...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~224-~224: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... interpreter mostly runs single-threaded and we’re waiting on user input deliberatel...

(COMMA_COMPOUND_SENTENCE)


[uncategorized] ~227-~227: Possible missing comma found.
Context: ...atement already. We may insert one more prompt like *“Top-level script execution compl...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 markdownlint-cli2 (0.17.2)
Docs/wfl-step.md

189-189: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


198-198: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


203-203: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


237-237: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🔇 Additional comments (7)
src/parser/mod.rs (1)

1668-1751: Improved file opening syntax with proper error handling

The updated parser logic now elegantly supports two distinct syntactic patterns for opening files:

  1. Original pattern: open file at "path" and read content as variable
  2. New pattern: open file at "path" as variable

The code branches based on the token after the file path, providing appropriate error messages and returning the correct statement type in each case.

However, there are formatting issues flagged by the CI pipeline. Please run cargo fmt --all to fix the indentation in these sections:

  • Lines 1671-1679
  • Lines 1716-1725
  • Lines 1737-1746
🧰 Tools
🪛 GitHub Actions: CI

[error] 1671-1679: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.


[error] 1716-1725: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.


[error] 1737-1746: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.

src/parser/tests.rs (1)

166-195: Good test coverage for the new syntax

The test case thoroughly validates the new open file at "path" as variable syntax, ensuring that:

  • The input is properly tokenized and parsed
  • The resulting statement is of type OpenFileStatement
  • Both the path and variable name are correctly extracted

Please run cargo fmt --all to fix the formatting issues flagged by the CI pipeline at lines 162-163 and 182-191.

🧰 Tools
🪛 GitHub Actions: CI

[error] 182-191: Prettier formatting check failed. Code style does not match expected formatting. Run 'cargo fmt --all' to fix.

test.wfl (1)

1-7: Appropriate demonstration of the new file handling syntax

This example workflow demonstrates the new syntax for opening files and assigning the handle to a variable. The commented-out action provides a good example of how this handle could be used for file operations.

Docs/implementation_progress_2025-05-19.md (4)

5-7: Well-documented MSI installer improvements

The documentation clearly describes the addition of .wfl file association and the new MSI build launcher script, which aligns well with the PR objectives.


28-35: Comprehensive technical details for MSI enhancements

The technical details section provides a clear explanation of the file association implementation, including both Open and Edit verbs, which matches the PR objectives.

🧰 Tools
🪛 LanguageTool

[duplication] ~35-~35: Possible typo: you repeated a word.
Context: ...t configuration file is included in the installer - Installer properly updates system PATH variable -...

(ENGLISH_WORD_REPEAT_RULE)


99-159: Build log entries provide good tracking

These build log entries demonstrate successful MSI creation with consistent versioning (2025.6), which helps track implementation progress.


161-169: Well-documented parser enhancement

The documentation clearly explains the parser changes, highlighting both syntactic patterns and the benefits they provide. The entry also mentions the improved error messages and test coverage, which aligns with the changes we see in the code.

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.

2 participants