docspec 0.2.0 → 0.4.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.
Files changed (80) hide show
  1. package/README.md +64 -142
  2. package/dist/__tests__/changed.test.d.ts +2 -0
  3. package/dist/__tests__/changed.test.d.ts.map +1 -0
  4. package/dist/__tests__/changed.test.js +98 -0
  5. package/dist/__tests__/changed.test.js.map +1 -0
  6. package/dist/__tests__/cli.test.js +48 -145
  7. package/dist/__tests__/cli.test.js.map +1 -1
  8. package/dist/__tests__/create.test.d.ts +2 -0
  9. package/dist/__tests__/create.test.d.ts.map +1 -0
  10. package/dist/__tests__/{generator.test.js → create.test.js} +31 -27
  11. package/dist/__tests__/create.test.js.map +1 -0
  12. package/dist/__tests__/generate.test.d.ts +2 -0
  13. package/dist/__tests__/generate.test.d.ts.map +1 -0
  14. package/dist/__tests__/generate.test.js +152 -0
  15. package/dist/__tests__/generate.test.js.map +1 -0
  16. package/dist/__tests__/path-utils.test.d.ts +2 -0
  17. package/dist/__tests__/path-utils.test.d.ts.map +1 -0
  18. package/dist/__tests__/path-utils.test.js +49 -0
  19. package/dist/__tests__/path-utils.test.js.map +1 -0
  20. package/dist/__tests__/template.test.d.ts +2 -0
  21. package/dist/__tests__/template.test.d.ts.map +1 -0
  22. package/dist/__tests__/template.test.js +95 -0
  23. package/dist/__tests__/template.test.js.map +1 -0
  24. package/dist/changed.d.ts +25 -0
  25. package/dist/changed.d.ts.map +1 -0
  26. package/dist/changed.js +209 -0
  27. package/dist/changed.js.map +1 -0
  28. package/dist/cli.js +89 -72
  29. package/dist/cli.js.map +1 -1
  30. package/dist/constants.d.ts +2 -0
  31. package/dist/constants.d.ts.map +1 -1
  32. package/dist/constants.js +118 -15
  33. package/dist/constants.js.map +1 -1
  34. package/dist/create.d.ts +14 -0
  35. package/dist/create.d.ts.map +1 -0
  36. package/dist/create.js +97 -0
  37. package/dist/create.js.map +1 -0
  38. package/dist/generate.d.ts +26 -0
  39. package/dist/generate.d.ts.map +1 -0
  40. package/dist/generate.js +176 -0
  41. package/dist/generate.js.map +1 -0
  42. package/dist/index.d.ts +8 -4
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +16 -7
  45. package/dist/index.js.map +1 -1
  46. package/dist/logger.d.ts +40 -0
  47. package/dist/logger.d.ts.map +1 -0
  48. package/dist/logger.js +74 -0
  49. package/dist/logger.js.map +1 -0
  50. package/dist/path-utils.d.ts +17 -0
  51. package/dist/path-utils.d.ts.map +1 -0
  52. package/dist/path-utils.js +76 -0
  53. package/dist/path-utils.js.map +1 -0
  54. package/dist/{format-parser.d.ts → template.d.ts} +5 -8
  55. package/dist/template.d.ts.map +1 -0
  56. package/dist/{format-parser.js → template.js} +33 -57
  57. package/dist/template.js.map +1 -0
  58. package/package.json +1 -1
  59. package/README.docspec.md +0 -180
  60. package/dist/__tests__/generator.test.d.ts +0 -2
  61. package/dist/__tests__/generator.test.d.ts.map +0 -1
  62. package/dist/__tests__/generator.test.js.map +0 -1
  63. package/dist/__tests__/validator.test.d.ts +0 -2
  64. package/dist/__tests__/validator.test.d.ts.map +0 -1
  65. package/dist/__tests__/validator.test.js +0 -331
  66. package/dist/__tests__/validator.test.js.map +0 -1
  67. package/dist/format-parser.d.ts.map +0 -1
  68. package/dist/format-parser.js.map +0 -1
  69. package/dist/generator.d.ts +0 -11
  70. package/dist/generator.d.ts.map +0 -1
  71. package/dist/generator.js +0 -66
  72. package/dist/generator.js.map +0 -1
  73. package/dist/types.d.ts +0 -16
  74. package/dist/types.d.ts.map +0 -1
  75. package/dist/types.js +0 -3
  76. package/dist/types.js.map +0 -1
  77. package/dist/validator.d.ts +0 -7
  78. package/dist/validator.d.ts.map +0 -1
  79. package/dist/validator.js +0 -178
  80. package/dist/validator.js.map +0 -1
@@ -1,331 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- const fs = __importStar(require("fs/promises"));
37
- const path = __importStar(require("path"));
38
- const os = __importStar(require("os"));
39
- const validator_1 = require("../validator");
40
- const generator_1 = require("../generator");
41
- const constants_1 = require("../constants");
42
- describe("validator", () => {
43
- let tempDir;
44
- beforeEach(async () => {
45
- tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "docspec-test-"));
46
- });
47
- afterEach(async () => {
48
- await fs.rm(tempDir, { recursive: true, force: true });
49
- });
50
- describe("validateDocspec", () => {
51
- it("should validate a properly customized docspec file", async () => {
52
- const filePath = path.join(tempDir, "valid.docspec.md");
53
- // Create a valid docspec with customized content
54
- const validContent = `# DOCSPEC: Test Document
55
-
56
- > Short phrase: *Test document*
57
-
58
- ## 1. Document Purpose
59
-
60
- This document describes the test suite for the docspec validator. It provides comprehensive test coverage for all validation scenarios and edge cases that the validator needs to handle correctly.
61
-
62
- ## 2. Update Triggers
63
-
64
- Update this document when adding new test cases or when the validation logic changes. It should always reflect the current state of the test suite.
65
-
66
- ## 3. Expected Structure
67
-
68
- This section describes the test structure and how tests are organized. Each test file covers a specific module or functionality area of the docspec package.
69
-
70
- ## 4. Editing Guidelines
71
-
72
- Keep test descriptions clear and concise. Use descriptive test names that explain what is being tested. Follow the AAA pattern: Arrange, Act, Assert. Do: Write comprehensive tests that cover edge cases. Don't: Skip edge cases or write tests that are too simple. Always test both success and failure scenarios.
73
-
74
- ## 5. Intentional Omissions
75
-
76
- No gaps at this time. All major functionality is covered by the test suite.
77
- `;
78
- await fs.writeFile(filePath, validContent, "utf-8");
79
- const result = await (0, validator_1.validateDocspec)(filePath);
80
- expect(result.valid).toBe(true);
81
- expect(result.errors).toHaveLength(0);
82
- });
83
- it("should reject a file with only boilerplate content", async () => {
84
- const filePath = path.join(tempDir, "boilerplate.docspec.md");
85
- await (0, generator_1.generateDocspec)(filePath);
86
- const result = await (0, validator_1.validateDocspec)(filePath);
87
- expect(result.valid).toBe(false);
88
- expect(result.errors.length).toBeGreaterThan(0);
89
- expect(result.errors.some(e => e.includes("boilerplate"))).toBe(true);
90
- });
91
- it("should detect missing sections", async () => {
92
- const filePath = path.join(tempDir, "incomplete.docspec.md");
93
- const incompleteContent = `# DOCSPEC: Test
94
-
95
- ## 1. Document Purpose
96
-
97
- Custom content here.
98
-
99
- ## 2. Update Triggers
100
-
101
- More custom content.
102
- `;
103
- await fs.writeFile(filePath, incompleteContent, "utf-8");
104
- const result = await (0, validator_1.validateDocspec)(filePath);
105
- expect(result.valid).toBe(false);
106
- // Should have errors for missing sections
107
- expect(result.errors.some(e => e.includes("Missing required section"))).toBe(true);
108
- });
109
- it("should detect empty sections", async () => {
110
- const filePath = path.join(tempDir, "empty-section.docspec.md");
111
- let content = `# DOCSPEC: Test
112
-
113
- `;
114
- // Add all sections but leave one empty
115
- constants_1.REQUIRED_SECTIONS.forEach((section, index) => {
116
- content += `## ${index + 1}. ${section}\n\n`;
117
- if (index === 2) {
118
- // Leave section 3 empty
119
- content += "\n";
120
- }
121
- else {
122
- content += "Custom content for this section.\n";
123
- }
124
- content += "\n\n";
125
- });
126
- await fs.writeFile(filePath, content, "utf-8");
127
- const result = await (0, validator_1.validateDocspec)(filePath);
128
- expect(result.valid).toBe(false);
129
- expect(result.errors.some(e => e.includes("empty"))).toBe(true);
130
- });
131
- it("should handle files with section numbers in headers", async () => {
132
- const filePath = path.join(tempDir, "numbered.docspec.md");
133
- const content = `# DOCSPEC: Test
134
-
135
- ## 1. Document Purpose
136
-
137
- This document serves as a test case for validating docspec files with numbered section headers. It contains custom content that is different from the boilerplate template.
138
-
139
- ## 2. Update Triggers
140
-
141
- This document should be updated whenever the validation logic for numbered headers changes. It tests the parser's ability to handle section numbers correctly.
142
-
143
- ## 3. Expected Structure
144
-
145
- This section describes the structure of the test document. It includes all required sections with sufficient content to pass validation checks.
146
-
147
- ## 4. Editing Guidelines
148
-
149
- The style for this test document is straightforward and technical. It focuses on clarity and precision in describing test scenarios. Do: Ensure all sections have adequate content. Don't: Use boilerplate text or leave sections empty. Always provide meaningful test data.
150
-
151
- ## 5. Intentional Omissions
152
-
153
- There are no known gaps in this test document. All sections are complete and properly formatted.
154
- `;
155
- await fs.writeFile(filePath, content, "utf-8");
156
- const result = await (0, validator_1.validateDocspec)(filePath);
157
- expect(result.valid).toBe(true);
158
- });
159
- it("should handle files without section numbers in headers", async () => {
160
- const filePath = path.join(tempDir, "unnumbered.docspec.md");
161
- const content = `# DOCSPEC: Test
162
-
163
- ---
164
-
165
- ## Document Purpose
166
-
167
- This document serves as a test case for validating docspec files without numbered section headers. It contains custom content that differs from the boilerplate template.
168
-
169
- ## Update Triggers
170
-
171
- This document should be updated whenever the validation logic for unnumbered headers changes. It tests the parser's flexibility in handling different header formats.
172
-
173
- ## Expected Structure
174
-
175
- This section describes the structure of the test document. It includes all required sections with sufficient content to pass validation checks.
176
-
177
- ## Editing Guidelines
178
-
179
- The style for this test document is straightforward and technical. It focuses on clarity and precision in describing test scenarios. Do: Ensure all sections have adequate content. Don't: Use boilerplate text or leave sections empty. Always provide meaningful test data.
180
-
181
- ## Intentional Omissions
182
-
183
- There are no known gaps in this test document. All sections are complete and properly formatted.
184
- `;
185
- await fs.writeFile(filePath, content, "utf-8");
186
- const result = await (0, validator_1.validateDocspec)(filePath);
187
- expect(result.valid).toBe(true);
188
- });
189
- it("should handle files without separators between sections", async () => {
190
- const filePath = path.join(tempDir, "no-separators.docspec.md");
191
- const content = `# DOCSPEC: Test
192
-
193
- ## 1. Document Purpose
194
-
195
- This document tests the validator's ability to handle files without separator lines between sections. The content here is custom and different from boilerplate.
196
-
197
- ## 2. Update Triggers
198
-
199
- This document should be updated when testing files without separators. The content is sufficient to pass validation.
200
-
201
- ## 3. Expected Structure
202
-
203
- This section describes the document structure. It includes all required sections with adequate content length.
204
-
205
- ## 4. Editing Guidelines
206
-
207
- The style rules for this test document are straightforward. Content is technical and precise. Do: Test files without separators. Don't: Require separators for validation. Ensure content is meaningful.
208
-
209
- ## 5. Intentional Omissions
210
-
211
- No gaps in this test document. All sections are complete with sufficient content.
212
- `;
213
- await fs.writeFile(filePath, content, "utf-8");
214
- const result = await (0, validator_1.validateDocspec)(filePath);
215
- // Should be valid without separators
216
- expect(result.valid).toBe(true);
217
- });
218
- it("should reject content that only differs by whitespace from boilerplate", async () => {
219
- const filePath = path.join(tempDir, "whitespace-only.docspec.md");
220
- let content = `# DOCSPEC: Test
221
-
222
- `;
223
- // Create content that's just boilerplate with different whitespace
224
- constants_1.REQUIRED_SECTIONS.forEach((section, index) => {
225
- content += `## ${index + 1}. ${section}\n\n`;
226
- // Use boilerplate but with extra spaces
227
- const boilerplate = constants_1.SECTION_BOILERPLATE[section];
228
- content += boilerplate.replace(/\n/g, " \n") + "\n";
229
- content += "\n\n";
230
- });
231
- await fs.writeFile(filePath, content, "utf-8");
232
- const result = await (0, validator_1.validateDocspec)(filePath);
233
- expect(result.valid).toBe(false);
234
- expect(result.errors.some(e => e.includes("too similar to boilerplate"))).toBe(true);
235
- });
236
- it("should reject sections that are too short", async () => {
237
- const filePath = path.join(tempDir, "short-section.docspec.md");
238
- let content = `# DOCSPEC: Test
239
-
240
- `;
241
- constants_1.REQUIRED_SECTIONS.forEach((section, index) => {
242
- content += `## ${index + 1}. ${section}\n\n`;
243
- if (index === 0) {
244
- // Make first section too short
245
- content += "Short.\n";
246
- }
247
- else {
248
- content += "This is a longer section with enough content to pass validation.\n";
249
- }
250
- content += "\n\n";
251
- });
252
- await fs.writeFile(filePath, content, "utf-8");
253
- const result = await (0, validator_1.validateDocspec)(filePath);
254
- expect(result.valid).toBe(false);
255
- expect(result.errors.some(e => e.includes("too short") || e.includes("incomplete"))).toBe(true);
256
- });
257
- it("should handle non-existent files gracefully", async () => {
258
- const filePath = path.join(tempDir, "nonexistent.docspec.md");
259
- const result = await (0, validator_1.validateDocspec)(filePath);
260
- expect(result.valid).toBe(false);
261
- expect(result.errors.length).toBeGreaterThan(0);
262
- expect(result.errors[0]).toContain("Failed to read file");
263
- });
264
- it("should handle files with extra sections (non-required)", async () => {
265
- const filePath = path.join(tempDir, "extra-sections.docspec.md");
266
- const content = `# DOCSPEC: Test
267
-
268
- ## 1. Document Purpose
269
-
270
- This document tests the validator's handling of extra sections beyond the required ones. The content is custom and sufficient to pass validation.
271
-
272
- ## 2. Update Triggers
273
-
274
- This document should be updated when testing extra section handling. The content is meaningful and not boilerplate.
275
-
276
- ## 3. Expected Structure
277
-
278
- This section describes the document structure including both required and optional sections. All content is customized.
279
-
280
- ## 4. Editing Guidelines
281
-
282
- The style rules for this test document are clear and technical. Content is sufficient in length. Do: Test extra sections. Don't: Reject valid documents with additional sections. Ensure all required sections are present.
283
-
284
- ## 5. Intentional Omissions
285
-
286
- No gaps in this test document. All sections are complete with adequate content.
287
-
288
- ## 7. Additional Section
289
-
290
- This is an extra section that shouldn't cause validation to fail. It contains additional information beyond the required sections.
291
- `;
292
- await fs.writeFile(filePath, content, "utf-8");
293
- const result = await (0, validator_1.validateDocspec)(filePath);
294
- // Extra sections should be allowed
295
- expect(result.valid).toBe(true);
296
- });
297
- it("should handle case-insensitive section matching", async () => {
298
- const filePath = path.join(tempDir, "case-test.docspec.md");
299
- const content = `# DOCSPEC: Test
300
-
301
- ---
302
-
303
- ## 1. PURPOSE OF THIS DOCUMENT
304
-
305
- Custom content.
306
-
307
- ## 2. when this document should be updated
308
-
309
- Custom content.
310
-
311
- ## 3. Expected Structure
312
-
313
- Custom content.
314
-
315
- ## 4. Editing Guidelines
316
-
317
- Custom style and editing guidelines content.
318
-
319
- ## 5. Intentional Omissions
320
-
321
- Custom gaps content.
322
- `;
323
- await fs.writeFile(filePath, content, "utf-8");
324
- const result = await (0, validator_1.validateDocspec)(filePath);
325
- // Currently the validator is case-sensitive, so this will fail
326
- // This test documents current behavior - could be enhanced later
327
- expect(result.valid).toBe(false);
328
- });
329
- });
330
- });
331
- //# sourceMappingURL=validator.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.test.js","sourceRoot":"","sources":["../../src/__tests__/validator.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAC7B,uCAAyB;AACzB,4CAA+C;AAC/C,4CAA+C;AAC/C,4CAAsE;AAEtE,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,OAAe,CAAC;IAEpB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,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AC;YAC/C,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;YAE/C,+DAA+D;YAC/D,iEAAiE;YACjE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-parser.d.ts","sourceRoot":"","sources":["../src/format-parser.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY,CAGpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CA2HhE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAkB1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-parser.js","sourceRoot":"","sources":["../src/format-parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,0CAGC;AAKD,gDA2HC;AAKD,8CAkBC;AA5KD,uCAAyB;AACzB,2CAA6B;AAc7B;;GAEG;AACH,SAAgB,eAAe,CAAC,cAAsB;IACpD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,OA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CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAE7C,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,iBAAiB;KAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,4CAA4C;IAC5C,yEAAyE;IACzE,yBAAyB;IACzB,MAAM,aAAa,GAAG;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,mBAAmB,CAAC,EAAE,kBAAkB;QACnE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,EAAE,2BAA2B;QACtE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mBAAmB,CAAC,EAAE,4BAA4B;KAC5E,CAAC;IAEF,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE,CAAC;QACvC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Generate a new docspec file at the specified path
3
- * @param filePath Path where the docspec file should be created (must end with .docspec.md)
4
- */
5
- export declare function generateDocspec(filePath: string): Promise<void>;
6
- /**
7
- * Generate docspec content as a string (for library use)
8
- * @param targetFilePath Path to the target markdown file (e.g., "README.md")
9
- */
10
- export declare function generateDocspecContent(targetFilePath: string): string;
11
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBrE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAErE"}
package/dist/generator.js DELETED
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.generateDocspec = generateDocspec;
37
- exports.generateDocspecContent = generateDocspecContent;
38
- const constants_1 = require("./constants");
39
- const fs = __importStar(require("fs/promises"));
40
- const path = __importStar(require("path"));
41
- /**
42
- * Generate a new docspec file at the specified path
43
- * @param filePath Path where the docspec file should be created (must end with .docspec.md)
44
- */
45
- async function generateDocspec(filePath) {
46
- // Extract target file path (replace .docspec.md with .md)
47
- const targetFilePath = filePath.replace(/\.docspec\.md$/, ".md");
48
- const targetFileName = path.basename(targetFilePath);
49
- // Generate the template content
50
- const content = (0, constants_1.getDocspecTemplate)(targetFileName);
51
- // Ensure the directory exists (recursive: true is safe even if dir exists)
52
- const dir = path.dirname(filePath);
53
- if (dir !== ".") {
54
- await fs.mkdir(dir, { recursive: true });
55
- }
56
- // Write the file
57
- await fs.writeFile(filePath, content, "utf-8");
58
- }
59
- /**
60
- * Generate docspec content as a string (for library use)
61
- * @param targetFilePath Path to the target markdown file (e.g., "README.md")
62
- */
63
- function generateDocspecContent(targetFilePath) {
64
- return (0, constants_1.getDocspecTemplate)(targetFilePath);
65
- }
66
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,0CAgBC;AAMD,wDAEC;AAhCD,2CAAiD;AACjD,gDAAkC;AAClC,2CAA6B;AAE7B;;;GAGG;AACI,KAAK,UAAU,eAAe,CAAC,QAAgB;IACpD,0DAA0D;IAC1D,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IACjE,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAErD,gCAAgC;IAChC,MAAM,OAAO,GAAG,IAAA,8BAAkB,EAAC,cAAc,CAAC,CAAC;IAEnD,2EAA2E;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,iBAAiB;IACjB,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,cAAsB;IAC3D,OAAO,IAAA,8BAAkB,EAAC,cAAc,CAAC,CAAC;AAC5C,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * Result of validating a docspec file
3
- */
4
- export interface ValidationResult {
5
- valid: boolean;
6
- errors: string[];
7
- }
8
- /**
9
- * Metadata about a docspec section
10
- */
11
- export interface DocspecSection {
12
- name: string;
13
- content: string;
14
- lineNumber: number;
15
- }
16
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB"}
package/dist/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { ValidationResult } from "./types";
2
- /**
3
- * Validate a docspec file
4
- * @param filePath Path to the docspec file to validate
5
- */
6
- export declare function validateDocspec(filePath: string): Promise<ValidationResult>;
7
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,SAAS,CAAC;AAG3D;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CjF"}
package/dist/validator.js DELETED
@@ -1,178 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.validateDocspec = validateDocspec;
37
- const fs = __importStar(require("fs/promises"));
38
- const constants_1 = require("./constants");
39
- /**
40
- * Validate a docspec file
41
- * @param filePath Path to the docspec file to validate
42
- */
43
- async function validateDocspec(filePath) {
44
- const errors = [];
45
- try {
46
- const content = await fs.readFile(filePath, "utf-8");
47
- const sections = parseSections(content);
48
- // Check for all required sections
49
- const foundSections = new Set();
50
- for (const section of sections) {
51
- foundSections.add(section.name);
52
- }
53
- // Check for missing sections
54
- for (const requiredSection of constants_1.REQUIRED_SECTIONS) {
55
- if (!foundSections.has(requiredSection)) {
56
- errors.push(`Missing required section: "${requiredSection}"`);
57
- }
58
- }
59
- // Validate each section's content
60
- for (const section of sections) {
61
- if (constants_1.REQUIRED_SECTIONS.includes(section.name)) {
62
- const validationError = validateSectionContent(section);
63
- if (validationError) {
64
- errors.push(validationError);
65
- }
66
- }
67
- }
68
- return {
69
- valid: errors.length === 0,
70
- errors,
71
- };
72
- }
73
- catch (error) {
74
- if (error instanceof Error) {
75
- return {
76
- valid: false,
77
- errors: [`Failed to read file: ${error.message}`],
78
- };
79
- }
80
- return {
81
- valid: false,
82
- errors: [`Failed to read file: ${String(error)}`],
83
- };
84
- }
85
- }
86
- /**
87
- * Parse markdown content into sections
88
- */
89
- function parseSections(content) {
90
- const sections = [];
91
- const lines = content.split("\n");
92
- let currentSection = null;
93
- let lineNumber = 1;
94
- for (let i = 0; i < lines.length; i++) {
95
- const line = lines[i];
96
- const trimmedLine = line.trim();
97
- // Check for section headers (## or ###)
98
- const headerMatch = trimmedLine.match(/^#{2,}\s+(.+)$/);
99
- if (headerMatch) {
100
- // Save previous section if exists
101
- if (currentSection) {
102
- sections.push(currentSection);
103
- }
104
- // Extract section name (remove section number if present)
105
- let sectionName = headerMatch[1].trim();
106
- // Skip AGENT INSTRUCTIONS section - don't validate it
107
- if (sectionName === "AGENT INSTRUCTIONS") {
108
- currentSection = null;
109
- continue;
110
- }
111
- // Remove leading number and period (e.g., "1. Purpose" -> "Purpose")
112
- sectionName = sectionName.replace(/^\d+\.\s*/, "");
113
- currentSection = {
114
- name: sectionName,
115
- content: "",
116
- lineNumber: i + 1,
117
- };
118
- }
119
- else if (currentSection) {
120
- // Accumulate content for current section
121
- if (currentSection.content) {
122
- currentSection.content += "\n";
123
- }
124
- currentSection.content += line;
125
- }
126
- lineNumber++;
127
- }
128
- // Add the last section
129
- if (currentSection) {
130
- sections.push(currentSection);
131
- }
132
- return sections;
133
- }
134
- /**
135
- * Validate that section content differs from boilerplate
136
- */
137
- function validateSectionContent(section) {
138
- const boilerplate = constants_1.SECTION_BOILERPLATE[section.name];
139
- if (!boilerplate) {
140
- return null; // Not a required section, skip validation
141
- }
142
- // Clean content: remove separator lines (---) and trim
143
- let content = section.content
144
- .split("\n")
145
- .filter(line => line.trim() !== "---")
146
- .join("\n")
147
- .trim();
148
- const boilerplateTrimmed = boilerplate.trim();
149
- // Check if content is empty
150
- if (!content) {
151
- return `Section "${section.name}" (line ${section.lineNumber}) is empty`;
152
- }
153
- // Check if content matches boilerplate exactly
154
- if (content === boilerplateTrimmed) {
155
- return `Section "${section.name}" (line ${section.lineNumber}) contains only boilerplate text and has not been customized`;
156
- }
157
- // Check if content is too similar to boilerplate (only whitespace differences)
158
- const normalizedContent = normalizeWhitespace(content);
159
- const normalizedBoilerplate = normalizeWhitespace(boilerplateTrimmed);
160
- if (normalizedContent === normalizedBoilerplate) {
161
- return `Section "${section.name}" (line ${section.lineNumber}) is too similar to boilerplate (only whitespace differences)`;
162
- }
163
- // Check if content is just a subset of boilerplate (very short)
164
- if (content.length < 50) {
165
- return `Section "${section.name}" (line ${section.lineNumber}) appears to be incomplete (too short)`;
166
- }
167
- return null;
168
- }
169
- /**
170
- * Normalize whitespace for comparison
171
- */
172
- function normalizeWhitespace(text) {
173
- return text
174
- .replace(/\s+/g, " ")
175
- .replace(/\n+/g, "\n")
176
- .trim();
177
- }
178
- //# sourceMappingURL=validator.js.map