Skip to content

[pull] master from GaijinEntertainment:master#972

Merged
pull[bot] merged 13 commits into
forksnd:masterfrom
GaijinEntertainment:master
May 8, 2026
Merged

[pull] master from GaijinEntertainment:master#972
pull[bot] merged 13 commits into
forksnd:masterfrom
GaijinEntertainment:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 8, 2026

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 : )

borisbat and others added 13 commits May 7, 2026 21:37
…eness

Original scope (cpp_* tools + with_cpp_source redirect)
-------------------------------------------------------

Four ast-grep-backed MCP tools for C++ source navigation across
src/, include/, modules/:

- cpp_grep_usage      - parse-aware identifier search (`sg run -p`)
- cpp_find_symbol     - kind-filtered symbol search (`sg scan` + rule-yaml)
- cpp_outline         - top-level declarations in a file or glob
- cpp_goto_definition - approximate where-is-this-defined; up to 5 ranked
                        candidates (same-file > same-dir > shorter path).
                        clangd-backed precise mode on the v2 roadmap.

Plus a `with_cpp_source` opt-in flag on `find_symbol` and
`goto_definition` that resolves daslang symbols' cppName field to a C++
source location via a lazily-built index. Bridges builtins / handled
types / addExtern-registered functions to their C++ implementation in
one tool call instead of two.

Critical correctness prerequisite: `sgconfig.yml.{linux,osx,windows}`
get a `languageGlobs: cpp: ["*.h", "*.hpp"]` block. Without it ast-grep
classifies .h files as C, not C++, and 375 headers (24% of the C++
surface) silently produce zero matches.

Copilot review round 2 (function decls + `using` aliases)
---------------------------------------------------------

`cpp_outline_rules.yml` gains two rules:

- `cpp-outline-functions-decl` matches `kind: declaration` with a
  `has: stopBy: end, kind: function_declarator` constraint, surfacing
  header-only function declarations (`void foo();`, etc.). On
  `include/daScript/ast/ast.h` alone this finds 323 declarations the
  index previously missed.
- `cpp-outline-typedefs-using` matches `alias_declaration`, surfacing
  modern `using X = Y;` aliases under `kind=typedef` alongside legacy
  `typedef X Y;`. `cpp_extract_name_pair` extended for the new shape.

Search-scope configuration (cpp_search_config.das)
--------------------------------------------------

New `utils/mcp/cpp_search_config.das` exports four constants the C++
tools read:

- CPP_SEARCH_DIRS              - folders to scan recursively (default:
                                  src, include, modules)
- CPP_SEARCH_ALWAYS_EXCLUDE    - hard-coded glob excludes; adds
                                  cmake-build-*/ and CMakeFiles/
                                  alongside build*/_deps/3rdparty/.git/
- CPP_SEARCH_INCLUDE_GLOBS     - file-extension lock (default
                                  *.cpp / *.h / *.hpp; covers 99.3% of
                                  the C++ surface per repo audit)
- CPP_SEARCH_INCLUDE_OVERRIDES - re-include paths the auto-exclude
                                  policy would otherwise drop

Folders containing a `.git` file or directory at any depth are
auto-excluded. Covers `modules/.daspkg_cache/` (daspkg's package index
clone) plus future submodules / FetchContent destinations / ad-hoc
clones, with no manual list to maintain.

Git-signature staleness (replaces lazy-once)
--------------------------------------------

`var cpp_index_built : bool` becomes `var cpp_index_signature : string`.
Each `ensure_cpp_index()` call recomputes a cheap signature from
`git rev-parse HEAD` + `git status --porcelain --untracked-files=normal`
(double-filtered to .cpp/.h/.hpp files in the search scope) +
per-dirty-file mtimes + `cpp_search_config.das` mtime, hashed via
daslang's builtin FNV-64 `hash()`. Cache hit when the signature
matches; rebuild when it doesn't.

Naturally fixes Copilot review #3 (silent failure trap): on `sg scan`
failure the signature stays empty, so the next call retries. No
permanent silent fallback to "(not located)".

Per-call cost: ~70-200ms typical. The trade is "always-fresh after C++
edits" vs "build once, restart MCP to refresh" --- explicit choice.

Tests: 11 new cases (236/236 green) for cpp_search_config defaults,
signature stability, .git-folder auto-exclusion (verified against the
local daspkg cache), function-declaration regression, and using-alias
regression. Sphinx clean.

