Skip to content

feat: add auto-init Pre-Check for /genesis and /quickstart#4

Open
moyu12-ae wants to merge 1 commit intoHaaaiawd:mainfrom
moyu12-ae:main
Open

feat: add auto-init Pre-Check for /genesis and /quickstart#4
moyu12-ae wants to merge 1 commit intoHaaaiawd:mainfrom
moyu12-ae:main

Conversation

@moyu12-ae
Copy link

@moyu12-ae moyu12-ae commented Mar 21, 2026

Summary

/genesis/quickstart 工作流添加自动初始化能力。

Problem

Trae 环境下的核心问题

在使用 Trae IDE 时存在一个"鸡生蛋、蛋生鸡"的困境:

  1. 现状

    • anws 框架的正常工作依赖于项目根目录存在 AGENTS.md.anws/ 目录结构
    • 用户需要先通过 CLI 执行 anws init 命令来初始化项目
    • 初始化后 anws 才能正常工作
  2. 问题

    • 对于新项目,用户在首次启动时无法直接使用 anws 能力
    • 必须先手动运行 CLI 完成初始化,这一体验与"全自动流程"的承诺相矛盾
    • 在 Trae 环境中,用户期望直接通过对话启动项目,但缺少前置条件导致无法实现
  3. 影响

    • 降低了 AI 工作流的易用性
    • 新用户学习成本增加
    • 与"零配置启动"的现代开发工具理念相悖

Solution

genesis.mdquickstart.md 的工作流开头增加 Pre-Check: 自动初始化 步骤:

自动检测流程

  1. 检测项目状态

    • 检查项目根目录是否存在 AGENTS.md
    • 检查项目根目录是否存在 .anws/ 目录
  2. 状态判断

    • ✅ 有 AGENTS.md 且有 .anws/ → 项目已初始化,直接进入工作流
    • ⚠️AGENTS.md 但无 .anws/ → 异常状态,创建 .anws/ 目录结构
    • ❌ 无 AGENTS.md → 全新项目,执行自动初始化
  3. 自动初始化流程(仅当无 AGENTS.md 时):

    • 创建 .anws/ 目录结构(changelog 和 v1 版本目录)
    • 生成 AGENTS.md 项目锚点文件
    • 创建 .anws/changelog/README.md 变更记录
    • 输出初始化确认信息
  4. 效果
    用户现在可以直接说"我要做一个新项目",anws 会自动检测并完成初始化,然后无缝进入后续工作流,无需任何手动干预。

Files Changed

  • src/anws/templates/.agents/workflows/genesis.md
  • src/anws/templates/.agents/workflows/quickstart.md

- Add Pre-Check step to automatically initialize projects without AGENTS.md
- Eliminates the need for manual 'anws init' CLI call
- Users can now start anws workflows directly without pre-initialization

Changes:
- /genesis: Added auto-detection of AGENTS.md and automatic creation of .anws/ structure
- /quickstart: Added same auto-init logic at entry point

This resolves the 'chicken-and-egg' problem where users needed to know
about anws before being able to use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant