Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ test-results/
.specstory/
chart/chartsmith/*.tgz
.direnv/

# Terraform
**/.terraform/
**/.terraform.lock.hcl
**/terraform.tfvars
**/terraform.tfstate
**/terraform.tfstate.backup
**/.terraform.tfvars.backup
56 changes: 0 additions & 56 deletions .stignore

This file was deleted.

12 changes: 0 additions & 12 deletions CLAUDE.md

This file was deleted.

28 changes: 14 additions & 14 deletions cmd/artifacthub.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func runArtifactHubCache(ctx context.Context, pgURI string, force bool, verbose
if err != nil && err != pgx.ErrNoRows {
return fmt.Errorf("failed to get last updated time: %w", err)
}

if lastUpdated.Valid {
// If cache was updated in the last 6 hours, skip
if time.Since(lastUpdated.Time) < 6*time.Hour {
Expand Down Expand Up @@ -136,7 +136,7 @@ func runArtifactHubCache(ctx context.Context, pgURI string, force bool, verbose
if err != nil {
return fmt.Errorf("failed to drop artifacthub_chart table: %w", err)
}

_, err = tx.Exec(ctx, `
CREATE TABLE artifacthub_chart (
id TEXT PRIMARY KEY,
Expand Down Expand Up @@ -186,32 +186,32 @@ func runArtifactHubCache(ctx context.Context, pgURI string, force bool, verbose
// Insert new data
batchSize := 1000
inserted := 0

// Use a map to deduplicate packages with the same name+version
deduplicated := make(map[string]HarborPackage)
for _, pkg := range packages {
key := fmt.Sprintf("%s-%s", pkg.Package, pkg.Version)
deduplicated[key] = pkg
}

// Convert back to slice for batch processing
uniquePackages := make([]HarborPackage, 0, len(deduplicated))
for _, pkg := range deduplicated {
uniquePackages = append(uniquePackages, pkg)
}

// Group packages by name to get the latest version
chartsByName := make(map[string][]HarborPackage)
for _, pkg := range uniquePackages {
chartsByName[pkg.Package] = append(chartsByName[pkg.Package], pkg)
}

if verbose {
logger.Debug(fmt.Sprintf("Found %d unique chart names after deduplication", len(chartsByName)))
logger.Debug(fmt.Sprintf("Processing %d unique packages (removed %d duplicates)",
len(uniquePackages), len(packages) - len(uniquePackages)))
logger.Debug(fmt.Sprintf("Processing %d unique packages (removed %d duplicates)",
len(uniquePackages), len(packages)-len(uniquePackages)))
}

// Process in batches to avoid memory issues
for _, batch := range createBatches(uniquePackages, batchSize) {
_, err = tx.CopyFrom(
Expand All @@ -231,11 +231,11 @@ func runArtifactHubCache(ctx context.Context, pgURI string, force bool, verbose
}, nil
}),
)

if err != nil {
return fmt.Errorf("failed to insert chart data batch: %w", err)
}

inserted += len(batch)
if verbose {
logger.Debug(fmt.Sprintf("Inserted %d/%d unique packages", inserted, len(uniquePackages)))
Expand Down Expand Up @@ -264,14 +264,14 @@ func runArtifactHubCache(ctx context.Context, pgURI string, force bool, verbose

func createBatches(items []HarborPackage, batchSize int) [][]HarborPackage {
var batches [][]HarborPackage

for i := 0; i < len(items); i += batchSize {
end := i + batchSize
if end > len(items) {
end = len(items)
}
batches = append(batches, items[i:end])
}

return batches
}
}
4 changes: 2 additions & 2 deletions cmd/debug-console.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func DebugConsoleCmd() *cobra.Command {
var workspaceID string
var nonInteractive bool

cmd := &cobra.Command{
Use: "debug-console [command] [flags]",
Short: "Interactive debug console for chartsmith",
Expand Down Expand Up @@ -71,7 +71,7 @@ Examples:
return debugcli.RunConsole(opts)
},
}

// Add flags
cmd.Flags().StringVar(&workspaceID, "workspace-id", "", "Workspace ID to use for commands")

Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func runWorker(ctx context.Context, pgURI string) error {
// Start the connection heartbeat before starting the listeners
// This ensures our connections stay alive even during idle periods
listener.StartHeartbeat(ctx)

if err := listener.StartListeners(ctx); err != nil {
return fmt.Errorf("failed to start listeners: %w", err)
}
Expand Down
12 changes: 0 additions & 12 deletions design/convert-k8s-to-helm/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions design/post-plan-render/README.md

This file was deleted.

Loading