mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-27 20:09:20 +01:00
Compare commits
No commits in common. "main" and "v1.0.104" have entirely different histories.
@ -1,136 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crdt_sync/crdt_sync.dart';
|
||||
import 'package:mcp_dart/mcp_dart.dart';
|
||||
|
||||
/// The MCP Skills extension (revision 2026-07-28). mcp_dart 2.4.4 has no
|
||||
/// typed API for it, so this file wires its two methods by hand: a
|
||||
/// capability under `extensions`, `skills/list` + `skills/get`, and the
|
||||
/// SKILL.md served as a plain resource the client reads and hash-checks.
|
||||
const kSkillsExtensionId = 'io.modelcontextprotocol/skills';
|
||||
|
||||
/// The skill's name; Claude Code lists it as `todo:filing-tasks`.
|
||||
const kFilingSkillName = 'filing-tasks';
|
||||
|
||||
/// SKILL.md's address. The last directory segment must equal the name.
|
||||
const kFilingSkillUri = 'skill://todo/$kFilingSkillName/SKILL.md';
|
||||
|
||||
const _description =
|
||||
"File, track and close a task in kuhy's todo app: the add_task fields, "
|
||||
'the "MANUAL WORK REQUIRED: " title, the "Todo: <id8>" commit trailer '
|
||||
'and closing with evidence. Use when asked to file, add or note a '
|
||||
'task, when you find work you will not finish now, and before you '
|
||||
"call a task's work done.";
|
||||
|
||||
// Kept in step with the copies in ~/.claude/CLAUDE.md and the
|
||||
// md-file-conventions skill: `claude -p` board workers never load MCP
|
||||
// skills, so those copies stay the source for them.
|
||||
const _body = '''
|
||||
# Filing tasks in the todo app
|
||||
|
||||
Tasks for kuhy's repos live in the todo app, never in TODO*.md files.
|
||||
|
||||
## add_task fields
|
||||
|
||||
- `repo`: `kuhyx/<origin repo name>`, e.g. `kuhyx/todo-app`.
|
||||
- `title`: one line naming the work.
|
||||
- `body`: markdown with what / where / done / verify.
|
||||
- `done_check`: a shell command run from the repo root, offline, under
|
||||
60 s, that exits 0 once the work is done. Its exit code settles it.
|
||||
- `priority`: low | medium | high (default medium).
|
||||
- `new_note: true` only when the task needs its own note; by default it
|
||||
joins the repo's single open note as a `## title` section.
|
||||
|
||||
## Work only kuhy can do
|
||||
|
||||
A task that needs kuhy's manual work has a title that starts with
|
||||
`MANUAL WORK REQUIRED: <what>`, in exactly those capitals.
|
||||
|
||||
## Closing a task
|
||||
|
||||
- Name the task in the commit that lands its work with a trailer line
|
||||
`Todo: <id8>` (its 8-character id prefix). The post-commit hook runs
|
||||
the task's done_check and closes it only on exit 0.
|
||||
- A task still open after that commit, or one with `Check: manual`:
|
||||
run its done_check yourself and only if it exits 0 call `close_task`
|
||||
with evidence `"<commit sha> done_check exit 0"`.
|
||||
- Never leave finished work's task open, and never close without
|
||||
running its done_check.
|
||||
''';
|
||||
|
||||
/// SKILL.md: frontmatter (JSON-quoted, which is valid YAML) then [_body].
|
||||
final String filingSkillMd = [
|
||||
'---',
|
||||
'name: ${jsonEncode(kFilingSkillName)}',
|
||||
'description: ${jsonEncode(_description)}',
|
||||
'---',
|
||||
_body,
|
||||
].join('\n');
|
||||
|
||||
/// The skill's `skills/list` entry; its one file carries size and digest.
|
||||
Map<String, dynamic> filingSkillEntry() {
|
||||
final bytes = utf8.encode(filingSkillMd);
|
||||
return {
|
||||
'uri': kFilingSkillUri,
|
||||
'frontmatter': {'name': kFilingSkillName, 'description': _description},
|
||||
'resources': [
|
||||
{
|
||||
'uri': kFilingSkillUri,
|
||||
'size': bytes.length,
|
||||
'digest': 'sha256:${revisionOf(filingSkillMd)}',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/// Publishes the filing skill on [server]; call before it connects.
|
||||
void registerFilingSkill(McpServer server) {
|
||||
final low = server.server
|
||||
..registerCapabilities(
|
||||
const ServerCapabilities(extensions: {kSkillsExtensionId: {}}),
|
||||
);
|
||||
server.registerResource(
|
||||
kFilingSkillName,
|
||||
kFilingSkillUri,
|
||||
(description: _description, mimeType: 'text/markdown'),
|
||||
(uri, _) => ReadResourceResult(
|
||||
contents: [
|
||||
TextResourceContents(
|
||||
uri: kFilingSkillUri,
|
||||
mimeType: 'text/markdown',
|
||||
text: filingSkillMd,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
void method(String name, Map<String, dynamic> Function(Object?) answer) =>
|
||||
low.setRequestHandler<JsonRpcRequest>(
|
||||
name,
|
||||
(request, _) async => _Json(answer(request.params?['uri'])),
|
||||
(id, params, meta) =>
|
||||
JsonRpcRequest(id: id, method: name, params: params, meta: meta),
|
||||
);
|
||||
method(
|
||||
'skills/list',
|
||||
(_) => {
|
||||
'skills': [filingSkillEntry()],
|
||||
},
|
||||
);
|
||||
method('skills/get', (uri) {
|
||||
if (uri == kFilingSkillUri) return {'skill': filingSkillEntry()};
|
||||
throw McpError(ErrorCode.resourceNotFound.value, 'no skill at $uri');
|
||||
});
|
||||
}
|
||||
|
||||
/// A result whose JSON is already built.
|
||||
class _Json implements BaseResultData {
|
||||
const _Json(this.json);
|
||||
|
||||
final Map<String, dynamic> json;
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get meta => null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => json;
|
||||
}
|
||||
@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mcp_dart/mcp_dart.dart';
|
||||
import 'package:todo/mcp/filing_skill.dart';
|
||||
import 'package:todo/mcp/request_guard.dart';
|
||||
import 'package:todo/mcp/task_service.dart';
|
||||
import 'package:todo/mcp/token_file.dart';
|
||||
@ -205,7 +204,6 @@ McpServer _server(TaskService tasks) {
|
||||
['query'],
|
||||
tasks.search,
|
||||
);
|
||||
registerFilingSkill(server);
|
||||
return server;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,6 @@ class AttachButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(
|
||||
tooltip: 'attach',
|
||||
icon: const Icon(Icons.attach_file, semanticLabel: 'Attach'),
|
||||
onPressed: () async {
|
||||
final files = await (picking ?? pickAttachments)(context);
|
||||
|
||||
@ -87,13 +87,11 @@ class CaptureAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
// Not gated on advanced mode: attaching is basic capture.
|
||||
AttachButton(onFiles: onAttachFiles, picking: attachmentPicking),
|
||||
IconButton(
|
||||
tooltip: 'new',
|
||||
onPressed: onNewNote,
|
||||
icon: const Icon(Icons.check, semanticLabel: 'New note'),
|
||||
),
|
||||
if (advanced)
|
||||
IconButton(
|
||||
tooltip: 'sync',
|
||||
onPressed: syncing ? null : onSync,
|
||||
icon: syncing
|
||||
? const WaitWatch(
|
||||
@ -107,7 +105,6 @@ class CaptureAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
: const Icon(Icons.sync, semanticLabel: 'Sync'),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'notes',
|
||||
onPressed: onOpenList,
|
||||
icon: const Icon(Icons.list, semanticLabel: 'Notes'),
|
||||
),
|
||||
@ -126,7 +123,6 @@ class CaptureAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
CaptureConfirmMark(captured: captured),
|
||||
IconButton(
|
||||
tooltip: 'settings',
|
||||
onPressed: onOpenSettings,
|
||||
icon: const Icon(Icons.settings, semanticLabel: 'Settings'),
|
||||
),
|
||||
|
||||
@ -189,7 +189,6 @@ class _CloudImagesScreenState extends State<CloudImagesScreen> {
|
||||
),
|
||||
if (!status.configured)
|
||||
IconButton(
|
||||
tooltip: 'copy',
|
||||
onPressed: () => unawaited(
|
||||
Clipboard.setData(
|
||||
const ClipboardData(text: kAddLoginCommand),
|
||||
|
||||
@ -42,14 +42,12 @@ class _ConfirmDeleteDialog extends StatelessWidget {
|
||||
actions: [
|
||||
IconButton(
|
||||
key: const ValueKey('confirm-cancel'),
|
||||
tooltip: 'cancel',
|
||||
autofocus: true,
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
icon: const Icon(Icons.close, semanticLabel: 'Cancel'),
|
||||
),
|
||||
IconButton(
|
||||
key: const ValueKey('confirm-delete'),
|
||||
tooltip: 'delete',
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
icon: Icon(Icons.delete, color: error, semanticLabel: 'Delete'),
|
||||
),
|
||||
|
||||
@ -15,10 +15,18 @@ import 'package:todo/ui/status_cue.dart';
|
||||
part 'github_mirror_screen_widget.dart';
|
||||
|
||||
class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
|
||||
late final _owner = TextEditingController(text: widget.initial.owner);
|
||||
late final _repo = TextEditingController(text: widget.initial.repo);
|
||||
late final _token = TextEditingController(text: widget.initial.token);
|
||||
late final _clientId = TextEditingController(text: widget.initial.clientId);
|
||||
late final TextEditingController _owner = TextEditingController(
|
||||
text: widget.initial.owner,
|
||||
);
|
||||
late final TextEditingController _repo = TextEditingController(
|
||||
text: widget.initial.repo,
|
||||
);
|
||||
late final TextEditingController _token = TextEditingController(
|
||||
text: widget.initial.token,
|
||||
);
|
||||
late final TextEditingController _clientId = TextEditingController(
|
||||
text: widget.initial.clientId,
|
||||
);
|
||||
|
||||
bool _testing = false;
|
||||
StatusCue? _status;
|
||||
@ -169,7 +177,6 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: IconButton.filled(
|
||||
tooltip: 'connect',
|
||||
onPressed: _connectGitHub,
|
||||
icon: const Icon(Icons.login, semanticLabel: 'Connect GitHub'),
|
||||
),
|
||||
@ -214,7 +221,6 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
|
||||
Row(
|
||||
children: [
|
||||
IconButton.outlined(
|
||||
tooltip: 'test',
|
||||
onPressed: _testing ? null : _test,
|
||||
icon: _testing
|
||||
? const WaitWatch(
|
||||
@ -232,7 +238,6 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
IconButton.filled(
|
||||
tooltip: 'save',
|
||||
onPressed: _save,
|
||||
icon: const Icon(Icons.save, semanticLabel: 'Save'),
|
||||
),
|
||||
|
||||
@ -99,7 +99,6 @@ class _NoteActionsSheetState extends State<NoteActionsSheet> {
|
||||
const SizedBox(height: 16),
|
||||
Align(
|
||||
child: IconButton.outlined(
|
||||
tooltip: 'delete',
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
icon: const Icon(
|
||||
Icons.delete_outline,
|
||||
|
||||
@ -16,8 +16,6 @@ const IconData kCreatedIcon = Icons.post_add;
|
||||
const IconData kUpdatedIcon = Icons.update;
|
||||
|
||||
/// A labelled date range shown as one preset menu plus a custom picker.
|
||||
///
|
||||
/// One-word tooltips on hover/long-press per textgate rule.
|
||||
class DateRangeField extends StatelessWidget {
|
||||
/// Creates a labelled date-range control.
|
||||
const DateRangeField({
|
||||
@ -98,29 +96,12 @@ class DateRangeField extends StatelessWidget {
|
||||
// A popup menu rather than DropdownButton: re-picking "Custom…" while a
|
||||
// custom range is shown must still reopen the picker.
|
||||
return PopupMenuButton<_Preset>(
|
||||
tooltip: 'range',
|
||||
// Empty, not the label: a tooltip is painted on long-press.
|
||||
tooltip: '',
|
||||
onSelected: (p) => _select(context, p),
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(
|
||||
value: _Preset.any,
|
||||
child: Tooltip(message: 'any', child: _Preset.any.glyph()),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _Preset.today,
|
||||
child: Tooltip(message: 'today', child: _Preset.today.glyph()),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _Preset.week,
|
||||
child: Tooltip(message: 'week', child: _Preset.week.glyph()),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _Preset.month,
|
||||
child: Tooltip(message: 'month', child: _Preset.month.glyph()),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _Preset.custom,
|
||||
child: Tooltip(message: 'custom', child: _Preset.custom.glyph()),
|
||||
),
|
||||
for (final p in _Preset.values)
|
||||
PopupMenuItem(value: p, child: p.glyph()),
|
||||
],
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
|
||||
@ -103,7 +103,6 @@ class _NoteDetailScreenState extends State<NoteDetailScreen> {
|
||||
picking: widget.attachmentPicking,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'copy',
|
||||
icon: Icon(
|
||||
_copied ? Icons.check : Icons.copy_all,
|
||||
semanticLabel: 'Copy',
|
||||
@ -111,7 +110,6 @@ class _NoteDetailScreenState extends State<NoteDetailScreen> {
|
||||
onPressed: _copy,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'delete',
|
||||
icon: const Icon(
|
||||
Icons.delete_outline,
|
||||
semanticLabel: 'Delete note',
|
||||
|
||||
@ -67,7 +67,6 @@ class NoteEditorStepPage extends StatelessWidget {
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: IconButton(
|
||||
tooltip: 'exit',
|
||||
icon: const Icon(Icons.arrow_back, semanticLabel: 'Exit guided'),
|
||||
onPressed: onExit,
|
||||
),
|
||||
|
||||
@ -58,7 +58,6 @@ class _NoteEditorWizardState extends State<NoteEditorWizard> {
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: 'cancel',
|
||||
icon: const Icon(Icons.close, semanticLabel: 'Cancel'),
|
||||
onPressed: widget.onCancel,
|
||||
),
|
||||
|
||||
@ -51,7 +51,6 @@ class NoteTile extends StatelessWidget {
|
||||
),
|
||||
subtitle: _meta(context),
|
||||
trailing: IconButton(
|
||||
tooltip: 'actions',
|
||||
icon: const Icon(Icons.more_vert, semanticLabel: 'Quick actions'),
|
||||
onPressed: onActions,
|
||||
),
|
||||
|
||||
@ -140,7 +140,6 @@ class _NotesListScreenState extends State<NotesListScreen> {
|
||||
_selectButton(),
|
||||
// Eye, no label: open = Claude-made notes shown, slashed = hidden.
|
||||
IconButton(
|
||||
tooltip: 'claude',
|
||||
icon: Icon(
|
||||
widget.appSettings.value.showClaudeNotes
|
||||
? Icons.visibility
|
||||
@ -149,7 +148,31 @@ class _NotesListScreenState extends State<NotesListScreen> {
|
||||
),
|
||||
onPressed: _toggleClaudeNotes,
|
||||
),
|
||||
_sortButton(),
|
||||
PopupMenuButton<NoteSort>(
|
||||
// Empty, not omitted: null falls back to the painted "Show menu".
|
||||
tooltip: '',
|
||||
icon: const Icon(Icons.sort, semanticLabel: 'Sort'),
|
||||
initialValue: _sort,
|
||||
onSelected: _setSort,
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(
|
||||
value: NoteSort.modifiedDesc,
|
||||
child: Icon(Icons.update, semanticLabel: 'Last updated'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.createdDesc,
|
||||
child: Icon(Icons.post_add, semanticLabel: 'Newest created'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.alphabetical,
|
||||
child: Icon(Icons.sort_by_alpha, semanticLabel: 'Alphabetical'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.priorityDesc,
|
||||
child: Icon(Icons.flag_outlined, semanticLabel: 'Priority'),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Filter icon with a badge counting user-applied facets. The
|
||||
// trailing padding + inward offset keep the badge from being
|
||||
// clipped at the screen edge.
|
||||
@ -160,7 +183,6 @@ class _NotesListScreenState extends State<NotesListScreen> {
|
||||
label: Text('$badgeCount'),
|
||||
offset: const Offset(-8, 4),
|
||||
child: IconButton(
|
||||
tooltip: 'filter',
|
||||
icon: const Icon(Icons.filter_list, semanticLabel: 'Filter'),
|
||||
onPressed: _openFilters,
|
||||
),
|
||||
|
||||
@ -9,7 +9,6 @@ extension _Selecting on _NotesListScreenState {
|
||||
/// App-bar toggle into and out of selection mode (tinted while on).
|
||||
Widget _selectButton() => IconButton(
|
||||
key: const ValueKey('select-mode'),
|
||||
tooltip: 'select',
|
||||
isSelected: _selection.active,
|
||||
onPressed: _selection.toggleMode,
|
||||
icon: const Icon(Icons.checklist, semanticLabel: 'Select'),
|
||||
@ -41,43 +40,4 @@ extension _Selecting on _NotesListScreenState {
|
||||
onClear: _selection.clear,
|
||||
);
|
||||
}
|
||||
|
||||
/// App-bar sort menu: one icon per order, each with a one-word tooltip.
|
||||
Widget _sortButton() => PopupMenuButton<NoteSort>(
|
||||
// One word, not omitted: null falls back to the painted "Show menu".
|
||||
tooltip: 'sort',
|
||||
icon: const Icon(Icons.sort, semanticLabel: 'Sort'),
|
||||
initialValue: _sort,
|
||||
onSelected: _setSort,
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(
|
||||
value: NoteSort.modifiedDesc,
|
||||
child: Tooltip(
|
||||
message: 'updated',
|
||||
child: Icon(Icons.update, semanticLabel: 'Last updated'),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.createdDesc,
|
||||
child: Tooltip(
|
||||
message: 'newest',
|
||||
child: Icon(Icons.post_add, semanticLabel: 'Newest created'),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.alphabetical,
|
||||
child: Tooltip(
|
||||
message: 'alphabetical',
|
||||
child: Icon(Icons.sort_by_alpha, semanticLabel: 'Alphabetical'),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: NoteSort.priorityDesc,
|
||||
child: Tooltip(
|
||||
message: 'priority',
|
||||
child: Icon(Icons.flag_outlined, semanticLabel: 'Priority'),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -13,7 +13,8 @@ const kRefusalFlash = Duration(milliseconds: 1500);
|
||||
|
||||
/// Set status, set priority, assign to repo, clear: icons only.
|
||||
///
|
||||
/// One-word tooltips on hover/long-press per textgate rule.
|
||||
/// Menus pass `tooltip: ''` because a tooltip is visible text; the icons
|
||||
/// carry semantic labels instead.
|
||||
class NotesSelectionBar extends StatefulWidget {
|
||||
/// Creates the bar; every callback acts on the whole selection.
|
||||
const NotesSelectionBar({
|
||||
@ -69,7 +70,7 @@ class _NotesSelectionBarState extends State<NotesSelectionBar> {
|
||||
children: [
|
||||
PopupMenuButton<Status>(
|
||||
key: const ValueKey('bulk-status'),
|
||||
tooltip: 'status',
|
||||
tooltip: '',
|
||||
icon: const Icon(Icons.task_alt, semanticLabel: 'Set status'),
|
||||
onSelected: widget.onStatus,
|
||||
itemBuilder: (_) => [
|
||||
@ -83,7 +84,7 @@ class _NotesSelectionBarState extends State<NotesSelectionBar> {
|
||||
),
|
||||
PopupMenuButton<Priority>(
|
||||
key: const ValueKey('bulk-priority'),
|
||||
tooltip: 'priority',
|
||||
tooltip: '',
|
||||
icon: const Icon(
|
||||
Icons.flag_outlined,
|
||||
semanticLabel: 'Set priority',
|
||||
@ -104,7 +105,6 @@ class _NotesSelectionBarState extends State<NotesSelectionBar> {
|
||||
),
|
||||
IconButton(
|
||||
key: const ValueKey('bulk-assign'),
|
||||
tooltip: 'assign',
|
||||
onPressed: _assign,
|
||||
icon: Icon(
|
||||
refused ? Icons.block : Icons.drive_file_move_outline,
|
||||
|
||||
@ -83,7 +83,6 @@ class _RepoPickerSheetState extends State<RepoPickerSheet> {
|
||||
: null,
|
||||
suffixIcon: IconButton(
|
||||
key: const ValueKey('repo-new-submit'),
|
||||
tooltip: 'use',
|
||||
onPressed: _submit,
|
||||
icon: const Icon(Icons.check, semanticLabel: 'Use repo'),
|
||||
),
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:crdt_sync_flutter/crdt_sync_flutter.dart'
|
||||
show E2ePassphraseButton;
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:kuhy_credit/kuhy_credit.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:sync_settings_ui/sync_settings_ui.dart';
|
||||
import 'package:todo/analytics/analytics_event.dart';
|
||||
@ -22,8 +21,6 @@ import 'package:todo/ui/app_route.dart';
|
||||
import 'package:todo/ui/cloud_images_settings.dart';
|
||||
import 'package:todo/ui/github_mirror_screen.dart';
|
||||
|
||||
part 'settings_screen_actions.dart';
|
||||
|
||||
/// Settings screen: the "Enable advanced" toggle plus links to the two sync
|
||||
/// surfaces.
|
||||
///
|
||||
@ -143,6 +140,87 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Exports every note to a single Markdown file. On mobile this opens the
|
||||
/// system share sheet; on desktop it writes the canonical `~/src/todo/
|
||||
/// BACKLOG.md` so a future tool/agent has a stable path to read.
|
||||
Future<void> _export() async {
|
||||
final notes = await widget.repository.listNotes();
|
||||
final markdown = NotesMarkdown.export(notes);
|
||||
await exportBacklog(markdown, notes.length);
|
||||
}
|
||||
|
||||
/// Imports notes from a user-picked Markdown file, merging by id so a
|
||||
/// stale backup never clobbers a newer local edit (see
|
||||
/// [NoteRepository.importNotes]).
|
||||
Future<void> _import() async {
|
||||
const group = XTypeGroup(
|
||||
label: 'Markdown',
|
||||
extensions: ['md', 'markdown', 'txt'],
|
||||
// UTIs/MIME so the picker accepts the file on iOS/Android too.
|
||||
uniformTypeIdentifiers: ['net.daringfireball.markdown', 'public.text'],
|
||||
mimeTypes: ['text/markdown', 'text/plain'],
|
||||
);
|
||||
final file = await openFile(acceptedTypeGroups: const [group]);
|
||||
if (file == null) return; // user cancelled
|
||||
final content = await file.readAsString();
|
||||
final notes = NotesMarkdown.parse(content);
|
||||
await widget.repository.importNotes(notes);
|
||||
}
|
||||
|
||||
/// Retries the sync after a passphrase is entered; the lock tile follows
|
||||
/// [e2eLocked], which the run updates.
|
||||
Future<void> _syncNow() async {
|
||||
try {
|
||||
await runSync(
|
||||
widget.repository,
|
||||
widget.initial,
|
||||
httpClient: widget.httpClient,
|
||||
firebaseFactory: widget.firebaseFactory,
|
||||
stateStore: widget.stateStore,
|
||||
);
|
||||
} on Exception {
|
||||
// The capture screen's status line reports sync failures.
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _openSyncSettings() async {
|
||||
await Navigator.of(context).push<void>(
|
||||
appRoute(
|
||||
context,
|
||||
(_) => SyncSettingsScreen(
|
||||
accountLoader: widget.accountLoader ?? loadAccount,
|
||||
accountSaver: widget.accountSaver ?? saveAccount,
|
||||
accountClearer: widget.accountClearer ?? clearAccount,
|
||||
sessionProbe: widget.sessionProbe ?? isFirebaseConfigured,
|
||||
firebaseFactory: widget.firebaseFactory ?? openFirebase,
|
||||
googleFirebaseFactory:
|
||||
widget.googleFirebaseFactory ?? openFirebaseWithGoogle,
|
||||
googleAvailable: widget.googleAvailable ?? googleSignInSupported,
|
||||
backup: BackupSlot(label: 'notes', export: _export, import: _import),
|
||||
),
|
||||
name: '/settings/sync',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _openGitHubMirror() async {
|
||||
await Navigator.of(context).push<SyncSettings>(
|
||||
appRoute(
|
||||
context,
|
||||
(_) => GitHubMirrorScreen(
|
||||
initial: widget.initial,
|
||||
repository: widget.repository,
|
||||
appSettings: widget.appSettings,
|
||||
analytics: widget.analytics,
|
||||
httpClient: widget.httpClient,
|
||||
firebaseFactory: widget.firebaseFactory,
|
||||
stateStore: widget.stateStore,
|
||||
),
|
||||
name: '/settings/github',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -186,14 +264,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
_openGitHubMirror,
|
||||
),
|
||||
// kuhy's credit closes the list; its panel opens above the logo.
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: KuhyCredit(alignStart: true),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
/// The settings screen's actions: Markdown export/import, sync now, and the
|
||||
/// routes to the two sync screens.
|
||||
///
|
||||
/// A `part` of `settings_screen.dart` because they read the screen's
|
||||
/// private state; split out for file size.
|
||||
part of 'settings_screen.dart';
|
||||
|
||||
extension _SettingsActions on _SettingsScreenState {
|
||||
/// Exports every note to a single Markdown file. On mobile this opens the
|
||||
/// system share sheet; on desktop it writes the canonical `~/src/todo/
|
||||
/// BACKLOG.md` so a future tool/agent has a stable path to read.
|
||||
Future<void> _export() async {
|
||||
final notes = await widget.repository.listNotes();
|
||||
final markdown = NotesMarkdown.export(notes);
|
||||
await exportBacklog(markdown, notes.length);
|
||||
}
|
||||
|
||||
/// Imports notes from a user-picked Markdown file, merging by id so a
|
||||
/// stale backup never clobbers a newer local edit (see
|
||||
/// [NoteRepository.importNotes]).
|
||||
Future<void> _import() async {
|
||||
const group = XTypeGroup(
|
||||
label: 'Markdown',
|
||||
extensions: ['md', 'markdown', 'txt'],
|
||||
// UTIs/MIME so the picker accepts the file on iOS/Android too.
|
||||
uniformTypeIdentifiers: ['net.daringfireball.markdown', 'public.text'],
|
||||
mimeTypes: ['text/markdown', 'text/plain'],
|
||||
);
|
||||
final file = await openFile(acceptedTypeGroups: const [group]);
|
||||
if (file == null) return; // user cancelled
|
||||
final content = await file.readAsString();
|
||||
final notes = NotesMarkdown.parse(content);
|
||||
await widget.repository.importNotes(notes);
|
||||
}
|
||||
|
||||
/// Retries the sync after a passphrase is entered; the lock tile follows
|
||||
/// [e2eLocked], which the run updates.
|
||||
Future<void> _syncNow() async {
|
||||
try {
|
||||
await runSync(
|
||||
widget.repository,
|
||||
widget.initial,
|
||||
httpClient: widget.httpClient,
|
||||
firebaseFactory: widget.firebaseFactory,
|
||||
stateStore: widget.stateStore,
|
||||
);
|
||||
} on Exception {
|
||||
// The capture screen's status line reports sync failures.
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _openSyncSettings() async {
|
||||
await Navigator.of(context).push<void>(
|
||||
appRoute(
|
||||
context,
|
||||
(_) => SyncSettingsScreen(
|
||||
accountLoader: widget.accountLoader ?? loadAccount,
|
||||
accountSaver: widget.accountSaver ?? saveAccount,
|
||||
accountClearer: widget.accountClearer ?? clearAccount,
|
||||
sessionProbe: widget.sessionProbe ?? isFirebaseConfigured,
|
||||
firebaseFactory: widget.firebaseFactory ?? openFirebase,
|
||||
googleFirebaseFactory:
|
||||
widget.googleFirebaseFactory ?? openFirebaseWithGoogle,
|
||||
googleAvailable: widget.googleAvailable ?? googleSignInSupported,
|
||||
backup: BackupSlot(label: 'notes', export: _export, import: _import),
|
||||
),
|
||||
name: '/settings/sync',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _openGitHubMirror() async {
|
||||
await Navigator.of(context).push<SyncSettings>(
|
||||
appRoute(
|
||||
context,
|
||||
(_) => GitHubMirrorScreen(
|
||||
initial: widget.initial,
|
||||
repository: widget.repository,
|
||||
appSettings: widget.appSettings,
|
||||
analytics: widget.analytics,
|
||||
httpClient: widget.httpClient,
|
||||
firebaseFactory: widget.firebaseFactory,
|
||||
stateStore: widget.stateStore,
|
||||
),
|
||||
name: '/settings/github',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -16,30 +16,6 @@ task (`id8 status priority repo title created_by`); `get_task` prints
|
||||
`created_by` is `claude` for notes filed through `add_task` or the CLI and
|
||||
`kuhy` for everything else (a missing value reads as `kuhy`).
|
||||
|
||||
The server also publishes one skill through the MCP Skills extension
|
||||
(`io.modelcontextprotocol/skills`, revision 2026-07-28): `filing-tasks`,
|
||||
which Claude Code lists as `todo:filing-tasks`. It holds the `add_task` field
|
||||
rules, the `MANUAL WORK REQUIRED:` title rule, the `Todo: <id8>` commit trailer
|
||||
and the close-the-task rule. mcp_dart 2.4.4 has no Skills API, so
|
||||
`lib/mcp/filing_skill.dart` registers the capability, `skills/list`,
|
||||
`skills/get` and the SKILL.md resource itself; the entry's sha256 and size are
|
||||
computed from the served text. `claude -p` board workers never load MCP
|
||||
skills, so `~/.claude/CLAUDE.md` and the `md-file-conventions` skill keep
|
||||
their copies.
|
||||
|
||||
Claude Code does not list the skill yet. In 2.1.332 the connect path runs
|
||||
`Xg() && capabilities.resources ? fetchMcpSkillsForClient(...) : []`, and
|
||||
`Xg()` returns the remote flag `tengu_wiggly_crystal` (default false). That
|
||||
flag was false for kuhy's account on 2026-11-27, so the client never sent
|
||||
`skills/list` (no `[mcp-skills]` line in `--debug` output). Even with the flag
|
||||
on, the client still refuses MCP skills for team/enterprise orgs that set
|
||||
`disableDirectMcpSkills`, for HIPAA/ZDR orgs and for plans it does not allow.
|
||||
The server side was probed live on :8735 the same day: `initialize`
|
||||
advertises the extension and `skills/list` plus `resources/read` serve the
|
||||
SKILL.md. To recheck after a Claude Code update, run
|
||||
`jq '.cachedGrowthBookFeatures.tengu_wiggly_crystal' ~/.claude.json`; once it
|
||||
prints `true`, `/skills` in a new session should list `todo:filing-tasks`.
|
||||
|
||||
| What | Where |
|
||||
|---|---|
|
||||
| Firebase seed (read once) | `~/.config/todo-mcp/firebase_auth.json` |
|
||||
|
||||
91
pubspec.lock
91
pubspec.lock
@ -109,20 +109,20 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: crdt_sync_dart
|
||||
ref: "crdt_sync_dart-v0.14.2"
|
||||
resolved-ref: "171a7f8ae34cec78df17a680e42878ca0b97c137"
|
||||
ref: "crdt_sync_dart-v0.14.1"
|
||||
resolved-ref: edd0f7a7882cb1d3904932ba94faa282d08165df
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.14.2"
|
||||
version: "0.14.1"
|
||||
crdt_sync_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: crdt_sync_flutter
|
||||
ref: "crdt_sync_flutter-v0.9.2"
|
||||
resolved-ref: "41af57870207f80a5bf571f15544a08fddcbe7bf"
|
||||
ref: "crdt_sync_flutter-v0.9.1"
|
||||
resolved-ref: "48dc28ad97b97c787aba4479c3ce51aade6e86b5"
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.9.2"
|
||||
version: "0.9.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -167,11 +167,11 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
path: data_transfer_flutter
|
||||
ref: "data_transfer_flutter-v0.2.4"
|
||||
resolved-ref: "5c2effe7d1148830c9e273e47a272791dc17509e"
|
||||
ref: "data_transfer_flutter-v0.2.3"
|
||||
resolved-ref: bb2f92f459283a29ad4864cf37704cc5f749cc6d
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.2.4"
|
||||
version: "0.2.3"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -184,11 +184,11 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: design_system
|
||||
ref: "design_system-v0.5.1"
|
||||
resolved-ref: "7252ba0a7637f08dba09a79426817e423643c62f"
|
||||
ref: "design_system-v0.4.1"
|
||||
resolved-ref: "422a5e53d975b7a1cbeadeb4e29ab0965bfc4bec"
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.5.1"
|
||||
version: "0.4.1"
|
||||
dev_build:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -233,10 +233,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_picker
|
||||
sha256: "5b99250437a4d34ee2cdc0686924452103540eaa1c248094b63f07f9d7216f6c"
|
||||
sha256: c3780977700b8962c3b9b6a9aa4e2c988956893d70d4a4fa2d7adf4ec9b9eaee
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.4.1"
|
||||
version: "13.4.0"
|
||||
file_picker_darwin:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -249,10 +249,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_picker_linux
|
||||
sha256: cf3889644e8e54551f5c3a4f98b6b6ef5f0ef85c07d2a0c1a969538983be2f9b
|
||||
sha256: "9215ee8c672508cdd9a325202669f849e1baac883658626b3abed5d7777e6a4b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.4"
|
||||
file_picker_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -415,14 +415,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.2"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: "4565a66f0a968f2e1ab4197854686990258aadab9572eb80a7655053a01dc302"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -595,15 +587,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.12.0"
|
||||
kuhy_credit:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "kuhy_credit/flutter"
|
||||
ref: "kuhy-credit-v0.3.2"
|
||||
resolved-ref: adeb40f68e1d6c701da43e396fc46bffa3ef10c7
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.3.2"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -804,14 +787,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path_parsing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_parsing
|
||||
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1101,11 +1076,11 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: sync_settings_ui
|
||||
ref: "sync_settings_ui-v0.8.6"
|
||||
resolved-ref: "41af57870207f80a5bf571f15544a08fddcbe7bf"
|
||||
ref: "sync_settings_ui-v0.8.4"
|
||||
resolved-ref: "15ef5b44f186cea0ab163cc88cb8743c51d58247"
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.8.6"
|
||||
version: "0.8.4"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1210,30 +1185,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.0"
|
||||
vector_graphics:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: "06081e4f2d8f17c306aa58989520694b463ad411bc7c7b93e76afa3e41ca17ac"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_codec
|
||||
sha256: "023f3afd1b08d040406e7ccc324f5173c04762a59e374f29d04cef00a4940742"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
vector_graphics_compiler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_compiler
|
||||
sha256: "4c9d2e7121eea8b4f160e6e435900a0ae7214cfc97c2d6cf84c25532b789b50d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.4"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1294,10 +1245,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4"
|
||||
sha256: "0fe8cc98946def31cbcbc8734aa4067031e6f65ea3a78a508060bfed2200bfeb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.1"
|
||||
version: "7.1.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
19
pubspec.yaml
19
pubspec.yaml
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.108+1
|
||||
version: 1.0.104+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
@ -33,12 +33,12 @@ dependencies:
|
||||
crdt_sync:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: crdt_sync_dart-v0.14.2
|
||||
ref: crdt_sync_dart-v0.14.1
|
||||
path: crdt_sync_dart
|
||||
crdt_sync_flutter:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: crdt_sync_flutter-v0.9.2
|
||||
ref: crdt_sync_flutter-v0.9.1
|
||||
path: crdt_sync_flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
@ -50,9 +50,9 @@ dependencies:
|
||||
design_system:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: design_system-v0.5.1
|
||||
ref: design_system-v0.4.1
|
||||
path: design_system
|
||||
file_picker: 13.4.1
|
||||
file_picker: 13.4.0
|
||||
file_selector: 1.1.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
@ -80,12 +80,6 @@ dependencies:
|
||||
image: 4.13.1
|
||||
# Camera + gallery picks for image attachments on Android.
|
||||
image_picker: 1.2.4
|
||||
# kuhy's logo credit, shown at the end of Settings.
|
||||
kuhy_credit:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: kuhy-credit-v0.3.2
|
||||
path: kuhy_credit/flutter
|
||||
# Flutter 3.50 deprecates package:flutter/material.dart; the shared UI
|
||||
# packages (design_system, sync_settings_ui) sit on material_ui, so the app
|
||||
# must too or their widgets lose MaterialLocalizations.
|
||||
@ -104,6 +98,7 @@ dependencies:
|
||||
# Retained only to read the legacy on-device DB during the one-time
|
||||
# migration in NoteRepository.open; remove once all devices are migrated.
|
||||
sqlite_crdt: 3.0.4
|
||||
|
||||
# Shared "Sync settings" screen (Firebase + local backup), reused across
|
||||
# every kuhy app that syncs. GitHub mirror stays app-local (see
|
||||
# lib/ui/github_mirror_screen.dart) since here it also triggers a note
|
||||
@ -111,7 +106,7 @@ dependencies:
|
||||
sync_settings_ui:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: sync_settings_ui-v0.8.6
|
||||
ref: sync_settings_ui-v0.8.4
|
||||
path: sync_settings_ui
|
||||
url_launcher: 6.3.3
|
||||
uuid: 4.6.0
|
||||
|
||||
@ -1,108 +0,0 @@
|
||||
// The task-filing skill over the MCP Skills extension (2026-07-28): the
|
||||
// entry, the file list and the SKILL.md read must pass the same checks
|
||||
// Claude Code runs before it lists `todo:<name>` and loads it.
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crdt_sync/crdt_sync.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mcp_dart/mcp_dart.dart';
|
||||
|
||||
import 'mcp_harness.dart';
|
||||
|
||||
const _ext = 'io.modelcontextprotocol/skills';
|
||||
final _name = RegExp(r'^(?=.{1,64}$)[a-z0-9]+(?:-[a-z0-9]+)*$');
|
||||
|
||||
class _Raw implements BaseResultData {
|
||||
_Raw(this.json);
|
||||
|
||||
final Map<String, dynamic> json;
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get meta => null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => json;
|
||||
}
|
||||
|
||||
void main() {
|
||||
late McpHarness h;
|
||||
late McpClient c;
|
||||
|
||||
setUp(() async {
|
||||
h = McpHarness();
|
||||
await h.start();
|
||||
c = await h.connect();
|
||||
});
|
||||
tearDown(() => h.dispose());
|
||||
|
||||
Future<Map<String, dynamic>> send(String method, Map<String, dynamic> p) => c
|
||||
.request(JsonRpcRequest(id: 0, method: method, params: p), _Raw.new)
|
||||
.then((r) => r.json);
|
||||
|
||||
test('declares the extension on 2026-07-28', () {
|
||||
expect(c.getProtocolVersion(), '2026-07-28');
|
||||
expect(c.getServerCapabilities()?.extensions?[_ext], isNotNull);
|
||||
});
|
||||
|
||||
test('lists one valid entry and serves its SKILL.md', () async {
|
||||
final list = await send('skills/list', {});
|
||||
final skills = list['skills'] as List<dynamic>;
|
||||
expect(skills, hasLength(1));
|
||||
final entry = skills.single as Map<String, dynamic>;
|
||||
final uri = entry['uri'] as String;
|
||||
expect(uri, endsWith('/SKILL.md'));
|
||||
final root = uri.substring(0, uri.length - '/SKILL.md'.length);
|
||||
final last = root.substring(root.lastIndexOf('/') + 1);
|
||||
final front = entry['frontmatter'] as Map<String, dynamic>;
|
||||
expect(front['name'], last);
|
||||
expect(_name.hasMatch(last), isTrue, reason: last);
|
||||
expect(front['description'], isA<String>());
|
||||
expect(uri, isNot(contains(r'$')));
|
||||
|
||||
final files = (entry['resources'] as List<dynamic>)
|
||||
.cast<Map<String, dynamic>>();
|
||||
final md = files.singleWhere((f) => f['uri'] == uri);
|
||||
|
||||
final got = await send('skills/get', {'uri': uri});
|
||||
expect(got['skill'], entry);
|
||||
|
||||
final read = await c.readResource(ReadResourceRequest(uri: uri));
|
||||
expect(read.contents, hasLength(1));
|
||||
final content = read.contents.single as TextResourceContents;
|
||||
expect(content.uri, uri);
|
||||
final bytes = utf8.encode(content.text);
|
||||
expect(md['size'], bytes.length);
|
||||
expect(md['digest'], 'sha256:${revisionOf(content.text)}');
|
||||
|
||||
// The frontmatter in the file parses to exactly the listed one.
|
||||
final text = content.text;
|
||||
expect(text, startsWith('---\n'));
|
||||
final end = text.indexOf('\n---\n', 4);
|
||||
final lines = text.substring(4, end).split('\n');
|
||||
final parsed = {
|
||||
for (final l in lines)
|
||||
l.substring(0, l.indexOf(':')): jsonDecode(
|
||||
l.substring(l.indexOf(':') + 1).trim(),
|
||||
),
|
||||
};
|
||||
expect(parsed, front);
|
||||
|
||||
final body = text.substring(end + 5);
|
||||
for (final rule in [
|
||||
'add_task',
|
||||
'done_check',
|
||||
'MANUAL WORK REQUIRED: ',
|
||||
'Todo: <id8>',
|
||||
'close_task',
|
||||
]) {
|
||||
expect(body, contains(rule));
|
||||
}
|
||||
});
|
||||
|
||||
test('skills/get on an unknown uri is an error', () async {
|
||||
await expectLater(
|
||||
send('skills/get', {'uri': 'skill://todo/nope/SKILL.md'}),
|
||||
throwsA(isA<McpError>()),
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -3,11 +3,10 @@ import 'dart:io';
|
||||
|
||||
import 'package:crdt_sync/crdt_sync.dart';
|
||||
import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/testing.dart';
|
||||
import 'package:kuhy_credit/kuhy_credit.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:sync_settings_ui/sync_settings_ui.dart';
|
||||
@ -198,10 +197,4 @@ void main() {
|
||||
// suite cannot write to the user's ~/todo.
|
||||
expect(resolveExportHome(), Platform.environment['HOME']);
|
||||
});
|
||||
|
||||
testWidgets('renders KuhyCredit at the bottom of the list', (tester) async {
|
||||
await pumpSettings(tester);
|
||||
|
||||
expect(find.byType(KuhyCredit, skipOffstage: false), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,20 +16,15 @@ final RegExp _word = RegExp('[A-Za-z]{2,}');
|
||||
Finder spoken(String part) =>
|
||||
find.bySemanticsLabel(RegExp(RegExp.escape(part)));
|
||||
|
||||
/// textgate one-word tooltip: no whitespace, <= 20 chars, no . ! ? , ; :
|
||||
bool isOneWordTooltip(String s) =>
|
||||
s.length <= 20 && !RegExp(r'[\s.!?,;:]').hasMatch(s);
|
||||
|
||||
/// Every string the tree paints: each [RichText] (which is what [Text] builds),
|
||||
/// and every non-empty [Tooltip] message that is not an allowed one-word
|
||||
/// tooltip. Text being typed lives in an [EditableText] and is the user's, so
|
||||
/// it is never painted through a [RichText] and is not collected.
|
||||
/// Every string the tree paints: each [RichText] (which is what [Text] builds)
|
||||
/// and every non-empty [Tooltip] message, since a tooltip is shown on
|
||||
/// long-press. Text being typed lives in an [EditableText] and is the user's,
|
||||
/// so it is never painted through a [RichText] and is not collected.
|
||||
List<String> paintedStrings(WidgetTester tester) => [
|
||||
for (final w in tester.widgetList<RichText>(find.byType(RichText)))
|
||||
w.text.toPlainText(),
|
||||
for (final t in tester.widgetList<Tooltip>(find.byType(Tooltip)))
|
||||
if ((t.message ?? '').isNotEmpty && !isOneWordTooltip(t.message!))
|
||||
t.message!,
|
||||
if ((t.message ?? '').isNotEmpty) t.message!,
|
||||
];
|
||||
|
||||
/// Fails if any painted string still holds a word once every [content]
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:todo/ui/capture_screen.dart';
|
||||
import 'package:todo/ui/text_free_localizations.dart';
|
||||
|
||||
import 'capture_screen_harness.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('app bar icon buttons show one-word tooltips on long-press', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpCapture(tester, prefs: configuredPrefs);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byTooltip('settings'), findsOneWidget);
|
||||
expect(find.byTooltip('notes'), findsOneWidget);
|
||||
|
||||
await tester.longPress(find.byTooltip('settings'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('settings'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user