-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathoptions.go
More file actions
55 lines (45 loc) · 2.93 KB
/
options.go
File metadata and controls
55 lines (45 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright AGNTCY Contributors (https://github.com/agntcy)
// SPDX-License-Identifier: Apache-2.0
package importcmd
import (
signcmd "github.com/agntcy/dir/cli/cmd/sign"
"github.com/agntcy/dir/importer/config"
enricherconfig "github.com/agntcy/dir/importer/enricher/config"
scannerconfig "github.com/agntcy/dir/importer/scanner/config"
)
var opts = &options{}
type options struct {
config.Config
RegistryType string
Sign bool // Sign records after pushing (flag binding)
OutputCIDFile string // File to write imported CIDs to (for deferred signing)
}
func init() {
flags := Command.Flags()
// Registry flags
flags.StringVar(&opts.RegistryType, "type", "", "Registry type (mcp, a2a)")
flags.StringVar(&opts.RegistryURL, "url", "", "Registry base URL")
flags.StringToStringVar(&opts.Filters, "filter", nil, "Filters (key=value)")
flags.IntVar(&opts.Limit, "limit", 0, "Maximum number of records to import (0 = no limit)")
flags.BoolVar(&opts.DryRun, "dry-run", false, "Preview without importing")
flags.BoolVar(&opts.Force, "force", false, "Force push even if record already exists")
flags.BoolVar(&opts.Debug, "debug", false, "Enable debug output for deduplication and validation failures")
// Enrichment flags
flags.StringVar(&opts.Enricher.ConfigFile, "enrich-config", enricherconfig.DefaultConfigFile, "Path to MCPHost configuration file (mcphost.json)")
flags.StringVar(&opts.Enricher.SkillsPromptTemplate, "enrich-skills-prompt", "", "Path to custom skills prompt template file")
flags.StringVar(&opts.Enricher.DomainsPromptTemplate, "enrich-domains-prompt", "", "Path to custom domains prompt template file")
flags.IntVar(&opts.Enricher.RequestsPerMinute, "enrich-rate-limit", enricherconfig.DefaultRequestsPerMinute, "Maximum LLM API requests per minute (to avoid rate limit errors)")
// Scanner flags
flags.BoolVar(&opts.Scanner.Enabled, "scanner-enabled", scannerconfig.DefaultScannerEnabled, "Run all registered security scanners on each record")
flags.DurationVar(&opts.Scanner.Timeout, "scanner-timeout", scannerconfig.DefaultTimeout, "Timeout per record scan")
flags.StringVar(&opts.Scanner.CLIPath, "scanner-cli-path", scannerconfig.DefaultCLIPath, "Path to mcp-scanner binary (default: mcp-scanner from PATH)")
flags.BoolVar(&opts.Scanner.FailOnError, "scanner-fail-on-error", scannerconfig.DefaultFailOnError, "Do not import records that have error-severity scanner findings")
flags.BoolVar(&opts.Scanner.FailOnWarning, "scanner-fail-on-warning", scannerconfig.DefaultFailOnWarning, "Do not import records that have warning-severity scanner findings")
// Signing flags
flags.BoolVar(&opts.Sign, "sign", false, "Sign records after pushing")
flags.StringVar(&opts.OutputCIDFile, "output-cids", "", "File to write imported CIDs (one per line, for deferred signing)")
signcmd.AddSigningFlags(flags)
// Mark required flags
Command.MarkFlagRequired("type") //nolint:errcheck
Command.MarkFlagRequired("url") //nolint:errcheck
}