feat(import): add import.orphan_handling config with 4 modes
- Add GetOrphanHandling() helper to SQLiteStorage (reads from config table) - Add --orphan-handling flag to 'bd import' command - Wire OrphanHandling through ImportOptions -> importer.Options - Auto-read config if flag not provided (default: 'allow') - Document in CONFIG.md with detailed mode explanations Modes: - strict: Fail on missing parent (safest) - resurrect: Auto-create parent tombstones from JSONL - skip: Skip orphans with warning - allow: Import without validation (default, most permissive) Closes bd-8072, bd-b92a Amp-Thread-ID: https://ampcode.com/threads/T-fd18d4a5-06b3-4400-9073-194d570846d8 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -158,11 +158,12 @@ func issueDataChanged(existing *types.Issue, updates map[string]interface{}) boo
|
||||
|
||||
// ImportOptions configures how the import behaves
|
||||
type ImportOptions struct {
|
||||
DryRun bool // Preview changes without applying them
|
||||
SkipUpdate bool // Skip updating existing issues (create-only mode)
|
||||
Strict bool // Fail on any error (dependencies, labels, etc.)
|
||||
RenameOnImport bool // Rename imported issues to match database prefix
|
||||
DryRun bool // Preview changes without applying them
|
||||
SkipUpdate bool // Skip updating existing issues (create-only mode)
|
||||
Strict bool // Fail on any error (dependencies, labels, etc.)
|
||||
RenameOnImport bool // Rename imported issues to match database prefix
|
||||
SkipPrefixValidation bool // Skip prefix validation (for auto-import)
|
||||
OrphanHandling string // Orphan handling mode: strict/resurrect/skip/allow (empty = use config)
|
||||
}
|
||||
|
||||
// ImportResult contains statistics about the import operation
|
||||
@@ -198,6 +199,7 @@ func importIssuesCore(ctx context.Context, dbPath string, store storage.Storage,
|
||||
Strict: opts.Strict,
|
||||
RenameOnImport: opts.RenameOnImport,
|
||||
SkipPrefixValidation: opts.SkipPrefixValidation,
|
||||
OrphanHandling: importer.OrphanHandling(opts.OrphanHandling),
|
||||
}
|
||||
|
||||
// Delegate to the importer package
|
||||
|
||||
Reference in New Issue
Block a user