@squadbase/vantage 0.2.1 → 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/dist/index.d.ts CHANGED
@@ -10,6 +10,6 @@ import 'react';
10
10
  */
11
11
 
12
12
  /** Framework version, kept in sync with package.json at build time. */
13
- declare const VERSION = "0.2.1";
13
+ declare const VERSION = "0.2.3";
14
14
 
15
15
  export { VERSION };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ function definePage(config) {
6
6
  }
7
7
 
8
8
  // src/index.ts
9
- var VERSION = "0.2.1";
9
+ var VERSION = "0.2.3";
10
10
 
11
11
  export { VERSION, definePage };
12
12
  //# sourceMappingURL=index.js.map
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\"\n"]}
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"]}
@@ -1,4 +1,4 @@
1
- export { vantagePlugin } from '../chunk-UHZ7XSAN.js';
1
+ export { vantagePlugin } from '../chunk-3QKPNWKJ.js';
2
2
  import '../chunk-46QI6GFC.js';
3
3
  import '../chunk-B7LLBNLV.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -22,12 +22,29 @@ The skills ship inside the `@squadbase/vantage` package. `vantage add skill` cop
22
22
  your app. They land **directly under the project root** by default; `--dir` puts them elsewhere.
23
23
 
24
24
  ```bash
25
- vantage add skill --all # every bundled skill, under the root
25
+ vantage add skill # list the skills and where they sit (writes nothing)
26
+ vantage add skill --all # every skill that isn't placed yet, under the root
26
27
  vantage add skill vantage-app # a single skill by name
27
28
  vantage add skill --all --dir .claude/skills # where Claude Code looks for them
28
- vantage add skill vantage-app --force # overwrite an existing copy
29
+ vantage add skill --all --force # refresh the placed copies in place
29
30
  ```
30
31
 
32
+ **The destination is scanned for, not assumed.** `add skill` walks the project first (skipping
33
+ `node_modules` and friends) and **skips any skill that is already placed, reporting where it is** —
34
+ under the root, under `.claude/skills/`, under `.squadbase/skills/`, it doesn't matter, so
35
+ **re-running never creates a second copy**. Drop the name to get just the list:
36
+
37
+ ```text
38
+ $ vantage add skill
39
+ Bundled skills:
40
+ vantage-add-feature .claude/skills/vantage-add-feature/
41
+ vantage-app .claude/skills/vantage-app/
42
+ vantage-pitfalls not placed
43
+ ```
44
+
45
+ With `--force`, the copies that were found are rewritten **where they are** (an explicit `--dir`
46
+ still wins as the destination).
47
+
31
48
  A `--dir` path resolves from the project root (absolute paths work too). To have Claude Code pick
32
49
  them up automatically, place them in `.claude/skills/`:
33
50
 
@@ -54,8 +71,8 @@ skill based on the task at hand. For other agents, pass whatever directory that
54
71
 
55
72
  - **The source of truth lives in the package.** Skills are distributed and updated together with
56
73
  the framework version, so bumping `@squadbase/vantage` gets you the latest procedures. To refresh
57
- copies you've already placed, run `vantage add skill --all --force` with the same `--dir` you
58
- used originally.
74
+ copies you've already placed, run `vantage add skill --all --force` the destination is scanned
75
+ for, so you don't have to remember the `--dir` you used originally.
59
76
  - **The Squadbase template ships them pre-placed.** Apps created from the template already contain
60
77
  `.claude/skills/`. For a hand-made app, add them with `vantage add skill`.
61
78
 
@@ -9,6 +9,61 @@ 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
+
36
+ ## v0.2.2
37
+
38
+ `vantage add skill` now scans for where the skills already are, and charts follow
39
+ stylesheet swaps too. Both are backwards-compatible.
40
+
41
+ ### Changed
42
+
43
+ - **`vantage add skill` looks for placed skills before copying** — it walks the
44
+ project for `<skill>/SKILL.md` and **skips anything already placed, reporting
45
+ where it is**. Under the root, under `.claude/skills/`, under
46
+ `.squadbase/skills/` — it makes no difference, so **re-running never creates a
47
+ second copy**, and an agent no longer has to know the candidate locations.
48
+ - `--force` rewrites the copies **where they were found** (an explicit `--dir`
49
+ still wins as the destination), so refreshing placed copies doesn't require
50
+ remembering the `--dir` you used originally.
51
+ - `vantage add skill` with no name is now a listing command: it prints the
52
+ bundled skills and where each one sits, and writes nothing.
53
+ - The bundled `AGENTS.md` drops its `ls`-the-usual-places routine in favour of
54
+ letting the CLI find them (a placed `AGENTS.md` is synced by `vantage upgrade`).
55
+
56
+ ### Fixed
57
+
58
+ - **[`EChart`](parts/echart) could miss a CSS update** — token
59
+ changes were only watched through attributes on `<html>` / `<body>`, so a
60
+ change that **only rewrites the injected `<style>`** (editing `styles.css` with
61
+ the dev server running, applying a theme preset, …) left the chart painted in
62
+ the previous colours while the DOM tokens were already new. A reload fixed it,
63
+ which made it read as "the preset didn't apply". Stylesheet swaps are now
64
+ watched as well, and the chart repaints **only when the token values actually
65
+ change**.
66
+
12
67
  ## v0.2.1
