schwarm-cli 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 601a7ca203a5837a47d4bd0348300054e07fe3577a57c99865a64c282e310d8f
4
- data.tar.gz: 857487dd8fa4d92e575466ebe1ed63c70fd3b1c744c6b041eb3d4c675c4657fc
3
+ metadata.gz: 1ce993c4ccb8c15a7a2743ef5d28c8f2c06e3513dad637c23ad0f7929e3dc8b5
4
+ data.tar.gz: add9e02c84c8b0bb05d96c34c0b07b68210669449bb0c428cda290b4559137a4
5
5
  SHA512:
6
- metadata.gz: 899c50f55a6b91d9a8690603de5cbf7dc429b022f18198d205c3679eb6a97911e1fb5afe6bc96cb8ae76f852bb38edf9ca7ef82df245249e5ef1fc5e8188ccc9
7
- data.tar.gz: 506dd09f7f837606a154cd61f0e2f79e7b231af0daa1e495115ba16b2e7c6fc5290dc101fd0c30ca8370132bc08178e39158295100a68c3a36a0e21e2079ca58
6
+ metadata.gz: 54bde32d06880389d77bf624a431c4f702f58fefd6d97067f0f4b6e042ab4bd6fba7e64f3399a16e19e0a4fb1473580c68f45998ae8248cb9ca8a08d3c5ea327
7
+ data.tar.gz: f2a4b9dd8b1b2061c3dc7d9512b2889e260abce55c640b8f5638caded2c790c0db5f03753a895a418a9075c54a41dc69050f1af09b89750e167e187036742cf2
@@ -21,7 +21,7 @@ require_relative "client/user_messages"
21
21
  module SchwarmCli
22
22
  class Client
23
23
  attr_reader :tasks, :repositories, :skills, :skill_files, :templates,
24
- :recurring, :agents, :shared_agents, :secrets, :sessions,
24
+ :recurring, :agents, :subscriptions, :secrets, :sessions,
25
25
  :repo_skills, :messages
26
26
 
27
27
  def get(...) = conn.get(...)
@@ -52,8 +52,8 @@ module SchwarmCli
52
52
  @skill_files = SkillFiles.new(client: self)
53
53
  @templates = TaskTemplates.new(client: self)
54
54
  @recurring = RecurringTasks.new(client: self)
55
- @agents = RepositoryAgents.new(client: self)
56
- @shared_agents = SharedAgents.new(client: self)
55
+ @agents = SharedAgents.new(client: self)
56
+ @subscriptions = RepositoryAgents.new(client: self)
57
57
  @secrets = SecretFiles.new(client: self)
58
58
  @sessions = AgentSessions.new(client: self)
