super-engineer-workflow 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ - `se init` 在 `openspec` 模式下默认尝试执行 `openspec init . --tools codex,claude`。
6
+ - `se init` 自动生成工作区 `.claude/commands/se/*` 快捷命令。
7
+ - 当初始化时选择安装 Codex skill,同步生成 `~/.codex/prompts/se-*.md` 快捷提示。
8
+ - 增加 `--skip-openspec-init` 和 `--skip-commands` 以便高级用户跳过对应步骤。
9
+
10
+ ## 0.1.1
11
+
12
+ - 调整 README 项目定位:适用于新系统开发和存量系统迭代,强调存量系统长期需求迭代优势更明显。
13
+ - 调整 npm 包描述,避免将适用场景限定为存量系统。
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  - 增加 `se` / `super-engineer` npm CLI 入口。
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # super-engineer
2
2
 
3
- `super-engineer` 是一个面向存量系统交付场景的 AI 工程工作流项目。
3
+ `super-engineer` 是一个面向需求驱动开发的软件工程工作流 skill,适用于新系统开发和存量系统迭代。
4
4
 
5
5
  它的目标不是让 AI 零散地写代码,而是让 AI 围绕一次真实需求,按稳定阶段推进:
6
6
 
@@ -14,12 +14,15 @@
14
14
 
15
15
  ## 适用场景
16
16
 
17
- - 中大型存量系统
17
+ - 新系统从 0 到 1 的需求交付
18
+ - 中大型存量系统的长期需求迭代
18
19
  - 多服务或多仓库工程
19
20
  - 需要计划、审查、验证门禁
20
21
  - 希望沉淀可回看、可追踪、可归档的交付过程
21
22
  - 希望把 OpenSpec 和代码交付流程接起来
22
23
 
24
+ 相比快速原型或一次性 demo,它更适合需要规格、计划、实现、自查、审查、验证、归档闭环的工程场景。相比从零开始的新项目,它在存量系统、多服务、多仓库、长期需求迭代场景下优势更明显。
25
+
23
26
  ## 当前能力
24
27
 
25
28
  当前版本已经支持:
@@ -120,7 +123,9 @@ se version # 查看版本
120
123
  python3 scripts/se-setup.py
