mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-28 01:49:16 +01:00
Compare commits
No commits in common. "main" and "v1.0.106" 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 'dart:io';
|
||||||
|
|
||||||
import 'package:mcp_dart/mcp_dart.dart';
|
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/request_guard.dart';
|
||||||
import 'package:todo/mcp/task_service.dart';
|
import 'package:todo/mcp/task_service.dart';
|
||||||
import 'package:todo/mcp/token_file.dart';
|
import 'package:todo/mcp/token_file.dart';
|
||||||
@ -205,7 +204,6 @@ McpServer _server(TaskService tasks) {
|
|||||||
['query'],
|
['query'],
|
||||||
tasks.search,
|
tasks.search,
|
||||||
);
|
);
|
||||||
registerFilingSkill(server);
|
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
`created_by` is `claude` for notes filed through `add_task` or the CLI and
|
||||||
`kuhy` for everything else (a missing value reads as `kuhy`).
|
`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 |
|
| What | Where |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Firebase seed (read once) | `~/.config/todo-mcp/firebase_auth.json` |
|
| Firebase seed (read once) | `~/.config/todo-mcp/firebase_auth.json` |
|
||||||
|
|||||||
18
pubspec.lock
18
pubspec.lock
@ -109,20 +109,20 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: crdt_sync_dart
|
path: crdt_sync_dart
|
||||||
ref: "crdt_sync_dart-v0.14.2"
|
ref: "crdt_sync_dart-v0.14.1"
|
||||||
resolved-ref: "171a7f8ae34cec78df17a680e42878ca0b97c137"
|
resolved-ref: edd0f7a7882cb1d3904932ba94faa282d08165df
|
||||||
url: "https://github.com/kuhyx/utils"
|
url: "https://github.com/kuhyx/utils"
|
||||||
source: git
|
source: git
|
||||||
version: "0.14.2"
|
version: "0.14.1"
|
||||||
crdt_sync_flutter:
|
crdt_sync_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: crdt_sync_flutter
|
path: crdt_sync_flutter
|
||||||
ref: "crdt_sync_flutter-v0.9.2"
|
ref: "crdt_sync_flutter-v0.9.1"
|
||||||
resolved-ref: "41af57870207f80a5bf571f15544a08fddcbe7bf"
|
resolved-ref: "48dc28ad97b97c787aba4479c3ce51aade6e86b5"
|
||||||
url: "https://github.com/kuhyx/utils"
|
url: "https://github.com/kuhyx/utils"
|
||||||
source: git
|
source: git
|
||||||
version: "0.9.2"
|
version: "0.9.1"
|
||||||
cross_file:
|
cross_file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1101,11 +1101,11 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: sync_settings_ui
|
path: sync_settings_ui
|
||||||
ref: "sync_settings_ui-v0.8.6"
|
ref: "sync_settings_ui-v0.8.5"
|
||||||
resolved-ref: "41af57870207f80a5bf571f15544a08fddcbe7bf"
|
resolved-ref: abfb596d7ce2f28acfefbd55e7b3227257325261
|
||||||
url: "https://github.com/kuhyx/utils"
|
url: "https://github.com/kuhyx/utils"
|
||||||
source: git
|
source: git
|
||||||
version: "0.8.6"
|
version: "0.8.5"
|
||||||
synchronized:
|
synchronized:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -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
|
# 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
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.108+1
|
version: 1.0.106+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.12.2
|
sdk: ^3.12.2
|
||||||
@ -33,12 +33,12 @@ dependencies:
|
|||||||
crdt_sync:
|
crdt_sync:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/kuhyx/utils
|
url: https://github.com/kuhyx/utils
|
||||||
ref: crdt_sync_dart-v0.14.2
|
ref: crdt_sync_dart-v0.14.1
|
||||||
path: crdt_sync_dart
|
path: crdt_sync_dart
|
||||||
crdt_sync_flutter:
|
crdt_sync_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/kuhyx/utils
|
url: https://github.com/kuhyx/utils
|
||||||
ref: crdt_sync_flutter-v0.9.2
|
ref: crdt_sync_flutter-v0.9.1
|
||||||
path: crdt_sync_flutter
|
path: crdt_sync_flutter
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
@ -111,7 +111,7 @@ dependencies:
|
|||||||
sync_settings_ui:
|
sync_settings_ui:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/kuhyx/utils
|
url: https://github.com/kuhyx/utils
|
||||||
ref: sync_settings_ui-v0.8.6
|
ref: sync_settings_ui-v0.8.5
|
||||||
path: sync_settings_ui
|
path: sync_settings_ui
|
||||||
url_launcher: 6.3.3
|
url_launcher: 6.3.3
|
||||||
uuid: 4.6.0
|
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>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user