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