Skip to content

feat: Add --status <UUID> --output-format links-notation support#47

Merged
konard merged 10 commits intomainfrom
issue-46-db1336ec1bd4
Jan 3, 2026
Merged

feat: Add --status <UUID> --output-format links-notation support#47
konard merged 10 commits intomainfrom
issue-46-db1336ec1bd4

Conversation

@konard
Copy link
Member

@konard konard commented Dec 31, 2025

Summary

This PR implements session ID tracking with UUID validation for command executions, as requested in the comments.

Features Implemented

  • --session-id <uuid> option: Allows specifying a custom UUID v4 for tracking command executions
  • --session-name <uuid> alias: Alternative name for --session-id (same functionality)
  • Auto-generated UUID: When no session ID is provided, a UUID v4 is automatically generated
  • UUID printed on start/end: The session UUID is printed at the beginning and end of command execution
  • Indented Links Notation format: Status output now uses an indented style format:
    <uuid>
      <key> "<value>"
      ...
    
  • Default storage folder: Session data is stored in ~/.start-command by default

Changes

Example Output

$ start echo hello
6dcf4c1b-ff3f-482c-95ab-711ea7d1b019

[2025-01-01 12:00:00] Starting: echo hello

hello

[2025-01-01 12:00:00] Finished
Exit code: 0
Log saved: /tmp/start-command-...

6dcf4c1b-ff3f-482c-95ab-711ea7d1b019

Status Query Output (indented Links Notation)

$ start --status 6dcf4c1b-ff3f-482c-95ab-711ea7d1b019
6dcf4c1b-ff3f-482c-95ab-711ea7d1b019
  uuid "6dcf4c1b-ff3f-482c-95ab-711ea7d1b019"
  status "executed"
  command "echo hello"
  exitCode "0"
  ...

Test plan

  • All existing tests pass
  • New functionality tested with UUID validation
  • Both JS and Rust implementations working
  • CI passing

🤖 Generated with Claude Code

Fixes #46

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

Issue: #46
@konard konard self-assigned this Dec 31, 2025
Implements Issue #46 - Support for querying command execution status
by UUID with configurable output formats.

New features:
- --status <uuid> flag to query status of a previous execution
- --output-format <format> flag to specify output format
- Supported formats: links-notation (default), json, text

The links-notation format outputs each property as a link doublet:
(uuid.property: property "value")

🤖 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] Make sure we have $ --status <UUID> --output-format links-notation support feat: Add --status <UUID> --output-format links-notation support Dec 31, 2025
@konard konard marked this pull request as ready for review December 31, 2025 12:30
konard and others added 3 commits December 31, 2025 13:33
Fixes ESLint no-unused-vars error.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Moved status formatting logic to js/src/lib/status-formatter.js
to keep cli.js under 1000 lines file size limit.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $16.310332 USD
  • Calculated by Anthropic: $11.192157 USD
  • Difference: $-5.118176 (-31.38%)
    📎 Log file uploaded as GitHub Gist (2328KB)
    🔗 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 31, 2025

How about rust version?

@konard konard marked this pull request as draft December 31, 2025 18:23
@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-31T18:23:03.736Z

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 2 commits December 31, 2025 19:29
Implements the same status query functionality in the Rust version that
was already available in the JavaScript version:

- Add --status <uuid> option to query execution status
- Add --output-format <format> option (links-notation, json, text)
- Create status_formatter.rs module for formatting output
- Add comprehensive tests for new options

This brings feature parity between JS and Rust implementations for
querying command execution status.

🤖 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 caught by 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 31, 2025 18:36
@konard
Copy link
Member Author

konard commented Dec 31, 2025

Rust Version Implementation Complete

@konard I have implemented the --status and --output-format support in the Rust version to match the JavaScript implementation.

Changes Made:

  1. rust/src/lib/args_parser.rs: Added parsing for --status and --output-format options with comprehensive validation:

    • --status <uuid> - Query status of a previous execution
    • --output-format <format> - Format: links-notation (default), json, or text
    • Proper error handling for missing arguments, invalid formats, etc.
    • 12 new tests for the status query functionality
  2. rust/src/lib/status_formatter.rs: New module with:

    • format_record_as_links_notation() - Links Notation output
    • format_record_as_text() - Human-readable text output
    • format_record() - Format dispatcher
    • query_status() - Main query function
    • 7 comprehensive tests
  3. rust/src/bin/main.rs: Added:

    • handle_status_query() function
    • Updated usage help with new options and examples

All CI checks are passing:

  • JavaScript CI/CD ✅
  • Rust CI/CD ✅

Usage (both JS and Rust):

# Default format (links-notation)
start --status a1b2c3d4-e5f6-7890-abcd-ef1234567890

# JSON format
start --status a1b2c3d4 --output-format json

# Text format
start --status a1b2c3d4 --output-format text

🤖 Generated with Claude Code

@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $6.923798 USD
  • Calculated by Anthropic: $4.414494 USD
  • Difference: $-2.509304 (-36.24%)
    📎 Log file uploaded as GitHub Gist (924KB)
    🔗 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 31, 2025

Use links notation indented style like:

6dcf4c1b-ff3f-482c-95ab-711ea7d1b019
  uuid "6dcf4c1b-ff3f-482c-95ab-711ea7d1b019"
  status "executed"
  ...

For both storage and display. Make sure lino objects codec supports such a formatting option, if it does not file the issue to its repository.

Also make sure we print UUID on start and end of operation.

We should also automatically generate UUID as session name.

And we should have --session-id option, to make sure we strictly set the UUID manually, and should use it unless it does not yet exists in our application folder like ~/.start-command, where we save .links and .lino files.

We should also have --session-name alias for --session-id.

For both we should check that they are valid UUIDs.

@konard konard marked this pull request as draft December 31, 2025 20:18
@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-31T20:18:39.702Z

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 3 commits December 31, 2025 21:32
- Add --session-id and --session-name (alias) options with UUID validation
- Auto-generate UUID when session ID not provided
- Print session UUID at start and end of command execution
- Change Links Notation output to indented style format:
  <uuid>
    <key> "<value>"
    ...
- Default storage folder to ~/.start-command
- Update tests for new format
- Filed issue #48 for lino-objects-codec indented format support

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Format function parameters according to prettier rules
- Use require('crypto') for proper module import

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduce cli.js file size by extracting version-related functions
to a new version.js module. This brings cli.js under the 1000 line limit.

🤖 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 31, 2025 20:43
@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $15.382515 USD
  • Calculated by Anthropic: $8.990289 USD
  • Difference: $-6.392225 (-41.56%)
    📎 Log file uploaded as GitHub Gist (2171KB)
    🔗 View complete solution draft log

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

@konard konard merged commit 8d0a796 into main Jan 3, 2026
18 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.

Make sure we have $ --status <UUID> --output-format links-notation support

1 participant