Skip to content

Commit c4ffdc9

Browse files
sionsmithclaude
andcommitted
feat: initial @keito-ai/sdk implementation
Auto-generated Node.js SDK for the Keito API with: - Type generation from OpenAPI v2 spec via openapi-typescript - Resource-based client (timeEntries, expenses, projects, clients, contacts, tasks, users, invoices, reports, outcomes) - HTTP core with retries, exponential backoff, typed error hierarchy - Auto-pagination with async iterator support - Outcome-based billing convenience layer (F7-F9) - Unit tests (33 passing across 5 suites) - CI/CD: test matrix, release-please auto-versioning, npm publish - Dual ESM + CJS output via tsup, zero runtime dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit c4ffdc9

40 files changed

Lines changed: 7922 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18, 20, 22]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: npm
21+
- run: npm ci
22+
- run: npm run generate
23+
- run: npm run typecheck
24+
- run: npm test
25+
- run: npm run build

.github/workflows/generate.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Regenerate Types
2+
3+
on:
4+
repository_dispatch:
5+
types: [openapi-spec-updated]
6+
workflow_dispatch:
7+
inputs:
8+
spec_repo:
9+
description: "Repo to fetch spec from (owner/repo)"
10+
default: "osodevops/keito"
11+
spec_path:
12+
description: "Path to spec in repo"
13+
default: "docs/openapi-v2.yaml"
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
generate:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
cache: npm
28+
- run: npm ci
29+
30+
- name: Fetch latest spec
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
REPO="${{ github.event.inputs.spec_repo || 'osodevops/keito' }}"
35+
SPEC_PATH="${{ github.event.inputs.spec_path || 'docs/openapi-v2.yaml' }}"
36+
gh api "repos/${REPO}/contents/${SPEC_PATH}" \
37+
--jq '.content' | base64 -d > openapi/openapi-v2.yaml
38+
39+
- run: npm run generate
40+
- run: npm run typecheck
41+
- run: npm test
42+
43+
- name: Check for changes
44+
id: diff
45+
run: |
46+
if git diff --quiet openapi/ src/generated/; then
47+
echo "changed=false" >> "$GITHUB_OUTPUT"
48+
else
49+
echo "changed=true" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Create PR
53+
if: steps.diff.outputs.changed == 'true'
54+
uses: peter-evans/create-pull-request@v6
55+
with:
56+
branch: chore/regenerate-types
57+
commit-message: "chore: regenerate types from updated OpenAPI spec"
58+
title: "chore: regenerate types from updated OpenAPI spec"
59+
body: |
60+
Auto-generated PR from updated OpenAPI spec.
61+
62+
- Fetched latest spec from upstream
63+
- Regenerated `src/generated/openapi.d.ts`
64+
- Type checking and tests pass
65+
66+
Review the diff and merge to trigger a release.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
release_created: ${{ steps.release.outputs.release_created }}
16+
tag_name: ${{ steps.release.outputs.tag_name }}
17+
steps:
18+
- uses: googleapis/release-please-action@v4
19+
id: release
20+
with:
21+
release-type: node
22+
23+
publish:
24+
needs: release-please
25+
if: ${{ needs.release-please.outputs.release_created }}
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
id-token: write
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 22
35+
cache: npm
36+
registry-url: https://registry.npmjs.org
37+
- run: npm ci
38+
- run: npm run generate
39+
- run: npm run typecheck
40+
- run: npm test
41+
- run: npm run build
42+
- run: npm publish --provenance --access public
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
.DS_Store
4+
*.tsbuildinfo
5+
.env
6+
.env.*

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}

0 commit comments

Comments
 (0)