synarcx 0.2.0 → 0.2.1
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 +233 -39
- package/dist/commands/config.js +7 -6
- package/dist/core/command-generation/adapters/bob.js +7 -20
- package/dist/core/command-generation/adapters/claude.js +9 -29
- package/dist/core/command-generation/adapters/cursor.js +9 -22
- package/dist/core/command-generation/adapters/pi.js +6 -19
- package/dist/core/command-generation/adapters/windsurf.js +9 -29
- package/dist/core/command-generation/yaml-utils.d.ts +3 -0
- package/dist/core/command-generation/yaml-utils.js +12 -0
- package/dist/core/completions/installers/bash-installer.d.ts +1 -0
- package/dist/core/completions/installers/bash-installer.js +14 -3
- package/dist/core/completions/installers/powershell-installer.d.ts +1 -0
- package/dist/core/completions/installers/powershell-installer.js +18 -10
- package/dist/core/config.js +0 -3
- package/dist/core/index.js +1 -1
- package/dist/core/init.d.ts +0 -2
- package/dist/core/init.js +27 -77
- package/dist/core/migration.js +1 -2
- package/dist/core/profile-sync-drift.d.ts +0 -7
- package/dist/core/profile-sync-drift.js +2 -17
- package/dist/core/profiles.d.ts +0 -11
- package/dist/core/profiles.js +1 -20
- package/dist/core/shared/artifact-cleanup.d.ts +5 -0
- package/dist/core/shared/artifact-cleanup.js +89 -0
- package/dist/core/shared/tool-detection.d.ts +4 -10
- package/dist/core/shared/tool-detection.js +3 -31
- package/dist/core/shared/workflow-registry.d.ts +40 -0
- package/dist/core/shared/workflow-registry.js +19 -0
- package/dist/core/templates/types.d.ts +7 -0
- package/dist/core/templates/types.js +9 -1
- package/dist/core/templates/workflows/analyze.js +84 -84
- package/dist/core/templates/workflows/apply-change.js +291 -291
- package/dist/core/templates/workflows/archive-change.js +254 -254
- package/dist/core/templates/workflows/clarify.js +91 -91
- package/dist/core/templates/workflows/debug.js +100 -100
- package/dist/core/templates/workflows/explore.js +462 -462
- package/dist/core/templates/workflows/propose.js +199 -199
- package/dist/core/templates/workflows/quick.js +112 -112
- package/dist/core/templates/workflows/refactor.js +109 -109
- package/dist/core/templates/workflows/sync.js +148 -148
- package/dist/core/update.d.ts +1 -21
- package/dist/core/update.js +18 -117
- package/dist/core/view.js +8 -8
- package/dist/core/workspace/open-surface.d.ts +2 -2
- package/dist/core/workspace/open-surface.js +13 -13
- package/package.json +84 -76
|
@@ -1,90 +1,91 @@
|
|
|
1
|
+
import { commandFromSkill } from '../types.js';
|
|
1
2
|
export function getSynRefactorSkillTemplate() {
|
|
2
3
|
return {
|
|
3
4
|
name: 'syn-refactor',
|
|
4
5
|
description: 'Investigate structural changes that must not alter behavior. Entry point for refactoring — explores, then hands off to /syn:propose.',
|
|
5
|
-
instructions: `Investigate a structural refactoring opportunity. Focuses on improving code structure without changing observable behavior. When thinking is clear, explicitly prompts the user to run \`/syn:propose\` — does NOT auto-create artifacts.
|
|
6
|
-
|
|
7
|
-
**Input**: The user can describe what they want to restructure, or just run the command to start exploring.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Initial Context
|
|
12
|
-
|
|
13
|
-
Check for existing context:
|
|
14
|
-
\`\`\`bash
|
|
15
|
-
synarcx list --json
|
|
16
|
-
\`\`\`
|
|
17
|
-
|
|
18
|
-
If a relevant change exists, read its artifacts. Otherwise, start fresh.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Reframing the Problem
|
|
23
|
-
|
|
24
|
-
This is a structural-change investigation. The goal is to improve code organization, reduce duplication, increase cohesion, or decrease coupling — without changing what the system does.
|
|
25
|
-
|
|
26
|
-
### Opening Question
|
|
27
|
-
|
|
28
|
-
Start by asking (use AskUserQuestion tool, open-ended):
|
|
29
|
-
> "What part of the codebase feels like it needs restructuring?"
|
|
30
|
-
|
|
31
|
-
Let the user describe the pain point before diving in.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Investigation
|
|
36
|
-
|
|
37
|
-
Explore the codebase to understand the current structure:
|
|
38
|
-
|
|
39
|
-
1. **Map the current shape** — read relevant source files, identify:
|
|
40
|
-
- Module boundaries and responsibilities
|
|
41
|
-
- Dependency direction
|
|
42
|
-
- Code duplication or overlapping concerns
|
|
43
|
-
- Testing patterns
|
|
44
|
-
|
|
45
|
-
2. **Identify the target shape** — work with the user to define:
|
|
46
|
-
- What the ideal structure would look like
|
|
47
|
-
- Which modules or files move where
|
|
48
|
-
- How dependencies should flow
|
|
49
|
-
|
|
50
|
-
3. **Surface risks** — flag areas of concern:
|
|
51
|
-
- Implicit dependencies that aren't visible in imports
|
|
52
|
-
- Areas where refactoring could make things worse
|
|
53
|
-
- Testing hazards (brittle tests, high coupling to internals)
|
|
54
|
-
|
|
55
|
-
4. **Visualize** — use ASCII diagrams to show:
|
|
56
|
-
- Current vs. target module structure
|
|
57
|
-
- Dependency direction changes
|
|
58
|
-
- File/move relationships
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Analyze-Gate Note (for the /syn:analyze phase)
|
|
63
|
-
|
|
64
|
-
When a proposal is created from this investigation, the analyze phase MUST check:
|
|
65
|
-
- Does the proposed change alter any public API signature?
|
|
66
|
-
- Does it change output format, error messages, or user-facing behavior?
|
|
67
|
-
- Does it add new functionality beyond what existed?
|
|
68
|
-
|
|
69
|
-
If any of these is true → flag as a **behavior contract violation** and suggest reclassifying as a feature (not a refactor).
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Hand-Off
|
|
74
|
-
|
|
75
|
-
When the investigation reaches a clear conclusion, present findings and explicitly prompt:
|
|
76
|
-
|
|
77
|
-
\`\`\`
|
|
78
|
-
### Refactoring Plan
|
|
79
|
-
|
|
80
|
-
**Current Shape**: <summary of current structure>
|
|
81
|
-
**Target Shape**: <proposed structure>
|
|
82
|
-
**Key Changes**: <list of structural moves>
|
|
83
|
-
**Risks**: <potential issues>
|
|
84
|
-
|
|
85
|
-
**Ready to formalize?** Run \`/syn:propose\` to create a change with these findings.
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
6
|
+
instructions: `Investigate a structural refactoring opportunity. Focuses on improving code structure without changing observable behavior. When thinking is clear, explicitly prompts the user to run \`/syn:propose\` — does NOT auto-create artifacts.
|
|
7
|
+
|
|
8
|
+
**Input**: The user can describe what they want to restructure, or just run the command to start exploring.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Initial Context
|
|
13
|
+
|
|
14
|
+
Check for existing context:
|
|
15
|
+
\`\`\`bash
|
|
16
|
+
synarcx list --json
|
|
17
|
+
\`\`\`
|
|
18
|
+
|
|
19
|
+
If a relevant change exists, read its artifacts. Otherwise, start fresh.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Reframing the Problem
|
|
24
|
+
|
|
25
|
+
This is a structural-change investigation. The goal is to improve code organization, reduce duplication, increase cohesion, or decrease coupling — without changing what the system does.
|
|
26
|
+
|
|
27
|
+
### Opening Question
|
|
28
|
+
|
|
29
|
+
Start by asking (use AskUserQuestion tool, open-ended):
|
|
30
|
+
> "What part of the codebase feels like it needs restructuring?"
|
|
31
|
+
|
|
32
|
+
Let the user describe the pain point before diving in.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Investigation
|
|
37
|
+
|
|
38
|
+
Explore the codebase to understand the current structure:
|
|
39
|
+
|
|
40
|
+
1. **Map the current shape** — read relevant source files, identify:
|
|
41
|
+
- Module boundaries and responsibilities
|
|
42
|
+
- Dependency direction
|
|
43
|
+
- Code duplication or overlapping concerns
|
|
44
|
+
- Testing patterns
|
|
45
|
+
|
|
46
|
+
2. **Identify the target shape** — work with the user to define:
|
|
47
|
+
- What the ideal structure would look like
|
|
48
|
+
- Which modules or files move where
|
|
49
|
+
- How dependencies should flow
|
|
50
|
+
|
|
51
|
+
3. **Surface risks** — flag areas of concern:
|
|
52
|
+
- Implicit dependencies that aren't visible in imports
|
|
53
|
+
- Areas where refactoring could make things worse
|
|
54
|
+
- Testing hazards (brittle tests, high coupling to internals)
|
|
55
|
+
|
|
56
|
+
4. **Visualize** — use ASCII diagrams to show:
|
|
57
|
+
- Current vs. target module structure
|
|
58
|
+
- Dependency direction changes
|
|
59
|
+
- File/move relationships
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Analyze-Gate Note (for the /syn:analyze phase)
|
|
64
|
+
|
|
65
|
+
When a proposal is created from this investigation, the analyze phase MUST check:
|
|
66
|
+
- Does the proposed change alter any public API signature?
|
|
67
|
+
- Does it change output format, error messages, or user-facing behavior?
|
|
68
|
+
- Does it add new functionality beyond what existed?
|
|
69
|
+
|
|
70
|
+
If any of these is true → flag as a **behavior contract violation** and suggest reclassifying as a feature (not a refactor).
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Hand-Off
|
|
75
|
+
|
|
76
|
+
When the investigation reaches a clear conclusion, present findings and explicitly prompt:
|
|
77
|
+
|
|
78
|
+
\`\`\`
|
|
79
|
+
### Refactoring Plan
|
|
80
|
+
|
|
81
|
+
**Current Shape**: <summary of current structure>
|
|
82
|
+
**Target Shape**: <proposed structure>
|
|
83
|
+
**Key Changes**: <list of structural moves>
|
|
84
|
+
**Risks**: <potential issues>
|
|
85
|
+
|
|
86
|
+
**Ready to formalize?** Run \`/syn:propose\` to create a change with these findings.
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
88
89
|
Do NOT create any artifacts or start the pipeline. The user must explicitly run \`/syn:propose\`.`,
|
|
89
90
|
license: 'MIT',
|
|
90
91
|
compatibility: 'Requires synarcx CLI.',
|
|
@@ -92,35 +93,34 @@ Do NOT create any artifacts or start the pipeline. The user must explicitly run
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
export function getSynRefactorCommandTemplate() {
|
|
95
|
-
return {
|
|
96
|
+
return commandFromSkill(getSynRefactorSkillTemplate(), {
|
|
96
97
|
name: 'syn:refactor',
|
|
97
98
|
description: 'Investigate structural refactoring — map current vs. target shape, then hands off to /syn:propose',
|
|
98
|
-
category: 'Workflow',
|
|
99
99
|
tags: ['workflow', 'refactor', 'restructure'],
|
|
100
|
-
content: `Investigate a structural refactoring opportunity. Focuses on improving code structure without changing observable behavior. When thinking is clear, explicitly prompts the user to run \`/syn:propose\` — does NOT auto-create artifacts.
|
|
101
|
-
|
|
102
|
-
**Input**: The argument after \`/syn:refactor\` describes what the user wants to restructure.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Investigation
|
|
107
|
-
|
|
108
|
-
1. **Map the current shape** — read relevant source files, identify module boundaries, dependencies, duplication.
|
|
109
|
-
2. **Identify the target shape** — define what the ideal structure looks like.
|
|
110
|
-
3. **Surface risks** — flag implicit dependencies, testing hazards, areas that could get worse.
|
|
111
|
-
4. **Visualize** — use ASCII diagrams to show current vs. target structure.
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Analyze-Gate Note
|
|
116
|
-
|
|
117
|
-
When artifacts are created, the analyze phase MUST check for behavior contract violations — no public API changes, no output format changes, no new functionality. If violated, flag and suggest reclassifying as a feature.
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Hand-Off
|
|
122
|
-
|
|
100
|
+
content: `Investigate a structural refactoring opportunity. Focuses on improving code structure without changing observable behavior. When thinking is clear, explicitly prompts the user to run \`/syn:propose\` — does NOT auto-create artifacts.
|
|
101
|
+
|
|
102
|
+
**Input**: The argument after \`/syn:refactor\` describes what the user wants to restructure.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Investigation
|
|
107
|
+
|
|
108
|
+
1. **Map the current shape** — read relevant source files, identify module boundaries, dependencies, duplication.
|
|
109
|
+
2. **Identify the target shape** — define what the ideal structure looks like.
|
|
110
|
+
3. **Surface risks** — flag implicit dependencies, testing hazards, areas that could get worse.
|
|
111
|
+
4. **Visualize** — use ASCII diagrams to show current vs. target structure.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Analyze-Gate Note
|
|
116
|
+
|
|
117
|
+
When artifacts are created, the analyze phase MUST check for behavior contract violations — no public API changes, no output format changes, no new functionality. If violated, flag and suggest reclassifying as a feature.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Hand-Off
|
|
122
|
+
|
|
123
123
|
Present a summary with Current Shape, Target Shape, Key Changes, and Risks. Then explicitly prompt: "Ready to formalize? Run \`/syn:propose\` to create a change with these findings."`
|
|
124
|
-
};
|
|
124
|
+
});
|
|
125
125
|
}
|
|
126
126
|
//# sourceMappingURL=refactor.js.map
|
|
@@ -1,101 +1,102 @@
|
|
|
1
|
+
import { commandFromSkill } from '../types.js';
|
|
1
2
|
export function getSynSyncSkillTemplate() {
|
|
2
3
|
return {
|
|
3
4
|
name: 'syn-sync',
|
|
4
5
|
description: 'Generate or update synspec/constitution.md with README validation, supporting file scan, guardrail Q&A, and structured constitution generation.',
|
|
5
|
-
instructions: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures validated project context.
|
|
6
|
-
|
|
7
|
-
**Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## README Gate (Required)
|
|
12
|
-
|
|
13
|
-
Before any generation, the README MUST pass quality validation.
|
|
14
|
-
|
|
15
|
-
1. **Check that README.md exists and is not empty.**
|
|
16
|
-
- If missing or blank → stop, output: "SYNC BLOCKED: README.md is missing or empty. Please write a README that describes what this project does and what problem it solves, then re-run \`/syn:sync\`."
|
|
17
|
-
- Do NOT write any files. Do NOT proceed.
|
|
18
|
-
|
|
19
|
-
2. **Check that README meaningfully describes the project.**
|
|
20
|
-
- A passing README must have both:
|
|
21
|
-
- At least one sentence describing what the project does
|
|
22
|
-
- At least one sentence describing the problem it solves or who it is for
|
|
23
|
-
- AI judges quality at runtime. Examples of THIN content that should fail:
|
|
24
|
-
- Only a title and install instructions
|
|
25
|
-
- Auto-generated placeholder text ("# My Project", "## Getting Started")
|
|
26
|
-
- Single-line descriptions with no substance
|
|
27
|
-
- If README is too thin → stop, output: "SYNC BLOCKED: README is too thin. A passing README must describe (1) what the project does and (2) what problem it solves, in at least one sentence each. Please update README.md and re-run \`/syn:sync\`."
|
|
28
|
-
|
|
29
|
-
3. **If README passes**, proceed to the next phase.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Supporting File Scan
|
|
34
|
-
|
|
35
|
-
After README passes, read supporting project files for context:
|
|
36
|
-
- \`AGENTS.md\` — AI agent conventions
|
|
37
|
-
- \`package.json\` — dependencies, scripts, metadata
|
|
38
|
-
- \`src/\` structure — code organization (top-level directories)
|
|
39
|
-
- Any other notable config files (\`tsconfig.json\`, \`.eslintrc.*\`, etc.)
|
|
40
|
-
|
|
41
|
-
Note what information is already well-covered by the README so guardrail questions avoid repeating it.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Guardrail Q&A
|
|
46
|
-
|
|
47
|
-
Generate up to 5 targeted questions. Each question should probe areas that CANNOT be reliably inferred from code or README alone:
|
|
48
|
-
|
|
49
|
-
| Topic Area | Example Question |
|
|
50
|
-
|------------|-----------------|
|
|
51
|
-
| Off-limits areas | "Are there any parts of the codebase AI should never modify?" |
|
|
52
|
-
| Hard constraints | "Are there compliance, security, or infrastructure constraints?" |
|
|
53
|
-
| Coding rules | "Are there coding conventions not obvious from the code?" |
|
|
54
|
-
| Out-of-scope | "What is explicitly out of scope for this project right now?" |
|
|
55
|
-
| Dependencies | "Are there any planned or pending dependency changes?" |
|
|
56
|
-
|
|
57
|
-
**Rules:**
|
|
58
|
-
- Adapt questions to the project's stack, structure, and domain — don't ask generic questions that don't apply
|
|
59
|
-
- Skip questions already answered by the README, AGENTS.md, or other supporting files
|
|
60
|
-
- Maximum 5 questions per session
|
|
61
|
-
- Ask one at a time using the AskUserQuestion tool, wait for each answer
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Constitution Generation
|
|
66
|
-
|
|
67
|
-
With README validated, supporting files scanned, and Q&A answers collected, generate \`synspec/constitution.md\` with these sections:
|
|
68
|
-
|
|
69
|
-
1. **\`# Constitution: <project-name>\`** — derived from package.json name, with Version field
|
|
70
|
-
2. **\`## Purpose\`** — 2-3 sentences synthesized from README
|
|
71
|
-
3. **\`## Principles\`** — key design principles inferred from codebase and Q&A
|
|
72
|
-
4. **\`## Tech Stack\`** — languages, frameworks, key dependencies from package.json
|
|
73
|
-
5. **\`## Constraints\`** — from Q&A answers: hard constraints, compliance, infra limits
|
|
74
|
-
6. **\`## Off-Limits\`** — from Q&A answers: areas AI must not touch, out-of-scope items
|
|
75
|
-
7. **\`## Conventions\`** — code style, naming, patterns observed from code and AGENTS.md
|
|
76
|
-
8. **\`## Architecture\`** — high-level structure overview from src/ scan
|
|
77
|
-
9. **\`## Decision Log\`** — table with Date, Decision, Rationale (append-only)
|
|
78
|
-
|
|
79
|
-
**The Constraints and Off-Limits sections MUST be written from Q&A answers, not inferred from docs.**
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Re-run (Update)
|
|
84
|
-
|
|
85
|
-
When re-run and \`synspec/constitution.md\` already exists, still run the README gate — README may have degraded since last sync. Offer a semver bump choice:
|
|
86
|
-
- **MAJOR** — constitution structure changed or reorganized
|
|
87
|
-
- **MINOR** — new section added
|
|
88
|
-
- **PATCH** — content update, typo fixes
|
|
89
|
-
|
|
90
|
-
Append a Sync Impact Report as an HTML comment at the top:
|
|
91
|
-
\`\`\`
|
|
92
|
-
<!-- Sync Impact: MAJOR — constitution structure reorganized -->
|
|
93
|
-
\`\`\`
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Output
|
|
98
|
-
|
|
6
|
+
instructions: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures validated project context.
|
|
7
|
+
|
|
8
|
+
**Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## README Gate (Required)
|
|
13
|
+
|
|
14
|
+
Before any generation, the README MUST pass quality validation.
|
|
15
|
+
|
|
16
|
+
1. **Check that README.md exists and is not empty.**
|
|
17
|
+
- If missing or blank → stop, output: "SYNC BLOCKED: README.md is missing or empty. Please write a README that describes what this project does and what problem it solves, then re-run \`/syn:sync\`."
|
|
18
|
+
- Do NOT write any files. Do NOT proceed.
|
|
19
|
+
|
|
20
|
+
2. **Check that README meaningfully describes the project.**
|
|
21
|
+
- A passing README must have both:
|
|
22
|
+
- At least one sentence describing what the project does
|
|
23
|
+
- At least one sentence describing the problem it solves or who it is for
|
|
24
|
+
- AI judges quality at runtime. Examples of THIN content that should fail:
|
|
25
|
+
- Only a title and install instructions
|
|
26
|
+
- Auto-generated placeholder text ("# My Project", "## Getting Started")
|
|
27
|
+
- Single-line descriptions with no substance
|
|
28
|
+
- If README is too thin → stop, output: "SYNC BLOCKED: README is too thin. A passing README must describe (1) what the project does and (2) what problem it solves, in at least one sentence each. Please update README.md and re-run \`/syn:sync\`."
|
|
29
|
+
|
|
30
|
+
3. **If README passes**, proceed to the next phase.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Supporting File Scan
|
|
35
|
+
|
|
36
|
+
After README passes, read supporting project files for context:
|
|
37
|
+
- \`AGENTS.md\` — AI agent conventions
|
|
38
|
+
- \`package.json\` — dependencies, scripts, metadata
|
|
39
|
+
- \`src/\` structure — code organization (top-level directories)
|
|
40
|
+
- Any other notable config files (\`tsconfig.json\`, \`.eslintrc.*\`, etc.)
|
|
41
|
+
|
|
42
|
+
Note what information is already well-covered by the README so guardrail questions avoid repeating it.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Guardrail Q&A
|
|
47
|
+
|
|
48
|
+
Generate up to 5 targeted questions. Each question should probe areas that CANNOT be reliably inferred from code or README alone:
|
|
49
|
+
|
|
50
|
+
| Topic Area | Example Question |
|
|
51
|
+
|------------|-----------------|
|
|
52
|
+
| Off-limits areas | "Are there any parts of the codebase AI should never modify?" |
|
|
53
|
+
| Hard constraints | "Are there compliance, security, or infrastructure constraints?" |
|
|
54
|
+
| Coding rules | "Are there coding conventions not obvious from the code?" |
|
|
55
|
+
| Out-of-scope | "What is explicitly out of scope for this project right now?" |
|
|
56
|
+
| Dependencies | "Are there any planned or pending dependency changes?" |
|
|
57
|
+
|
|
58
|
+
**Rules:**
|
|
59
|
+
- Adapt questions to the project's stack, structure, and domain — don't ask generic questions that don't apply
|
|
60
|
+
- Skip questions already answered by the README, AGENTS.md, or other supporting files
|
|
61
|
+
- Maximum 5 questions per session
|
|
62
|
+
- Ask one at a time using the AskUserQuestion tool, wait for each answer
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Constitution Generation
|
|
67
|
+
|
|
68
|
+
With README validated, supporting files scanned, and Q&A answers collected, generate \`synspec/constitution.md\` with these sections:
|
|
69
|
+
|
|
70
|
+
1. **\`# Constitution: <project-name>\`** — derived from package.json name, with Version field
|
|
71
|
+
2. **\`## Purpose\`** — 2-3 sentences synthesized from README
|
|
72
|
+
3. **\`## Principles\`** — key design principles inferred from codebase and Q&A
|
|
73
|
+
4. **\`## Tech Stack\`** — languages, frameworks, key dependencies from package.json
|
|
74
|
+
5. **\`## Constraints\`** — from Q&A answers: hard constraints, compliance, infra limits
|
|
75
|
+
6. **\`## Off-Limits\`** — from Q&A answers: areas AI must not touch, out-of-scope items
|
|
76
|
+
7. **\`## Conventions\`** — code style, naming, patterns observed from code and AGENTS.md
|
|
77
|
+
8. **\`## Architecture\`** — high-level structure overview from src/ scan
|
|
78
|
+
9. **\`## Decision Log\`** — table with Date, Decision, Rationale (append-only)
|
|
79
|
+
|
|
80
|
+
**The Constraints and Off-Limits sections MUST be written from Q&A answers, not inferred from docs.**
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Re-run (Update)
|
|
85
|
+
|
|
86
|
+
When re-run and \`synspec/constitution.md\` already exists, still run the README gate — README may have degraded since last sync. Offer a semver bump choice:
|
|
87
|
+
- **MAJOR** — constitution structure changed or reorganized
|
|
88
|
+
- **MINOR** — new section added
|
|
89
|
+
- **PATCH** — content update, typo fixes
|
|
90
|
+
|
|
91
|
+
Append a Sync Impact Report as an HTML comment at the top:
|
|
92
|
+
\`\`\`
|
|
93
|
+
<!-- Sync Impact: MAJOR — constitution structure reorganized -->
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Output
|
|
99
|
+
|
|
99
100
|
After completion, summarize what was created or updated, note the version, and list how many Q&A questions were answered.`,
|
|
100
101
|
license: 'MIT',
|
|
101
102
|
compatibility: 'Requires synarcx CLI.',
|
|
@@ -103,63 +104,62 @@ After completion, summarize what was created or updated, note the version, and l
|
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
export function getSynSyncCommandTemplate() {
|
|
106
|
-
return {
|
|
107
|
+
return commandFromSkill(getSynSyncSkillTemplate(), {
|
|
107
108
|
name: 'syn:sync',
|
|
108
109
|
description: 'Generate/update project constitution with README validation, guardrail Q&A, and constraint capture',
|
|
109
|
-
category: 'Workflow',
|
|
110
110
|
tags: ['workflow', 'sync', 'project'],
|
|
111
|
-
content: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures validated project context.
|
|
112
|
-
|
|
113
|
-
**Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## README Gate (Required)
|
|
118
|
-
|
|
119
|
-
Before any generation, the README MUST pass quality validation.
|
|
120
|
-
|
|
121
|
-
1. **Check that README.md exists and is not empty.**
|
|
122
|
-
- If missing or blank → stop with message explaining README must exist and describe the project.
|
|
123
|
-
- Do NOT write any files.
|
|
124
|
-
|
|
125
|
-
2. **Check that README meaningfully describes the project.**
|
|
126
|
-
- A passing README must have both: (1) what the project does, (2) what problem it solves.
|
|
127
|
-
- AI judges quality at runtime.
|
|
128
|
-
- If too thin → stop with message explaining what's needed.
|
|
129
|
-
|
|
130
|
-
3. **If README passes**, proceed.
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Supporting File Scan
|
|
135
|
-
|
|
136
|
-
Read AGENTS.md, package.json, src/ structure, and other notable config files. Note what's already covered by README to avoid redundant questions.
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Guardrail Q&A
|
|
141
|
-
|
|
142
|
-
Generate up to 5 targeted questions about off-limits areas, hard constraints, coding rules, out-of-scope items, and dependency plans. Adapt to the project's stack and domain. Skip questions already answered by README or supporting files.
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Constitution Generation
|
|
147
|
-
|
|
148
|
-
Generate \`synspec/constitution.md\` with sections: Purpose, Principles, Tech Stack, Constraints (from Q&A), Off-Limits (from Q&A), Conventions, Architecture, Decision Log.
|
|
149
|
-
|
|
150
|
-
**Constraints and Off-Limits MUST come from Q&A answers, not inferred.**
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Re-run (Update)
|
|
155
|
-
|
|
156
|
-
Still run the README gate even when constitution exists — README may have degraded. Offer semver bump. Append Sync Impact Report HTML comment.
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Output
|
|
161
|
-
|
|
111
|
+
content: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures validated project context.
|
|
112
|
+
|
|
113
|
+
**Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## README Gate (Required)
|
|
118
|
+
|
|
119
|
+
Before any generation, the README MUST pass quality validation.
|
|
120
|
+
|
|
121
|
+
1. **Check that README.md exists and is not empty.**
|
|
122
|
+
- If missing or blank → stop with message explaining README must exist and describe the project.
|
|
123
|
+
- Do NOT write any files.
|
|
124
|
+
|
|
125
|
+
2. **Check that README meaningfully describes the project.**
|
|
126
|
+
- A passing README must have both: (1) what the project does, (2) what problem it solves.
|
|
127
|
+
- AI judges quality at runtime.
|
|
128
|
+
- If too thin → stop with message explaining what's needed.
|
|
129
|
+
|
|
130
|
+
3. **If README passes**, proceed.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Supporting File Scan
|
|
135
|
+
|
|
136
|
+
Read AGENTS.md, package.json, src/ structure, and other notable config files. Note what's already covered by README to avoid redundant questions.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Guardrail Q&A
|
|
141
|
+
|
|
142
|
+
Generate up to 5 targeted questions about off-limits areas, hard constraints, coding rules, out-of-scope items, and dependency plans. Adapt to the project's stack and domain. Skip questions already answered by README or supporting files.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Constitution Generation
|
|
147
|
+
|
|
148
|
+
Generate \`synspec/constitution.md\` with sections: Purpose, Principles, Tech Stack, Constraints (from Q&A), Off-Limits (from Q&A), Conventions, Architecture, Decision Log.
|
|
149
|
+
|
|
150
|
+
**Constraints and Off-Limits MUST come from Q&A answers, not inferred.**
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Re-run (Update)
|
|
155
|
+
|
|
156
|
+
Still run the README gate even when constitution exists — README may have degraded. Offer semver bump. Append Sync Impact Report HTML comment.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Output
|
|
161
|
+
|
|
162
162
|
Summarize what was created/updated, note the version, and show how many Q&A questions were answered.`
|
|
163
|
-
};
|
|
163
|
+
});
|
|
164
164
|
}
|
|
165
165
|
//# sourceMappingURL=sync.js.map
|
package/dist/core/update.d.ts
CHANGED
|
@@ -44,27 +44,7 @@ export declare class UpdateCommand {
|
|
|
44
44
|
*/
|
|
45
45
|
private displayOldCoreCustomProfileNote;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Returns the number of directories removed.
|
|
49
|
-
*/
|
|
50
|
-
private removeSkillDirs;
|
|
51
|
-
/**
|
|
52
|
-
* Removes skill directories for workflows that are no longer selected in the active profile.
|
|
53
|
-
* Returns the number of directories removed.
|
|
54
|
-
*/
|
|
55
|
-
private removeUnselectedSkillDirs;
|
|
56
|
-
/**
|
|
57
|
-
* Removes command files for workflows when delivery changed to skills-only.
|
|
58
|
-
* Returns the number of files removed.
|
|
59
|
-
*/
|
|
60
|
-
private removeCommandFiles;
|
|
61
|
-
/**
|
|
62
|
-
* Removes command files for workflows that are no longer selected in the active profile.
|
|
63
|
-
* Returns the number of files removed.
|
|
64
|
-
*/
|
|
65
|
-
private removeUnselectedCommandFiles;
|
|
66
|
-
/**
|
|
67
|
-
* Detect and handle legacy OpenSpec artifacts.
|
|
47
|
+
* Detect and handle legacy artifacts.
|
|
68
48
|
* Unlike init, update warns but continues if legacy files found in non-interactive mode.
|
|
69
49
|
* Returns array of tool IDs that were newly configured during legacy upgrade.
|
|
70
50
|
*/
|