language-operator 0.0.1 → 0.1.30

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +125 -0
  3. data/CHANGELOG.md +53 -0
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +284 -0
  6. data/LICENSE +229 -21
  7. data/Makefile +77 -0
  8. data/README.md +3 -11
  9. data/Rakefile +34 -0
  10. data/bin/aictl +7 -0
  11. data/completions/_aictl +232 -0
  12. data/completions/aictl.bash +121 -0
  13. data/completions/aictl.fish +114 -0
  14. data/docs/architecture/agent-runtime.md +585 -0
  15. data/docs/dsl/agent-reference.md +591 -0
  16. data/docs/dsl/best-practices.md +1078 -0
  17. data/docs/dsl/chat-endpoints.md +895 -0
  18. data/docs/dsl/constraints.md +671 -0
  19. data/docs/dsl/mcp-integration.md +1177 -0
  20. data/docs/dsl/webhooks.md +932 -0
  21. data/docs/dsl/workflows.md +744 -0
  22. data/examples/README.md +569 -0
  23. data/examples/agent_example.rb +86 -0
  24. data/examples/chat_endpoint_agent.rb +118 -0
  25. data/examples/github_webhook_agent.rb +171 -0
  26. data/examples/mcp_agent.rb +158 -0
  27. data/examples/oauth_callback_agent.rb +296 -0
  28. data/examples/stripe_webhook_agent.rb +219 -0
  29. data/examples/webhook_agent.rb +80 -0
  30. data/lib/language_operator/agent/base.rb +110 -0
  31. data/lib/language_operator/agent/executor.rb +440 -0
  32. data/lib/language_operator/agent/instrumentation.rb +54 -0
  33. data/lib/language_operator/agent/metrics_tracker.rb +183 -0
  34. data/lib/language_operator/agent/safety/ast_validator.rb +272 -0
  35. data/lib/language_operator/agent/safety/audit_logger.rb +104 -0
  36. data/lib/language_operator/agent/safety/budget_tracker.rb +175 -0
  37. data/lib/language_operator/agent/safety/content_filter.rb +93 -0
  38. data/lib/language_operator/agent/safety/manager.rb +207 -0
  39. data/lib/language_operator/agent/safety/rate_limiter.rb +150 -0
  40. data/lib/language_operator/agent/safety/safe_executor.rb +115 -0
  41. data/lib/language_operator/agent/scheduler.rb +183 -0
  42. data/lib/language_operator/agent/telemetry.rb +116 -0
  43. data/lib/language_operator/agent/web_server.rb +610 -0
  44. data/lib/language_operator/agent/webhook_authenticator.rb +226 -0
  45. data/lib/language_operator/agent.rb +149 -0
  46. data/lib/language_operator/cli/commands/agent.rb +1252 -0
  47. data/lib/language_operator/cli/commands/cluster.rb +335 -0
  48. data/lib/language_operator/cli/commands/install.rb +404 -0
  49. data/lib/language_operator/cli/commands/model.rb +266 -0
  50. data/lib/language_operator/cli/commands/persona.rb +396 -0
  51. data/lib/language_operator/cli/commands/quickstart.rb +22 -0
  52. data/lib/language_operator/cli/commands/status.rb +156 -0
  53. data/lib/language_operator/cli/commands/tool.rb +537 -0
  54. data/lib/language_operator/cli/commands/use.rb +47 -0
  55. data/lib/language_operator/cli/errors/handler.rb +180 -0
  56. data/lib/language_operator/cli/errors/suggestions.rb +176 -0
  57. data/lib/language_operator/cli/formatters/code_formatter.rb +81 -0
  58. data/lib/language_operator/cli/formatters/log_formatter.rb +290 -0
  59. data/lib/language_operator/cli/formatters/progress_formatter.rb +53 -0
  60. data/lib/language_operator/cli/formatters/table_formatter.rb +179 -0
  61. data/lib/language_operator/cli/formatters/value_formatter.rb +113 -0
  62. data/lib/language_operator/cli/helpers/cluster_context.rb +62 -0
  63. data/lib/language_operator/cli/helpers/cluster_validator.rb +101 -0
  64. data/lib/language_operator/cli/helpers/editor_helper.rb +58 -0
  65. data/lib/language_operator/cli/helpers/kubeconfig_validator.rb +167 -0
  66. data/lib/language_operator/cli/helpers/resource_dependency_checker.rb +74 -0
  67. data/lib/language_operator/cli/helpers/schedule_builder.rb +108 -0
  68. data/lib/language_operator/cli/helpers/user_prompts.rb +69 -0
  69. data/lib/language_operator/cli/main.rb +232 -0
  70. data/lib/language_operator/cli/templates/tools/generic.yaml +66 -0
  71. data/lib/language_operator/cli/wizards/agent_wizard.rb +246 -0
  72. data/lib/language_operator/cli/wizards/quickstart_wizard.rb +588 -0
  73. data/lib/language_operator/client/base.rb +214 -0
  74. data/lib/language_operator/client/config.rb +136 -0
  75. data/lib/language_operator/client/cost_calculator.rb +37 -0
  76. data/lib/language_operator/client/mcp_connector.rb +123 -0
  77. data/lib/language_operator/client.rb +19 -0
  78. data/lib/language_operator/config/cluster_config.rb +101 -0
  79. data/lib/language_operator/config/tool_patterns.yaml +57 -0
  80. data/lib/language_operator/config/tool_registry.rb +96 -0
  81. data/lib/language_operator/config.rb +138 -0
  82. data/lib/language_operator/dsl/adapter.rb +124 -0
  83. data/lib/language_operator/dsl/agent_context.rb +90 -0
  84. data/lib/language_operator/dsl/agent_definition.rb +427 -0
  85. data/lib/language_operator/dsl/chat_endpoint_definition.rb +115 -0
  86. data/lib/language_operator/dsl/config.rb +119 -0
  87. data/lib/language_operator/dsl/context.rb +50 -0
  88. data/lib/language_operator/dsl/execution_context.rb +47 -0
  89. data/lib/language_operator/dsl/helpers.rb +109 -0
  90. data/lib/language_operator/dsl/http.rb +184 -0
  91. data/lib/language_operator/dsl/mcp_server_definition.rb +73 -0
  92. data/lib/language_operator/dsl/parameter_definition.rb +124 -0
  93. data/lib/language_operator/dsl/registry.rb +36 -0
  94. data/lib/language_operator/dsl/shell.rb +125 -0
  95. data/lib/language_operator/dsl/tool_definition.rb +112 -0
  96. data/lib/language_operator/dsl/webhook_authentication.rb +114 -0
  97. data/lib/language_operator/dsl/webhook_definition.rb +106 -0
  98. data/lib/language_operator/dsl/workflow_definition.rb +259 -0
  99. data/lib/language_operator/dsl.rb +160 -0
  100. data/lib/language_operator/errors.rb +60 -0
  101. data/lib/language_operator/kubernetes/client.rb +279 -0
  102. data/lib/language_operator/kubernetes/resource_builder.rb +194 -0
  103. data/lib/language_operator/loggable.rb +47 -0
  104. data/lib/language_operator/logger.rb +141 -0
  105. data/lib/language_operator/retry.rb +123 -0
  106. data/lib/language_operator/retryable.rb +132 -0
  107. data/lib/language_operator/tool_loader.rb +242 -0
  108. data/lib/language_operator/validators.rb +170 -0
  109. data/lib/language_operator/version.rb +1 -1
  110. data/lib/language_operator.rb +65 -3
  111. data/requirements/tasks/challenge.md +9 -0
  112. data/requirements/tasks/iterate.md +36 -0
  113. data/requirements/tasks/optimize.md +21 -0
  114. data/requirements/tasks/tag.md +5 -0
  115. data/test_agent_dsl.rb +108 -0
  116. metadata +503 -20
