Skip to content

Commit

Permalink
Create project file structure with base command API client configurat…
Browse files Browse the repository at this point in the history
…ion method
  • Loading branch information
sbosio committed Sep 12, 2024
1 parent b93f24c commit 2d37980
Show file tree
Hide file tree
Showing 34 changed files with 9,679 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
dist
43 changes: 43 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"extends": [
"oclif",
"oclif-typescript",
"plugin:mocha/recommended"
],
"ignorePatterns": ["**/test/**/*.js"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": [
"import",
"mocha"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"camelcase":"off",
"indent": ["error", 2, {"MemberExpression": 1}],
"mocha/no-mocha-arrows": "warn",
"mocha/no-exports": "warn",
"mocha/no-setup-in-describe": "warn",
"no-await-in-loop": "off", // Perfect legit to use await in loops, we should leave it off
"no-constant-condition": ["error", {"checkLoops": false }],
"node/no-missing-import": "off",
"unicorn/filename-case": "off",
"unicorn/import-style": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-lonely-if":"off",
"unicorn/no-process-exit": "off",
"unicorn/numeric-separators-style":"off",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-regexp-test": "off"
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
open-pull-requests-limit: 5
schedule:
interval: "weekly"
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Test Suite

on:
- push
- workflow_dispatch

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['16.x', '20.x']
os: ['sfdc-hk-ubuntu-latest', 'sfdc-hk-macos-latest', 'sfdc-hk-windows-latest']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: yarn
- run: yarn --immutable --network-timeout 1000000
- name: Unit tests
run: yarn test
- name: Check linting
run: yarn lint
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*-debug.log
*-error.log
**/.DS_Store
/.idea
/dist
/tmp
/node_modules
oclif.manifest.json

package-lock.json
pnpm-lock.yaml
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.jshint*
coverage
.nyc_output
10 changes: 10 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": ["ts-node/register", "test/helpers.mjs"],
"package": "../package.json",
"reporter": "spec",
"timeout": 5000,
"recursive": true,
"watchExtension": "ts"
}
9 changes: 9 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"all": true,
"include": [
"src/**/*.ts"
],
"exclude": [
"dist/**/*"
]
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.20.2
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229,
"skipFiles": ["<node_internals>/**"]
},
{
"type": "node",
"request": "launch",
"name": "Execute Command",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "node",
"runtimeArgs": ["--loader", "ts-node/esm", "--no-warnings=ExperimentalWarning"],
"program": "${workspaceFolder}/bin/dev.js",
"args": ["ai"]
}
]
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Change Log
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @heroku/front-end
#ECCN:Open Source
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Contributing Guide For Heroku AI CLI plugin

This page lists the operational governance model of this project, as well as the recommendations and requirements for how to best contribute to the Heroku Builds CLI. We strive to obey these as best as possible. As always, thanks for contributing – we hope these guidelines make it easier and shed some light on our approach and processes.

# Governance Model
## Published but not supported

The intent and goal of open sourcing this project is because it may contain useful or interesting code/concepts that we wish to share with the larger open source community. Although occasional work may be done on it, we will not be looking for or soliciting contributions.

# Issues, requests & ideas

Use GitHub Issues page to submit issues, enhancement requests and discuss ideas.

