docspec 0.1.0 → 0.3.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 +69 -51
- package/dist/__tests__/changed.test.d.ts +2 -0
- package/dist/__tests__/changed.test.d.ts.map +1 -0
- package/dist/__tests__/changed.test.js +98 -0
- package/dist/__tests__/changed.test.js.map +1 -0
- package/dist/__tests__/cli.test.js +38 -158
- package/dist/__tests__/cli.test.js.map +1 -1
- package/dist/__tests__/constants.test.js +8 -18
- package/dist/__tests__/constants.test.js.map +1 -1
- package/dist/__tests__/create.test.d.ts +2 -0
- package/dist/__tests__/create.test.d.ts.map +1 -0
- package/dist/__tests__/create.test.js +122 -0
- package/dist/__tests__/create.test.js.map +1 -0
- package/dist/__tests__/generate.test.d.ts +2 -0
- package/dist/__tests__/generate.test.d.ts.map +1 -0
- package/dist/__tests__/generate.test.js +113 -0
- package/dist/__tests__/generate.test.js.map +1 -0
- package/dist/__tests__/generator.test.js +36 -32
- package/dist/__tests__/generator.test.js.map +1 -1
- package/dist/__tests__/path-utils.test.d.ts +2 -0
- package/dist/__tests__/path-utils.test.d.ts.map +1 -0
- package/dist/__tests__/path-utils.test.js +49 -0
- package/dist/__tests__/path-utils.test.js.map +1 -0
- package/dist/__tests__/template.test.d.ts +2 -0
- package/dist/__tests__/template.test.d.ts.map +1 -0
- package/dist/__tests__/template.test.js +95 -0
- package/dist/__tests__/template.test.js.map +1 -0
- package/dist/__tests__/validator.test.js +50 -94
- package/dist/__tests__/validator.test.js.map +1 -1
- package/dist/changed.d.ts +25 -0
- package/dist/changed.d.ts.map +1 -0
- package/dist/changed.js +210 -0
- package/dist/changed.js.map +1 -0
- package/dist/cli.js +89 -73
- package/dist/cli.js.map +1 -1
- package/dist/constants.d.ts +5 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +155 -40
- package/dist/constants.js.map +1 -1
- package/dist/create.d.ts +12 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/create.js +93 -0
- package/dist/create.js.map +1 -0
- package/dist/docspec-changed.d.ts +25 -0
- package/dist/docspec-changed.d.ts.map +1 -0
- package/dist/docspec-changed.js +210 -0
- package/dist/docspec-changed.js.map +1 -0
- package/dist/docspec-generate.d.ts +22 -0
- package/dist/docspec-generate.d.ts.map +1 -0
- package/dist/docspec-generate.js +171 -0
- package/dist/docspec-generate.js.map +1 -0
- package/dist/format-parser.d.ts +24 -0
- package/dist/format-parser.d.ts.map +1 -0
- package/dist/format-parser.js +205 -0
- package/dist/format-parser.js.map +1 -0
- package/dist/generate.d.ts +26 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +175 -0
- package/dist/generate.js.map +1 -0
- package/dist/generator.d.ts +6 -6
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +38 -26
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +40 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +74 -0
- package/dist/logger.js.map +1 -0
- package/dist/path-utils.d.ts +17 -0
- package/dist/path-utils.d.ts.map +1 -0
- package/dist/path-utils.js +76 -0
- package/dist/path-utils.js.map +1 -0
- package/dist/template.d.ts +20 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +151 -0
- package/dist/template.js.map +1 -0
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +39 -1
- package/dist/validator.js.map +1 -1
- package/docspec-format.md +45 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,sDAKC;AAMD,sDASC;AAKD,sCAKC;AA1CD,2CAA6B;AAE7B,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,WAAW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AC9D,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,QAAgB;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChE,OAAO,CACL,UAAU,CAAC,UAAU,CAAC,WAAW,GAAG,GAAG,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface ParsedSection {
|
|
2
|
+
name: string;
|
|
3
|
+
boilerplate: string;
|
|
4
|
+
number: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ParsedFormat {
|
|
7
|
+
sections: ParsedSection[];
|
|
8
|
+
template: string;
|
|
9
|
+
agentInstructions?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse the docspec template file (.docspec/docspec.md) into structure and sections.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseFormatFile(formatFilePath: string): ParsedFormat;
|
|
15
|
+
/**
|
|
16
|
+
* Path to the template file (.docspec/docspec.md). Seeds from bundled default if missing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getFormatFilePath(): string;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,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;AA4GD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C"}
|
package/dist/template.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
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.parseFormatFile = parseFormatFile;
|
|
37
|
+
exports.getFormatFilePath = getFormatFilePath;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
/**
|
|
41
|
+
* Parse the docspec template file (.docspec/docspec.md) into structure and sections.
|
|
42
|
+
*/
|
|
43
|
+
function parseFormatFile(formatFilePath) {
|
|
44
|
+
const content = fs.readFileSync(formatFilePath, "utf-8");
|
|
45
|
+
return parseFormatContent(content);
|
|
46
|
+
}
|
|
47
|
+
function parseFormatContent(content) {
|
|
48
|
+
const lines = content.split("\n");
|
|
49
|
+
// Look for AGENT INSTRUCTIONS section first
|
|
50
|
+
let agentInstructions;
|
|
51
|
+
let agentInstructionsStart = -1;
|
|
52
|
+
let agentInstructionsEnd = -1;
|
|
53
|
+
for (let i = 0; i < lines.length; i++) {
|
|
54
|
+
if (lines[i].trim() === "## AGENT INSTRUCTIONS") {
|
|
55
|
+
agentInstructionsStart = i;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (agentInstructionsStart >= 0) {
|
|
60
|
+
for (let i = agentInstructionsStart + 1; i < lines.length; i++) {
|
|
61
|
+
const trimmedLine = lines[i].trim();
|
|
62
|
+
if (trimmedLine.match(/^##\s+/)) {
|
|
63
|
+
agentInstructionsEnd = i;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (agentInstructionsEnd < 0)
|
|
68
|
+
agentInstructionsEnd = lines.length;
|
|
69
|
+
const agentLines = lines.slice(agentInstructionsStart + 1, agentInstructionsEnd);
|
|
70
|
+
let agentContent = agentLines.join("\n");
|
|
71
|
+
agentContent = agentContent
|
|
72
|
+
.split("\n")
|
|
73
|
+
.filter((line) => line.trim() !== "---")
|
|
74
|
+
.join("\n")
|
|
75
|
+
.trim();
|
|
76
|
+
if (agentContent)
|
|
77
|
+
agentInstructions = agentContent;
|
|
78
|
+
}
|
|
79
|
+
// Find all section headers: ## N. Section Name
|
|
80
|
+
const sectionHeaderRegex = /^##\s+(\d+)\.\s+(.+)$/;
|
|
81
|
+
const sectionHeaders = [];
|
|
82
|
+
for (let i = 0; i < lines.length; i++) {
|
|
83
|
+
if (lines[i].trim() === "## AGENT INSTRUCTIONS")
|
|
84
|
+
continue;
|
|
85
|
+
const match = lines[i].match(sectionHeaderRegex);
|
|
86
|
+
if (match) {
|
|
87
|
+
sectionHeaders.push({
|
|
88
|
+
lineIndex: i,
|
|
89
|
+
number: parseInt(match[1], 10),
|
|
90
|
+
name: match[2].trim(),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (sectionHeaders.length === 0) {
|
|
95
|
+
throw new Error("No section headers found in template. Expected format: ## N. Section Name");
|
|
96
|
+
}
|
|
97
|
+
const firstSectionLine = sectionHeaders[0].lineIndex;
|
|
98
|
+
const templateBeforeSections = agentInstructionsStart >= 0 && agentInstructionsStart < firstSectionLine
|
|
99
|
+
? lines.slice(0, agentInstructionsStart).join("\n").trim()
|
|
100
|
+
: lines.slice(0, firstSectionLine).join("\n").trim();
|
|
101
|
+
const template = templateBeforeSections + "\n\n{{AGENT_INSTRUCTIONS}}\n\n{{SECTIONS}}\n";
|
|
102
|
+
const sections = [];
|
|
103
|
+
for (let i = 0; i < sectionHeaders.length; i++) {
|
|
104
|
+
const header = sectionHeaders[i];
|
|
105
|
+
const nextHeaderLine = i < sectionHeaders.length - 1 ? sectionHeaders[i + 1].lineIndex : lines.length;
|
|
106
|
+
const sectionLines = lines.slice(header.lineIndex + 1, nextHeaderLine);
|
|
107
|
+
let sectionContent = sectionLines.join("\n");
|
|
108
|
+
sectionContent = sectionContent
|
|
109
|
+
.split("\n")
|
|
110
|
+
.filter((line) => line.trim() !== "---")
|
|
111
|
+
.join("\n")
|
|
112
|
+
.trim();
|
|
113
|
+
sections.push({
|
|
114
|
+
name: header.name,
|
|
115
|
+
boilerplate: sectionContent,
|
|
116
|
+
number: header.number,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
sections.sort((a, b) => a.number - b.number);
|
|
120
|
+
return {
|
|
121
|
+
sections,
|
|
122
|
+
template,
|
|
123
|
+
agentInstructions,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Seed .docspec/docspec.md from the bundled docspec-format.md if it doesn't exist.
|
|
128
|
+
*/
|
|
129
|
+
function seedDefaultFormatFile() {
|
|
130
|
+
const cwd = process.cwd();
|
|
131
|
+
const userPath = path.join(cwd, ".docspec", "docspec.md");
|
|
132
|
+
const defaultPath = path.join(__dirname, "..", "docspec-format.md");
|
|
133
|
+
if (!fs.existsSync(defaultPath)) {
|
|
134
|
+
throw new Error(`Default template not found at ${defaultPath}. ` +
|
|
135
|
+
`Create .docspec/docspec.md in your project or ensure the docspec package is installed correctly.`);
|
|
136
|
+
}
|
|
137
|
+
fs.mkdirSync(path.join(cwd, ".docspec"), { recursive: true });
|
|
138
|
+
fs.copyFileSync(defaultPath, userPath);
|
|
139
|
+
return userPath;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Path to the template file (.docspec/docspec.md). Seeds from bundled default if missing.
|
|
143
|
+
*/
|
|
144
|
+
function getFormatFilePath() {
|
|
145
|
+
const cwd = process.cwd();
|
|
146
|
+
const userPath = path.join(cwd, ".docspec", "docspec.md");
|
|
147
|
+
if (fs.existsSync(userPath))
|
|
148
|
+
return userPath;
|
|
149
|
+
return seedDefaultFormatFile();
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,0CAGC;AA+GD,8CAKC;AAzID,uCAAyB;AACzB,2CAA6B;AAc7B;;GAEG;AACH,SAAgB,eAAe,CAAC,cA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ACL,QAAQ;QACR,QAAQ;QACR,iBAAiB;KAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,iCAAiC,WAAW,IAAI;YAC9C,kGAAkG,CACrG,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAC1D,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7C,OAAO,qBAAqB,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,SAAS,CAAC;AAI3D;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmEjF"}
|
package/dist/validator.js
CHANGED
|
@@ -36,41 +36,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.validateDocspec = validateDocspec;
|
|
37
37
|
const fs = __importStar(require("fs/promises"));
|
|
38
38
|
const constants_1 = require("./constants");
|
|
39
|
+
const logger_1 = require("./logger");
|
|
39
40
|
/**
|
|
40
41
|
* Validate a docspec file
|
|
41
42
|
* @param filePath Path to the docspec file to validate
|
|
42
43
|
*/
|
|
43
44
|
async function validateDocspec(filePath) {
|
|
44
45
|
const errors = [];
|
|
46
|
+
logger_1.logger.debug(`Reading file: ${filePath}`);
|
|
45
47
|
try {
|
|
46
48
|
const content = await fs.readFile(filePath, "utf-8");
|
|
49
|
+
logger_1.logger.debug(`File read successfully, ${content.length} characters`);
|
|
50
|
+
logger_1.logger.debug("Parsing sections from content");
|
|
47
51
|
const sections = parseSections(content);
|
|
52
|
+
logger_1.logger.debug(`Found ${sections.length} section(s)`);
|
|
48
53
|
// Check for all required sections
|
|
49
54
|
const foundSections = new Set();
|
|
50
55
|
for (const section of sections) {
|
|
51
56
|
foundSections.add(section.name);
|
|
57
|
+
logger_1.logger.debug(`Found section: "${section.name}" (line ${section.lineNumber})`);
|
|
52
58
|
}
|
|
59
|
+
logger_1.logger.debug(`Checking for ${constants_1.REQUIRED_SECTIONS.length} required section(s)`);
|
|
53
60
|
// Check for missing sections
|
|
54
61
|
for (const requiredSection of constants_1.REQUIRED_SECTIONS) {
|
|
55
62
|
if (!foundSections.has(requiredSection)) {
|
|
63
|
+
logger_1.logger.debug(`Missing required section: "${requiredSection}"`);
|
|
56
64
|
errors.push(`Missing required section: "${requiredSection}"`);
|
|
57
65
|
}
|
|
66
|
+
else {
|
|
67
|
+
logger_1.logger.debug(`✓ Required section found: "${requiredSection}"`);
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
// Validate each section's content
|
|
71
|
+
logger_1.logger.debug("Validating section content");
|
|
60
72
|
for (const section of sections) {
|
|
61
73
|
if (constants_1.REQUIRED_SECTIONS.includes(section.name)) {
|
|
74
|
+
logger_1.logger.debug(`Validating content for section: "${section.name}"`);
|
|
62
75
|
const validationError = validateSectionContent(section);
|
|
63
76
|
if (validationError) {
|
|
77
|
+
logger_1.logger.debug(`Validation error for "${section.name}": ${validationError}`);
|
|
64
78
|
errors.push(validationError);
|
|
65
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
logger_1.logger.debug(`✓ Section "${section.name}" content is valid`);
|
|
82
|
+
}
|
|
66
83
|
}
|
|
67
84
|
}
|
|
85
|
+
const isValid = errors.length === 0;
|
|
86
|
+
logger_1.logger.debug(`Validation ${isValid ? "passed" : "failed"} with ${errors.length} error(s)`);
|
|
68
87
|
return {
|
|
69
|
-
valid:
|
|
88
|
+
valid: isValid,
|
|
70
89
|
errors,
|
|
71
90
|
};
|
|
72
91
|
}
|
|
73
92
|
catch (error) {
|
|
93
|
+
logger_1.logger.debug(`Error reading file: ${error instanceof Error ? error.message : String(error)}`);
|
|
74
94
|
if (error instanceof Error) {
|
|
75
95
|
return {
|
|
76
96
|
valid: false,
|
|
@@ -89,6 +109,7 @@ async function validateDocspec(filePath) {
|
|
|
89
109
|
function parseSections(content) {
|
|
90
110
|
const sections = [];
|
|
91
111
|
const lines = content.split("\n");
|
|
112
|
+
logger_1.logger.debug(`Parsing ${lines.length} lines for sections`);
|
|
92
113
|
let currentSection = null;
|
|
93
114
|
let lineNumber = 1;
|
|
94
115
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -99,12 +120,20 @@ function parseSections(content) {
|
|
|
99
120
|
if (headerMatch) {
|
|
100
121
|
// Save previous section if exists
|
|
101
122
|
if (currentSection) {
|
|
123
|
+
logger_1.logger.debug(`Closing section "${currentSection.name}" with ${currentSection.content.length} characters`);
|
|
102
124
|
sections.push(currentSection);
|
|
103
125
|
}
|
|
104
126
|
// Extract section name (remove section number if present)
|
|
105
127
|
let sectionName = headerMatch[1].trim();
|
|
128
|
+
// Skip AGENT INSTRUCTIONS section - don't validate it
|
|
129
|
+
if (sectionName === "AGENT INSTRUCTIONS") {
|
|
130
|
+
logger_1.logger.debug("Skipping AGENT INSTRUCTIONS section");
|
|
131
|
+
currentSection = null;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
106
134
|
// Remove leading number and period (e.g., "1. Purpose" -> "Purpose")
|
|
107
135
|
sectionName = sectionName.replace(/^\d+\.\s*/, "");
|
|
136
|
+
logger_1.logger.debug(`Found section header: "${sectionName}" at line ${i + 1}`);
|
|
108
137
|
currentSection = {
|
|
109
138
|
name: sectionName,
|
|
110
139
|
content: "",
|
|
@@ -122,6 +151,7 @@ function parseSections(content) {
|
|
|
122
151
|
}
|
|
123
152
|
// Add the last section
|
|
124
153
|
if (currentSection) {
|
|
154
|
+
logger_1.logger.debug(`Closing final section "${currentSection.name}" with ${currentSection.content.length} characters`);
|
|
125
155
|
sections.push(currentSection);
|
|
126
156
|
}
|
|
127
157
|
return sections;
|
|
@@ -132,8 +162,10 @@ function parseSections(content) {
|
|
|
132
162
|
function validateSectionContent(section) {
|
|
133
163
|
const boilerplate = constants_1.SECTION_BOILERPLATE[section.name];
|
|
134
164
|
if (!boilerplate) {
|
|
165
|
+
logger_1.logger.debug(`No boilerplate found for section "${section.name}", skipping content validation`);
|
|
135
166
|
return null; // Not a required section, skip validation
|
|
136
167
|
}
|
|
168
|
+
logger_1.logger.debug(`Validating content for "${section.name}" (boilerplate length: ${boilerplate.length})`);
|
|
137
169
|
// Clean content: remove separator lines (---) and trim
|
|
138
170
|
let content = section.content
|
|
139
171
|
.split("\n")
|
|
@@ -141,24 +173,30 @@ function validateSectionContent(section) {
|
|
|
141
173
|
.join("\n")
|
|
142
174
|
.trim();
|
|
143
175
|
const boilerplateTrimmed = boilerplate.trim();
|
|
176
|
+
logger_1.logger.debug(`Section content length: ${content.length} characters`);
|
|
144
177
|
// Check if content is empty
|
|
145
178
|
if (!content) {
|
|
179
|
+
logger_1.logger.debug(`Section "${section.name}" is empty`);
|
|
146
180
|
return `Section "${section.name}" (line ${section.lineNumber}) is empty`;
|
|
147
181
|
}
|
|
148
182
|
// Check if content matches boilerplate exactly
|
|
149
183
|
if (content === boilerplateTrimmed) {
|
|
184
|
+
logger_1.logger.debug(`Section "${section.name}" matches boilerplate exactly`);
|
|
150
185
|
return `Section "${section.name}" (line ${section.lineNumber}) contains only boilerplate text and has not been customized`;
|
|
151
186
|
}
|
|
152
187
|
// Check if content is too similar to boilerplate (only whitespace differences)
|
|
153
188
|
const normalizedContent = normalizeWhitespace(content);
|
|
154
189
|
const normalizedBoilerplate = normalizeWhitespace(boilerplateTrimmed);
|
|
155
190
|
if (normalizedContent === normalizedBoilerplate) {
|
|
191
|
+
logger_1.logger.debug(`Section "${section.name}" is too similar to boilerplate (only whitespace differences)`);
|
|
156
192
|
return `Section "${section.name}" (line ${section.lineNumber}) is too similar to boilerplate (only whitespace differences)`;
|
|
157
193
|
}
|
|
158
194
|
// Check if content is just a subset of boilerplate (very short)
|
|
159
195
|
if (content.length < 50) {
|
|
196
|
+
logger_1.logger.debug(`Section "${section.name}" is too short (${content.length} < 50 characters)`);
|
|
160
197
|
return `Section "${section.name}" (line ${section.lineNumber}) appears to be incomplete (too short)`;
|
|
161
198
|
}
|
|
199
|
+
logger_1.logger.debug(`Section "${section.name}" content validation passed`);
|
|
162
200
|
return null;
|
|
163
201
|
}
|
|
164
202
|
/**
|
package/dist/validator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"validator.js","sour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AgE;IAChE,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACxB,eAAM,CAAC,KAAK,CAAC,YAAY,OAAO,CAAC,IAAI,mBAAmB,OAAO,CAAC,MAAM,mBAAmB,CAAC,CAAC;QAC3F,OAAO,YAAY,OAAO,CAAC,IAAI,WAAW,OAAO,CAAC,UAAU,wCAAwC,CAAC;IACvG,CAAC;IAED,eAAM,CAAC,KAAK,CAAC,YAAY,OAAO,CAAC,IAAI,6BAA6B,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACvC,OAAO,IAAI;SACR,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SACrB,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# DOCSPEC: [{{TARGET_FILE}}](/{{TARGET_FILE}})
|
|
2
|
+
|
|
3
|
+
> A specification that defines how the target document should be maintained by agents.
|
|
4
|
+
|
|
5
|
+
## AGENT INSTRUCTIONS
|
|
6
|
+
|
|
7
|
+
**Target document:** `{{TARGET_FILE}}`
|
|
8
|
+
|
|
9
|
+
**Your task:**
|
|
10
|
+
|
|
11
|
+
* Compare the target document against this docspec.
|
|
12
|
+
* Update the target document to satisfy this docspec.
|
|
13
|
+
* Make the smallest changes necessary.
|
|
14
|
+
* Preserve existing content that already complies.
|
|
15
|
+
* Do not invent content, sections, or facts not implied by this docspec or the repository.
|
|
16
|
+
|
|
17
|
+
## 1. Document Purpose
|
|
18
|
+
|
|
19
|
+
What this document exists to explain or enable.
|
|
20
|
+
What questions it must reliably answer.
|
|
21
|
+
What kind of doc it is (overview, agent guide, spec, tutorial, etc.).
|
|
22
|
+
|
|
23
|
+
## 2. Update Triggers
|
|
24
|
+
|
|
25
|
+
What kinds of changes should cause this document to be updated.
|
|
26
|
+
Describe in terms of detectable changes (structure, APIs, workflows, behavior).
|
|
27
|
+
Also note changes that **should not** trigger updates.
|
|
28
|
+
|
|
29
|
+
## 3. Expected Structure
|
|
30
|
+
|
|
31
|
+
The sections this document should contain.
|
|
32
|
+
For each section: what it covers at a high level and any constraints
|
|
33
|
+
(e.g., "high-level only", "no exhaustive lists", "link out instead of duplicating").
|
|
34
|
+
|
|
35
|
+
## 4. Editing Guidelines
|
|
36
|
+
|
|
37
|
+
How edits to this document should be made.
|
|
38
|
+
Local rules for tone, level of detail, and scope.
|
|
39
|
+
Explicit do/don't guidance to avoid drift, speculation, or redundancy.
|
|
40
|
+
|
|
41
|
+
## 5. Intentional Omissions
|
|
42
|
+
|
|
43
|
+
What this document deliberately does not cover.
|
|
44
|
+
Where that information lives instead, if applicable.
|
|
45
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docspec",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Docspec is a specification format and toolchain for documentation that is maintained by agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"README.md"
|
|
26
|
+
"README.md",
|
|
27
|
+
"docspec-format.md"
|
|
27
28
|
],
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/jest": "^30.0.0",
|