mustflow 2.22.16 → 2.22.46

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 (67) hide show
  1. package/dist/cli/commands/dashboard.js +51 -4
  2. package/dist/cli/commands/explain.js +3 -2
  3. package/dist/cli/commands/help.js +0 -1
  4. package/dist/cli/commands/run.js +51 -4
  5. package/dist/cli/commands/verify.js +2 -1
  6. package/dist/cli/i18n/en.js +5 -0
  7. package/dist/cli/i18n/es.js +5 -0
  8. package/dist/cli/i18n/fr.js +5 -0
  9. package/dist/cli/i18n/hi.js +5 -0
  10. package/dist/cli/i18n/ko.js +5 -0
  11. package/dist/cli/i18n/zh.js +5 -0
  12. package/dist/cli/lib/cli-output.js +1 -1
  13. package/dist/cli/lib/dashboard-html/client-script.js +9 -0
  14. package/dist/cli/lib/dashboard-html/styles.js +48 -1
  15. package/dist/cli/lib/doc-review-ledger.js +1 -1
  16. package/dist/cli/lib/git-changes.js +2 -0
  17. package/dist/cli/lib/local-index/index.js +324 -298
  18. package/dist/cli/lib/repo-map.js +19 -5
  19. package/dist/cli/lib/run-plan.js +20 -7
  20. package/dist/cli/lib/run-root-trust.js +33 -2
  21. package/dist/cli/lib/validation/index.js +6 -2
  22. package/dist/cli/lib/validation/test-selection.js +11 -1
  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/command-intent-eligibility.js +7 -0
  27. package/dist/core/contract-lint.js +3 -3
  28. package/dist/core/line-endings.js +2 -0
  29. package/dist/core/repeated-failure.js +1 -1
  30. package/dist/core/run-write-drift.js +42 -26
  31. package/dist/core/safe-filesystem.js +54 -5
  32. package/dist/core/skill-route-explanation.js +2 -1
  33. package/dist/core/source-anchors.js +7 -3
  34. package/dist/core/test-selection.js +13 -2
  35. package/dist/core/test-target-paths.js +17 -0
  36. package/dist/core/validation-ratchet.js +62 -17
  37. package/dist/core/verification-decision-graph.js +8 -1
  38. package/package.json +1 -1
  39. package/templates/default/i18n.toml +141 -3
  40. package/templates/default/locales/en/.mustflow/skills/INDEX.md +24 -1
  41. package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +212 -0
  42. package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +184 -0
  43. package/templates/default/locales/en/.mustflow/skills/auth-permission-change/SKILL.md +194 -0
  44. package/templates/default/locales/en/.mustflow/skills/config-env-change/SKILL.md +189 -0
  45. package/templates/default/locales/en/.mustflow/skills/css-code-change/SKILL.md +199 -0
  46. package/templates/default/locales/en/.mustflow/skills/dart-code-change/SKILL.md +179 -0
  47. package/templates/default/locales/en/.mustflow/skills/database-migration-change/SKILL.md +178 -0
  48. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +151 -0
  49. package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +115 -0
  50. package/templates/default/locales/en/.mustflow/skills/file-path-cross-platform-change/SKILL.md +147 -0
  51. package/templates/default/locales/en/.mustflow/skills/flutter-code-change/SKILL.md +116 -0
  52. package/templates/default/locales/en/.mustflow/skills/go-code-change/SKILL.md +156 -0
  53. package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +117 -0
  54. package/templates/default/locales/en/.mustflow/skills/html-code-change/SKILL.md +173 -0
  55. package/templates/default/locales/en/.mustflow/skills/javascript-code-change/SKILL.md +149 -0
  56. package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +154 -0
  57. package/templates/default/locales/en/.mustflow/skills/release-publish-change/SKILL.md +172 -0
  58. package/templates/default/locales/en/.mustflow/skills/routes.toml +138 -0
  59. package/templates/default/locales/en/.mustflow/skills/rust-code-change/SKILL.md +154 -0
  60. package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +22 -7
  61. package/templates/default/locales/en/.mustflow/skills/security-regression-tests/SKILL.md +31 -20
  62. package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +186 -0
  63. package/templates/default/locales/en/.mustflow/skills/tailwind-code-change/SKILL.md +164 -0
  64. package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +185 -0
  65. package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +184 -0
  66. package/templates/default/locales/en/.mustflow/skills/unocss-code-change/SKILL.md +186 -0
  67. package/templates/default/manifest.toml +158 -1
