mdjournal 1.0.15 → 1.0.16
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 +287 -164
- package/docs/api-reference.html +2295 -0
- package/docs/config-spec.md +322 -0
- package/docs/extension-spec.md +676 -0
- package/docs/index.md +261 -0
- package/docs/integration-spec.md +518 -0
- package/docs/markdown-format-spec.md +779 -0
- package/docs/openapi.yaml +1009 -0
- package/docs/requirements.md +837 -0
- package/docs/screenshot.png +0 -0
- package/package.json +5 -3
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
# mdJournal 外部連携仕様書
|
|
2
|
+
|
|
3
|
+
## 1. 概要
|
|
4
|
+
|
|
5
|
+
本ドキュメントは、mdJournalの外部システム連携に関する技術仕様を定義する。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 2. Slack連携
|
|
10
|
+
|
|
11
|
+
### 2.1 概要
|
|
12
|
+
|
|
13
|
+
Slack Appを使用して、日報の投稿およびTODO情報の取得を行う。
|
|
14
|
+
|
|
15
|
+
### 2.2 必要な権限(OAuth Scopes)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
channels:read
|
|
19
|
+
chat:write
|
|
20
|
+
chat:write.public
|
|
21
|
+
users:read
|
|
22
|
+
reactions:read
|
|
23
|
+
bookmarks:read
|
|
24
|
+
stars:read
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2.3 設定ファイル
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
# config/integrations.yaml
|
|
31
|
+
slack:
|
|
32
|
+
enabled: true
|
|
33
|
+
bot_token: "${SLACK_BOT_TOKEN}" # 環境変数から取得
|
|
34
|
+
signing_secret: "${SLACK_SIGNING_SECRET}"
|
|
35
|
+
|
|
36
|
+
daily_report:
|
|
37
|
+
channel_id: "C0123456789" # 投稿先チャンネル
|
|
38
|
+
channel_name: "#daily-report" # 表示用
|
|
39
|
+
auto_post: false # 自動投稿の有効/無効
|
|
40
|
+
post_time: "09:00" # 自動投稿時刻
|
|
41
|
+
|
|
42
|
+
todo_sync:
|
|
43
|
+
enabled: true
|
|
44
|
+
sources:
|
|
45
|
+
- type: "stars" # スター付きメッセージ
|
|
46
|
+
- type: "bookmarks" # ブックマーク
|
|
47
|
+
- type: "reminders" # リマインダー
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2.4 日報投稿フォーマット
|
|
51
|
+
|
|
52
|
+
#### 2.4.1 Block Kit形式
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"blocks": [
|
|
57
|
+
{
|
|
58
|
+
"type": "header",
|
|
59
|
+
"text": {
|
|
60
|
+
"type": "plain_text",
|
|
61
|
+
"text": "📋 日報 - サンプル太郎 2025-12-18"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "section",
|
|
66
|
+
"text": {
|
|
67
|
+
"type": "mrkdwn",
|
|
68
|
+
"text": "*【計画】*"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "section",
|
|
73
|
+
"text": {
|
|
74
|
+
"type": "mrkdwn",
|
|
75
|
+
"text": "• 08:30 `P99` タスク確認・整理、日報返信\n• 09:00 `P99` 新人研修サポート\n• 09:30 `P34` クライアントA MTG"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "divider"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"type": "section",
|
|
83
|
+
"text": {
|
|
84
|
+
"type": "mrkdwn",
|
|
85
|
+
"text": "*【実績】*"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "section",
|
|
90
|
+
"text": {
|
|
91
|
+
"type": "mrkdwn",
|
|
92
|
+
"text": "• 08:30 `P99` タスク確認・整理、日報返信"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "divider"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "section",
|
|
100
|
+
"text": {
|
|
101
|
+
"type": "mrkdwn",
|
|
102
|
+
"text": "*【TODO】*"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "section",
|
|
107
|
+
"text": {
|
|
108
|
+
"type": "mrkdwn",
|
|
109
|
+
"text": "☐ `P99` ブラウザ等アップデート\n🔄 `P99` 社内規定作成"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### 2.4.2 テキスト形式(フォールバック)
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
📋 日報 - サンプル太郎 2025-12-18
|
|
120
|
+
|
|
121
|
+
【計画】
|
|
122
|
+
• 08:30 [P99] タスク確認・整理、日報返信
|
|
123
|
+
• 09:00 [P99] 新人研修サポート
|
|
124
|
+
• 09:30 [P34] クライアントA MTG
|
|
125
|
+
|
|
126
|
+
【実績】
|
|
127
|
+
• 08:30 [P99] タスク確認・整理、日報返信
|
|
128
|
+
|
|
129
|
+
【TODO】
|
|
130
|
+
☐ [P99] ブラウザ等アップデート
|
|
131
|
+
🔄 [P99] 社内規定作成
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 2.5 API実装
|
|
135
|
+
|
|
136
|
+
#### POST `/api/slack/post`
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface SlackPostRequest {
|
|
140
|
+
date: string; // YYYY-MM-DD
|
|
141
|
+
format?: 'block' | 'text';
|
|
142
|
+
preview?: boolean; // プレビューのみ(実際に投稿しない)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface SlackPostResponse {
|
|
146
|
+
success: boolean;
|
|
147
|
+
message_ts?: string; // Slackメッセージタイムスタンプ
|
|
148
|
+
channel?: string;
|
|
149
|
+
preview?: string; // プレビュー時のメッセージ内容
|
|
150
|
+
error?: string;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### GET `/api/slack/todos`
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
interface SlackTodosResponse {
|
|
158
|
+
todos: SlackTodoItem[];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface SlackTodoItem {
|
|
162
|
+
id: string;
|
|
163
|
+
text: string;
|
|
164
|
+
source: 'star' | 'bookmark' | 'reminder';
|
|
165
|
+
channel_id: string;
|
|
166
|
+
channel_name: string;
|
|
167
|
+
message_ts: string;
|
|
168
|
+
permalink: string;
|
|
169
|
+
created_at: string;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 3. Git連携
|
|
176
|
+
|
|
177
|
+
### 3.1 概要
|
|
178
|
+
|
|
179
|
+
日報ファイルの変更をGitリポジトリで管理し、自動/手動でcommit・pushを行う。
|
|
180
|
+
|
|
181
|
+
### 3.2 設定ファイル
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
# config/integrations.yaml
|
|
185
|
+
git:
|
|
186
|
+
enabled: true
|
|
187
|
+
repo_path: "./data" # Git管理対象ディレクトリ
|
|
188
|
+
|
|
189
|
+
auto_commit:
|
|
190
|
+
enabled: true
|
|
191
|
+
on_save: true # ファイル保存時に自動commit
|
|
192
|
+
interval: null # 定期commit間隔(秒)、nullで無効
|
|
193
|
+
|
|
194
|
+
auto_push:
|
|
195
|
+
enabled: false
|
|
196
|
+
interval: 3600 # push間隔(秒)
|
|
197
|
+
|
|
198
|
+
commit_message:
|
|
199
|
+
template: "📝 Update daily report: {date}"
|
|
200
|
+
include_summary: true # 変更サマリを含める
|
|
201
|
+
|
|
202
|
+
remote:
|
|
203
|
+
name: "origin"
|
|
204
|
+
branch: "main"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 3.3 Commit メッセージテンプレート
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
📝 Update daily report: 2025-12-18
|
|
211
|
+
|
|
212
|
+
Changes:
|
|
213
|
+
- PLAN: 8 items
|
|
214
|
+
- RESULT: 3 items
|
|
215
|
+
- TODO: 5 items (+2 new, 1 completed)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 3.4 API実装
|
|
219
|
+
|
|
220
|
+
#### GET `/api/git/status`
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
interface GitStatusResponse {
|
|
224
|
+
branch: string;
|
|
225
|
+
clean: boolean;
|
|
226
|
+
staged: string[];
|
|
227
|
+
modified: string[];
|
|
228
|
+
untracked: string[];
|
|
229
|
+
ahead: number; // リモートより先行しているcommit数
|
|
230
|
+
behind: number; // リモートより遅れているcommit数
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### POST `/api/git/commit`
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
interface GitCommitRequest {
|
|
238
|
+
message?: string; // カスタムメッセージ(オプション)
|
|
239
|
+
files?: string[]; // 特定ファイルのみcommit
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface GitCommitResponse {
|
|
243
|
+
success: boolean;
|
|
244
|
+
commit_hash?: string;
|
|
245
|
+
message?: string;
|
|
246
|
+
error?: string;
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
#### POST `/api/git/push`
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
interface GitPushResponse {
|
|
254
|
+
success: boolean;
|
|
255
|
+
pushed_commits?: number;
|
|
256
|
+
error?: string;
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### GET `/api/git/log`
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
interface GitLogRequest {
|
|
264
|
+
limit?: number; // デフォルト: 20
|
|
265
|
+
file?: string; // 特定ファイルの履歴
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface GitLogResponse {
|
|
269
|
+
commits: GitCommit[];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
interface GitCommit {
|
|
273
|
+
hash: string;
|
|
274
|
+
short_hash: string;
|
|
275
|
+
message: string;
|
|
276
|
+
author: string;
|
|
277
|
+
date: string;
|
|
278
|
+
files_changed: string[];
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 4. Googleカレンダー連携
|
|
285
|
+
|
|
286
|
+
### 4.1 概要
|
|
287
|
+
|
|
288
|
+
Google Calendar APIを使用して、予定の取得・表示を行う。
|
|
289
|
+
|
|
290
|
+
### 4.2 認証方式
|
|
291
|
+
|
|
292
|
+
- OAuth 2.0(Desktop application)
|
|
293
|
+
- サービスアカウント(オプション)
|
|
294
|
+
|
|
295
|
+
### 4.3 必要な権限(Scopes)
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
https://www.googleapis.com/auth/calendar.readonly
|
|
299
|
+
https://www.googleapis.com/auth/calendar.events.readonly
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### 4.4 設定ファイル
|
|
303
|
+
|
|
304
|
+
```yaml
|
|
305
|
+
# config/integrations.yaml
|
|
306
|
+
google_calendar:
|
|
307
|
+
enabled: true
|
|
308
|
+
credentials_path: "./config/google-credentials.json"
|
|
309
|
+
token_path: "./config/google-token.json"
|
|
310
|
+
|
|
311
|
+
calendars:
|
|
312
|
+
- id: "primary"
|
|
313
|
+
name: "メインカレンダー"
|
|
314
|
+
color: "#4285f4"
|
|
315
|
+
show: true
|
|
316
|
+
- id: "work@example.com"
|
|
317
|
+
name: "仕事用"
|
|
318
|
+
color: "#0b8043"
|
|
319
|
+
show: true
|
|
320
|
+
- id: "ja.japanese#holiday@group.v.calendar.google.com"
|
|
321
|
+
name: "日本の祝日"
|
|
322
|
+
color: "#d50000"
|
|
323
|
+
show: true
|
|
324
|
+
|
|
325
|
+
sync:
|
|
326
|
+
range_days_before: 7 # 何日前からの予定を取得
|
|
327
|
+
range_days_after: 30 # 何日後までの予定を取得
|
|
328
|
+
refresh_interval: 300 # 更新間隔(秒)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### 4.5 API実装
|
|
332
|
+
|
|
333
|
+
#### GET `/api/gcal/events`
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
interface GCalEventsRequest {
|
|
337
|
+
start_date: string; // YYYY-MM-DD
|
|
338
|
+
end_date: string; // YYYY-MM-DD
|
|
339
|
+
calendar_ids?: string[]; // 特定カレンダーのみ
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface GCalEventsResponse {
|
|
343
|
+
events: GCalEvent[];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
interface GCalEvent {
|
|
347
|
+
id: string;
|
|
348
|
+
calendar_id: string;
|
|
349
|
+
calendar_name: string;
|
|
350
|
+
title: string;
|
|
351
|
+
start: string; // ISO 8601
|
|
352
|
+
end: string; // ISO 8601
|
|
353
|
+
all_day: boolean;
|
|
354
|
+
location?: string;
|
|
355
|
+
description?: string;
|
|
356
|
+
meeting_url?: string; // Google Meet等のURL
|
|
357
|
+
attendees?: string[];
|
|
358
|
+
color: string;
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### POST `/api/gcal/import`
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
interface GCalImportRequest {
|
|
366
|
+
date: string; // YYYY-MM-DD
|
|
367
|
+
event_ids: string[]; // インポートする予定のID
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface GCalImportResponse {
|
|
371
|
+
success: boolean;
|
|
372
|
+
imported_count: number;
|
|
373
|
+
plan_items: PlanItem[];
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### GET `/api/gcal/auth/url`
|
|
378
|
+
|
|
379
|
+
OAuth認証URLを取得
|
|
380
|
+
|
|
381
|
+
#### POST `/api/gcal/auth/callback`
|
|
382
|
+
|
|
383
|
+
OAuth認証コールバック処理
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## 5. 勤怠管理システム連携(将来拡張)
|
|
388
|
+
|
|
389
|
+
### 5.1 概要
|
|
390
|
+
|
|
391
|
+
勤怠管理システムへAPIでデータを送信する。実装は将来拡張として予定。
|
|
392
|
+
|
|
393
|
+
### 5.2 設定ファイル
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
# config/integrations.yaml
|
|
397
|
+
attendance:
|
|
398
|
+
enabled: false
|
|
399
|
+
api_url: "https://attendance.example.com/api"
|
|
400
|
+
api_key: "${ATTENDANCE_API_KEY}"
|
|
401
|
+
|
|
402
|
+
mapping:
|
|
403
|
+
work_start: "PLAN[0].time" # 最初のPLAN時刻
|
|
404
|
+
work_end: "RESULT[-1].time" # 最後のRESULT時刻
|
|
405
|
+
break_time: 60 # 休憩時間(分)
|
|
406
|
+
|
|
407
|
+
auto_submit:
|
|
408
|
+
enabled: false
|
|
409
|
+
time: "18:00"
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 5.3 API設計(予定)
|
|
413
|
+
|
|
414
|
+
#### POST `/api/attendance/submit`
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
interface AttendanceSubmitRequest {
|
|
418
|
+
date: string;
|
|
419
|
+
work_start: string; // HH:MM
|
|
420
|
+
work_end: string; // HH:MM
|
|
421
|
+
break_time: number; // 分
|
|
422
|
+
remarks?: string;
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## 6. 環境変数
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
# .env
|
|
432
|
+
# Slack
|
|
433
|
+
SLACK_BOT_TOKEN=xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx
|
|
434
|
+
SLACK_SIGNING_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
435
|
+
|
|
436
|
+
# Google Calendar
|
|
437
|
+
GOOGLE_CLIENT_ID=xxxxxxxxxxxx.apps.googleusercontent.com
|
|
438
|
+
GOOGLE_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxx
|
|
439
|
+
|
|
440
|
+
# Git (オプション)
|
|
441
|
+
GIT_AUTHOR_NAME="Your Name"
|
|
442
|
+
GIT_AUTHOR_EMAIL="your.email@example.com"
|
|
443
|
+
|
|
444
|
+
# Attendance (将来)
|
|
445
|
+
ATTENDANCE_API_KEY=xxxxxxxxxxxxxxxx
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## 7. エラーハンドリング
|
|
451
|
+
|
|
452
|
+
### 7.1 共通エラーレスポンス
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
interface ErrorResponse {
|
|
456
|
+
success: false;
|
|
457
|
+
error: {
|
|
458
|
+
code: string;
|
|
459
|
+
message: string;
|
|
460
|
+
details?: any;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### 7.2 エラーコード
|
|
466
|
+
|
|
467
|
+
| コード | 説明 |
|
|
468
|
+
|-------|------|
|
|
469
|
+
| `SLACK_AUTH_ERROR` | Slack認証エラー |
|
|
470
|
+
| `SLACK_CHANNEL_NOT_FOUND` | チャンネルが見つからない |
|
|
471
|
+
| `SLACK_POST_FAILED` | メッセージ投稿失敗 |
|
|
472
|
+
| `GIT_NOT_INITIALIZED` | Gitリポジトリ未初期化 |
|
|
473
|
+
| `GIT_COMMIT_FAILED` | Commit失敗 |
|
|
474
|
+
| `GIT_PUSH_FAILED` | Push失敗 |
|
|
475
|
+
| `GCAL_AUTH_ERROR` | Google認証エラー |
|
|
476
|
+
| `GCAL_FETCH_FAILED` | 予定取得失敗 |
|
|
477
|
+
| `INTEGRATION_DISABLED` | 連携機能が無効 |
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 8. セキュリティ考慮事項
|
|
482
|
+
|
|
483
|
+
### 8.1 認証情報の管理
|
|
484
|
+
|
|
485
|
+
- APIトークン等は環境変数で管理
|
|
486
|
+
- 設定ファイル内では`${ENV_VAR}`形式で参照
|
|
487
|
+
- `.env`ファイルは`.gitignore`に追加
|
|
488
|
+
|
|
489
|
+
### 8.2 OAuth トークンの保存
|
|
490
|
+
|
|
491
|
+
- Google OAuth トークンは暗号化して保存
|
|
492
|
+
- トークンファイルは適切なパーミッションで保護
|
|
493
|
+
|
|
494
|
+
### 8.3 ネットワークアクセス
|
|
495
|
+
|
|
496
|
+
- ローカル環境での使用を前提
|
|
497
|
+
- 外部APIアクセスはHTTPS必須
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## 9. 実装優先度
|
|
502
|
+
|
|
503
|
+
| 優先度 | 連携機能 | 理由 |
|
|
504
|
+
|-------|---------|------|
|
|
505
|
+
| 高 | Git連携 | データのバージョン管理は必須 |
|
|
506
|
+
| 高 | Slack日報投稿 | 日常的な報告業務に直結 |
|
|
507
|
+
| 中 | Googleカレンダー | 予定の一元管理に有用 |
|
|
508
|
+
| 中 | Slack TODO取得 | TODO管理の効率化 |
|
|
509
|
+
| 低 | 勤怠システム | 将来拡張として検討 |
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## 更新履歴
|
|
514
|
+
|
|
515
|
+
| バージョン | 日付 | 更新内容 |
|
|
516
|
+
|-----------|------|---------|
|
|
517
|
+
| 1.0 | 2025-12-20 | mdJournalとして公開準備 |
|
|
518
|
+
| 0.1 | 2025-12-18 | 初版作成 |
|