Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
1.8 KiB
Go
61 lines
1.8 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/steveyegge/beads/internal/beads"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
// issueIDCompletion provides shell completion for issue IDs by querying the storage
|
|
// and returning a list of IDs with their titles as descriptions
|
|
func issueIDCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
|
// Initialize storage if not already initialized
|
|
ctx := context.Background()
|
|
if rootCtx != nil {
|
|
ctx = rootCtx
|
|
}
|
|
|
|
// Get database path - use same logic as in PersistentPreRun
|
|
currentDBPath := dbPath
|
|
if currentDBPath == "" {
|
|
currentDBPath = beads.FindDatabasePath()
|
|
if currentDBPath == "" {
|
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
|
}
|
|
}
|
|
|
|
// Open database if store is not initialized
|
|
currentStore := store
|
|
if currentStore == nil {
|
|
var err error
|
|
currentStore, err = openReadOnlyStoreForDBPath(ctx, currentDBPath)
|
|
if err != nil {
|
|
// If we can't open database, return empty completion
|
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
|
}
|
|
defer func() { _ = currentStore.Close() }()
|
|
}
|
|
|
|
// Use SearchIssues with IDPrefix filter to efficiently query matching issues
|
|
filter := types.IssueFilter{
|
|
IDPrefix: toComplete, // Filter at database level for better performance
|
|
}
|
|
issues, err := currentStore.SearchIssues(ctx, "", filter)
|
|
if err != nil {
|
|
// If we can't list issues, return empty completion
|
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
|
}
|
|
|
|
// Build completion list
|
|
completions := make([]string, 0, len(issues))
|
|
for _, issue := range issues {
|
|
// Format: ID\tTitle (shown during completion)
|
|
completions = append(completions, fmt.Sprintf("%s\t%s", issue.ID, issue.Title))
|
|
}
|
|
|
|
return completions, cobra.ShellCompDirectiveNoFileComp
|
|
}
|