@longph2102/v-flow 1.5.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.
- package/AGENTS.md +265 -0
- package/CHANGELOG.md +318 -0
- package/LICENSE +21 -0
- package/README.md +326 -0
- package/agents/ba-agent.md +437 -0
- package/agents/ba-critic-agent.md +156 -0
- package/agents/ba-to-ptyc-agent.md +112 -0
- package/agents/bugfix-analyst-agent.md +221 -0
- package/agents/constitute-agent.md +155 -0
- package/agents/help-agent.md +168 -0
- package/agents/implement-agent.md +220 -0
- package/agents/import-ba-docs-agent.md +164 -0
- package/agents/master-check-agent.md +228 -0
- package/agents/metrics-agent.md +180 -0
- package/agents/operations-agent.md +123 -0
- package/agents/plan-agent.md +218 -0
- package/agents/prototype-agent.md +191 -0
- package/agents/retrospective-agent.md +196 -0
- package/agents/review-agent.md +210 -0
- package/agents/sprint-agent.md +191 -0
- package/agents/status-agent.md +186 -0
- package/agents/sync-agent.md +201 -0
- package/agents/test-agent.md +166 -0
- package/agents/understand-agent.md +339 -0
- package/cli/commands/check.js +96 -0
- package/cli/commands/dev-quiz.js +107 -0
- package/cli/commands/doctor.js +348 -0
- package/cli/commands/feature.js +259 -0
- package/cli/commands/hooks.js +163 -0
- package/cli/commands/init.js +189 -0
- package/cli/commands/log.js +199 -0
- package/cli/commands/plugin.js +230 -0
- package/cli/commands/score-card.js +203 -0
- package/cli/commands/status.js +269 -0
- package/cli/commands/sync.js +59 -0
- package/cli/commands/upgrade.js +150 -0
- package/cli/commands/validate.js +1259 -0
- package/cli/commands/watch.js +151 -0
- package/cli/index.js +46 -0
- package/cli/lib/ac-test-gate.js +89 -0
- package/cli/lib/activity-log.js +209 -0
- package/cli/lib/cli-error.js +183 -0
- package/cli/lib/constitution-lint.js +561 -0
- package/cli/lib/dev-quiz-grade.js +127 -0
- package/cli/lib/governance.js +78 -0
- package/cli/lib/hook-targets.js +167 -0
- package/cli/lib/i18n.js +375 -0
- package/cli/lib/knowledge-oracle.js +379 -0
- package/cli/lib/logger.js +203 -0
- package/cli/lib/module-card-lint.js +304 -0
- package/cli/lib/module-card-score.js +223 -0
- package/cli/lib/plugins.js +481 -0
- package/cli/lib/scanner.js +692 -0
- package/cli/lib/sync-core.js +232 -0
- package/cli/lib/sync-targets.js +84 -0
- package/cli/lib/templates.js +268 -0
- package/cli/lib/yaml-parser.js +203 -0
- package/commands/v.ba-critic.md +101 -0
- package/commands/v.ba-to-ptyc.md +71 -0
- package/commands/v.bugfix.md +86 -0
- package/commands/v.check.md +131 -0
- package/commands/v.constitute.md +87 -0
- package/commands/v.constitution.md +84 -0
- package/commands/v.fork.md +127 -0
- package/commands/v.help.md +73 -0
- package/commands/v.hotfix.md +200 -0
- package/commands/v.implement.md +92 -0
- package/commands/v.import-ba-docs.md +222 -0
- package/commands/v.metrics.md +74 -0
- package/commands/v.operations.md +70 -0
- package/commands/v.plan.md +78 -0
- package/commands/v.prototype.md +121 -0
- package/commands/v.quickfix.md +169 -0
- package/commands/v.retrospective.md +80 -0
- package/commands/v.review.md +78 -0
- package/commands/v.rewind.md +127 -0
- package/commands/v.specify.md +118 -0
- package/commands/v.sprint.md +75 -0
- package/commands/v.status.md +62 -0
- package/commands/v.sync.md +81 -0
- package/commands/v.test.md +67 -0
- package/commands/v.understand.md +112 -0
- package/package.json +65 -0
- package/skills/_shared/constitution-reader/SKILL.md +109 -0
- package/skills/_shared/constitution-reader/config.json +52 -0
- package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
- package/skills/_shared/constitution-reader/gotchas.md +46 -0
- package/skills/_shared/context-reader/SKILL.md +111 -0
- package/skills/_shared/context-reader/config.json +54 -0
- package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
- package/skills/_shared/context-reader/gotchas.md +49 -0
- package/skills/_shared/ears-notation/SKILL.md +63 -0
- package/skills/_shared/ears-notation/config.json +55 -0
- package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
- package/skills/_shared/ears-notation/gotchas.md +43 -0
- package/skills/check/cross-validator/SKILL.md +206 -0
- package/skills/check/cross-validator/config.json +33 -0
- package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
- package/skills/check/cross-validator/gotchas.md +43 -0
- package/skills/implement/constitution-enforcer/SKILL.md +134 -0
- package/skills/implement/constitution-enforcer/config.json +16 -0
- package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
- package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
- package/skills/implement/constitution-enforcer/gotchas.md +26 -0
- package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
- package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
- package/skills/implement/no-go-zone-guard/config.json +28 -0
- package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
- package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
- package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
- package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
- package/skills/implement/tdd-driver/SKILL.md +159 -0
- package/skills/implement/tdd-driver/config.json +33 -0
- package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
- package/skills/implement/tdd-driver/gotchas.md +34 -0
- package/skills/metrics/metrics-collector/SKILL.md +133 -0
- package/skills/metrics/metrics-collector/config.json +16 -0
- package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
- package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
- package/skills/metrics/metrics-collector/gotchas.md +26 -0
- package/skills/operations/incident-runbook/SKILL.md +167 -0
- package/skills/operations/incident-runbook/config.json +21 -0
- package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
- package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
- package/skills/operations/incident-runbook/gotchas.md +26 -0
- package/skills/plan/architecture-designer/SKILL.md +228 -0
- package/skills/plan/architecture-designer/config.json +32 -0
- package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
- package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
- package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
- package/skills/plan/architecture-designer/gotchas.md +45 -0
- package/skills/plan/task-breakdown/SKILL.md +208 -0
- package/skills/plan/task-breakdown/config.json +26 -0
- package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
- package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
- package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
- package/skills/plan/task-breakdown/gotchas.md +39 -0
- package/skills/prototype/LOGIC.md +240 -0
- package/skills/prototype/SKILL.md +185 -0
- package/skills/prototype/UI.md +407 -0
- package/skills/prototype/config.json +104 -0
- package/skills/prototype/examples/bad/prototype-notes.md +68 -0
- package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
- package/skills/prototype/examples/good/prototype-notes.md +67 -0
- package/skills/prototype/gotchas.md +128 -0
- package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
- package/skills/prototype/scripts/check-flow-state.sh +104 -0
- package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
- package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
- package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
- package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
- package/skills/review/adversarial-reviewer/SKILL.md +137 -0
- package/skills/review/adversarial-reviewer/config.json +32 -0
- package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
- package/skills/review/adversarial-reviewer/gotchas.md +46 -0
- package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
- package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
- package/skills/specify/ba-critic/SKILL.md +172 -0
- package/skills/specify/ba-critic/config.json +32 -0
- package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
- package/skills/specify/ba-critic/gotchas.md +40 -0
- package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
- package/skills/specify/ba-doc-generator/SKILL.md +102 -0
- package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
- package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
- package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
- package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
- package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
- package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
- package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
- package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
- package/skills/specify/bugfix-analyst/SKILL.md +296 -0
- package/skills/specify/bugfix-analyst/config.json +41 -0
- package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
- package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
- package/skills/specify/bugfix-analyst/gotchas.md +51 -0
- package/skills/specify/ears-writer/SKILL.md +129 -0
- package/skills/specify/ears-writer/config.json +20 -0
- package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
- package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
- package/skills/specify/ears-writer/gotchas.md +43 -0
- package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
- package/skills/test/test-case-generator/SKILL.md +161 -0
- package/skills/test/test-case-generator/config.json +33 -0
- package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
- package/skills/test/test-case-generator/gotchas.md +43 -0
- package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
- package/skills/understand/ba-docs-scanner/config.json +47 -0
- package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
- package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
- package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
- package/skills/understand/codebase-scanner/SKILL.md +260 -0
- package/skills/understand/codebase-scanner/config.json +56 -0
- package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
- package/skills/understand/codebase-scanner/gotchas.md +42 -0
- package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
- package/templates/DESIGN.md +456 -0
- package/templates/agent-command-template.yaml +240 -0
- package/templates/agent-config-template.md +170 -0
- package/templates/agent-definition-template.md +145 -0
- package/templates/agent-metrics-template.md +150 -0
- package/templates/api-contract-template.md +72 -0
- package/templates/bugfix-report-template.md +195 -0
- package/templates/bugfix-spec-template.md +134 -0
- package/templates/code-review-report-template.md +119 -0
- package/templates/constitution-template.md +234 -0
- package/templates/context-template.md +94 -0
- package/templates/data-model-template.md +95 -0
- package/templates/decision-log-template.md +92 -0
- package/templates/flow-state-template.yaml +208 -0
- package/templates/github/workflows/v-flow-validate.yml +30 -0
- package/templates/knowledge/adr-template.md +70 -0
- package/templates/knowledge/api-contract-template.md +140 -0
- package/templates/knowledge/domain-glossary.md +29 -0
- package/templates/knowledge/golden-tests-readme.md +115 -0
- package/templates/knowledge/lessons-learned.md +41 -0
- package/templates/knowledge/patterns.md +103 -0
- package/templates/module-card/SKILL.md +85 -0
- package/templates/module-card/api-specs.md +96 -0
- package/templates/module-card/business-quiz.md +119 -0
- package/templates/module-card/cross-service.md +125 -0
- package/templates/module-card/db.md +85 -0
- package/templates/module-card/dev-quiz.md +62 -0
- package/templates/module-card/permissions.md +83 -0
- package/templates/module-card/state-diagram.md +64 -0
- package/templates/module-card/tech-context.md +90 -0
- package/templates/module-card/ui-flows.md +91 -0
- package/templates/module-card/use-cases.md +142 -0
- package/templates/module-template.yaml +161 -0
- package/templates/operations-report-template.md +108 -0
- package/templates/plan-template.md +308 -0
- package/templates/prototype-notes-template.md +116 -0
- package/templates/ptyc/PTYC.template.docx +0 -0
- package/templates/ptyc/ptyc.meta.example.yaml +44 -0
- package/templates/retrospective-report-template.md +136 -0
- package/templates/security-review-template.md +84 -0
- package/templates/session-template.md +167 -0
- package/templates/spec-review-log-template.md +75 -0
- package/templates/spec-template.md +229 -0
- package/templates/sprint-status-template.md +101 -0
- package/templates/tasks-template.md +275 -0
- package/templates/test-cases-template.md +124 -0
- package/templates/ux-checklist-template.md +79 -0
- package/templates/validation-report-template.md +125 -0
- package/templates/vflow-config-template.yaml +22 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML Parser — Shared .flow-state.yaml parsing for V-Flow CLI
|
|
3
|
+
*
|
|
4
|
+
* Replaces fragile regex-based parsing with proper YAML library.
|
|
5
|
+
* Used by: status.js, doctor.js, feature.js
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs-extra');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
// Use js-yaml if available, otherwise fallback to regex-based parsing
|
|
12
|
+
let yaml;
|
|
13
|
+
try {
|
|
14
|
+
yaml = require('js-yaml');
|
|
15
|
+
} catch {
|
|
16
|
+
yaml = null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Parse .flow-state.yaml content into a structured object.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} content - Raw YAML content
|
|
23
|
+
* @returns {object} Parsed flow state
|
|
24
|
+
*/
|
|
25
|
+
function parseFlowState(content) {
|
|
26
|
+
// Use js-yaml if available
|
|
27
|
+
if (yaml) {
|
|
28
|
+
try {
|
|
29
|
+
const raw = yaml.load(content);
|
|
30
|
+
return normalizeFlowState(raw || {});
|
|
31
|
+
} catch {
|
|
32
|
+
// Fallback to regex if YAML parsing fails
|
|
33
|
+
return parseFlowStateRegex(content);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return parseFlowStateRegex(content);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Normalize raw YAML object into the expected flow state shape.
|
|
41
|
+
* Ensures consistent field names and defaults.
|
|
42
|
+
*/
|
|
43
|
+
function normalizeFlowState(raw) {
|
|
44
|
+
return {
|
|
45
|
+
featureName: raw.feature_name || null,
|
|
46
|
+
featureId: raw.feature_id || null,
|
|
47
|
+
currentPhase: raw.current_phase || null,
|
|
48
|
+
phaseStatus: raw.phase_status || null,
|
|
49
|
+
projectType: raw.project_type || null,
|
|
50
|
+
createdAt: raw.created_at || null,
|
|
51
|
+
lastUpdated: raw.last_updated || null,
|
|
52
|
+
specVersion: raw.spec_version_latest || null,
|
|
53
|
+
blocked: raw.blocked === true,
|
|
54
|
+
blockedReason: raw.blocked_reason || null,
|
|
55
|
+
awaitingCheckpoint: raw.awaiting_checkpoint || null,
|
|
56
|
+
|
|
57
|
+
// Governance — risk tier + structured approvals (actor/timestamp/decision)
|
|
58
|
+
riskTier: raw.risk_tier || null,
|
|
59
|
+
approvals: Array.isArray(raw.approvals) ? raw.approvals : [],
|
|
60
|
+
|
|
61
|
+
// Artifacts
|
|
62
|
+
artifacts: normalizeArtifacts(raw.artifacts || {}),
|
|
63
|
+
|
|
64
|
+
// Routing
|
|
65
|
+
routeDecision: raw.routing?.after_master_check?.route_decision || null,
|
|
66
|
+
|
|
67
|
+
// Concerns
|
|
68
|
+
concernsCount: Array.isArray(raw.active_concerns) ? raw.active_concerns.length : 0,
|
|
69
|
+
|
|
70
|
+
// Phase history
|
|
71
|
+
phaseHistory: raw.phase_history || [],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Normalize artifacts section from YAML
|
|
77
|
+
*/
|
|
78
|
+
function normalizeArtifacts(artifacts) {
|
|
79
|
+
const result = {};
|
|
80
|
+
const defaults = {
|
|
81
|
+
exists: false,
|
|
82
|
+
version: null,
|
|
83
|
+
status: null,
|
|
84
|
+
verdict: null,
|
|
85
|
+
total: 0,
|
|
86
|
+
completed: 0,
|
|
87
|
+
human_approved: false,
|
|
88
|
+
synced_to_spec: null,
|
|
89
|
+
concerns_count: 0,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const artifactNames = ['spec', 'plan', 'tasks', 'test_cases', 'validation_report', 'code_review'];
|
|
93
|
+
for (const name of artifactNames) {
|
|
94
|
+
const src = artifacts[name] || {};
|
|
95
|
+
result[name] = {
|
|
96
|
+
exists: src.exists === true,
|
|
97
|
+
version: src.version || defaults.version,
|
|
98
|
+
status: src.status || defaults.status,
|
|
99
|
+
verdict: src.verdict || defaults.verdict,
|
|
100
|
+
total: typeof src.total === 'number' ? src.total : defaults.total,
|
|
101
|
+
completed: typeof src.completed === 'number' ? src.completed : defaults.completed,
|
|
102
|
+
human_approved: src.human_approved === true,
|
|
103
|
+
synced_to_spec: src.synced_to_spec || defaults.synced_to_spec,
|
|
104
|
+
concerns_count: typeof src.concerns_count === 'number' ? src.concerns_count : defaults.concerns_count,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Fallback regex-based parser (for environments without js-yaml).
|
|
113
|
+
* Preserves backward compatibility with the original status.js logic.
|
|
114
|
+
*/
|
|
115
|
+
function parseFlowStateRegex(content) {
|
|
116
|
+
const state = {};
|
|
117
|
+
|
|
118
|
+
const getField = (key) => {
|
|
119
|
+
const match = content.match(new RegExp(`^${key}:\\s*"?([^"\\n]*)"?`, 'm'));
|
|
120
|
+
return match ? match[1].trim() : null;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
state.featureName = getField('feature_name');
|
|
124
|
+
state.featureId = getField('feature_id');
|
|
125
|
+
state.currentPhase = getField('current_phase');
|
|
126
|
+
state.phaseStatus = getField('phase_status');
|
|
127
|
+
state.projectType = getField('project_type');
|
|
128
|
+
state.createdAt = getField('created_at');
|
|
129
|
+
state.lastUpdated = getField('last_updated');
|
|
130
|
+
state.specVersion = getField('spec_version_latest');
|
|
131
|
+
state.blocked = getField('blocked') === 'true';
|
|
132
|
+
state.blockedReason = getField('blocked_reason');
|
|
133
|
+
state.awaitingCheckpoint = getField('awaiting_checkpoint');
|
|
134
|
+
state.riskTier = getField('risk_tier');
|
|
135
|
+
state.approvals = []; // structured list — only the js-yaml path parses it fully
|
|
136
|
+
|
|
137
|
+
// Parse artifact statuses
|
|
138
|
+
state.artifacts = {};
|
|
139
|
+
const artifactNames = ['spec', 'plan', 'tasks', 'test_cases', 'validation_report', 'code_review'];
|
|
140
|
+
for (const name of artifactNames) {
|
|
141
|
+
const existsMatch = content.match(new RegExp(`${name}:[\\s\\S]*?exists:\\s*(true|false)`, 'm'));
|
|
142
|
+
state.artifacts[name] = {
|
|
143
|
+
exists: existsMatch ? existsMatch[1] === 'true' : false,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
if (name === 'spec') {
|
|
147
|
+
const versionMatch = content.match(/spec:[\s\S]*?version:\s*"?([^"\n]*)"?/m);
|
|
148
|
+
const statusMatch = content.match(/spec:[\s\S]*?status:\s*"?([^"\n]*)"?/m);
|
|
149
|
+
state.artifacts.spec.version = versionMatch ? versionMatch[1] : null;
|
|
150
|
+
state.artifacts.spec.status = statusMatch ? statusMatch[1] : null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (name === 'validation_report') {
|
|
154
|
+
const verdictMatch = content.match(/validation_report:[\s\S]*?verdict:\s*"?([^"\n]*)"?/m);
|
|
155
|
+
state.artifacts.validation_report.verdict = verdictMatch ? verdictMatch[1] : null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (name === 'tasks') {
|
|
159
|
+
const totalMatch = content.match(/tasks:[\s\S]*?total:\s*(\d+)/m);
|
|
160
|
+
const completedMatch = content.match(/tasks:[\s\S]*?completed:\s*(\d+)/m);
|
|
161
|
+
state.artifacts.tasks.total = totalMatch ? parseInt(totalMatch[1]) : 0;
|
|
162
|
+
state.artifacts.tasks.completed = completedMatch ? parseInt(completedMatch[1]) : 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Parse routing
|
|
167
|
+
const routeDecision = content.match(/route_decision:\s*"?([^"\n]*)"?/m);
|
|
168
|
+
state.routeDecision = routeDecision ? routeDecision[1] : null;
|
|
169
|
+
|
|
170
|
+
// Parse concerns count
|
|
171
|
+
const concernsCount = content.match(/concerns_count:\s*(\d+)/m);
|
|
172
|
+
state.concernsCount = concernsCount ? parseInt(concernsCount[1]) : 0;
|
|
173
|
+
|
|
174
|
+
state.phaseHistory = [];
|
|
175
|
+
|
|
176
|
+
return state;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Read and parse .flow-state.yaml from a feature directory.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} featureDir - Absolute path to feature directory
|
|
183
|
+
* @returns {object|null} Parsed flow state, or null if file doesn't exist
|
|
184
|
+
*/
|
|
185
|
+
async function readFlowState(featureDir) {
|
|
186
|
+
const flowStatePath = path.join(featureDir, '.flow-state.yaml');
|
|
187
|
+
if (!fs.existsSync(flowStatePath)) return null;
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
const content = await fs.readFile(flowStatePath, 'utf8');
|
|
191
|
+
return parseFlowState(content);
|
|
192
|
+
} catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = {
|
|
198
|
+
parseFlowState,
|
|
199
|
+
normalizeFlowState,
|
|
200
|
+
normalizeArtifacts,
|
|
201
|
+
parseFlowStateRegex,
|
|
202
|
+
readFlowState,
|
|
203
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "BA Critic Agent — Adversarial spec review 1 round (dùng sau /v.specify --dual)"
|
|
3
|
+
phase: "S.1"
|
|
4
|
+
agent: "ba-critic-agent"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /v.ba-critic
|
|
8
|
+
|
|
9
|
+
> Orchestration wrapper cho **BA Critic Agent**. Đọc `agents/ba-critic-agent.md` để thực hiện core logic.
|
|
10
|
+
|
|
11
|
+
## Điều kiện sử dụng
|
|
12
|
+
|
|
13
|
+
- Đã chạy `/v.specify --dual` → `spec.md` và `spec-review-log.md` đã tồn tại
|
|
14
|
+
- Hoặc: BA Agent vừa cập nhật spec sau ITERATE và bạn muốn chạy round tiếp theo
|
|
15
|
+
|
|
16
|
+
## Execution
|
|
17
|
+
1. Đọc agent definition: `agents/ba-critic-agent.md`
|
|
18
|
+
2. Thực hiện toàn bộ quy trình trong agent definition
|
|
19
|
+
3. Ghi kết quả theo Output Template bên dưới
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🔀 Routing Rules — Sau BA Critic
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Verdict = CONVERGED (0 Critical + 0 Major)
|
|
27
|
+
→ [Optional S.1.5] /v.prototype ← nếu spec có ambiguity sau review
|
|
28
|
+
→ Route: /v.plan + /v.test (SONG SONG)
|
|
29
|
+
→ Spec đã hội tụ, sẵn sàng chuyển sang Build phase
|
|
30
|
+
|
|
31
|
+
Verdict = ITERATE (≥ 1 Critical hoặc Major)
|
|
32
|
+
→ Route: BA Agent sửa spec → /v.ba-critic (round tiếp)
|
|
33
|
+
→ BA Agent đọc issues và bump spec version
|
|
34
|
+
|
|
35
|
+
Verdict = ESCALATE (Round ≥ 4)
|
|
36
|
+
→ Route: Human review
|
|
37
|
+
→ Cần meeting với stakeholder
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Output Template — spec-review-log.md
|
|
41
|
+
|
|
42
|
+
Append Round N vào `spec-review-log.md`:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Round [N] — [YYYY-MM-DD]
|
|
46
|
+
|
|
47
|
+
**Spec Version đầu round**: v[X.Y]
|
|
48
|
+
**Reviewer**: BA Critic Agent (fresh context)
|
|
49
|
+
|
|
50
|
+
### Issues Found
|
|
51
|
+
|
|
52
|
+
| ID | Mức | Mô tả ngắn | Requirement liên quan |
|
|
53
|
+
|----|-----|------------|----------------------|
|
|
54
|
+
| R[N]-C001 | 🔴 Critical | ... | REQ-xxx |
|
|
55
|
+
|
|
56
|
+
### Thống kê Round [N]
|
|
57
|
+
|
|
58
|
+
| Mức | Số lượng |
|
|
59
|
+
|-----|---------|
|
|
60
|
+
| 🔴 Critical | N |
|
|
61
|
+
| 🟠 Major | N |
|
|
62
|
+
| 🟡 Minor | N |
|
|
63
|
+
|
|
64
|
+
### Verdict Round [N]
|
|
65
|
+
> [CONVERGED / ITERATE / ESCALATE]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Cập nhật **Convergence Summary** ở cuối file.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Input
|
|
73
|
+
- `.v-flow/features/NNN-feature/spec.md`
|
|
74
|
+
- `.v-flow/constitution.md`
|
|
75
|
+
- `.v-flow/context.md` *(nếu legacy)*
|
|
76
|
+
- `.v-flow/features/NNN-feature/spec-review-log.md` *(header only)*
|
|
77
|
+
|
|
78
|
+
## Output
|
|
79
|
+
- `.v-flow/features/NNN-feature/spec-review-log.md` *(append Round N)*
|
|
80
|
+
|
|
81
|
+
## Ví dụ
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
/v.ba-critic
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
*(Không cần argument — tự động đọc feature folder hiện tại)*
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Cập nhật State & Session
|
|
92
|
+
|
|
93
|
+
**Append vào `_session.md`**:
|
|
94
|
+
```markdown
|
|
95
|
+
### [S.1] BA Critic Round [N] — [YYYY-MM-DD]
|
|
96
|
+
- **Agent**: BA Critic Agent
|
|
97
|
+
- **Spec Version**: v[X.Y]
|
|
98
|
+
- **Verdict**: [CONVERGED | ITERATE | ESCALATE]
|
|
99
|
+
- **Issues**: [N] Critical, [N] Major, [N] Minor
|
|
100
|
+
- **Routing**: → [next step]
|
|
101
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "BA to PTYC Agent — Sinh tài liệu Phân tích Yêu cầu (PTYC.docx) chuẩn ISO từ spec.md (Doc Export — S.1.6, optional)"
|
|
3
|
+
phase: "S.1.6"
|
|
4
|
+
agent: "ba-to-ptyc-agent"
|
|
5
|
+
optional: true
|
|
6
|
+
dependency: "Python docxtpl (pip install docxtpl); mermaid-cli optional cho sơ đồ"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /v.ba-to-ptyc
|
|
10
|
+
|
|
11
|
+
> Orchestration wrapper cho **BA to PTYC Agent**. Đọc `agents/ba-to-ptyc-agent.md` để thực hiện core logic.
|
|
12
|
+
> Tương ứng **bước 7a** trong BA Skill Pipeline: `spec.md` → `PTYC.docx`.
|
|
13
|
+
|
|
14
|
+
> ⚠️ **OPTIONAL — Doc Export**. Chỉ sinh tài liệu bàn giao, không thay đổi spec/plan/code.
|
|
15
|
+
> Cơ chế **Route B**: đổ dữ liệu vào template `.docx` có sẵn → **giữ nguyên 100% format ISO Viettel**.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
> ⚠️ Tooling nằm **trong `.v-flow/` của project** (do `v-flow init/sync` copy vào): `.v-flow/scripts/ptyc/` + `.v-flow/templates/ptyc/`. Chạy mọi lệnh từ **gốc project** (nơi có thư mục `.v-flow/`) — **KHÔNG** dùng đường dẫn kiểu `<project>/scripts/...` ở thư mục gốc (không tồn tại), cũng không cần repo framework ngoài.
|
|
22
|
+
> Nếu `.v-flow/scripts/ptyc/` chưa có → chạy `v-flow sync --apply` (hoặc `v-flow init`) để copy vào. `<F>` = `.v-flow/features/{NNN}`.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. <F>/spec.md ← nên đã Approved
|
|
26
|
+
2. <F>/ptyc.meta.yaml ← nếu chưa có: copy .v-flow/templates/ptyc/ptyc.meta.example.yaml và điền
|
|
27
|
+
3. venv trong .v-flow (1 lần) — macOS python externally-managed:
|
|
28
|
+
python3 -m venv .v-flow/.venv && .v-flow/.venv/bin/pip install docxtpl
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> Thiếu `docxtpl` → `render_ptyc.py` in hướng dẫn cài venv và **dừng (không ra file)**.
|
|
32
|
+
> Thiếu `mermaid-cli` → sơ đồ dùng placeholder (không fail).
|
|
33
|
+
> Template tự resolve `.v-flow/templates/ptyc/PTYC.template.docx` — không cần `--template`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Execution
|
|
38
|
+
|
|
39
|
+
1. Đọc agent definition: `agents/ba-to-ptyc-agent.md`
|
|
40
|
+
2. Chạy từ **gốc project** (nơi có `.v-flow/`). `<F>` = `.v-flow/features/{NNN}`.
|
|
41
|
+
3. Đọc `<F>/spec.md` + `<F>/ptyc.meta.yaml` (+ `<F>/plan.md` nếu có)
|
|
42
|
+
4. Map → `<F>/ptyc/ptyc-data.json` (đúng `.v-flow/scripts/ptyc/ptyc-data.schema.json`)
|
|
43
|
+
5. (Tùy chọn) `node .v-flow/scripts/ptyc/render_mermaid.mjs <F>/ptyc/img`
|
|
44
|
+
6. Render — **`--out` là thư mục** → file tự đặt tên `{doc_code}.docx` (doc_code tự sinh từ `pyc_ref.no`, KHÔNG hardcode):
|
|
45
|
+
`.v-flow/.venv/bin/python .v-flow/scripts/ptyc/render_ptyc.py --data <F>/ptyc/ptyc-data.json --out <F>/ptyc/ --img-dir <F>/ptyc/img`
|
|
46
|
+
7. **Xác nhận file `.docx` tồn tại** + đúng số PYC → báo đường dẫn + danh sách `[TBD]`
|
|
47
|
+
|
|
48
|
+
## Options
|
|
49
|
+
|
|
50
|
+
### `--feature <NNN>`
|
|
51
|
+
Chỉ định feature. Mặc định: feature đang active trong `.flow-state.yaml`.
|
|
52
|
+
|
|
53
|
+
### `--meta <path>`
|
|
54
|
+
Đường dẫn `ptyc.meta.yaml` khác (mặc định: trong thư mục feature).
|
|
55
|
+
|
|
56
|
+
### `--no-images`
|
|
57
|
+
Bỏ qua bước mermaid → tất cả sơ đồ dùng placeholder (nhanh, không cần mmdc).
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Output
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
.v-flow/features/{NNN}/ptyc/
|
|
65
|
+
├── ptyc.meta.yaml ← metadata (BA điền)
|
|
66
|
+
├── ptyc-data.json ← dữ liệu AI map từ spec (trung gian, review được)
|
|
67
|
+
├── img/ ← *.mmd + *.png (nếu render được)
|
|
68
|
+
└── PTYC_{doc_code}.docx ← ✅ tài liệu bàn giao
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> 📎 Sinh lại template (khi file mẫu đổi): `.v-flow/.venv/bin/python .v-flow/scripts/ptyc/build_template.py <file-mẫu.docx> .v-flow/templates/ptyc/PTYC.template.docx`
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Bugfix Flow — S.1(3-behavior) → B.0(opt) → B.1(3-tier TDD) → R.1. Dành cho bug cần investigate."
|
|
3
|
+
phase: "S.1 → B.0 → B.1 → R.1"
|
|
4
|
+
agents: ["bugfix-analyst-agent", "plan-agent", "implement-agent", "review-agent"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /v.bugfix
|
|
8
|
+
|
|
9
|
+
Chạy **Bugfix Flow** — pipeline chuẩn hóa để chẩn đoán và sửa lỗi (Surgical Bugfix), áp dụng 3-behavior model và 3-tier TDD.
|
|
10
|
+
|
|
11
|
+
> ⚠️ **Điều kiện sử dụng**: Chỉ dùng khi:
|
|
12
|
+
> - Bug cần investigate, ảnh hưởng nhiều file (≥ 5 files), hoặc cần regression testing
|
|
13
|
+
> - Có risk regression nếu sửa sai
|
|
14
|
+
> - Bug đã reproduced hoặc có log/evidence rõ ràng
|
|
15
|
+
|
|
16
|
+
> ❌ **Không dùng cho**:
|
|
17
|
+
> - Bug trivial < 5 files, nguyên nhân rõ ràng → dùng `/v.quickfix`
|
|
18
|
+
> - Production incident P1/P2 → dùng `/v.hotfix`
|
|
19
|
+
> - Mở rộng feature mới → dùng full pipeline `/v.specify`
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Phase 1: Bugfix Analysis [S.1]
|
|
24
|
+
|
|
25
|
+
Bạn là **Bugfix Analyst Agent** — chuyên gia chẩn đoán bug.
|
|
26
|
+
|
|
27
|
+
### Quy trình:
|
|
28
|
+
1. Đọc và tuân thủ tuyệt đối kỹ năng tại `skills/specify/bugfix-analyst/SKILL.md`
|
|
29
|
+
2. Phân tích root cause từ input
|
|
30
|
+
3. Khởi tạo `.flow-state.yaml` nếu chưa có (Phase S.1, type bugfix)
|
|
31
|
+
4. Xây dựng 3-Behavior Model:
|
|
32
|
+
- BUG-B (Defect): Cái gì ĐANG SAI
|
|
33
|
+
- BUG-E (Expected): Cái gì PHẢI ĐÚNG
|
|
34
|
+
- BUG-U (Unchanged): Cái gì KHÔNG ĐƯỢC ĐỔI (≥ 2 items)
|
|
35
|
+
5. Thiết kế 3-Tier Test Plan (T1: Red, T2: Green, T3: Protect)
|
|
36
|
+
6. Output ra `bugfix.md` dựa theo `.v-flow/templates/bugfix-spec-template.md`
|
|
37
|
+
7. Cập nhật vào `_session.md`
|
|
38
|
+
|
|
39
|
+
### Routing sau Phase 1
|
|
40
|
+
- Human approve `bugfix.md` → /v.plan (nếu cần design) hoặc /v.implement (nếu fix đơn giản)
|
|
41
|
+
- Root cause confidence = low → DỪNG, yêu cầu user thêm log/debug session
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Phase 2: Fix Design [B.0a] (Optional)
|
|
46
|
+
|
|
47
|
+
Bạn là **Plan Agent** — thiết kế fix an toàn.
|
|
48
|
+
|
|
49
|
+
### Quy trình:
|
|
50
|
+
1. Đọc `bugfix.md`
|
|
51
|
+
2. Lên plan sửa đổi chi tiết, đảm bảo cover hết BUG-E và không break BUG-U.
|
|
52
|
+
3. Không đụng No-Go Zones trong `context.md`
|
|
53
|
+
4. Lên rollback plan
|
|
54
|
+
5. Output ra `plan.md`
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Phase 3: Implement Fix [B.1]
|
|
59
|
+
|
|
60
|
+
Bạn là **Implement Agent** — code theo TDD 3-Tier.
|
|
61
|
+
|
|
62
|
+
### Quy trình:
|
|
63
|
+
1. Thực hiện TDD theo 3 Tier:
|
|
64
|
+
- 🔴 **RED**: Viết T1 tests (reproduce bug) → Run → confirm FAIL
|
|
65
|
+
- 🟢 **GREEN**: Implement fix → Run T1 PASS → Run T2 PASS
|
|
66
|
+
- 🛡️ **PROTECT**: Run T3 PASS (regression check) → Full suite PASS
|
|
67
|
+
2. Fix không được đụng tới files nằm ngoài scope trừ khi cần thiết (và update report)
|
|
68
|
+
3. Cập nhật kết quả vào `_session.md`
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Phase 4: Review + Bugfix Report [R.1]
|
|
73
|
+
|
|
74
|
+
Bạn là **Review Agent** — adversarial review và tạo báo cáo.
|
|
75
|
+
|
|
76
|
+
### Quy trình:
|
|
77
|
+
1. Đọc kỹ `bugfix.md` và changes
|
|
78
|
+
2. Xác nhận 3-Tier Test Plan đã được implement đầy đủ (T1, T2, T3 pass)
|
|
79
|
+
3. Xác nhận root cause thực sự đã được giải quyết
|
|
80
|
+
4. Tạo `bugfix-report.md` theo `.v-flow/templates/bugfix-report-template.md` (Trả lời 6 câu hỏi: Bug là gì? Root cause? Giải pháp? Sửa ntn? File nào sửa? File nào ảnh hưởng?)
|
|
81
|
+
5. Đưa ra Verdict.
|
|
82
|
+
|
|
83
|
+
### Verdict:
|
|
84
|
+
- APPROVED → Có bugfix-report.md → Deploy
|
|
85
|
+
- CHANGES_REQUIRED → Bắt buộc sửa lại
|
|
86
|
+
- ESCALATE → Chuyển sang full pipeline
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Master Check Agent — Cross-validate Spec ↔ Plan ↔ Tests trước khi implement"
|
|
3
|
+
phase: "R.0"
|
|
4
|
+
agent: "master-check-agent"
|
|
5
|
+
routing_rules:
|
|
6
|
+
PASS: "implement"
|
|
7
|
+
PASS_WITH_CONCERNS: "implement"
|
|
8
|
+
FAIL_spec_gap: "re_specify"
|
|
9
|
+
FAIL_plan_gap: "re_plan"
|
|
10
|
+
FAIL_test_gap: "re_test"
|
|
11
|
+
FAIL_nogo_violation: "re_plan"
|
|
12
|
+
FAIL_constitution: "fix_artifact"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# /v.check
|
|
16
|
+
|
|
17
|
+
> Orchestration wrapper cho **Master Check Agent**. Đọc `agents/master-check-agent.md` để thực hiện core logic.
|
|
18
|
+
|
|
19
|
+
> ⚠️ KHÔNG có code nào được viết cho đến khi Master Check = **PASS** hoặc **PASS WITH CONCERNS**
|
|
20
|
+
|
|
21
|
+
## Điều kiện tiên quyết
|
|
22
|
+
- `spec.md` — kiểm tra Status block (Section 7): tất cả artifacts phải ✅
|
|
23
|
+
- `plan.md` + `tasks.md` phải tồn tại
|
|
24
|
+
- `test-cases.md` phải tồn tại
|
|
25
|
+
- `constitution.md` phải tồn tại
|
|
26
|
+
- `context.md` (nếu legacy project)
|
|
27
|
+
|
|
28
|
+
## Execution
|
|
29
|
+
1. Đọc agent definition: `agents/master-check-agent.md`
|
|
30
|
+
2. Thực hiện toàn bộ quy trình trong agent definition
|
|
31
|
+
3. Tạo `validation-report.md` theo output template
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🔀 Routing Rules — Sau Master Check
|
|
36
|
+
|
|
37
|
+
> Điền `fail_reason` vào `validation-report.md` và `.flow-state.yaml` để agent/user biết đi đâu tiếp theo.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Verdict = PASS
|
|
41
|
+
→ Route: /v.implement
|
|
42
|
+
→ Không có vấn đề, sẵn sàng code
|
|
43
|
+
|
|
44
|
+
Verdict = PASS_WITH_CONCERNS
|
|
45
|
+
→ Route: /v.implement
|
|
46
|
+
→ ⚠️ Implement Agent PHẢI đọc và xử lý từng concern trong list
|
|
47
|
+
→ ⚠️ /v.review PHẢI verify concerns đã resolved
|
|
48
|
+
|
|
49
|
+
Verdict = FAIL + fail_reason = "spec_gap"
|
|
50
|
+
→ Route: /v.specify (sửa/bổ sung spec)
|
|
51
|
+
→ Sau spec: bump version → /v.sync → /v.check
|
|
52
|
+
|
|
53
|
+
Verdict = FAIL + fail_reason = "plan_gap"
|
|
54
|
+
→ Route: /v.plan (re-design plan)
|
|
55
|
+
→ Sau plan: /v.sync → /v.check
|
|
56
|
+
|
|
57
|
+
Verdict = FAIL + fail_reason = "test_gap"
|
|
58
|
+
→ Route: /v.test (bổ sung test cases)
|
|
59
|
+
→ Sau test: /v.check
|
|
60
|
+
|
|
61
|
+
Verdict = FAIL + fail_reason = "nogo_violation"
|
|
62
|
+
→ Route: /v.plan (redesign tránh No-Go Zones)
|
|
63
|
+
|
|
64
|
+
Verdict = FAIL + fail_reason = "constitution_violation"
|
|
65
|
+
→ Route: Fix artifact vi phạm → /v.check
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Output — validation-report.md
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
# Validation Report — [Feature Name]
|
|
72
|
+
|
|
73
|
+
**Ngày check**: YYYY-MM-DD
|
|
74
|
+
**Spec Version**: vX.Y
|
|
75
|
+
**Verdict**: ✅ PASS / ⚠️ PASS WITH CONCERNS / ❌ FAIL
|
|
76
|
+
|
|
77
|
+
## Tóm tắt Coverage
|
|
78
|
+
|
|
79
|
+
| Metric | Kết quả |
|
|
80
|
+
|--------|---------|
|
|
81
|
+
| Tổng requirements | N |
|
|
82
|
+
| REQ có task | N/N ✅ |
|
|
83
|
+
| REQ có test case | N/N ✅ |
|
|
84
|
+
| Orphan tasks | 0 ✅ |
|
|
85
|
+
| Orphan tests | 0 ✅ |
|
|
86
|
+
|
|
87
|
+
## Issues
|
|
88
|
+
(Critical / Major / Concerns / Minor)
|
|
89
|
+
|
|
90
|
+
## Kết luận
|
|
91
|
+
> ✅ PASS — Sẵn sàng implement
|
|
92
|
+
> ⚠️ PASS WITH CONCERNS — Xem danh sách Concerns ở trên
|
|
93
|
+
> ❌ FAIL — Fix [N] Critical/Major issues trước khi implement
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Cập nhật State & Session
|
|
97
|
+
|
|
98
|
+
**Cập nhật `.flow-state.yaml`**:
|
|
99
|
+
```yaml
|
|
100
|
+
artifacts:
|
|
101
|
+
validation_report:
|
|
102
|
+
exists: true
|
|
103
|
+
verdict: "PASS"
|
|
104
|
+
spec_version_checked: "v1.0"
|
|
105
|
+
concerns_count: 0
|
|
106
|
+
issues_critical: 0
|
|
107
|
+
issues_major: 0
|
|
108
|
+
routing:
|
|
109
|
+
after_master_check:
|
|
110
|
+
last_verdict: "PASS"
|
|
111
|
+
last_fail_reason: null
|
|
112
|
+
route_decision: "implement"
|
|
113
|
+
current_phase: "R.0"
|
|
114
|
+
phase_status: "done"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Append vào `_session.md`**:
|
|
118
|
+
```markdown
|
|
119
|
+
### [R.0] Master Check — [YYYY-MM-DD]
|
|
120
|
+
- **Verdict**: [PASS | PASS_WITH_CONCERNS | FAIL]
|
|
121
|
+
- **Issues**: [N] critical, [N] major, [N] concerns
|
|
122
|
+
- **Routing**: [route_decision] — [lý do]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Ví dụ
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
/v.check Feature 001-user-login
|
|
131
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Constitute Agent — AI phân tích dự án và tự động draft constitution.md v2"
|
|
3
|
+
phase: "S.0a"
|
|
4
|
+
agent: "constitute-agent"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /v.constitute
|
|
8
|
+
|
|
9
|
+
> Orchestration wrapper cho **Constitute Agent**. Đọc `agents/constitute-agent.md` để thực hiện core logic.
|
|
10
|
+
|
|
11
|
+
> ⚠️ **Khác với `/v.constitution`**: Lệnh cũ hỏi user từng bước (interactive). Lệnh này **tự scan codebase và draft**, user chỉ cần review sau.
|
|
12
|
+
|
|
13
|
+
## Điều kiện tiên quyết
|
|
14
|
+
- `.v-flow/` phải tồn tại (đã chạy `v-flow init`)
|
|
15
|
+
- `.v-flow/constitution.md` nên tồn tại (v1 template từ init)
|
|
16
|
+
- Ưu tiên đọc `.v-flow/context.md` nếu đã có
|
|
17
|
+
|
|
18
|
+
## Execution
|
|
19
|
+
1. Đọc agent definition: `agents/constitute-agent.md`
|
|
20
|
+
2. Thực hiện toàn bộ quy trình trong agent definition
|
|
21
|
+
3. Ghi đè `constitution.md` với v2 (AI-drafted)
|
|
22
|
+
|
|
23
|
+
## Options
|
|
24
|
+
|
|
25
|
+
### (không có argument) — Scan codebase tự động
|
|
26
|
+
AI scan codebase, infer patterns, draft constitution.
|
|
27
|
+
|
|
28
|
+
### --from-context — Ưu tiên đọc context.md
|
|
29
|
+
```
|
|
30
|
+
/v.constitute --from-context
|
|
31
|
+
```
|
|
32
|
+
Ưu tiên đọc `context.md` thay vì scan lại codebase từ đầu.
|
|
33
|
+
|
|
34
|
+
### [text kèm] — Kèm mô tả ngắn
|
|
35
|
+
```
|
|
36
|
+
/v.constitute Dự án Flutter mobile app, team 5 người
|
|
37
|
+
```
|
|
38
|
+
Kèm context bổ sung giúp AI draft chính xác hơn.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🔀 Routing Rules — Sau Constitute
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Constitution v2 được tạo
|
|
46
|
+
→ Tech Lead review:
|
|
47
|
+
1. Xác nhận / chỉnh sửa [⚠️ AI-inferred]
|
|
48
|
+
2. Điền [Cần quyết định] (đặc biệt AI models, privacy)
|
|
49
|
+
3. Xóa header warning → constitution có hiệu lực
|
|
50
|
+
→ Sau approve: S.0b (agent-config.md) hoặc S.1 (/v.specify)
|
|
51
|
+
|
|
52
|
+
Dự án legacy chưa có module cards
|
|
53
|
+
→ /v.understand --module (generate Module Cards)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cập nhật State & Session
|
|
57
|
+
|
|
58
|
+
**Cập nhật `.flow-state.yaml`**:
|
|
59
|
+
```yaml
|
|
60
|
+
current_phase: "S.0a"
|
|
61
|
+
phase_status: "awaiting_human"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Append vào `_session.md`**:
|
|
65
|
+
```markdown
|
|
66
|
+
### [S.0a] Constitution — [YYYY-MM-DD]
|
|
67
|
+
- **Agent**: Constitute Agent
|
|
68
|
+
- **Output**: `constitution.md` v2 (AI-drafted)
|
|
69
|
+
- **Sections inferred**: [N]/7
|
|
70
|
+
- **Sections needing human**: [N] `[Cần quyết định]`
|
|
71
|
+
- **Routing**: → Await Tech Lead review
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Output
|
|
77
|
+
- `.v-flow/constitution.md` **(v2 — AI-drafted, cần Tech Lead review & approve)**
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Ví dụ
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
/v.constitute
|
|
85
|
+
/v.constitute Dự án Flutter mobile app, team 5 người
|
|
86
|
+
/v.constitute --from-context
|
|
87
|
+
```
|