59
59
  @repo_skills = RepositorySkills.new(client: self)
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SchwarmCli
4
+ module Commands
5
+ class AgentSubscriptions < Base
6
+ desc "list", "List repository subscriptions"
7
+ option :repo, type: :string, desc: "Filter by repository ID, owner/repo, or GitHub URL"
8
+ option :query, type: :string, desc: "Search by name"
9
+ pagination_options
10
+ def list
11
+ handle_errors do
12
+ data = fetch_paged do |page_params|
13
+ client.subscriptions.list(repository_id: resolve_repo(options[:repo]), query: options[:query],
14
+ **page_params)
15
+ end
16
+ output_list(data, columns: [%w[ID id], %w[NAME name], %w[REPO github_repository_name],
17
+ %w[ENABLED enabled], %w[SCHEDULE schedule]])
18
+ end
19
+ end
20
+
21
+ desc "show ID", "Show subscription details"
22
+ def show(id)
23
+ handle_errors do
24
+ data = client.subscriptions.find(id)
25
+ output_record(data, fields: {
26
+ "ID" => "id", "Name" => "name", "Repository" => "github_repository_name",
27
+ "Agent" => "shared_agent_id", "Enabled" => "enabled",
28
+ "Schedule" => "schedule",
29
+ "Additional Instructions" => "additional_instructions",
30
+ "Created" => "created_at", "Updated" => "updated_at"
31
+ })
32
+ end
33
+ end
34
+
35
+ desc "create", "Subscribe an agent to a repository"
36
+ option :repo, type: :string, required: true, desc: "Repository ID, owner/repo, or GitHub URL"
37
+ option :agent, type: :string, required: true,
38
+ desc: "Agent ID to subscribe to this repository"
39
+ option :additional_instructions, type: :string,
40
+ desc: "Per-repository additional instructions appended to the shared prompt"
41
+ option :enabled, type: :boolean, default: true,
42
+ desc: "Whether the subscription is active (default: true)"
43
+ def create
44
+ handle_errors do
45
+ data = client.subscriptions.create(**create_attrs)
46
+ output_record(data, fields: { "ID" => "id", "Name" => "name", "Enabled" => "enabled" })
47
+ end
48
+ end
49
+
50
+ desc "update ID", "Update a subscription"
51
+ option :additional_instructions, type: :string,
52
+ desc: "Per-repository additional instructions"
53
+ option :enabled, type: :boolean, desc: "Whether the subscription is active"
54
+ def update(id)
55
+ handle_errors do
56
+ data = client.subscriptions.update(id, **update_attrs)
57
+ output_record(data, fields: { "ID" => "id", "Name" => "name", "Enabled" => "enabled" })
58
+ end
59
+ end
60
+
61
+ desc "delete ID", "Delete a subscription"
62
+ def delete(id)
63
+ handle_errors do
64
+ client.subscriptions.destroy(id)
65
+ puts "Subscription #{id} deleted."
66
+ end
67
+ end
68
+
69
+ desc "toggle ID", "Toggle subscription enabled/disabled"
70
+ def toggle(id)
71
+ handle_errors do
72
+ data = client.subscriptions.toggle(id)
73
+ status = data.dig("data", "enabled") ? "enabled" : "disabled"
74
+ puts "Subscription #{id} #{status}."
75
+ end
76
+ end
77
+
78
+ desc "run-now ID", "Trigger subscription to run immediately"
79
+ map "run-now" => :run_now
80
+ def run_now(id)
81
+ handle_errors do
82
+ client.subscriptions.run_now(id)
83
+ puts "Subscription #{id} triggered."
84
+ end
85
+ end
86
+
87
+ private
88
+
89
+ def create_attrs
90
+ attrs = {
91
+ shared_agent_id: options[:agent],
92
+ github_repository_id: resolve_repo(options[:repo]),
93
+ enabled: options[:enabled]
94
+ }
95
+ attrs[:additional_instructions] = options[:additional_instructions] if options[:additional_instructions]
96
+ attrs
97
+ end
98
+
99
+ def update_attrs
100
+ {}.tap do |attrs|
101
+ attrs[:additional_instructions] = options[:additional_instructions] if options[:additional_instructions]
102
+ attrs[:enabled] = options[:enabled] unless options[:enabled].nil?
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -1,19 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "agent_subscriptions"
4
+
3
5
  module SchwarmCli
4
6
  module Commands
5
7
  class Agents < Base
6
- desc "list", "List repository agents"
7
- option :repo, type: :string, desc: "Filter by repository ID, owner/repo, or GitHub URL"
8
+ desc "subscriptions SUBCOMMAND", "Manage repository subscriptions"
9
+ subcommand "subscriptions", AgentSubscriptions
10
+
11
+ desc "list", "List agents"
8
12
  option :query, type: :string, desc: "Search by name"
9
13
  pagination_options
10
14
  def list
11
15
  handle_errors do
12
16
  data = fetch_paged do |page_params|
13
- client.agents.list(repository_id: resolve_repo(options[:repo]), query: options[:query], **page_params)
17
+ client.agents.list(query: options[:query], **page_params)
14
18
  end
15
- output_list(data, columns: [%w[ID id], %w[NAME name], %w[REPO github_repository_name],
16
- %w[ENABLED enabled], %w[SCHEDULE schedule]])
19
+ output_list(data, columns: [%w[ID id], %w[NAME name], %w[ENABLED enabled],
20
+ %w[SCHEDULE schedule]])
17
21
  end
18
22
  end
19
23
 
@@ -22,34 +26,31 @@ module SchwarmCli
22
26
  handle_errors do
23
27
  data = client.agents.find(id)
24
28
  output_record(data, fields: {
25
- "ID" => "id", "Name" => "name", "Repository" => "github_repository_name",
26
- "Shared Agent" => "shared_agent_id", "Enabled" => "enabled",
27
- "Schedule" => "schedule",
28
- "Additional Instructions" => "additional_instructions",
29
+ "ID" => "id", "Name" => "name", "Enabled" => "enabled",
30
+ "Schedule" => "schedule", "Prompt" => "prompt",
29
31
  "Created" => "created_at", "Updated" => "updated_at"
30
32
  })
31
33
  end
32
34
  end
33
35
 
34
- desc "create", "Create a repository agent (subscribe a shared agent to a repo)"
35
- option :repo, type: :string, required: true, desc: "Repository ID, owner/repo, or GitHub URL"
36
- option :shared_agent, type: :string, required: true,
37
- desc: "Shared agent ID to subscribe to this repository"
38
- option :additional_instructions, type: :string,
39
- desc: "Per-repository additional instructions appended to the shared prompt"
40
- option :enabled, type: :boolean, default: true,
41
- desc: "Whether the agent runs (default: true)"
36
+ desc "create", "Create an agent"
37
+ option :name, type: :string, required: true, desc: "Agent name"
38
+ option :prompt, type: :string, required: true, desc: "Agent prompt"
39
+ option :schedule, type: :string, desc: "Cron schedule"
42
40
  def create
