@bussolabs/closeyourit-cli 0.0.27 → 0.2.0
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 +2 -0
- package/dist/commands/projects/github-connect.d.ts +10 -0
- package/dist/commands/projects/github-connect.js +28 -0
- package/dist/commands/projects/github-map.d.ts +9 -0
- package/dist/commands/projects/github-map.js +44 -0
- package/oclif.manifest.json +1232 -1143
- package/opencli.json +146 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,8 @@ 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. |
|
|
55
|
+
| `projects github-map [--connected-only]` | List every visible CloseYourIt project and its connected GitHub repository; automatically fetches all pages. |
|
|
54
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). |
|
|
55
57
|
| `groups list [--page]` | List groups (macro-projects) in your org. |
|
|
56
58
|
| `groups create <name> [--color] [--roadmap-enabled]` | Create a group (container of related projects, e.g. "DriverOne"). |
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ProjectsGithubMap extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'connected-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 ProjectsGithubMap extends base_1.BaseCommand {
|
|
7
|
+
static description = 'List the project → GitHub repository mapping for local automation';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> projects github-map',
|
|
10
|
+
'<%= config.bin %> projects github-map --connected-only',
|
|
11
|
+
'<%= config.bin %> projects github-map --connected-only --json',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
'connected-only': core_1.Flags.boolean({ description: 'Show only projects connected to a GitHub repository' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(ProjectsGithubMap);
|
|
18
|
+
const mappings = [];
|
|
19
|
+
let page = 1;
|
|
20
|
+
let totalPages = 1;
|
|
21
|
+
do {
|
|
22
|
+
const params = new URLSearchParams({ page: String(page), per: '100' });
|
|
23
|
+
if (flags['connected-only'])
|
|
24
|
+
params.set('connected_only', 'true');
|
|
25
|
+
// eslint-disable-next-line no-await-in-loop
|
|
26
|
+
const response = await this.api.get(`/cli/v1/projects/github-map?${params.toString()}`);
|
|
27
|
+
mappings.push(...(response.data ?? []));
|
|
28
|
+
totalPages = Number(response.meta?.total_pages ?? 1);
|
|
29
|
+
page += 1;
|
|
30
|
+
} while (page <= totalPages);
|
|
31
|
+
const result = { data: mappings, meta: { total: mappings.length } };
|
|
32
|
+
if (!this.jsonEnabled()) {
|
|
33
|
+
this.log((0, output_1.renderTable)(['KEY', 'PROJECT', 'REPOSITORY', 'BRANCH', 'CONNECTED'], mappings.map((mapping) => [
|
|
34
|
+
String(mapping.project_key ?? ''),
|
|
35
|
+
String(mapping.project_name ?? ''),
|
|
36
|
+
String(mapping.repository?.full_name ?? '-'),
|
|
37
|
+
String(mapping.repository?.default_branch ?? '-'),
|
|
38
|
+
mapping.repository ? 'yes' : 'no',
|
|
39
|
+
])));
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = ProjectsGithubMap;
|