13
68
 
14
69
  Charts now follow the theme tokens, and `Select` works out the value-to-label
@@ -12,8 +12,8 @@
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 |
16
- | `vantage add <kind> <name>` | Scaffold or place a `page` / `api` / `ui` / `block` / `skill` / `agents` (`--force` to overwrite; `skill` takes `--dir` for the destination) |
15
+ | `vantage routes` | Print the page + API URL map (`--pages` / `--apis` for one side only, `--detail` for each route's spec) |
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`) |
19
19
  | `vantage doctor` | Diagnose environment / installation health |
@@ -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
@@ -27,8 +27,10 @@ import type { EChartsOption } from "@squadbase/vantage/components";
27
27
 
28
28
  By default the theme's `--chart-1` through `--chart-5` become the series colours. ECharts can't read
29
29
  CSS variables *while painting*, but `EChart` resolves the tokens once at init with
30
- `getComputedStyle` and passes them in as an ECharts theme. It watches for the `.dark` class going on
31
- and off, and re-reads the tokens when it changes.
30
+ `getComputedStyle` and passes them in as an ECharts theme. It watches for anything that can change
31
+ those tokens and re-reads them when the values actually move — the `.dark` class going on and off,
32
+ and **stylesheet swaps** too (editing `styles.css` with the dev server running, applying a theme
33
+ preset, …).
32
34
 
33
35
  To give series their own colours, set `option.color` (or `series[].itemStyle.color`). Your option
34
36
  wins over the theme, so **axes, legend and tooltip keep following the tokens**.
@@ -22,12 +22,29 @@ Skill のソースは `@squadbase/vantage` パッケージに同梱されてい
22
22
  対象アプリにコピーします。配置先は既定で**プロジェクトルート直下**で、`--dir` で変えられます。
23
23
 
24
24
  ```bash
25
- vantage add skill --all # 同梱スキルをすべて、ルート直下に配置
25
+ vantage add skill # 一覧と配置場所を表示するだけ(何も書かない)
26
+ vantage add skill --all # 未配置のものを、ルート直下に配置
26
27
  vantage add skill vantage-app # 名前を指定して1つだけ配置
27
28
  vantage add skill --all --dir .claude/skills # Claude Code が読む場所に配置
28
- vantage add skill vantage-app --force # 既存を上書き
29
+ vantage add skill --all --force # 配置済みのコピーをその場で最新に更新
29
30
  ```
30
31
 
32
+ **配置先は決め打ちではなく、走査して見つけます。** `add skill` はまずプロジェクト内
33
+ (`node_modules` などを除く)を走査し、**既に配置されている skill はスキップして場所を報告**
34
+ します。ルート直下でも `.claude/skills/` でも `.squadbase/skills/` でも同じで、**再実行しても
35
+ 二重に配置されません**。名前を省いて実行すると、一覧と配置場所だけが出ます:
36
+
37
+ ```text
38
+ $ vantage add skill
39
+ Bundled skills:
40
+ vantage-add-feature .claude/skills/vantage-add-feature/
41
+ vantage-app .claude/skills/vantage-app/
42
+ vantage-pitfalls not placed
43
+ ```
44
+
45
+ `--force` を付けると、**見つかった場所をそのまま**新しい内容で書き換えます(`--dir` を明示した
46
+ ときは、そちらが配置先として優先されます)。
47
+
31
48
  `--dir` のパスはプロジェクトルートからの相対で解決されます(絶対パスも可)。Claude Code に
32
49
  自動認識させるなら `.claude/skills/` に置きます:
33
50
 
@@ -54,8 +71,8 @@ Skill の手順を読み込んで実行します。他のエージェントに
54
71
 
55
72
  - **source-of-truth はパッケージ内**にあります。Skill はフレームワークのバージョンと一緒に
56
73
  配布・更新されるため、`@squadbase/vantage` を上げれば最新の手順が手に入ります。配置済みの
57
- コピーを更新したいときは、配置したときと同じ `--dir` を付けて
58
- `vantage add skill --all --force` を実行します。
74
+ コピーを更新したいときは `vantage add skill --all --force` を実行します(置き場所は走査して
75
+ 見つけるので、`--dir` を覚えておく必要はありません)。
59
76
  - **Squadbase テンプレートには配置済み**です。テンプレートから作ったアプリには、最初から
60
77
  `.claude/skills/` が入っています。手で作ったアプリには `vantage add skill` で足してください。
61
78
 
@@ -8,6 +8,56 @@ 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
+
33
+ ## v0.2.2
34
+
35
+ `vantage add skill` が配置先を走査するようになり、チャートがスタイルシートの差し替えにも
36
+ 追従するようになりました。どちらも後方互換です。
37
+
38
+ ### 変更
39
+
40
+ - **`vantage add skill` が配置済みの Skill を探してからコピーします** ― プロジェクト内を
41
+ 走査して `<skill>/SKILL.md` を探し、**既にあればスキップして場所を報告**します。ルート直下
42
+ でも `.claude/skills/` でも `.squadbase/skills/` でも同じなので、**再実行しても二重に配置
43
+ されません**。エージェント側が置き場所の候補を覚えておく必要がなくなります。
44
+ - `--force` は**見つかった場所をその場で**書き換えます(`--dir` を明示したときは、そちらが
45
+ 配置先として優先されます)。配置済みコピーの更新に、前回と同じ `--dir` を思い出す必要は
46
+ ありません。
47
+ - 名前を省いた `vantage add skill` は、**一覧と配置場所を出すだけ**の表示コマンドに
48
+ なりました(何も書き込まず exit 0)。
49
+ - 同梱の `AGENTS.md` も更新し、置き場所を `ls` で当てにいく手順を「CLI が探す」に
50
+ 置き換えました(配置済みの `AGENTS.md` は `vantage upgrade` で同期されます)。
51
+
52
+ ### 修正
53
+
54
+ - **[`EChart`](parts/echart) が CSS の更新に追従しない場合がありました** ―
55
+ トークンの変化を `html` / `body` の属性でしか見ていなかったため、**注入済みの `<style>` の
56
+ 中身だけが差し替わる経路**(開発中の `styles.css` の書き換え、テーマプリセットの適用など)で
57
+ DOM のトークンは新しいのにチャートだけ前の色のまま残っていました(リロードで直るため
58
+ 「プリセットが効いていない」と誤解しやすい状態でした)。スタイルシートの差し替えも監視
59
+ 対象になり、**トークンの値が実際に変わったときだけ**描き直します。
60
+
11
61
  ## v0.2.1
12
62
 
13
63
  チャートをテーマトークンに追従させ、`Select` の値とラベルの対応を Vantage 側で組むように
@@ -12,8 +12,8 @@
12
12
  | `vantage build` | クライアント + オプションのサーバーをビルド → `dist/` |
13
13
  | `vantage preview` | 本番ビルドをローカルで起動(fullstack は既定 `:4173`、spa は Vite プレビュー) |
14
14
  | `vantage check` | 静的検査(ルート・境界・禁止ファイル)。エラーがあれば exit 1 |
15
- | `vantage routes` | ページ + API の URL マップを表示 |
16
- | `vantage add <kind> <name>` | `page` / `api` / `ui` / `block` / `skill` / `agents` を雛形生成・配置(`--force` で上書き、`skill` は `--dir` で配置先を指定) |
15
+ | `vantage routes` | ページ + API の URL マップを表示(`--pages` / `--apis` で片側だけ、`--detail` で仕様つき) |
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`) |
19
19
  | `vantage doctor` | 環境・インストールの健全性を診断 |
