safe-notion 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +130 -5
  2. package/dist/index.js +11 -0
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -1,15 +1,140 @@
1
- # notion-cli-for-ai
1
+ # safe-notion
2
2
 
3
- To install dependencies:
3
+ AIエージェント向けの安全なNotion APIラッパーCLI。きめ細かな権限制御により、AIエージェントとNotion API間のセキュリティレイヤーとして機能します。
4
+
5
+ ## 特徴
6
+
7
+ - **きめ細かな権限制御**: `resource:operation` 形式(例: `page:read`, `database:query`)で操作を制限
8
+ - **階層認識**: 子ページは親ページのルールを継承
9
+ - **条件付きアクセス**: Notionプロパティの値に基づいたアクセス制御
10
+ - **デフォルト拒否**: 明示的に許可されない限り、すべての操作を拒否
11
+
12
+ ## インストール
13
+
14
+ ```bash
15
+ npm install -g safe-notion
16
+ ```
17
+
18
+ ## 設定
19
+
20
+ ### 環境変数
21
+
22
+ ```bash
23
+ export NOTION_TOKEN="your-notion-integration-token"
24
+ ```
25
+
26
+ ### 設定ファイル
27
+
28
+ 設定ファイルを初期化:
29
+
30
+ ```bash
31
+ notion-safe config init
32
+ ```
33
+
34
+ 設定ファイルの場所: `~/.config/safe-notion/config.jsonc`
35
+
36
+ ### 設定例
37
+
38
+ ```jsonc
39
+ {
40
+ "rules": [
41
+ {
42
+ // 特定ページとその子孫に読み取り専用アクセス
43
+ "name": "docs-readonly",
44
+ "pageId": "12345678-1234-1234-1234-123456789abc",
45
+ "permissions": ["page:read", "block:read"]
46
+ },
47
+ {
48
+ // データベースへのクエリと新規作成のみ許可
49
+ "name": "tasks-db",
50
+ "databaseId": "87654321-4321-4321-4321-cba987654321",
51
+ "permissions": ["database:read", "database:query", "database:create"]
52
+ },
53
+ {
54
+ // 条件付きアクセス: 担当者が自分の場合のみ更新可能
55
+ "name": "my-tasks-only",
56
+ "databaseId": "87654321-4321-4321-4321-cba987654321",
57
+ "permissions": ["page:update"],
58
+ "condition": {
59
+ "property": "担当者",
60
+ "type": "people",
61
+ "equals": "me"
62
+ }
63
+ }
64
+ ],
65
+ "defaultPermission": "deny"
66
+ }
67
+ ```
68
+
69
+ ## 使用可能な権限
70
+
71
+ | リソース | 権限 | 説明 |
72
+ |---------|------|------|
73
+ | Page | `page:read` | ページの読み取り |
74
+ | Page | `page:update` | ページの更新 |
75
+ | Page | `page:create` | ページの作成 |
76
+ | Database | `database:read` | データベースの読み取り |
77
+ | Database | `database:query` | データベースのクエリ |
78
+ | Database | `database:create` | データベースへのページ作成 |
79
+ | Block | `block:read` | ブロックの読み取り |
80
+ | Block | `block:append` | ブロックの追加 |
81
+ | Block | `block:delete` | ブロックの削除 |
82
+
83
+ ## CLIコマンド
84
+
85
+ ### ページ操作
86
+
87
+ ```bash
88
+ notion-safe page get <page-id>
89
+ notion-safe page create --parent <parent-id> --title "タイトル"
90
+ notion-safe page update <page-id>
91
+ ```
92
+
93
+ ### データベース操作
94
+
95
+ ```bash
96
+ notion-safe db get <database-id>
97
+ notion-safe db query <database-id>
98
+ notion-safe db create-page <database-id>
99
+ ```
100
+
101
+ ### ブロック操作
102
+
103
+ ```bash
104
+ notion-safe block get <block-id>
105
+ notion-safe block children <block-id>
106
+ notion-safe block append <block-id> --children '<json>'
107
+ notion-safe block delete <block-id>
108
+ ```
109
+
110
+ ### 設定管理
111
+
112
+ ```bash
113
+ notion-safe config init # 設定ファイルを初期化
114
+ notion-safe config validate # 設定を検証
115
+ notion-safe config path # 設定ファイルのパスを表示
116
+ ```
117
+
118
+ ## 開発
119
+
120
+ ### 依存関係のインストール
4
121
 
5
122
  ```bash
6
123
  bun install
7
124
  ```
8
125
 
9
- To run:
126
+ ### ビルド
10
127
 
11
128
  ```bash
12
- bun run src/index.ts
129
+ bun run build
13
130
  ```
14
131
 
15
- This project was created using `bun init` in bun v1.3.3. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
132
+ ### 型チェック
133
+
134
+ ```bash
135
+ bun run typecheck
136
+ ```
137
+
138
+ ## ライセンス
139
+
140
+ MIT
package/dist/index.js CHANGED
@@ -666,6 +666,17 @@ function createConfigCommand() {
666
666
  config.command("path").description("Show the configuration file path").action(() => {
667
667
  outputJson({ path: getConfigPath() });
668
668
  });
669
+ config.command("show").description("Show the current configuration").action(() => {
670
+ try {
671
+ const configData = loadConfig();
672
+ outputJson({
673
+ path: getConfigPath(),
674
+ config: configData
675
+ });
676
+ } catch (error) {
677
+ handleError(error);
678
+ }
679
+ });
669
680
  return config;
670
681
  }
671
682
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safe-notion",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A safe Notion API wrapper CLI for AI agents with granular permission control",
5
5
  "license": "MIT",
6
6
  "author": "shoppingjaws",
@@ -54,6 +54,7 @@
54
54
  "@notionhq/client": "^5.8.0",
55
55
  "commander": "^14.0.2",
56
56
  "jsonc-parser": "^3.3.1",
57
+ "safe-notion": "^0.1.0",
57
58
  "zod": "^4.3.6"
58
59
  },
59
60
  "engines": {