data/LICENSE CHANGED
@@ -1,21 +1,229 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 James Ryan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ Licensor: Language Operator Contributors
4
+ Software: Language Operator Ruby SDK & CLI
5
+
6
+ Use Limitation: The Software may not be used to provide a commercial
7
+ database service, data processing service, or other commercial offering
8
+ that makes the functionality of the Software available to third parties.
9
+
10
+ Specifically, you may not:
11
+ - Provide "Language Operator as a Service" or similar managed offerings
12
+ - Offer the Software as a hosted or managed service to third parties
13
+ - Incorporate the Software into a commercial product that directly
14
+ competes with the Licensor's offerings
15
+
16
+ License Grant: Subject to the Use Limitation, Licensor grants you a
17
+ non-exclusive, worldwide, royalty-free, non-transferable license to:
18
+ - Use, copy, modify, and create derivative works of the Software
19
+ - Distribute copies of the Software
20
+ - Use the Software internally within your organization
21
+ - Use the Software for development, testing, and non-commercial purposes
22
+
23
+ The above rights may be exercised in any medium or format, whether now
24
+ known or later created.
25
+
26
+ Change Date: 2028-01-01
27
+
28
+ Change License: Apache License, Version 2.0
29
+
30
+ Future License Text:
31
+
32
+ Apache License
33
+ Version 2.0, January 2004
34
+ http://www.apache.org/licenses/
35
+
36
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
37
+
38
+ 1. Definitions.
39
+
40
+ "License" shall mean the terms and conditions for use, reproduction,
41
+ and distribution as defined by Sections 1 through 9 of this document.
42
+
43
+ "Licensor" shall mean the copyright owner or entity authorized by
44
+ the copyright owner that is granting the License.
45
+
46
+ "Legal Entity" shall mean the union of the acting entity and all
47
+ other entities that control, are controlled by, or are under common
48
+ control with that entity. For the purposes of this definition,
49
+ "control" means (i) the power, direct or indirect, to cause the
50
+ direction or management of such entity, whether by contract or
51
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
52
+ outstanding shares, or (iii) beneficial ownership of such entity.
53
+
54
+ "You" (or "Your") shall mean an individual or Legal Entity
55
+ exercising permissions granted by this License.
56
+
57
+ "Source" form shall mean the preferred form for making modifications,
58
+ including but not limited to software source code, documentation
59
+ source, and configuration files.
60
+
61
+ "Object" form shall mean any form resulting from mechanical
62
+ transformation or translation of a Source form, including but
63
+ not limited to compiled object code, generated documentation,
64
+ and conversions to other media types.
65
+
66
+ "Work" shall mean the work of authorship, whether in Source or
67
+ Object form, made available under the License, as indicated by a
68
+ copyright notice that is included in or attached to the work
69
+ (an example is provided in the Appendix below).
70
+
71
+ "Derivative Works" shall mean any work, whether in Source or Object
72
+ form, that is based on (or derived from) the Work and for which the
73
+ editorial revisions, annotations, elaborations, or other modifications
74
+ represent, as a whole, an original work of authorship. For the purposes
75
+ of this License, Derivative Works shall not include works that remain
76
+ separable from, or merely link (or bind by name) to the interfaces of,
77
+ the Work and Derivative Works thereof.
78
+
79
+ "Contribution" shall mean any work of authorship, including
80
+ the original version of the Work and any modifications or additions
81
+ to that Work or Derivative Works thereof, that is intentionally
82
+ submitted to Licensor for inclusion in the Work by the copyright owner
83
+ or by an individual or Legal Entity authorized to submit on behalf of
84
+ the copyright owner. For the purposes of this definition, "submitted"
85
+ means any form of electronic, verbal, or written communication sent
86
+ to the Licensor or its representatives, including but not limited to
87
+ communication on electronic mailing lists, source code control systems,
88
+ and issue tracking systems that are managed by, or on behalf of, the
89
+ Licensor for the purpose of discussing and improving the Work, but
90
+ excluding communication that is conspicuously marked or otherwise
91
+ designated in writing by the copyright owner as "Not a Contribution."
92
+
93
+ "Contributor" shall mean Licensor and any individual or Legal Entity
94
+ on behalf of whom a Contribution has been received by Licensor and
95
+ subsequently incorporated within the Work.
96
+
97
+ 2. Grant of Copyright License. Subject to the terms and conditions of
98
+ this License, each Contributor hereby grants to You a perpetual,
99
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
100
+ copyright license to reproduce, prepare Derivative Works of,
101
+ publicly display, publicly perform, sublicense, and distribute the
102
+ Work and such Derivative Works in Source or Object form.
103
+
104
+ 3. Grant of Patent License. Subject to the terms and conditions of
105
+ this License, each Contributor hereby grants to You a perpetual,
106
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
107
+ (except as stated in this section) patent license to make, have made,
108
+ use, offer to sell, sell, import, and otherwise transfer the Work,
109
+ where such license applies only to those patent claims licensable
110
+ by such Contributor that are necessarily infringed by their
111
+ Contribution(s) alone or by combination of their Contribution(s)
112
+ with the Work to which such Contribution(s) was submitted. If You
113
+ institute patent litigation against any entity (including a
114
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
115
+ or a Contribution incorporated within the Work constitutes direct
116
+ or contributory patent infringement, then any patent licenses
117
+ granted to You under this License for that Work shall terminate
118
+ as of the date such litigation is filed.
119
+
120
+ 4. Redistribution. You may reproduce and distribute copies of the
121
+ Work or Derivative Works thereof in any medium, with or without
122
+ modifications, and in Source or Object form, provided that You
123
+ meet the following conditions:
124
+
125
+ (a) You must give any other recipients of the Work or
126
+ Derivative Works a copy of this License; and
127
+
128
+ (b) You must cause any modified files to carry prominent notices
129
+ stating that You changed the files; and
130
+
131
+ (c) You must retain, in the Source form of any Derivative Works
132
+ that You distribute, all copyright, patent, trademark, and
133
+ attribution notices from the Source form of the Work,
134
+ excluding those notices that do not pertain to any part of
135
+ the Derivative Works; and
136
+
137
+ (d) If the Work includes a "NOTICE" text file as part of its
138
+ distribution, then any Derivative Works that You distribute must
139
+ include a readable copy of the attribution notices contained
140
+ within such NOTICE file, excluding those notices that do not
141
+ pertain to any part of the Derivative Works, in at least one
142
+ of the following places: within a NOTICE text file distributed
143
+ as part of the Derivative Works; within the Source form or
144
+ documentation, if provided along with the Derivative Works; or,
145
+ within a display generated by the Derivative Works, if and
146
+ wherever such third-party notices normally appear. The contents
147
+ of the NOTICE file are for informational purposes only and
148
+ do not modify the License. You may add Your own attribution
149
+ notices within Derivative Works that You distribute, alongside
150
+ or as an addendum to the NOTICE text from the Work, provided
151
+ that such additional attribution notices cannot be construed
152
+ as modifying the License.
153
+
154
+ You may add Your own copyright statement to Your modifications and
155
+ may provide additional or different license terms and conditions
156
+ for use, reproduction, or distribution of Your modifications, or
157
+ for any such Derivative Works as a whole, provided Your use,
158
+ reproduction, and distribution of the Work otherwise complies with
159
+ the conditions stated in this License.
160
+
161
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
162
+ any Contribution intentionally submitted for inclusion in the Work
163
+ by You to the Licensor shall be under the terms and conditions of
164
+ this License, without any additional terms or conditions.
165
+ Notwithstanding the above, nothing herein shall supersede or modify
166
+ the terms of any separate license agreement you may have executed
167
+ with Licensor regarding such Contributions.
168
+
169
+ 6. Trademarks. This License does not grant permission to use the trade
170
+ names, trademarks, service marks, or product names of the Licensor,
171
+ except as required for reasonable and customary use in describing the
172
+ origin of the Work and reproducing the content of the NOTICE file.
173
+
174
+ 7. Disclaimer of Warranty. Unless required by applicable law or
175
+ agreed to in writing, Licensor provides the Work (and each
176
+ Contributor provides its Contributions) on an "AS IS" BASIS,
177
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
178
+ implied, including, without limitation, any warranties or conditions
179
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
180
+ PARTICULAR PURPOSE. You are solely responsible for determining the
181
+ appropriateness of using or redistributing the Work and assume any
182
+ risks associated with Your exercise of permissions under this License.
183
+
184
+ 8. Limitation of Liability. In no event and under no legal theory,
185
+ whether in tort (including negligence), contract, or otherwise,
186
+ unless required by applicable law (such as deliberate and grossly
187
+ negligent acts) or agreed to in writing, shall any Contributor be
188
+ liable to You for damages, including any direct, indirect, special,
189
+ incidental, or consequential damages of any character arising as a
190
+ result of this License or out of the use or inability to use the
191
+ Work (including but not limited to damages for loss of goodwill,
192
+ work stoppage, computer failure or malfunction, or any and all
193
+ other commercial damages or losses), even if such Contributor
194
+ has been advised of the possibility of such damages.
195
+
196
+ 9. Accepting Warranty or Additional Liability. While redistributing
197
+ the Work or Derivative Works thereof, You may choose to offer,
198
+ and charge a fee for, acceptance of support, warranty, indemnity,
199
+ or other liability obligations and/or rights consistent with this
200
+ License. However, in accepting such obligations, You may act only
201
+ on Your own behalf and on Your sole responsibility, not on behalf
202
+ of any other Contributor, and only if You agree to indemnify,
203
+ defend, and hold each Contributor harmless for any liability
204
+ incurred by, or claims asserted against, such Contributor by reason
205
+ of your accepting any such warranty or additional liability.
206
+
207
+ END OF TERMS AND CONDITIONS
208
+
209
+ Copyright 2025-present Language Operator Contributors
210
+
211
+ Licensed under the Apache License, Version 2.0 (the "License");
212
+ you may not use this file except in compliance with the License.
213
+ You may obtain a copy of the License at
214
+
215
+ http://www.apache.org/licenses/LICENSE-2.0
216
+
217
+ Unless required by applicable law or agreed to in writing, software
218
+ distributed under the License is distributed on an "AS IS" BASIS,
219
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
220
+ See the License for the specific language governing permissions and
221
+ limitations under the License.
222
+
223
+ ---
224
+
225
+ Notice: On or after the Change Date (2028-01-01), this Software will be
226
+ automatically licensed under the Apache License, Version 2.0 as specified
227
+ above. Until that date, the Use Limitation applies.
228
+
229
+ For questions about licensing, please contact the project maintainers.
data/Makefile ADDED
@@ -0,0 +1,77 @@
1
+ .PHONY: help build test install console docs clean version-bump lint
2
+
3
+ .DEFAULT_GOAL := help
4
+
5
+ help: ## Show this help message
6
+ @echo 'Usage: make [target]'
7
+ @echo ''
8
+ @echo 'Available targets:'
9
+ @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
10
+
11
+ build: ## Build the gem
12
+ @echo "Building language-operator gem..."
13
+ @gem build language-operator.gemspec
14
+ @echo "✅ Gem built successfully"
15
+
16
+ test: ## Run the test suite
17
+ @echo "Running tests..."
18
+ @bundle exec rspec
19
+ @echo "✅ All tests passed"
20
+
21
+ install: build ## Build and install the gem locally
22
+ @echo "Installing gem..."
23
+ @gem install language-operator-*.gem
24
+ @echo "✅ Gem installed successfully"
25
+
26
+ console: ## Open an IRB console with the gem loaded
27
+ @bundle exec rake console
28
+
29
+ docs: ## Generate YARD documentation
30
+ @echo "Generating documentation..."
31
+ @bundle exec yard doc
32
+ @echo "✅ Documentation generated in doc/"
33
+
34
+ lint: ## Run RuboCop linter
35
+ @echo "Running RuboCop..."
36
+ @bundle exec rubocop
37
+ @echo "✅ No linting issues found"
38
+
39
+ lint-fix: ## Auto-fix RuboCop issues
40
+ @echo "Auto-fixing RuboCop issues..."
41
+ @bundle exec rubocop --autocorrect-all
42
+
43
+ clean: ## Clean build artifacts
44
+ @echo "Cleaning build artifacts..."
45
+ @rm -f language-operator-*.gem
46
+ @rm -rf doc/
47
+ @rm -rf .yardoc/
48
+ @echo "✅ Cleaned"
49
+
50
+ version-bump: ## Bump version (usage: make version-bump TYPE=patch|minor|major)
51
+ @if [ -z "$(TYPE)" ]; then \
52
+ echo "❌ Error: TYPE not specified"; \
53
+ echo "Usage: make version-bump TYPE=patch|minor|major"; \
54
+ exit 1; \
55
+ fi
56
+ @./bin/bump-version $(TYPE)
57
+
58
+ version-bump-patch: ## Bump patch version (0.1.0 -> 0.1.1)
59
+ @./bin/bump-version patch
60
+
61
+ version-bump-minor: ## Bump minor version (0.1.0 -> 0.2.0)
62
+ @./bin/bump-version minor
63
+
64
+ version-bump-major: ## Bump major version (0.1.0 -> 1.0.0)
65
+ @./bin/bump-version major
66
+
67
+ # CI targets
68
+ ci-test: test lint ## Run CI test suite (tests + linting)
69
+
70
+ # Development workflow
71
+ dev-setup: ## Install development dependencies
72
+ @echo "Installing dependencies..."
73
+ @bundle install
74
+ @echo "✅ Development environment ready"
75
+
76
+ dev-watch: ## Run tests in watch mode
77
+ @bundle exec guard
data/README.md CHANGED
@@ -1,13 +1,5 @@
1
- # Language Operator - Placeholder
1
+ # Ruby SDK for Language Operator
2
2
 
3
- **This gem is a placeholder to reserve the name "language-operator" on RubyGems.**
3
+ [![Gem Version](https://img.shields.io/gem/v/language-operator.svg)](https://rubygems.org/gems/language-operator)
4
4
 
5
- ## About
6
-
7
- Language Operator is a Kubernetes operator for deploying and managing language model agents, tools, and models in Kubernetes clusters.
8
-
9
- The project is currently under active development. Once the initial release is ready, this placeholder will be replaced with the actual gem.
10
-
11
- ## License
12
-
13
- MIT License - See LICENSE file for details.
5
+ This gem is experimental, used by [language-operator](https://github.com/language-operator/language-operator), and not ready for production.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.exclude_pattern = 'spec/e2e/**/*_spec.rb'
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new(:e2e) do |t|
12
+ t.pattern = 'spec/e2e/**/*_spec.rb'
13
+ t.rspec_opts = '--tag e2e'
14
+ end
15
+
16
+ RuboCop::RakeTask.new
17
+
18
+ desc 'Run all tests (unit + e2e)'
19
+ task test: %i[spec e2e]
20
+
21
+ task default: %i[spec rubocop]
22
+
23
+ desc 'Generate YARD documentation'
24
+ task :docs do
25
+ sh 'yard doc'
26
+ end
27
+
28
+ desc 'Open console with gem loaded'
29
+ task :console do
30
+ require 'irb'
31
+ require 'language_operator'
32
+ ARGV.clear
33
+ IRB.start
34
+ end
data/bin/aictl ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/language_operator'
5
+ require_relative '../lib/language_operator/cli/main'
6
+
7
+ LanguageOperator::CLI::Main.start(ARGV)
@@ -0,0 +1,232 @@
1
+ #compdef aictl
2
+
3
+ # zsh completion for aictl
4
+
5
+ _aictl() {
6
+ local -a commands
7
+ local curcontext="$curcontext" state line
8
+ typeset -A opt_args
9
+
10
+ commands=(
11
+ 'cluster:Manage language clusters'
12
+ 'use:Switch to a different cluster context'
13
+ 'agent:Manage autonomous agents'
14
+ 'persona:Manage agent personas'
15
+ 'tool:Manage MCP tools'
16
+ 'status:Show system status and overview'
17
+ 'version:Show aictl and operator version'
18
+ 'new:Generate a new tool or agent project'
19
+ 'serve:Start an MCP server for tools'
20
+ 'test:Test tool definitions'
21
+ 'run:Run an agent'
22
+ 'console:Start an interactive Ruby console'
23
+ 'help:Show help'
24
+ )
25
+
26
+ _arguments -C \
27
+ '1: :->command' \
28
+ '*::arg:->args'
29
+
30
+ case $state in
31
+ command)
32
+ _describe 'aictl command' commands
33
+ ;;
34
+ args)
35
+ case $line[1] in
36
+ cluster)
37
+ _aictl_cluster
38
+ ;;
39
+ use)
40
+ _aictl_use
41
+ ;;
42
+ agent)
43
+ _aictl_agent
44
+ ;;
45
+ persona)
46
+ _aictl_persona
47
+ ;;
48
+ tool)
49
+ _aictl_tool
50
+ ;;
51
+ new)
52
+ _aictl_new
53
+ ;;
54
+ esac
55
+ ;;
56
+ esac
57
+ }
58
+
59
+ _aictl_cluster() {
60
+ local -a subcommands
61
+ subcommands=(
62
+ 'create:Create a new language cluster'
63
+ 'list:List all language clusters'
64
+ 'current:Show current cluster context'
65
+ 'inspect:Show detailed cluster information'
66
+ 'delete:Delete a language cluster'
67
+ )
68
+
69
+ _arguments -C \
70
+ '1: :->subcommand' \
71
+ '*::arg:->args'
72
+
73
+ case $state in
74
+ subcommand)
75
+ _describe 'cluster subcommand' subcommands
76
+ ;;
77
+ args)
78
+ case $line[1] in
79
+ inspect|delete)
80
+ _aictl_clusters
81
+ ;;
82
+ esac
83
+ ;;
84
+ esac
85
+ }
86
+
87
+ _aictl_use() {
88
+ _aictl_clusters
89
+ }
90
+
91
+ _aictl_agent() {
92
+ local -a subcommands
93
+ subcommands=(
94
+ 'create:Create a new autonomous agent'
95
+ 'list:List agents in current cluster'
96
+ 'inspect:Show detailed agent information'
97
+ 'delete:Delete an agent'
98
+ 'logs:View agent execution logs'
99
+ 'code:Display synthesized agent code'
100
+ 'edit:Edit agent instructions'
101
+ 'pause:Pause scheduled agent execution'
102
+ 'resume:Resume paused agent'
103
+ )
104
+
105
+ _arguments -C \
106
+ '1: :->subcommand' \
107
+ '*::arg:->args'
108
+
109
+ case $state in
110
+ subcommand)
111
+ _describe 'agent subcommand' subcommands
112
+ ;;
113
+ args)
114
+ case $line[1] in
115
+ create)
116
+ _arguments \
117
+ '--cluster=[Override current cluster context]:cluster:_aictl_clusters' \
118
+ '--create-cluster=[Create cluster inline]:name:' \
119
+ '--persona=[Use specific persona]:persona:_aictl_personas' \
120
+ '--dry-run[Preview without creating]'
121
+ ;;
122
+ list)
123
+ _arguments \
124
+ '--all-clusters[Show agents from all clusters]' \
125
+ '--cluster=[Show agents from specific cluster]:cluster:_aictl_clusters'
126
+ ;;
127
+ inspect|delete|logs|code|edit|pause|resume)
128
+ _aictl_agents
129
+ ;;
130
+ esac
131
+ ;;
132
+ esac
133
+ }
134
+
135
+ _aictl_persona() {
136
+ local -a subcommands
137
+ subcommands=(
138
+ 'list:List available personas'
139
+ 'show:Display full persona details'
140
+ 'create:Create a new custom persona'
141
+ 'edit:Edit an existing persona'
142
+ 'delete:Delete a persona'
143
+ )
144
+
145
+ _arguments -C \
146
+ '1: :->subcommand' \
147
+ '*::arg:->args'
148
+
149
+ case $state in
150
+ subcommand)
151
+ _describe 'persona subcommand' subcommands
152
+ ;;
153
+ args)
154
+ case $line[1] in
155
+ create)
156
+ _arguments \
157
+ '--from=[Inherit from existing persona]:persona:_aictl_personas' \
158
+ '--cluster=[Override current cluster]:cluster:_aictl_clusters'
159
+ ;;
160
+ show|edit|delete)
161
+ _aictl_personas
162
+ ;;
163
+ esac
164
+ ;;
165
+ esac
166
+ }
167
+
168
+ _aictl_tool() {
169
+ local -a subcommands
170
+ subcommands=(
171
+ 'list:List tools in current cluster'
172
+ 'install:Install a new MCP tool'
173
+ 'auth:Configure tool authentication'
174
+ 'test:Test tool connectivity'
175
+ 'delete:Delete a tool'
176
+ )
177
+
178
+ _arguments -C \
179
+ '1: :->subcommand' \
180
+ '*::arg:->args'
181
+
182
+ case $state in
183
+ subcommand)
184
+ _describe 'tool subcommand' subcommands
185
+ ;;
186
+ args)
187
+ case $line[1] in
188
+ auth|test|delete)
189
+ _aictl_tools
190
+ ;;
191
+ list)
192
+ _arguments \
193
+ '--cluster=[Override current cluster]:cluster:_aictl_clusters'
194
+ ;;
195
+ esac
196
+ ;;
197
+ esac
198
+ }
199
+
200
+ _aictl_new() {
201
+ local -a types
202
+ types=('tool:Generate a new tool project' 'agent:Generate a new agent project')
203
+ _describe 'project type' types
204
+ }
205
+
206
+ # Helper functions for dynamic completion
207
+
208
+ _aictl_clusters() {
209
+ local -a clusters
210
+ clusters=(${(f)"$(aictl cluster list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME')"})
211
+ _describe 'cluster' clusters
212
+ }
213
+
214
+ _aictl_agents() {
215
+ local -a agents
216
+ agents=(${(f)"$(aictl agent list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME')"})
217
+ _describe 'agent' agents
218
+ }
219
+
220
+ _aictl_personas() {
221
+ local -a personas
222
+ personas=(${(f)"$(aictl persona list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME')"})
223
+ _describe 'persona' personas
224
+ }
225
+
226
+ _aictl_tools() {
227
+ local -a tools
228
+ tools=(${(f)"$(aictl tool list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME')"})
229
+ _describe 'tool' tools
230
+ }
231
+
232
+ _aictl "$@"