@bussolabs/closeyourit-cli 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/base.js +7 -0
- package/dist/commands/projects/github-connect.d.ts +10 -0
- package/dist/commands/projects/github-connect.js +28 -0
- package/dist/commands/whoami.js +21 -2
- package/oclif.manifest.json +2559 -2510
- package/opencli.json +23 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ CLOSEYOURIT_TOKEN=cyi_u_… CLOSEYOURIT_API_URL=https://www.closeyour.it \
|
|
|
51
51
|
| `projects settings show --project <id\|key>` | Show a project's settings (log/analytics retention + feature flags). |
|
|
52
52
|
| `projects settings update --project <id\|key> [--logs-retention-days] [--analytics-retention-days] [--roadmap-enabled] [--quick-bug-report-enabled] [--analytics-enabled]` | Update a project's settings (only the passed fields change). |
|
|
53
53
|
| `projects github --project <id\|key>` | Show a project's GitHub integration (repo link + tag→release binding rules). |
|
|
54
|
+
| `projects github-connect --project <id\|key> --repository <owner/name>` | Connect a project to a repository visible to the organization's GitHub App. |
|
|
54
55
|
| `projects github-map [--connected-only]` | List every visible CloseYourIt project and its connected GitHub repository; automatically fetches all pages. |
|
|
55
56
|
| `projects github-update --project <id\|key> [--default-branch] [--production-environment-id] [--staging-environment-id] [--sync-enabled] [--tag-binding-enabled] [--autoclose-on-merge]` | Update a project's GitHub binding rules (only the passed fields change). |
|
|
56
57
|
| `groups list [--page]` | List groups (macro-projects) in your org. |
|
package/dist/base.js
CHANGED
|
@@ -101,6 +101,13 @@ class BaseCommand extends core_1.Command {
|
|
|
101
101
|
}
|
|
102
102
|
return this.exit(1);
|
|
103
103
|
}
|
|
104
|
+
// Oclif's default JSON formatter serializes the complete CommandError. That object references
|
|
105
|
+
// the command instance and therefore cfg/api.config, including the bearer token. Never pass an
|
|
106
|
+
// unknown error to that formatter in JSON mode: emit a deliberately small allow-listed envelope.
|
|
107
|
+
if (this.jsonEnabled()) {
|
|
108
|
+
this.logJson({ error: { code: error_codes_1.ErrorCodes.System.unexpected, message: 'Command failed' } });
|
|
109
|
+
return this.exit(1);
|
|
110
|
+
}
|
|
104
111
|
return super.catch(error);
|
|
105
112
|
}
|
|
106
113
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ProjectsGithubConnect extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
repository: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const output_1 = require("../../lib/output");
|
|
6
|
+
class ProjectsGithubConnect extends base_1.BaseCommand {
|
|
7
|
+
static description = 'Connect a project to a repository available to the organization GitHub App';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> projects github-connect -p CYAG --repository bussolabs/closeyourit-agent',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
...base_1.projectFlag,
|
|
13
|
+
repository: core_1.Flags.string({ description: 'GitHub repository as owner/name', required: true }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(ProjectsGithubConnect);
|
|
17
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
18
|
+
const res = await this.api.post(`/cli/v1/projects/${encodeURIComponent(projectId)}/github`, { full_name: flags.repository });
|
|
19
|
+
if (!this.jsonEnabled()) {
|
|
20
|
+
const data = res.data ?? {};
|
|
21
|
+
const repository = (data.repository ?? {});
|
|
22
|
+
this.log('GitHub repository connected:');
|
|
23
|
+
this.log((0, output_1.renderRecord)({ project_id: data.project_id, full_name: repository.full_name, default_branch: repository.default_branch }));
|
|
24
|
+
}
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = ProjectsGithubConnect;
|
package/dist/commands/whoami.js
CHANGED
|
@@ -2,11 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const base_1 = require("../base");
|
|
4
4
|
class Whoami extends base_1.BaseCommand {
|
|
5
|
-
static description = 'Show the authenticated account, organization, token and permissions';
|
|
5
|
+
static description = 'Show the authenticated account, organization, token prefix and permissions';
|
|
6
6
|
static examples = ['<%= config.bin %> whoami', '<%= config.bin %> whoami --json'];
|
|
7
7
|
async run() {
|
|
8
8
|
const res = await this.api.get('/cli/v1/whoami');
|
|
9
|
-
|
|
9
|
+
// Rebuild from an allow-list. If a future backend accidentally includes a token secret or other
|
|
10
|
+
// authentication internals, `--json` must not proxy them to stdout.
|
|
11
|
+
const who = {
|
|
12
|
+
account: res.data.account && {
|
|
13
|
+
id: res.data.account.id,
|
|
14
|
+
name: res.data.account.name,
|
|
15
|
+
email: res.data.account.email,
|
|
16
|
+
},
|
|
17
|
+
organization: res.data.organization && {
|
|
18
|
+
id: res.data.organization.id,
|
|
19
|
+
name: res.data.organization.name,
|
|
20
|
+
slug: res.data.organization.slug,
|
|
21
|
+
},
|
|
22
|
+
token: res.data.token && {
|
|
23
|
+
id: res.data.token.id,
|
|
24
|
+
name: res.data.token.name,
|
|
25
|
+
prefix: res.data.token.prefix,
|
|
26
|
+
},
|
|
27
|
+
permissions: res.data.permissions,
|
|
28
|
+
};
|
|
10
29
|
if (!this.jsonEnabled()) {
|
|
11
30
|
this.log(`Account: ${who.account?.name ?? '-'} <${who.account?.email ?? '-'}>`);
|
|
12
31
|
this.log(`Organization: ${who.organization?.name ?? '-'} (${who.organization?.slug ?? '-'})`);
|