Skip to content

Add exitCode alias for code property#112

Merged
konard merged 6 commits into
mainfrom
issue-36-52b7c0a5
Jun 11, 2026
Merged

Add exitCode alias for code property#112
konard merged 6 commits into
mainfrom
issue-36-52b7c0a5

Conversation

@konard

@konard konard commented Sep 9, 2025

Copy link
Copy Markdown
Member

Summary

  • Added an exitCode alias for the code property across both the JavaScript and Rust implementations (issue Add exitCode alias for code #36).
  • Merged the latest main (monorepo restructure: src/js/src/, tests/js/tests/) into the branch and re-applied the change to the new modular layout.
  • Maintains full backward compatibility — the existing code property is unchanged.

Implementation Details

JavaScript (js/)

  • createResult (js/src/$.result.mjs) now includes exitCode: code.
  • finish() (js/src/$.process-runner-base.mjs) — the single choke point every result passes through before being returned to the user — normalizes exitCode from code, so every execution path (simple commands, pipelines, virtual commands, sequences) exposes the alias without patching dozens of literal result objects.

Rust (rust/)

  • Added CommandResult::exit_code() accessor (rust/src/utils.rs) as the idiomatic alias for the code field, mirroring the JS exitCode alias.

Docs & release

  • Documented the alias in js/README.md and rust/README.md.
  • Added a changeset (js/.changeset/exitcode-alias.md, minor) and a Rust changelog fragment (rust/changelog.d/..., minor).

Test plan

  • js/tests/exitcode-alias.test.mjs — covers basic alias, matching values, success/failure, and pipeline scenarios (5 tests pass).
  • rust/tests/utils.rs::test_command_result_exit_code_alias — verifies exit_code() matches code for success and failure (passes).
  • Core JS suites ($.test.mjs, pipe.test.mjs) pass with no regressions.
  • Language parity check passes (both js/src/** and rust/src/** changed).

🤖 Generated with Claude Code


Resolves #36

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #36
@konard konard self-assigned this Sep 9, 2025
konard and others added 2 commits September 9, 2025 21:07
- Added exitCode as an alias for the code property in all result objects
- Updated createResult function to include exitCode property
- Modified all direct object creations with code property to include exitCode
- Updated virtual command execution path to include exitCode
- Added comprehensive tests for exitCode alias functionality
- Ensures backward compatibility while providing the requested alias

Fixes #36

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add exitCode alias for code Add exitCode alias for code property Sep 9, 2025
@konard konard marked this pull request as ready for review September 9, 2025 18:19
@konard

konard commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Get latest changes from default branch, and ensure everything is applied to both JavaScript and Rust.

@konard konard marked this pull request as draft June 10, 2026 22:21
@konard

konard commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

🤖 AI Work Session Started

Starting automated work session at 2026-06-10T22:21:50.715Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

konard added 2 commits June 10, 2026 22:26
- Resolve monorepo restructure conflict (src/ -> js/src, tests/ -> js/tests)
- JS: add exitCode alias for code in createResult and centralized finish()
- Rust: add CommandResult::exit_code() accessor mirroring the JS alias
- Move exitCode test to js/tests, add Rust parity test
- Add changeset/changelog fragments for both languages
@konard konard marked this pull request as ready for review June 10, 2026 22:27
@konard

konard commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Working session summary

Everything is complete. Here's a summary of the work done on PR #112 for issue #36:

Summary

The PR comment asked to "Get latest changes from default branch, and ensure everything is applied to both JavaScript and Rust." The merge status was DIRTY because main had restructured the repo into a monorepo (src/js/src/, tests/js/tests/) and split the old monolithic src/$.mjs into modular files.

What I did

  1. Merged main into the branch and resolved conflicts:

    • The old src/$.mjs (which my original change targeted) was deleted in main — removed it.
    • Moved the test to the new js/tests/ location.
  2. Re-applied the exitCode alias to the new JavaScript layout:

    • js/src/$.result.mjscreateResult now includes exitCode: code.
    • js/src/$.process-runner-base.mjs — added normalization in finish(), the single choke point every result passes through before being returned to the user. This covers all execution paths (simple commands, pipelines, virtual commands, sequences) cleanly instead of patching dozens of literal result objects.
  3. Added Rust parity (the new requirement):

    • rust/src/utils.rs — added CommandResult::exit_code() accessor as the idiomatic alias for the code field.
  4. Tests, docs, and release fragments:

    • JS test (js/tests/exitcode-alias.test.mjs, 5 tests) + Rust test (test_command_result_exit_code_alias).
    • Documented the alias in both js/README.md and rust/README.md.
    • Added a changeset (minor) and a Rust changelog fragment (minor).

Verification

  • All three CI workflows pass: Language parity check, JavaScript checks, Rust checks (lint/format + tests on Ubuntu/macOS/Windows).
  • Locally verified: JS tests pass, Rust tests pass, cargo fmt --check clean, the parity script passes (both js/src/** and rust/src/** changed), prettier/eslint/jscpd clean.
  • PR is ready for review, merge state CLEAN, working tree clean.

PR: #112


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $2.883328

📊 Context and tokens usage:

  • 70.9K / 1M (7%) input tokens, 21.5K / 128K (17%) output tokens

Total: (4.5K new + 58.0K cache writes + 3.9M cache reads) input tokens, 21.5K output tokens, $2.883328 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.8 (claude-opus-4-8)

📎 Log file uploaded as Gist (1892KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit 8eda90b into main Jun 11, 2026
22 checks passed
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.

Add exitCode alias for code

1 participant