@shenlee/devcrew 0.1.0

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.
Files changed (64) hide show
  1. package/CONTRIBUTING.md +21 -0
  2. package/LICENSE +186 -0
  3. package/README.md +142 -0
  4. package/README.zh-CN.md +156 -0
  5. package/SECURITY.md +19 -0
  6. package/dist/packages/adapters/src/index.js +234 -0
  7. package/dist/packages/cli/src/index.js +76 -0
  8. package/dist/packages/core/src/active-run.js +24 -0
  9. package/dist/packages/core/src/artifacts.js +120 -0
  10. package/dist/packages/core/src/config.js +51 -0
  11. package/dist/packages/core/src/index.js +11 -0
  12. package/dist/packages/core/src/paths.js +51 -0
  13. package/dist/packages/core/src/standards.js +61 -0
  14. package/dist/packages/core/src/store.js +24 -0
  15. package/dist/packages/core/src/types.js +48 -0
  16. package/dist/packages/core/src/validation.js +52 -0
  17. package/dist/packages/core/src/verification.js +157 -0
  18. package/dist/packages/core/src/version.js +2 -0
  19. package/dist/packages/core/src/workflow.js +166 -0
  20. package/dist/packages/orchestrator/src/index.js +376 -0
  21. package/dist/packages/plugins/src/index.js +173 -0
  22. package/dist/packages/service/src/index.js +2 -0
  23. package/dist/packages/service/src/stdio.js +100 -0
  24. package/dist/packages/service/src/tools.js +177 -0
  25. package/docs/claude-code.md +37 -0
  26. package/docs/codex.md +80 -0
  27. package/docs/quickstart.md +64 -0
  28. package/docs/roles.md +43 -0
  29. package/docs/workflow.md +70 -0
  30. package/examples/README.md +11 -0
  31. package/examples/feature-request.md +13 -0
  32. package/examples/greenfield-request.md +14 -0
  33. package/package.json +60 -0
  34. package/packages/adapters/src/index.ts +404 -0
  35. package/packages/cli/src/index.ts +88 -0
  36. package/packages/core/src/active-run.ts +31 -0
  37. package/packages/core/src/artifacts.ts +148 -0
  38. package/packages/core/src/config.ts +56 -0
  39. package/packages/core/src/index.ts +11 -0
  40. package/packages/core/src/paths.ts +66 -0
  41. package/packages/core/src/standards.ts +70 -0
  42. package/packages/core/src/store.ts +28 -0
  43. package/packages/core/src/types.ts +182 -0
  44. package/packages/core/src/validation.ts +79 -0
  45. package/packages/core/src/verification.ts +163 -0
  46. package/packages/core/src/version.ts +2 -0
  47. package/packages/core/src/workflow.ts +214 -0
  48. package/packages/orchestrator/src/index.ts +469 -0
  49. package/packages/plugins/assets/composer-icon.png +0 -0
  50. package/packages/plugins/assets/logo.png +0 -0
  51. package/packages/plugins/src/index.ts +211 -0
  52. package/packages/service/src/index.ts +2 -0
  53. package/packages/service/src/stdio.ts +121 -0
  54. package/packages/service/src/tools.ts +215 -0
  55. package/plugins/devcrew-codex/.codex-plugin/plugin.json +41 -0
  56. package/plugins/devcrew-codex/.mcp.json +16 -0
  57. package/plugins/devcrew-codex/agents/architect.toml +6 -0
  58. package/plugins/devcrew-codex/agents/implementer.toml +6 -0
  59. package/plugins/devcrew-codex/agents/pm.toml +6 -0
  60. package/plugins/devcrew-codex/agents/tester.toml +6 -0
  61. package/plugins/devcrew-codex/assets/composer-icon.png +0 -0
  62. package/plugins/devcrew-codex/assets/logo.png +0 -0
  63. package/plugins/devcrew-codex/skills/devcrew/SKILL.md +17 -0
  64. package/scripts/smoke-codex-plugin.mjs +331 -0
