fix: restore formatting and README link emphasis
This commit is contained in:
1 parent
7fa8129296
commit
29374db01f
9 files changed
+97
-71
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Skills Vault
|
||||
|
||||
***[汉语](./README.zh.md)***
|
||||
**_[汉语](./README.zh.md)_**
|
||||
|
||||
The CLI for backing up and restoring [Agent Skills](https://agentskills.io).
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Skills Vault
|
||||
|
||||
***[English](./README.md)***
|
||||
**_[English](./README.md)_**
|
||||
|
||||
用于备份和恢复 [Agent Skills](https://agentskills.io) 的 CLI。
|
||||
|
||||
|
||||
+51
-41
@@ -278,12 +278,16 @@ async function runRestoreFromManifest(
|
||||
appendLine(`[dry-run] ${preview}`);
|
||||
}
|
||||
|
||||
return {
|
||||
exitCode: 0,
|
||||
stdout: streamOutput ? (streamedOutput ? "\n" : "") : page(lines.join("\n")),
|
||||
stderr: "",
|
||||
payload: {
|
||||
manifestPath,
|
||||
return {
|
||||
exitCode: 0,
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: page(lines.join("\n")),
|
||||
stderr: "",
|
||||
payload: {
|
||||
manifestPath,
|
||||
projectScope,
|
||||
dryRun: true,
|
||||
sourceCount: entries.length,
|
||||
@@ -413,7 +417,11 @@ async function runRestoreFromManifest(
|
||||
) {
|
||||
return {
|
||||
exitCode: 1,
|
||||
stdout: streamOutput ? (streamedOutput ? "\n" : "") : page(lines.join("\n")),
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: page(lines.join("\n")),
|
||||
stderr: page(
|
||||
formatGlobalSkillStateMismatch(globalSkillStateDiff)
|
||||
.map((line) => errorMessage(line))
|
||||
@@ -429,7 +437,11 @@ async function runRestoreFromManifest(
|
||||
);
|
||||
return {
|
||||
exitCode: 0,
|
||||
stdout: streamOutput ? (streamedOutput ? "\n" : "") : page(lines.join("\n")),
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: page(lines.join("\n")),
|
||||
stderr: "",
|
||||
payload: {
|
||||
manifestPath,
|
||||
@@ -500,14 +512,13 @@ async function runRestoreFromManifest(
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return {
|
||||
exitCode: 1,
|
||||
stdout:
|
||||
streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stderr: page([...errors, errorMessage(message)].join("\n")),
|
||||
errorCode: resolveRestoreErrorCode(message),
|
||||
};
|
||||
@@ -528,18 +539,19 @@ async function runRestoreFromManifest(
|
||||
),
|
||||
);
|
||||
errors.push(
|
||||
errorMessage(`Completed restore with ${failures.length} source failure(s).`),
|
||||
errorMessage(
|
||||
`Completed restore with ${failures.length} source failure(s).`,
|
||||
),
|
||||
);
|
||||
return {
|
||||
exitCode: 0,
|
||||
stdout:
|
||||
streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stderr: page(errors.join("\n")),
|
||||
payload: {
|
||||
manifestPath,
|
||||
@@ -563,14 +575,13 @@ async function runRestoreFromManifest(
|
||||
) {
|
||||
return {
|
||||
exitCode: 1,
|
||||
stdout:
|
||||
streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stderr: page(
|
||||
formatGlobalSkillStateMismatch(globalSkillStateDiff)
|
||||
.map((line) => errorMessage(line))
|
||||
@@ -591,14 +602,13 @@ async function runRestoreFromManifest(
|
||||
);
|
||||
return {
|
||||
exitCode: 0,
|
||||
stdout:
|
||||
streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stdout: streamOutput
|
||||
? streamedOutput
|
||||
? "\n"
|
||||
: ""
|
||||
: lines.length > 0
|
||||
? page(lines.join("\n"))
|
||||
: "",
|
||||
stderr: errors.length > 0 ? page(errors.join("\n")) : "",
|
||||
payload: {
|
||||
manifestPath,
|
||||
|
||||
@@ -86,15 +86,17 @@ export function commandErrorPage(
|
||||
usage: string,
|
||||
example: string,
|
||||
): string {
|
||||
return page([
|
||||
`${errorBadge("ERROR")} ${red(message)}`,
|
||||
"",
|
||||
dim(" Usage:"),
|
||||
` ${usage}`,
|
||||
"",
|
||||
dim(" Example:"),
|
||||
` ${example}`,
|
||||
].join("\n"));
|
||||
return page(
|
||||
[
|
||||
`${errorBadge("ERROR")} ${red(message)}`,
|
||||
"",
|
||||
dim(" Usage:"),
|
||||
` ${usage}`,
|
||||
"",
|
||||
dim(" Example:"),
|
||||
` ${example}`,
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
|
||||
export function infoLine(text: string): string {
|
||||
|
||||
+5
-3
@@ -192,9 +192,11 @@ test("shows help before project-scope validation", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
|
||||
+13
-7
@@ -82,9 +82,11 @@ test("prints top-level help", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
@@ -176,7 +178,9 @@ test("uses process argv when invoked like the CLI", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"The CLI for backing up and restoring Agent Skills",
|
||||
);
|
||||
expect(plainStdout).toContain("Explore the open-source repo at https://github.com/xixu-me/skills-vault");
|
||||
expect(plainStdout).toContain(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout).not.toContain("try:");
|
||||
expect(stdoutText).toContain("\x1b[38;5;102m");
|
||||
expect(stdoutText).toContain("\x1b[38;5;145m");
|
||||
@@ -205,9 +209,11 @@ test("shows a landing page when no command is provided", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain("\x1b[38;5;102m");
|
||||
expect(result.stdout).toContain("\x1b[38;5;145m");
|
||||
expect(result.stdout).not.toContain("\x1b[36m");
|
||||
|
||||
@@ -17,9 +17,11 @@ test("shows completion help text", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
|
||||
+5
-3
@@ -18,9 +18,11 @@ test("shows doctor help text", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
|
||||
@@ -35,9 +35,11 @@ test("shows restore help text", async () => {
|
||||
expect(plainStdout).toContain(
|
||||
"\n\nExplore the open-source repo at https://github.com/xixu-me/skills-vault",
|
||||
);
|
||||
expect(plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
)).toBe(true);
|
||||
expect(
|
||||
plainStdout.endsWith(
|
||||
"Explore the open-source repo at https://github.com/xixu-me/skills-vault\n\n",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.stdout).toContain(
|
||||
`Global restore verifies ${defaultGlobalSkillsPath} against ${defaultGlobalLockFilePath}`,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user