1mod bench;
14mod check;
15mod completions;
16mod connect;
17mod connector;
18mod contracts;
19mod crystallize;
20mod doctor;
21mod dump;
22mod explain;
23mod flow;
24mod init;
25mod lint_fmt;
26mod mcp;
27mod merge_captain;
28mod models;
29mod orchestrator;
30mod package;
31mod persona;
32mod playground;
33mod portal;
34mod provider;
35mod quickstart;
36mod run;
37mod runs;
38mod serve;
39mod skill;
40mod skills;
41mod test;
42mod trace;
43mod trigger;
44mod trust;
45mod try_cmd;
46mod util;
47mod verify;
48mod viz;
49mod watch;
50
51pub(crate) use bench::BenchArgs;
52pub(crate) use check::{CheckArgs, CheckOutputFormat};
53pub(crate) use completions::{CompletionShell, CompletionsArgs};
54pub(crate) use connect::{
55 ConnectArgs, ConnectCommand, ConnectGenericArgs, ConnectGithubArgs, ConnectLinearArgs,
56 ConnectOAuthArgs,
57};
58pub(crate) use connector::{
59 ConnectorArgs, ConnectorCheckArgs, ConnectorCommand, ConnectorTestArgs,
60};
61pub(crate) use contracts::{
62 ContractsArgs, ContractsBundleArgs, ContractsCommand, ContractsHostCapabilitiesArgs,
63 ContractsOutputArgs,
64};
65pub(crate) use crystallize::{
66 CrystallizeArgs, CrystallizeCommand, CrystallizeIngestArgs, CrystallizeShadowArgs,
67 CrystallizeValidateArgs,
68};
69pub(crate) use doctor::DoctorArgs;
70pub(crate) use dump::{
71 DumpConnectorMatrixArgs, DumpHighlightKeywordsArgs, DumpTriggerQuickrefArgs,
72};
73pub(crate) use explain::ExplainArgs;
74pub(crate) use flow::{
75 FlowArchivistCommand, FlowArchivistScanArgs, FlowArgs, FlowCommand, FlowReplayAuditArgs,
76 FlowShipCommand, FlowShipWatchArgs,
77};
78pub(crate) use init::{InitArgs, NewArgs, ProjectTemplate};
79pub(crate) use lint_fmt::{FmtArgs, PathTargetsArgs};
80pub(crate) use mcp::{McpArgs, McpCommand, McpLoginArgs, McpServeArgs, McpServerRefArgs};
81pub(crate) use merge_captain::{
82 MergeCaptainArgs, MergeCaptainAuditArgs, MergeCaptainAuditFormat, MergeCaptainBackendKind,
83 MergeCaptainCommand, MergeCaptainIterateArgs, MergeCaptainIterateFormat,
84 MergeCaptainLadderArgs, MergeCaptainLadderFormat, MergeCaptainMockCleanupArgs,
85 MergeCaptainMockCommand, MergeCaptainMockInitArgs, MergeCaptainMockServeArgs,
86 MergeCaptainMockStatusArgs, MergeCaptainMockStepArgs, MergeCaptainRunArgs,
87};
88pub(crate) use models::{
89 ModelRecommendArgs, ModelsArgs, ModelsCommand, ModelsInstallArgs, ModelsListArgs,
90 ModelsTestArgs,
91};
92pub(crate) use orchestrator::{
93 OrchestratorArgs, OrchestratorCommand, OrchestratorDeployArgs, OrchestratorDeployProvider,
94 OrchestratorDlqArgs, OrchestratorFireArgs, OrchestratorInspectArgs, OrchestratorLocalArgs,
95 OrchestratorLogFormat, OrchestratorQueueArgs, OrchestratorQueueCommand,
96 OrchestratorQueueDrainArgs, OrchestratorQueueLsArgs, OrchestratorQueuePurgeArgs,
97 OrchestratorRecoverArgs, OrchestratorReloadArgs, OrchestratorReplayArgs,
98 OrchestratorResumeArgs, OrchestratorServeArgs, OrchestratorStatsArgs, OrchestratorTenantArgs,
99 OrchestratorTenantCommand, OrchestratorTenantCreateArgs, OrchestratorTenantDeleteArgs,
100 OrchestratorTenantLsArgs, OrchestratorTenantSuspendArgs,
101};
102pub(crate) use package::{
103 AddArgs, InstallArgs, PackageArgs, PackageCacheCommand, PackageCommand, PublishArgs,
104 RemoveArgs, UpdateArgs,
105};
106pub(crate) use persona::{
107 PersonaArgs, PersonaCheckArgs, PersonaCommand, PersonaControlArgs, PersonaDoctorArgs,
108 PersonaInspectArgs, PersonaListArgs, PersonaNewArgs, PersonaSpendArgs, PersonaStatusArgs,
109 PersonaTemplateKind, PersonaTickArgs, PersonaTriggerArgs,
110};
111pub(crate) use playground::PlaygroundArgs;
112pub(crate) use portal::PortalArgs;
113pub(crate) use provider::{ModelInfoArgs, ProviderCatalogArgs, ProviderReadyArgs};
114pub(crate) use quickstart::QuickstartArgs;
115pub(crate) use run::RunArgs;
116pub(crate) use runs::{EvalArgs, ReplayArgs, RunsArgs, RunsCommand};
117pub(crate) use serve::{
118 A2aServeArgs, McpServeTransport, ServeAcpArgs, ServeArgs, ServeCommand, ServeMcpArgs,
119 ServeTlsMode,
120};
121pub(crate) use skill::{
122 SkillArgs, SkillCommand, SkillEndorseArgs, SkillKeyCommand, SkillKeyGenerateArgs,
123 SkillSignArgs, SkillTrustAddArgs, SkillTrustCommand, SkillTrustListArgs, SkillVerifyArgs,
124 SkillWhoSignedArgs,
125};
126pub(crate) use skills::{
127 SkillsArgs, SkillsCommand, SkillsInspectArgs, SkillsInstallArgs, SkillsListArgs,
128 SkillsMatchArgs, SkillsNewArgs,
129};
130pub(crate) use test::TestArgs;
131pub(crate) use trace::{TraceArgs, TraceCommand, TraceImportArgs};
132pub(crate) use trigger::{TriggerArgs, TriggerCancelArgs, TriggerCommand, TriggerReplayArgs};
133pub(crate) use try_cmd::TryArgs;
134#[allow(unused_imports)]
137pub(crate) use trust::{
138 TrustArgs, TrustCommand, TrustExportArgs, TrustOutcomeArg, TrustQueryArgs, TrustTierArg,
139 TrustVerifyChainArgs,
140};
141pub(crate) use verify::VerifyArgs;
142pub(crate) use viz::VizArgs;
143pub(crate) use watch::WatchArgs;
144
145use clap::{Parser, Subcommand};
146
147#[derive(Debug, Parser)]
148#[command(
149 name = "harn",
150 about = "The agent harness language",
151 version,
152 disable_help_subcommand = false,
153 arg_required_else_help = true
154)]
155pub(crate) struct Cli {
156 #[command(subcommand)]
157 pub command: Option<Command>,
158}
159
160#[derive(Debug, Subcommand)]
161pub(crate) enum Command {
162 #[command(long_about = "\
164Execute a .harn file or an inline expression.
165
166USAGE
167 harn run script.harn
168 harn run -e 'println(\"hello\")'
169 harn run script.harn -- arg1 arg2 (script reads `argv` as list<string>)
170
171CONCURRENCY
172 Harn supports first-class concurrency primitives:
173 - spawn { ... } — launch a task, return a handle
174 - parallel each LIST — concurrent map
175 - parallel settle LIST — concurrent map, collect Ok/Err
176 - parallel N — N-way fan-out
177 - with { max_concurrent: N } — cap in-flight workers
178 - channels, retry, select
179 https://harnlang.com/concurrency.html
180
181LLM THROTTLING
182 Providers can be rate-limited via `rpm:` in harn.toml / providers.toml
183 or via `HARN_RATE_LIMIT_<PROVIDER>=N`. Rate limits control throughput
184 (RPM); `max_concurrent` on `parallel` caps simultaneous in-flight jobs.
185
186SCRIPTING
187 LLM-readable one-pager: https://harnlang.com/docs/llm/harn-quickref.html
188 Human cheatsheet: https://harnlang.com/scripting-cheatsheet.html
189 Full docs: https://harnlang.com/
190")]
191 Run(RunArgs),
192 Check(CheckArgs),
194 Explain(ExplainArgs),
198 Contracts(ContractsArgs),
200 Lint(PathTargetsArgs),
202 Fmt(FmtArgs),
204 Test(TestArgs),
206 Init(InitArgs),
208 New(NewArgs),
210 Doctor(DoctorArgs),
215 Quickstart(QuickstartArgs),
217 Connect(Box<ConnectArgs>),
219 Connector(ConnectorArgs),
221 Serve(ServeArgs),
223 Mcp(McpArgs),
225 Watch(WatchArgs),
227 Portal(PortalArgs),
229 Trigger(TriggerArgs),
231 Flow(FlowArgs),
233 Trace(TraceArgs),
235 Crystallize(CrystallizeArgs),
237 Trust(TrustArgs),
239 #[command(name = "trust-graph")]
241 TrustGraph(TrustArgs),
242 Verify(VerifyArgs),
244 Completions(CompletionsArgs),
246 Orchestrator(OrchestratorArgs),
248 Playground(PlaygroundArgs),
250 Runs(RunsArgs),
252 Replay(ReplayArgs),
254 Eval(EvalArgs),
256 Repl,
258 Bench(BenchArgs),
260 Viz(VizArgs),
262 Install(InstallArgs),
264 Add(AddArgs),
266 Update(UpdateArgs),
268 Remove(RemoveArgs),
270 Lock,
272 Package(PackageArgs),
274 Publish(PublishArgs),
280 Persona(PersonaArgs),
282 #[command(name = "merge-captain")]
284 MergeCaptain(MergeCaptainArgs),
285 ModelInfo(ModelInfoArgs),
287 Models(ModelsArgs),
289 ProviderCatalog(ProviderCatalogArgs),
291 ProviderReady(ProviderReadyArgs),
293 #[command(name = "try")]
296 Try(TryArgs),
297 Skills(SkillsArgs),
299 Skill(SkillArgs),
301 Version,
303 #[command(hide = true, name = "dump-highlight-keywords")]
309 DumpHighlightKeywords(DumpHighlightKeywordsArgs),
310 #[command(hide = true, name = "dump-trigger-quickref")]
316 DumpTriggerQuickref(DumpTriggerQuickrefArgs),
317 #[command(hide = true, name = "dump-connector-matrix")]
323 DumpConnectorMatrix(DumpConnectorMatrixArgs),
324}
325
326#[cfg(test)]
327mod tests;