synarcx 0.1.0 → 0.2.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/README.md CHANGED
@@ -25,7 +25,7 @@ synarcx init
25
25
 
26
26
  Then in your AI tool:
27
27
 
28
- 1. `/syn:sync` — generate project context (run once, re-run when the project shifts significantly)
28
+ 1. `/syn:sync` — validate README and generate project constitution with guardrail Q&A
29
29
  2. `/syn:explore "your idea"` — think through the problem, then follow the suggestion to `/syn:propose`
30
30
  3. `/syn:propose my-feature` — create proposal, specs, design, and tasks in one step
31
31
  4. `/syn:clarify` — sharpen the artifacts with targeted questions
@@ -34,35 +34,47 @@ Then in your AI tool:
34
34
  7. `/syn:archive` — archive when done
35
35
 
36
36
  For bugs, use `/syn:debug` instead of `/syn:explore` — same flow, starting from a known error.
37
+ For structural improvements, use `/syn:refactor`.
38
+ For small, low-risk changes (typos, config tweaks), use `/syn:quick` — no artifacts, inline preview, then apply.
37
39
 
38
40
  ## Commands
39
41
 
40
- | Command | Description |
41
- |---------|-------------|
42
- | `/syn:sync` | Generate or update the project constitution from README, AGENTS.md, package.json |
43
- | `/syn:explore` | Thinking partner — explore ideas, investigate problems, clarify requirements |
44
- | `/syn:debug` | Investigation tool — diagnose a known error and hand off findings to `/syn:propose` |
45
- | `/syn:propose` | Create a new change with proposal, specs, design, and tasks in one step |
46
- | `/syn:clarify` | Ask up to 5 targeted questions to sharpen artifacts before implementation |
47
- | `/syn:analyze` | Cross-artifact consistency check across proposal, specs, design, and tasks |
48
- | `/syn:apply` | Implement tasks from a change's task list |
49
- | `/syn:archive` | Archive a completed change and sync specs |
42
+ | Command | Description |
43
+ | ----------------- | ------------------------------------------------------------------------------------------------ |
44
+ | `/syn:sync` | Validate README, scan project files, run guardrail Q&A, generate constitution |
45
+ | `/syn:explore` | Thinking partner — explore ideas, investigate problems, clarify requirements |
46
+ | `/syn:debug` | Diagnose a known error (3-phase analysis), then prompts `/syn:propose` explicitly |
47
+ | `/syn:refactor` | Investigate structural refactoring map current vs target shape, then prompts `/syn:propose` |
48
+ | `/syn:quick` | Fast-path for small low-risk changes inline preview, confirm, apply no artifacts |
49
+ | `/syn:propose` | Create a new change with proposal, specs, design, and tasks in one step |
50
+ | `/syn:clarify` | Ask up to 5 targeted questions to sharpen artifacts before implementation |
51
+ | `/syn:analyze` | Cross-artifact consistency check across proposal, specs, design, and tasks |
52
+ | `/syn:apply` | Implement tasks from a change's task list |
53
+ | `/syn:archive` | Archive a completed change and sync specs |
50
54
 
51
55
  ## How It Works
52
56
 
53
57
  AI coding assistants are powerful but lose context fast when requirements live only in chat history. SynArcX adds a lightweight spec layer so you and your AI agree on what to build before any code is written.
54
58
 
55
59
  ```
56
- syn:sync (once)
60
+ sync ─────────────────────────────────────────► constitution
57
61
 
58
- explore ──┐
62
+ explore ──┐
63
+ debug ──┤
59
64
  ├──► propose ──► clarify ──► analyze ──► apply ──► archive
60
- debug ──┘
65
+ refactor ──┘
66
+
67
+ quick ────────────────────────────────────────────► apply
61
68
  ```
62
69
 
63
70
  Each step suggests the next — you decide when to advance.
64
71
 
72
+ - `sync` generates/updates the constitution — run once, re-run when the project shifts
73
+ - `explore`, `debug`, and `refactor` are entry points that hand off to `propose`
74
+ - `quick` is a fast-path that skips the pipeline entirely — for small, low-risk changes
75
+
65
76
  Each change gets its own folder under `synspec/changes/` with:
