docworks 0.11.0 → 0.12.0-next.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 CHANGED
@@ -1,50 +1,55 @@
1
1
  <img width="150" height="62" alt="logo-light" src="https://github.com/user-attachments/assets/a538da6b-3443-45d3-bc25-1604ea3b31b1" />
2
2
  <br/><br/>
3
3
 
4
- Ensure your docs answer critical questions. AI-powered validation that checks if developers can actually find what they need.
4
+ Ensure your docs work for developers and AI. Validates that critical questions can be answered from your documentation.
5
5
 
6
- ## The Problem
6
+ ## Quick Start
7
7
 
8
- Your docs mention "authentication" 50 times, but developers still can't figure out HOW to authenticate. Keywords exist, but answers are fragmented across pages. Support tickets spike.
8
+ ```bash
9
+ # Install globally
10
+ npm install -g docworks
9
11
 
10
- ## How It Works
12
+ # Initialize for your platform
13
+ docworks init --platform mintlify
11
14
 
12
- Define what questions your docs must answer. DocWorks uses AI to verify they remain answerable after every change.
15
+ # Edit docworks.yml with your docs URL
16
+ # source: https://docs.yourcompany.com
13
17
 
14
- ```yaml
15
- # docworks.yml
16
- questions:
17
- critical:
18
- - How do I authenticate?
19
- - What are the rate limits?
20
- - How do I handle errors?
18
+ # Run validation
19
+ OPENAI_API_KEY=sk-... docworks check
21
20
  ```
22
21
 
23
- ## Install
22
+ ## How It Works
24
23
 
25
- ```bash
26
- npm install -g docworks
27
- ```
24
+ 1. **Point to your docs** - Provide your documentation URL
25
+ 2. **Define journeys** - What must developers accomplish?
26
+ 3. **AI validates** - Can these journeys be completed?
27
+ 4. **Get results** - See what's missing
28
28
 
29
- ## Quick Start
29
+ ## Supported Platforms
30
30
 
31
- ```bash
32
- # 1. Initialize with smart defaults
33
- docworks init
31
+ DocWorks automatically detects and fetches documentation from:
34
32
 
35
- # 2. Check your docs (with your OpenAI key)
36
- OPENAI_API_KEY=sk-... docworks check
37
- ```
33
+ - **Mintlify** - via llms.txt
34
+ - **ReadMe** - via llms.txt
35
+ - **GitBook** - via llms.txt
36
+ - **Any site with llms.txt** - [llmstxt.org](https://llmstxt.org)
37
+ - **Local folders** - for private docs
38
38
 
39
- Output:
39
+ ## Configuration
40
40
 
41
- ```
42
- How do I authenticate?
43
- What are the rate limits?
44
- ❌ How do I handle errors?
41
+ ```yaml
42
+ # docworks.yml
43
+ source: https://docs.yourcompany.com # Your docs URL
44
+
45
+ journeys:
46
+ authentication:
47
+ - How do I authenticate?
48
+ - Where do I get API keys?
49
+ - What are the rate limits?
45
50
 
46
- Documentation check failed:
47
- Critical questions cannot be answered from current docs
51
+ provider: openai # or anthropic
52
+ model: gpt-4o-mini
48
53
  ```
49
54
 
50
55
  ## CI/CD Integration
@@ -64,137 +69,42 @@ jobs:
64
69
  OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
65
70
  ```
66
71
 
67
- ## Configuration
68
-
69
- ```yaml
70
- # docworks.yml
71
- questions:
72
- critical: # These block PRs if unanswerable
73
- - How do I install this?
74
- - How do I authenticate?
75
-
76
- important: # These warn but don't block
77
- - How do I debug issues?
78
- - What are the rate limits?
79
-
80
- nice_to_have: # Informational only
81
- - Are there TypeScript types?
82
-
83
- # Optional: Use your preferred AI provider
84
- provider: openai # or anthropic, azure
85
- model: gpt-4o-mini
86
- ```
87
-
88
72
  ## Templates
89
73
 
90
- Start quickly with pre-built templates:
91
-
92
74
  ```bash
93
- # API documentation
94
- docworks init --template api
75
+ # For documentation platforms
76
+ docworks init --platform mintlify
77
+ docworks init --platform readme
78
+ docworks init --platform gitbook
95
79
 
