@ecc-hgy/ae 0.2.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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/bin/ae.js +2 -0
  4. package/package.json +43 -0
  5. package/skills/brainstorming/SKILL.md +133 -0
  6. package/skills/diagnose/SKILL.md +146 -0
  7. package/skills/diagnose/assets/issue-7-sections.md +35 -0
  8. package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  9. package/skills/grill-me/SKILL.md +10 -0
  10. package/skills/handoff/SKILL.md +19 -0
  11. package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
  12. package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  13. package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
  14. package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
  15. package/skills/improve-codebase-architecture/SKILL.md +101 -0
  16. package/skills/review/SKILL.md +119 -0
  17. package/skills/tdd/SKILL.md +157 -0
  18. package/skills/tdd/deep-modules.md +33 -0
  19. package/skills/tdd/interface-design.md +31 -0
  20. package/skills/tdd/mocking.md +59 -0
  21. package/skills/tdd/refactoring.md +10 -0
  22. package/skills/tdd/tests.md +61 -0
  23. package/skills/to-issues/SKILL.md +79 -0
  24. package/skills/to-issues/todo-template.md +25 -0
  25. package/skills/to-prd/SKILL.md +108 -0
  26. package/skills/verification-before-completion/SKILL.md +153 -0
  27. package/skills/writing-plans/SKILL.md +115 -0
  28. package/skills/zoom-out/SKILL.md +7 -0
  29. package/src/cli.js +62 -0
  30. package/src/commands/init.js +190 -0
  31. package/src/commands/setup.js +111 -0
  32. package/src/skeleton.js +209 -0
  33. package/src/utils/copy.js +100 -0
  34. package/src/utils/paths.js +60 -0
  35. package/src/utils/report.js +31 -0
  36. package/templates/ae-rules.md +17 -0
  37. package/templates/entries/AGENTS.md +21 -0
  38. package/templates/entries/CLAUDE.md +21 -0
  39. package/templates/entries/README.md +18 -0
  40. package/templates/entries/handoff.md +1 -0
  41. package/templates/entries/spec/INDEX.md +15 -0
  42. package/templates/entries/spec/README.md +19 -0
