@r_masseater/msch 0.134.0 → 0.141.1

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 (55) hide show
  1. package/dist/addon-tasks.mjs +1 -1
  2. package/dist/build-workspace-settings-C2EOC9GX.mjs +627 -0
  3. package/dist/build-workspace-settings-C2EOC9GX.mjs.map +1 -0
  4. package/dist/cargo-inputs.mjs +1 -1
  5. package/dist/cli.mjs +711 -752
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/config.d.mts +13 -37
  8. package/dist/config.mjs +335 -23
  9. package/dist/config.mjs.map +1 -1
  10. package/dist/decision-rules-CqgOVodl.mjs +43 -0
  11. package/dist/decision-rules-CqgOVodl.mjs.map +1 -0
  12. package/dist/decision-rules.d.mts +2 -1
  13. package/dist/decision-rules.mjs +1 -1
  14. package/dist/{dependencies-Bjn3xWkq.mjs → dependencies-DgltkhvK.mjs} +2 -2
  15. package/dist/{dependencies-Bjn3xWkq.mjs.map → dependencies-DgltkhvK.mjs.map} +1 -1
  16. package/dist/{derive-cargo-inputs-BLMqkRS3.mjs → derive-cargo-inputs-DbMOBcGP.mjs} +3 -3
  17. package/dist/{derive-cargo-inputs-BLMqkRS3.mjs.map → derive-cargo-inputs-DbMOBcGP.mjs.map} +1 -1
  18. package/dist/{ignored-directories-CaTFIbjo.mjs → ignored-directories-BGiOSvNx.mjs} +2 -2
  19. package/dist/{ignored-directories-CaTFIbjo.mjs.map → ignored-directories-BGiOSvNx.mjs.map} +1 -1
  20. package/dist/index-DOkaGaUe.d.mts +25 -0
  21. package/dist/library.mjs +2 -2
  22. package/dist/lint.d.mts +38 -2
  23. package/dist/lint.mjs +20 -1
  24. package/dist/lint.mjs.map +1 -0
  25. package/dist/oxlint.mjs +2 -2
  26. package/dist/{problem-Dk1svgmC.mjs → problem-CkDaLJxX.mjs} +2 -2
  27. package/dist/{problem-Dk1svgmC.mjs.map → problem-CkDaLJxX.mjs.map} +1 -1
  28. package/dist/{published-Cgl1qeYH.mjs → published-BrX24558.mjs} +269 -8
  29. package/dist/published-BrX24558.mjs.map +1 -0
  30. package/dist/{repository-files-C_GzAnYp.mjs → repository-files-CX48nfE5.mjs} +4 -5
  31. package/dist/repository-files-CX48nfE5.mjs.map +1 -0
  32. package/dist/{define-lint-preset-_bDnJMcY.mjs → repository-text-CpD8Z1kp.mjs} +355 -380
  33. package/dist/repository-text-CpD8Z1kp.mjs.map +1 -0
  34. package/dist/traced-rules.config-CnYNZrOa.mjs +8 -0
  35. package/dist/traced-rules.config-CnYNZrOa.mjs.map +1 -0
  36. package/dist/workspace-settings.mjs +2 -434
  37. package/dist/zenn-markdown.config-uksui7Go.mjs +77 -0
  38. package/dist/zenn-markdown.config-uksui7Go.mjs.map +1 -0
  39. package/package.json +13 -13
  40. package/skills/msch-checks/SKILL.md +5 -5
  41. package/skills/msch-publishing/SKILL.md +1 -1
  42. package/skills/msch-repository-config/SKILL.md +19 -18
  43. package/skills/msch-workspace-settings/SKILL.md +15 -9
  44. package/src/app/vite.d.ts +5 -8
  45. package/dist/define-lint-preset-_bDnJMcY.mjs.map +0 -1
  46. package/dist/index-_y7Igwy0.d.mts +0 -321
  47. package/dist/published-Cgl1qeYH.mjs.map +0 -1
  48. package/dist/repository-files-C_GzAnYp.mjs.map +0 -1
  49. package/dist/repository-text-BPhi-pct.mjs +0 -331
  50. package/dist/repository-text-BPhi-pct.mjs.map +0 -1
  51. package/dist/required-stack-BLSiAmpx.mjs +0 -188
  52. package/dist/required-stack-BLSiAmpx.mjs.map +0 -1
  53. package/dist/workspace-projects-Zg078aA1.mjs +0 -269
  54. package/dist/workspace-projects-Zg078aA1.mjs.map +0 -1
  55. package/dist/workspace-settings.mjs.map +0 -1
@@ -1,21 +1,47 @@
1
- import { n as DECISION_TIMEOUT_MS, t as DECISION_MODEL } from "./config-B3SYjao5.mjs";
1
+ import { r as RepositoryFiles } from "./repository-files-CX48nfE5.mjs";
2
+ import { C as workspaceProjects, D as TASK_NAMES } from "./published-BrX24558.mjs";
3
+ import { i as USAGE_SPOOL, n as DECISION_TIMEOUT_MS, t as DECISION_MODEL } from "./config-B3SYjao5.mjs";
4
+ import { i as decisionRules, n as allRulesOf, o as pluginRules, r as decisionPluginName, s as shadcnRestyleContracts, t as zennMarkdown } from "./zenn-markdown.config-uksui7Go.mjs";
2
5
  import { createRequire, registerHooks } from "node:module";
3
- import { Array, Option, Predicate, Record, String, Struct, pipe } from "effect";
6
+ import { Array, Effect, Option, Predicate, Record, String as String$1, pipe } from "effect";
4
7
  import { fileURLToPath } from "node:url";
8
+ import fu4 from "@r_masseater/fu4/package.json" with { type: "json" };
9
+ import wism from "@r_masseater/wism/package.json" with { type: "json" };
10
+ import y8 from "@r_masseater/y8/package.json" with { type: "json" };
5
11
  import tanstackQuery from "@r_masseater/oxlint-typed-rules/tanstack-query";
6
12
  import tanstackRouter from "@r_masseater/oxlint-typed-rules/tanstack-router";
7
13
  import { plugin } from "@shadcn/lint";
8
14
  import baselineJs from "eslint-plugin-baseline-js";
9
- import { presets } from "@effect/tsgo/oxlint-presets";
10
- import htmlReact from "@html-eslint/eslint-plugin-react";
11
- import eslintReact from "@r_masseater/oxlint-typed-rules/react";
12
- import reactHooks from "eslint-plugin-react-hooks";
13
- import { createDecisionPlugin, defineDecisionRule } from "@r_masseater/oxlint-plugin-decision";
14
- import remotion from "@r_masseater/oxlint-typed-rules/remotion";
15
- import { rustCrate, skill, structure, workspace } from "@r_masseater/wism/presets";
16
15
  import presetJa from "@r_masseater/textlint-rule-preset-ja";
17
- import markdown from "@textlint/textlint-plugin-markdown";
18
- import { recommended } from "@r_masseater/y8/presets";
16
+ import { betterleaks } from "@r_masseater/h56m/presets";
17
+ // src/entities/workspace/model/workspace-names.ts
18
+ const ALTERNATIVE = "|";
19
+ const SCOPE = /^@[^/]+\//u;
20
+ const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
21
+ /** @internal */
22
+ const patternOf = (names) => {
23
+ const alternatives = pipe(names, Array.map(String$1.replaceAll(SPECIAL, String.raw`\$&`)));
24
+ return new RegExp(`(?<![\\p{L}\\p{N}_-])(?:${Array.join(alternatives, ALTERNATIVE)})(?![\\p{L}\\p{N}_-])`, "gu");
25
+ };
26
+ const namedIn = (basename) => ({ directory, packageName }) => {
27
+ const unscoped = pipe(packageName, Option.map(String$1.replace(SCOPE, "")));
28
+ return {
29
+ directory,
30
+ names: pipe([
31
+ Option.some(directory),
32
+ Option.some(basename(directory)),
33
+ packageName,
34
+ unscoped
35
+ ], Array.getSomes, Array.dedupe),
36
+ packageName
37
+ };
38
+ };
39
+ /** @internal */
40
+ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(root) {
41
+ const files = yield* RepositoryFiles;
42
+ const projects = yield* workspaceProjects(root);
43
+ return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
44
+ });
19
45
  // src/shared/config/exempt.ts