@@ -0,0 +1,147 @@
1
+ ---
2
+ mustflow_doc: skill.file-path-cross-platform-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: file-path-cross-platform-change
9
+ description: Apply this skill when file path handling, cross-platform path behavior, path helpers, safe filesystem wrappers, temp or cache paths, atomic writes, locks, archive extraction, uploads, downloads, scanners, CLI/API/schema path contracts, snapshots, generated outputs, or package artifact paths are created, changed, reviewed, or reported.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.file-path-cross-platform-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
+ - test_release
24
+ - mustflow_check
25
+ ---
26
+
27
+ # File Path Cross-Platform Change
28
+
29
+ <!-- mustflow-section: purpose -->
30
+ ## Purpose
31
+
32
+ Treat file paths as security boundaries and operating-system contracts, not as ordinary strings.
33
+
34
+ <!-- mustflow-section: use-when -->
35
+ ## Use When
36
+
37
+ - Code accepts, stores, serializes, validates, normalizes, joins, resolves, compares, scans, extracts, uploads, downloads, writes, deletes, locks, packages, or reports paths.
38
+ - Path behavior appears in CLI arguments, API request or response schemas, config files, snapshots, fixtures, generated output, package artifacts, logs, manifests, caches, temp directories, upload or download flows, archive extraction, or scanner output.
39
+ - A change claims path traversal safety, base-directory containment, symlink safety, junction or reparse-point safety, archive extraction safety, atomic write behavior, durable write behavior, lock ownership, cleanup safety, deterministic scanning, or Windows/macOS/Linux compatibility.
40
+ - A test or docs example includes paths that must behave consistently across Windows, macOS, Linux, CI, containers, archives, package artifacts, or user machines.
41
+
42
+ <!-- mustflow-section: do-not-use-when -->
43
+ ## Do Not Use When
44
+
45
+ - The task only changes in-memory labels and no path is interpreted by an OS, runtime, CLI, API, archive, scanner, package manager, or filesystem helper.
46
+ - The task only changes Git line-ending policy; use `line-ending-hygiene`.
47
+ - A generated artifact is only referenced or packaged and no path validation, path generation, or artifact path contract changes; use `artifact-integrity-check`.
48
+ - The task is only a narrow low-level filesystem helper change with no public path contract; `cross-platform-filesystem-safety` can be used as the narrower adjunct.
49
+
50
+ <!-- mustflow-section: required-inputs -->
51
+ ## Required Inputs
52
+
53
+ - Every path input and output, including user input, CLI args, API fields, config fields, archive entries, generated files, temp files, cache paths, lock files, uploaded filenames, download filenames, scanner roots, package artifact paths, and logs.
54
+ - The path owner and trust class: user-controlled, repository-owned, generated, temp, cache, archive-contained, package artifact, external file, or unknown.
55
+ - The base directory or allowed root, expected relative/absolute policy, symlink and reparse-point policy, case-sensitivity policy, invalid-name policy, atomic-write policy, lock policy, archive extraction policy, scanner bounds, cleanup policy, and platform expectations.
56
+ - Current path helpers, safe filesystem wrappers, temp/cache helpers, archive helpers, upload/download helpers, scanners, schema validators, snapshots, and tests.
57
+ - Relevant command-intent entries for build, tests, docs, release, and mustflow validation.
58
+
59
+ <!-- mustflow-section: preconditions -->
60
+ ## Preconditions
61
+
62
+ - The task matches the Use When conditions and does not match the Do Not Use When exclusions.
63
+ - Existing path helpers and safe filesystem wrappers have been inspected before adding a new helper.
64
+ - Security and privacy review is applied first when paths can expose secrets, personal data, uploaded files, downloaded files, or files outside an owned root.
65
+ - The path contract is classified before editing: internal helper, public CLI, public API, schema, generated output, snapshot, package artifact, archive, upload/download, scanner, temp/cache, lock, or cleanup.
66
+
67
+ <!-- mustflow-section: allowed-edits -->
68
+ ## Allowed Edits
69
+
70
+ - Update path validators, path helpers, safe filesystem wrappers, schemas, CLI parsing, API contracts, snapshots, fixtures, docs, tests, package metadata, generated-output paths, archive extraction, scanner bounds, temp/cache handling, locks, and cleanup code that are directly needed for safe path behavior.
71
+ - Prefer existing repository path helpers and one shared path contract over ad hoc string manipulation.
72
+ - Keep path display format stable for users and automation. Prefer repository-relative paths in output unless absolute paths are required for local diagnosis.
73
+ - Do not broaden filesystem access, cleanup roots, scanner roots, archive extraction roots, package artifact globs, or upload/download destinations to make a path bug disappear.
74
+
75
+ <!-- mustflow-section: procedure -->
76
+ ## Procedure
77
+
78
+ 1. Build a path ledger. List every path field, argument, helper, schema, snapshot, generated output, package artifact, archive entry, upload/download filename, scanner root, temp/cache path, lock file, and cleanup target touched by the change.
79
+ 2. Classify each path by trust and owner: trusted repository path, user input, generated state, template path, package artifact, temporary file, cache file, archive-contained path, external path, uploaded name, downloaded name, scanner root, or unknown.
80
+ 3. Define the allowed root and representation. Decide whether the contract accepts relative paths, absolute paths, URLs, file URLs, archive entry names, package-relative paths, repository-relative paths, or display-only paths.
81
+ 4. Reject dangerous path text before filesystem access: null bytes, empty names where not allowed, absolute paths where relative paths are required, dot segments where not allowed, Windows device names, drive-relative paths, UNC roots, namespace prefixes, alternate data streams, trailing dots or spaces, reserved characters, and mixed separator bypasses.
82
+ 5. Treat Windows drive-relative paths such as `C:tmp.txt` as relative to a drive current directory, not as `C:\tmp.txt`.
83
+ 6. Treat Windows reserved names as reserved even with extensions. Names such as `CON`, `PRN`, `AUX`, `NUL`, `COM1`, and `LPT1` must not become ordinary user filenames.
84
+ 7. Treat macOS and Windows case-insensitive defaults as compatibility risks. Decide whether to reject case-only collisions, preserve spelling, normalize display only, or rely on the host filesystem.
85
+ 8. Do not solve containment with string prefixes. Establish the base real path, resolve or canonicalize the candidate parent when possible, then use path-aware relative containment with a separator boundary.
86
+ 9. For new files whose final path does not exist yet, canonicalize the existing parent directory and verify that parent remains inside the allowed root.
87
+ 10. Recheck symlink, junction, reparse-point, and final-target behavior at the operation boundary where the runtime allows it. Do not claim race-free behavior from normalize-then-open code alone.
88
+ 11. For uploads and downloads, separate displayed filename from storage key. Validate extension, size, content type, magic bytes when relevant, path separators, Unicode aliasing, reserved names, collision policy, overwrite policy, and tenant or user ownership.
89
+ 12. For archive extraction, validate every entry before extraction. Reject absolute entries, parent traversal, empty names, platform-reserved names, symlink entries unless explicitly supported, hard links unless explicitly supported, duplicate or case-colliding entries, oversized entries, zip bombs, and extraction outside the target root.
90
+ 13. Do not call extract-all behavior on untrusted archives unless the helper performs per-entry validation and bounded extraction.
91
+ 14. For atomic writes, create the temporary file in the target directory on the same filesystem, use an unpredictable temp name, write, flush, close, replace or rename, and flush the parent directory when the platform and helper support it.
92
+ 15. Scope atomicity claims. Cross-filesystem moves, network filesystems, Windows sharing violations, antivirus/indexer locks, and missing directory fsync support can downgrade a claim to best effort.
93
+ 16. For Windows replace or rename failures caused by sharing violations, use bounded retry or report the platform limitation. Do not turn every transient lock into silent data loss.
94
+ 17. For locks and mutexes, define owner token, stale lock policy, crash recovery, deletion race handling, PID reuse handling, and whether the lock works on local filesystems only. Do not treat a PID file alone as proof of ownership.
95
+ 18. For scanners, set max depth, max file count, max file size, binary-file handling, ignored directories, hidden-file policy, permission-error behavior, symlink traversal policy, loop detection, deterministic ordering, and output path format.
96
+ 19. For temp and cache paths, keep them under an owned root, avoid global temp rename into a target location, include cleanup bounds, and avoid leaking user data through predictable names.
97
+ 20. For CLI, API, schema, snapshot, docs, and package artifact path changes, update every contract surface together. Path spelling, separators, slash policy, absolute/relative policy, escaping, sorting, and error messages are part of the contract.
98
+ 21. Add focused tests for the riskiest path shapes: traversal, absolute input, drive-relative input, UNC-like input, reserved names, trailing dots or spaces, case collision, symlink escape, archive traversal, duplicate archive entries, scanner loop, large file cap, and cleanup boundary.
99
+ 22. Select verification from the command contract based on risk. Public CLI/API/schema/package artifact changes need broader checks than internal helper-only changes.
100
+
101
+ <!-- mustflow-section: postconditions -->
102
+ ## Postconditions
103
+
104
+ - Path trust classes, accepted path representation, invalid-name policy, case policy, root boundary, symlink and reparse-point policy, archive policy, upload/download policy, scanner policy, atomic-write policy, lock policy, temp/cache policy, and cleanup policy are explicit.
105
+ - Path contracts are synchronized across helpers, schemas, CLI/API docs, snapshots, fixtures, generated outputs, package artifacts, tests, and reports.
106
+ - Any race-safety, atomicity, durability, lock, or cross-platform claim is scoped to what the current runtime and helpers can actually guarantee.
107
+ - Platform behavior that was not tested is reported as remaining risk.
108
+
109
+ <!-- mustflow-section: verification -->
110
+ ## Verification
111
+
112
+ Use configured oneshot command intents when available:
113
+
114
+ - `changes_status`
115
+ - `changes_diff_summary`
116
+ - `lint`
117
+ - `build`
118
+ - `test_related`
119
+ - `test`
120
+ - `docs_validate_fast`
121
+ - `test_release`
122
+ - `mustflow_check`
123
+
124
+ Prefer focused tests for helper-only path changes. Use release or package checks when CLI output, schemas, snapshots, generated outputs, package artifacts, template paths, or installed workflow files change.
125
+
126
+ <!-- mustflow-section: failure-handling -->
127
+ ## Failure Handling
128
+
129
+ - If root containment is unclear, stop before writing, deleting, extracting, scanning, or opening and report the ambiguous path owner.
130
+ - If the platform cannot prove symlink-safe behavior, fail closed or report the exact remaining gap.
131
+ - If archive entries cannot be validated before extraction, do not extract the archive.
132
+ - If atomic replace, file fsync, parent directory fsync, no-follow open, lock ownership, or final-target verification is unavailable, downgrade the claim and keep the operation bounded.
133
+ - If Windows, macOS, Linux, container, CI, or network-filesystem behavior differs and cannot be tested, state the untested platform boundary.
134
+ - If cleanup might remove user data or files outside generated state, do not proceed without a tighter owned root.
135
+
136
+ <!-- mustflow-section: output-format -->
137
+ ## Output Format
138
+
139
+ - Path contract changed
140
+ - Path ledger and trust classes
141
+ - Accepted representation and base-root policy
142
+ - Windows, macOS, Linux, archive, upload/download, scanner, lock, temp/cache, atomic-write, and cleanup decisions
143
+ - CLI/API/schema/snapshot/generated-output/package artifact surfaces synchronized
144
+ - Tests or fixtures added or reused
145
+ - Command intents run
146
+ - Skipped platform checks and reasons
147
+ - Remaining file path cross-platform risk
@@ -0,0 +1,116 @@
1
+ ---
2
+ mustflow_doc: skill.flutter-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: flutter-code-change
9
+ description: Apply this skill when Flutter widgets, screens, routing, state management, async UI, platform channels, assets, responsive layout, accessibility, or Flutter 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.flutter-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
+ # Flutter Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Flutter widget, state owner, build purity, async lifecycle, navigation, platform channel, asset, responsive layout, and accessibility boundaries.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - Flutter `lib/**.dart`, widgets, screens, routing, state management, platform channels, assets, tests, integration tests, or platform project files change.
37
+ - The task touches `StatefulWidget`, `StatelessWidget`, `setState`, `BuildContext`, navigation, `FutureBuilder`, `StreamBuilder`, controllers, subscriptions, `MethodChannel`, `pubspec.yaml` assets, or responsive layout.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - The change is pure Dart package or CLI logic with no Flutter UI/lifecycle surface; use `dart-code-change`.
43
+ - The task only reads Flutter code for orientation.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - `pubspec.yaml`, analyzer config, app root, route config, state management setup, target screen, parent widgets, assets, platform channel files, and tests.
49
+ - Existing state management, navigation, accessibility, theming, and responsive layout conventions.
50
+ - Configured verification intents.
51
+
52
+ <!-- mustflow-section: preconditions -->
53
+ ## Preconditions
54
+
55
+ - Identify widget tree owner, state owner, route owner, async source, platform boundary, asset declaration, and verification surface.
56
+ - Keep `build` as UI description, not a side-effect runner.
57
+
58
+ <!-- mustflow-section: allowed-edits -->
59
+ ## Allowed Edits
60
+
61
+ - Put network calls, subscriptions, controllers, timers, analytics, navigation side effects, and snackbars in the proper lifecycle or event boundary.
62
+ - Use the project's existing state management and routing style.
63
+ - Use constraints and layout information rather than device-name assumptions.
64
+ - Dispose controllers, streams, timers, animations, and subscriptions.
65
+
66
+ <!-- mustflow-section: procedure -->
67
+ ## Procedure
68
+
69
+ 1. Read app root, route config, parent widgets, state owner, target widget, platform files, assets, and tests.
70
+ 2. Classify the change: widget layout, state, async lifecycle, navigation, platform channel, asset, accessibility, or test-only.
71
+ 3. Do not create futures, streams, controllers, listeners, or side effects inside `build`.
72
+ 4. Keep `setState` narrow and synchronous; do not put awaited work inside the `setState` callback.
73
+ 5. After async gaps, ensure the widget is still mounted before using context or state, and prefer disposing owners so dead widgets are not touched.
74
+ 6. Keep navigation consistent with the project's router.
75
+ 7. If platform channel or native permission changes, verify Dart interface, native implementation, serialization shape, and error shape together.
76
+ 8. Check small width, wide width, long text, text scaling, keyboard/open input states, and screen-reader semantics when relevant.
77
+
78
+ <!-- mustflow-section: postconditions -->
79
+ ## Postconditions
80
+
81
+ - Widget build remains pure.
82
+ - State owner and async lifecycle are clear.
83
+ - Layout responds to constraints and text scaling.
84
+ - Platform, asset, and accessibility risks are checked or reported.
85
+
86
+ <!-- mustflow-section: verification -->
87
+ ## Verification
88
+
89
+ Use configured oneshot command intents when available:
90
+
91
+ - `lint`
92
+ - `build`
93
+ - `test_related`
94
+ - `test`
95
+ - `docs_validate_fast`
96
+ - `mustflow_check`
97
+
98
+ Report missing widget, integration, golden, or platform verification intents when relevant.
99
+
100
+ <!-- mustflow-section: failure-handling -->
101
+ ## Failure Handling
102
+
103
+ - If a lifecycle fix requires repeated mounted checks, inspect ownership and disposal before adding more guards.
104
+ - If layout only works for one viewport, redesign with constraints before finishing.
105
+ - If platform permissions or channels are unclear, stop that part and inspect native config.
106
+
107
+ <!-- mustflow-section: output-format -->
108
+ ## Output Format
109
+
110
+ - Boundary checked
111
+ - State, lifecycle, layout, and accessibility notes
112
+ - Platform or asset impact
113
+ - Files changed
114
+ - Command intents run
115
+ - Skipped checks and reasons
116
+ - Remaining Flutter risk
@@ -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