atlasctl 0.1.1 → 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/package.json +2 -1
- package/src/cli.ts +81 -8
- package/src/llm-help.ts +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atlasctl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Atlassian CLI for Confluence page exports with comments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.3.8",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"test": "bun test"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@modeltoolsprotocol/sdk": "0.2.0",
|
|
24
25
|
"commander": "^14.0.3"
|
|
25
26
|
}
|
|
26
27
|
}
|
package/src/cli.ts
CHANGED
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
writeConfig,
|
|
14
14
|
} from "./config";
|
|
15
15
|
import { fetchConfluencePage } from "./confluence";
|
|
16
|
-
import {
|
|
16
|
+
import { withDescribe, type DescribeOptions } from "@modeltoolsprotocol/sdk";
|
|
17
17
|
|
|
18
|
-
const VERSION = "0.
|
|
18
|
+
const VERSION = "0.2.0";
|
|
19
19
|
|
|
20
20
|
function parseConfigKey(value: string): ConfigKey {
|
|
21
21
|
if (!CONFIG_KEYS.includes(value as ConfigKey)) {
|
|
@@ -144,6 +144,83 @@ async function handleConfigSetCommand(key?: string, value?: string): Promise<voi
|
|
|
144
144
|
await handleConfigSet(parseConfigKey(key), value);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
export const DESCRIBE_OPTIONS: DescribeOptions = {
|
|
148
|
+
commands: {
|
|
149
|
+
"config set": {
|
|
150
|
+
examples: [
|
|
151
|
+
{ description: "Interactive guided setup", command: "atlasctl config set" },
|
|
152
|
+
{ description: "Set site", command: "atlasctl config set site your-domain.atlassian.net" },
|
|
153
|
+
{ description: "Set API key", command: "atlasctl config set apikey your-token" },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
"config get": {
|
|
157
|
+
stdout: {
|
|
158
|
+
contentType: "text/plain",
|
|
159
|
+
description: "The config value. apikey always prints ***hidden***.",
|
|
160
|
+
},
|
|
161
|
+
examples: [
|
|
162
|
+
{ description: "Read configured site", command: "atlasctl config get site", output: "your-domain.atlassian.net" },
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
"config show": {
|
|
166
|
+
stdout: {
|
|
167
|
+
contentType: "application/json",
|
|
168
|
+
description: "All config keys with apikey masked",
|
|
169
|
+
},
|
|
170
|
+
examples: [
|
|
171
|
+
{ description: "Display current config", command: "atlasctl config show" },
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
"confluence page get": {
|
|
175
|
+
argTypes: { output: "path" },
|
|
176
|
+
stdout: {
|
|
177
|
+
contentType: "application/json",
|
|
178
|
+
description: "Page metadata, recursive comment tree, and fetch metadata",
|
|
179
|
+
schema: {
|
|
180
|
+
type: "object",
|
|
181
|
+
required: ["page", "comments", "meta"],
|
|
182
|
+
properties: {
|
|
183
|
+
page: {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
id: { type: "string" },
|
|
187
|
+
title: { type: "string" },
|
|
188
|
+
space: { type: "string" },
|
|
189
|
+
url: { type: "string" },
|
|
190
|
+
bodyHtml: { type: "string" },
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
comments: {
|
|
194
|
+
type: "array",
|
|
195
|
+
items: {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
id: { type: "string" },
|
|
199
|
+
author: { type: "string" },
|
|
200
|
+
bodyHtml: { type: "string" },
|
|
201
|
+
inlineContext: { type: "object" },
|
|
202
|
+
children: { type: "array" },
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
meta: {
|
|
207
|
+
type: "object",
|
|
208
|
+
properties: {
|
|
209
|
+
fetchedAt: { type: "string" },
|
|
210
|
+
totalComments: { type: "integer" },
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
examples: [
|
|
217
|
+
{ description: "Fetch a page by ID", command: "atlasctl confluence page get 12345 --pretty" },
|
|
218
|
+
{ description: "Fetch by URL, save to file", command: "atlasctl confluence page get https://your-domain.atlassian.net/wiki/spaces/ENG/pages/12345 --output page.json" },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
|
|
147
224
|
export function buildProgram(): Command {
|
|
148
225
|
const program = new Command();
|
|
149
226
|
|
|
@@ -151,9 +228,10 @@ export function buildProgram(): Command {
|
|
|
151
228
|
.name("atlasctl")
|
|
152
229
|
.description("Atlassian CLI for Confluence page exports")
|
|
153
230
|
.version(VERSION)
|
|
154
|
-
.option("--help-llm", "print concise LLM-focused usage guidance")
|
|
155
231
|
.showHelpAfterError();
|
|
156
232
|
|
|
233
|
+
withDescribe(program, DESCRIBE_OPTIONS);
|
|
234
|
+
|
|
157
235
|
const configCommand = program.command("config").description("Manage local CLI configuration");
|
|
158
236
|
|
|
159
237
|
configCommand
|
|
@@ -197,11 +275,6 @@ export function buildProgram(): Command {
|
|
|
197
275
|
}
|
|
198
276
|
|
|
199
277
|
export async function run(argv = process.argv): Promise<void> {
|
|
200
|
-
if (argv.includes("--help-llm")) {
|
|
201
|
-
process.stdout.write(`${getLlmHelpText()}\n`);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
278
|
const program = buildProgram();
|
|
206
279
|
await program.parseAsync(argv);
|
|
207
280
|
}
|
package/src/llm-help.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export function getLlmHelpText(): string {
|
|
2
|
-
return `atlasctl (LLM Quick Guide)
|
|
3
|
-
|
|
4
|
-
Purpose
|
|
5
|
-
- Get a Confluence page plus full comment tree (including inline comments) as JSON.
|
|
6
|
-
|
|
7
|
-
Required config
|
|
8
|
-
- File: ~/.atlasctl.json
|
|
9
|
-
- Keys: site, email, apikey
|
|
10
|
-
|
|
11
|
-
Fast path
|
|
12
|
-
- atlasctl config set
|
|
13
|
-
- atlasctl confluence page get <page-id-or-url> --pretty
|
|
14
|
-
|
|
15
|
-
Non-interactive setup
|
|
16
|
-
- atlasctl config set site <your-domain.atlassian.net>
|
|
17
|
-
- atlasctl config set email <you@example.com>
|
|
18
|
-
- atlasctl config set apikey <token>
|
|
19
|
-
|
|
20
|
-
Read config
|
|
21
|
-
- atlasctl config show
|
|
22
|
-
- atlasctl config get site
|
|
23
|
-
- atlasctl config get email
|
|
24
|
-
- atlasctl config get apikey (always prints ***hidden***)
|
|
25
|
-
|
|
26
|
-
Fetch
|
|
27
|
-
- atlasctl confluence page get <id-or-url> [--output <file>] [--pretty]
|
|
28
|
-
|
|
29
|
-
Input rules
|
|
30
|
-
- id-or-url can be numeric page ID, /pages/<id>/ URL, or ?pageId=<id> URL.
|
|
31
|
-
- URL host must match configured site.
|
|
32
|
-
|
|
33
|
-
Output
|
|
34
|
-
- page, comments (recursive), meta.
|
|
35
|
-
- inline comments map to comment.inlineContext: textSelection, markerRef, resolved.
|
|
36
|
-
|
|
37
|
-
Common failures
|
|
38
|
-
- Missing config keys: set site/email/apikey.
|
|
39
|
-
- Invalid URL or no page ID in URL.
|
|
40
|
-
- URL host mismatch with configured site.
|
|
41
|
-
- Guided config in non-TTY: use explicit config set key/value commands.`;
|
|
42
|
-
}
|