6aspec 2.0.0-dev.3 → 2.0.0-dev.30

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 (95) hide show
  1. package/.6aspec/rules/biz/code.md +122 -28
  2. package/.6aspec/rules/biz/code_implementation_sop.md +77 -0
  3. package/.6aspec/rules/brown/brown_archive_sop.md +17 -11
  4. package/.6aspec/rules/brown/brown_constitution.md +11 -0
  5. package/.6aspec/rules/brown/brown_continue_sop.md +10 -3
  6. package/.6aspec/rules/brown/brown_design_sop.md +285 -71
  7. package/.6aspec/rules/brown/brown_explore_sop.md +314 -0
  8. package/.6aspec/rules/brown/brown_ff_sop.md +31 -18
  9. package/.6aspec/rules/brown/brown_impact_sop.md +101 -45
  10. package/.6aspec/rules/brown/brown_implement_sop.md +127 -43
  11. package/.6aspec/rules/brown/brown_list_sop.md +12 -12
  12. package/.6aspec/rules/brown/brown_new_sop.md +63 -38
  13. package/.6aspec/rules/brown/brown_proposal_sop.md +286 -76
  14. package/.6aspec/rules/brown/brown_quick_sop.md +5 -5
  15. package/.6aspec/rules/brown/brown_review_sop.md +4 -4
  16. package/.6aspec/rules/brown/brown_rollback_sop.md +29 -19
  17. package/.6aspec/rules/brown/brown_specs_sop.md +412 -120
  18. package/.6aspec/rules/brown/brown_status_sop.md +13 -3
  19. package/.6aspec/rules/brown/brown_tasks_sop.md +212 -83
  20. package/.6aspec/rules/brown/brown_understand_sop.md +111 -40
  21. package/.6aspec/rules/brown/brown_update_sop.md +287 -0
  22. package/.6aspec/rules/brown/brown_verify_sop.md +138 -58
  23. package/.6aspec/rules/green/{6A_archive_sop.md → green_archive_sop.md} +3 -3
  24. package/.6aspec/rules/green/{6A_clarify_sop.md → green_clarify_sop.md} +1 -1
  25. package/.6aspec/rules/green/{6A_code_implementation_sop.md → green_code_implementation_sop.md} +18 -3
  26. package/.6aspec/rules/green/{6A_continue_sop.md → green_continue_sop.md} +3 -3
  27. package/.6aspec/rules/green/{6A_new_sop.md → green_new_sop.md} +90 -11
  28. package/.6aspec/rules/green/green_status_schema.md +4 -4
  29. package/.6aspec/rules/green/{6A_status_sop.md → green_status_sop.md} +3 -3
  30. package/.6aspec/rules/green/{6A_tasks_sop.md → green_tasks_sop.md} +1 -1
  31. package/.claude/commands/6aspec/brown/explore.md +11 -0
  32. package/.claude/commands/6aspec/brown/update.md +11 -0
  33. package/.claude/commands/6aspec/code.md +10 -0
  34. package/.claude/commands/6aspec/green/archive.md +1 -1
  35. package/.claude/commands/6aspec/green/clarify.md +2 -2
  36. package/.claude/commands/6aspec/green/continue.md +1 -1
  37. package/.claude/commands/6aspec/green/design.md +2 -2
  38. package/.claude/commands/6aspec/green/{execute-task.md → implement.md} +1 -1
  39. package/.claude/commands/6aspec/green/import-model-table.md +1 -1
  40. package/.claude/commands/6aspec/green/init.md +2 -2
  41. package/.claude/commands/6aspec/green/model.md +2 -2
  42. package/.claude/commands/6aspec/green/new.md +2 -2
  43. package/.claude/commands/6aspec/green/rollback.md +1 -1
  44. package/.claude/commands/6aspec/green/status.md +1 -1
  45. package/.claude/commands/6aspec/green/tasks.md +2 -2
  46. package/.claude/commands/6aspec/green/visual-logic.md +2 -2
  47. package/.claude/commands/opsx/apply.md +152 -0
  48. package/.claude/commands/opsx/archive.md +157 -0
  49. package/.claude/commands/opsx/bulk-archive.md +242 -0
  50. package/.claude/commands/opsx/continue.md +114 -0
  51. package/.claude/commands/opsx/explore.md +174 -0
  52. package/.claude/commands/opsx/ff.md +94 -0
  53. package/.claude/commands/opsx/new.md +69 -0
  54. package/.claude/commands/opsx/onboard.md +525 -0
  55. package/.claude/commands/opsx/sync.md +134 -0
  56. package/.claude/commands/opsx/verify.md +164 -0
  57. package/.claude/settings.local.json +21 -1
  58. package/.cursor/commands/6aspec/brown/explore.md +11 -0
  59. package/.cursor/commands/6aspec/brown/update.md +9 -0
  60. package/.cursor/commands/6aspec/code.md +8 -0
  61. package/.cursor/commands/6aspec/green/archive.md +1 -1
  62. package/.cursor/commands/6aspec/green/clarify.md +2 -2
  63. package/.cursor/commands/6aspec/green/continue.md +1 -1
  64. package/.cursor/commands/6aspec/green/design.md +2 -2
  65. package/.cursor/commands/6aspec/green/{execute-task.md → implement.md} +1 -1
  66. package/.cursor/commands/6aspec/green/import-model-table.md +1 -1
  67. package/.cursor/commands/6aspec/green/init.md +2 -2
  68. package/.cursor/commands/6aspec/green/model.md +2 -2
  69. package/.cursor/commands/6aspec/green/new.md +2 -2
  70. package/.cursor/commands/6aspec/green/rollback.md +1 -1
  71. package/.cursor/commands/6aspec/green/status.md +1 -1
  72. package/.cursor/commands/6aspec/green/tasks.md +2 -2
  73. package/.cursor/commands/6aspec/green/visual-logic.md +2 -2
  74. package/.cursor/commands/opsx-apply.md +152 -0
  75. package/.cursor/commands/opsx-archive.md +157 -0
  76. package/.cursor/commands/opsx-bulk-archive.md +242 -0
  77. package/.cursor/commands/opsx-continue.md +114 -0
  78. package/.cursor/commands/opsx-explore.md +174 -0
  79. package/.cursor/commands/opsx-ff.md +94 -0
  80. package/.cursor/commands/opsx-new.md +69 -0
  81. package/.cursor/commands/opsx-onboard.md +525 -0
  82. package/.cursor/commands/opsx-sync.md +134 -0
  83. package/.cursor/commands/opsx-verify.md +164 -0
  84. package/README.md +1 -1
  85. package/bin/6aspec +17 -1
  86. package/lib/cli.js +1 -1
  87. package/package.json +1 -1
  88. /package/.6aspec/rules/green/{6A_constitution.md → green_constitution.md} +0 -0
  89. /package/.6aspec/rules/green/{6A_design_sop.md → green_design_sop.md} +0 -0
  90. /package/.6aspec/rules/green/{6A_import_model_table_sop.md → green_import_model_table_sop.md} +0 -0
  91. /package/.6aspec/rules/green/{6A_init_event_list_sop.md → green_init_event_list_sop.md} +0 -0
  92. /package/.6aspec/rules/green/{6A_init_map_sop.md → green_init_map_sop.md} +0 -0
  93. /package/.6aspec/rules/green/{6A_model_sop.md → green_model_sop.md} +0 -0
  94. /package/.6aspec/rules/green/{6A_rollback_sop.md → green_rollback_sop.md} +0 -0
  95. /package/.6aspec/rules/green/{6A_visual_logic_sop.md → green_visual_logic_sop.md} +0 -0
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: /opsx-sync
3
+ id: opsx-sync
4
+ category: Workflow
5
+ description: Sync delta specs from a change to main specs
6
+ ---
7
+
8
+ Sync delta specs from a change to main specs.
9
+
10
+ This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
11
+
12
+ **Input**: Optionally specify a change name after `/opsx:sync` (e.g., `/opsx:sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
13
+
14
+ **Steps**
15
+
16
+ 1. **If no change name provided, prompt for selection**
17
+
18
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
19
+
20
+ Show changes that have delta specs (under `specs/` directory).
21
+
22
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
23
+
24
+ 2. **Find delta specs**
25
+
26
+ Look for delta spec files in `openspec/changes/<name>/specs/*/spec.md`.
27
+
28
+ Each delta spec file contains sections like:
29
+ - `## ADDED Requirements` - New requirements to add
30
+ - `## MODIFIED Requirements` - Changes to existing requirements
31
+ - `## REMOVED Requirements` - Requirements to remove
32
+ - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
33
+
34
+ If no delta specs found, inform user and stop.
35
+
36
+ 3. **For each delta spec, apply changes to main specs**
37
+
38
+ For each capability with a delta spec at `openspec/changes/<name>/specs/<capability>/spec.md`:
39
+
40
+ a. **Read the delta spec** to understand the intended changes
41
+
42
+ b. **Read the main spec** at `openspec/specs/<capability>/spec.md` (may not exist yet)
43
+
44
+ c. **Apply changes intelligently**:
45
+
46
+ **ADDED Requirements:**
47
+ - If requirement doesn't exist in main spec → add it
48
+ - If requirement already exists → update it to match (treat as implicit MODIFIED)
49
+
50
+ **MODIFIED Requirements:**
51
+ - Find the requirement in main spec
52
+ - Apply the changes - this can be:
53
+ - Adding new scenarios (don't need to copy existing ones)
54
+ - Modifying existing scenarios
55
+ - Changing the requirement description
56
+ - Preserve scenarios/content not mentioned in the delta
57
+
58
+ **REMOVED Requirements:**
59
+ - Remove the entire requirement block from main spec
60
+
61
+ **RENAMED Requirements:**
62
+ - Find the FROM requirement, rename to TO
63
+
64
+ d. **Create new main spec** if capability doesn't exist yet:
65
+ - Create `openspec/specs/<capability>/spec.md`
66
+ - Add Purpose section (can be brief, mark as TBD)
67
+ - Add Requirements section with the ADDED requirements
68
+
69
+ 4. **Show summary**
70
+
71
+ After applying all changes, summarize:
72
+ - Which capabilities were updated
73
+ - What changes were made (requirements added/modified/removed/renamed)
74
+
75
+ **Delta Spec Format Reference**
76
+
77
+ ```markdown
78
+ ## ADDED Requirements
79
+
80
+ ### Requirement: New Feature
81
+ The system SHALL do something new.
82
+
83
+ #### Scenario: Basic case
84
+ - **WHEN** user does X
85
+ - **THEN** system does Y
86
+
87
+ ## MODIFIED Requirements
88
+
89
+ ### Requirement: Existing Feature
90
+ #### Scenario: New scenario to add
91
+ - **WHEN** user does A
92
+ - **THEN** system does B
93
+
94
+ ## REMOVED Requirements
95
+
96
+ ### Requirement: Deprecated Feature
97
+
98
+ ## RENAMED Requirements
99
+
100
+ - FROM: `### Requirement: Old Name`
101
+ - TO: `### Requirement: New Name`
102
+ ```
103
+
104
+ **Key Principle: Intelligent Merging**
105
+
106
+ Unlike programmatic merging, you can apply **partial updates**:
107
+ - To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
108
+ - The delta represents *intent*, not a wholesale replacement
109
+ - Use your judgment to merge changes sensibly
110
+
111
+ **Output On Success**
112
+
113
+ ```
114
+ ## Specs Synced: <change-name>
115
+
116
+ Updated main specs:
117
+
118
+ **<capability-1>**:
119
+ - Added requirement: "New Feature"
120
+ - Modified requirement: "Existing Feature" (added 1 scenario)
121
+
122
+ **<capability-2>**:
123
+ - Created new spec file
124
+ - Added requirement: "Another Feature"
125
+
126
+ Main specs are now updated. The change remains active - archive when implementation is complete.
127
+ ```
128
+
129
+ **Guardrails**
130
+ - Read both delta and main specs before making changes
131
+ - Preserve existing content not mentioned in delta
132
+ - If something is unclear, ask for clarification
133
+ - Show what you're changing as you go
134
+ - The operation should be idempotent - running twice should give same result
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: /opsx-verify
3
+ id: opsx-verify
4
+ category: Workflow
5
+ description: Verify implementation matches change artifacts before archiving
6
+ ---
7
+
8
+ Verify that an implementation matches the change artifacts (specs, tasks, design).
9
+
10
+ **Input**: Optionally specify a change name after `/opsx:verify` (e.g., `/opsx:verify add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
11
+
12
+ **Steps**
13
+
14
+ 1. **If no change name provided, prompt for selection**
15
+
16
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
17
+
18
+ Show changes that have implementation tasks (tasks artifact exists).
19
+ Include the schema used for each change if available.
20
+ Mark changes with incomplete tasks as "(In Progress)".
21
+
22
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
23
+
24
+ 2. **Check status to understand the schema**
25
+ ```bash
26
+ openspec status --change "<name>" --json
27
+ ```
28
+ Parse the JSON to understand:
29
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
30
+ - Which artifacts exist for this change
31
+
32
+ 3. **Get the change directory and load artifacts**
33
+
34
+ ```bash
35
+ openspec instructions apply --change "<name>" --json
36
+ ```
37
+
38
+ This returns the change directory and context files. Read all available artifacts from `contextFiles`.
39
+
40
+ 4. **Initialize verification report structure**
41
+
42
+ Create a report structure with three dimensions:
43
+ - **Completeness**: Track tasks and spec coverage
44
+ - **Correctness**: Track requirement implementation and scenario coverage
45
+ - **Coherence**: Track design adherence and pattern consistency
46
+
47
+ Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
48
+
49
+ 5. **Verify Completeness**
50
+
51
+ **Task Completion**:
52
+ - If tasks.md exists in contextFiles, read it
53
+ - Parse checkboxes: `- [ ]` (incomplete) vs `- [x]` (complete)
54
+ - Count complete vs total tasks
55
+ - If incomplete tasks exist:
56
+ - Add CRITICAL issue for each incomplete task
57
+ - Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
58
+
59
+ **Spec Coverage**:
60
+ - If delta specs exist in `openspec/changes/<name>/specs/`:
61
+ - Extract all requirements (marked with "### Requirement:")
62
+ - For each requirement:
63
+ - Search codebase for keywords related to the requirement
64
+ - Assess if implementation likely exists
65
+ - If requirements appear unimplemented:
66
+ - Add CRITICAL issue: "Requirement not found: <requirement name>"
67
+ - Recommendation: "Implement requirement X: <description>"
68
+
69
+ 6. **Verify Correctness**
70
+
71
+ **Requirement Implementation Mapping**:
72
+ - For each requirement from delta specs:
73
+ - Search codebase for implementation evidence
74
+ - If found, note file paths and line ranges
75
+ - Assess if implementation matches requirement intent
76
+ - If divergence detected:
77
+ - Add WARNING: "Implementation may diverge from spec: <details>"
78
+ - Recommendation: "Review <file>:<lines> against requirement X"
79
+
80
+ **Scenario Coverage**:
81
+ - For each scenario in delta specs (marked with "#### Scenario:"):
82
+ - Check if conditions are handled in code
83
+ - Check if tests exist covering the scenario
84
+ - If scenario appears uncovered:
85
+ - Add WARNING: "Scenario not covered: <scenario name>"
86
+ - Recommendation: "Add test or implementation for scenario: <description>"
87
+
88
+ 7. **Verify Coherence**
89
+
90
+ **Design Adherence**:
91
+ - If design.md exists in contextFiles:
92
+ - Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
93
+ - Verify implementation follows those decisions
94
+ - If contradiction detected:
95
+ - Add WARNING: "Design decision not followed: <decision>"
96
+ - Recommendation: "Update implementation or revise design.md to match reality"
97
+ - If no design.md: Skip design adherence check, note "No design.md to verify against"
98
+
99
+ **Code Pattern Consistency**:
100
+ - Review new code for consistency with project patterns
101
+ - Check file naming, directory structure, coding style
102
+ - If significant deviations found:
103
+ - Add SUGGESTION: "Code pattern deviation: <details>"
104
+ - Recommendation: "Consider following project pattern: <example>"
105
+
106
+ 8. **Generate Verification Report**
107
+
108
+ **Summary Scorecard**:
109
+ ```
110
+ ## Verification Report: <change-name>
111
+
112
+ ### Summary
113
+ | Dimension | Status |
114
+ |--------------|------------------|
115
+ | Completeness | X/Y tasks, N reqs|
116
+ | Correctness | M/N reqs covered |
117
+ | Coherence | Followed/Issues |
118
+ ```
119
+
120
+ **Issues by Priority**:
121
+
122
+ 1. **CRITICAL** (Must fix before archive):
123
+ - Incomplete tasks
124
+ - Missing requirement implementations
125
+ - Each with specific, actionable recommendation
126
+
127
+ 2. **WARNING** (Should fix):
128
+ - Spec/design divergences
129
+ - Missing scenario coverage
130
+ - Each with specific recommendation
131
+
132
+ 3. **SUGGESTION** (Nice to fix):
133
+ - Pattern inconsistencies
134
+ - Minor improvements
135
+ - Each with specific recommendation
136
+
137
+ **Final Assessment**:
138
+ - If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
139
+ - If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
140
+ - If all clear: "All checks passed. Ready for archive."
141
+
142
+ **Verification Heuristics**
143
+
144
+ - **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
145
+ - **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
146
+ - **Coherence**: Look for glaring inconsistencies, don't nitpick style
147
+ - **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
148
+ - **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
149
+
150
+ **Graceful Degradation**
151
+
152
+ - If only tasks.md exists: verify task completion only, skip spec/design checks
153
+ - If tasks + specs exist: verify completeness and correctness, skip design
154
+ - If full artifacts: verify all three dimensions
155
+ - Always note which checks were skipped and why
156
+
157
+ **Output Format**
158
+
159
+ Use clear markdown with:
160
+ - Table for summary scorecard
161
+ - Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
162
+ - Code references in format: `file.ts:123`
163
+ - Specific, actionable recommendations
164
+ - No vague suggestions like "consider reviewing"
package/README.md CHANGED
@@ -118,7 +118,7 @@ npm install -g 6aspec@2.0.0
118
118
  |------|------|
119
119
  | `/6aspec:green:new` | 创建一个模块 |
120
120
  | `/6aspec:green:continue` | 生成下一个工件 |
121
- | `/6aspec:green:execute-task` | 执行任务 |
121
+ | `/6aspec:green:implement` | 执行任务 |
122
122
  | `/6aspec:green:init` | 初始化项目 |
123
123
  | `/6aspec:green:status` | 查看状态 |
124
124
  | `/6aspec:green:model` | 数据建模 |
package/bin/6aspec CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const path = require('path');
4
+ const pkg = require('../package.json');
4
5
  const cli = require('../lib/cli');
5
6
 
6
7
  const args = process.argv.slice(2);
@@ -8,7 +9,7 @@ const command = args[0];
8
9
 
9
10
  if (!command || command === '--help' || command === '-h') {
10
11
  console.log(`
11
- \x1b[36m6Aspec\x1b[0m - 轻量级 spec 驱动开发框架
12
+ \x1b[36m6Aspec\x1b[0m v${pkg.version} - 轻量级 spec 驱动开发框架
12
13
 
13
14
  用法:
14
15
  6aspec <command>
@@ -16,6 +17,7 @@ if (!command || command === '--help' || command === '-h') {
16
17
  命令:
17
18
  init 交互式初始化(选择工具 + 安装配置)
18
19
  update 更新已安装的工具配置(merge 模式)
20
+ version 显示当前 CLI 版本
19
21
  --help 显示帮助信息
20
22
 
21
23
  示例:
@@ -27,6 +29,20 @@ if (!command || command === '--help' || command === '-h') {
27
29
  process.exit(0);
28
30
  }
29
31
 
32
+ if (command === '--version' || command === '-v' || command === 'version') {
33
+ const fs = require('fs');
34
+ const configPath = path.join(process.cwd(), '.6aspec/init.json');
35
+ let projectInfo = '';
36
+ if (fs.existsSync(configPath)) {
37
+ try {
38
+ const cfg = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
39
+ projectInfo = `\n\x1b[2m 当前项目已安装: ${cfg.tools.join(', ')} (版本 ${cfg.version || 'unknown'})\x1b[0m`;
40
+ } catch {}
41
+ }
42
+ console.log(`\x1b[36m6Aspec\x1b[0m v${pkg.version}${projectInfo}`);
43
+ process.exit(0);
44
+ }
45
+
30
46
  (async () => {
31
47
  try {
32
48
  switch (command) {
package/lib/cli.js CHANGED
@@ -88,7 +88,7 @@ function buildRightLines() {
88
88
  ` ${MAGENTA}Greenfield (new project):${RESET}`,
89
89
  ` ${GREEN}/6aspec:green:new${RESET} Create a module`,
90
90
  ` ${GREEN}/6aspec:green:continue${RESET} Next artifact`,
91
- ` ${GREEN}/6aspec:green:execute-task${RESET} Execute tasks`,
91
+ ` ${GREEN}/6aspec:green:implement${RESET} Execute tasks`,
92
92
  ];
93
93
  }
94
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "6aspec",
3
- "version": "2.0.0-dev.3",
3
+ "version": "2.0.0-dev.30",
4
4
  "description": "6Aspec - 轻量级 spec 驱动开发框架,支持 Cursor 和 Claude Code",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {