mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-18 23:54:34 +01:00
package:http has no timeout; a dead connection wedged sync forever. CliSession now wraps its client: 30 s to headers, 30 s per body chunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWXgrX1QxVjqMiz6KFs
27 lines
907 B
Dart
27 lines
907 B
Dart
import 'dart:io';
|
|
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:todo/cli/cli_session.dart' show CliSession;
|
|
|
|
/// Default data dir: `$XDG_DATA_HOME/todo-cli`, else `~/.local/share/todo-cli`.
|
|
String defaultDataDir(Map<String, String> env) {
|
|
final xdg = env['XDG_DATA_HOME'] ?? '';
|
|
final base = xdg.isNotEmpty
|
|
? xdg
|
|
: p.join(env['HOME'] ?? '', '.local', 'share');
|
|
return p.join(base, 'todo-cli');
|
|
}
|
|
|
|
/// Node ids of the installs Claude files notes through: the MCP server and
|
|
/// the CLI under the same data root as [defaultDataDir]. Missing ones are
|
|
/// skipped.
|
|
Set<String> claudeNodeIds(Map<String, String> env) {
|
|
final cli = defaultDataDir(env);
|
|
return {
|
|
for (final dir in [cli, p.join(p.dirname(cli), 'todo-mcp')])
|
|
if (File(p.join(dir, CliSession.nodeIdFileName)) case final f
|
|
when f.existsSync())
|
|
f.readAsStringSync().trim(),
|
|
}..remove('');
|
|
}
|