Skip to content

runtime/hints: add since() helper for hint templates - #48

Merged
raphael merged 1 commit into
mainfrom
runtime-hints-since
Dec 30, 2025
Merged

raphael merged 1 commit into
mainfrom
runtime-hints-since

Conversation

@raphael

@raphael raphael commented Dec 30, 2025

Copy link
Copy Markdown
Member

Summary

Add a generic since(from,to) function to the hint template FuncMap that returns the number of seconds between two timestamps (to - from). This enables downstream services to conditionally show duration-aware hints (e.g., "this may take a minute" for windows exceeding 6 months).

Changes

  • runtime/agent/runtime/hints/hints.go: Add since helper + parseTimestamp supporting RFC3339 strings and time.Time values
  • runtime/agent/runtime/hints/hints_test.go: Table-driven tests for since via CompileHintTemplates
  • AGENTS.md: Expand repo-wide coding guidelines

Example usage

{{if gt (since .From .To) 15552000}} — this may take a minute{{end}}

Test evidence

  • make lint ✅
  • make test ✅

Add a generic since(from,to) function to the hint template FuncMap that
returns the number of seconds between two timestamps (to - from). This
enables downstream services to conditionally show duration-aware hints
(e.g., 'this may take a minute' for windows exceeding 6 months).

The helper accepts RFC3339 strings and time.Time values, returning 0 on
parse failure so hint rendering can proceed gracefully.

Also expands AGENTS.md with repo-wide coding guidelines.
@raphael
raphael enabled auto-merge (squash) December 30, 2025 00:57
@raphael
raphael merged commit c08d282 into main Dec 30, 2025
2 checks passed
@raphael
raphael deleted the runtime-hints-since branch December 30, 2025 01:01
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.

1 participant