20
46
  const generated = [
21
47
  "**/routeTree.gen.ts",
@@ -39,6 +65,246 @@ const exempt = [
39
65
  ...checkerInputs,
40
66
  ...vendored
41
67
  ];
68
+ // src/shared/lib/path-existence.ts
69
+ const WILDCARD = /[*?[]/u;
70
+ const SEPARATOR = "/";
71
+ const FIRST = 0;
72
+ /** @internal */
73
+ const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
74
+ const files = yield* RepositoryFiles;
75
+ return yield* files.exists(files.join(root, path));
76
+ });
77
+ /** @internal */
78
+ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
79
+ const files = yield* RepositoryFiles;
80
+ const directory = yield* files.isDirectory(files.join(root, path));
81
+ return Option.getOrElse(directory, () => false);
82
+ });
83
+ /** @internal */
84
+ const staticPrefix = (path) => {
85
+ const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
86
+ if (String$1.endsWith(SEPARATOR)(prefix)) return String$1.slice(FIRST, -1)(prefix);
87
+ return prefix;
88
+ };
89
+ /** @internal */
90
+ const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
91
+ const prefix = staticPrefix(path);
92
+ if (String$1.isEmpty(prefix)) return false;
93
+ const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR}`]);
94
+ return Array.isReadonlyArrayNonEmpty(ignored);
95
+ });
96
+ // src/app/built-config.ts
97
+ /** @internal */
98
+ const recordBuilt = (config) => {
99
+ globalThis.mschBuiltConfig = [config];
100
+ return config;
101
+ };
102
+ /** @internal */
103
+ const forgetBuilt = () => {
104
+ globalThis.mschBuiltConfig = [];
105
+ };
106
+ /** @internal */
107
+ const lastBuilt = () => pipe(Option.fromUndefinedOr(globalThis.mschBuiltConfig), Option.flatMap(Array.head));
108
+ // src/shared/lib/tool-bins.ts
109
+ const binOf = (bin, manifest) => fileURLToPath(new URL(bin, import.meta.resolve(manifest)));
110
+ /** @internal */
111
+ const TOOL_BINS = {
112
+ y8: binOf(y8.bin.y8, "@r_masseater/y8/package.json"),
113
+ wism: binOf(wism.bin.wism, "@r_masseater/wism/package.json"),
114
+ fu4: binOf(fu4.bin.fu4, "@r_masseater/fu4/package.json")
115
+ };
116
+ // src/app/repository-tasks.ts
117
+ const NOT_INPUTS = [
118
+ "!node_modules/.pnpm-store",
119
+ "!node_modules/.pnpm-store/**",
120
+ "!node_modules/.tmp",
121
+ "!node_modules/.tmp/**",
122
+ "!target/**",
123
+ "!node_modules/.vitest-cache/**",
124
+ "!node_modules/.cache/**"
125
+ ];
126
+ const UNTRACKED_ENV = [
127
+ "CLOUDFLARE_ACCOUNT_ID",
128
+ "CLOUDFLARE_AI_GATEWAY_ID",
129
+ "CLOUDFLARE_API_TOKEN",
130
+ "CLAUDECODE",
131
+ "CLAUDE_CODE_REMOTE",
132
+ "GITHUB_ACTIONS",
133
+ "HTTPS_PROXY",
134
+ "https_proxy",
135
+ "NO_PROXY",
136
+ "no_proxy",
137
+ "SSL_CERT_FILE",
138
+ "NODE_EXTRA_CA_CERTS"
139
+ ];
140
+ const MSCH = "FALLOW_TYPE_AWARE_BACKEND=tsrs msch";
141
+ const CHECK = `TSRS_LINT_RUN_EXTERNAL_CODE=1 msch changed --batch-sources ${String(1e3)} -- vp check --deny-warnings --continue-on-error --no-error-on-unmatched-pattern`;
142
+ const COMPAT = "msch changed -- msch publish compat-changed";
143
+ const Y8 = `node ${TOOL_BINS.y8}`;
144
+ const WISM = `node ${TOOL_BINS.wism}`;
145
+ const FU4 = `node ${TOOL_BINS.fu4}`;
146
+ const AUDIT = Array.join([
147
+ "copy=\"$(mktemp -d)\"",
148
+ `trap 'rm -rf "$copy"' EXIT`,
149
+ `for file in ${Array.join([
150
+ "package.json",
151
+ "pnpm-workspace.yaml",
152
+ "pnpm-lock.yaml",
153
+ ".npmrc"
154
+ ], " ")}; do if [ -f "$file" ]; then cp "$file" "$copy/"; fi; done`,
155
+ "(cd \"$copy\" && vp pm audit --fix >/dev/null) || exit",
156
+ `added="$(diff pnpm-workspace.yaml "$copy/pnpm-workspace.yaml" | sed -n 's/^> \\(.*\\)$/\\1 # exit: unused/p')"`,
157
+ "if [ -z \"$added\" ]; then exit 0; fi",
158
+ `printf '%s\\n' "vp pm audit --fix found vulnerable versions. First update them within their ranges with vp update -r --no-save <package>... -- --depth Infinity. For each one still reported by vp pm audit, add its line to overrides in pnpm-workspace.yaml and run vp install:" "$added" >&2`,
159
+ "exit 1"
160
+ ], "; ");
161
+ const BROKER_TOKEN = `GH_TOKEN="\${GITHUB_APP_TOKEN:-$GH_TOKEN}"`;
162
+ const DAILY = `msch exits; ${BROKER_TOKEN} msch upstream; ${BROKER_TOKEN} msch refs; refs=$?; msch agents "\${RUNNER_TEMP:-\${TMPDIR:-/tmp}}/msch-agents" && exit "$refs"`;
163
+ const TEST = "msch changed -- vp test run --passWithNoTests";
164
+ const CARGO = "cargo fmt --all --check && cargo clippy --workspace --all-targets --locked -- -D warnings";
165
+ const cargoTasks = (cargo) => Option.match(cargo, {
166
+ onNone: () => ({}),
167
+ onSome: (inputs) => ({ cargo: {
168
+ command: CARGO,
169
+ cache: {
170
+ input: [...inputs],
171
+ output: [],
172
+ untrackedEnv: UNTRACKED_ENV
173
+ }
174
+ } })
175
+ });
176
+ const MSCH_VERIFY_COMMANDS = {
177
+ check: CHECK,
178
+ msch: MSCH,
179
+ audit: AUDIT,
180
+ published: "msch published",
181
+ compat: COMPAT,
182
+ y8: Y8,
183
+ wism: WISM,
184
+ fu4: FU4
185
+ };
186
+ const MSCH_TASK_COMMANDS = {
187
+ ...MSCH_VERIFY_COMMANDS,
188
+ test: TEST
189
+ };
190
+ const CI_TASKS = [TASK_NAMES.verify, TASK_NAMES.test];
191
+ const USAGE_TASK = "usage";
192
+ const METERED_TASKS = [
193
+ "check",
194
+ "msch",
195
+ "y8",
196
+ "wism",
197
+ "fu4"
198
+ ];
199
+ const meteredCommand = (command) => `USAGE_METER_SPOOL="$PWD/${USAGE_SPOOL}" ${command}`;
200
+ const usageCommandOf = ({ endpoint }) => `msch usage --endpoint ${endpoint}`;
201
+ const commandOf = (usage) => (command) => Option.match(usage, {
202
+ onNone: () => command,
203
+ onSome: () => meteredCommand(command)
204
+ });
205
+ const usageTasks = (usage) => Option.match(usage, {
206
+ onNone: () => ({}),
207
+ onSome: (options) => ({ [USAGE_TASK]: {
208
+ command: usageCommandOf(options),
209
+ dependsOn: [...METERED_TASKS],
210
+ cache: false
211
+ } })
212
+ });
213
+ const tasksOf = ({ workspace, commands, usage, cargo }) => {
214
+ const inputs = [
215
+ { auto: true },
216
+ ...workspace.ignoredDirectories,
217
+ ...NOT_INPUTS
218
+ ];
219
+ const run = commandOf(usage);
220
+ const checks = {
221
+ ...commands,
222
+ check: {
223
+ command: run(CHECK),
224
+ cache: {
225
+ input: inputs,
226
+ untrackedEnv: UNTRACKED_ENV
227
+ }
228
+ },
229
+ msch: {
230
+ command: run(MSCH_VERIFY_COMMANDS.msch),
231
+ dependsOn: ["check", ...workspace.tasks.native],
232
+ cache: false
233
+ },
234
+ audit: {
235
+ command: AUDIT,
236
+ cache: false
237
+ },
238
+ y8: {
239
+ command: run(Y8),
240
+ dependsOn: [...workspace.tasks.native],
241
+ cache: false
242
+ },
243
+ wism: {
244
+ command: run(WISM),
245
+ dependsOn: [...workspace.tasks.native],
246
+ cache: false
247
+ },
248
+ fu4: {
249
+ command: run(FU4),
250
+ dependsOn: [...workspace.tasks.native],
251
+ cache: false
252
+ },
253
+ published: {
254
+ command: MSCH_TASK_COMMANDS.published,
255
+ cache: false
256
+ },
257
+ compat: {
258
+ command: COMPAT,
259
+ dependsOn: ["msch"],
260
+ cache: false
261
+ },
262
+ ...cargoTasks(cargo),
263
+ ...usageTasks(usage)
264
+ };
265
+ return {
266
+ ...checks,
267
+ test: {
268
+ command: TEST,
269
+ dependsOn: ["check", ...workspace.tasks.native],
270
+ cache: { input: [...inputs, "!**/.cache/**"] }
271
+ },
272
+ daily: {
273
+ command: DAILY,
274
+ dependsOn: [...workspace.tasks.native],
275
+ cache: false
276
+ },
277
+ verify: {
278
+ command: [],
279
+ dependsOn: [...workspace.tasks.verify, ...Record.keys(checks)]
280
+ },
281
+ ci: {
282
+ command: [],
283
+ dependsOn: [...CI_TASKS, ...workspace.tasks.test]
284
+ }
285
+ };
286
+ };
287
+ const REINSTALL = "vp install";
288
+ const GIT_HOOKS = {
289
+ "pre-commit": ["vp staged", "vp exec msch --staged"],
290
+ "commit-msg": ["vp exec msch --commit-msg \"$1\""],
291
+ "pre-push": ["vp exec msch --pre-push", "vp run verify"],
292
+ "post-checkout": [`[ "$3" = 0 ] || ${REINSTALL}`],
293
+ "post-merge": [REINSTALL],
294
+ "post-rewrite": [REINSTALL]
295
+ };
296
+ const gitHooksOf = (hooks = {}) => ({
297
+ ...GIT_HOOKS,
298
+ ...hooks
299
+ });
300
+ const toolsOf = (tools = {}) => ({
301
+ "open-telemetry/opentelemetry-collector-releases": {
302
+ version: "0.166.0",
303
+ bin: ["otelcol"]
304
+ },
305
+ "open-telemetry/weaver": { version: "0.28.0" },
306
+ ...tools
307
+ });
42
308
  // src/features/define-lint-preset/config/lint-overrides.config.ts
43
309
  const resourceRules = {
44
310
  "msch-lint/worker-logpush": "error",
@@ -67,33 +333,6 @@ const commandsOverride = {
67
333
  files: ["**/bin/**"],
68
334
  rules: { "msch-lint/wiring-only-commands": "error" }
69
335
  };
70
- // src/features/define-lint-preset/config/decision-rules.ts
71
- var decision_rules_default = createDecisionPlugin({
72
- name: "stack",
73
- rules: [
74
- defineDecisionRule({
75
- id: "exclusive-status",
76
- target: "file",
77
- question: "Does this code represent one piece of state with several boolean flags or optional fields whose combinations can contradict each other, instead of one exclusive status expressed as a discriminated union? Answer no when every state is a single exclusive status, or when the file holds no such state. A violation needs two or more booleans or optional fields that describe the same piece of state; a single boolean value, parameter, return value or field is not a violation, and a union of objects told apart by a status or kind field is already an exclusive status. A constant configuration object whose shape a library fixes, such as an OpenFeature flag definition, holds no state and is not a violation. Fields that each stand on their own, so that every combination of them is valid, such as the optional filters of a search, the options of a request or independent settings, describe separate things and are not a violation.",
78
- message: "状態は排他的なstatusを持つ判別共用体で表し、booleanフラグの組を使わない。",
79
- cutoff: .8
80
- }),
81
- defineDecisionRule({
82
- id: "server-state-tanstack-query",
83
- target: "file",
84
- question: "Does this code, running in the browser, fetch, cache or synchronize server data with something other than TanStack Query or the Query and Command of Effect UI, such as fetch inside useEffect, SWR or a hand-written cache? Answer no when server data in the browser goes only through TanStack Query or Effect UI, when the file runs only on a server, in a Worker or in a command-line tool, when the file is part of plover, the framework that carries Effect UI queries between the Worker and the browser, or when the file handles no server data. Creating an API client such as a better-auth or Eden client, which fetches nothing until a query calls it, is not a violation.",
85
- message: "ブラウザのサーバー状態はTanStack QueryかEffect UIのQuery・Commandだけで扱う。",
86
- cutoff: .8
87
- }),
88
- defineDecisionRule({
89
- id: "ui-state-effect-atom",
90
- target: "file",
91
- question: "Does this code hold client-side UI state with something other than effect-atom, such as useState, useReducer, React context used as a store, zustand, jotai or redux? Answer no when client-side UI state is held only by effect-atom, or when the file holds none. effect-atom is Atom from effect/reactivity, read and written through @effect/atom-react hooks such as useAtomValue and useAtomSet. Creating a TanStack Query QueryClient or configuring the router, which hold no UI state, is not a violation.",
92
- message: "UI状態はeffect-atomだけで扱う。",
93
- cutoff: .8
94
- })
95
- ]
96
- });
97
336
  // src/features/define-lint-preset/config/web-guidance.config.ts
98
337
  const webGuidanceRules = {
99
338
  "jsx-a11y/no-redundant-roles": ["error", {
@@ -105,36 +344,6 @@ const webGuidanceRules = {
105
344
  roles: ["tabpanel"]
106
345
  }]
107
346
  };
108
- // src/features/define-lint-preset/config/lint.config.ts
109
- const asErrors = (names) => Record.fromEntries(pipe(names, Array.map((name) => [name, "error"])));
110
- const allRulesOf = ({ prefix, rules }) => asErrors(pipe(Record.keys(rules), Array.map((rule) => `${prefix}/${rule}`)));
111
- const reactHooksRules = asErrors(pipe(Struct.keys(reactHooks.configs["recommended-latest"].rules), Array.map(String.replace("react-hooks/", "react-hooks-js/"))));
112
- const eslintReactRuleNames = pipe(Record.keys(eslintReact.configs["strict-typescript"].rules ?? {}), Array.filter((name) => !(String.replace("@eslint-react/", "react-hooks-js/")(name) in reactHooksRules)));
113
- const effectRuleNames = pipe(Record.values(presets), Array.flatMap((preset) => Struct.keys(preset.rules ?? {})));
114
- const pluginRules = {
115
- ...asErrors(Record.keys(htmlReact.configs.all.rules ?? {})),
116
- ...reactHooksRules,
117
- ...asErrors(eslintReactRuleNames),
118
- ...asErrors(effectRuleNames)
119
- };
120
- const decisionPluginName = decision_rules_default.meta.name;
121
- const decisionRules = allRulesOf({
122
- prefix: decisionPluginName,
123
- rules: decision_rules_default.rules
124
- });
125
- const decisionTestRules = pipe(decisionRules, Record.map(() => "off"));
126
- const shadcnRestyleContracts = [{
127
- pattern: "^Table(Head|Cell)$",
128
- allow: ["text-alignment", "fvn-spacing"]
129
- }, {
130
- pattern: "^TableCaption$",
131
- allow: [
132
- "caption",
133
- "text-alignment",
134
- "mt-*",
135
- "mb-*"
136
- ]
137
- }];
138
347
  // src/features/define-lint-preset/config/test-rules.config.ts
139
348
  const testRules = {
140
349
  "vitest/expect-expect": ["error", { assertFunctionNames: [
@@ -431,39 +640,10 @@ const lint = {
431
640
  reportUnusedDisableDirectives: "error"
432
641
  }
433
642
  };
434
- // src/features/define-lint-preset/config/traced-rules.config.ts
435
- const tracedRules = {
436
- "msch-lint/traced-elysia": "error",
437
- "msch-lint/traced-effect-run": "error"
438
- };
439
- // src/features/define-lint-preset/config/remotion-rules.config.ts
440
- const remotionRules = allRulesOf({
441
- prefix: "@remotion",
442
- rules: remotion.rules
443
- });
444
- // src/features/define-lint-preset/config/video-rules.config.ts
445
- const videoRules = ({ say, series, banned = {} }) => ({
446
- "msch-lint/video-say": ["error", say],
447
- "msch-lint/video-readings": "error",
448
- "msch-lint/video-series": ["error", {
449
- series,
450
- banned
451
- }]
452
- });
453
- // src/features/define-lint-preset/config/structure.config.ts
454
- const isIgnore = Predicate.not(String.startsWith("!"));
455
- const structureOf = ({ members, ignorePatterns }) => structure({
456
- kinds: [
457
- workspace({ paths: members }),
458
- rustCrate(),
459
- skill()
460
- ],
461
- ignores: pipe(ignorePatterns, Array.filter(isIgnore))
462
- });
463
- const ON_Y8 = "@r_masseater/y8/kuromojin";
464
- const requireWithY8Kuromojin = (parentUrl) => {
643
+ const ON_LINDERA = "@r_masseater/textlint-rule-preset-ja/kuromojin";
644
+ const requireWithLinderaKuromojin = (parentUrl) => {
465
645
  registerHooks({ resolve: (specifier, context, nextResolve) => {
466
- if (specifier === "kuromojin") return nextResolve(ON_Y8, {
646
+ if (specifier === "kuromojin") return nextResolve(ON_LINDERA, {
467
647
  ...context,
468
648
  parentURL: import.meta.url
469
649
  });
@@ -476,7 +656,7 @@ const NO_HANDLERS = {};
476
656
  const JAPANESE_LETTERS = /[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/gv;
477
657
  const LATIN_WORDS = /\p{Script=Latin}+/gv;
478
658
  const NONE = 0;
479
- const countOf = (text, pattern) => Array.length(String.match(text, pattern).pipe(Option.getOrElse(() => [])));
659
+ const countOf = (text, pattern) => Array.length(String$1.match(text, pattern).pipe(Option.getOrElse(() => [])));
480
660
  const writtenInJapanese = (text) => {
481
661
  const letters = countOf(text, JAPANESE_LETTERS);
482
662
  return letters > NONE && letters >= countOf(text, LATIN_WORDS);
@@ -487,7 +667,7 @@ const presetIn = (value) => {
487
667
  if (Predicate.hasProperty(value, "default")) return presetIn(value.default);
488
668
  return Option.none();
489
669
  };
490
- const required = requireWithY8Kuromojin(import.meta.url);
670
+ const required = requireWithLinderaKuromojin(import.meta.url);
491
671
  const presetOf = (specifier, loaded) => Option.getOrThrowWith(presetIn(loaded), () => /* @__PURE__ */ new TypeError(`${specifier} does not export a textlint preset`));
492
672
  const reportingJapanese = (context) => ({
493
673
  get id() {
@@ -547,291 +727,86 @@ const textlintFilters = {
547
727
  "node-types": filterIn("textlint-filter-rule-node-types", createRequire(import.meta.url)("textlint-filter-rule-node-types")),
548
728
  allowlist: filterIn("textlint-filter-rule-allowlist", defaultOf(createRequire(import.meta.url)("textlint-filter-rule-allowlist")))
549
729
  };
550
- // src/features/define-lint-preset/config/zenn-markdown.config.ts
551
- const CONTAINER_FENCE = ":::";
552
- const LINE_BREAK = "\n";
553
- const BLANK = " ";
554
- const IMAGE_SIZE = /(?<=!\[[^\]]*\]\(\S+) =\d*x\d*(?=\))/gu;
555
- const NEXT = 1;
556
- const spaces = (text) => String.repeat(text.length)(BLANK);
557
- const sizeIndices = (line) => pipe(Array.fromIterable(String.matchAll(IMAGE_SIZE)(line)), Array.flatMap((found) => pipe(Option.fromUndefinedOr(found.index), Option.map((start) => pipe(Array.head(found), Option.map((size) => Array.range(start, start + size.length - NEXT)), Option.getOrElse(() => []))), Option.getOrElse(() => []))));
558
- const withoutImageSizes = (line) => {
559
- const blankAt = sizeIndices(line);
560
- return pipe(String.split("")(line), Array.map((character, index) => {
561
- if (Array.contains(blankAt, index)) return BLANK;
562
- return character;
563
- }), Array.join(""));
564
- };
565
- const blankedLine = (line) => {
566
- if (String.startsWith(CONTAINER_FENCE)(line)) return spaces(line);
567
- return withoutImageSizes(line);
568
- };
569
- const blanked = (text) => pipe(text, String.split(LINE_BREAK), Array.map(blankedLine), Array.join(LINE_BREAK));
570
- var ZennMarkdownProcessor = class {
571
- markdown;
572
- constructor(options) {
573
- this.markdown = new markdown.Processor(options);
574
- }
575
- availableExtensions() {
576
- return this.markdown.availableExtensions();
577
- }
578
- processor(extension) {
579
- const { preProcess, postProcess } = this.markdown.processor(extension);
580
- return {
581
- preProcess: (text, filePath) => preProcess(blanked(text), filePath),
582
- postProcess
583
- };
584
- }
585
- };
586
- const zennMarkdown = { Processor: ZennMarkdownProcessor };
587
- // src/features/define-lint-preset/config/markdown.config.ts
588
- const skillNamesOf = (indexSkill) => Option.match(indexSkill, {
589
- onNone: () => ({}),
590
- onSome: (index) => ({ index })
591
- });
592
- const docsOf = (indexSkill) => {
593
- const skillNames = skillNamesOf(indexSkill);
594
- return {
595
- agents: {
596
- sections: [
597
- ["Tech stack"],
598
- ["Commands"],
599
- ["Rules"]
600
- ],
601
- commands: ["Commands"],
602
- stack: ["Tech stack"],
603
- skillNames
604
- },
605
- skills: { skillNames }
606
- };
607
- };
608
- const MARKDOWN_IGNORES = [
730
+ // src/app/repository-text.ts
731
+ const TEXT_IGNORES = [
732
+ "AGENTS.md",
733
+ "CLAUDE.md",
609
734
  ".agents/skills/**",
610
735
  "CHANGELOG.md",
611
- "**/CLAUDE.md",
612
736
  ...exempt
613
737
  ];
614
- const MARKDOWN_RULES = { "agnix/XP-001": "off" };
615
- const markdownOf = ({ indexSkill, docs = {} }) => {
616
- const base = docsOf(indexSkill);
738
+ const ZENN_MARKDOWN = "zenn-markdown";
739
+ const QUOTATION = String.raw`/「(?:[^「」]|「[^「」]*」)*」|『(?:[^『』]|『[^『』]*』)*』/`;
740
+ const SPEAKER = String.raw`/^:::[\w-]+\n[\s\S]*?\n:::$/m`;
741
+ const ELLIPSIS = "…";
742
+ /** @internal */
743
+ const BUILT_ALLOWANCES = [QUOTATION, SPEAKER];
744
+ const filtersOf = (properNouns) => ({
745
+ comments: true,
746
+ "node-types": { nodeTypes: ["BlockQuote"] },
747
+ allowlist: { allow: [...BUILT_ALLOWANCES, ...properNouns] }
748
+ });
749
+ const SENTENCE_LENGTH = 120;
750
+ const KANJI_RUN = 6;
751
+ const PUBLIC_LINES = [
752
+ String.raw`\bCF_BEACON_TOKEN = "[0-9a-f]{32}"`,
753
+ String.raw`\b\w*DISCORD_\w*ID = "[0-9]{17,20}"`,
754
+ String.raw`untrusted comment: minisign public key: [0-9A-F]{16}`
755
+ ];
756
+ const EXEMPT_PATHS = [String.raw`(?:^|/)(?:fixtures|upstream|hooks/vendor)/`];
757
+ const builtRules = (style) => ({
758
+ "@textlint-ja/preset-ai-writing": true,
759
+ "@r_masseater/preset-ja": true,
760
+ "preset-ja-technical-writing": {
761
+ "sentence-length": { max: SENTENCE_LENGTH },
762
+ "ja-no-mixed-period": { allowPeriodMarks: [":"] },
763
+ "no-mix-dearu-desumasu": {
764
+ preferInBody: style,
765
+ preferInList: style
766
+ },
767
+ "max-kanji-continuous-len": { max: KANJI_RUN },
768
+ "ja-no-successive-word": { allow: [ELLIPSIS] }
769
+ }
770
+ });
771
+ const textlintOf = ({ properNouns = [], rules = {}, sources = [], articles }) => {
772
+ const textRules = {
773
+ ...rules,
774
+ ...builtRules("である")
775
+ };
776
+ const filters = filtersOf(properNouns);
777
+ const articleSources = Array.filter([{
778
+ files: [...articles],
779
+ plugins: { [ZENN_MARKDOWN]: true },
780
+ rules: {
781
+ ...rules,
782
+ ...builtRules("ですます")
783
+ },
784
+ filters
785
+ }], () => Array.isReadonlyArrayNonEmpty(articles));
617
786
  return {
618
- extends: [recommended({
619
- ...base,
620
- ...docs,
621
- agents: {
622
- ...base.agents,
623
- ...docs.agents
624
- },
625
- skills: {
626
- ...base.skills,
627
- ...docs.skills
628
- }
629
- })],
630
- rules: MARKDOWN_RULES,
787
+ ignores: [...TEXT_IGNORES, ...articles],
788
+ presets: textlintPresets,
789
+ filterModules: textlintFilters,
790
+ pluginModules: { [ZENN_MARKDOWN]: zennMarkdown },
631
791
  reportUnusedDirectives: true,
632
- ignores: MARKDOWN_IGNORES
792
+ sources: pipe(sources, Array.map(({ files, plugins }) => ({
793
+ files: [...files],
794
+ plugins: { ...plugins },
795
+ rules: textRules,
796
+ filters
797
+ })), Array.appendAll(articleSources)),
798
+ filters,
799
+ rules: textRules
633
800
  };
634
801
  };
635
- // src/features/define-lint-preset/config/fallow.config.ts
636
- const PRESET = {
637
- typeAware: {
638
- enabled: true,
639
- require: "complete"
640
- },
641
- ignoreExportsUsedInFile: true,
642
- failOnParseError: true,
643
- audit: { gate: "all" },
644
- security: { categories: { include: [
645
- "angular-trusted-html",
646
- "cleartext-transport",
647
- "code-injection",
648
- "command-injection",
649
- "dangerous-html",
650
- "deprecated-cipher",
651
- "dom-document-write",
652
- "dynamic-module-load",
653
- "dynamic-regex",
654
- "electron-unsafe-webpreferences",
655
- "hardcoded-secret",
656
- "header-injection",
657
- "insecure-cookie",
658
- "insecure-randomness",
659
- "insecure-temp-file",
660
- "jquery-html",
661
- "jwt-alg-none",
662
- "jwt-verify-missing-algorithms",
663
- "llm-call-injection",
664
- "mass-assignment",
665
- "mysql-multiple-statements",
666
- "nextjs-open-redirect",
667
- "nosql-injection",
668
- "open-redirect",
669
- "path-traversal",
670
- "permissive-cors",
671
- "postmessage-wildcard-origin",
672
- "prototype-pollution",
673
- "redos-regex",
674
- "resource-amplification",
675
- "route-send-file",
676
- "secret-pii-log",
677
- "secret-to-network",
678
- "sql-injection",
679
- "ssrf",
680
- "ssti",
681
- "template-escape-bypass",
682
- "tls-validation-disabled",
683
- "unsafe-buffer-alloc",
684
- "unsafe-deserialization",
685
- "weak-crypto",
686
- "webview-injection",
687
- "world-writable-permission",
688
- "xpath-injection",
689
- "xxe",
690
- "zip-slip"
691
- ] } },
692
- duplicates: { threshold: 1 },
693
- flags: { sdkPatterns: [
694
- {
695
- function: "getBooleanValue",
696
- nameArg: 0,
697
- provider: "OpenFeature"
698
- },
699
- {
700
- function: "getStringValue",
701
- nameArg: 0,
702
- provider: "OpenFeature"
703
- },
704
- {
705
- function: "getNumberValue",
706
- nameArg: 0,
707
- provider: "OpenFeature"
708
- },
709
- {
710
- function: "getObjectValue",
711
- nameArg: 0,
712
- provider: "OpenFeature"
713
- },
714
- {
715
- function: "getBooleanDetails",
716
- nameArg: 0,
717
- provider: "OpenFeature"
718
- },
719
- {
720
- function: "getStringDetails",
721
- nameArg: 0,
722
- provider: "OpenFeature"
723
- },
724
- {
725
- function: "getNumberDetails",
726
- nameArg: 0,
727
- provider: "OpenFeature"
728
- },
729
- {
730
- function: "getObjectDetails",
731
- nameArg: 0,
732
- provider: "OpenFeature"
733
- },
734
- {
735
- function: "getBoolean",
736
- nameArg: 0,
737
- provider: "OpenFeature (Effect service)"
738
- }
739
- ] },
740
- framework: [
741
- {
742
- name: "vite-plus-adopt",
743
- enablers: ["@r_masseater/msch"],
744
- toolingDependencies: [
745
- "@commitlint/config-conventional",
746
- "@textlint-ja/textlint-rule-preset-ai-writing",
747
- "fallow",
748
- "textlint-rule-preset-ja-technical-writing"
749
- ]
750
- },
751
- {
752
- name: "oxlint-plugin-decision",
753
- enablers: ["@r_masseater/msch"],
754
- entryPoints: ["decision-rules.ts"]
755
- },
756
- {
757
- name: "skills",
758
- enablers: ["skills"],
759
- configPatterns: ["skills-lock.json"],
760
- toolingDependencies: ["skills"]
761
- },
762
- {
763
- name: "tanstack-intent",
764
- enablers: ["@tanstack/intent"],
765
- configPatterns: [".intent/hooks/*.mjs"],
766
- toolingDependencies: ["@tanstack/intent"]
767
- }
768
- ],
769
- rules: {
770
- "unused-files": "error",
771
- "unused-exports": "error",
772
- "unused-types": "error",
773
- "private-type-leaks": "error",
774
- "deprecated-exports-in-use": "error",
775
- "unused-dependencies": "error",
776
- "unused-dev-dependencies": "error",
777
- "unused-optional-dependencies": "error",
778
- "unused-enum-members": "error",
779
- "unused-class-members": "error",
780
- "unused-store-members": "error",
781
- "unprovided-injects": "error",
782
- "unrendered-components": "error",
783
- "unused-component-props": "error",
784
- "unused-component-emits": "error",
785
- "unused-component-inputs": "error",
786
- "unused-component-outputs": "error",
787
- "unused-svelte-events": "error",
788
- "unused-server-actions": "error",
789
- "unused-load-data-keys": "error",
790
- "prop-drilling": "error",
791
- "thin-wrapper": "error",
792
- "duplicate-prop-shape": "error",
793
- "css-token-drift": "error",
794
- "css-duplicate-block": "error",
795
- "css-selector-complexity": "error",
796
- "css-dead-surface": "error",
797
- "css-broken-reference": "error",
798
- "complexity-cyclomatic": "error",
799
- "complexity-cognitive": "error",
800
- "complexity-crap": "error",
801
- "unresolved-imports": "error",
802
- "unlisted-dependencies": "error",
803
- "duplicate-exports": "error",
804
- "type-only-dependencies": "error",
805
- "test-only-dependencies": "error",
806
- "dev-dependencies-in-production": "error",
807
- "circular-dependencies": "error",
808
- "re-export-cycle": "error",
809
- "boundary-violation": "error",
810
- "feature-flags": "error",
811
- "stale-suppressions": "error",
812
- "require-suppression-reason": "error",
813
- "unused-catalog-entries": "error",
814
- "empty-catalog-groups": "error",
815
- "unresolved-catalog-references": "error",
816
- "unused-dependency-overrides": "error",
817
- "misconfigured-dependency-overrides": "error",
818
- "security-client-server-leak": "error",
819
- "security-sink": "error",
820
- "policy-violation": "error",
821
- "invalid-client-export": "error",
822
- "mixed-client-server-barrel": "error",
823
- "misplaced-directive": "error",
824
- "route-collision": "error",
825
- "dynamic-segment-name-conflict": "error"
826
- }
827
- };
828
- const isRecord = (value) => Predicate.isReadonlyObject(value) && !Array.isArray(value);
829
- const mergeValue = (base, own) => {
830
- if (Array.isArray(base) && Array.isArray(own)) return [...base, ...own];
831
- if (isRecord(base) && isRecord(own)) return Record.union(base, own, mergeValue);
832
- return own;
802
+ const anyOf = (subject) => (patterns) => {
803
+ if (Array.isReadonlyArrayEmpty(patterns)) return [];
804
+ return [`matchesAny(${subject}, [${pipe(patterns, Array.map((pattern) => `\`${pattern}\``), Array.join(", "))}])`];
833
805
  };
834
- const fallowOf = (owns) => Array.reduce(owns, PRESET, (merged, own) => Record.union(merged, own, mergeValue));
835
- export { alchemyOverride as _, zennMarkdown as a, exempt as b, structureOf as c, tracedRules as d, lint as f, decision_rules_default as g, decisionTestRules as h, markdownOf as i, videoRules as l, decisionRules as m, MARKDOWN_IGNORES as n, textlintFilters as o, allRulesOf as p, MARKDOWN_RULES as r, textlintPresets as s, fallowOf as t, remotionRules as u, commandsOverride as v, removalPolicyOverride as y };
806
+ const secretsOf = () => ({
807
+ extend: { path: betterleaks },
808
+ filter: pipe([...anyOf("finding.line")(PUBLIC_LINES), ...anyOf(`attributes["path"]`)(EXEMPT_PATHS)], Array.join(" || "))
809
+ });
810
+ export { namedWorkspaces as _, GIT_HOOKS as a, toolsOf as c, recordBuilt as d, existsAt as f, exempt as g, staticPrefix as h, lint as i, forgetBuilt as l, isIgnored as m, secretsOf as n, gitHooksOf as o, isDirectoryAt as p, textlintOf as r, tasksOf as s, BUILT_ALLOWANCES as t, lastBuilt as u, patternOf as v };
836
811
 
837
- //# sourceMappingURL=define-lint-preset-_bDnJMcY.mjs.map
812
+ //# sourceMappingURL=repository-text-CpD8Z1kp.mjs.map