aitable-workflow-cli 0.1.28 → 0.1.29-beta.1790736949347

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 (60) hide show
  1. package/dist/assistant/assets/index-BA6il19d.css +1 -0
  2. package/dist/assistant/assets/{index-B3LvYfRW.js → index-BMzAOp70.js} +31 -31
  3. package/dist/assistant/index.html +2 -2
  4. package/dist/chunk-BBP5RVFU.js +15 -0
  5. package/dist/cli.js +180 -73
  6. package/dist/{config-ui-server-4SVD42Z3.js → config-ui-server-UWELHUH4.js} +1 -1
  7. package/dist/web/assets/index-Bnmnydwk.css +1 -0
  8. package/dist/web/assets/index-Dbs1xWB9.js +331 -0
  9. package/dist/web/index.html +2 -2
  10. package/dist/web/install.ps1 +173 -0
  11. package/dist/web/install.sh +188 -0
  12. package/package.json +3 -3
  13. package/templates/ai-native-sdlc/.env.example +11 -0
  14. package/templates/ai-native-sdlc/aitable-workflow.config.yml +47 -0
  15. package/templates/ai-native-sdlc/coding-agents.config.json +17 -0
  16. package/templates/ai-native-sdlc/docs/plans/2026-09-15-ai-native-sdlc-dual-staff-implementation-plan.md +150 -0
  17. package/templates/ai-native-sdlc/docs/plans/2026-09-15-ai-native-sdlc-dual-staff.md +213 -0
  18. package/templates/ai-native-sdlc/docs/plans/2026-09-16-domain-role-notification-routing.md +36 -0
  19. package/templates/ai-native-sdlc/docs/plans/2026-09-16-execution-resume-and-cr-loop.md +29 -0
  20. package/templates/ai-native-sdlc/docs/plans/2026-09-16-project-handoff.md +148 -0
  21. package/templates/ai-native-sdlc/docs/plans/2026-09-17-prd-code-context-and-readable-prompts.md +37 -0
  22. package/templates/ai-native-sdlc/docs/plans/2026-09-21-plan-merge-sync-and-agent-source.md +19 -0
  23. package/templates/ai-native-sdlc/docs/plans/2026-09-21-sdlc-base-ref-and-review-notification.md +18 -0
  24. package/templates/ai-native-sdlc/docs/plans/2026-09-29-borrow-from-joe-design.md +943 -0
  25. package/templates/ai-native-sdlc/lib/artifacts.ts +126 -0
  26. package/templates/ai-native-sdlc/lib/recipe-config.ts +34 -0
  27. package/templates/ai-native-sdlc/lib/recipe-helpers.ts +595 -0
  28. package/templates/ai-native-sdlc/npmrc +1 -0
  29. package/templates/ai-native-sdlc/package.json +19 -0
  30. package/templates/ai-native-sdlc/profile/profile.yml +115 -0
  31. package/templates/ai-native-sdlc/setup/module-config.seed.json +37 -0
  32. package/templates/ai-native-sdlc/test/artifacts.test.ts +72 -0
  33. package/templates/ai-native-sdlc/test/recipe-helpers.test.ts +931 -0
  34. package/templates/ai-native-sdlc/tsconfig.json +17 -0
  35. package/templates/ai-native-sdlc/workflows/.gitkeep +3 -0
  36. package/templates/ai-native-sdlc/workflows/execution/automations/blocked-questions-dev.json +91 -0
  37. package/templates/ai-native-sdlc/workflows/execution/automations/blocked-questions.json +91 -0
  38. package/templates/ai-native-sdlc/workflows/execution/automations/cr-review-dev.json +80 -0
  39. package/templates/ai-native-sdlc/workflows/execution/automations/cr-review.json +81 -0
  40. package/templates/ai-native-sdlc/workflows/execution/automations/resume-answers.json +42 -0
  41. package/templates/ai-native-sdlc/workflows/execution/automations/spec-review-dev.json +138 -0
  42. package/templates/ai-native-sdlc/workflows/execution/recipes/coding.recipe.ts +161 -0
  43. package/templates/ai-native-sdlc/workflows/execution/recipes/prd-review.recipe.ts +200 -0
  44. package/templates/ai-native-sdlc/workflows/execution/recipes/prd.recipe.ts +163 -0
  45. package/templates/ai-native-sdlc/workflows/execution/recipes/review.recipe.ts +257 -0
  46. package/templates/ai-native-sdlc/workflows/execution/recipes/spec-review.recipe.ts +242 -0
  47. package/templates/ai-native-sdlc/workflows/execution/recipes/spec.recipe.ts +173 -0
  48. package/templates/ai-native-sdlc/workflows/execution/workflow.yml +79 -0
  49. package/templates/ai-native-sdlc/workflows/intake/automations/accept-intake.json +101 -0
  50. package/templates/ai-native-sdlc/workflows/intake/recipes/classify-module.recipe.ts +133 -0
  51. package/templates/ai-native-sdlc/workflows/intake/recipes/create-change.recipe.ts +94 -0
  52. package/templates/ai-native-sdlc/workflows/intake/recipes/mechanical-deduplicate.recipe.ts +33 -0
  53. package/templates/ai-native-sdlc/workflows/intake/workflow.yml +62 -0
  54. package/templates/ai-native-sdlc/workspaces/dev/AGENTS.md +69 -0
  55. package/templates/ai-native-sdlc/workspaces/pm/AGENTS.md +48 -0
  56. package/templates/ai-native-sdlc/workspaces/reviewer/AGENTS.md +79 -0
  57. package/dist/assistant/assets/index-CCEHOkkJ.css +0 -1
  58. package/dist/chunk-YDJTCQW4.js +0 -15
  59. package/dist/web/assets/index-DPc2WOdp.css +0 -1
  60. package/dist/web/assets/index-HTw8K38o.js +0 -332
