@bussolabs/closeyourit-cli 0.8.0 → 0.9.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/dist/commands/kb/create.d.ts +2 -0
- package/dist/commands/kb/create.js +13 -0
- package/dist/commands/kb/update.d.ts +2 -0
- package/dist/commands/kb/update.js +20 -4
- package/oclif.manifest.json +3689 -3659
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ export default class KbCreate extends BaseCommand {
|
|
|
7
7
|
kind: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
body: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
'body-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
'tech-spec': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'tech-spec-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
12
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
13
|
};
|
|
12
14
|
run(): Promise<unknown>;
|
|
@@ -9,6 +9,7 @@ class KbCreate extends base_1.BaseCommand {
|
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> kb create --project acme-api --title "Kamal rollback" --body "Steps…"',
|
|
11
11
|
'<%= config.bin %> kb create -p acme-api --title "ADR: queue backend" --kind decision --body-file ./adr.md',
|
|
12
|
+
'<%= config.bin %> kb create -p acme-api --title "Deploy" --body-file ./body.md --tech-spec-file ./tech.md',
|
|
12
13
|
];
|
|
13
14
|
static flags = {
|
|
14
15
|
// Required — passed straight to the server as `project` (key or UUID), resolved there.
|
|
@@ -17,6 +18,8 @@ class KbCreate extends base_1.BaseCommand {
|
|
|
17
18
|
kind: core_1.Flags.string({ description: 'Page kind: note|decision|guide', default: 'note' }),
|
|
18
19
|
body: core_1.Flags.string({ description: 'Page body (markdown)' }),
|
|
19
20
|
'body-file': core_1.Flags.string({ description: 'Read the body (markdown) from a local file' }),
|
|
21
|
+
'tech-spec': core_1.Flags.string({ description: 'Technical section, kept separate from the simple body' }),
|
|
22
|
+
'tech-spec-file': core_1.Flags.string({ description: 'Read the technical section from a local file' }),
|
|
20
23
|
};
|
|
21
24
|
async run() {
|
|
22
25
|
const { flags } = await this.parse(KbCreate);
|
|
@@ -32,11 +35,21 @@ class KbCreate extends base_1.BaseCommand {
|
|
|
32
35
|
if (body === undefined) {
|
|
33
36
|
this.error('Provide the page body via --body or --body-file.', { exit: 2 });
|
|
34
37
|
}
|
|
38
|
+
let techSpec = flags['tech-spec'];
|
|
39
|
+
if (techSpec === undefined && flags['tech-spec-file'] !== undefined) {
|
|
40
|
+
try {
|
|
41
|
+
techSpec = await (0, promises_1.readFile)(flags['tech-spec-file'], 'utf8');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
this.error(`File not found or unreadable: ${flags['tech-spec-file']}`, { exit: 2 });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
35
47
|
const res = await this.api.post('/cli/v1/knowledge/pages', {
|
|
36
48
|
project: flags.project,
|
|
37
49
|
title: flags.title,
|
|
38
50
|
kind: flags.kind,
|
|
39
51
|
body,
|
|
52
|
+
tech_spec: techSpec,
|
|
40
53
|
});
|
|
41
54
|
if (!this.jsonEnabled()) {
|
|
42
55
|
this.log('Knowledge page created:');
|
|
@@ -10,6 +10,8 @@ export default class KbUpdate extends BaseCommand {
|
|
|
10
10
|
kind: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
11
|
body: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
'body-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'tech-spec': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'tech-spec-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
15
|
};
|
|
14
16
|
run(): Promise<unknown>;
|
|
15
17
|
}
|
|
@@ -9,6 +9,7 @@ class KbUpdate extends base_1.BaseCommand {
|
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> kb update <page-id> --title "New title"',
|
|
11
11
|
'<%= config.bin %> kb update <page-id> --kind decision --body-file ./adr.md',
|
|
12
|
+
'<%= config.bin %> kb update <page-id> --tech-spec-file ./tech.md',
|
|
12
13
|
];
|
|
13
14
|
static args = {
|
|
14
15
|
id: core_1.Args.string({ description: 'Knowledge page id', required: true }),
|
|
@@ -18,6 +19,8 @@ class KbUpdate extends base_1.BaseCommand {
|
|
|
18
19
|
kind: core_1.Flags.string({ description: 'New kind: note|decision|guide' }),
|
|
19
20
|
body: core_1.Flags.string({ description: 'New body (markdown)' }),
|
|
20
21
|
'body-file': core_1.Flags.string({ description: 'Read the new body (markdown) from a local file' }),
|
|
22
|
+
'tech-spec': core_1.Flags.string({ description: 'New technical section, kept separate from the simple body' }),
|
|
23
|
+
'tech-spec-file': core_1.Flags.string({ description: 'Read the new technical section from a local file' }),
|
|
21
24
|
};
|
|
22
25
|
async run() {
|
|
23
26
|
const { args, flags } = await this.parse(KbUpdate);
|
|
@@ -30,11 +33,23 @@ class KbUpdate extends base_1.BaseCommand {
|
|
|
30
33
|
this.error(`File not found or unreadable: ${flags['body-file']}`, { exit: 2 });
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
let techSpec = flags['tech-spec'];
|
|
37
|
+
if (techSpec === undefined && flags['tech-spec-file'] !== undefined) {
|
|
38
|
+
try {
|
|
39
|
+
techSpec = await (0, promises_1.readFile)(flags['tech-spec-file'], 'utf8');
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
this.error(`File not found or unreadable: ${flags['tech-spec-file']}`, { exit: 2 });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (flags.title === undefined &&
|
|
46
|
+
flags.kind === undefined &&
|
|
47
|
+
body === undefined &&
|
|
48
|
+
techSpec === undefined) {
|
|
49
|
+
this.error('Provide at least one of --title, --kind, --body, --body-file, --tech-spec or --tech-spec-file.', { exit: 2 });
|
|
35
50
|
}
|
|
36
|
-
// The backend expects the full title/body/kind on update → read the current page and
|
|
37
|
-
// so a partial edit (e.g. only --
|
|
51
|
+
// The backend expects the full title/body/kind/tech_spec on update → read the current page and
|
|
52
|
+
// merge, so a partial edit (e.g. only --tech-spec) doesn't blank out the other fields.
|
|
38
53
|
const base = `/cli/v1/knowledge/pages/${encodeURIComponent(args.id)}`;
|
|
39
54
|
const current = await this.api.get(base);
|
|
40
55
|
const page = current.data ?? {};
|
|
@@ -42,6 +57,7 @@ class KbUpdate extends base_1.BaseCommand {
|
|
|
42
57
|
title: flags.title ?? page.title,
|
|
43
58
|
kind: flags.kind ?? page.kind,
|
|
44
59
|
body: body ?? page.body,
|
|
60
|
+
tech_spec: techSpec ?? page.tech_spec,
|
|
45
61
|
});
|
|
46
62
|
if (!this.jsonEnabled()) {
|
|
47
63
|
this.log('Knowledge page updated:');
|