@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.
- package/dist/addon-tasks.mjs +1 -1
- package/dist/build-workspace-settings-C2EOC9GX.mjs +627 -0
- package/dist/build-workspace-settings-C2EOC9GX.mjs.map +1 -0
- package/dist/cargo-inputs.mjs +1 -1
- package/dist/cli.mjs +711 -752
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +13 -37
- package/dist/config.mjs +335 -23
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules-CqgOVodl.mjs +43 -0
- package/dist/decision-rules-CqgOVodl.mjs.map +1 -0
- package/dist/decision-rules.d.mts +2 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{dependencies-Bjn3xWkq.mjs → dependencies-DgltkhvK.mjs} +2 -2
- package/dist/{dependencies-Bjn3xWkq.mjs.map → dependencies-DgltkhvK.mjs.map} +1 -1
- package/dist/{derive-cargo-inputs-BLMqkRS3.mjs → derive-cargo-inputs-DbMOBcGP.mjs} +3 -3
- package/dist/{derive-cargo-inputs-BLMqkRS3.mjs.map → derive-cargo-inputs-DbMOBcGP.mjs.map} +1 -1
- package/dist/{ignored-directories-CaTFIbjo.mjs → ignored-directories-BGiOSvNx.mjs} +2 -2
- package/dist/{ignored-directories-CaTFIbjo.mjs.map → ignored-directories-BGiOSvNx.mjs.map} +1 -1
- package/dist/index-DOkaGaUe.d.mts +25 -0
- package/dist/library.mjs +2 -2
- package/dist/lint.d.mts +38 -2
- package/dist/lint.mjs +20 -1
- package/dist/lint.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{problem-Dk1svgmC.mjs → problem-CkDaLJxX.mjs} +2 -2
- package/dist/{problem-Dk1svgmC.mjs.map → problem-CkDaLJxX.mjs.map} +1 -1
- package/dist/{published-Cgl1qeYH.mjs → published-BrX24558.mjs} +269 -8
- package/dist/published-BrX24558.mjs.map +1 -0
- package/dist/{repository-files-C_GzAnYp.mjs → repository-files-CX48nfE5.mjs} +4 -5
- package/dist/repository-files-CX48nfE5.mjs.map +1 -0
- package/dist/{define-lint-preset-_bDnJMcY.mjs → repository-text-CpD8Z1kp.mjs} +355 -380
- package/dist/repository-text-CpD8Z1kp.mjs.map +1 -0
- package/dist/traced-rules.config-CnYNZrOa.mjs +8 -0
- package/dist/traced-rules.config-CnYNZrOa.mjs.map +1 -0
- package/dist/workspace-settings.mjs +2 -434
- package/dist/zenn-markdown.config-uksui7Go.mjs +77 -0
- package/dist/zenn-markdown.config-uksui7Go.mjs.map +1 -0
- package/package.json +13 -13
- package/skills/msch-checks/SKILL.md +5 -5
- package/skills/msch-publishing/SKILL.md +1 -1
- package/skills/msch-repository-config/SKILL.md +19 -18
- package/skills/msch-workspace-settings/SKILL.md +15 -9
- package/src/app/vite.d.ts +5 -8
- package/dist/define-lint-preset-_bDnJMcY.mjs.map +0 -1
- package/dist/index-_y7Igwy0.d.mts +0 -321
- package/dist/published-Cgl1qeYH.mjs.map +0 -1
- package/dist/repository-files-C_GzAnYp.mjs.map +0 -1
- package/dist/repository-text-BPhi-pct.mjs +0 -331
- package/dist/repository-text-BPhi-pct.mjs.map +0 -1
- package/dist/required-stack-BLSiAmpx.mjs +0 -188
- package/dist/required-stack-BLSiAmpx.mjs.map +0 -1
- package/dist/workspace-projects-Zg078aA1.mjs +0 -269
- package/dist/workspace-projects-Zg078aA1.mjs.map +0 -1
- package/dist/workspace-settings.mjs.map +0 -1
package/dist/config.d.mts
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import { UserConfig } from "vite-plus";
|
|
2
|
-
import { i as WorkspaceSettings, t as AddedRulesValue } from "./index-BXM6N-Rk.mjs";
|
|
3
|
-
import { a as MarkdownOptions, t as FallowConfig } from "./index-_y7Igwy0.mjs";
|
|
4
|
-
import { GitHooksSection } from "@r_masseater/vite-plus-adopt";
|
|
5
2
|
import "effect";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { t as AddedRulesValue } from "./index-BXM6N-Rk.mjs";
|
|
4
|
+
import { t as MarkdownOptions } from "./index-DOkaGaUe.mjs";
|
|
5
|
+
import { GitHooksSection, ToolSections } from "@r_masseater/vite-plus-adopt";
|
|
6
|
+
import "./index-BY9hL-AJ.mjs";
|
|
7
|
+
import "@r_masseater/h56m";
|
|
8
|
+
type FallowConfig = Readonly<Record<string, unknown>>;
|
|
8
9
|
interface CommitOptions {
|
|
9
10
|
readonly subjectScripts: readonly string[];
|
|
10
11
|
}
|
|
11
|
-
export declare const COMMIT_LINT: {
|
|
12
|
-
extends: string[];
|
|
13
|
-
};
|
|
14
12
|
interface UsageOptions {
|
|
15
13
|
readonly endpoint: string;
|
|
16
|
-
readonly apiKeyEnv?: string;
|
|
17
14
|
}
|
|
18
|
-
type
|
|
19
|
-
export declare const GIT_HOOKS: {
|
|
20
|
-
readonly "pre-commit": readonly ["vp staged", "vp exec msch --staged"];
|
|
21
|
-
readonly "commit-msg": readonly ["vp exec msch --commit-msg \"$1\""];
|
|
22
|
-
readonly "pre-push": readonly ["vp exec msch --pre-push", "vp run verify"];
|
|
23
|
-
readonly "post-checkout": readonly ["[ \"$3\" = 0 ] || vp install"];
|
|
24
|
-
readonly "post-merge": readonly ["vp install"];
|
|
25
|
-
readonly "post-rewrite": readonly ["vp install"];
|
|
26
|
-
};
|
|
15
|
+
type ToolsSection = NonNullable<ToolSections["tools"]>;
|
|
27
16
|
interface TextSource {
|
|
28
17
|
readonly files: readonly string[];
|
|
29
18
|
readonly plugins: Readonly<Record<string, boolean | object>>;
|
|
@@ -33,15 +22,13 @@ interface TextOptions {
|
|
|
33
22
|
readonly rules?: Readonly<Record<string, object>>;
|
|
34
23
|
readonly sources?: readonly TextSource[];
|
|
35
24
|
}
|
|
36
|
-
|
|
37
|
-
export declare const PLUGIN_DEPENDENCIES = "Claude Code installs a plugin's dependencies from its own package.json and lockfile, where only exact registry versions install";
|
|
38
|
-
export interface AddedOverride {
|
|
25
|
+
interface AddedOverride {
|
|
39
26
|
readonly files: readonly string[];
|
|
40
27
|
readonly excludeFiles?: readonly string[];
|
|
41
28
|
readonly rules: AddedRulesValue;
|
|
42
29
|
}
|
|
43
|
-
|
|
44
|
-
readonly
|
|
30
|
+
interface RepositoryOptions {
|
|
31
|
+
readonly root: string;
|
|
45
32
|
readonly commit?: CommitOptions;
|
|
46
33
|
readonly overrides?: readonly AddedOverride[];
|
|
47
34
|
readonly textlint?: TextOptions;
|
|
@@ -51,20 +38,9 @@ export interface RepositoryOptions {
|
|
|
51
38
|
readonly remoteCache?: string;
|
|
52
39
|
};
|
|
53
40
|
readonly usage?: UsageOptions;
|
|
54
|
-
readonly
|
|
55
|
-
readonly inputs: CargoInputs;
|
|
56
|
-
};
|
|
41
|
+
readonly tools?: ToolsSection;
|
|
57
42
|
readonly gitHooks?: GitHooksSection;
|
|
58
43
|
readonly fallow?: FallowConfig;
|
|
59
44
|
}
|
|
60
|
-
export declare const
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
export declare const FORMAT: {
|
|
64
|
-
ignorePatterns: string[];
|
|
65
|
-
sortImports: boolean;
|
|
66
|
-
sortTailwindcss: boolean;
|
|
67
|
-
sortPackageJson: boolean;
|
|
68
|
-
};
|
|
69
|
-
export declare const repositoryConfig: (options: RepositoryOptions) => UserConfig;
|
|
70
|
-
export {};
|
|
45
|
+
export declare const repositoryConfig: (options: RepositoryOptions) => Promise<UserConfig>;
|
|
46
|
+
export type { AddedOverride, RepositoryOptions };
|
package/dist/config.mjs
CHANGED
|
@@ -1,14 +1,277 @@
|
|
|
1
|
-
import { Array, Effect, Layer, ManagedRuntime, Option, Record, String, pipe } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Array, Effect, Layer, ManagedRuntime, Option, Predicate, Record, Schema, String, pipe } from "effect";
|
|
2
|
+
import { n as requiredStack, t as workspaceSettings } from "./build-workspace-settings-C2EOC9GX.mjs";
|
|
3
|
+
import { t as cargoInputs } from "./derive-cargo-inputs-DbMOBcGP.mjs";
|
|
4
|
+
import { a as nodeServicesLayer, i as nodeRepositoryFiles, r as RepositoryFiles } from "./repository-files-CX48nfE5.mjs";
|
|
5
|
+
import { a as decisionTestRules } from "./zenn-markdown.config-uksui7Go.mjs";
|
|
6
|
+
import { _ as namedWorkspaces, c as toolsOf, d as recordBuilt, f as existsAt, g as exempt, h as staticPrefix, i as lint, m as isIgnored, n as secretsOf, o as gitHooksOf, p as isDirectoryAt, r as textlintOf, s as tasksOf, v as patternOf } from "./repository-text-CpD8Z1kp.mjs";
|
|
7
|
+
import { mdlct } from "@r_masseater/mdlct/y8";
|
|
8
|
+
import { recommended } from "@r_masseater/y8/presets";
|
|
9
|
+
import { rustCrate, skill, structure, workspace } from "@r_masseater/wism/presets";
|
|
10
|
+
import { t as tracedRules } from "./traced-rules.config-CnYNZrOa.mjs";
|
|
11
|
+
import { recommended as recommended$1 } from "@r_masseater/fu4/presets";
|
|
4
12
|
import { definePlugin, defineRule } from "@r_masseater/fu4";
|
|
5
13
|
import { NOOP, actionOf, keysOf, pairsOf, runOf, valueAt, workflowRule } from "@r_masseater/fu4/rules";
|
|
6
|
-
import {
|
|
7
|
-
import { a as gitHooksOf, d as existsAt, f as isDirectoryAt, g as patternOf, h as namedWorkspaces, i as GIT_HOOKS, m as staticPrefix, n as secretsOf, o as tasksOf, p as isIgnored, r as textlintOf, u as recordBuilt } from "./repository-text-BPhi-pct.mjs";
|
|
14
|
+
import { groupOf } from "@r_masseater/masseater-utils/text";
|
|
8
15
|
import { fileURLToPath } from "node:url";
|
|
9
16
|
import { RuleConfigSeverity } from "@commitlint/types";
|
|
10
17
|
import { RUNTIME_SECTIONS } from "@r_masseater/masseater-utils/kestrion";
|
|
11
|
-
|
|
18
|
+
// src/features/define-lint-preset/config/structure.config.ts
|
|
19
|
+
const isIgnore = Predicate.not(String.startsWith("!"));
|
|
20
|
+
const structureOf = ({ members, ignorePatterns }) => structure({
|
|
21
|
+
kinds: [
|
|
22
|
+
workspace({ paths: members }),
|
|
23
|
+
rustCrate(),
|
|
24
|
+
skill()
|
|
25
|
+
],
|
|
26
|
+
ignores: pipe(ignorePatterns, Array.filter(isIgnore))
|
|
27
|
+
});
|
|
28
|
+
// src/features/define-lint-preset/config/markdown.config.ts
|
|
29
|
+
const skillNamesOf = (indexSkill) => Option.match(indexSkill, {
|
|
30
|
+
onNone: () => ({}),
|
|
31
|
+
onSome: (index) => ({ index })
|
|
32
|
+
});
|
|
33
|
+
const agentDocsOf = (indexSkill) => {
|
|
34
|
+
const skillNames = skillNamesOf(indexSkill);
|
|
35
|
+
return {
|
|
36
|
+
agents: {
|
|
37
|
+
sections: [
|
|
38
|
+
["Tech stack"],
|
|
39
|
+
["Commands"],
|
|
40
|
+
["Rules"]
|
|
41
|
+
],
|
|
42
|
+
commands: ["Commands"],
|
|
43
|
+
stack: ["Tech stack"],
|
|
44
|
+
skillNames
|
|
45
|
+
},
|
|
46
|
+
skills: { skillNames }
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const MARKDOWN_IGNORES = [
|
|
50
|
+
".agents/skills/**",
|
|
51
|
+
"CHANGELOG.md",
|
|
52
|
+
"**/CLAUDE.md",
|
|
53
|
+
...exempt
|
|
54
|
+
];
|
|
55
|
+
const MARKDOWN_RULES = { "agnix/XP-001": "off" };
|
|
56
|
+
const markdownOf = ({ indexSkill, docs = {} }) => {
|
|
57
|
+
const base = agentDocsOf(indexSkill);
|
|
58
|
+
const { agents, skills, ...documents } = docs;
|
|
59
|
+
return {
|
|
60
|
+
extends: [recommended(documents), mdlct({
|
|
61
|
+
agents: {
|
|
62
|
+
...base.agents,
|
|
63
|
+
...agents
|
|
64
|
+
},
|
|
65
|
+
skills: {
|
|
66
|
+
...base.skills,
|
|
67
|
+
...skills
|
|
68
|
+
}
|
|
69
|
+
})],
|
|
70
|
+
rules: MARKDOWN_RULES,
|
|
71
|
+
reportUnusedDirectives: true,
|
|
72
|
+
ignores: MARKDOWN_IGNORES
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
// src/features/define-lint-preset/config/fallow.config.ts
|
|
76
|
+
const PRESET = {
|
|
77
|
+
typeAware: {
|
|
78
|
+
enabled: true,
|
|
79
|
+
require: "complete"
|
|
80
|
+
},
|
|
81
|
+
ignoreExportsUsedInFile: true,
|
|
82
|
+
failOnParseError: true,
|
|
83
|
+
audit: { gate: "all" },
|
|
84
|
+
security: { categories: { include: [
|
|
85
|
+
"angular-trusted-html",
|
|
86
|
+
"cleartext-transport",
|
|
87
|
+
"code-injection",
|
|
88
|
+
"command-injection",
|
|
89
|
+
"dangerous-html",
|
|
90
|
+
"deprecated-cipher",
|
|
91
|
+
"dom-document-write",
|
|
92
|
+
"dynamic-module-load",
|
|
93
|
+
"dynamic-regex",
|
|
94
|
+
"electron-unsafe-webpreferences",
|
|
95
|
+
"hardcoded-secret",
|
|
96
|
+
"header-injection",
|
|
97
|
+
"insecure-cookie",
|
|
98
|
+
"insecure-randomness",
|
|
99
|
+
"insecure-temp-file",
|
|
100
|
+
"jquery-html",
|
|
101
|
+
"jwt-alg-none",
|
|
102
|
+
"jwt-verify-missing-algorithms",
|
|
103
|
+
"llm-call-injection",
|
|
104
|
+
"mass-assignment",
|
|
105
|
+
"mysql-multiple-statements",
|
|
106
|
+
"nextjs-open-redirect",
|
|
107
|
+
"nosql-injection",
|
|
108
|
+
"open-redirect",
|
|
109
|
+
"path-traversal",
|
|
110
|
+
"permissive-cors",
|
|
111
|
+
"postmessage-wildcard-origin",
|
|
112
|
+
"prototype-pollution",
|
|
113
|
+
"redos-regex",
|
|
114
|
+
"resource-amplification",
|
|
115
|
+
"route-send-file",
|
|
116
|
+
"secret-pii-log",
|
|
117
|
+
"secret-to-network",
|
|
118
|
+
"sql-injection",
|
|
119
|
+
"ssrf",
|
|
120
|
+
"ssti",
|
|
121
|
+
"template-escape-bypass",
|
|
122
|
+
"tls-validation-disabled",
|
|
123
|
+
"unsafe-buffer-alloc",
|
|
124
|
+
"unsafe-deserialization",
|
|
125
|
+
"weak-crypto",
|
|
126
|
+
"webview-injection",
|
|
127
|
+
"world-writable-permission",
|
|
128
|
+
"xpath-injection",
|
|
129
|
+
"xxe",
|
|
130
|
+
"zip-slip"
|
|
131
|
+
] } },
|
|
132
|
+
duplicates: { threshold: 1 },
|
|
133
|
+
flags: { sdkPatterns: [
|
|
134
|
+
{
|
|
135
|
+
function: "getBooleanValue",
|
|
136
|
+
nameArg: 0,
|
|
137
|
+
provider: "OpenFeature"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
function: "getStringValue",
|
|
141
|
+
nameArg: 0,
|
|
142
|
+
provider: "OpenFeature"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
function: "getNumberValue",
|
|
146
|
+
nameArg: 0,
|
|
147
|
+
provider: "OpenFeature"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
function: "getObjectValue",
|
|
151
|
+
nameArg: 0,
|
|
152
|
+
provider: "OpenFeature"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
function: "getBooleanDetails",
|
|
156
|
+
nameArg: 0,
|
|
157
|
+
provider: "OpenFeature"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
function: "getStringDetails",
|
|
161
|
+
nameArg: 0,
|
|
162
|
+
provider: "OpenFeature"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
function: "getNumberDetails",
|
|
166
|
+
nameArg: 0,
|
|
167
|
+
provider: "OpenFeature"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
function: "getObjectDetails",
|
|
171
|
+
nameArg: 0,
|
|
172
|
+
provider: "OpenFeature"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
function: "getBoolean",
|
|
176
|
+
nameArg: 0,
|
|
177
|
+
provider: "OpenFeature (Effect service)"
|
|
178
|
+
}
|
|
179
|
+
] },
|
|
180
|
+
framework: [
|
|
181
|
+
{
|
|
182
|
+
name: "vite-plus-adopt",
|
|
183
|
+
enablers: ["@r_masseater/msch"],
|
|
184
|
+
toolingDependencies: [
|
|
185
|
+
"@commitlint/config-conventional",
|
|
186
|
+
"@textlint-ja/textlint-rule-preset-ai-writing",
|
|
187
|
+
"fallow",
|
|
188
|
+
"textlint-rule-preset-ja-technical-writing"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "oxlint-plugin-decision",
|
|
193
|
+
enablers: ["@r_masseater/msch"],
|
|
194
|
+
entryPoints: ["decision-rules.ts"]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "skills",
|
|
198
|
+
enablers: ["skills"],
|
|
199
|
+
configPatterns: ["skills-lock.json"],
|
|
200
|
+
toolingDependencies: ["skills"]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "tanstack-intent",
|
|
204
|
+
enablers: ["@tanstack/intent"],
|
|
205
|
+
configPatterns: [".intent/hooks/*.mjs"],
|
|
206
|
+
toolingDependencies: ["@tanstack/intent"]
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
rules: {
|
|
210
|
+
"unused-files": "error",
|
|
211
|
+
"unused-exports": "error",
|
|
212
|
+
"unused-types": "error",
|
|
213
|
+
"private-type-leaks": "error",
|
|
214
|
+
"deprecated-exports-in-use": "error",
|
|
215
|
+
"unused-dependencies": "error",
|
|
216
|
+
"unused-dev-dependencies": "error",
|
|
217
|
+
"unused-optional-dependencies": "error",
|
|
218
|
+
"unused-enum-members": "error",
|
|
219
|
+
"unused-class-members": "error",
|
|
220
|
+
"unused-store-members": "error",
|
|
221
|
+
"unprovided-injects": "error",
|
|
222
|
+
"unrendered-components": "error",
|
|
223
|
+
"unused-component-props": "error",
|
|
224
|
+
"unused-component-emits": "error",
|
|
225
|
+
"unused-component-inputs": "error",
|
|
226
|
+
"unused-component-outputs": "error",
|
|
227
|
+
"unused-svelte-events": "error",
|
|
228
|
+
"unused-server-actions": "error",
|
|
229
|
+
"unused-load-data-keys": "error",
|
|
230
|
+
"prop-drilling": "error",
|
|
231
|
+
"thin-wrapper": "error",
|
|
232
|
+
"duplicate-prop-shape": "error",
|
|
233
|
+
"css-token-drift": "error",
|
|
234
|
+
"css-duplicate-block": "error",
|
|
235
|
+
"css-selector-complexity": "error",
|
|
236
|
+
"css-dead-surface": "error",
|
|
237
|
+
"css-broken-reference": "error",
|
|
238
|
+
"complexity-cyclomatic": "error",
|
|
239
|
+
"complexity-cognitive": "error",
|
|
240
|
+
"complexity-crap": "error",
|
|
241
|
+
"unresolved-imports": "error",
|
|
242
|
+
"unlisted-dependencies": "error",
|
|
243
|
+
"duplicate-exports": "error",
|
|
244
|
+
"type-only-dependencies": "error",
|
|
245
|
+
"test-only-dependencies": "error",
|
|
246
|
+
"dev-dependencies-in-production": "error",
|
|
247
|
+
"circular-dependencies": "error",
|
|
248
|
+
"re-export-cycle": "error",
|
|
249
|
+
"boundary-violation": "error",
|
|
250
|
+
"feature-flags": "error",
|
|
251
|
+
"stale-suppressions": "error",
|
|
252
|
+
"require-suppression-reason": "error",
|
|
253
|
+
"unused-catalog-entries": "error",
|
|
254
|
+
"empty-catalog-groups": "error",
|
|
255
|
+
"unresolved-catalog-references": "error",
|
|
256
|
+
"unused-dependency-overrides": "error",
|
|
257
|
+
"misconfigured-dependency-overrides": "error",
|
|
258
|
+
"security-client-server-leak": "error",
|
|
259
|
+
"security-sink": "error",
|
|
260
|
+
"policy-violation": "error",
|
|
261
|
+
"invalid-client-export": "error",
|
|
262
|
+
"mixed-client-server-barrel": "error",
|
|
263
|
+
"misplaced-directive": "error",
|
|
264
|
+
"route-collision": "error",
|
|
265
|
+
"dynamic-segment-name-conflict": "error"
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const isRecord = (value) => Predicate.isReadonlyObject(value) && !Array.isArray(value);
|
|
269
|
+
const mergeValue = (base, own) => {
|
|
270
|
+
if (Array.isArray(base) && Array.isArray(own)) return [...base, ...own];
|
|
271
|
+
if (isRecord(base) && isRecord(own)) return Record.union(base, own, mergeValue);
|
|
272
|
+
return own;
|
|
273
|
+
};
|
|
274
|
+
const fallowOf = (owns) => Array.reduce(owns, PRESET, (merged, own) => Record.union(merged, own, mergeValue));
|
|
12
275
|
// src/features/guard-workflows/model/yaml.ts
|
|
13
276
|
const rootOf = ({ source }) => Option.fromNullishOr(source.yaml);
|
|
14
277
|
const stringOf = (node) => pipe(node, Option.filter(({ kind }) => kind === "scalar"), Option.map(({ value, line, column }) => ({
|
|
@@ -41,8 +304,10 @@ const descend = (...keys) => (node) => {
|
|
|
41
304
|
// src/features/guard-workflows/model/publish-trigger.ts
|
|
42
305
|
const PUBLISH = /\bmsch\s+publish\s+(?:plan|npm|release)\b/u;
|
|
43
306
|
const MANUAL = "workflow_dispatch";
|
|
307
|
+
const CALLED = "workflow_call";
|
|
308
|
+
const PUBLISH_WORKFLOW = /\/\.github\/workflows\/publish\.ya?ml(?:@|$)/u;
|
|
44
309
|
const TRIGGER_KEY = "on";
|
|
45
|
-
const MESSAGE$5 = "publishes with `msch publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch publish dispatch`.";
|
|
310
|
+
const MESSAGE$5 = "publishes with `msch publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps, or the call of the shared publish workflow, in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch publish dispatch`. A reusable workflow may also take `workflow_call`, because its callers meet the same rule.";
|
|
46
311
|
const triggersOf = (node) => {
|
|
47
312
|
if (node.kind === "scalar") return [node.value];
|
|
48
313
|
if (node.kind === "sequence") return pipe(node.children, Array.map(({ value }) => value));
|
|
@@ -50,18 +315,21 @@ const triggersOf = (node) => {
|
|
|
50
315
|
};
|
|
51
316
|
/** @internal */
|
|
52
317
|
const publishTrigger = workflowRule({
|
|
53
|
-
description: "Reports msch publish steps in a workflow that something other than workflow_dispatch starts",
|
|
318
|
+
description: "Reports msch publish steps, or a call of the shared publish workflow, in a workflow that something other than workflow_dispatch starts",
|
|
54
319
|
visitor: (fail, context) => {
|
|
55
320
|
const publishing = [];
|
|
56
321
|
return {
|
|
57
322
|
...NOOP,
|
|
323
|
+
jobPre: (job) => {
|
|
324
|
+
if (pipe(Option.fromNullishOr(job.workflowCall), Option.flatMap(({ uses }) => Option.fromNullishOr(uses)), Option.exists(({ value }) => PUBLISH_WORKFLOW.test(value)))) publishing.push(MANUAL);
|
|
325
|
+
},
|
|
58
326
|
step: (step) => {
|
|
59
327
|
if (pipe(runOf(step), Option.flatMap(({ run }) => Option.fromNullishOr(run)), Option.exists(({ value }) => PUBLISH.test(value)))) publishing.push(MANUAL);
|
|
60
328
|
},
|
|
61
329
|
workflowPost: () => {
|
|
62
330
|
const root = rootOf(context);
|
|
63
331
|
const triggers = pipe(childOf(TRIGGER_KEY)(root), Option.map(triggersOf), Option.getOrElse(() => []));
|
|
64
|
-
const manualOnly = pipe(triggers, Array.every((trigger) => trigger === MANUAL));
|
|
332
|
+
const manualOnly = pipe(triggers, Array.every((trigger) => trigger === MANUAL || trigger === CALLED));
|
|
65
333
|
if (Array.isReadonlyArrayNonEmpty(publishing) && !manualOnly) for (const key of pipe(root, keyNodeOf(TRIGGER_KEY), Option.toArray)) fail(key, MESSAGE$5);
|
|
66
334
|
}
|
|
67
335
|
};
|
|
@@ -413,20 +681,28 @@ const workflowPolicy = () => ({
|
|
|
413
681
|
});
|
|
414
682
|
// src/features/guard-workflows/model/fu4-config.ts
|
|
415
683
|
/** @internal */
|
|
416
|
-
const fu4Of = () => ({ extends: [recommended(), workflowPolicy()] });
|
|
684
|
+
const fu4Of = () => ({ extends: [recommended$1(), workflowPolicy()] });
|
|
417
685
|
const COMMIT_LINT = { extends: [fileURLToPath(import.meta.resolve("@commitlint/config-conventional"))] };
|
|
418
686
|
const SUBJECT_SCRIPT = "subject-script";
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
687
|
+
const JAPANESE_SCRIPTS = [
|
|
688
|
+
"Hiragana",
|
|
689
|
+
"Katakana",
|
|
690
|
+
"Han"
|
|
691
|
+
];
|
|
692
|
+
const commitlintOf = (commit) => {
|
|
693
|
+
const subjectScripts = pipe(Option.fromUndefinedOr(commit), Option.match({
|
|
694
|
+
onNone: () => JAPANESE_SCRIPTS,
|
|
695
|
+
onSome: (options) => options.subjectScripts
|
|
696
|
+
}));
|
|
697
|
+
return {
|
|
422
698
|
...COMMIT_LINT,
|
|
423
699
|
rules: { [SUBJECT_SCRIPT]: [
|
|
424
700
|
RuleConfigSeverity.Error,
|
|
425
701
|
"always",
|
|
426
702
|
[...subjectScripts]
|
|
427
703
|
] }
|
|
428
|
-
}
|
|
429
|
-
}
|
|
704
|
+
};
|
|
705
|
+
};
|
|
430
706
|
// src/app/repository-dependencies.ts
|
|
431
707
|
const allowedIn = (allowances, fields) => pipe(allowances, Record.map(({ workspaces, dependencies }) => ({
|
|
432
708
|
workspaces,
|
|
@@ -440,8 +716,7 @@ const dependencyRulesOf = (workspace) => ({
|
|
|
440
716
|
...allowedIn(workspace.dependencies, RUNTIME_SECTIONS)
|
|
441
717
|
},
|
|
442
718
|
banned: requiredStack,
|
|
443
|
-
exactDependencies: { [PLUGIN_DEPENDENCIES]: workspace.plugins }
|
|
444
|
-
peerRanges: "intersect"
|
|
719
|
+
exactDependencies: { [PLUGIN_DEPENDENCIES]: workspace.plugins }
|
|
445
720
|
});
|
|
446
721
|
// src/app/repository-config.ts
|
|
447
722
|
const cacheOf = (remoteCache) => pipe(Option.fromNullishOr(remoteCache), Option.match({
|
|
@@ -471,10 +746,10 @@ const added = ({ files, excludeFiles, rules }) => pipe(Option.fromUndefinedOr(ex
|
|
|
471
746
|
})
|
|
472
747
|
}));
|
|
473
748
|
const lintOf = ({ workspace, overrides = [] }) => ({
|
|
474
|
-
...lint
|
|
749
|
+
...lint,
|
|
475
750
|
ignorePatterns: exempt,
|
|
476
751
|
overrides: [
|
|
477
|
-
...lint
|
|
752
|
+
...lint.overrides,
|
|
478
753
|
{
|
|
479
754
|
files: [...workspace.lint.shadcnUi],
|
|
480
755
|
rules: { "react/jsx-props-no-spreading": "off" }
|
|
@@ -505,10 +780,10 @@ const lintOf = ({ workspace, overrides = [] }) => ({
|
|
|
505
780
|
}
|
|
506
781
|
]
|
|
507
782
|
});
|
|
508
|
-
|
|
783
|
+
/** @internal */
|
|
784
|
+
const configOf = (options) => {
|
|
509
785
|
const { workspace, commit, textlint = {}, markdown = {}, run = {}, usage, cargo, gitHooks, fallow } = options;
|
|
510
786
|
const ownFallow = Option.toArray(Option.fromUndefinedOr(fallow));
|
|
511
|
-
const cargoInputs = Option.map(Option.fromUndefinedOr(cargo), ({ inputs }) => inputs);
|
|
512
787
|
return recordBuilt({
|
|
513
788
|
commitlint: commitlintOf(commit),
|
|
514
789
|
dependencyRules: dependencyRulesOf(workspace),
|
|
@@ -527,6 +802,7 @@ const repositoryConfig = (options) => {
|
|
|
527
802
|
}),
|
|
528
803
|
fu4: fu4Of(),
|
|
529
804
|
fallow: fallowOf([...workspace.fallow, ...ownFallow]),
|
|
805
|
+
tools: toolsOf(options.tools),
|
|
530
806
|
test: {
|
|
531
807
|
projects: [...workspace.testProjects],
|
|
532
808
|
passWithNoTests: true
|
|
@@ -541,11 +817,47 @@ const repositoryConfig = (options) => {
|
|
|
541
817
|
workspace,
|
|
542
818
|
commands: run.tasks ?? {},
|
|
543
819
|
usage: Option.fromUndefinedOr(usage),
|
|
544
|
-
cargo
|
|
820
|
+
cargo
|
|
545
821
|
})
|
|
546
822
|
}
|
|
547
823
|
});
|
|
548
824
|
};
|
|
549
|
-
|
|
825
|
+
// src/app/config.ts
|
|
826
|
+
const CARGO_MANIFEST = "Cargo.toml";
|
|
827
|
+
const derivedCargo = Effect.fn("derivedCargo")(function* derivedCargo(root) {
|
|
828
|
+
const files = yield* RepositoryFiles;
|
|
829
|
+
if (!(yield* files.exists(files.join(root, CARGO_MANIFEST)))) return Option.none();
|
|
830
|
+
const inputs = yield* Effect.promise(() => cargoInputs({ directory: root }));
|
|
831
|
+
return Option.some(inputs);
|
|
832
|
+
});
|
|
833
|
+
const Manifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));
|
|
834
|
+
const repositoryName = Effect.fn("repositoryName")(function* repositoryName(root) {
|
|
835
|
+
const files = yield* RepositoryFiles;
|
|
836
|
+
return (yield* (yield* files.readFile(files.join(root, "package.json"))).pipe(Option.getOrElse(() => "{}"), Schema.decodeEffect(Manifest), Effect.orDie)).name;
|
|
837
|
+
});
|
|
838
|
+
const remoteCacheOf = Effect.fn("remoteCacheOf")(function* remoteCacheOf(root, base) {
|
|
839
|
+
const name = yield* repositoryName(root);
|
|
840
|
+
return `${String.replace(/\/+$/u, "")(base)}/${encodeURIComponent(name)}`;
|
|
841
|
+
});
|
|
842
|
+
const derivedRun = (root, run) => Option.fromNullishOr(run.remoteCache).pipe(Option.match({
|
|
843
|
+
onNone: () => Effect.succeed(run),
|
|
844
|
+
onSome: (base) => remoteCacheOf(root, base).pipe(Effect.map((remoteCache) => ({
|
|
845
|
+
...run,
|
|
846
|
+
remoteCache
|
|
847
|
+
})))
|
|
848
|
+
}));
|
|
849
|
+
const derivedConfig = Effect.fn("derivedConfig")(function* derivedConfig({ root, run = {}, ...options }) {
|
|
850
|
+
const workspace = yield* Effect.promise(() => workspaceSettings({ root }));
|
|
851
|
+
const cargo = yield* derivedCargo(root);
|
|
852
|
+
const derived = yield* derivedRun(root, run);
|
|
853
|
+
return configOf({
|
|
854
|
+
...options,
|
|
855
|
+
run: derived,
|
|
856
|
+
workspace,
|
|
857
|
+
cargo
|
|
858
|
+
});
|
|
859
|
+
});
|
|
860
|
+
const repositoryConfig = (options) => Effect.runPromise(derivedConfig(options).pipe(Effect.provide(nodeRepositoryFiles)));
|
|
861
|
+
export { repositoryConfig };
|
|
550
862
|
|
|
551
863
|
//# sourceMappingURL=config.mjs.map
|