1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(
name = "conpub",
version,
about = "Publish local knowledge files to Confluence"
)]
pub(crate) struct Cli {
#[command(subcommand)]
pub(crate) command: Command,
/// Pretty-print JSON output for humans.
#[arg(long, global = true)]
pub(crate) pretty: bool,
}
#[derive(Subcommand)]
pub(crate) enum Command {
/// Set the user-level local knowledge root.
Root {
/// Local knowledge-base root directory.
dir: Option<PathBuf>,
/// Confluence Cloud base URL, for example https://example.atlassian.net/wiki.
#[arg(long)]
base_url: Option<String>,
},
/// Bind the current project to a source subdirectory and Confluence parent.
Bind {
/// Source path relative to the configured root.
source: String,
/// Confluence space key.
#[arg(long)]
space: Option<String>,
/// Confluence parent page ID.
#[arg(long)]
parent: Option<String>,
/// Override the user-level Confluence Cloud base URL for this project.
#[arg(long)]
base_url: Option<String>,
},
/// Resolve effective configuration for the current project.
Resolve,
/// Search local Markdown and Typst files.
Search {
/// Case-insensitive query string.
query: String,
/// Search the whole configured root instead of the bound source.
#[arg(long)]
all: bool,
/// Maximum number of matches to return.
#[arg(long, default_value_t = 50)]
limit: usize,
},
/// Build a persistent local search index.
Index {
/// Index the whole configured root instead of the bound source.
#[arg(long)]
all: bool,
},
/// Read a local file excerpt using a root-relative path or path:line reference.
Read {
/// Root-relative path, optionally suffixed with :line.
reference: String,
/// 1-based line number. Overrides a :line suffix.
#[arg(long)]
line: Option<usize>,
/// Number of lines before and after the target line.
#[arg(long, default_value_t = 20)]
context: usize,
},
/// Produce a local publish plan without remote writes.
Plan,
/// Publish to Confluence.
Publish {
/// Confirm remote writes.
#[arg(long)]
yes: bool,
/// Validate the local publish set without remote writes.
#[arg(long)]
dry_run: bool,
/// Delay between Confluence publish calls.
#[arg(long, default_value_t = 0)]
delay_ms: u64,
/// Publish concurrency. Currently only 1 is supported.
#[arg(long, default_value_t = 1)]
concurrency: usize,
},
/// Reconcile local documents with the last successful publish state.
Sync {
/// Optional root-relative, source-relative, or directory paths to sync.
paths: Vec<String>,
/// Confirm remote writes for changed local documents.
#[arg(long)]
yes: bool,
/// Plan the sync without remote writes.
#[arg(long)]
dry_run: bool,
/// Delay between Confluence publish calls.
#[arg(long, default_value_t = 0)]
delay_ms: u64,
/// Publish concurrency. Currently only 1 is supported.
#[arg(long, default_value_t = 1)]
concurrency: usize,
/// Archive deleted pages whose Confluence page IDs are known in local state.
#[arg(long)]
archive_deleted: bool,
},
/// Reconcile deleted state entries: drop bookkeeping residue, optionally
/// archiving or permanently deleting the remote pages first.
Prune {
/// Confirm state changes (and remote writes with --archive/--delete).
#[arg(long)]
yes: bool,
/// Archive the Confluence pages of deleted entries before dropping them.
#[arg(long)]
archive: bool,
/// Permanently delete the Confluence pages of deleted entries before dropping them.
#[arg(long)]
delete: bool,
},
/// Show local configuration and publish status summary.
Status,
}