mustflow 2.22.17 → 2.22.47

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.
Files changed (70) hide show
  1. package/README.md +6 -0
  2. package/dist/cli/commands/api.js +874 -0
  3. package/dist/cli/commands/dashboard.js +51 -4
  4. package/dist/cli/commands/explain.js +3 -2
  5. package/dist/cli/commands/help.js +0 -1
  6. package/dist/cli/commands/run.js +41 -4
  7. package/dist/cli/commands/verify.js +4 -43
  8. package/dist/cli/i18n/en.js +15 -0
  9. package/dist/cli/i18n/es.js +15 -0
  10. package/dist/cli/i18n/fr.js +15 -0
  11. package/dist/cli/i18n/hi.js +15 -0
  12. package/dist/cli/i18n/ko.js +15 -0
  13. package/dist/cli/i18n/zh.js +15 -0
  14. package/dist/cli/index.js +1 -0
  15. package/dist/cli/lib/cli-output.js +1 -1
  16. package/dist/cli/lib/command-registry.js +6 -0
  17. package/dist/cli/lib/dashboard-html/client-script.js +9 -0
  18. package/dist/cli/lib/dashboard-html/styles.js +48 -1
  19. package/dist/cli/lib/doc-review-ledger.js +1 -1
  20. package/dist/cli/lib/local-index/index.js +324 -298
  21. package/dist/cli/lib/repo-map.js +19 -5
  22. package/dist/cli/lib/validation/index.js +6 -2
  23. package/dist/core/active-run-locks.js +36 -8
  24. package/dist/core/atomic-state-write.js +5 -20
  25. package/dist/core/change-verification.js +18 -2
  26. package/dist/core/contract-lint.js +3 -3
  27. package/dist/core/public-json-contracts.js +48 -0
  28. package/dist/core/repeated-failure.js +1 -1
  29. package/dist/core/run-write-drift.js +30 -17
  30. package/dist/core/safe-filesystem.js +54 -5
  31. package/dist/core/skill-route-explanation.js +2 -1
  32. package/dist/core/source-anchors.js +7 -3
  33. package/dist/core/validation-ratchet.js +61 -18
  34. package/dist/core/verification-decision-graph.js +8 -1
  35. package/dist/core/verification-plan-id.js +44 -0
  36. package/package.json +1 -1
  37. package/schemas/README.md +6 -0
  38. package/schemas/command-catalog.schema.json +158 -0
  39. package/schemas/diff-risk.schema.json +74 -0
  40. package/schemas/health.schema.json +45 -0
  41. package/schemas/latest-evidence.schema.json +95 -0
  42. package/schemas/verification-plan.schema.json +245 -0
  43. package/schemas/workspace-summary.schema.json +282 -0
  44. package/templates/default/i18n.toml +139 -1
  45. package/templates/default/locales/en/.mustflow/skills/INDEX.md +24 -1
  46. package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +212 -0
  47. package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +184 -0
  48. package/templates/default/locales/en/.mustflow/skills/auth-permission-change/SKILL.md +194 -0
  49. package/templates/default/locales/en/.mustflow/skills/config-env-change/SKILL.md +189 -0
  50. package/templates/default/locales/en/.mustflow/skills/css-code-change/SKILL.md +199 -0
  51. package/templates/default/locales/en/.mustflow/skills/dart-code-change/SKILL.md +179 -0
  52. package/templates/default/locales/en/.mustflow/skills/database-migration-change/SKILL.md +178 -0
  53. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +151 -0
  54. package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +115 -0
  55. package/templates/default/locales/en/.mustflow/skills/file-path-cross-platform-change/SKILL.md +147 -0
  56. package/templates/default/locales/en/.mustflow/skills/flutter-code-change/SKILL.md +116 -0
  57. package/templates/default/locales/en/.mustflow/skills/go-code-change/SKILL.md +156 -0
  58. package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +117 -0
  59. package/templates/default/locales/en/.mustflow/skills/html-code-change/SKILL.md +173 -0
  60. package/templates/default/locales/en/.mustflow/skills/javascript-code-change/SKILL.md +149 -0
  61. package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +154 -0
  62. package/templates/default/locales/en/.mustflow/skills/release-publish-change/SKILL.md +172 -0
  63. package/templates/default/locales/en/.mustflow/skills/routes.toml +138 -0
  64. package/templates/default/locales/en/.mustflow/skills/rust-code-change/SKILL.md +154 -0
  65. package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +186 -0
  66. package/templates/default/locales/en/.mustflow/skills/tailwind-code-change/SKILL.md +164 -0
  67. package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +185 -0
  68. package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +184 -0
  69. package/templates/default/locales/en/.mustflow/skills/unocss-code-change/SKILL.md +186 -0
  70. package/templates/default/manifest.toml +158 -1
