diff --git a/.github/workflows/import-records.yaml b/.github/workflows/import-records.yaml index 092baf590..8d0612b84 100644 --- a/.github/workflows/import-records.yaml +++ b/.github/workflows/import-records.yaml @@ -162,10 +162,14 @@ jobs: echo "--- Processing Entry $((${{ matrix.entry.index }} + 1)) ---" CIDS_FILE="imported-cids-${{ matrix.entry.index }}.txt" + # TODO: Uncomment when the importer supports saving per-record JSON files. + # DRY_RUN_DIR="dry-run-output-${{ matrix.entry.index }}" CMD=("${DIRCTL_PATH}" import --type=mcp-registry --url=https://registry.modelcontextprotocol.io/v0.1 --server-addr="${{ env.SERVER_ADDRESS }}" --auth-mode=oidc "--auth-token=${DIR_AUTH_TOKEN}" --enrich-config=mcphost_ci.json --enrich-rate-limit="${{ env.RATE_LIMIT }}") if [[ "${{ env.DRY_RUN }}" == "true" ]]; then CMD+=("--dry-run") + # TODO: Replace with the following block when the importer supports saving per-record JSON files. + # CMD+=("--dry-run" "--output-dir=$DRY_RUN_DIR") else # Output CIDs for deferred signing (only in non-dry-run mode) CMD+=("--output-cids=$CIDS_FILE") @@ -209,6 +213,20 @@ jobs: cat "$JSONL_FILE" fi + # TODO: Replace print above with the following block when the importer supports saving per-record JSON files. + # # Print per-record JSON files (dry-run mode). The importer writes one + # # .record.json per record into $DRY_RUN_DIR. + # if [[ "${{ env.DRY_RUN }}" == "true" ]] && [ -d "$DRY_RUN_DIR" ]; then + # shopt -s nullglob + # RECORD_FILES=("$DRY_RUN_DIR"/*.record.json) + # echo "--- Dry-run records ($DRY_RUN_DIR): ${#RECORD_FILES[@]} file(s) ---" + # for f in "${RECORD_FILES[@]}"; do + # echo "=== $(basename "$f") ===" + # cat "$f" + # echo + # done + # fi + # Output CIDs file path for signing step echo "cids_file=$CIDS_FILE" >> $GITHUB_OUTPUT diff --git a/cli/cmd/import/import.go b/cli/cmd/import/import.go index c5f85d703..9be1fbab8 100644 --- a/cli/cmd/import/import.go +++ b/cli/cmd/import/import.go @@ -50,6 +50,7 @@ Examples (Agent Skill directory): Preview and output: dirctl import --type=mcp-registry --url=https://registry.modelcontextprotocol.io/v0.1 --dry-run + dirctl import --type=mcp-registry --url=https://registry.modelcontextprotocol.io/v0.1 --dry-run --output-dir=./out dirctl import --type=mcp-registry --url=https://registry.modelcontextprotocol.io/v0.1 --output-cids=./imported.cids Enrichment (MCPHost / LLM): @@ -156,8 +157,9 @@ func printSummary(cmd *cobra.Command, result *types.ImportResult) { if opts.DryRun { presenter.Printf(cmd, "\nNote: This was a dry run. No records were actually imported.\n") - if result.OutputFile != "" { - presenter.Printf(cmd, "Records saved to: %s\n", result.OutputFile) + if result.OutputDir != "" { + presenter.Printf(cmd, "Records saved to directory: %s\n", result.OutputDir) + presenter.Printf(cmd, "Each record is written as .record.json and can be re-imported via dirctl push.\n") } } } diff --git a/cli/cmd/import/options.go b/cli/cmd/import/options.go index 2cb2d31f8..31c3a7fd8 100644 --- a/cli/cmd/import/options.go +++ b/cli/cmd/import/options.go @@ -50,7 +50,8 @@ func init() { signcmd.AddSigningFlags(flags) // Common flags - flags.BoolVar(&opts.DryRun, "dry-run", false, "Preview without importing") + flags.BoolVar(&opts.DryRun, "dry-run", false, "Preview without importing; transformed records are written to --output-dir (one JSON file per record) so they can be re-imported later via `dirctl import`") + flags.StringVar(&opts.OutputDir, "output-dir", "", "Directory to write per-record JSON files when --dry-run is set (defaults to ./import-dry-run- in the current working directory)") 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") diff --git a/cli/go.mod b/cli/go.mod index 6a50464f1..1f261bd05 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -20,7 +20,7 @@ replace ( require ( buf.build/gen/go/agntcy/oasf/protocolbuffers/go v1.36.11-20260427075301-21bf512e44c9.1 - github.com/agntcy/dir-importer v1.3.0 + github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b github.com/agntcy/dir-mcp v1.3.0 github.com/agntcy/dir-runtime/discovery v1.3.0 github.com/agntcy/dir-runtime/server v1.3.0 @@ -499,7 +499,7 @@ require ( github.com/libp2p/go-reuseport v0.4.0 // indirect github.com/libp2p/go-yamux/v5 v5.1.0 // indirect github.com/libp2p/zeroconf/v2 v2.2.0 // indirect - github.com/mark3labs/mcp-go v0.52.0 // indirect + github.com/mark3labs/mcp-go v0.53.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-isatty v0.0.22 // indirect github.com/miekg/dns v1.1.72 // indirect diff --git a/cli/go.sum b/cli/go.sum index 8c24a424d..5df993456 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -190,8 +190,8 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= -github.com/agntcy/dir-importer v1.3.0 h1:biojlL4BQI6xoaem3/uZuWZ8E+ud/r2O3KyErUM0oQU= -github.com/agntcy/dir-importer v1.3.0/go.mod h1:AUIqEJONjwI+W3fI3q7UGuHTu9TR9TRgJcQwlJcV+Ig= +github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b h1:BmhkPF1nUFhRrR8wz5txVQ1EyOKdwYP5dVaPqLug0Rg= +github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b/go.mod h1:EYqzt4Cqz+1iid4/aTWUNbzqVLvRStyy2VCEqe8l6FM= github.com/agntcy/dir-mcp v1.3.0 h1:xG7qkcsile69u0I7x3VrSvyVKT0NuBlgDK29WrHo5dg= github.com/agntcy/dir-mcp v1.3.0/go.mod h1:4GqrwnqlzBvzkrnd0DV3N0iq7rRANtOlQ2aMIzrLQHo= github.com/agntcy/dir-runtime/discovery v1.3.0 h1:sQuSA/QyxeHES9ayVVVhX1NuTGwNuRmioXk2mZgXFmc= @@ -1174,8 +1174,8 @@ github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8S github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/marcopolo/simnet v0.0.4 h1:50Kx4hS9kFGSRIbrt9xUS3NJX33EyPqHVmpXvaKLqrY= github.com/marcopolo/simnet v0.0.4/go.mod h1:tfQF1u2DmaB6WHODMtQaLtClEf3a296CKQLq5gAsIS0= -github.com/mark3labs/mcp-go v0.52.0 h1:uRSzupNSUyPGDpF4owY5X4zEpACPwBnlM3FAFuXN6gQ= -github.com/mark3labs/mcp-go v0.52.0/go.mod h1:Zg9cB2HdwdMMVgY0xtTzq3KvYIOJQDsaut+jWjwDaQY= +github.com/mark3labs/mcp-go v0.53.0 h1:nzjUi/L448XxwrfmVjiZ03vWgYOWVBrJK0wkZH7fVWo= +github.com/mark3labs/mcp-go v0.53.0/go.mod h1:Zg9cB2HdwdMMVgY0xtTzq3KvYIOJQDsaut+jWjwDaQY= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/masahiro331/go-disk v0.0.0-20260423015231-f7a470ebd472 h1:QAY4If99Ee10TUP4mdcB6Qlm036ayfYruTLjvlaczbs= diff --git a/tests/go.mod b/tests/go.mod index 80beabb22..c4ec8d6be 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -16,7 +16,7 @@ replace ( replace github.com/ThalesIgnite/crypto11 => github.com/ThalesGroup/crypto11 v1.6.0 require ( - github.com/agntcy/dir-importer v1.3.0 + github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b github.com/agntcy/dir/api v1.3.0 github.com/agntcy/dir/cli v1.3.0 github.com/agntcy/dir/client v1.3.0 @@ -366,7 +366,7 @@ require ( github.com/libp2p/zeroconf/v2 v2.2.0 // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect github.com/lunixbochs/struc v0.0.0-20241101090106-8d528fa2c543 // indirect - github.com/mark3labs/mcp-go v0.52.0 // indirect + github.com/mark3labs/mcp-go v0.53.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/masahiro331/go-disk v0.0.0-20260423015231-f7a470ebd472 // indirect github.com/masahiro331/go-ebs-file v0.0.0-20260422020928-9d24e29aac27 // indirect diff --git a/tests/go.sum b/tests/go.sum index 1f8cc488f..f7de2c4bb 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -190,8 +190,8 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= -github.com/agntcy/dir-importer v1.3.0 h1:biojlL4BQI6xoaem3/uZuWZ8E+ud/r2O3KyErUM0oQU= -github.com/agntcy/dir-importer v1.3.0/go.mod h1:AUIqEJONjwI+W3fI3q7UGuHTu9TR9TRgJcQwlJcV+Ig= +github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b h1:BmhkPF1nUFhRrR8wz5txVQ1EyOKdwYP5dVaPqLug0Rg= +github.com/agntcy/dir-importer v1.3.1-0.20260513134649-3276412ac13b/go.mod h1:EYqzt4Cqz+1iid4/aTWUNbzqVLvRStyy2VCEqe8l6FM= github.com/agntcy/dir-mcp v1.3.0 h1:xG7qkcsile69u0I7x3VrSvyVKT0NuBlgDK29WrHo5dg= github.com/agntcy/dir-mcp v1.3.0/go.mod h1:4GqrwnqlzBvzkrnd0DV3N0iq7rRANtOlQ2aMIzrLQHo= github.com/agntcy/dir-runtime/discovery v1.3.0 h1:sQuSA/QyxeHES9ayVVVhX1NuTGwNuRmioXk2mZgXFmc= @@ -1183,8 +1183,8 @@ github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8S github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/marcopolo/simnet v0.0.4 h1:50Kx4hS9kFGSRIbrt9xUS3NJX33EyPqHVmpXvaKLqrY= github.com/marcopolo/simnet v0.0.4/go.mod h1:tfQF1u2DmaB6WHODMtQaLtClEf3a296CKQLq5gAsIS0= -github.com/mark3labs/mcp-go v0.52.0 h1:uRSzupNSUyPGDpF4owY5X4zEpACPwBnlM3FAFuXN6gQ= -github.com/mark3labs/mcp-go v0.52.0/go.mod h1:Zg9cB2HdwdMMVgY0xtTzq3KvYIOJQDsaut+jWjwDaQY= +github.com/mark3labs/mcp-go v0.53.0 h1:nzjUi/L448XxwrfmVjiZ03vWgYOWVBrJK0wkZH7fVWo= +github.com/mark3labs/mcp-go v0.53.0/go.mod h1:Zg9cB2HdwdMMVgY0xtTzq3KvYIOJQDsaut+jWjwDaQY= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=