Docs: skills/mcp_tools.md, install/skills/mcp_tools.md,
doc/source/reference/utils/mcp.rst all updated for the config file +
staleness story.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds five MCP tools for navigating C++ source via ast-grep + tree-sitter-cpp:

  - cpp_grep_usage      — parse-aware identifier-leaf usage search across
                          multiple AST kinds (identifier, type_identifier,
                          namespace_identifier, field_identifier).
  - cpp_find_symbol     — declaration lookup by (name, kind).
  - cpp_outline         — function signatures, template specializations,
                          class/namespace nesting, qualified names. Auto/tree/
                          flat render modes.
  - cpp_goto_definition — best-effort approximate goto. Ranks candidates by
                          file proximity; surfaces index-build failures via
                          cpp_index_status().
  - find_symbol / goto_definition — opt-in `with_cpp_source` redirect that
                          resolves builtin/handled-type C++ source locations
                          via the lazily-built cpp index.

Search scope is configurable in `utils/mcp/cpp_search_config.das`
(CPP_SEARCH_DIRS, CPP_SEARCH_INCLUDE_GLOBS, CPP_SEARCH_INCLUDE_OVERRIDES,
CPP_MAX_FIND_RESULTS, CPP_MAX_GOTO_CANDIDATES). Folders containing a `.git`
file/dir (submodules, FetchContent) auto-excluded.

The cpp index is cached in-process and rebuilds when its git-state staleness
signature changes (HEAD + filtered status + per-file mtimes + config mtime).
First call ~2s, subsequent ~150ms.

In a non-git checkout (extracted tarball, manual rm of .git), the no-git
fallback walks CPP_SEARCH_DIRS recursively and folds per-file mtimes into
the signature so source edits still invalidate the cache. ~50–200ms; only
hit when git rev-parse / status fails. The .git-folder auto-exclude logic
is reused so vendored repos and the daspkg cache are pruned consistently.

cpp_run_scan / do_cpp_grep_usage are parse-first: on Windows, sg can exit
non-zero while still emitting valid JSON (warnings on stderr get merged in
by run_and_capture). Try to parse first; only fail if parse itself fails,
and enrich the message with the rc when sg exited non-zero.

goto_definition's `with_cpp_source` redirect now also fires for handled
types (TypeAnnotation.cppName) — previously only builtin functions
populated cppName. Type fallback in resolve_definition gets a new
isHandle branch that mirrors the path find_symbol already takes. Future
gaps (ExprVar of handled type, ExprField on handled-type parent) are
documented inline as a v2 roadmap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ast should not contain implementation for program. We can use it
without Program.
Context should not depend on simulate. We can use context
without simulation.
Rececntly we wrongly changed CMakeXxdImpl. Now it points to
correct path.
mcp: C++ source-search tools (cpp_grep_usage / cpp_find_symbol / cpp_outline / cpp_goto_definition) + with_cpp_source redirect
…gram-context

Aleksisch/split program context
CHANGELIST.md (0.6.2 section): folded in every PR merged since v0.6.2-RC1.
- dasSQLITE entry extended with full join family, multi-Q lowering, _in/_not_in
  via json_each, [sql_function], schema_from + check_schema, and the migration
  trio (sqlite_migrate, typed ALTERs, [struct_convert] rebuild)
- New "daspkg: Project Bundling for Distribution" subsection (release verb,
  exe-relative shared modules, -list-shared-modules, project-local resolution,
  native shared deps)
- New "Build, CI, and Web" subsection (tutorials in CI, web reuses main
  CMakeLists, parse-aware C++ MCP tools)
- New "Examples" section: Asteroids (DECS migration), Pacman, River Run
- Compiler/AOT/JIT bullets extended: tuple-strict typer, [template_tuple] for
  Option/Result, callsite arrow body, error reporting audit, super walk-up,
  block-form variable annotations, cbind prefixes, program/context/serialize
  refactor
- Runtime libs bullets extended: path-aware glob in fio, math common functions,
  clargs Result, das-fmt vendored
- Bug Fixes extended: standalone-exe shutdown, top-level let-init builtins,
  fusion TSan/loadSize, plugin completion fix, __e2k__ pragma

site/index.html: 0.6.2 overview mirrors the changelist additions above.

CMakeLists.txt: install rules for utils/das-fmt/ (the .das sources plus README,
LICENSE, and the pre-commit hook script) so the SDK ships the formatter
alongside the other in-tree utilities.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…0.6.2-rc2-prep

docs: 0.6.2 changelist post-RC1 + site mirror; install utils/das-fmt
The install/CLAUDE.md and install/skills/ tree had been hand-mirrored
from the top-level skills tree, drifting on every edit (e.g. PR #2602
had to update both copies of mcp_tools.md). This collapses the skills
side to a single source of truth in skills/ + an install/skills.list
manifest that CMake reads to copy named files into the SDK at install
time. install/CLAUDE.md stays as a separate audience-curated head
(Running Scripts, Project files, SDK Directory Layout) — the two
heads' near-identical syntax block is the only remaining duplication.

