owner-clone-ai-mcp 2.1.7 → 2.1.9

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.
@@ -397,6 +397,15 @@ text_content(自由テキスト)か、content(カテゴリ別の構造化
397
397
  },
398
398
  },
399
399
  },
400
+ {
401
+ name: 'duplicate_knowledge',
402
+ description: `ナレッジを複製します(画面の「複製」ボタンと同じ動作)。本文・カテゴリ・タグ・フォルダ・装飾設定をそのままコピーし、タイトルは既定で「元タイトル(複製)」。new_title で複製後のタイトル、folder_id で保存先フォルダを指定できます。v2作成など「原本を残して改稿する」前のベース作りに便利です。`,
403
+ inputSchema: { type: 'object', properties: {
404
+ knowledge_id: { type: 'string', description: '複製元ナレッジのID(必須)' },
405
+ new_title: { type: 'string', description: '複製後のタイトル(省略時「元タイトル(複製)」)' },
406
+ folder_id: { type: 'string', description: '保存先フォルダID(省略時は元と同じフォルダ)' },
407
+ }, required: ['knowledge_id'] },
408
+ },
400
409
  {
401
410
  name: 'list_knowledge_revision_notes',
402
411
  description: `ナレッジに付けられた修正指示(人間が画面で入れた指摘)の一覧を取得します。
@@ -417,6 +426,11 @@ quote=該当箇所の引用・para_index=段落位置・instruction=指示本文
417
426
  ];
418
427
 
419
428
  const handlers = {
429
+ async duplicate_knowledge(args) {
430
+ const d = await callApi(`/knowledge/${args.knowledge_id}/duplicate`,
431
+ { method: 'POST', body: JSON.stringify({ new_title: args.new_title, folder_id: args.folder_id }) });
432
+ return `✅ 「${d.title}」として複製しました(id: ${d.id})`;
433
+ },
420
434
  async list_knowledge_revision_notes(args) {
421
435
  const d = await callApi(`/knowledge/${args.knowledge_id}/revision-notes`);
422
436
  const lines = (d.notes || []).map((n, i) =>
@@ -157,6 +157,42 @@ role: reference(参照) / tool(道具) / output(成果物)`,
157
157
  },
158
158
  ];
159
159
 
160
+ /** 【純関数】提案の中身を人が読める木にする(goal_plan は open_questions → ゴール木 → タスク(担当/部署/使う道具)) */
161
+ function formatProposalPayload(kind, payload) {
162
+ if (!payload || typeof payload !== 'object') return '';
163
+ const lines = [];
164
+ if (kind === 'goal_plan') {
165
+ const qs = Array.isArray(payload.open_questions) ? payload.open_questions : [];
166
+ if (qs.length) {
167
+ lines.push(' ❓ 最初に確認(承認すると先頭タスクになる・回答待ちでも他タスクは進行可):');
168
+ qs.forEach((x, i) => lines.push(` ${i + 1}. ${x.question}${x.why ? `(${x.why})` : ''}`));
169
+ }
170
+ const walk = (g, depth) => {
171
+ const pad = ' '.repeat(depth + 1);
172
+ lines.push(`${pad}◦ ${g.title}${g.done_criteria ? `|完了: ${g.done_criteria}` : ''}`);
173
+ for (const t of g.tasks || []) {
174
+ const meta = [t.assignee ? (t.assignee === 'ai' ? '担当AI' : '担当人') : null, t.department || null, t.due ? `〜${t.due}` : null].filter(Boolean);
175
+ const uses = (t.uses || []).map(u => `${u.type}:${u.name}`).join(', ');
176
+ lines.push(`${pad} - ${t.title}${meta.length ? `(${meta.join('・')})` : ''}${uses ? ` 使う: ${uses}` : ''}`);
177
+ }
178
+ for (const c of g.children || []) walk(c, depth + 1);
179
+ };
180
+ (payload.goals || []).forEach(g => walk(g, 0));
181
+ const count = (gs) => gs.reduce((a, g) => a + 1 + count(g.children || []), 0);
182
+ const tcount = (gs) => gs.reduce((a, g) => a + (g.tasks || []).length + tcount(g.children || []), 0);
183
+ lines.push(` (ゴール ${count(payload.goals || [])} 件・タスク ${tcount(payload.goals || [])} 件)`);
184
+ } else if (kind === 'create_resource') {
185
+ lines.push(` 作るもの: ${payload.resource_type || '?'}「${(payload.config && payload.config.name) || '無題'}」${payload.config && payload.config.description ? `|${String(payload.config.description).slice(0, 120)}` : ''}`);
186
+ } else if (kind === 'add_goal') {
187
+ lines.push(` 追加ゴール: ${payload.title || ''}${payload.done_criteria ? `|完了: ${payload.done_criteria}` : ''}`);
188
+ } else if (kind === 'add_task') {
189
+ lines.push(` 追加タスク: ${payload.title || ''}`);
190
+ } else if (kind === 'remove_goal') {
191
+ lines.push(` 削除するゴール: ${payload.goal_id || ''}`);
192
+ }
193
+ return lines.length ? '\n' + lines.join('\n') : '';
194
+ }
195
+
160
196
  const q = (args, keys) => {
161
197
  const p = keys.filter(k => args && args[k] !== undefined && args[k] !== null)
162
198
  .map(k => `${k}=${encodeURIComponent(args[k])}`).join('&');
@@ -245,8 +281,12 @@ const handlers = {
245
281
  async list_project_proposals(args = {}) {
246
282
  const d = await callApi(`/project-os/proposals${q(args, ['project_id'])}`);
247
283
  if (!d.proposals.length) return '提案はありません。';
248
- return d.proposals.map(p =>
249
- `- [${p.id}] ${p.status === 'pending' ? '⏸' : p.status} ${p.kind}: ${p.reason || ''}`).join('\n');
284
+ // ⚠️ 承認待ちは中身(ゴール木・最初に確認・リソース設定)まで出す。要約だけだと AI が承認前に内容を読めず、
285
+ // ユーザーに画面を開いてもらうしかなかった(2026-11-19 自社運用で発覚)。却下/実行済みは1行のまま。
286
+ return d.proposals.map(p => {
287
+ const head = `- [${p.id}] ${p.status === 'pending' ? '⏸' : p.status} ${p.kind}: ${p.reason || ''}`;
288
+ return p.status === 'pending' ? head + formatProposalPayload(p.kind, p.payload) : head;
289
+ }).join('\n');
250
290
  },
251
291
  async approve_project_proposal(args) {
252
292
  const d = await callApi(`/project-os/proposals/${args.proposal_id}/approve`, { method: 'POST',
@@ -282,4 +322,4 @@ const handlers = {
282
322
  },
283
323
  };
284
324
 
285
- module.exports = { tools, handlers };
325
+ module.exports = { tools, handlers, formatProposalPayload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owner-clone-ai-mcp",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "MCP server for Owner Clone AI — exposes knowledge and agent presets to Claude Code",
5
5
  "main": "index.js",
6
6
  "bin": {