121
124
  ```
122
125
 
123
- 脚本会依次完成环境检查、安装目标选择、工作区选择、代码目录配置、需求目录配置、工作流模式选择、OpenSpec 初始化确认,并在执行前展示摘要。最终会创建 `workspace.yml`、`openspec/`、`superengineer/<demand_name>/需求.md`,并可选安装 skill 到 Codex / Claude 本机目录。
126
+ 脚本会依次完成环境检查、安装目标选择、工作区选择、代码目录配置、需求目录配置、工作流模式选择、OpenSpec 初始化确认、快捷命令生成,并在执行前展示摘要。最终会创建 `workspace.yml`、`openspec/`、`superengineer/<demand_name>/需求.md`、`.claude/commands/se/*`,并可选安装 skill 到 Codex / Claude 本机目录。
127
+
128
+ 当选择 `openspec` 模式时,`se init` 默认会尝试在工作区根目录执行 `openspec init . --tools codex,claude`。如果本机未安装 OpenSpec CLI,会跳过并给出提示;如果你希望跳过该步骤,可以使用 `--skip-openspec-init`。
124
129
 
125
130
  如果需要非交互初始化:
126
131
 
@@ -112,7 +112,28 @@ python3 scripts/se-setup.py
112
112
  4. 配置代码目录 `code_path` 和当前需求目录名。
113
113
  5. 选择输入模式:`openspec` 或 `todo`。
114
114
  6. 选择是否尝试执行 `openspec init`。
115
- 7. 展示初始化摘要,确认后再真正写入文件。
115
+ 7. 选择是否生成 Claude / Codex 快捷命令。
116
+ 8. 展示初始化摘要,确认后再真正写入文件。
117
+
118
+ 当输入模式为 `openspec` 时,默认会在工作区根目录尝试执行:
119
+
120
+ ```bash
121
+ openspec init . --tools codex,claude
122
+ ```
123
+
124
+ 如果本机没有安装 OpenSpec CLI,会跳过并提示。高级用户可以使用 `--skip-openspec-init` 跳过。
125
+
126
+ 初始化会自动生成工作区 Claude Code 快捷命令:
127
+
128
+ ```text
129
+ ai-workspace/.claude/commands/se/
130
+ ```
131
+
132
+ 如果初始化时选择安装到 Codex,也会同步生成:
133
+
134
+ ```text
135
+ ~/.codex/prompts/se-*.md
136
+ ```
116
137
 
117
138
  如果需要非交互初始化:
118
139
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "super-engineer-workflow",
3
- "version": "0.1.0",
4
- "description": "Super Engineer workflow skill and CLI for legacy-system AI delivery with OpenSpec bridge support.",
3
+ "version": "0.1.2",
4
+ "description": "Super Engineer workflow skill and CLI for demand-driven AI delivery with OpenSpec bridge support.",
5
5
  "license": "MIT",
6
6
  "author": "Gary-Coding",
7
7
  "homepage": "https://github.com/Gary-Coding/super-engineer#readme",
@@ -28,7 +28,9 @@ def main() -> None:
28
28
  help="安装 skill 到本机目录。默认:none",
29
29
  )
30
30
  parser.add_argument("--force-skill", action="store_true", help="安装 skill 时先删除已有目录。")
31
- parser.add_argument("--openspec-init", action="store_true", help="如果安装了 openspec CLI,尝试执行 openspec init。")
31
+ parser.add_argument("--openspec-init", action="store_true", help="如果安装了 openspec CLI,尝试执行 openspec init。openspec 模式默认启用。")
32
+ parser.add_argument("--skip-openspec-init", action="store_true", help="openspec 模式下也跳过 openspec init。")
33
+ parser.add_argument("--skip-commands", action="store_true", help="跳过生成 Claude / Codex 快捷命令。")
32
34
  parser.add_argument("--yes", action="store_true", help="非交互模式,全部使用参数或默认值。")
33
35
  args = parser.parse_args()
34
36
 
@@ -55,7 +57,9 @@ def main() -> None:
55
57
  demand_name=demand_name,
56
58
  source=source,
57
59
  mode=mode,
58
- openspec_init=args.openspec_init,
60
+ openspec_init=should_init_openspec(source, args.openspec_init, args.skip_openspec_init),
61
+ install_target=install,
62
+ skip_commands=args.skip_commands,
59
63
  )
60
64
  print_summary(workspace, demand_name, source, mode)
61
65
 
@@ -73,6 +77,8 @@ def should_prompt(args: argparse.Namespace) -> bool:
73
77
  args.install,
74
78
  args.force_skill,
75
79
  args.openspec_init,
80
+ args.skip_openspec_init,
81
+ args.skip_commands,
76
82
  ]
77
83
  )
78
84
  return not provided and sys.stdin.isatty()
@@ -129,8 +135,10 @@ def prompt_args(args: argparse.Namespace) -> argparse.Namespace:
129
135
  },
130
136
  )
131
137
  print("")
132
- print("Step 6/7 OpenSpec 初始化")
133
- args.openspec_init = prompt_bool("是否尝试执行 openspec init", default=False)
138
+ print("Step 6/7 OpenSpec 初始化与快捷命令")
139
+ args.openspec_init = prompt_bool("是否尝试执行 openspec init", default=True)
140
+ args.skip_openspec_init = not args.openspec_init
141
+ args.skip_commands = not prompt_bool("是否生成 Claude / Codex 快捷命令", default=True)
134
142
  print("")
135
143
  print("Step 7/7 执行前确认")
136
144
  print(f" install: {args.install}")
@@ -141,6 +149,7 @@ def prompt_args(args: argparse.Namespace) -> argparse.Namespace:
141
149
  print(f" source: {args.source}")
142
150
  print(f" mode: {args.mode}")
143
151
  print(f" openspec_init: {args.openspec_init}")
152
+ print(f" skip_commands: {args.skip_commands}")
144
153
  if not prompt_bool("确认开始初始化", default=True):
145
154
  raise SystemExit("已取消初始化。")
146
155
  print("")
@@ -218,6 +227,8 @@ def init_workspace(
218
227
  source: str,
219
228
  mode: str,
220
229
  openspec_init: bool,
230
+ install_target: str,
231
+ skip_commands: bool,
221
232
  ) -> None:
222
233
  (workspace / "docs").mkdir(parents=True, exist_ok=True)
223
234
  (workspace / "openspec" / "changes").mkdir(parents=True, exist_ok=True)
@@ -255,6 +266,16 @@ def init_workspace(
255
266
 
256
267
  if openspec_init:
257
268
  try_init_openspec(workspace)
269
+ if not skip_commands:
270
+ install_workspace_commands(workspace)
271
+ if install_target in ("codex", "both"):
272
+ install_codex_prompts()
273
+
274
+
275
+ def should_init_openspec(source: str, openspec_init: bool, skip_openspec_init: bool) -> bool:
276
+ if skip_openspec_init:
277
+ return False
278
+ return source == "openspec" or openspec_init
258
279
 
259
280
 
260
281
  def build_workspace_yml(code_path: str, demand_name: str, source: str, mode: str) -> str:
@@ -292,8 +313,7 @@ def try_init_openspec(workspace: Path) -> None:
292
313
  if not shutil.which("openspec"):
293
314
  print("openspec_init=skipped:openspec CLI not found")
294
315
  return
295
- config_file = workspace / "openspec" / "config.yaml"
296
- if config_file.exists():
316
+ if openspec_initialized(workspace):
297
317
  print("openspec_init=skipped:already initialized")
298
318
  return
299
319
  result = subprocess.run(
@@ -308,6 +328,163 @@ def try_init_openspec(workspace: Path) -> None:
308
328
  print(f"openspec_init={'ok' if result.returncode == 0 else 'failed'}")
309
329
 
310
330
 
331
+ def openspec_initialized(workspace: Path) -> bool:
332
+ markers = [
333
+ workspace / "openspec" / "config.yaml",
334
+ workspace / ".claude" / "commands" / "opsx" / "propose.md",
335
+ workspace / ".codex" / "skills" / "openspec-propose" / "SKILL.md",
336
+ ]
337
+ return any(path.exists() for path in markers)
338
+
339
+
340
+ SE_COMMANDS: dict[str, str] = {
341
+ "propose.md": """---
342
+ description: Super Engineer:生成或完善 OpenSpec change
343
+ argument-hint: <change-name>
344
+ ---
345
+
346
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
347
+
348
+ 本命令接收到的 OpenSpec change 名称参数是:`$ARGUMENTS`。
349
+
350
+ 如果 `$ARGUMENTS` 为空,先不要执行 `/se:propose`,请直接询问用户:
351
+
352
+ ```text
353
+ 请提供 OpenSpec change 名称,例如:demand-to-venus-api。
354
+ ```
355
+
356
+ 如果 `$ARGUMENTS` 不为空,请执行:
357
+
358
+ ```text
359
+ python3 ~/.claude/skills/super-engineer-workflow/scripts/run-workflow.py route-se --command-text "/se:propose $ARGUMENTS"
360
+ ```
361
+
362
+ 请根据当前 workspace 的 demand_file 生成或完善 OpenSpec change。
363
+ 本命令只能生成或完善 OpenSpec change 文档,严禁执行 /se:bridge,严禁生成或修改 todo.md。
364
+ 不要改代码。
365
+ 过程中请使用中文。
366
+ """,
367
+ "propose-fix.md": """---
368
+ description: Super Engineer:需求补充后修正当前 OpenSpec change
369
+ argument-hint: <change-name>
370
+ ---
371
+
372
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
373
+
374
+ 本命令接收到的 OpenSpec change 名称参数是:`$ARGUMENTS`。
375
+
376
+ 如果 `$ARGUMENTS` 为空,先不要执行 `/se:propose`,请直接询问用户:
377
+
378
+ ```text
379
+ 请提供要修正的 OpenSpec change 名称,例如:demand-to-venus-api。
380
+ ```
381
+
382
+ 如果 `$ARGUMENTS` 不为空,请执行:
383
+
384
+ ```text
385
+ /se:propose $ARGUMENTS
386
+ ```
387
+
388
+ 当前需求有补充,请基于修改后的 demand_file 修正当前 OpenSpec change。
389
+ 不要创建新的 change。
390
+ 不要改代码。
391
+ 过程中请使用中文。
392
+ """,
393
+ "bridge.md": """---
394
+ description: Super Engineer:生成桥接 todo
395
+ ---
396
+
397
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
398
+
399
+ 请执行:
400
+
401
+ ```text
402
+ python3 ~/.claude/skills/super-engineer-workflow/scripts/run-workflow.py route-se --command-text "/se:bridge"
403
+ ```
404
+
405
+ 针对当前 OpenSpec change 生成桥接 todo,并总结待审核项。
406
+ 不要改代码,不要进入实现。
407
+ 过程中请使用中文。
408
+ """,
409
+ "plan.md": """---
410
+ description: Super Engineer:只生成实施计划
411
+ ---
412
+
413
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
414
+
415
+ /se:plan
416
+
417
+ 基于已审核的 todo.md 生成计划。
418
+ 先不要改代码,只总结目标仓库、影响范围、验收标准和主要风险。
419
+ 过程中请使用中文。
420
+ """,
421
+ "apply.md": """---
422
+ description: Super Engineer:审核 todo 后进入交付阶段
423
+ ---
424
+
425
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
426
+
427
+ /se:apply
428
+
429
+ 我已审核当前桥接 todo,可以进入交付阶段。
430
+ 使用当前工作空间。
431
+ 如果没有硬阻塞,自动推进到实现、自查、审查和验证。
432
+ 过程中请使用中文。
433
+ """,
434
+ "archive-check.md": """---
435
+ description: Super Engineer:检查 OpenSpec 归档条件
436
+ ---
437
+
438
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
439
+
440
+ /se:archive-check
441
+
442
+ 检查当前 OpenSpec change 是否满足归档条件。
443
+ 过程中请使用中文。
444
+ """,
445
+ "archive.md": """---
446
+ description: Super Engineer:归档 OpenSpec change
447
+ ---
448
+
449
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
450
+
451
+ /se:archive
452
+
453
+ 仅在 archive_ready=true、merge_mode=safe_merge、spec_conflicts 为空时执行归档。
454
+ 过程中请使用中文。
455
+ """,
456
+ "status.md": """---
457
+ description: Super Engineer:查看当前工作流状态
458
+ ---
459
+
460
+ 请使用 super-engineer-workflow skill 处理下面的 /se:* 工作流命令。
461
+
462
+ /se:status
463
+
464
+ 请检查当前工作流状态,并说明当前阶段、允许的下一步和阻塞项。
465
+ 过程中请使用中文。
466
+ """,
467
+ }
468
+
469
+
470
+ def install_workspace_commands(workspace: Path) -> None:
471
+ command_dir = workspace / ".claude" / "commands" / "se"
472
+ command_dir.mkdir(parents=True, exist_ok=True)
473
+ for name, content in SE_COMMANDS.items():
474
+ (command_dir / name).write_text(content, encoding="utf-8")
475
+ print(f"claude_commands=created:{command_dir}")
476
+
477
+
478
+ def install_codex_prompts() -> None:
479
+ prompt_dir = Path(os.environ.get("CODEX_HOME", "~/.codex")).expanduser() / "prompts"
480
+ prompt_dir.mkdir(parents=True, exist_ok=True)
481
+ for name, content in SE_COMMANDS.items():
482
+ codex_name = f"se-{name}"
483
+ codex_content = content.replace("~/.claude/skills/", "~/.codex/skills/")
484
+ (prompt_dir / codex_name).write_text(codex_content, encoding="utf-8")
485
+ print(f"codex_prompts=created:{prompt_dir}")
486
+
487
+
311
488
  def print_summary(workspace: Path, demand_name: str, source: str, mode: str) -> None:
312
489
  print("")
313
490
  print("初始化完成。")
@@ -44,6 +44,8 @@ def main() -> None:
44
44
  assert_file(workspace / "workspace.yml")
45
45
  assert_file(workspace / "superengineer" / "1-demo" / "需求.md")
46
46
  assert_dir(workspace / "openspec" / "changes")
47
+ assert_file(workspace / ".claude" / "commands" / "se" / "propose.md")
48
+ assert_file(workspace / ".claude" / "commands" / "se" / "bridge.md")
47
49
 
48
50
  legacy = root / "legacy-workspace"
49
51
  legacy.mkdir()