77
+
66
78
  - `proposal.md` — what and why
67
79
  - `specs/` — what the system shall do
68
80
  - `design.md` — how to build it
package/dist/core/init.js CHANGED
@@ -41,6 +41,8 @@ const WORKFLOW_TO_SKILL_DIR = {
41
41
  'clarify': 'syn-clarify',
42
42
  'analyze': 'syn-analyze',
43
43
  'debug': 'syn-debug',
44
+ 'refactor': 'syn-refactor',
45
+ 'quick': 'syn-quick',
44
46
  };
45
47
  // -----------------------------------------------------------------------------
46
48
  // Init Command Class
@@ -16,6 +16,8 @@ export const WORKFLOW_TO_SKILL_DIR = {
16
16
  'clarify': 'syn-clarify',
17
17
  'analyze': 'syn-analyze',
18
18
  'debug': 'syn-debug',
19
+ 'refactor': 'syn-refactor',
20
+ 'quick': 'syn-quick',
19
21
  };
20
22
  function toKnownWorkflows(workflows) {
21
23
  return workflows.filter((workflow) => ALL_WORKFLOWS.includes(workflow));
@@ -9,11 +9,11 @@ import type { Profile } from './global-config.js';
9
9
  * Core workflows included in the 'core' profile.
10
10
  * These provide the streamlined experience for new users.
11
11
  */
12
- export declare const CORE_WORKFLOWS: readonly ["explore", "propose", "clarify", "analyze", "apply", "debug", "archive", "sync"];
12
+ export declare const CORE_WORKFLOWS: readonly ["explore", "propose", "clarify", "analyze", "apply", "debug", "archive", "sync", "refactor", "quick"];
13
13
  /**
14
14
  * All available workflows in the system.
15
15
  */
16
- export declare const ALL_WORKFLOWS: readonly ["explore", "propose", "clarify", "analyze", "apply", "debug", "archive", "sync"];
16
+ export declare const ALL_WORKFLOWS: readonly ["explore", "propose", "clarify", "analyze", "apply", "debug", "archive", "sync", "refactor", "quick"];
17
17
  export type WorkflowId = (typeof ALL_WORKFLOWS)[number];
18
18
  export type CoreWorkflowId = (typeof CORE_WORKFLOWS)[number];
19
19
  /**
@@ -8,7 +8,7 @@
8
8
  * Core workflows included in the 'core' profile.
9
9
  * These provide the streamlined experience for new users.
10
10
  */
11
- export const CORE_WORKFLOWS = ['explore', 'propose', 'clarify', 'analyze', 'apply', 'debug', 'archive', 'sync'];
11
+ export const CORE_WORKFLOWS = ['explore', 'propose', 'clarify', 'analyze', 'apply', 'debug', 'archive', 'sync', 'refactor', 'quick'];
12
12
  /**
13
13
  * All available workflows in the system.
14
14
  */
@@ -21,6 +21,8 @@ export const ALL_WORKFLOWS = [
21
21
  'debug',
22
22
  'archive',
23
23
  'sync',
24
+ 'refactor',
25
+ 'quick',
24
26
  ];
25
27
  /**
26
28
  * Resolves which workflows should be active for a given profile configuration.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Shared utilities for generating skill and command files.
5
5
  */
6
- import { getSynExploreSkillTemplate, getSynApplySkillTemplate, getSynArchiveSkillTemplate, getSynProposeSkillTemplate, getSynSyncSkillTemplate, getSynClarifySkillTemplate, getSynAnalyzeSkillTemplate, getSynDebugSkillTemplate, getSynExploreCommandTemplate, getSynApplyCommandTemplate, getSynArchiveCommandTemplate, getSynProposeCommandTemplate, getSynSyncCommandTemplate, getSynClarifyCommandTemplate, getSynAnalyzeCommandTemplate, getSynDebugCommandTemplate, } from '../templates/skill-templates.js';
6
+ import { getSynExploreSkillTemplate, getSynApplySkillTemplate, getSynArchiveSkillTemplate, getSynProposeSkillTemplate, getSynSyncSkillTemplate, getSynClarifySkillTemplate, getSynAnalyzeSkillTemplate, getSynDebugSkillTemplate, getSynRefactorSkillTemplate, getSynQuickSkillTemplate, getSynExploreCommandTemplate, getSynApplyCommandTemplate, getSynArchiveCommandTemplate, getSynProposeCommandTemplate, getSynSyncCommandTemplate, getSynClarifyCommandTemplate, getSynAnalyzeCommandTemplate, getSynDebugCommandTemplate, getSynRefactorCommandTemplate, getSynQuickCommandTemplate, } from '../templates/skill-templates.js';
7
7
  /**
8
8
  * Gets skill templates with their directory names, optionally filtered by workflow IDs.
9
9
  *
@@ -19,6 +19,8 @@ export function getSkillTemplates(workflowFilter) {
19
19
  { template: getSynClarifySkillTemplate(), dirName: 'syn-clarify', workflowId: 'clarify' },
20
20
  { template: getSynAnalyzeSkillTemplate(), dirName: 'syn-analyze', workflowId: 'analyze' },
21
21
  { template: getSynDebugSkillTemplate(), dirName: 'syn-debug', workflowId: 'debug' },
22
+ { template: getSynRefactorSkillTemplate(), dirName: 'syn-refactor', workflowId: 'refactor' },
23
+ { template: getSynQuickSkillTemplate(), dirName: 'syn-quick', workflowId: 'quick' },
22
24
  ];
23
25
  if (!workflowFilter)
24
26
  return all;
@@ -40,6 +42,8 @@ export function getCommandTemplates(workflowFilter) {
40
42
  { template: getSynClarifyCommandTemplate(), id: 'clarify' },
41
43
  { template: getSynAnalyzeCommandTemplate(), id: 'analyze' },
42
44
  { template: getSynDebugCommandTemplate(), id: 'debug' },
45
+ { template: getSynRefactorCommandTemplate(), id: 'refactor' },
46
+ { template: getSynQuickCommandTemplate(), id: 'quick' },
43
47
  ];
44
48
  if (!workflowFilter)
45
49
  return all;
@@ -6,12 +6,12 @@
6
6
  /**
7
7
  * Names of skill directories created by synarcx init.
8
8
  */
9
- export declare const SKILL_NAMES: readonly ["syn-explore", "syn-apply", "syn-archive", "syn-propose", "syn-sync", "syn-clarify", "syn-analyze", "syn-debug"];
9
+ export declare const SKILL_NAMES: readonly ["syn-explore", "syn-apply", "syn-archive", "syn-propose", "syn-sync", "syn-clarify", "syn-analyze", "syn-debug", "syn-refactor", "syn-quick"];
10
10
  export type SkillName = (typeof SKILL_NAMES)[number];
11
11
  /**
12
12
  * IDs of command templates created by synarcx init.
13
13
  */
14
- export declare const COMMAND_IDS: readonly ["explore", "apply", "archive", "propose", "sync", "clarify", "analyze", "debug"];
14
+ export declare const COMMAND_IDS: readonly ["explore", "apply", "archive", "propose", "sync", "clarify", "analyze", "debug", "refactor", "quick"];
15
15
  export type CommandId = (typeof COMMAND_IDS)[number];
16
16
  /**
17
17
  * Status of skill configuration for a tool.
@@ -18,6 +18,8 @@ export const SKILL_NAMES = [
18
18
  'syn-clarify',
19
19
  'syn-analyze',
20
20
  'syn-debug',
21
+ 'syn-refactor',
22
+ 'syn-quick',
21
23
  ];
22
24
  /**
23
25
  * IDs of command templates created by synarcx init.
@@ -31,6 +33,8 @@ export const COMMAND_IDS = [
31
33
  'clarify',
32
34
  'analyze',
33
35
  'debug',
36
+ 'refactor',
37
+ 'quick',
34
38
  ];
35
39
  /**
36
40
  * Gets the list of tools with skillsDir configured.
@@ -12,4 +12,6 @@ export { getSynSyncSkillTemplate, getSynSyncCommandTemplate } from './workflows/
12
12
  export { getSynClarifySkillTemplate, getSynClarifyCommandTemplate } from './workflows/clarify.js';
13
13
  export { getSynAnalyzeSkillTemplate, getSynAnalyzeCommandTemplate } from './workflows/analyze.js';
14
14
  export { getSynDebugSkillTemplate, getSynDebugCommandTemplate } from './workflows/debug.js';
15
+ export { getSynRefactorSkillTemplate, getSynRefactorCommandTemplate } from './workflows/refactor.js';
16
+ export { getSynQuickSkillTemplate, getSynQuickCommandTemplate } from './workflows/quick.js';
15
17
  //# sourceMappingURL=skill-templates.d.ts.map
@@ -11,4 +11,6 @@ export { getSynSyncSkillTemplate, getSynSyncCommandTemplate } from './workflows/
11
11
  export { getSynClarifySkillTemplate, getSynClarifyCommandTemplate } from './workflows/clarify.js';
12
12
  export { getSynAnalyzeSkillTemplate, getSynAnalyzeCommandTemplate } from './workflows/analyze.js';
13
13
  export { getSynDebugSkillTemplate, getSynDebugCommandTemplate } from './workflows/debug.js';
14
+ export { getSynRefactorSkillTemplate, getSynRefactorCommandTemplate } from './workflows/refactor.js';
15
+ export { getSynQuickSkillTemplate, getSynQuickCommandTemplate } from './workflows/quick.js';
14
16
  //# sourceMappingURL=skill-templates.js.map
@@ -1,8 +1,8 @@
1
1
  export function getSynDebugSkillTemplate() {
2
2
  return {
3
3
  name: 'syn-debug',
4
- description: 'Investigate a known error or failure — root cause analysis, pattern recognition, and hypothesis formulation. Hands off to /syn:propose for task creation.',
5
- instructions: `Investigate a known error or failure systematically in 3 phases. Produces a diagnosis and suggests \`/syn:propose\` for creating the fix change.
4
+ description: 'Investigate a known error or failure — root cause analysis, pattern recognition, and hypothesis formulation. Hands off explicitly to /syn:propose.',
5
+ instructions: `Investigate a known error or failure systematically in 3 phases. Produces a diagnosis and explicitly prompts the user to run \`/syn:propose\` does NOT auto-create artifacts or auto-hand off.
6
6
 
7
7
  **Input**: Error message, symptom, or failure description. If no input provided, ask what went wrong.
8
8
 
@@ -47,7 +47,7 @@ Use that context to understand what was intended vs. what went wrong.
47
47
 
48
48
  ## Output
49
49
 
50
- After completing the 3-phase investigation, summarize:
50
+ After completing the 3-phase investigation, present findings and prompt explicitly:
51
51
 
52
52
  \`\`\`
53
53
  ### Diagnosis
@@ -56,10 +56,10 @@ After completing the 3-phase investigation, summarize:
56
56
  **Pattern**: <similar issues or novel>
57
57
  **Hypothesis**: <proposed fix approach>
58
58
 
59
- **Next Step**: Ready to formalize a change? Run \`/syn:propose\` with these findings.
59
+ **Ready to formalize?** Run \`/syn:propose\` to create a change with these findings.
60
60
  \`\`\`
61
61
 
62
- If no change exists yet, suggest creating one via \`/syn:propose\` with the diagnosis as the starting context.`,
62
+ Do NOT create any artifacts, do NOT start the pipeline automatically. The user must explicitly run \`/syn:propose\` to formalize.`,
63
63
  license: 'MIT',
64
64
  compatibility: 'Requires synarcx CLI.',
65
65
  metadata: { author: 'synarcx', version: '0.1' },
@@ -68,7 +68,7 @@ If no change exists yet, suggest creating one via \`/syn:propose\` with the diag
68
68
  export function getSynDebugCommandTemplate() {
69
69
  return {
70
70
  name: 'syn:debug',
71
- description: 'Investigate a known error — root cause analysis through hypothesis, suggests /syn:propose',
71
+ description: 'Investigate a known error — root cause analysis through hypothesis, explicitly prompts /syn:propose',
72
72
  category: 'Workflow',
73
73
  tags: ['workflow', 'debug', 'fix'],
74
74
  content: `Investigate a known error or failure systematically in 3 phases. Produces a diagnosis and suggests \`/syn:propose\` for creating the fix change.
@@ -111,7 +111,7 @@ If a change is active, read its artifacts first to understand what was intended
111
111
 
112
112
  ## Output
113
113
 
114
- After completing, summarize with a diagnosis and suggest \`/syn:propose\` with the findings.`
114
+ After completing, present the diagnosis and explicitly prompt the user to run \`/syn:propose\` to formalize the fix. Do NOT auto-create artifacts.`
115
115
  };
116
116
  }
117
117
  //# sourceMappingURL=debug.js.map
@@ -0,0 +1,4 @@
1
+ import type { SkillTemplate, CommandTemplate } from '../types.js';
2
+ export declare function getSynQuickSkillTemplate(): SkillTemplate;
3
+ export declare function getSynQuickCommandTemplate(): CommandTemplate;
4
+ //# sourceMappingURL=quick.d.ts.map
@@ -0,0 +1,129 @@
1
+ export function getSynQuickSkillTemplate() {
2
+ return {
3
+ name: 'syn-quick',
4
+ description: 'Fast-path for small, low-risk changes — reads context, shows change inline, asks confirmation, applies. No artifacts created.',
5
+ instructions: `Apply a small, low-risk change directly — no proposal, no specs, no artifacts. Describes the change inline, asks the user to confirm, then applies after confirmation.
6
+
7
+ **Input**: The user describes the change to make. If no description provided, ask what they want to change.
8
+
9
+ ---
10
+
11
+ ## Scope Check
12
+
13
+ Before proceeding, evaluate whether the described change is small enough for the quick path:
14
+
15
+ **Good for /syn:quick:**
16
+ - Typo fixes
17
+ - Single-line config changes
18
+ - Renaming a variable or function (single file, no callers to update across modules)
19
+ - Simple dependency version bump
20
+ - One-off formatting fix
21
+ - Small comment or documentation fix
22
+
23
+ **Too large for /syn:quick (warn and suggest alternative):**
24
+ - Multi-file changes
25
+ - Changes that add new behavior or logic
26
+ - Architectural or structural changes
27
+ - Changes requiring design decisions
28
+ - Refactoring that touches multiple modules
29
+ - Any change that would normally warrant a proposal
30
+
31
+ If the change description implies multi-file, new behavior, or architectural impact:
32
+ 1. Warn: "This looks too large for \`/syn:quick\`. Consider \`/syn:explore\` to think it through or \`/syn:propose\` to create a full change."
33
+ 2. If the user acknowledges and chooses to proceed anyway, continue with the quick apply.
34
+
35
+ ---
36
+
37
+ ## Read Context
38
+
39
+ Read the relevant source files to understand current state.
40
+
41
+ ---
42
+
43
+ ## Show Change Inline
44
+
45
+ Present the proposed change clearly:
46
+
47
+ \`\`\`
48
+ ### Proposed Change
49
+
50
+ **File**: path/to/file.ts
51
+ **Current**: <existing code or content>
52
+ **Proposed**: <modified code or content>
53
+ **Reason**: <brief explanation>
54
+ \`\`\`
55
+
56
+ ---
57
+
58
+ ## Ask Confirmation
59
+
60
+ Use the AskUserQuestion tool to confirm:
61
+ > "Apply this change?"
62
+
63
+ Options: Yes (proceed), No (cancel).
64
+
65
+ Apply only after explicit confirmation.
66
+
67
+ ---
68
+
69
+ ## Apply
70
+
71
+ Make the change. Commit is optional based on user preference.
72
+
73
+ ---
74
+
75
+ ## Output
76
+
77
+ After applying:
78
+ - Summarize what was changed
79
+ - Note that no synspec artifacts were created`,
80
+ license: 'MIT',
81
+ compatibility: 'Requires synarcx CLI.',
82
+ metadata: { author: 'synarcx', version: '0.1' },
83
+ };
84
+ }
85
+ export function getSynQuickCommandTemplate() {
86
+ return {
87
+ name: 'syn:quick',
88
+ description: 'Apply a small, low-risk change directly — no artifacts, inline preview, confirmation step',
89
+ category: 'Workflow',
90
+ tags: ['workflow', 'quick', 'fast'],
91
+ content: `Apply a small, low-risk change directly — no proposal, no specs, no artifacts. Describes the change inline, asks the user to confirm, then applies after confirmation.
92
+
93
+ **Input**: The argument after \`/syn:quick\` describes the change to make.
94
+
95
+ ---
96
+
97
+ ## Scope Check
98
+
99
+ - **Good for**: typo fixes, single-line config changes, renames (single file), dep bumps, minor formatting, comment fixes.
100
+ - **Too large**: multi-file changes, new behavior, architectural changes, design decisions, multi-module refactoring.
101
+
102
+ If too large → warn and suggest \`/syn:explore\` or \`/syn:propose\`. If user confirms anyway, proceed.
103
+
104
+ ---
105
+
106
+ ## Read Context
107
+
108
+ Read the relevant source files to understand current state.
109
+
110
+ ---
111
+
112
+ ## Show Change Inline
113
+
114
+ Present: file, current content, proposed content, reason.
115
+
116
+ ---
117
+
118
+ ## Ask Confirmation
119
+
120
+ Ask "Apply this change?" with Yes/No options. Apply only after confirmation.
121
+
122
+ ---
123
+
124
+ ## Apply
125
+
126
+ Make the change. No synspec artifacts are created.`
127
+ };
128
+ }
129
+ //# sourceMappingURL=quick.js.map
@@ -0,0 +1,4 @@
1
+ import type { SkillTemplate, CommandTemplate } from '../types.js';
2
+ export declare function getSynRefactorSkillTemplate(): SkillTemplate;
3
+ export declare function getSynRefactorCommandTemplate(): CommandTemplate;
4
+ //# sourceMappingURL=refactor.d.ts.map
@@ -0,0 +1,126 @@
1
+ export function getSynRefactorSkillTemplate() {
2
+ return {
3
+ name: 'syn-refactor',
4
+ 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
+
88
+ Do NOT create any artifacts or start the pipeline. The user must explicitly run \`/syn:propose\`.`,
89
+ license: 'MIT',
90
+ compatibility: 'Requires synarcx CLI.',
91
+ metadata: { author: 'synarcx', version: '0.1' },
92
+ };
93
+ }
94
+ export function getSynRefactorCommandTemplate() {
95
+ return {
96
+ name: 'syn:refactor',
97
+ description: 'Investigate structural refactoring — map current vs. target shape, then hands off to /syn:propose',
98
+ category: 'Workflow',
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
+
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
+ };
125
+ }
126
+ //# sourceMappingURL=refactor.js.map
@@ -1,38 +1,88 @@
1
1
  export function getSynSyncSkillTemplate() {
2
2
  return {
3
3
  name: 'syn-sync',
4
- description: 'Auto-generate or update synspec/constitution.md from project files (README, AGENTS.md, package.json, src structure) with semver versioning and Sync Impact Report.',
5
- instructions: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures the project's purpose, principles, tech stack, conventions, architecture, and decision log.
4
+ 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
6
 
7
- **Input**: The user can specify a description of what to focus on, or just run the command to regenerate from sources.
7
+ **Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
8
8
 
9
9
  ---
10
10
 
11
- ## First Run
11
+ ## README Gate (Required)
12
12
 
13
- 1. **Read project sources**
14
- - \`README.md\` — project description, features, purpose
15
- - \`AGENTS.md\` — AI agent conventions
16
- - \`package.json\` — dependencies, scripts, metadata
17
- - \`src/\` structure — code organization (top-level directories)
13
+ Before any generation, the README MUST pass quality validation.
18
14
 
19
- 2. **Generate \`synspec/constitution.md\`** with these sections:
20
- - \`# Constitution: <project-name>\` derived from package.json name
21
- - \`Version: 0.1.0\`
22
- - \`## Purpose\` — 2-3 sentences from README
23
- - \`## Principles\` — key design principles inferred from codebase
24
- - \`## Tech Stack\` — languages, frameworks, key dependencies
25
- - \`## Conventions\` — code style, naming, patterns observed
26
- - \`## Architecture\` — high-level structure overview
27
- - \`## Decision Log\` — table with Date, Decision, Rationale
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.
28
18
 
29
- 3. **Verify** the file was created at \`synspec/constitution.md\`
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.**
30
80
 
31
81
  ---
32
82
 
33
83
  ## Re-run (Update)
34
84
 
35
- When re-run, offer a semver bump choice:
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:
36
86
  - **MAJOR** — constitution structure changed or reorganized
37
87
  - **MINOR** — new section added
38
88
  - **PATCH** — content update, typo fixes
@@ -46,7 +96,7 @@ Append a Sync Impact Report as an HTML comment at the top:
46
96
 
47
97
  ## Output
48
98
 
49
- After completion, summarize what was created or updated, and note the version.`,
99
+ After completion, summarize what was created or updated, note the version, and list how many Q&A questions were answered.`,
50
100
  license: 'MIT',
51
101
  compatibility: 'Requires synarcx CLI.',
52
102
  metadata: { author: 'synarcx', version: '0.1' },
@@ -55,54 +105,61 @@ After completion, summarize what was created or updated, and note the version.`,
55
105
  export function getSynSyncCommandTemplate() {
56
106
  return {
57
107
  name: 'syn:sync',
58
- description: 'Auto-generate or update synspec/constitution.md from project files',
108
+ description: 'Generate/update project constitution with README validation, guardrail Q&A, and constraint capture',
59
109
  category: 'Workflow',
60
110
  tags: ['workflow', 'sync', 'project'],
61
- content: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures the project's purpose, principles, tech stack, conventions, architecture, and decision log.
111
+ content: `Generate or update the project constitution — a living document in \`synspec/constitution.md\` that captures validated project context.
62
112
 
63
- **Input**: The user can specify a description of what to focus on, or just run the command to regenerate from sources.
113
+ **Input**: The user can specify a focus area, or just run the command to proceed through the validation flow.
64
114
 
65
115
  ---
66
116
 
67
- ## First Run
117
+ ## README Gate (Required)
68
118
 
69
- 1. **Read project sources**
70
- - \`README.md\` — project description, features, purpose
71
- - \`AGENTS.md\` — AI agent conventions
72
- - \`package.json\` — dependencies, scripts, metadata
73
- - \`src/\` structure — code organization (top-level directories)
119
+ Before any generation, the README MUST pass quality validation.
74
120
 
75
- 2. **Generate \`synspec/constitution.md\`** with these sections:
76
- - \`# Constitution: <project-name>\` derived from package.json name
77
- - \`Version: 0.1.0\`
78
- - \`## Purpose\` — 2-3 sentences from README
79
- - \`## Principles\` — key design principles inferred from codebase
80
- - \`## Tech Stack\` — languages, frameworks, key dependencies
81
- - \`## Conventions\` — code style, naming, patterns observed
82
- - \`## Architecture\` — high-level structure overview
83
- - \`## Decision Log\` — table with Date, Decision, Rationale
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.
84
124
 
85
- 3. **Verify** the file was created at \`synspec/constitution.md\`
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.
86
131
 
87
132
  ---
88
133
 
89
- ## Re-run (Update)
134
+ ## Supporting File Scan
90
135
 
91
- When re-run, offer a semver bump choice:
92
- - **MAJOR** — constitution structure changed or reorganized
93
- - **MINOR** — new section added
94
- - **PATCH** — content update, typo fixes
136
+ Read AGENTS.md, package.json, src/ structure, and other notable config files. Note what's already covered by README to avoid redundant questions.
95
137
 
96
- Append a Sync Impact Report as an HTML comment at the top:
97
- \`\`\`
98
- <!-- Sync Impact: MAJOR — constitution structure reorganized -->
99
- \`\`\`
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.
100
157
 
101
158
  ---
102
159
 
103
160
  ## Output
104
161
 
105
- After completion, summarize what was created or updated, and note the version.`
162
+ Summarize what was created/updated, note the version, and show how many Q&A questions were answered.`
106
163
  };
107
164
  }
108
165
  //# sourceMappingURL=sync.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synarcx",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "SynArcX — Synapse Architecture Code Extension. Spec-driven development workflow for AI coding agents.",
5
5
  "keywords": [
6
6
  "synarcx",