Import Brownfield Documentation
Import existing documentation from Notion exports, Confluence, GitHub Wiki, or any markdown folder.
What This Does
- Analyzes markdown files in source directory (recursively)
- Classifies files based on content:
- Specs - Contains "user story", "acceptance criteria", "feature"
- Modules - Contains "module", "component", "architecture"
- Team - Contains "onboarding", "convention", "workflow"
- Legacy - Everything else (no strong match)
- Copies files to appropriate destinations
- Creates migration report with classification details
- Updates config with import history
Usage
/sw:import-docs <source-path> [options]
Options
--source=<type> - Source type: notion, confluence, wiki, custom (required)
--project=<id> - Target project ID (default: active project)
--preserve-structure - Preserve original folder structure
--dry-run - Preview classification without importing
Examples
Example 1: Notion Export
# Export Notion workspace to /tmp/notion-export/
# Then import:
/sw:import-docs /tmp/notion-export/ --source=notion
# Result:
# 📊 Analysis Results:
# Total files: 47
# - Specs: 12 files → specs/
# - Modules: 18 files → modules/
# - Team docs: 5 files → team/
# - Legacy: 12 files → legacy/notion/
# ✅ Import complete!
Example 2: Confluence Export
/sw:import-docs /path/to/confluence/ --source=confluence --project=web-app
# Imports to: projects/web-app/specs/, modules/, team/, legacy/confluence/
Example 3: Dry Run (Preview)
/sw:import-docs /tmp/docs/ --source=custom --dry-run
# Shows classification without importing files
# Use this to preview results before actual import
Example 4: Preserve Structure
/sw:import-docs /path/to/wiki/ --source=wiki --preserve-structure
# Preserves original folder structure:
# legacy/wiki/engineering/backend/auth.md
# legacy/wiki/engineering/frontend/components.md
Supported Sources
Notion
- Export Format: Markdown & CSV
- Steps:
- In Notion: Settings → Export → Export all workspace content
- Choose "Markdown & CSV" format
- Download ZIP file
- Extract to folder (e.g.,
/tmp/notion-export/)
- Run import command
Confluence
- Export Format: HTML or Markdown
- Steps:
- Space tools → Content Tools → Export
- Choose HTML or Markdown
- Extract exported files
- Run import command
GitHub Wiki
- Export Format: Git repository
- Steps:
- Clone wiki:
git clone https://github.com/user/repo.wiki.git
- Run import command on cloned directory
Custom (Any Markdown)
- Any folder containing
.md or .markdown files
- Recursive search through subdirectories
Classification Algorithm
Files are classified using keyword analysis:
Specs (70%+ confidence)
- Keywords: "user story", "acceptance criteria", "feature", "requirement"
- Patterns: "As a [user], I want [goal]", "Given-When-Then"
- Example: Feature specs, PRDs, user stories
Modules (70%+ confidence)
- Keywords: "module", "component", "service", "architecture"
- Patterns: API docs, technical design, integration points
- Example: Auth module, payment processing, ML pipeline
Team (70%+ confidence)
- Keywords: "onboarding", "convention", "workflow", "pr process"
- Patterns: Team processes, coding standards, deployment guides
- Example: Onboarding guide, code review checklist
Legacy (<70% confidence)
- No strong match to above categories
- Uncertain classification
- Requires manual review
Destination Folders
Files are imported to:
.specweave/docs/internal/projects/{project}/
├── specs/ ← Specs (spec keywords)
├── modules/ ← Modules (module keywords)
├── team/ ← Team docs (team keywords)
└── legacy/{source}/ ← Legacy (uncertain classification)
├── notion/
├── confluence/
├── wiki/
└── custom/
Migration Report
After import, a detailed report is generated:
Location: .specweave/docs/internal/projects/{project}/legacy/README.md
Contents:
- Import summary (counts per category)
- Classification analysis (with confidence scores)
- List of imported files
- Next steps and recommendations
Configuration Updates
Import history is tracked in .specweave/config.json:
{
"brownfield": {
"importHistory": [{
"source": "notion",
"workspace": "acme-corp",
"importedAt": "2025-11-06T10:30:00Z",
"project": "web-app",
"filesImported": 47,
"destination": ".specweave/docs/internal/projects/web-app/legacy/notion/"
}]
}
}
After Import
- Review classification - Check migration report
- Move misclassified files - Use file manager or git
- Update spec numbers - Rename to
spec-NNN-name.md
- Clean up legacy - Delete obsolete content
- Update references - Fix broken links
When to Use
- Migrating from Notion to SpecWeave
- Consolidating wikis from GitHub, Confluence, etc.
- Onboarding brownfield projects with existing documentation
- Merging multiple doc sources into single SpecWeave instance
Limitations
- Only markdown files (.md, .markdown) supported
- No direct API integration (use exports)
- Classification is heuristic (80%+ accuracy target)
- Manual review recommended for low-confidence files
See Also
Implementation: src/cli/commands/import-docs.ts
1---2name: import-docs3description: Import brownfield documentation from Notion exports, Confluence, GitHub Wiki, or any markdown folder. Automatically classifies files as specs, modules, team docs, or legacy.4---5
6# Import Brownfield Documentation
7
8Import existing documentation from Notion exports, Confluence, GitHub Wiki, or any markdown folder.
9
10## What This Does
11
121. **Analyzes markdown files** in source directory (recursively)
132. **Classifies files** based on content:
14 - **Specs** - Contains "user story", "acceptance criteria", "feature"
15 - **Modules** - Contains "module", "component", "architecture"
16 - **Team** - Contains "onboarding", "convention", "workflow"
17 - **Legacy** - Everything else (no strong match)
183. **Copies files** to appropriate destinations
194. **Creates migration report** with classification details
205. **Updates config** with import history
21
22## Usage
23
24```bash
25/sw:import-docs <source-path> [options]
26```
27
28### Options
29
30- `--source=<type>` - Source type: `notion`, `confluence`, `wiki`, `custom` (required)
31- `--project=<id>` - Target project ID (default: active project)
32- `--preserve-structure` - Preserve original folder structure
33- `--dry-run` - Preview classification without importing
34
35## Examples
36
37### Example 1: Notion Export
38
39```bash
40# Export Notion workspace to /tmp/notion-export/
41# Then import:
42
43/sw:import-docs /tmp/notion-export/ --source=notion
44
45# Result:
46# 📊 Analysis Results:
47# Total files: 47
48# - Specs: 12 files → specs/
49# - Modules: 18 files → modules/
50# - Team docs: 5 files → team/
51# - Legacy: 12 files → legacy/notion/
52# ✅ Import complete!
53```
54
55### Example 2: Confluence Export
56
57```bash
58/sw:import-docs /path/to/confluence/ --source=confluence --project=web-app
59
60# Imports to: projects/web-app/specs/, modules/, team/, legacy/confluence/
61```
62
63### Example 3: Dry Run (Preview)
64
65```bash
66/sw:import-docs /tmp/docs/ --source=custom --dry-run
67
68# Shows classification without importing files
69# Use this to preview results before actual import
70```
71
72### Example 4: Preserve Structure
73
74```bash
75/sw:import-docs /path/to/wiki/ --source=wiki --preserve-structure
76
77# Preserves original folder structure:
78# legacy/wiki/engineering/backend/auth.md
79# legacy/wiki/engineering/frontend/components.md
80```
81
82## Supported Sources
83
84### Notion
85- **Export Format**: Markdown & CSV
86- **Steps**:
87 1. In Notion: Settings → Export → Export all workspace content
88 2. Choose "Markdown & CSV" format
89 3. Download ZIP file
90 4. Extract to folder (e.g., `/tmp/notion-export/`)
91 5. Run import command
92
93### Confluence
94- **Export Format**: HTML or Markdown
95- **Steps**:
96 1. Space tools → Content Tools → Export
97 2. Choose HTML or Markdown
98 3. Extract exported files
99 4. Run import command
100
101### GitHub Wiki
102- **Export Format**: Git repository
103- **Steps**:
104 1. Clone wiki: `git clone https://github.com/user/repo.wiki.git`
105 2. Run import command on cloned directory
106
107### Custom (Any Markdown)
108- Any folder containing `.md` or `.markdown` files
109- Recursive search through subdirectories
110
111## Classification Algorithm
112
113Files are classified using keyword analysis:
114
115### Specs (70%+ confidence)
116- Keywords: "user story", "acceptance criteria", "feature", "requirement"
117- Patterns: "As a [user], I want [goal]", "Given-When-Then"
118- Example: Feature specs, PRDs, user stories
119
120### Modules (70%+ confidence)
121- Keywords: "module", "component", "service", "architecture"
122- Patterns: API docs, technical design, integration points
123- Example: Auth module, payment processing, ML pipeline
124
125### Team (70%+ confidence)
126- Keywords: "onboarding", "convention", "workflow", "pr process"
127- Patterns: Team processes, coding standards, deployment guides
128- Example: Onboarding guide, code review checklist
129
130### Legacy (<70% confidence)
131- No strong match to above categories
132- Uncertain classification
133- Requires manual review
134
135## Destination Folders
136
137Files are imported to:
138
139```
140.specweave/docs/internal/projects/{project}/
141├── specs/ ← Specs (spec keywords)
142├── modules/ ← Modules (module keywords)
143├── team/ ← Team docs (team keywords)
144└── legacy/{source}/ ← Legacy (uncertain classification)
145 ├── notion/
146 ├── confluence/
147 ├── wiki/
148 └── custom/
149```
150
151## Migration Report
152
153After import, a detailed report is generated:
154
155**Location**: `.specweave/docs/internal/projects/{project}/legacy/README.md`
156
157**Contents**:
158- Import summary (counts per category)
159- Classification analysis (with confidence scores)
160- List of imported files
161- Next steps and recommendations
162
163## Configuration Updates
164
165Import history is tracked in `.specweave/config.json`:
166
167```json
168{
169 "brownfield": {
170 "importHistory": [{
171 "source": "notion",
172 "workspace": "acme-corp",
173 "importedAt": "2025-11-06T10:30:00Z",
174 "project": "web-app",
175 "filesImported": 47,
176 "destination": ".specweave/docs/internal/projects/web-app/legacy/notion/"
177 }]
178 }
179}
180```
181
182## After Import
183
1841. **Review classification** - Check migration report
1852. **Move misclassified files** - Use file manager or git
1863. **Update spec numbers** - Rename to `spec-NNN-name.md`
1874. **Clean up legacy** - Delete obsolete content
1885. **Update references** - Fix broken links
189
190## When to Use
191
192- **Migrating from Notion** to SpecWeave
193- **Consolidating wikis** from GitHub, Confluence, etc.
194- **Onboarding brownfield projects** with existing documentation
195- **Merging multiple doc sources** into single SpecWeave instance
196
197## Limitations
198
199- Only markdown files (.md, .markdown) supported
200- No direct API integration (use exports)
201- Classification is heuristic (80%+ accuracy target)
202- Manual review recommended for low-confidence files
203
204## See Also
205
206- `/sw:init-multiproject` - Set up multi-project mode first
207- [Brownfield Import Guide](https://docs.spec-weave.com/guides/brownfield-import)
208- [Migration Best Practices](https://docs.spec-weave.com/guides/migration-best-practices)
209
210---
211
212**Implementation**: `src/cli/commands/import-docs.ts`