Files
persistent-chat-plugin/lib/templates.js
卡若AI ba786b3700 feat: Persistent Chat v1.1 CO-Chat 整合上传 Gitea
同步 enhance/bridge/smoke/retire 模块、vendor 3.3.34、增强面板与 PRD 文档,
Hub 接入 hub-routes-prd,含安装/经验/模块说明与 co-integration 运维脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 17:42:16 +08:00

71 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
const fs = require('fs');
const path = require('path');
const MODE_A_PROMPT = `请使用 persistent-chat MCP卡若复盘 + 续跑三段式):
1. select_conversation / init_conversationcursorTitle=当前标签名)。
2. 新计划必须 newPlan若与旧任务无关的新任务 → init_conversation(newPlan:true, planLabel=计划名, cursorTitle=标签名),禁止挂旧线程。
3. 每轮:执行 → **[卡若复盘]** 🎯📌💡📝▶ → wait\`\`\`text 包裹)。
4. 挂起后续跑①追问→「追问完成」→②WebSearch+GitHub→「检索完成」→③执行▶。
5. 「结束持久对话」才停循环。
规则:仅加载 persistent-chat.mdc · MCP 仅 persistent-chat · 禁止 co-chat/channel。
第一项任务:`;
const MODE_B_PROMPT = `模式 B · Composer 增强Opus 实现类任务)
规则:仅加载 pchat-composer.mdc · 禁止 wait_for_user_input / persistent-chat 循环。
完成后 → Hub「同步增强结论 → 本 ct_」→ 切回模式 A Chat 复盘。
第一项任务:`;
function ruleFileStatus(workspace) {
const rulesDir = path.join(workspace, '.cursor', 'rules');
const check = (name) => {
const p = path.join(rulesDir, name);
return { name, path: p, exists: fs.existsSync(p) };
};
return {
persistentChat: check('persistent-chat.mdc'),
pchatComposer: check('pchat-composer.mdc'),
coChat: check('co-chat.mdc'),
};
}
function getTemplates(workspace) {
const rules = ruleFileStatus(workspace);
return {
ok: true,
templates: [
{
id: 'mode-a-persistent',
label: 'Persistent 复盘',
badge: 'A·续跑',
ruleFile: 'persistent-chat.mdc',
ruleExists: rules.persistentChat.exists,
mcp: 'persistent-chat only',
prompt: MODE_A_PROMPT,
},
{
id: 'mode-b-composer',
label: 'Composer 增强',
badge: 'B·增强',
ruleFile: 'pchat-composer.mdc',
ruleExists: rules.pchatComposer.exists,
mcp: 'Composer增强补丁链',
prompt: MODE_B_PROMPT,
},
],
rules,
};
}
function templatesReady(workspace) {
const t = getTemplates(workspace);
return t.templates.every((x) => x.ruleExists);
}
module.exports = { getTemplates, templatesReady, MODE_A_PROMPT, MODE_B_PROMPT };