43
41
  handle_errors do
44
- data = client.agents.create(**create_attrs)
42
+ attrs = { name: options[:name], prompt: options[:prompt] }
43
+ attrs[:schedule] = options[:schedule] if options[:schedule]
44
+
45
+ data = client.agents.create(**attrs)
45
46
  output_record(data, fields: { "ID" => "id", "Name" => "name", "Enabled" => "enabled" })
46
47
  end
47
48
  end
48
49
 
49
- desc "update ID", "Update a repository agent"
50
- option :additional_instructions, type: :string,
51
- desc: "Per-repository additional instructions"
52
- option :enabled, type: :boolean, desc: "Whether the agent runs"
50
+ desc "update ID", "Update an agent"
51
+ option :name, type: :string, desc: "Agent name"
52
+ option :prompt, type: :string, desc: "Agent prompt"
53
+ option :schedule, type: :string, desc: "Cron schedule"
53
54
  def update(id)
54
55
  handle_errors do
55
56
  data = client.agents.update(id, **update_attrs)
@@ -57,7 +58,7 @@ module SchwarmCli
57
58
  end
58
59
  end
59
60
 
60
- desc "delete ID", "Delete a repository agent"
61
+ desc "delete ID", "Delete an agent"
61
62
  def delete(id)
62
63
  handle_errors do
63
64
  client.agents.destroy(id)
@@ -74,31 +75,13 @@ module SchwarmCli
74
75
  end
75
76
  end
76
77
 
77
- desc "run-now ID", "Trigger agent to run immediately"
78
- map "run-now" => :run_now
79
- def run_now(id)
80
- handle_errors do
81
- client.agents.run_now(id)
82
- puts "Agent #{id} triggered."
83
- end
84
- end
85
-
86
78
  private
87
79
 
88
- def create_attrs
89
- attrs = {
90
- shared_agent_id: options[:shared_agent],
91
- github_repository_id: resolve_repo(options[:repo]),
92
- enabled: options[:enabled]
93
- }
94
- attrs[:additional_instructions] = options[:additional_instructions] if options[:additional_instructions]
95
- attrs
96
- end
97
-
98
80
  def update_attrs
99
81
  {}.tap do |attrs|
100
- attrs[:additional_instructions] = options[:additional_instructions] if options[:additional_instructions]
101
- attrs[:enabled] = options[:enabled] unless options[:enabled].nil?
82
+ attrs[:name] = options[:name] if options[:name]
83
+ attrs[:prompt] = options[:prompt] if options[:prompt]
84
+ attrs[:schedule] = options[:schedule] if options[:schedule]
102
85
  end
103
86
  end
104
87
  end
@@ -7,7 +7,6 @@ require_relative "templates"
7
7
  require_relative "skills"
8
8
  require_relative "skill_files"
9
9
  require_relative "agents"
10
- require_relative "shared_agents"
11
10
  require_relative "recurring"
12
11
  require_relative "secrets"
13
12
  require_relative "sessions"
@@ -34,12 +33,9 @@ module SchwarmCli
34
33
  desc "skill-files SUBCOMMAND", "Manage skill files"
35
34
  subcommand "skill_files", SkillFilesCmd
36
35
 
37
- desc "agents SUBCOMMAND", "Manage repository agents"
36
+ desc "agents SUBCOMMAND", "Manage agents and their repository subscriptions"
38
37
  subcommand "agents", Agents
39
38
 
40
- desc "shared-agents SUBCOMMAND", "Manage shared agents"
41
- subcommand "shared_agents", SharedAgentsCmd
42
-
43
39
  desc "recurring SUBCOMMAND", "Manage recurring tasks"
44
40
  subcommand "recurring", Recurring
45
41
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchwarmCli
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
data/schwarm-skill.md CHANGED
@@ -266,13 +266,18 @@ for tasks in a repository.
266
266
  ```bash
267
267
  schwarm repo-skills create --repo <REPO_ID> --skill <SKILL_ID>
268
268
  ```
269
- 3. Create a repository agent (custom instructions for all tasks in a repo):
269
+ 3. Create an agent (a reusable definition with a name, prompt, and optional schedule):
270
270
  ```bash
271
- schwarm agents create --repo <REPO_ID> --name "Code style" --prompt "Always follow the project's eslint config"
271
+ schwarm agents create --name "Code style" --prompt "Always follow the project's eslint config"
272
272
  ```
