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,185 @@
1
+ ---
2
+ mustflow_doc: skill.tauri-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: tauri-code-change
9
+ description: Apply this skill when Tauri frontend invokes, Rust commands, capabilities, permissions, scopes, plugins, filesystem, dialog, shell, opener, updater, sidecar, or mobile native permissions are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.tauri-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
+ # Tauri Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve the Tauri WebView-to-native boundary across frontend calls, Rust commands, plugin permissions, capabilities, scopes, filesystem, dialog, shell, opener, updater, sidecar, and mobile permissions.
32
+
33
+ Treat the WebView as low trust and the Rust/native side as high authority. Frontend validation is only UX. Rust command validation is the final security boundary.
34
+
35
+ <!-- mustflow-section: use-when -->
36
+ ## Use When
37
+
38
+ - `src-tauri`, `tauri.conf.*`, `Cargo.toml`, `#[tauri::command]`, `invoke`, Tauri JavaScript APIs, plugin config, capabilities, permissions, scopes, fs, dialog, shell, opener, updater, sidecar, mobile manifests, or native permissions change.
39
+ - A frontend button, menu, or workflow calls native resources through Tauri.
40
+
41
+ <!-- mustflow-section: do-not-use-when -->
42
+ ## Do Not Use When
43
+
44
+ - The change is a pure web frontend view with no Tauri API, command, permission, plugin, or native resource boundary.
45
+ - The Rust code is not part of a Tauri application; use `rust-code-change`.
46
+
47
+ <!-- mustflow-section: required-inputs -->
48
+ ## Required Inputs
49
+
50
+ - Frontend package metadata, Tauri config, Rust manifests, main/lib command modules, command registration, capability and permission files, plugin config, updater config, sidecar config, mobile permissions, and tests.
51
+ - Map of frontend calls to Rust commands or plugin APIs, permission scopes, exact window labels, exact webview labels, remote origins, and actual OS resources.
52
+ - Permission diff: previous permissions, new permissions, newly reachable windows/webviews, new scopes, and native operations enabled.
53
+ - Configured verification intents.
54
+
55
+ <!-- mustflow-section: preconditions -->
56
+ ## Preconditions
57
+
58
+ - Identify Tauri major version and permission model before editing.
59
+ - Treat every frontend-provided path, URL, command argument, channel, token, or feature flag as untrusted.
60
+ - Determine which window or webview receives each capability.
61
+ - Before widening any capability, write the exact native action being enabled: window label, webview label, command name, plugin command, input fields, allowed path or URL, and why a narrower existing permission cannot satisfy the feature.
62
+
63
+ <!-- mustflow-section: allowed-edits -->
64
+ ## Allowed Edits
65
+
66
+ - Keep capabilities and permissions feature-specific and window/webview-specific.
67
+ - Validate paths, URLs, command arguments, and update channels in Rust or the native boundary.
68
+ - Prefer app-owned directories and stable app IDs over broad filesystem paths.
69
+ - Keep shell, opener, sidecar, and updater behavior narrowly scoped.
70
+ - Prefer Rust commands that map small enums or ids to fixed native operations over exposing broad plugin APIs directly to the frontend.
71
+
72
+ <!-- mustflow-section: procedure -->
73
+ ## Procedure
74
+
75
+ 1. Read frontend call sites, Tauri config, Rust command registration, Rust command handlers, plugin config, capabilities, permissions, scopes, updater, sidecar, mobile native permissions, and tests.
76
+ 2. Build an IPC map: frontend function, command or plugin API, Rust handler, permission, scope, OS resource, and response data.
77
+ 3. Classify every native operation by trust boundary: frontend input, Rust validation, plugin permission, capability target, scope, OS resource, and returned data sensitivity.
78
+ 4. Do not trust frontend validation for filesystem paths, URLs, shell arguments, updater channels, identifiers, selected dialog paths, or server-provided links.
79
+ 5. Apply the capability and permission policy below before adding permissions, scopes, remote origins, default permission sets, or wildcard targets.
80
+ 6. Apply the command input policy below before adding or changing `#[tauri::command]` handlers or `invoke` wrappers.
81
+ 7. Apply the filesystem, dialog, shell, opener, updater, and sidecar policies below when those plugins or native operations are touched.
82
+ 8. Choose configured verification intents that cover Rust, frontend, Tauri build, permission/capability drift, and security-sensitive behavior when available.
83
+
84
+ ## Capability And Permission Policy
85
+
86
+ - Do not add or widen `windows: ["*"]`, `webviews: ["*"]`, broad label globs, `remote.urls`, or platform removal unless the user explicitly asked for that security boundary change.
87
+ - Privileged permissions must target exact window labels or exact webview labels.
88
+ - Treat multiple capability files as additive. A small temporary capability can still widen the final build.
89
+ - Do not add plugin `default` permission sets merely to fix a permission error. Prefer the smallest `allow-*` permission and the narrowest scope.
90
+ - For updater permissions, do not expose download or install operations to the frontend unless the feature explicitly requires renderer-triggered install behavior.
91
+ - Do not add broad filesystem scopes such as home, document, download, desktop, temp, app local data, resource root, drive root, or recursive write/delete scopes.
92
+ - Prefer app-owned paths with feature-specific names and narrow file patterns.
93
+ - Do not rely on capability scope alone. Confirm the Rust command or plugin path actually enforces the intended path, URL, argument, or channel constraint.
94
+ - Remote capabilities are denied by default. If unavoidable, keep them read-only or low-risk and isolated from filesystem, shell, updater, and opener privileges.
95
+
96
+ ## Command Input Policy
97
+
98
+ - Every new or changed `#[tauri::command]` must have a typed request shape unless the command has no input.
99
+ - Use closed enums for actions, formats, updater channels, job kinds, and sidecar tasks.
100
+ - Reject `serde_json::Value`, unbounded maps, raw shell argument arrays, raw updater channel strings, raw URLs, raw paths, and dynamic command names unless the command immediately validates and normalizes them.
101
+ - Use unknown-field rejection for command request structs when compatible with the existing Rust style.
102
+ - Do not let frontend code call a dynamic command name. Frontend wrappers must call known command names and known argument shapes.
103
+ - Validate all paths, URLs, shell arguments, updater channels, file types, ids, and user-selected dialog paths in Rust before use.
104
+ - Do not return secrets, tokens, private file paths, command stderr containing credentials, update headers, or raw system details unless the feature explicitly requires it and the caller is scoped.
105
+
106
+ ## Filesystem And Dialog Policy
107
+
108
+ - Prefer a Rust command that maps an id or relative filename to an app-owned path. Do not let the frontend choose arbitrary absolute paths for routine app storage.
109
+ - For app-owned paths, reject absolute paths, parent traversal, root components, Windows prefixes, and non-normal path components before joining to the base.
110
+ - Canonicalize the trusted base and the target parent before creating or writing files; ensure the target remains inside the base.
111
+ - Define overwrite, create, rename, remove, and recursive behavior explicitly.
112
+ - Dialog selection is only user intent evidence. Revalidate selected paths in Rust for file type, size, extension, content signature when relevant, symlink behavior, and allowed operation.
113
+ - Do not connect dialog-selected paths to broad future filesystem access without a second Rust-side validation and storage policy.
114
+
115
+ ## Shell Sidecar Opener Updater Policy
116
+
117
+ - Do not expose shell execution through command strings, shell interpreters, dynamic executable names, dynamic working directories, dynamic environment variables, `args: true`, or catch-all validators.
118
+ - Prefer Rust commands that execute fixed binaries with fixed argument order and narrow enum/id inputs.
119
+ - If shell plugin access is unavoidable, pin the command name, sidecar flag, and ordered args. Dynamic args must be anchored validators for one primitive value only.
120
+ - Do not expose sidecars directly to arbitrary frontend args. Prefer a Rust command that maps a small enum or job id to fixed sidecar args.
121
+ - Do not open arbitrary URLs or files through opener. Parse and allowlist scheme, host, port, path prefix, and userinfo behavior before opening URLs. Restrict paths to app-owned exports or freshly selected and revalidated files.
122
+ - Treat server-provided URLs, markdown links, release notes, AI output, and remote content as untrusted before opener calls.
123
+ - Do not let frontend input control updater endpoint, public key, proxy, authorization headers, TLS downgrade, downgrade comparator, or arbitrary channel strings.
124
+ - Frontend update input may select only a closed channel enum when needed. Rust or static config must map that enum to hard-coded HTTPS endpoints and configured public keys.
125
+ - Do not enable insecure updater transport in production unless the user explicitly accepts the supply-chain boundary change and the repository records why.
126
+
127
+ ## Review Rejection Criteria
128
+
129
+ Reject or revise a change when:
130
+
131
+ - A permission error is fixed by adding a default permission set without explaining the exact native operation.
132
+ - Privileged permissions target all windows, all webviews, broad label globs, or remote origins.
133
+ - Filesystem scopes include broad user directories, recursive write/delete, app local WebView data, resource root, drive root, or arbitrary temp paths.
134
+ - Shell or sidecar access accepts command strings, shell interpreters, arbitrary args, unanchored validators, dynamic cwd, or dynamic env.
135
+ - Opener accepts arbitrary URLs, custom schemes, wildcard URL scopes, arbitrary file paths, or app names from frontend input.
136
+ - Updater endpoint, public key, proxy, headers, authorization, TLS mode, downgrade behavior, or arbitrary channel is renderer-controlled.
137
+ - A Rust command accepts untyped JSON, broad maps, raw paths, raw URLs, raw shell args, or action strings without immediate Rust-side normalization.
138
+ - Frontend validation is presented as the authoritative security check.
139
+ - A command is registered without checking which windows or webviews can reach it.
140
+ - The response returns sensitive paths, tokens, command output, update metadata, or system details without a scoped need.
141
+
142
+ <!-- mustflow-section: postconditions -->
143
+ ## Postconditions
144
+
145
+ - Frontend-to-native resource access is mapped and minimized.
146
+ - Broad capabilities, permissions, scopes, shell access, updater exceptions, and sensitive returns are avoided or reported.
147
+ - Rust/native validation does not rely only on frontend checks.
148
+ - Permission and capability changes have a clear diff and native-operation justification.
149
+ - Missing Tauri-specific verification is reported.
150
+
151
+ <!-- mustflow-section: verification -->
152
+ ## Verification
153
+
154
+ Use configured oneshot command intents when available:
155
+
156
+ - `lint`
157
+ - `build`
158
+ - `test_related`
159
+ - `test`
160
+ - `docs_validate_fast`
161
+ - `mustflow_check`
162
+
163
+ Report missing native build, permission diff, updater, shell, sidecar, opener, dialog, filesystem, or mobile permission verification intents when relevant.
164
+
165
+ <!-- mustflow-section: failure-handling -->
166
+ ## Failure Handling
167
+
168
+ - If a feature appears to require broad capabilities, stop and propose a narrower command or permission model.
169
+ - If frontend and Rust command contracts drift, synchronize them before adding more UI.
170
+ - If native permission behavior cannot be verified, report the platform-specific gap.
171
+ - If a capability, scope, or plugin permission widens unexpectedly, stop and reduce it before changing unrelated UI.
172
+ - If a command accepts broad input, replace it with a typed request and Rust-side validation before exposing it to the frontend.
173
+ - If updater, shell, opener, sidecar, or filesystem access cannot be narrowed, report the security boundary change instead of hiding it as a normal feature fix.
174
+
175
+ <!-- mustflow-section: output-format -->
176
+ ## Output Format
177
+
178
+ - Boundary checked
179
+ - IPC, command input, permission, capability, window/webview, and scope notes
180
+ - Permission diff: old permissions, new permissions, newly reachable windows/webviews, new scopes, and native operation justification
181
+ - Filesystem, dialog, shell, opener, updater, sidecar, or mobile risk
182
+ - Files changed
183
+ - Command intents run
184
+ - Skipped checks and reasons
185
+ - Remaining Tauri risk
@@ -0,0 +1,184 @@
1
+ ---
2
+ mustflow_doc: skill.typescript-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: typescript-code-change
9
+ description: Apply this skill when TypeScript source, declarations, tsconfig, package exports, module resolution, type safety, or TypeScript 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.typescript-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
+ # TypeScript Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve TypeScript's type, runtime validation, module, build, and public API boundaries while making the requested code change. The goal is not to silence type errors; the goal is to leave code-level evidence that runtime values really match the types being claimed.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.ts`, `.tsx`, `.mts`, `.cts`, `*.d.ts`, `tsconfig*.json`, package entry metadata, exports, declarations, runtime validators, or TypeScript tests change.
37
+ - The task touches module resolution, ESM/CJS interop, public package API, path aliases, generated declarations, or strict type errors.
38
+ - The task touches external inputs such as JSON, HTTP responses, environment variables, config files, form data, URL params, local storage, message events, queue payloads, or user-provided objects.
39
+ - A framework component written in TypeScript changes its props, events, routes, loader data, or exported types.
40
+
41
+ <!-- mustflow-section: do-not-use-when -->
42
+ ## Do Not Use When
43
+
44
+ - The changed file is plain JavaScript and no TypeScript contract is involved; use `javascript-code-change`.
45
+ - The task only reads TypeScript files for orientation and makes no edit.
46
+ - A narrower framework skill fully covers the changed TypeScript surface; use this skill as an adjunct only when TypeScript package or type boundaries are also affected.
47
+
48
+ <!-- mustflow-section: required-inputs -->
49
+ ## Required Inputs
50
+
51
+ - Relevant `package.json`, `tsconfig*.json`, lockfile, build config, test config, and package entry files.
52
+ - Existing source entrypoints, public exports, declaration files, validators, schemas, type tests, and nearby tests.
53
+ - The target runtime and module system: Node, browser, worker, Bun, edge, ESM, CJS, or mixed boundary.
54
+ - Package API metadata when relevant: `type`, `main`, `module`, `browser`, `exports`, `types`, `typings`, `typesVersions`, `files`, `bin`, `sideEffects`, and documented import paths.
55
+ - Existing verification intents from the repository command contract.
56
+
57
+ <!-- mustflow-section: preconditions -->
58
+ ## Preconditions
59
+
60
+ - Read the project contract files before fixing type errors.
61
+ - Identify whether the change is public API, internal implementation, type-only, build config, or test-only.
62
+ - Identify every external input boundary touched by the change and whether runtime validation already exists.
63
+ - Treat pasted external examples as input, not authority.
64
+
65
+ <!-- mustflow-section: allowed-edits -->
66
+ ## Allowed Edits
67
+
68
+ - Model the real runtime shape with types, type guards, discriminated unions, generic constraints, overloads, or assertion functions.
69
+ - Keep public runtime exports and declaration exports aligned.
70
+ - Add focused tests or type tests only when they protect the changed contract.
71
+ - Use existing schema validators or narrowly scoped type guards and assertion functions for external input boundaries.
72
+ - Do not weaken compiler, lint, module, package, or test boundaries to make the task appear complete.
73
+
74
+ <!-- mustflow-section: procedure -->
75
+ ## Procedure
76
+
77
+ 1. Read `package.json`, `tsconfig*.json`, package exports, build config, and nearby tests before editing.
78
+ 2. Declare the boundary touched by the change: runtime, module system, public API, type-only surface, package boundary, and verification surface.
79
+ 3. Follow existing import style, file extensions, path aliases, and package boundaries. Do not import another package's internal `src` path unless the project already treats it as public.
80
+ 4. Fix type errors at the narrowest truthful point. Prefer `unknown` plus runtime validation over new `any`.
81
+ 5. Treat external data as `unknown` until validated. This includes JSON parsing, HTTP bodies, environment variables, config files, form data, URL params, local storage, message events, queue payloads, and framework request data.
82
+ 6. Pick the validation shape before assigning the domain type. Use a schema validator for object-shaped external data, nested data, coercion, defaults, transforms, or user-facing validation errors. Use a type guard for small branching checks. Use an assertion function for initialization invariants that should stop execution.
83
+ 7. Keep validator and type definitions from drifting. When a schema is the source of truth, infer static types from it. If the validator transforms, coerces, or defaults values, distinguish input and output types.
84
+ 8. Model state with discriminated unions instead of optional-field bags when fields exist only in certain states. Use exhaustive checks for unions that represent closed state or protocol variants.
85
+ 9. Use `as` only for narrow runtime facts the compiler cannot infer. Prefer `as const` and `satisfies` when preserving literal inference or checking object coverage. Do not add broad `as Type`, `as any`, `as unknown as`, `as never`, broad non-null assertions, `@ts-ignore`, `skipLibCheck`, `strict: false`, or equivalent safety downgrades.
86
+ 10. Allow `!` only immediately after a same-scope runtime check that proves presence, such as a `has` check for the same key before `get`. Do not use `!` across `await`, callbacks, mutation, lifecycle boundaries, or property chains.
87
+ 11. For type tests, prefer `@ts-expect-error` with a short reason. Do not use `@ts-ignore` in implementation code. Implementation `@ts-expect-error` needs an owner, removal condition, and risk report.
88
+ 12. If a public API changes, trace every consumer-visible import specifier, runtime export, type export, declaration output, docs example, type-only export, overload, generic default, interface field, enum or literal member, class member, and package entry condition.
89
+ 13. Treat `exports`, `types`, `typings`, `typesVersions`, package `type`, file extensions, path aliases, declaration import paths, and barrel exports as public API surfaces. Adding or tightening `exports` can break existing deep imports.
90
+ 14. If ESM/CJS behavior changes, verify package `type`, `main`, `module`, `browser`, `exports`, condition order, extension rules, generated JS, and generated declaration files together.
91
+ 15. Inspect generated declarations when package surfaces change. Declaration files must not leak source-only aliases, private paths, workspace-only package names, unpublished internal paths, or accidental public re-exports.
92
+ 16. Choose the narrowest configured verification intents that cover typecheck, lint, tests, build output, declarations, package contract risk, and downstream-style consumer risk.
93
+
94
+ <!-- mustflow-section: assertion-policy -->
95
+ ## Assertion Policy
96
+
97
+ Allowed:
98
+
99
+ - `as const` for preserving literal types.
100
+ - `satisfies` for checking object coverage while preserving the expression's inferred shape.
101
+ - Narrow assertions immediately after a nearby runtime check when TypeScript cannot express the relationship.
102
+ - Assertion functions that actually inspect the value and throw on failure.
103
+ - `@ts-expect-error` in type tests when the comment states why the error is expected.
104
+ - One contained wrapper around an incorrect third-party type, backed by runtime validation or a smoke test.
105
+
106
+ Rejected by default:
107
+
108
+ - `JSON.parse(...) as T`, `response.json() as T`, `process.env as Env`, `Object.fromEntries(formData) as T`, or any external input cast directly to a domain type.
109
+ - `as any`, `as unknown as T`, `as never`, or a broad object-wide `as T` used to bypass incompatible shapes.
110
+ - `user!.profile!.field!`-style property chains or non-null assertions after async, callbacks, mutation, or lifecycle transitions.
111
+ - Implementation `@ts-ignore`.
112
+ - Compiler setting downgrades such as disabling strictness, null checking, indexed access safety, or declaration checking to make the patch pass.
113
+
114
+ <!-- mustflow-section: public-api-policy -->
115
+ ## Public API Policy
116
+
117
+ Public API includes every import path a consumer can resolve, runtime JS entry, declaration entry, package export condition, type export, generated `.d.ts` signature, class member, overload, generic parameter, interface field, enum or literal member, public barrel export, CLI `bin`, and documented example.
118
+
119
+ When package or declaration surfaces change:
120
+
121
+ - Compare runtime exports and type exports.
122
+ - Check root imports, subpath imports, type-only imports, ESM imports, CJS requires, and documented deep imports when those targets are supported.
123
+ - Treat removed exports, renamed exports, narrowed parameters, changed defaults, changed overload order, widened or narrowed return contracts, required field additions, optional field meaning changes, generic bound changes, and declaration path changes as compatibility-sensitive.
124
+ - Treat path aliases in emitted JS or declarations as release risks unless the consumer environment is guaranteed to resolve them.
125
+ - If a previously importable deep path becomes blocked by `exports`, report it as a breaking-change risk unless a compatibility export remains.
126
+
127
+ <!-- mustflow-section: rejection-criteria -->
128
+ ## Review Rejection Criteria
129
+
130
+ Reject or revise the patch when any of these appear without explicit evidence and risk reporting:
131
+
132
+ - A type error is fixed by adding `any`, broad `as`, double assertion, non-null assertion, `@ts-ignore`, or compiler setting downgrades.
133
+ - External data is trusted as a domain type without schema validation, a type guard, or an assertion function.
134
+ - A state object uses optional fields where a discriminated union would encode the lifecycle correctly.
135
+ - Validator schemas and exported types are duplicated without a single source of truth.
136
+ - Generated declarations expose source-only aliases, internal module paths, workspace-only packages, or accidental barrel exports.
137
+ - Package entry metadata changes without checking runtime entry, type entry, declaration output, and supported resolver modes.
138
+ - `skipLibCheck` or weakened strictness is used as release validation for a library/package.
139
+
140
+ <!-- mustflow-section: postconditions -->
141
+ ## Postconditions
142
+
143
+ - Type safety is preserved or improved.
144
+ - Runtime input boundaries are validated before values receive domain types.
145
+ - Runtime exports, type exports, and declaration output agree.
146
+ - Assertions are narrow, justified, and contained.
147
+ - Any public API or module-system risk is reported.
148
+ - No type-checking or test guard was weakened without an explicit user request and risk report.
149
+
150
+ <!-- mustflow-section: verification -->
151
+ ## Verification
152
+
153
+ Use configured oneshot command intents when available:
154
+
155
+ - `lint`
156
+ - `build`
157
+ - `test_related`
158
+ - `test`
159
+ - `docs_validate_fast`
160
+ - `mustflow_check`
161
+
162
+ If a package API changes, include the configured release or package-surface verification when available.
163
+
164
+ Report whether configured verification exists for declaration output, package artifact contents, downstream-style consumer fixtures, minimum supported TypeScript version, latest supported TypeScript version, ESM, CJS, and bundler-style resolution when those surfaces change.
165
+
166
+ <!-- mustflow-section: failure-handling -->
167
+ ## Failure Handling
168
+
169
+ - If a type error appears to require weakening compiler settings, stop and report the real boundary conflict.
170
+ - If external input has no validation pattern, add a narrow validator/guard/assertion or report the missing boundary instead of casting.
171
+ - If module resolution is unclear, inspect the package and compiler configuration before changing imports.
172
+ - If generated declaration output cannot be inspected, report the package API risk and the missing verification intent.
173
+ - If verification commands are missing, report the missing intents instead of inventing package-manager commands.
174
+
175
+ <!-- mustflow-section: output-format -->
176
+ ## Output Format
177
+
178
+ - Boundary checked
179
+ - Files changed
180
+ - Type and module safety notes
181
+ - Public API or declaration impact
182
+ - Command intents run
183
+ - Skipped checks and reasons
184
+ - Remaining TypeScript risk
@@ -0,0 +1,186 @@
1
+ ---
2
+ mustflow_doc: skill.unocss-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: unocss-code-change
9
+ description: Apply this skill when UnoCSS config, presets, extraction, content pipeline, shortcuts, rules, variants, safelist, blocklist, attributify, transformers, or utility usage are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.unocss-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
+ # UnoCSS Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve UnoCSS extraction, preset, shortcut, rule, safelist, blocklist, variant, attributify, and production CSS boundaries. Treat UnoCSS utilities as statically extracted tokens, not runtime-generated strings.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `uno.config.*`, `unocss.config.*`, presets, rules, shortcuts, variants, extractors, content pipeline, safelist, blocklist, transformers, attributify, icon utilities, or UnoCSS utility usage changes.
37
+ - The task touches Vue, Svelte, Astro, MDX, TSX, backend templates, markdown-generated HTML, runtime class maps, generated CSS visibility, static class maps in `.ts` or `.js`, or utility generation in shared files.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - Utility styling is Tailwind, not UnoCSS; use `tailwind-code-change`.
43
+ - Styling is plain CSS without UnoCSS extraction risk; use `css-code-change`.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - `uno.config.*` or `unocss.config.*`, package metadata, bundler integration, CSS entry, content extraction rules, presets, shortcuts, rules, variants, safelist, blocklist, transformers, attributify settings, and tests.
49
+ - The file types that actually contain utilities, including static maps or variant helpers in `.ts` or `.js` files.
50
+ - Approved token allowlists for intent, tone, size, color, spacing, theme, state, icon, and variant values.
51
+ - Any runtime source for visual values: CMS, database, backend templates, user input, API data, generated markdown, or external components.
52
+ - Configured verification intents.
53
+
54
+ <!-- mustflow-section: preconditions -->
55
+ ## Preconditions
56
+
57
+ - Confirm extraction targets before adding utilities or moving class maps.
58
+ - Identify whether the project uses default pipeline extraction, explicit `content.pipeline.include`, `@unocss-include`, safelist, or custom extractors.
59
+ - Identify whether shortcuts, rules, variants, or safelist entries are design-system vocabulary or one-off hiding places.
60
+ - If the config is unclear, do not introduce attributify, custom rules, custom variants, broad shortcuts, or broad safelists. Use plain `class` utilities with complete static strings.
61
+
62
+ <!-- mustflow-section: allowed-edits -->
63
+ ## Allowed Edits
64
+
65
+ - Keep utilities statically extractable or narrowly safelisted.
66
+ - Add shortcuts only for shared design-system vocabulary.
67
+ - Add variants only for clear team conventions.
68
+ - Use blocklist or lint policy to prevent raw pixels, raw colors, non-canonical aliases, and uncontrolled arbitrary utilities when the project supports it.
69
+ - Extend extraction only through narrow pipeline include patterns or a single-file include marker when static class maps live outside default scanned file types.
70
+ - Add safelist entries only for finite candidates that cannot exist statically in source.
71
+
72
+ <!-- mustflow-section: procedure -->
73
+ ## Procedure
74
+
75
+ 1. Read UnoCSS config, presets, extraction config, CSS import, framework integration, and nearby utility usage.
76
+ 2. Classify the change: extraction, preset, shortcut, rule, variant, safelist, blocklist, attributify, transformer, icon utility, or component usage.
77
+ 3. Treat every UnoCSS utility as a build-time extraction token. Reject runtime interpolation, concatenation, array joins, broad template fragments, or values built only from API, CMS, database, backend, or user-input strings.
78
+ 4. If a missing utility comes from string interpolation, replace it with a finite static map. If that map lives in `.ts` or `.js`, ensure the file is included by a narrow content pipeline pattern or a single-file include marker.
79
+ 5. Use safelist only for classes that cannot appear statically in source, such as CMS schema values, external runtime input, backend-rendered fragments, or external components. Do not use safelist to cover a bad component API or forgotten extraction include.
80
+ 6. Keep safelists small, finite, named, and bounded by approved token lists and maximum generated count. Treat feature-local safelists over 50 classes, shared safelists over 200 classes, or total safelists over 300 classes as design/extraction failures unless explicitly justified.
81
+ 7. Do not generate safelists from whole theme objects, full color palettes, all shades, all spacing values, all breakpoints, or broad property and variant multiplication.
82
+ 8. Use token allowlists before writing shortcuts, rules, variants, or safelists. Do not use every theme key as an allowed product value.
83
+ 9. Add shortcuts only for repeated product primitives. Prefer static shortcuts when all combinations are known. Dynamic shortcuts must be anchored, token allowlisted, and free of broad catch-all groups.
84
+ 10. Do not use shortcuts as one-off wrappers for long class strings in a single screen.
85
+ 11. Add custom rules only for CSS primitives or token bridges that existing presets cannot express. Do not pass arbitrary raw values directly into CSS.
86
+ 12. Returning raw CSS strings from custom rules requires explicit review because escaping, variants, and generated CSS structure become the rule author's responsibility.
87
+ 13. Add custom variants only for stable team selector conventions such as known data states, ARIA states, or approved themes. Variants must be allowlisted and selector-scoped.
88
+ 14. Use blocklist policy to catch raw pixel utilities, raw color utilities, non-token arbitrary values, and non-canonical aliases when the project supports it. Pair blocklist entries with actionable messages and lint visibility when available.
89
+ 15. If attributify is used in JSX or TSX, require prefixed-only attributes, the JSX transformer, and framework type shims. Prefer a project prefix such as `un-`; do not introduce unprefixed `text`, `color`, `size`, or `border` attributes.
90
+ 16. If attributify transformer limitations make an attribute ambiguous, use valued prefixed attributes or plain `class` utilities.
91
+ 17. Choose configured verification intents that cover production build, extraction coverage, lint, component tests, generated CSS size risk, and visual risk when available.
92
+
93
+ <!-- mustflow-section: extraction-policy -->
94
+ ## Extraction Policy
95
+
96
+ - Static class maps are valid only when UnoCSS actually scans the file that contains the full utility strings.
97
+ - Default framework scanning may not include plain `.ts` or `.js` utility files. Check the project config before moving variants into helper files.
98
+ - Prefer static maps for finite values such as intent, tone, size, density, column count, state, and theme.
99
+ - Use narrow content pipeline includes for repeated helper-map locations.
100
+ - Use a single-file include marker only for isolated files that intentionally hold extractable utilities.
101
+ - Do not add broad extraction globs that pull tests, generated files, build output, dependencies, or unrelated scripts into utility extraction.
102
+
103
+ <!-- mustflow-section: shortcut-rule-variant-policy -->
104
+ ## Shortcut, Rule, And Variant Policy
105
+
106
+ - Shortcuts, rules, and variants create project-wide styling vocabulary. Treat them as public design-system surface, not local convenience.
107
+ - Dynamic shortcut regexes must not contain unbounded catch-all groups. They must be anchored and restricted to approved token values.
108
+ - Custom rules must not become raw CSS property tunnels.
109
+ - Custom variants must not create arbitrary selector DSLs.
110
+ - One-off names such as page-specific hero, pricing, landing, or copy wrappers do not belong in global shortcuts.
111
+ - If all combinations are known, prefer generated static shortcut entries over runtime-like regex behavior.
112
+
113
+ <!-- mustflow-section: safelist-blocklist-policy -->
114
+ ## Safelist And Blocklist Policy
115
+
116
+ - Safelist is a last resort for finite utilities absent from source.
117
+ - Safelist functions must have a named source, an approved candidate list, and a cap.
118
+ - Broad theme iteration, palette multiplication, shade multiplication, and variant multiplication are rejected by default.
119
+ - Blocklist should reject raw pixel, raw hex, raw color-function, and non-token arbitrary utilities when those violate the design system.
120
+ - Blocklist failures should explain the preferred token, scale value, CSS variable, or source file to change.
121
+ - If blocklist only removes generated CSS without a lint or test signal, report the developer-experience risk.
122
+
123
+ <!-- mustflow-section: attributify-policy -->
124
+ ## Attributify Policy
125
+
126
+ - Do not introduce attributify in a project whose UnoCSS config is unclear.
127
+ - In JSX/TSX, attributify requires prefixed-only mode, JSX transformation, and framework type declarations.
128
+ - Avoid unprefixed attributes that collide with DOM or component props.
129
+ - Prefer plain `class` utilities when transformer, type shim, or prop conflict handling is missing.
130
+
131
+ <!-- mustflow-section: review-rejection-criteria -->
132
+ ## Review Rejection Criteria
133
+
134
+ Reject the change when:
135
+
136
+ - Utilities are assembled from runtime fragments.
137
+ - A static map moves into a file UnoCSS does not scan.
138
+ - Safelist hides an extraction mistake.
139
+ - Safelist generation is broad, uncapped, or based on whole theme objects.
140
+ - Dynamic shortcuts use catch-all regex groups or accept arbitrary values.
141
+ - Custom rules pass raw values directly into CSS.
142
+ - Custom variants accept arbitrary selectors or themes.
143
+ - Blocklist removes utilities without an actionable developer-facing signal.
144
+ - JSX/TSX attributify lacks prefix, transformer, or type support.
145
+
146
+ <!-- mustflow-section: postconditions -->
147
+ ## Postconditions
148
+
149
+ - Utilities are extractable or intentionally safelisted.
150
+ - Shortcut, variant, and rule additions are bounded and reviewable.
151
+ - Safelist and blocklist changes are finite, token-aware, and visible to maintainers.
152
+ - Production generated CSS risk is checked or reported.
153
+ - Attributify conflicts are considered when relevant.
154
+
155
+ <!-- mustflow-section: verification -->
156
+ ## Verification
157
+
158
+ Use configured oneshot command intents when available:
159
+
160
+ - `lint`
161
+ - `build`
162
+ - `test_related`
163
+ - `test`
164
+ - `docs_validate_fast`
165
+ - `mustflow_check`
166
+
167
+ Report missing production CSS, extractor, or visual verification intents when relevant.
168
+
169
+ <!-- mustflow-section: failure-handling -->
170
+ ## Failure Handling
171
+
172
+ - If a utility is missing in production, inspect extraction targets and runtime-only class composition first.
173
+ - If safelist growth is broad, stop and require a smaller token-bounded contract.
174
+ - If a custom extractor is needed, treat it as build-system risk and use a narrower contract skill if command metadata changes.
175
+ - If static maps are not extracted, fix the source include boundary before adding safelist.
176
+ - If attributify breaks JSX or component props, fall back to plain `class` utilities or add the missing prefixed transformer/type contract.
177
+
178
+ <!-- mustflow-section: output-format -->
179
+ ## Output Format
180
+
181
+ - Boundary checked
182
+ - Extraction, safelist, shortcut, or variant notes
183
+ - Files changed
184
+ - Command intents run
185
+ - Skipped checks and reasons
186
+ - Remaining UnoCSS risk