96
- # NPM package
97
- docworks init --template library
98
-
99
- # Internal platform
100
- docworks init --template internal
80
+ # For local documentation
81
+ docworks init --platform local
101
82
  ```
102
83
 
103
- ## Why DocWorks?
104
-
105
- - **Explicit control** - You define what matters, not magic patterns
106
- - **AI-powered** - Understands context, not just keywords
107
- - **Progressive adoption** - Start advisory, enable blocking when ready
108
- - **Provider flexible** - OpenAI, Anthropic, Azure (BYO keys)
109
- - **Fast** - Cached responses, parallel validation
84
+ ## Local Documentation
110
85
 
111
- ## Examples
112
-
113
- ### API Documentation
114
-
115
- ```yaml
116
- questions:
117
- critical:
118
- - How do I authenticate with the API?
119
- - What are the API endpoints?
120
- - How do I handle errors?
121
- ```
122
-
123
- ### Library/Package
86
+ For private or local documentation:
124
87
 
125
88
  ```yaml
126
- questions:
127
- critical:
128
- - How do I install this package?
129
- - How do I import and use it?
130
- - What's a basic example?
131
- ```
89
+ source: ./docs # Path to folder with .md/.mdx files
132
90
 
133
- ### Internal Docs
134
-
135
- ```yaml
136
- questions:
137
- critical:
138
- - How do I get access?
139
- - Who do I contact for help?
91
+ journeys:
92
+ internal:
93
+ - How do I deploy?
140
94
  - Where are the runbooks?
141
95
  ```
142
96
 
143
- ## How It Really Works
144
-
145
- 1. **You define questions** your docs must answer
146
- 2. **DocWorks reads** all your documentation
147
- 3. **AI validates** each question is answerable
148
- 4. **CI/CD enforces** on every PR
149
-
150
- No keyword matching. No regex patterns. Just: "Can a developer find this answer?"
151
-
152
- ## Requirements
153
-
154
- - Node.js 16+
155
- - OpenAI API key (or Anthropic, Azure)
156
- - Documentation in Markdown
157
-
158
- ## Pricing
159
-
160
- - **DocWorks**: Free, open source, MIT licensed
161
- - **AI costs**: ~$0.01 per check with caching (you pay provider directly)
162
-
163
- ## Development
164
-
165
- ```bash
166
- # Clone and install
167
- git clone https://github.com/caiopizzol/docworks
168
- cd docworks
169
- npm install
170
-
171
- # Run locally
172
- npm run dev
173
-
174
- # Run tests
175
- npm test
176
- ```
177
-
178
97
  ## FAQ
179
98
 
180
- **Q: Will this block my PRs?**
181
- A: Not by default. Starts in advisory mode. Enable blocking when ready.
182
-
183
- **Q: What if the AI is wrong?**
184
- A: Adjust confidence thresholds, use advisory mode, or override specific questions.
99
+ **Q: What if my platform doesn't have llms.txt?**
100
+ A: Use local mode by pointing to your docs folder, or ask your platform to support [llmstxt.org](https://llmstxt.org)
185
101
 
186
- **Q: Can I use this with private docs?**
187
- A: Yes. Runs in your CI with your API keys. Docs never leave your infrastructure.
102
+ **Q: How does it fetch online docs?**
103
+ A: DocWorks looks for `/llms.txt` at your docs URL, which lists all documentation pages
188
104
 
189
- **Q: Does it support other languages?**
190
- A: Currently Markdown/MDX. More formats coming soon.
105
+ **Q: Can I test private documentation?**
106
+ A: Yes, use local mode with `source: ./docs`
191
107
 
192
108
  ## License
193
109
 
194
110
  MIT
195
-
196
- ## Links
197
-
198
- - [Documentation](https://docworks.dev)
199
- - [GitHub](https://github.com/caiopizzol/docworks)
200
- - [NPM](https://npmjs.com/package/docworks)
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAkHA,wBAAsB,IAAI,CAAC,OAAO,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqChB"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA2EA,wBAAsB,IAAI,CAAC,OAAO,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BhB"}
@@ -1,8 +1,8 @@
1
1
  import fs from 'fs';
2
- import { glob } from 'glob';
3
2
  const TEMPLATES = {
4
3
  default: `# DocWorks Configuration
5
- source: ./llms.txt
4
+ # Point to your documentation URL or local folder
5
+ source: https://docs.example.com # or ./docs for local
6
6
 
