@salesforce/plugin-command-reference 3.1.107 → 3.1.108
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 +7 -4
- package/lib/commands/commandreference/generate.d.ts +1 -0
- package/lib/commands/commandreference/generate.js +10 -3
- package/lib/commands/commandreference/generate.js.map +1 -1
- package/lib/ditamap/command-helpers.d.ts +25 -0
- package/lib/ditamap/command-helpers.js +59 -0
- package/lib/ditamap/command-helpers.js.map +1 -0
- package/lib/ditamap/command.d.ts +1 -14
- package/lib/ditamap/command.js +2 -44
- package/lib/ditamap/command.js.map +1 -1
- package/lib/docs.d.ts +3 -1
- package/lib/docs.js +29 -27
- package/lib/docs.js.map +1 -1
- package/lib/generator-factory.d.ts +46 -0
- package/lib/generator-factory.js +89 -0
- package/lib/generator-factory.js.map +1 -0
- package/lib/markdown/cli-reference.d.ts +10 -0
- package/lib/markdown/cli-reference.js +50 -0
- package/lib/markdown/cli-reference.js.map +1 -0
- package/lib/markdown/command.d.ts +17 -0
- package/lib/markdown/command.js +257 -0
- package/lib/markdown/command.js.map +1 -0
- package/lib/markdown/index.d.ts +7 -0
- package/lib/markdown/index.js +23 -0
- package/lib/markdown/index.js.map +1 -0
- package/lib/markdown/markdown-base.d.ts +10 -0
- package/lib/markdown/markdown-base.js +39 -0
- package/lib/markdown/markdown-base.js.map +1 -0
- package/lib/markdown/root-index.d.ts +6 -0
- package/lib/markdown/root-index.js +37 -0
- package/lib/markdown/root-index.js.map +1 -0
- package/lib/markdown/toc.d.ts +8 -0
- package/lib/markdown/toc.js +68 -0
- package/lib/markdown/toc.js.map +1 -0
- package/lib/markdown/topic-commands.d.ts +8 -0
- package/lib/markdown/topic-commands.js +40 -0
- package/lib/markdown/topic-commands.js.map +1 -0
- package/lib/markdown/topic-index.d.ts +9 -0
- package/lib/markdown/topic-index.js +80 -0
- package/lib/markdown/topic-index.js.map +1 -0
- package/lib/utils.d.ts +1 -1
- package/messages/main.md +5 -1
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +14 -2
- package/package.json +14 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { BaseDitamap } from './ditamap/base-ditamap.js';
|
|
17
|
+
import { CLIReference } from './ditamap/cli-reference.js';
|
|
18
|
+
import { Command as DitaCommand } from './ditamap/command.js';
|
|
19
|
+
import { Ditamap } from './ditamap/ditamap.js';
|
|
20
|
+
import { HelpReference } from './ditamap/help-reference.js';
|
|
21
|
+
import { TopicCommands } from './ditamap/topic-commands.js';
|
|
22
|
+
import { TopicDitamap } from './ditamap/topic-ditamap.js';
|
|
23
|
+
import { MarkdownCliReference } from './markdown/cli-reference.js';
|
|
24
|
+
import { MarkdownCommand } from './markdown/command.js';
|
|
25
|
+
import { MarkdownTopicIndex } from './markdown/topic-index.js';
|
|
26
|
+
import { MarkdownToc } from './markdown/toc.js';
|
|
27
|
+
export class DitaGeneratorFactory {
|
|
28
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
29
|
+
createCliReference(_topics) {
|
|
30
|
+
return new CLIReference();
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line class-methods-use-this
|
|
33
|
+
createHelpReference() {
|
|
34
|
+
return new HelpReference();
|
|
35
|
+
}
|
|
36
|
+
// eslint-disable-next-line class-methods-use-this
|
|
37
|
+
createRootIndex(topics) {
|
|
38
|
+
return new BaseDitamap(topics);
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
41
|
+
createToc(_topicEntries) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
// eslint-disable-next-line class-methods-use-this
|
|
45
|
+
createTopicCommands(topic, topicMeta) {
|
|
46
|
+
return new TopicCommands(topic, topicMeta);
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
49
|
+
createTopicIndex(topic, commands, _topicMeta) {
|
|
50
|
+
const commandIds = commands.map((cmd) => cmd.id);
|
|
51
|
+
return new TopicDitamap(topic, commandIds);
|
|
52
|
+
}
|
|
53
|
+
// eslint-disable-next-line class-methods-use-this
|
|
54
|
+
createCommand(topic, subtopic, command, commandMeta) {
|
|
55
|
+
return new DitaCommand(topic, subtopic, command, commandMeta);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class MarkdownGeneratorFactory {
|
|
59
|
+
outputDir;
|
|
60
|
+
constructor(outputDir) {
|
|
61
|
+
this.outputDir = outputDir;
|
|
62
|
+
}
|
|
63
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
64
|
+
createCliReference(_topics) {
|
|
65
|
+
return new MarkdownCliReference(Ditamap.cliVersion, Ditamap.pluginVersions, this.outputDir);
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line class-methods-use-this
|
|
68
|
+
createHelpReference() {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
72
|
+
createRootIndex(_topics) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
createToc(topicEntries) {
|
|
76
|
+
return new MarkdownToc(topicEntries, this.outputDir);
|
|
77
|
+
}
|
|
78
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
79
|
+
createTopicCommands(_topic, _topicMeta) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
createTopicIndex(topic, commands, topicMeta) {
|
|
83
|
+
return new MarkdownTopicIndex(topic, commands, topicMeta, this.outputDir);
|
|
84
|
+
}
|
|
85
|
+
createCommand(topic, subtopic, command, commandMeta) {
|
|
86
|
+
return new MarkdownCommand(topic, subtopic, command, commandMeta, this.outputDir);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=generator-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-factory.js","sourceRoot":"","sources":["../src/generator-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4BhD,MAAM,OAAO,oBAAoB;IAC/B,qFAAqF;IAC9E,kBAAkB,CAAC,OAAiB;QACzC,OAAO,IAAI,YAAY,EAAE,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AC;IAEM,SAAS,CAAC,YAA6B;QAC5C,OAAO,IAAI,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,qFAAqF;IAC9E,mBAAmB,CAAC,MAAc,EAAE,UAAmB;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,gBAAgB,CAAC,KAAa,EAAE,QAAwB,EAAE,SAAkB;QACjF,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IAEM,aAAa,CAClB,KAAa,EACb,QAAuB,EACvB,OAAqB,EACrB,WAAoC;QAEpC,OAAO,IAAI,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
2
|
+
export declare class MarkdownCliReference extends MarkdownBase {
|
|
3
|
+
private cliVersion;
|
|
4
|
+
private pluginVersions;
|
|
5
|
+
constructor(cliVersion: string, pluginVersions: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}>, outputDir: string);
|
|
9
|
+
protected generate(): Promise<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
17
|
+
export class MarkdownCliReference extends MarkdownBase {
|
|
18
|
+
cliVersion;
|
|
19
|
+
pluginVersions;
|
|
20
|
+
constructor(cliVersion, pluginVersions, outputDir) {
|
|
21
|
+
super(MarkdownBase.file('cli_reference'), outputDir);
|
|
22
|
+
this.cliVersion = cliVersion;
|
|
23
|
+
this.pluginVersions = pluginVersions;
|
|
24
|
+
}
|
|
25
|
+
generate() {
|
|
26
|
+
const lines = [];
|
|
27
|
+
lines.push('<!-- prettier-ignore-start -->');
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push('# Salesforce CLI Command Reference');
|
|
30
|
+
lines.push('');
|
|
31
|
+
lines.push('This command reference contains information about the Salesforce CLI commands and their flags. Use these commands to build Agentforce agents, manage Salesforce DX projects, create and manage scratch orgs and sandboxes, synchronize source to and from orgs, create and install packages, and more.');
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push(`Salesforce CLI version: \`${this.cliVersion}\``);
|
|
34
|
+
lines.push('');
|
|
35
|
+
if (this.pluginVersions.length > 0) {
|
|
36
|
+
lines.push('## Plugin Versions');
|
|
37
|
+
lines.push('');
|
|
38
|
+
lines.push('| Plugin | Version |');
|
|
39
|
+
lines.push('|--------|---------|');
|
|
40
|
+
for (const { name, version } of this.pluginVersions) {
|
|
41
|
+
lines.push(`| \`${name}\` | \`${version}\` |`);
|
|
42
|
+
}
|
|
43
|
+
lines.push('');
|
|
44
|
+
}
|
|
45
|
+
lines.push('<!-- prettier-ignore-end -->');
|
|
46
|
+
lines.push('');
|
|
47
|
+
return Promise.resolve(lines.join('\n'));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=cli-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AAC,OAAO,IAAI,UAAU,OAAO,MAAM,CAAC,CAAC;YACjD,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandClass } from '../utils.js';
|
|
2
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
3
|
+
export declare class MarkdownCommand extends MarkdownBase {
|
|
4
|
+
private flags;
|
|
5
|
+
private commandMeta;
|
|
6
|
+
private binary;
|
|
7
|
+
private commandName;
|
|
8
|
+
private summary;
|
|
9
|
+
private help;
|
|
10
|
+
private examples;
|
|
11
|
+
private state;
|
|
12
|
+
private deprecated;
|
|
13
|
+
private deprecationDetails;
|
|
14
|
+
private aliases;
|
|
15
|
+
constructor(topic: string, subtopic: string | null, command: CommandClass, commandMeta: Record<string, unknown> | undefined, outputDir: string);
|
|
16
|
+
protected generate(): Promise<string>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { asString, ensureObject, ensureString } from '@salesforce/ts-types';
|
|
18
|
+
import { punctuate, replaceConfigVariables } from '../utils.js';
|
|
19
|
+
import { buildCommandParameters, formatParagraphs, readBinary } from '../ditamap/command-helpers.js';
|
|
20
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
21
|
+
export class MarkdownCommand extends MarkdownBase {
|
|
22
|
+
flags;
|
|
23
|
+
commandMeta;
|
|
24
|
+
binary;
|
|
25
|
+
commandName;
|
|
26
|
+
summary;
|
|
27
|
+
help;
|
|
28
|
+
examples;
|
|
29
|
+
state;
|
|
30
|
+
deprecated;
|
|
31
|
+
deprecationDetails;
|
|
32
|
+
aliases;
|
|
33
|
+
constructor(topic, subtopic, command, commandMeta = {}, outputDir) {
|
|
34
|
+
const commandWithUnderscores = ensureString(command.id).replace(/:/g, '_');
|
|
35
|
+
// If the command ID has no subtopic (e.g. "doctor"), its filename would collide with the topic
|
|
36
|
+
// index file (cli_reference_doctor.md), so append _command to disambiguate.
|
|
37
|
+
const isTopicLevelCommand = !ensureString(command.id).includes(':');
|
|
38
|
+
const baseName = isTopicLevelCommand
|
|
39
|
+
? `cli_reference_${commandWithUnderscores}_command`
|
|
40
|
+
: `cli_reference_${commandWithUnderscores}`;
|
|
41
|
+
const filename = MarkdownBase.file(baseName);
|
|
42
|
+
super(filename, outputDir);
|
|
43
|
+
this.destination = join(outputDir, topic, filename);
|
|
44
|
+
this.flags = ensureObject(command.flags);
|
|
45
|
+
this.commandMeta = commandMeta;
|
|
46
|
+
this.binary = readBinary(this.commandMeta);
|
|
47
|
+
this.summary = punctuate(command.summary);
|
|
48
|
+
// commandName is the bare command ID with colons replaced by the topic separator (e.g. "agent activate")
|
|
49
|
+
this.commandName = command.id.replace(/:/g, asString(this.commandMeta.topicSeparator, ' '));
|
|
50
|
+
const description = command.description
|
|
51
|
+
? replaceConfigVariables(command.description, this.binary, this.commandName)
|
|
52
|
+
: undefined;
|
|
53
|
+
this.help = formatParagraphs(description);
|
|
54
|
+
this.examples = (command.examples ?? []).map((example) => {
|
|
55
|
+
let desc;
|
|
56
|
+
let commands;
|
|
57
|
+
if (typeof example === 'string') {
|
|
58
|
+
const parts = example.split('\n');
|
|
59
|
+
desc = parts.length > 1 ? parts[0] : null;
|
|
60
|
+
commands = parts.length > 1 ? parts.slice(1) : [parts[0]];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
desc = example.description;
|
|
64
|
+
commands = [example.command];
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
description: replaceConfigVariables(desc ?? '', this.binary, this.commandName),
|
|
68
|
+
commands: commands.map((cmd) => replaceConfigVariables(cmd, this.binary, this.commandName)),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
this.state = command.state ?? this.commandMeta.state;
|
|
72
|
+
this.deprecated = Boolean(command.deprecated) || this.state === 'deprecated';
|
|
73
|
+
const dep = command.deprecated;
|
|
74
|
+
this.deprecationDetails = dep && typeof dep === 'object' ? dep : null;
|
|
75
|
+
this.aliases = command.aliases ?? [];
|
|
76
|
+
}
|
|
77
|
+
async generate() {
|
|
78
|
+
const parameters = await buildCommandParameters(this.commandName, this.binary, this.flags);
|
|
79
|
+
const lines = [];
|
|
80
|
+
lines.push('<!-- prettier-ignore-start -->');
|
|
81
|
+
lines.push('');
|
|
82
|
+
const stateLabel = resolveStateLabel(this.state, this.deprecated);
|
|
83
|
+
lines.push(`# ${this.commandName}${stateLabel ? ` (${stateLabel})` : ''}`);
|
|
84
|
+
lines.push('');
|
|
85
|
+
if (this.summary) {
|
|
86
|
+
lines.push(this.summary);
|
|
87
|
+
lines.push('');
|
|
88
|
+
}
|
|
89
|
+
const disclaimer = resolveDisclaimer(this.commandName, this.state, this.deprecated, this.deprecationDetails);
|
|
90
|
+
if (disclaimer) {
|
|
91
|
+
lines.push(':::note');
|
|
92
|
+
lines.push(disclaimer);
|
|
93
|
+
lines.push(':::');
|
|
94
|
+
lines.push('');
|
|
95
|
+
}
|
|
96
|
+
if (this.help.length > 0) {
|
|
97
|
+
lines.push(`## Description for ${this.commandName}`);
|
|
98
|
+
lines.push('');
|
|
99
|
+
for (const paragraph of convertBulletListsToHtml(this.help.map((p) => escapeForMarkdown(p)))) {
|
|
100
|
+
lines.push(paragraph);
|
|
101
|
+
lines.push('');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (this.aliases.length > 0) {
|
|
105
|
+
lines.push(`## Aliases for ${this.commandName}`);
|
|
106
|
+
lines.push('');
|
|
107
|
+
for (const alias of this.aliases) {
|
|
108
|
+
lines.push(`\`${alias}\``);
|
|
109
|
+
lines.push('');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (parameters.length > 0) {
|
|
113
|
+
lines.push('## Flags');
|
|
114
|
+
lines.push('');
|
|
115
|
+
lines.push('| Flag Name (Long) | Flag Name (Short) | Description |');
|
|
116
|
+
lines.push('|------------------|-------------------|-------------|');
|
|
117
|
+
// Sort parameters alphabetically by flag name
|
|
118
|
+
const sortedParams = [...parameters].sort((a, b) => a.name.localeCompare(b.name));
|
|
119
|
+
for (const param of sortedParams) {
|
|
120
|
+
lines.push(renderFlagRow(param));
|
|
121
|
+
}
|
|
122
|
+
lines.push('');
|
|
123
|
+
}
|
|
124
|
+
if (this.examples.length > 0) {
|
|
125
|
+
lines.push(`## Examples for ${this.commandName}`);
|
|
126
|
+
lines.push('');
|
|
127
|
+
for (const example of this.examples) {
|
|
128
|
+
if (example.description) {
|
|
129
|
+
lines.push(example.description);
|
|
130
|
+
lines.push('');
|
|
131
|
+
}
|
|
132
|
+
for (const cmd of example.commands) {
|
|
133
|
+
lines.push('```shell');
|
|
134
|
+
lines.push(cmd.trim().replace(/^\$\s*/, ''));
|
|
135
|
+
lines.push('```');
|
|
136
|
+
lines.push('');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Remove the trailing empty line after the last example
|
|
140
|
+
if (lines[lines.length - 1] === '') {
|
|
141
|
+
lines.pop();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
lines.push('<!-- prettier-ignore-end -->');
|
|
145
|
+
lines.push('');
|
|
146
|
+
return lines.join('\n');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function escapeForMarkdown(text) {
|
|
150
|
+
// Escape HTML entities for markdown safety
|
|
151
|
+
let result = text.replace(/</g, '<').replace(/>/g, '>');
|
|
152
|
+
// Normalize whitespace: collapse multiple spaces/tabs/newlines to single space
|
|
153
|
+
result = result.replace(/\s+/g, ' ');
|
|
154
|
+
// Trim leading/trailing whitespace
|
|
155
|
+
result = result.trim();
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Converts bullet list paragraphs to HTML <ul>/<li> tags for compact rendering in markdown.
|
|
160
|
+
* Strips leading whitespace from bullets to prevent code block rendering.
|
|
161
|
+
*
|
|
162
|
+
* @param paragraphs - Array of paragraph strings, some may be bullet items
|
|
163
|
+
* @returns Array where consecutive bullets are converted to a single HTML <ul> string
|
|
164
|
+
*/
|
|
165
|
+
function convertBulletListsToHtml(paragraphs) {
|
|
166
|
+
const result = [];
|
|
167
|
+
let i = 0;
|
|
168
|
+
while (i < paragraphs.length) {
|
|
169
|
+
const trimmed = paragraphs[i].trimStart();
|
|
170
|
+
if (trimmed.startsWith('- ') || trimmed.startsWith('* ')) {
|
|
171
|
+
// Collect consecutive list items and render as HTML bullet list
|
|
172
|
+
const items = [];
|
|
173
|
+
while (i < paragraphs.length) {
|
|
174
|
+
const itemTrimmed = paragraphs[i].trimStart();
|
|
175
|
+
if (itemTrimmed.startsWith('- ') || itemTrimmed.startsWith('* ')) {
|
|
176
|
+
// Remove the bullet marker (- or *) and wrap in <li>
|
|
177
|
+
items.push(`<li>${itemTrimmed.substring(2)}</li>`);
|
|
178
|
+
i++;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Wrap all items in <ul> tags
|
|
185
|
+
result.push(`<ul>${items.join('')}</ul>`);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
result.push(paragraphs[i]);
|
|
189
|
+
i++;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function resolveStateLabel(state, deprecated) {
|
|
195
|
+
if (deprecated)
|
|
196
|
+
return 'Deprecated';
|
|
197
|
+
if (state === 'beta')
|
|
198
|
+
return 'Beta';
|
|
199
|
+
if (state === 'preview')
|
|
200
|
+
return 'Developer Preview';
|
|
201
|
+
if (state === 'closedPilot' || state === 'openPilot')
|
|
202
|
+
return 'Pilot';
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
function resolveDisclaimer(commandName, state, deprecated, deprecationDetails) {
|
|
206
|
+
if (deprecated) {
|
|
207
|
+
const versionNote = deprecationDetails?.version
|
|
208
|
+
? ` and will be removed in v${deprecationDetails.version} or later`
|
|
209
|
+
: '';
|
|
210
|
+
const toNote = deprecationDetails?.to ? ` Use \`${deprecationDetails.to}\` instead.` : '';
|
|
211
|
+
return `The command \`${commandName}\` has been deprecated${versionNote}.${toNote}`;
|
|
212
|
+
}
|
|
213
|
+
if (state === 'closedPilot') {
|
|
214
|
+
// prettier-ignore
|
|
215
|
+
return `We provide the \`${commandName}\` command to selected customers through an invitation-only pilot program that requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can\x27t guarantee acceptance. The \`${commandName}\` command isn\x27t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can\x27t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.`;
|
|
216
|
+
}
|
|
217
|
+
if (state === 'openPilot') {
|
|
218
|
+
// prettier-ignore
|
|
219
|
+
return `We provide the \`${commandName}\` command to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can\x27t guarantee acceptance. The \`${commandName}\` command isn\x27t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can\x27t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.`;
|
|
220
|
+
}
|
|
221
|
+
if (state === 'beta') {
|
|
222
|
+
return 'This feature is a Beta Service. Customers may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at [Agreements and Terms](https://www.salesforce.com/company/legal/agreements/).';
|
|
223
|
+
}
|
|
224
|
+
if (state === 'preview') {
|
|
225
|
+
// prettier-ignore
|
|
226
|
+
return 'This command is available as a developer preview. The command isn\'t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don\'t implement functionality developed with these commands or tools.';
|
|
227
|
+
}
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
function renderFlagRow(param) {
|
|
231
|
+
const longFlag = `<code>‑‑${param.name.replace(/-/g, '‑')}</code>`;
|
|
232
|
+
const shortFlag = param.char ? `<code>‑${param.char}</code>` : 'N/A';
|
|
233
|
+
const desc = renderFlagDescription(param);
|
|
234
|
+
return `| ${longFlag} | ${shortFlag} | ${desc} |`;
|
|
235
|
+
}
|
|
236
|
+
function renderFlagDescription(param) {
|
|
237
|
+
const metadataParts = [];
|
|
238
|
+
if (param.deprecated) {
|
|
239
|
+
const toNote = param.deprecated.to ? ` Use \`--${param.deprecated.to}\` instead.` : '';
|
|
240
|
+
metadataParts.push(`**This flag is deprecated.${toNote}**`);
|
|
241
|
+
}
|
|
242
|
+
const flagType = param.hasValue ? 'Value' : 'Boolean';
|
|
243
|
+
metadataParts.push(`**Type:** ${flagType}`);
|
|
244
|
+
if (!param.optional)
|
|
245
|
+
metadataParts.push('**Required**');
|
|
246
|
+
if (param.options?.length) {
|
|
247
|
+
metadataParts.push(`**Valid Values:** ${param.options.map((o) => `\`${o}\``).join(', ')}`);
|
|
248
|
+
}
|
|
249
|
+
if (param.defaultFlagValue)
|
|
250
|
+
metadataParts.push(`**Default value:** \`${param.defaultFlagValue}\``);
|
|
251
|
+
const desc = convertBulletListsToHtml(param.description.map((p) => escapeForMarkdown(p.replace(/\|/g, '|')))).join('<br><br>');
|
|
252
|
+
const parts = [metadataParts.join('<br>')];
|
|
253
|
+
if (desc)
|
|
254
|
+
parts.push(desc);
|
|
255
|
+
return parts.join('<br><br>').replace(/\n/g, ' ');
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/markdown/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAc,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAsC,SAAS,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAY,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,MAAM,OAAO,eAAgB,SAAQ,YAAY;IACvC,KAAK,CAAuB;IAC5B,WAAW,CAA0B;IACrC,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,OAAO,CAAqB;IAC5B,IAAI,CAAW;IACf,QAAQ,CAAkB;IAC1B,KAAK,CAAU;IACf,UAAU,CAAU;IACpB,kBAAkB,CAA2C;IAC7D,OAAO,CAAW;IAE1B,YACE,KAAa,EACb,QAAuB,EACvB,OAAqB,EACrB,cAAuC,EAAE,EACzC,SAAiB;QAEjB,MAAM,sBAAsB,GAAG,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3E,+FAA+F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KAAK,CAAC,QAAQ;QAAE,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAC1B,aAAa,CAAC,IAAI,CAAC,qBAAqB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7F,CAAC;IACD,IAAI,KAAK,CAAC,gBAAgB;QAAE,aAAa,CAAC,IAAI,CAAC,wBAAwB,KAAK,CAAC,gBAAgB,IAAI,CAAC,CAAC;IAEnG,MAAM,IAAI,GAAG,wBAAwB,CACnC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAC5E,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEnB,MAAM,KAAK,GAAa,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3B,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { MarkdownBase } from './markdown-base.js';
|
|
2
|
+
export { MarkdownCommand } from './command.js';
|
|
3
|
+
export { MarkdownCliReference } from './cli-reference.js';
|
|
4
|
+
export { MarkdownRootIndex } from './root-index.js';
|
|
5
|
+
export { MarkdownTopicCommands } from './topic-commands.js';
|
|
6
|
+
export { MarkdownTopicIndex } from './topic-index.js';
|
|
7
|
+
export { MarkdownToc } from './toc.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { MarkdownBase } from './markdown-base.js';
|
|
17
|
+
export { MarkdownCommand } from './command.js';
|
|
18
|
+
export { MarkdownCliReference } from './cli-reference.js';
|
|
19
|
+
export { MarkdownRootIndex } from './root-index.js';
|
|
20
|
+
export { MarkdownTopicCommands } from './topic-commands.js';
|
|
21
|
+
export { MarkdownTopicIndex } from './topic-index.js';
|
|
22
|
+
export { MarkdownToc } from './toc.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare abstract class MarkdownBase {
|
|
2
|
+
private filename;
|
|
3
|
+
protected outputDir: string;
|
|
4
|
+
protected destination: string;
|
|
5
|
+
protected constructor(filename: string, outputDir: string);
|
|
6
|
+
static file(name: string): string;
|
|
7
|
+
getFilename(): string;
|
|
8
|
+
write(): Promise<void>;
|
|
9
|
+
protected abstract generate(): Promise<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { dirname, join } from 'node:path';
|
|
17
|
+
import fs from 'node:fs/promises';
|
|
18
|
+
export class MarkdownBase {
|
|
19
|
+
filename;
|
|
20
|
+
outputDir;
|
|
21
|
+
destination;
|
|
22
|
+
constructor(filename, outputDir) {
|
|
23
|
+
this.filename = filename;
|
|
24
|
+
this.outputDir = outputDir;
|
|
25
|
+
this.destination = join(outputDir, filename);
|
|
26
|
+
}
|
|
27
|
+
static file(name) {
|
|
28
|
+
return `${name}.md`;
|
|
29
|
+
}
|
|
30
|
+
getFilename() {
|
|
31
|
+
return this.filename;
|
|
32
|
+
}
|
|
33
|
+
async write() {
|
|
34
|
+
await fs.mkdir(dirname(this.destination), { recursive: true });
|
|
35
|
+
const output = await this.generate();
|
|
36
|
+
await fs.writeFile(this.destination, output);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=markdown-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-base.js","sourceRoot":"","sources":["../../src/markdown/markdown-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,MAAM,OAAgB,YAAY;IAGF;IAA4B;IAFhD,WAAW,CAAS;IAE9B,YAA8B,QAAgB,EAAY,SAAiB;QAA7C,aAAQ,GAAR,QAAQ,CAAQ;QAAY,cAAS,GAAT,SAAS,CAAQ;QACzE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,GAAG,IAAI,KAAK,CAAC;IACtB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CAGF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
17
|
+
export class MarkdownRootIndex extends MarkdownBase {
|
|
18
|
+
topics;
|
|
19
|
+
constructor(topics, outputDir) {
|
|
20
|
+
super(MarkdownBase.file('cli_reference_index'), outputDir);
|
|
21
|
+
this.topics = topics;
|
|
22
|
+
}
|
|
23
|
+
generate() {
|
|
24
|
+
const lines = [];
|
|
25
|
+
lines.push('<!-- prettier-ignore-start -->');
|
|
26
|
+
lines.push('');
|
|
27
|
+
lines.push('# sf CLI Reference — Topic Index');
|
|
28
|
+
lines.push('');
|
|
29
|
+
for (const topic of this.topics.sort()) {
|
|
30
|
+
lines.push(`- [${topic}](./${topic}/cli_reference_${topic}.md)`);
|
|
31
|
+
}
|
|
32
|
+
lines.push('<!-- prettier-ignore-end -->');
|
|
33
|
+
lines.push('');
|
|
34
|
+
return Promise.resolve(lines.join('\n'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=root-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-index.js","sourceRoot":"","sources":["../../src/markdown/root-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACtB;IAA3B,YAA2B,MAAgB,EAAE,SAAiB;QAC5D,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,SAAS,CAAC,CAAC;QADlC,WAAM,GAAN,MAAM,CAAU;IAE3C,CAAC;IAES,QAAQ;QAChB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,OAAO,KAAK,kBAAkB,KAAK,MAAM,CAAC,CAAC;QACnE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TocTopicEntry } from '../generator-factory.js';
|
|
2
|
+
import { MarkdownBase } from './markdown-base.js';
|
|
3
|
+
export declare class MarkdownToc extends MarkdownBase {
|
|
4
|
+
private topicEntries;
|
|
5
|
+
constructor(topicEntries: TocTopicEntry[], outputDir: string);
|
|
6
|
+
static file(): string;
|
|
7
|
+
protected generate(): Promise<string>;
|
|
8
|
+
}
|