[pull] master from GaijinEntertainment:master#973
Merged
Conversation
Fills the gap between skills/CLAUDE.md (categorical knowledge) and
the daslang MCP (symbol lookups) — covers the long tail of "how do
I X?" / "what's the pattern for Y?" answers an agent figured out
once and would otherwise lose.
Atomic .md docs with stable-slug cross-refs and inline question
aliases, dupe-on-add gate, FTS5+BM25 retrieval. .md is source of
truth; SQLite index is rebuildable. v0 ships BM25 only — embeddings
and LLM rerank are vNext.
CLAUDE.md gets an "Asking blind-mouse" section + tool responses
carry hint footers ("if stale, edit"; "research it then mouse__add")
so corpus hygiene is reinforced at the moment of decision.
30/30 dastest tests pass; lint + format clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- dedupe_slug: preserve verbatim slug on collision (don't re-slugify),
so a valid slug_hint like 'my_doc' becomes 'my_doc-2', not 'my-doc-2'
- sanitize_fts5_query: drop '\t' from allow-list so tabs collapse to
spaces upstream of split(" ") tokenization
- rebuild FTS row: drop the doc.questions loop -- doc.body already
contains the '## Questions' section, so we were indexing aliases
twice and skewing BM25
- search: clamp k to [1, 50]; SQLite LIMIT -1 = no-limit, untrusted
callers shouldn't be able to scan the whole corpus
- main: reword 'mouse__get <slug>' hint to MCP-tool form
Tests: dedupe_slug preserves underscore on collision; search returns
empty for k<=0; tab-separated query still matches.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- slug_from_title caps to MAX_SLUG_LEN with trailing-dash retrim, so long titles can't produce slugs that is_valid_slug later rejects. - dedupe_slug truncates base before appending -N suffix, keeping the candidate within MAX_SLUG_LEN; preserves base verbatim when no collision (existing tests still hold). - add_doc sanitizes the question before use: \r/\n collapse to spaces, empty-after-sanitize is rejected with an error. Closes a YAML injection vector via newline-bearing MCP input. - LinkRow insert switched to insert_or_ignore so a doc accidentally listing the same link twice in frontmatter doesn't abort the rebuild transaction. Drive-bys: - is_valid_slug refactored to peek_data (clears pre-existing PERF002/ PERF003 in the loop). - Tests use repeat() helper instead of += loops, and one var fm became let fm in test_read_doc_clears_stale_error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- rebuild: skip+warn docs whose frontmatter slug fails is_valid_slug (avoids indexing docs that cmd_get/tool_get would later refuse to open). Test seeds a `slug: Bad.Slug` doc and asserts only the valid- slug doc is indexed. - README: drop `bash` fence around `mcp__daslang__format_file` (it's an MCP tool, not a shell command); reword to clarify the formatter has no CLI equivalent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- rebuild: skip+warn when basename != {slug}.md so search never returns
unfetchable docs (cmd_get/tool_get build paths from slug, not DocRow.path)
- search: downcase cleaned query so user-typed FTS5 keywords (OR/AND/NOT/
NEAR) become inert tokens instead of producing invalid OR-join syntax
- cmd_get/tool_get: surface parse_error to the user (warning log + [W]
prefix in tool_get output) so corrupted docs aren't silently partial
Tests: test_rebuild_skips_basename_slug_mismatch,
test_search_handles_uppercase_fts_keywords. All 55 mouse tests pass.
Also: CLAUDE.md "Asking blind-mouse" — explicit planning-phase guidance
(sweep mouse__ask before code research, mouse__add rough answers freely).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(mouse): blind-mouse v0 — personal Q&A cache MCP server
PERF013 a += 1 / a -= 1 → a++ / a--
PERF014 closed-interval char-class range → strings::is_alpha/is_alnum/is_number
PERF015 ternary min/max → math::min(a, b) / max(a, b)
PERF016 ternary abs → math::abs(x)
PERF017 length(x) == 0 → empty(x) (avoids strlen on strings)
STYLE016 adjacent guards with identical exit → ||-merge
STYLE017 if (cond) return true; else return false → return cond / !cond
STYLE018 b == true / b != false → b / !b (Yoda forms detected)
STYLE019 min(max(x, lo), hi) → math::clamp(x, lo, hi)
Each rule has a test file under utils/lint/tests/ (expect 31208:N for PERF,
expect 31209:N for STYLE — the prior skill claim that style expect doesn't
work was stale). 9 RST sections added to doc/source/reference/language/lint.rst.
Visitor changes:
* current_function.flags.generated suppresses warnings for macro-synthesized
code (e.g. [CommandLineArgs] codegen)
* PERF017 self-skip when current_function (or fromGeneric) is empty — its own
body is literally length(x) == 0 and the rule's whole job is to suggest it
* dropped redundant in_closure>0 early-return from preVisitExprOp2 — loop_depth
already doesn't increment inside closure bodies, so PERF001's loop check is
correctly scoped without it. Surfaces syntactic patterns (PERF014/017 etc.)
inside the natural build_string() $(var w) { ... } idiom
Sweeps:
* utils/lint/main.das — 3 self-fixes (rule runner triggered its own rules)
* utils/mouse/ — ~15 hits cleaned up (PERF013/014/017/STYLE016)
* dogfooding: perf_lint.das and style_lint.das now lint-clean for the new
rules (refactored their own internal guard chains)
Followup PR will sweep the remaining ~377 daslib hits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(lint): 9 new perf/style rules — PERF013–017, STYLE016–019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )