Skip to content

Feat/stdlib fs env format - #149

Merged
hyperpolymath merged 4 commits into
mainfrom
feat/stdlib-fs-env-format
Jul 29, 2026
Merged

Feat/stdlib fs env format#149
hyperpolymath merged 4 commits into
mainfrom
feat/stdlib-fs-env-format

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (would change existing behaviour)
  • 🕳️ Soundness fix (fixes a checker/proof false-negative)
  • 📖 Documentation
  • 🧹 Refactor / tech debt (behaviour-preserving)
  • ⚡ Performance
  • 🔧 Build / CI / tooling

How has this been verified?

Checklist

  • My commits are signed (git commit -S).
  • I ran the project's own checks/tests locally and they pass.
  • New files carry the correct SPDX-License-Identifier (code/config MPL-2.0,
    prose CC-BY-SA-4.0); I did not relicense existing files.
  • Docs are updated, and no public claim now overstates what the code does.
  • I have not introduced a soundness hole (or I have flagged where I might have).

Notes for reviewers


Summary by Gitar

  • New Standard Library Functions:
    • Added file system builtins fs_write_file, fs_read_file, fs_create_dir_all, and fs_exists in crates/my-lang/src/stdlib.rs
    • Added env_args() and positional placeholder format() builtins in crates/my-lang/src/stdlib.rs
  • CLI Enhancements:
    • Added trailing argument forwarding support to my-cli Run command to propagate -- arguments to env_args()
  • Documentation & Website:
    • Added SSG configuration, site templates, and default landing page assets

This will update automatically on new commits.

hyperpolymath and others added 3 commits April 30, 2026 15:30
Six new stdlib builtins for tooling workloads:
  - fs_write_file / fs_read_file / fs_create_dir_all / fs_exists
  - env_args (host-supplied with std::env::args().skip(1) fallback)
  - format (positional {} substitution, {{ }} escapes)

Plus PROGRAM_ARGS OnceLock + pub fn set_program_args, and my-cli's Run
subcommand grows a trailing_var_arg field forwarded to set_program_args.

Validated by an end-to-end run of an out-of-tree scaffold tool against
six idaptik-port component repos.

See PR body for details and open design questions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread _site/index.html
Comment thread CONTRIBUTING.md
Comment thread crates/my-lang/src/stdlib.rs
Comment thread crates/my-lang/src/stdlib.rs
@gitar-bot

gitar-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

Note

Automatic reviews are paused because your trial's included automatic processing has been used for this period. Upgrade now, or comment "Gitar review" to run a review anytime.
Learn more

Code Review ✅ Approved 4 resolved / 4 findings

Adds standard library file system, formatting, and argument builtins along with CLI argument forwarding. Consider adding unit tests for the new builtins and excluding generated site output from version control.

Auto-approved and auto-merge armed: No blocking issues found.
Please see Auto-approve Docs for details on setting custom approval criteria. — merges when pipeline and required approvals pass.

✅ 4 resolved
Quality: Generated site output and duplicate CSS committed to repo

📄 _site/index.html:1-15 📄 _site/assets/style.css:1-15 📄 assets/style.css:1 📄 templates/modern.css:1
This PR (titled for stdlib fs/env/format builtins) also commits generated static-site output: _site/index.html, _site/assets/style.css, plus three byte-identical 303-line stylesheets (_site/assets/style.css, assets/style.css, templates/modern.css). Generated _site/ artifacts should be produced by the build and git-ignored, not tracked, and the triplicated CSS creates a maintenance hazard where edits must be kept in sync. Consider gitignoring _site/ and deduplicating the stylesheet to a single source.

Quality: Invalid SPDX identifier MPL-2.0-or-later in CONTRIBUTING.md

📄 CONTRIBUTING.md:1
CONTRIBUTING.md adds SPDX-License-Identifier: MPL-2.0-or-later, which is not a valid SPDX identifier (the SPDX license list defines MPL-2.0 and MPL-2.0-no-copyleft-exception; there is no -or-later variant). This also contradicts the PR's own checklist which specifies MPL-2.0 for code/config. Automated SPDX/REUSE tooling will reject this tag. Change it to MPL-2.0.

Edge Case: env_args() leaks host argv when embedder omits set_program_args

📄 crates/my-lang/src/stdlib.rs:14-20 📄 crates/my-lang/src/stdlib.rs:1481-1485
When a program is run through an embedder (not my-cli) that never calls set_program_args, env_args() falls back to std::env::args().skip(1), exposing the host process's command-line arguments to the guest program. Because PROGRAM_ARGS is a OnceLock (first-call-wins), an embedder that runs multiple programs in one process also cannot reset args between runs — the second program sees the first program's argv. If this fallback is undesirable for embedders, consider defaulting to an empty list unless args are explicitly provided, and document the single-shot limitation.

Quality: New format/fs/env_args builtins have no tests

📄 crates/my-lang/src/stdlib.rs:385-399 📄 crates/my-lang/src/stdlib.rs:1376-1390 📄 crates/my-lang/src/stdlib.rs:1471-1485
The new format, fs_write_file, fs_read_file, fs_create_dir_all, fs_exists, and env_args builtins ship without unit tests. Notably format's escape handling ({{, }}, {}), the not-enough-args error path, and the extra-args-silently-ignored behavior are easy to regress. Add tests covering escaped braces, placeholder/arg count mismatches, and non-string value formatting.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot

gitar-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ Gitar auto-approved this PR but could not enable auto-merge: auto-merge is disabled for this repository — enable "Allow auto-merge" in the repository settings.

@gitar-bot gitar-bot 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.

Gitar has auto-approved this PR and enabled auto-merge (configure)

@gitar-bot gitar-bot Bot added the gitar-approved Added by Gitar label Jul 29, 2026
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
@hyperpolymath
hyperpolymath merged commit 0b8042d into main Jul 29, 2026
21 checks passed
@hyperpolymath
hyperpolymath deleted the feat/stdlib-fs-env-format branch July 29, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gitar-approved Added by Gitar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant