@miyaoka/fsss 0.2.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 miyaoka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -108,10 +108,53 @@ Options:
108
108
  -h, --help ヘルプを表示する
109
109
  ```
110
110
 
111
- ## ドキュメント
111
+ ## Plugin — `_plugins/` を置くだけで横断的処理を追加
112
+
113
+ ```
114
+ commands/
115
+ _plugins/
116
+ logger.ts ← 全コマンドに適用
117
+ serve.ts
118
+ remote/
119
+ _plugins/
120
+ auth.ts ← remote 配下にのみ適用
121
+ [name]/
122
+ push.ts
123
+ ```
124
+
125
+ `commands/` ツリーの任意の階層に `_plugins/` を配置するだけで、その階層以下のコマンドにプラグインが自動適用される。
126
+
127
+ ```ts
128
+ // commands/_plugins/logger.ts
129
+ export default definePlugin(({ cliName }) => ({
130
+ provide: {
131
+ logger: {
132
+ info: (msg: string) => console.log(`[${cliName}] ${msg}`),
133
+ },
134
+ },
135
+ middleware: async (_ctx, next) => {
136
+ const start = performance.now();
137
+ await next();
138
+ console.log(`${(performance.now() - start).toFixed(0)}ms`);
139
+ },
140
+ }));
141
+ ```
142
+
143
+ - `provide` で注入した値はコマンドの `run()` で `extensions` として型付きで受け取れる
144
+ - `middleware` はコマンドの実行を包む onion model(root 側が外側、leaf 側が内側)
145
+ - Extensions の型は `fsss-codegen` で自動生成される
146
+
147
+ ```ts
148
+ run({ extensions }) {
149
+ extensions.logger.info("hello");
150
+ }
151
+ ```
152
+
153
+ ## [ドキュメント](docs/README.md)
112
154
 
113
155
  - [ファイルベースルーティング](docs/routing.md) — コマンドツリー、動的セグメント、params と args の分離
114
156
  - [スキーマと値の解決](docs/schema.md) — defineCommand、args 定義、値の優先順位、ヘルプ生成
115
157
  - [設定ファイルと環境変数](docs/config.md) — autoEnv、config ファイル階層、`--config` フラグ
158
+ - [プラグインシステム](docs/plugin.md) — `_plugins/` 規約、ミドルウェア、Extensions の型生成
116
159
  - [内部アーキテクチャ](docs/architecture.md) — パイプライン設計、各モジュールの責務、処理トレース
117
- - [既存ツールとの比較](docs/comparison.md) — commander / oclif / Pastel / Gud CLI / convict との比較
160
+ - [既存ツールとの比較](docs/comparison.md) — commander / oclif / Pastel / Gud CLI / gunshi / convict との比較
package/dist/codegen.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miyaoka/fsss",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A CLI framework where your file structure becomes your command structure, and a single schema gives you typed values whether they come from flags, env vars, or config files.",
5
5
  "type": "module",
6
6
  "author": "miyaoka",
@@ -32,28 +32,25 @@
32
32
  "files": [
33
33
  "dist"
34
34
  ],
35
+ "dependencies": {
36
+ "zod": "4.3.6"
37
+ },
38
+ "devDependencies": {
39
+ "@tsconfig/node24": "24.0.4",
40
+ "@types/bun": "1.3.9",
41
+ "oxfmt": "0.31.0",
42
+ "oxlint": "1.46.0",
43
+ "oxlint-tsgolint": "0.12.0",
44
+ "typescript": "5.9.3",
45
+ "unplugin-dts": "1.0.0-beta.6",
46
+ "vite": "8.0.0-beta.13"
47
+ },
35
48
  "scripts": {
36
- "prepack": "cp ../../README.md .",
37
- "postpack": "rm README.md",
38
- "prepare": "vite build",
39
49
  "build": "vite build",
40
50
  "dev": "vite build --watch",
41
51
  "test": "bun test",
42
52
  "typecheck": "tsgo --noEmit",
43
53
  "lint": "oxlint --type-aware .",
44
54
  "fix": "oxlint --type-aware --fix . && oxfmt ."
45
- },
46
- "dependencies": {
47
- "zod": "catalog:"
48
- },
49
- "devDependencies": {
50
- "@tsconfig/node24": "catalog:",
51
- "@types/bun": "catalog:",
52
- "oxfmt": "catalog:",
53
- "oxlint": "catalog:",
54
- "oxlint-tsgolint": "catalog:",
55
- "typescript": "catalog:",
56
- "unplugin-dts": "catalog:",
57
- "vite": "catalog:"
58
55
  }
59
- }
56
+ }