@omfalos/mokosh 0.1.4 → 0.1.5
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 +62 -3
- package/dist/cli.js +66 -26
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +67 -27
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +124 -3
- package/dist/index.d.ts +124 -3
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -17
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +17 -17
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +17 -17
- package/dist/mcp.mjs.map +1 -1
- package/package.json +3 -2
- package/templates/config/mokosh.config.js +18 -0
- package/templates/skill/SKILL.md +122 -0
- package/templates/skill/mokosh.md +117 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Designed for performance and RAG (Retrieval-Augmented Generation) workflows, Mok
|
|
|
20
20
|
- **Multi-Language Support**: Robust extraction from:
|
|
21
21
|
- **JavaScript/TypeScript**: static `import`, dynamic `import()`, `require()`, and re-exports.
|
|
22
22
|
- **Python**: all import forms (`import X`, `from X import Y`, relative `.`/`..` imports, star imports) via `@lezer/python` AST. Test files (`test_*.py`, `*_test.py`) and test frameworks (`pytest`, `unittest`) auto-detected.
|
|
23
|
-
- **Go**: top-level declarations and `// @tag` markers via `@lezer/go` AST.
|
|
23
|
+
- **Go**: top-level declarations and `// @tag` markers via `@lezer/go` AST. Module-local imports are resolved to internal files via `go.mod` (including `replace` directives); everything else is treated as external. See [ADR-007](./docs/adr-007-go-resolution.md).
|
|
24
24
|
- **CSS/SCSS/Less/Stylus**: tracks `@import` relationships.
|
|
25
25
|
- **CoffeeScript/LiveScript/Lua/Gherkin**: AST-based parsing for dependencies and tags.
|
|
26
26
|
- **Graph Traversal**: Programmatically explore dependencies from any entry point with depth control.
|
|
@@ -94,6 +94,16 @@ npm run build
|
|
|
94
94
|
|
|
95
95
|
## Quick Start
|
|
96
96
|
|
|
97
|
+
### AI Assistant Setup
|
|
98
|
+
|
|
99
|
+
Scaffold a Claude Code skill and slash command that teach your AI assistant how to drive Mokosh — via MCP if it's configured, falling back to the CLI otherwise:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx @omfalos/mokosh --init-skill
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This writes `.claude/skills/mokosh/SKILL.md` (auto-invoked) and `.claude/commands/mokosh.md` (explicit `/mokosh`) into your project. Existing files are left untouched — pass `--force` to overwrite.
|
|
106
|
+
|
|
97
107
|
### CLI Usage
|
|
98
108
|
|
|
99
109
|
Generate a dependency graph as JSON:
|
|
@@ -153,6 +163,9 @@ npx @omfalos/mokosh --query "category:logic,tag:auth" src/index.ts
|
|
|
153
163
|
- `--query <query>`: Filter the output graph using a query string. Supported keys: `path`, `type`, `category`, `tag`, `external`, `importsFile`, `importedBy`, `minImports`, `maxImports`, `minSize`, `maxSize`, `hasDocstring`, `sort`, `limit`. Example: `category:logic,hasDocstring:false`.
|
|
154
164
|
- `--query-help`: Print the full query filter reference and examples.
|
|
155
165
|
- `--silent`: Suppress progress output on stderr.
|
|
166
|
+
- `--init-skill`: Scaffold the bundled Claude Code skill/command (`.claude/skills/mokosh/SKILL.md`, `.claude/commands/mokosh.md`) into the current project.
|
|
167
|
+
- `--init-config`: Scaffold a commented starter `mokosh.config.js` into the project root.
|
|
168
|
+
- `--force`: Overwrite existing files. Use with `--init-skill` / `--init-config`.
|
|
156
169
|
- `--help`: Show usage information.
|
|
157
170
|
|
|
158
171
|
### Programmatic API
|
|
@@ -174,13 +187,57 @@ graph.traverse('src/main.ts', (node, depth) => {
|
|
|
174
187
|
console.log(graph.toMermaid());
|
|
175
188
|
```
|
|
176
189
|
|
|
190
|
+
## Configuration
|
|
191
|
+
|
|
192
|
+
Mokosh auto-discovers `mokosh.config.json` / `.js` / `.cjs` in the project root — no flag needed, for both the CLI and the MCP server. Scaffold a commented starter file with:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npx @omfalos/mokosh --init-config
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
> **Note:** The MCP server only loads `mokosh.config.json` (JS execution is disabled there for safety). If you want the MCP server to pick up your config, use a `.json` file rather than `.js`/`.cjs`.
|
|
199
|
+
|
|
200
|
+
**`mokosh.config.json`:**
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"cachePath": "custom-cache/graph.json",
|
|
204
|
+
"entryPoints": ["src/index.ts"],
|
|
205
|
+
"ignoreDirs": ["vendor", "generated"],
|
|
206
|
+
"extensions": [".graphql"],
|
|
207
|
+
"configMatchers": [".myconfig."],
|
|
208
|
+
"testPatterns": [".unit.", ".integration."],
|
|
209
|
+
"testLibraries": ["@my-org/test-utils"],
|
|
210
|
+
"barrelThreshold": 0.7
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`ignoreDirs` and `extensions` are **additive** — they extend the built-in defaults rather than replacing them.
|
|
215
|
+
|
|
216
|
+
### Config fields
|
|
217
|
+
|
|
218
|
+
| Field | Type | Description |
|
|
219
|
+
| --- | --- | --- |
|
|
220
|
+
| `cachePath` | `string` | Override default `mokosh-cache/graph.json` |
|
|
221
|
+
| `entryPoints` | `string[]` | Default entry points when none passed on CLI |
|
|
222
|
+
| `ignoreDirs` | `string[]` | Extra dirs to skip (merged with built-in defaults) |
|
|
223
|
+
| `extensions` | `string[]` | Extra file extensions to scan (merged with built-in defaults) |
|
|
224
|
+
| `configMatchers` | `string[]` | Extra basename substrings that classify a file as `"config"` |
|
|
225
|
+
| `testPatterns` | `string[]` | Extra basename substrings that classify a file as `"test"` |
|
|
226
|
+
| `testLibraries` | `string[]` | Extra import names that classify a file as `"test"` |
|
|
227
|
+
| `barrelThreshold` | `number` | Export-ratio threshold for `"barrel"` detection (default `0.8`) |
|
|
228
|
+
| `gitStats` | `boolean` | When `true`, enriches each cache-missed node with `commitCount90d` and `lastAuthor` via `git log`. Off by default. |
|
|
229
|
+
| `coverageReportPath` | `string` | Path (relative to project root) to an Istanbul `coverage-summary.json`. When set, each node gets a `coveragePct` field. |
|
|
230
|
+
| `coverageThreshold` | `number` | Line-coverage % below which `--find-uncovered` / `find_uncovered` flags a file. Default: `80`. |
|
|
231
|
+
| `tagApplier` | `{ framework?, frameworkOverrides? }` | Configures `--apply-tags` output format. `framework` is the fallback test framework (`vitest` \| `playwright` \| `cypress` \| `jest`) used when a file's own imports don't reveal one; `frameworkOverrides` maps path-glob patterns to a framework, checked before the top-level fallback. See [ADR-008](./docs/adr-008-tag-applier-strategies.md). |
|
|
232
|
+
|
|
233
|
+
See the [Usage Guide](./docs/usage.md#configuration-file) for `mokosh.config.js` (factory functions, side effects) and programmatic config-loading examples.
|
|
234
|
+
|
|
177
235
|
## Documentation
|
|
178
236
|
|
|
179
237
|
For detailed information on each process, check the following guides:
|
|
180
238
|
|
|
181
239
|
### Guides
|
|
182
240
|
- [Architecture Overview](./docs/architecture.md)
|
|
183
|
-
- [Product Requirements Document (PRD)](./docs/prd.md)
|
|
184
241
|
- [Usage Guide](./docs/usage.md)
|
|
185
242
|
- [Query Language Guide](./docs/query.md)
|
|
186
243
|
- [Graph Traversal](./docs/traversal.md)
|
|
@@ -188,7 +245,7 @@ For detailed information on each process, check the following guides:
|
|
|
188
245
|
- [Lock File Analysis](./docs/lock-files.md)
|
|
189
246
|
- [MCP Server](./docs/mcp.md)
|
|
190
247
|
- [Monorepo Support](./docs/monorepo.md)
|
|
191
|
-
- [
|
|
248
|
+
- [Releasing](./docs/releasing.md)
|
|
192
249
|
|
|
193
250
|
### Architecture Decision Records
|
|
194
251
|
- [ADR-001: AST Libraries for Style Parsers](./docs/adr-001-styles-parsing.md)
|
|
@@ -197,3 +254,5 @@ For detailed information on each process, check the following guides:
|
|
|
197
254
|
- [ADR-004: Type Graph — Type-Level Dependency Layer](./docs/adr-004-type-graph.md)
|
|
198
255
|
- [ADR-005: Feature Graph — Domain Clustering by Hub Detection](./docs/adr-005-feature-graph.md)
|
|
199
256
|
- [ADR-006: Responsibility Graph — Semantic Role Assignment](./docs/adr-006-responsibility-graph.md)
|
|
257
|
+
- [ADR-007: Go Import Resolution](./docs/adr-007-go-resolution.md)
|
|
258
|
+
- [ADR-008: Tag Applier Strategy Architecture](./docs/adr-008-tag-applier-strategies.md)
|