Implements a full Language Server Protocol server accessible via `streamd lsp`. The server communicates over stdin/stdout and auto- detects the workspace root from the LSP initialize request. Features implemented: - Passive mode when no .streamd.toml exists in workspace root - Workspace-root-based config loading (bypasses R22/R23 global config) - .streamd.toml file watcher (config reloads without restart) - textDocument/completion with @ trigger, conditional suggestions (if_with relationships), and temporal date/time snippets (R16) - textDocument/publishDiagnostics: R15 file-name format + R18 timesheet violations (overlapping timecards, unclosed days) - textDocument/documentSymbol: shard tree exposed as nested symbols - textDocument/codeAction: "Mark task as done" quickfix for @Task - workspace/symbol: cross-file shard search - textDocument/references: find all @Marker occurrences - textDocument/rename: rename @Marker across all files Dependencies added: tower-lsp 0.20, tokio, dashmap, serde_json
78 lines
1.8 KiB
Rust
78 lines
1.8 KiB
Rust
use clap::{Parser, Subcommand};
|
|
use clap_complete::Shell;
|
|
|
|
#[derive(Parser)]
|
|
#[command(name = "streamd")]
|
|
#[command(
|
|
author,
|
|
version,
|
|
about = "Personal knowledge management and time-tracking CLI using @Tag annotations"
|
|
)]
|
|
pub struct Cli {
|
|
#[command(subcommand)]
|
|
pub command: Option<Commands>,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum TodoAction {
|
|
/// Edit a task by its number
|
|
Edit {
|
|
/// Task number to edit
|
|
number: usize,
|
|
},
|
|
/// Mark a task as done
|
|
Done {
|
|
/// Task number to mark as done
|
|
number: usize,
|
|
},
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Commands {
|
|
/// Create a new stream file
|
|
New,
|
|
|
|
/// Display open tasks
|
|
Todo {
|
|
/// Show tasks with dates in the future
|
|
#[arg(long)]
|
|
show_future: bool,
|
|
|
|
#[command(subcommand)]
|
|
action: Option<TodoAction>,
|
|
},
|
|
|
|
/// Edit a stream file by position
|
|
Edit {
|
|
/// Position of the file to edit (0 = most recent, negative = from oldest)
|
|
#[arg(default_value = "1")]
|
|
number: i32,
|
|
},
|
|
|
|
/// Display extracted timesheets
|
|
Timesheet {
|
|
/// Display time as decimal hours (X.XXh) instead of the default HH:MM format
|
|
#[arg(short, long)]
|
|
decimal: bool,
|
|
|
|
/// Show all timecards grouped by day instead of the summary report
|
|
#[arg(short, long)]
|
|
debug: bool,
|
|
},
|
|
|
|
/// Open or create the daily entry for a given date
|
|
Daily {
|
|
/// Date in YYYYMMDD format (defaults to today in configured timezone)
|
|
date: Option<String>,
|
|
},
|
|
|
|
/// Generate shell completions
|
|
Completions {
|
|
/// Shell to generate completions for
|
|
#[arg(value_enum)]
|
|
shell: Shell,
|
|
},
|
|
|
|
/// Start LSP server (communicates over stdin/stdout)
|
|
Lsp,
|
|
}
|