Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Dec 29, 2025

Summary

This PR translates the JavaScript start-command package to Rust, creating a complete Rust implementation that mirrors the JavaScript API. It also reorganizes the repository structure per feedback.

Changes

Rust Implementation

  • Complete translation of all JavaScript modules to Rust:
    • args_parser.rs - Command-line argument parsing
    • substitution.rs - Natural language command substitution engine
    • user_manager.rs - User creation/isolation management (cross-platform)
    • isolation.rs - Command isolation with logging
    • failure_handler.rs - Git clone suggestions on command failure
    • mod.rs - Public library interface

Repository Structure (per feedback)

  • Moved scripts/ and experiments/ to root - Shared between JS and Rust implementations
  • Created rust/tests/ folder - Integration tests for Rust implementation
  • Separated CI workflows - js.yml and rust.yml instead of single release.yml

CI/CD Workflows

  • js.yml - JavaScript CI/CD with detect-changes, changeset check, lint, test, and release jobs
  • rust.yml - Rust CI/CD with detect-changes, changelog check, lint, test, build, and release jobs
  • Both workflows use shared scripts from the root scripts/ folder

Rust Features

  • 42 unit tests + 10 integration tests passing on Linux, macOS, and Windows
  • Cross-platform support with platform-specific fallbacks
  • Debug mode via START_DEBUG=1 environment variable

