@agile-vibe-coding/avc 0.3.5 → 0.4.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.
@@ -38,16 +38,22 @@ process.on('message', async (msg) => {
38
38
  */
39
39
  function updateStatus(taskId, status) {
40
40
  const projectRoot = process.cwd();
41
- // Find the work.json by walking the hierarchy
42
- // Task ID: context-0001-0001-0001 → path: .avc/project/context-0001/context-0001-0001/context-0001-0001-0001/work.json
43
- const idParts = taskId.replace('context-', '').split('-');
44
- let dir = join(projectRoot, '.avc', 'project');
45
- let current = 'context';
46
- for (const part of idParts) {
47
- current += `-${part}`;
48
- dir = join(dir, current);
41
+ const projectDir = join(projectRoot, '.avc', 'project');
42
+
43
+ // Try flat path first (tasks/subtasks written by seed-processor are flat)
44
+ let workJsonPath = join(projectDir, taskId, 'work.json');
45
+
46
+ // Fall back to nested path (epics/stories are nested)
47
+ if (!existsSync(workJsonPath)) {
48
+ const idParts = taskId.replace('context-', '').split('-');
49
+ let dir = projectDir;
50
+ let current = 'context';
51
+ for (const part of idParts) {
52
+ current += `-${part}`;
53
+ dir = join(dir, current);
54
+ }
55
+ workJsonPath = join(dir, 'work.json');
49
56
  }
50
- const workJsonPath = join(dir, 'work.json');
51
57
 
52
58
  if (existsSync(workJsonPath)) {
53
59
  try {
@@ -59,6 +65,39 @@ function updateStatus(taskId, status) {
59
65
  }
60
66
  }
61
67
 
68
+ /**
69
+ * Auto-complete all subtasks of a task.
70
+ * Subtasks are documentation artifacts — the task's agent loop implements everything.
71
+ */
72
+ function autoCompleteSubtasks(taskId) {
73
+ const projectDir = join(process.cwd(), '.avc', 'project');
74
+
75
+ // Read the task's work.json to get children
76
+ const taskWorkJsonPath = join(projectDir, taskId, 'work.json');
77
+ if (!existsSync(taskWorkJsonPath)) return;
78
+
79
+ try {
80
+ const taskWork = JSON.parse(readFileSync(taskWorkJsonPath, 'utf8'));
81
+ const children = taskWork.children || [];
82
+
83
+ for (const childId of children) {
84
+ // Try flat path first
85
+ let childPath = join(projectDir, childId, 'work.json');
86
+ if (!existsSync(childPath)) continue;
87
+
88
+ try {
89
+ const childWork = JSON.parse(readFileSync(childPath, 'utf8'));
90
+ if (childWork.type === 'subtask' && childWork.status !== 'completed') {
91
+ childWork.status = 'completed';
92
+ childWork.updated = new Date().toISOString();
93
+ childWork.metadata = { ...childWork.metadata, completedBy: taskId };
94
+ writeFileSync(childPath, JSON.stringify(childWork, null, 2), 'utf8');
95
+ }
96
+ } catch {}
97
+ }
98
+ } catch {}
99
+ }
100
+
62
101
  async function run(taskId) {
63
102
  const logger = new CommandLogger('run-task', process.cwd());
64
103
  logger.start();
@@ -87,6 +126,9 @@ async function run(taskId) {
87
126
  } else if (result.success) {
88
127
  // Tests passed — move to review (not completed). Human must approve before merge.
89
128
  updateStatus(taskId, 'implemented');
129
+ // Auto-complete subtasks — they are documentation artifacts, not separate implementation units.
130
+ // The task's agent loop implements everything including subtask ACs.
131
+ autoCompleteSubtasks(taskId);
90
132
  try {
91
133
  process.send({
92
134
  type: 'complete',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-vibe-coding/avc",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Agile Vibe Coding (AVC) - Framework for managing AI agent-based software development projects",
5
5
  "type": "module",
6
6
  "main": "cli/index.js",