This repository was archived by the owner on Apr 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.rs
More file actions
758 lines (687 loc) · 25.7 KB
/
Copy pathquery.rs
File metadata and controls
758 lines (687 loc) · 25.7 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
//! Query commands: show, epics, tasks, list, cat, files, lock, unlock, lock-check.
//!
//! Reads from SQLite as the sole source of truth.
use std::fs;
use std::path::{Path, PathBuf};
use serde_json::json;
use crate::output::{error_exit, json_output, pretty_output};
use flowctl_core::id::{is_epic_id, is_task_id};
use flowctl_core::types::{
Epic, Task, SPECS_DIR,
};
use super::helpers::get_flow_dir;
// ── Helpers ─────────────────────────────────────────────────────────
/// Ensure .flow/ exists, error_exit if not.
fn ensure_flow_exists() -> PathBuf {
let flow_dir = get_flow_dir();
if !flow_dir.exists() {
error_exit(".flow/ does not exist. Run 'flowctl init' first.");
}
flow_dir
}
/// Serialize an Epic to the JSON format matching Python output.
fn epic_to_json(epic: &Epic) -> serde_json::Value {
let spec_path = format!(".flow/specs/{}.md", epic.id);
json!({
"id": epic.id,
"title": epic.title,
"status": epic.status.to_string(),
"branch_name": epic.branch_name,
"plan_review_status": epic.plan_review.to_string(),
"plan_reviewed_at": null,
"completion_review_status": epic.completion_review.to_string(),
"completion_reviewed_at": null,
"depends_on_epics": epic.depends_on_epics,
"default_impl": epic.default_impl,
"default_review": epic.default_review,
"default_sync": epic.default_sync,
"spec_path": spec_path,
"created_at": epic.created_at.to_rfc3339(),
"updated_at": epic.updated_at.to_rfc3339(),
})
}
/// Serialize a Task to the JSON format matching Python output.
fn task_to_json(task: &Task) -> serde_json::Value {
let spec_path = format!(".flow/tasks/{}.md", task.id);
// Try to get runtime state from JSON files
let mut assignee: serde_json::Value = json!(null);
let mut claimed_at: serde_json::Value = json!(null);
let claim_note: serde_json::Value = json!("");
let flow_dir = crate::commands::helpers::get_flow_dir();
if let Ok(state) = flowctl_core::json_store::state_read(&flow_dir, &task.id) {
if let Some(a) = &state.assignee {
assignee = json!(a);
}
if let Some(ca) = &state.claimed_at {
claimed_at = json!(ca.to_rfc3339());
}
}
json!({
"id": task.id,
"epic": task.epic,
"title": task.title,
"status": task.status.to_string(),
"priority": task.priority,
"domain": task.domain.to_string(),
"depends_on": task.depends_on,
"files": task.files,
"impl": task.r#impl,
"review": task.review,
"sync": task.sync,
"assignee": assignee,
"claimed_at": claimed_at,
"claim_note": claim_note,
"spec_path": spec_path,
"created_at": task.created_at.to_rfc3339(),
"updated_at": task.updated_at.to_rfc3339(),
})
}
/// Task summary for list/show contexts (less detail than full task_to_json).
fn task_summary_json(task: &Task) -> serde_json::Value {
json!({
"id": task.id,
"title": task.title,
"status": task.status.to_string(),
"priority": task.priority,
"depends_on": task.depends_on,
})
}
/// Task summary for tasks command (includes epic, domain).
fn task_list_json(task: &Task) -> serde_json::Value {
json!({
"id": task.id,
"epic": task.epic,
"title": task.title,
"status": task.status.to_string(),
"priority": task.priority,
"domain": task.domain.to_string(),
"depends_on": task.depends_on,
})
}
// ── JSON file data access ──────────────────────────────────────────
/// Get a single epic by ID from JSON files.
fn get_epic(flow_dir: &Path, id: &str) -> Option<Epic> {
flowctl_core::json_store::epic_read(flow_dir, id).ok()
}
/// Get a single task by ID from JSON files.
fn get_task(flow_dir: &Path, id: &str) -> Option<Task> {
flowctl_core::json_store::task_read(flow_dir, id).ok()
}
/// Get all tasks for an epic from JSON files.
fn get_epic_tasks(flow_dir: &Path, epic_id: &str) -> Vec<Task> {
flowctl_core::json_store::task_list_by_epic(flow_dir, epic_id).unwrap_or_default()
}
/// Get all epics from JSON files.
fn get_all_epics(flow_dir: &Path) -> Vec<Epic> {
flowctl_core::json_store::epic_list(flow_dir).unwrap_or_default()
}
/// Get all tasks, optionally filtered, from JSON files.
fn get_all_tasks(
flow_dir: &Path,
epic_filter: Option<&str>,
status_filter: Option<&str>,
domain_filter: Option<&str>,
) -> Vec<Task> {
match epic_filter {
Some(epic_id) => {
let mut tasks = flowctl_core::json_store::task_list_by_epic(flow_dir, epic_id).unwrap_or_default();
if let Some(status) = status_filter {
tasks.retain(|t| t.status.to_string() == status);
}
if let Some(domain) = domain_filter {
tasks.retain(|t| t.domain.to_string() == domain);
}
tasks
}
None => {
let mut tasks = flowctl_core::json_store::task_list_all(flow_dir).unwrap_or_default();
if let Some(status) = status_filter {
tasks.retain(|t| t.status.to_string() == status);
}
if let Some(domain) = domain_filter {
tasks.retain(|t| t.domain.to_string() == domain);
}
tasks
}
}
}
// ── Show command ────────────────────────────────────────────────────
pub fn cmd_show(json: bool, id: String) {
let flow_dir = ensure_flow_exists();
if is_epic_id(&id) {
let epic = match get_epic(&flow_dir, &id) {
Some(e) => e,
None => {
error_exit(&format!("Epic not found: {}", id));
}
};
// Get tasks for this epic
let tasks = get_epic_tasks(&flow_dir, &id);
let task_summaries: Vec<serde_json::Value> = tasks
.iter()
.map(task_summary_json)
.collect();
if json {
let mut result = epic_to_json(&epic);
result["tasks"] = json!(task_summaries);
json_output(result);
} else {
let mut buf = String::new();
buf.push_str(&format!("Epic: {}\n", epic.id));
buf.push_str(&format!("Title: {}\n", epic.title));
buf.push_str(&format!("Status: {}\n", epic.status));
buf.push_str(&format!("Spec: .flow/specs/{}.md\n", epic.id));
buf.push_str(&format!("\nTasks ({}):\n", tasks.len()));
for t in &tasks {
let deps = if t.depends_on.is_empty() {
String::new()
} else {
format!(" (deps: {})", t.depends_on.join(", "))
};
buf.push_str(&format!(" [{}] {}: {}{}\n", t.status, t.id, t.title, deps));
}
pretty_output("show", &buf);
}
} else if is_task_id(&id) {
let task = match get_task(&flow_dir, &id) {
Some(t) => t,
None => {
error_exit(&format!("Task not found: {}", id));
}
};
if json {
json_output(task_to_json(&task));
} else {
let mut buf = String::new();
buf.push_str(&format!("Task: {}\n", task.id));
buf.push_str(&format!("Epic: {}\n", task.epic));
buf.push_str(&format!("Title: {}\n", task.title));
buf.push_str(&format!("Status: {}\n", task.status));
if task.domain != flowctl_core::types::Domain::General {
buf.push_str(&format!("Domain: {}\n", task.domain));
}
let deps_str = if task.depends_on.is_empty() {
"none".to_string()
} else {
task.depends_on.join(", ")
};
buf.push_str(&format!("Depends on: {}\n", deps_str));
buf.push_str(&format!("Spec: .flow/tasks/{}.md\n", task.id));
pretty_output("show", &buf);
}
} else {
error_exit(&format!(
"Invalid ID: {}. Expected format: fn-N or fn-N-slug (epic), fn-N.M or fn-N-slug.M (task)",
id
));
}
}
// ── Epics command ───────────────────────────────────────────────────
pub fn cmd_epics(json: bool) {
let flow_dir = ensure_flow_exists();
let epics = get_all_epics(&flow_dir);
let mut epics_out: Vec<serde_json::Value> = Vec::new();
for epic in &epics {
let tasks = get_epic_tasks(&flow_dir, &epic.id);
let task_count = tasks.len();
let done_count = tasks
.iter()
.filter(|t| t.status == flowctl_core::state_machine::Status::Done)
.count();
epics_out.push(json!({
"id": epic.id,
"title": epic.title,
"status": epic.status.to_string(),
"tasks": task_count,
"done": done_count,
}));
}
if json {
json_output(json!({
"epics": epics_out,
"count": epics_out.len(),
}));
} else if epics_out.is_empty() {
println!("No epics found.");
} else {
use std::fmt::Write as _;
let mut buf = String::new();
writeln!(buf, "Epics ({}):\n", epics_out.len()).ok();
for e in &epics_out {
let tasks = e["tasks"].as_u64().unwrap_or(0);
let done = e["done"].as_u64().unwrap_or(0);
let progress = if tasks > 0 {
format!("{}/{}", done, tasks)
} else {
"0/0".to_string()
};
writeln!(
buf,
" [{}] {}: {} ({} tasks done)",
e["status"].as_str().unwrap_or(""),
e["id"].as_str().unwrap_or(""),
e["title"].as_str().unwrap_or(""),
progress
)
.ok();
}
pretty_output("epics", &buf);
}
}
// ── Tasks command ───────────────────────────────────────────────────
pub fn cmd_tasks(
json: bool,
epic: Option<String>,
status: Option<String>,
domain: Option<String>,
) {
let flow_dir = ensure_flow_exists();
let tasks = get_all_tasks(
&flow_dir,
epic.as_deref(),
status.as_deref(),
domain.as_deref(),
);
let tasks_out: Vec<serde_json::Value> = tasks.iter().map(task_list_json).collect();
if json {
json_output(json!({
"tasks": tasks_out,
"count": tasks_out.len(),
}));
} else if tasks_out.is_empty() {
let scope = epic.as_ref().map(|e| format!(" for epic {}", e)).unwrap_or_default();
let status_filter = status.as_ref().map(|s| format!(" with status '{}'", s)).unwrap_or_default();
println!("No tasks found{}{}.", scope, status_filter);
} else {
use std::fmt::Write as _;
let scope = epic.as_ref().map(|e| format!(" for {}", e)).unwrap_or_default();
let mut buf = String::new();
writeln!(buf, "Tasks{} ({}):\n", scope, tasks_out.len()).ok();
for t in &tasks {
let deps = if t.depends_on.is_empty() {
String::new()
} else {
format!(" (deps: {})", t.depends_on.join(", "))
};
let domain_tag = if t.domain != flowctl_core::types::Domain::General {
format!(" [{}]", t.domain)
} else {
String::new()
};
writeln!(
buf,
" [{}] {}: {}{}{}",
t.status, t.id, t.title, domain_tag, deps
)
.ok();
}
pretty_output("tasks", &buf);
}
}
// ── List command ────────────────────────────────────────────────────
pub fn cmd_list(json: bool) {
let flow_dir = ensure_flow_exists();
let epics = get_all_epics(&flow_dir);
let all_tasks = get_all_tasks(&flow_dir, None, None, None);
// Group tasks by epic
let mut tasks_by_epic: std::collections::HashMap<String, Vec<&Task>> =
std::collections::HashMap::new();
for task in &all_tasks {
tasks_by_epic
.entry(task.epic.clone())
.or_default()
.push(task);
}
if json {
let epics_out: Vec<serde_json::Value> = epics
.iter()
.map(|e| {
let task_list = tasks_by_epic.get(&e.id).map(std::vec::Vec::len).unwrap_or(0);
let done_count = tasks_by_epic
.get(&e.id)
.map(|tasks| {
tasks
.iter()
.filter(|t| t.status == flowctl_core::state_machine::Status::Done)
.count()
})
.unwrap_or(0);
json!({
"id": e.id,
"title": e.title,
"status": e.status.to_string(),
"tasks": task_list,
"done": done_count,
})
})
.collect();
let tasks_out: Vec<serde_json::Value> = all_tasks
.iter()
.map(|t| {
json!({
"id": t.id,
"epic": t.epic,
"title": t.title,
"status": t.status.to_string(),
"priority": t.priority,
"depends_on": t.depends_on,
})
})
.collect();
json_output(json!({
"epics": epics_out,
"tasks": tasks_out,
"epic_count": epics_out.len(),
"task_count": tasks_out.len(),
}));
} else if epics.is_empty() {
println!("No epics or tasks found.");
} else {
let total_tasks = all_tasks.len();
let total_done = all_tasks
.iter()
.filter(|t| t.status == flowctl_core::state_machine::Status::Done)
.count();
println!(
"Flow Status: {} epics, {} tasks ({} done)\n",
epics.len(),
total_tasks,
total_done
);
for e in &epics {
let task_list = tasks_by_epic.get(&e.id);
let done_count = task_list
.map(|tasks| {
tasks
.iter()
.filter(|t| t.status == flowctl_core::state_machine::Status::Done)
.count()
})
.unwrap_or(0);
let task_count = task_list.map(std::vec::Vec::len).unwrap_or(0);
let progress = if task_count > 0 {
format!("{}/{}", done_count, task_count)
} else {
"0/0".to_string()
};
println!(
"[{}] {}: {} ({} done)",
e.status, e.id, e.title, progress
);
if let Some(tasks) = task_list {
for t in tasks {
let deps = if t.depends_on.is_empty() {
String::new()
} else {
format!(" (deps: {})", t.depends_on.join(", "))
};
println!(
" [{}] {}: {}{}",
t.status, t.id, t.title, deps
);
}
}
println!();
}
}
}
// ── Cat command ─────────────────────────────────────────────────────
pub fn cmd_cat(id: String) {
let flow_dir = ensure_flow_exists();
if is_epic_id(&id) {
// Epic spec: still read from specs/ directory
let spec_path = flow_dir.join(SPECS_DIR).join(format!("{}.md", id));
match fs::read_to_string(&spec_path) {
Ok(content) => pretty_output("cat", &content),
Err(_) => {
error_exit(&format!("Spec not found: {}", spec_path.display()));
}
}
} else if is_task_id(&id) {
// Task body: read from JSON spec file
match flowctl_core::json_store::task_spec_read(&flow_dir, &id) {
Ok(body) => {
if body.is_empty() {
error_exit(&format!("Task spec not found: {}", id));
}
pretty_output("cat", &body);
}
Err(_) => {
error_exit(&format!("Task not found: {}", id));
}
}
} else {
error_exit(&format!(
"Invalid ID: {}. Expected format: fn-N or fn-N-slug (epic), fn-N.M or fn-N-slug.M (task)",
id
));
}
}
// ── Stub commands (not yet ported) ──────────────────────────────────
pub fn cmd_files(json_mode: bool, epic: String) {
let flow_dir = ensure_flow_exists();
if !is_epic_id(&epic) {
error_exit(&format!("Invalid epic ID: {}", epic));
}
let tasks = get_epic_tasks(&flow_dir, &epic);
// Build ownership map: file -> list of task IDs
let mut ownership: std::collections::BTreeMap<String, Vec<String>> =
std::collections::BTreeMap::new();
for task in &tasks {
let mut task_files: Vec<String> = task.files.clone();
// Fallback: parse **Files:** from task spec if no structured files
if task_files.is_empty() {
if let Ok(body) = flowctl_core::json_store::task_spec_read(&flow_dir, &task.id) {
for line in body.lines() {
if let Some(rest) = line.strip_prefix("**Files:**") {
task_files = rest
.split(',')
.map(|f| f.trim().trim_matches('`').to_string())
.filter(|f| !f.is_empty())
.collect();
break;
}
}
}
}
for fp in task_files {
ownership
.entry(fp)
.or_default()
.push(task.id.clone());
}
}
let conflicts: std::collections::BTreeMap<&String, &Vec<String>> = ownership
.iter()
.filter(|(_, tasks)| tasks.len() > 1)
.collect();
if json_mode {
json_output(json!({
"epic": epic,
"ownership": ownership,
"conflicts": conflicts,
"file_count": ownership.len(),
"conflict_count": conflicts.len(),
}));
} else {
use std::fmt::Write as _;
let mut buf = String::new();
writeln!(buf, "File ownership for {}:\n", epic).ok();
if ownership.is_empty() {
writeln!(buf, " No files declared.").ok();
} else {
for (f, task_ids) in &ownership {
if task_ids.len() == 1 {
writeln!(buf, " {} \u{2192} {}", f, task_ids[0]).ok();
} else {
writeln!(buf, " {} \u{2192} CONFLICT: {}", f, task_ids.join(", ")).ok();
}
}
if !conflicts.is_empty() {
writeln!(
buf,
"\n \u{26a0} {} file conflict(s) \u{2014} tasks sharing files cannot run in parallel",
conflicts.len()
)
.ok();
}
}
pretty_output("files", &buf);
}
}
// ── Lock commands (Teams mode) ─────────────────────────────────────
pub fn cmd_lock(json: bool, task: String, files: String, mode: String) {
let flow_dir = ensure_flow_exists();
let file_list: Vec<&str> = files.split(',').map(str::trim).filter(|s| !s.is_empty()).collect();
if file_list.is_empty() {
error_exit("No files specified for locking.");
}
let mut locked = Vec::new();
let mut already_locked = Vec::new();
for file in &file_list {
// Check for conflict: another task holding the file.
let locks = flowctl_core::json_store::locks_read(&flow_dir).unwrap_or_default();
let conflict = locks.iter().find(|l| l.file_path == *file && l.task_id != task);
if let Some(holder) = conflict {
already_locked.push(json!({"file": file, "owners": [format!("{}({mode})", holder.task_id)], "detail": format!("file '{}' already locked by task '{}'", file, holder.task_id)}));
} else {
match flowctl_core::json_store::lock_acquire(&flow_dir, file, &task, &mode) {
Ok(()) => locked.push(file.to_string()),
Err(e) => {
error_exit(&format!("Failed to lock {}: {}", file, e));
}
}
}
}
if json {
json_output(json!({
"locked": locked,
"already_locked": already_locked,
"task": task,
"mode": mode,
}));
} else {
if !locked.is_empty() {
println!("Locked {} file(s) for task {} (mode: {})", locked.len(), task, mode);
}
for al in &already_locked {
println!(
"Already locked: {} (owners: {})",
al["file"].as_str().unwrap_or(""),
al["owners"],
);
}
}
}
pub fn cmd_unlock(json: bool, task: Option<String>, _files: Option<String>, all: bool) {
let flow_dir = ensure_flow_exists();
if all {
match flowctl_core::json_store::locks_clear(&flow_dir) {
Ok(count) => {
if json {
json_output(json!({
"cleared": count,
"message": format!("Cleared {} file lock(s)", count),
}));
} else {
println!("Cleared {} file lock(s)", count);
}
}
Err(e) => error_exit(&format!("Failed to clear locks: {}", e)),
}
return;
}
let task_id = match task {
Some(t) => t,
None => {
error_exit("--task is required (or use --all to clear all locks)");
}
};
match flowctl_core::json_store::lock_release_task(&flow_dir, &task_id) {
Ok(count) => {
if json {
json_output(json!({
"task": task_id,
"unlocked": count,
"message": format!("Released {} lock(s) for task {}", count, task_id),
}));
} else {
println!("Released {} lock(s) for task {}", count, task_id);
}
}
Err(e) => error_exit(&format!("Failed to unlock: {}", e)),
}
}
pub fn cmd_lock_check(json: bool, file: Option<String>) {
let flow_dir = ensure_flow_exists();
match file {
Some(f) => {
let locks = flowctl_core::json_store::locks_read(&flow_dir).unwrap_or_default();
let holder = locks.iter().find(|l| l.file_path == f).map(|l| l.task_id.clone());
if let Some(task_id) = holder {
if json {
json_output(json!({
"file": f,
"locked": true,
"locks": [{"task_id": task_id, "mode": "write"}],
}));
} else {
println!("{}: locked by {}", f, task_id);
}
} else if json {
json_output(json!({
"file": f,
"locked": false,
}));
} else {
println!("{}: not locked", f);
}
}
None => {
let entries = flowctl_core::json_store::locks_read(&flow_dir)
.unwrap_or_else(|e| { error_exit(&format!("Query failed: {}", e)); });
let locks: Vec<serde_json::Value> = entries
.into_iter()
.map(|entry| json!({
"file": entry.file_path,
"task_id": entry.task_id,
"locked_at": entry.locked_at,
"mode": entry.mode,
}))
.collect();
if json {
json_output(json!({
"locks": locks,
"count": locks.len(),
}));
} else if locks.is_empty() {
println!("No file locks active.");
} else {
println!("Active file locks ({}):\n", locks.len());
for l in &locks {
println!(
" {} → {} [{}] (since {})",
l["file"].as_str().unwrap_or(""),
l["task_id"].as_str().unwrap_or(""),
l["mode"].as_str().unwrap_or("write"),
l["locked_at"].as_str().unwrap_or("")
);
}
}
}
}
}
pub fn cmd_heartbeat(json: bool, task: String) {
let _flow_dir = ensure_flow_exists();
// Heartbeat is a no-op with file-based locks (no TTL expiry).
// We still report success for protocol compatibility.
if json {
json_output(json!({
"task": task,
"extended": 0,
"message": "Heartbeat acknowledged (file-based locks have no TTL)",
}));
} else {
println!("Heartbeat acknowledged for task {} (file-based locks have no TTL)", task);
}
}