@@ -0,0 +1,60 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { access } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ let cachedPackageRoot;
7
+
8
+ export async function packageRootAsync() {
9
+ if (cachedPackageRoot) {
10
+ return cachedPackageRoot;
11
+ }
12
+
13
+ let current = path.dirname(fileURLToPath(import.meta.url));
14
+ while (true) {
15
+ const candidate = path.join(current, 'package.json');
16
+ try {
17
+ await access(candidate);
18
+ cachedPackageRoot = current;
19
+ return cachedPackageRoot;
20
+ } catch {
21
+ const parent = path.dirname(current);
22
+ if (parent === current) {
23
+ throw new Error('Could not find package.json from current module path.');
24
+ }
25
+ current = parent;
26
+ }
27
+ }
28
+ }
29
+
30
+ export function packageRoot() {
31
+ if (cachedPackageRoot) {
32
+ return cachedPackageRoot;
33
+ }
34
+
35
+ let current = path.dirname(fileURLToPath(import.meta.url));
36
+ while (true) {
37
+ if (existsSync(path.join(current, 'package.json'))) {
38
+ cachedPackageRoot = current;
39
+ return cachedPackageRoot;
40
+ }
41
+
42
+ const parent = path.dirname(current);
43
+ if (parent === current) {
44
+ throw new Error('Could not find package.json from current module path.');
45
+ }
46
+ current = parent;
47
+ }
48
+ }
49
+
50
+ export function assetPath(name) {
51
+ return path.join(packageRoot(), name);
52
+ }
53
+
54
+ export function skillsPath() {
55
+ return path.join(packageRoot(), 'skills');
56
+ }
57
+
58
+ export function templatesPath(subdir = '') {
59
+ return path.join(packageRoot(), 'templates', subdir);
60
+ }
@@ -0,0 +1,31 @@
1
+ export function formatSetupReport({ created, skipped, target, dryRun }) {
2
+ const installedLabel = dryRun ? 'Would install' : 'Installed';
3
+ return [
4
+ dryRun ? 'AE setup dry run complete' : 'AE setup complete',
5
+ `- ${installedLabel}: ${created.length} (${summarize(created)})`,
6
+ `- Skipped: ${skipped.length} (${summarize(skipped)})`,
7
+ `- Target: ${target}`,
8
+ `- Next: edit config/ae-rules.md (optional), then run \`ae init "<goal>"\`.`,
9
+ ].join('\n');
10
+ }
11
+
12
+ export function formatInitReport({ created, skipped, target, rules, dryRun }) {
13
+ const createdLabel = dryRun ? 'Would create' : 'Created';
14
+ return [
15
+ dryRun ? 'AE init dry run complete' : 'AE init complete',
16
+ `- ${createdLabel}: ${created.length} (${summarize(created)})`,
17
+ `- Skipped: ${skipped.length} (${summarize(skipped)})`,
18
+ `- Rules: ${rules}`,
19
+ `- Target: ${target}`,
20
+ ].join('\n');
21
+ }
22
+
23
+ function summarize(paths) {
24
+ if (paths.length === 0) {
25
+ return 'none';
26
+ }
27
+ if (paths.length <= 8) {
28
+ return paths.join(', ');
29
+ }
30
+ return `${paths.slice(0, 8).join(', ')}, ...`;
31
+ }
@@ -0,0 +1,17 @@
1
+ # Project-Specific Rules
2
+
3
+ <!-- 这个文件在 `ae init` 时会被读取,内容会注入到 AGENTS.md 与 CLAUDE.md 的
4
+ AE:RULES block 中。可以在 `ae setup` 之后、`ae init` 之前编辑。 -->
5
+
6
+ ## 通用约束
7
+
8
+ - 例如:所有代码注释使用中文
9
+ - 例如:提交信息遵循 Conventional Commits
10
+
11
+ ## 项目栈
12
+
13
+ - 例如:Node.js 18+,TypeScript strict mode
14
+
15
+ ## 协作偏好
16
+
17
+ - 例如:小步提交,每个 commit 必须包含测试
@@ -0,0 +1,21 @@
1
+ # Project Goal
2
+
3
+ {{PROJECT_GOAL}}
4
+
5
+ ## R1 Progressive Loading
6
+
7
+ Keep this file short because every agent session loads it. Do trivial work directly. For non-trivial product, architecture, implementation, or debug work, first load the relevant local guidance or skill, then proceed.
8
+
9
+ ## Spec Landing Rules
10
+
11
+ - SDD owns what to build; TDD owns how to prove it works.
12
+ - After writing or changing anything under `spec/needs/<need-name>/`, update `spec/INDEX.md`.
13
+ - If `spec/INDEX.md` cannot be updated confidently, run the future `index-rebuild` command or leave an explicit handoff note.
14
+ - Do not write `prd.md` before requirement alignment.
15
+ - Do not fix a bug before expected behavior is aligned.
16
+
17
+ ## Project Specific Rules
18
+
19
+ <!-- AE:PROJECT:BEGIN -->
20
+ <!-- Add project-specific rules here. `ae init` manages AE:RULES separately. -->
21
+ <!-- AE:PROJECT:END -->
@@ -0,0 +1,21 @@
1
+ # Project Goal
2
+
3
+ {{PROJECT_GOAL}}
4
+
5
+ ## R1 Progressive Loading
6
+
7
+ Keep this file short because every agent session loads it. Do trivial work directly. For non-trivial product, architecture, implementation, or debug work, first load the relevant local guidance or skill, then proceed.
8
+
9
+ ## Spec Landing Rules
10
+
11
+ - SDD owns what to build; TDD owns how to prove it works.
12
+ - After writing or changing anything under `spec/needs/<need-name>/`, update `spec/INDEX.md`.
13
+ - If `spec/INDEX.md` cannot be updated confidently, run the future `index-rebuild` command or leave an explicit handoff note.
14
+ - Do not write `prd.md` before requirement alignment.
15
+ - Do not fix a bug before expected behavior is aligned.
16
+
17
+ ## Project Specific Rules
18
+
19
+ <!-- AE:PROJECT:BEGIN -->
20
+ <!-- Add project-specific rules here. `ae init` manages AE:RULES separately. -->
21
+ <!-- AE:PROJECT:END -->
@@ -0,0 +1,18 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ {{PROJECT_GOAL}}
4
+
5
+ ## Setup
6
+
7
+ TODO: 记录安装和启动方式。
8
+
9
+ ## Usage
10
+
11
+ TODO: 记录常用操作。
12
+
13
+ ## Project Map
14
+
15
+ - `reference/`: 原始素材,只读心态。
16
+ - `spec/`: SDD/TDD 规格产物。
17
+ - `data/`: 运行产物、导出和缓存。
18
+ - `scripts/`: 辅助脚本。
@@ -0,0 +1 @@
1
+ <!-- 跨会话/跨项目进展交接,由 handoff skill 在会话结束时人工触发更新。 -->
@@ -0,0 +1,15 @@
1
+ # spec 索引
2
+
3
+ ## 需求
4
+
5
+ | 需求名 | prd | design | todo | issues | 当前节点 |
6
+ |--------|-----|--------|------|--------|----------|
7
+
8
+ ## ADR
9
+
10
+ | 编号 | 标题 | 状态 | 日期 |
11
+ |------|------|------|------|
12
+
13
+ ## 跨需求引用
14
+
15
+ - 暂无
@@ -0,0 +1,19 @@
1
+ # Spec Map
2
+
3
+ ## Needs
4
+
5
+ ```text
6
+ TODO: 用 ASCII 图画出需求地图。
7
+ ```
8
+
9
+ ## Main Flow
10
+
11
+ ```text
12
+ TODO: 用 ASCII 图画出核心业务流程。
13
+ ```
14
+
15
+ ## Relationships
16
+
17
+ ```text
18
+ TODO: 按需记录需求间依赖或触发关系。
19
+ ```