273
- 4. List agents for a repo:
273
+ 4. Subscribe an agent to a repository so it runs against that repo:
274
274
  ```bash
275
- schwarm agents list --repo <REPO_ID>
275
+ schwarm agents subscriptions create --repo <REPO_ID> --agent <AGENT_ID>
276
+ ```
277
+ 5. List subscriptions for a repo, or all agents:
278
+ ```bash
279
+ schwarm agents subscriptions list --repo <REPO_ID>
280
+ schwarm agents list
276
281
  ```
277
282
 
278
283
  ## Tips
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schwarm-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Garrigues
@@ -103,6 +103,7 @@ files:
103
103
  - lib/schwarm_cli/client/task_templates.rb
104
104
  - lib/schwarm_cli/client/tasks.rb
105
105
  - lib/schwarm_cli/client/user_messages.rb
106
+ - lib/schwarm_cli/commands/agent_subscriptions.rb
106
107
  - lib/schwarm_cli/commands/agents.rb
107
108
  - lib/schwarm_cli/commands/base.rb
108
109
  - lib/schwarm_cli/commands/configure.rb
@@ -112,7 +113,6 @@ files:
112
113
  - lib/schwarm_cli/commands/repos.rb
113
114
  - lib/schwarm_cli/commands/secrets.rb
114
115
  - lib/schwarm_cli/commands/sessions.rb
115
- - lib/schwarm_cli/commands/shared_agents.rb
116
116
  - lib/schwarm_cli/commands/skill_files.rb
117
117
  - lib/schwarm_cli/commands/skills.rb
118
118
  - lib/schwarm_cli/commands/tasks.rb
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SchwarmCli
4
- module Commands
5
- class SharedAgentsCmd < Base
6
- desc "list", "List shared agents"
7
- option :query, type: :string, desc: "Search by name"
8
- pagination_options
9
- def list
10
- handle_errors do
11
- data = fetch_paged do |page_params|
12
- client.shared_agents.list(query: options[:query], **page_params)
13
- end
14
- output_list(data, columns: [%w[ID id], %w[NAME name], %w[ENABLED enabled],
15
- %w[SCHEDULE schedule]])
16
- end
17
- end
18
-
19
- desc "show ID", "Show shared agent details"
20
- def show(id)
21
- handle_errors do
22
- data = client.shared_agents.find(id)
23
- output_record(data, fields: {
24
- "ID" => "id", "Name" => "name", "Enabled" => "enabled",
25
- "Schedule" => "schedule", "Prompt" => "prompt",
26
- "Created" => "created_at", "Updated" => "updated_at"
27
- })
28
- end
29
- end
30
-
31
- desc "create", "Create a shared agent"
32
- option :name, type: :string, required: true, desc: "Agent name"
33
- option :prompt, type: :string, required: true, desc: "Agent prompt"
34
- option :schedule, type: :string, desc: "Cron schedule"
35
- def create
36
- handle_errors do
37
- attrs = { name: options[:name], prompt: options[:prompt] }
38
- attrs[:schedule] = options[:schedule] if options[:schedule]
39
-
40
- data = client.shared_agents.create(**attrs)
41
- output_record(data, fields: { "ID" => "id", "Name" => "name", "Enabled" => "enabled" })
42
- end
43
- end
44
-
45
- desc "update ID", "Update a shared agent"
46
- option :name, type: :string, desc: "Agent name"
47
- option :prompt, type: :string, desc: "Agent prompt"
48
- option :schedule, type: :string, desc: "Cron schedule"
49
- def update(id)
50
- handle_errors do
51
- data = client.shared_agents.update(id, **update_attrs)
52
- output_record(data, fields: { "ID" => "id", "Name" => "name", "Enabled" => "enabled" })
53
- end
54
- end
55
-
56
- desc "delete ID", "Delete a shared agent"
57
- def delete(id)
58
- handle_errors do
59
- client.shared_agents.destroy(id)
60
- puts "Shared agent #{id} deleted."
61
- end
62
- end
63
-
64
- desc "toggle ID", "Toggle shared agent enabled/disabled"
65
- def toggle(id)
66
- handle_errors do
67
- data = client.shared_agents.toggle(id)
68
- status = data.dig("data", "enabled") ? "enabled" : "disabled"
69
- puts "Shared agent #{id} #{status}."
70
- end
71
- end
72
-
73
- private
74
-
75
- def update_attrs
76
- {}.tap do |attrs|
77
- attrs[:name] = options[:name] if options[:name]
78
- attrs[:prompt] = options[:prompt] if options[:prompt]
79
- attrs[:schedule] = options[:schedule] if options[:schedule]
80
- end
81
- end
82
- end
83
- end
84
- end