@terra-symposium/docs 0.1.76 → 0.1.77
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/bin/generate-skills.mjs
CHANGED
|
@@ -44,7 +44,8 @@ function splitFrontmatter(source) {
|
|
|
44
44
|
const metadata = parse(match[1]);
|
|
45
45
|
return {
|
|
46
46
|
body: source.slice(match[0].length).trim(),
|
|
47
|
-
metadata:
|
|
47
|
+
metadata:
|
|
48
|
+
metadata && typeof metadata === 'object' && !Array.isArray(metadata) ? metadata : {},
|
|
48
49
|
metadataIssue: undefined,
|
|
49
50
|
};
|
|
50
51
|
} catch (error) {
|
|
@@ -128,7 +129,9 @@ export async function generateSkillsIndex(repositoryRoot, outputPath) {
|
|
|
128
129
|
|
|
129
130
|
if (process.argv[1] && resolve(process.argv[1]) === resolve(new URL(import.meta.url).pathname)) {
|
|
130
131
|
const root = resolve(process.argv[2] ?? process.cwd());
|
|
131
|
-
const outputPath = resolve(
|
|
132
|
+
const outputPath = resolve(
|
|
133
|
+
process.argv[3] ?? join(root, '.terra-docs/cache/skills.generated.json'),
|
|
134
|
+
);
|
|
132
135
|
const skills = await generateSkillsIndex(root, outputPath);
|
|
133
136
|
console.log(`Indexed ${skills.length} skills from ${root}`);
|
|
134
137
|
}
|
package/package.json
CHANGED
package/site/astro.config.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { defineConfig } from 'astro/config';
|
|
|
6
6
|
import mdx from '@astrojs/mdx';
|
|
7
7
|
import react from '@astrojs/react';
|
|
8
8
|
import { unified } from '@astrojs/markdown-remark';
|
|
9
|
+
import { DOCS_VITE_OPTIMIZE_DEPS } from '../lib-dist/lib/astro.js';
|
|
9
10
|
import { basePathRemarkPlugin } from './base-path-remark-plugin.mjs';
|
|
10
11
|
import { docsContentPlugin } from './docs-content-plugin.mjs';
|
|
11
12
|
|
|
@@ -67,6 +68,7 @@ export default defineConfig({
|
|
|
67
68
|
markdown: { processor: unified({ remarkPlugins: [[basePathRemarkPlugin, { base }]] }) },
|
|
68
69
|
vite: {
|
|
69
70
|
plugins: [packageDependencyResolver, docsContentPlugin({ root: projectRoot, base })],
|
|
71
|
+
optimizeDeps: { include: [...DOCS_VITE_OPTIMIZE_DEPS] },
|
|
70
72
|
resolve: { alias: packageExportAliases() },
|
|
71
73
|
server: { fs: { allow: [projectRoot, packageRoot] } },
|
|
72
74
|
},
|
|
@@ -57,7 +57,9 @@ export function SkillsExplorer({ skills }: { skills: SkillRecord[] }) {
|
|
|
57
57
|
return [...byScope.entries()];
|
|
58
58
|
}, [filteredSkills]);
|
|
59
59
|
const metadataEntries = selectedSkill
|
|
60
|
-
? Object.entries(selectedSkill.metadata).filter(
|
|
60
|
+
? Object.entries(selectedSkill.metadata).filter(
|
|
61
|
+
([key]) => !['name', 'description'].includes(key),
|
|
62
|
+
)
|
|
61
63
|
: [];
|
|
62
64
|
|
|
63
65
|
return (
|
|
@@ -97,13 +99,17 @@ export function SkillsExplorer({ skills }: { skills: SkillRecord[] }) {
|
|
|
97
99
|
{entries.map((skill) => (
|
|
98
100
|
<li key={skill.sourcePath}>
|
|
99
101
|
<button
|
|
100
|
-
aria-current={
|
|
102
|
+
aria-current={
|
|
103
|
+
selectedSkill?.sourcePath === skill.sourcePath ? 'true' : undefined
|
|
104
|
+
}
|
|
101
105
|
className="docs-skills__item"
|
|
102
106
|
onClick={() => setActivePath(skill.sourcePath)}
|
|
103
107
|
type="button"
|
|
104
108
|
>
|
|
105
109
|
<span className="docs-skills__item-title">{skill.title}</span>
|
|
106
|
-
<span className="docs-skills__item-description">
|
|
110
|
+
<span className="docs-skills__item-description">
|
|
111
|
+
{skill.description || skill.name}
|
|
112
|
+
</span>
|
|
107
113
|
<span className="docs-skills__item-path">{skill.directory}</span>
|
|
108
114
|
</button>
|
|
109
115
|
</li>
|
|
@@ -135,11 +141,15 @@ export function SkillsExplorer({ skills }: { skills: SkillRecord[] }) {
|
|
|
135
141
|
</dl>
|
|
136
142
|
) : null}
|
|
137
143
|
{selectedSkill.metadataIssue ? (
|
|
138
|
-
<p className="docs-skills__metadata-issue">
|
|
144
|
+
<p className="docs-skills__metadata-issue">
|
|
145
|
+
Frontmatter could not be parsed: {selectedSkill.metadataIssue}
|
|
146
|
+
</p>
|
|
139
147
|
) : null}
|
|
140
148
|
<details className="docs-skills__source" open>
|
|
141
149
|
<summary>Full skill instructions</summary>
|
|
142
|
-
<pre
|
|
150
|
+
<pre>
|
|
151
|
+
<code>{selectedSkill.body}</code>
|
|
152
|
+
</pre>
|
|
143
153
|
</details>
|
|
144
154
|
</article>
|
|
145
155
|
) : null}
|