Files Changed

  • Created: rust/tests/integration_test.rs
  • Created: .github/workflows/rust.yml
  • Renamed: .github/workflows/release.yml.github/workflows/js.yml
  • Moved: js/scripts/*scripts/
  • Moved: js/experiments/*experiments/
  • Created: changelog.d/README.md (Rust changelog fragments)
  • Added scripts: bump-version.mjs, collect-changelog.mjs, detect-code-changes.mjs, get-bump-type.mjs, merge-changesets.mjs

Test plan

  • All 52 Rust tests pass on Ubuntu, macOS, and Windows
  • JavaScript tests pass
  • Both CI workflows (js.yml and rust.yml) pass
  • cargo build --release produces working binary

Fixes #38

🤖 Generated with Claude Code

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

Issue: #38
@konard konard self-assigned this Dec 29, 2025
konard and others added 2 commits December 29, 2025 13:35
Move all JavaScript source files, tests, scripts, and experiments
into a dedicated js/ folder to prepare for Rust implementation.

- Move src/ to js/src/
- Move test/ to js/test/
- Move scripts/ to js/scripts/
- Move experiments/ to js/experiments/
- Update package.json paths
- Update eslint.config.mjs paths
- Disable no-unused-vars for test and experiment files

This prepares the codebase for adding a parallel Rust implementation
in a rust/ folder.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Translate the JavaScript CLI tool to Rust with full feature parity:
- args_parser.rs: Command-line argument parsing
- substitution.rs: Natural language command substitution (.lino files)
- user_manager.rs: User isolation management
- isolation.rs: Process isolation (screen, tmux, docker, ssh)
- failure_handler.rs: GitHub issue auto-reporting

All 42 unit tests pass. The Rust implementation maintains
simplicity and correctness as requested, avoiding premature
optimizations.

Also includes case study documentation in docs/case-studies/issue-38/

Closes #38

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Add Rust code translation feat: Add Rust code translation of start-command CLI Dec 29, 2025
konard and others added 3 commits December 29, 2025 13:54
Update all script and source file paths in the GitHub Actions workflow
to point to the new js/ directory structure:
- scripts/*.mjs → js/scripts/*.mjs
- src/bin/cli.js → js/src/bin/cli.js
- test/*.test.js → js/test/*.test.js

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 29, 2025 12:58
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $12.575057 USD
  • Calculated by Anthropic: $9.071136 USD
  • Difference: $-3.503922 (-27.86%)
    📎 Log file uploaded as GitHub Gist (1473KB)
    🔗 View complete solution draft log

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

@konard
Copy link
Member Author

konard commented Dec 29, 2025

Please double check tree of files, we still have some JavaScript related files that are left in the root of the repository. I want clear separation, JavaScript related files go to ./js folder, and Rust related files go to ./rust folder (src, tests + project files). Experiments, examples and scripts can be kept at the root of repository.

Ensure all changes are correct, consistent and fully meet the requirements.

@konard konard marked this pull request as draft December 29, 2025 19:06
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-29T19:06:27.252Z

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 working session to finish, and provide your feedback.

Move all JavaScript-related configuration files into the js/ folder
for cleaner separation between JS and Rust implementations:

- Move package.json, package-lock.json, bun.lock to js/
- Move eslint.config.mjs, .prettierrc, .prettierignore to js/
- Move bunfig.toml to js/
- Move .changeset/ to js/
- Update .husky/pre-commit to cd into js/ before running lint-staged
- Update CI workflow with working-directory: js for all JS-related steps
- Update package.json paths to be relative to js/ folder
- Fix cli.js package.json import path

.husky/ remains at root as it needs to be in the git hooks location.
All JavaScript tests pass (22/22). Rust tests pass (42/42).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 29, 2025 19:21
@konard
Copy link
Member Author

konard commented Dec 29, 2025

Changes Made

I've addressed the feedback about JavaScript files remaining at the repository root. Here's what was moved:

Files moved to js/ folder:

  • package.jsonjs/package.json
  • package-lock.jsonjs/package-lock.json
  • bun.lockjs/bun.lock
  • bunfig.tomljs/bunfig.toml
  • eslint.config.mjsjs/eslint.config.mjs
  • .prettierrcjs/.prettierrc
  • .prettierignorejs/.prettierignore
  • .changeset/js/.changeset/

Repository structure now:

.
├── .github/workflows/    # CI/CD workflows
├── .husky/               # Git hooks (must be at root for git)
├── docs/                 # Documentation
├── js/                   # All JavaScript implementation
│   ├── .changeset/       # Changeset config
│   ├── src/              # Source code
│   ├── test/             # Tests
│   ├── scripts/          # Build/release scripts
│   ├── experiments/      # Experiments
│   ├── package.json      # npm package config
│   └── (other JS configs)
├── rust/                 # All Rust implementation
│   ├── src/              # Source code
│   └── Cargo.toml        # Cargo config
├── ARCHITECTURE.md
├── CHANGELOG.md
├── LICENSE
├── README.md
└── REQUIREMENTS.md

Updates made:

  • Updated CI workflow with working-directory: js for all JS-related steps
  • Updated .husky/pre-commit to cd js && npx lint-staged
  • Updated package.json paths to be relative to js/ folder
  • Fixed cli.js package.json import path

All tests pass:

  • JavaScript: 22/22 tests ✅
  • Rust: 42/42 tests ✅
  • CI: All checks passing ✅

🤖 Generated with Claude Code

@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $6.680987 USD
  • Calculated by Anthropic: $4.172269 USD
  • Difference: $-2.508718 (-37.55%)
    📎 Log file uploaded as GitHub Gist (790KB)
    🔗 View complete solution draft log

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

@konard
Copy link
Member Author

konard commented Dec 29, 2025

I asked to keep these in the root of repository:

│   ├── scripts/          # Build/release scripts
│   ├── experiments/      # Experiments

Also rust version should have it's own tests.

Also for Rust we should have https://github.com/link-foundation/rust-ai-driven-development-pipeline-template used, (scripts) will be shared with https://github.com/link-foundation/js-ai-driven-development-pipeline-template.

But instead of single release.yml, we now should have js.yml and rust.yml workflows.

@konard konard marked this pull request as draft December 29, 2025 19:55
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-29T19:55:24.471Z

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 working session to finish, and provide your feedback.

konard and others added 6 commits December 29, 2025 21:10
Changes:
- Move scripts/ and experiments/ to repository root (shared)
- Add separate js.yml and rust.yml workflows
- Remove single release.yml in favor of language-specific workflows
- Add Rust integration tests in rust/tests/
- Add changelog.d/ for Rust changelog fragments
- Update js/package.json paths to reference root scripts
- Update scripts to support --working-dir and --type parameters

Repository structure:
- js/: JavaScript implementation
- rust/: Rust implementation with src/, tests/
- scripts/: Shared CI/CD scripts
- experiments/: Shared experiments
- changelog.d/: Rust changelog fragments
- .github/workflows/: js.yml and rust.yml

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply cargo fmt to fix formatting issues that were caught by CI.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Fix unused variable warnings (prefix with underscore)
- Replace map_or with is_ok_and for better idiomatic code
- Add #[derive(Default)] where appropriate instead of manual impl
- Remove redundant trim() before split_whitespace()
- Use next_back() instead of last() on DoubleEndedIterator
- Use iter().flatten() instead of manual if let pattern

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Skip test_get_current_user_groups on Windows since `groups` command is Unix-specific
- Add admin/staff groups to test_group_exists check for macOS compatibility

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Try getent first (Linux-specific)
- Fall back to dscl command for macOS support
- This fixes the test_group_exists failure on macOS CI

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 29, 2025 20:34
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:


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

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 Rust code translation

2 participants