7
7
  journeys:
8
8
  getting_started:
@@ -15,54 +15,10 @@ journeys:
15
15
  - How do I debug issues?
16
16
  - Where can I get help?
17
17
 
18
- provider: openai
19
- model: gpt-4o-mini`,
20
- api: `# DocWorks Configuration - API Documentation
21
- source: ./llms.txt
22
-
23
- journeys:
24
- authentication:
25
- - How do I authenticate?
26
- - Where do I get API keys?
27
- - What auth methods are supported?
28
-
29
- integration:
30
- - What are the endpoints?
31
- - How do I handle errors?
32
- - What are the rate limits?
33
-
34
- production:
35
- - How do I monitor usage?
36
- - Where are status pages?
37
- - How do I get support?
38
-
39
- provider: openai
40
- model: gpt-4o-mini`,
41
- library: `# DocWorks Configuration - Library/Package
42
- source: ./llms.txt
43
-
44
- journeys:
45
- setup:
46
- - How do I install this package?
47
- - How do I import it?
48
- - What are the requirements?
49
-
50
- basic_usage:
51
- - What's a hello world example?
52
- - What are the main functions?
53
- - How do I configure options?
54
-
55
- typescript:
56
- - Does it have TypeScript support?
57
- - Where are the type definitions?
58
- - How do I use with TypeScript?
59
-
60
18
  provider: openai
61
19
  model: gpt-4o-mini`,
62
20
  mintlify: `# DocWorks Configuration - Mintlify
63
- source:
64
- type: mcp
65
- server: "@mintlify/mcp-server"
21
+ source: https://docs.yourcompany.com # Your Mintlify docs URL
66
22
 
67
23
  journeys:
68
24
  api_reference:
@@ -78,9 +34,7 @@ journeys:
78
34
  provider: openai
79
35
  model: gpt-4o-mini`,
80
36
  readme: `# DocWorks Configuration - ReadMe
81
- source:
82
- type: mcp
83
- server: "@readme/mcp-server"
37
+ source: https://docs.yourcompany.com # Your ReadMe docs URL
84
38
 
85
39
  journeys:
86
40
  developer_experience:
@@ -91,9 +45,7 @@ journeys:
91
45
  provider: openai
92
46
  model: gpt-4o-mini`,
93
47
  gitbook: `# DocWorks Configuration - GitBook
94
- source:
95
- type: mcp
96
- server: "@gitbook/mcp-server"
48
+ source: https://docs.yourcompany.com # Your GitBook URL
97
49
 
98
50
  journeys:
99
51
  knowledge_base:
@@ -101,6 +53,17 @@ journeys:
101
53
  - Can I search effectively?
102
54
  - Are guides comprehensive?
103
55
 
56
+ provider: openai
57
+ model: gpt-4o-mini`,
58
+ local: `# DocWorks Configuration - Local Documentation
59
+ source: ./docs # Path to your documentation folder
60
+
61
+ journeys:
62
+ getting_started:
63
+ - How do I get started?
64
+ - Where are examples?
65
+ - What are the prerequisites?
66
+
104
67
  provider: openai
