mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-25 01:54:49 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
21 lines
675 B
TypeScript
21 lines
675 B
TypeScript
export function formatDuration(secs: number) {
|
|
if (secs <= 0) return ""
|
|
if (secs < 60) return `${secs}s`
|
|
if (secs < 3600) {
|
|
const mins = Math.floor(secs / 60)
|
|
const remaining = secs % 60
|
|
return remaining > 0 ? `${mins}m ${remaining}s` : `${mins}m`
|
|
}
|
|
if (secs < 86400) {
|
|
const hours = Math.floor(secs / 3600)
|
|
const remaining = Math.floor((secs % 3600) / 60)
|
|
return remaining > 0 ? `${hours}h ${remaining}m` : `${hours}h`
|
|
}
|
|
if (secs < 604800) {
|
|
const days = Math.floor(secs / 86400)
|
|
return days === 1 ? "~1 day" : `~${days} days`
|
|
}
|
|
const weeks = Math.floor(secs / 604800)
|
|
return weeks === 1 ? "~1 week" : `~${weeks} weeks`
|
|
}
|