@@ -0,0 +1,156 @@
1
+ ---
2
+ mustflow_doc: skill.go-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: go-code-change
9
+ description: Apply this skill when Go source, modules, package APIs, interfaces, errors, goroutines, channels, context propagation, tests, or generated code boundaries are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.go-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # Go Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Go package, module, API, error, context, concurrency, and test boundaries without adding needless abstraction.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.go`, `go.mod`, `go.sum`, `go.work`, build tags, generated code, public package API, tests, benchmarks, goroutines, channels, or context propagation change.
37
+ - The task touches interfaces, error wrapping, package structure, concurrency ownership, or module dependencies.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - The task only reads Go files and makes no edit.
43
+ - A generated file is the only affected file and must be regenerated by a declared project command instead of edited manually.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - `go.mod`, `go.sum`, `go.work`, build tooling, lint config, and CI hints.
49
+ - All files in the changed package, including `_test.go`, build-tagged files, examples, and generated-file markers.
50
+ - The public API surface when exported identifiers, errors, or package paths change.
51
+ - Configured verification intents.
52
+
53
+ <!-- mustflow-section: preconditions -->
54
+ ## Preconditions
55
+
56
+ - Inspect the whole package before adding names or methods.
57
+ - Determine whether the change affects exported API, concurrency ownership, or dependency graph.
58
+ - Identify generated files and avoid direct edits unless explicitly requested.
59
+
60
+ <!-- mustflow-section: allowed-edits -->
61
+ ## Allowed Edits
62
+
63
+ - Keep interfaces small and preferably owned by the consuming side.
64
+ - Return concrete provider types from provider packages unless the package intentionally hides multiple implementations as its public API.
65
+ - Keep domain and use-case packages free of SQL, HTTP transport, queue, cloud SDK, ORM, and vendor persistence types unless those types are the explicit public API.
66
+ - Preserve context propagation across API and goroutine boundaries.
67
+ - Return actionable errors and wrap causes when callers need `errors.Is` or `errors.As`.
68
+ - Add table-driven tests when they clarify behavior.
69
+
70
+ <!-- mustflow-section: procedure -->
71
+ ## Procedure
72
+
73
+ 1. Read module files, package files, tests, build tags, and generated-code markers.
74
+ 2. Classify the change as package API, internal implementation, dependency, error behavior, context flow, concurrency, or test-only.
75
+ 3. Check package boundaries before adding a package or interface:
76
+ - reject shared bucket packages named `common`, `util`, `types`, `interfaces`, `api`, or `models` unless the repository already has a specific local convention with a narrower meaning;
77
+ - put an interface in the package that consumes the methods, not in the package that merely implements them;
78
+ - create an interface only after a real consumer needs that exact method set;
79
+ - shrink an interface to the methods the immediate consumer calls;
80
+ - reject provider-side interfaces that exist only for mocks;
81
+ - reject provider constructors that return interfaces by default; prefer concrete exported types such as `*Client`, `*Store`, or `*Service`;
82
+ - verify that a package split reduces a real dependency direction problem or creates a coherent capability instead of hiding imports.
83
+ 4. If exported identifiers or package paths change, classify the public API impact:
84
+ - treat exported functions, variables, constants, types, methods, struct fields, interfaces, interface method sets, sentinel errors, typed errors, module path, package import path, and minimum Go version as contracts;
85
+ - assume exported symbols in a v1+ module are public API unless the package is internal or local evidence proves otherwise;
86
+ - do not remove, rename, or change exported signatures, exported field types, exported interface methods, or observable error behavior without an explicit breaking-change plan;
87
+ - adding a method to an exported interface is breaking for external implementations even when adding a method to a concrete type would be safe.
88
+ 5. Preserve error contracts:
89
+ - use `errors.Is` and `errors.As` semantics as observable API when documented or already tested;
90
+ - do not compare error strings;
91
+ - do not expose dependency sentinel or typed errors through wrapping unless the package intentionally supports them as API;
92
+ - treat a change between observable wrapping and non-observable formatting as API-sensitive;
93
+ - add tests for documented sentinel or typed errors when the error behavior changes.
94
+ 6. If goroutines or channels change, name the owner, stop condition, cancellation path, wait path, error path, close responsibility, and test synchronization.
95
+ 7. Reject fire-and-forget goroutines unless they are owned by a long-lived object with a shutdown path, joined before return, managed by a group with a wait path, or explicitly documented as safely detached.
96
+ 8. Preserve context propagation:
97
+ - request-scoped functions accept `ctx` first and pass it down;
98
+ - do not store request context in structs;
99
+ - do not pass nil context;
100
+ - do not introduce `context.Background()` inside request or operation depth unless it is a true process root with a documented owner;
101
+ - derived contexts must release their cancel function on every path;
102
+ - blocking sends, receives, waits, retry loops, worker loops, and external calls must observe cancellation or be proven non-blocking.
103
+ 9. Preserve channel ownership:
104
+ - the sender that knows all sends are complete closes the channel;
105
+ - receivers do not close borrowed input channels;
106
+ - multiple senders require a coordinator that closes only after all senders finish;
107
+ - cancellable pipelines must avoid permanently blocking upstream goroutines when downstream stops early.
108
+ 10. Keep timeout policy at request, command, API, or operation boundaries. Do not hide arbitrary sleeps or timeouts in reusable helpers unless that helper explicitly owns the policy.
109
+ 11. Keep concurrency tests deterministic. Do not use elapsed real time to wait for goroutine progress; use explicit synchronization, owned lifecycle waits, fake time, or the repository's established concurrency test helper.
110
+ 12. If dependency metadata changes, keep module files and dependent tests synchronized. Do not raise the `go` directive, add toolchain requirements, change module path, or introduce direct dependencies unless the task requires it and the final report calls out the support impact.
111
+ 13. Choose configured verification intents that cover formatting, tests, race-sensitive behavior, lint, API drift, and module drift when available.
112
+
113
+ <!-- mustflow-section: postconditions -->
114
+ ## Postconditions
115
+
116
+ - Package ownership and exported API impact are clear.
117
+ - Context, goroutine, channel, and error ownership are explicit.
118
+ - Tests cover the changed behavior without sleeps as synchronization.
119
+ - Module drift is reported when dependency verification cannot run.
120
+
121
+ <!-- mustflow-section: verification -->
122
+ ## Verification
123
+
124
+ Use configured oneshot command intents when available:
125
+
126
+ - `lint`
127
+ - `build`
128
+ - `test_related`
129
+ - `test`
130
+ - `docs_validate_fast`
131
+ - `mustflow_check`
132
+
133
+ For concurrency-sensitive changes, report whether a configured race or equivalent verification intent exists.
134
+
135
+ <!-- mustflow-section: failure-handling -->
136
+ ## Failure Handling
137
+
138
+ - If an import cycle appears, revisit package boundaries instead of adding a workaround package.
139
+ - If a new package becomes a shared bucket, move behavior back to the owning package or name the concrete capability.
140
+ - If a provider-side interface appears only for mocking, delete it or move a minimal interface to the consumer.
141
+ - If tests need sleeps for concurrency, prefer deterministic synchronization or report the gap.
142
+ - If a goroutine has no owner, stop condition, wait path, cancellation path, or error path, do not add it.
143
+ - If a public error stops satisfying documented `errors.Is` or `errors.As` checks, restore the contract or report the breaking-change requirement.
144
+ - If wrapping would expose a dependency error as public API, keep the dependency error internal or document the intentional contract.
145
+ - If a generated file must change but no generator intent exists, report the missing command contract.
146
+
147
+ <!-- mustflow-section: output-format -->
148
+ ## Output Format
149
+
150
+ - Boundary checked
151
+ - Package and API impact
152
+ - Context/concurrency/error notes
153
+ - Files changed
154
+ - Command intents run
155
+ - Skipped checks and reasons
156
+ - Remaining Go risk
@@ -0,0 +1,117 @@
1
+ ---
2
+ mustflow_doc: skill.hono-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: hono-code-change
9
+ description: Apply this skill when Hono apps, routes, middleware, validators, RPC clients, bindings, context variables, auth boundaries, or runtime adapters are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.hono-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # Hono Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Hono runtime, middleware, validation, context binding, auth, typed route, and response contract boundaries.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `new Hono`, `app.get`, `app.post`, `app.use`, `c.env`, `c.get`, `c.set`, validators, RPC clients, middleware, adapters, or Hono route tests change.
37
+ - The task touches Cloudflare Workers, Bun, Node, edge-compatible routes, bindings, variables, auth middleware, or response schemas.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - The task only touches framework-agnostic service code behind a Hono handler; use the relevant language or architecture skill.
43
+ - Another HTTP framework is used instead of Hono.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - Package metadata, TypeScript config, runtime adapter config, worker or server entrypoint, routes, middleware, env/binding types, schemas, client types, and tests.
49
+ - Target runtime matrix: Cloudflare, Bun, Node, edge-compatible, or single runtime.
50
+ - Existing response envelope and error contract.
51
+
52
+ <!-- mustflow-section: preconditions -->
53
+ ## Preconditions
54
+
55
+ - Confirm runtime before using platform APIs.
56
+ - Identify `Bindings` for runtime-provided values and `Variables` for request-local middleware values.
57
+ - Identify auth, validation, and error response boundaries before adding routes.
58
+
59
+ <!-- mustflow-section: allowed-edits -->
60
+ ## Allowed Edits
61
+
62
+ - Keep runtime-specific APIs isolated behind adapters or runtime-specific files.
63
+ - Register middleware in an order that preserves logging, CORS, security headers, body limits, auth, validation, and handler behavior.
64
+ - Trust only validated request data in handlers.
65
+ - Keep success and failure envelopes consistent.
66
+
67
+ <!-- mustflow-section: procedure -->
68
+ ## Procedure
69
+
70
+ 1. Read app entrypoint, runtime adapter, route modules, middleware, schemas, client type exports, and tests.
71
+ 2. Map the route boundary: method, path, runtime, auth, params, query, headers, cookies, body, variables, bindings, response statuses, and content types.
72
+ 3. Do not put Node-only, Bun-only, or Cloudflare-only APIs in shared routes.
73
+ 4. Keep auth middleware above protected routes and wildcard or fallback routes after specific routes.
74
+ 5. Separate `Bindings` from `Variables`; do not store request-local state in globals.
75
+ 6. Use validator output rather than rereading unvalidated request bodies.
76
+ 7. Preserve typed route or RPC inference by keeping handler responses in the framework's typed response path.
77
+ 8. Choose configured verification intents that cover type checks, route tests, auth failure, validation failure, and runtime env mocks when available.
78
+
79
+ <!-- mustflow-section: postconditions -->
80
+ ## Postconditions
81
+
82
+ - Runtime-specific APIs are isolated.
83
+ - Middleware order and auth boundary are clear.
84
+ - Request validation and response envelope are preserved.
85
+ - Typed route or RPC contract impact is reported.
86
+
87
+ <!-- mustflow-section: verification -->
88
+ ## Verification
89
+
90
+ Use configured oneshot command intents when available:
91
+
92
+ - `lint`
93
+ - `build`
94
+ - `test_related`
95
+ - `test`
96
+ - `docs_validate_fast`
97
+ - `mustflow_check`
98
+
99
+ Report missing multi-runtime or route-level verification intents when relevant.
100
+
101
+ <!-- mustflow-section: failure-handling -->
102
+ ## Failure Handling
103
+
104
+ - If runtime target is unclear, inspect adapter and deployment config before editing.
105
+ - If a route needs a broader permission, binding, or auth change, switch to the relevant security or contract skill.
106
+ - If typed route inference breaks, repair schema and response shape before adding more routes.
107
+
108
+ <!-- mustflow-section: output-format -->
109
+ ## Output Format
110
+
111
+ - Boundary checked
112
+ - Runtime and middleware notes
113
+ - Validation and response contract notes
114
+ - Files changed
115
+ - Command intents run
116
+ - Skipped checks and reasons
117
+ - Remaining Hono risk
@@ -0,0 +1,173 @@
1
+ ---
2
+ mustflow_doc: skill.html-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: html-code-change
9
+ description: Apply this skill when HTML, templates, JSX or component markup, forms, controls, dialogs, navigation, tables, media, metadata, SEO head content, or structured data are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.html-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # HTML Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve semantic structure, native controls, keyboard access, focus behavior, form labeling, metadata, and browser-valid markup. Treat non-native interactive markup as suspicious by default; HTML already gives browsers, keyboards, forms, password managers, mobile input, and assistive technology a working contract.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.html`, JSX, TSX, Vue, Svelte, Astro, or template markup changes.
37
+ - The task touches layout landmarks, headings, forms, buttons, links, dialogs, menus, tabs, accordions, custom selects, composite widgets, tables, media, metadata, canonical links, Open Graph, robots, hreflang, viewport, or JSON-LD.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - Only CSS changes and markup semantics are unchanged; use `css-code-change`.
43
+ - The markup is generated and should be changed through a source component or template.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - Existing page layout, document shell, head/SEO helpers, metadata builders, canonical URL helpers, sitemap or robots config, form components, interactive control components, and tests.
49
+ - Target framework conventions for rendering, routing, hydration, and metadata.
50
+ - Visible page content, H1 or primary title, main entity, locale, indexing intent, and data sources for title, description, image, author, date, price, rating, availability, and FAQ content when metadata changes.
51
+ - Accessibility and validation tooling declared in the command contract.
52
+
53
+ <!-- mustflow-section: preconditions -->
54
+ ## Preconditions
55
+
56
+ - Identify the document structure, interactive controls, form ownership, focus path, metadata source, and verification surface.
57
+ - Prefer native HTML elements before adding ARIA or JavaScript behavior.
58
+ - Classify every interactive element by user intent before changing markup.
59
+ - Do not edit metadata, canonical, Open Graph, robots, hreflang, or JSON-LD from a single file in isolation.
60
+
61
+ <!-- mustflow-section: allowed-edits -->
62
+ ## Allowed Edits
63
+
64
+ - Use semantic landmarks, headings, native links, native buttons, and native form controls where possible.
65
+ - Connect labels, help text, error text, required state, autocomplete, and input type explicitly.
66
+ - Keep metadata and structured data consistent with visible page content.
67
+ - Add ARIA only when native semantics cannot express the control and the required role, state, keyboard, and focus behavior are implemented.
68
+
69
+ <!-- mustflow-section: procedure -->
70
+ ## Procedure
71
+
72
+ 1. Read the page shell, route layout, metadata helpers, component patterns, and tests before editing.
73
+ 2. Check document outline, landmarks, source order, and heading levels.
74
+ 3. Classify each interactive element by intent. Navigation to a URL uses an anchor with `href`. Commands, toggles, submit actions, open/close actions, destructive actions, copy actions, disclosure triggers, and modal triggers use buttons.
75
+ 4. Use native form controls for text entry, selection, checkbox, radio, and file input. Use grouped native radio or checkbox controls with fieldset and legend when the group label matters.
76
+ 5. Treat composite widgets such as tabs, action menus, comboboxes, listboxes, trees, grids, and custom selects as high-risk. Prefer native HTML or an existing audited component; otherwise implement the complete role, state, focus, and keyboard pattern.
77
+ 6. Reject clickable `div` or `span` controls, clickable icons without buttons, anchors without `href`, links used as buttons, nested interactive controls, positive `tabindex`, focusable `aria-hidden` content, and focus outline removal without a replacement focus style.
78
+ 7. Use ARIA only when native HTML cannot express the needed semantics. Validate the role is legal for the element, the accessible name exists, required states are present, visual and ARIA states stay synchronized, keyboard behavior matches the widget pattern, and focus behavior is explicit.
79
+ 8. For custom legacy button-like elements that cannot be replaced, require `role`, focusability, Enter activation, Space activation, Space scroll prevention, pointer activation, duplicate-event prevention, and visible focus. Use native buttons instead whenever possible.
80
+ 9. For dialogs, prefer native dialog when the project can support it. Otherwise implement focus entry, Tab and Shift+Tab containment, Escape behavior, inert or unreachable background content, visible close or cancel control, focus return, and an accessible name.
81
+ 10. For tabs, use tablist, tab, and tabpanel semantics only for a real tabbed interface. Require one active tab, panel linkage, roving tabindex, arrow key movement, Home and End where expected, and Enter or Space activation when activation is manual.
82
+ 11. For menus, do not use ARIA menu roles for ordinary site navigation. Site navigation is a nav landmark with links. Use ARIA menu patterns only for application-style action menus with a button trigger, expanded state, focus strategy, Escape close behavior, and focus return.
83
+ 12. For forms, verify visible label association, help association, error association, required text, native required state, autocomplete, validation timing, invalid state, error summary behavior, and submission behavior.
84
+ 13. Use placeholder, title, aria-label, color, icon, or toast-only feedback only as supplementary affordances, not as the only label, required indicator, or error explanation.
85
+ 14. For metadata, read visible content and the metadata generation path first. Keep title, description, canonical, Open Graph, Twitter or X card data, robots, hreflang, and JSON-LD aligned with visible content, locale, URL, and indexing intent.
86
+ 15. Structured data must describe content visible on the same page. Do not invent ratings, reviews, FAQ items, authors, prices, availability, dates, organizations, product properties, or claims not backed by the page data source.
87
+ 16. Ensure every HTML page has a valid non-empty language and responsive viewport that does not disable zoom. Mixed-language passages should identify their language when needed.
88
+ 17. Keep inline script and style minimal; move behavior and styling to the existing project layers unless the framework requires an inline boundary.
89
+ 18. Choose configured verification intents that cover markup validity, lint, build, accessibility, route rendering, metadata, and docs when available.
90
+
91
+ <!-- mustflow-section: form-accessibility -->
92
+ ## Form Accessibility Rules
93
+
94
+ - Every user-editable native form control needs a persistent visible label, preferably an explicit label whose `for` value exactly matches the control `id`.
95
+ - Placeholder text, title text, aria-label, icon-only labels, and visual proximity are not substitutes for visible labels unless a strong design constraint is reported and the accessible name remains clear.
96
+ - Help text and error text must be real DOM text with stable IDs and connected through `aria-describedby` when relevant.
97
+ - Required native controls should use native `required`; the required state must also be visible in text or an explained marker. Do not rely on color alone.
98
+ - Use `aria-required` mainly for custom ARIA controls or deliberate compatibility needs; it does not enforce browser validation.
99
+ - Do not set `aria-invalid` before the user has interacted with the field or attempted submission. Set it when validation has determined the field is invalid.
100
+ - Error messages must identify what is wrong and how to fix it when the fix is known. Avoid generic text such as "Invalid" with no recovery instruction.
101
+ - Multiple submit errors should use an error summary near the top of the form or page when the project pattern supports it. Summary items should link to invalid fields, and inline errors should remain next to fields.
102
+ - Use alert or live regions only for dynamic validation or submit feedback that should be announced. Do not spam alerts on every keystroke or place interactive controls inside alerts.
103
+ - Inputs collecting information about the current user should use appropriate autocomplete tokens. Do not blindly disable autocomplete on login, checkout, contact, signup, or account forms.
104
+
105
+ <!-- mustflow-section: metadata-policy -->
106
+ ## Metadata And Structured Data Rules
107
+
108
+ Before editing page metadata, identify the rendered route, canonical production URL, visible H1 or main title, visible primary entity, locale, indexing intent, and source of page facts.
109
+
110
+ - Titles must match the visible primary topic, avoid repeated keyword stuffing, avoid stale boilerplate, and use the page's visible language.
111
+ - Descriptions must summarize the actual visible page and must not fabricate claims, guarantees, prices, ratings, dates, or features.
112
+ - Canonical URLs must be absolute production URLs for the preferred version of the same or near-duplicate content. Do not point canonical to staging, localhost, unrelated pages, wrong locale pages, redirects, 404s, noindex pages, or parameter URLs unless explicitly intended.
113
+ - Canonical, sitemap, hreflang, internal links, and social URL metadata should not contradict each other.
114
+ - Open Graph and Twitter or X title, description, URL, and image should come from the same source of truth as page metadata unless a campaign override is documented. Social images must be absolute, crawlable, and representative of the visible page.
115
+ - Prefer JSON-LD for structured data. Validate JSON syntax and ensure required properties for the chosen rich result type are present when rich-result eligibility matters.
116
+ - Robots directives such as noindex, nofollow, nosnippet, or restrictive crawl hints need explicit intent. Before removing one, check whether the page is intentionally private, duplicated, thin, internal, staged, or blocked.
117
+
118
+ <!-- mustflow-section: rejection-criteria -->
119
+ ## Review Rejection Criteria
120
+
121
+ Reject or revise the patch when any of these appear without strong justification and verification:
122
+
123
+ - New `div` or `span` interaction where a native link, button, or form control would work.
124
+ - Anchors without `href`, buttons implemented as links, links implemented as buttons, nested interactive controls, clickable icons without native controls, or site navigation using ARIA menu roles.
125
+ - Custom controls without complete accessible name, role, state, keyboard, focus, and hidden-content behavior.
126
+ - Positive `tabindex`, hidden content that remains tabbable, focusable `aria-hidden` content, or invisible focus.
127
+ - Form controls without visible labels, placeholder-only labels, disconnected help or error text, color-only required or error state, premature `aria-invalid`, or autocomplete removed without reason.
128
+ - Metadata or JSON-LD that contradicts visible content, fabricates facts, points canonical or social URL at the wrong page, disables zoom, omits page language, or accidentally noindexes a public page.
129
+
130
+ <!-- mustflow-section: postconditions -->
131
+ ## Postconditions
132
+
133
+ - Markup communicates the intended structure without relying on visual styling alone.
134
+ - Keyboard and focus behavior are preserved.
135
+ - Forms have labels and errors connected.
136
+ - Metadata and structured data reflect visible content.
137
+ - Hidden content is not reachable by keyboard when it should be inactive.
138
+ - Native controls are used unless a complete custom interaction pattern is justified.
139
+
140
+ <!-- mustflow-section: verification -->
141
+ ## Verification
142
+
143
+ Use configured oneshot command intents when available:
144
+
145
+ - `lint`
146
+ - `build`
147
+ - `test_related`
148
+ - `test`
149
+ - `docs_validate_fast`
150
+ - `mustflow_check`
151
+
152
+ Report missing accessibility, browser, or HTML validation intents when relevant.
153
+
154
+ When configured or manual verification is available, cover keyboard-only navigation with Tab, Shift+Tab, Enter, Space, Escape, Arrow keys, Home, and End where applicable. Confirm visible focus, accessible name, role, value, state, hidden-content behavior, form errors, metadata consistency, and structured data truthfulness.
155
+
156
+ <!-- mustflow-section: failure-handling -->
157
+ ## Failure Handling
158
+
159
+ - If a custom control cannot meet keyboard and focus requirements, replace it with a native element or report the blocker.
160
+ - If metadata source of truth is unclear, inspect the framework route and SEO helpers before editing.
161
+ - If form validation timing or error ownership is unclear, keep native validation behavior and report the unresolved custom validation boundary.
162
+ - If structured data facts cannot be traced to visible content or a trusted page data source, do not add them.
163
+ - If accessibility verification is unavailable, report the manual keyboard and focus checks that remain.
164
+
165
+ <!-- mustflow-section: output-format -->
166
+ ## Output Format
167
+
168
+ - Boundary checked
169
+ - Semantic, form, focus, and metadata notes
170
+ - Files changed
171
+ - Command intents run
172
+ - Skipped checks and reasons
173
+ - Remaining HTML risk
@@ -0,0 +1,149 @@
1
+ ---
2
+ mustflow_doc: skill.javascript-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: javascript-code-change
9
+ description: Apply this skill when JavaScript source, package module format, runtime boundary, dependency usage, async Promise handling, browser or Node behavior, bundler config, or tests are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.javascript-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # JavaScript Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve JavaScript module, runtime, package entry, Promise, cleanup, dependency, and test boundaries.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.js`, `.mjs`, `.cjs`, package scripts, package exports, bundler config, browser code, Node code, edge code, dependency usage, or JavaScript tests change.
37
+ - The task touches `import`, `require`, `module.exports`, `exports`, `fetch`, `process`, `window`, `document`, `Buffer`, `fs`, `async`, Promise chains, or package entry metadata.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - TypeScript surfaces are changed; use `typescript-code-change`.
43
+ - JavaScript files are generated artifacts that should be regenerated by a declared command.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - `package.json`, lockfile, engines, module `type`, package `exports`, bundler config, lint config, test config, and relevant entrypoints.
49
+ - Target runtime: browser, Node, worker, edge, Bun, or multi-runtime boundary.
50
+ - Runtime adapter files, source entrypoints, package docs examples, and build output layout when package entry or runtime support changes.
51
+ - Async ownership and cleanup surface when Promises, retries, timers, event listeners, streams, abort signals, background tasks, startup, shutdown, or external I/O change.
52
+ - Configured verification intents.
53
+
54
+ <!-- mustflow-section: preconditions -->
55
+ ## Preconditions
56
+
57
+ - Determine module system and runtime before editing imports or globals.
58
+ - Treat Promise and dependency changes as behavior changes unless proven otherwise.
59
+
60
+ <!-- mustflow-section: allowed-edits -->
61
+ ## Allowed Edits
62
+
63
+ - Keep ESM and CommonJS boundaries explicit and localized.
64
+ - Use browser APIs only in browser-safe files and Node APIs only in Node-safe files.
65
+ - Await, return, catch, or intentionally handle every Promise.
66
+ - Prefer existing dependencies and platform APIs over adding a new dependency.
67
+ - Keep runtime-specific APIs behind platform adapters or runtime-specific entrypoints.
68
+ - Keep package entry changes synchronized with declarations, docs examples, build output, and consumer smoke coverage when available.
69
+
70
+ <!-- mustflow-section: procedure -->
71
+ ## Procedure
72
+
73
+ 1. Read package metadata, module type, exports, bundler config, lint config, entrypoints, docs examples, and tests.
74
+ 2. Declare the touched boundary: module system, runtime, package entry, browser/Node/edge/Bun split, async flow, dependency, or test-only.
75
+ 3. Classify each changed JavaScript file as shared, Node, browser, edge, Bun, or test-only before adding imports or globals.
76
+ 4. Keep shared files portable:
77
+ - do not import or reference `node:*`, `fs`, `process`, `Buffer`, `window`, `document`, `localStorage`, DOM-only APIs, or Node streams directly;
78
+ - prefer `URL`, `URLSearchParams`, `Uint8Array`, `ArrayBuffer`, `TextEncoder`, `TextDecoder`, Web `Request`/`Response`, Web Streams, and injected dependencies when those fit the existing code.
79
+ 5. Keep runtime-specific APIs isolated:
80
+ - Node files may use Node process, filesystem, Buffer, Node crypto, and Node streams;
81
+ - browser files may use DOM, window, document, local storage, browser events, and browser fetch;
82
+ - edge files should be treated as Web API based, not as browser DOM code and not as full Node code;
83
+ - Bun-specific APIs do not prove Node, browser, or edge compatibility.
84
+ 6. Do not use runtime detection as a broad escape hatch in shared code. Prefer explicit runtime entrypoints, adapters, conditional exports, or dependency injection over a file that mixes every runtime branch.
85
+ 7. Keep environment access behind existing server/client env helpers. Do not read raw server secrets from client, shared, browser, or edge code, and do not assume `process.env` exists outside Node-oriented code.
86
+ 8. Do not mix `import`/`export` with `require`/`module.exports` outside an established interop boundary.
87
+ 9. Treat package entry metadata as public contract:
88
+ - `type`, file extensions, `main`, `module`, `browser`, `exports`, `types`, `typesVersions`, `files`, `bin`, `sideEffects`, and `engines` affect consumers;
89
+ - adding `exports` can block deep imports and should be classified as public API sensitive;
90
+ - conditional exports must keep specific conditions before generic fallbacks;
91
+ - ESM and CJS branches should expose compatible documented shapes when both are supported;
92
+ - TypeScript declaration output and docs examples must keep pointing at existing package entry files.
93
+ 10. For package entry changes, check source entrypoints, build output layout, docs import examples, TypeScript or declaration settings, bundler config, and consumer-style tests. Report missing Node ESM, Node CJS, browser bundle, edge, Bun, or TypeScript consumer verification when those targets are claimed but no configured intent exists.
94
+ 11. Treat build targets as syntax/output compatibility, not as permission to use a runtime API. A browser or edge build target does not make Node filesystem, process, Buffer, or native APIs safe.
95
+ 12. Treat implicit globals as failures.
96
+ 13. Do not discard Promises. Every Promise-producing call must be awaited, returned, joined, or intentionally supervised by the project's detached-task pattern.
97
+ 14. Do not leave `.map(async ...)` unjoined. Join with the established Promise aggregation or bounded-concurrency helper when parallel work is intended.
98
+ 15. Do not use unbounded parallelism for large external I/O fan-out. Use the local concurrency limit pattern when the workload touches HTTP, database, filesystem, queue, AI, or other external services.
99
+ 16. Propagate cancellation when the operation can outlive a request, job, stream, retry loop, timeout, or user action. Accept and forward `AbortSignal` or the repository's established cancellation token when available.
100
+ 17. Do not implement timeout as a caller-only race that leaves the real work running. Timeout behavior must cancel or abort the underlying operation when the API supports it.
101
+ 18. Put cleanup in a deterministic path. Timers, event listeners, stream readers, Node streams, temp files, locks, transactions, subscriptions, and shutdown drains need success, failure, timeout, and cancellation cleanup coverage when touched.
102
+ 19. Do not build package exports or dependency changes without checking consumers, tests, and docs examples.
103
+ 20. Choose configured verification intents that cover lint, build, tests, package entry, runtime behavior, async rejection handling, cancellation, and cleanup when available.
104
+
105
+ <!-- mustflow-section: postconditions -->
106
+ ## Postconditions
107
+
108
+ - Runtime and module boundaries are explicit.
109
+ - Promise failures are not hidden.
110
+ - Runtime-specific APIs do not leak into shared, browser, edge, or package entry code.
111
+ - Package entry changes are synchronized with tests or reported as unverified.
112
+ - Async cancellation and cleanup behavior is covered or reported as a remaining risk.
113
+ - No unnecessary dependency was added.
114
+
115
+ <!-- mustflow-section: verification -->
116
+ ## Verification
117
+
118
+ Use configured oneshot command intents when available:
119
+
120
+ - `lint`
121
+ - `build`
122
+ - `test_related`
123
+ - `test`
124
+ - `docs_validate_fast`
125
+ - `mustflow_check`
126
+
127
+ Report missing browser, Node, edge, Bun, TypeScript-consumer, package-entry, async-cancellation, or cleanup verification intents when they are relevant.
128
+
129
+ <!-- mustflow-section: failure-handling -->
130
+ ## Failure Handling
131
+
132
+ - If the module system is unclear, inspect package metadata and entrypoints before editing.
133
+ - If runtime globals are needed in shared code, isolate them behind an adapter or report the boundary conflict.
134
+ - If a shared file imports runtime-only APIs, split the runtime entry or adapter before adding more branches.
135
+ - If a package entry change breaks a documented import path, restore compatibility or report the breaking-change requirement.
136
+ - If a Promise is intentionally detached but has no rejection sink, shutdown/drain policy, or tracing context, do not detach it.
137
+ - If cancellation or cleanup cannot be proven, add or reuse the local lifecycle pattern before weakening tests.
138
+ - If dependency compatibility is unclear, classify the change as research or defer it.
139
+
140
+ <!-- mustflow-section: output-format -->
141
+ ## Output Format
142
+
143
+ - Boundary checked
144
+ - Runtime and module notes
145
+ - Async and dependency notes
146
+ - Files changed
147
+ - Command intents run
148
+ - Skipped checks and reasons
149
+ - Remaining JavaScript risk