105
68
  model: gpt-4o-mini`,
106
69
  };
@@ -116,50 +79,19 @@ export async function init(options) {
116
79
  const template = TEMPLATES[templateName];
117
80
  if (!template) {
118
81
  console.error(`Unknown template: ${templateName}`);
119
- console.log('Available: default, api, library, mintlify, readme, gitbook');
82
+ console.log('Available: default, mintlify, readme, gitbook, local');
120
83
  process.exit(1);
121
84
  }
122
- // Create llms.txt if needed (not for MCP platforms)
123
- if (!options.platform && !fs.existsSync('llms.txt')) {
124
- await createLLMSTxt();
125
- }
126
85
  // Write config
127
86
  fs.writeFileSync('docworks.yml', template);
128
87
  console.log('✅ Created docworks.yml\n');
129
88
  // Next steps
130
89
  console.log('Next steps:');
131
- if (!options.platform) {
132
- console.log('1. Review llms.txt - ensure all docs are listed');
133
- }
134
- console.log('2. Set your API key:');
90
+ console.log('1. Update the source URL to your documentation');
91
+ console.log('2. Customize the journeys for your needs');
92
+ console.log('3. Set your API key:');
135
93
  console.log(' export OPENAI_API_KEY=sk-...');
136
- console.log('3. Run validation:');
94
+ console.log('4. Run validation:');
137
95
  console.log(' docworks check');
138
96
  }
139
- async function createLLMSTxt() {
140
- console.log('📝 Creating llms.txt...');
141
- // Find common documentation files
142
- const patterns = ['README.md', 'readme.md', 'docs/**/*.md', '*.md'];
143
- const files = new Set();
144
- for (const pattern of patterns) {
145
- const matches = await glob(pattern, {
146
- ignore: ['node_modules/**', '.git/**', 'CHANGELOG.md'],
147
- });
148
- matches.forEach((file) => files.add(file));
149
- }
150
- const content = [
151
- '# Documentation sources for DocWorks',
152
- '# Add your documentation files below, one per line',
153
- '# Lines starting with # are comments',
154
- '',
155
- ...Array.from(files).slice(0, 20), // Limit initial list
156
- '',
157
- '# Add more files as needed:',
158
- '# docs/api/authentication.md',
159
- '# examples/quickstart.js',
160
- '# https://api.example.com/openapi.json',
161
- ].join('\n');
162
- fs.writeFileSync('llms.txt', content);
163
- console.log(`✅ Created llms.txt with ${files.size} documentation files\n`);
164
- }
165
97
  //# sourceMappingURL=init.js.map
@@ -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AAA;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,eAAe;IACf,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;IAC1C,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;IAEvC,aAAa;IACb,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAC1B,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;IAC7D,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAA;IACvD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;IACnC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;IAC9C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAClC,CAAC"}
package/dist/index.js CHANGED
@@ -11,8 +11,7 @@ program
11
11
  program
12
12
  .command('init')
13
13
  .description('Initialize DocWorks configuration')
14
- .option('-t, --template <t>', 'Template: default, api, library', 'default')
15
- .option('-p, --platform <p>', 'Platform: mintlify, readme, gitbook')
14
+ .option('-p, --platform <platform>', 'Platform: mintlify, readme, gitbook, local')
16
15
  .action(init);
17
16
  program
18
17
  .command('check')
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,6CAA6C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AO,CAAC,OAAO,CAAC,CAAA;AAEnB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mCAAmC,CAAC;KAChD,MAAM,CACL,2BAA2B,EAC3B,4CAA4C,CAC7C;KACA,MAAM,CAAC,IAAI,CAAC,CAAA;AAEf,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,qBAAqB,EAAE,aAAa,EAAE,cAAc,CAAC;KAC5D,MAAM,CAAC,sBAAsB,EAAE,wBAAwB,CAAC;KACxD,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC;KACvC,MAAM,CAAC,qBAAqB,EAAE,gCAAgC,EAAE,UAAU,CAAC;KAC3E,MAAM,CAAC,KAAK,CAAC,CAAA;AAEhB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,+CAA+C,CAAC;KAC5D,MAAM,CAAC,qBAAqB,EAAE,aAAa,EAAE,cAAc,CAAC;KAC5D,MAAM,CAAC,aAAa,EAAE,yBAAyB,CAAC;KAChD,MAAM,CAAC,IAAI,CAAC,CAAA;AAEf,OAAO,CAAC,KAAK,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/sources/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE9D,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAiB7E"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/sources/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE9D,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAY7E"}
@@ -1,17 +1,12 @@
1
1
  export async function createSource(config) {
2
- const sourceConfig = typeof config.source === 'string'
3
- ? { type: 'llms.txt', path: config.source }
4
- : config.source;
5
- switch (sourceConfig.type) {
6
- case 'mcp': {
7
- const { MCPSource } = await import('./mcp.js');
8
- return new MCPSource(sourceConfig.server);
9
- }
10
- case 'llms.txt':
11
- default: {
12
- const { LLMSTxtSource } = await import('./llms-txt.js');
13
- return new LLMSTxtSource();
14
- }
2
+ const source = config.source;
3
+ // URL - use llms.txt
4
+ if (source.startsWith('http://') || source.startsWith('https://')) {
5
+ const { LLMSTxtSource } = await import('./llms-txt.js');
6
+ return new LLMSTxtSource(source);
15
7
  }
8
+ // Local path - read markdown files
9
+ const { LocalSource } = await import('./local.js');
10
+ return new LocalSource(source);
16
11
  }
17
12
  //# sourceMappingURL=base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/sources/base.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAsB;IACvD,MAAM,YAAY,GAChB,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,UAAmB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;QACpD,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;IAEnB,QAAQ,YAAY,CAAC,IAAI,EAAE,CAAC;QAC1B,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAA;YAC9C,OAAO,IAAI,SAAS,CAAC,YAAY,CAAC,MAAO,CAAC,CAAA;QAC5C,CAAC;QACD,KAAK,UAAU,CAAC;QAChB,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAA;YACvD,OAAO,IAAI,aAAa,EAAE,CAAA;QAC5B,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/sources/base.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAsB;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IAE5B,qBAAqB;IACrB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAA;QACvD,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IAClC,CAAC;IAED,mCAAmC;IACnC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;IAClD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { DocSource } from '../types/config.js';
2
2
  export declare class LLMSTxtSource implements DocSource {
3
+ private url;
3
4
  name: string;
4
- private filepath;
5
+ constructor(url: string);
5
6
  fetch(): Promise<string>;
7
+ private fetchFromLLMSTxt;
6
8
  }
7
9
  //# sourceMappingURL=llms-txt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"llms-txt.d.ts","sourceRoot":"","sources":["../../src/sources/llms-txt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,qBAAa,aAAc,YAAW,SAAS;IAC7C,IAAI,SAAa;IACjB,OAAO,CAAC,QAAQ,CAAe;IAEzB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;CA2C/B"}
1
+ {"version":3,"file":"llms-txt.d.ts","sourceRoot":"","sources":["../../src/sources/llms-txt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,qBAAa,aAAc,YAAW,SAAS;IAGjC,OAAO,CAAC,GAAG;IAFvB,IAAI,EAAE,MAAM,CAAA;gBAEQ,GAAG,EAAE,MAAM;IAIzB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;YA2BhB,gBAAgB;CA0C/B"}
@@ -1,43 +1,64 @@
1
- import fs from 'fs';
2
1
  export class LLMSTxtSource {
3
- constructor() {
4
- this.name = 'llms.txt';
5
- this.filepath = './llms.txt';
2
+ constructor(url) {
3
+ this.url = url;
4
+ this.name = `llms.txt from ${new URL(url).hostname}`;
6
5
  }
7
6
  async fetch() {
8
- if (!fs.existsSync(this.filepath)) {
9
- throw new Error('llms.txt not found. Create it with:\n' +
10
- ' docworks init\n\n' +
11
- 'Or create manually listing your documentation files.');
7
+ try {
8
+ // Try to fetch llms.txt from the domain
9
+ const llmsTxtUrl = new URL('/llms.txt', this.url).href;
10
+ console.log(`Fetching ${llmsTxtUrl}...`);
11
+ const response = await fetch(llmsTxtUrl);
12
+ if (!response.ok) {
13
+ // Maybe they provided the llms.txt URL directly
14
+ const directResponse = await fetch(this.url);
15
+ if (!directResponse.ok) {
16
+ throw new Error(`No llms.txt found at ${this.url}`);
17
+ }
18
+ return await this.fetchFromLLMSTxt(await directResponse.text());
19
+ }
20
+ return await this.fetchFromLLMSTxt(await response.text());
21
+ }
22
+ catch (error) {
23
+ throw new Error(`Failed to fetch documentation from ${this.url}\n` +
24
+ `Ensure the site has an llms.txt file.\n` +
25
+ `Error: ${error.message}`);
12
26
  }
13
- const content = fs.readFileSync(this.filepath, 'utf-8');
14
- const sources = content
27
+ }
28
+ async fetchFromLLMSTxt(content) {
29
+ // Parse llms.txt format (lines starting with # are comments)
30
+ const urls = content
15
31
  .split('\n')
16
32
  .map((line) => line.trim())
17
- .filter((line) => line && !line.startsWith('#'));
18
- if (sources.length === 0) {
19
- throw new Error('llms.txt is empty. Add your documentation files.');
33
+ .filter((line) => line && !line.startsWith('#'))
34
+ .filter((line) => line.startsWith('http'));
35
+ if (urls.length === 0) {
36
+ throw new Error('No documentation URLs found in llms.txt');
20
37
  }
21
- const docs = [];
22
- for (const source of sources) {
23
- // Handle URLs (future feature)
24
- if (source.startsWith('http')) {
25
- console.log(`⚠️ URL sources not yet supported: ${source}`);
26
- continue;
38
+ console.log(`Found ${urls.length} documentation URLs`);
39
+ // Fetch all documentation URLs in parallel
40
+ const docs = await Promise.all(urls.map(async (url, i) => {
41
+ try {
42
+ console.log(` Fetching (${i + 1}/${urls.length}): ${url}`);
43
+ const response = await fetch(url);
44
+ if (!response.ok) {
45
+ console.warn(` ⚠️ Failed to fetch: ${url}`);
46
+ return null;
47
+ }
48
+ const content = await response.text();
49
+ return `\n=== ${url} ===\n${content}`;
27
50
  }
28
- // Handle local files
29
- if (fs.existsSync(source)) {
30
- const content = fs.readFileSync(source, 'utf-8');
31
- docs.push(`\n=== ${source} ===\n${content}`);
51
+ catch (error) {
52
+ console.warn(` ⚠️ Error fetching ${url}: ${error}`);
53
+ return null;
32
54
  }
33
- else {
34
- console.warn(`⚠️ File not found: ${source}`);
35
- }
36
- }
37
- if (docs.length === 0) {
38
- throw new Error('No valid documentation sources found in llms.txt');
55
+ }));
56
+ const validDocs = docs.filter(Boolean);
57
+ if (validDocs.length === 0) {
58
+ throw new Error('Could not fetch any documentation from llms.txt URLs');
39
59
  }
40
- return docs.join('\n\n');
60
+ console.log(`Successfully fetched ${validDocs.length} documents\n`);
61
+ return validDocs.join('\n\n');
41
62
  }
42
63
  }
43
64
  //# sourceMappingURL=llms-txt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"llms-txt.js","sourceRoot":"","sources":["../../src/sources/llms-txt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AAInB,MAAM,OAAO,aAAa;IAA1B;QACE,SAAI,GAAG,UAAU,CAAA;QACT,aAAQ,GAAG,YAAY,CAAA;IA6CjC,CAAC;IA3CC,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CA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AAS,OAAO,EAAE,CAAA;YACvC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,KAAK,KAAK,EAAE,CAAC,CAAA;gBACrD,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC,CAAC,CACH,CAAA;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAEtC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACzE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,SAAS,CAAC,MAAM,cAAc,CAAC,CAAA;QACnE,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { DocSource } from '../types/config.js';
2
+ export declare class LocalSource implements DocSource {
3
+ private directory;
4
+ name: string;
5
+ constructor(directory: string);
6
+ fetch(): Promise<string>;
7
+ }
8
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,qBAAa,WAAY,YAAW,SAAS;IAG/B,OAAO,CAAC,SAAS;IAF7B,IAAI,EAAE,MAAM,CAAA;gBAEQ,SAAS,EAAE,MAAM;IAI/B,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;CAiC/B"}
@@ -0,0 +1,37 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { glob } from 'glob';
4
+ export class LocalSource {
5
+ constructor(directory) {
6
+ this.directory = directory;
7
+ this.name = `Local: ${directory}`;
8
+ }
9
+ async fetch() {
10
+ if (!fs.existsSync(this.directory)) {
11
+ throw new Error(`Directory not found: ${this.directory}`);
12
+ }
13
+ // Find all markdown files
14
+ const patterns = ['**/*.md', '**/*.mdx'];
15
+ const files = [];
16
+ for (const pattern of patterns) {
17
+ const matches = await glob(pattern, {
18
+ cwd: this.directory,
19
+ ignore: ['node_modules/**', '.git/**'],
20
+ });
21
+ files.push(...matches);
22
+ }
23
+ if (files.length === 0) {
24
+ throw new Error(`No markdown files found in ${this.directory}`);
25
+ }
26
+ console.log(`Found ${files.length} documentation files`);
27
+ // Read all files
28
+ const docs = [];
29
+ for (const file of files) {
30
+ const filepath = path.join(this.directory, file);
31
+ const content = fs.readFileSync(filepath, 'utf-8');
32
+ docs.push(`\n=== ${file} ===\n${content}`);
33
+ }
34
+ return docs.join('\n\n');
35
+ }
36
+ }
37
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,MAAM,OAAO,WAAW;IAGtB,YAAoB,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACnC,IAAI,CAAC,IAAI,GAAG,UAAU,SAAS,EAAE,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAC3D,CAAC;QAED,0BAA0B;QAC1B,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QAExC,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;gBAClC,GAAG,EAAE,IAAI,CAAC,SAAS;gBACnB,MAAM,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC;aACvC,CAAC,CAAA;YACF,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QACxB,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QACjE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,sBAAsB,CAAC,CAAA;QAExD,iBAAiB;QACjB,MAAM,IAAI,GAAa,EAAE,CAAA;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAChD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAClD,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,SAAS,OAAO,EAAE,CAAC,CAAA;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,14 +1,10 @@
1
1
  export interface DocWorksConfig {
2
- source: string | SourceConfig;
2
+ source: string;
3
3
  journeys: Record<string, string[]>;
4
4
  provider?: 'openai' | 'anthropic';
5
5
  model?: string;
6
6
  api_key?: string;
7
7
  }
8
- export interface SourceConfig {
9
- type: 'llms.txt' | 'mcp';
10
- server?: string;
11
- }
12
8
  export interface ValidationResult {
13
9
  question: string;
14
10
  answerable: 'YES' | 'PARTIAL' | 'NO';
@@ -21,6 +17,5 @@ export interface JourneyResults {
21
17
  export interface DocSource {
22
18
  name: string;
23
19
  fetch(): Promise<string>;
24
- search?(query: string): Promise<string>;
25
20
  }
26
21
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,GAAG,YAAY,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,GAAG,KAAK,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CACtC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACxC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CACtC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docworks",
3
- "version": "0.11.0",
3
+ "version": "0.12.0-next.1",
4
4
  "description": "Ensure your docs work for developers and AI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,9 +0,0 @@
1
- import { DocSource } from '../types/config.js';
2
- export declare class MCPSource implements DocSource {
3
- private server;
4
- name: string;
5
- constructor(server: string);
6
- fetch(): Promise<string>;
7
- search(query: string): Promise<string>;
8
- }
9
- //# sourceMappingURL=mcp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/sources/mcp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAI9C,qBAAa,SAAU,YAAW,SAAS;IAG7B,OAAO,CAAC,MAAM;IAF1B,IAAI,EAAE,MAAM,CAAA;gBAEQ,MAAM,EAAE,MAAM;IAI5B,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAiBxB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAY7C"}
@@ -1,33 +0,0 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
- const execAsync = promisify(exec);
4
- export class MCPSource {
5
- constructor(server) {
6
- this.server = server;
7
- this.name = `MCP: ${server}`;
8
- }
9
- async fetch() {
10
- try {
11
- // For MVP, execute MCP server command
12
- // Future: Use proper MCP SDK
13
- const { stdout } = await execAsync(`npx ${this.server} --list-docs`, { maxBuffer: 10 * 1024 * 1024 } // 10MB buffer
14
- );
15
- return stdout;
16
- }
17
- catch (error) {
18
- throw new Error(`Failed to connect to MCP server: ${this.server}\n` +
19
- `Ensure the server package is installed and accessible.`);
20
- }
21
- }
22
- async search(query) {
23
- try {
24
- const { stdout } = await execAsync(`npx ${this.server} --search "${query}"`, { maxBuffer: 10 * 1024 * 1024 });
25
- return stdout;
26
- }
27
- catch {
28
- // Fallback to full fetch if search not supported
29
- return this.fetch();
30
- }
31
- }
32
- }
33
- //# sourceMappingURL=mcp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/sources/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAGhC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;AAEjC,MAAM,OAAO,SAAS;IAGpB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAChC,IAAI,CAAC,IAAI,GAAG,QAAQ,MAAM,EAAE,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,sCAAsC;YACtC,6BAA6B;YAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAChC,OAAO,IAAI,CAAC,MAAM,cAAc,EAChC,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,cAAc;aAC/C,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,oCAAoC,IAAI,CAAC,MAAM,IAAI;gBACjD,wDAAwD,CAC3D,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAChC,OAAO,IAAI,CAAC,MAAM,cAAc,KAAK,GAAG,EACxC,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAChC,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,MAAM,CAAC;YACP,iDAAiD;YACjD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAA;QACrB,CAAC;IACH,CAAC;CACF"}