@modality-counter/core 2.10.0 โ†’ 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # `@modality-counter/core`
2
+
3
+ Core library for the **Counter** system โ€” a hero-persona / method / workflow engine that powers MCP servers and CLIs. Content (heroes, methods, workflows, protocols) is authored as MDX files with YAML front matter and loaded at runtime; the package exposes the MCP tool wiring, CLI runners, validation helpers, and supporting utilities that consume it.
4
+
5
+ ## Repository
6
+
7
+ - **NPM**
8
+ - https://www.npmjs.com/package/@modality-counter/core
9
+
10
+ ## Features
11
+
12
+ - ๐Ÿฆธ **Hero Personas** โ€” Deployable agent personas ("heroes") with behavior protocols, method aliases, and dependency loading
13
+ - ๐Ÿ“œ **Methods & Workflows** โ€” MDX-authored methods and workflows discovered and executed by id
14
+ - ๐Ÿ”Œ **MCP Tools** โ€” Ready-to-register tools: `_Counter` (search), `_Counter__Deploy`, `_Counter__ExecuteMethod`, `_Counter__DeployWorkflow`, `_Counter__PartyMode`
15
+ - ๐Ÿ–ฅ๏ธ **CLI Runners** โ€” `toCounterCLI` and `toCounterCLIHelp` for passthrough CLIs over a Counter base directory
16
+ - โœ… **Validation Helpers** โ€” Bun-test-based setup helpers for method, persona, template, protocol, and category-link validation
17
+ - ๐Ÿ“„ **MDX Entry Point** โ€” `readMdxYaml` for reading method usage/parameters from MDX front matter
18
+ - ๐Ÿ” **Fuzzy Search** โ€” Fuzzy finder plus wildcard matching for heroes/methods/workflows
19
+ - ๐Ÿ“š **Protocols** โ€” Bundled protocol MDX modules (behavior, party mode, answer, codesymbol, โ€ฆ)
20
+ - ๐Ÿงช **Testing Entry Point** โ€” `@modality-counter/core/testing` keeps `bun:test` out of the main bundle
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @modality-counter/core
26
+ # or
27
+ bun add @modality-counter/core
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ### Wire up MCP tools for a Counter base directory
33
+
34
+ ```typescript
35
+ import { setupMcpCounter } from "@modality-counter/core";
36
+
37
+ const tools = await setupMcpCounter("/path/to/counter/base");
38
+ // register `tools` with your MCP server (FastMCP-compatible)
39
+ ```
40
+
41
+ ### Run a Counter passthrough CLI
42
+
43
+ ```typescript
44
+ import { toCounterCLI, toCounterCLIHelp } from "@modality-counter/core";
45
+
46
+ const run = toCounterCLI("/path/to/counter/base", { cliName: "my-cli" });
47
+ await run(process.argv.slice(2));
48
+
49
+ const help = toCounterCLIHelp("my-cli", "/path/to/counter/base");
50
+ ```
51
+
52
+ ### Read MDX front matter
53
+
54
+ ```typescript
55
+ import { readMdxYaml } from "@modality-counter/core/mdx";
56
+
57
+ const data = await readMdxYaml("/path/to/method.mdx");
58
+ console.log(data?.method?.usage?.parameters);
59
+ ```
60
+
61
+ ### Use validation helpers in tests
62
+
63
+ ```typescript
64
+ import { setupMethodValidation } from "@modality-counter/core/testing";
65
+
66
+ setupMethodValidation("/path/to/counter/base");
67
+ ```
68
+
69
+ ## API
70
+
71
+ ### Main entry (`@modality-counter/core`)
72
+
73
+ | Export | Description |
74
+ |---|---|
75
+ | `setupMcpCounter(baseDir, mcpServer?)` | Build the Counter MCP tool set for a base directory |
76
+ | `executeMethod(props, items)` | Execute a Counter method by id |
77
+ | `toCounterCLI(baseDir, options?)` | CLI runner printing raw skill text for a method |
78
+ | `toCounterCLIHelp(cliName, baseDir, format?, commandName?)` | Help handler (resolves `true` when handled) |
79
+ | `getAllCounterItems(kinds, baseDir)` | Discover Counter items of the given kinds |
80
+ | `getCounterContent(items, id, โ€ฆ)` | Load full content for an item |
81
+ | `getNormalizedName(name, type, prefix)` | Normalize a method/persona/workflow name |
82
+ | `getPagination`, `needsChunking`, `getChunk` | Pagination helpers |
83
+ | `validateMethodFile`, `validateTemplateFile`, `validateProtocolFile` | File validators |
84
+ | Protocol modules (`BehaviorProtocol`, `PartyModeProtocol`, โ€ฆ) | Bundled MDX protocols |
85
+
86
+ ### MDX entry (`@modality-counter/core/mdx`)
87
+
88
+ | Export | Description |
89
+ |---|---|
90
+ | `readMdxYaml(filePath)` | Read an MDX file's YAML front matter |
91
+
92
+ ### Testing entry (`@modality-counter/core/testing`)
93
+
94
+ | Export | Description |
95
+ |---|---|
96
+ | `setupMethodValidation` | Validate method files |
97
+ | `setupPersonaValidation` | Validate persona files |
98
+ | `setupTemplateValidation` | Validate template files |
99
+ | `setupCategoryLinkValidation` | Validate category links |
100
+ | `setupSingleMethodValidation` | Validate a single method file |
101
+
102
+ ## Content layout
103
+
104
+ Counter content lives in a base directory of MDX files grouped by type (personas, methods, workflows, templates, protocols). Items are discovered by scanning for `.md`/`.mdx` files. Methods declare `usage.parameters` and `usage.examples` in their YAML front matter, which drives both CLI help and MCP tool schemas.
105
+
106
+ ## License
107
+
108
+ ISC