create-rstack 1.7.0 → 1.7.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/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1798,21 +1798,25 @@ function parseAgentsContent(content) {
|
|
|
1798
1798
|
const lines = content.split('\n');
|
|
1799
1799
|
let currentKey = '';
|
|
1800
1800
|
let currentTitle = '';
|
|
1801
|
+
let currentLevel = 0;
|
|
1801
1802
|
let currentContent = [];
|
|
1802
1803
|
for (const line of lines){
|
|
1803
|
-
const sectionMatch = line.match(
|
|
1804
|
+
const sectionMatch = line.match(/^(#{1,2})\s+(.+)$/);
|
|
1804
1805
|
if (sectionMatch) {
|
|
1805
1806
|
if (currentKey) sections[currentKey] = {
|
|
1806
1807
|
title: currentTitle,
|
|
1808
|
+
level: currentLevel,
|
|
1807
1809
|
content: currentContent.join('\n').trim()
|
|
1808
1810
|
};
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
+
currentLevel = sectionMatch[1].length;
|
|
1812
|
+
currentTitle = sectionMatch[2].trim();
|
|
1813
|
+
currentKey = `${currentLevel}-${currentTitle.toLowerCase()}`;
|
|
1811
1814
|
currentContent = [];
|
|
1812
1815
|
} else if (currentKey) currentContent.push(line);
|
|
1813
1816
|
}
|
|
1814
1817
|
if (currentKey) sections[currentKey] = {
|
|
1815
1818
|
title: currentTitle,
|
|
1819
|
+
level: currentLevel,
|
|
1816
1820
|
content: currentContent.join('\n').trim()
|
|
1817
1821
|
};
|
|
1818
1822
|
return sections;
|
|
@@ -1825,6 +1829,7 @@ function mergeAgentsFiles(agentsFiles) {
|
|
|
1825
1829
|
for (const [key, section] of Object.entries(sections)){
|
|
1826
1830
|
if (!allSections[key]) allSections[key] = {
|
|
1827
1831
|
title: section.title,
|
|
1832
|
+
level: section.level,
|
|
1828
1833
|
contents: []
|
|
1829
1834
|
};
|
|
1830
1835
|
if (section.content && !allSections[key].contents.includes(section.content)) allSections[key].contents.push(section.content);
|
|
@@ -1832,7 +1837,7 @@ function mergeAgentsFiles(agentsFiles) {
|
|
|
1832
1837
|
}
|
|
1833
1838
|
const result = [];
|
|
1834
1839
|
for (const [, section] of Object.entries(allSections)){
|
|
1835
|
-
result.push(
|
|
1840
|
+
result.push(`${'#'.repeat(section.level)} ${section.title}`);
|
|
1836
1841
|
result.push('');
|
|
1837
1842
|
for (const content of section.contents){
|
|
1838
1843
|
result.push(content);
|