@@ -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` でそのまま読めます。ネット接続も
@@ -27,8 +27,9 @@ import type { EChartsOption } from "@squadbase/vantage/components";
27
27
 
28
28
  既定ではテーマの `--chart-1` 〜 `--chart-5` がそのまま系列色になります。ECharts は**描画中**には
29
29
  CSS 変数を読めませんが、`EChart` は init のタイミングで `getComputedStyle` からトークンの実値を
30
- 解決し、ECharts のテーマとして渡しています。`.dark` の付け外しを見張っていて、切り替われば
31
- 読み直します。
30
+ 解決し、ECharts のテーマとして渡しています。**トークンが変わりうる操作は見張っていて**、値が
31
+ 実際に変わったときだけ読み直します ― `.dark` の付け外しだけでなく、**スタイルシートの差し替え**
32
+ (開発中に `styles.css` を書き換えた・テーマプリセットを当てた、など)も拾います。
32
33
 
33
34
  系列に固有の色を当てたいときは `option.color`(または `series[].itemStyle.color`)で上書きします。
34
35
  option はテーマより優先されるので、**軸・凡例・ツールチップのトークン追従は残ります**。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vantage",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Data dashboard framework for Squadbase Editor. Vite-powered, config-free, one-file first.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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 # { pages, layouts, notFound, error, apis, hasServer }
140
- vantage check --json # { ok, errorCount, warningCount, diagnostics[] }
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` が出しうる診断コード(参考):
@@ -57,7 +57,7 @@ API export・env 誤用)はユーザーコードを実行しないので速く
57
57
  vantage routes # 既にあるページと API の URL マップ