@@ -0,0 +1,21 @@
1
+ # Contributing
2
+
3
+ ## Development
4
+
5
+ ```bash
6
+ npm install
7
+ npm test
8
+ npm run build
9
+ npm run validate
10
+ ```
11
+
12
+ ## Pull Requests
13
+
14
+ Keep changes scoped and include tests for behavior changes. For workflow behavior, update both tests and documentation.
15
+
16
+ ## Project Standards
17
+
18
+ - Use TypeScript strict mode.
19
+ - Prefer small modules with explicit inputs and outputs.
20
+ - Keep host-specific behavior behind adapters.
21
+ - Do not bypass Codex or Claude Code permission models.
package/LICENSE ADDED
@@ -0,0 +1,186 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on or derived from the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ patent license to make, have made, use, offer to sell, sell, import,
76
+ and otherwise transfer the Work, where such license applies only to
77
+ those patent claims licensable by such Contributor that are necessarily
78
+ infringed by their Contribution alone or by combination of their
79
+ Contribution with the Work to which such Contribution was submitted.
80
+ If You institute patent litigation against any entity alleging that
81
+ the Work or a Contribution incorporated within the Work constitutes
82
+ direct or contributory patent infringement, then any patent licenses
83
+ granted to You under this License for that Work shall terminate as of
84
+ the date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or
92
+ Derivative Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, then any Derivative Works that You distribute must
105
+ include a readable copy of the attribution notices contained
106
+ within such NOTICE file, excluding those notices that do not
107
+ pertain to any part of the Derivative Works, in at least one
108
+ of the following places: within a NOTICE text file distributed
109
+ as part of the Derivative Works; within the Source form or
110
+ documentation, if provided along with the Derivative Works; or,
111
+ within a display generated by the Derivative Works, if and
112
+ wherever such third-party notices normally appear. The contents
113
+ of the NOTICE file are for informational purposes only and
114
+ do not modify the License. You may add Your own attribution
115
+ notices within Derivative Works that You distribute, alongside
116
+ or as an addendum to the NOTICE text from the Work, provided
117
+ that such additional attribution notices cannot be construed
118
+ as modifying the License.
119
+
120
+ You may add Your own copyright statement to Your modifications and
121
+ may provide additional or different license terms and conditions
122
+ for use, reproduction, or distribution of Your modifications, or
123
+ for any such Derivative Works as a whole, provided Your use,
124
+ reproduction, and distribution of the Work otherwise complies with
125
+ the conditions stated in this License.
126
+
127
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
128
+ any Contribution intentionally submitted for inclusion in the Work
129
+ by You to the Licensor shall be under the terms and conditions of
130
+ this License, without any additional terms or conditions.
131
+ Notwithstanding the above, nothing herein shall supersede or modify
132
+ the terms of any separate license agreement you may have executed
133
+ with Licensor regarding such Contributions.
134
+
135
+ 6. Trademarks. This License does not grant permission to use the trade
136
+ names, trademarks, service marks, or product names of the Licensor,
137
+ except as required for reasonable and customary use in describing the
138
+ origin of the Work and reproducing the content of the NOTICE file.
139
+
140
+ 7. Disclaimer of Warranty. Unless required by applicable law or
141
+ agreed to in writing, Licensor provides the Work on an "AS IS"
142
+ BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
143
+ or implied, including, without limitation, any warranties or conditions
144
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
145
+ PARTICULAR PURPOSE. You are solely responsible for determining the
146
+ appropriateness of using or redistributing the Work and assume any
147
+ risks associated with Your exercise of permissions under this License.
148
+
149
+ 8. Limitation of Liability. In no event and under no legal theory,
150
+ whether in tort (including negligence), contract, or otherwise,
151
+ unless required by applicable law (such as deliberate and grossly
152
+ negligent acts) or agreed to in writing, shall any Contributor be
153
+ liable to You for damages, including any direct, indirect, special,
154
+ incidental, or consequential damages of any character arising as a
155
+ result of this License or out of the use or inability to use the
156
+ Work (including but not limited to damages for loss of goodwill,
157
+ work stoppage, computer failure or malfunction, or any and all
158
+ other commercial damages or losses), even if such Contributor
159
+ has been advised of the possibility of such damages.
160
+
161
+ 9. Accepting Warranty or Additional Liability. While redistributing
162
+ the Work or Derivative Works thereof, You may choose to offer,
163
+ and charge a fee for, acceptance of support, warranty, indemnity,
164
+ or other liability obligations and/or rights consistent with this
165
+ License. However, in accepting such obligations, You may act only
166
+ on Your own behalf and on Your sole responsibility, not on behalf
167
+ of any other Contributor, and only if You agree to indemnify,
168
+ defend, and hold each Contributor harmless for any liability
169
+ incurred by, or claims asserted against, such Contributor by reason
170
+ of your accepting any such warranty or additional liability.
171
+
172
+ END OF TERMS AND CONDITIONS
173
+
174
+ Copyright 2026 DevCrew Contributors
175
+
176
+ Licensed under the Apache License, Version 2.0 (the "License");
177
+ you may not use this file except in compliance with the License.
178
+ You may obtain a copy of the License at
179
+
180
+ https://www.apache.org/licenses/LICENSE-2.0
181
+
182
+ Unless required by applicable law or agreed to in writing, software
183
+ distributed under the License is distributed on an "AS IS" BASIS,
184
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ See the License for the specific language governing permissions and
186
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # DevCrew
2
+
3
+ English | [简体中文](README.zh-CN.md)
4
+
5
+ DevCrew is a local workflow service for Codex and Claude Code. It gives coding agents a gated professional delivery process:
6
+
7
+ Requester -> Product Manager -> Architect -> Implementer -> Tester -> Acceptance.
8
+
9
+ The first release is intentionally local-first. DevCrew stores workflow state and artifacts in the repository, exposes MCP tools for agent-host interaction, and generates Codex and Claude Code plugin bundles.
10
+
11
+ ## Features
12
+
13
+ - Gated phases for requirements, architecture, implementation planning, and test reporting.
14
+ - Two workflow modes: `feature` for existing repositories and `greenfield` for new products.
15
+ - Safe execution modes: `plan` is the default; `apply` must be explicitly requested before implementer/tester roles can write files or run validation commands.
16
+ - Host-preferred backend selection: Codex runs default to Codex, Claude Code runs default to Claude.
17
+ - Orchestrated role execution: `devcrew_start` runs the PM role, and `devcrew_continue` runs the next phase role before opening the gate.
18
+ - Implementation review artifact: implementation gates include changed files, captured diff, and architecture compliance review notes.
19
+ - Repository artifacts in `.devcrew/runs/<run-id>/state.json` and `docs/devcrew/<run-id>/`.
20
+ - Standards discovery from `.devcrew/standards.md`, `AGENTS.md`, `CLAUDE.md`, README, and common project manifests.
21
+ - MCP tools: `devcrew_start`, `devcrew_status`, `devcrew_answer`, `devcrew_approve`, `devcrew_reject`, `devcrew_continue`, and `devcrew_artifact`.
22
+ - Codex and Claude Code plugin scaffolds generated by `devcrew init`.
23
+
24
+ ## Install As A Codex Plugin
25
+
26
+ Add the DevCrew marketplace:
27
+
28
+ ```bash
29
+ codex plugin marketplace add lishen802/devcrew
30
+ ```
31
+
32
+ Restart Codex, open the plugin directory, choose the DevCrew marketplace, and install the DevCrew plugin.
33
+
34
+ The plugin starts the DevCrew MCP server with:
35
+
36
+ ```bash
37
+ npx -y @shenlee/devcrew@0.1.0 serve --stdio
38
+ ```
39
+
40
+ The plugin locks the MCP server to the published npm package version, so users do not need to clone the source or build TypeScript at install time. You only need Node.js and network access the first time Codex starts the MCP server.
41
+
42
+ ## Install From npm
43
+
44
+ ```bash
45
+ npm install -g @shenlee/devcrew
46
+ devcrew --version
47
+ devcrew doctor /path/to/repo
48
+ ```
49
+
50
+ The npm package is published as `@shenlee/devcrew`, while the installed CLI command remains `devcrew`. It declares the Codex and Claude Agent SDKs as optional dependencies. npm installs optional dependencies by default; if your environment omits them, reinstall with `npm install -g @shenlee/devcrew --include=optional`. `devcrew doctor` reports whether `@openai/codex-sdk` and `@anthropic-ai/claude-agent-sdk` are resolvable for real host-backed `apply` workflows.
51
+
52
+ ## Install From Source
53
+
54
+ ```bash
55
+ npm install
56
+ npm run validate
57
+ npm link
58
+ ```
59
+
60
+ Then initialize a project:
61
+
62
+ ```bash
63
+ devcrew init /path/to/repo
64
+ devcrew doctor /path/to/repo
65
+ ```
66
+
67
+ ## Use In An Agent
68
+
69
+ Start the MCP server through the generated plugin configuration:
70
+
71
+ ```bash
72
+ devcrew serve --stdio
73
+ ```
74
+
75
+ In Codex or Claude Code, invoke the generated DevCrew skill and ask for a workflow:
76
+
77
+ ```text
78
+ Use DevCrew to plan and implement audit logging for the billing API.
79
+ ```
80
+
81
+ The agent should call `devcrew_start`, show the PM-generated requirements artifact, then wait for approval before moving to architecture. After each approval, `devcrew_continue` runs the next role and writes its Markdown artifact before opening the next gate.
82
+
83
+ Plugins set `DEVCREW_HOST` for host detection, so `devcrew_start` can omit `host` unless you want to override it. DevCrew records the latest run as the repository's active run, so follow-up MCP calls can omit `runId`.
84
+
85
+ By default DevCrew runs in `plan` mode. To allow the implementer/tester phases to make repository changes and run configured verification commands, explicitly request apply mode:
86
+
87
+ ```text
88
+ Use DevCrew in apply mode to implement audit logging for the billing API.
89
+ ```
90
+
91
+ DevCrew auto-discovers verification commands from common project manifests. The current rules prefer `package.json` scripts (`validate`, then `test`, then `typecheck`/`lint`), then fall back to `go test ./...`, `cargo test`, or `python -m pytest` when matching manifests are present.
92
+
93
+ You can override discovery with explicit commands in `.devcrew/config.json`:
94
+
95
+ ```json
96
+ {
97
+ "version": 1,
98
+ "defaultBackend": "host-preferred",
99
+ "executionMode": "plan",
100
+ "verifyCommands": ["npm run validate"],
101
+ "workflow": {
102
+ "gates": ["requirements", "architecture", "implementation", "testing"],
103
+ "artifactDirectory": "docs/devcrew"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Development
109
+
110
+ ```bash
111
+ npm test
112
+ npm run build
113
+ npm run validate
114
+ npm pack --dry-run
115
+ ```
116
+
117
+ The SDK adapters use deterministic local fallback output when Codex or Claude SDK packages are not installed. This keeps local tests reliable while preserving the adapter boundary for real host integration. In `apply` mode, DevCrew still inherits the host sandbox and approval boundaries.
118
+
119
+ For published installs, the host SDK packages are pinned optional dependencies so `npx -y @shenlee/devcrew@<version>` can resolve them from the DevCrew package itself. Plan mode can still fall back to deterministic artifacts, but apply mode fails with a clear SDK resolution error if the selected host SDK is unavailable.
120
+
121
+ Public npm publishing is handled by the `npm publish` GitHub Actions workflow. It runs validation, checks the package with `npm pack --dry-run`, and publishes with npm provenance when a GitHub Release is published or the workflow is manually dispatched with `NPM_TOKEN` configured.
122
+
123
+ After publishing the npm version referenced by the Codex plugin, run the real marketplace smoke test:
124
+
125
+ ```bash
126
+ npm run smoke:codex-plugin
127
+ ```
128
+
129
+ It installs DevCrew from the Codex marketplace into an isolated `CODEX_HOME`, starts the installed MCP server, and runs a full plan-mode workflow.
130
+
131
+ ## Documentation
132
+
133
+ - [Quickstart](docs/quickstart.md)
134
+ - [Codex setup](docs/codex.md)
135
+ - [Claude Code setup](docs/claude-code.md)
136
+ - [Workflow model](docs/workflow.md)
137
+ - [Role customization](docs/roles.md)
138
+ - [Examples](examples/README.md)
139
+
140
+ ## License
141
+
142
+ Apache-2.0
@@ -0,0 +1,156 @@
1
+ # DevCrew
2
+
3
+ [English](README.md) | 简体中文
4
+
5
+ DevCrew 是一个面向 Codex、Claude Code 等编程 Agent 的本地工作流服务。它把一次功能或产品开发拆成带门禁的专业流程:
6
+
7
+ 需求提出者 -> 产品经理 -> 架构师 -> 实现工程师 -> 测试验收 -> 交付确认。
8
+
9
+ 项目目标是让 Agent 不只是“直接写代码”,而是像一个小型开发团队一样,先澄清需求、确认边界,再设计方案、实施、测试并产出可审查的文档。
10
+
11
+ ## 核心能力
12
+
13
+ - 内置阶段门禁:需求确认、架构确认、实现计划确认、测试报告确认。
14
+ - 支持两种工作流:`feature` 用于已有项目功能开发,`greenfield` 用于从零开始的新产品。
15
+ - 支持安全执行模式:默认是 `plan`,只有显式请求 `apply` 时,implementer/tester 阶段才允许写文件或运行验证命令。
16
+ - 默认按当前宿主选择后端:在 Codex 中优先使用 Codex,在 Claude Code 中优先使用 Claude。
17
+ - 已接入角色编排:`devcrew_start` 会先运行 PM 角色,`devcrew_continue` 会运行下一阶段角色,然后再打开阶段门禁。
18
+ - 实现评审产物:implementation gate 会附带 changed files、捕获的 diff 和架构符合性审查说明。
19
+ - 运行状态写入 `.devcrew/runs/<run-id>/state.json`,评审产物写入 `docs/devcrew/<run-id>/`。
20
+ - 自动发现项目规范:`.devcrew/standards.md`、`AGENTS.md`、`CLAUDE.md`、README 以及常见项目配置文件。
21
+ - 提供 MCP 工具:`devcrew_start`、`devcrew_status`、`devcrew_answer`、`devcrew_approve`、`devcrew_reject`、`devcrew_continue`、`devcrew_artifact`。
22
+ - 可通过 `devcrew init` 生成 Codex 和 Claude Code 插件骨架。
23
+
24
+ ## 作为 Codex 插件安装
25
+
26
+ 添加 DevCrew marketplace:
27
+
28
+ ```bash
29
+ codex plugin marketplace add lishen802/devcrew
30
+ ```
31
+
32
+ 重启 Codex,打开插件目录,选择 DevCrew marketplace,然后安装 DevCrew 插件。
33
+
34
+ 插件会用下面的命令启动 DevCrew MCP 服务:
35
+
36
+ ```bash
37
+ npx -y @shenlee/devcrew@0.1.0 serve --stdio
38
+ ```
39
+
40
+ 插件会锁定到已发布的 npm 包版本,因此用户不需要克隆源码,也不需要在安装时编译 TypeScript;只需要本机有 Node.js,并且 Codex 第一次启动 MCP 服务时可以访问网络。
41
+
42
+ ## 通过 npm 安装
43
+
44
+ ```bash
45
+ npm install -g @shenlee/devcrew
46
+ devcrew --version
47
+ devcrew doctor /path/to/repo
48
+ ```
49
+
50
+ npm 包发布名是 `@shenlee/devcrew`,安装后的 CLI 命令仍然是 `devcrew`。它会把 Codex SDK 和 Claude Agent SDK 声明为 optional dependencies。npm 默认会安装 optional dependencies;如果你的环境跳过了它们,可以用 `npm install -g @shenlee/devcrew --include=optional` 重新安装。`devcrew doctor` 会检查 `@openai/codex-sdk` 和 `@anthropic-ai/claude-agent-sdk` 是否可解析,用于确认真实宿主后端的 `apply` 流程是否可用。
51
+
52
+ ## 从源码安装
53
+
54
+ ```bash
55
+ npm install
56
+ npm run validate
57
+ npm link
58
+ ```
59
+
60
+ 初始化一个项目:
61
+
62
+ ```bash
63
+ devcrew init /path/to/repo
64
+ devcrew doctor /path/to/repo
65
+ ```
66
+
67
+ 初始化后会生成:
68
+
69
+ - `.devcrew/config.json`
70
+ - `.devcrew/standards.md`
71
+ - `docs/devcrew/`
72
+ - `plugins/devcrew-codex/`
73
+ - `plugins/devcrew-claude/`
74
+
75
+ ## 在 Agent 中使用
76
+
77
+ 通过生成的插件配置启动 MCP 服务:
78
+
79
+ ```bash
80
+ devcrew serve --stdio
81
+ ```
82
+
83
+ 然后在 Codex 或 Claude Code 中调用 DevCrew,例如:
84
+
85
+ ```text
86
+ 使用 DevCrew 帮我规划并实现 billing API 的审计日志功能。
87
+ ```
88
+
89
+ 典型流程:
90
+
91
+ 1. Agent 调用 `devcrew_start` 创建工作流。
92
+ 2. DevCrew 运行 PM 角色生成需求文档并等待你确认。
93
+ 3. 你通过 `devcrew_approve` 或 `devcrew_reject` 推进或驳回阶段。
94
+ 4. 需求确认后,`devcrew_continue` 会运行架构师角色,再依次进入实现计划和测试验收。
95
+ 5. 所有产物都会保存在 `docs/devcrew/<run-id>/`,方便审查和版本管理。
96
+
97
+ 插件会设置 `DEVCREW_HOST` 用于宿主识别,因此 `devcrew_start` 可以省略 `host`,除非你需要显式覆盖。DevCrew 会把最新 run 记录为当前仓库的 active run,后续 MCP 调用可以省略 `runId`。
98
+
99
+ 默认情况下 DevCrew 使用安全的 `plan` 模式。如果你希望 implementer/tester 阶段真正修改仓库并运行配置好的验证命令,需要明确要求 apply 模式:
100
+
101
+ ```text
102
+ 使用 DevCrew apply 模式帮我实现 billing API 的审计日志功能。
103
+ ```
104
+
105
+ DevCrew 会自动从常见项目清单中发现验证命令。当前规则会优先读取 `package.json` scripts(`validate`,然后是 `test`,再到 `typecheck`/`lint`),再按项目清单回退到 `go test ./...`、`cargo test` 或 `python -m pytest`。
106
+
107
+ 你也可以在 `.devcrew/config.json` 中显式覆盖:
108
+
109
+ ```json
110
+ {
111
+ "version": 1,
112
+ "defaultBackend": "host-preferred",
113
+ "executionMode": "plan",
114
+ "verifyCommands": ["npm run validate"],
115
+ "workflow": {
116
+ "gates": ["requirements", "architecture", "implementation", "testing"],
117
+ "artifactDirectory": "docs/devcrew"
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## 开发命令
123
+
124
+ ```bash
125
+ npm test
126
+ npm run build
127
+ npm run validate
128
+ npm pack --dry-run
129
+ ```
130
+
131
+ 当前适配器在未安装 Codex SDK 或 Claude SDK 时会使用确定性的本地 fallback 输出。这样可以保证测试和演示稳定,同时保留接入真实宿主 SDK 的边界。即使在 `apply` 模式下,DevCrew 仍然继承宿主的 sandbox、审批和工具权限。
132
+
133
+ 对于发布安装,宿主 SDK 包会作为精确锁定的 optional dependencies 随 DevCrew 一起安装,因此 `npx -y @shenlee/devcrew@<version>` 可以从 DevCrew 包自身解析这些 SDK。plan 模式仍允许 deterministic fallback;但 apply 模式在选定宿主 SDK 不可用时会直接失败,并给出明确的 SDK 解析错误。
134
+
135
+ 公开 npm 发布由 `npm publish` GitHub Actions 工作流处理。发布 GitHub Release 或手动触发 workflow 时,它会先运行验证,再执行 `npm pack --dry-run` 检查包内容,最后在配置 `NPM_TOKEN` 后使用 npm provenance 发布公开包。
136
+
137
+ 当 Codex 插件引用的 npm 版本发布完成后,运行真实 marketplace smoke test:
138
+
139
+ ```bash
140
+ npm run smoke:codex-plugin
141
+ ```
142
+
143
+ 它会在隔离的 `CODEX_HOME` 中从 Codex marketplace 安装 DevCrew,启动安装后的 MCP 服务,并跑完整的 plan 模式工作流。
144
+
145
+ ## 文档
146
+
147
+ - [快速开始](docs/quickstart.md)
148
+ - [Codex 接入](docs/codex.md)
149
+ - [Claude Code 接入](docs/claude-code.md)
150
+ - [工作流模型](docs/workflow.md)
151
+ - [角色定制](docs/roles.md)
152
+ - [示例](examples/README.md)
153
+
154
+ ## 许可证
155
+
156
+ Apache-2.0
package/SECURITY.md ADDED
@@ -0,0 +1,19 @@
1
+ # Security
2
+
3
+ DevCrew is a local workflow service. It does not grant additional permissions beyond the host agent runtime.
4
+
5
+ ## Permission Model
6
+
7
+ - Codex sandbox and approval settings remain authoritative in Codex.
8
+ - Claude Code permissions and approval settings remain authoritative in Claude Code.
9
+ - DevCrew records state and writes artifacts inside the target repository.
10
+
11
+ ## Reporting Issues
12
+
13
+ For a public repository, open a private security advisory when available. Otherwise contact the maintainers before publishing exploit details.
14
+
15
+ ## Design Rules
16
+
17
+ - Do not store secrets in `.devcrew/runs`.
18
+ - Do not add network access to adapters without explicit configuration.
19
+ - Do not execute destructive commands from the service layer.