@@ -0,0 +1,126 @@
1
+ /**
2
+ * 变更工件的路径与命名只在这里定义一次。
3
+ * 各阶段 recipe 通过这些函数拼装 prompt 指引、产出物标注与 CR 描述,
4
+ * 需要调整产物名称或目录结构时只改本文件。
5
+ */
6
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
7
+ import path from "node:path";
8
+
9
+ export type ArtifactStage = "prd" | "spec" | "coding" | "review";
10
+
11
+ const ARTIFACT_FILES: Record<ArtifactStage, string> = {
12
+ prd: "01-prd.md",
13
+ spec: "02-spec.md",
14
+ coding: "03-coding.md",
15
+ review: "04-review.md",
16
+ };
17
+
18
+ /** 变更工件的登记表,键为工件文件名。 */
19
+ export type ArtifactManifest = Record<string, { summary: string }>;
20
+
21
+ const MANIFEST_FILE = ".artifacts.json";
22
+
23
+ /** Agent 未自写概要时的兜底登记,避免工件存在却漏登记。 */
24
+ const ARTIFACT_SUMMARIES: Record<ArtifactStage, string> = {
25
+ prd: "PRD:需求、验收标准与依赖,供 Dev 制定实施计划",
26
+ spec: "技术方案:选中/未选中仓库及理由、改动文件、风险与测试命令",
27
+ coding: "编码工件:各仓库改动、真实测试命令与输出、CI 证据",
28
+ review: "评审结论:真实测试与 CI 证据、CR 评论处理结果",
29
+ };
30
+
31
+ /** 变更工件目录相对仓库根,如 `changes/CHG-xxx`。 */
32
+ export function changeDir(id: string): string {
33
+ return `changes/${id}`;
34
+ }
35
+
36
+ /** 阶段工件文件名,如 `01-prd.md`;用于「产出物」标注。 */
37
+ export function artifactName(stage: ArtifactStage): string {
38
+ return ARTIFACT_FILES[stage];
39
+ }
40
+
41
+ /** 阶段工件相对仓库根的路径,如 `changes/CHG-xxx/01-prd.md`;用于 prompt 指引与 CR 描述。 */
42
+ export function artifactPath(stage: ArtifactStage, id: string): string {
43
+ return `${changeDir(id)}/${ARTIFACT_FILES[stage]}`;
44
+ }
45
+
46
+ /** 阶段工件在某 worktree 内的绝对路径,如 `<worktree>/changes/CHG-xxx/01-prd.md`。 */
47
+ export function artifactAbsPath(
48
+ stage: ArtifactStage,
49
+ worktreeDir: string,
50
+ id: string,
51
+ ): string {
52
+ return `${worktreeDir}/${artifactPath(stage, id)}`;
53
+ }
54
+
55
+ /**
56
+ * git.ensureWorktree 返回的 dir 自 2026-09-24 路径归一重构后是「项目根相对路径」
57
+ * (见 packages/core/src/toolkit/git/git-adapter.ts 的 relativeDir,为跨机器可移植而设计)。
58
+ * 裸 fs 读写按 process.cwd() 解析(≠ 项目根),coding agent 的 cwd 是角色工作区(也≠ 项目根),
59
+ * 两者都需要真实绝对路径才能命中同一份文件;`git.*` / `coding.run` toolkit 自己会按项目根
60
+ * 再解析一次,不需要这层转换,只有直接拼路径的场景(fs 读写 + prompt 文本)必须先用本函数换算。
61
+ */
62
+ export function resolveWorktreeDir(configDir: string, dir: string): string {
63
+ return path.resolve(configDir, dir);
64
+ }
65
+
66
+ /** manifest 相对仓库根的路径,如 `changes/CHG-xxx/.artifacts.json`。 */
67
+ export function manifestPath(id: string): string {
68
+ return `${changeDir(id)}/${MANIFEST_FILE}`;
69
+ }
70
+
71
+ /** manifest 在某 worktree 内的绝对路径。 */
72
+ export function manifestAbsPath(worktreeDir: string, id: string): string {
73
+ return `${worktreeDir}/${manifestPath(id)}`;
74
+ }
75
+
76
+ /** 读取登记表;文件缺失或内容不是合法登记表时返回空表,不抛错。 */
77
+ export function readArtifactManifest(
78
+ worktreeDir: string,
79
+ id: string,
80
+ ): ArtifactManifest {
81
+ const absPath = manifestAbsPath(worktreeDir, id);
82
+ if (!existsSync(absPath)) return {};
83
+ try {
84
+ const parsed: unknown = JSON.parse(readFileSync(absPath, "utf8"));
85
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
86
+ return Object.fromEntries(
87
+ Object.entries(parsed).filter(
88
+ (entry): entry is [string, { summary: string }] => {
89
+ const value = entry[1] as { summary?: unknown } | null;
90
+ return typeof value?.summary === "string";
91
+ },
92
+ ),
93
+ );
94
+ } catch {
95
+ return {};
96
+ }
97
+ }
98
+
99
+ /**
100
+ * 兜底登记:Agent 已自写概要时保留原文,只在工件存在而条目缺失时补写兜底概要。
101
+ * 工件不存在(未选中仓库)不登记,否则下游会把未产出的仓库当成已产出。
102
+ */
103
+ export function ensureArtifactManifest(
104
+ worktreeDir: string,
105
+ id: string,
106
+ stage: ArtifactStage,
107
+ ): boolean {
108
+ if (!existsSync(artifactAbsPath(stage, worktreeDir, id))) return false;
109
+ const manifest = readArtifactManifest(worktreeDir, id);
110
+ const name = artifactName(stage);
111
+ if (manifest[name]) return false;
112
+ manifest[name] = { summary: ARTIFACT_SUMMARIES[stage] };
113
+ writeFileSync(
114
+ manifestAbsPath(worktreeDir, id),
115
+ `${JSON.stringify(manifest, null, 2)}\n`,
116
+ "utf8",
117
+ );
118
+ return true;
119
+ }
120
+
121
+ /** 阶段专用分支名;当前仅技术方案评审需要独立分支。 */
122
+ export function stageBranchName(stage: ArtifactStage, id: string): string {
123
+ const filename = artifactName(stage);
124
+ const suffix = filename.replace(/\.md$/, "").replace(/^0/, "");
125
+ return `${id}-${suffix}`;
126
+ }
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+
3
+ const repositoryCommandConfig = z.object({
4
+ bin: z.string().min(1),
5
+ args: z.array(z.string()),
6
+ timeout_ms: z.number().int().positive().optional(),
7
+ }).strict();
8
+
9
+ /** 仓库只在 profile YAML anchor 中定义一次,steps 通过 alias 获得此完整结构。 */
10
+ export const repositoryConfig = z.object({
11
+ url: z.string().min(1),
12
+ default_branch: z.string().min(1).optional(),
13
+ commands: z.array(repositoryCommandConfig).optional(),
14
+ }).strict();
15
+
16
+ export type RepositoryConfig = z.infer<typeof repositoryConfig>;
17
+
18
+ export const pmStageConfig = z.object({
19
+ pm_repository: repositoryConfig,
20
+ });
21
+
22
+ /** PRD 需要理解当前业务逻辑,但业务仓库不是 PM 的工件写入目标。 */
23
+ export const prdStageConfig = pmStageConfig.extend({
24
+ business_repositories: z.array(repositoryConfig).min(1),
25
+ });
26
+
27
+ export const devStageConfig = z.object({
28
+ dev_repositories: z.array(repositoryConfig).min(1),
29
+ });
30
+
31
+ /** 技术方案阶段还需读取 PM 仓库 worktree 中已合并的 PRD。 */
32
+ export const planStageConfig = devStageConfig.extend({
33
+ pm_repository: repositoryConfig,
34
+ });