@delete101020/aidlc 4.0.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/AUTOMATION.md +148 -0
- package/README.md +684 -0
- package/dist/assets/annotate-artifact.skill.md +121 -0
- package/dist/assets/epic-context.skill.md +55 -0
- package/dist/bundle.js +49470 -0
- package/dist/templates/ainative/agents/native-engineer.md +66 -0
- package/dist/templates/ainative/agents/native-operator.md +71 -0
- package/dist/templates/ainative/agents/native-originator.md +56 -0
- package/dist/templates/ainative/agents/native-product-owner.md +68 -0
- package/dist/templates/ainative/agents/native-reviewer.md +65 -0
- package/dist/templates/ainative/agents/native-verifier.md +58 -0
- package/dist/templates/ainative/artifacts/build-plan.md +56 -0
- package/dist/templates/ainative/artifacts/implement.md +55 -0
- package/dist/templates/ainative/artifacts/intent.md +50 -0
- package/dist/templates/ainative/artifacts/maintain.md +85 -0
- package/dist/templates/ainative/artifacts/review.md +68 -0
- package/dist/templates/ainative/artifacts/spec.md +69 -0
- package/dist/templates/ainative/artifacts/verify.md +55 -0
- package/dist/templates/ainative/skills/native-build-plan.md +74 -0
- package/dist/templates/ainative/skills/native-implement.md +62 -0
- package/dist/templates/ainative/skills/native-intent.md +50 -0
- package/dist/templates/ainative/skills/native-maintain.md +94 -0
- package/dist/templates/ainative/skills/native-review.md +82 -0
- package/dist/templates/ainative/skills/native-spec.md +83 -0
- package/dist/templates/ainative/skills/native-verify.md +60 -0
- package/dist/templates/sdlc/agents/designer.md +87 -0
- package/dist/templates/sdlc/agents/developer.md +178 -0
- package/dist/templates/sdlc/agents/example-with-skills.md +59 -0
- package/dist/templates/sdlc/agents/orchestrator.md +186 -0
- package/dist/templates/sdlc/agents/po.md +115 -0
- package/dist/templates/sdlc/agents/qa.md +141 -0
- package/dist/templates/sdlc/agents/tech-lead.md +124 -0
- package/dist/templates/sdlc/artifacts/design.md +130 -0
- package/dist/templates/sdlc/artifacts/execute-test.md +64 -0
- package/dist/templates/sdlc/artifacts/implement.backend.md +96 -0
- package/dist/templates/sdlc/artifacts/implement.md +70 -0
- package/dist/templates/sdlc/artifacts/implement.web-react.md +109 -0
- package/dist/templates/sdlc/artifacts/implement.web.md +99 -0
- package/dist/templates/sdlc/artifacts/plan.md +97 -0
- package/dist/templates/sdlc/artifacts/prototype.md +141 -0
- package/dist/templates/sdlc/artifacts/test-cases.md +47 -0
- package/dist/templates/sdlc/artifacts/test-plan.md +100 -0
- package/dist/templates/sdlc/artifacts/unit-test.md +32 -0
- package/dist/templates/sdlc/profiles/agile-lite.yaml +29 -0
- package/dist/templates/sdlc/profiles/hybrid.yaml +43 -0
- package/dist/templates/sdlc/profiles/iso-ieee.yaml +67 -0
- package/dist/templates/sdlc/profiles/none.yaml +21 -0
- package/dist/templates/sdlc/skills/advance-epic.md +77 -0
- package/dist/templates/sdlc/skills/analyze-requirements.md +279 -0
- package/dist/templates/sdlc/skills/discovery-gate.md +118 -0
- package/dist/templates/sdlc/skills/execute-test.md +74 -0
- package/dist/templates/sdlc/skills/generate-test-cases.md +77 -0
- package/dist/templates/sdlc/skills/implement.md +74 -0
- package/dist/templates/sdlc/skills/prd.md +114 -0
- package/dist/templates/sdlc/skills/prototype.md +128 -0
- package/dist/templates/sdlc/skills/tech-design.md +134 -0
- package/dist/templates/sdlc/skills/test-plan.md +115 -0
- package/dist/templates/sdlc/skills/test-report.md +38 -0
- package/dist/templates/sdlc/skills/unit-test.md +43 -0
- package/dist/templates/sdlc/validators/ci.mjs +49 -0
- package/dist/templates/sdlc/validators/traceability.mjs +244 -0
- package/dist/templates/speckit/agents/analyst.md +42 -0
- package/dist/templates/speckit/agents/speckit-developer.md +36 -0
- package/dist/templates/speckit/agents/speckit-qa.md +38 -0
- package/dist/templates/speckit/agents/speckit-tech-lead.md +40 -0
- package/dist/templates/speckit/artifacts/analyze.md +48 -0
- package/dist/templates/speckit/artifacts/clarify.md +64 -0
- package/dist/templates/speckit/artifacts/plan.md +57 -0
- package/dist/templates/speckit/artifacts/specify.md +64 -0
- package/dist/templates/speckit/artifacts/tasks.md +33 -0
- package/dist/templates/speckit/skills/analyze.md +50 -0
- package/dist/templates/speckit/skills/clarify.md +31 -0
- package/dist/templates/speckit/skills/plan.md +56 -0
- package/dist/templates/speckit/skills/specify.md +52 -0
- package/dist/templates/speckit/skills/speckit-implement.md +33 -0
- package/dist/templates/speckit/skills/tasks.md +38 -0
- package/dist/tools/epic-memory-hook.mjs +78 -0
- package/dist/tools/epic-memory.mjs +130 -0
- package/dist/tools/md-to-html.mjs +478 -0
- package/dist/tools/vendor/marked.esm.mjs +2432 -0
- package/dist/vendor/annotron/LICENSE +21 -0
- package/dist/vendor/annotron/README.md +213 -0
- package/dist/vendor/annotron/bin/annotron +467 -0
- package/dist/vendor/annotron/commands/annotron.md +11 -0
- package/dist/vendor/annotron/hooks/annotron-hook.sh +38 -0
- package/dist/vendor/annotron/hooks/hooks.json +50 -0
- package/dist/vendor/annotron/package.json +72 -0
- package/dist/vendor/annotron/skills/annotron-review/SKILL.md +86 -0
- package/dist/vendor/annotron/src/chrome.html +2029 -0
- package/dist/vendor/annotron/src/mdRender.js +208 -0
- package/dist/vendor/annotron/src/sdk.js +1042 -0
- package/dist/vendor/annotron/src/server.js +780 -0
- package/package.json +60 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown → HTML renderer for annotron's Markdown mode.
|
|
3
|
+
*
|
|
4
|
+
* Uses `markdown-it` for the prose and `merslim` (a slim, zero-runtime mermaid
|
|
5
|
+
* renderer) to turn ```mermaid fenced blocks into self-contained inline SVG at
|
|
6
|
+
* render time — so architecture docs with UML/flow/sequence/… diagrams render
|
|
7
|
+
* without any client-side diagram runtime. Types merslim can't lay out headless
|
|
8
|
+
* (sequence, state, mindmap) fall back to its Unicode ASCII rendering; anything
|
|
9
|
+
* unparseable falls back to the raw fenced source.
|
|
10
|
+
*/
|
|
11
|
+
import MarkdownIt from 'markdown-it';
|
|
12
|
+
import {
|
|
13
|
+
parseToIR,
|
|
14
|
+
flowchartToSvg, classToSvg, erToSvg,
|
|
15
|
+
buildPieSvg, buildQuadrantSvg, buildJourneySvg, buildGanttSvg,
|
|
16
|
+
buildTimelineSvg, buildC4Svg, buildArchitectureSvg, buildGitGraphSvg,
|
|
17
|
+
} from 'merslim';
|
|
18
|
+
|
|
19
|
+
// merslim IR type → one-call SVG builder (only the types that lay out headless).
|
|
20
|
+
const SVG_BUILDERS = {
|
|
21
|
+
flowchart: flowchartToSvg,
|
|
22
|
+
class: classToSvg,
|
|
23
|
+
er: erToSvg,
|
|
24
|
+
pie: buildPieSvg,
|
|
25
|
+
quadrant: buildQuadrantSvg,
|
|
26
|
+
journey: buildJourneySvg,
|
|
27
|
+
gantt: buildGanttSvg,
|
|
28
|
+
timeline: buildTimelineSvg,
|
|
29
|
+
c4: buildC4Svg,
|
|
30
|
+
architecture: buildArchitectureSvg,
|
|
31
|
+
gitgraph: buildGitGraphSvg,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function escapeHtml(s) {
|
|
35
|
+
return String(s).replace(/[&<>"']/g, c => (
|
|
36
|
+
{ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// merslim (≤0.2.3) renders flowchart *edge* labels verbatim: unlike node
|
|
41
|
+
// labels it neither strips the surrounding "…" quotes mermaid uses to allow
|
|
42
|
+
// special characters nor converts <br/> into line breaks. Such labels come out
|
|
43
|
+
// with visible quotes and a literal "<br/>" that overflows the edge (issue #84).
|
|
44
|
+
// When any edge label needs that handling, hand the whole diagram to
|
|
45
|
+
// client-side mermaid.js instead, which renders it faithfully.
|
|
46
|
+
function flowchartNeedsClientRender(ir) {
|
|
47
|
+
const edges = (ir && ir.edges) || [];
|
|
48
|
+
return edges.some((e) => {
|
|
49
|
+
const l = e && e.label;
|
|
50
|
+
if (typeof l !== 'string') return false;
|
|
51
|
+
return /<br\s*\/?>/i.test(l) || /^\s*".*"\s*$/.test(l);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// A built SVG that still carries a literal "<br/>" in rendered text means a
|
|
56
|
+
// label's line break was not laid out — treat it as degraded and fall back.
|
|
57
|
+
function svgLooksDegraded(svg) {
|
|
58
|
+
return /<br\s*\/?>/i.test(svg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function renderDiagram(src) {
|
|
62
|
+
try {
|
|
63
|
+
const r = await parseToIR(src);
|
|
64
|
+
if (r && r.ok) {
|
|
65
|
+
const build = SVG_BUILDERS[r.type];
|
|
66
|
+
if (build && !(r.type === 'flowchart' && flowchartNeedsClientRender(r.ir))) {
|
|
67
|
+
try {
|
|
68
|
+
const svg = build(r.ir, { dark: false });
|
|
69
|
+
if (typeof svg === 'string' && svg.includes('<svg') && !svgLooksDegraded(svg)) {
|
|
70
|
+
return `<figure class="mmd-diagram" data-mmd-type="${escapeHtml(r.type)}">${svg}</figure>`;
|
|
71
|
+
}
|
|
72
|
+
} catch { /* fall through to client-side mermaid */ }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch { /* fall through to client-side mermaid */ }
|
|
76
|
+
// merslim has no headless SVG builder for this type (sequence / state /
|
|
77
|
+
// mindmap) or the build failed. Hand the raw source to mermaid.js in the
|
|
78
|
+
// browser instead of the old ASCII fallback, so EVERY diagram renders as a
|
|
79
|
+
// real diagram — matching the mermaid extension. wrapDocument injects the
|
|
80
|
+
// mermaid runtime whenever any of these client blocks are present.
|
|
81
|
+
return `<pre class="mermaid mmd-client">${escapeHtml(src)}</pre>`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const isMermaidFence = (info) => (info || '').trim().split(/\s+/)[0].toLowerCase() === 'mermaid';
|
|
85
|
+
|
|
86
|
+
function slugify(text) {
|
|
87
|
+
return (text || '').toLowerCase().trim()
|
|
88
|
+
.replace(/[^\w\s-]/g, '')
|
|
89
|
+
.replace(/\s+/g, '-')
|
|
90
|
+
.replace(/-+/g, '-');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Render Markdown text to a full, self-contained HTML document. */
|
|
94
|
+
export async function renderMarkdown(mdText, { title = 'Markdown' } = {}) {
|
|
95
|
+
const md = new MarkdownIt({ html: true, linkify: true, typographer: true, breaks: false });
|
|
96
|
+
|
|
97
|
+
// Extract headings for outline
|
|
98
|
+
const headings = [];
|
|
99
|
+
const headingLevels = /^h([1-6])$/i;
|
|
100
|
+
|
|
101
|
+
// Pre-render every mermaid block (async), keyed by its source.
|
|
102
|
+
const tokens = md.parse(mdText || '', {});
|
|
103
|
+
const diagrams = new Map();
|
|
104
|
+
for (const t of tokens) {
|
|
105
|
+
if (t.type === 'fence' && isMermaidFence(t.info) && !diagrams.has(t.content)) {
|
|
106
|
+
diagrams.set(t.content, await renderDiagram(t.content));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const defaultFence = md.renderer.rules.fence
|
|
111
|
+
|| ((toks, idx, options, env, self) => self.renderToken(toks, idx, options));
|
|
112
|
+
md.renderer.rules.fence = (toks, idx, options, env, self) => {
|
|
113
|
+
const t = toks[idx];
|
|
114
|
+
if (isMermaidFence(t.info) && diagrams.has(t.content)) return diagrams.get(t.content);
|
|
115
|
+
return defaultFence(toks, idx, options, env, self);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Override heading renderer to extract headings and add IDs
|
|
119
|
+
const defaultHeading = md.renderer.rules.heading_open
|
|
120
|
+
|| ((toks, idx, options, env, self) => self.renderToken(toks, idx, options));
|
|
121
|
+
md.renderer.rules.heading_open = (toks, idx, options, env, self) => {
|
|
122
|
+
const token = toks[idx];
|
|
123
|
+
const match = token.tag.match(headingLevels);
|
|
124
|
+
if (match) {
|
|
125
|
+
const level = parseInt(match[1], 10);
|
|
126
|
+
// Find the heading text from the next token
|
|
127
|
+
const nextToken = toks[idx + 1];
|
|
128
|
+
if (nextToken && nextToken.type === 'inline' && nextToken.content) {
|
|
129
|
+
const text = nextToken.content;
|
|
130
|
+
const id = slugify(text);
|
|
131
|
+
token.attrSet('id', id);
|
|
132
|
+
headings.push({ level, text, id });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return defaultHeading(toks, idx, options, env, self);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const body = md.renderer.render(tokens, md.options, {});
|
|
139
|
+
// Load the mermaid runtime only when a diagram fell back to client rendering.
|
|
140
|
+
const needsMermaid = body.includes('class="mermaid');
|
|
141
|
+
return wrapDocument(body, title, headings, needsMermaid);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function wrapDocument(bodyHtml, title, headings = [], needsMermaid = false) {
|
|
145
|
+
const headingsJson = escapeHtml(JSON.stringify(headings));
|
|
146
|
+
return `<!DOCTYPE html>
|
|
147
|
+
<html lang="en">
|
|
148
|
+
<head>
|
|
149
|
+
<meta charset="utf-8">
|
|
150
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
151
|
+
<meta name="headings-data" content="${headingsJson}">
|
|
152
|
+
<title>${escapeHtml(title)}</title>
|
|
153
|
+
<style>
|
|
154
|
+
:root { --ink:#1f2430; --muted:#6b7280; --line:#e6e8ee; --accent:#2741F1; --code-bg:#f5f6fa; }
|
|
155
|
+
* { box-sizing: border-box; }
|
|
156
|
+
body { margin: 0; background: #fff; color: var(--ink);
|
|
157
|
+
font: 16px/1.75 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
|
|
158
|
+
.md { max-width: 820px; margin: 0 auto; padding: 48px 32px 120px; }
|
|
159
|
+
.md h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .4em; line-height: 1.2; }
|
|
160
|
+
.md h2 { font-size: 1.5rem; font-weight: 650; margin: 1.8em 0 .5em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
|
|
161
|
+
.md h3 { font-size: 1.2rem; font-weight: 650; margin: 1.5em 0 .4em; }
|
|
162
|
+
.md h4 { font-size: 1.02rem; font-weight: 650; margin: 1.3em 0 .3em; }
|
|
163
|
+
.md p { margin: 0 0 1em; }
|
|
164
|
+
.md a { color: var(--accent); text-decoration: none; }
|
|
165
|
+
.md a:hover { text-decoration: underline; }
|
|
166
|
+
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.6em; }
|
|
167
|
+
.md li { margin: .3em 0; }
|
|
168
|
+
.md blockquote { margin: 1em 0; padding: .6em 1.1em; border-left: 3px solid #d88689;
|
|
169
|
+
background: #faf7f7; color: var(--muted); border-radius: 0 8px 8px 0; }
|
|
170
|
+
.md code { background: var(--code-bg); border-radius: 5px; padding: .12em .4em; font-size: .88em;
|
|
171
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
|
|
172
|
+
.md pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
|
|
173
|
+
padding: 14px 16px; overflow: auto; margin: 0 0 1.2em; }
|
|
174
|
+
.md pre code { background: none; padding: 0; font-size: .86em; line-height: 1.6; }
|
|
175
|
+
.md table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .95em; }
|
|
176
|
+
.md th, .md td { text-align: left; padding: 8px 12px; border: 1px solid var(--line); vertical-align: top; }
|
|
177
|
+
.md th { background: #f7f8fb; font-weight: 650; }
|
|
178
|
+
.md hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
|
|
179
|
+
.md img { max-width: 100%; }
|
|
180
|
+
/* diagrams */
|
|
181
|
+
.md .mmd-diagram { margin: 1.4em 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px;
|
|
182
|
+
background: #fcfcfe; text-align: center; overflow-x: auto; }
|
|
183
|
+
.md .mmd-diagram svg { max-width: 100%; height: auto; }
|
|
184
|
+
.md .mmd-ascii { background: #0f1420; color: #cfe3ff; border: none;
|
|
185
|
+
font-family: ui-monospace, Menlo, monospace; line-height: 1.35; }
|
|
186
|
+
.md .mmd-raw { border-style: dashed; }
|
|
187
|
+
/* client-side mermaid fallback (sequence / state / mindmap) */
|
|
188
|
+
.md .mermaid { margin: 1.4em 0; padding: 16px; border: 1px solid var(--line);
|
|
189
|
+
border-radius: 12px; background: #fcfcfe; text-align: center; overflow-x: auto; }
|
|
190
|
+
.md .mermaid svg { max-width: 100%; height: auto; }
|
|
191
|
+
/* raw source shown only until mermaid replaces it (avoids a flash of code) */
|
|
192
|
+
.md .mermaid:not([data-processed]) { color: var(--muted); text-align: left;
|
|
193
|
+
font: .82em/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; }
|
|
194
|
+
</style>
|
|
195
|
+
</head>
|
|
196
|
+
<body>
|
|
197
|
+
<article class="md">
|
|
198
|
+
${bodyHtml}
|
|
199
|
+
</article>
|
|
200
|
+
${needsMermaid ? ` <script type="module">
|
|
201
|
+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
|
202
|
+
mermaid.initialize({ startOnLoad: false, theme: 'default' });
|
|
203
|
+
// Render the fenced blocks merslim couldn't lay out headless.
|
|
204
|
+
mermaid.run({ querySelector: '.mermaid' }).catch((e) => console.error('mermaid render failed', e));
|
|
205
|
+
</script>` : ''}
|
|
206
|
+
</body>
|
|
207
|
+
</html>`;
|
|
208
|
+
}
|