Skip to content

Commit f8ccc00

Browse files
committed
fix: finalize v1.0.0 release
1 parent 1557a9c commit f8ccc00

3 files changed

Lines changed: 16 additions & 50 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Example shape:
104104
"status": "complete",
105105
"primary_provider": "ollama",
106106
"path": "/Users/you/.ollama/models/blobs/sha256-...",
107-
"created_at": "2026-04-08T09:15:00+02:00",
107+
"timestamp": "2026-04-08T09:15:00+02:00",
108108
"file_count": 1,
109109
"all_paths": [
110110
"/Users/you/.ollama/models/blobs/sha256-..."

internal/scan/scan.go

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10-
"reflect"
1110
"sort"
1211
"strings"
13-
"syscall"
1412
"time"
1513

1614
"weightless/internal/providers"
@@ -59,7 +57,7 @@ type Artifact struct {
5957
CanonicalPath string `json:"canonical_path"`
6058
SizeBytes int64 `json:"size_bytes"`
6159
SizeHuman string `json:"size_human"`
62-
CreatedAt string `json:"created_at,omitempty"`
60+
Timestamp string `json:"timestamp,omitempty"`
6361
FileCount int `json:"file_count,omitempty"`
6462
Matches []Match `json:"matches"`
6563
AllPaths []string `json:"all_paths"`
@@ -656,7 +654,7 @@ func buildAggregateArtifact(groupPath, modelName string, items []Artifact) Artif
656654
aggregate.OwnerReferences = collectOwners(items)
657655
aggregate.Notes = collectNotes(items)
658656
aggregate.Status = aggregateStatus(items)
659-
aggregate.CreatedAt = aggregateCreatedAt(groupPath, items)
657+
aggregate.Timestamp = aggregateTimestamp(groupPath, items)
660658
aggregate.CanonicalMissing = false
661659
for _, item := range items {
662660
aggregate.SizeBytes += item.SizeBytes
@@ -666,16 +664,16 @@ func buildAggregateArtifact(groupPath, modelName string, items []Artifact) Artif
666664
return aggregate
667665
}
668666

669-
func aggregateCreatedAt(groupPath string, items []Artifact) string {
670-
if createdAt := inferCreatedAt(groupPath); createdAt != "" {
671-
return createdAt
667+
func aggregateTimestamp(groupPath string, items []Artifact) string {
668+
if timestamp := inferTimestamp(groupPath); timestamp != "" {
669+
return timestamp
672670
}
673671
var earliest time.Time
674672
found := false
675673
for _, item := range items {
676-
current := item.CreatedAt
674+
current := item.Timestamp
677675
if current == "" {
678-
current = inferCreatedAt(item.Path)
676+
current = inferTimestamp(item.Path)
679677
}
680678
if current == "" {
681679
continue
@@ -1055,7 +1053,7 @@ func finalizeArtifacts(artifacts []Artifact) {
10551053
artifacts[idx].Status = inferStatus(artifacts[idx])
10561054
artifacts[idx].ModelName = displayModelName(inferModelName(artifacts[idx]))
10571055
artifacts[idx].Name = artifacts[idx].ModelName
1058-
artifacts[idx].CreatedAt = inferCreatedAt(artifacts[idx].Path)
1056+
artifacts[idx].Timestamp = inferTimestamp(artifacts[idx].Path)
10591057
if artifacts[idx].Name == "" {
10601058
artifacts[idx].Name = trimKnownExtensions(artifacts[idx].FileName)
10611059
}
@@ -1332,58 +1330,26 @@ func trimKnownExtensions(name string) string {
13321330
return out
13331331
}
13341332

1335-
func inferCreatedAt(path string) string {
1336-
createdAt, ok := fileCreatedAt(path)
1333+
func inferTimestamp(path string) string {
1334+
timestamp, ok := fileTimestamp(path)
13371335
if !ok {
13381336
return ""
13391337
}
1340-
return createdAt.Format(time.RFC3339)
1338+
return timestamp.Format(time.RFC3339)
13411339
}
13421340

1343-
func fileCreatedAt(path string) (time.Time, bool) {
1341+
func fileTimestamp(path string) (time.Time, bool) {
13441342
info, err := os.Stat(path)
13451343
if err != nil {
13461344
return time.Time{}, false
13471345
}
1348-
if createdAt, ok := birthTimeFromFileInfo(info); ok {
1349-
return createdAt, true
1350-
}
13511346
modifiedAt := info.ModTime()
13521347
if modifiedAt.IsZero() {
13531348
return time.Time{}, false
13541349
}
13551350
return modifiedAt, true
13561351
}
13571352

1358-
func birthTimeFromFileInfo(info fs.FileInfo) (time.Time, bool) {
1359-
sys, ok := info.Sys().(*syscall.Stat_t)
1360-
if !ok || sys == nil {
1361-
return time.Time{}, false
1362-
}
1363-
value := reflect.ValueOf(sys)
1364-
if value.Kind() == reflect.Ptr {
1365-
value = value.Elem()
1366-
}
1367-
for _, fieldName := range []string{"Birthtimespec", "Birthtim", "Btim"} {
1368-
field := value.FieldByName(fieldName)
1369-
if !field.IsValid() {
1370-
continue
1371-
}
1372-
secField := field.FieldByName("Sec")
1373-
nsecField := field.FieldByName("Nsec")
1374-
if !secField.IsValid() || !nsecField.IsValid() {
1375-
continue
1376-
}
1377-
sec := secField.Int()
1378-
nsec := nsecField.Int()
1379-
if sec == 0 && nsec == 0 {
1380-
continue
1381-
}
1382-
return time.Unix(sec, nsec), true
1383-
}
1384-
return time.Time{}, false
1385-
}
1386-
13871353
func humanizeOwners(owners []string) []string {
13881354
out := make([]string, 0, len(owners))
13891355
for _, owner := range owners {

internal/tui/model.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func buildTables(base scan.Report, report scan.Report, width int, providerFilter
350350
item.Name,
351351
item.SizeHuman,
352352
item.PrimaryProvider,
353-
displayCreatedAt(item.CreatedAt),
353+
displayTimestamp(item.Timestamp),
354354
displayPath,
355355
})
356356
tabPaths = append(tabPaths, item.Path)
@@ -397,7 +397,7 @@ func artifactColumns(width int, drilled bool) []table.Column {
397397
{Title: "Name", Width: nameWidth},
398398
{Title: "Size", Width: 10},
399399
{Title: "Provider", Width: 12},
400-
{Title: "Created", Width: 12},
400+
{Title: "Timestamp", Width: 12},
401401
{Title: "Path", Width: pathWidth},
402402
}
403403
}
@@ -640,7 +640,7 @@ func openCommand(target string) *exec.Cmd {
640640
}
641641
}
642642

643-
func displayCreatedAt(value string) string {
643+
func displayTimestamp(value string) string {
644644
if strings.TrimSpace(value) == "" {
645645
return "-"
646646
}

0 commit comments

Comments
 (0)