1#![cfg_attr(
2 not(test),
3 deny(clippy::unwrap_used, clippy::panic, clippy::indexing_slicing)
4)]
5pub mod auth;
17pub mod clean;
18pub mod cli;
19pub mod comments;
20pub mod comments_meta;
21pub mod config;
22pub mod custom_id;
23pub mod doctor;
24pub mod envelope;
25pub mod error;
26pub mod google;
27pub mod open;
28pub mod orgfile;
29pub mod project;
30pub mod pull;
31pub mod push;
32pub mod sexp;
33pub mod syncstate;
34
35pub use error::{Error, Result};
36
37use tftio_cli_common::{
38 AgentCapability, AgentSurfaceSpec, CommandSelector, LicenseType, ToolSpec, workspace_tool,
39};
40
41const PUSH_COMMAND: CommandSelector = CommandSelector::new(&["push"]);
42const PULL_COMMAND: CommandSelector = CommandSelector::new(&["pull"]);
43const CLEAN_COMMAND: CommandSelector = CommandSelector::new(&["clean"]);
44const OPEN_COMMAND: CommandSelector = CommandSelector::new(&["open"]);
45
46const PUSH_CAPABILITY: AgentCapability =
47 AgentCapability::minimal("push-projection", &[PUSH_COMMAND], &[])
48 .with_when_to_use(
49 "the user wants to publish an org file's projection to its linked Google Doc (creating the doc on first push)",
50 )
51 .with_when_not_to_use("the user wants to retrieve reviewer comments (use pull instead)");
52
53const PULL_CAPABILITY: AgentCapability =
54 AgentCapability::minimal("pull-comments", &[PULL_COMMAND], &[])
55 .with_when_to_use(
56 "the user wants to fetch reviewer comments from the linked Google Doc into the org file's metadata section",
57 )
58 .with_when_not_to_use("the user wants to publish content to Google Docs (use push instead)");
59
60const CLEAN_CAPABILITY: AgentCapability =
61 AgentCapability::minimal("clean-comments", &[CLEAN_COMMAND], &[])
62 .with_when_to_use("the user wants to archive comments already marked DONE in the org file")
63 .with_when_not_to_use("the user wants to resolve comments in Google Docs (push does that)");
64
65const OPEN_CAPABILITY: AgentCapability = AgentCapability::minimal("open-doc", &[OPEN_COMMAND], &[])
66 .with_when_to_use("the user wants the browser URL of the org file's linked Google Doc")
67 .with_when_not_to_use("the org file has not yet been pushed to a Google Doc");
68
69const AGENT_SURFACE: AgentSurfaceSpec = AgentSurfaceSpec::new(&[
70 PUSH_CAPABILITY,
71 PULL_CAPABILITY,
72 CLEAN_CAPABILITY,
73 OPEN_CAPABILITY,
74]);
75
76pub const TOOL_SPEC: ToolSpec = workspace_tool(
78 "org-gdocs",
79 "org-gdocs",
80 env!("CARGO_PKG_VERSION"),
81 LicenseType::MIT,
82 true,
83 true,
84)
85.with_agent_surface(&AGENT_SURFACE);