@r_masseater/vite-plus-adopt 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # vite-plus-adopt
2
2
 
3
- `vpa` は、Betterleaks・actionlint・zizmor・commitlint・textlint・markdownlint・Steiger・fallow とエージェントスキルの導入を Vite+ に取り込む CLI である。設定と依存の規則を `vite.config.ts` に書くと、そこから読んで動かす。
4
- 引数なしの `vpa` を 1 回実行すると、設定のある検査をすべて並行して動かし、結果をまとめて出す。
5
- TypeScript 7 だけで動く Feature-Sliced Design の Steiger プラグインと @arethetypeswrong/core も同梱する。
3
+ `vpa` is a CLI that brings Betterleaks, actionlint, zizmor, commitlint, textlint, markdownlint, Steiger, fallow and agent skill installation into Vite+. Write their settings and your dependency rules in `vite.config.ts`, and `vpa` reads them from there.
4
+ Running `vpa` once with no arguments runs every configured check in parallel and prints the results together.
5
+ It also bundles a Feature-Sliced Design plugin for Steiger and @arethetypeswrong/core, both running on TypeScript 7 alone.
6
6
 
7
- ## 公開先
7
+ ## Published to
8
8
 
9
9
  - npm: [@r_masseater/vite-plus-adopt](https://www.npmjs.com/package/@r_masseater/vite-plus-adopt)
10
10
 
11
- ## 使い方
11
+ ## Usage
12
12
 
13
13
  ```sh
14
14
  vp add -D @r_masseater/vite-plus-adopt
15
15
  ```
16
16
 
17
- postinstall を許すため、`pnpm-workspace.yaml` の `allowBuilds` に足す。
17
+ Allow its postinstall by adding it to `allowBuilds` in `pnpm-workspace.yaml`.
18
18
 
19
19
  ```yaml
20
20
  allowBuilds:
@@ -29,13 +29,13 @@ import { defineConfig } from "vite-plus";
29
29
  export default defineConfig({
30
30
  commitlint: { extends: ["@commitlint/config-conventional"] },
31
31
  dependencyRules: {
32
- banned: { "テストは vite-plus/test から読む": ["vitest", "@vitest/*"] },
32
+ banned: { "Import tests from vite-plus/test": ["vitest", "@vitest/*"] },
33
33
  peerRanges: "intersect",
34
34
  },
35
35
  betterleaks: {
36
36
  extend: { useDefault: true },
37
37
  filter: 'matchesAny(finding.line, [`\\bCF_BEACON_TOKEN = "[0-9a-f]{32}"`])',
38
- ignoredSecrets: ["<秘密の SHA-256>"],
38
+ ignoredSecrets: ["<SHA-256 of the secret>"],
39
39
  },
40
40
  steiger: { paths: ["apps/*/src"], rules: [...fsd.configs.recommended] },
41
41
  textlint: {
@@ -48,11 +48,11 @@ export default defineConfig({
48
48
  });
49
49
  ```
50
50
 
51
- `import type {} from "@r_masseater/vite-plus-adopt"` で、`defineConfig` に上の 8 つのキーの型が付く。
52
- textlint は Git が追跡する Markdown を検査する。ほかのファイルも検査するときは、`textlint.sources` に対象の glob(`files`)とそのファイルに当てる設定を並べる。`presets` はそこでも使える。
53
- Steiger は `steiger.paths` に合うディレクトリのうち、直下に FSD のレイヤー(`app`・`pages`・`widgets`・`features`・`entities`・`shared` など)のフォルダを持つものだけを検査する。
51
+ `import type {} from "@r_masseater/vite-plus-adopt"` types the 8 keys above on `defineConfig`.
52
+ textlint checks the Markdown files Git tracks. To check other files too, list their globs (`files`) and the settings for them in `textlint.sources`. `presets` work there as well.
53
+ Steiger checks only the directories matching `steiger.paths` that directly contain FSD layer folders (`app`, `pages`, `widgets`, `features`, `entities`, `shared` and so on).
54
54
 
55
- Git のフックは次のように書く。
55
+ Write the Git hooks like this.
56
56
 
57
57
  ```sh
58
58
  # .vite-hooks/pre-commit
@@ -61,9 +61,9 @@ vpa --staged
61
61
  vpa --commit-msg "$1"
62
62
  ```
63
63
 
64
- ## エージェントスキル
64
+ ## Agent skills
65
65
 
66
- `skills` に GitHub のリポジトリとコミットを書くと、`vpa --prepare` がそのスキルを `.agents/skills/` に置く。スキルは `SKILL.md` の `name` で選び、`"all"` は `root` の下のすべてを選ぶ。
66
+ List GitHub repositories and commits in `skills`, and `vpa --prepare` puts their skills in `.agents/skills/`. Skills are picked by the `name` in `SKILL.md`, and `"all"` picks every skill under `root`.
67
67
 
68
68
  ```ts
69
69
  export default defineConfig({
@@ -79,21 +79,21 @@ export default defineConfig({
79
79
  });
80
80
  ```
81
81
 
82
- 取得したスキルは `~/.cache/vpa/skills/`(`XDG_CACHE_HOME`、Windows では `LOCALAPPDATA` の下)に読み取り専用で置く。`.agents/skills/` からはシンボリックリンク(Windows ではジャンクション)で指す。同じコミットはマシンのどのワークツリーでも取り直さない。非公開のリポジトリは `GITHUB_TOKEN` で取る。
82
+ Fetched skills are stored read-only in `~/.cache/vpa/skills/` (under `XDG_CACHE_HOME`, or `LOCALAPPDATA` on Windows), and `.agents/skills/` points to them with symbolic links (junctions on Windows). A commit is fetched once per machine and shared by every worktree. Private repositories are fetched with `GITHUB_TOKEN`.
83
83
 
84
- `./` で始まるキーは、このリポジトリのフォルダである。コミットは書かず、`SKILL.md` を持つ直下のフォルダをそのまま指す。
84
+ A key starting with `./` is a folder in this repository. It takes no commit and points directly to the folders under it that contain `SKILL.md`.
85
85
 
86
- `prepare` には `vpa --prepare` を書く。Renovate がコミットを更新できるように、`renovate.json` で次のプリセットを読む。
86
+ Put `vpa --prepare` in `prepare`. To let Renovate update the commits, extend this preset in `renovate.json`.
87
87
 
88
88
  ```json
89
89
  { "extends": ["github>masseater/masseater.dev//libs/vite-plus-adopt/renovate"] }
90
90
  ```
91
91
 
92
- ## Feature-Sliced Design のプラグイン
92
+ ## Feature-Sliced Design plugin
93
93
 
94
- `@r_masseater/vite-plus-adopt/fsd` は [@feature-sliced/steiger-plugin][fsd-plugin] 0.8.2 を同梱したもので、ルールと `configs.recommended` は元と同じである。
95
- steiger 本体も `@feature-sliced/steiger-plugin` に依存し、それが TypeScript 5 を引き込む。
96
- vpa は steiger の CLI を使わないので、`pnpm-workspace.yaml` の `overrides` で外せる。
94
+ `@r_masseater/vite-plus-adopt/fsd` bundles [@feature-sliced/steiger-plugin][fsd-plugin] 0.8.2, with the same rules and `configs.recommended` as the original.
95
+ steiger itself also depends on `@feature-sliced/steiger-plugin`, which pulls in TypeScript 5.
96
+ vpa does not use the steiger CLI, so you can drop it with `overrides` in `pnpm-workspace.yaml`.
97
97
 
98
98
  ```yaml
99
99
  overrides:
@@ -102,10 +102,10 @@ overrides:
102
102
 
103
103
  [fsd-plugin]: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd
104
104
 
105
- ## @arethetypeswrong/core の置き換え
105
+ ## Replacement for @arethetypeswrong/core
106
106
 
107
- `@r_masseater/vite-plus-adopt/attw` は [@arethetypeswrong/core][attw] 0.18.5 と同じ API を、TypeScript 7.1 だけで出す。
108
- `pack.attw.module` にこれを渡せば、`@arethetypeswrong/core` を入れずに同じ検査が動く。
107
+ `@r_masseater/vite-plus-adopt/attw` provides the same API as [@arethetypeswrong/core][attw] 0.18.5, on TypeScript 7.1 alone.
108
+ Pass it to `pack.attw.module`, and the same checks run without installing `@arethetypeswrong/core`.
109
109
 
110
110
  ```ts
111
111
  import * as attw from "@r_masseater/vite-plus-adopt/attw";
@@ -120,6 +120,6 @@ export default defineConfig({
120
120
 
121
121
  [attw]: https://github.com/arethetypeswrong/arethetypeswrong.github.io/tree/main/packages/core
122
122
 
123
- ## ライセンス
123
+ ## License
124
124
 
125
- MIT。`dist/fsd.mjs`・`dist/parsers`・`dist/attw.mjs` に同梱した元のパッケージのライセンスは `THIRD-PARTY-NOTICES` にある。
125
+ MIT. The licenses of the original packages bundled in `dist/fsd.mjs`, `dist/parsers` and `dist/attw.mjs` are in `THIRD-PARTY-NOTICES`.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "./run-cli-BiPFbX9J.mjs";
3
- import { t as runVpa } from "./vpa-B2qvWn3Q.mjs";
3
+ import { t as runVpa } from "./vpa-B3VOYbg1.mjs";
4
4
  import { Effect, Path, Stdio } from "effect";
5
5
  // src/app/cli.ts
6
6
  runCli(Effect.gen(function* main() {
package/dist/fsd.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { s as SteigerConfig } from "./index-vq2Re-JL.mjs";
1
+ import { s as SteigerConfig } from "./index-HO_uRepr.mjs";
2
2
  export interface FsdPlugin {
3
3
  readonly plugin: SteigerConfig[number];
4
4
  readonly configs: {
@@ -1,9 +1,112 @@
1
- import { t as defineConfig } from "./steiger-Bi33gRXU.mjs";
2
1
  import { Effect, Path, Schema } from "effect";
3
2
  import { TextlintRcConfig } from "@textlint/config-loader";
4
3
  import { TextlintKernelRule } from "@textlint/kernel";
4
+ import "effector";
5
5
  import { UserConfig } from "@commitlint/types";
6
6
  import { Configuration, Rule } from "markdownlint";
7
+ interface File {
8
+ type: 'file';
9
+ path: string;
10
+ }
11
+ interface Folder {
12
+ type: 'folder';
13
+ path: string;
14
+ children: Array<File | Folder>;
15
+ }
16
+ type BaseRuleOptions = Record<string, unknown>;
17
+ interface Rule$1<Context = unknown, RuleOptions extends BaseRuleOptions = BaseRuleOptions, RuleName extends string | number | symbol = string> {
18
+ /** Short code name for the rule. */
19
+ name: RuleName;
20
+ check: (this: Context, root: Folder, ruleOptions: RuleOptions) => RuleResult | Promise<RuleResult>;
21
+ }
22
+ interface RuleResult {
23
+ diagnostics: Array<PartialDiagnostic>;
24
+ }
25
+ interface PartialDiagnostic {
26
+ message: string;
27
+ fixes?: Array<Fix>;
28
+ location: {
29
+ /** Absolute path to a folder or a file that contains the issue. */
30
+ path: string;
31
+ /** 1-based line and column indexes of the start of the issue. */
32
+ start?: {
33
+ /** 1-based line index of the start of the issue. */
34
+ line?: number;
35
+ /** 1-based column index of the start of the issue. */
36
+ column?: number;
37
+ };
38
+ /** 1-based line and column indexes of the end of the issue. */
39
+ end?: {
40
+ /** 1-based line index of the end of the issue. */
41
+ line?: number;
42
+ /** 1-based column index of the end of the issue. */
43
+ column?: number;
44
+ };
45
+ };
46
+ }
47
+ type Fix = {
48
+ type: 'rename';
49
+ path: string;
50
+ newName: string;
51
+ } | {
52
+ type: 'create-file';
53
+ path: string;
54
+ content: string;
55
+ } | {
56
+ type: 'create-folder';
57
+ path: string;
58
+ } | {
59
+ type: 'delete';
60
+ path: string;
61
+ } | {
62
+ type: 'modify-file';
63
+ path: string;
64
+ content: string;
65
+ };
66
+ type Config$1<Rules extends Array<Rule$1>> = Array<ConfigObject<Rules> | Plugin<unknown, Rules> | GlobalIgnore>;
67
+ type Severity = 'off' | 'warn' | 'error';
68
+ /**
69
+ * Extracts a union of rule names from a given tuple of `Rule` objects.
70
+ *
71
+ * @example
72
+ * type Context = unknown
73
+ * type Options = BaseRuleOptions
74
+ * type Result = RuleNames<[Rule<Context, Options, 'foo'>, Rule<Context, Options, 'bar'>]>
75
+ * // Result is 'foo' | 'bar'
76
+ */
77
+ type RuleNames<Rules extends Array<Rule$1>> = Rules[number]['name'];
78
+ type LookUpByName<Union, Name> = Union extends {
79
+ name: Name;
80
+ } ? Union : never;
81
+ /**
82
+ * Looks up a rule in a tuple of rules by name and then extracts that rule's options type.
83
+ *
84
+ * @example
85
+ * type Context = unknown
86
+ * type Rules = [Rule<Context, { foo: string }, 'foo'>, Rule<Context, { bar: number }, 'bar'>]
87
+ * type Result = OptionsForRule<Rules, 'foo'>
88
+ * // Result is { foo: string }
89
+ */
90
+ type OptionsForRule<Rules extends Array<Rule$1>, RuleName extends RuleNames<Rules>> = LookUpByName<Rules[number], RuleName> extends Rule$1<unknown, infer Options> ? Options : never;
91
+ interface ConfigObject<Rules extends Array<Rule$1>> {
92
+ /** Globs of files to check. */
93
+ files?: Array<string>;
94
+ /** Globs of files to ignore. */
95
+ ignores?: Array<string>;
96
+ /** Severity of rules and individual rule options. */
97
+ rules: { [key in RuleNames<Rules>]?: Severity | [Severity, OptionsForRule<Rules, key>]; };
98
+ }
99
+ type GlobalIgnore = {
100
+ ignores: Array<string>;
101
+ };
102
+ interface Plugin<Context = unknown, Rules extends Array<Rule$1<Context>> = Array<Rule$1>> {
103
+ meta: {
104
+ name: string;
105
+ version: string;
106
+ };
107
+ ruleDefinitions: Rules;
108
+ }
109
+ declare function defineConfig<Rules extends Array<Rule$1> = Array<Rule$1>>(config: Config$1<Rules>): Config$1<Rules>;
7
110
  declare const VpToolsError_base: Schema.Class<VpToolsError, Schema.TaggedStruct<"VpToolsError", {
8
111
  readonly kind: Schema.Literals<readonly ["config-missing", "tool-failed", "checks-failed"]>;
9
112
  readonly message: Schema.String;
@@ -103,4 +206,4 @@ declare module "vite" {
103
206
  interface UserConfig extends ToolSections {}
104
207
  }
105
208
  export { FallowConfig as a, SteigerSection as c, SkillsSection as d, VpToolsError as f, DependencyRules as i, TextlintConfig as l, BetterleaksRule as n, MarkdownlintConfig as o, CommitlintConfig as r, SteigerConfig as s, BetterleaksConfig as t, ToolSections as u };
106
- //# sourceMappingURL=index-vq2Re-JL.d.mts.map
209
+ //# sourceMappingURL=index-HO_uRepr.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as FallowConfig, c as SteigerSection, d as SkillsSection, f as VpToolsError, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./index-vq2Re-JL.mjs";
1
+ import { a as FallowConfig, c as SteigerSection, d as SkillsSection, f as VpToolsError, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./index-HO_uRepr.mjs";
2
2
  import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
3
3
  import { ChildProcessSpawner } from "effect/process";
4
4
  /** @internal */
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as loadViteConfig, t as runVpa } from "./vpa-B2qvWn3Q.mjs";
1
+ import { n as loadViteConfig, t as runVpa } from "./vpa-B3VOYbg1.mjs";
2
2
  import { d as VpToolsError } from "./output-BdvTIQ-k.mjs";
3
3
  export { VpToolsError, loadViteConfig, runVpa };
@@ -5939,287 +5939,6 @@ var linter = {
5939
5939
  return [runRulesFx.doneData, () => watcher.close()];
5940
5940
  }
5941
5941
  };
5942
- // ../../node_modules/.pnpm/steiger@0.10.0_typescript@7.1.0-beta/node_modules/steiger/dist/app.d.ts
5943
- var [File$1] = [
5944
- 26,
5945
- () => [],
5946
- ["", ""]
5947
- ];
5948
- var [Folder] = [
5949
- 27,
5950
- () => [
5951
- File$1,
5952
- Folder,
5953
- Array
5954
- ],
5955
- [
5956
- "",
5957
- "",
5958
- "",
5959
- "",
5960
- "",
5961
- ""
5962
- ]
5963
- ];
5964
- var [BaseRuleOptions] = [
5965
- 28,
5966
- () => [Record],
5967
- [""]
5968
- ];
5969
- var [Rule] = [
5970
- 29,
5971
- (Context, RuleOptions, RuleName) => [
5972
- BaseRuleOptions,
5973
- BaseRuleOptions,
5974
- RuleName,
5975
- Context,
5976
- Folder,
5977
- RuleOptions,
5978
- RuleResult,
5979
- RuleResult,
5980
- Promise
5981
- ],
5982
- [
5983
- "",
5984
- "",
5985
- "",
5986
- "",
5987
- "",
5988
- "",
5989
- "",
5990
- "",
5991
- "",
5992
- "",
5993
- "",
5994
- "",
5995
- "",
5996
- "",
5997
- "",
5998
- "",
5999
- ""
6000
- ]
6001
- ];
6002
- var [RuleResult] = [
6003
- 30,
6004
- () => [PartialDiagnostic, Array],
6005
- [
6006
- "",
6007
- "",
6008
- ""
6009
- ]
6010
- ];
6011
- var [PartialDiagnostic] = [
6012
- 31,
6013
- () => [Fix, Array],
6014
- [
6015
- "",
6016
- "",
6017
- "",
6018
- "",
6019
- "",
6020
- "",
6021
- "",
6022
- "",
6023
- "",
6024
- "",
6025
- "",
6026
- ""
6027
- ]
6028
- ];
6029
- var [Fix] = [
6030
- 32,
6031
- () => [],
6032
- [
6033
- "",
6034
- "",
6035
- "",
6036
- "",
6037
- "",
6038
- "",
6039
- "",
6040
- "",
6041
- "",
6042
- "",
6043
- "",
6044
- "",
6045
- ""
6046
- ]
6047
- ];
6048
- var [Config] = [
6049
- 33,
6050
- (Rules) => [
6051
- Rule,
6052
- Array,
6053
- Rules,
6054
- ConfigObject,
6055
- Rules,
6056
- Plugin,
6057
- GlobalIgnore,
6058
- Array
6059
- ],
6060
- [
6061
- "",
6062
- "",
6063
- "",
6064
- "",
6065
- "",
6066
- "",
6067
- "",
6068
- "",
6069
- ""
6070
- ]
6071
- ];
6072
- var [Severity] = [
6073
- 34,
6074
- () => [],
6075
- []
6076
- ];
6077
- var [RuleNames] = [
6078
- 35,
6079
- (Rules) => [
6080
- Rule,
6081
- Array,
6082
- Rules
6083
- ],
6084
- [
6085
- "",
6086
- "",
6087
- "",
6088
- ""
6089
- ]
6090
- ];
6091
- var [LookUpByName] = [
6092
- 36,
6093
- (Union, Name) => [
6094
- Union,
6095
- Name,
6096
- Union
6097
- ],
6098
- [
6099
- "",
6100
- "",
6101
- "",
6102
- "",
6103
- "",
6104
- ""
6105
- ]
6106
- ];
6107
- var [OptionsForRule] = [
6108
- 37,
6109
- (Rules, RuleName) => [
6110
- Rule,
6111
- Array,
6112
- Rules,
6113
- RuleNames,
6114
- Rules,
6115
- RuleName,
6116
- LookUpByName,
6117
- Rule
6118
- ],
6119
- [
6120
- "",
6121
- "",
6122
- "",
6123
- "",
6124
- "",
6125
- "",
6126
- "",
6127
- "",
6128
- "",
6129
- "",
6130
- "",
6131
- ""
6132
- ]
6133
- ];
6134
- var [ConfigObject] = [
6135
- 38,
6136
- (Rules) => [
6137
- Rule,
6138
- Array,
6139
- Array,
6140
- Array,
6141
- Rules,
6142
- RuleNames,
6143
- Severity,
6144
- Severity,
6145
- Rules,
6146
- key,
6147
- OptionsForRule
6148
- ],
6149
- [
6150
- "",
6151
- "",
6152
- "",
6153
- "",
6154
- "",
6155
- "",
6156
- "",
6157
- "",
6158
- "",
6159
- "",
6160
- "",
6161
- "",
6162
- "",
6163
- "",
6164
- "",
6165
- ""
6166
- ]
6167
- ];
6168
- var [GlobalIgnore] = [
6169
- 39,
6170
- () => [Array],
6171
- ["", ""]
6172
- ];
6173
- var [Plugin] = [
6174
- 40,
6175
- (Context, Rules) => [
6176
- Context,
6177
- Rule,
6178
- Array,
6179
- Rule,
6180
- Array,
6181
- Rules
6182
- ],
6183
- [
6184
- "",
6185
- "",
6186
- "",
6187
- "",
6188
- "",
6189
- "",
6190
- "",
6191
- "",
6192
- "",
6193
- "",
6194
- "",
6195
- ""
6196
- ]
6197
- ];
6198
- var [defineConfig] = [
6199
- 50,
6200
- (Rules) => [
6201
- Rule,
6202
- Array,
6203
- Rule,
6204
- Array,
6205
- Rules,
6206
- Config,
6207
- Rules,
6208
- Config
6209
- ],
6210
- [
6211
- "",
6212
- "",
6213
- "",
6214
- "",
6215
- "",
6216
- "",
6217
- "",
6218
- "",
6219
- "",
6220
- ""
6221
- ]
6222
- ];
6223
- export { linter as n, processConfiguration as r, defineConfig as t };
5942
+ export { processConfiguration as n, linter as t };
6224
5943
 
6225
- //# sourceMappingURL=steiger-Bi33gRXU.mjs.map
5944
+ //# sourceMappingURL=steiger-CbusAzht.mjs.map