### Bug Reports and Fixes
- If you find a bug, please search for it in the [Issues](https://github.com/heroku/heroku-cli-plugin-ai/issues), and if it isn't already tracked,
[create a new issue](https://github.com/heroku/heroku-cli-plugin-ai/issues/new). Fill out the "Bug Report" section of the issue template. Even if an Issue is closed, feel free to comment and add details, it will still
be reviewed.
- Issues that have already been identified as a bug (note: able to reproduce) will be labelled `bug`.
- If you'd like to submit a fix for a bug, [send a Pull Request](#creating_a_pull_request) and mention the Issue number.
- Include tests that isolate the bug and verifies that it was fixed.

### New Features
- If you'd like to add new functionality to this project, describe the problem you want to solve in a [new Issue](https://github.com/heroku/heroku-cli-plugin-ai/issues/new).
- Issues that have been identified as a feature request will be labelled `enhancement`.
- If you'd like to implement the new feature, please wait for feedback from the project
maintainers before spending too much time writing the code. In some cases, `enhancement`s may
not align well with the project objectives at the time.

### Tests, Documentation, Miscellaneous
- If you'd like to improve the tests, you want to make the documentation clearer, you have an
alternative implementation of something that may have advantages over the way its currently
done, or you have any other change, we would be happy to hear about it!
- If its a trivial change, go ahead and [send a Pull Request](#creating_a_pull_request) with the changes you have in mind.
- If not, [open an Issue](https://github.com/heroku/heroku-cli-plugin-ai/issues/new) to discuss the idea first.

If you're new to our project and looking for some way to make your first contribution, look for Issues labelled `good first contribution`.

# Contribution Checklist

- [x] Clean, simple, well styled code
- [x] Commits should be atomic and messages must be descriptive. Related issues should be mentioned by Issue number.
- [x] Comments
- Module-level & function-level comments.
- Comments on complex blocks of code or algorithms (include references to sources).
- [x] Tests
- The test suite, if provided, must be complete and pass
- Increase code coverage, not versa.
- [x] Dependencies
- Minimize number of dependencies.
- Prefer Apache 2.0, BSD3, MIT, ISC and MPL licenses.
- [x] Reviews
- Changes must be approved via peer code review

# Creating a Pull Request

1. **Ensure the bug/feature was not already reported** by searching on GitHub under Issues. If none exists, create a new issue so that other contributors can keep track of what you are trying to add/fix and offer suggestions (or let you know if there is already an effort in progress).
3. **Clone** the forked repo to your machine.
4. **Create** a new branch to contain your work (e.g. `git br fix-issue-11`)
4. **Commit** changes to your own branch.
5. **Push** your work back up to your fork. (e.g. `git push fix-issue-11`)
6. **Submit** a Pull Request against the `main` branch and refer to the issue(s) you are fixing. Try not to pollute your pull request with unintended changes. Keep it simple and small.
7. **Sign** the Salesforce CLA (you will be prompted to do so when submitting the Pull Request)

> **NOTE**: Be sure to [sync your fork](https://help.github.com/articles/syncing-a-fork/) before making a pull request.
# License
By contributing your code, you agree to license your contribution under the terms of our project [LICENSE](LICENSE) and to sign the [Salesforce CLA](https://cla.salesforce.com/sign-cla)
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (c) 2024, Heroku <>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# heroku-cli-plugin-ai
@heroku-cli/plugin-ai
=====================

Heroku AI CLI plugin


[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@heroku-cli/plugin-ai.svg)](https://npmjs.org/package/@heroku-cli/plugin-ai)
[![Downloads/week](https://img.shields.io/npm/dw/@heroku-cli/plugin-ai.svg)](https://npmjs.org/package/@heroku-cli/plugin-ai)


<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
```sh-session
$ heroku plugins:install @heroku-cli/plugin-ai
$ heroku ai:COMMAND
running command...
$ heroku ai --help [COMMAND]
USAGE
$ heroku ai:COMMAND
...
```
# Commands
<!-- commands -->

<!-- commandsstop -->
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Security

Please report any security issue to [[email protected]](mailto:[email protected])
as soon as it is discovered. This library limits its runtime dependencies in
order to reduce the total cost of ownership as much as can be, but all consumers
should remain vigilant and have their security stakeholders review all third-party
products (3PP) like this one and their dependencies.
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
6 changes: 6 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning

// eslint-disable-next-line n/shebang
import {execute} from '@oclif/core'

await execute({development: true, dir: import.meta.url})
6 changes: 6 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node

const oclif = require('@oclif/core')
oclif.run().catch(async error => {
return require('@oclif/core/handle')(error)
})
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
74 changes: 74 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@heroku-cli/plugin-ai",
"description": "Heroku CLI plugin for Heroku AI add-on",
"version": "0.0.0",
"author": "Heroku",
"bugs": "https://github.com/heroku/heroku-cli-plugin-ai/issues",
"dependencies": {
"@heroku-cli/color": "^2",
"@heroku-cli/command": "^11",
"@heroku-cli/schema": "^1.0.25",
"@oclif/core": "^2.16.0",
"@oclif/plugin-help": "^5",
"tsheredoc": "^1"
},
"devDependencies": {
"@oclif/test": "^2.3.28",
"@types/mocha": "^10",
"@types/nock": "^11",
"@types/node": "^16",
"@types/sinon": "^17",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"chai": "^4",
"eslint": "^7",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1",
"eslint-import-resolver-typescript": "^3",
"eslint-plugin-import": "^2",
"eslint-plugin-mocha": "^10",
"http-call": "^5",
"mocha": "^10",
"nock": "^13",
"np": "7.7.0",
"nyc": "^15",
"oclif": "2.2.0",
"sinon": "^14",
"stdout-stderr": "^0",
"strip-ansi": "^6",
"ts-node": "^10",
"typescript": "^5"
},
"engines": {
"node": ">=16.20.2"
},
"files": [
"/dist"
],
"homepage": "https://github.com/heroku/heroku-cli-plugin-ai",
"keywords": [
"heroku-plugin",
"oclif"
],
"license": "ISC",
"oclif": {
"bin": "heroku",
"commands": "./dist/commands",
"devPlugins": [
"@oclif/plugin-help"
],
"topics": {
"ai": {
"description": "manage Heroku AI models"
}
}
},
"repository": "heroku/heroku-cli-plugin-integration",
"scripts": {
"build": "rm -rf dist && tsc -b && oclif manifest && oclif readme && mv oclif.manifest.json ./dist/oclif.manifest.json && cp README.md ./dist/README.md",
"lint": "eslint . --ext .ts --config .eslintrc.json",
"posttest": "yarn lint",
"test": "nyc mocha --forbid-only",
"version": "oclif readme && git add README.md"
}
}
Empty file added src/commands/ai/models/.keep
Empty file.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {run} from '@oclif/core'
Loading

0 comments on commit 2d37980

Please sign in to comment.