-
Notifications
You must be signed in to change notification settings - Fork 0
docs: Initial configuration + install guide #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Typecheck | ||
| run: npm run typecheck | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,55 @@ | ||
| ## @supermodeltools/[email protected] | ||
| # Supermodel TypeScript SDK | ||
|
|
||
| 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: | ||
| [](https://www.npmjs.com/package/@supermodeltools/sdk) | ||
| [](https://www.typescriptlang.org/) | ||
|
|
||
| Environment | ||
| * Node.js | ||
| * Webpack | ||
| * Browserify | ||
| TypeScript client for the [Supermodel API](https://docs.supermodeltools.com) - code graph generation and static analysis. | ||
|
|
||
| Language level | ||
| * ES5 - you must have a Promises/A+ library installed | ||
| * ES6 | ||
| ## Install | ||
|
|
||
| Module system | ||
| * CommonJS | ||
| * ES6 module system | ||
| ```bash | ||
| npm install @supermodeltools/sdk | ||
| ``` | ||
|
|
||
| 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)) | ||
| ## Quick Start | ||
|
|
||
| ### Building | ||
| Get your API key from the [Supermodel Dashboard](https://supermodeltools.com/dashboard) and set it as `SUPERMODEL_API_KEY`. | ||
|
|
||
| To build and compile the typescript sources to javascript use: | ||
| ``` | ||
| npm install | ||
| npm run build | ||
| ``` | ||
| ```typescript | ||
| import { Configuration, DefaultApi } from '@supermodeltools/sdk'; | ||
| import { readFile } from 'node:fs/promises'; | ||
|
|
||
| ### Publishing | ||
| const config = new Configuration({ | ||
| basePath: 'https://api.supermodeltools.com', | ||
| apiKey: process.env.SUPERMODEL_API_KEY, | ||
| }); | ||
|
|
||
| First build the package then run `npm publish` | ||
| const api = new DefaultApi(config); | ||
|
|
||
| ### Consuming | ||
| // Create a ZIP of your repo: git archive -o /tmp/repo.zip HEAD | ||
| const file = new Blob([await readFile('/tmp/repo.zip')], { type: 'application/zip' }); | ||
|
|
||
| navigate to the folder of your consuming project and run one of the following commands. | ||
| const result = await api.generateSupermodelGraph({ | ||
| idempotencyKey: 'my-repo:supermodel:abc123', | ||
| file, | ||
| }); | ||
|
|
||
| _published:_ | ||
|
|
||
| ``` | ||
| npm install @supermodeltools/[email protected] --save | ||
| console.log(result.graph.nodes.length, 'nodes'); | ||
| ``` | ||
|
|
||
| _unPublished (not recommended):_ | ||
| ## Methods | ||
|
|
||
| ``` | ||
| npm install PATH_TO_GENERATED_PACKAGE --save | ||
| ``` | ||
| | Method | Description | | ||
| |--------|-------------| | ||
| | `generateDependencyGraph` | File-level dependency graph | | ||
| | `generateCallGraph` | Function-level call graph | | ||
| | `generateDomainGraph` | Domain model classification | | ||
| | `generateParseGraph` | AST parse tree relationships | | ||
| | `generateSupermodelGraph` | Full Supermodel IR bundle | | ||
|
|
||
| All methods require `idempotencyKey` (string) and `file` (Blob) parameters. | ||
|
|
||
| ## Links | ||
|
|
||
| - [API Documentation](https://docs.supermodeltools.com) | ||
| - [OpenAPI Spec](https://www.npmjs.com/package/@supermodeltools/openapi-spec) | ||
greynewell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,36 @@ | ||
| { | ||
| "name": "@supermodeltools/sdk", | ||
| "version": "0.3.8", | ||
| "description": "OpenAPI client for @supermodeltools/sdk", | ||
| "author": "OpenAPI-Generator", | ||
| "description": "TypeScript SDK for the Supermodel API - code graph generation and analysis", | ||
| "author": "Supermodel <[email protected]>", | ||
| "license": "UNLICENSED", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" | ||
| "url": "git+https://github.com/supermodeltools/typescript-sdk.git" | ||
| }, | ||
| "homepage": "https://docs.supermodeltools.com", | ||
| "bugs": { | ||
| "url": "https://github.com/supermodeltools/typescript-sdk/issues" | ||
| }, | ||
| "keywords": [ | ||
| "supermodel", | ||
| "sdk", | ||
| "api-client", | ||
| "code-graph", | ||
| "static-analysis", | ||
| "typescript" | ||
| ], | ||
| "main": "./dist/index.js", | ||
| "typings": "./dist/index.d.ts", | ||
| "module": "./dist/esm/index.js", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "sideEffects": false, | ||
| "scripts": { | ||
| "build": "tsc && tsc -p tsconfig.esm.json", | ||
| "prepare": "npm run build" | ||
| "prepare": "npm run build", | ||
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "^4.0 || ^5.0" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.