Skip to content

feat(js): add currentTime to --status output for executing commands#106

Merged
konard merged 2 commits intomainfrom
issue-105-0edd650b7149
Apr 23, 2026
Merged

feat(js): add currentTime to --status output for executing commands#106
konard merged 2 commits intomainfrom
issue-105-0edd650b7149

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Apr 23, 2026

Summary

Closes #105.

When $ --status <uuid-or-session> is called for a command that is still executing, the output now includes a new currentTime field next to startTime. This makes it trivial to see how long a command has been running (just subtract startTime from currentTime).

Before

4854c1e6-be73-4dd5-8c3a-ff6c8a854993
  uuid 4854c1e6-...
  status executing
  command "solve https://github.com/..."
  logPath /tmp/.../4854c1e6-...log
  startTime "2026-04-23T10:02:57.786Z"
  workingDirectory /home/box

After

4854c1e6-be73-4dd5-8c3a-ff6c8a854993
  uuid 4854c1e6-...
  status executing
  command "solve https://github.com/..."
  logPath /tmp/.../4854c1e6-...log
  startTime "2026-04-23T10:02:57.786Z"
  currentTime "2026-04-23T10:10:13.042Z"
  workingDirectory /home/box

currentTime is only added when the status is executing; for finished executions the output is unchanged (endTime already reflects completion).

Changes

  • js/src/lib/status-formatter.js: new attachCurrentTime() helper that wraps the enriched record and augments its toObject() to include currentTime right after startTime. Wired into queryStatus() so all three formats (links-notation, JSON, text) benefit.
  • js/test/status-query.test.js: integration tests covering all three formats — executing records include currentTime, completed records do not.
  • js/test/session-name-status.test.js: unit tests for attachCurrentTime() (executing vs executed, non-mutation, key ordering, null input).
  • js/.changeset/issue-105-current-time.md: patch changeset.

Test plan

  • bun test test/status-query.test.js test/session-name-status.test.js → 32/32 pass, 90 expect() calls
  • bun run lint → clean
  • bun run format:check → clean
  • Manual CLI check with an executing record:
    • --status <uuid> (default links-notation) includes currentTime "..."
    • --status <uuid> --output-format json includes "currentTime": "..."
    • --status <uuid> --output-format text includes Current Time: ...
  • Manual CLI check with a completed record: currentTime / Current Time: absent in all formats.

Reproducing the issue

Create or attach to a long-running command (e.g. $ --isolated screen -d -s my-session -- solve ...) and repeatedly run $ --status my-session. Before this PR the output only shows startTime, so you have to read the clock yourself; after this PR it shows both, so elapsed time is obvious.

Note: the 2 pre-existing failures in test/args-parser.test.js (regex /requires a UUID argument/) are unrelated — they exist on main because an earlier commit changed the error message to "UUID or session name" without updating the expected regex in the test.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #105
@konard konard self-assigned this Apr 23, 2026
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-04-23T10:41:17.173Z

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.

Adds a `currentTime` field to the `--status` output (links-notation,
JSON, and text) whenever the execution is still `executing`. This
surfaces the moment the query was made so users can easily compute how
long a command has been running from `startTime`, which is what issue
#105 asks for.

Resolves #105
@konard konard changed the title [WIP] Add support for currentTime, when status executing, so it will be visible what is current time of call of $ --status 8b4d5df0-5a24-4af6-b159-a035463aac68 feat(js): add currentTime to --status output for executing commands Apr 23, 2026
@konard konard marked this pull request as ready for review April 23, 2026 10:50
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

Solution summary

PR is ready for review. Summary:


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

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

🤖 Solution Draft Log

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

💰 Cost: $6.260347

📊 Context and tokens usage:

  • 126.2K / 1M (13%) input tokens, 27.0K / 128K (21%) output tokens

Total: (176.8K + 9.0M cached) input tokens, 27.0K output tokens, $6.260347 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (2380KB)


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

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

✅ 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
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-04-23T11:53:04.672Z

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 a commit that referenced this pull request Apr 23, 2026
Mirrors the JS change from PR #106. When `--status <uuid-or-session>`
is called for a command whose status is `executing`, all three output
formats (links-notation, JSON, text) now include a `currentTime`
field/line right after `startTime`/`Start Time:`. This surfaces the
moment the query was made so users can easily compute how long a
command has been running.

Completed executions are unchanged — `endTime` already reflects
completion, and `currentTime` is not attached.

- `rust/src/lib/status_formatter.rs`: new `attach_current_time()`
  helper plus `_with_current_time` variants of the three formatters.
  `query_status()` now wires the timestamp through to all formats.
- `rust/src/lib/mod.rs`: re-export the new helpers.
- `rust/tests/status_formatter_test.rs`: 10 new unit tests for the
  formatter variants and JSON/links-notation/text output shape.
- `rust/tests/session_name_status_test.rs`: 9 new integration tests
  for `query_status` across all three formats, plus direct
  `attach_current_time` behavior.
- `rust/changelog.d/105.md`: changelog fragment.

Fixes #105
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 23, 2026

Solution summary

All CI checks pass:

  • Test (macos-latest): pass
  • Test (ubuntu-latest): pass
  • Test (windows-latest): pass
  • Code Coverage: pass
  • Lint and Format Check: pass
  • Changelog Fragment Check: pass
  • Test Count Parity (Rust vs JS): pass

Build/Auto/Manual Release are skipping (normal for non-main PRs).

PR #107 is ready: #107

Summary of what was done:

  • Issue: Add support for currentTime, when status executing, so it will be visible what is current time of call of $ --status 8b4d5df0-5a24-4af6-b159-a035463aac68 #105 had a follow-up comment asking for the Rust implementation of the currentTime feature that was already merged in JS via PR feat(js): add currentTime to --status output for executing commands #106.
  • Implementation (rust/src/lib/status_formatter.rs):
    • Added attach_current_time() helper that returns Some(Utc::now()) for executing records and None for completed ones.
    • Added _with_current_time variants of all three formatters (format_record_as_links_notation, format_record_as_text, format_record).
    • query_status() now wires the timestamp through to all three formats, inserting currentTime right after startTime in links-notation and right after Start Time: in text.
    • Re-exported new helpers in rust/src/lib/mod.rs.
  • Tests (19 new tests, all passing):
    • rust/tests/status_formatter_test.rs: 10 unit tests covering JSON/links/text variants, placement ordering, and no-op paths.
    • rust/tests/session_name_status_test.rs: 9 integration tests through query_status and direct attach_current_time behavior including mutation safety.
  • Changelog: rust/changelog.d/105.md (feat → minor bump).
  • Manual verification: launched a detached sleep 200 via screen; confirmed all three output formats show currentTime/Current Time: for executing records and omit it for completed ones.
  • CI: all checks pass (mac/linux/windows tests, code coverage, lint/format, changelog, version, test parity). PR: feat(rust): add currentTime to --status output for executing commands #107

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant