@astryxdesign/cli 0.7.16-canary.gfef050d → 0.7.16

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.
@@ -0,0 +1 @@
1
+ {"threshold":1.5,"weights":{"b:above_an":-0.5,"b:above_existing":-0.5,"b:action_and":-1.0,"b:action_with":-1.0,"b:actions_and":-1.0,"b:add_button":1.0,"b:all_and":-1.0,"b:an_add":0.5,"b:an_empty":-1.0,"b:an_existing":-1.5,"b:an_external":-1.0,"b:an_open":-1.0,"b:an_optional":-0.5,"b:analytics_dashboard":-0.5,"b:and_accessible":-1.5,"b:and_action":-1.0,"b:and_after":0.5,"b:and_before":-0.5,"b:and_cancel":-0.5,"b:and_collapsed":-1.0,"b:and_collapsible":0.5,"b:and_compact":1.5,"b:and_confirmation":-0.5,"b:and_current":-0.5,"b:and_dark":-1.0,"b:and_data":0.5,"b:and_date":-0.5,"b:and_dense":0.5,"b:and_detail":1.5,"b:and_empty":-0.5,"b:and_evidence":0.5,"b:and_explicit":1.0,"b:and_inline":1.0,"b:and_links":0.5,"b:and_live":1.0,"b:and_metadata":1.0,"b:and_next":1.0,"b:and_no":-1.0,"b:and_one":0.5,"b:and_open":0.5,"b:and_optional":1.0,"b:and_percentage":-0.5,"b:and_refresh":-1.0,"b:and_saved":-0.5,"b:and_selected":1.0,"b:and_separate":1.0,"b:and_show":1.5,"b:and_source":-0.5,"b:and_status":0.5,"b:and_table":-0.5,"b:and_three":-1.0,"b:and_time":-0.5,"b:and_two":1.0,"b:and_unavailable":-1.5,"b:app_name":-0.5,"b:app_shell":0.5,"b:app_with":0.5,"b:banner_for":-0.5,"b:banner_with":-0.5,"b:bar_and":-1.0,"b:bar_chart":-0.5,"b:bar_with":0.5,"b:bars_and":0.5,"b:before_after":1.0,"b:before_and":0.5,"b:below_the":-0.5,"b:beside_an":-0.5,"b:button_and":1.0,"b:button_in":-0.5,"b:button_opening":-0.5,"b:button_with":-0.5,"b:buttons_and":0.5,"b:calendar_with":1.5,"b:card_with":-1.5,"b:cards_and":1.5,"b:cell_with":-0.5,"b:chart_and":1.0,"b:chart_legend":-0.5,"b:chart_with":-1.5,"b:charts_with":-1.5,"b:columns_and":-0.5,"b:compact_chart":-0.5,"b:compact_inline":-0.5,"b:compact_model":-0.5,"b:compact_read":-0.5,"b:compact_status":-0.5,"b:compact_table":-1.0,"b:comparison_table":0.5,"b:comparison_with":1.0,"b:confirmation_dialog":-0.5,"b:controls_for":-0.5,"b:controls_with":-1.5,"b:copy_link":-1.0,"b:counts_and":1.0,"b:coverage_and":-0.5,"b:coverage_table":-0.5,"b:dashboard_with":0.5,"b:data_dashboard":-0.5,"b:data_source":0.5,"b:data_table":-0.5,"b:date_and":-0.5,"b:dense_data":1.0,"b:dense_read":0.5,"b:dense_table":-1.0,"b:description_and":0.5,"b:detail_dialog":1.0,"b:detail_page":-0.5,"b:detail_panel":0.5,"b:detail_with":1.0,"b:details_and":-0.5,"b:details_dialog":-0.5,"b:details_panel":0.5,"b:details_with":-0.5,"b:dialog_and":-0.5,"b:dialog_with":-2.5,"b:each_with":-1.5,"b:empty_and":0.5,"b:empty_state":-0.5,"b:empty_states":-0.5,"b:error_and":0.5,"b:error_banner":0.5,"b:error_states":-0.5,"b:evidence_and":1.0,"b:evidence_table":1.0,"b:existing_analytics":-0.5,"b:existing_app":3.0,"b:existing_dashboard":-0.5,"b:existing_dense":-2.0,"b:existing_metric":-0.5,"b:existing_metrics":-0.5,"b:existing_overview":-0.5,"b:existing_page":-1.0,"b:existing_review":-0.5,"b:existing_run":-0.5,"b:existing_sidebar":-0.5,"b:existing_test":-0.5,"b:external_link":-0.5,"b:external_links":-0.5,"b:fields_and":-0.5,"b:filter_for":-0.5,"b:filters_and":0.5,"b:filters_with":-0.5,"b:for_an":1.0,"b:for_the":1.0,"b:form_and":0.5,"b:form_dialog":-0.5,"b:form_to":0.5,"b:form_with":1.0,"b:full_width":0.5,"b:graph_with":-0.5,"b:grid_of":1.0,"b:grid_with":1.0,"b:header_and":-2.0,"b:header_with":-0.5,"b:heading_and":-0.5,"b:headings_and":-0.5,"b:health_dashboard":-0.5,"b:history_table":0.5,"b:history_with":0.5,"b:hover_card":-0.5,"b:in_an":-0.5,"b:inside_existing":-0.5,"b:inside_the":2.0,"b:inspector_with":-1.0,"b:keep_existing":-0.5,"b:keep_the":-2.0,"b:keyboard_accessible":-0.5,"b:label_and":-1.0,"b:labels_and":-0.5,"b:landing_page":-0.5,"b:last_updated":0.5,"b:left_and":1.0,"b:light_and":-0.5,"b:line_chart":1.5,"b:link_button":-0.5,"b:link_to":1.0,"b:links_and":-0.5,"b:links_in":-1.0,"b:links_to":1.5,"b:list_and":-1.0,"b:list_with":1.0,"b:loading_empty":1.0,"b:loading_error":0.5,"b:menu_with":-1.0,"b:metadata_and":0.5,"b:metadata_rows":-0.5,"b:metadata_with":-1.0,"b:metric_card":-0.5,"b:metric_cards":-1.0,"b:metrics_and":-1.0,"b:metrics_table":-1.0,"b:metrics_with":0.5,"b:modal_with":-0.5,"b:name_and":-0.5,"b:names_and":-0.5,"b:navigation_and":0.5,"b:navigation_with":-0.5,"b:next_action":0.5,"b:next_to":-0.5,"b:notice_with":-0.5,"b:of_an":-0.5,"b:of_the":0.5,"b:on_an":-0.5,"b:on_hover":-0.5,"b:on_mobile":-0.5,"b:on_the":0.5,"b:one_compact":-0.5,"b:one_primary":-0.5,"b:overview_and":-1.0,"b:overview_with":2.0,"b:page_and":-0.5,"b:page_for":1.0,"b:page_frame":-1.0,"b:page_header":-1.0,"b:page_with":1.0,"b:panel_with":-2.5,"b:per_row":0.5,"b:picker_with":-0.5,"b:popover_with":-1.0,"b:preserve_the":-0.5,"b:primary_action":0.5,"b:report_with":1.0,"b:results_table":-0.5,"b:results_with":-0.5,"b:retry_button":-0.5,"b:review_page":0.5,"b:review_queue":0.5,"b:review_table":-0.5,"b:review_with":0.5,"b:right_side":-0.5,"b:row_and":-0.5,"b:row_with":-0.5,"b:rows_and":0.5,"b:rows_in":-0.5,"b:rows_with":-0.5,"b:run_history":0.5,"b:save_and":-0.5,"b:search_and":-0.5,"b:search_with":1.5,"b:searchable_multi":-1.0,"b:section_with":-1.0,"b:sections_with":-1.5,"b:segmented_control":-0.5,"b:selector_for":-0.5,"b:selector_in":-0.5,"b:selector_to":-1.0,"b:selectors_and":-0.5,"b:series_chart":-1.0,"b:shell_and":1.5,"b:shell_with":-0.5,"b:side_navigation":-1.0,"b:sidebar_and":1.5,"b:sidebar_with":-1.5,"b:single_page":1.5,"b:source_and":0.5,"b:source_details":-0.5,"b:source_links":1.0,"b:state_for":-0.5,"b:status_in":-0.5,"b:status_rows":1.0,"b:summary_and":1.0,"b:summary_card":-0.5,"b:summary_table":-0.5,"b:summary_with":-1.0,"b:switch_and":0.5,"b:tab_with":0.5,"b:table_and":0.5,"b:table_cell":-0.5,"b:table_column":-1.0,"b:table_of":0.5,"b:table_row":-1.0,"b:table_rows":-0.5,"b:table_to":-0.5,"b:table_with":0.5,"b:tables_and":1.0,"b:tables_with":0.5,"b:tags_and":-0.5,"b:text_and":-0.5,"b:text_input":2.5,"b:that_opens":-0.5,"b:the_app":1.0,"b:the_current":-1.5,"b:the_existing":-1.0,"b:the_left":0.5,"b:the_page":-1.0,"b:the_right":0.5,"b:the_selected":0.5,"b:time_and":-1.0,"b:time_range":0.5,"b:time_series":0.5,"b:timeline_with":-0.5,"b:timestamp_and":-0.5,"b:title_and":-0.5,"b:to_show":-1.0,"b:to_the":-1.0,"b:toggle_to":-0.5,"b:tokens_and":-0.5,"b:tool_with":0.5,"b:toolbar_and":1.0,"b:toolbar_with":-1.0,"b:trend_and":0.5,"b:two_column":-0.5,"b:two_compact":-1.0,"b:unavailable_states":-1.0,"b:update_the":-0.5,"b:using_the":1.0,"b:warning_and":-0.5,"b:while_preserving":-0.5,"b:with_clickable":0.5,"b:with_colored":-0.5,"b:with_compact":-0.5,"b:with_copy":-1.0,"b:with_counts":-0.5,"b:with_current":0.5,"b:with_editable":0.5,"b:with_exact":-0.5,"b:with_expandable":-1.0,"b:with_explicit":-0.5,"b:with_filters":0.5,"b:with_four":-0.5,"b:with_grouped":0.5,"b:with_hover":1.0,"b:with_independent":-0.5,"b:with_inline":1.5,"b:with_one":0.5,"b:with_per":0.5,"b:with_progress":-1.0,"b:with_read":-0.5,"b:with_request":1.0,"b:with_search":-0.5,"b:with_separate":-0.5,"b:with_shared":0.5,"b:with_tabs":0.5,"b:with_the":-0.5,"b:with_title":-1.0,"b:without_changing":-0.5,"b:workflow_with":1.5,"b:workspace_with":1.5,"base":-0.5,"commas:0":-0.5,"commas:3":1.0,"commas:4":1.0,"h:3":-0.5,"k:edit":-1.0,"k:page":0.5,"k:part":-0.5,"len:0":-1.0,"len:1":-1.0,"len:2":-0.5,"len:4":0.5,"len:5":0.5,"len:6":1.5,"s:0":-0.5,"s:4":0.5,"s:5":0.5,"u:above":-0.5,"u:accepted":-0.5,"u:access":1.0,"u:accessible":-1.0,"u:account":0.5,"u:actions":-0.5,"u:add":-1.5,"u:admin":1.0,"u:after":-0.5,"u:agent":0.5,"u:ai":0.5,"u:alert":1.0,"u:all":-0.5,"u:analytics":0.5,"u:animated":0.5,"u:answer":0.5,"u:application":0.5,"u:apply":-0.5,"u:architecture":1.0,"u:area":-0.5,"u:areas":1.0,"u:artifact":-0.5,"u:artifacts":-0.5,"u:as":-0.5,"u:assistant":-0.5,"u:at":0.5,"u:attachment":-1.0,"u:badge":-1.0,"u:banner":-0.5,"u:bar":-0.5,"u:below":-1.0,"u:benchmark":1.0,"u:between":-0.5,"u:blocked":-0.5,"u:blocking":-0.5,"u:blocks":0.5,"u:board":1.5,"u:body":0.5,"u:bounded":-1.0,"u:brief":0.5,"u:browser":1.0,"u:bug":-1.0,"u:bulk":-0.5,"u:button":-0.5,"u:buttons":-0.5,"u:by":0.5,"u:calendar":1.0,"u:cancel":-0.5,"u:candidate":0.5,"u:candidates":-0.5,"u:capture":0.5,"u:card":-0.5,"u:catalog":0.5,"u:category":0.5,"u:cells":0.5,"u:center":0.5,"u:change":-0.5,"u:changes":-0.5,"u:changing":-0.5,"u:chart":-1.0,"u:charts":0.5,"u:check":0.5,"u:checkboxes":-1.0,"u:chips":-1.0,"u:choose":-1.0,"u:clear":-1.0,"u:close":-0.5,"u:closed":-1.5,"u:cohort":0.5,"u:collapse":-0.5,"u:collapsed":-1.5,"u:collapsible":-0.5,"u:color":-0.5,"u:colors":-0.5,"u:columns":0.5,"u:comment":-0.5,"u:comments":-1.5,"u:compact":-0.5,"u:compare":2.0,"u:completed":-1.0,"u:completion":-0.5,"u:component":1.0,"u:concise":-0.5,"u:config":1.0,"u:configuration":-0.5,"u:confirm":-1.0,"u:confirmed":-1.0,"u:console":1.0,"u:containing":0.5,"u:content":-1.0,"u:contextual":-1.0,"u:conversation":-0.5,"u:copy":-0.5,"u:count":-0.5,"u:counts":-1.0,"u:create":0.5,"u:custom":-0.5,"u:daily":0.5,"u:dark":0.5,"u:dashboard":0.5,"u:data":-0.5,"u:dataset":0.5,"u:day":-0.5,"u:days":-0.5,"u:decision":0.5,"u:decisions":1.5,"u:default":-2.0,"u:definition":-0.5,"u:definitions":0.5,"u:delete":-0.5,"u:delta":-1.5,"u:demand":-0.5,"u:dense":0.5,"u:dependency":-1.0,"u:description":-0.5,"u:descriptions":-1.0,"u:destination":-1.5,"u:detailed":-0.5,"u:details":0.5,"u:diagnostic":0.5,"u:diagnostics":0.5,"u:dialog":-1.0,"u:directory":2.5,"u:disabled":-0.5,"u:disclosure":-0.5,"u:display":-0.5,"u:distinct":-0.5,"u:document":1.5,"u:documentation":0.5,"u:dot":-0.5,"u:dots":0.5,"u:drafts":-0.5,"u:drawer":-1.0,"u:drill":0.5,"u:drop":-0.5,"u:dropdown":-0.5,"u:duration":-0.5,"u:each":1.0,"u:editable":1.0,"u:editor":-0.5,"u:edits":-1.0,"u:embedded":-1.0,"u:end":-0.5,"u:entity":0.5,"u:error":-0.5,"u:event":0.5,"u:events":0.5,"u:evidence":-0.5,"u:existing":-2.5,"u:expand":-1.0,"u:expandable":-0.5,"u:expanded":-1.5,"u:experiment":-0.5,"u:explain":-1.0,"u:explaining":-0.5,"u:explicit":-1.0,"u:failed":-0.5,"u:failure":-0.5,"u:fallback":-1.0,"u:feature":1.0,"u:feed":0.5,"u:feedback":-0.5,"u:fields":-0.5,"u:file":0.5,"u:filterable":1.5,"u:filtered":-1.0,"u:filters":0.5,"u:findings":0.5,"u:first":0.5,"u:flow":-0.5,"u:follow":0.5,"u:footer":-1.5,"u:for":-1.0,"u:form":1.0,"u:four":1.0,"u:from":-0.5,"u:gallery":0.5,"u:gap":-0.5,"u:gate":1.0,"u:generate":0.5,"u:generated":-0.5,"u:global":0.5,"u:graph":0.5,"u:grid":1.0,"u:group":0.5,"u:grouped":0.5,"u:guide":2.0,"u:header":-0.5,"u:headers":-0.5,"u:heading":-0.5,"u:headings":0.5,"u:headline":0.5,"u:health":0.5,"u:hierarchy":-0.5,"u:highlight":-0.5,"u:highlighted":0.5,"u:home":0.5,"u:horizontal":0.5,"u:host":-0.5,"u:hours":0.5,"u:hover":-1.0,"u:icon":-1.5,"u:icons":-0.5,"u:id":-0.5,"u:in":-1.0,"u:inbox":1.0,"u:independently":0.5,"u:indicator":-0.5,"u:info":-1.0,"u:information":-0.5,"u:informational":-1.0,"u:inline":-1.5,"u:inside":-1.0,"u:inspector":1.5,"u:intake":1.5,"u:interactive":1.0,"u:into":-1.0,"u:inventory":1.5,"u:item":-0.5,"u:items":-1.5,"u:its":0.5,"u:job":0.5,"u:jobs":-0.5,"u:json":0.5,"u:keep":-1.0,"u:keeping":-0.5,"u:label":-1.0,"u:labeled":-0.5,"u:labeling":1.0,"u:labels":-1.0,"u:landing":1.0,"u:legend":-0.5,"u:level":-1.0,"u:library":0.5,"u:lifecycle":0.5,"u:light":-0.5,"u:line":-0.5,"u:lines":-0.5,"u:linked":-1.0,"u:links":-0.5,"u:list":1.0,"u:listing":1.0,"u:lists":0.5,"u:load":-0.5,"u:loading":-1.0,"u:log":2.0,"u:long":-0.5,"u:lookup":1.0,"u:manager":0.5,"u:match":-1.0,"u:matching":1.0,"u:matrix":1.5,"u:measured":0.5,"u:measurement":0.5,"u:message":-0.5,"u:messages":-1.5,"u:metadata":-0.5,"u:metric":0.5,"u:minimal":-0.5,"u:mobile":1.0,"u:modal":-1.0,"u:mode":-0.5,"u:model":-0.5,"u:monitoring":-0.5,"u:more":0.5,"u:multi":0.5,"u:multiple":-0.5,"u:my":1.0,"u:name":-0.5,"u:names":-0.5,"u:nav":-0.5,"u:navigation":-0.5,"u:neutral":-1.0,"u:new":-0.5,"u:node":-0.5,"u:not":-1.0,"u:note":1.0,"u:numbered":-0.5,"u:numbers":-1.5,"u:observed":-1.0,"u:of":0.5,"u:on":-1.0,"u:only":0.5,"u:open":-0.5,"u:opening":-0.5,"u:opens":-0.5,"u:operations":0.5,"u:option":0.5,"u:optional":-1.0,"u:options":-1.5,"u:outcome":-1.0,"u:output":-0.5,"u:over":-1.0,"u:overlay":-1.0,"u:owner":0.5,"u:page":1.0,"u:pages":0.5,"u:paginated":0.5,"u:pagination":-0.5,"u:pane":1.0,"u:panel":-0.5,"u:panels":1.0,"u:percentage":-0.5,"u:performance":0.5,"u:person":-0.5,"u:pill":-1.5,"u:pills":-0.5,"u:pinned":0.5,"u:pipeline":-1.0,"u:placeholder":-2.0,"u:plus":0.5,"u:popover":-0.5,"u:post":0.5,"u:presentation":1.5,"u:preserve":-1.5,"u:preserving":-2.5,"u:preview":0.5,"u:previews":0.5,"u:primary":0.5,"u:priority":1.5,"u:production":0.5,"u:progress":0.5,"u:project":0.5,"u:projects":1.0,"u:prominent":0.5,"u:prompt":1.0,"u:public":1.0,"u:publication":0.5,"u:publish":1.0,"u:published":1.5,"u:quality":-0.5,"u:query":-0.5,"u:question":1.5,"u:queue":1.0,"u:quick":0.5,"u:quiet":1.0,"u:rail":-2.0,"u:range":-1.0,"u:ranked":0.5,"u:rate":0.5,"u:read":0.5,"u:readiness":-0.5,"u:reading":0.5,"u:reason":-0.5,"u:reasoning":-0.5,"u:recording":0.5,"u:reference":0.5,"u:region":-1.0,"u:release":0.5,"u:rename":-0.5,"u:report":1.0,"u:reporting":-0.5,"u:reports":0.5,"u:request":0.5,"u:requirement":-0.5,"u:resizable":-0.5,"u:response":-1.0,"u:responsive":-0.5,"u:result":-0.5,"u:results":0.5,"u:retain":-1.0,"u:retry":-1.0,"u:review":0.5,"u:reviewed":0.5,"u:rollout":-0.5,"u:routing":1.0,"u:rows":0.5,"u:rule":-0.5,"u:running":-1.5,"u:runs":0.5,"u:save":-1.5,"u:saved":0.5,"u:scoped":0.5,"u:score":0.5,"u:scorecard":0.5,"u:scroll":-1.5,"u:scrollable":0.5,"u:scrolling":-0.5,"u:search":0.5,"u:section":-1.0,"u:sections":1.0,"u:segment":-1.0,"u:select":-1.0,"u:selectable":-0.5,"u:selecting":-0.5,"u:selection":0.5,"u:semantic":-0.5,"u:send":-0.5,"u:separate":-1.0,"u:separated":-1.0,"u:series":-0.5,"u:server":0.5,"u:service":0.5,"u:sessions":0.5,"u:setup":0.5,"u:share":-1.0,"u:shared":-0.5,"u:shell":0.5,"u:short":0.5,"u:show":-0.5,"u:shows":1.0,"u:side":0.5,"u:sidebar":-0.5,"u:single":0.5,"u:six":1.0,"u:small":-0.5,"u:snapshot":-1.0,"u:sortable":0.5,"u:sources":-1.0,"u:spacing":-1.0,"u:stacked":-1.0,"u:stage":0.5,"u:stale":-1.0,"u:step":-0.5,"u:stepper":1.0,"u:steps":0.5,"u:sticky":0.5,"u:strip":-1.0,"u:style":1.0,"u:submission":0.5,"u:submit":1.0,"u:suggestions":-1.0,"u:summaries":0.5,"u:surface":-0.5,"u:svg":0.5,"u:system":1.5,"u:tab":-0.5,"u:table":0.5,"u:tables":0.5,"u:tabs":0.5,"u:tag":-1.0,"u:tags":-0.5,"u:target":-0.5,"u:team":1.0,"u:technical":-0.5,"u:text":-0.5,"u:that":-0.5,"u:the":-1.0,"u:theme":0.5,"u:then":2.0,"u:tiles":1.0,"u:timestamp":-1.5,"u:timing":0.5,"u:to":-0.5,"u:toggles":1.0,"u:token":-0.5,"u:tokens":-0.5,"u:tool":1.0,"u:toolbar":-0.5,"u:tools":0.5,"u:top":-1.0,"u:totals":-0.5,"u:trace":-0.5,"u:tracker":0.5,"u:tracking":1.0,"u:transcript":-0.5,"u:tree":1.0,"u:trends":2.0,"u:triage":0.5,"u:turn":-0.5,"u:type":-0.5,"u:typed":-0.5,"u:types":-1.5,"u:unavailable":-1.5,"u:up":-0.5,"u:updated":0.5,"u:upload":1.0,"u:url":0.5,"u:usage":-1.0,"u:use":-0.5,"u:using":0.5,"u:validation":-1.0,"u:value":-0.5,"u:values":-1.0,"u:version":-1.0,"u:versus":-0.5,"u:vertical":-0.5,"u:vertically":-0.5,"u:view":0.5,"u:viewer":1.0,"u:visible":-0.5,"u:visual":1.0,"u:visualization":-0.5,"u:volume":0.5,"u:warning":-1.0,"u:warnings":0.5,"u:weekly":1.5,"u:when":-2.0,"u:where":1.0,"u:while":-2.0,"u:widget":-1.0,"u:widgets":-1.5,"u:windows":1.0,"u:with":0.5,"u:without":-1.5,"u:wizard":-0.5,"u:work":0.5,"u:workflow":0.5,"u:workspace":1.0,"u:wrapped":-0.5,"u:wrapping":-0.5}}
@@ -0,0 +1,26 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Whether an idea carries an edit phrase. It needs no word table.
6
+ * @param {string} idea
7
+ * @returns {boolean}
8
+ */
9
+ export function hasEditPhrase(idea: string): boolean;
10
+ /**
11
+ * The ranker's best page template that is not a shell, or undefined.
12
+ * @param {import('./rank.mjs').RankedPage[]} ranked
13
+ */
14
+ export function bestPage(ranked: import("./rank.mjs").RankedPage[]): import("./words.mjs").RankedPage | undefined;
15
+ /**
16
+ * The text score without its threshold, and whether the edit rule fires.
17
+ * Null without the table or a page to weigh.
18
+ * @param {string} idea
19
+ * @param {import('./rank.mjs').IdeaKind} kind
20
+ * @param {import('./rank.mjs').RankedPage[]} ranked
21
+ * @returns {{edit: boolean, score: number} | null}
22
+ */
23
+ export function shellCallScore(idea: string, kind: import("./rank.mjs").IdeaKind, ranked: import("./rank.mjs").RankedPage[]): {
24
+ edit: boolean;
25
+ score: number;
26
+ } | null;
@@ -0,0 +1,87 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Whether an idea that build would start on the app shell still asks
5
+ * for a whole page.
6
+ *
7
+ * @input The idea, its kind (`ideaKind`), and the page ranker's output.
8
+ * @output True when the idea reads as a new page, so build starts from the
9
+ * closest page template instead of the empty shell.
10
+ * @position Beside start.mjs (api/build/kit/). It runs only on a shell start,
11
+ * after the placement rules. An idea with an edit phrase keeps the shell.
12
+ *
13
+ * The call is a linear score over fixed weights
14
+ * (`shell.weights.json`): the idea's words and word pairs, its kind, its
15
+ * length, and how strongly the ranker's best page template matched.
16
+ */
17
+
18
+ import {loadShellWeights} from '../_adapter.mjs';
19
+ import {SHELL_FAMILY} from './words.mjs';
20
+
21
+ /**
22
+ * Words that mark a change to a page or app the builder already has.
23
+ */
24
+ const EDIT =
25
+ /\b(existing|current|my (page|app|dashboard|screen|site)|add (a |an |the )?\w* ?to|change|fix|move|rename|restyle|update|modify|replace|remove|tweak|adjust|improve|refactor|our (page|app))\b/;
26
+
27
+ /**
28
+ * Whether an idea carries an edit phrase. It needs no word table.
29
+ * @param {string} idea
30
+ * @returns {boolean}
31
+ */
32
+ export function hasEditPhrase(idea) {
33
+ return EDIT.test(String(idea).toLowerCase());
34
+ }
35
+
36
+ /**
37
+ * The features the weights are keyed by.
38
+ * @param {string} text the idea, lower case
39
+ * @param {string} kind
40
+ * @param {import('./rank.mjs').RankedPage | undefined} best the ranker's best
41
+ * page template that is not a shell
42
+ * @returns {Set<string>}
43
+ */
44
+ function featuresOf(text, kind, best) {
45
+ const words = text.match(/[a-z]+/g) ?? [];
46
+ const features = new Set(['bias', `k:${kind}`]);
47
+ words.forEach((word, i) => {
48
+ features.add(`u:${word}`);
49
+ if (i > 0) features.add(`b:${words[i - 1]}_${word}`);
50
+ });
51
+ if (best) {
52
+ features.add(`s:${Math.min(Math.floor(best.score / 5), 6)}`);
53
+ features.add(`h:${Math.min(best.hits, 4)}`);
54
+ if (best.familyNamed) features.add('fam');
55
+ if (best.base) features.add('base');
56
+ }
57
+ features.add(`len:${Math.min(Math.floor(words.length / 5), 6)}`);
58
+ features.add(`commas:${Math.min((text.match(/,/g) ?? []).length, 4)}`);
59
+ return features;
60
+ }
61
+
62
+ /**
63
+ * The ranker's best page template that is not a shell, or undefined.
64
+ * @param {import('./rank.mjs').RankedPage[]} ranked
65
+ */
66
+ export function bestPage(ranked) {
67
+ return ranked.find(r => r.family !== SHELL_FAMILY && r.score > 0);
68
+ }
69
+
70
+ /**
71
+ * The text score without its threshold, and whether the edit rule fires.
72
+ * Null without the table or a page to weigh.
73
+ * @param {string} idea
74
+ * @param {import('./rank.mjs').IdeaKind} kind
75
+ * @param {import('./rank.mjs').RankedPage[]} ranked
76
+ * @returns {{edit: boolean, score: number} | null}
77
+ */
78
+ export function shellCallScore(idea, kind, ranked) {
79
+ const weights = loadShellWeights();
80
+ if (!weights) return null;
81
+ const text = String(idea).toLowerCase();
82
+ const best = bestPage(ranked);
83
+ let score = 0;
84
+ for (const feature of featuresOf(text, kind, best))
85
+ score += weights.weights[feature] ?? 0;
86
+ return {edit: EDIT.test(text), score};
87
+ }
@@ -8,7 +8,8 @@
8
8
  import {loadWeights} from '../_adapter.mjs';
9
9
  import {asksForNewPage} from './kind.mjs';
10
10
  import {pickAlternatives, pickStart} from './rank.mjs';
11
- import {blendOrder, weighStart} from './weights.mjs';
11
+ import {hasEditPhrase, shellCallScore} from './shellcall.mjs';
12
+ import {blendOrder, blendSummary, weighStart} from './weights.mjs';
12
13
 
13
14
  /**
14
15
  * @typedef {import('../../search/search.type.mjs').SearchResultEntry} SearchResultEntry
@@ -57,6 +58,60 @@ function placement(kind, inPage) {
57
58
  return null;
58
59
  }
59
60
 
61
+ /**
62
+ * Fixed coefficients of a logistic decision over build's own numbers: bias,
63
+ * whole page, edit, blend margin over the shell, the shell's blend score, the
64
+ * gap to the blend's second template, the idea's comma count, the text score
65
+ * (shellcall.mjs) and its edit-word flag. Fixed constants; nothing is trained
66
+ * at run time. An edit phrase keeps the shell before the decision runs, so the
67
+ * two edit inputs are 0 whenever it runs; they stay because the constants were
68
+ * fit with them.
69
+ */
70
+ const LIFT = [
71
+ -0.7707, 0.6706, -0.2642, 0.2815, -0.1621, 0.1759, 0.1713, 0.2891, -0.3491,
72
+ ];
73
+
74
+ /** The decision replaces the shell with a page when p >= 0.30. */
75
+ const LIFT_AT = 0.3;
76
+
77
+ /**
78
+ * The page template that replaces an app-shell start, or null to keep the
79
+ * shell. The blend's best template takes the start when the decision's
80
+ * whole-page probability is at least 0.30.
81
+ * @param {import('./rank.mjs').RankedPage[]} ranked
82
+ * @param {import('./rank.mjs').IdeaKind} kind
83
+ * @param {PageTemplate[]} catalog
84
+ * @param {string} idea
85
+ * @returns {PageTemplate | null}
86
+ */
87
+ function liftFromShell(ranked, kind, catalog, idea) {
88
+ const b = blendSummary(
89
+ idea,
90
+ ranked,
91
+ pickStart(ranked, 'page'),
92
+ catalog,
93
+ loadWeights(),
94
+ );
95
+ if (!b || !b.best) return null;
96
+ // A change to a page or app the builder already has keeps its shell.
97
+ if (hasEditPhrase(idea)) return null;
98
+ const text = shellCallScore(idea, kind, ranked);
99
+ const x = [
100
+ 1,
101
+ kind === 'page' ? 1 : 0,
102
+ kind === 'edit' ? 1 : 0,
103
+ b.bestScore - b.shell,
104
+ b.shell,
105
+ b.bestScore - b.secondScore,
106
+ (String(idea).match(/,/g) ?? []).length,
107
+ text?.score ?? 0,
108
+ text?.edit ? 1 : 0,
109
+ ];
110
+ const logit = x.reduce((s, v, i) => s + v * LIFT[i], 0);
111
+ if (1 / (1 + Math.exp(-logit)) < LIFT_AT) return null;
112
+ return catalog.find(t => t.name === b.best) ?? null;
113
+ }
114
+
60
115
  /**
61
116
  * The template to start from: the ready page the ranker puts first when it
62
117
  * has the evidence to lead, else the first fallback shell the project can
@@ -113,10 +168,18 @@ export function chooseStart(ranked, kind, pages, directMatch, catalog, idea) {
113
168
  ? proposed
114
169
  : null
115
170
  : (ranked.find(r => r.name === weighed) ?? proposed);
116
- const closest = pick && catalog.find(t => t.name === pick.name);
117
- if (pick && closest) {
171
+ // An idea that would start on the app shell starts from the blend's best page
172
+ // when the decision's whole-page probability is at least 0.30. A direct match,
173
+ // ready or not, keeps the start and reason it already has.
174
+ const lifted =
175
+ !direct && (!pick || pick.family === 'Shell')
176
+ ? liftFromShell(ranked, kind, catalog, idea)
177
+ : null;
178
+ const closest = lifted ?? (pick && catalog.find(t => t.name === pick.name));
179
+ if (closest) {
118
180
  const agrees = closest.name === direct;
119
- const place = placement(kind, pick.base && pick.familyNamed);
181
+ const place =
182
+ lifted || !pick ? null : placement(kind, pick.base && pick.familyNamed);
120
183
  return {
121
184
  ...asTemplate(closest),
122
185
  basis: agrees ? 'direct' : 'closest',
@@ -40,6 +40,21 @@ export function weighStart(idea: string, ranked: import("./rank.mjs").RankedPage
40
40
  weights?: WeightsFile | null;
41
41
  newPage?: boolean;
42
42
  }): string | null | undefined;
43
+ /**
44
+ * The blend's scores: the app shell's, and the best non-shell template with
45
+ * its score and the runner-up's. Null without weights.
46
+ * @param {string} idea
47
+ * @param {import('./rank.mjs').RankedPage[]} ranked
48
+ * @param {import('./rank.mjs').RankedPage | null} pick
49
+ * @param {DescribedTemplate[]} catalog
50
+ * @param {WeightsFile | null} weights
51
+ */
52
+ export function blendSummary(idea: string, ranked: import("./rank.mjs").RankedPage[], pick: import("./rank.mjs").RankedPage | null, catalog: DescribedTemplate[], weights: WeightsFile | null): {
53
+ shell: number;
54
+ best: string;
55
+ bestScore: number;
56
+ secondScore: number;
57
+ } | null;
43
58
  /** The app shell, as one candidate. */
44
59
  export const SHELL: "SHELL";
45
60
  export type WeightTable = {
@@ -418,3 +418,30 @@ export function weighStart(
418
418
  if (newPage && kept) return kept;
419
419
  return null;
420
420
  }
421
+
422
+ /**
423
+ * The blend's scores: the app shell's, and the best non-shell template with
424
+ * its score and the runner-up's. Null without weights.
425
+ * @param {string} idea
426
+ * @param {import('./rank.mjs').RankedPage[]} ranked
427
+ * @param {import('./rank.mjs').RankedPage | null} pick
428
+ * @param {DescribedTemplate[]} catalog
429
+ * @param {WeightsFile | null} weights
430
+ */
431
+ export function blendSummary(idea, ranked, pick, catalog, weights) {
432
+ if (!weights) return null;
433
+ const {cands, scores} = blend(idea, ranked, pick, catalog, weights);
434
+ let shell = 0;
435
+ const rest = [];
436
+ for (let i = 0; i < cands.length; i++) {
437
+ if (cands[i] === SHELL) shell = scores[i];
438
+ else rest.push({name: cands[i], score: scores[i], i});
439
+ }
440
+ rest.sort((x, y) => y.score - x.score || x.i - y.i);
441
+ return {
442
+ shell,
443
+ best: rest[0]?.name ?? null,
444
+ bestScore: rest[0]?.score ?? 0,
445
+ secondScore: rest[1]?.score ?? 0,
446
+ };
447
+ }