Skip to content

[feature-request] A query surface over TypeScript statements and expressions in the frontend engine #442

Description

@jessegall

Proposal:
Vue\Codebase exposes only whereElement/whereTag (template elements) and whereTypeDeclaration (TS object types). There is no way to select statements or expressions inside a .ts module, so a whole class of frontend rule cannot be written. Concretely I wanted a 'client-decides' detector for a backend-driven UI: flag a module under resources/js/view that (a) branches on a domain word read off the DOM (an if/switch comparing dataset.* or getAttribute('data-*') against a string literal), (b) finds its target with a meaning-selector it invented rather than a name the server sent (querySelector with '[autofocus], input, textarea', ':scope > .v-node', '#app > [data-tag=surface]'), or (c) holds a policy constant (a duration, a distance, a threshold, a key chord). All three are AST-detectable given a TS statement/expression query; none is detectable today. The Vue/Ts/Parser and Vue/Expr/Parser already exist, so the parsing is there — what is missing is a Codebase selector that opens a Query over their nodes, the frontend twin of the backend whereMethodDeclaration/whereIf/whereCall selectors. I have written the skill and sin (.commandments/custom/ClientDecidesSkill.php, ClientDecides.php) and had to leave the detector unwritten.

Filed via commandments feature-request from a consumer project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions