mancode 0.3.10 → 0.3.11
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.en.md +3 -3
- package/README.md +3 -3
- package/dist/{chunk-KEIW7AEP.js → chunk-WAH4E2N2.js} +8 -4
- package/dist/chunk-WAH4E2N2.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{v3-adapter-3GJT3AID.js → v3-adapter-HA7VR5VL.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-KEIW7AEP.js.map +0 -1
- /package/dist/{v3-adapter-3GJT3AID.js.map → v3-adapter-HA7VR5VL.js.map} +0 -0
package/README.en.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<p align="center">
|
|
18
18
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square" alt="License: AGPL-3.0" /></a>
|
|
19
19
|
<a href="https://www.npmjs.com/package/mancode"><img src="https://img.shields.io/npm/v/mancode?style=flat-square" alt="npm version" /></a>
|
|
20
|
-
<img src="https://img.shields.io/badge/status-stable%20v0.3.
|
|
20
|
+
<img src="https://img.shields.io/badge/status-stable%20v0.3.11-green?style=flat-square" alt="Status: stable v0.3.11" />
|
|
21
21
|
<img src="https://img.shields.io/badge/V3-cross--CLI%20team%20Beta-FB6A21?style=flat-square" alt="V3: cross-CLI team Beta" />
|
|
22
22
|
<img src="https://img.shields.io/badge/platforms-Claude%20Code%20%7C%20Cursor%20%7C%20Codex%20%7C%20Copilot%20%7C%20ZCode-5865F2?style=flat-square" alt="Platforms: Claude Code, Cursor, Codex in ChatGPT desktop and CLI, GitHub Copilot, ZCode" />
|
|
23
23
|
<img src="https://img.shields.io/badge/tests-passing-brightgreen?style=flat-square" alt="Tests passing" />
|
|
@@ -344,7 +344,7 @@ it should behave, and why previous decisions were made.
|
|
|
344
344
|
|
|
345
345
|
## Installation
|
|
346
346
|
|
|
347
|
-
**Status**: stable v0.3.
|
|
347
|
+
**Status**: stable v0.3.11. Claude Code, Cursor, Codex in the ChatGPT desktop app
|
|
348
348
|
and CLI, and GitHub Copilot are supported. ZCode adapter support is included,
|
|
349
349
|
with project skill discovery kept behind a verification gate before release.
|
|
350
350
|
|
|
@@ -447,7 +447,7 @@ mancode version
|
|
|
447
447
|
Example output for a UI project (not a default stack):
|
|
448
448
|
|
|
449
449
|
```text
|
|
450
|
-
mancode v0.3.
|
|
450
|
+
mancode v0.3.11
|
|
451
451
|
|
|
452
452
|
Project: my-app (React + TypeScript + Tailwind)
|
|
453
453
|
Mode: solo (default)
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<p align="center">
|
|
18
18
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square" alt="许可证:AGPL-3.0" /></a>
|
|
19
19
|
<a href="https://www.npmjs.com/package/mancode"><img src="https://img.shields.io/npm/v/mancode?style=flat-square" alt="npm 版本" /></a>
|
|
20
|
-
<img src="https://img.shields.io/badge/status-stable%20v0.3.
|
|
20
|
+
<img src="https://img.shields.io/badge/status-stable%20v0.3.11-green?style=flat-square" alt="状态:稳定版 v0.3.11" />
|
|
21
21
|
<img src="https://img.shields.io/badge/V3-%E8%B7%A8%20CLI%20%E5%9B%A2%E9%98%9F%20Beta-FB6A21?style=flat-square" alt="V3:跨 CLI 团队协作 Beta" />
|
|
22
22
|
<img src="https://img.shields.io/badge/platforms-Claude%20Code%20%7C%20Cursor%20%7C%20Codex%20%7C%20Copilot%20%7C%20ZCode-5865F2?style=flat-square" alt="平台:Claude Code、Cursor、ChatGPT 桌面端 Codex、Codex CLI、GitHub Copilot、ZCode" />
|
|
23
23
|
<img src="https://img.shields.io/badge/tests-passing-brightgreen?style=flat-square" alt="测试通过" />
|
|
@@ -296,7 +296,7 @@ src/components/
|
|
|
296
296
|
|
|
297
297
|
## 安装
|
|
298
298
|
|
|
299
|
-
**状态**:稳定版 v0.3.
|
|
299
|
+
**状态**:稳定版 v0.3.11。Claude Code、Cursor、ChatGPT 桌面端中的 Codex、
|
|
300
300
|
Codex CLI 和 GitHub Copilot 均已支持。ZCode adapter 已接入,但项目级 skill
|
|
301
301
|
发现路径在发布前仍作为验证门禁。
|
|
302
302
|
|
|
@@ -397,7 +397,7 @@ mancode version
|
|
|
397
397
|
以下是 UI 项目的输出示例,并非默认技术栈:
|
|
398
398
|
|
|
399
399
|
```text
|
|
400
|
-
mancode v0.3.
|
|
400
|
+
mancode v0.3.11
|
|
401
401
|
|
|
402
402
|
Project: my-app (React + TypeScript + Tailwind)
|
|
403
403
|
Mode: solo (default)
|
|
@@ -323,10 +323,14 @@ function renderV3Bootstrap(platform) {
|
|
|
323
323
|
"",
|
|
324
324
|
`- Platform: ${platformLabel}. This file is a non-authoritative bootstrap.`,
|
|
325
325
|
"- Locate the project root before running mancode commands.",
|
|
326
|
-
|
|
327
|
-
"-
|
|
326
|
+
"- First run `mancode status --json` from the project root.",
|
|
327
|
+
"- If status reports `currentSession`, reuse it. `currentTask: null` and `MANCODE_TASK_REQUIRED` do not make a session stale.",
|
|
328
|
+
`- Only when status has no \`currentSession\`, create one once with \`mancode context session new --client ${platform}\`. Pass its returned \`sessionId\` as \`--session <id>\` to later commands; an \`export\` inside one command tool does not persist to later command tools.`,
|
|
329
|
+
'- If no current task and no task is explicitly supplied, report "no task bound" and stop. Do not probe workflow subcommands to work around `MANCODE_TASK_REQUIRED`.',
|
|
330
|
+
"- Bootstrap is read-only: do not run `mancode init`, `mancode migrate`, `mancode workflow`, or inspect mancode installed package/source.",
|
|
331
|
+
"- With an existing or supplied task, read its Context Pack with `mancode context show --purpose orient --session <id>`; for anonymous diagnosis, include an explicit `--task <namespace:id>`.",
|
|
332
|
+
"- After an operator explicitly requests task work, perform mutations only through `mancode workflow`, `mancode team`, and `mancode context` commands with their required revision and session arguments.",
|
|
328
333
|
"- For a mode entry, request the matching Context Pack purpose: `plan`, `implement`, `review`, `verify`, or `handoff`.",
|
|
329
|
-
"- Perform mutations only through `mancode workflow`, `mancode team`, and `mancode context` commands with their required revision and session arguments.",
|
|
330
334
|
"- Do not persist task, mode, or session state in this adapter file or any legacy state file.",
|
|
331
335
|
`- ${modeEntry}`,
|
|
332
336
|
`- No approved session or prompt hook is assumed. After a real-host spike is recorded for ${platform}, a verified host may provide MANCODE_HOST_SESSION_KEY; otherwise mutations require an explicit \`--session\`.`
|
|
@@ -594,4 +598,4 @@ export {
|
|
|
594
598
|
removeV3Adapter,
|
|
595
599
|
renderV3Bootstrap
|
|
596
600
|
};
|
|
597
|
-
//# sourceMappingURL=chunk-
|
|
601
|
+
//# sourceMappingURL=chunk-WAH4E2N2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/installers/v3-adapter.ts","../src/installers/managed-block.ts"],"sourcesContent":["import {\n lstat,\n mkdir,\n readFile,\n rename,\n rm,\n writeFile,\n} from 'node:fs/promises';\nimport path from 'node:path';\nimport {\n hasManagedBlock,\n removeManagedBlock,\n replaceManagedBlock,\n} from './managed-block.js';\nimport type { PlatformName } from './registry.js';\n\n/**\n * This is the schema of the generated bootstrap, not a product version. The\n * schema manifest records the expected renderer schema while physical status\n * is derived from the managed files below.\n */\nexport const V3_ADAPTER_VERSION = '3';\n\nexport const V3_ADAPTER_MANAGED_MARKER =\n '<!-- Managed by mancode:v3-adapter. Do not edit this marker. -->';\n\nconst V3_CODEX_START_MARKER = '<!-- mancode:v3:codex:start -->';\nconst V3_CODEX_END_MARKER = '<!-- mancode:v3:codex:end -->';\nconst V3_ZCODE_START_MARKER = '<!-- mancode:v3:zcode:start -->';\nconst V3_ZCODE_END_MARKER = '<!-- mancode:v3:zcode:end -->';\nconst V3_COPILOT_START_MARKER = '<!-- mancode:v3:copilot:start -->';\nconst V3_COPILOT_END_MARKER = '<!-- mancode:v3:copilot:end -->';\nconst RETRIABLE_ADAPTER_READ_CODES = new Set(['EACCES', 'EBUSY', 'EPERM']);\nconst ADAPTER_READ_MAX_ATTEMPTS = 4;\nconst ADAPTER_READ_RETRY_DELAY_MS = 25;\n\nexport interface V3AdapterCapabilities {\n nativeModeEntry: boolean;\n sessionHook: false;\n promptHook: false;\n sessionIdentity: 'explicit-required';\n}\n\nexport interface V3PlatformAdapterStatus {\n version: string;\n installed: boolean;\n ready: boolean;\n target: string;\n detail: string;\n capabilities: V3AdapterCapabilities;\n}\n\n/**\n * A physical file touched by the V3 bootstrap renderer. Codex and ZCode\n * deliberately share the AGENTS target, so activation journals these files\n * rather than individual platform installs.\n */\nexport type V3AdapterFileTarget =\n | 'claude-skill'\n | 'cursor-rule'\n | 'agents'\n | 'copilot-instructions';\n\nexport interface V3AdapterFilePlan {\n target: V3AdapterFileTarget;\n beforeContent: string | null;\n targetContent: string;\n}\n\nexport interface V3StagedAdapter {\n platform: PlatformName;\n /** The corresponding live target, relative to the project root. */\n target: string;\n /** The generated candidate, kept under V3 staging rather than the live target. */\n stagingTarget: string;\n}\n\nconst V3_ADAPTER_FILE_TARGETS: V3AdapterFileTarget[] = [\n 'claude-skill',\n 'cursor-rule',\n 'agents',\n 'copilot-instructions',\n];\n\n/**\n * Calculates exact file replacements without publishing them. This lets a\n * migration journal bind the combined AGENTS.md result before its first\n * visible write and preserves all user-authored content outside our blocks.\n */\nexport async function planV3AdapterFiles(\n projectRoot: string,\n): Promise<V3AdapterFilePlan[]> {\n const root = path.resolve(projectRoot);\n const existing = new Map<V3AdapterFileTarget, string | null>();\n for (const target of V3_ADAPTER_FILE_TARGETS) {\n existing.set(target, await readAdapterTarget(root, target));\n }\n const agents = existing.get('agents') ?? '';\n const nextAgents = replaceManagedV3BlockText(\n replaceManagedV3BlockText(\n agents,\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n renderV3Bootstrap('codex'),\n ),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n renderV3Bootstrap('zcode'),\n );\n const plans: V3AdapterFilePlan[] = [\n managedFilePlan(\n 'claude-skill',\n existing.get('claude-skill') ?? null,\n renderClaudeSkill(renderV3Bootstrap('claude-code')),\n ),\n managedFilePlan(\n 'cursor-rule',\n existing.get('cursor-rule') ?? null,\n renderCursorRule(renderV3Bootstrap('cursor')),\n ),\n {\n target: 'agents',\n beforeContent: existing.get('agents') ?? null,\n targetContent: nextAgents,\n },\n {\n target: 'copilot-instructions',\n beforeContent: existing.get('copilot-instructions') ?? null,\n targetContent: replaceManagedV3BlockText(\n existing.get('copilot-instructions') ?? '',\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n renderV3Bootstrap('copilot'),\n ),\n },\n ];\n return plans;\n}\n\n/** Publishes one precomputed fixed-target replacement with atomic rename. */\nexport async function applyV3AdapterFilePlan(\n projectRoot: string,\n plan: V3AdapterFilePlan,\n): Promise<void> {\n const root = path.resolve(projectRoot);\n if (!V3_ADAPTER_FILE_TARGETS.includes(plan.target)) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_INVALID');\n }\n if (typeof plan.targetContent !== 'string' || !plan.targetContent.trim()) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_INVALID');\n }\n const target = v3AdapterTargetPath(root, plan.target);\n await mkdir(path.dirname(target), { recursive: true });\n await atomicWrite(target, plan.targetContent);\n}\n\n/**\n * Renders a complete adapter candidate under V3 staging. Shadow integration\n * may inspect this exact replacement without changing a live managed file.\n */\nexport async function stageV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3StagedAdapter> {\n const root = path.resolve(projectRoot);\n const target = targetFor(platform);\n const content = await renderV3AdapterCandidate(root, platform);\n const stagingTarget = path.join(\n '.mancode',\n 'staging',\n 'adapters',\n 'v3',\n platform,\n target,\n );\n const destination = path.join(root, stagingTarget);\n await mkdir(path.dirname(destination), { recursive: true });\n await atomicWrite(destination, content);\n return { platform, target, stagingTarget };\n}\n\nexport function v3AdapterTargetPath(\n projectRoot: string,\n target: V3AdapterFileTarget,\n): string {\n const root = path.resolve(projectRoot);\n switch (target) {\n case 'claude-skill':\n return path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md');\n case 'cursor-rule':\n return path.join(root, '.cursor', 'rules', 'mancode-v3.mdc');\n case 'agents':\n return path.join(root, 'AGENTS.md');\n case 'copilot-instructions':\n return path.join(root, '.github', 'copilot-instructions.md');\n }\n}\n\n/**\n * Writes only stable V3 bootstrap instructions. In particular, this never\n * creates legacy authority or copies task state into an adapter file.\n */\nexport async function installV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3PlatformAdapterStatus> {\n const root = path.resolve(projectRoot);\n const content = renderV3Bootstrap(platform);\n switch (platform) {\n case 'claude-code':\n await writeManagedFile(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n renderClaudeSkill(content),\n );\n break;\n case 'cursor':\n await writeManagedFile(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n renderCursorRule(content),\n );\n break;\n case 'codex':\n await replaceManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n content,\n );\n break;\n case 'copilot':\n await replaceManagedV3Block(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n content,\n );\n break;\n case 'zcode':\n await replaceManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n content,\n );\n break;\n }\n return inspectV3Adapter(root, platform);\n}\n\n/** Physical adapter status intentionally does not infer hook approval. */\nexport async function inspectV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3PlatformAdapterStatus> {\n const root = path.resolve(projectRoot);\n const target = targetFor(platform);\n const installed = await adapterTargetPresent(root, platform);\n return {\n version: V3_ADAPTER_VERSION,\n installed,\n ready: installed,\n target,\n detail: installed\n ? 'V3 bootstrap is present; session identity is explicit-required.'\n : 'V3 bootstrap is not installed.',\n capabilities: capabilitiesFor(platform),\n };\n}\n\n/** Actual on-disk inventory for compatibility gates; never trust manifest echo. */\nexport async function inspectV3AdapterVersions(\n projectRoot: string,\n): Promise<Record<PlatformName, string>> {\n const platforms: PlatformName[] = [\n 'claude-code',\n 'codex',\n 'cursor',\n 'copilot',\n 'zcode',\n ];\n const entries = await Promise.all(\n platforms.map(async (platform) => {\n const status = await inspectV3Adapter(projectRoot, platform);\n return [platform, status.ready ? status.version : 'missing'] as const;\n }),\n );\n return Object.fromEntries(entries) as Record<PlatformName, string>;\n}\n\n/** Removes only the V3 bootstrap owned by this renderer, never V3 authority. */\nexport async function removeV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<void> {\n const root = path.resolve(projectRoot);\n switch (platform) {\n case 'claude-code':\n await removeManagedFile(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n );\n return;\n case 'cursor':\n await removeManagedFile(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n );\n return;\n case 'codex':\n await removeManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n );\n return;\n case 'copilot':\n await removeManagedV3Block(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n );\n return;\n case 'zcode':\n await removeManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n );\n }\n}\n\nexport function renderV3Bootstrap(platform: PlatformName): string {\n const platformLabel = platformLabelFor(platform);\n const modeEntry = capabilitiesFor(platform).nativeModeEntry\n ? 'Use the platform mode entry only as a shortcut; resolve a Context Pack first.'\n : 'This platform has no native V3 mode entry; use the CLI commands explicitly.';\n return [\n '# mancode V3 bootstrap',\n '',\n V3_ADAPTER_MANAGED_MARKER,\n '',\n `- Platform: ${platformLabel}. This file is a non-authoritative bootstrap.`,\n '- Locate the project root before running mancode commands.',\n '- First run `mancode status --json` from the project root.',\n '- If status reports `currentSession`, reuse it. `currentTask: null` and `MANCODE_TASK_REQUIRED` do not make a session stale.',\n `- Only when status has no \\`currentSession\\`, create one once with \\`mancode context session new --client ${platform}\\`. Pass its returned \\`sessionId\\` as \\`--session <id>\\` to later commands; an \\`export\\` inside one command tool does not persist to later command tools.`,\n '- If no current task and no task is explicitly supplied, report \"no task bound\" and stop. Do not probe workflow subcommands to work around `MANCODE_TASK_REQUIRED`.',\n '- Bootstrap is read-only: do not run `mancode init`, `mancode migrate`, `mancode workflow`, or inspect mancode installed package/source.',\n '- With an existing or supplied task, read its Context Pack with `mancode context show --purpose orient --session <id>`; for anonymous diagnosis, include an explicit `--task <namespace:id>`.',\n '- After an operator explicitly requests task work, perform mutations only through `mancode workflow`, `mancode team`, and `mancode context` commands with their required revision and session arguments.',\n '- For a mode entry, request the matching Context Pack purpose: `plan`, `implement`, `review`, `verify`, or `handoff`.',\n '- Do not persist task, mode, or session state in this adapter file or any legacy state file.',\n `- ${modeEntry}`,\n `- No approved session or prompt hook is assumed. After a real-host spike is recorded for ${platform}, a verified host may provide MANCODE_HOST_SESSION_KEY; otherwise mutations require an explicit \\`--session\\`.`,\n ].join('\\n');\n}\n\nasync function renderV3AdapterCandidate(\n root: string,\n platform: PlatformName,\n): Promise<string> {\n switch (platform) {\n case 'claude-code': {\n const existing = await readAdapterTarget(root, 'claude-skill');\n return managedFilePlan(\n 'claude-skill',\n existing,\n renderClaudeSkill(renderV3Bootstrap(platform)),\n ).targetContent;\n }\n case 'cursor': {\n const existing = await readAdapterTarget(root, 'cursor-rule');\n return managedFilePlan(\n 'cursor-rule',\n existing,\n renderCursorRule(renderV3Bootstrap(platform)),\n ).targetContent;\n }\n case 'codex': {\n const existing = (await readAdapterTarget(root, 'agents')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n case 'copilot': {\n const existing =\n (await readAdapterTarget(root, 'copilot-instructions')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n case 'zcode': {\n const existing = (await readAdapterTarget(root, 'agents')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n }\n}\n\nfunction renderClaudeSkill(content: string): string {\n return [\n '---',\n 'name: mancode-v3',\n 'description: \"Stable bootstrap for mancode V3 context and workflow commands.\"',\n '---',\n '',\n content,\n '',\n ].join('\\n');\n}\n\nfunction renderCursorRule(content: string): string {\n return [\n '---',\n 'description: \"Stable bootstrap for mancode V3 context and workflow commands.\"',\n 'alwaysApply: true',\n 'globs: \"**/*\"',\n '---',\n '',\n content,\n '',\n ].join('\\n');\n}\n\nasync function adapterTargetPresent(\n root: string,\n platform: PlatformName,\n): Promise<boolean> {\n switch (platform) {\n case 'claude-code':\n return managedFilePresent(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n );\n case 'cursor':\n return managedFilePresent(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n );\n case 'codex':\n return managedBlockPresent(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n );\n case 'copilot':\n return managedBlockPresent(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n );\n case 'zcode':\n return managedBlockPresent(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n );\n }\n}\n\nasync function writeManagedFile(\n filePath: string,\n content: string,\n): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing !== null && !existing.includes(V3_ADAPTER_MANAGED_MARKER)) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_USER_AUTHORED');\n }\n await mkdir(path.dirname(filePath), { recursive: true });\n await atomicWrite(filePath, content);\n}\n\nasync function removeManagedFile(filePath: string): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing?.includes(V3_ADAPTER_MANAGED_MARKER)) {\n await rm(filePath, { force: true });\n }\n}\n\nasync function replaceManagedV3Block(\n filePath: string,\n startMarker: string,\n endMarker: string,\n content: string,\n): Promise<void> {\n const existing = (await readTextIfExists(filePath)) ?? '';\n const block = [startMarker, content, endMarker].join('\\n');\n await mkdir(path.dirname(filePath), { recursive: true });\n await atomicWrite(\n filePath,\n replaceManagedBlock(existing, block, startMarker, endMarker),\n );\n}\n\nfunction replaceManagedV3BlockText(\n existing: string,\n startMarker: string,\n endMarker: string,\n content: string,\n): string {\n return replaceManagedBlock(\n existing,\n [startMarker, content, endMarker].join('\\n'),\n startMarker,\n endMarker,\n );\n}\n\nfunction managedFilePlan(\n target: V3AdapterFileTarget,\n beforeContent: string | null,\n targetContent: string,\n): V3AdapterFilePlan {\n if (\n beforeContent !== null &&\n !beforeContent.includes(V3_ADAPTER_MANAGED_MARKER)\n ) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_USER_AUTHORED');\n }\n return { target, beforeContent, targetContent };\n}\n\nasync function readAdapterTarget(\n root: string,\n target: V3AdapterFileTarget,\n): Promise<string | null> {\n const filePath = v3AdapterTargetPath(root, target);\n try {\n const entry = await lstat(filePath);\n if (!entry.isFile() || entry.isSymbolicLink()) {\n throw new Error('MANCODE_ARTIFACT_PATH_UNSAFE');\n }\n } catch (error) {\n if (isNodeError(error) && error.code === 'ENOENT') return null;\n throw error;\n }\n return readFile(filePath, 'utf8');\n}\n\nasync function removeManagedV3Block(\n filePath: string,\n startMarker: string,\n endMarker: string,\n): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing === null || !hasManagedBlock(existing, startMarker, endMarker)) {\n return;\n }\n const cleaned = removeManagedBlock(existing, startMarker, endMarker);\n if (cleaned.trim()) {\n await atomicWrite(filePath, `${cleaned.trimEnd()}\\n`);\n } else {\n await rm(filePath, { force: true });\n }\n}\n\nasync function managedFilePresent(filePath: string): Promise<boolean> {\n const content = await readTextIfExists(filePath);\n return content?.includes(V3_ADAPTER_MANAGED_MARKER) ?? false;\n}\n\nasync function managedBlockPresent(\n filePath: string,\n startMarker: string,\n endMarker: string,\n): Promise<boolean> {\n const content = await readTextIfExists(filePath);\n return content !== null && hasManagedBlock(content, startMarker, endMarker);\n}\n\nasync function readTextIfExists(filePath: string): Promise<string | null> {\n for (let attempt = 1; attempt <= ADAPTER_READ_MAX_ATTEMPTS; attempt += 1) {\n try {\n return await readFile(filePath, 'utf8');\n } catch (error) {\n if (isNodeError(error) && error.code === 'ENOENT') return null;\n if (\n !isRetriableAdapterReadError(error) ||\n attempt === ADAPTER_READ_MAX_ATTEMPTS\n ) {\n throw error;\n }\n await delay(ADAPTER_READ_RETRY_DELAY_MS * attempt);\n }\n }\n throw new Error('MANCODE_V3_ADAPTER_READ_RETRY_EXHAUSTED');\n}\n\nasync function atomicWrite(filePath: string, content: string): Promise<void> {\n const temporary = path.join(\n path.dirname(filePath),\n `.${path.basename(filePath)}.${process.pid}.${Date.now()}.tmp`,\n );\n try {\n await writeFile(temporary, content, { encoding: 'utf8', flag: 'wx' });\n await rename(temporary, filePath);\n } finally {\n await rm(temporary, { force: true }).catch(() => undefined);\n }\n}\n\nfunction targetFor(platform: PlatformName): string {\n switch (platform) {\n case 'claude-code':\n return '.claude/skills/mancode-v3/SKILL.md';\n case 'cursor':\n return '.cursor/rules/mancode-v3.mdc';\n case 'codex':\n case 'zcode':\n return 'AGENTS.md';\n case 'copilot':\n return '.github/copilot-instructions.md';\n }\n}\n\nfunction platformLabelFor(platform: PlatformName): string {\n switch (platform) {\n case 'claude-code':\n return 'Claude Code';\n case 'cursor':\n return 'Cursor';\n case 'codex':\n return 'Codex';\n case 'copilot':\n return 'GitHub Copilot';\n case 'zcode':\n return 'ZCode';\n }\n}\n\nfunction capabilitiesFor(platform: PlatformName): V3AdapterCapabilities {\n return {\n nativeModeEntry: platform === 'claude-code' || platform === 'cursor',\n sessionHook: false,\n promptHook: false,\n sessionIdentity: 'explicit-required',\n };\n}\n\nfunction isNodeError(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error;\n}\n\nfunction isRetriableAdapterReadError(error: unknown): boolean {\n return (\n isNodeError(error) && RETRIABLE_ADAPTER_READ_CODES.has(error.code ?? '')\n );\n}\n\nasync function delay(milliseconds: number): Promise<void> {\n await new Promise<void>((resolve) => {\n setTimeout(resolve, milliseconds);\n });\n}\n","export const DEFAULT_MANCODE_START_MARKER = '<!-- mancode:start -->';\nexport const DEFAULT_MANCODE_END_MARKER = '<!-- mancode:end -->';\n\nexport function removeManagedBlock(\n existing: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): string {\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n\n if (start === null && end === null) return existing;\n if (start === null || end === null) return existing;\n if (end.start < start.start) return existing;\n\n const before = existing.slice(0, start.start);\n const after = existing.slice(end.end);\n const merged = `${before}${after}`;\n return cleanUpOrphanedNewlines(merged);\n}\n\nexport function hasManagedBlock(\n existing: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): boolean {\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n return start !== null && end !== null && end.start > start.start;\n}\n\nfunction cleanUpOrphanedNewlines(content: string): string {\n const trimmed = content.replace(/\\n{3,}/gu, '\\n\\n').replace(/\\n+$/u, '\\n');\n return trimmed || '';\n}\n\nexport function replaceManagedBlock(\n existing: string,\n block: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): string {\n const normalizedBlock = normalizeManagedBlock(block, startMarker, endMarker);\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n\n if ((start === null) !== (end === null)) {\n throw new Error('managed block is malformed: missing start or end marker');\n }\n\n if (start === null && end === null) {\n const trimmedExisting = trimTrailingNewlines(existing);\n if (!trimmedExisting) return `${normalizedBlock}\\n`;\n return `${trimmedExisting}\\n\\n${normalizedBlock}\\n`;\n }\n\n if (!start || !end) {\n throw new Error('managed block is malformed: missing start or end marker');\n }\n\n if (end.start < start.start) {\n throw new Error('managed block is malformed: end marker precedes start');\n }\n\n return `${existing.slice(0, start.start)}${normalizedBlock}${existing.slice(\n end.end,\n )}`;\n}\n\nfunction normalizeManagedBlock(\n block: string,\n startMarker: string,\n endMarker: string,\n): string {\n const trimmedBlock = block.trim();\n const hasStart = trimmedBlock.startsWith(startMarker);\n const hasEnd = trimmedBlock.endsWith(endMarker);\n\n if (hasStart && hasEnd) return trimmedBlock;\n if (hasStart || hasEnd) {\n throw new Error('managed block content includes only one marker');\n }\n\n return `${startMarker}\\n${trimmedBlock}\\n${endMarker}`;\n}\n\nfunction trimTrailingNewlines(value: string): string {\n return value.replace(/\\n+$/u, '');\n}\n\nfunction findMarkerLine(\n content: string,\n marker: string,\n): { start: number; end: number } | null {\n let offset = 0;\n let inFence: { char: '`' | '~'; length: number } | null = null;\n\n for (const lineWithBreak of content.matchAll(/[^\\n]*(?:\\n|$)/gu)) {\n const rawLine = lineWithBreak[0];\n if (!rawLine) break;\n\n const line = rawLine.replace(/\\n$/u, '').replace(/\\r$/u, '');\n const fence = line.match(/^(`{3,}|~{3,})/u)?.[1];\n if (fence) {\n const char = fence[0] as '`' | '~';\n if (!inFence) {\n inFence = { char, length: fence.length };\n } else if (inFence.char === char && fence.length >= inFence.length) {\n inFence = null;\n }\n } else if (!inFence && line === marker) {\n return {\n start: offset,\n end: offset + marker.length,\n };\n }\n\n offset += rawLine.length;\n }\n\n return null;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;;;ACRV,IAAM,+BAA+B;AACr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ACxD,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;AAEA,SAAS,gBAAgB,UAA+C;AACtE,SAAO;AAAA,IACL,iBAAiB,aAAa,iBAAiB,aAAa;AAAA,IAC5D,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,iBAAiB;AAAA,EACnB;AACF;AAEA,SAAS,YAAY,OAAgD;AACnE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AAClE;AAEA,SAAS,4BAA4B,OAAyB;AAC5D,SACE,YAAY,KAAK,KAAK,6BAA6B,IAAI,MAAM,QAAQ,EAAE;AAE3E;AAEA,eAAe,MAAM,cAAqC;AACxD,QAAM,IAAI,QAAc,CAAC,YAAY;AACnC,eAAW,SAAS,YAAY;AAAA,EAClC,CAAC;AACH;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
replaceManagedBlock,
|
|
121
121
|
stageV3Adapter,
|
|
122
122
|
v3AdapterTargetPath
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-WAH4E2N2.js";
|
|
124
124
|
|
|
125
125
|
// src/cli.ts
|
|
126
126
|
import { program } from "commander";
|
|
@@ -11499,7 +11499,7 @@ async function activateLegacyMigration(input) {
|
|
|
11499
11499
|
for (const action of payload.actions.filter(
|
|
11500
11500
|
(action2) => action2.kind === "v3_adapter_file"
|
|
11501
11501
|
)) {
|
|
11502
|
-
const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-
|
|
11502
|
+
const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-HA7VR5VL.js");
|
|
11503
11503
|
await applyV3AdapterFilePlan2(root, action);
|
|
11504
11504
|
}
|
|
11505
11505
|
journal = await completeActivationStep(
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
renderV3Bootstrap,
|
|
11
11
|
stageV3Adapter,
|
|
12
12
|
v3AdapterTargetPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WAH4E2N2.js";
|
|
14
14
|
export {
|
|
15
15
|
V3_ADAPTER_MANAGED_MARKER,
|
|
16
16
|
V3_ADAPTER_VERSION,
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
stageV3Adapter,
|
|
25
25
|
v3AdapterTargetPath
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=v3-adapter-
|
|
27
|
+
//# sourceMappingURL=v3-adapter-HA7VR5VL.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mancode",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "AI coding agent workflow harness. Five modes from practice to playoffs: stop over-engineering, reuse project context, and add multi-agent code review.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/installers/v3-adapter.ts","../src/installers/managed-block.ts"],"sourcesContent":["import {\n lstat,\n mkdir,\n readFile,\n rename,\n rm,\n writeFile,\n} from 'node:fs/promises';\nimport path from 'node:path';\nimport {\n hasManagedBlock,\n removeManagedBlock,\n replaceManagedBlock,\n} from './managed-block.js';\nimport type { PlatformName } from './registry.js';\n\n/**\n * This is the schema of the generated bootstrap, not a product version. The\n * schema manifest records the expected renderer schema while physical status\n * is derived from the managed files below.\n */\nexport const V3_ADAPTER_VERSION = '3';\n\nexport const V3_ADAPTER_MANAGED_MARKER =\n '<!-- Managed by mancode:v3-adapter. Do not edit this marker. -->';\n\nconst V3_CODEX_START_MARKER = '<!-- mancode:v3:codex:start -->';\nconst V3_CODEX_END_MARKER = '<!-- mancode:v3:codex:end -->';\nconst V3_ZCODE_START_MARKER = '<!-- mancode:v3:zcode:start -->';\nconst V3_ZCODE_END_MARKER = '<!-- mancode:v3:zcode:end -->';\nconst V3_COPILOT_START_MARKER = '<!-- mancode:v3:copilot:start -->';\nconst V3_COPILOT_END_MARKER = '<!-- mancode:v3:copilot:end -->';\nconst RETRIABLE_ADAPTER_READ_CODES = new Set(['EACCES', 'EBUSY', 'EPERM']);\nconst ADAPTER_READ_MAX_ATTEMPTS = 4;\nconst ADAPTER_READ_RETRY_DELAY_MS = 25;\n\nexport interface V3AdapterCapabilities {\n nativeModeEntry: boolean;\n sessionHook: false;\n promptHook: false;\n sessionIdentity: 'explicit-required';\n}\n\nexport interface V3PlatformAdapterStatus {\n version: string;\n installed: boolean;\n ready: boolean;\n target: string;\n detail: string;\n capabilities: V3AdapterCapabilities;\n}\n\n/**\n * A physical file touched by the V3 bootstrap renderer. Codex and ZCode\n * deliberately share the AGENTS target, so activation journals these files\n * rather than individual platform installs.\n */\nexport type V3AdapterFileTarget =\n | 'claude-skill'\n | 'cursor-rule'\n | 'agents'\n | 'copilot-instructions';\n\nexport interface V3AdapterFilePlan {\n target: V3AdapterFileTarget;\n beforeContent: string | null;\n targetContent: string;\n}\n\nexport interface V3StagedAdapter {\n platform: PlatformName;\n /** The corresponding live target, relative to the project root. */\n target: string;\n /** The generated candidate, kept under V3 staging rather than the live target. */\n stagingTarget: string;\n}\n\nconst V3_ADAPTER_FILE_TARGETS: V3AdapterFileTarget[] = [\n 'claude-skill',\n 'cursor-rule',\n 'agents',\n 'copilot-instructions',\n];\n\n/**\n * Calculates exact file replacements without publishing them. This lets a\n * migration journal bind the combined AGENTS.md result before its first\n * visible write and preserves all user-authored content outside our blocks.\n */\nexport async function planV3AdapterFiles(\n projectRoot: string,\n): Promise<V3AdapterFilePlan[]> {\n const root = path.resolve(projectRoot);\n const existing = new Map<V3AdapterFileTarget, string | null>();\n for (const target of V3_ADAPTER_FILE_TARGETS) {\n existing.set(target, await readAdapterTarget(root, target));\n }\n const agents = existing.get('agents') ?? '';\n const nextAgents = replaceManagedV3BlockText(\n replaceManagedV3BlockText(\n agents,\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n renderV3Bootstrap('codex'),\n ),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n renderV3Bootstrap('zcode'),\n );\n const plans: V3AdapterFilePlan[] = [\n managedFilePlan(\n 'claude-skill',\n existing.get('claude-skill') ?? null,\n renderClaudeSkill(renderV3Bootstrap('claude-code')),\n ),\n managedFilePlan(\n 'cursor-rule',\n existing.get('cursor-rule') ?? null,\n renderCursorRule(renderV3Bootstrap('cursor')),\n ),\n {\n target: 'agents',\n beforeContent: existing.get('agents') ?? null,\n targetContent: nextAgents,\n },\n {\n target: 'copilot-instructions',\n beforeContent: existing.get('copilot-instructions') ?? null,\n targetContent: replaceManagedV3BlockText(\n existing.get('copilot-instructions') ?? '',\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n renderV3Bootstrap('copilot'),\n ),\n },\n ];\n return plans;\n}\n\n/** Publishes one precomputed fixed-target replacement with atomic rename. */\nexport async function applyV3AdapterFilePlan(\n projectRoot: string,\n plan: V3AdapterFilePlan,\n): Promise<void> {\n const root = path.resolve(projectRoot);\n if (!V3_ADAPTER_FILE_TARGETS.includes(plan.target)) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_INVALID');\n }\n if (typeof plan.targetContent !== 'string' || !plan.targetContent.trim()) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_INVALID');\n }\n const target = v3AdapterTargetPath(root, plan.target);\n await mkdir(path.dirname(target), { recursive: true });\n await atomicWrite(target, plan.targetContent);\n}\n\n/**\n * Renders a complete adapter candidate under V3 staging. Shadow integration\n * may inspect this exact replacement without changing a live managed file.\n */\nexport async function stageV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3StagedAdapter> {\n const root = path.resolve(projectRoot);\n const target = targetFor(platform);\n const content = await renderV3AdapterCandidate(root, platform);\n const stagingTarget = path.join(\n '.mancode',\n 'staging',\n 'adapters',\n 'v3',\n platform,\n target,\n );\n const destination = path.join(root, stagingTarget);\n await mkdir(path.dirname(destination), { recursive: true });\n await atomicWrite(destination, content);\n return { platform, target, stagingTarget };\n}\n\nexport function v3AdapterTargetPath(\n projectRoot: string,\n target: V3AdapterFileTarget,\n): string {\n const root = path.resolve(projectRoot);\n switch (target) {\n case 'claude-skill':\n return path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md');\n case 'cursor-rule':\n return path.join(root, '.cursor', 'rules', 'mancode-v3.mdc');\n case 'agents':\n return path.join(root, 'AGENTS.md');\n case 'copilot-instructions':\n return path.join(root, '.github', 'copilot-instructions.md');\n }\n}\n\n/**\n * Writes only stable V3 bootstrap instructions. In particular, this never\n * creates legacy authority or copies task state into an adapter file.\n */\nexport async function installV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3PlatformAdapterStatus> {\n const root = path.resolve(projectRoot);\n const content = renderV3Bootstrap(platform);\n switch (platform) {\n case 'claude-code':\n await writeManagedFile(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n renderClaudeSkill(content),\n );\n break;\n case 'cursor':\n await writeManagedFile(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n renderCursorRule(content),\n );\n break;\n case 'codex':\n await replaceManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n content,\n );\n break;\n case 'copilot':\n await replaceManagedV3Block(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n content,\n );\n break;\n case 'zcode':\n await replaceManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n content,\n );\n break;\n }\n return inspectV3Adapter(root, platform);\n}\n\n/** Physical adapter status intentionally does not infer hook approval. */\nexport async function inspectV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<V3PlatformAdapterStatus> {\n const root = path.resolve(projectRoot);\n const target = targetFor(platform);\n const installed = await adapterTargetPresent(root, platform);\n return {\n version: V3_ADAPTER_VERSION,\n installed,\n ready: installed,\n target,\n detail: installed\n ? 'V3 bootstrap is present; session identity is explicit-required.'\n : 'V3 bootstrap is not installed.',\n capabilities: capabilitiesFor(platform),\n };\n}\n\n/** Actual on-disk inventory for compatibility gates; never trust manifest echo. */\nexport async function inspectV3AdapterVersions(\n projectRoot: string,\n): Promise<Record<PlatformName, string>> {\n const platforms: PlatformName[] = [\n 'claude-code',\n 'codex',\n 'cursor',\n 'copilot',\n 'zcode',\n ];\n const entries = await Promise.all(\n platforms.map(async (platform) => {\n const status = await inspectV3Adapter(projectRoot, platform);\n return [platform, status.ready ? status.version : 'missing'] as const;\n }),\n );\n return Object.fromEntries(entries) as Record<PlatformName, string>;\n}\n\n/** Removes only the V3 bootstrap owned by this renderer, never V3 authority. */\nexport async function removeV3Adapter(\n projectRoot: string,\n platform: PlatformName,\n): Promise<void> {\n const root = path.resolve(projectRoot);\n switch (platform) {\n case 'claude-code':\n await removeManagedFile(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n );\n return;\n case 'cursor':\n await removeManagedFile(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n );\n return;\n case 'codex':\n await removeManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n );\n return;\n case 'copilot':\n await removeManagedV3Block(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n );\n return;\n case 'zcode':\n await removeManagedV3Block(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n );\n }\n}\n\nexport function renderV3Bootstrap(platform: PlatformName): string {\n const platformLabel = platformLabelFor(platform);\n const modeEntry = capabilitiesFor(platform).nativeModeEntry\n ? 'Use the platform mode entry only as a shortcut; resolve a Context Pack first.'\n : 'This platform has no native V3 mode entry; use the CLI commands explicitly.';\n return [\n '# mancode V3 bootstrap',\n '',\n V3_ADAPTER_MANAGED_MARKER,\n '',\n `- Platform: ${platformLabel}. This file is a non-authoritative bootstrap.`,\n '- Locate the project root before running mancode commands.',\n `- Create or supply an explicit session: \\`mancode context session new --client ${platform}\\` or \\`--session <id>\\`.`,\n '- Read current task context with `mancode context show --purpose orient --session <id>`; for anonymous diagnosis, include an explicit `--task <namespace:id>`.',\n '- For a mode entry, request the matching Context Pack purpose: `plan`, `implement`, `review`, `verify`, or `handoff`.',\n '- Perform mutations only through `mancode workflow`, `mancode team`, and `mancode context` commands with their required revision and session arguments.',\n '- Do not persist task, mode, or session state in this adapter file or any legacy state file.',\n `- ${modeEntry}`,\n `- No approved session or prompt hook is assumed. After a real-host spike is recorded for ${platform}, a verified host may provide MANCODE_HOST_SESSION_KEY; otherwise mutations require an explicit \\`--session\\`.`,\n ].join('\\n');\n}\n\nasync function renderV3AdapterCandidate(\n root: string,\n platform: PlatformName,\n): Promise<string> {\n switch (platform) {\n case 'claude-code': {\n const existing = await readAdapterTarget(root, 'claude-skill');\n return managedFilePlan(\n 'claude-skill',\n existing,\n renderClaudeSkill(renderV3Bootstrap(platform)),\n ).targetContent;\n }\n case 'cursor': {\n const existing = await readAdapterTarget(root, 'cursor-rule');\n return managedFilePlan(\n 'cursor-rule',\n existing,\n renderCursorRule(renderV3Bootstrap(platform)),\n ).targetContent;\n }\n case 'codex': {\n const existing = (await readAdapterTarget(root, 'agents')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n case 'copilot': {\n const existing =\n (await readAdapterTarget(root, 'copilot-instructions')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n case 'zcode': {\n const existing = (await readAdapterTarget(root, 'agents')) ?? '';\n return replaceManagedV3BlockText(\n existing,\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n renderV3Bootstrap(platform),\n );\n }\n }\n}\n\nfunction renderClaudeSkill(content: string): string {\n return [\n '---',\n 'name: mancode-v3',\n 'description: \"Stable bootstrap for mancode V3 context and workflow commands.\"',\n '---',\n '',\n content,\n '',\n ].join('\\n');\n}\n\nfunction renderCursorRule(content: string): string {\n return [\n '---',\n 'description: \"Stable bootstrap for mancode V3 context and workflow commands.\"',\n 'alwaysApply: true',\n 'globs: \"**/*\"',\n '---',\n '',\n content,\n '',\n ].join('\\n');\n}\n\nasync function adapterTargetPresent(\n root: string,\n platform: PlatformName,\n): Promise<boolean> {\n switch (platform) {\n case 'claude-code':\n return managedFilePresent(\n path.join(root, '.claude', 'skills', 'mancode-v3', 'SKILL.md'),\n );\n case 'cursor':\n return managedFilePresent(\n path.join(root, '.cursor', 'rules', 'mancode-v3.mdc'),\n );\n case 'codex':\n return managedBlockPresent(\n path.join(root, 'AGENTS.md'),\n V3_CODEX_START_MARKER,\n V3_CODEX_END_MARKER,\n );\n case 'copilot':\n return managedBlockPresent(\n path.join(root, '.github', 'copilot-instructions.md'),\n V3_COPILOT_START_MARKER,\n V3_COPILOT_END_MARKER,\n );\n case 'zcode':\n return managedBlockPresent(\n path.join(root, 'AGENTS.md'),\n V3_ZCODE_START_MARKER,\n V3_ZCODE_END_MARKER,\n );\n }\n}\n\nasync function writeManagedFile(\n filePath: string,\n content: string,\n): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing !== null && !existing.includes(V3_ADAPTER_MANAGED_MARKER)) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_USER_AUTHORED');\n }\n await mkdir(path.dirname(filePath), { recursive: true });\n await atomicWrite(filePath, content);\n}\n\nasync function removeManagedFile(filePath: string): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing?.includes(V3_ADAPTER_MANAGED_MARKER)) {\n await rm(filePath, { force: true });\n }\n}\n\nasync function replaceManagedV3Block(\n filePath: string,\n startMarker: string,\n endMarker: string,\n content: string,\n): Promise<void> {\n const existing = (await readTextIfExists(filePath)) ?? '';\n const block = [startMarker, content, endMarker].join('\\n');\n await mkdir(path.dirname(filePath), { recursive: true });\n await atomicWrite(\n filePath,\n replaceManagedBlock(existing, block, startMarker, endMarker),\n );\n}\n\nfunction replaceManagedV3BlockText(\n existing: string,\n startMarker: string,\n endMarker: string,\n content: string,\n): string {\n return replaceManagedBlock(\n existing,\n [startMarker, content, endMarker].join('\\n'),\n startMarker,\n endMarker,\n );\n}\n\nfunction managedFilePlan(\n target: V3AdapterFileTarget,\n beforeContent: string | null,\n targetContent: string,\n): V3AdapterFilePlan {\n if (\n beforeContent !== null &&\n !beforeContent.includes(V3_ADAPTER_MANAGED_MARKER)\n ) {\n throw new Error('MANCODE_V3_ADAPTER_TARGET_USER_AUTHORED');\n }\n return { target, beforeContent, targetContent };\n}\n\nasync function readAdapterTarget(\n root: string,\n target: V3AdapterFileTarget,\n): Promise<string | null> {\n const filePath = v3AdapterTargetPath(root, target);\n try {\n const entry = await lstat(filePath);\n if (!entry.isFile() || entry.isSymbolicLink()) {\n throw new Error('MANCODE_ARTIFACT_PATH_UNSAFE');\n }\n } catch (error) {\n if (isNodeError(error) && error.code === 'ENOENT') return null;\n throw error;\n }\n return readFile(filePath, 'utf8');\n}\n\nasync function removeManagedV3Block(\n filePath: string,\n startMarker: string,\n endMarker: string,\n): Promise<void> {\n const existing = await readTextIfExists(filePath);\n if (existing === null || !hasManagedBlock(existing, startMarker, endMarker)) {\n return;\n }\n const cleaned = removeManagedBlock(existing, startMarker, endMarker);\n if (cleaned.trim()) {\n await atomicWrite(filePath, `${cleaned.trimEnd()}\\n`);\n } else {\n await rm(filePath, { force: true });\n }\n}\n\nasync function managedFilePresent(filePath: string): Promise<boolean> {\n const content = await readTextIfExists(filePath);\n return content?.includes(V3_ADAPTER_MANAGED_MARKER) ?? false;\n}\n\nasync function managedBlockPresent(\n filePath: string,\n startMarker: string,\n endMarker: string,\n): Promise<boolean> {\n const content = await readTextIfExists(filePath);\n return content !== null && hasManagedBlock(content, startMarker, endMarker);\n}\n\nasync function readTextIfExists(filePath: string): Promise<string | null> {\n for (let attempt = 1; attempt <= ADAPTER_READ_MAX_ATTEMPTS; attempt += 1) {\n try {\n return await readFile(filePath, 'utf8');\n } catch (error) {\n if (isNodeError(error) && error.code === 'ENOENT') return null;\n if (\n !isRetriableAdapterReadError(error) ||\n attempt === ADAPTER_READ_MAX_ATTEMPTS\n ) {\n throw error;\n }\n await delay(ADAPTER_READ_RETRY_DELAY_MS * attempt);\n }\n }\n throw new Error('MANCODE_V3_ADAPTER_READ_RETRY_EXHAUSTED');\n}\n\nasync function atomicWrite(filePath: string, content: string): Promise<void> {\n const temporary = path.join(\n path.dirname(filePath),\n `.${path.basename(filePath)}.${process.pid}.${Date.now()}.tmp`,\n );\n try {\n await writeFile(temporary, content, { encoding: 'utf8', flag: 'wx' });\n await rename(temporary, filePath);\n } finally {\n await rm(temporary, { force: true }).catch(() => undefined);\n }\n}\n\nfunction targetFor(platform: PlatformName): string {\n switch (platform) {\n case 'claude-code':\n return '.claude/skills/mancode-v3/SKILL.md';\n case 'cursor':\n return '.cursor/rules/mancode-v3.mdc';\n case 'codex':\n case 'zcode':\n return 'AGENTS.md';\n case 'copilot':\n return '.github/copilot-instructions.md';\n }\n}\n\nfunction platformLabelFor(platform: PlatformName): string {\n switch (platform) {\n case 'claude-code':\n return 'Claude Code';\n case 'cursor':\n return 'Cursor';\n case 'codex':\n return 'Codex';\n case 'copilot':\n return 'GitHub Copilot';\n case 'zcode':\n return 'ZCode';\n }\n}\n\nfunction capabilitiesFor(platform: PlatformName): V3AdapterCapabilities {\n return {\n nativeModeEntry: platform === 'claude-code' || platform === 'cursor',\n sessionHook: false,\n promptHook: false,\n sessionIdentity: 'explicit-required',\n };\n}\n\nfunction isNodeError(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error;\n}\n\nfunction isRetriableAdapterReadError(error: unknown): boolean {\n return (\n isNodeError(error) && RETRIABLE_ADAPTER_READ_CODES.has(error.code ?? '')\n );\n}\n\nasync function delay(milliseconds: number): Promise<void> {\n await new Promise<void>((resolve) => {\n setTimeout(resolve, milliseconds);\n });\n}\n","export const DEFAULT_MANCODE_START_MARKER = '<!-- mancode:start -->';\nexport const DEFAULT_MANCODE_END_MARKER = '<!-- mancode:end -->';\n\nexport function removeManagedBlock(\n existing: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): string {\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n\n if (start === null && end === null) return existing;\n if (start === null || end === null) return existing;\n if (end.start < start.start) return existing;\n\n const before = existing.slice(0, start.start);\n const after = existing.slice(end.end);\n const merged = `${before}${after}`;\n return cleanUpOrphanedNewlines(merged);\n}\n\nexport function hasManagedBlock(\n existing: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): boolean {\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n return start !== null && end !== null && end.start > start.start;\n}\n\nfunction cleanUpOrphanedNewlines(content: string): string {\n const trimmed = content.replace(/\\n{3,}/gu, '\\n\\n').replace(/\\n+$/u, '\\n');\n return trimmed || '';\n}\n\nexport function replaceManagedBlock(\n existing: string,\n block: string,\n startMarker = DEFAULT_MANCODE_START_MARKER,\n endMarker = DEFAULT_MANCODE_END_MARKER,\n): string {\n const normalizedBlock = normalizeManagedBlock(block, startMarker, endMarker);\n const start = findMarkerLine(existing, startMarker);\n const end = findMarkerLine(existing, endMarker);\n\n if ((start === null) !== (end === null)) {\n throw new Error('managed block is malformed: missing start or end marker');\n }\n\n if (start === null && end === null) {\n const trimmedExisting = trimTrailingNewlines(existing);\n if (!trimmedExisting) return `${normalizedBlock}\\n`;\n return `${trimmedExisting}\\n\\n${normalizedBlock}\\n`;\n }\n\n if (!start || !end) {\n throw new Error('managed block is malformed: missing start or end marker');\n }\n\n if (end.start < start.start) {\n throw new Error('managed block is malformed: end marker precedes start');\n }\n\n return `${existing.slice(0, start.start)}${normalizedBlock}${existing.slice(\n end.end,\n )}`;\n}\n\nfunction normalizeManagedBlock(\n block: string,\n startMarker: string,\n endMarker: string,\n): string {\n const trimmedBlock = block.trim();\n const hasStart = trimmedBlock.startsWith(startMarker);\n const hasEnd = trimmedBlock.endsWith(endMarker);\n\n if (hasStart && hasEnd) return trimmedBlock;\n if (hasStart || hasEnd) {\n throw new Error('managed block content includes only one marker');\n }\n\n return `${startMarker}\\n${trimmedBlock}\\n${endMarker}`;\n}\n\nfunction trimTrailingNewlines(value: string): string {\n return value.replace(/\\n+$/u, '');\n}\n\nfunction findMarkerLine(\n content: string,\n marker: string,\n): { start: number; end: number } | null {\n let offset = 0;\n let inFence: { char: '`' | '~'; length: number } | null = null;\n\n for (const lineWithBreak of content.matchAll(/[^\\n]*(?:\\n|$)/gu)) {\n const rawLine = lineWithBreak[0];\n if (!rawLine) break;\n\n const line = rawLine.replace(/\\n$/u, '').replace(/\\r$/u, '');\n const fence = line.match(/^(`{3,}|~{3,})/u)?.[1];\n if (fence) {\n const char = fence[0] as '`' | '~';\n if (!inFence) {\n inFence = { char, length: fence.length };\n } else if (inFence.char === char && fence.length >= inFence.length) {\n inFence = null;\n }\n } else if (!inFence && line === marker) {\n return {\n start: offset,\n end: offset + marker.length,\n };\n }\n\n offset += rawLine.length;\n }\n\n return null;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;;;ACRV,IAAM,+BAA+B;AACrC,IAAM,6BAA6B;AAEnC,SAAS,mBACd,UACA,cAAc,8BACd,YAAY,4BACJ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