Structural changes:
- Extract ~32 lines of "Project Overview" / "What and Why" /
  "Designing with macros" prose from CLAUDE.md to a new shipped
  skills/project_overview.md; both heads keep a 1-line pointer.
- Fold skills/clargs_migration.md into clargs_usage.md as a final
  "Migrating from get_command_line_arguments()" section.
- Replace install/skills/ (19 files, ~3100L) with install/skills.list
  (21 entries) + a CMake file(STRINGS) install rule with FATAL_ERROR
  existence check. install_instructions.md rewritten to match.

Per-skill content cleanup (informed by an audit memo against the old
install/skills/ versions, kept where it removed only repo-internal
navigation noise; reverted where install/ over-trimmed substantive
content like Handle<T>/HandleRegistry, daspkg's command table, and
the .das_module C++ binding boilerplate):
- das_macros.md: drop 115L of legacy var inscope/<- AST patterns;
  preserve the substantive [call_macro] entry-guard contract section.
- detect_dupe.md: drop the entire 116L "Maintainer notes" section
  (repo-dev-only); generalize bin/Release/daslang.exe → bin/daslang.
- writing_tests.md: drop "Test index", "AOT tests registration",
  and "options no_aot" sections (all repo-dev infrastructure).
- dynamic_modules.md: drop "Resolution order in getModuleInfo()"
  internals and "Install rules for .das_module" CMake snippet.
- daspkg.md: drop "Package Index" section (index repo navigation);
  generalize bin/Release/daslang.exe → bin/daslang.
- jobque_debugging.md, memory_leak_detection.md: generalize binary
  paths from bin/Debug/daslang.exe → bin/daslang etc.
- linq.md: drop two issue #2505 historical-nav references.
- cpp_integration.md: drop include/daScript/misc/string_writer.h
  internal path from the LogLevel collision caveat.
- filesystem.md: drop in-tree src/ and tests/ Reference pointers;
  keep daslib/, include/, tutorials/ pointers (those all ship).
- make_pr.md: drop step 5.5 (.md stop-rule).
- CLAUDE.md skill table: drop stale gc_use_after_sweep.md row
  (the file never existed); drop clargs_migration row.
- install/CLAUDE.md skill table: add project_overview.md and
  strudel_port.md rows to match the 21-entry ship list.

Verification:
- cmake -B build -S . reconfigures cleanly.
- cmake --install build --prefix /tmp/das-install-test produces
  /tmp/das-install-test/CLAUDE.md (= install/CLAUDE.md, the SDK
  version) and /tmp/das-install-test/skills/ with exactly the 21
  files listed in install/skills.list, all matching skills/ source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CLAUDE.md cleanup + single-skills-tree manifest
…-meaning

The v0.6.2-RC2 release linux64 build failed compiling AOT-generated cpp:

  error: declaration of 'TTuple<24, bool, …Profile> User::Profile' changes
         meaning of 'Profile' [-Wchanges-meaning]

GCC 13+ rejects field declarations whose name shadows a struct name from the
enclosing scope (the C++ standard considers it ill-formed). The pattern shows
up naturally in daslang sources:

    struct Profile { ... }
    [sql_table] struct User {
        Profile : Option<Profile>   // field name == type name → AOT cpp blows up
    }

Two changes:

1. daslib/aot_cpp.das — describeCppTypeEx now emits the elaborated form
   `struct Foo` / `struct mod::Foo` for tStructure references. Single-point
   patch in the centralized type renderer (called 106× from the file).
   Elaborated-type-specifier is valid in every context where a bare struct
   name is, including template arguments. Verified on g++-13.4 locally
   (matches CI's g++-13.3) with both a focused micro-test and a full local
   AOT test suite run (7352/7358 pass, 0 failed, 0 errors).

2. .github/workflows/release.yml — linux64 release now uses
   CC=clang CXX=clang++, matching build.yml. PR/master CI was clang-only
   so it never exercised the GCC-only failure path; aligning the two
   eliminates the divergence and prevents the next "release-only" surprise.

Either change alone would have shipped RC2, but both together are correct:
(1) is the root-cause codegen fix (also helps any user building AOT cpp
under gcc), and (2) keeps the build and release matrices consistent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nges-meaning-fix

fix(aot): elaborate struct types for GCC 13+ -Wchanges-meaning + clang on release linux
@pull pull Bot locked and limited conversation to collaborators May 8, 2026
@pull pull Bot added the ⤵️ pull label May 8, 2026
@pull pull Bot merged commit 269178f into forksnd:master May 8, 2026
1 of 3 checks passed
@pull pull Bot had a problem deploying to github-pages May 8, 2026 20:58 Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants