owner-clone-ai-mcp 2.1.8 → 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.
- package/domains/projectOs.js +43 -3
- package/package.json +1 -1
package/domains/projectOs.js
CHANGED
|
@@ -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
|
-
|
|
249
|
-
|
|
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 };
|