Skip to content

Commit 4dc9f84

Browse files
authored
feat: add greptimedb-quickstart skill with onboarding card (#2469)
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
1 parent b30fe96 commit 4dc9f84

15 files changed

Lines changed: 769 additions & 1 deletion

File tree

.github/workflows/addDocsToS3BucketAWS.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
- "src/**"
1313
- "static/**"
1414
- "versioned_sidebars/**"
15+
- "skills/**"
16+
- "scripts/sync-skill.mjs"
1517
- "sidebars.ts"
1618
- "docusaurus.config.ts"
1719
- "package.json"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ src/**/*.js
2626
# Exception: CodeBlock component is intentionally JavaScript
2727
!src/theme/CodeBlock/index.js
2828
variables/*.js
29+
30+
# Generated by scripts/sync-skill.mjs from skills/*/SKILL.md
31+
static/SKILL.md
32+
static/skills/

docs/getting-started/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ keywords: [getting started, overview, installation, quick start]
44
description: Get started with GreptimeDB quickly.
55
---
66

7+
import AgentOnboarding from '@site/src/components/AgentOnboarding';
8+
79
# Getting Started
810

11+
<AgentOnboarding />
12+
913
Get started with GreptimeDB quickly by following these steps:
1014

1115
- [Installation](./installation/overview.md): Learn how to install GreptimeDB as a standalone or cluster.

i18n/zh/docusaurus-plugin-content-docs/current/getting-started/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ keywords: [快速开始, 安装]
44
description: 快速开始使用 GreptimeDB
55
---
66

7+
import AgentOnboarding from '@site/src/components/AgentOnboarding';
8+
79
# 立即开始
810

11+
<AgentOnboarding />
12+
913
立即开始使用 GreptimeDB!
1014

1115
- [安装](./installation/overview.md):安装 GreptimeDB 单机模式或分布式集群。

i18n/zh/docusaurus-plugin-content-docs/version-1.0/getting-started/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ keywords: [快速开始, 安装]
44
description: 快速开始使用 GreptimeDB
55
---
66

7+
import AgentOnboarding from '@site/src/components/AgentOnboarding';
8+
79
# 立即开始
810

11+
<AgentOnboarding />
12+
913
立即开始使用 GreptimeDB!
1014

1115
- [安装](./installation/overview.md):安装 GreptimeDB 单机模式或分布式集群。

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",
7+
"sync-skill": "node scripts/sync-skill.mjs",
8+
"prestart": "pnpm sync-skill",
79
"start": "docusaurus start",
810
"start:zh": "DOC_LANG=zh pnpm start",
11+
"prebuild": "pnpm sync-skill",
912
"build": "docusaurus build",
1013
"swizzle": "docusaurus swizzle",
1114
"deploy": "docusaurus deploy",

scripts/sync-skill.mjs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env node
2+
// Mirrors every skills/<name>/SKILL.md to static/ so Docusaurus publishes them
3+
// at the site root:
4+
// skills/greptimedb-quickstart/SKILL.md -> static/SKILL.md
5+
// -> static/skills/greptimedb-quickstart/SKILL.md
6+
// skills/<other>/SKILL.md -> static/skills/<other>/SKILL.md
7+
//
8+
// The root /SKILL.md is the agent-onboarding entrypoint (copied from
9+
// greptimedb-quickstart). The /skills/<name>/SKILL.md endpoints let agents
10+
// fetch sister skills directly from the docs site instead of guessing GitHub
11+
// paths.
12+
//
13+
// Runs as a prestart / prebuild npm hook. Never edit anything under
14+
// static/SKILL.md or static/skills/ by hand.
15+
16+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
17+
import { dirname, resolve } from 'node:path';
18+
import { fileURLToPath } from 'node:url';
19+
20+
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
21+
const skillsDir = resolve(repoRoot, 'skills');
22+
const staticDir = resolve(repoRoot, 'static');
23+
const ROOT_SKILL = 'greptimedb-quickstart';
24+
25+
// Wipe previous outputs so a renamed or deleted skill does not leave a stale
26+
// SKILL.md behind under static/skills/.
27+
const staticSkillsDir = resolve(staticDir, 'skills');
28+
const staticRootSkill = resolve(staticDir, 'SKILL.md');
29+
if (existsSync(staticSkillsDir)) rmSync(staticSkillsDir, { recursive: true, force: true });
30+
if (existsSync(staticRootSkill)) rmSync(staticRootSkill, { force: true });
31+
32+
// Load version variables from variables/variables-<latestStable>.ts and resolve
33+
// VAR::name placeholders in each skill, mirroring what llms-txt-generator.ts
34+
// does for the .md endpoints. Without this, version-pinned commands in
35+
// SKILL.md (Docker tag, install.sh argument) would ship the literal
36+
// "VAR::greptimedbVersion" string to agents.
37+
const latestVersion = JSON.parse(readFileSync(resolve(repoRoot, 'versions.json'), 'utf8'))[0];
38+
const variables = loadVariables(latestVersion);
39+
40+
function loadVariables(version) {
41+
const file = resolve(repoRoot, 'variables', `variables-${version}.ts`);
42+
if (!existsSync(file)) {
43+
console.warn(`[sync-skill] variables-${version}.ts not found; VAR:: placeholders will not be resolved`);
44+
return {};
45+
}
46+
const text = readFileSync(file, 'utf8');
47+
const out = {};
48+
for (const m of text.matchAll(/(\w+):\s*['"]([^'"]+)['"]/g)) {
49+
out[m[1]] = m[2];
50+
}
51+
return out;
52+
}
53+
54+
function resolveVariables(content) {
55+
return content.replace(/VAR::([A-Z_]+)/gi, (match, name) => variables[name] ?? match);
56+
}
57+
58+
// Inject the breadcrumb as a YAML comment inside the frontmatter so strict
59+
// frontmatter parsers (Anthropic Skill loaders, etc.) still see `---` as the
60+
// first byte of the file. Falls back to an HTML comment prefix when the
61+
// source has no frontmatter.
62+
function withBanner(body, srcRel) {
63+
const yamlComment = `# Generated from ${srcRel}. Do not edit by hand.\n`;
64+
const match = body.match(/^---\r?\n/);
65+
if (match) {
66+
return body.slice(0, match[0].length) + yamlComment + body.slice(match[0].length);
67+
}
68+
return `<!-- Generated from ${srcRel}. Do not edit by hand. -->\n` + body;
69+
}
70+
71+
function writeWithBanner(srcAbs, dstAbs, srcRel) {
72+
mkdirSync(dirname(dstAbs), { recursive: true });
73+
const body = resolveVariables(readFileSync(srcAbs, 'utf8'));
74+
writeFileSync(dstAbs, withBanner(body, srcRel), 'utf8');
75+
console.log(`[sync-skill] ${srcRel} -> ${dstAbs.slice(repoRoot.length + 1)}`);
76+
}
77+
78+
for (const name of readdirSync(skillsDir, { withFileTypes: true })) {
79+
if (!name.isDirectory()) continue;
80+
const src = resolve(skillsDir, name.name, 'SKILL.md');
81+
const srcRel = `skills/${name.name}/SKILL.md`;
82+
try {
83+
readFileSync(src);
84+
} catch {
85+
continue;
86+
}
87+
writeWithBanner(src, resolve(staticDir, 'skills', name.name, 'SKILL.md'), srcRel);
88+
if (name.name === ROOT_SKILL) {
89+
writeWithBanner(src, resolve(staticDir, 'SKILL.md'), srcRel);
90+
}
91+
}

skills/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ This is the GreptimeDB documentation for AI agents.
66

77
## Content
88

9+
- `greptimedb-quickstart`: Entry-point guide — when to use GreptimeDB, how to install, which write protocol to choose, how to query, plus pointers to deeper docs via `llms.txt`. Start here.
910
- `greptimedb-pipeline`: For creating greptimedb pipeline definition
1011
- `greptimedb-flow`: For creating greptimedb flow, continuous aggregation tasks
1112
- `greptimedb-trigger`: For creating greptimedb trigger
1213

14+
The `greptimedb-quickstart` skill is also hosted at <https://docs.greptime.com/SKILL.md> (and <https://docs.greptime.cn/SKILL.md>), so any AI coding agent can load it with a single instruction:
15+
16+
> Read https://docs.greptime.com/SKILL.md and follow the instructions to use GreptimeDB with your AI agent — deploy, configure, ingest, and query.
17+
1318
## How to install
1419

1520
Using `skills` cli tool to install the skill to your coding agents.
1621

22+
### `greptimedb-quickstart`
23+
24+
`npx skills add https://github.com/GreptimeTeam/docs/tree/main/skills/greptimedb-quickstart`
25+
1726
### `greptimedb-pipeline`
1827

1928
`npx skills add https://github.com/GreptimeTeam/docs/tree/main/skills/greptimedb-pipeline`

0 commit comments

Comments
 (0)