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.
- package/README.md +6 -0
- package/dist/cli/commands/api.js +874 -0
- package/dist/cli/commands/dashboard.js +51 -4
- package/dist/cli/commands/explain.js +3 -2
- package/dist/cli/commands/help.js +0 -1
- package/dist/cli/commands/run.js +41 -4
- package/dist/cli/commands/verify.js +4 -43
- package/dist/cli/i18n/en.js +15 -0
- package/dist/cli/i18n/es.js +15 -0
- package/dist/cli/i18n/fr.js +15 -0
- package/dist/cli/i18n/hi.js +15 -0
- package/dist/cli/i18n/ko.js +15 -0
- package/dist/cli/i18n/zh.js +15 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/lib/cli-output.js +1 -1
- package/dist/cli/lib/command-registry.js +6 -0
- package/dist/cli/lib/dashboard-html/client-script.js +9 -0
- package/dist/cli/lib/dashboard-html/styles.js +48 -1
- package/dist/cli/lib/doc-review-ledger.js +1 -1
- package/dist/cli/lib/local-index/index.js +324 -298
- package/dist/cli/lib/repo-map.js +19 -5
- package/dist/cli/lib/validation/index.js +6 -2
- package/dist/core/active-run-locks.js +36 -8
- package/dist/core/atomic-state-write.js +5 -20
- package/dist/core/change-verification.js +18 -2
- package/dist/core/contract-lint.js +3 -3
- package/dist/core/public-json-contracts.js +48 -0
- package/dist/core/repeated-failure.js +1 -1
- package/dist/core/run-write-drift.js +30 -17
- package/dist/core/safe-filesystem.js +54 -5
- package/dist/core/skill-route-explanation.js +2 -1
- package/dist/core/source-anchors.js +7 -3
- package/dist/core/validation-ratchet.js +61 -18
- package/dist/core/verification-decision-graph.js +8 -1
- package/dist/core/verification-plan-id.js +44 -0
- package/package.json +1 -1
- package/schemas/README.md +6 -0
- package/schemas/command-catalog.schema.json +158 -0
- package/schemas/diff-risk.schema.json +74 -0
- package/schemas/health.schema.json +45 -0
- package/schemas/latest-evidence.schema.json +95 -0
- package/schemas/verification-plan.schema.json +245 -0
- package/schemas/workspace-summary.schema.json +282 -0
- package/templates/default/i18n.toml +139 -1
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +24 -1
- package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +212 -0
- package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +184 -0
- package/templates/default/locales/en/.mustflow/skills/auth-permission-change/SKILL.md +194 -0
- package/templates/default/locales/en/.mustflow/skills/config-env-change/SKILL.md +189 -0
- package/templates/default/locales/en/.mustflow/skills/css-code-change/SKILL.md +199 -0
- package/templates/default/locales/en/.mustflow/skills/dart-code-change/SKILL.md +179 -0
- package/templates/default/locales/en/.mustflow/skills/database-migration-change/SKILL.md +178 -0
- package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +151 -0
- package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/file-path-cross-platform-change/SKILL.md +147 -0
- package/templates/default/locales/en/.mustflow/skills/flutter-code-change/SKILL.md +116 -0
- package/templates/default/locales/en/.mustflow/skills/go-code-change/SKILL.md +156 -0
- package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +117 -0
- package/templates/default/locales/en/.mustflow/skills/html-code-change/SKILL.md +173 -0
- package/templates/default/locales/en/.mustflow/skills/javascript-code-change/SKILL.md +149 -0
- package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +154 -0
- package/templates/default/locales/en/.mustflow/skills/release-publish-change/SKILL.md +172 -0
- package/templates/default/locales/en/.mustflow/skills/routes.toml +138 -0
- package/templates/default/locales/en/.mustflow/skills/rust-code-change/SKILL.md +154 -0
- package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +186 -0
- package/templates/default/locales/en/.mustflow/skills/tailwind-code-change/SKILL.md +164 -0
- package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +185 -0
- package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +184 -0
- package/templates/default/locales/en/.mustflow/skills/unocss-code-change/SKILL.md +186 -0
- package/templates/default/manifest.toml +158 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.rust-code-change
|
|
3
|
+
locale: en
|
|
4
|
+
canonical: true
|
|
5
|
+
revision: 2
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: rust-code-change
|
|
9
|
+
description: Apply this skill when Rust source, Cargo metadata, features, traits, errors, ownership, async runtime, unsafe code, tests, examples, or public crate APIs are created or changed.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.rust-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
|
+
# Rust Code Change
|
|
27
|
+
|
|
28
|
+
<!-- mustflow-section: purpose -->
|
|
29
|
+
## Purpose
|
|
30
|
+
|
|
31
|
+
Preserve Rust ownership, error, trait, feature, async runtime, unsafe, and public crate boundaries while making a focused change. A Rust change is successful only when it clarifies ownership and contracts, not when it merely silences the borrow checker.
|
|
32
|
+
|
|
33
|
+
<!-- mustflow-section: use-when -->
|
|
34
|
+
## Use When
|
|
35
|
+
|
|
36
|
+
- `.rs`, `Cargo.toml`, `Cargo.lock`, workspace config, feature flags, public exports, traits, error types, tests, examples, benches, FFI, async runtime, or unsafe code change.
|
|
37
|
+
- The task touches ownership, borrowing, lifetimes, `Clone`, `Arc`, `Mutex`, `unwrap`, or public crate compatibility.
|
|
38
|
+
|
|
39
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
40
|
+
## Do Not Use When
|
|
41
|
+
|
|
42
|
+
- Rust files are read-only context and no Rust surface changes.
|
|
43
|
+
- A generated Rust file should be regenerated by a declared command rather than edited.
|
|
44
|
+
|
|
45
|
+
<!-- mustflow-section: required-inputs -->
|
|
46
|
+
## Required Inputs
|
|
47
|
+
|
|
48
|
+
- `Cargo.toml`, workspace manifests, lockfile policy, toolchain config, rustfmt, clippy, feature flags, docs.rs metadata, optional dependencies, and CI hints.
|
|
49
|
+
- Relevant `src/lib.rs`, `src/main.rs`, modules, public re-exports, tests, examples, and docs examples.
|
|
50
|
+
- Existing error handling convention and async runtime.
|
|
51
|
+
- Public crate status, minimum supported Rust version, feature support policy, and downstream compatibility expectations when available.
|
|
52
|
+
- Configured verification intents.
|
|
53
|
+
|
|
54
|
+
<!-- mustflow-section: preconditions -->
|
|
55
|
+
## Preconditions
|
|
56
|
+
|
|
57
|
+
- Determine whether the change affects ownership flow, public API, feature gates, optional dependencies, error contract, async runtime, or unsafe invariants.
|
|
58
|
+
- Read local patterns before adding traits, lifetimes, clones, locks, boxed errors, feature bounds, or `Send + Sync + 'static` constraints.
|
|
59
|
+
- Treat `clone`, `Arc<Mutex<_>>`, explicit lifetimes, `'static`, `Box<dyn Error>`, `unwrap`, feature changes, and `unsafe` as suspicious until their contract impact is justified.
|
|
60
|
+
|
|
61
|
+
<!-- mustflow-section: allowed-edits -->
|
|
62
|
+
## Allowed Edits
|
|
63
|
+
|
|
64
|
+
- Prefer truthful ownership and borrowing over broad cloning.
|
|
65
|
+
- Follow the crate's existing application-versus-library error convention.
|
|
66
|
+
- Keep feature-gated code and public re-exports synchronized.
|
|
67
|
+
- Touch unsafe code only with explicit invariants preserved in nearby comments.
|
|
68
|
+
- Add feature, async, or unsafe verification notes when configured command intents are missing.
|
|
69
|
+
|
|
70
|
+
<!-- mustflow-section: procedure -->
|
|
71
|
+
## Procedure
|
|
72
|
+
|
|
73
|
+
1. Read Cargo metadata, features, optional dependencies, docs.rs metadata, toolchain config, public exports, relevant modules, and tests.
|
|
74
|
+
2. Classify the change as ownership, API, error, feature, async, unsafe, dependency, or test-only.
|
|
75
|
+
3. Resolve ownership problems in this order: identify the real owner, shrink borrow scopes, fix function signatures to accept references or slices when ownership is unnecessary, distinguish transfer from sharing, then consider clone or shared ownership only when the semantics require it.
|
|
76
|
+
4. Before adding `clone`, verify it is a cheap handle clone such as `Arc`, `Rc`, or `Bytes`, a small intentional value clone, or a true independent ownership split. Reject large collection clones, loop clones, clone-then-borrow code, and whole-state clones made only to satisfy `spawn`.
|
|
77
|
+
5. Before adding `Arc<Mutex<_>>`, verify multiple owners truly need shared mutable state. Keep critical sections short, document lock order when relevant, and do not hold a lock guard across `.await`, I/O, callbacks, or user code.
|
|
78
|
+
6. Use explicit lifetimes only to describe real borrow relationships. Do not add `'static` or `T: 'static` to public APIs merely because an internal task boundary requires it.
|
|
79
|
+
7. Use concrete error enums for library APIs when callers need to classify failures. Keep `Box<dyn Error>` mostly to binaries, examples, tests, prototypes, or explicitly opaque error policies.
|
|
80
|
+
8. Avoid `unwrap` and vague `expect` in production paths. They are allowed only for tests, examples, startup policy, or invariants already proven by nearby code.
|
|
81
|
+
9. If feature flags change, treat default features, no-default builds, all-features builds, optional dependency implicit features, public re-exports, docs examples, and feature-gated trait impls as compatibility surfaces. Features should be additive.
|
|
82
|
+
10. Treat public re-exports, public dependency types, generic bounds, trait item sets, error enum variants, `#[non_exhaustive]`, and MSRV as public API. Tightened bounds, added required trait methods, removed re-exports, or changed error variants require compatibility review.
|
|
83
|
+
11. Do not mix async runtimes. A Tokio crate should not casually gain `async-std` or runtime-specific APIs in library core. Do not call blocking I/O or CPU-heavy work in async paths without an established boundary such as async-native APIs, a blocking pool, or a dedicated worker.
|
|
84
|
+
12. For async spawning, avoid leaking internal `Send + Sync + 'static` requirements into public APIs. Prefer owned task state, smaller spawn boundaries, local task structures, or caller-owned runtime decisions.
|
|
85
|
+
13. Touch `unsafe` only when a safe design cannot express the required behavior. Every unsafe block needs a nearby `SAFETY:` explanation; every public `unsafe fn` needs `# Safety` docs. Keep unsafe scopes small and wrap them in safe abstractions only when callers have no hidden safety obligations.
|
|
86
|
+
14. For FFI, keep Rust ABI types out of C boundaries. Use explicit ownership, `#[repr(C)]` where required, raw pointer plus length pairs, `CStr`/`CString`, RAII wrappers, null handling, panic boundaries, and documented thread-safety evidence before manual `Send` or `Sync`.
|
|
87
|
+
15. Choose configured verification intents that cover format, lint, build, tests, feature combinations, docs, public API, unsafe, and FFI risk when available.
|
|
88
|
+
|
|
89
|
+
<!-- mustflow-section: rejection-criteria -->
|
|
90
|
+
## Review Rejection Criteria
|
|
91
|
+
|
|
92
|
+
Reject or revise the patch when any of these appear without strong local justification:
|
|
93
|
+
|
|
94
|
+
- New large `clone()` calls, clone-then-borrow code, loop clones, or state clones used only to appease ownership errors.
|
|
95
|
+
- New `Arc<Mutex<AppState>>`-style shared bags, locks held across `.await`, or async I/O resources shared mainly by mutex.
|
|
96
|
+
- New public `'static`, `Send`, or `Sync` bounds that exist only because an internal task was spawned.
|
|
97
|
+
- New public `Box<dyn Error>` in a library where callers need typed failures.
|
|
98
|
+
- New production `unwrap` or vague `expect` on I/O, parse, environment, network, FFI, lock, or user input paths.
|
|
99
|
+
- Feature changes that remove APIs, change type meaning, rename features, expose internal optional dependency names, or fail default/no-default/all-features reasoning.
|
|
100
|
+
- Public dependency types, re-exports, trait bounds, trait methods, or error enum variants changed without semver review.
|
|
101
|
+
- Async runtime mixing, blocking I/O in async paths, or runtime ownership moved into a library core without a clear boundary.
|
|
102
|
+
- Unsafe blocks without `SAFETY:` comments, unsafe functions without `# Safety`, undocumented manual `Send`/`Sync`, or FFI that exposes Rust layout types across C ABI.
|
|
103
|
+
|
|
104
|
+
<!-- mustflow-section: postconditions -->
|
|
105
|
+
## Postconditions
|
|
106
|
+
|
|
107
|
+
- Ownership changes are intentional, not compiler appeasement.
|
|
108
|
+
- Public API, features, optional dependencies, and error contracts are synchronized.
|
|
109
|
+
- Async runtime ownership is preserved and blocking work is isolated.
|
|
110
|
+
- Unsafe and FFI invariants are preserved or no unsafe code was touched.
|
|
111
|
+
- Missing feature, semver, docs, unsafe, or FFI verification is reported.
|
|
112
|
+
|
|
113
|
+
<!-- mustflow-section: verification -->
|
|
114
|
+
## Verification
|
|
115
|
+
|
|
116
|
+
Use configured oneshot command intents when available:
|
|
117
|
+
|
|
118
|
+
- `lint`
|
|
119
|
+
- `build`
|
|
120
|
+
- `test_related`
|
|
121
|
+
- `test`
|
|
122
|
+
- `docs_validate_fast`
|
|
123
|
+
- `mustflow_check`
|
|
124
|
+
|
|
125
|
+
Report whether configured feature-combination, documentation, semver, Miri, sanitizer, and downstream-style verification exists when those surfaces change.
|
|
126
|
+
|
|
127
|
+
When configured intents exist for these risks, prefer coverage equivalent to:
|
|
128
|
+
|
|
129
|
+
- formatting and linting
|
|
130
|
+
- workspace checks and tests
|
|
131
|
+
- default, no-default, all-features, and relevant feature combinations
|
|
132
|
+
- doctests and docs build for public crates
|
|
133
|
+
- public API or semver compatibility checks for published crates
|
|
134
|
+
- Miri or sanitizer-style checks for unsafe, raw pointer, FFI, or manual concurrency primitives
|
|
135
|
+
|
|
136
|
+
<!-- mustflow-section: failure-handling -->
|
|
137
|
+
## Failure Handling
|
|
138
|
+
|
|
139
|
+
- If borrow-checker fixes produce broad clones or locks, revisit ownership boundaries before proceeding.
|
|
140
|
+
- If feature-gated code cannot be verified, report the specific unverified feature surface.
|
|
141
|
+
- If public API compatibility cannot be verified, report the exact exported symbols, trait bounds, feature gates, or errors at risk.
|
|
142
|
+
- If async runtime or blocking boundaries are unclear, stop that part and inspect the runtime ownership before editing further.
|
|
143
|
+
- If unsafe invariants are unclear, stop that part and request or inspect stronger evidence.
|
|
144
|
+
|
|
145
|
+
<!-- mustflow-section: output-format -->
|
|
146
|
+
## Output Format
|
|
147
|
+
|
|
148
|
+
- Boundary checked
|
|
149
|
+
- Ownership, feature, async, or unsafe impact
|
|
150
|
+
- Public API or error impact
|
|
151
|
+
- Files changed
|
|
152
|
+
- Command intents run
|
|
153
|
+
- Skipped checks and reasons
|
|
154
|
+
- Remaining Rust risk
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.svelte-code-change
|
|
3
|
+
locale: en
|
|
4
|
+
canonical: true
|
|
5
|
+
revision: 2
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: svelte-code-change
|
|
9
|
+
description: Apply this skill when Svelte or SvelteKit components, routes, load functions, server actions, endpoints, stores, context, runes, SSR boundaries, server-only imports, accessibility warnings, 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.svelte-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
|
+
# Svelte Code Change
|
|
27
|
+
|
|
28
|
+
<!-- mustflow-section: purpose -->
|
|
29
|
+
## Purpose
|
|
30
|
+
|
|
31
|
+
Preserve Svelte component reactivity, SvelteKit SSR/server/client boundaries, data secrecy, load/action/endpoint contracts, request-scoped state ownership, accessibility, and generated route behavior. Choose files by data boundary first, not by filename habit.
|
|
32
|
+
|
|
33
|
+
<!-- mustflow-section: use-when -->
|
|
34
|
+
## Use When
|
|
35
|
+
|
|
36
|
+
- `.svelte`, `+page`, `+layout`, `+page.server`, `+layout.server`, `+server`, load functions, form actions, endpoints, stores, context, runes, `$app` imports, `$lib/server`, hooks, route params, or Svelte tests change.
|
|
37
|
+
- The task touches state management, SSR errors, browser APIs, forms, routing, progressive enhancement, request-local data, server-only imports, private/public environment variables, or Svelte 5 runes.
|
|
38
|
+
|
|
39
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
40
|
+
## Do Not Use When
|
|
41
|
+
|
|
42
|
+
- The change is plain CSS or HTML with no Svelte or SvelteKit behavior; use the relevant UI foundation skill.
|
|
43
|
+
- The service code is framework-free and no Svelte boundary changes.
|
|
44
|
+
|
|
45
|
+
<!-- mustflow-section: required-inputs -->
|
|
46
|
+
## Required Inputs
|
|
47
|
+
|
|
48
|
+
- Package metadata, Svelte config, Vite config, TypeScript config, route segment files, hooks, app types, stores/runes/context, form schema, and tests.
|
|
49
|
+
- Svelte version, route data source, secrecy, request scope, mutation type, serialization requirement, SSR/client boundary, browser dependency, and state owner.
|
|
50
|
+
- Imports from `$lib/server`, `*.server.*`, `$env/static/private`, `$env/dynamic/private`, DB/filesystem/server SDK modules, cookies, auth headers, and `event.locals`.
|
|
51
|
+
- Configured verification intents.
|
|
52
|
+
|
|
53
|
+
<!-- mustflow-section: preconditions -->
|
|
54
|
+
## Preconditions
|
|
55
|
+
|
|
56
|
+
- For route work, read the sibling `+layout`, `+page`, `+page.server`, and `+server` files as one boundary.
|
|
57
|
+
- Classify every data access by origin, secrecy, request scope, mutation, browser dependency, and serialization before choosing a SvelteKit file.
|
|
58
|
+
- Treat all route files as potentially server-executed until proven otherwise.
|
|
59
|
+
|
|
60
|
+
<!-- mustflow-section: allowed-edits -->
|
|
61
|
+
## Allowed Edits
|
|
62
|
+
|
|
63
|
+
- Keep secrets, private environment, database clients, and cookie-authenticated data in server-only files.
|
|
64
|
+
- Use browser APIs only behind client-safe lifecycle or environment guards.
|
|
65
|
+
- Keep state local unless shared ownership is justified.
|
|
66
|
+
- Preserve form actions and progressive enhancement instead of replacing all forms with client-only fetch.
|
|
67
|
+
- Use context for request-scoped component-tree sharing instead of module singletons.
|
|
68
|
+
- Use `$derived` for computed display values and `$effect` only for browser-side effects and cleanup.
|
|
69
|
+
|
|
70
|
+
<!-- mustflow-section: procedure -->
|
|
71
|
+
## Procedure
|
|
72
|
+
|
|
73
|
+
1. Read route segment files, parent layouts, stores/runes/context, hooks, app types, and tests.
|
|
74
|
+
2. Identify Svelte version and whether the code uses runes or legacy reactivity.
|
|
75
|
+
3. Before choosing a file, classify every data access with: origin, secrecy, request scope, mutation, browser dependency, and serialization.
|
|
76
|
+
4. If data requires DB, filesystem, private env, cookies, auth headers, `event.locals`, server SDKs, or request-local identity, keep it in server-only code: `+page.server`, `+layout.server`, `+server`, `hooks.server`, or `$lib/server`.
|
|
77
|
+
5. If data is public and can be safely fetched by the browser without secrets, universal load is allowed.
|
|
78
|
+
6. If the operation is a page form mutation, prefer `+page.server` actions over a custom JSON endpoint.
|
|
79
|
+
7. If the operation is a public HTTP API, webhook, mobile API, stream, file response, or non-page endpoint, use `+server`.
|
|
80
|
+
8. If the value is UI-only state such as modal open, selected tab, draft input, accordion state, hover state, or local editing state, keep it in component `$state` or local context.
|
|
81
|
+
9. If a value is computed from reactive inputs, use `$derived`. Do not use `$effect` to copy or synchronize derived state.
|
|
82
|
+
10. Use `$effect`, lifecycle hooks, event handlers, actions, or dynamic imports for browser-only APIs and browser-only libraries. Do not touch `window`, `document`, `localStorage`, `matchMedia`, canvas, or browser-only imports in SSR top-level code.
|
|
83
|
+
11. Keep request-specific user/session/auth state out of module-level mutable variables, global stores, exported `$state`, and load/action side effects.
|
|
84
|
+
12. Do not write to stores from load functions.
|
|
85
|
+
13. Keep server load return values intentionally serializable and minimal. Do not pass secrets, raw sessions, tokens, hidden DB fields, or whole service responses to the browser.
|
|
86
|
+
14. Prefer `$app/state` over legacy `$app/stores` in SvelteKit projects that use the newer SvelteKit state API.
|
|
87
|
+
15. Do not hide SSR errors by disabling SSR unless the user explicitly accepts that product and architecture change.
|
|
88
|
+
16. Treat accessibility compiler warnings as real findings unless a local false-positive reason is documented.
|
|
89
|
+
|
|
90
|
+
<!-- mustflow-section: data-boundary-policy -->
|
|
91
|
+
## Data Boundary Policy
|
|
92
|
+
|
|
93
|
+
- Public route params and public query values may live in universal load until they drive private DB/API access.
|
|
94
|
+
- Public external APIs and public CMS data may live in universal load only when the browser may call them directly without secrets.
|
|
95
|
+
- DB, filesystem, private env, server SDKs, cookies, auth headers, sessions, and `event.locals` belong in server-only files.
|
|
96
|
+
- User-specific data must be read server-side and narrowed before being serialized into `data`.
|
|
97
|
+
- Page forms should use form actions by default.
|
|
98
|
+
- External clients, webhooks, mobile apps, streaming responses, and custom HTTP responses belong in `+server`.
|
|
99
|
+
- Browser-only values belong in component effects, event handlers, dynamic imports, or browser actions.
|
|
100
|
+
|
|
101
|
+
<!-- mustflow-section: route-boundary-policy -->
|
|
102
|
+
## Route Boundary Policy
|
|
103
|
+
|
|
104
|
+
- `+page.ts` and `+layout.ts` are universal. They may run on the server and in the browser.
|
|
105
|
+
- `+page.server.ts` and `+layout.server.ts` are for server-only page data.
|
|
106
|
+
- `+page.server.ts` actions are for page-owned form mutations.
|
|
107
|
+
- `+server.ts` is for HTTP endpoints, webhooks, non-page APIs, streams, files, and custom responses.
|
|
108
|
+
- Do not create a JSON endpoint for a normal page form unless there is a non-page consumer.
|
|
109
|
+
- Do not wrap server-only imports in browser guards. Fix the import graph.
|
|
110
|
+
|
|
111
|
+
<!-- mustflow-section: runes-state-policy -->
|
|
112
|
+
## Runes And State Policy
|
|
113
|
+
|
|
114
|
+
- Use `$state` for local interactive UI state.
|
|
115
|
+
- Use `$derived` for calculations from props, route data, page state, or local state.
|
|
116
|
+
- Use `$effect` only for browser-side effects, subscriptions, DOM, canvas, analytics, third-party browser libraries, and cleanup.
|
|
117
|
+
- Use stores for external streams or manual subscribe/unsubscribe interop, not ordinary component state.
|
|
118
|
+
- Use context for parent-owned values shared down the component tree, especially request-scoped layout data.
|
|
119
|
+
- Do not reassign reactive context objects after placing them in context; update their properties or pass getter functions when needed.
|
|
120
|
+
|
|
121
|
+
<!-- mustflow-section: ssr-debug-policy -->
|
|
122
|
+
## SSR Debug Policy
|
|
123
|
+
|
|
124
|
+
When SSR breaks, inspect in this order:
|
|
125
|
+
|
|
126
|
+
1. Private env imports.
|
|
127
|
+
2. `$lib/server`, `*.server.*`, DB, filesystem, admin SDK, or server-only import chains.
|
|
128
|
+
3. Request-local state stored in module singletons, stores, or exported `$state`.
|
|
129
|
+
4. Browser API access at module top-level or during SSR render.
|
|
130
|
+
5. Hydration mismatch from time, randomness, locale, timezone, localStorage, or browser-only initial state.
|
|
131
|
+
6. Route-level SSR disabling only after the product accepts an SPA-like shell.
|
|
132
|
+
|
|
133
|
+
<!-- mustflow-section: hard-bans -->
|
|
134
|
+
## Hard Bans
|
|
135
|
+
|
|
136
|
+
- Do not add route-level SSR disabling to fix `window is not defined`.
|
|
137
|
+
- Do not move required first-render page data into lifecycle hooks or `$effect`.
|
|
138
|
+
- Do not import `$lib/server`, `*.server.*`, private env modules, DB clients, filesystem, or admin SDKs from universal/client route files or shared client utilities.
|
|
139
|
+
- Do not mutate module-scope variables, global stores, or exported `$state` with user/session/request data during SSR, load, or actions.
|
|
140
|
+
- Do not use `$effect` to compute derived values.
|
|
141
|
+
- Do not put browser-only library imports at top level when the package touches browser globals during import.
|
|
142
|
+
- Do not serialize secrets, raw sessions, access tokens, hidden DB fields, or whole service responses through load data.
|
|
143
|
+
|
|
144
|
+
<!-- mustflow-section: postconditions -->
|
|
145
|
+
## Postconditions
|
|
146
|
+
|
|
147
|
+
- Server/client and SSR boundaries are explicit.
|
|
148
|
+
- State owner and derived/effect behavior are clear.
|
|
149
|
+
- Forms remain progressive unless intentionally changed.
|
|
150
|
+
- Private data stays server-only and serialized data is intentionally minimal.
|
|
151
|
+
- Request-scoped sharing uses load data, props, or context instead of module singletons.
|
|
152
|
+
- Accessibility warnings are resolved or justified.
|
|
153
|
+
|
|
154
|
+
<!-- mustflow-section: verification -->
|
|
155
|
+
## Verification
|
|
156
|
+
|
|
157
|
+
Use configured oneshot command intents when available:
|
|
158
|
+
|
|
159
|
+
- `lint`
|
|
160
|
+
- `build`
|
|
161
|
+
- `test_related`
|
|
162
|
+
- `test`
|
|
163
|
+
- `docs_validate_fast`
|
|
164
|
+
- `mustflow_check`
|
|
165
|
+
|
|
166
|
+
Report missing Svelte check, SSR render, form action, or browser verification intents when relevant.
|
|
167
|
+
|
|
168
|
+
<!-- mustflow-section: failure-handling -->
|
|
169
|
+
## Failure Handling
|
|
170
|
+
|
|
171
|
+
- If a browser API breaks SSR, move it to a client-safe boundary instead of disabling SSR by default.
|
|
172
|
+
- If data source ownership is unclear, inspect route server files and hooks before editing.
|
|
173
|
+
- If accessibility warnings require an ignore, include the specific reason in the code or report.
|
|
174
|
+
- If server-only imports leak into universal/client files, move the boundary instead of adding runtime guards.
|
|
175
|
+
- If request-local data is stored globally, move it to server load, actions, context, or persistent storage with user scoping.
|
|
176
|
+
|
|
177
|
+
<!-- mustflow-section: output-format -->
|
|
178
|
+
## Output Format
|
|
179
|
+
|
|
180
|
+
- Boundary checked
|
|
181
|
+
- SSR/server/client and state notes
|
|
182
|
+
- Form/action/accessibility impact
|
|
183
|
+
- Files changed
|
|
184
|
+
- Command intents run
|
|
185
|
+
- Skipped checks and reasons
|
|
186
|
+
- Remaining Svelte risk
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.tailwind-code-change
|
|
3
|
+
locale: en
|
|
4
|
+
canonical: true
|
|
5
|
+
revision: 2
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: tailwind-code-change
|
|
9
|
+
description: Apply this skill when Tailwind classes, className composition, static class detection, theme tokens, variants, safelists, arbitrary values, Tailwind config, @theme, @apply, or Tailwind migration surfaces are created or changed.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.tailwind-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
|
+
# Tailwind Code Change
|
|
27
|
+
|
|
28
|
+
<!-- mustflow-section: purpose -->
|
|
29
|
+
## Purpose
|
|
30
|
+
|
|
31
|
+
Preserve Tailwind static class detection, design tokens, bounded variants, responsive/state behavior, accessibility states, and production build output. Treat Tailwind utilities as build-time tokens, not runtime strings.
|
|
32
|
+
|
|
33
|
+
<!-- mustflow-section: use-when -->
|
|
34
|
+
## Use When
|
|
35
|
+
|
|
36
|
+
- Tailwind `class`, `className`, `@apply`, `@theme`, config, source scanning, safelist, theme tokens, variants, arbitrary values, or component class composition change.
|
|
37
|
+
- The task touches Tailwind v3/v4 migration, token addition, responsive modifiers, state modifiers, `clsx`/`cn`, CVA-style variant helpers, `@source`, or production CSS generation risk.
|
|
38
|
+
- Component APIs accept status, tone, intent, size, column count, color, spacing, or class-related props that affect Tailwind utilities.
|
|
39
|
+
|
|
40
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
41
|
+
## Do Not Use When
|
|
42
|
+
|
|
43
|
+
- Styling is plain CSS without Tailwind utilities; use `css-code-change`.
|
|
44
|
+
- Utility generation is UnoCSS, not Tailwind; use `unocss-code-change`.
|
|
45
|
+
|
|
46
|
+
<!-- mustflow-section: required-inputs -->
|
|
47
|
+
## Required Inputs
|
|
48
|
+
|
|
49
|
+
- Tailwind version/config or CSS entry, content/source scanning rules, theme tokens, PostCSS/build config, class merge helpers, variant helpers, component patterns, and tests.
|
|
50
|
+
- Existing design system vocabulary, token naming conventions, accessibility state patterns, and component prop APIs.
|
|
51
|
+
- Any runtime source for visual values: props, CMS, database, tenant config, user input, API data, or external package markup.
|
|
52
|
+
- Configured verification intents.
|
|
53
|
+
|
|
54
|
+
<!-- mustflow-section: preconditions -->
|
|
55
|
+
## Preconditions
|
|
56
|
+
|
|
57
|
+
- Confirm how Tailwind detects source classes before changing class composition.
|
|
58
|
+
- Identify whether the project is using Tailwind v3 config safelists or Tailwind v4 CSS source directives.
|
|
59
|
+
- Identify tokens, variant helpers, and semantic visual states before adding arbitrary values or raw colors.
|
|
60
|
+
- Confirm whether affected components are local one-offs, shared components, or public design-system surfaces.
|
|
61
|
+
|
|
62
|
+
<!-- mustflow-section: allowed-edits -->
|
|
63
|
+
## Allowed Edits
|
|
64
|
+
|
|
65
|
+
- Use full static class strings that the build can detect.
|
|
66
|
+
- Use existing theme tokens before arbitrary values or raw colors.
|
|
67
|
+
- Use static maps, component extraction, or variant helpers for finite repeated variants.
|
|
68
|
+
- Use safelists only for finite class candidates that cannot appear in scanned source.
|
|
69
|
+
- Use inline styles plus CSS variables for unbounded runtime values such as tenant, database, or user-provided colors.
|
|
70
|
+
- Keep hover, focus-visible, disabled, aria/data, dark, and motion variants aligned with existing component behavior.
|
|
71
|
+
|
|
72
|
+
<!-- mustflow-section: procedure -->
|
|
73
|
+
## Procedure
|
|
74
|
+
|
|
75
|
+
1. Read Tailwind config or CSS entry, scanning rules, theme tokens, helpers, and nearby components.
|
|
76
|
+
2. Classify the change: token, utility usage, dynamic variant, component extraction, responsive state, accessibility state, or migration.
|
|
77
|
+
3. Treat every Tailwind class as a complete build-time token. Reject runtime interpolation, concatenation, array joins, or fragment assembly for utilities such as color, spacing, grid count, span, tone, or arbitrary values.
|
|
78
|
+
4. For finite choices, use a static map with semantic keys and full class strings. Good keys describe UI meaning such as `danger`, `muted`, `compact`, or `featured`; bad keys store Tailwind fragments such as `red`, `600`, or `cols-3` for later assembly.
|
|
79
|
+
5. Use a CVA-style variant helper only when a shared component has multiple variant axes, defaults, or compound variants. The helper must still contain full static class strings.
|
|
80
|
+
6. Use safelists only as a last resort for finite candidates that cannot be present in source files. Tailwind v4 projects should express this through the project's CSS source policy; Tailwind v3 maintenance projects may use config safelists when that is the existing pattern. Do not safelist broad palettes or unbounded ranges to avoid fixing a bad component API.
|
|
81
|
+
7. Use inline style plus a CSS variable bridge for unbounded runtime values from databases, APIs, tenants, CMS content, or user input. Do not try to mint Tailwind class names from unbounded values.
|
|
82
|
+
8. Treat arbitrary values as escape hatches. Allow them for one-off asset alignment, complex grid templates, complex calculations, local CSS variable assignment, or values that cannot be expressed with regular utilities.
|
|
83
|
+
9. Reject arbitrary raw colors in component markup, arbitrary spacing that approximates existing scale values, arbitrary container widths, arbitrary radius or shadow used as a hidden token, and repeated arbitrary values. Repeated values must be promoted to a semantic design token or component variant.
|
|
84
|
+
10. Keep raw color literals in theme or token files only. Token names should describe purpose, not numeric value.
|
|
85
|
+
11. Use `clsx` or `cn` only to combine complete class strings. Do not hide dynamic Tailwind string construction inside helper functions.
|
|
86
|
+
12. Do not expose unrestricted class fragments through public component APIs. If a `className` passthrough exists, preserve internal layout-critical classes and prevent consumer props from becoming the source of required Tailwind generation.
|
|
87
|
+
13. Do not extract a component only because a class list is long. Extract a component when structure, behavior, accessibility, and styling repeat together across files.
|
|
88
|
+
14. Do not use `@apply` to hide long JSX or template class lists. Reserve `@apply` for third-party markup overrides, CSS-module boundaries, or template systems where component extraction is genuinely heavier.
|
|
89
|
+
15. Use mobile-first responsive classes and include focus-visible or equivalent keyboard states for interactive elements.
|
|
90
|
+
16. Check for conflicting utilities on one element, such as mutually exclusive display, spacing, text-size, or layout utilities.
|
|
91
|
+
17. Choose configured verification intents that cover production build, lint, component tests, accessibility states, and visual risk when available.
|
|
92
|
+
|
|
93
|
+
<!-- mustflow-section: generation-policy -->
|
|
94
|
+
## Generation Policy
|
|
95
|
+
|
|
96
|
+
- Tailwind classes must appear as complete static strings in scanned source, a static variant map, a CVA-style variant declaration, or an explicit finite safelist.
|
|
97
|
+
- Dynamic visual state must be represented by exactly one of: static map entry, variant helper entry, explicit safelist entry, or CSS variable bridge.
|
|
98
|
+
- Status, tone, intent, size, density, and column props are closed sets until proven otherwise. Model them as finite typed variants, not string fragments.
|
|
99
|
+
- Production CSS is the contract. If a class only exists after runtime string construction, assume production CSS may omit it.
|
|
100
|
+
|
|
101
|
+
<!-- mustflow-section: token-policy -->
|
|
102
|
+
## Token Policy
|
|
103
|
+
|
|
104
|
+
- Use existing tokens and approved utilities first.
|
|
105
|
+
- Add a design token when a value repeats, has product meaning, appears in more than one component, supports theming, or has a designer-owned name.
|
|
106
|
+
- Do not add value-named tokens such as pixel-width or random-color names. Name tokens by role, surface, status, container, spacing purpose, or component meaning.
|
|
107
|
+
- Keep component markup free of raw hex, RGB, OKLCH, arbitrary color, and arbitrary shadow values unless the file is itself a token/theme definition.
|
|
108
|
+
|
|
109
|
+
<!-- mustflow-section: review-rejection-criteria -->
|
|
110
|
+
## Review Rejection Criteria
|
|
111
|
+
|
|
112
|
+
Reject the change when:
|
|
113
|
+
|
|
114
|
+
- A Tailwind utility is assembled from runtime fragments.
|
|
115
|
+
- A raw color appears outside a token or theme file.
|
|
116
|
+
- An arbitrary value appears without a narrow reason.
|
|
117
|
+
- The same arbitrary value appears in more than one place.
|
|
118
|
+
- A wrapper component exists only to hide a one-off class list.
|
|
119
|
+
- `@apply` hides component-specific styling instead of handling a CSS boundary.
|
|
120
|
+
- A public component exposes unconstrained Tailwind class fragments.
|
|
121
|
+
- A safelist covers broad palettes, broad numeric ranges, or unknown runtime values.
|
|
122
|
+
- Conflicting utilities are present on the same element.
|
|
123
|
+
|
|
124
|
+
<!-- mustflow-section: postconditions -->
|
|
125
|
+
## Postconditions
|
|
126
|
+
|
|
127
|
+
- All generated utilities are visible to Tailwind's detector, a static map, a variant helper, or an intentional finite safelist.
|
|
128
|
+
- Arbitrary values are rare, justified, and not repeated without token promotion.
|
|
129
|
+
- Runtime visual values are constrained by semantic variants or bridged through CSS variables.
|
|
130
|
+
- Interactive states include keyboard and disabled behavior where relevant.
|
|
131
|
+
- Production-build class loss risk is checked or reported.
|
|
132
|
+
|
|
133
|
+
<!-- mustflow-section: verification -->
|
|
134
|
+
## Verification
|
|
135
|
+
|
|
136
|
+
Use configured oneshot command intents when available:
|
|
137
|
+
|
|
138
|
+
- `lint`
|
|
139
|
+
- `build`
|
|
140
|
+
- `test_related`
|
|
141
|
+
- `test`
|
|
142
|
+
- `docs_validate_fast`
|
|
143
|
+
- `mustflow_check`
|
|
144
|
+
|
|
145
|
+
Report missing production CSS or visual verification intents when relevant.
|
|
146
|
+
|
|
147
|
+
<!-- mustflow-section: failure-handling -->
|
|
148
|
+
## Failure Handling
|
|
149
|
+
|
|
150
|
+
- If production styling disappears, inspect dynamic class generation and source scanning first.
|
|
151
|
+
- If arbitrary values accumulate, stop and consider whether the design token system is missing a token.
|
|
152
|
+
- If helper utilities erase class visibility, rewrite to static maps or report the build risk.
|
|
153
|
+
- If a component API requires arbitrary Tailwind fragments, narrow it to semantic variants or report the public API risk.
|
|
154
|
+
|
|
155
|
+
<!-- mustflow-section: output-format -->
|
|
156
|
+
## Output Format
|
|
157
|
+
|
|
158
|
+
- Boundary checked
|
|
159
|
+
- Class detection and token notes
|
|
160
|
+
- Responsive and accessibility state notes
|
|
161
|
+
- Files changed
|
|
162
|
+
- Command intents run
|
|
163
|
+
- Skipped checks and reasons
|
|
164
|
+
- Remaining Tailwind risk
|