watashi-db 0.0.5 → 0.0.7
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/.claude-docs/CODEX_INTEGRATION.md +116 -0
- package/README.md +1 -0
- package/cowork-plugin/.claude-plugin/plugin.json +1 -1
- package/cowork-plugin/hooks/hooks.json +11 -0
- package/cowork-plugin/skills/recall/SKILL.md +33 -0
- package/dist/config/instance.d.ts +10 -0
- package/dist/config/instance.js +39 -0
- package/dist/config/instance.js.map +1 -0
- package/dist/config/loader.d.ts +12 -0
- package/dist/config/loader.js +49 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +353 -0
- package/dist/config/schema.js +69 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +116 -0
- package/dist/config/types.js +37 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validator.d.ts +22 -0
- package/dist/config/validator.js +183 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/constants.d.ts +7 -4
- package/dist/constants.js +17 -4
- package/dist/constants.js.map +1 -1
- package/dist/context-pack.d.ts +48 -0
- package/dist/context-pack.js +274 -0
- package/dist/context-pack.js.map +1 -0
- package/dist/database/connection.d.ts +9 -1
- package/dist/database/connection.js +23 -2
- package/dist/database/connection.js.map +1 -1
- package/dist/database/queries-core.d.ts +182 -0
- package/dist/database/queries-core.js +929 -0
- package/dist/database/queries-core.js.map +1 -0
- package/dist/database/queries.d.ts +41 -96
- package/dist/database/queries.js +43 -663
- package/dist/database/queries.js.map +1 -1
- package/dist/database/schema.js +858 -1
- package/dist/database/schema.js.map +1 -1
- package/dist/hook.d.ts +7 -0
- package/dist/hook.js +41 -0
- package/dist/hook.js.map +1 -0
- package/dist/index.js +16 -53
- package/dist/index.js.map +1 -1
- package/dist/lint.d.ts +40 -0
- package/dist/lint.js +114 -0
- package/dist/lint.js.map +1 -0
- package/dist/policy.d.ts +48 -0
- package/dist/policy.js +175 -0
- package/dist/policy.js.map +1 -0
- package/dist/prompts/bootstrap-prompts.js +2 -21
- package/dist/prompts/bootstrap-prompts.js.map +1 -1
- package/dist/provenance.js +1 -3
- package/dist/provenance.js.map +1 -1
- package/dist/resources/context-resources.js +14 -5
- package/dist/resources/context-resources.js.map +1 -1
- package/dist/scoring.d.ts +21 -0
- package/dist/scoring.js +35 -0
- package/dist/scoring.js.map +1 -0
- package/dist/server-instructions.d.ts +7 -0
- package/dist/server-instructions.js +33 -0
- package/dist/server-instructions.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +95 -0
- package/dist/server.js.map +1 -0
- package/dist/setup.d.ts +5 -0
- package/dist/setup.js +157 -0
- package/dist/setup.js.map +1 -0
- package/dist/store/federation.d.ts +66 -0
- package/dist/store/federation.js +291 -0
- package/dist/store/federation.js.map +1 -0
- package/dist/store/merge.d.ts +36 -0
- package/dist/store/merge.js +168 -0
- package/dist/store/merge.js.map +1 -0
- package/dist/store/session-state.d.ts +35 -0
- package/dist/store/session-state.js +69 -0
- package/dist/store/session-state.js.map +1 -0
- package/dist/store/store-manager.d.ts +46 -0
- package/dist/store/store-manager.js +108 -0
- package/dist/store/store-manager.js.map +1 -0
- package/dist/store/sync-manager.d.ts +77 -0
- package/dist/store/sync-manager.js +298 -0
- package/dist/store/sync-manager.js.map +1 -0
- package/dist/tools/claim-tools.js +89 -9
- package/dist/tools/claim-tools.js.map +1 -1
- package/dist/tools/decision-tools.js +47 -6
- package/dist/tools/decision-tools.js.map +1 -1
- package/dist/tools/episode-tools.js +35 -5
- package/dist/tools/episode-tools.js.map +1 -1
- package/dist/tools/export-tools.js +21 -23
- package/dist/tools/export-tools.js.map +1 -1
- package/dist/tools/profile-tools.js +39 -8
- package/dist/tools/profile-tools.js.map +1 -1
- package/dist/tools/promote-tools.d.ts +10 -0
- package/dist/tools/promote-tools.js +289 -0
- package/dist/tools/promote-tools.js.map +1 -0
- package/dist/tools/query-tools.js +64 -14
- package/dist/tools/query-tools.js.map +1 -1
- package/dist/tools/store-tools.d.ts +9 -0
- package/dist/tools/store-tools.js +82 -0
- package/dist/tools/store-tools.js.map +1 -0
- package/dist/tools/sync-tools.d.ts +9 -0
- package/dist/tools/sync-tools.js +55 -0
- package/dist/tools/sync-tools.js.map +1 -0
- package/dist/tools/theory-tools.d.ts +7 -0
- package/dist/tools/theory-tools.js +155 -0
- package/dist/tools/theory-tools.js.map +1 -0
- package/dist/types.d.ts +174 -24
- package/dist/types.js +61 -8
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Codex CLI 連携ガイド
|
|
2
|
+
|
|
3
|
+
> codex-cli v0.98.0 / config.toml 設定済み前提
|
|
4
|
+
|
|
5
|
+
## 概要
|
|
6
|
+
|
|
7
|
+
OpenAI Codex CLI を Claude Code セッション内からレビュー・製造に利用する。
|
|
8
|
+
モデルは `gpt-5.3-codex`(config.toml で設定済み)。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## サブコマンド体系
|
|
13
|
+
|
|
14
|
+
| サブコマンド | 用途 | 対話性 |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `codex` (引数なし) | 対話セッション | 対話 |
|
|
17
|
+
| `codex exec` | 非対話実行(製造・調査) | 非対話 |
|
|
18
|
+
| `codex review` | コードレビュー | 非対話 |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## レビュー依頼
|
|
23
|
+
|
|
24
|
+
### `codex review`(推奨)
|
|
25
|
+
|
|
26
|
+
ステージング済み差分をレビューする場合:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
codex review --uncommitted --title "レビュータイトル" \
|
|
30
|
+
-c 'model="gpt-5.3-codex"' \
|
|
31
|
+
> .codex_outputs/YYYYMMDD_HHMMSS_output.txt 2>&1
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**重要な制約**:
|
|
35
|
+
- `--uncommitted` と `[PROMPT]` 引数は **排他的** — 同時指定するとエラーになる
|
|
36
|
+
- カスタムプロンプトを渡したい場合は `--uncommitted` を外して `[PROMPT]` を使う
|
|
37
|
+
- `-m` フラグは `review` サブコマンドには存在しない — `-c 'model="..."'` で指定
|
|
38
|
+
|
|
39
|
+
#### オプション一覧
|
|
40
|
+
|
|
41
|
+
| オプション | 説明 |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `--uncommitted` | staged + unstaged + untracked 全変更をレビュー |
|
|
44
|
+
| `--base <BRANCH>` | 指定ブランチとの差分をレビュー |
|
|
45
|
+
| `--commit <SHA>` | 特定コミットの差分をレビュー |
|
|
46
|
+
| `--title <TITLE>` | レビューサマリに表示するタイトル |
|
|
47
|
+
| `-c 'model="..."'` | モデル指定(config.toml のデフォルトを上書き) |
|
|
48
|
+
|
|
49
|
+
### プロンプト付きレビュー(`codex exec`経由)
|
|
50
|
+
|
|
51
|
+
レビュー観点を指定したい場合は `exec` を使う:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
codex exec -m gpt-5.3-codex -p automation -s read-only \
|
|
55
|
+
"この差分をレビューしてください。観点: ... : .codex_inputs/review_input.md" \
|
|
56
|
+
> .codex_outputs/YYYYMMDD_HHMMSS_output.txt 2>&1
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 製造依頼
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
codex exec -m gpt-5.3-codex -p automation -s workspace-write \
|
|
65
|
+
"指示内容: .codex_inputs/task_input.md" \
|
|
66
|
+
-o .codex_outputs/YYYYMMDD_HHMMSS_last_message.txt \
|
|
67
|
+
> .codex_outputs/YYYYMMDD_HHMMSS_output.txt 2>&1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ファイル規約
|
|
73
|
+
|
|
74
|
+
| ディレクトリ | 用途 |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `.codex_inputs/` | Codex への入力ファイル |
|
|
77
|
+
| `.codex_outputs/` | Codex からの出力ファイル |
|
|
78
|
+
|
|
79
|
+
ファイル名形式: `YYYYMMDD_HHMMSS_<目的>.md` / `_output.txt`
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## config.toml プロファイル
|
|
84
|
+
|
|
85
|
+
| プロファイル | 用途 | approval_policy | sandbox_mode |
|
|
86
|
+
|---|---|---|---|
|
|
87
|
+
| `human` | ユーザー直接利用 | on-request | workspace-write |
|
|
88
|
+
| `automation` | Claude Code / スクリプトから呼び出し | never | workspace-write |
|
|
89
|
+
|
|
90
|
+
Claude Code から呼ぶ場合は `-p automation` を指定。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## タイムアウト目安
|
|
95
|
+
|
|
96
|
+
| 依頼種別 | 目安 |
|
|
97
|
+
|---|---|
|
|
98
|
+
| レビュー | 15分(timeout: 600000) |
|
|
99
|
+
| 製造 | 60分(timeout: 600000、必要に応じて分割) |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## エンコーディング注意
|
|
104
|
+
|
|
105
|
+
- 入力ファイルは **UTF-8(BOM無し)** で作成
|
|
106
|
+
- Windows 環境のコンソール出力は文字化けする場合があるが、ファイルリダイレクト先は正常
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## よくあるエラー
|
|
111
|
+
|
|
112
|
+
| エラー | 原因 | 対処 |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `unexpected argument '--approval-mode'` | v0.98.0 で廃止 | `-p automation` または `-c 'approval_policy="never"'` |
|
|
115
|
+
| `unexpected argument '-m'` (review時) | `review` に `-m` なし | `-c 'model="..."'` を使う |
|
|
116
|
+
| `'--uncommitted' cannot be used with '[PROMPT]'` | 排他的オプション | プロンプトを外すか `exec` を使う |
|
package/README.md
CHANGED
|
@@ -174,6 +174,7 @@ watashi_log_decision:
|
|
|
174
174
|
| `claim_evidence` | 構造化根拠参照(7種: url, file, claim, ...) |
|
|
175
175
|
| `claim_checks` | 検証ログ(7種 x 4結果) |
|
|
176
176
|
| `decisions` | 意思決定ログ |
|
|
177
|
+
| `decisions_fts` | Decisions用FTS5全文検索インデックス |
|
|
177
178
|
| `episodes` | 思考パターン・意思決定エピソード(文脈→問題→欲求→決定→結果→原則) |
|
|
178
179
|
| `episodes_fts` | Episodes用FTS5全文検索インデックス |
|
|
179
180
|
| `audit_log` | 全操作の監査ログ |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: >
|
|
3
|
+
過去の判断・好み・経験を watashi-db から参照する。
|
|
4
|
+
以下の場面で自動的に使用すること:
|
|
5
|
+
ユーザーが過去の判断・方針について言及した時 /
|
|
6
|
+
設計判断で類似の過去事例が参考になりそうな時 /
|
|
7
|
+
「前に〜したっけ?」等の直接的な問い /
|
|
8
|
+
技術選定で過去の好みや経験が影響しそうな時
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
watashi-db から過去のコンテキストを検索・参照します。
|
|
12
|
+
|
|
13
|
+
## 引数
|
|
14
|
+
- `$ARGUMENTS`: (オプション)検索トピック / キーワード
|
|
15
|
+
|
|
16
|
+
## 手順
|
|
17
|
+
|
|
18
|
+
1. **トピック特定**: $ARGUMENTS または会話の文脈から検索キーワードを抽出
|
|
19
|
+
|
|
20
|
+
2. **検索実行**: 以下のツールを適切に使い分ける:
|
|
21
|
+
- `watashi_query_context`: 幅広いトピック検索(Claims + Decisions + Episodes 横断)
|
|
22
|
+
- `watashi_search_claims`: 特定カテゴリの好み・スキルを絞り込む場合
|
|
23
|
+
- `watashi_get_context_pack`: トークン予算を指定した効率的な検索
|
|
24
|
+
|
|
25
|
+
3. **結果の活用**:
|
|
26
|
+
- 検索結果が0件なら何も報告しない(ユーザーの邪魔をしない)
|
|
27
|
+
- 関連する過去の判断・好みが見つかったら、自然に応答に組み込む
|
|
28
|
+
- 「以前〜と判断されています」のように出典を示す
|
|
29
|
+
|
|
30
|
+
## 注意事項
|
|
31
|
+
- 控えめに: 検索したこと自体を逐一報告しない
|
|
32
|
+
- 結果が多すぎる場合は confidence や更新日時で上位のみ使用
|
|
33
|
+
- ユーザーが明示的に `/recall` で呼んだ場合は検索結果を詳細に表示
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* インスタンスID管理
|
|
3
|
+
* 各watashi-dbインスタンスに一意のIDを付与し、共有DB(sqlite-shared)の
|
|
4
|
+
* 書き込み排他制御に使用する。
|
|
5
|
+
* 初回起動時にULIDを生成し、~/.watashi-db/instance_id に保存。
|
|
6
|
+
*/
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { ulid } from "ulid";
|
|
10
|
+
import { DB_DIR } from "../constants.js";
|
|
11
|
+
const INSTANCE_ID_FILE = path.join(DB_DIR, "instance_id");
|
|
12
|
+
let cachedInstanceId = null;
|
|
13
|
+
/**
|
|
14
|
+
* このインスタンスのIDを取得する。
|
|
15
|
+
* ファイルが存在しなければ新規生成して保存する。
|
|
16
|
+
*/
|
|
17
|
+
export function getInstanceId() {
|
|
18
|
+
if (cachedInstanceId)
|
|
19
|
+
return cachedInstanceId;
|
|
20
|
+
// ディレクトリが無ければ作成
|
|
21
|
+
if (!fs.existsSync(DB_DIR)) {
|
|
22
|
+
fs.mkdirSync(DB_DIR, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
if (fs.existsSync(INSTANCE_ID_FILE)) {
|
|
25
|
+
cachedInstanceId = fs.readFileSync(INSTANCE_ID_FILE, "utf-8").trim();
|
|
26
|
+
return cachedInstanceId;
|
|
27
|
+
}
|
|
28
|
+
// 初回起動: ULIDを生成して保存
|
|
29
|
+
cachedInstanceId = ulid();
|
|
30
|
+
fs.writeFileSync(INSTANCE_ID_FILE, cachedInstanceId, "utf-8");
|
|
31
|
+
return cachedInstanceId;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* テスト用: インスタンスIDをリセットする
|
|
35
|
+
*/
|
|
36
|
+
export function _resetInstanceIdForTesting() {
|
|
37
|
+
cachedInstanceId = null;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/config/instance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE1D,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,gBAAgB;QAAE,OAAO,gBAAgB,CAAC;IAE9C,gBAAgB;IAChB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACpC,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QACrE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,oBAAoB;IACpB,gBAAgB,GAAG,IAAI,EAAE,CAAC;IAC1B,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC9D,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,gBAAgB,GAAG,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "./schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* config.json を読み込んで ResolvedConfig を返す
|
|
4
|
+
* ファイルが存在しない場合はデフォルト構成を返す
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadConfig(): ResolvedConfig;
|
|
7
|
+
/**
|
|
8
|
+
* デフォルト構成: 現行の単一DB動作を再現
|
|
9
|
+
* Store名 "default" / Context名 "default"
|
|
10
|
+
*/
|
|
11
|
+
export declare function getDefaultConfig(): ResolvedConfig;
|
|
12
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config.json ローダー
|
|
3
|
+
* ファイルの読み込み・パース・バリデーション、またはデフォルト構成の生成
|
|
4
|
+
*/
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { CONFIG_PATH, DB_PATH } from "../constants.js";
|
|
7
|
+
import { validateAndResolveConfig, ConfigValidationError } from "./validator.js";
|
|
8
|
+
/**
|
|
9
|
+
* config.json を読み込んで ResolvedConfig を返す
|
|
10
|
+
* ファイルが存在しない場合はデフォルト構成を返す
|
|
11
|
+
*/
|
|
12
|
+
export function loadConfig() {
|
|
13
|
+
if (!fs.existsSync(CONFIG_PATH)) {
|
|
14
|
+
return getDefaultConfig();
|
|
15
|
+
}
|
|
16
|
+
const raw = fs.readFileSync(CONFIG_PATH, "utf-8");
|
|
17
|
+
let parsed;
|
|
18
|
+
try {
|
|
19
|
+
parsed = JSON.parse(raw);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
const message = e instanceof SyntaxError ? e.message : String(e);
|
|
23
|
+
throw new ConfigValidationError([`config.json のJSON構文エラー: ${message}`]);
|
|
24
|
+
}
|
|
25
|
+
return validateAndResolveConfig(parsed);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* デフォルト構成: 現行の単一DB動作を再現
|
|
29
|
+
* Store名 "default" / Context名 "default"
|
|
30
|
+
*/
|
|
31
|
+
export function getDefaultConfig() {
|
|
32
|
+
return {
|
|
33
|
+
stores: {
|
|
34
|
+
default: {
|
|
35
|
+
type: "local",
|
|
36
|
+
path: DB_PATH,
|
|
37
|
+
originalPath: DB_PATH,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
contexts: {
|
|
41
|
+
default: {
|
|
42
|
+
stores: { default: "read-write" },
|
|
43
|
+
default_store: "default",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
default_context: "default",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGjF;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,CAAC,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjE,MAAM,IAAI,qBAAqB,CAAC,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,OAAO;gBACb,YAAY,EAAE,OAAO;aACtB;SACF;QACD,QAAQ,EAAE;YACR,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;gBACjC,aAAa,EAAE,SAAS;aACzB;SACF;QACD,eAAe,EAAE,SAAS;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config.json の Zod スキーマ定義
|
|
3
|
+
* マルチStore構成を宣言的に定義するための型とバリデーション
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
/** 同期設定 */
|
|
7
|
+
export declare const SyncConfigSchema: z.ZodObject<{
|
|
8
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
destination: z.ZodString;
|
|
10
|
+
generations: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
destination: string;
|
|
14
|
+
generations: number;
|
|
15
|
+
}, {
|
|
16
|
+
destination: string;
|
|
17
|
+
enabled?: boolean | undefined;
|
|
18
|
+
generations?: number | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export type SyncConfig = z.infer<typeof SyncConfigSchema>;
|
|
21
|
+
/** Store discriminated union */
|
|
22
|
+
export declare const StoreSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"local">;
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
sync: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
destination: z.ZodString;
|
|
28
|
+
generations: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
}, "strict", z.ZodTypeAny, {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
destination: string;
|
|
32
|
+
generations: number;
|
|
33
|
+
}, {
|
|
34
|
+
destination: string;
|
|
35
|
+
enabled?: boolean | undefined;
|
|
36
|
+
generations?: number | undefined;
|
|
37
|
+
}>>;
|
|
38
|
+
}, "strict", z.ZodTypeAny, {
|
|
39
|
+
path: string;
|
|
40
|
+
type: "local";
|
|
41
|
+
sync?: {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
destination: string;
|
|
44
|
+
generations: number;
|
|
45
|
+
} | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
path: string;
|
|
48
|
+
type: "local";
|
|
49
|
+
sync?: {
|
|
50
|
+
destination: string;
|
|
51
|
+
enabled?: boolean | undefined;
|
|
52
|
+
generations?: number | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
}>, z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"remote-db">;
|
|
56
|
+
url: z.ZodString;
|
|
57
|
+
}, "strict", z.ZodTypeAny, {
|
|
58
|
+
type: "remote-db";
|
|
59
|
+
url: string;
|
|
60
|
+
}, {
|
|
61
|
+
type: "remote-db";
|
|
62
|
+
url: string;
|
|
63
|
+
}>, z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"remote-mcp">;
|
|
65
|
+
url: z.ZodString;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
type: "remote-mcp";
|
|
68
|
+
url: string;
|
|
69
|
+
}, {
|
|
70
|
+
type: "remote-mcp";
|
|
71
|
+
url: string;
|
|
72
|
+
}>]>;
|
|
73
|
+
export type StoreConfig = z.infer<typeof StoreSchema>;
|
|
74
|
+
export declare const AccessModeSchema: z.ZodEnum<["read-write", "read-only"]>;
|
|
75
|
+
export type AccessMode = z.infer<typeof AccessModeSchema>;
|
|
76
|
+
export declare const ContextSchema: z.ZodObject<{
|
|
77
|
+
stores: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEnum<["read-write", "read-only"]>>, Record<string, "read-write" | "read-only">, Record<string, "read-write" | "read-only">>;
|
|
78
|
+
default_store: z.ZodString;
|
|
79
|
+
}, "strict", z.ZodTypeAny, {
|
|
80
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
81
|
+
default_store: string;
|
|
82
|
+
}, {
|
|
83
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
84
|
+
default_store: string;
|
|
85
|
+
}>;
|
|
86
|
+
export type ContextConfig = z.infer<typeof ContextSchema>;
|
|
87
|
+
export declare const LintConfigSchema: z.ZodObject<{
|
|
88
|
+
secret_detection: z.ZodDefault<z.ZodEnum<["block", "warn", "off"]>>;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
secret_detection: "block" | "warn" | "off";
|
|
91
|
+
}, {
|
|
92
|
+
secret_detection?: "block" | "warn" | "off" | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
export type LintConfig = z.infer<typeof LintConfigSchema>;
|
|
95
|
+
/** Store名・Context名に使用可能な文字パターン */
|
|
96
|
+
export declare const STORE_NAME_PATTERN: RegExp;
|
|
97
|
+
export declare const RawConfigSchema: z.ZodObject<{
|
|
98
|
+
stores: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"local">;
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
sync: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
103
|
+
destination: z.ZodString;
|
|
104
|
+
generations: z.ZodDefault<z.ZodNumber>;
|
|
105
|
+
}, "strict", z.ZodTypeAny, {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
destination: string;
|
|
108
|
+
generations: number;
|
|
109
|
+
}, {
|
|
110
|
+
destination: string;
|
|
111
|
+
enabled?: boolean | undefined;
|
|
112
|
+
generations?: number | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
}, "strict", z.ZodTypeAny, {
|
|
115
|
+
path: string;
|
|
116
|
+
type: "local";
|
|
117
|
+
sync?: {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
destination: string;
|
|
120
|
+
generations: number;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
path: string;
|
|
124
|
+
type: "local";
|
|
125
|
+
sync?: {
|
|
126
|
+
destination: string;
|
|
127
|
+
enabled?: boolean | undefined;
|
|
128
|
+
generations?: number | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
}>, z.ZodObject<{
|
|
131
|
+
type: z.ZodLiteral<"remote-db">;
|
|
132
|
+
url: z.ZodString;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
type: "remote-db";
|
|
135
|
+
url: string;
|
|
136
|
+
}, {
|
|
137
|
+
type: "remote-db";
|
|
138
|
+
url: string;
|
|
139
|
+
}>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"remote-mcp">;
|
|
141
|
+
url: z.ZodString;
|
|
142
|
+
}, "strict", z.ZodTypeAny, {
|
|
143
|
+
type: "remote-mcp";
|
|
144
|
+
url: string;
|
|
145
|
+
}, {
|
|
146
|
+
type: "remote-mcp";
|
|
147
|
+
url: string;
|
|
148
|
+
}>]>>, Record<string, {
|
|
149
|
+
path: string;
|
|
150
|
+
type: "local";
|
|
151
|
+
sync?: {
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
destination: string;
|
|
154
|
+
generations: number;
|
|
155
|
+
} | undefined;
|
|
156
|
+
} | {
|
|
157
|
+
type: "remote-db";
|
|
158
|
+
url: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: "remote-mcp";
|
|
161
|
+
url: string;
|
|
162
|
+
}>, Record<string, {
|
|
163
|
+
path: string;
|
|
164
|
+
type: "local";
|
|
165
|
+
sync?: {
|
|
166
|
+
destination: string;
|
|
167
|
+
enabled?: boolean | undefined;
|
|
168
|
+
generations?: number | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
} | {
|
|
171
|
+
type: "remote-db";
|
|
172
|
+
url: string;
|
|
173
|
+
} | {
|
|
174
|
+
type: "remote-mcp";
|
|
175
|
+
url: string;
|
|
176
|
+
}>>;
|
|
177
|
+
contexts: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
178
|
+
stores: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEnum<["read-write", "read-only"]>>, Record<string, "read-write" | "read-only">, Record<string, "read-write" | "read-only">>;
|
|
179
|
+
default_store: z.ZodString;
|
|
180
|
+
}, "strict", z.ZodTypeAny, {
|
|
181
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
182
|
+
default_store: string;
|
|
183
|
+
}, {
|
|
184
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
185
|
+
default_store: string;
|
|
186
|
+
}>>, Record<string, {
|
|
187
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
188
|
+
default_store: string;
|
|
189
|
+
}>, Record<string, {
|
|
190
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
191
|
+
default_store: string;
|
|
192
|
+
}>>;
|
|
193
|
+
default_context: z.ZodString;
|
|
194
|
+
lint: z.ZodOptional<z.ZodObject<{
|
|
195
|
+
secret_detection: z.ZodDefault<z.ZodEnum<["block", "warn", "off"]>>;
|
|
196
|
+
}, "strict", z.ZodTypeAny, {
|
|
197
|
+
secret_detection: "block" | "warn" | "off";
|
|
198
|
+
}, {
|
|
199
|
+
secret_detection?: "block" | "warn" | "off" | undefined;
|
|
200
|
+
}>>;
|
|
201
|
+
client_policies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
202
|
+
read: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
|
|
203
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
204
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
205
|
+
}, "strict", z.ZodTypeAny, {
|
|
206
|
+
categories?: string[] | undefined;
|
|
207
|
+
scopes?: string[] | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
categories?: string[] | undefined;
|
|
210
|
+
scopes?: string[] | undefined;
|
|
211
|
+
}>, z.ZodLiteral<"none">]>>;
|
|
212
|
+
write: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
|
|
213
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
214
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
215
|
+
}, "strict", z.ZodTypeAny, {
|
|
216
|
+
categories?: string[] | undefined;
|
|
217
|
+
scopes?: string[] | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
categories?: string[] | undefined;
|
|
220
|
+
scopes?: string[] | undefined;
|
|
221
|
+
}>, z.ZodLiteral<"none">]>>;
|
|
222
|
+
}, "strict", z.ZodTypeAny, {
|
|
223
|
+
read: {
|
|
224
|
+
categories?: string[] | undefined;
|
|
225
|
+
scopes?: string[] | undefined;
|
|
226
|
+
} | "none";
|
|
227
|
+
write: {
|
|
228
|
+
categories?: string[] | undefined;
|
|
229
|
+
scopes?: string[] | undefined;
|
|
230
|
+
} | "none";
|
|
231
|
+
}, {
|
|
232
|
+
read?: {
|
|
233
|
+
categories?: string[] | undefined;
|
|
234
|
+
scopes?: string[] | undefined;
|
|
235
|
+
} | "none" | undefined;
|
|
236
|
+
write?: {
|
|
237
|
+
categories?: string[] | undefined;
|
|
238
|
+
scopes?: string[] | undefined;
|
|
239
|
+
} | "none" | undefined;
|
|
240
|
+
}>>>;
|
|
241
|
+
}, "strict", z.ZodTypeAny, {
|
|
242
|
+
stores: Record<string, {
|
|
243
|
+
path: string;
|
|
244
|
+
type: "local";
|
|
245
|
+
sync?: {
|
|
246
|
+
enabled: boolean;
|
|
247
|
+
destination: string;
|
|
248
|
+
generations: number;
|
|
249
|
+
} | undefined;
|
|
250
|
+
} | {
|
|
251
|
+
type: "remote-db";
|
|
252
|
+
url: string;
|
|
253
|
+
} | {
|
|
254
|
+
type: "remote-mcp";
|
|
255
|
+
url: string;
|
|
256
|
+
}>;
|
|
257
|
+
contexts: Record<string, {
|
|
258
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
259
|
+
default_store: string;
|
|
260
|
+
}>;
|
|
261
|
+
default_context: string;
|
|
262
|
+
lint?: {
|
|
263
|
+
secret_detection: "block" | "warn" | "off";
|
|
264
|
+
} | undefined;
|
|
265
|
+
client_policies?: Record<string, {
|
|
266
|
+
read: {
|
|
267
|
+
categories?: string[] | undefined;
|
|
268
|
+
scopes?: string[] | undefined;
|
|
269
|
+
} | "none";
|
|
270
|
+
write: {
|
|
271
|
+
categories?: string[] | undefined;
|
|
272
|
+
scopes?: string[] | undefined;
|
|
273
|
+
} | "none";
|
|
274
|
+
}> | undefined;
|
|
275
|
+
}, {
|
|
276
|
+
stores: Record<string, {
|
|
277
|
+
path: string;
|
|
278
|
+
type: "local";
|
|
279
|
+
sync?: {
|
|
280
|
+
destination: string;
|
|
281
|
+
enabled?: boolean | undefined;
|
|
282
|
+
generations?: number | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
} | {
|
|
285
|
+
type: "remote-db";
|
|
286
|
+
url: string;
|
|
287
|
+
} | {
|
|
288
|
+
type: "remote-mcp";
|
|
289
|
+
url: string;
|
|
290
|
+
}>;
|
|
291
|
+
contexts: Record<string, {
|
|
292
|
+
stores: Record<string, "read-write" | "read-only">;
|
|
293
|
+
default_store: string;
|
|
294
|
+
}>;
|
|
295
|
+
default_context: string;
|
|
296
|
+
lint?: {
|
|
297
|
+
secret_detection?: "block" | "warn" | "off" | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
client_policies?: Record<string, {
|
|
300
|
+
read?: {
|
|
301
|
+
categories?: string[] | undefined;
|
|
302
|
+
scopes?: string[] | undefined;
|
|
303
|
+
} | "none" | undefined;
|
|
304
|
+
write?: {
|
|
305
|
+
categories?: string[] | undefined;
|
|
306
|
+
scopes?: string[] | undefined;
|
|
307
|
+
} | "none" | undefined;
|
|
308
|
+
}> | undefined;
|
|
309
|
+
}>;
|
|
310
|
+
export type RawConfig = z.infer<typeof RawConfigSchema>;
|
|
311
|
+
/** 解決済み同期設定(パス正規化後) */
|
|
312
|
+
export interface ResolvedSyncConfig {
|
|
313
|
+
enabled: boolean;
|
|
314
|
+
destination: string;
|
|
315
|
+
originalDestination: string;
|
|
316
|
+
generations: number;
|
|
317
|
+
}
|
|
318
|
+
/** パス正規化済みのローカルStore */
|
|
319
|
+
export interface ResolvedLocalStore {
|
|
320
|
+
type: "local";
|
|
321
|
+
path: string;
|
|
322
|
+
originalPath: string;
|
|
323
|
+
sync?: ResolvedSyncConfig;
|
|
324
|
+
}
|
|
325
|
+
/** 解決済みStore(現時点ではlocalのみ実装) */
|
|
326
|
+
export type ResolvedStore = ResolvedLocalStore;
|
|
327
|
+
/** 解決済みContext */
|
|
328
|
+
export interface ResolvedContext {
|
|
329
|
+
stores: Record<string, AccessMode>;
|
|
330
|
+
default_store: string;
|
|
331
|
+
}
|
|
332
|
+
/** 解決済みLint設定 */
|
|
333
|
+
export interface ResolvedLintConfig {
|
|
334
|
+
secret_detection: "block" | "warn" | "off";
|
|
335
|
+
}
|
|
336
|
+
/** 解決済みクライアントポリシー */
|
|
337
|
+
export interface ClientPolicyAccess {
|
|
338
|
+
categories?: string[];
|
|
339
|
+
scopes?: string[];
|
|
340
|
+
}
|
|
341
|
+
export interface ClientPolicyConfig {
|
|
342
|
+
read: ClientPolicyAccess | "none";
|
|
343
|
+
write: ClientPolicyAccess | "none";
|
|
344
|
+
}
|
|
345
|
+
/** 解決済みConfig(バリデーション通過後の内部表現) */
|
|
346
|
+
export interface ResolvedConfig {
|
|
347
|
+
stores: Record<string, ResolvedStore>;
|
|
348
|
+
contexts: Record<string, ResolvedContext>;
|
|
349
|
+
default_context: string;
|
|
350
|
+
lint?: ResolvedLintConfig;
|
|
351
|
+
client_policies?: Record<string, ClientPolicyConfig>;
|
|
352
|
+
}
|
|
353
|
+
//# sourceMappingURL=schema.d.ts.map
|