Skip to content

Commit ad4643f

Browse files
authored
docs: Initial configuration + install guide (#1)
* docs: Initial configuration + install guide * chore: add link to dashboard to get API key
1 parent aba20e2 commit ad4643f

File tree

3 files changed

+90
-35
lines changed

3 files changed

+90
-35
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
cache: npm
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Typecheck
25+
run: npm run typecheck
26+
27+
- name: Build
28+
run: npm run build
29+

README.md

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,55 @@
1-
## @supermodeltools/sdk@0.3.8
1+
# Supermodel TypeScript SDK
22

3-
This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
3+
[![npm](https://img.shields.io/npm/v/@supermodeltools/sdk)](https://www.npmjs.com/package/@supermodeltools/sdk)
4+
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org/)
45

5-
Environment
6-
* Node.js
7-
* Webpack
8-
* Browserify
6+
TypeScript client for the [Supermodel API](https://docs.supermodeltools.com) - code graph generation and static analysis.
97

10-
Language level
11-
* ES5 - you must have a Promises/A+ library installed
12-
* ES6
8+
## Install
139

14-
Module system
15-
* CommonJS
16-
* ES6 module system
10+
```bash
11+
npm install @supermodeltools/sdk
12+
```
1713

18-
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
14+
## Quick Start
1915

20-
### Building
16+
Get your API key from the [Supermodel Dashboard](https://supermodeltools.com/dashboard) and set it as `SUPERMODEL_API_KEY`.
2117

22-
To build and compile the typescript sources to javascript use:
23-
```
24-
npm install
25-
npm run build
26-
```
18+
```typescript
19+
import { Configuration, DefaultApi } from '@supermodeltools/sdk';
20+
import { readFile } from 'node:fs/promises';
2721

28-
### Publishing
22+
const config = new Configuration({
23+
basePath: 'https://api.supermodeltools.com',
24+
apiKey: process.env.SUPERMODEL_API_KEY,
25+
});
2926

30-
First build the package then run `npm publish`
27+
const api = new DefaultApi(config);
3128

32-
### Consuming
29+
// Create a ZIP of your repo: git archive -o /tmp/repo.zip HEAD
30+
const file = new Blob([await readFile('/tmp/repo.zip')], { type: 'application/zip' });
3331

34-
navigate to the folder of your consuming project and run one of the following commands.
32+
const result = await api.generateSupermodelGraph({
33+
idempotencyKey: 'my-repo:supermodel:abc123',
34+
file,
35+
});
3536

36-
_published:_
37-
38-
```
39-
npm install @supermodeltools/[email protected] --save
37+
console.log(result.graph.nodes.length, 'nodes');
4038
```
4139

42-
_unPublished (not recommended):_
40+
## Methods
4341

44-
```
45-
npm install PATH_TO_GENERATED_PACKAGE --save
46-
```
42+
| Method | Description |
43+
|--------|-------------|
44+
| `generateDependencyGraph` | File-level dependency graph |
45+
| `generateCallGraph` | Function-level call graph |
46+
| `generateDomainGraph` | Domain model classification |
47+
| `generateParseGraph` | AST parse tree relationships |
48+
| `generateSupermodelGraph` | Full Supermodel IR bundle |
49+
50+
All methods require `idempotencyKey` (string) and `file` (Blob) parameters.
51+
52+
## Links
53+
54+
- [API Documentation](https://docs.supermodeltools.com)
55+
- [OpenAPI Spec](https://www.npmjs.com/package/@supermodeltools/openapi-spec)

package.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
{
22
"name": "@supermodeltools/sdk",
33
"version": "0.3.8",
4-
"description": "OpenAPI client for @supermodeltools/sdk",
5-
"author": "OpenAPI-Generator",
4+
"description": "TypeScript SDK for the Supermodel API - code graph generation and analysis",
5+
"author": "Supermodel <[email protected]>",
6+
"license": "UNLICENSED",
67
"repository": {
78
"type": "git",
8-
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
9+
"url": "git+https://github.com/supermodeltools/typescript-sdk.git"
910
},
11+
"homepage": "https://docs.supermodeltools.com",
12+
"bugs": {
13+
"url": "https://github.com/supermodeltools/typescript-sdk/issues"
14+
},
15+
"keywords": [
16+
"supermodel",
17+
"sdk",
18+
"api-client",
19+
"code-graph",
20+
"static-analysis",
21+
"typescript"
22+
],
1023
"main": "./dist/index.js",
1124
"typings": "./dist/index.d.ts",
1225
"module": "./dist/esm/index.js",
26+
"files": [
27+
"dist"
28+
],
1329
"sideEffects": false,
1430
"scripts": {
1531
"build": "tsc && tsc -p tsconfig.esm.json",
16-
"prepare": "npm run build"
32+
"prepare": "npm run build",
33+
"typecheck": "tsc --noEmit"
1734
},
1835
"devDependencies": {
1936
"typescript": "^4.0 || ^5.0"

0 commit comments

Comments
 (0)