@angeloashmore/prismic-cli-poc 0.0.0-pr.9.92b6b39 → 0.0.0-pr.9.e40beab
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/index.mjs +134 -107
- package/package.json +1 -1
- package/src/docs-fetch.ts +146 -0
- package/src/docs-list.ts +131 -0
- package/src/docs.ts +26 -121
- package/src/index.ts +1 -1
- package/src/page-type-add-field-boolean.ts +1 -1
- package/src/page-type-add-field-color.ts +1 -1
- package/src/page-type-add-field-date.ts +1 -1
- package/src/page-type-add-field-embed.ts +1 -1
- package/src/page-type-add-field-geo-point.ts +1 -1
- package/src/page-type-add-field-group.ts +1 -1
- package/src/page-type-add-field-image.ts +1 -1
- package/src/page-type-add-field-key-text.ts +1 -1
- package/src/page-type-add-field-link.ts +1 -1
- package/src/page-type-add-field-number.ts +1 -1
- package/src/page-type-add-field-rich-text.ts +1 -1
- package/src/page-type-add-field-select.ts +1 -1
- package/src/page-type-add-field-timestamp.ts +1 -1
- package/src/page-type-add-field-uid.ts +1 -1
- package/src/page-type-create.ts +1 -1
- package/src/repo-create.ts +1 -1
- package/src/skill-install.ts +2 -2
- package/src/skill-uninstall.ts +1 -1
- package/src/slice-add-field-boolean.ts +1 -1
- package/src/slice-add-field-color.ts +1 -1
- package/src/slice-add-field-date.ts +1 -1
- package/src/slice-add-field-embed.ts +1 -1
- package/src/slice-add-field-geo-point.ts +1 -1
- package/src/slice-add-field-group.ts +1 -1
- package/src/slice-add-field-image.ts +1 -1
- package/src/slice-add-field-key-text.ts +1 -1
- package/src/slice-add-field-link.ts +1 -1
- package/src/slice-add-field-number.ts +1 -1
- package/src/slice-add-field-rich-text.ts +1 -1
- package/src/slice-add-field-select.ts +1 -1
- package/src/slice-add-field-timestamp.ts +1 -1
- package/src/status.ts +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
|
|
3
|
+
const HELP = `
|
|
4
|
+
Fetch and display documentation from Prismic's docs site.
|
|
5
|
+
|
|
6
|
+
USAGE
|
|
7
|
+
prismic docs fetch <path> [flags]
|
|
8
|
+
|
|
9
|
+
ARGUMENTS
|
|
10
|
+
path Documentation path with optional anchor (e.g., "nextjs" or "nextjs#set-up-a-prismic-client")
|
|
11
|
+
|
|
12
|
+
FLAGS
|
|
13
|
+
-h, --help Show help for command
|
|
14
|
+
|
|
15
|
+
EXAMPLES
|
|
16
|
+
prismic docs fetch nextjs
|
|
17
|
+
prismic docs fetch nextjs#set-up-a-prismic-client
|
|
18
|
+
|
|
19
|
+
LEARN MORE
|
|
20
|
+
Visit https://prismic.io/docs for the full documentation.
|
|
21
|
+
`.trim();
|
|
22
|
+
|
|
23
|
+
function parsePathAndAnchor(input: string): { path: string; anchor?: string } {
|
|
24
|
+
const hashIndex = input.indexOf("#");
|
|
25
|
+
if (hashIndex === -1) {
|
|
26
|
+
return { path: input };
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
path: input.slice(0, hashIndex),
|
|
30
|
+
anchor: input.slice(hashIndex + 1),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function fetchMarkdown(
|
|
35
|
+
url: string,
|
|
36
|
+
): Promise<{ ok: true; content: string } | { ok: false; error: string }> {
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(url);
|
|
39
|
+
if (response.status === 404) {
|
|
40
|
+
return { ok: false, error: `Documentation not found: ${url}` };
|
|
41
|
+
}
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
error: `Failed to fetch documentation: ${response.status}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const content = await response.text();
|
|
49
|
+
return { ok: true, content };
|
|
50
|
+
} catch (error) {
|
|
51
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
52
|
+
return { ok: false, error: `Network error: ${message}` };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function anchorToHeadingPattern(anchor: string): RegExp {
|
|
57
|
+
// Convert kebab-case anchor to a pattern that matches the heading text.
|
|
58
|
+
const pattern = anchor
|
|
59
|
+
.split("-")
|
|
60
|
+
.map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
|
|
61
|
+
.join("[\\s-]+");
|
|
62
|
+
return new RegExp(`^(#{1,6})\\s+${pattern}\\s*$`, "im");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function extractSection(
|
|
66
|
+
markdown: string,
|
|
67
|
+
anchor: string,
|
|
68
|
+
): { ok: true; content: string } | { ok: false; error: string } {
|
|
69
|
+
const lines = markdown.split("\n");
|
|
70
|
+
const headingPattern = anchorToHeadingPattern(anchor);
|
|
71
|
+
|
|
72
|
+
let startIndex = -1;
|
|
73
|
+
let headingLevel = 0;
|
|
74
|
+
|
|
75
|
+
for (let i = 0; i < lines.length; i++) {
|
|
76
|
+
const match = lines[i].match(headingPattern);
|
|
77
|
+
if (match) {
|
|
78
|
+
startIndex = i;
|
|
79
|
+
headingLevel = match[1].length;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (startIndex === -1) {
|
|
85
|
+
return { ok: false, error: `Anchor not found: #${anchor}` };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let endIndex = lines.length;
|
|
89
|
+
for (let i = startIndex + 1; i < lines.length; i++) {
|
|
90
|
+
const headingMatch = lines[i].match(/^(#{1,6})\s/);
|
|
91
|
+
if (headingMatch && headingMatch[1].length <= headingLevel) {
|
|
92
|
+
endIndex = i;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const content = lines.slice(startIndex, endIndex).join("\n").trim();
|
|
98
|
+
return { ok: true, content };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function docsFetch(): Promise<void> {
|
|
102
|
+
const {
|
|
103
|
+
positionals: [pathArg],
|
|
104
|
+
values: { help },
|
|
105
|
+
} = parseArgs({
|
|
106
|
+
args: process.argv.slice(4),
|
|
107
|
+
options: {
|
|
108
|
+
help: { type: "boolean", short: "h" },
|
|
109
|
+
},
|
|
110
|
+
allowPositionals: true,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
if (help) {
|
|
114
|
+
console.info(HELP);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!pathArg) {
|
|
119
|
+
console.info(HELP);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const { path, anchor } = parsePathAndAnchor(pathArg);
|
|
124
|
+
const url = `https://prismic.io/docs/${path}.md`;
|
|
125
|
+
|
|
126
|
+
const fetchResult = await fetchMarkdown(url);
|
|
127
|
+
if (!fetchResult.ok) {
|
|
128
|
+
console.error(fetchResult.error);
|
|
129
|
+
process.exitCode = 1;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let output = fetchResult.content;
|
|
134
|
+
|
|
135
|
+
if (anchor) {
|
|
136
|
+
const extractResult = extractSection(output, anchor);
|
|
137
|
+
if (!extractResult.ok) {
|
|
138
|
+
console.error(extractResult.error);
|
|
139
|
+
process.exitCode = 1;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
output = extractResult.content;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.info(output);
|
|
146
|
+
}
|
package/src/docs-list.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
|
|
3
|
+
const HELP = `
|
|
4
|
+
List documentation pages from Prismic's docs site.
|
|
5
|
+
|
|
6
|
+
USAGE
|
|
7
|
+
prismic docs list [flags]
|
|
8
|
+
|
|
9
|
+
FLAGS
|
|
10
|
+
-h, --help Show help for command
|
|
11
|
+
|
|
12
|
+
EXAMPLES
|
|
13
|
+
prismic docs list
|
|
14
|
+
`.trim();
|
|
15
|
+
|
|
16
|
+
const ROOT_SITEMAP_URL = "https://prismic.io/docs/sitemap.xml";
|
|
17
|
+
|
|
18
|
+
function decodeXmlEntities(input: string): string {
|
|
19
|
+
return input
|
|
20
|
+
.replaceAll("&", "&")
|
|
21
|
+
.replaceAll("<", "<")
|
|
22
|
+
.replaceAll(">", ">")
|
|
23
|
+
.replaceAll(""", '"')
|
|
24
|
+
.replaceAll("'", "'");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function extractLocEntries(xml: string): string[] {
|
|
28
|
+
const locPattern = /<loc>(.*?)<\/loc>/g;
|
|
29
|
+
const entries: string[] = [];
|
|
30
|
+
let match = locPattern.exec(xml);
|
|
31
|
+
|
|
32
|
+
while (match) {
|
|
33
|
+
entries.push(decodeXmlEntities(match[1]).trim());
|
|
34
|
+
match = locPattern.exec(xml);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return entries.filter(Boolean);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function fetchXml(url: string): Promise<{ ok: true; xml: string } | { ok: false; error: string }> {
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetch(url);
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
error: `Failed to fetch sitemap: ${response.status} (${url})`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
xml: await response.text(),
|
|
53
|
+
};
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
return { ok: false, error: `Network error while fetching sitemap ${url}: ${message}` };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function toDocsPath(urlString: string): string | null {
|
|
61
|
+
try {
|
|
62
|
+
const url = new URL(urlString);
|
|
63
|
+
if (url.hostname !== "prismic.io") {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!url.pathname.startsWith("/docs/")) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return url.pathname.replace(/^\/docs\//, "").replace(/^\/+|\/+$/g, "");
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function docsList(): Promise<void> {
|
|
78
|
+
const {
|
|
79
|
+
values: { help },
|
|
80
|
+
} = parseArgs({
|
|
81
|
+
args: process.argv.slice(4),
|
|
82
|
+
options: {
|
|
83
|
+
help: { type: "boolean", short: "h" },
|
|
84
|
+
},
|
|
85
|
+
allowPositionals: true,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (help) {
|
|
89
|
+
console.info(HELP);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const rootResult = await fetchXml(ROOT_SITEMAP_URL);
|
|
94
|
+
if (!rootResult.ok) {
|
|
95
|
+
console.error(rootResult.error);
|
|
96
|
+
process.exitCode = 1;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const nestedSitemapUrls = extractLocEntries(rootResult.xml);
|
|
101
|
+
if (nestedSitemapUrls.length === 0) {
|
|
102
|
+
console.error(`No nested sitemaps found in ${ROOT_SITEMAP_URL}`);
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const nestedResults = await Promise.all(nestedSitemapUrls.map((url) => fetchXml(url)));
|
|
108
|
+
const failedFetch = nestedResults.find((result) => !result.ok);
|
|
109
|
+
if (failedFetch && !failedFetch.ok) {
|
|
110
|
+
console.error(failedFetch.error);
|
|
111
|
+
process.exitCode = 1;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const paths = new Set<string>();
|
|
116
|
+
|
|
117
|
+
for (const nestedResult of nestedResults) {
|
|
118
|
+
if (!nestedResult.ok) continue;
|
|
119
|
+
|
|
120
|
+
for (const url of extractLocEntries(nestedResult.xml)) {
|
|
121
|
+
const path = toDocsPath(url);
|
|
122
|
+
if (path) {
|
|
123
|
+
paths.add(path);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (const path of [...paths].sort((a, b) => a.localeCompare(b))) {
|
|
129
|
+
console.info(path);
|
|
130
|
+
}
|
|
131
|
+
}
|
package/src/docs.ts
CHANGED
|
@@ -1,149 +1,54 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
|
+
import { docsFetch } from "./docs-fetch";
|
|
3
|
+
import { docsList } from "./docs-list";
|
|
2
4
|
|
|
3
5
|
const HELP = `
|
|
4
|
-
Fetch and
|
|
6
|
+
Fetch and list documentation from Prismic's docs site.
|
|
5
7
|
|
|
6
8
|
USAGE
|
|
7
|
-
prismic docs <
|
|
9
|
+
prismic docs <command> [flags]
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
COMMANDS
|
|
12
|
+
fetch Fetch and display a documentation page
|
|
13
|
+
list List documentation pages
|
|
11
14
|
|
|
12
15
|
FLAGS
|
|
13
16
|
-h, --help Show help for command
|
|
14
17
|
|
|
15
18
|
EXAMPLES
|
|
16
|
-
prismic docs nextjs
|
|
17
|
-
prismic docs nextjs#set-up-a-prismic-client
|
|
19
|
+
prismic docs fetch nextjs
|
|
20
|
+
prismic docs fetch nextjs#set-up-a-prismic-client
|
|
21
|
+
prismic docs list
|
|
18
22
|
|
|
19
23
|
LEARN MORE
|
|
20
|
-
|
|
24
|
+
Use \`prismic docs <command> --help\` for more information about a command.
|
|
21
25
|
`.trim();
|
|
22
26
|
|
|
23
|
-
function parsePathAndAnchor(input: string): { path: string; anchor?: string } {
|
|
24
|
-
const hashIndex = input.indexOf("#");
|
|
25
|
-
if (hashIndex === -1) {
|
|
26
|
-
return { path: input };
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
path: input.slice(0, hashIndex),
|
|
30
|
-
anchor: input.slice(hashIndex + 1),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function fetchMarkdown(
|
|
35
|
-
url: string,
|
|
36
|
-
): Promise<{ ok: true; content: string } | { ok: false; error: string }> {
|
|
37
|
-
try {
|
|
38
|
-
const response = await fetch(url);
|
|
39
|
-
if (response.status === 404) {
|
|
40
|
-
return { ok: false, error: `Documentation not found: ${url}` };
|
|
41
|
-
}
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
return {
|
|
44
|
-
ok: false,
|
|
45
|
-
error: `Failed to fetch documentation: ${response.status}`,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const content = await response.text();
|
|
49
|
-
return { ok: true, content };
|
|
50
|
-
} catch (error) {
|
|
51
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
52
|
-
return { ok: false, error: `Network error: ${message}` };
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function anchorToHeadingPattern(anchor: string): RegExp {
|
|
57
|
-
// Convert kebab-case anchor to a pattern that matches the heading text
|
|
58
|
-
// Each hyphen/space becomes a flexible match for hyphens or spaces
|
|
59
|
-
const pattern = anchor
|
|
60
|
-
.split("-")
|
|
61
|
-
.map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
|
|
62
|
-
.join("[\\s-]+");
|
|
63
|
-
return new RegExp(`^(#{1,6})\\s+${pattern}\\s*$`, "im");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function extractSection(
|
|
67
|
-
markdown: string,
|
|
68
|
-
anchor: string,
|
|
69
|
-
): { ok: true; content: string } | { ok: false; error: string } {
|
|
70
|
-
const lines = markdown.split("\n");
|
|
71
|
-
const headingPattern = anchorToHeadingPattern(anchor);
|
|
72
|
-
|
|
73
|
-
let startIndex = -1;
|
|
74
|
-
let headingLevel = 0;
|
|
75
|
-
|
|
76
|
-
// Find the matching heading
|
|
77
|
-
for (let i = 0; i < lines.length; i++) {
|
|
78
|
-
const match = lines[i].match(headingPattern);
|
|
79
|
-
if (match) {
|
|
80
|
-
startIndex = i;
|
|
81
|
-
headingLevel = match[1].length;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (startIndex === -1) {
|
|
87
|
-
return { ok: false, error: `Anchor not found: #${anchor}` };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Find the end of this section (next heading of equal or lower level number)
|
|
91
|
-
let endIndex = lines.length;
|
|
92
|
-
for (let i = startIndex + 1; i < lines.length; i++) {
|
|
93
|
-
const headingMatch = lines[i].match(/^(#{1,6})\s/);
|
|
94
|
-
if (headingMatch && headingMatch[1].length <= headingLevel) {
|
|
95
|
-
endIndex = i;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const content = lines.slice(startIndex, endIndex).join("\n").trim();
|
|
101
|
-
return { ok: true, content };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
27
|
export async function docs(): Promise<void> {
|
|
105
28
|
const {
|
|
106
|
-
positionals: [
|
|
107
|
-
values: { help },
|
|
29
|
+
positionals: [subcommand],
|
|
108
30
|
} = parseArgs({
|
|
109
31
|
args: process.argv.slice(3),
|
|
110
32
|
options: {
|
|
111
33
|
help: { type: "boolean", short: "h" },
|
|
112
34
|
},
|
|
113
35
|
allowPositionals: true,
|
|
36
|
+
strict: false,
|
|
114
37
|
});
|
|
115
38
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const fetchResult = await fetchMarkdown(url);
|
|
130
|
-
if (!fetchResult.ok) {
|
|
131
|
-
console.error(fetchResult.error);
|
|
132
|
-
process.exitCode = 1;
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
let output = fetchResult.content;
|
|
137
|
-
|
|
138
|
-
if (anchor) {
|
|
139
|
-
const extractResult = extractSection(output, anchor);
|
|
140
|
-
if (!extractResult.ok) {
|
|
141
|
-
console.error(extractResult.error);
|
|
142
|
-
process.exitCode = 1;
|
|
143
|
-
return;
|
|
39
|
+
switch (subcommand) {
|
|
40
|
+
case "fetch":
|
|
41
|
+
await docsFetch();
|
|
42
|
+
break;
|
|
43
|
+
case "list":
|
|
44
|
+
await docsList();
|
|
45
|
+
break;
|
|
46
|
+
default: {
|
|
47
|
+
if (subcommand) {
|
|
48
|
+
console.error(`Unknown docs subcommand: ${subcommand}\n`);
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
}
|
|
51
|
+
console.info(HELP);
|
|
144
52
|
}
|
|
145
|
-
output = extractResult.content;
|
|
146
53
|
}
|
|
147
|
-
|
|
148
|
-
console.info(output);
|
|
149
54
|
}
|
package/src/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ COMMANDS
|
|
|
42
42
|
pull Pull types and slices from Prismic
|
|
43
43
|
push Push types and slices to Prismic
|
|
44
44
|
codegen Generate code from Prismic models
|
|
45
|
-
docs Fetch documentation from Prismic
|
|
45
|
+
docs Fetch and list documentation from Prismic
|
|
46
46
|
skill Manage Prismic AI skills
|
|
47
47
|
preview Manage preview configurations
|
|
48
48
|
token Manage API tokens in a repository
|
|
@@ -232,7 +232,7 @@ export async function pageTypeAddFieldBoolean(): Promise<void> {
|
|
|
232
232
|
if (frameworkInfo?.framework) {
|
|
233
233
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
234
234
|
console.info(
|
|
235
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
235
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -218,7 +218,7 @@ export async function pageTypeAddFieldColor(): Promise<void> {
|
|
|
218
218
|
if (frameworkInfo?.framework) {
|
|
219
219
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
220
220
|
console.info(
|
|
221
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
221
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -221,7 +221,7 @@ export async function pageTypeAddFieldDate(): Promise<void> {
|
|
|
221
221
|
if (frameworkInfo?.framework) {
|
|
222
222
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
223
223
|
console.info(
|
|
224
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
224
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -218,7 +218,7 @@ export async function pageTypeAddFieldEmbed(): Promise<void> {
|
|
|
218
218
|
if (frameworkInfo?.framework) {
|
|
219
219
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
220
220
|
console.info(
|
|
221
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
221
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -215,7 +215,7 @@ export async function pageTypeAddFieldGeoPoint(): Promise<void> {
|
|
|
215
215
|
if (frameworkInfo?.framework) {
|
|
216
216
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
217
217
|
console.info(
|
|
218
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
218
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -192,7 +192,7 @@ export async function pageTypeAddFieldGroup(): Promise<void> {
|
|
|
192
192
|
if (frameworkInfo?.framework) {
|
|
193
193
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
194
194
|
console.info(
|
|
195
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
195
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -218,7 +218,7 @@ export async function pageTypeAddFieldImage(): Promise<void> {
|
|
|
218
218
|
if (frameworkInfo?.framework) {
|
|
219
219
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
220
220
|
console.info(
|
|
221
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
221
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -218,7 +218,7 @@ export async function pageTypeAddFieldKeyText(): Promise<void> {
|
|
|
218
218
|
if (frameworkInfo?.framework) {
|
|
219
219
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
220
220
|
console.info(
|
|
221
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
221
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -241,7 +241,7 @@ export async function pageTypeAddFieldLink(): Promise<void> {
|
|
|
241
241
|
if (frameworkInfo?.framework) {
|
|
242
242
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
243
243
|
console.info(
|
|
244
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
244
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -250,7 +250,7 @@ export async function pageTypeAddFieldNumber(): Promise<void> {
|
|
|
250
250
|
if (frameworkInfo?.framework) {
|
|
251
251
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
252
252
|
console.info(
|
|
253
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
253
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
254
254
|
);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -242,7 +242,7 @@ export async function pageTypeAddFieldRichText(): Promise<void> {
|
|
|
242
242
|
if (frameworkInfo?.framework) {
|
|
243
243
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
244
244
|
console.info(
|
|
245
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
245
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
@@ -224,7 +224,7 @@ export async function pageTypeAddFieldSelect(): Promise<void> {
|
|
|
224
224
|
if (frameworkInfo?.framework) {
|
|
225
225
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
226
226
|
console.info(
|
|
227
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
227
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -221,7 +221,7 @@ export async function pageTypeAddFieldTimestamp(): Promise<void> {
|
|
|
221
221
|
if (frameworkInfo?.framework) {
|
|
222
222
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
223
223
|
console.info(
|
|
224
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
224
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -201,7 +201,7 @@ export async function pageTypeAddFieldUid(): Promise<void> {
|
|
|
201
201
|
if (frameworkInfo?.framework) {
|
|
202
202
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
203
203
|
console.info(
|
|
204
|
-
` Run \`prismic docs ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
204
|
+
` Run \`prismic docs fetch ${docsPath}#write-page-components\` to learn how to implement a page file`,
|
|
205
205
|
);
|
|
206
206
|
}
|
|
207
207
|
}
|
package/src/page-type-create.ts
CHANGED
|
@@ -151,7 +151,7 @@ export async function pageTypeCreate(): Promise<void> {
|
|
|
151
151
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
152
152
|
const anchor = getWritePageComponentsAnchor(frameworkInfo.framework);
|
|
153
153
|
console.info(
|
|
154
|
-
` Run \`prismic docs ${docsPath}${anchor}\` to learn how to implement a page file`,
|
|
154
|
+
` Run \`prismic docs fetch ${docsPath}${anchor}\` to learn how to implement a page file`,
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
}
|
package/src/repo-create.ts
CHANGED
|
@@ -160,7 +160,7 @@ export async function repoCreate(): Promise<void> {
|
|
|
160
160
|
const clientFile = getClientFilePath(frameworkInfo);
|
|
161
161
|
const fileDesc = clientFile ? `creating ${clientFile}` : "configuring Prismic";
|
|
162
162
|
console.info();
|
|
163
|
-
console.info(`Next: Run \`prismic docs ${docsPath}${anchor}\` for instructions on ${fileDesc}`);
|
|
163
|
+
console.info(`Next: Run \`prismic docs fetch ${docsPath}${anchor}\` for instructions on ${fileDesc}`);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
package/src/skill-install.ts
CHANGED
|
@@ -36,7 +36,7 @@ For Prismic-related tasks, use the \`prismic\` CLI first.
|
|
|
36
36
|
|
|
37
37
|
1. Discover capabilities with \`prismic --help\`.
|
|
38
38
|
2. Inspect details with \`prismic <command> --help\`.
|
|
39
|
-
3. Use \`prismic docs <path>\` when documentation is needed.
|
|
39
|
+
3. Use \`prismic docs list\` to discover docs paths, then \`prismic docs fetch <path>\` when documentation is needed.
|
|
40
40
|
4. Prefer CLI workflows over direct API/manual changes.
|
|
41
41
|
5. If the CLI does not support a required operation, state that explicitly, then use the next-best fallback.
|
|
42
42
|
`.trim();
|
|
@@ -79,7 +79,7 @@ export async function findGlobalSkillInstallTargets(config?: {
|
|
|
79
79
|
|
|
80
80
|
export async function skillInstall(): Promise<void> {
|
|
81
81
|
const {
|
|
82
|
-
values: { dryRun, help },
|
|
82
|
+
values: { "dry-run": dryRun, help },
|
|
83
83
|
} = parseArgs({
|
|
84
84
|
args: process.argv.slice(4), // skip: node, script, "skill", "install"
|
|
85
85
|
options: {
|
package/src/skill-uninstall.ts
CHANGED
|
@@ -21,7 +21,7 @@ LEARN MORE
|
|
|
21
21
|
|
|
22
22
|
export async function skillUninstall(): Promise<void> {
|
|
23
23
|
const {
|
|
24
|
-
values: { dryRun, help },
|
|
24
|
+
values: { "dry-run": dryRun, help },
|
|
25
25
|
} = parseArgs({
|
|
26
26
|
args: process.argv.slice(4), // skip: node, script, "skill", "uninstall"
|
|
27
27
|
options: {
|
|
@@ -234,7 +234,7 @@ export async function sliceAddFieldBoolean(): Promise<void> {
|
|
|
234
234
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
235
235
|
const anchor = getWriteComponentsAnchor(frameworkInfo.framework);
|
|
236
236
|
console.info(
|
|
237
|
-
` Run \`prismic docs ${docsPath}${anchor}\` to learn how to implement the slice's component`,
|
|
237
|
+
` Run \`prismic docs fetch ${docsPath}${anchor}\` to learn how to implement the slice's component`,
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
@@ -220,7 +220,7 @@ export async function sliceAddFieldColor(): Promise<void> {
|
|
|
220
220
|
const docsPath = getDocsPath(frameworkInfo.framework);
|
|
221
221
|
const anchor = getWriteComponentsAnchor(frameworkInfo.framework);
|
|
222
222
|
console.info(
|
|
223
|
-
` Run \`prismic docs ${docsPath}${anchor}\` to learn how to implement the slice's component`,
|
|
223
|
+
` Run \`prismic docs fetch ${docsPath}${anchor}\` to learn how to implement the slice's component`,
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
226
|
}
|