Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
15c9c1e
feat: define shared extractor types
tharropoulos Apr 17, 2026
4a1dffd
chore: update package scripts and deps
tharropoulos Apr 17, 2026
fd04296
chore: refresh lockfile
tharropoulos Apr 17, 2026
9fa74c4
ci: use renamed scripts for yml linting
tharropoulos Apr 17, 2026
2514929
feat: add path normalization helpers
tharropoulos Apr 17, 2026
514b63f
feat: add in-memory diagnostics collector
tharropoulos Apr 17, 2026
613e52d
feat: add progress reporting
tharropoulos Apr 17, 2026
ae8c382
feat: add filesystem helpers
tharropoulos Apr 17, 2026
8b34e30
feat: add c++ ast helpers
tharropoulos Apr 17, 2026
ce9a3fd
feat: add counting semaphore
tharropoulos Apr 17, 2026
4ecc0f1
feat: add extractor config loading
tharropoulos Apr 17, 2026
99d09cf
feat: add source resolution helpers
tharropoulos Apr 17, 2026
c7bc265
feat: add string constant loading
tharropoulos Apr 17, 2026
b9e89ff
feat: add function symbol indexing
tharropoulos Apr 17, 2026
952b573
feat: discover route registrations
tharropoulos Apr 17, 2026
fce5c3c
feat: add syntax parsing helpers
tharropoulos Apr 17, 2026
7f2c5e7
feat: add route debug logger
tharropoulos Apr 17, 2026
51613bc
feat: add collected parameter tracking
tharropoulos Apr 17, 2026
f1fa9a0
feat: add expression resolution
tharropoulos Apr 17, 2026
0255df0
feat: add extraction traversal
tharropoulos Apr 17, 2026
92b8640
feat: wire route parameter extraction
tharropoulos Apr 17, 2026
7cf457f
feat: build extracted api spec
tharropoulos Apr 17, 2026
93acddb
feat: add extraction runtime
tharropoulos Apr 17, 2026
5772298
feat: add cli command dispatch
tharropoulos Apr 17, 2026
6517e77
feat: add semantic api diff reporting
tharropoulos Apr 17, 2026
cc92d8f
chore: add project config files
tharropoulos Apr 17, 2026
cb84c23
chore: ignore build output
tharropoulos Apr 17, 2026
e23e559
chore: add extractor sync workflow
tharropoulos Apr 17, 2026
be9d3de
chore: update extracted api artifacts
tharropoulos Apr 17, 2026
046c4e2
build: fix dependency for tree-sitter
tharropoulos Apr 17, 2026
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
143 changes: 143 additions & 0 deletions .github/workflows/extract-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Extract Typesense API

on:
workflow_dispatch:
schedule:
- cron: "17 4 * * *"
push:
branches:
- master
paths:
- "src/**"
- "config.json"
- "package.json"
- "package-lock.json"
- "tsconfig.json"
- ".github/workflows/extract-api.yml"

permissions:
contents: write
issues: write

jobs:
extract:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Build CLI
run: npm run build

- name: Save previous extracted spec
run: |
if git cat-file -e HEAD:output/typesense_api_spec.json 2>/dev/null; then
git show HEAD:output/typesense_api_spec.json > "$RUNNER_TEMP/previous-typesense-api-spec.json"
else
printf '%s\n' '{"rootDir":"","routeFile":"","routes":[],"diagnostics":[]}' > "$RUNNER_TEMP/previous-typesense-api-spec.json"
fi

- name: Run extractor
id: extract
continue-on-error: true
run: node dist/cli.js extract --config ./config.json --fail-on-diagnostics

- name: Upload extractor artifacts for debugging
if: steps.extract.outcome != 'success'
uses: actions/upload-artifact@v4
with:
name: extractor-debug-artifacts
if-no-files-found: warn
path: |
output/typesense_api_spec.json
output/typesense_api_diagnostics.json

- name: Stop on extractor diagnostics
if: steps.extract.outcome != 'success'
run: exit 1

- name: Check for extracted output changes
id: changes
run: |
if git diff --quiet -- output/typesense_api_spec.json output/typesense_api_diagnostics.json; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Build semantic API diff
if: steps.changes.outputs.changed == 'true'
run: |
node dist/cli.js semantic-diff \
--previous "$RUNNER_TEMP/previous-typesense-api-spec.json" \
--next output/typesense_api_spec.json \
--json-output "$RUNNER_TEMP/typesense-api-diff.json" \
--markdown-output "$RUNNER_TEMP/typesense-api-diff.md"

- name: Read semantic API diff result
if: steps.changes.outputs.changed == 'true'
id: semantic_diff
run: |
jq -r '"changed=\(.changed)"' "$RUNNER_TEMP/typesense-api-diff.json" >> "$GITHUB_OUTPUT"

- name: Commit extracted artifacts
if: steps.changes.outputs.changed == 'true'
id: commit_artifacts
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add output/typesense_api_spec.json output/typesense_api_diagnostics.json
git commit -m "chore: update extracted Typesense API artifacts"
git push
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Open OpenAPI update issue
if: steps.changes.outputs.changed == 'true' && steps.semantic_diff.outputs.changed == 'true'
uses: actions/github-script@v7
with:
script: |
const fs = require("node:fs");
const owner = context.repo.owner;
const repo = context.repo.repo;
const commitSha = "${{ steps.commit_artifacts.outputs.sha }}";
const shortSha = commitSha.slice(0, 12);
const commitUrl = `https://github.com/${owner}/${repo}/commit/${commitSha}`;
const title = `Update openapi.yml for extracted Typesense API changes [${shortSha}]`;
const existing = await github.paginate(github.rest.issues.listForRepo, {
owner,
repo,
state: "open",
per_page: 100,
});
const alreadyOpen = existing.some((issue) => issue.title === title);
if (alreadyOpen) {
core.info(`Open issue already exists: ${title}`);
return;
}

const bodyPath = `${process.env.RUNNER_TEMP}/typesense-api-diff.md`;
const diffBody = fs.readFileSync(bodyPath, "utf8");
const body = [
"<!-- typesense-api-sync-issue -->",
`Commit: ${commitUrl}`,
"",
diffBody,
].join("\n");
await github.rest.issues.create({
owner,
repo,
title,
body,
});
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
run: npm install

- name: Lint OpenAPI specification
run: npm run lint
run: npm run spec:lint

- name: Bundle OpenAPI specification
run: npm run bundle
run: npm run spec:bundle

- name: Upload bundled specification
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
14 changes: 14 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"root_dir": "",
"route_file": "src/main/typesense_server.cpp",
"source_branch": "v30",
"output_path": "./output/typesense_api_spec.json",
"diagnostics_output_path": "./output/typesense_api_diagnostics.json",
"max_call_depth": 4,
"fail_on_unresolved": false,
"blacklist": {
"paths": ["/proxy", "/proxy_sse", "/operations/reset_peers", "/limits"],
"params": ["_ArraySize_"]
},
"overrides": []
}
33 changes: 33 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
ignores: ["**/dist/**"],
},
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
},
{
files: ["**/*.js", "**/*.mjs"],
...tseslint.configs.disableTypeChecked,
},
);
1 change: 1 addition & 0 deletions output/typesense_api_diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Loading
Loading