Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ jobs:
run: npm run typecheck
- name: Build
run: npm run build
- name: Verify compiled adapters
run: npm run test:dist
- name: Test
run: npm test
28 changes: 17 additions & 11 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<p align="center">
<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>
<a href="https://www.npmjs.com/package/mancode"><img src="https://img.shields.io/npm/v/mancode?style=flat-square" alt="npm version" /></a>
<img src="https://img.shields.io/badge/status-V3%20beta%20v0.3.14-orange?style=flat-square" alt="Status: V3 beta v0.3.14" />
<img src="https://img.shields.io/badge/status-Continuity%20v0.3.16-2f855a?style=flat-square" alt="Status: mancode Continuity v0.3.16" />
<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" />
</p>

Expand All @@ -34,6 +34,9 @@ different gears for different stakes: light solo mode for daily practice, `/man`
for playoff-level engineering discipline, and coaching-staff subagents for
research, planning, implementation, and review.

**mancode Continuity** is the continuous-context runtime that carries tasks,
decisions, and verification evidence safely into later conversations.

[Installation](#installation) · [Usage](#usage)

mancode ships with adapters for Claude Code, Cursor, Codex in the ChatGPT
Expand Down Expand Up @@ -102,7 +105,7 @@ explicitly resumes the existing TaskRef, preserving continuity without treating
one window's temporary state as another window's identity.

```bash
mancode status --json
mancode status --brief --json
mancode context session new --client claude-code
mancode context resume <namespace:ULID> --session <id> --client claude-code
mancode context show --purpose orient --session <id> --client claude-code
Expand Down Expand Up @@ -350,9 +353,8 @@ it should behave, and why previous decisions were made.

## Installation

**Status**: V3 beta v0.3.14. Claude Code, Cursor, Codex in the ChatGPT desktop
app and CLI, GitHub Copilot, and ZCode adapters are included. Stable release
still requires the five-host real-session acceptance and the `context beta` B1 gate.
**Status**: mancode Continuity v0.3.16. Claude Code, Cursor, Codex in the ChatGPT
desktop app and CLI, GitHub Copilot, and ZCode adapters are included.

Requires Node.js 20 or newer. macOS, Linux, Windows CMD, PowerShell, and Git Bash
are supported. Git is optional: without it, initialization continues with solo
Expand Down Expand Up @@ -421,6 +423,7 @@ mancode init
mancode init --legacy
mancode status
mancode status --json
mancode status --brief --json
mancode install <claude-code|cursor|codex|copilot|zcode>
mancode list-platforms
mancode team identity create --name "<name>"
Expand Down Expand Up @@ -449,7 +452,7 @@ mancode version
Simplified output:

```text
mancode v0.3.14
mancode v0.3.16

Project: my-app
Runtime: ready
Expand Down Expand Up @@ -488,12 +491,15 @@ mancode init

### `mancode status`

Shows activation, runtime binding, identity/session evidence, transport, and
the physical readiness of each platform bootstrap and original mode entry.
The default and full JSON views show activation, runtime binding,
identity/session evidence, transport, and the physical readiness of each
platform bootstrap and original mode entry. Coding agents should combine
`--brief --json` to read only the compact Continuity runtime view.

```bash
mancode status
mancode status --json
mancode status --brief --json
```

### `mancode workflow`
Expand Down Expand Up @@ -639,7 +645,7 @@ Ensure the `.cursor/rules/mancode-*.mdc` files exist. Rules with
Mode-specific rules (manba, man, manteam, manps) trigger based on the
description field — invoke them by asking for `/manba` or similar.

### How to reinstall V3 adapters
### How to reinstall Continuity adapters

```bash
mancode uninstall claude-code --force
Expand All @@ -654,7 +660,7 @@ mancode install copilot
mancode install zcode
```

V3 authority is protected, so `mancode uninstall --all` does not delete workflow
Continuity authority is protected, so `mancode uninstall --all` does not delete workflow
authority. To inspect removable runtime records, run
`mancode context compact --dry-run` first.

Expand All @@ -665,7 +671,7 @@ npm uninstall -g mancode
```

Uninstalling each platform removes its mancode bootstrap while preserving
user-authored rules, instructions, and V3 workflow data. The `--all` form is only
user-authored rules, instructions, and Continuity workflow data. The `--all` form is only
supported for projects explicitly initialized with `mancode init --legacy`.

## FAQ
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<p align="center">
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square" alt="许可证:AGPL-3.0" /></a>
<a href="https://www.npmjs.com/package/mancode"><img src="https://img.shields.io/npm/v/mancode?style=flat-square" alt="npm 版本" /></a>
<img src="https://img.shields.io/badge/status-V3%20beta%20v0.3.14-orange?style=flat-square" alt="状态:V3 Beta v0.3.14" />
<img src="https://img.shields.io/badge/status-Continuity%20v0.3.16-2f855a?style=flat-square" alt="状态:mancode Continuity v0.3.16" />
<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" />
</p>

Expand All @@ -36,6 +36,8 @@
日常任务用轻量 `solo`,关键任务用季后赛级别的 `/man`,复杂任务让教练组 subagents
负责调研、计划、实现和审查。

**mancode Continuity(连续上下文运行时)**负责把任务、决策和验证证据安全地带到后续对话。

mancode 当前支持 Claude Code、Cursor、ChatGPT 桌面端中的 Codex、Codex CLI、
GitHub Copilot 和 ZCode。每个平台继续使用原来的 `man*` 入口,并通过静态
bootstrap 接入统一的 Context Pack 与 workflow authority。
Expand Down Expand Up @@ -92,7 +94,7 @@ mancode 把目标、需求、计划、检查结果和交接信息保存在稳定
窗口的临时状态误当成另一个窗口的身份。

```bash
mancode status --json
mancode status --brief --json
mancode context session new --client claude-code
mancode context resume <namespace:ULID> --session <id> --client claude-code
mancode context show --purpose orient --session <id> --client claude-code
Expand Down Expand Up @@ -305,9 +307,8 @@ src/components/

## 安装

**状态**:V3 Beta v0.3.14。Claude Code、Cursor、ChatGPT 桌面端中的 Codex、
Codex CLI 和 GitHub Copilot 均已接入;ZCode adapter 已接入。正式稳定发布仍需
完成五平台真实宿主验收和 `context beta` B1 门禁。
**状态**:mancode Continuity v0.3.16。Claude Code、Cursor、ChatGPT 桌面端中的
Codex、Codex CLI、GitHub Copilot 和 ZCode adapter 均已接入。

需要 Node.js 20 或更高版本。原生支持 macOS、Linux、Windows CMD、
PowerShell 和 Git Bash。Git 是可选依赖:未安装时仍可初始化,只会把团队
Expand Down Expand Up @@ -374,6 +375,7 @@ mancode init
mancode init --legacy
mancode status
mancode status --json
mancode status --brief --json
mancode install <claude-code|cursor|codex|copilot|zcode>
mancode list-platforms
mancode team identity create --name "<name>"
Expand Down Expand Up @@ -402,7 +404,7 @@ mancode version
以下是简化输出示例:

```text
mancode v0.3.14
mancode v0.3.16

Project: my-app
Runtime: ready
Expand Down Expand Up @@ -440,12 +442,14 @@ mancode init

### `mancode status`

显示 activation、runtime binding、identity/session evidence、transport 和各平台
bootstrap/原 mode 入口的实际就绪状态。
默认输出和完整 JSON 显示 activation、runtime binding、identity/session evidence、
transport 和各平台 bootstrap/原 mode 入口的实际就绪状态。编码 Agent 应组合使用
`--brief --json`,只读取精简的 Continuity 运行时视图。

```bash
mancode status
mancode status --json
mancode status --brief --json
```

### `mancode workflow`
Expand Down Expand Up @@ -579,7 +583,7 @@ mancode/
(context、practice、solo)在每次对话加载。模式规则(manba、man、manteam、
manps)按 description 触发——输入 `/manba` 等关键词即可激活。

### 如何重装 V3 适配器
### 如何重装 Continuity 适配器

```bash
mancode uninstall claude-code --force
Expand All @@ -594,7 +598,7 @@ mancode install copilot
mancode install zcode
```

V3 authority 受保护,`mancode uninstall --all` 不会删除工作流权威数据。需要
Continuity authority 受保护,`mancode uninstall --all` 不会删除工作流权威数据。需要
清理运行时保留记录时,先用 `mancode context compact --dry-run` 检查候选。

### 如何移除 CLI
Expand All @@ -604,7 +608,7 @@ npm uninstall -g mancode
```

逐个平台卸载会移除对应的 mancode bootstrap,并保留用户自定义 rules、instructions
V3 工作流数据。旧项目若明确使用 `mancode init --legacy`,才支持 legacy 的
Continuity 工作流数据。旧项目若明确使用 `mancode init --legacy`,才支持 legacy 的
`mancode uninstall --all --force`。

## 常见问题
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mancode",
"version": "0.3.14",
"description": "AI coding agent workflow harness. Five modes from practice to playoffs: stop over-engineering, reuse project context, and add multi-agent code review.",
"version": "0.3.16",
"description": "AI coding agent workflow harness with mancode Continuity for cross-conversation tasks, decisions, verification, and team coordination.",
"type": "module",
"license": "AGPL-3.0-only",
"author": "whitelonng",
Expand Down Expand Up @@ -59,13 +59,14 @@
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest run",
"test:dist": "node scripts/verify-dist-adapters.mjs",
"test:windows-smoke": "node scripts/windows-smoke.mjs",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "biome check src tests",
"typecheck": "tsc --noEmit",
"format": "biome format --write src tests",
"prepublishOnly": "npm run lint && npm run typecheck && npm run build && npm test"
"prepublishOnly": "npm run lint && npm run typecheck && npm run build && npm run test:dist && npm test"
},
"dependencies": {
"commander": "^12.1.0",
Expand Down
92 changes: 92 additions & 0 deletions scripts/verify-dist-adapters.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { spawnSync } from 'node:child_process';
import { mkdir, mkdtemp, readFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';

const repoRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'..',
);
const cliPath = path.join(repoRoot, 'dist', 'cli.js');
const projectRoot = await mkdtemp(
path.join(tmpdir(), 'mancode-dist-adapters-'),
);

try {
await mkdir(projectRoot, { recursive: true });
runCli(['init', '--empty', '--platform', 'all', '--lang', 'en']);

const generatedFiles = [
'.claude/skills/mancode-v3/SKILL.md',
'.claude/skills/man/SKILL.md',
'.cursor/rules/mancode-v3.mdc',
'.cursor/commands/man.md',
'AGENTS.md',
'.agents/skills/man/SKILL.md',
'.github/copilot-instructions.md',
'.github/prompts/man.prompt.md',
];

for (const relativePath of generatedFiles) {
const content = await readFile(path.join(projectRoot, relativePath), 'utf8');
assertGeneratedContract(relativePath, content);
}

const status = runCli(['status', '--brief', '--json']);
const parsed = JSON.parse(status.stdout);
assert(
parsed.runtime === 'mancode-continuity' && parsed.state === 'active',
`compiled status returned an unexpected runtime: ${status.stdout}`,
);
assert(
!status.stdout.includes('"v3"') && !status.stdout.includes('v3_active'),
`compiled brief status exposed internal version fields: ${status.stdout}`,
);

console.log(
`Verified ${generatedFiles.length} adapters generated by dist/cli.js.`,
);
} finally {
await rm(projectRoot, { recursive: true, force: true });
}

function runCli(args) {
const result = spawnSync(process.execPath, [cliPath, ...args], {
cwd: projectRoot,
encoding: 'utf8',
});
assert(
result.status === 0,
`compiled CLI failed (${result.status}): ${result.stderr || result.stdout}`,
);
return result;
}

function assertGeneratedContract(relativePath, content) {
for (const required of [
'mancode status --brief --json',
'snapshot already obtained in this conversation',
'mancode Continuity',
]) {
assert(
content.includes(required),
`${relativePath} is missing compiled guidance: ${required}`,
);
}
for (const forbidden of [
'mancode status --json',
'authority: "v3"',
'v3_active',
]) {
assert(
!content.includes(forbidden),
`${relativePath} exposes stale guidance: ${forbidden}`,
);
}
}

function assert(condition, message) {
if (!condition) throw new Error(message);
}
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ program
.command('status')
.description('Show current mancode project status')
.option('--json', 'Output as JSON (for scripts)')
.option('--brief', 'Output compact mancode Continuity runtime status')
.action(async (options) => {
const code = await status(process.cwd(), options);
process.exitCode = code;
Expand Down
15 changes: 15 additions & 0 deletions src/commands/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ import {
resumeSession,
} from '../runtime/session.js';
import { readLocalActor } from '../team/actor.js';
import {
capabilitiesFromGitRefCache,
readGitRefTeamCache,
} from '../team/git-ref-cache.js';
import {
listGitRefWorkflowRepairs,
recoverGitRefWorkflowRepair,
Expand Down Expand Up @@ -810,6 +814,16 @@ async function resolveContext(
projectRoot: project.projectRoot,
entityHomeStoreContext: project.runtime.entityHomeStoreContext,
});
const capabilities =
project.project.config.transport.mode === 'git-ref'
? capabilitiesFromGitRefCache(
project.project.config,
await readGitRefTeamCache(
project.projectRoot,
project.project.config,
),
)
: undefined;
return resolver.resolve({
session,
taskRef: request.taskRef,
Expand All @@ -823,6 +837,7 @@ async function resolveContext(
adapterVersions: project.project.manifest.managedAdapters,
},
codeHead: await readCheckoutCodeHead(project.projectRoot),
...(capabilities === undefined ? {} : { capabilities }),
});
}

Expand Down
Loading
Loading