@catladder/cli 0.0.0-new-cli-80ac360a → 0.0.0-new-cli-a65ec262
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 -2
- package/dist/bundles/catenv/index.js +4341 -27
- package/dist/bundles/cli/index.js +15981 -771
- package/dist/cli/src/apps/catenv/catenv.d.ts +1 -0
- package/dist/cli/src/apps/catenv/catenv.js +1 -1
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/apps/catenv/printVariables.js +0 -10
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/catenv.js +13 -16
- package/dist/cli/src/catenv.js.map +1 -1
- package/dist/cli/src/cli.js +24 -5
- package/dist/cli/src/cli.js.map +1 -1
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js +1 -1
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js.map +1 -1
- package/dist/cli/src/commands/fun/commandDadjoke.js +1 -1
- package/dist/cli/src/commands/fun/commandDadjoke.js.map +1 -1
- package/dist/cli/src/commands/fun/commandStarwars.js +1 -1
- package/dist/cli/src/commands/fun/commandStarwars.js.map +1 -1
- package/dist/cli/src/commands/general/commandKubeCurrentContext.js +1 -1
- package/dist/cli/src/commands/general/commandKubeGetShell.js +1 -1
- package/dist/cli/src/commands/general/commandKubeListNamespaces.js +1 -1
- package/dist/cli/src/commands/general/commandKubeListPods.js +1 -1
- package/dist/cli/src/commands/general/commandKubeListSecrets.js +1 -1
- package/dist/cli/src/commands/general/commandKubePortForward.js +1 -1
- package/dist/cli/src/commands/general/commandKubeStopPortforward.js +1 -1
- package/dist/cli/src/commands/index.d.ts +3 -0
- package/dist/cli/src/commands/index.js +23 -1
- package/dist/cli/src/commands/index.js.map +1 -1
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js +1 -1
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.js +1 -1
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.js +1 -1
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js +1 -1
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/commands/project/commandConfigSecrets.js +1 -1
- package/dist/cli/src/commands/project/commandDeletePods.js +1 -1
- package/dist/cli/src/commands/project/commandDeleteProject.js +1 -1
- package/dist/cli/src/commands/project/commandEnvVars.js +1 -1
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js +1 -1
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js.map +1 -1
- package/dist/cli/src/commands/project/commandGetShell.js +1 -1
- package/dist/cli/src/commands/project/commandGitlabCi.js +2 -2
- package/dist/cli/src/commands/project/commandListPods.js +1 -1
- package/dist/cli/src/commands/project/commandNamespace.js +1 -1
- package/dist/cli/src/commands/project/commandOpenEnv.js +1 -1
- package/dist/cli/src/commands/project/commandOpenGit.js +1 -1
- package/dist/cli/src/commands/project/commandOpenLogs.js +1 -1
- package/dist/cli/src/commands/project/commandPauseProject.js +1 -1
- package/dist/cli/src/commands/project/commandPortForward.js +1 -1
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js +1 -1
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js.map +1 -1
- package/dist/cli/src/commands/project/commandRenewToken.js +1 -1
- package/dist/cli/src/commands/project/commandSecretsClearBackups.js +1 -1
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js +2 -2
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js.map +1 -1
- package/dist/cli/src/commands/project/commandSetup.js +1 -1
- package/dist/cli/src/commands/project/commandTriggerCronjob.js +2 -2
- package/dist/cli/src/commands/project/commandTriggerCronjob.js.map +1 -1
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.d.ts +27 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js +83 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.d.ts +22 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js +60 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.d.ts +7 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js +35 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js.map +1 -0
- package/dist/cli/src/completion.js +49 -36
- package/dist/cli/src/completion.js.map +1 -1
- package/dist/cli/src/security/auditDocument.js.map +1 -0
- package/dist/cli/src/security/createSecurityAuditMergeRequest.js.map +1 -0
- package/dist/cli/src/security/evaluateSecurityAudit.js.map +1 -0
- package/dist/pipeline/src/build/types.d.ts +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
- package/dist/pipeline/src/deploy/types/index.d.ts +2 -2
- package/dist/pipeline/src/types/config.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/scripts/bundle +0 -2
- package/src/apps/catenv/catenv.ts +4 -2
- package/src/apps/catenv/printVariables.ts +0 -8
- package/src/catenv.ts +18 -19
- package/src/cli.ts +29 -5
- package/src/commands/cloudSQL/commandRestoreDb.ts +1 -1
- package/src/commands/fun/commandDadjoke.ts +1 -1
- package/src/commands/fun/commandStarwars.ts +1 -1
- package/src/commands/general/commandKubeCurrentContext.ts +1 -1
- package/src/commands/general/commandKubeGetShell.ts +1 -1
- package/src/commands/general/commandKubeListNamespaces.ts +1 -1
- package/src/commands/general/commandKubeListPods.ts +1 -1
- package/src/commands/general/commandKubeListSecrets.ts +1 -1
- package/src/commands/general/commandKubePortForward.ts +1 -1
- package/src/commands/general/commandKubeStopPortforward.ts +1 -1
- package/src/commands/index.ts +5 -0
- package/src/commands/mongodb/commandMongoDestroyMember.ts +1 -1
- package/src/commands/mongodb/commandMongoGetShell.ts +1 -1
- package/src/commands/mongodb/commandMongoPortForward.ts +1 -1
- package/src/commands/project/commandCloudSqlProxy.ts +1 -1
- package/src/commands/project/commandConfigSecrets.ts +1 -1
- package/src/commands/project/commandDeletePods.ts +1 -1
- package/src/commands/project/commandDeleteProject.ts +1 -1
- package/src/commands/project/commandEnvVars.ts +1 -1
- package/src/commands/project/commandGetMyTotalWorktime.ts +1 -1
- package/src/commands/project/commandGetShell.ts +1 -1
- package/src/commands/project/commandGitlabCi.ts +2 -2
- package/src/commands/project/commandListPods.ts +1 -1
- package/src/commands/project/commandNamespace.ts +1 -1
- package/src/commands/project/commandOpenEnv.ts +1 -1
- package/src/commands/project/commandOpenGit.ts +1 -1
- package/src/commands/project/commandOpenLogs.ts +1 -1
- package/src/commands/project/commandPauseProject.ts +1 -1
- package/src/commands/project/commandPortForward.ts +1 -1
- package/src/commands/project/commandProjectRestoreDb.ts +1 -1
- package/src/commands/project/commandRenewToken.ts +1 -1
- package/src/commands/project/commandSecretsClearBackups.ts +1 -1
- package/src/commands/project/commandSecurityEvaluate.ts +2 -2
- package/src/commands/project/commandSetup.ts +1 -1
- package/src/commands/project/commandTriggerCronjob.ts +2 -2
- package/src/commands/security/commandSecurityAuditCiJob.ts +91 -0
- package/src/commands/security/commandSecurityAuditCreate.ts +58 -0
- package/src/commands/security/commandSecurityAuditEvaluate.ts +30 -0
- package/src/completion.ts +53 -45
- package/bin/catci +0 -3
- package/bin/catci-dev +0 -3
- package/dist/bundles/catci/index.js +0 -71714
- package/dist/cli/src/apps/catci/catci.d.ts +0 -1
- package/dist/cli/src/apps/catci/catci.js +0 -33
- package/dist/cli/src/apps/catci/catci.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/auditDocument.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/commands.d.ts +0 -2
- package/dist/cli/src/apps/catci/commands/security/commands.js +0 -118
- package/dist/cli/src/apps/catci/commands/security/commands.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +0 -1
- package/dist/cli/src/catci.d.ts +0 -1
- package/dist/cli/src/catci.js +0 -7
- package/dist/cli/src/catci.js.map +0 -1
- package/src/apps/catci/catci.ts +0 -26
- package/src/apps/catci/commands/security/commands.ts +0 -161
- package/src/catci.ts +0 -3
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/topics.json +0 -0
- /package/src/{apps/catci/commands/security → security}/auditDocument.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/topics.json +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { Gitlab } from "@gitbeaker/rest";
|
|
3
|
+
import {
|
|
4
|
+
evaluateSecurityAudit,
|
|
5
|
+
makeSecurityAuditOverview,
|
|
6
|
+
} from "../../security/evaluateSecurityAudit";
|
|
7
|
+
import {
|
|
8
|
+
createSecurityAuditMergeRequest,
|
|
9
|
+
SECURITY_AUDIT_FILE_NAME,
|
|
10
|
+
} from "../../security/createSecurityAuditMergeRequest";
|
|
11
|
+
|
|
12
|
+
const GITLAB_HOST = "https://git.panter.ch";
|
|
13
|
+
|
|
14
|
+
export const commandSecurityAuditCiJob = defineCommand({
|
|
15
|
+
name: "security audit ci-job",
|
|
16
|
+
description:
|
|
17
|
+
"Evaluates security audit document. Creates MR with template if missing.",
|
|
18
|
+
group: "security",
|
|
19
|
+
inputs: {
|
|
20
|
+
path: { type: "string", message: "path to project root", positional: true },
|
|
21
|
+
token: {
|
|
22
|
+
type: "string",
|
|
23
|
+
message: "GitLab token (api scope)",
|
|
24
|
+
positional: true,
|
|
25
|
+
},
|
|
26
|
+
mainBranch: {
|
|
27
|
+
type: "string",
|
|
28
|
+
message: "main branch name",
|
|
29
|
+
positional: true,
|
|
30
|
+
},
|
|
31
|
+
projectId: {
|
|
32
|
+
type: "string",
|
|
33
|
+
message: "GitLab project ID",
|
|
34
|
+
positional: true,
|
|
35
|
+
},
|
|
36
|
+
userId: {
|
|
37
|
+
type: "string",
|
|
38
|
+
message: "GitLab user ID (assignee)",
|
|
39
|
+
positional: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
execute: async (ctx) => {
|
|
43
|
+
const path = await ctx.get("path");
|
|
44
|
+
const evaluation = await evaluateSecurityAudit({ path });
|
|
45
|
+
|
|
46
|
+
if (evaluation.isErr()) {
|
|
47
|
+
ctx.log("could not evaluate security audit document");
|
|
48
|
+
ctx.log("creating new merge request with security audit template...");
|
|
49
|
+
|
|
50
|
+
const token = await ctx.get("token");
|
|
51
|
+
const mainBranch = await ctx.get("mainBranch");
|
|
52
|
+
const projectId = await ctx.get("projectId");
|
|
53
|
+
const userId = await ctx.get("userId");
|
|
54
|
+
|
|
55
|
+
const api = new Gitlab({ host: GITLAB_HOST, token });
|
|
56
|
+
|
|
57
|
+
const mr = await createSecurityAuditMergeRequest({
|
|
58
|
+
api,
|
|
59
|
+
mainBranch,
|
|
60
|
+
projectId,
|
|
61
|
+
userId: parseInt(userId),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (mr.isErr()) {
|
|
65
|
+
ctx.log(
|
|
66
|
+
`could not create merge request with security audit template: ${mr.error}`,
|
|
67
|
+
);
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ctx.log("security audit merge request created successfully");
|
|
73
|
+
ctx.log(
|
|
74
|
+
`please finish the MR by updating SECURITY.md document: ${mr.value.web_url}`,
|
|
75
|
+
);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (evaluation.value.score.answeredTopics === 0) {
|
|
81
|
+
ctx.log("audit document has no answered topics");
|
|
82
|
+
ctx.log(
|
|
83
|
+
`please answer security topics in ${SECURITY_AUDIT_FILE_NAME} by adding responsible people and check/cross in the table`,
|
|
84
|
+
);
|
|
85
|
+
process.exitCode = 1;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
ctx.log(makeSecurityAuditOverview(evaluation.value));
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { Gitlab } from "@gitbeaker/rest";
|
|
3
|
+
import { createSecurityAuditMergeRequest } from "../../security/createSecurityAuditMergeRequest";
|
|
4
|
+
|
|
5
|
+
const GITLAB_HOST = "https://git.panter.ch";
|
|
6
|
+
|
|
7
|
+
export const commandSecurityAuditCreate = defineCommand({
|
|
8
|
+
name: "security audit create",
|
|
9
|
+
description: "Creates a MR with the latest security audit template document",
|
|
10
|
+
group: "security",
|
|
11
|
+
inputs: {
|
|
12
|
+
token: {
|
|
13
|
+
type: "string",
|
|
14
|
+
message: "GitLab token (api scope)",
|
|
15
|
+
positional: true,
|
|
16
|
+
},
|
|
17
|
+
mainBranch: {
|
|
18
|
+
type: "string",
|
|
19
|
+
message: "main branch name",
|
|
20
|
+
positional: true,
|
|
21
|
+
},
|
|
22
|
+
projectId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
message: "GitLab project ID",
|
|
25
|
+
positional: true,
|
|
26
|
+
},
|
|
27
|
+
userId: {
|
|
28
|
+
type: "string",
|
|
29
|
+
message: "GitLab user ID (assignee)",
|
|
30
|
+
positional: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
execute: async (ctx) => {
|
|
34
|
+
const token = await ctx.get("token");
|
|
35
|
+
const mainBranch = await ctx.get("mainBranch");
|
|
36
|
+
const projectId = await ctx.get("projectId");
|
|
37
|
+
const userId = await ctx.get("userId");
|
|
38
|
+
|
|
39
|
+
const api = new Gitlab({ host: GITLAB_HOST, token });
|
|
40
|
+
|
|
41
|
+
const result = await createSecurityAuditMergeRequest({
|
|
42
|
+
api,
|
|
43
|
+
mainBranch,
|
|
44
|
+
projectId,
|
|
45
|
+
userId: parseInt(userId),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (result.isErr()) {
|
|
49
|
+
ctx.log(`could not create security audit merge request: ${result.error}`);
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
} else {
|
|
52
|
+
ctx.log("security audit merge request created successfully");
|
|
53
|
+
ctx.log(
|
|
54
|
+
`please finish the MR by updating SECURITY.md document: ${result.value.web_url}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import {
|
|
3
|
+
evaluateSecurityAudit,
|
|
4
|
+
makeSecurityAuditOverview,
|
|
5
|
+
} from "../../security/evaluateSecurityAudit";
|
|
6
|
+
import { SECURITY_AUDIT_FILE_NAME } from "../../security/createSecurityAuditMergeRequest";
|
|
7
|
+
|
|
8
|
+
export const commandSecurityAuditEvaluate = defineCommand({
|
|
9
|
+
name: "security audit evaluate",
|
|
10
|
+
description: "Evaluates security audit document in given path",
|
|
11
|
+
group: "security",
|
|
12
|
+
inputs: {
|
|
13
|
+
path: { type: "string", message: "path to project root", positional: true },
|
|
14
|
+
},
|
|
15
|
+
execute: async (ctx) => {
|
|
16
|
+
const path = await ctx.get("path");
|
|
17
|
+
ctx.log("evaluating security audit document...");
|
|
18
|
+
|
|
19
|
+
const result = await evaluateSecurityAudit({ path });
|
|
20
|
+
if (result.isErr()) {
|
|
21
|
+
ctx.log(`${result.error}`);
|
|
22
|
+
ctx.log(
|
|
23
|
+
`please make sure the security audit document ${SECURITY_AUDIT_FILE_NAME} is in the repository`,
|
|
24
|
+
);
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
} else {
|
|
27
|
+
ctx.log(makeSecurityAuditOverview(result.value));
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
});
|
package/src/completion.ts
CHANGED
|
@@ -16,60 +16,68 @@ export async function getCompletions(
|
|
|
16
16
|
words: string[],
|
|
17
17
|
cursorWord: string,
|
|
18
18
|
): Promise<string[]> {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
19
|
+
// Try to match words against command names (which can be multi-word)
|
|
20
|
+
// Walk through words, consuming them as command name parts until we find
|
|
21
|
+
// an exact command match or need to suggest the next subcommand level.
|
|
22
|
+
|
|
23
|
+
// Find all commands whose name starts with the words typed so far
|
|
24
|
+
const typed = words.join(" ");
|
|
25
|
+
|
|
26
|
+
// Exact match: we've typed a full command name, now complete its inputs
|
|
27
|
+
const exactCommand = allCommands.find((c) => c.name === typed);
|
|
28
|
+
if (exactCommand) {
|
|
29
|
+
// Check if cursor is a --flag
|
|
30
|
+
if (cursorWord.startsWith("--")) {
|
|
31
|
+
return getFlagCompletions(exactCommand, cursorWord);
|
|
32
|
+
}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
// Check if previous word was a --flag (complete its value)
|
|
35
|
+
const prevWord = words[words.length - 1];
|
|
36
|
+
if (prevWord?.startsWith("--")) {
|
|
37
|
+
const flagName = prevWord.replace(/^--/, "");
|
|
38
|
+
const inputName = flagNameToInputName(flagName);
|
|
39
|
+
const inputDef = exactCommand.inputs[inputName];
|
|
40
|
+
if (inputDef && "choices" in inputDef && inputDef.choices) {
|
|
41
|
+
return resolveChoicesForCompletion(inputDef, cursorWord);
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
// Complete positional inputs
|
|
47
|
+
const positionalInputs = getPositionalInputs(exactCommand);
|
|
48
|
+
// Count non-flag args after the command name
|
|
49
|
+
const argsAfterCommand = words.slice(exactCommand.name.split(" ").length);
|
|
50
|
+
const positionalArgs = argsAfterCommand.filter((w) => !w.startsWith("--"));
|
|
51
|
+
const positionalIndex = positionalArgs.length;
|
|
52
|
+
const targetInput = positionalInputs[positionalIndex];
|
|
53
|
+
|
|
54
|
+
if (targetInput) {
|
|
55
|
+
const [, inputDef] = targetInput;
|
|
56
|
+
if ("choices" in inputDef && inputDef.choices) {
|
|
57
|
+
return resolveChoicesForCompletion(inputDef, cursorWord);
|
|
58
|
+
}
|
|
48
59
|
}
|
|
49
60
|
return [];
|
|
50
61
|
}
|
|
51
62
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const [, inputDef] = targetInput;
|
|
67
|
-
if ("choices" in inputDef && inputDef.choices) {
|
|
68
|
-
return resolveChoicesForCompletion(inputDef, cursorWord);
|
|
63
|
+
// No exact match. Complete the next level of subcommand names.
|
|
64
|
+
// The prefix is what's been typed so far (words joined with space).
|
|
65
|
+
const prefix = typed ? typed + " " : "";
|
|
66
|
+
|
|
67
|
+
// Find unique next-level subcommand names
|
|
68
|
+
const nextParts = new Set<string>();
|
|
69
|
+
for (const cmd of allCommands) {
|
|
70
|
+
if (cmd.name.startsWith(prefix)) {
|
|
71
|
+
// Get the next word after the prefix
|
|
72
|
+
const rest = cmd.name.slice(prefix.length);
|
|
73
|
+
const nextPart = rest.split(" ")[0];
|
|
74
|
+
if (nextPart && nextPart.startsWith(cursorWord)) {
|
|
75
|
+
nextParts.add(nextPart);
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
return [];
|
|
80
|
+
return [...nextParts].sort();
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
function getPositionalInputs(command: CommandDef): [string, InputDef][] {
|
package/bin/catci
DELETED
package/bin/catci-dev
DELETED