58
58
  vantage check # いま壊れていないか(これから出すエラーと切り分ける)
59
59
  ls server/ # あれば fullstack モード。無ければ SPA
60
- ls .claude/skills # 配置済みの skill(このファイルの仲間)
60
+ vantage add skill # 配置済みの skill(このファイルの仲間)と、その場所
61
61
  ```
62
62
 
63
63
  ## Step 2 — ルートを決める
@@ -37,8 +37,9 @@ Base UI の `SelectValue` は選択中の **value をそのまま描き**、`Sel
37
37
 
38
38
  ## チャート:`EChart` の配色はトークン追従。上書きは `option.color`
39
39
 
40
- 系列色は `--chart-1..5`、軸・凡例・ツールチップは文字色/境界色のトークンから組まれ、
41
- ライト / ダークの切り替えにも追従する(init 時にトークンの実値を解決している)
40
+ 系列色は `--chart-1..5`、軸・凡例・ツールチップは文字色/境界色のトークンから組まれる
41
+ (init 時にトークンの実値を解決している)。ライト / ダークの切り替えにも、`styles.css` の
42
+ 書き換えやテーマプリセットの適用にも追従する。
42
43
 
43
44
  - **`theme` プロップを渡すと追従は完全に止まる。** 系列の色だけ変えたいなら `option.color` を
44
45
  使う ― option はテーマより優先されるので、軸まわりの追従は残る。
@@ -309,8 +309,10 @@ pnpm preview # 本番ビルドをローカル実行
309
309
  ```
310
310
 
311
311
  `vantage-manifest.json` の `mode`(`spa` / `fullstack`)は `server/` の有無から自動で決まる
312
- (手で書かない)。`vantage check --json` / `vantage routes --json` はエージェント向けの機械
313
- 可読出力。`console.*` とランタイムエラーは開発ターミナルに `[browser:…]` として転送される。
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
 
@@ -318,18 +320,20 @@ pnpm preview # 本番ビルドをローカル実行
318
320
  - **`vantage-add-feature`** — 既存アプリに page / api / ui を 1 つ足す定型
319
321
  - **`vantage-pitfalls`** — Base UI(≠ Radix)の癖など、静かに壊れる落とし穴のリファレンス
320
322
 
321
- **まず、このアプリに配置済みかを探す。** 手順書の本体は SKILL.md というファイルで、置き場所は
322
- アプリによって違う:
323
+ 手順書の本体は `SKILL.md` というファイルで、置き場所はアプリによって違う(ルート直下・
324
+ `.claude/skills/`・`.squadbase/skills/` など)。**探す必要はない ― CLI が探す:**
323
325
 
324
326
  ```bash
325
- ls .claude/skills # よくある置き場所
326
- ls -d vantage-* # ルート直下に置くのが既定
327
+ vantage add skill # 同梱 skill の一覧と、それぞれの配置場所
327
328
  ```
328
329
 
329
- 見つかったらその `SKILL.md` を読む(`vantage add skill` を再実行する必要はない)。**無いときだけ**
330
- 配置する ― 一覧は名前を省いて実行すると出る:
330
+ 配置済みならその場所が出るので、その `SKILL.md` を読む。`not placed` のものだけ配置する:
331
331
 
332
332
  ```bash
333
- vantage add skill # 同梱されている skill 名の一覧
334
- vantage add skill --all --dir .claude/skills # 配置(--dir を省くとルート直下)
333
+ vantage add skill --all # 配置済みはスキップ(場所を報告するだけ)
334
+ vantage add skill --all --dir .claude/skills # 置き場所を指定(既定はルート直下)
335
335
  ```
336
+
337
+ `add skill` はプロジェクト内を走査してから動くので、**再実行しても二重に配置されない**。
338
+ 配置済みのコピーを新しいバージョンに更新したいときだけ `--force` を付ける(見つかった場所を
339
+ そのまま書き換える)。