moonkeyguard

    MoonBit library for CI regression checks of scoped VS Code extension keybinding behavior contracts.

    vscode
    keybindings
    behavior-contracts
    regression-testing
    ci
    Download zip
    Version
    0.3.1
    License
    Apache-2.0
    Last updated
    last month
    Downloads
    40

    No dependencies

    #MoonKeyguard

    开发状态:VS Code profile、文件 CLI 和性能测量已进入公开 main;提交 31aeb1b 的 GitHub Actions 在 MoonBit 0.10.14 下全部成功。0.3.0 已于 2026-09-22 通过 moon publish --frozen 发布至 Mooncakes, manifest 显示 build_status=success、has_package=true。

    MoonKeyguard 本轮聚焦 VS Code 扩展快捷键的发布前行为回归检查: 维护者提交相关默认规则、扩展 package.json、用户覆盖配置,以及“在这个状态下应该触发哪个命令”的场景契约。 同一组按键只改了 when 条件,也可能让普通编辑模式下的“保存”变成某个扩展命令; 本工具给出实际选中规则、条件判定和预期差异,方便在 CI 中拦截这种变化。

    目标用户是需要维护多状态、多平台快捷键行为的 VS Code 扩展或键位包作者。 如果只是给自己的编辑器改几个快捷键,优先使用 VS Code 内置同键查看和排障日志,无需引入本库。 它不是所有编辑器的通用解析器,更不替代 VS Code 对真实键盘、布局、焦点和命令执行的最终判定。 本项目与八月 MoonBVHKit 的选题、仓库和核心实现独立。

    #先看一个可以复验的用途

    moon run cmd/main -- vscode --defaults examples/vscode-review/defaults.jsonc --extension examples/vscode-review/extension/package.regression.json --overrides examples/vscode-review/overrides.jsonc --scenarios examples/vscode-review/scenarios.json --platform windows

    预期退出 1,普通保存、有选区但未开启模式、只读编辑三个状态发生回归。 把 extension 参数改为同目录的 package.json 后,五个状态应通过,退出 0。 反例和修复的按键均为 Ctrl+S:这里检查的是条件变化造成的行为回归,不是简单找重复字符串。 这是原创的开发扩展和故障注入样例,不是实际客户采用或线上故障记录。

    同一个纯 MoonBit 内核也可以直接从 Node 调用,完全不启动 moonrun:

    moon build --release --target js node scripts/check_vscode.mjs examples/vscode-review/defaults.jsonc examples/vscode-review/extension/package.json examples/vscode-review/overrides.jsonc examples/vscode-review/scenarios.json windows

    入口 @vscode.audit_sources / 导出 audit_json 共享原生格式导入、when 判定、规则顺序和报告; 两个调用端只负责文件和进程边界。详见 宿主边界、 场景复现及手工实机核对 和 为什么独立成库。

    #兼容保留的 DSL 基础能力

    • 用轻量 DSL 表达 bind、context、reserve 和 keymap 声明,代码审查可以直接看到每一条快捷键变更。
    • 对 Ctrl+K 与 Ctrl+K,Ctrl+L 这类序列做前缀分析,区分同一上下文、父子上下文和互斥兄弟上下文。
    • 对 all、windows、mac、linux 等平台集合进行重叠计算,避免“平台专用快捷键”被全局 fallback 抢走。
    • 提供保守的系统/终端/焦点导航保留目录,并保留来源说明;团队可以传入自己的 ReservedRule 目录。
    • 输出文本、Markdown、JSON、SARIF 2.1.0、冲突图、迁移 diff、推荐修复和发布门禁。
    • 核心 API 是纯函数式的:分析不会修改调用者持有的数组,结果对相同输入稳定,可用于离线 CI 和 wasm。

    #当前边界

    VS Code profile 只覆盖给定规则快照、显式布尔状态和受支持键名。 未知 when 操作符、缺少必要状态、删除/禁用规则、命令参数、系统级快捷键、扫描码或未覆盖布局等不会被简化成安全结果; 相关探针返回 inconclusive,退出 2。只测试列出的状态,不是遍历真实编辑器所有状态的证明。 原有 DSL 与 dispatcher 是库自定义模型,不能被当作 VS Code 宿主语义。 不自动扫描用户配置、不监听键盘、不自动修复或写回文件。

    #环境

    • 本轮最终验证使用 MoonBit moonc 0.10.14+7d59c7ec9、moon 0.1.20260920 及配套标准库。
    • 格式化请使用配套工具链;不同版本的格式化及严格告警规则可能变化。升级编译器时必须同时更新标准库;可使用官方 moon upgrade。CI 会输出实际版本,不能用旧版本的本地通过代替最新远程结果。
    • 发布模块只依赖随工具链提供的 moonbitlang/core,没有需要在包复验时下载的 registry 依赖。JSONC 注释/尾逗号预处理由纯 MoonBit 完成,再交给 core JSON 解析器;宿主接口来源见 THIRD_PARTY_NOTICES。
    • 文件 CLI 的 wasm / wasm-gc 版本依赖配套 moonrun 的宿主 IO 接口,不声称可在任意 WASI 运行时运行;JS 版本使用 Node.js。native/LLVM 当前只支持内联输入,文件输入会返回明确错误。

    #快速开始

    git clone https://github.com/zhangbowen2006/MoonKeyguard.git cd MoonKeyguard moon update moon check --deny-warn moon test --deny-warn moon run cmd/main

    CLI 格式和附加报告:

    moon run cmd/main -- --format json moon run cmd/main -- --format markdown --suggest moon run cmd/main -- --format sarif --fail-on-warning moon run cmd/main -- --metrics moon run cmd/main -- --source "bind save command=save keys=Ctrl+S" --name quick-demo moon run cmd/main -- --input examples/editor.keymap --format json --fail-on-error

    --input PATH 只读指定的 UTF-8 配置文件,不自动发现文件或修改原配置; --source TEXT 支持短文本,显式空字符串表示空配置,不再回退到 demo。 参数拼写错误、缺少值、重复参数及同时使用两种输入会被拒绝。 退出码:0 完成或门禁通过、1 策略门禁失败、2 参数/文件/编码/DSL 输入错误; 默认只出报告,--fail-on-error 或 --fail-on-warning 开启相应门禁。 输入错误无论是否开启门禁都返回 2,不再通过 abort 制造崩溃堆栈。

    --format json 始终输出一个 JSON 文档: schema_version、ok(本次门禁是否通过)、exit_code、analysis、 metrics、suggestions、baseline。报告模式下要检查风险,请读取 analysis.errors/warnings/ok,不要把顶层 ok 当作“零风险”。 错误文档含 error;人类诊断写 stderr,JSON/SARIF 写 stdout。 参数解析阶段失败时格式选项尚未确立,直接输出 stderr;不会假装已经生成 JSON。 SARIF 不支持附加 metrics/suggest/baseline,避免混入不符合格式的内容。 这是 0.3.0 的 CLI 输出结构;核心库的 analysis_to_json API 不变。

    文件先完整读入,再检查 2 MiB 字节限制及 1048576 UTF-16 码元限制。 解析后、成对分析前检查每份配置的绑定数量,默认 2000; --max-bindings 可设为 1..10000。不是流式读取,也不是对抗恶意输入的内存沙箱。 完整“插件冲突—拦截—修复”步骤见 文件审查示例。

    #DSL 示例

    keymap name=editor version=1 context global parent= rank=0 description=all-windows context editor parent=global rank=10 description=text-editor reserve Cmd+Q platform=mac bind save command=editor.save keys=Ctrl+S context=editor platform=all priority=10 description=save-buffer bind jump_line command=editor.jump_line keys=Ctrl+K,Ctrl+L context=editor platform=all priority=5 description=jump-line

    keys 使用 + 表示一个 chord,使用逗号表示连续 chord。context 未填写时为 global;platform 未填写时为 all;priority 越高,dispatcher 越优先选择。字段值使用无空格的 token,描述可以使用短横线或下划线。

    #MoonBit API

    在自己的 MoonBit 模块中安装已发布的版本:

    moon add zhangbowen2006/moonkeyguard@0.3.1

    在调用方的 moon.pkg 中添加导入:

    import { "zhangbowen2006/moonkeyguard" @moonkeyguard, }

    let parsed = @moonkeyguard.parse_keymap(source, name="editor")
    if !parsed.ok {
    println(@moonkeyguard.parse_diagnostics_to_json(parsed.diagnostics))
    }
    let analysis = @moonkeyguard.analyze(parsed.keymap)
    println(@moonkeyguard.analysis_to_markdown(analysis))
    let suggestions = @moonkeyguard.suggest_all(parsed.keymap, analysis)
    println(@moonkeyguard.suggestions_to_markdown(suggestions))

    主要入口:

    API用途
    parse_keys / canonical_keys解析并规范化快捷键序列
    parse_keymap解析 DSL,返回结构化 parser diagnostics
    analyze / audit运行冲突、上下文、平台、保留键和可访问性规则
    suggest_for / suggest_all生成不占用保留键的替换建议
    analysis_to_text/json/markdown/sarif生成终端、文档、机器和 GitHub 代码扫描报告
    build_conflict_graph计算冲突边、连通分量和 hotspot
    diff_keymaps / migration_plan对两个版本做按 id 的语义 diff
    reachability_matrix / reachability_to_*按 context/platform 证明绑定可达、遮蔽和不可用状态
    compare_baseline / baseline_report_to_*只阻止新增风险,保留历史问题作为可追踪债务
    import_csv / import_tsv / import_pipe导入常见表格或管道格式
    dispatch / replay在纯 MoonBit 模拟器中检查解析结果的可达性
    audit_with_profile应用 desktop、terminal、accessible 或自定义策略
    release_gate汇总结构校验、冲突分析、策略、基准和迁移证据

    #Reachability matrix

    冲突分析回答“声明是否可能重叠”,而可达性矩阵回答“在真实的 context/platform 组合中谁会被 dispatcher 选中”。

    let report = @moonkeyguard.reachability_matrix(
    parsed.keymap,
    contexts=["global", "editor"],
    platforms=["all", "mac"],
    )
    println(@moonkeyguard.reachability_to_markdown(report))

    探针数组为空时自动使用 keymap 中声明的 context 和 all 平台;输入会去重、规范化并排序,适合把 JSON 结果作为 CI artifact。子 context 的绑定不会反向泄漏到父 context。

    #Baseline regression gate

    Teams that already have accepted findings can ratchet quality without hiding old debt. Compare two deterministic analyses and fail only when a new error is introduced:

    let baseline = @moonkeyguard.analyze(@moonkeyguard.parse_keymap(old_source).keymap)
    let current = @moonkeyguard.analyze(@moonkeyguard.parse_keymap(new_source).keymap)
    let report = @moonkeyguard.compare_baseline(baseline, current)
    println(@moonkeyguard.baseline_report_to_markdown(report))

    Finding identities omit source line numbers, so moving a declaration does not create a false regression. Set fail_on_warning=true when warnings are also blocking for a release.

    #可运行示例

    moon run examples/basic moon run examples/baseline

    示例会解析一个 editor/terminal keymap,输出冲突摘要、冲突图热点、dispatcher 回放和建议修复。examples/basic/main.mbt 只依赖公开 API,可以直接复制为集成测试的起点。

    #报告与 CI

    仓库中的 .github/workflows/ci.yml 会在 push、pull request 和手动触发时执行:

    moon check --deny-warn moon build moon test --deny-warn moon fmt --check moon info

    同时运行 CLI、basic example,并检查 pkg.generated.mbti 没有未提交变化。SARIF 输出可以作为 GitHub Code Scanning 的上传输入;项目本身不上传任何键盘记录或用户数据。

    #测试

    当前测试覆盖:

    • 修饰键别名、非法 chord、空输入和连续 chord;
    • parser 的未知 directive、重复 context、保留键和禁用记录;
    • 精确冲突、同命令重复、前缀冲突、父子/兄弟 context 和平台集合;
    • reserved catalog、Accessibility 风险、策略 profile 和自定义项目规则;
    • CSV/TSV/pipe 适配、DSL round-trip、keymap merge 和语义 diff;
    • conflict graph、dispatcher/replay、audit timeline、release gate 和 benchmark;
    • text/Markdown/JSON/SARIF/schema 输出的稳定字段。

    本地运行:

    moon test --deny-warn

    #性能与可扩展性

    当前实现优先保证可解释性和 wasm 可移植性:解析约为 O(lines × attributes),分析约为 O(bindings² + bindings × context-depth),dispatcher 约为 O(bindings × context-depth)。complexity_report 和 run_benchmark 用于把规模、回归和未来索引优化记录在版本历史中。项目边界明确保留了操作系统 hook 和 GUI 录制功能,避免把静态分析器扩成不可维护的桌面框架。

    #许可证与来源

    源代码采用 Apache-2.0,见 LICENSE。运行时没有复制第三方实现;仅使用 MoonBit 官方 moonbitlang/core。保留快捷键目录中的平台说明和来源链接是政策解释材料,不是从平台代码中移植的实现。更完整的来源记录见 THIRD_PARTY_NOTICES.md。

    #AI 使用说明

    开发过程中使用 AI 辅助生成了部分初稿、测试用例和文档草稿,所有内容均由项目维护者在本地 MoonBit 工具链中审阅、修改并通过测试。没有引入来源不明的代码、素材、用户数据或未授权模型输出;AI 不替代许可证审查、测试和发布决定。详见 AI_USAGE.md。

    #维护与发布

    • 变更应保持一个有意义的提交一个主题,保留真实 Git 提交、Issue、PR、测试和发布记录。
    • 发布前运行 moon package --list,确认包中没有 _build、临时文件或敏感数据。
    • 0.3.0 已发布至 Mooncakes,并已核对公开 manifest 的版本、构建状态和包可用状态。
    • 发布流程、验收证据和风险记录见 docs/ 与 submission/。

    #相似方案核对(截至 2026-09-17)

    VS Code 内置同键查看、排障日志、实机测试及其他按键项目都应优先用于各自擅长的问题。本项目的限定差异是把给定规则快照和显式状态契约放入 CI,并对未知宿主语义返回 inconclusive。查重范围和限制记录在 docs/DEDUPLICATION.md;有限检索不能证明绝对首创,也不等于已有外部采用。

    Analysis

    pub(all) struct Analysis {
    keymap_name : String
    findings : Array[Finding]
    checked_bindings : Int
    enabled_bindings : Int
    error_count : Int
    warning_count : Int
    info_count : Int
    score : Int
    fingerprint : String
    } derive(Eq,
    Debug
    )

    A complete deterministic analysis result.

    Analysis::count_kind

    fn Analysis::count_kind(self : Analysis, kind : IssueKind) -> Int

    Count findings of a particular kind.

    Analysis::equal

    fn Analysis::equal(Analysis, Analysis) -> Bool

    Analysis::not_equal

    fn Analysis::not_equal(x : Analysis, y : Analysis) -> Bool

    Analysis::ok

    fn Analysis::ok(self : Analysis) -> Bool

    True when the analysis has no error-level findings.

    Analysis::summary

    fn Analysis::summary(self : Analysis) -> String

    Return a compact summary intended for CI logs.

    Analysis::to_repr

    AuditTimeline

    pub(all) struct AuditTimeline {
    project : String
    events : Array[TimelineEvent]
    baseline : String
    } derive(Eq,
    Debug
    )

    AuditTimeline::equal

    AuditTimeline::new

    fn AuditTimeline::new(project : String, baseline? : String) -> AuditTimeline

    AuditTimeline::not_equal

    fn AuditTimeline::not_equal(x : AuditTimeline, y : AuditTimeline) -> Bool

    BaselineReport

    pub(all) struct BaselineReport {
    baseline_fingerprint : String
    current_fingerprint : String
    baseline_count : Int
    current_count : Int
    new_findings : Array[Finding]
    resolved_findings : Array[Finding]
    retained_count : Int
    new_error_count : Int
    new_warning_count : Int
    new_info_count : Int
    fail_on_warning : Bool
    passed : Bool
    } derive(Eq,
    Debug
    )

    A differential report for CI baseline checks.

    Existing findings are retained as debt, while only newly introduced findings affect the default gate. Finding identities deliberately omit line and source so that moving a declaration does not look like a new defect.

    BaselineReport::equal

    BaselineReport::not_equal

    fn BaselineReport::not_equal(x : BaselineReport, y : BaselineReport) -> Bool

    BaselineReport::summary

    fn BaselineReport::summary(self : BaselineReport) -> String

    Return a concise baseline summary for CI logs.

    BenchmarkCase

    pub(all) struct BenchmarkCase {
    name : String
    inputs : Array[String]
    context : String
    platform : String
    expected_status : DispatchStatus
    repetitions : Int
    } derive(Eq,
    Debug
    )

    Portable benchmark and regression fixtures without wall-clock dependence.

    BenchmarkCase::equal

    BenchmarkCase::not_equal

    fn BenchmarkCase::not_equal(x : BenchmarkCase, y : BenchmarkCase) -> Bool

    BenchmarkResult

    pub(all) struct BenchmarkResult {
    name : String
    operations : Int
    matched : Int
    prefixes : Int
    misses : Int
    mismatches : Int
    score : Int
    notes : Array[String]
    } derive(Eq,
    Debug
    )

    BenchmarkResult::equal

    BenchmarkResult::not_equal

    fn BenchmarkResult::not_equal(x : BenchmarkResult, y : BenchmarkResult) -> Bool

    Binding

    pub(all) struct Binding {
    id : String
    command : String
    keys : KeySequence
    context : String
    platform : String
    source : String
    line : Int
    priority : Int
    enabled : Bool
    description : String
    } derive(Eq,
    Debug
    )

    A single shortcut declaration from a keymap file.

    Binding::equal

    fn Binding::equal(Binding, Binding) -> Bool

    Binding::label

    fn Binding::label(self : Binding) -> String

    Return the stable identifier used in reports.

    Binding::new

    fn Binding::new(id : String, command : String, keys : KeySequence, context? : String, platform? : String, source? : String, line? : Int, priority? : Int, enabled? : Bool, description? : String) -> Binding

    Construct a binding with sensible defaults for programmatic callers.

    Binding::not_equal

    fn Binding::not_equal(x : Binding, y : Binding) -> Bool

    Binding::to_repr

    BindingChange

    pub(all) struct BindingChange {
    kind : ChangeKind
    id : String
    before : Binding?
    after : Binding?
    summary : String
    risk : Severity
    } derive(Eq,
    Debug
    )

    BindingChange::equal

    BindingChange::not_equal

    fn BindingChange::not_equal(x : BindingChange, y : BindingChange) -> Bool

    BindingQuery

    pub(all) struct BindingQuery {
    binding : Binding
    context_distance : Int
    platform_match : Bool
    command_match : Bool
    } derive(Eq,
    Debug
    )

    Query, projection, and deterministic serialization helpers.

    BindingQuery::equal

    BindingQuery::not_equal

    fn BindingQuery::not_equal(x : BindingQuery, y : BindingQuery) -> Bool

    BindingRow

    pub(all) struct BindingRow {
    id : String
    command : String
    keys : String
    context : String
    platform : String
    priority : String
    enabled : String
    description : String
    } derive(Eq,
    Debug
    )

    Dependency-free tabular adapters for importing keymaps from CI artifacts.

    BindingRow::equal

    fn BindingRow::equal(BindingRow, BindingRow) -> Bool

    BindingRow::not_equal

    fn BindingRow::not_equal(x : BindingRow, y : BindingRow) -> Bool

    CatalogReport

    pub(all) struct CatalogReport {
    keymap : Keymap
    matched : Array[ReservedRule]
    unmatched : Array[ReservedRule]
    findings : Array[Finding]
    } derive(Eq,
    Debug
    )

    CatalogReport::equal

    CatalogReport::not_equal

    fn CatalogReport::not_equal(x : CatalogReport, y : CatalogReport) -> Bool

    ChangeKind

    pub(all) enum ChangeKind {
    Added
    Removed
    Modified
    Unchanged
    } derive(Eq,
    Debug
    )

    Semantic keymap diffing for review and migration planning.

    ChangeKind::equal

    fn ChangeKind::equal(ChangeKind, ChangeKind) -> Bool

    ChangeKind::not_equal

    fn ChangeKind::not_equal(x : ChangeKind, y : ChangeKind) -> Bool

    ComplexityReport

    pub(all) struct ComplexityReport {
    bindings : Int
    contexts : Int
    findings : Int
    parse_complexity : String
    analysis_complexity : String
    dispatch_complexity : String
    memory_notes : Array[String]
    } derive(Eq,
    Debug
    )

    ComplexityReport::equal

    ComplexityReport::not_equal

    fn ComplexityReport::not_equal(x : ComplexityReport, y : ComplexityReport) -> Bool

    ConflictEdge

    pub(all) struct ConflictEdge {
    left : String
    right : String
    code : String
    severity : Severity
    weight : Int
    } derive(Eq,
    Debug
    )

    Conflict graph utilities for finding keymap hotspots.

    ConflictEdge::equal

    ConflictEdge::not_equal

    fn ConflictEdge::not_equal(x : ConflictEdge, y : ConflictEdge) -> Bool

    ConflictGraph

    pub(all) struct ConflictGraph {
    nodes : Array[ConflictNode]
    edges : Array[ConflictEdge]
    components : Array[Array[String]]
    } derive(Eq,
    Debug
    )

    ConflictGraph::equal

    ConflictGraph::not_equal

    fn ConflictGraph::not_equal(x : ConflictGraph, y : ConflictGraph) -> Bool

    ConflictNode

    pub(all) struct ConflictNode {
    id : String
    command : String
    degree : Int
    error_degree : Int
    warning_degree : Int
    info_degree : Int
    } derive(Eq,
    Debug
    )

    ConflictNode::equal

    ConflictNode::not_equal

    fn ConflictNode::not_equal(x : ConflictNode, y : ConflictNode) -> Bool

    Context

    pub(all) struct Context {
    name : String
    parent : String
    rank : Int
    description : String
    } derive(Eq,
    Debug
    )

    A context declaration. Contexts form a small inheritance tree used when deciding whether one binding shadows another.

    Context::equal

    fn Context::equal(Context, Context) -> Bool

    Context::not_equal

    fn Context::not_equal(x : Context, y : Context) -> Bool

    Context::to_repr

    DispatchResult

    pub(all) struct DispatchResult {
    status : DispatchStatus
    input : String
    canonical : String
    command : String
    binding_ids : Array[String]
    context : String
    platform : String
    message : String
    } derive(Eq,
    Debug
    )

    DispatchResult::equal

    DispatchResult::not_equal

    fn DispatchResult::not_equal(x : DispatchResult, y : DispatchResult) -> Bool

    DispatchStatus

    pub(all) enum DispatchStatus {
    Matched
    Prefix
    NoMatch
    Ambiguous
    Disabled
    Invalid
    } derive(Eq,
    Debug
    )

    A small deterministic dispatcher simulation used to validate analyzer assumptions without depending on a GUI or operating-system backend.

    DispatchStatus::equal

    DispatchStatus::not_equal

    fn DispatchStatus::not_equal(x : DispatchStatus, y : DispatchStatus) -> Bool

    DispatchStep

    pub(all) struct DispatchStep {
    input : String
    result : DispatchResult
    elapsed_ms : Int
    } derive(Eq,
    Debug
    )

    DispatchStep::equal

    DispatchStep::not_equal

    fn DispatchStep::not_equal(x : DispatchStep, y : DispatchStep) -> Bool

    DispatchTrace

    pub(all) struct DispatchTrace {
    context : String
    platform : String
    steps : Array[DispatchStep]
    matched_count : Int
    prefix_count : Int
    no_match_count : Int
    } derive(Eq,
    Debug
    )

    DispatchTrace::equal

    DispatchTrace::not_equal

    fn DispatchTrace::not_equal(x : DispatchTrace, y : DispatchTrace) -> Bool

    Effort

    pub(all) enum Effort {
    Small
    Medium
    Large
    } derive(Eq,
    Debug
    )

    Human-oriented recommendations derived from machine findings.

    Effort::equal

    fn Effort::equal(Effort, Effort) -> Bool

    Effort::not_equal

    fn Effort::not_equal(x : Effort, y : Effort) -> Bool

    Effort::to_repr

    FieldSpec

    pub(all) struct FieldSpec {
    name : String
    required : Bool
    description : String
    example : String
    } derive(Eq,
    Debug
    )

    Machine-readable schema and support matrix for integrations.

    FieldSpec::equal

    fn FieldSpec::equal(FieldSpec, FieldSpec) -> Bool

    FieldSpec::not_equal

    fn FieldSpec::not_equal(x : FieldSpec, y : FieldSpec) -> Bool

    Finding

    pub(all) struct Finding {
    code : String
    kind : IssueKind
    severity : Severity
    message : String
    primary_id : String
    secondary_id : String
    shortcut : String
    context : String
    source : String
    line : Int
    suggestion : String
    } derive(Eq,
    Debug
    )

    A finding emitted by the analyzer.

    Finding::equal

    fn Finding::equal(Finding, Finding) -> Bool

    Finding::not_equal

    fn Finding::not_equal(x : Finding, y : Finding) -> Bool

    Finding::to_line

    fn Finding::to_line(self : Finding) -> String

    Convert a finding into a compact human-readable line.

    Finding::to_repr

    GateItem

    pub(all) struct GateItem {
    code : String
    title : String
    passed : Bool
    severity : Severity
    evidence : String
    remediation : String
    } derive(Eq,
    Debug
    )

    Release governance helpers keep the engineering evidence reviewable.

    GateItem::equal

    fn GateItem::equal(GateItem, GateItem) -> Bool

    GateItem::not_equal

    fn GateItem::not_equal(x : GateItem, y : GateItem) -> Bool

    GateItem::to_repr

    ImportReport

    pub(all) struct ImportReport {
    keymap : Keymap
    rows_seen : Int
    rows_imported : Int
    diagnostics : Array[ParseDiagnostic]
    } derive(Eq,
    Debug
    )

    ImportReport::equal

    ImportReport::not_equal

    fn ImportReport::not_equal(x : ImportReport, y : ImportReport) -> Bool

    IssueKind

    pub(all) enum IssueKind {
    ExactConflict
    PrefixConflict
    ShadowedBinding
    DuplicateCommand
    ReservedShortcut
    AccessibilityRisk
    InvalidKey
    InvalidContext
    InvalidRecord
    DisabledBinding
    PlatformOverlap
    } derive(Eq,
    Debug
    )

    The family of rule that produced a finding.

    IssueKind::equal

    fn IssueKind::equal(IssueKind, IssueKind) -> Bool

    IssueKind::name

    fn IssueKind::name(self : IssueKind) -> String

    Return the issue kind as a stable kebab-case code.

    IssueKind::not_equal

    fn IssueKind::not_equal(x : IssueKind, y : IssueKind) -> Bool

    KeySequence

    pub(all) struct KeySequence {
    raw : String
    steps : Array[String]
    canonical : String
    has_modifier : Bool
    modifier_count : Int
    key_count : Int
    } derive(Eq,
    Debug
    )

    A normalized keyboard sequence. The textual form is stable and suitable for reports, while steps keeps each chord available to library consumers.

    KeySequence::equal

    fn KeySequence::equal(KeySequence, KeySequence) -> Bool

    KeySequence::new

    fn KeySequence::new(raw : String, steps : Array[String], canonical : String, has_modifier : Bool, modifier_count : Int) -> KeySequence

    Construct a normalized sequence value.

    KeySequence::not_equal

    fn KeySequence::not_equal(x : KeySequence, y : KeySequence) -> Bool

    Keymap

    pub(all) struct Keymap {
    name : String
    version : String
    bindings : Array[Binding]
    contexts : Array[Context]
    reserved : Array[String]
    } derive(Eq,
    Debug
    )

    All data needed to analyze one keymap.

    Keymap::empty

    fn Keymap::empty(name? : String) -> Keymap

    Construct an empty keymap.

    Keymap::equal

    fn Keymap::equal(Keymap, Keymap) -> Bool

    Keymap::not_equal

    fn Keymap::not_equal(x : Keymap, y : Keymap) -> Bool

    Keymap::to_repr

    KeymapDiff

    pub(all) struct KeymapDiff {
    from_name : String
    to_name : String
    changes : Array[BindingChange]
    added : Int
    removed : Int
    modified : Int
    unchanged : Int
    context_added : Int
    context_removed : Int
    reserved_added : Int
    reserved_removed : Int
    } derive(Eq,
    Debug
    )

    KeymapDiff::equal

    fn KeymapDiff::equal(KeymapDiff, KeymapDiff) -> Bool

    KeymapDiff::not_equal

    fn KeymapDiff::not_equal(x : KeymapDiff, y : KeymapDiff) -> Bool

    KeymapMetrics

    pub(all) struct KeymapMetrics {
    binding_count : Int
    enabled_count : Int
    context_count : Int
    platform_count : Int
    command_count : Int
    max_chord_length : Int
    average_chord_length : Int
    modifierless_count : Int
    documented_count : Int
    duplicate_command_count : Int
    density_score : Int
    } derive(Eq,
    Debug
    )

    Keymap metrics used to track maintainability over time.

    KeymapMetrics::equal

    KeymapMetrics::not_equal

    fn KeymapMetrics::not_equal(x : KeymapMetrics, y : KeymapMetrics) -> Bool

    KeymapSchema

    pub(all) struct KeymapSchema {
    version : String
    directives : Array[String]
    fields : Array[FieldSpec]
    formats : Array[String]
    guarantees : Array[String]
    } derive(Eq,
    Debug
    )

    KeymapSchema::equal

    KeymapSchema::not_equal

    fn KeymapSchema::not_equal(x : KeymapSchema, y : KeymapSchema) -> Bool

    KeymapSelection

    pub(all) struct KeymapSelection {
    name : String
    bindings : Array[Binding]
    contexts : Array[Context]
    query : String
    } derive(Eq,
    Debug
    )

    KeymapSelection::equal

    KeymapSelection::not_equal

    fn KeymapSelection::not_equal(x : KeymapSelection, y : KeymapSelection) -> Bool

    MergeResult

    pub(all) struct MergeResult {
    keymap : Keymap
    conflicts : Array[String]
    adopted : Int
    skipped : Int
    } derive(Eq,
    Debug
    )

    MergeResult::equal

    fn MergeResult::equal(MergeResult, MergeResult) -> Bool

    MergeResult::not_equal

    fn MergeResult::not_equal(x : MergeResult, y : MergeResult) -> Bool

    ParseDiagnostic

    pub(all) struct ParseDiagnostic {
    line : Int
    code : String
    message : String
    source : String
    } derive(Eq,
    Debug
    )

    Parse diagnostics are kept separate from policy findings.

    ParseDiagnostic::equal

    ParseDiagnostic::not_equal

    fn ParseDiagnostic::not_equal(x : ParseDiagnostic, y : ParseDiagnostic) -> Bool

    ParseResult

    pub(all) struct ParseResult {
    keymap : Keymap
    diagnostics : Array[ParseDiagnostic]
    ok : Bool
    } derive(Eq,
    Debug
    )

    Result returned by the line-oriented keymap parser.

    ParseResult::equal

    fn ParseResult::equal(ParseResult, ParseResult) -> Bool

    ParseResult::not_equal

    fn ParseResult::not_equal(x : ParseResult, y : ParseResult) -> Bool

    PolicyProfile

    pub(all) struct PolicyProfile {
    name : String
    reserved : Array[String]
    max_chord_length : Int
    max_modifier_count : Int
    require_description : Bool
    allow_disabled : Bool
    fail_on_warning : Bool
    allowed_platforms : Array[String]
    } derive(Eq,
    Debug
    )

    Named policy profiles turn the analyzer into a repeatable CI gate.

    PolicyProfile::equal

    PolicyProfile::not_equal

    fn PolicyProfile::not_equal(x : PolicyProfile, y : PolicyProfile) -> Bool

    ProfileReport

    pub(all) struct ProfileReport {
    profile : PolicyProfile
    parse : ParseResult
    analysis : Analysis
    metrics : KeymapMetrics
    passed : Bool
    gate_messages : Array[String]
    } derive(Eq,
    Debug
    )

    ProfileReport::equal

    ProfileReport::not_equal

    fn ProfileReport::not_equal(x : ProfileReport, y : ProfileReport) -> Bool

    ProjectRules

    pub(all) struct ProjectRules {
    command_prefix : String
    required_contexts : Array[String]
    allowed_platforms : Array[String]
    max_bindings_per_context : Int
    require_modifier : Bool
    require_description : Bool
    fail_on_info : Bool
    } derive(Eq,
    Debug
    )

    Extensible project rules for teams that need conventions beyond built-ins.

    ProjectRules::default

    fn ProjectRules::default() -> ProjectRules

    ProjectRules::equal

    ProjectRules::not_equal

    fn ProjectRules::not_equal(x : ProjectRules, y : ProjectRules) -> Bool

    ReachabilityCell

    pub(all) struct ReachabilityCell {
    binding_id : String
    context : String
    platform : String
    status : ReachabilityStatus
    selected_id : String
    message : String
    } derive(Eq,
    Debug
    )

    ReachabilityCell::equal

    ReachabilityCell::not_equal

    fn ReachabilityCell::not_equal(x : ReachabilityCell, y : ReachabilityCell) -> Bool

    ReachabilityReport

    pub(all) struct ReachabilityReport {
    keymap_name : String
    contexts : Array[String]
    platforms : Array[String]
    cells : Array[ReachabilityCell]
    binding_count : Int
    reachable_count : Int
    shadowed_count : Int
    ambiguous_count : Int
    unavailable_count : Int
    disabled_count : Int
    } derive(Eq,
    Debug
    )

    ReachabilityReport::equal

    ReachabilityReport::not_equal

    ReachabilityReport::summary

    fn ReachabilityReport::summary(self : ReachabilityReport) -> String

    ReachabilityStatus

    pub(all) enum ReachabilityStatus {
    Reachable
    Shadowed
    Ambiguous
    Unavailable
    Disabled
    } derive(Eq,
    Debug
    )

    A deterministic context/platform probe matrix for shortcut reachability.

    Conflict reports explain that two declarations overlap; this report answers the complementary release question: for a concrete context and platform, which binding actually wins, and which declarations are never selected?

    ReachabilityStatus::equal

    ReachabilityStatus::not_equal

    Recommendation

    pub(all) struct Recommendation {
    code : String
    title : String
    priority : Int
    severity : Severity
    effort : Effort
    affected_ids : Array[String]
    rationale : String
    action : String
    } derive(Eq,
    Debug
    )

    Recommendation::equal

    Recommendation::not_equal

    fn Recommendation::not_equal(x : Recommendation, y : Recommendation) -> Bool

    ReleaseGate

    pub(all) struct ReleaseGate {
    project : String
    version : String
    items : Array[GateItem]
    passed : Bool
    score : Int
    } derive(Eq,
    Debug
    )

    ReleaseGate::equal

    fn ReleaseGate::equal(ReleaseGate, ReleaseGate) -> Bool

    ReleaseGate::not_equal

    fn ReleaseGate::not_equal(x : ReleaseGate, y : ReleaseGate) -> Bool

    ReleaseInput

    pub(all) struct ReleaseInput {
    keymap : Keymap
    analysis : Analysis
    validation : ValidationReport
    profile : ProfileReport?
    benchmark : Array[BenchmarkResult]
    diff : KeymapDiff?
    } derive(Eq,
    Debug
    )

    ReleaseInput::equal

    ReleaseInput::not_equal

    fn ReleaseInput::not_equal(x : ReleaseInput, y : ReleaseInput) -> Bool

    ReservedRule

    pub(all) struct ReservedRule {
    platform : String
    shortcut : String
    rationale : String
    source : String
    severity : Severity
    } derive(Eq,
    Debug
    )

    Curated reservation catalog with provenance-friendly explanations.

    ReservedRule::equal

    ReservedRule::not_equal

    fn ReservedRule::not_equal(x : ReservedRule, y : ReservedRule) -> Bool

    RuleReport

    pub(all) struct RuleReport {
    rules : ProjectRules
    findings : Array[Finding]
    passed : Bool
    } derive(Eq,
    Debug
    )

    RuleReport::equal

    fn RuleReport::equal(RuleReport, RuleReport) -> Bool

    RuleReport::not_equal

    fn RuleReport::not_equal(x : RuleReport, y : RuleReport) -> Bool

    Severity

    pub(all) enum Severity {
    Info
    Warning
    Error
    } derive(Eq,
    Debug
    )

    A severity attached to an analysis finding.

    Severity::equal

    fn Severity::equal(Severity, Severity) -> Bool

    Severity::name

    fn Severity::name(self : Severity) -> String

    Return the issue severity as a machine-readable string.

    Severity::not_equal

    fn Severity::not_equal(x : Severity, y : Severity) -> Bool

    Severity::to_repr

    StructuralIssue

    pub(all) struct StructuralIssue {
    kind : StructuralKind
    code : String
    message : String
    id : String
    line : Int
    severity : Severity
    } derive(Eq,
    Debug
    )

    StructuralIssue::equal

    StructuralIssue::not_equal

    fn StructuralIssue::not_equal(x : StructuralIssue, y : StructuralIssue) -> Bool

    StructuralKind

    pub(all) enum StructuralKind {
    MissingRootContext
    DuplicateId
    EmptyId
    EmptyCommand
    InvalidIdentifier
    MissingParent
    ContextCycle
    NegativeRank
    InvalidPlatform
    InvalidReservedMarker
    InvalidShortcut
    EmptyDescription
    } derive(Eq,
    Debug
    )

    Structural validation runs before policy analysis and gives precise repair locations for malformed keymaps.

    StructuralKind::equal

    StructuralKind::not_equal

    fn StructuralKind::not_equal(x : StructuralKind, y : StructuralKind) -> Bool

    Suggestion

    pub(all) struct Suggestion {
    binding_id : String
    command : String
    current : String
    replacement : String
    reason : String
    confidence : Int
    } derive(Eq,
    Debug
    )

    A candidate replacement suggested for a problematic binding.

    Suggestion::equal

    fn Suggestion::equal(Suggestion, Suggestion) -> Bool

    Suggestion::not_equal

    fn Suggestion::not_equal(x : Suggestion, y : Suggestion) -> Bool

    TimelineDelta

    pub(all) struct TimelineDelta {
    previous : TimelineEvent?
    current : TimelineEvent
    score_delta : Int
    errors_delta : Int
    warnings_delta : Int
    regressed : Bool
    } derive(Eq,
    Debug
    )

    TimelineDelta::equal

    TimelineDelta::not_equal

    fn TimelineDelta::not_equal(x : TimelineDelta, y : TimelineDelta) -> Bool

    TimelineEvent

    pub(all) struct TimelineEvent {
    sequence : Int
    label : String
    actor : String
    kind : TimelineEventKind
    fingerprint : String
    errors : Int
    warnings : Int
    score : Int
    note : String
    } derive(Eq,
    Debug
    )

    TimelineEvent::equal

    TimelineEvent::not_equal

    fn TimelineEvent::not_equal(x : TimelineEvent, y : TimelineEvent) -> Bool

    TimelineEventKind

    pub(all) enum TimelineEventKind {
    Imported
    Analyzed
    Approved
    Rejected
    Migrated
    } derive(Eq,
    Debug
    )

    Append-only audit timeline for tracking keymap evolution in CI.

    TimelineEventKind::equal

    TimelineEventKind::not_equal

    fn TimelineEventKind::not_equal(x : TimelineEventKind, y : TimelineEventKind) -> Bool

    ValidationReport

    pub(all) struct ValidationReport {
    keymap_name : String
    issues : Array[StructuralIssue]
    error_count : Int
    warning_count : Int
    valid : Bool
    } derive(Eq,
    Debug
    )

    ValidationReport::equal

    ValidationReport::not_equal

    fn ValidationReport::not_equal(x : ValidationReport, y : ValidationReport) -> Bool

    accessible_profile

    fn accessible_profile() -> PolicyProfile

    A profile for user-facing tools that prioritizes discoverability.

    active_bindings

    fn active_bindings(keymap : Keymap, context : String, platform : String) -> Array[BindingQuery]

    Resolve bindings active in a context. Parent declarations come first so a caller can apply child-priority rules while streaming the result.

    analysis_exit_code

    fn analysis_exit_code(analysis : Analysis, fail_on_warning? : Bool) -> Int

    Return a conventional process exit code for a CI gate.

    analysis_to_json

    fn analysis_to_json(analysis : Analysis) -> String

    Serialize an analysis without relying on a third-party JSON package.

    analysis_to_markdown

    fn analysis_to_markdown(analysis : Analysis) -> String

    Render a concise Markdown table for documentation and release notes.

    analysis_to_sarif

    fn analysis_to_sarif(analysis : Analysis) -> String

    SARIF 2.1.0 output lets GitHub annotate keymap files in CI.

    analysis_to_text

    fn analysis_to_text(analysis : Analysis) -> String

    Human-readable report suitable for a pull request comment.

    analyze

    fn analyze(keymap : Keymap) -> Analysis

    Analyze declarations using all built-in rules.

    analyze_with_rules

    fn analyze_with_rules(keymap : Keymap, rules : ProjectRules) -> Analysis

    Combine built-in analysis with project rules while preserving evidence.

    apply_keymap_diff

    fn apply_keymap_diff(base : Keymap, target : Keymap, include_removed? : Bool) -> Keymap

    Apply a diff's additions and modifications to a base keymap.

    apply_reserved_catalog

    fn apply_reserved_catalog(keymap : Keymap, rules : Array[ReservedRule]) -> Keymap

    Add the catalog to a keymap's reserved markers without introducing dupes.

    audit

    fn audit(source : String, name? : String) -> (ParseResult, Analysis)

    Parse and analyze in one call for CLI and integrations.

    audit_with_catalog

    fn audit_with_catalog(keymap : Keymap, rules : Array[ReservedRule]) -> CatalogReport

    Audit against an explicit reservation catalog and preserve matched rules.

    audit_with_named_profile

    fn audit_with_named_profile(source : String, name : String, profile_name : String) -> ProfileReport

    Convenience overload using a built-in profile.

    audit_with_profile

    fn audit_with_profile(source : String, name : String, profile : PolicyProfile) -> ProfileReport

    Analyze one source document with a named policy profile.

    baseline_report_to_json

    fn baseline_report_to_json(report : BaselineReport) -> String

    Serialize a baseline result for CI artifacts.

    baseline_report_to_markdown

    fn baseline_report_to_markdown(report : BaselineReport) -> String

    Render a baseline report as Markdown suitable for a pull request comment.

    behavioral_changes

    fn behavioral_changes(diff : KeymapDiff) -> Array[BindingChange]

    Return only changes that may alter runtime behavior.

    benchmark_case

    fn benchmark_case(name : String, inputs : Array[String], context? : String, platform? : String, expected_status? : DispatchStatus, repetitions? : Int) -> BenchmarkCase

    benchmark_result_to_json

    fn benchmark_result_to_json(result : BenchmarkResult) -> String

    benchmark_results_to_markdown

    fn benchmark_results_to_markdown(results : Array[BenchmarkResult]) -> String

    benchmark_suite

    fn benchmark_suite(keymap : Keymap, fixtures : Array[BenchmarkCase]) -> Array[BenchmarkResult]

    build_conflict_graph

    fn build_conflict_graph(keymap : Keymap, analysis : Analysis) -> ConflictGraph

    Build a graph from findings, retaining isolated bindings as nodes.

    canonical_keys

    fn canonical_keys(raw : String) -> String

    Normalize a key sequence for comparisons. Invalid input returns an empty string, which makes it safe to use in diagnostics without throwing.

    catalog_report_to_markdown

    fn catalog_report_to_markdown(report : CatalogReport) -> String

    catalog_to_json

    fn catalog_to_json(rules : Array[ReservedRule]) -> String

    clean_demo_source

    fn clean_demo_source() -> String

    A clean sample useful for embedding in a smoke test.

    compare_baseline

    fn compare_baseline(baseline : Analysis, current : Analysis, fail_on_warning? : Bool) -> BaselineReport

    Compare a current analysis with an accepted baseline.

    By default this is a ratchet: old findings remain visible but do not block a release, while any new error blocks it. Set fail_on_warning when a team wants warnings to be part of its release policy as well.

    complexity_report

    fn complexity_report(keymap : Keymap, analysis : Analysis) -> ComplexityReport

    Explain the current implementation's asymptotic behavior so it can be tracked when a future indexed implementation is introduced.

    complexity_to_markdown

    fn complexity_to_markdown(report : ComplexityReport) -> String

    conflict_component

    fn conflict_component(graph : ConflictGraph, id : String) -> Array[String]

    Return the component containing an id.

    conflict_graph_to_json

    fn conflict_graph_to_json(graph : ConflictGraph) -> String

    conflict_graph_to_markdown

    fn conflict_graph_to_markdown(graph : ConflictGraph, limit? : Int) -> String

    conflict_hotspots

    fn conflict_hotspots(graph : ConflictGraph, limit? : Int) -> Array[ConflictNode]

    Return nodes ranked by conflict degree, with stable id tie-breaking.

    default_reserved_rules

    fn default_reserved_rules() -> Array[ReservedRule]

    The catalog is intentionally conservative: it flags well-known system controls, but the profile can always be customized for a product shell.

    demo_analysis

    fn demo_analysis() -> Analysis

    Run the full sample audit.

    demo_keymap

    fn demo_keymap() -> Keymap

    Build a sample keymap directly, avoiding a parser round trip for embedding.

    demo_source

    fn demo_source() -> String

    The sample intentionally contains one exact conflict, one chord-prefix warning, one reserved shortcut, and one disabled entry.

    desktop_profile

    fn desktop_profile() -> PolicyProfile

    Sensible cross-platform defaults for desktop applications.

    diff_keymaps

    fn diff_keymaps(before : Keymap, after : Keymap) -> KeymapDiff

    Compare declarations by id and retain unchanged entries for auditability.

    dispatch

    fn dispatch(keymap : Keymap, raw : String, context? : String, platform? : String) -> DispatchResult

    Resolve one complete or partial sequence.

    dispatch_result_to_json

    fn dispatch_result_to_json(result : DispatchResult) -> String

    dispatch_trace_to_markdown

    fn dispatch_trace_to_markdown(trace : DispatchTrace) -> String

    evaluate_project_rules

    fn evaluate_project_rules(keymap : Keymap, rules : ProjectRules) -> RuleReport

    Apply project-specific naming, scope, density, and documentation rules.

    explain_reserved

    fn explain_reserved(binding : Binding, rules : Array[ReservedRule]) -> Array[ReservedRule]

    Find catalog rules that explain why a binding is reserved.

    export_csv

    fn export_csv(keymap : Keymap) -> String

    Export a keymap using a stable, documented column order.

    find_binding

    fn find_binding(keymap : Keymap, id : String) -> Binding?

    Look up one binding by its stable id.

    find_command

    fn find_command(keymap : Keymap, command : String) -> Array[Binding]

    Return all bindings belonging to a command, retaining declaration order.

    health_recommendations

    fn health_recommendations(keymap : Keymap, analysis : Analysis) -> Array[Recommendation]

    Add maintainability advice even when no conflict exists.

    import_csv

    fn import_csv(source : String, name? : String) -> ImportReport

    Import the stable CSV schema emitted by export_csv.

    import_pipe

    fn import_pipe(source : String, name? : String) -> ImportReport

    Import a legacy pipe format, NOT a native VS Code keybindings file: command | key | when | platform.

    import_report_to_text

    fn import_report_to_text(report : ImportReport) -> String

    import_rows

    fn import_rows(rows : Array[BindingRow], name? : String) -> ImportReport

    Construct a keymap from rows and preserve row-level diagnostics.

    import_tsv

    fn import_tsv(source : String, name? : String) -> ImportReport

    Import tab-separated rows using the same column names as CSV.

    key_prefix

    fn key_prefix(prefix : KeySequence, full : KeySequence) -> Bool

    True if the first sequence is a strict prefix of the second.

    keymap_diff_to_json

    fn keymap_diff_to_json(diff : KeymapDiff) -> String

    keymap_from_bindings

    fn keymap_from_bindings(name : String, bindings : Array[Binding]) -> Keymap

    Create a minimal valid keymap without writing a DSL document.

    keymap_metrics

    fn keymap_metrics(keymap : Keymap) -> KeymapMetrics

    Calculate counts without relying on hash maps, keeping the library small.

    keymap_schema

    fn keymap_schema() -> KeymapSchema

    Describe the DSL consumed by parse_keymap.

    keymap_to_dsl

    fn keymap_to_dsl(keymap : Keymap) -> String

    Serialize a keymap back to a review-friendly DSL document.

    merge_keymaps

    fn merge_keymaps(base : Keymap, overlay : Keymap) -> MergeResult

    Merge an overlay keymap. Existing ids are replaced only when priority is at least as high; equal ids with a different command are reported.

    metrics_to_json

    fn metrics_to_json(metrics : KeymapMetrics) -> String

    migration_plan

    fn migration_plan(diff : KeymapDiff) -> String

    Render a migration plan that can be copied into a release checklist.

    normalize_keymap

    fn normalize_keymap(keymap : Keymap) -> Keymap

    Return a canonical copy with bindings and contexts sorted by name.

    overlap_explanation

    fn overlap_explanation(keymap : Keymap, left : Binding, right : Binding) -> String

    Explain why two bindings are considered to overlap.

    parse_diagnostics_to_json

    fn parse_diagnostics_to_json(diagnostics : Array[ParseDiagnostic]) -> String

    Serialize parser diagnostics for CI consumers.

    parse_keymap

    fn parse_keymap(source : String, name? : String) -> ParseResult

    Parse a complete keymap document.

    parse_keys

    fn parse_keys(raw : String) -> Result[KeySequence, String]

    Parse a sequence such as Ctrl+K Ctrl+C or cmd+k,cmd+c.

    platforms_overlap

    fn platforms_overlap(left : String, right : String) -> Bool

    Platform names are case-insensitive and can be combined with | or ,.

    primary_commands

    fn primary_commands(keymap : Keymap, context : String, platform : String) -> Array[Binding]

    Return one binding per unique command, choosing the most specific one.

    profile_by_name

    fn profile_by_name(name : String) -> PolicyProfile

    Resolve the built-in profile by name.

    profile_report_to_json

    fn profile_report_to_json(report : ProfileReport) -> String

    profile_report_to_markdown

    fn profile_report_to_markdown(report : ProfileReport) -> String

    project_capabilities

    fn project_capabilities() -> Array[String]

    Explain the design boundary in machine-readable form.

    reachability_matrix

    fn reachability_matrix(keymap : Keymap, contexts? : Array[String], platforms? : Array[String]) -> ReachabilityReport

    Probe every declaration against the requested contexts and platforms.

    Empty probe arrays mean all declared contexts and the all platform. The resulting arrays are sorted and deduplicated so the report fingerprint can be compared in CI without depending on caller order.

    reachability_to_json

    fn reachability_to_json(report : ReachabilityReport) -> String

    reachability_to_markdown

    fn reachability_to_markdown(report : ReachabilityReport) -> String

    recommendations

    fn recommendations(analysis : Analysis) -> Array[Recommendation]

    Build one actionable item per finding, deduplicated by finding code and ids.

    recommendations_to_json

    fn recommendations_to_json(items : Array[Recommendation]) -> String

    recommendations_to_markdown

    fn recommendations_to_markdown(items : Array[Recommendation]) -> String

    release_gate

    fn release_gate(project : String, version : String, input : ReleaseInput) -> ReleaseGate

    Evaluate the evidence that matters before publishing a new keymap policy.

    release_gate_to_json

    fn release_gate_to_json(gate : ReleaseGate) -> String

    release_gate_to_markdown

    fn release_gate_to_markdown(gate : ReleaseGate) -> String

    release_input

    fn release_input(keymap : Keymap, profile? : PolicyProfile?, baseline? : Keymap?) -> ReleaseInput

    Create a complete release input from a keymap and an optional baseline.

    replay

    fn replay(keymap : Keymap, inputs : Array[String], context? : String, platform? : String) -> DispatchTrace

    Replay a sequence of user inputs and count outcomes.

    row

    fn row(id : String, command : String, keys : String, context? : String, platform? : String, priority? : String, enabled? : String, description? : String) -> BindingRow

    A compact row constructor for integrations that already have columns.

    rule_report_to_json

    fn rule_report_to_json(report : RuleReport) -> String

    rule_report_to_markdown

    fn rule_report_to_markdown(report : RuleReport) -> String

    run_benchmark

    fn run_benchmark(keymap : Keymap, fixture : BenchmarkCase) -> BenchmarkResult

    Run a deterministic benchmark fixture and report semantic mismatches.

    schema_to_json

    fn schema_to_json(schema : KeymapSchema) -> String

    schema_to_markdown

    fn schema_to_markdown(schema : KeymapSchema) -> String

    select_bindings

    fn select_bindings(keymap : Keymap, command? : String, context? : String, platform? : String, enabled_only? : Bool) -> KeymapSelection

    Query by optional command, context, platform, and enabled state.

    selection_to_text

    fn selection_to_text(selection : KeymapSelection) -> String

    Produce a compact selection report for API clients.

    shortcut_final_key

    fn shortcut_final_key(sequence : KeySequence) -> String

    Return the final key without modifiers, useful for reserved-key policies.

    shortcut_has_modifier

    fn shortcut_has_modifier(sequence : KeySequence) -> Bool

    Parse a modifier expression and expose a simple risk signal.

    structural_issue_to_json

    fn structural_issue_to_json(issue : StructuralIssue) -> String

    suggest_all

    fn suggest_all(keymap : Keymap, analysis : Analysis, limit? : Int) -> Array[Suggestion]

    Suggest alternatives for every binding carrying a finding.

    suggest_for

    fn suggest_for(keymap : Keymap, binding : Binding, limit? : Int) -> Array[Suggestion]

    Suggest up to limit free alternatives for one binding.

    suggestions_to_markdown

    fn suggestions_to_markdown(suggestions : Array[Suggestion]) -> String

    Render suggestions as a simple Markdown checklist.

    support_matrix

    fn support_matrix() -> Array[(String, String, Bool)]

    Return a stable feature matrix for README and downstream tooling.

    terminal_profile

    fn terminal_profile() -> PolicyProfile

    A stricter profile for terminal and shell applications.

    timeline_append

    fn timeline_append(timeline : AuditTimeline, label : String, actor : String, kind : TimelineEventKind, analysis : Analysis, note? : String) -> AuditTimeline

    Append an event with a monotonically increasing sequence number.

    timeline_delta

    fn timeline_delta(timeline : AuditTimeline) -> TimelineDelta?

    Compare the latest event with the immediately preceding one.

    timeline_latest

    fn timeline_latest(timeline : AuditTimeline) -> TimelineEvent?

    timeline_record_gate

    fn timeline_record_gate(timeline : AuditTimeline, label : String, actor : String, analysis : Analysis, note? : String) -> AuditTimeline

    Record an analysis event and choose Approved/Rejected from the result.

    timeline_regressions

    fn timeline_regressions(timeline : AuditTimeline) -> Array[TimelineDelta]

    Return all regressions after the baseline event.

    timeline_summary

    fn timeline_summary(timeline : AuditTimeline) -> String

    Return a stable summary useful for release notes.

    timeline_to_json

    fn timeline_to_json(timeline : AuditTimeline) -> String

    timeline_to_markdown

    fn timeline_to_markdown(timeline : AuditTimeline) -> String

    unreachable_bindings

    fn unreachable_bindings(keymap : Keymap, context : String, platform : String) -> Array[Binding]

    Return ids that are declared but cannot be reached in a context.

    unreachable_commands

    fn unreachable_commands(keymap : Keymap, context : String, platform : String) -> Array[String]

    Check that every command has at least one dispatchable binding.

    validate_catalog

    fn validate_catalog(rules : Array[ReservedRule]) -> Array[String]

    Validate that every catalog entry itself uses a parseable shortcut.

    validate_keymap

    fn validate_keymap(keymap : Keymap) -> ValidationReport

    Inspect all declarations without applying conflict policy.

    validation_to_json

    fn validation_to_json(report : ValidationReport) -> String

    validation_to_markdown

    fn validation_to_markdown(report : ValidationReport) -> String