# Construction Scripts

Scripts and workflow docs for building and maintaining the knowledge base.

## Scripts

### sync-github-repo-list.sh

Sync GitHub repository lists to local JSON files.

```bash
./construction/sync-github-repo-list.sh
```

**Output Files:**
- `knowledge/meta/repos-public.json` - Public repositories
- `knowledge/meta/repos-private.json` - Private repositories
- `knowledge/meta/repos-forks.json` - Forked repositories

**Data Sources:**
- pingcap organization
- tidbcloud organization
- tikv organization

**Dependencies:** `gh` (GitHub CLI), `jq`

---

### scan-public-entrypoints.py

Scan deployment-side public entrypoints from local manifests.

```bash
python3 construction/scan-public-entrypoints.py
```

**Output Files:**
- `knowledge/deployment/public-entrypoint-catalog.json`
- `knowledge/deployment/public-entrypoint-scan.md`

---

### generate-deployment-derived-artifacts.py

Generate deployment-derived KB artifacts from local deployment repos.

```bash
python3 construction/generate-deployment-derived-artifacts.py
```

---

### derive-public-service-catalog.py

Derive public service catalog artifacts from deployment-side entrypoint data.

```bash
python3 construction/derive-public-service-catalog.py
```

## Scan Workflow

Repository scan work is performed by Agent manual scan following:

- `construction/deep-scan-all-repos.md`
- `construction/deep-scan-best-practise.md`

---

## Update Deployment Repos

When deployment repository list changes:

```bash
# 1. Sync repository lists
./construction/sync-github-repo-list.sh

# 2. Manually edit knowledge/deployment/deployment-repos.json
# Extract relevant repos from repos-private.json

# 3. Update knowledge/deployment/deployment-repos.md
# Update detailed descriptions
```

## Directory Structure

```
pingcap-kb-source/
├── README.md                      # Project overview
├── knowledge/                     # Knowledge base
│   ├── meta/                      # Metadata files
│   └── repos/                     # Detailed repo info
└── construction/                  # This directory
    ├── README.md                  # This file
    ├── sync-github-repo-list.sh   # Sync repo lists
    ├── scan-public-entrypoints.py # Deployment entrypoint scan
    ├── generate-deployment-derived-artifacts.py
    ├── derive-public-service-catalog.py
    └── deep-scan-all-repos.md     # Scan task & format
```
