@piup/plugin-default 0.0.1-beta.1 → 0.0.1-beta.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.
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -49,12 +49,25 @@ function isWorkspacePath(workspace, candidate) {
|
|
|
49
49
|
const relative = path.relative(path.resolve(workspace), absolute);
|
|
50
50
|
return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative) && existsSync(absolute);
|
|
51
51
|
}
|
|
52
|
+
function isNegatedPathMention(text, index) {
|
|
53
|
+
const prefix = text.slice(Math.max(0, index - 80), index);
|
|
54
|
+
return /(?:未(?:曾|被)?|并未|没有|不要|别|无需|不(?:要|应|可|能|会|需)?)(?:\s*(?:再|去|进行))?\s*(?:修改|改动|变更|编辑|触及|涉及|包含|影响|处理)?\s*$/u.test(prefix) || /(?:do\s+not|don't|not)\s*(?:modify|change|edit|touch|include|affect)?\s*$/i.test(prefix);
|
|
55
|
+
}
|
|
52
56
|
function inferredPaths(request, workspace) {
|
|
53
57
|
const withoutUrls = request.replace(/\b(?:https?|ftp):\/\/[^\s<>'"`]+/gi, " ");
|
|
54
58
|
const projectName = workspace ? path.basename(path.resolve(workspace)) : void 0;
|
|
55
|
-
const explicit = [...[...withoutUrls.matchAll(/`([^`]+)`/g)].map((match) =>
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const explicit = [...[...withoutUrls.matchAll(/`([^`]+)`/g)].map((match) => ({
|
|
60
|
+
candidate: match[1] ?? "",
|
|
61
|
+
index: match.index ?? 0
|
|
62
|
+
})), ...[...withoutUrls.matchAll(/(?:^|\s)(\.\/[A-Za-z0-9_./-]+)/g)].map((match) => ({
|
|
63
|
+
candidate: match[1] ?? "",
|
|
64
|
+
index: (match.index ?? 0) + match[0].indexOf(match[1] ?? "")
|
|
65
|
+
}))];
|
|
66
|
+
const existing = workspace ? [...withoutUrls.matchAll(/[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*\/?/g)].map((match) => ({
|
|
67
|
+
candidate: match[0],
|
|
68
|
+
index: match.index ?? 0
|
|
69
|
+
})).filter(({ candidate }) => candidate.replace(/\/$/, "") !== projectName).filter(({ candidate }) => isWorkspacePath(workspace, candidate)).filter(({ candidate }) => /[/.]/.test(candidate) || statSync(path.resolve(workspace, candidate)).isDirectory()) : [];
|
|
70
|
+
return normalizedScope([...explicit, ...existing].filter(({ candidate, index }) => candidate !== projectName && !isNegatedPathMention(withoutUrls, index)).map(({ candidate }) => candidate));
|
|
58
71
|
}
|
|
59
72
|
/** These replies need an active, already authorized task; they never start or recall one. */
|
|
60
73
|
function confirmationTopic(request) {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/delivery.ts","../src/index.ts"],"sourcesContent":["import type { DeliveryOperation } from \"@piup/contracts\";\n\n/** Only imperative delivery-only clauses qualify; questions, negation and mixed\n * development requests fall back to the ordinary router. */\nexport function deliveryOperationsForRequest(request: string): readonly DeliveryOperation[] | undefined {\n const clauses = request.trim().split(/(?:[,,。.!!;;\\n]+|\\b(?:and then|and|then)\\b|然后|并且|并|再|同时)/i)\n .map((clause) => clause.trim()).filter(Boolean);\n if (clauses.length === 0) return undefined;\n const operations = new Set<DeliveryOperation>();\n for (const clause of clauses) {\n const match = clause.match(\n /^(?:(?:请|帮我|麻烦|直接|只需|只|先|继续|接着)\\s*|(?:please|just|only|now|continue to)\\s+)*(?:git\\s+)?(提交|推送|commit|push)\\s*(.*)$/i,\n );\n if (!match) return undefined;\n const verb = match[1]!.toLowerCase();\n const object = match[2]!.trim();\n const operation = verb === \"提交\" || verb === \"commit\" ? \"commit\" : \"push\";\n // Treat '修改/修复' as nouns only in established delivery objects. Do not\n // swallow a subsequent instruction such as '提交代码后修复登录问题'.\n const chineseObject = operation === \"commit\"\n ? /^(?:(?:当前|现有|已有|本次|这些|所有|刚才|已完成|修复后|修改后|代码|改动|修改|变更|修复|文件|结果|的|\\s))*$/\n : /^(?:(?:代码|改动|修改|变更|修复|提交|当前|已有|现有|本次|所有|这些|的|到|至|远端|远程|仓库|分支|\\s)|(?:origin|upstream|main|master))*$/i;\n const englishObject = operation === \"commit\"\n ? /^(?:(?:the|all|current|existing|these|staged|code|changes?|fix(?:es)?|updates?)\\b\\s*)*$/i\n : /^(?:(?:the|all|current|existing|these|commits?|code|changes?|fix(?:es)?|updates?|to|remote|origin|upstream|main|master|branch)\\b\\s*)*$/i;\n if (!chineseObject.test(object) && !englishObject.test(object)) return undefined;\n operations.add(operation);\n }\n return [...operations];\n}\n","import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { PIUP_API_VERSION } from \"@piup/contracts\";\nimport type {\n GateDefinition,\n RequestDisposition,\n RouteId,\n RouteResult,\n RoutingDecision,\n StageDefinition,\n Strategy,\n TaskRecord,\n WorkflowDefinition,\n} from \"@piup/contracts\";\nimport { definePlugin } from \"@piup/plugin-sdk\";\n\nimport { deliveryOperationsForRequest } from \"./delivery.js\";\n\nexport const defaultPlugin = definePlugin({\n descriptor: {\n id: \"@piup/plugin-default\",\n apiVersion: PIUP_API_VERSION,\n capabilities: [\"route.default\", \"strategy.default\", \"workflow.default\"],\n },\n});\n\nconst ROUTE_STRATEGY_IDS: Readonly<Record<RouteId, string>> = {\n debug: \"debug-local-fix\",\n small: \"small-change\",\n standard: \"standard-delivery\",\n foundation: \"foundation-change\",\n infra: \"infra-change\",\n};\n\nfunction normalizedScope(paths: readonly string[]): readonly string[] {\n const normalized = paths\n .map((candidate) =>\n candidate.trim().replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/\\/$/, \"\"),\n )\n .filter(\n (candidate) =>\n candidate !== \"\" &&\n candidate !== \"..\" &&\n !candidate.startsWith(\"../\") &&\n !path.posix.isAbsolute(candidate) &&\n !/^[a-z][a-z0-9+.-]*:\\/\\//i.test(candidate),\n );\n return normalized.length > 0 ? [...new Set(normalized)] : [\".\"];\n}\n\nfunction isWorkspacePath(workspace: string, candidate: string): boolean {\n const absolute = path.resolve(workspace, candidate);\n const relative = path.relative(path.resolve(workspace), absolute);\n return (\n relative !== \"\" &&\n !relative.startsWith(\"..\") &&\n !path.isAbsolute(relative) &&\n existsSync(absolute)\n );\n}\n\nfunction inferredPaths(request: string, workspace?: string): readonly string[] {\n const withoutUrls = request.replace(/\\b(?:https?|ftp):\\/\\/[^\\s<>'\"`]+/gi, \" \");\n // A project/command name is not a path just because a same-name build\n // artifact exists. Use ./name or the paths argument to target that artifact.\n const projectName = workspace ? path.basename(path.resolve(workspace)) : undefined;\n const explicit = [\n ...[...withoutUrls.matchAll(/`([^`]+)`/g)]\n .map((match) => match[1] ?? \"\")\n .filter((candidate) => candidate !== projectName),\n ...[...withoutUrls.matchAll(/(?:^|\\s)(\\.\\/[A-Za-z0-9_./-]+)/g)].map(\n (match) => match[1] ?? \"\",\n ),\n ];\n const existing = workspace\n ? [...withoutUrls.matchAll(/[A-Za-z0-9_.-]+(?:\\/[A-Za-z0-9_.-]+)*\\/?/g)]\n .map((match) => match[0])\n .filter((candidate) => candidate.replace(/\\/$/, \"\") !== projectName)\n .filter((candidate) => isWorkspacePath(workspace, candidate))\n .filter((candidate) => /[/.]/.test(candidate) || statSync(path.resolve(workspace, candidate)).isDirectory())\n : [];\n return normalizedScope([...explicit, ...existing]);\n}\n\ntype ConfirmationTopic = \"integration\" | \"model\" | \"plan\";\n\n/** These replies need an active, already authorized task; they never start or recall one. */\nfunction confirmationTopic(request: string): ConfirmationTopic | undefined {\n const reply = request.trim()\n .replace(/^(?:请|麻烦)\\s*/, \"\")\n .replace(/^(?:确认|可以|好的|好|同意)[,,\\s]+/, \"\")\n .replace(/[。.!!]$/, \"\").trim();\n if (/^(?:(?:确认|同意)(?:接入|集成)(?:(?:这个|该|上述)模型)?|(?:就|直接)(?:接入|集成)(?:这个|该|上述)模型)$/.test(reply)) {\n return \"integration\";\n }\n if (/^(?:就用|确认使用|同意使用)(?:这个|该|上述)模型$/.test(reply)) return \"model\";\n if (/^(?:(?:就|直接)?按(?:这个|该|上述|当前|原|你(?:推荐|建议)的)方案(?:执行|实施|继续)|确认(?:执行|实施)(?:这个|该|当前)方案)$/.test(reply)) {\n return \"plan\";\n }\n return undefined;\n}\n\n/** Deterministic, side-effect-free default router. */\nexport function routeRequest(\n request: string,\n paths: readonly string[] = [],\n workspace?: string,\n): RouteResult {\n const summary = request.trim();\n const scope = {\n paths: normalizedScope(paths.length > 0 ? paths : inferredPaths(summary, workspace)),\n };\n if (summary === \"\") {\n return {\n requestKind: \"ambiguous\",\n route: null,\n complexity: null,\n risk: null,\n strategyId: null,\n dispatchMode: \"inline\",\n scope,\n reason: \"The request is empty.\",\n };\n }\n\n const changeSignal = /\\b(add|build|change|create|delete|develop|fix|implement|integrate|migrate|modify|optimi[sz]e|refactor|remove|rename|replace|update|upgrade|write)\\b|接入|集成|修改|实现|修复|新增|创建|开发|优化|重构|删除|移除|去掉|去除|调整|替换|升级|迁移|完善|搭建|改(?:成|为|一下|下)?/i;\n const genericChangeOnly = /^(?:(?:please\\s+)?(?:add|build|change|create|delete|develop|fix|implement|integrate|migrate|modify|optimi[sz]e|refactor|remove|rename|replace|update|upgrade|write)|(?:请|帮我|麻烦)?\\s*(?:接入|集成|修改|实现|修复|新增|创建|开发|优化|重构|删除|移除|去掉|去除|调整|替换|升级|迁移|完善|搭建|改)(?:一下|下)?)(?:[。.!!])?$/i;\n const readOnlySignal = /^(?:what|why|how|explain|describe|show|list|inspect|review|assess|evaluate|analy[sz]e|summari[sz]e|where|which|who|can you explain)\\b|^(?:(?:请帮我|帮我|请|麻烦)\\s*)?(?:什么|为什么|为何|如何|怎么|怎样|解释|说明|查看|列出|分析|评估|评审|总结|哪里|哪些|给出.{0,12}方案)/i;\n // A diagnostic request can also explicitly ask for implementation. Do not\n // treat questions such as \"how to fix\" as authorization to edit.\n const diagnosticStart = /^(?:analy[sz]e|inspect|review|assess|evaluate)\\b|^(?:(?:请帮我|帮我|请|麻烦)\\s*)?(?:分析|检查|排查|评估)/i;\n const coordinatedChange = new RegExp(\n `(?:并且?|然后|同时|\\\\b(?:and|then)\\\\s+)(?:直接|请|帮我|\\\\s)*(?:${changeSignal.source})`,\n \"i\",\n );\n const asksForDiagnosticChange = diagnosticStart.test(summary) && coordinatedChange.test(summary);\n const holdSignal = /^(?:不要|先别|先不|无需|暂缓|停止|暂停)(?:修改|改|执行|开始|做|动|实施|继续|提交|推送)?(?:[,。,.!!\\s]|$)|^(?:不要|先别|先不|无需|暂缓|停止|暂停)\\s*(?:提交|推送)|^(?:do not|don't|never)\\s+(?:commit|push)\\b/i;\n // Explicit limits apply even when appended to a confirmation/change request.\n const explicitReadOnly = /(?:不要|先别|先不|暂不|暂缓|停止|暂停|无需)\\s*(?:确认|同意)?\\s*(?:修改|改|执行|实施|接入|集成|继续|动手|写入)|(?:只|仅)(?:做)?(?:分析|解释|讨论|查看|评估)|\\b(?:do not|don't|no need to)\\s+(?:modify|edit|change|implement|integrate|execute|write)\\b|\\b(?:only|just)\\s+(?:analy[sz]e|inspect|explain|review|discuss)\\b/i;\n const integrationQuestion = /接入|集成|\\bintegrate\\b/i.test(summary) &&\n /[??]|是否|能否|可否|吗[。!!]?$|\\b(?:can|could|should|would)\\b/i.test(summary);\n const deliveryOperations = deliveryOperationsForRequest(summary);\n const feedback = regressionFeedbackSubject(summary) !== undefined;\n const restrictedFeedback = feedback && (\n /[??]|为什么|为何|怎么|如何|是否|是不是|不要|先别|先不|无需|暂缓|停止|暂停|只(?:看|查|读|分析|解释)|仅(?:看|查|读|分析|解释)|\\b(?:why|how|whether|do not|don't|only|stop|pause)\\b/i.test(summary) ||\n (!changeSignal.test(summary) && /分析|解释|\\b(?:explain|analy[sz]e|inspect)\\b/i.test(summary))\n );\n const requestKind = restrictedFeedback || explicitReadOnly.test(summary) || integrationQuestion || holdSignal.test(summary) || (readOnlySignal.test(summary) && !asksForDiagnosticChange)\n ? \"read-only\"\n : deliveryOperations\n ? \"delivery\"\n : changeSignal.test(summary) && !genericChangeOnly.test(summary) && !confirmationTopic(summary)\n ? \"change\"\n : \"ambiguous\";\n if (requestKind !== \"change\") {\n return {\n requestKind,\n ...(requestKind === \"delivery\" && deliveryOperations ? { deliveryOperations } : {}),\n route: null,\n complexity: null,\n risk: null,\n strategyId: null,\n dispatchMode: \"inline\",\n scope,\n reason:\n requestKind === \"read-only\"\n ? \"No repository mutation was requested; keep the interaction read-only.\"\n : requestKind === \"delivery\"\n ? \"Deliver existing changes with the authorized Git operations; do not create or recall a development task.\"\n : \"No unambiguous repository mutation signal was found; clarification is required.\",\n };\n }\n\n return routeChangeRequest(summary, scope.paths, workspace);\n}\n\n/** Compile a semantic plan without reclassifying the agent's goal using keywords. */\nexport function routeFromDecision(decision: RoutingDecision, paths: readonly string[]): RouteResult {\n if (!Object.hasOwn(ROUTE_STRATEGY_IDS, decision.route) ||\n ![\"low\", \"medium\", \"high\"].includes(decision.complexity) ||\n ![\"low\", \"medium\", \"high\"].includes(decision.risk) || !decision.reason?.trim()) {\n throw new Error(\"路由决策必须包含有效的 route、complexity、risk 和具体理由\");\n }\n if (decision.route === \"small\" && (decision.complexity !== \"low\" || decision.risk !== \"low\")) {\n throw new Error(\"small 仅适用于已确认的低复杂度、低风险局部变更\");\n }\n if ([\"foundation\", \"infra\"].includes(decision.route) && decision.complexity !== \"high\") {\n throw new Error(\"foundation/infra 必须按高复杂度规划\");\n }\n return {\n requestKind: \"change\", route: decision.route, complexity: decision.complexity,\n risk: decision.risk, reason: decision.reason, strategyId: ROUTE_STRATEGY_IDS[decision.route],\n dispatchMode: \"inline\", scope: { paths: normalizedScope(paths) },\n };\n}\n\n/** Conservative rule-based fallback for non-agent callers; never establishes authorization. */\nexport function routeChangeRequest(\n request: string,\n paths: readonly string[] = [],\n workspace?: string,\n): RouteResult {\n const scope = {\n paths: normalizedScope(paths.length > 0 ? paths : inferredPaths(request, workspace)),\n };\n const text = `${request} ${scope.paths.join(\" \")}`.toLowerCase();\n // Classify the affected mechanism, not arbitrary substrings (e.g. TypeScript,\n // React Router, or an agent application's name). Agent planning remains final.\n const migration = /\\bmigrat(?:e|ion|ing)\\b|迁移/i.test(request);\n const projectMigration = migration && /项目|应用|仓库|全部数据|完整数据|\\b(?:project|application|repository|all data)\\b/i.test(request);\n const controlMechanism = /任务(?:召回|路由|调度|阶段)|意图(?:理解|识别|判断|解析|路由)|阶段(?:切换|推进|重建|门禁)|执行门禁|持久化阶段|\\b(?:task[ -](?:recall|routing|schedul(?:er|ing))|intent[ -](?:resolution|routing)|stage[ -](?:transition|gates?))\\b/i.test(text);\n const infrastructurePath = /(?:^|[\\s/`])(?:\\.piup|\\.pi|\\.github\\/workflows|scripts)(?:[/\\s`.]|$)|\\bpackages\\/(?:pi-extension|plugin-default)\\b|\\b(?:dockerfile|tsconfig\\.json|vitest\\.config|eslint\\.config)\\b/i.test(text);\n const businessWorkflow = /(?:订单|审批|营销|表单).{0,12}(?:流程|工作流)|\\b(?:order|approval|marketing|form)\\b.{0,24}\\bworkflow\\b/i.test(request);\n const workflowMechanism = /调度器|工具链|执行引擎|插件|持续集成|构建流水线|\\b(?:scheduler|toolchain|plugin|skills?|ci\\/cd)\\b|\\b(?:agent|lifecycle|workflow)[ -](?:hooks?|runtime|extensions?)\\b/i.test(text) ||\n (!businessWorkflow && /工作流|\\bworkflow\\b/i.test(text));\n let route: RouteId;\n let complexity: \"low\" | \"medium\" | \"high\";\n let risk: \"low\" | \"medium\" | \"high\";\n let reason: string;\n if (projectMigration) {\n route = \"foundation\";\n complexity = \"high\";\n risk = \"high\";\n reason = \"Project or application migration affects data and compatibility; names and tooling keywords do not reduce its scope.\";\n } else if (controlMechanism || infrastructurePath || workflowMechanism) {\n route = \"infra\";\n complexity = \"high\";\n risk = controlMechanism ? \"high\" : \"medium\";\n reason = \"Changes workflow control, task execution, or tooling infrastructure; classify by affected mechanism rather than file count.\";\n } else if (/\\b(?:foundation|architecture|cross[- ]module|cross[- ]package|migrat(?:e|ion|ing)|batch|platform|framework|protocol)\\b|迁移|基础|架构|跨模块|跨包|批量|协议/i.test(text)) {\n route = \"foundation\";\n complexity = \"high\";\n risk = \"high\";\n reason = \"Matched a foundational, cross-module, migration, or protocol change.\";\n } else if (businessWorkflow || /\\b(?:api|contract|database|schema|sqlite|auth|multiple|multi[- ]file|tetris|game|component|feature|router|routing)\\b|接口|契约|数据库|鉴权|多文件|组件|功能|页面路由|前端路由/i.test(text)) {\n route = \"standard\";\n complexity = \"medium\";\n risk = \"medium\";\n reason = \"Matched a feature or multi-file contract change.\";\n } else if (/\\b(?:bug|debug|fix|regression|error|crash)\\b|修复|错误|异常|崩溃|回归/i.test(text)) {\n route = \"debug\";\n complexity = \"low\";\n risk = \"low\";\n reason = \"Matched a localized defect or regression.\";\n } else {\n // Absence of recognized keywords is not evidence of low complexity or risk.\n route = \"standard\";\n complexity = \"medium\";\n risk = \"medium\";\n reason = \"Insufficient evidence for a small change; use conservative standard planning.\";\n }\n\n return {\n requestKind: \"change\",\n route,\n complexity,\n risk,\n strategyId: ROUTE_STRATEGY_IDS[route],\n dispatchMode: \"inline\",\n scope,\n reason,\n };\n}\n\nexport interface ActiveRequestDecision {\n readonly disposition: RequestDisposition;\n readonly route: RouteResult;\n readonly reason: string;\n}\n\nfunction meaningfulTerms(value: string): Set<string> {\n const ignored = new Set([\n \"add\", \"build\", \"change\", \"continue\", \"create\", \"fix\", \"implement\", \"modify\",\n \"please\", \"refactor\", \"remove\", \"replace\", \"resume\", \"update\", \"改\", \"修改\", \"实现\",\n \"修复\", \"继续\", \"恢复\", \"请\", \"一下\", \"之前\", \"任务\", \"接入\", \"集成\", \"integrate\",\n ]);\n const terms = new Set<string>();\n for (const token of value.toLowerCase().match(/[\\p{Script=Han}]+|[\\p{L}\\p{N}_./-]+/gu) ?? []) {\n if (ignored.has(token)) continue;\n if (/^\\p{Script=Han}+$/u.test(token)) {\n const normalized = [...ignored]\n .filter((word) => /^\\p{Script=Han}+$/u.test(word))\n .reduce((result, word) => result.replaceAll(word, \"\"), token);\n if (normalized.length === 1) continue;\n if (normalized.length === 2) terms.add(normalized);\n for (let index = 0; index < normalized.length - 1; index += 1) {\n terms.add(normalized.slice(index, index + 2));\n }\n continue;\n }\n if (token.length > 1) terms.add(token);\n }\n return terms;\n}\n\n/** A regression report is contextual continuation, not standalone edit permission. */\nfunction regressionFeedbackSubject(request: string): string | undefined {\n // Match the user's subject, never shared words/paths inside a pasted error.\n const heading = request.split(/[::\\r\\n]/, 1)[0] ?? \"\";\n const signal = /(?:还是|仍然?|依然|又)\\s*(?:会|在)?\\s*(?:报错|失败|出错|不行|不正常|不能用|无法使用)|\\bstill\\s+(?:fails?\\b|failing\\b|errors?\\b|broken\\b|not working\\b)/i;\n if (!signal.test(heading)) return undefined;\n return heading.replace(signal, \" \").replace(/测试|重试|\\b(?:test|testing|retest|retry)\\b/gi, \" \").trim();\n}\n\n/** Recall verbs must be instructions, not words in a topic, denial, or pasted error. */\nexport function isTaskRecallRequest(request: string): boolean {\n return /^(?:(?:请帮我|请|麻烦|帮我)\\s*|(?:please|can you|could you)\\s+)?(?:\\b(?:continue|resume|reopen|return to)\\b|继续|恢复|接着|回到|召回)/i.test(request.trim());\n}\n\nexport interface TaskIntentEvidence {\n readonly score: number;\n readonly sharedTerms: readonly string[];\n readonly lexicalScore: number;\n readonly scopeScore: number;\n readonly routeScore: number;\n}\n\n/** Retrieval evidence only, never authorization to recall or edit. */\nexport function explainTaskIntent(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n options: { readonly explicitRecall?: boolean } = {},\n): TaskIntentEvidence {\n const empty = { score: 0, sharedTerms: [], lexicalScore: 0, scopeScore: 0, routeScore: 0 };\n const route = routeRequest(request, [], workspace);\n const recallSignal = isTaskRecallRequest(request);\n if (route.requestKind === \"read-only\" || route.requestKind === \"delivery\" || confirmationTopic(request)) return empty;\n const feedbackSubject = regressionFeedbackSubject(request);\n const regression = route.requestKind === \"ambiguous\" && feedbackSubject !== undefined &&\n routeRequest(task.request, [], workspace).requestKind === \"change\";\n // Only a related regression can inherit an existing change task's intent.\n // An unmatched report remains ambiguous and cannot start a new write task.\n if (route.requestKind === \"ambiguous\" && !recallSignal && !options.explicitRecall && !regression) return empty;\n\n const requestedTerms = meaningfulTerms(regression ? feedbackSubject : request);\n const taskTerms = meaningfulTerms(task.request);\n const sharedTerms = [...requestedTerms].filter((term) => taskTerms.has(term));\n const scope = regression ? inferredPaths(feedbackSubject, workspace) : route.scope.paths;\n const explicitScope = !scope.includes(\".\");\n const scopeMatch = explicitScope && scopesOverlap(task.scope.paths, scope);\n if (sharedTerms.length === 0 && !scopeMatch) return empty;\n\n const lexicalScore = sharedTerms.reduce(\n (score, term) => score + (/^[\\p{Script=Han}]+$/u.test(term) ? 5 : 30),\n 0,\n );\n const scopeScore = scopeMatch ? 50 : 0;\n const routeScore = route.route !== null && route.route === task.route ? 2 : 0;\n return { score: lexicalScore + scopeScore + routeScore, sharedTerms, lexicalScore, scopeScore, routeScore };\n}\n\n/** Compatibility score for candidate retrieval and explicit activation commands. */\nexport function scoreTaskIntent(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n options: { readonly explicitRecall?: boolean } = {},\n): number {\n return explainTaskIntent(request, task, workspace, options).score;\n}\n\nfunction scopesOverlap(left: readonly string[], right: readonly string[]): boolean {\n if (left.includes(\".\") || right.includes(\".\")) return true;\n return left.some((leftPath) =>\n right.some(\n (rightPath) =>\n leftPath === rightPath ||\n leftPath.startsWith(`${rightPath.replace(/\\/$/, \"\")}/`) ||\n rightPath.startsWith(`${leftPath.replace(/\\/$/, \"\")}/`),\n ),\n );\n}\n\n/** Classify every turn received while another task is active. */\nexport function decideActiveRequest(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n): ActiveRequestDecision {\n const route = routeRequest(request, [], workspace);\n if (route.requestKind === \"delivery\") {\n return { disposition: \"delivery\", route, reason: \"Deliver existing changes without advancing the active task.\" };\n }\n if (route.requestKind === \"read-only\") {\n return { disposition: \"read-only\", route, reason: \"The new turn is a read-only question.\" };\n }\n if (route.requestKind === \"ambiguous\") {\n const topic = confirmationTopic(request);\n if (topic && routeRequest(task.request, [], workspace).requestKind === \"change\") {\n const matchesTask = topic === \"plan\" ||\n (topic === \"integration\" && /接入|集成|\\bintegrate\\b/i.test(task.request)) ||\n (topic === \"model\" && /模型|\\bmodels?\\b|\\b(?:t2v|i2v|t2i|llm)\\b/i.test(task.request));\n if (matchesTask) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The confirmation continues the active task within its previously authorized scope.\",\n };\n }\n }\n if (regressionFeedbackSubject(request) !== undefined && scoreTaskIntent(request, task, workspace) >= 10) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The regression report matches the previously authorized task.\",\n };\n }\n if (/^(?:more detail|continue|keep going|继续|补充|接着)/i.test(request.trim())) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The turn is an explicit continuation of the active task.\",\n };\n }\n return { disposition: \"clarify\", route, reason: \"The new turn needs clarification.\" };\n }\n\n const replanning = /\\b(instead|alternative|another approach|different approach|reroute)\\b|改成|换成|另一(?:个|种)?方案|重新规划/i.test(\n request,\n );\n const newTerms = meaningfulTerms(request);\n const oldTerms = meaningfulTerms(task.request);\n const sharedTerms = [...newTerms].filter((term) => oldTerms.has(term));\n const explicitScope = !route.scope.paths.includes(\".\");\n const related =\n replanning ||\n sharedTerms.length > 0 ||\n (explicitScope && scopesOverlap(task.scope.paths, route.scope.paths));\n\n if (!related) {\n return {\n disposition: \"follow-up\",\n route,\n reason: \"The change does not match the active task scope or intent.\",\n };\n }\n if (\n replanning ||\n route.route !== task.route ||\n (explicitScope && !route.scope.paths.every((candidate) => scopesOverlap([candidate], task.scope.paths)))\n ) {\n return {\n disposition: \"reroute\",\n route,\n reason: \"The request is related but changes the plan, route, or authorized scope.\",\n };\n }\n return {\n disposition: \"continue\",\n route,\n reason: \"The request matches the active task intent and scope.\",\n };\n}\n\nfunction inline(\n id: string,\n phase: \"analysis\" | \"implementation\" | \"acceptance\",\n instructions: string,\n): StageDefinition {\n return { id, type: \"inline-agent\", phase, instructions };\n}\n\nfunction check(\n id: string,\n command: readonly [string, ...string[]],\n): StageDefinition {\n return { id, type: \"command\", phase: \"check\", command };\n}\n\nfunction gates(checkId: string): readonly GateDefinition[] {\n return [\n {\n id: `command:${checkId}`,\n required: true,\n description: `${checkId} 命令必须基于当前工作区摘要执行通过。`,\n },\n {\n id: \"acceptance\",\n required: true,\n description: \"验收阶段必须复核已提交的检查证据,且不得修改已检查的文件。\",\n },\n ];\n}\n\nexport class StrategyRegistry {\n readonly #strategies = new Map<RouteId, Strategy>();\n\n register(strategy: Strategy): this {\n if (this.#strategies.has(strategy.route)) {\n throw new Error(`A strategy is already registered for route ${strategy.route}`);\n }\n if (strategy.stages.length === 0) {\n throw new Error(`Strategy ${strategy.id} must define at least one stage`);\n }\n this.#strategies.set(strategy.route, strategy);\n return this;\n }\n\n resolve(route: RouteId): Strategy {\n const strategy = this.#strategies.get(route);\n if (!strategy) throw new Error(`No strategy registered for route ${route}`);\n return strategy;\n }\n\n list(): readonly Strategy[] {\n return [...this.#strategies.values()];\n }\n}\n\nexport function createDefaultStrategyRegistry(\n checkCommand: readonly [string, ...string[]],\n): StrategyRegistry {\n return new StrategyRegistry()\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.debug,\n route: \"debug\",\n stages: [\n inline(\"locate\", \"analysis\", \"编辑前定位并说明问题的直接原因。\"),\n inline(\"implement\", \"implementation\", \"实施最小且完整的修复。\"),\n check(\"scoped-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核修复和范围检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"scoped-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.small,\n route: \"small\",\n stages: [\n inline(\"scope\", \"analysis\", \"确认请求涉及的路径和最小实施方案。\"),\n inline(\"implement\", \"implementation\", \"实现已确认范围内的变更。\"),\n check(\"scoped-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核变更和检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"scoped-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.standard,\n route: \"standard\",\n stages: [\n inline(\"research\", \"analysis\", \"调研相关代码与契约。\"),\n inline(\"plan\", \"analysis\", \"制定实施和验证方案。\"),\n inline(\"implement\", \"implementation\", \"按方案实现变更。\"),\n check(\"check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核范围、差异和检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.foundation,\n route: \"foundation\",\n stages: [\n inline(\"research\", \"analysis\", \"调研受影响的架构和兼容性约束。\"),\n inline(\"contract\", \"analysis\", \"确定公共契约和迁移约束。\"),\n inline(\"implement-core\", \"implementation\", \"实现核心契约变更。\"),\n inline(\"implement-integration\", \"implementation\", \"集成调用方并完成迁移变更。\"),\n check(\"staged-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核契约矩阵和全部检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"staged-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.infra,\n route: \"infra\",\n stages: [\n inline(\"scope\", \"analysis\", \"界定工作流或工具链变更及其兼容范围。\"),\n inline(\"design\", \"analysis\", \"定义状态、失败和恢复语义。\"),\n inline(\"implement\", \"implementation\", \"实现基础设施变更和失败场景测试。\"),\n check(\"static-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核事件历史、恢复过程和静态检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"static-check\"),\n });\n}\n\nexport function workflowForRoute(\n result: RouteResult,\n checkCommand: readonly [string, ...string[]],\n): WorkflowDefinition {\n if (result.requestKind !== \"change\" || !result.route || !result.strategyId) {\n throw new Error(\"Only a routed change request can be compiled into a workflow\");\n }\n const strategy = createDefaultStrategyRegistry(checkCommand).resolve(result.route);\n if (strategy.id !== result.strategyId) {\n throw new Error(\n `Route selected ${result.strategyId}, but registry resolved ${strategy.id}`,\n );\n }\n return {\n version: 1,\n name: strategy.id,\n stages: strategy.stages,\n gates: strategy.gates,\n };\n}\n\nfunction packageDirectoryForScope(workspace: string, scopePath: string): string | null {\n const root = path.resolve(workspace);\n let current = scopePath === \".\" ? root : path.resolve(root, scopePath);\n if (!existsSync(current) || path.extname(current) !== \"\") current = path.dirname(current);\n while (current === root || current.startsWith(`${root}${path.sep}`)) {\n if (existsSync(path.join(current, \"package.json\"))) return current;\n if (current === root) break;\n current = path.dirname(current);\n }\n return null;\n}\n\nexport function detectCheckCommand(\n workspace: string,\n scopePaths: readonly string[] = [\".\"],\n): readonly [string, ...string[]] {\n const root = path.resolve(workspace);\n const packageDirectory = scopePaths\n .map((scopePath) => packageDirectoryForScope(root, scopePath))\n .find((candidate): candidate is string => candidate !== null)\n ?? packageDirectoryForScope(root, \".\");\n if (packageDirectory) {\n const manifest = JSON.parse(\n readFileSync(path.join(packageDirectory, \"package.json\"), \"utf8\"),\n ) as { scripts?: Record<string, string> };\n const relative = path.relative(root, packageDirectory).replaceAll(\"\\\\\", \"/\");\n const runner = existsSync(path.join(root, \"pnpm-lock.yaml\")) ||\n existsSync(path.join(packageDirectory, \"pnpm-lock.yaml\"))\n ? \"pnpm\"\n : \"npm\";\n const prefix = relative === \"\"\n ? []\n : runner === \"pnpm\"\n ? [\"--dir\", relative]\n : [\"--prefix\", relative];\n if (manifest.scripts?.check) return [runner, ...prefix, \"run\", \"check\"];\n if (manifest.scripts?.test) return [runner, ...prefix, \"test\"];\n }\n return [\"git\", \"diff\", \"--check\", \"--\", \".\"];\n}\n\n/** Legacy setup workflow. Interactive execution recompiles this through the route registry. */\nexport function createDefaultWorkflow(\n checkCommand: readonly [string, ...string[]],\n): WorkflowDefinition {\n return {\n version: 1,\n name: \"default\",\n stages: [\n inline(\"implement\", \"implementation\", \"实现用户请求的变更。\"),\n check(\"check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"check\"),\n };\n}\n"],"mappings":";;;;;;;AAIA,SAAgB,6BAA6B,SAA2D;CACtG,MAAM,UAAU,QAAQ,KAAK,CAAC,CAAC,MAAM,2DAA2D,CAAC,CAC9F,KAAK,WAAW,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;CAChD,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,MAAM,6BAAa,IAAI,IAAuB;CAC9C,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,QAAQ,OAAO,MACnB,qHACF;EACA,IAAI,CAAC,OAAO,OAAO,KAAA;EACnB,MAAM,OAAO,MAAM,EAAE,CAAE,YAAY;EACnC,MAAM,SAAS,MAAM,EAAE,CAAE,KAAK;EAC9B,MAAM,YAAY,SAAS,QAAQ,SAAS,WAAW,WAAW;EAGlE,MAAM,gBAAgB,cAAc,WAChC,0EACA;EACJ,MAAM,gBAAgB,cAAc,WAChC,6FACA;EACJ,IAAI,CAAC,cAAc,KAAK,MAAM,KAAK,CAAC,cAAc,KAAK,MAAM,GAAG,OAAO,KAAA;EACvE,WAAW,IAAI,SAAS;CAC1B;CACA,OAAO,CAAC,GAAG,UAAU;AACvB;;;ACVA,MAAa,gBAAgB,aAAa,EACxC,YAAY;CACV,IAAI;CACJ,YAAY;CACZ,cAAc;EAAC;EAAiB;EAAoB;CAAkB;AACxE,EACF,CAAC;AAED,MAAM,qBAAwD;CAC5D,OAAO;CACP,OAAO;CACP,UAAU;CACV,YAAY;CACZ,OAAO;AACT;AAEA,SAAS,gBAAgB,OAA6C;CACpE,MAAM,aAAa,MAChB,KAAK,cACJ,UAAU,KAAK,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CA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KAAK,SAAS,MAAM,gBAAgB,CAAC,CAAC,WAAW,MAAM,GAAG;EAC3E,MAAM,SAAS,WAAW,KAAK,KAAK,MAAM,gBAAgB,CAAC,KACzD,WAAW,KAAK,KAAK,kBAAkB,gBAAgB,CAAC,IACtD,SACA;EACJ,MAAM,SAAS,aAAa,KACxB,CAAC,IACD,WAAW,SACT,CAAC,SAAS,QAAQ,IAClB,CAAC,YAAY,QAAQ;EAC3B,IAAI,SAAS,SAAS,OAAO,OAAO;GAAC;GAAQ,GAAG;GAAQ;GAAO;EAAO;EACtE,IAAI,SAAS,SAAS,MAAM,OAAO;GAAC;GAAQ,GAAG;GAAQ;EAAM;CAC/D;CACA,OAAO;EAAC;EAAO;EAAQ;EAAW;EAAM;CAAG;AAC7C;;AAGA,SAAgB,sBACd,cACoB;CACpB,OAAO;EACL,SAAS;EACT,MAAM;EACN,QAAQ;GACN,OAAO,aAAa,kBAAkB,YAAY;GAClD,MAAM,SAAS,YAAY;GAC3B,OAAO,cAAc,cAAc,gBAAgB;EACrD;EACA,OAAO,MAAM,OAAO;CACtB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/delivery.ts","../src/index.ts"],"sourcesContent":["import type { DeliveryOperation } from \"@piup/contracts\";\n\n/** Only imperative delivery-only clauses qualify; questions, negation and mixed\n * development requests fall back to the ordinary router. */\nexport function deliveryOperationsForRequest(request: string): readonly DeliveryOperation[] | undefined {\n const clauses = request.trim().split(/(?:[,,。.!!;;\\n]+|\\b(?:and then|and|then)\\b|然后|并且|并|再|同时)/i)\n .map((clause) => clause.trim()).filter(Boolean);\n if (clauses.length === 0) return undefined;\n const operations = new Set<DeliveryOperation>();\n for (const clause of clauses) {\n const match = clause.match(\n /^(?:(?:请|帮我|麻烦|直接|只需|只|先|继续|接着)\\s*|(?:please|just|only|now|continue to)\\s+)*(?:git\\s+)?(提交|推送|commit|push)\\s*(.*)$/i,\n );\n if (!match) return undefined;\n const verb = match[1]!.toLowerCase();\n const object = match[2]!.trim();\n const operation = verb === \"提交\" || verb === \"commit\" ? \"commit\" : \"push\";\n // Treat '修改/修复' as nouns only in established delivery objects. Do not\n // swallow a subsequent instruction such as '提交代码后修复登录问题'.\n const chineseObject = operation === \"commit\"\n ? /^(?:(?:当前|现有|已有|本次|这些|所有|刚才|已完成|修复后|修改后|代码|改动|修改|变更|修复|文件|结果|的|\\s))*$/\n : /^(?:(?:代码|改动|修改|变更|修复|提交|当前|已有|现有|本次|所有|这些|的|到|至|远端|远程|仓库|分支|\\s)|(?:origin|upstream|main|master))*$/i;\n const englishObject = operation === \"commit\"\n ? /^(?:(?:the|all|current|existing|these|staged|code|changes?|fix(?:es)?|updates?)\\b\\s*)*$/i\n : /^(?:(?:the|all|current|existing|these|commits?|code|changes?|fix(?:es)?|updates?|to|remote|origin|upstream|main|master|branch)\\b\\s*)*$/i;\n if (!chineseObject.test(object) && !englishObject.test(object)) return undefined;\n operations.add(operation);\n }\n return [...operations];\n}\n","import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { PIUP_API_VERSION } from \"@piup/contracts\";\nimport type {\n GateDefinition,\n RequestDisposition,\n RouteId,\n RouteResult,\n RoutingDecision,\n StageDefinition,\n Strategy,\n TaskRecord,\n WorkflowDefinition,\n} from \"@piup/contracts\";\nimport { definePlugin } from \"@piup/plugin-sdk\";\n\nimport { deliveryOperationsForRequest } from \"./delivery.js\";\n\nexport const defaultPlugin = definePlugin({\n descriptor: {\n id: \"@piup/plugin-default\",\n apiVersion: PIUP_API_VERSION,\n capabilities: [\"route.default\", \"strategy.default\", \"workflow.default\"],\n },\n});\n\nconst ROUTE_STRATEGY_IDS: Readonly<Record<RouteId, string>> = {\n debug: \"debug-local-fix\",\n small: \"small-change\",\n standard: \"standard-delivery\",\n foundation: \"foundation-change\",\n infra: \"infra-change\",\n};\n\nfunction normalizedScope(paths: readonly string[]): readonly string[] {\n const normalized = paths\n .map((candidate) =>\n candidate.trim().replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/\\/$/, \"\"),\n )\n .filter(\n (candidate) =>\n candidate !== \"\" &&\n candidate !== \"..\" &&\n !candidate.startsWith(\"../\") &&\n !path.posix.isAbsolute(candidate) &&\n !/^[a-z][a-z0-9+.-]*:\\/\\//i.test(candidate),\n );\n return normalized.length > 0 ? [...new Set(normalized)] : [\".\"];\n}\n\nfunction isWorkspacePath(workspace: string, candidate: string): boolean {\n const absolute = path.resolve(workspace, candidate);\n const relative = path.relative(path.resolve(workspace), absolute);\n return (\n relative !== \"\" &&\n !relative.startsWith(\"..\") &&\n !path.isAbsolute(relative) &&\n existsSync(absolute)\n );\n}\n\nfunction isNegatedPathMention(text: string, index: number): boolean {\n const prefix = text.slice(Math.max(0, index - 80), index);\n return /(?:未(?:曾|被)?|并未|没有|不要|别|无需|不(?:要|应|可|能|会|需)?)(?:\\s*(?:再|去|进行))?\\s*(?:修改|改动|变更|编辑|触及|涉及|包含|影响|处理)?\\s*$/u.test(prefix) ||\n /(?:do\\s+not|don't|not)\\s*(?:modify|change|edit|touch|include|affect)?\\s*$/i.test(prefix);\n}\n\nfunction inferredPaths(request: string, workspace?: string): readonly string[] {\n const withoutUrls = request.replace(/\\b(?:https?|ftp):\\/\\/[^\\s<>'\"`]+/gi, \" \");\n // A project/command name is not a path just because a same-name build\n // artifact exists. Use ./name or the paths argument to target that artifact.\n const projectName = workspace ? path.basename(path.resolve(workspace)) : undefined;\n const explicit = [\n ...[...withoutUrls.matchAll(/`([^`]+)`/g)].map((match) => ({\n candidate: match[1] ?? \"\", index: match.index ?? 0,\n })),\n ...[...withoutUrls.matchAll(/(?:^|\\s)(\\.\\/[A-Za-z0-9_./-]+)/g)].map((match) => ({\n candidate: match[1] ?? \"\", index: (match.index ?? 0) + match[0].indexOf(match[1] ?? \"\"),\n })),\n ];\n const existing = workspace\n ? [...withoutUrls.matchAll(/[A-Za-z0-9_.-]+(?:\\/[A-Za-z0-9_.-]+)*\\/?/g)].map((match) => ({\n candidate: match[0], index: match.index ?? 0,\n })).filter(({ candidate }) => candidate.replace(/\\/$/, \"\") !== projectName)\n .filter(({ candidate }) => isWorkspacePath(workspace, candidate))\n .filter(({ candidate }) => /[/.]/.test(candidate) || statSync(path.resolve(workspace, candidate)).isDirectory())\n : [];\n // A path mentioned as an exclusion is evidence of what must not be changed,\n // not an implementation target. Inferring it as scope would reject the real\n // target later at the diff gate.\n return normalizedScope([...explicit, ...existing]\n .filter(({ candidate, index }) => candidate !== projectName && !isNegatedPathMention(withoutUrls, index))\n .map(({ candidate }) => candidate));\n}\n\ntype ConfirmationTopic = \"integration\" | \"model\" | \"plan\";\n\n/** These replies need an active, already authorized task; they never start or recall one. */\nfunction confirmationTopic(request: string): ConfirmationTopic | undefined {\n const reply = request.trim()\n .replace(/^(?:请|麻烦)\\s*/, \"\")\n .replace(/^(?:确认|可以|好的|好|同意)[,,\\s]+/, \"\")\n .replace(/[。.!!]$/, \"\").trim();\n if (/^(?:(?:确认|同意)(?:接入|集成)(?:(?:这个|该|上述)模型)?|(?:就|直接)(?:接入|集成)(?:这个|该|上述)模型)$/.test(reply)) {\n return \"integration\";\n }\n if (/^(?:就用|确认使用|同意使用)(?:这个|该|上述)模型$/.test(reply)) return \"model\";\n if (/^(?:(?:就|直接)?按(?:这个|该|上述|当前|原|你(?:推荐|建议)的)方案(?:执行|实施|继续)|确认(?:执行|实施)(?:这个|该|当前)方案)$/.test(reply)) {\n return \"plan\";\n }\n return undefined;\n}\n\n/** Deterministic, side-effect-free default router. */\nexport function routeRequest(\n request: string,\n paths: readonly string[] = [],\n workspace?: string,\n): RouteResult {\n const summary = request.trim();\n const scope = {\n paths: normalizedScope(paths.length > 0 ? paths : inferredPaths(summary, workspace)),\n };\n if (summary === \"\") {\n return {\n requestKind: \"ambiguous\",\n route: null,\n complexity: null,\n risk: null,\n strategyId: null,\n dispatchMode: \"inline\",\n scope,\n reason: \"The request is empty.\",\n };\n }\n\n const changeSignal = /\\b(add|build|change|create|delete|develop|fix|implement|integrate|migrate|modify|optimi[sz]e|refactor|remove|rename|replace|update|upgrade|write)\\b|接入|集成|修改|实现|修复|新增|创建|开发|优化|重构|删除|移除|去掉|去除|调整|替换|升级|迁移|完善|搭建|改(?:成|为|一下|下)?/i;\n const genericChangeOnly = /^(?:(?:please\\s+)?(?:add|build|change|create|delete|develop|fix|implement|integrate|migrate|modify|optimi[sz]e|refactor|remove|rename|replace|update|upgrade|write)|(?:请|帮我|麻烦)?\\s*(?:接入|集成|修改|实现|修复|新增|创建|开发|优化|重构|删除|移除|去掉|去除|调整|替换|升级|迁移|完善|搭建|改)(?:一下|下)?)(?:[。.!!])?$/i;\n const readOnlySignal = /^(?:what|why|how|explain|describe|show|list|inspect|review|assess|evaluate|analy[sz]e|summari[sz]e|where|which|who|can you explain)\\b|^(?:(?:请帮我|帮我|请|麻烦)\\s*)?(?:什么|为什么|为何|如何|怎么|怎样|解释|说明|查看|列出|分析|评估|评审|总结|哪里|哪些|给出.{0,12}方案)/i;\n // A diagnostic request can also explicitly ask for implementation. Do not\n // treat questions such as \"how to fix\" as authorization to edit.\n const diagnosticStart = /^(?:analy[sz]e|inspect|review|assess|evaluate)\\b|^(?:(?:请帮我|帮我|请|麻烦)\\s*)?(?:分析|检查|排查|评估)/i;\n const coordinatedChange = new RegExp(\n `(?:并且?|然后|同时|\\\\b(?:and|then)\\\\s+)(?:直接|请|帮我|\\\\s)*(?:${changeSignal.source})`,\n \"i\",\n );\n const asksForDiagnosticChange = diagnosticStart.test(summary) && coordinatedChange.test(summary);\n const holdSignal = /^(?:不要|先别|先不|无需|暂缓|停止|暂停)(?:修改|改|执行|开始|做|动|实施|继续|提交|推送)?(?:[,。,.!!\\s]|$)|^(?:不要|先别|先不|无需|暂缓|停止|暂停)\\s*(?:提交|推送)|^(?:do not|don't|never)\\s+(?:commit|push)\\b/i;\n // Explicit limits apply even when appended to a confirmation/change request.\n const explicitReadOnly = /(?:不要|先别|先不|暂不|暂缓|停止|暂停|无需)\\s*(?:确认|同意)?\\s*(?:修改|改|执行|实施|接入|集成|继续|动手|写入)|(?:只|仅)(?:做)?(?:分析|解释|讨论|查看|评估)|\\b(?:do not|don't|no need to)\\s+(?:modify|edit|change|implement|integrate|execute|write)\\b|\\b(?:only|just)\\s+(?:analy[sz]e|inspect|explain|review|discuss)\\b/i;\n const integrationQuestion = /接入|集成|\\bintegrate\\b/i.test(summary) &&\n /[??]|是否|能否|可否|吗[。!!]?$|\\b(?:can|could|should|would)\\b/i.test(summary);\n const deliveryOperations = deliveryOperationsForRequest(summary);\n const feedback = regressionFeedbackSubject(summary) !== undefined;\n const restrictedFeedback = feedback && (\n /[??]|为什么|为何|怎么|如何|是否|是不是|不要|先别|先不|无需|暂缓|停止|暂停|只(?:看|查|读|分析|解释)|仅(?:看|查|读|分析|解释)|\\b(?:why|how|whether|do not|don't|only|stop|pause)\\b/i.test(summary) ||\n (!changeSignal.test(summary) && /分析|解释|\\b(?:explain|analy[sz]e|inspect)\\b/i.test(summary))\n );\n const requestKind = restrictedFeedback || explicitReadOnly.test(summary) || integrationQuestion || holdSignal.test(summary) || (readOnlySignal.test(summary) && !asksForDiagnosticChange)\n ? \"read-only\"\n : deliveryOperations\n ? \"delivery\"\n : changeSignal.test(summary) && !genericChangeOnly.test(summary) && !confirmationTopic(summary)\n ? \"change\"\n : \"ambiguous\";\n if (requestKind !== \"change\") {\n return {\n requestKind,\n ...(requestKind === \"delivery\" && deliveryOperations ? { deliveryOperations } : {}),\n route: null,\n complexity: null,\n risk: null,\n strategyId: null,\n dispatchMode: \"inline\",\n scope,\n reason:\n requestKind === \"read-only\"\n ? \"No repository mutation was requested; keep the interaction read-only.\"\n : requestKind === \"delivery\"\n ? \"Deliver existing changes with the authorized Git operations; do not create or recall a development task.\"\n : \"No unambiguous repository mutation signal was found; clarification is required.\",\n };\n }\n\n return routeChangeRequest(summary, scope.paths, workspace);\n}\n\n/** Compile a semantic plan without reclassifying the agent's goal using keywords. */\nexport function routeFromDecision(decision: RoutingDecision, paths: readonly string[]): RouteResult {\n if (!Object.hasOwn(ROUTE_STRATEGY_IDS, decision.route) ||\n ![\"low\", \"medium\", \"high\"].includes(decision.complexity) ||\n ![\"low\", \"medium\", \"high\"].includes(decision.risk) || !decision.reason?.trim()) {\n throw new Error(\"路由决策必须包含有效的 route、complexity、risk 和具体理由\");\n }\n if (decision.route === \"small\" && (decision.complexity !== \"low\" || decision.risk !== \"low\")) {\n throw new Error(\"small 仅适用于已确认的低复杂度、低风险局部变更\");\n }\n if ([\"foundation\", \"infra\"].includes(decision.route) && decision.complexity !== \"high\") {\n throw new Error(\"foundation/infra 必须按高复杂度规划\");\n }\n return {\n requestKind: \"change\", route: decision.route, complexity: decision.complexity,\n risk: decision.risk, reason: decision.reason, strategyId: ROUTE_STRATEGY_IDS[decision.route],\n dispatchMode: \"inline\", scope: { paths: normalizedScope(paths) },\n };\n}\n\n/** Conservative rule-based fallback for non-agent callers; never establishes authorization. */\nexport function routeChangeRequest(\n request: string,\n paths: readonly string[] = [],\n workspace?: string,\n): RouteResult {\n const scope = {\n paths: normalizedScope(paths.length > 0 ? paths : inferredPaths(request, workspace)),\n };\n const text = `${request} ${scope.paths.join(\" \")}`.toLowerCase();\n // Classify the affected mechanism, not arbitrary substrings (e.g. TypeScript,\n // React Router, or an agent application's name). Agent planning remains final.\n const migration = /\\bmigrat(?:e|ion|ing)\\b|迁移/i.test(request);\n const projectMigration = migration && /项目|应用|仓库|全部数据|完整数据|\\b(?:project|application|repository|all data)\\b/i.test(request);\n const controlMechanism = /任务(?:召回|路由|调度|阶段)|意图(?:理解|识别|判断|解析|路由)|阶段(?:切换|推进|重建|门禁)|执行门禁|持久化阶段|\\b(?:task[ -](?:recall|routing|schedul(?:er|ing))|intent[ -](?:resolution|routing)|stage[ -](?:transition|gates?))\\b/i.test(text);\n const infrastructurePath = /(?:^|[\\s/`])(?:\\.piup|\\.pi|\\.github\\/workflows|scripts)(?:[/\\s`.]|$)|\\bpackages\\/(?:pi-extension|plugin-default)\\b|\\b(?:dockerfile|tsconfig\\.json|vitest\\.config|eslint\\.config)\\b/i.test(text);\n const businessWorkflow = /(?:订单|审批|营销|表单).{0,12}(?:流程|工作流)|\\b(?:order|approval|marketing|form)\\b.{0,24}\\bworkflow\\b/i.test(request);\n const workflowMechanism = /调度器|工具链|执行引擎|插件|持续集成|构建流水线|\\b(?:scheduler|toolchain|plugin|skills?|ci\\/cd)\\b|\\b(?:agent|lifecycle|workflow)[ -](?:hooks?|runtime|extensions?)\\b/i.test(text) ||\n (!businessWorkflow && /工作流|\\bworkflow\\b/i.test(text));\n let route: RouteId;\n let complexity: \"low\" | \"medium\" | \"high\";\n let risk: \"low\" | \"medium\" | \"high\";\n let reason: string;\n if (projectMigration) {\n route = \"foundation\";\n complexity = \"high\";\n risk = \"high\";\n reason = \"Project or application migration affects data and compatibility; names and tooling keywords do not reduce its scope.\";\n } else if (controlMechanism || infrastructurePath || workflowMechanism) {\n route = \"infra\";\n complexity = \"high\";\n risk = controlMechanism ? \"high\" : \"medium\";\n reason = \"Changes workflow control, task execution, or tooling infrastructure; classify by affected mechanism rather than file count.\";\n } else if (/\\b(?:foundation|architecture|cross[- ]module|cross[- ]package|migrat(?:e|ion|ing)|batch|platform|framework|protocol)\\b|迁移|基础|架构|跨模块|跨包|批量|协议/i.test(text)) {\n route = \"foundation\";\n complexity = \"high\";\n risk = \"high\";\n reason = \"Matched a foundational, cross-module, migration, or protocol change.\";\n } else if (businessWorkflow || /\\b(?:api|contract|database|schema|sqlite|auth|multiple|multi[- ]file|tetris|game|component|feature|router|routing)\\b|接口|契约|数据库|鉴权|多文件|组件|功能|页面路由|前端路由/i.test(text)) {\n route = \"standard\";\n complexity = \"medium\";\n risk = \"medium\";\n reason = \"Matched a feature or multi-file contract change.\";\n } else if (/\\b(?:bug|debug|fix|regression|error|crash)\\b|修复|错误|异常|崩溃|回归/i.test(text)) {\n route = \"debug\";\n complexity = \"low\";\n risk = \"low\";\n reason = \"Matched a localized defect or regression.\";\n } else {\n // Absence of recognized keywords is not evidence of low complexity or risk.\n route = \"standard\";\n complexity = \"medium\";\n risk = \"medium\";\n reason = \"Insufficient evidence for a small change; use conservative standard planning.\";\n }\n\n return {\n requestKind: \"change\",\n route,\n complexity,\n risk,\n strategyId: ROUTE_STRATEGY_IDS[route],\n dispatchMode: \"inline\",\n scope,\n reason,\n };\n}\n\nexport interface ActiveRequestDecision {\n readonly disposition: RequestDisposition;\n readonly route: RouteResult;\n readonly reason: string;\n}\n\nfunction meaningfulTerms(value: string): Set<string> {\n const ignored = new Set([\n \"add\", \"build\", \"change\", \"continue\", \"create\", \"fix\", \"implement\", \"modify\",\n \"please\", \"refactor\", \"remove\", \"replace\", \"resume\", \"update\", \"改\", \"修改\", \"实现\",\n \"修复\", \"继续\", \"恢复\", \"请\", \"一下\", \"之前\", \"任务\", \"接入\", \"集成\", \"integrate\",\n ]);\n const terms = new Set<string>();\n for (const token of value.toLowerCase().match(/[\\p{Script=Han}]+|[\\p{L}\\p{N}_./-]+/gu) ?? []) {\n if (ignored.has(token)) continue;\n if (/^\\p{Script=Han}+$/u.test(token)) {\n const normalized = [...ignored]\n .filter((word) => /^\\p{Script=Han}+$/u.test(word))\n .reduce((result, word) => result.replaceAll(word, \"\"), token);\n if (normalized.length === 1) continue;\n if (normalized.length === 2) terms.add(normalized);\n for (let index = 0; index < normalized.length - 1; index += 1) {\n terms.add(normalized.slice(index, index + 2));\n }\n continue;\n }\n if (token.length > 1) terms.add(token);\n }\n return terms;\n}\n\n/** A regression report is contextual continuation, not standalone edit permission. */\nfunction regressionFeedbackSubject(request: string): string | undefined {\n // Match the user's subject, never shared words/paths inside a pasted error.\n const heading = request.split(/[::\\r\\n]/, 1)[0] ?? \"\";\n const signal = /(?:还是|仍然?|依然|又)\\s*(?:会|在)?\\s*(?:报错|失败|出错|不行|不正常|不能用|无法使用)|\\bstill\\s+(?:fails?\\b|failing\\b|errors?\\b|broken\\b|not working\\b)/i;\n if (!signal.test(heading)) return undefined;\n return heading.replace(signal, \" \").replace(/测试|重试|\\b(?:test|testing|retest|retry)\\b/gi, \" \").trim();\n}\n\n/** Recall verbs must be instructions, not words in a topic, denial, or pasted error. */\nexport function isTaskRecallRequest(request: string): boolean {\n return /^(?:(?:请帮我|请|麻烦|帮我)\\s*|(?:please|can you|could you)\\s+)?(?:\\b(?:continue|resume|reopen|return to)\\b|继续|恢复|接着|回到|召回)/i.test(request.trim());\n}\n\nexport interface TaskIntentEvidence {\n readonly score: number;\n readonly sharedTerms: readonly string[];\n readonly lexicalScore: number;\n readonly scopeScore: number;\n readonly routeScore: number;\n}\n\n/** Retrieval evidence only, never authorization to recall or edit. */\nexport function explainTaskIntent(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n options: { readonly explicitRecall?: boolean } = {},\n): TaskIntentEvidence {\n const empty = { score: 0, sharedTerms: [], lexicalScore: 0, scopeScore: 0, routeScore: 0 };\n const route = routeRequest(request, [], workspace);\n const recallSignal = isTaskRecallRequest(request);\n if (route.requestKind === \"read-only\" || route.requestKind === \"delivery\" || confirmationTopic(request)) return empty;\n const feedbackSubject = regressionFeedbackSubject(request);\n const regression = route.requestKind === \"ambiguous\" && feedbackSubject !== undefined &&\n routeRequest(task.request, [], workspace).requestKind === \"change\";\n // Only a related regression can inherit an existing change task's intent.\n // An unmatched report remains ambiguous and cannot start a new write task.\n if (route.requestKind === \"ambiguous\" && !recallSignal && !options.explicitRecall && !regression) return empty;\n\n const requestedTerms = meaningfulTerms(regression ? feedbackSubject : request);\n const taskTerms = meaningfulTerms(task.request);\n const sharedTerms = [...requestedTerms].filter((term) => taskTerms.has(term));\n const scope = regression ? inferredPaths(feedbackSubject, workspace) : route.scope.paths;\n const explicitScope = !scope.includes(\".\");\n const scopeMatch = explicitScope && scopesOverlap(task.scope.paths, scope);\n if (sharedTerms.length === 0 && !scopeMatch) return empty;\n\n const lexicalScore = sharedTerms.reduce(\n (score, term) => score + (/^[\\p{Script=Han}]+$/u.test(term) ? 5 : 30),\n 0,\n );\n const scopeScore = scopeMatch ? 50 : 0;\n const routeScore = route.route !== null && route.route === task.route ? 2 : 0;\n return { score: lexicalScore + scopeScore + routeScore, sharedTerms, lexicalScore, scopeScore, routeScore };\n}\n\n/** Compatibility score for candidate retrieval and explicit activation commands. */\nexport function scoreTaskIntent(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n options: { readonly explicitRecall?: boolean } = {},\n): number {\n return explainTaskIntent(request, task, workspace, options).score;\n}\n\nfunction scopesOverlap(left: readonly string[], right: readonly string[]): boolean {\n if (left.includes(\".\") || right.includes(\".\")) return true;\n return left.some((leftPath) =>\n right.some(\n (rightPath) =>\n leftPath === rightPath ||\n leftPath.startsWith(`${rightPath.replace(/\\/$/, \"\")}/`) ||\n rightPath.startsWith(`${leftPath.replace(/\\/$/, \"\")}/`),\n ),\n );\n}\n\n/** Classify every turn received while another task is active. */\nexport function decideActiveRequest(\n request: string,\n task: Pick<TaskRecord, \"request\" | \"route\" | \"scope\">,\n workspace?: string,\n): ActiveRequestDecision {\n const route = routeRequest(request, [], workspace);\n if (route.requestKind === \"delivery\") {\n return { disposition: \"delivery\", route, reason: \"Deliver existing changes without advancing the active task.\" };\n }\n if (route.requestKind === \"read-only\") {\n return { disposition: \"read-only\", route, reason: \"The new turn is a read-only question.\" };\n }\n if (route.requestKind === \"ambiguous\") {\n const topic = confirmationTopic(request);\n if (topic && routeRequest(task.request, [], workspace).requestKind === \"change\") {\n const matchesTask = topic === \"plan\" ||\n (topic === \"integration\" && /接入|集成|\\bintegrate\\b/i.test(task.request)) ||\n (topic === \"model\" && /模型|\\bmodels?\\b|\\b(?:t2v|i2v|t2i|llm)\\b/i.test(task.request));\n if (matchesTask) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The confirmation continues the active task within its previously authorized scope.\",\n };\n }\n }\n if (regressionFeedbackSubject(request) !== undefined && scoreTaskIntent(request, task, workspace) >= 10) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The regression report matches the previously authorized task.\",\n };\n }\n if (/^(?:more detail|continue|keep going|继续|补充|接着)/i.test(request.trim())) {\n return {\n disposition: \"continue\",\n route,\n reason: \"The turn is an explicit continuation of the active task.\",\n };\n }\n return { disposition: \"clarify\", route, reason: \"The new turn needs clarification.\" };\n }\n\n const replanning = /\\b(instead|alternative|another approach|different approach|reroute)\\b|改成|换成|另一(?:个|种)?方案|重新规划/i.test(\n request,\n );\n const newTerms = meaningfulTerms(request);\n const oldTerms = meaningfulTerms(task.request);\n const sharedTerms = [...newTerms].filter((term) => oldTerms.has(term));\n const explicitScope = !route.scope.paths.includes(\".\");\n const related =\n replanning ||\n sharedTerms.length > 0 ||\n (explicitScope && scopesOverlap(task.scope.paths, route.scope.paths));\n\n if (!related) {\n return {\n disposition: \"follow-up\",\n route,\n reason: \"The change does not match the active task scope or intent.\",\n };\n }\n if (\n replanning ||\n route.route !== task.route ||\n (explicitScope && !route.scope.paths.every((candidate) => scopesOverlap([candidate], task.scope.paths)))\n ) {\n return {\n disposition: \"reroute\",\n route,\n reason: \"The request is related but changes the plan, route, or authorized scope.\",\n };\n }\n return {\n disposition: \"continue\",\n route,\n reason: \"The request matches the active task intent and scope.\",\n };\n}\n\nfunction inline(\n id: string,\n phase: \"analysis\" | \"implementation\" | \"acceptance\",\n instructions: string,\n): StageDefinition {\n return { id, type: \"inline-agent\", phase, instructions };\n}\n\nfunction check(\n id: string,\n command: readonly [string, ...string[]],\n): StageDefinition {\n return { id, type: \"command\", phase: \"check\", command };\n}\n\nfunction gates(checkId: string): readonly GateDefinition[] {\n return [\n {\n id: `command:${checkId}`,\n required: true,\n description: `${checkId} 命令必须基于当前工作区摘要执行通过。`,\n },\n {\n id: \"acceptance\",\n required: true,\n description: \"验收阶段必须复核已提交的检查证据,且不得修改已检查的文件。\",\n },\n ];\n}\n\nexport class StrategyRegistry {\n readonly #strategies = new Map<RouteId, Strategy>();\n\n register(strategy: Strategy): this {\n if (this.#strategies.has(strategy.route)) {\n throw new Error(`A strategy is already registered for route ${strategy.route}`);\n }\n if (strategy.stages.length === 0) {\n throw new Error(`Strategy ${strategy.id} must define at least one stage`);\n }\n this.#strategies.set(strategy.route, strategy);\n return this;\n }\n\n resolve(route: RouteId): Strategy {\n const strategy = this.#strategies.get(route);\n if (!strategy) throw new Error(`No strategy registered for route ${route}`);\n return strategy;\n }\n\n list(): readonly Strategy[] {\n return [...this.#strategies.values()];\n }\n}\n\nexport function createDefaultStrategyRegistry(\n checkCommand: readonly [string, ...string[]],\n): StrategyRegistry {\n return new StrategyRegistry()\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.debug,\n route: \"debug\",\n stages: [\n inline(\"locate\", \"analysis\", \"编辑前定位并说明问题的直接原因。\"),\n inline(\"implement\", \"implementation\", \"实施最小且完整的修复。\"),\n check(\"scoped-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核修复和范围检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"scoped-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.small,\n route: \"small\",\n stages: [\n inline(\"scope\", \"analysis\", \"确认请求涉及的路径和最小实施方案。\"),\n inline(\"implement\", \"implementation\", \"实现已确认范围内的变更。\"),\n check(\"scoped-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核变更和检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"scoped-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.standard,\n route: \"standard\",\n stages: [\n inline(\"research\", \"analysis\", \"调研相关代码与契约。\"),\n inline(\"plan\", \"analysis\", \"制定实施和验证方案。\"),\n inline(\"implement\", \"implementation\", \"按方案实现变更。\"),\n check(\"check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核范围、差异和检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.foundation,\n route: \"foundation\",\n stages: [\n inline(\"research\", \"analysis\", \"调研受影响的架构和兼容性约束。\"),\n inline(\"contract\", \"analysis\", \"确定公共契约和迁移约束。\"),\n inline(\"implement-core\", \"implementation\", \"实现核心契约变更。\"),\n inline(\"implement-integration\", \"implementation\", \"集成调用方并完成迁移变更。\"),\n check(\"staged-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核契约矩阵和全部检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"staged-check\"),\n })\n .register({\n version: 1,\n id: ROUTE_STRATEGY_IDS.infra,\n route: \"infra\",\n stages: [\n inline(\"scope\", \"analysis\", \"界定工作流或工具链变更及其兼容范围。\"),\n inline(\"design\", \"analysis\", \"定义状态、失败和恢复语义。\"),\n inline(\"implement\", \"implementation\", \"实现基础设施变更和失败场景测试。\"),\n check(\"static-check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核事件历史、恢复过程和静态检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"static-check\"),\n });\n}\n\nexport function workflowForRoute(\n result: RouteResult,\n checkCommand: readonly [string, ...string[]],\n): WorkflowDefinition {\n if (result.requestKind !== \"change\" || !result.route || !result.strategyId) {\n throw new Error(\"Only a routed change request can be compiled into a workflow\");\n }\n const strategy = createDefaultStrategyRegistry(checkCommand).resolve(result.route);\n if (strategy.id !== result.strategyId) {\n throw new Error(\n `Route selected ${result.strategyId}, but registry resolved ${strategy.id}`,\n );\n }\n return {\n version: 1,\n name: strategy.id,\n stages: strategy.stages,\n gates: strategy.gates,\n };\n}\n\nfunction packageDirectoryForScope(workspace: string, scopePath: string): string | null {\n const root = path.resolve(workspace);\n let current = scopePath === \".\" ? root : path.resolve(root, scopePath);\n if (!existsSync(current) || path.extname(current) !== \"\") current = path.dirname(current);\n while (current === root || current.startsWith(`${root}${path.sep}`)) {\n if (existsSync(path.join(current, \"package.json\"))) return current;\n if (current === root) break;\n current = path.dirname(current);\n }\n return null;\n}\n\nexport function detectCheckCommand(\n workspace: string,\n scopePaths: readonly string[] = [\".\"],\n): readonly [string, ...string[]] {\n const root = path.resolve(workspace);\n const packageDirectory = scopePaths\n .map((scopePath) => packageDirectoryForScope(root, scopePath))\n .find((candidate): candidate is string => candidate !== null)\n ?? packageDirectoryForScope(root, \".\");\n if (packageDirectory) {\n const manifest = JSON.parse(\n readFileSync(path.join(packageDirectory, \"package.json\"), \"utf8\"),\n ) as { scripts?: Record<string, string> };\n const relative = path.relative(root, packageDirectory).replaceAll(\"\\\\\", \"/\");\n const runner = existsSync(path.join(root, \"pnpm-lock.yaml\")) ||\n existsSync(path.join(packageDirectory, \"pnpm-lock.yaml\"))\n ? \"pnpm\"\n : \"npm\";\n const prefix = relative === \"\"\n ? []\n : runner === \"pnpm\"\n ? [\"--dir\", relative]\n : [\"--prefix\", relative];\n if (manifest.scripts?.check) return [runner, ...prefix, \"run\", \"check\"];\n if (manifest.scripts?.test) return [runner, ...prefix, \"test\"];\n }\n return [\"git\", \"diff\", \"--check\", \"--\", \".\"];\n}\n\n/** Legacy setup workflow. Interactive execution recompiles this through the route registry. */\nexport function createDefaultWorkflow(\n checkCommand: readonly [string, ...string[]],\n): WorkflowDefinition {\n return {\n version: 1,\n name: \"default\",\n stages: [\n inline(\"implement\", \"implementation\", \"实现用户请求的变更。\"),\n check(\"check\", checkCommand),\n inline(\"acceptance\", \"acceptance\", \"复核检查证据,不得编辑文件。\"),\n ],\n gates: gates(\"check\"),\n };\n}\n"],"mappings":";;;;;;;AAIA,SAAgB,6BAA6B,SAA2D;CACtG,MAAM,UAAU,QAAQ,KAAK,CAAC,CAAC,MAAM,2DAA2D,CAAC,CAC9F,KAAK,WAAW,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;CAChD,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,MAAM,6BAAa,IAAI,IAAuB;CAC9C,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,QAAQ,OAAO,MACnB,qHACF;EACA,IAAI,CAAC,OAAO,OAAO,KAAA;EACnB,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,gBAAgB,CAAC,KACzD,WAAW,KAAK,KAAK,kBAAkB,gBAAgB,CAAC,IACtD,SACA;EACJ,MAAM,SAAS,aAAa,KACxB,CAAC,IACD,WAAW,SACT,CAAC,SAAS,QAAQ,IAClB,CAAC,YAAY,QAAQ;EAC3B,IAAI,SAAS,SAAS,OAAO,OAAO;GAAC;GAAQ,GAAG;GAAQ;GAAO;EAAO;EACtE,IAAI,SAAS,SAAS,MAAM,OAAO;GAAC;GAAQ,GAAG;GAAQ;EAAM;CAC/D;CACA,OAAO;EAAC;EAAO;EAAQ;EAAW;EAAM;CAAG;AAC7C;;AAGA,SAAgB,sBACd,cACoB;CACpB,OAAO;EACL,SAAS;EACT,MAAM;EACN,QAAQ;GACN,OAAO,aAAa,kBAAkB,YAAY;GAClD,MAAM,SAAS,YAAY;GAC3B,OAAO,cAAc,cAAc,gBAAgB;EACrD;EACA,OAAO,MAAM,OAAO;CACtB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piup/plugin-default",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"description": "Default router, strategies, workflows, and project check detection for piup.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@piup/contracts": "0.0.1-beta.
|
|
36
|
-
"@piup/plugin-sdk": "0.0.1-beta.
|
|
35
|
+
"@piup/contracts": "0.0.1-beta.2",
|
|
36
|
+
"@piup/plugin-sdk": "0.0.1-beta.2"
|
|
37
37
|
}
|
|
38
38
|
}
|