@uoyo/mvtt 2.0.0-beta.2 → 2.0.0-beta.3
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/README.md +1 -11
- package/dist/build/section-loader.d.ts.map +1 -1
- package/dist/build/section-loader.js +18 -8
- package/dist/build/section-loader.js.map +1 -1
- package/dist/fs/materialize.d.ts.map +1 -1
- package/dist/fs/materialize.js +5 -0
- package/dist/fs/materialize.js.map +1 -1
- package/dist/scripts/session-update.cjs +7568 -0
- package/install-manifest.yaml +2 -0
- package/package.json +3 -2
- package/sources/defaults/config.yaml +7 -7
- package/sources/defaults/session.yaml +9 -16
- package/sources/scripts/session-update.js +351 -0
- package/sources/sections/activation-load-context.md +4 -0
- package/sources/sections/footer-next-steps.md +1 -1
- package/sources/sections/session-update.md +100 -32
- package/sources/skills/mvt-analyze/manifest.yaml +1 -0
- package/sources/skills/mvt-analyze-code/manifest.yaml +18 -4
- package/sources/skills/mvt-bug-detect/business.md +99 -101
- package/sources/skills/mvt-bug-detect/manifest.yaml +84 -84
- package/sources/skills/mvt-check-context/business.md +3 -5
- package/sources/skills/mvt-check-context/manifest.yaml +15 -8
- package/sources/skills/mvt-cleanup/business.md +49 -23
- package/sources/skills/mvt-cleanup/manifest.yaml +15 -10
- package/sources/skills/mvt-config/business.md +1 -2
- package/sources/skills/mvt-config/manifest.yaml +11 -4
- package/sources/skills/mvt-create-skill/business.md +6 -5
- package/sources/skills/mvt-create-skill/manifest.yaml +27 -11
- package/sources/skills/mvt-design/business.md +3 -6
- package/sources/skills/mvt-design/manifest.yaml +14 -1
- package/sources/skills/mvt-fix/business.md +2 -1
- package/sources/skills/mvt-fix/manifest.yaml +6 -3
- package/sources/skills/mvt-help/business.md +2 -4
- package/sources/skills/mvt-help/manifest.yaml +13 -5
- package/sources/skills/mvt-implement/business.md +4 -5
- package/sources/skills/mvt-implement/manifest.yaml +13 -0
- package/sources/skills/mvt-init/business.md +2 -2
- package/sources/skills/mvt-init/manifest.yaml +1 -0
- package/sources/skills/mvt-manage-context/business.md +11 -0
- package/sources/skills/mvt-manage-context/manifest.yaml +14 -3
- package/sources/skills/mvt-plan-dev/business.md +101 -20
- package/sources/skills/mvt-plan-dev/manifest.yaml +18 -19
- package/sources/skills/mvt-quick-dev/business.md +2 -1
- package/sources/skills/mvt-quick-dev/manifest.yaml +21 -6
- package/sources/skills/mvt-refactor/business.md +2 -1
- package/sources/skills/mvt-refactor/manifest.yaml +21 -3
- package/sources/skills/mvt-resume/business.md +28 -68
- package/sources/skills/mvt-resume/manifest.yaml +17 -7
- package/sources/skills/mvt-review/business.md +3 -3
- package/sources/skills/mvt-review/manifest.yaml +22 -1
- package/sources/skills/mvt-status/business.md +14 -18
- package/sources/skills/mvt-status/manifest.yaml +11 -3
- package/sources/skills/mvt-sync-context/business.md +14 -9
- package/sources/skills/mvt-sync-context/manifest.yaml +3 -0
- package/sources/skills/mvt-template/business.md +0 -2
- package/sources/skills/mvt-template/manifest.yaml +13 -8
- package/sources/skills/mvt-test/business.md +3 -3
- package/sources/skills/mvt-test/manifest.yaml +14 -1
- package/sources/skills/mvt-update-plan/business.md +14 -3
- package/sources/skills/mvt-update-plan/manifest.yaml +11 -19
- package/dist/build/plan-validator.d.ts +0 -26
- package/dist/build/plan-validator.d.ts.map +0 -1
- package/dist/build/plan-validator.js +0 -225
- package/dist/build/plan-validator.js.map +0 -1
- package/dist/commands/build.d.ts +0 -5
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -46
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/migrate.d.ts +0 -16
- package/dist/commands/migrate.d.ts.map +0 -1
- package/dist/commands/migrate.js +0 -118
- package/dist/commands/migrate.js.map +0 -1
|
@@ -27,10 +27,10 @@ sections:
|
|
|
27
27
|
- rule: "User selects \"export\" -> Output template to specified location"
|
|
28
28
|
- rule: "Custom template must preserve frontmatter format"
|
|
29
29
|
boundaries:
|
|
30
|
-
- scope: "modify default templates in `_templates/` root"
|
|
31
|
-
skill: "(
|
|
32
|
-
- scope: "modify skill logic"
|
|
33
|
-
skill: "(
|
|
30
|
+
- scope: "modify default templates in `_templates/` root (only create/modify in `custom/`)"
|
|
31
|
+
skill: "(constraint)"
|
|
32
|
+
- scope: "modify skill logic (only change output formatting)"
|
|
33
|
+
skill: "(constraint)"
|
|
34
34
|
|
|
35
35
|
- type: shared
|
|
36
36
|
source: sections/activation-load-context.md
|
|
@@ -41,12 +41,9 @@ sections:
|
|
|
41
41
|
- type: shared
|
|
42
42
|
source: sections/activation-load-config.md
|
|
43
43
|
|
|
44
|
-
- type: shared
|
|
45
|
-
source: sections/output-language-constraint.md
|
|
46
|
-
|
|
47
44
|
- type: inline
|
|
48
45
|
content: |
|
|
49
|
-
### Step
|
|
46
|
+
### Step 4: Pre-flight Checks
|
|
50
47
|
- No blocking checks required.
|
|
51
48
|
|
|
52
49
|
- type: file
|
|
@@ -61,3 +58,11 @@ sections:
|
|
|
61
58
|
source: sections/footer-next-steps.md
|
|
62
59
|
params:
|
|
63
60
|
current_skill: mvt-template
|
|
61
|
+
conditional_suggestions:
|
|
62
|
+
conditions:
|
|
63
|
+
- condition: "template customized"
|
|
64
|
+
primary: mvt-status
|
|
65
|
+
primary_desc: "Check project status"
|
|
66
|
+
- condition: "template reset to default"
|
|
67
|
+
primary: mvt-help
|
|
68
|
+
primary_desc: "Review available skills and templates"
|
|
@@ -76,8 +76,7 @@
|
|
|
76
76
|
- Record each finding with: scenario id, expected vs observed, severity (Critical / Warning), and recommend `/mvt-fix`.
|
|
77
77
|
|
|
78
78
|
### Step 9: Write Artifact
|
|
79
|
-
- **Path**:
|
|
80
|
-
- **Template**: `.ai-agents/skills/_templates/test-output.md` (custom override at `_templates/custom/...` takes precedence).
|
|
79
|
+
- **Path and template**: as defined in the **Artifact Structure** section below.
|
|
81
80
|
- **Required content** (mapped to template headings):
|
|
82
81
|
- `Scope` -- target files, fallbacks applied.
|
|
83
82
|
- `Test Framework & Layout` -- chosen framework, file layout convention.
|
|
@@ -89,7 +88,8 @@
|
|
|
89
88
|
- `Suggested Run Commands` -- one or two commands the user can copy-paste.
|
|
90
89
|
- The actual test files go to the project tree; the artifact is a record.
|
|
91
90
|
|
|
92
|
-
### Step 10:
|
|
91
|
+
### Step 10: State Update
|
|
92
|
+
Apply the State Update rules defined in the **State Update** section below.
|
|
93
93
|
|
|
94
94
|
## Edge Cases & Errors
|
|
95
95
|
|
|
@@ -66,7 +66,7 @@ sections:
|
|
|
66
66
|
level: "WARN"
|
|
67
67
|
message: "Session not initialized. Run `/mvt-init` first."
|
|
68
68
|
- order: "2"
|
|
69
|
-
field: "
|
|
69
|
+
field: "implementation files (user args, implementation.md, or source tree)"
|
|
70
70
|
level: "WARN"
|
|
71
71
|
message: "No implementation found. Run `/mvt-implement` first."
|
|
72
72
|
|
|
@@ -95,8 +95,21 @@ sections:
|
|
|
95
95
|
|
|
96
96
|
- type: shared
|
|
97
97
|
source: sections/session-update.md
|
|
98
|
+
params:
|
|
99
|
+
current_skill: mvt-test
|
|
98
100
|
|
|
99
101
|
- type: shared
|
|
100
102
|
source: sections/footer-next-steps.md
|
|
101
103
|
params:
|
|
102
104
|
current_skill: mvt-test
|
|
105
|
+
conditional_suggestions:
|
|
106
|
+
conditions:
|
|
107
|
+
- condition: "tests pass, implementation verified"
|
|
108
|
+
primary: mvt-review
|
|
109
|
+
primary_desc: "Final code review before merge"
|
|
110
|
+
- condition: "tests reveal bugs"
|
|
111
|
+
primary: mvt-fix
|
|
112
|
+
primary_desc: "Fix the issues found during testing"
|
|
113
|
+
- condition: "plan exists with remaining tasks"
|
|
114
|
+
primary: mvt-update-plan
|
|
115
|
+
primary_desc: "Mark current task done and advance to next"
|
|
@@ -54,10 +54,10 @@ If the selected next task is currently `pending` -> promote it to `in_progress`
|
|
|
54
54
|
|
|
55
55
|
### Step 6: Update Session State
|
|
56
56
|
|
|
57
|
-
Apply the
|
|
57
|
+
Apply the State Update rules defined in the **State Update** section below, AND the update-plan-specific updates:
|
|
58
58
|
|
|
59
|
-
- Refresh the matching entry in `
|
|
60
|
-
- Do NOT touch `active_change.
|
|
59
|
+
- Refresh the matching entry in `changes[]`: `updated_at` -> current ISO 8601 timestamp.
|
|
60
|
+
- Do NOT touch `active_change.plan_path`.
|
|
61
61
|
|
|
62
62
|
### Step 7: Output
|
|
63
63
|
|
|
@@ -70,3 +70,14 @@ Emit the Plan Update summary block defined in the Output Format section. Include
|
|
|
70
70
|
- If a new `current_task` is set -> recommend the skill matching its `skill_hint`.
|
|
71
71
|
- If plan complete -> recommend `/mvt-cleanup` or starting a new change via `/mvt-analyze`.
|
|
72
72
|
- If all remaining tasks are blocked -> recommend resolving the blocker (point at the `notes` of the blocked task).
|
|
73
|
+
|
|
74
|
+
## Edge Cases & Errors
|
|
75
|
+
|
|
76
|
+
| Case | Handling |
|
|
77
|
+
|------|----------|
|
|
78
|
+
| `plan.yaml` not found at `active_change.plan_path` | Abort with error: "No plan found. Run `/mvt-plan-dev` to create one." |
|
|
79
|
+
| Task id provided does not exist in `plan.yaml` | Abort with error listing valid task ids |
|
|
80
|
+
| Transition to `done` but `depends_on` tasks are not all `done` | Warn but allow: "Task marked done despite unfinished dependencies — verify correctness" |
|
|
81
|
+
| All tasks are `done` but user marks another as `in_progress` | Reject: plan is already complete; suggest creating a new change |
|
|
82
|
+
| Circular dependency detected in `depends_on` | Report the cycle and refuse to auto-advance `current_task`; suggest manual fix |
|
|
83
|
+
| `plan.yaml` write fails (permission denied, invalid YAML state) | Abort; do not update session; report the write error |
|
|
@@ -24,7 +24,7 @@ sections:
|
|
|
24
24
|
- rule: "Task id missing AND only one task is in_progress -> Default to that task"
|
|
25
25
|
- rule: "Target status would create an invalid current_task -> Recompute current_task automatically"
|
|
26
26
|
- rule: "All tasks become done -> Set plan.status = done, current_task = null"
|
|
27
|
-
- rule: "active_change.
|
|
27
|
+
- rule: "active_change.plan_path is empty -> Stop and suggest /mvt-plan-dev"
|
|
28
28
|
|
|
29
29
|
boundaries:
|
|
30
30
|
- scope: "create new tasks or restructure the plan"
|
|
@@ -55,16 +55,17 @@ sections:
|
|
|
55
55
|
level: "WARN"
|
|
56
56
|
message: 'Session not initialized. Run `/mvt-init` first.'
|
|
57
57
|
- order: "2"
|
|
58
|
-
field: "active_change.
|
|
58
|
+
field: "active_change.plan_path"
|
|
59
59
|
level: "BLOCK"
|
|
60
|
-
message: 'No active plan. Run `/mvt-plan-dev` to create one
|
|
60
|
+
message: 'No active plan. Run `/mvt-plan-dev` to create one.'
|
|
61
61
|
|
|
62
62
|
- type: inline
|
|
63
63
|
content: |
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
64
|
+
## Operation Mode: Shortcut
|
|
65
|
+
|
|
66
|
+
This skill operates as a shortcut — it can execute at any time when an active plan exists.
|
|
67
|
+
- Performs surgical edits only — never overwrites the whole plan structure.
|
|
68
|
+
- Re-validates the resulting plan before writing; aborts on validation failure.
|
|
68
69
|
|
|
69
70
|
- type: file
|
|
70
71
|
source: ./business.md
|
|
@@ -100,18 +101,9 @@ sections:
|
|
|
100
101
|
|
|
101
102
|
- type: shared
|
|
102
103
|
source: sections/session-update.md
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Update-Plan Specific State Updates
|
|
107
|
-
|
|
108
|
-
In addition to the mandatory updates above, this skill MUST refresh `recent_changes` for the active change:
|
|
109
|
-
|
|
110
|
-
- Find the entry where `id == active_change.id`. If absent, append one (this should be rare; happens when the plan was created out-of-band).
|
|
111
|
-
- Set `last_updated` to the current ISO 8601 timestamp.
|
|
112
|
-
- Trim to max 5 entries (drop the oldest by `last_updated` ascending).
|
|
113
|
-
|
|
114
|
-
Do NOT modify `active_change.has_plan` or `active_change.plan_path` here -- those are owned by `/mvt-plan-dev`.
|
|
104
|
+
params:
|
|
105
|
+
current_skill: mvt-update-plan
|
|
106
|
+
update_change: true
|
|
115
107
|
|
|
116
108
|
- type: shared
|
|
117
109
|
source: sections/footer-next-steps.md
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface PlanValidationError {
|
|
2
|
-
path: string;
|
|
3
|
-
message: string;
|
|
4
|
-
}
|
|
5
|
-
export interface PlanTask {
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
status: string;
|
|
9
|
-
depends_on: string[];
|
|
10
|
-
skill_hint?: string;
|
|
11
|
-
acceptance?: string[];
|
|
12
|
-
artifacts?: string[];
|
|
13
|
-
notes?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface Plan {
|
|
16
|
-
version: number;
|
|
17
|
-
change_id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
created_at: string;
|
|
20
|
-
updated_at: string;
|
|
21
|
-
status: string;
|
|
22
|
-
current_task: string | null;
|
|
23
|
-
tasks: PlanTask[];
|
|
24
|
-
}
|
|
25
|
-
export declare function validatePlan(rawYaml: string): PlanValidationError[];
|
|
26
|
-
//# sourceMappingURL=plan-validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-validator.d.ts","sourceRoot":"","sources":["../../src/build/plan-validator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAsID,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA+GnE"}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { parse as parseYaml } from "yaml";
|
|
2
|
-
const PLAN_STATUSES = new Set(["in_progress", "done", "abandoned"]);
|
|
3
|
-
const TASK_STATUSES = new Set([
|
|
4
|
-
"pending",
|
|
5
|
-
"in_progress",
|
|
6
|
-
"done",
|
|
7
|
-
"blocked",
|
|
8
|
-
"skipped",
|
|
9
|
-
]);
|
|
10
|
-
function isString(v) {
|
|
11
|
-
return typeof v === "string";
|
|
12
|
-
}
|
|
13
|
-
function isNonEmptyString(v) {
|
|
14
|
-
return typeof v === "string" && v.length > 0;
|
|
15
|
-
}
|
|
16
|
-
function detectCycle(tasks) {
|
|
17
|
-
const idIndex = new Map();
|
|
18
|
-
for (const t of tasks)
|
|
19
|
-
idIndex.set(t.id, t);
|
|
20
|
-
const WHITE = 0;
|
|
21
|
-
const GRAY = 1;
|
|
22
|
-
const BLACK = 2;
|
|
23
|
-
const color = new Map();
|
|
24
|
-
for (const t of tasks)
|
|
25
|
-
color.set(t.id, WHITE);
|
|
26
|
-
const stack = [];
|
|
27
|
-
function visit(id) {
|
|
28
|
-
color.set(id, GRAY);
|
|
29
|
-
stack.push(id);
|
|
30
|
-
const task = idIndex.get(id);
|
|
31
|
-
if (task) {
|
|
32
|
-
for (const dep of task.depends_on ?? []) {
|
|
33
|
-
const c = color.get(dep);
|
|
34
|
-
if (c === GRAY) {
|
|
35
|
-
const cycleStart = stack.indexOf(dep);
|
|
36
|
-
return stack.slice(cycleStart).concat(dep);
|
|
37
|
-
}
|
|
38
|
-
if (c === WHITE) {
|
|
39
|
-
const found = visit(dep);
|
|
40
|
-
if (found)
|
|
41
|
-
return found;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
stack.pop();
|
|
46
|
-
color.set(id, BLACK);
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
for (const t of tasks) {
|
|
50
|
-
if (color.get(t.id) === WHITE) {
|
|
51
|
-
const cycle = visit(t.id);
|
|
52
|
-
if (cycle)
|
|
53
|
-
return cycle;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
function validateTask(task, index, knownIds, errors) {
|
|
59
|
-
const base = `tasks[${index}]`;
|
|
60
|
-
if (typeof task !== "object" || task === null) {
|
|
61
|
-
errors.push({ path: base, message: "Task must be an object" });
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const t = task;
|
|
65
|
-
if (!isNonEmptyString(t.id)) {
|
|
66
|
-
errors.push({ path: `${base}.id`, message: "Missing or empty id" });
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
if (!isNonEmptyString(t.title)) {
|
|
70
|
-
errors.push({ path: `${base}.title`, message: "Missing or empty title" });
|
|
71
|
-
}
|
|
72
|
-
if (!isString(t.status) || !TASK_STATUSES.has(t.status)) {
|
|
73
|
-
errors.push({
|
|
74
|
-
path: `${base}.status`,
|
|
75
|
-
message: `Invalid status "${String(t.status)}". Expected one of: ${[...TASK_STATUSES].join(", ")}`,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (!Array.isArray(t.depends_on)) {
|
|
79
|
-
errors.push({
|
|
80
|
-
path: `${base}.depends_on`,
|
|
81
|
-
message: "depends_on must be an array (use [] for no dependencies)",
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
for (let i = 0; i < t.depends_on.length; i++) {
|
|
86
|
-
const dep = t.depends_on[i];
|
|
87
|
-
if (!isNonEmptyString(dep)) {
|
|
88
|
-
errors.push({
|
|
89
|
-
path: `${base}.depends_on[${i}]`,
|
|
90
|
-
message: "Dependency entries must be non-empty strings",
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (t.skill_hint !== undefined && !isString(t.skill_hint)) {
|
|
96
|
-
errors.push({ path: `${base}.skill_hint`, message: "skill_hint must be a string" });
|
|
97
|
-
}
|
|
98
|
-
if (t.acceptance !== undefined && !Array.isArray(t.acceptance)) {
|
|
99
|
-
errors.push({ path: `${base}.acceptance`, message: "acceptance must be an array" });
|
|
100
|
-
}
|
|
101
|
-
if (t.artifacts !== undefined && !Array.isArray(t.artifacts)) {
|
|
102
|
-
errors.push({ path: `${base}.artifacts`, message: "artifacts must be an array" });
|
|
103
|
-
}
|
|
104
|
-
if (t.notes !== undefined && !isString(t.notes)) {
|
|
105
|
-
errors.push({ path: `${base}.notes`, message: "notes must be a string" });
|
|
106
|
-
}
|
|
107
|
-
if (knownIds.has(t.id)) {
|
|
108
|
-
errors.push({ path: `${base}.id`, message: `Duplicate task id "${t.id}"` });
|
|
109
|
-
}
|
|
110
|
-
knownIds.add(t.id);
|
|
111
|
-
return {
|
|
112
|
-
id: t.id,
|
|
113
|
-
title: isString(t.title) ? t.title : "",
|
|
114
|
-
status: isString(t.status) ? t.status : "",
|
|
115
|
-
depends_on: Array.isArray(t.depends_on) ? t.depends_on : [],
|
|
116
|
-
skill_hint: isString(t.skill_hint) ? t.skill_hint : undefined,
|
|
117
|
-
acceptance: Array.isArray(t.acceptance) ? t.acceptance : undefined,
|
|
118
|
-
artifacts: Array.isArray(t.artifacts) ? t.artifacts : undefined,
|
|
119
|
-
notes: isString(t.notes) ? t.notes : undefined,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
export function validatePlan(rawYaml) {
|
|
123
|
-
const errors = [];
|
|
124
|
-
let parsed;
|
|
125
|
-
try {
|
|
126
|
-
parsed = parseYaml(rawYaml);
|
|
127
|
-
}
|
|
128
|
-
catch (e) {
|
|
129
|
-
errors.push({ path: "(root)", message: `Invalid YAML: ${e}` });
|
|
130
|
-
return errors;
|
|
131
|
-
}
|
|
132
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
133
|
-
errors.push({ path: "(root)", message: "Plan must be a YAML mapping" });
|
|
134
|
-
return errors;
|
|
135
|
-
}
|
|
136
|
-
const plan = parsed;
|
|
137
|
-
if (plan.version !== 1) {
|
|
138
|
-
errors.push({
|
|
139
|
-
path: "version",
|
|
140
|
-
message: `Unsupported plan version "${String(plan.version)}". Expected 1.`,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
if (!isNonEmptyString(plan.change_id)) {
|
|
144
|
-
errors.push({ path: "change_id", message: "Missing or empty change_id" });
|
|
145
|
-
}
|
|
146
|
-
if (!isNonEmptyString(plan.title)) {
|
|
147
|
-
errors.push({ path: "title", message: "Missing or empty title" });
|
|
148
|
-
}
|
|
149
|
-
if (!isNonEmptyString(plan.created_at)) {
|
|
150
|
-
errors.push({ path: "created_at", message: "Missing or empty created_at" });
|
|
151
|
-
}
|
|
152
|
-
if (!isNonEmptyString(plan.updated_at)) {
|
|
153
|
-
errors.push({ path: "updated_at", message: "Missing or empty updated_at" });
|
|
154
|
-
}
|
|
155
|
-
if (!isString(plan.status) || !PLAN_STATUSES.has(plan.status)) {
|
|
156
|
-
errors.push({
|
|
157
|
-
path: "status",
|
|
158
|
-
message: `Invalid status "${String(plan.status)}". Expected one of: ${[...PLAN_STATUSES].join(", ")}`,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
const currentTask = plan.current_task;
|
|
162
|
-
if (currentTask !== null && !isString(currentTask)) {
|
|
163
|
-
errors.push({
|
|
164
|
-
path: "current_task",
|
|
165
|
-
message: "current_task must be a task id string or null",
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
if (!Array.isArray(plan.tasks)) {
|
|
169
|
-
errors.push({ path: "tasks", message: "tasks must be an array" });
|
|
170
|
-
return errors;
|
|
171
|
-
}
|
|
172
|
-
if (plan.tasks.length === 0) {
|
|
173
|
-
errors.push({ path: "tasks", message: "Plan must contain at least one task" });
|
|
174
|
-
return errors;
|
|
175
|
-
}
|
|
176
|
-
const knownIds = new Set();
|
|
177
|
-
const validated = [];
|
|
178
|
-
for (let i = 0; i < plan.tasks.length; i++) {
|
|
179
|
-
const t = validateTask(plan.tasks[i], i, knownIds, errors);
|
|
180
|
-
if (t)
|
|
181
|
-
validated.push(t);
|
|
182
|
-
}
|
|
183
|
-
for (let i = 0; i < validated.length; i++) {
|
|
184
|
-
const t = validated[i];
|
|
185
|
-
for (let j = 0; j < t.depends_on.length; j++) {
|
|
186
|
-
const dep = t.depends_on[j];
|
|
187
|
-
if (!knownIds.has(dep)) {
|
|
188
|
-
errors.push({
|
|
189
|
-
path: `tasks[${i}].depends_on[${j}]`,
|
|
190
|
-
message: `Unknown task id "${dep}"`,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (typeof currentTask === "string" && !knownIds.has(currentTask)) {
|
|
196
|
-
errors.push({
|
|
197
|
-
path: "current_task",
|
|
198
|
-
message: `Unknown task id "${currentTask}"`,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
else if (typeof currentTask === "string" && knownIds.has(currentTask)) {
|
|
202
|
-
const ct = validated.find((t) => t.id === currentTask);
|
|
203
|
-
if (ct && ct.status !== "pending" && ct.status !== "in_progress") {
|
|
204
|
-
errors.push({
|
|
205
|
-
path: "current_task",
|
|
206
|
-
message: `current_task "${currentTask}" must reference a task with status "pending" or "in_progress" (found "${ct.status}")`,
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (plan.status === "done" && currentTask !== null) {
|
|
211
|
-
errors.push({
|
|
212
|
-
path: "current_task",
|
|
213
|
-
message: 'current_task must be null when plan status is "done"',
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
const cycle = detectCycle(validated);
|
|
217
|
-
if (cycle) {
|
|
218
|
-
errors.push({
|
|
219
|
-
path: "tasks",
|
|
220
|
-
message: `Dependency cycle detected: ${cycle.join(" -> ")}`,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
return errors;
|
|
224
|
-
}
|
|
225
|
-
//# sourceMappingURL=plan-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-validator.js","sourceRoot":"","sources":["../../src/build/plan-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AA6B1C,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,SAAS;IACT,aAAa;IACb,MAAM;IACN,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,WAAW,CAAC,KAAiB;IACpC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG,CAAC,CAAC;IAChB,MAAM,IAAI,GAAG,CAAC,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,CAAC;IAChB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CA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":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,YAAiB,GAAG,IAAI,CA4C7D"}
|
package/dist/commands/build.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parse as parseYaml } from "yaml";
|
|
4
|
-
import { assembleFromManifest } from "../build/assembler.js";
|
|
5
|
-
import { validateManifest } from "../build/validator.js";
|
|
6
|
-
export function buildCommand(options = {}) {
|
|
7
|
-
const projectRoot = process.cwd();
|
|
8
|
-
const sourcesDir = path.resolve(projectRoot, "sources");
|
|
9
|
-
const outputRoot = options.out ? path.resolve(options.out) : projectRoot;
|
|
10
|
-
const timestamp = new Date().toISOString();
|
|
11
|
-
let totalFiles = 0;
|
|
12
|
-
let totalErrors = 0;
|
|
13
|
-
for (const kind of ["skills", "templates"]) {
|
|
14
|
-
const baseDir = path.resolve(sourcesDir, kind);
|
|
15
|
-
if (!existsSync(baseDir))
|
|
16
|
-
continue;
|
|
17
|
-
for (const entry of readdirSync(baseDir)) {
|
|
18
|
-
const manifestPath = path.join(baseDir, entry, "manifest.yaml");
|
|
19
|
-
if (!existsSync(manifestPath))
|
|
20
|
-
continue;
|
|
21
|
-
const errors = validateManifest(manifestPath, sourcesDir);
|
|
22
|
-
if (errors.length > 0) {
|
|
23
|
-
for (const err of errors) {
|
|
24
|
-
console.error(`[ERROR] ${err.file}: ${err.message}`);
|
|
25
|
-
}
|
|
26
|
-
totalErrors += errors.length;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const raw = readFileSync(manifestPath, "utf-8");
|
|
30
|
-
const manifest = parseYaml(raw);
|
|
31
|
-
const content = assembleFromManifest(manifestPath, {
|
|
32
|
-
sourcesDir,
|
|
33
|
-
timestamp,
|
|
34
|
-
});
|
|
35
|
-
const outPath = path.resolve(outputRoot, manifest.output);
|
|
36
|
-
mkdirSync(path.dirname(outPath), { recursive: true });
|
|
37
|
-
writeFileSync(outPath, content, "utf-8");
|
|
38
|
-
console.log(`[OK] ${manifest.output}`);
|
|
39
|
-
totalFiles++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
console.log(`\nBuild complete: ${totalFiles} files generated, ${totalErrors} errors.`);
|
|
43
|
-
if (totalErrors > 0)
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,MAAM,UAAU,YAAY,CAAC,UAAwB,EAAE;IACrD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAEzE,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,WAAW,GAAG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AAE,OAAO,CAAC,CAAC;YAEzC,OAAO,CAAC,GAAG,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACvC,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,UAAU,qBAAqB,WAAW,UAAU,CAAC,CAAC;IACvF,IAAI,WAAW,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface MigrationResult {
|
|
2
|
-
skipped: boolean;
|
|
3
|
-
reason?: string;
|
|
4
|
-
backup?: string;
|
|
5
|
-
changes?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function migrateManifests(projectRoot: string): MigrationResult;
|
|
8
|
-
export declare function migratePaths(projectRoot: string): MigrationResult;
|
|
9
|
-
export declare function migrateConfig(projectRoot: string): MigrationResult;
|
|
10
|
-
export interface MigrateAllResult {
|
|
11
|
-
manifests: MigrationResult;
|
|
12
|
-
paths: MigrationResult;
|
|
13
|
-
config: MigrationResult;
|
|
14
|
-
}
|
|
15
|
-
export declare function migrateAll(projectRoot: string): MigrateAllResult;
|
|
16
|
-
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAeD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CA8CrE;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CA2BjE;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CA0ClE;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAMhE"}
|
package/dist/commands/migrate.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4
|
-
function backupDir(projectRoot) {
|
|
5
|
-
const dir = path.join(projectRoot, ".ai-agents/.backup");
|
|
6
|
-
mkdirSync(dir, { recursive: true });
|
|
7
|
-
return dir;
|
|
8
|
-
}
|
|
9
|
-
function backupFile(projectRoot, filePath, label) {
|
|
10
|
-
const dir = backupDir(projectRoot);
|
|
11
|
-
const dest = path.join(dir, `${label}-${Date.now()}.yaml`);
|
|
12
|
-
copyFileSync(filePath, dest);
|
|
13
|
-
return dest;
|
|
14
|
-
}
|
|
15
|
-
export function migrateManifests(projectRoot) {
|
|
16
|
-
const manifestPath = path.join(projectRoot, ".ai-agents/knowledge/core/manifest.yaml");
|
|
17
|
-
if (!existsSync(manifestPath)) {
|
|
18
|
-
return { skipped: true, reason: "no core/manifest.yaml present" };
|
|
19
|
-
}
|
|
20
|
-
const raw = readFileSync(manifestPath, "utf-8");
|
|
21
|
-
const old = parseYaml(raw);
|
|
22
|
-
const hasLegacyType = old.type === "core";
|
|
23
|
-
const hasLegacyField = "token_estimate" in old || "loading_strategy" in old;
|
|
24
|
-
const filesArr = Array.isArray(old.files) ? old.files : [];
|
|
25
|
-
const filesMissOrigin = filesArr.some((f) => !("origin" in f));
|
|
26
|
-
if (!hasLegacyType && !hasLegacyField && !filesMissOrigin) {
|
|
27
|
-
return { skipped: true, reason: "already migrated" };
|
|
28
|
-
}
|
|
29
|
-
const backup = backupFile(projectRoot, manifestPath, "core-manifest");
|
|
30
|
-
const migrated = {
|
|
31
|
-
id: typeof old.id === "string" ? old.id : "core",
|
|
32
|
-
type: hasLegacyType ? "shared" : (old.type ?? "shared"),
|
|
33
|
-
files: filesArr.map((f) => ({
|
|
34
|
-
path: typeof f.path === "string" ? f.path : "",
|
|
35
|
-
origin: typeof f.origin === "string" ? f.origin : "user",
|
|
36
|
-
auto_load: typeof f.auto_load === "boolean"
|
|
37
|
-
? f.auto_load
|
|
38
|
-
: typeof f.required === "boolean"
|
|
39
|
-
? f.required
|
|
40
|
-
: true,
|
|
41
|
-
})),
|
|
42
|
-
};
|
|
43
|
-
writeFileSync(manifestPath, stringifyYaml(migrated), "utf-8");
|
|
44
|
-
const changes = [];
|
|
45
|
-
if (hasLegacyType)
|
|
46
|
-
changes.push("type: core -> shared");
|
|
47
|
-
if (hasLegacyField)
|
|
48
|
-
changes.push("removed token_estimate / loading_strategy");
|
|
49
|
-
if (filesMissOrigin)
|
|
50
|
-
changes.push("added origin: user to legacy entries");
|
|
51
|
-
return { skipped: false, backup, changes };
|
|
52
|
-
}
|
|
53
|
-
export function migratePaths(projectRoot) {
|
|
54
|
-
const oldPath = path.join(projectRoot, ".ai-agents/workspace/project-context.md");
|
|
55
|
-
const newDir = path.join(projectRoot, ".ai-agents/knowledge/project/_generated");
|
|
56
|
-
const newPath = path.join(newDir, "project-context.md");
|
|
57
|
-
if (!existsSync(oldPath)) {
|
|
58
|
-
return { skipped: true, reason: "no legacy workspace/project-context.md" };
|
|
59
|
-
}
|
|
60
|
-
if (existsSync(newPath)) {
|
|
61
|
-
return {
|
|
62
|
-
skipped: true,
|
|
63
|
-
reason: "target already exists at knowledge/project/_generated/project-context.md",
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const backup = backupFile(projectRoot, oldPath, "project-context");
|
|
67
|
-
mkdirSync(newDir, { recursive: true });
|
|
68
|
-
renameSync(oldPath, newPath);
|
|
69
|
-
return {
|
|
70
|
-
skipped: false,
|
|
71
|
-
backup,
|
|
72
|
-
changes: [`moved workspace/project-context.md -> knowledge/project/_generated/project-context.md`],
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export function migrateConfig(projectRoot) {
|
|
76
|
-
const configPath = path.join(projectRoot, ".ai-agents/config.yaml");
|
|
77
|
-
if (!existsSync(configPath)) {
|
|
78
|
-
return { skipped: true, reason: "no config.yaml" };
|
|
79
|
-
}
|
|
80
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
81
|
-
const config = parseYaml(raw);
|
|
82
|
-
const prefs = config.preferences ?? {};
|
|
83
|
-
const hasLegacy = typeof prefs.language === "string";
|
|
84
|
-
const hasInteraction = typeof prefs.interaction_language === "string";
|
|
85
|
-
const hasDocument = typeof prefs.document_output_language === "string";
|
|
86
|
-
if (!hasLegacy && hasInteraction && hasDocument) {
|
|
87
|
-
return { skipped: true, reason: "already migrated" };
|
|
88
|
-
}
|
|
89
|
-
if (!hasLegacy && !hasInteraction) {
|
|
90
|
-
return { skipped: true, reason: "no language fields to migrate" };
|
|
91
|
-
}
|
|
92
|
-
const backup = backupFile(projectRoot, configPath, "config");
|
|
93
|
-
const source = hasInteraction
|
|
94
|
-
? prefs.interaction_language
|
|
95
|
-
: prefs.language;
|
|
96
|
-
const newPrefs = { ...prefs };
|
|
97
|
-
newPrefs.interaction_language = source;
|
|
98
|
-
newPrefs.document_output_language = hasDocument
|
|
99
|
-
? prefs.document_output_language
|
|
100
|
-
: source;
|
|
101
|
-
delete newPrefs.language;
|
|
102
|
-
const migrated = { ...config, preferences: newPrefs };
|
|
103
|
-
writeFileSync(configPath, stringifyYaml(migrated), "utf-8");
|
|
104
|
-
const changes = [];
|
|
105
|
-
if (hasLegacy)
|
|
106
|
-
changes.push(`language: ${prefs.language} -> interaction_language + document_output_language`);
|
|
107
|
-
if (!hasDocument)
|
|
108
|
-
changes.push("set document_output_language fallback");
|
|
109
|
-
return { skipped: false, backup, changes };
|
|
110
|
-
}
|
|
111
|
-
export function migrateAll(projectRoot) {
|
|
112
|
-
return {
|
|
113
|
-
manifests: migrateManifests(projectRoot),
|
|
114
|
-
paths: migratePaths(projectRoot),
|
|
115
|
-
config: migrateConfig(projectRoot),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=migrate.js.map
|