@squadbase/vantage 0.2.2 → 0.2.3
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 +2 -2
- package/dist/{chunk-UHZ7XSAN.js → chunk-3QKPNWKJ.js} +3 -3
- package/dist/{chunk-UHZ7XSAN.js.map → chunk-3QKPNWKJ.js.map} +1 -1
- package/dist/cli.js +306 -28
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/vite/index.js +1 -1
- package/docs/en/changelog.md +24 -0
- package/docs/en/cli-reference.md +52 -1
- package/docs/ja/changelog.md +22 -0
- package/docs/ja/cli-reference.md +52 -1
- package/package.json +1 -1
- package/skills/vantage-add-feature/SKILL.md +12 -2
- package/templates/AGENTS.md +4 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/define-page.ts","../src/index.ts"],"names":[],"mappings":";;;AAyCO,SAAS,WAAW,MAAA,EAAgC;AACzD,EAAA,OAAO,MAAA;AACT;;;AChCO,IAAM,OAAA,GAAU","file":"index.js","sourcesContent":["import type { ComponentType, ReactNode } from \"react\"\n\n/**\n * Optional per-page configuration. The only required part of a page module is\n * its default-exported component; `definePage` covers everything else.\n */\nexport interface PageConfig {\n /** Document title applied when this route is active. */\n title?: string\n /** Description metadata for the page. */\n description?: string\n /**\n * Short label for navigation built from `useRoutes()`. Defaults to `title`,\n * which is often too long for a nav (\"Overview · Acme Analytics\").\n */\n navLabel?: string\n /**\n * Component rendered while the route is loading.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n pendingComponent?: ComponentType\n /**\n * Component rendered when the route throws.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n errorComponent?: ComponentType<{ error: unknown }>\n /**\n * Validate/transform the URL search params for this route.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n validateSearch?: (search: Record<string, unknown>) => Record<string, unknown>\n}\n\n/**\n * Declare optional page configuration.\n *\n * ```tsx\n * export const page = definePage({ title: \"Monthly Analysis\" })\n * export default function MonthlyAnalysis() { return <div/> }\n * ```\n */\nexport function definePage(config: PageConfig): PageConfig {\n return config\n}\n\n/** Convenience type for a Vantage page component. */\nexport type PageComponent = ComponentType & { (): ReactNode }\n","/**\n * `@squadbase/vantage` — public runtime surface.\n *\n * The only import most pages need. Server state lives in\n * `@squadbase/vantage/query`, navigation in `@squadbase/vantage/router`,\n * UI in `@squadbase/vantage/ui`, and API types in `@squadbase/vantage/server`.\n */\nexport { definePage } from \"./runtime/define-page\"\nexport type { PageConfig, PageComponent } from \"./runtime/define-page\"\n\n/** Framework version, kept in sync with package.json at build time. */\nexport const VERSION = \"0.2.
|
|
1
|
+
{"version":3,"sources":["../src/runtime/define-page.ts","../src/index.ts"],"names":[],"mappings":";;;AAyCO,SAAS,WAAW,MAAA,EAAgC;AACzD,EAAA,OAAO,MAAA;AACT;;;AChCO,IAAM,OAAA,GAAU","file":"index.js","sourcesContent":["import type { ComponentType, ReactNode } from \"react\"\n\n/**\n * Optional per-page configuration. The only required part of a page module is\n * its default-exported component; `definePage` covers everything else.\n */\nexport interface PageConfig {\n /** Document title applied when this route is active. */\n title?: string\n /** Description metadata for the page. */\n description?: string\n /**\n * Short label for navigation built from `useRoutes()`. Defaults to `title`,\n * which is often too long for a nav (\"Overview · Acme Analytics\").\n */\n navLabel?: string\n /**\n * Component rendered while the route is loading.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n pendingComponent?: ComponentType\n /**\n * Component rendered when the route throws.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n errorComponent?: ComponentType<{ error: unknown }>\n /**\n * Validate/transform the URL search params for this route.\n * (Reserved — not yet applied to Vantage's code-split routes in the prototype.)\n */\n validateSearch?: (search: Record<string, unknown>) => Record<string, unknown>\n}\n\n/**\n * Declare optional page configuration.\n *\n * ```tsx\n * export const page = definePage({ title: \"Monthly Analysis\" })\n * export default function MonthlyAnalysis() { return <div/> }\n * ```\n */\nexport function definePage(config: PageConfig): PageConfig {\n return config\n}\n\n/** Convenience type for a Vantage page component. */\nexport type PageComponent = ComponentType & { (): ReactNode }\n","/**\n * `@squadbase/vantage` — public runtime surface.\n *\n * The only import most pages need. Server state lives in\n * `@squadbase/vantage/query`, navigation in `@squadbase/vantage/router`,\n * UI in `@squadbase/vantage/ui`, and API types in `@squadbase/vantage/server`.\n */\nexport { definePage } from \"./runtime/define-page\"\nexport type { PageConfig, PageComponent } from \"./runtime/define-page\"\n\n/** Framework version, kept in sync with package.json at build time. */\nexport const VERSION = \"0.2.3\"\n"]}
|
package/dist/vite/index.js
CHANGED
package/docs/en/changelog.md
CHANGED
|
@@ -9,6 +9,30 @@ What changed in each Vantage release. Newest is on top.
|
|
|
9
9
|
> minor release may include backwards-incompatible changes. A patch is limited to
|
|
10
10
|
> backwards-compatible additions and bug fixes.
|
|
11
11
|
|
|
12
|
+
## v0.2.3
|
|
13
|
+
|
|
14
|
+
`vantage routes` can be narrowed to one side of the map, and can print the spec of
|
|
15
|
+
every route. Additions only, so it is backwards-compatible.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`vantage routes` takes `--pages` / `--apis`** (see
|
|
20
|
+
[CLI reference](cli-reference)) — pages only (plus layout / 404 / error), or
|
|
21
|
+
API routes only. They are not exclusive: passing both, or neither, prints
|
|
22
|
+
everything exactly as before.
|
|
23
|
+
- **`--detail` adds each route's static spec** — for a page, the `definePage`
|
|
24
|
+
title / navLabel / description and its path params; for an API, **per method**,
|
|
25
|
+
the query keys read through `searchParams`, the request body (`json` /
|
|
26
|
+
`formData` / `text`, with its keys when destructured), the response status,
|
|
27
|
+
content type and object keys, and the status and message of every `HttpError`.
|
|
28
|
+
It answers "how do I call this endpoint?" without opening the handler.
|
|
29
|
+
- With `--json`, every entry gains a `spec`. The existing keys (`route`,
|
|
30
|
+
`file`, `dynamic`, `params`) are untouched, so current readers keep working.
|
|
31
|
+
- Everything is **inferred by reading the source** — like `check`, your code is
|
|
32
|
+
never imported or executed. Keys assembled at runtime, or input and output
|
|
33
|
+
hidden inside helper functions, will not show up: treat the output as a
|
|
34
|
+
**draft** of the spec, not a contract.
|
|
35
|
+
|
|
12
36
|
## v0.2.2
|
|
13
37
|
|
|
14
38
|
`vantage add skill` now scans for where the skills already are, and charts follow
|
package/docs/en/cli-reference.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `vantage build` | Build client + optional server → `dist/` |
|
|
13
13
|
| `vantage preview` | Run the production build locally (fullstack default `:4173`; spa via Vite preview) |
|
|
14
14
|
| `vantage check` | Static checks (routes, boundaries, forbidden files). Exit 1 on error |
|
|
15
|
-
| `vantage routes` | Print the page + API URL map |
|
|
15
|
+
| `vantage routes` | Print the page + API URL map (`--pages` / `--apis` for one side only, `--detail` for each route's spec) |
|
|
16
16
|
| `vantage add <kind> <name>` | Scaffold or place a `page` / `api` / `ui` / `block` / `skill` / `agents` (`--force` to overwrite; `skill` scans for copies already placed and skips them, `--dir` picks the destination) |
|
|
17
17
|
| `vantage docs [name]` | Show the bundled guide and component reference |
|
|
18
18
|
| `vantage search <query>` | Search that same reference in full text (natural language or `--regex`) |
|
|
@@ -51,6 +51,57 @@ vantage check ./demo/index.tsx # a file argument still checks its parent directo
|
|
|
51
51
|
> `add`, `docs` and `search` use their positionals for their own arguments (`add page dashboard`,
|
|
52
52
|
> `docs button`, `search date picker`) rather than a path, so they are excluded from this shortcut.
|
|
53
53
|
|
|
54
|
+
## `vantage routes` — the URL map, with specs
|
|
55
|
+
|
|
56
|
+
With no flags it prints the URL map of pages, layouts and API routes. Flags narrow it to **one
|
|
57
|
+
side** or add the **static spec** of every route.
|
|
58
|
+
|
|
59
|
+
| Flag | Meaning |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `--pages` | Pages only (plus layout / 404 / error) |
|
|
62
|
+
| `--apis` | API routes only |
|
|
63
|
+
| `--detail` | Add each route's spec (pages: path params + `definePage` metadata; APIs: methods, request, response) |
|
|
64
|
+
| `--json` | Machine-readable output (with `--detail`, every entry gains a `spec`) |
|
|
65
|
+
|
|
66
|
+
`--pages` and `--apis` are not exclusive — passing both, or neither, prints everything.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
vantage routes --pages # pages only
|
|
70
|
+
vantage routes --apis --detail # APIs with their specs
|
|
71
|
+
vantage routes --detail --json # machine-readable, specs included
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
Pages
|
|
76
|
+
/sales/:customerId sales/[customerId].tsx
|
|
77
|
+
title Customer detail
|
|
78
|
+
params :customerId
|
|
79
|
+
|
|
80
|
+
API
|
|
81
|
+
/api/customers/:id server/api/customers/[id].ts
|
|
82
|
+
GET
|
|
83
|
+
path :id
|
|
84
|
+
response 200 application/json
|
|
85
|
+
error 404 "Customer ${params.id} not found"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`--detail` reads these shapes:
|
|
89
|
+
|
|
90
|
+
| Line | Where it comes from |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `title` / `nav` / `desc` | String literals in `definePage({ ... })` |
|
|
93
|
+
| `params` | `[id]` / `[...rest]` in the filename |
|
|
94
|
+
| Method | HTTP method exports such as `export function GET` |
|
|
95
|
+
| `query` | `searchParams.get/getAll/has("x")` |
|
|
96
|
+
| `body` | `request.json()` / `formData()` / `text()` (plus the keys of `const { a, b } = await request.json()`) |
|
|
97
|
+
| `response` | Status, content type and object-literal keys of `Response.json(…)` / `json(…)` / `new Response(…)` |
|
|
98
|
+
| `error` | `new HttpError(status, "message")` |
|
|
99
|
+
|
|
100
|
+
> [!NOTE]
|
|
101
|
+
> Like `check`, `--detail` is **static text analysis** — your code is never imported or executed. Keys
|
|
102
|
+
> assembled at runtime, or input/output hidden inside helper functions, will not show up. Treat the
|
|
103
|
+
> output as a draft of the spec, not a contract.
|
|
104
|
+
|
|
54
105
|
## `vantage docs` — read the docs from the CLI
|
|
55
106
|
|
|
56
107
|
The content of this site is **bundled into the package**, so `vantage docs` prints it as plain
|
package/docs/ja/changelog.md
CHANGED
|
@@ -8,6 +8,28 @@ Vantage のリリースごとの変更点です。新しいものが上に来ま
|
|
|
8
8
|
> まだプロトタイプ(**0.x**)です。0.x の間は **minor が実質のメジャー**扱いで、後方互換性の
|
|
9
9
|
> ない変更は minor で入ることがあります。patch は後方互換の機能追加とバグ修正のみです。
|
|
10
10
|
|
|
11
|
+
## v0.2.3
|
|
12
|
+
|
|
13
|
+
`vantage routes` を片側だけに絞れるようになり、各ルートの仕様も出せるようになりました。
|
|
14
|
+
すべて追加のみで後方互換です。
|
|
15
|
+
|
|
16
|
+
### 追加
|
|
17
|
+
|
|
18
|
+
- **`vantage routes` に `--pages` / `--apis` が付きました**(→ [CLI リファレンス](cli-reference))
|
|
19
|
+
― ページ(+ layout / 404 / error)だけ、API ルートだけに絞れます。排他ではないので、両方
|
|
20
|
+
付けても、どちらも付けなくても今までどおり全部出ます。
|
|
21
|
+
- **`--detail` で各ルートの静的な仕様を併記します** ― ページは `definePage` の
|
|
22
|
+
title / navLabel / description とパスパラメータ、API は**メソッドごと**に
|
|
23
|
+
`searchParams` で読むクエリキー・リクエストボディ(`json` / `formData` / `text`。
|
|
24
|
+
分割代入していればキーも)・レスポンスの status と content-type とオブジェクトのキー・
|
|
25
|
+
`HttpError` の status とメッセージが並びます。既存 API の呼び方を確かめるのに、
|
|
26
|
+
ハンドラを開かずに済みます。
|
|
27
|
+
- `--json` と併せると、各要素に `spec` が増えます。既存のキー(`route` / `file` /
|
|
28
|
+
`dynamic` / `params`)はそのままなので、今の読み手を壊しません。
|
|
29
|
+
- 取れるのは**ソースを読んだだけの推定**です(`check` と同じく、アプリのコードを import も
|
|
30
|
+
実行もしません)。実行時に組み立てるキーや、ヘルパー関数の中に隠れた入出力は出てきません
|
|
31
|
+
― 仕様の**下書き**であって契約ではありません。
|
|
32
|
+
|
|
11
33
|
## v0.2.2
|
|
12
34
|
|
|
13
35
|
`vantage add skill` が配置先を走査するようになり、チャートがスタイルシートの差し替えにも
|
package/docs/ja/cli-reference.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `vantage build` | クライアント + オプションのサーバーをビルド → `dist/` |
|
|
13
13
|
| `vantage preview` | 本番ビルドをローカルで起動(fullstack は既定 `:4173`、spa は Vite プレビュー) |
|
|
14
14
|
| `vantage check` | 静的検査(ルート・境界・禁止ファイル)。エラーがあれば exit 1 |
|
|
15
|
-
| `vantage routes` | ページ + API の URL
|
|
15
|
+
| `vantage routes` | ページ + API の URL マップを表示(`--pages` / `--apis` で片側だけ、`--detail` で仕様つき) |
|
|
16
16
|
| `vantage add <kind> <name>` | `page` / `api` / `ui` / `block` / `skill` / `agents` を雛形生成・配置(`--force` で上書き、`skill` は配置済みを走査してスキップ・`--dir` で配置先を指定) |
|
|
17
17
|
| `vantage docs [name]` | 同梱のガイド + コンポーネントリファレンスを表示 |
|
|
18
18
|
| `vantage search <query>` | 同じリファレンスを全文検索(自然言語 or `--regex`) |
|
|
@@ -51,6 +51,57 @@ vantage check ./demo/index.tsx # ファイル指定でも親ディレクトリ
|
|
|
51
51
|
> `add`・`docs`・`search` はパス引数ではなく positional を自分の引数(`add page dashboard`・
|
|
52
52
|
> `docs button`・`search 日付の選択`)に使うため、この短縮形の対象外です。
|
|
53
53
|
|
|
54
|
+
## `vantage routes` — URL マップと仕様
|
|
55
|
+
|
|
56
|
+
引数なしで、ページ・レイアウト・API の URL マップを出します。フラグで**片側だけ**に絞ったり、
|
|
57
|
+
各ルートの**静的な仕様**を足したりできます。
|
|
58
|
+
|
|
59
|
+
| フラグ | 意味 |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `--pages` | ページ(+ layout / 404 / error)だけを表示 |
|
|
62
|
+
| `--apis` | API ルートだけを表示 |
|
|
63
|
+
| `--detail` | 各ルートの仕様を併記(ページはパスパラメータと `definePage` のメタ、API はメソッド・リクエスト・レスポンス) |
|
|
64
|
+
| `--json` | 機械可読出力(`--detail` を付けると各要素に `spec` が付く) |
|
|
65
|
+
|
|
66
|
+
`--pages` と `--apis` は排他ではありません。両方付けても、どちらも付けなくても全部出ます。
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
vantage routes --pages # ページだけ
|
|
70
|
+
vantage routes --apis --detail # API を仕様つきで
|
|
71
|
+
vantage routes --detail --json # 仕様つきの機械可読出力
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
Pages
|
|
76
|
+
/sales/:customerId sales/[customerId].tsx
|
|
77
|
+
title Customer detail
|
|
78
|
+
params :customerId
|
|
79
|
+
|
|
80
|
+
API
|
|
81
|
+
/api/customers/:id server/api/customers/[id].ts
|
|
82
|
+
GET
|
|
83
|
+
path :id
|
|
84
|
+
response 200 application/json
|
|
85
|
+
error 404 "Customer ${params.id} not found"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`--detail` が拾うのは次の書き方です。
|
|
89
|
+
|
|
90
|
+
| 行 | 何を読むか |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `title` / `nav` / `desc` | `definePage({ ... })` の文字列リテラル |
|
|
93
|
+
| `params` | ファイル名の `[id]` / `[...rest]` |
|
|
94
|
+
| メソッド | `export function GET` などの HTTP メソッド export |
|
|
95
|
+
| `query` | `searchParams.get/getAll/has("x")` |
|
|
96
|
+
| `body` | `request.json()` / `formData()` / `text()`(`const { a, b } = await request.json()` ならキーも) |
|
|
97
|
+
| `response` | `Response.json(…)` / `json(…)` / `new Response(…)` の status・content-type・オブジェクトリテラルのキー |
|
|
98
|
+
| `error` | `new HttpError(status, "message")` |
|
|
99
|
+
|
|
100
|
+
> [!NOTE]
|
|
101
|
+
> `--detail` は `check` と同じく**ソースを読むだけの静的解析**で、アプリのコードを import も実行も
|
|
102
|
+
> しません。実行時に組み立てるキーや、ヘルパー関数の中に隠れた入出力は出てきません(出力は
|
|
103
|
+
> 「仕様の下書き」であって契約ではありません)。
|
|
104
|
+
|
|
54
105
|
## `vantage docs` — ドキュメントを CLI で読む
|
|
55
106
|
|
|
56
107
|
このサイトの内容は**パッケージに同梱**されていて、`vantage docs` でそのまま読めます。ネット接続も
|
package/package.json
CHANGED
|
@@ -133,11 +133,21 @@ vantage check # 規約違反が無いか(exit 1 ならエラーあり)
|
|
|
133
133
|
vantage dev # 実際に動くか(console は開発ターミナルに [browser:…] で転送)
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
+
`vantage routes` は `--pages` / `--apis` で片側だけに絞れる。`--detail` を足すと各ルートの静的な
|
|
137
|
+
仕様(ページ: パスパラメータ + `definePage` のメタ / API: メソッド・`searchParams` のキー・
|
|
138
|
+
リクエストボディ・レスポンスの status と形・`HttpError`)まで出るので、**既存 API の呼び方を
|
|
139
|
+
確かめる**ときはこれが速い(ソースを読むだけの推定で、実行はしない)。
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
vantage routes --apis --detail # 既存 API のメソッド/入出力を確認
|
|
143
|
+
```
|
|
144
|
+
|
|
136
145
|
エージェントで自動処理するなら機械可読出力を使う:
|
|
137
146
|
|
|
138
147
|
```bash
|
|
139
|
-
vantage routes --json
|
|
140
|
-
vantage
|
|
148
|
+
vantage routes --json # { pages, layouts, notFound, error, apis, hasServer }
|
|
149
|
+
vantage routes --apis --detail --json # { apis: [{ route, file, params, spec }], hasServer }
|
|
150
|
+
vantage check --json # { ok, errorCount, warningCount, diagnostics[] }
|
|
141
151
|
```
|
|
142
152
|
|
|
143
153
|
`vantage check` が出しうる診断コード(参考):
|
package/templates/AGENTS.md
CHANGED
|
@@ -309,8 +309,10 @@ pnpm preview # 本番ビルドをローカル実行
|
|
|
309
309
|
```
|
|
310
310
|
|
|
311
311
|
`vantage-manifest.json` の `mode`(`spa` / `fullstack`)は `server/` の有無から自動で決まる
|
|
312
|
-
(手で書かない)。`vantage
|
|
313
|
-
|
|
312
|
+
(手で書かない)。`vantage routes` は `--pages` / `--apis` で片側だけに絞れ、`--detail` を足すと
|
|
313
|
+
各ルートの静的な仕様(ページ: パスパラメータ + `definePage` のメタ / API: メソッド・query・
|
|
314
|
+
body・レスポンスの status と形)まで出る。`vantage check --json` / `vantage routes --json` は
|
|
315
|
+
エージェント向けの機械可読出力。`console.*` とランタイムエラーは開発ターミナルに `[browser:…]` として転送される。
|
|
314
316
|
|
|
315
317
|
## さらに詳しく(同梱 Skill)
|
|
316
318
|
|