Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/addDocsToS3BucketAWS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- "src/**"
- "static/**"
- "versioned_sidebars/**"
- "skills/**"
- "scripts/sync-skill.mjs"
- "sidebars.ts"
- "docusaurus.config.ts"
- "package.json"
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ src/**/*.js
# Exception: CodeBlock component is intentionally JavaScript
!src/theme/CodeBlock/index.js
variables/*.js

# Generated by scripts/sync-skill.mjs from skills/*/SKILL.md
static/SKILL.md
static/skills/
4 changes: 4 additions & 0 deletions docs/getting-started/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ keywords: [getting started, overview, installation, quick start]
description: Get started with GreptimeDB quickly.
---

import AgentOnboarding from '@site/src/components/AgentOnboarding';

# Getting Started

<AgentOnboarding />

Get started with GreptimeDB quickly by following these steps:

- [Installation](./installation/overview.md): Learn how to install GreptimeDB as a standalone or cluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ keywords: [快速开始, 安装]
description: 快速开始使用 GreptimeDB
---

import AgentOnboarding from '@site/src/components/AgentOnboarding';

# 立即开始

<AgentOnboarding />

立即开始使用 GreptimeDB!

- [安装](./installation/overview.md):安装 GreptimeDB 单机模式或分布式集群。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ keywords: [快速开始, 安装]
description: 快速开始使用 GreptimeDB
---

import AgentOnboarding from '@site/src/components/AgentOnboarding';

# 立即开始

<AgentOnboarding />

立即开始使用 GreptimeDB!

- [安装](./installation/overview.md):安装 GreptimeDB 单机模式或分布式集群。
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"sync-skill": "node scripts/sync-skill.mjs",
"prestart": "pnpm sync-skill",
"start": "docusaurus start",
"start:zh": "DOC_LANG=zh pnpm start",
"prebuild": "pnpm sync-skill",
Comment thread
killme2008 marked this conversation as resolved.
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand Down
91 changes: 91 additions & 0 deletions scripts/sync-skill.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env node
// Mirrors every skills/<name>/SKILL.md to static/ so Docusaurus publishes them
// at the site root:
// skills/greptimedb-quickstart/SKILL.md -> static/SKILL.md
// -> static/skills/greptimedb-quickstart/SKILL.md
// skills/<other>/SKILL.md -> static/skills/<other>/SKILL.md
//
// The root /SKILL.md is the agent-onboarding entrypoint (copied from
// greptimedb-quickstart). The /skills/<name>/SKILL.md endpoints let agents
// fetch sister skills directly from the docs site instead of guessing GitHub
// paths.
//
// Runs as a prestart / prebuild npm hook. Never edit anything under
// static/SKILL.md or static/skills/ by hand.

import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const skillsDir = resolve(repoRoot, 'skills');
const staticDir = resolve(repoRoot, 'static');
const ROOT_SKILL = 'greptimedb-quickstart';

// Wipe previous outputs so a renamed or deleted skill does not leave a stale
// SKILL.md behind under static/skills/.
const staticSkillsDir = resolve(staticDir, 'skills');
const staticRootSkill = resolve(staticDir, 'SKILL.md');
if (existsSync(staticSkillsDir)) rmSync(staticSkillsDir, { recursive: true, force: true });
if (existsSync(staticRootSkill)) rmSync(staticRootSkill, { force: true });

// Load version variables from variables/variables-<latestStable>.ts and resolve
// VAR::name placeholders in each skill, mirroring what llms-txt-generator.ts
// does for the .md endpoints. Without this, version-pinned commands in
// SKILL.md (Docker tag, install.sh argument) would ship the literal
// "VAR::greptimedbVersion" string to agents.
const latestVersion = JSON.parse(readFileSync(resolve(repoRoot, 'versions.json'), 'utf8'))[0];
const variables = loadVariables(latestVersion);

function loadVariables(version) {
const file = resolve(repoRoot, 'variables', `variables-${version}.ts`);
if (!existsSync(file)) {
console.warn(`[sync-skill] variables-${version}.ts not found; VAR:: placeholders will not be resolved`);
return {};
}
const text = readFileSync(file, 'utf8');
const out = {};
for (const m of text.matchAll(/(\w+):\s*['"]([^'"]+)['"]/g)) {
out[m[1]] = m[2];
}
return out;
}

function resolveVariables(content) {
return content.replace(/VAR::([A-Z_]+)/gi, (match, name) => variables[name] ?? match);
}

// Inject the breadcrumb as a YAML comment inside the frontmatter so strict
// frontmatter parsers (Anthropic Skill loaders, etc.) still see `---` as the
// first byte of the file. Falls back to an HTML comment prefix when the
// source has no frontmatter.
function withBanner(body, srcRel) {
const yamlComment = `# Generated from ${srcRel}. Do not edit by hand.\n`;
const match = body.match(/^---\r?\n/);
if (match) {
return body.slice(0, match[0].length) + yamlComment + body.slice(match[0].length);
}
return `<!-- Generated from ${srcRel}. Do not edit by hand. -->\n` + body;
}

function writeWithBanner(srcAbs, dstAbs, srcRel) {
mkdirSync(dirname(dstAbs), { recursive: true });
const body = resolveVariables(readFileSync(srcAbs, 'utf8'));
writeFileSync(dstAbs, withBanner(body, srcRel), 'utf8');
console.log(`[sync-skill] ${srcRel} -> ${dstAbs.slice(repoRoot.length + 1)}`);
}

for (const name of readdirSync(skillsDir, { withFileTypes: true })) {
if (!name.isDirectory()) continue;
const src = resolve(skillsDir, name.name, 'SKILL.md');
const srcRel = `skills/${name.name}/SKILL.md`;
try {
readFileSync(src);
} catch {
continue;
}
writeWithBanner(src, resolve(staticDir, 'skills', name.name, 'SKILL.md'), srcRel);
if (name.name === ROOT_SKILL) {
writeWithBanner(src, resolve(staticDir, 'SKILL.md'), srcRel);
}
}
Comment thread
killme2008 marked this conversation as resolved.
9 changes: 9 additions & 0 deletions skills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ This is the GreptimeDB documentation for AI agents.

## Content

- `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.
- `greptimedb-pipeline`: For creating greptimedb pipeline definition
- `greptimedb-flow`: For creating greptimedb flow, continuous aggregation tasks
- `greptimedb-trigger`: For creating greptimedb trigger

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:

> Read https://docs.greptime.com/SKILL.md and follow the instructions to use GreptimeDB with your AI agent — deploy, configure, ingest, and query.

## How to install

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

### `greptimedb-quickstart`

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

### `greptimedb-pipeline`

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