Skip to content

Commit e1e8a8e

Browse files
committed
Move pull and push under cagent share (breaking change)
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent 50ef192 commit e1e8a8e

8 files changed

Lines changed: 41 additions & 28 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
- `./bin/cagent run --exec <config.yaml>` - Execute agent without TUI (non-interactive)
2424
- `./bin/cagent new` - Generate new agent configuration interactively
2525
- `./bin/cagent new --model openai/gpt-5` - Generate with specific model
26-
- `./bin/cagent push ./agent.yaml namespace/repo` - Push agent to OCI registry
27-
- `./bin/cagent pull namespace/repo` - Pull agent from OCI registry
26+
- `./bin/cagent share push ./agent.yaml namespace/repo` - Push agent to OCI registry
27+
- `./bin/cagent share pull namespace/repo` - Pull agent from OCI registry
2828
- `./bin/cagent serve mcp ./agent.yaml` - Expose agents as MCP tools
2929
- `./bin/cagent serve a2a <config.yaml>` - Start agent as A2A server
3030
- `./bin/cagent serve api` - Start Docker `cagent` API server

cmd/root/pull.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ func newPullCmd() *cobra.Command {
2222
var flags pullFlags
2323

2424
cmd := &cobra.Command{
25-
Use: "pull <registry-ref>",
26-
Short: "Pull an agent from an OCI registry",
27-
Long: "Pull an agent configuration file from an OCI registry",
28-
GroupID: "core",
29-
Args: cobra.ExactArgs(1),
30-
RunE: flags.runPullCommand,
25+
Use: "pull <registry-ref>",
26+
Short: "Pull an agent from an OCI registry",
27+
Long: "Pull an agent configuration file from an OCI registry",
28+
Args: cobra.ExactArgs(1),
29+
RunE: flags.runPullCommand,
3130
}
3231

3332
cmd.PersistentFlags().BoolVar(&flags.force, "force", false, "Force pull even if the configuration already exists locally")
@@ -36,7 +35,7 @@ func newPullCmd() *cobra.Command {
3635
}
3736

3837
func (f *pullFlags) runPullCommand(cmd *cobra.Command, args []string) error {
39-
telemetry.TrackCommand("pull", args)
38+
telemetry.TrackCommand("share", append([]string{"pull"}, args...))
4039

4140
ctx := cmd.Context()
4241
out := cli.NewPrinter(cmd.OutOrStdout())

cmd/root/push.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ import (
1616

1717
func newPushCmd() *cobra.Command {
1818
return &cobra.Command{
19-
Use: "push <agent-file> <registry-ref>",
20-
Short: "Push an agent to an OCI registry",
21-
Long: "Push an agent configuration file to an OCI registry",
22-
GroupID: "core",
23-
Args: cobra.ExactArgs(2),
24-
RunE: runPushCommand,
19+
Use: "push <agent-file> <registry-ref>",
20+
Short: "Push an agent to an OCI registry",
21+
Long: "Push an agent configuration file to an OCI registry",
22+
Args: cobra.ExactArgs(2),
23+
RunE: runPushCommand,
2524
}
2625
}
2726

2827
func runPushCommand(cmd *cobra.Command, args []string) error {
29-
telemetry.TrackCommand("push", args)
28+
telemetry.TrackCommand("share", append([]string{"push"}, args...))
3029

3130
ctx := cmd.Context()
3231
agentFilename := args[0]

cmd/root/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ func NewRootCmd() *cobra.Command {
101101
cmd.AddCommand(newRunCmd())
102102
cmd.AddCommand(newNewCmd())
103103
cmd.AddCommand(newEvalCmd())
104-
cmd.AddCommand(newPushCmd())
105-
cmd.AddCommand(newPullCmd())
104+
cmd.AddCommand(newShareCmd())
106105
cmd.AddCommand(newDebugCmd())
107106
cmd.AddCommand(newAliasCmd())
108107
cmd.AddCommand(newServeCmd())

cmd/root/share.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package root
2+
3+
import "github.com/spf13/cobra"
4+
5+
func newShareCmd() *cobra.Command {
6+
cmd := &cobra.Command{
7+
Use: "share",
8+
Short: "Share agents",
9+
GroupID: "core",
10+
}
11+
12+
cmd.AddCommand(newPushCmd())
13+
cmd.AddCommand(newPullCmd())
14+
15+
return cmd
16+
}

docs/pages/concepts/distribution.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ <h2>Overview</h2>
77

88
<div class="callout callout-tip">
99
<div class="callout-title">💡 Tip</div>
10-
<p>For CLI commands related to distribution, see <a href="#features/cli" onclick="event.preventDefault(); navigate('features/cli')">CLI Reference</a> (<code>cagent push</code>, <code>cagent pull</code>, <code>cagent alias</code>).</p>
10+
<p>For CLI commands related to distribution, see <a href="#features/cli" onclick="event.preventDefault(); navigate('features/cli')">CLI Reference</a> (<code>cagent share push</code>, <code>cagent share pull</code>, <code>cagent alias</code>).</p>
1111
</div>
1212

1313
<h2>Pushing Agents</h2>
1414

1515
<pre><code class="language-bash"># Push to Docker Hub
16-
$ cagent push ./agent.yaml docker.io/username/my-agent:latest
16+
$ cagent share push ./agent.yaml docker.io/username/my-agent:latest
1717

1818
# Push to GitHub Container Registry
19-
$ cagent push ./agent.yaml ghcr.io/username/my-agent:v1.0</code></pre>
19+
$ cagent share push ./agent.yaml ghcr.io/username/my-agent:v1.0</code></pre>
2020

2121
<h2>Pulling Agents</h2>
2222

@@ -74,7 +74,7 @@ <h2>Private Repositories</h2>
7474
$ docker login docker.io
7575

7676
# Now push/pull works with private repos
77-
$ cagent push ./agent.yaml docker.io/myorg/private-agent:latest
77+
$ cagent share push ./agent.yaml docker.io/myorg/private-agent:latest
7878
$ cagent run docker.io/myorg/private-agent:latest</code></pre>
7979

8080
<div class="callout callout-info">

docs/pages/features/cli.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ <h3><code>cagent acp</code></h3>
106106

107107
<p>See <a href="#features/acp" onclick="event.preventDefault(); navigate('features/acp')">ACP</a> for details on the Agent Client Protocol.</p>
108108

109-
<h3><code>cagent push</code> / <code>cagent pull</code></h3>
110-
<p>Distribute agents via OCI registries.</p>
109+
<h3><code>cagent share push</code> / <code>cagent pull</code></h3>
110+
<p>Share agents via OCI registries.</p>
111111

112112
<pre><code class="language-bash"># Push an agent
113-
$ cagent push ./agent.yaml docker.io/username/my-agent:latest
113+
$ cagent share push ./agent.yaml docker.io/username/my-agent:latest
114114

115115
# Pull an agent
116-
$ cagent pull docker.io/username/my-agent:latest</code></pre>
116+
$ cagent share pull docker.io/username/my-agent:latest</code></pre>
117117

118118
<p>See <a href="#concepts/distribution" onclick="event.preventDefault(); navigate('concepts/distribution')">Agent Distribution</a> for full registry workflow details.</p>
119119

pkg/remote/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Pull(ctx context.Context, registryRef string, force bool, opts ...crane.Opt
3434
if meta, metaErr := store.GetArtifactMetadata(localRef); metaErr == nil {
3535
if meta.Digest == remoteDigest {
3636
if !hasCagentAnnotation(meta.Annotations) {
37-
return "", fmt.Errorf("artifact %s found in store wasn't created by `cagent push`\nTry to push again with `cagent push` (cagent >= v1.10.0)", localRef)
37+
return "", fmt.Errorf("artifact %s found in store wasn't created by `cagent share push`\nTry to push again with `cagent share push` (cagent >= v1.10.0)", localRef)
3838
}
3939
return meta.Digest, nil
4040
}
@@ -51,7 +51,7 @@ func Pull(ctx context.Context, registryRef string, force bool, opts ...crane.Opt
5151
return "", fmt.Errorf("getting manifest from pulled image: %w", err)
5252
}
5353
if !hasCagentAnnotation(manifest.Annotations) {
54-
return "", fmt.Errorf("artifact %s wasn't created by `cagent push`\nTry to push again with `cagent push` (cagent >= v1.10.0)", localRef)
54+
return "", fmt.Errorf("artifact %s wasn't created by `cagent share push`\nTry to push again with `cagent share push` (cagent >= v1.10.0)", localRef)
5555
}
5656

5757
digest, err := store.StoreArtifact(img, localRef)

0 commit comments

Comments
 (0)