chore(prettier): add formatter scripts and format files

This commit is contained in:
xixu-me committed 2026-03-25 12:27:55 +08:00
1 parent 32545773c9
commit 80cbf7d966
12 files changed
+262 -201

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
# Dependencies
node_modules/
# Build and package artifacts
dist/
build/
coverage/
*.tgz
# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Environment files
.env
.env.*
!.env.example
# Editor directories
.idea/
.vscode/
# OS files
.DS_Store
Thumbs.db
desktop.ini
+15
View File
@@ -0,0 +1,15 @@
{
"lockfileVersion": 1,
"configVersion": 1,
"workspaces": {
"": {
"name": "@xixu-me/skills-vault",
"devDependencies": {
"prettier": "^3.8.1",
},
},
},
"packages": {
"prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="],
}
}
@@ -45,6 +45,7 @@
## Task 1: Establish the CLI Shell and Package Metadata ## Task 1: Establish the CLI Shell and Package Metadata
**Files:** **Files:**
- Create: `src/cli.ts` - Create: `src/cli.ts`
- Create: `test/cli.test.ts` - Create: `test/cli.test.ts`
- Modify: `package.json` - Modify: `package.json`
@@ -126,6 +127,7 @@ git commit -m "refactor(cli): add top-level skvlt entrypoint"
## Task 2: Move Backup Into Command and Internal Modules ## Task 2: Move Backup Into Command and Internal Modules
**Files:** **Files:**
- Create: `src/commands/backup.ts` - Create: `src/commands/backup.ts`
- Create: `src/internal/args/parse-backup-args.ts` - Create: `src/internal/args/parse-backup-args.ts`
- Create: `src/internal/manifest/build-manifest.ts` - Create: `src/internal/manifest/build-manifest.ts`
@@ -158,7 +160,11 @@ Expected: FAIL because `../src/commands/backup` does not exist yet.
```ts ```ts
// src/internal/process/run-bunx.ts // src/internal/process/run-bunx.ts
export async function runBunx(args: string[]) { export async function runBunx(args: string[]) {
const proc = Bun.spawn({ cmd: ["bunx", ...args], stdout: "pipe", stderr: "pipe" }); const proc = Bun.spawn({
cmd: ["bunx", ...args],
stdout: "pipe",
stderr: "pipe",
});
const [stdout, stderr, exitCode] = await Promise.all([ const [stdout, stderr, exitCode] = await Promise.all([
new Response(proc.stdout).text(), new Response(proc.stdout).text(),
new Response(proc.stderr).text(), new Response(proc.stderr).text(),
@@ -173,7 +179,9 @@ export async function runBunx(args: string[]) {
```ts ```ts
export async function runBackup(argv: string[]) { export async function runBackup(argv: string[]) {
const options = parseBackupArgs(argv); const options = parseBackupArgs(argv);
const installedSkillNames = await getInstalledSkillNames(options.projectScope); const installedSkillNames = await getInstalledSkillNames(
options.projectScope,
);
const manifest = buildManifest(installedSkillNames, options.lockFilePath); const manifest = buildManifest(installedSkillNames, options.lockFilePath);
return options.dryRun return options.dryRun
? { exitCode: 0, stdout: manifest, stderr: "" } ? { exitCode: 0, stdout: manifest, stderr: "" }
@@ -201,6 +209,7 @@ git commit -m "refactor(backup): move backup flow into command modules"
## Task 3: Move Restore Concurrency Helpers Into Internal Install Modules ## Task 3: Move Restore Concurrency Helpers Into Internal Install Modules
**Files:** **Files:**
- Create: `src/internal/install/resolve-install-concurrency.ts` - Create: `src/internal/install/resolve-install-concurrency.ts`
- Create: `src/internal/install/run-with-concurrency.ts` - Create: `src/internal/install/run-with-concurrency.ts`
- Create: `test/install-concurrency.test.ts` - Create: `test/install-concurrency.test.ts`
@@ -215,7 +224,9 @@ import { resolveInstallConcurrency } from "../src/internal/install/resolve-insta
import { runWithConcurrency } from "../src/internal/install/run-with-concurrency"; import { runWithConcurrency } from "../src/internal/install/run-with-concurrency";
test("resolveInstallConcurrency caps auto concurrency at task count", () => { test("resolveInstallConcurrency caps auto concurrency at task count", () => {
expect(resolveInstallConcurrency({ taskCount: 2, availableParallelism: 16 })).toBe(2); expect(
resolveInstallConcurrency({ taskCount: 2, availableParallelism: 16 }),
).toBe(2);
}); });
``` ```
@@ -233,7 +244,12 @@ export function resolveInstallConcurrency(options: ResolveOptions): number {
} }
// src/internal/install/run-with-concurrency.ts // src/internal/install/run-with-concurrency.ts
export async function runWithConcurrency<T>(items: T[], concurrency: number, worker: Worker<T>, options: Options) { export async function runWithConcurrency<T>(
items: T[],
concurrency: number,
worker: Worker<T>,
options: Options,
) {
// preserve bounded scheduling and continue-on-error semantics // preserve bounded scheduling and continue-on-error semantics
} }
``` ```
@@ -253,6 +269,7 @@ git commit -m "refactor(restore): isolate install concurrency helpers"
## Task 4: Move Restore Into Command and Manifest Modules ## Task 4: Move Restore Into Command and Manifest Modules
**Files:** **Files:**
- Create: `src/commands/restore.ts` - Create: `src/commands/restore.ts`
- Create: `src/internal/args/parse-restore-args.ts` - Create: `src/internal/args/parse-restore-args.ts`
- Create: `src/internal/manifest/parse-manifest.ts` - Create: `src/internal/manifest/parse-manifest.ts`
@@ -286,7 +303,9 @@ export async function runRestore(argv: string[]) {
const options = parseRestoreArgs(argv); const options = parseRestoreArgs(argv);
const manifest = parseManifest(options.manifestPath); const manifest = parseManifest(options.manifestPath);
const plan = createRestorePlan(manifest, options); const plan = createRestorePlan(manifest, options);
return options.dryRun ? previewRestorePlan(plan) : await executeRestorePlan(plan, options); return options.dryRun
? previewRestorePlan(plan)
: await executeRestorePlan(plan, options);
} }
``` ```
@@ -310,6 +329,7 @@ git commit -m "refactor(restore): move restore flow into command modules"
## Task 5: Remove Legacy Script Layout and Finish Packaging ## Task 5: Remove Legacy Script Layout and Finish Packaging
**Files:** **Files:**
- Create: `README.md` - Create: `README.md`
- Modify: `package.json` - Modify: `package.json`
- Delete: `scripts/backup.ts` - Delete: `scripts/backup.ts`
+165 -166
View File
@@ -2,240 +2,239 @@ total_sources: 24
total_skills: 141 total_skills: 141
sources: sources:
'anthropics/skills': "anthropics/skills":
count: 11 count: 11
skills: skills:
- 'algorithmic-art' - "algorithmic-art"
- 'canvas-design' - "canvas-design"
- 'doc-coauthoring' - "doc-coauthoring"
- 'docx' - "docx"
- 'mcp-builder' - "mcp-builder"
- 'pdf' - "pdf"
- 'skill-creator' - "skill-creator"
- 'slack-gif-creator' - "slack-gif-creator"
- 'theme-factory' - "theme-factory"
- 'webapp-testing' - "webapp-testing"
- 'xlsx' - "xlsx"
'blader/humanizer': "blader/humanizer":
count: 1 count: 1
skills: skills:
- 'humanizer' - "humanizer"
'callstackincubator/agent-skills': "callstackincubator/agent-skills":
count: 5 count: 5
skills: skills:
- 'github' - "github"
- 'react-native-best-practices' - "react-native-best-practices"
- 'react-native-brownfield-migration' - "react-native-brownfield-migration"
- 'upgrading-react-native' - "upgrading-react-native"
- 'validate-skills' - "validate-skills"
'chromedevtools/chrome-devtools-mcp': "chromedevtools/chrome-devtools-mcp":
count: 4 count: 4
skills: skills:
- 'a11y-debugging' - "a11y-debugging"
- 'chrome-devtools' - "chrome-devtools"
- 'debug-optimize-lcp' - "debug-optimize-lcp"
- 'troubleshooting' - "troubleshooting"
'cloudflare/skills': "cloudflare/skills":
count: 8 count: 8
skills: skills:
- 'agents-sdk' - "agents-sdk"
- 'building-mcp-server-on-cloudflare' - "building-mcp-server-on-cloudflare"
- 'cloudflare' - "cloudflare"
- 'durable-objects' - "durable-objects"
- 'sandbox-sdk' - "sandbox-sdk"
- 'web-perf' - "web-perf"
- 'workers-best-practices' - "workers-best-practices"
- 'wrangler' - "wrangler"
'coderabbitai/skills': "coderabbitai/skills":
count: 1 count: 1
skills: skills:
- 'autofix' - "autofix"
'github/awesome-copilot': "github/awesome-copilot":
count: 21 count: 21
skills: skills:
- 'agent-governance' - "agent-governance"
- 'agentic-eval' - "agentic-eval"
- 'automate-this' - "automate-this"
- 'cloud-design-patterns' - "cloud-design-patterns"
- 'codeql' - "codeql"
- 'create-agentsmd' - "create-agentsmd"
- 'create-architectural-decision-record' - "create-architectural-decision-record"
- 'create-github-action-workflow-specification' - "create-github-action-workflow-specification"
- 'create-readme' - "create-readme"
- 'dependabot' - "dependabot"
- 'documentation-writer' - "documentation-writer"
- 'doublecheck' - "doublecheck"
- 'editorconfig' - "editorconfig"
- 'git-commit' - "git-commit"
- 'github-issues' - "github-issues"
- 'make-repo-contribution' - "make-repo-contribution"
- 'mcp-cli' - "mcp-cli"
- 'publish-to-pages' - "publish-to-pages"
- 'python-mcp-server-generator' - "python-mcp-server-generator"
- 'refactor' - "refactor"
- 'secret-scanning' - "secret-scanning"
'huggingface/skills': "huggingface/skills":
count: 11 count: 11
skills: skills:
- 'hf-cli' - "hf-cli"
- 'huggingface-community-evals' - "huggingface-community-evals"
- 'huggingface-datasets' - "huggingface-datasets"
- 'huggingface-gradio' - "huggingface-gradio"
- 'huggingface-jobs' - "huggingface-jobs"
- 'huggingface-llm-trainer' - "huggingface-llm-trainer"
- 'huggingface-paper-publisher' - "huggingface-paper-publisher"
- 'huggingface-papers' - "huggingface-papers"
- 'huggingface-trackio' - "huggingface-trackio"
- 'huggingface-vision-trainer' - "huggingface-vision-trainer"
- 'transformers-js' - "transformers-js"
'langchain-ai/langchain-skills': "langchain-ai/langchain-skills":
count: 11 count: 11
skills: skills:
- 'deep-agents-core' - "deep-agents-core"
- 'deep-agents-memory' - "deep-agents-memory"
- 'deep-agents-orchestration' - "deep-agents-orchestration"
- 'framework-selection' - "framework-selection"
- 'langchain-dependencies' - "langchain-dependencies"
- 'langchain-fundamentals' - "langchain-fundamentals"
- 'langchain-middleware' - "langchain-middleware"
- 'langchain-rag' - "langchain-rag"
- 'langgraph-fundamentals' - "langgraph-fundamentals"
- 'langgraph-human-in-the-loop' - "langgraph-human-in-the-loop"
- 'langgraph-persistence' - "langgraph-persistence"
'makenotion/skills': "makenotion/skills":
count: 1 count: 1
skills: skills:
- 'notion-cli' - "notion-cli"
'mastra-ai/skills': "mastra-ai/skills":
count: 1 count: 1
skills: skills:
- 'mastra' - "mastra"
'microsoft/playwright-cli': "microsoft/playwright-cli":
count: 1 count: 1
skills: skills:
- 'playwright-cli' - "playwright-cli"
'obra/superpowers': "obra/superpowers":
count: 14 count: 14
skills: skills:
- 'brainstorming' - "brainstorming"
- 'dispatching-parallel-agents' - "dispatching-parallel-agents"
- 'executing-plans' - "executing-plans"
- 'finishing-a-development-branch' - "finishing-a-development-branch"
- 'receiving-code-review' - "receiving-code-review"
- 'requesting-code-review' - "requesting-code-review"
- 'subagent-driven-development' - "subagent-driven-development"
- 'systematic-debugging' - "systematic-debugging"
- 'test-driven-development' - "test-driven-development"
- 'using-git-worktrees' - "using-git-worktrees"
- 'using-superpowers' - "using-superpowers"
- 'verification-before-completion' - "verification-before-completion"
- 'writing-plans' - "writing-plans"
- 'writing-skills' - "writing-skills"
'openai/skills': "openai/skills":
count: 27 count: 27
skills: skills:
- 'aspnet-core' - "aspnet-core"
- 'chatgpt-apps' - "chatgpt-apps"
- 'develop-web-game' - "develop-web-game"
- 'figma' - "figma"
- 'frontend-skill' - "frontend-skill"
- 'gh-address-comments' - "gh-address-comments"
- 'gh-fix-ci' - "gh-fix-ci"
- 'imagegen' - "imagegen"
- 'jupyter-notebook' - "jupyter-notebook"
- 'linear' - "linear"
- 'netlify-deploy' - "netlify-deploy"
- 'notion-knowledge-capture' - "notion-knowledge-capture"
- 'notion-meeting-intelligence' - "notion-meeting-intelligence"
- 'notion-research-documentation' - "notion-research-documentation"
- 'notion-spec-to-implementation' - "notion-spec-to-implementation"
- 'openai-docs' - "openai-docs"
- 'playwright-interactive' - "playwright-interactive"
- 'render-deploy' - "render-deploy"
- 'screenshot' - "screenshot"
- 'security-ownership-map' - "security-ownership-map"
- 'security-threat-model' - "security-threat-model"
- 'sentry' - "sentry"
- 'slides' - "slides"
- 'sora' - "sora"
- 'speech' - "speech"
- 'transcribe' - "transcribe"
- 'winui-app' - "winui-app"
'redis/agent-skills': "redis/agent-skills":
count: 1 count: 1
skills: skills:
- 'redis-development' - "redis-development"
'remotion-dev/skills': "remotion-dev/skills":
count: 1 count: 1
skills: skills:
- 'remotion-best-practices' - "remotion-best-practices"
'resciencelab/opc-skills': "resciencelab/opc-skills":
count: 10 count: 10
skills: skills:
- 'archive' - "archive"
- 'banner-creator' - "banner-creator"
- 'domain-hunter' - "domain-hunter"
- 'logo-creator' - "logo-creator"
- 'nanobanana' - "nanobanana"
- 'producthunt' - "producthunt"
- 'reddit' - "reddit"
- 'requesthunt' - "requesthunt"
- 'seo-geo' - "seo-geo"
- 'twitter' - "twitter"
'semgrep/skills': "semgrep/skills":
count: 3 count: 3
skills: skills:
- 'code-security' - "code-security"
- 'llm-security' - "llm-security"
- 'semgrep' - "semgrep"
'supabase/agent-skills': "supabase/agent-skills":
count: 1 count: 1
skills: skills:
- 'supabase-postgres-best-practices' - "supabase-postgres-best-practices"
'upstash/context7': "upstash/context7":
count: 1 count: 1
skills: skills:
- 'context7-mcp' - "context7-mcp"
'vercel-labs/agent-skills': "vercel-labs/agent-skills":
count: 4 count: 4
skills: skills:
- 'deploy-to-vercel' - "deploy-to-vercel"
- 'vercel-composition-patterns' - "vercel-composition-patterns"
- 'vercel-react-best-practices' - "vercel-react-best-practices"
- 'web-design-guidelines' - "web-design-guidelines"
'vercel-labs/skills': "vercel-labs/skills":
count: 1 count: 1
skills: skills:
- 'find-skills' - "find-skills"
'xixu-me/xdrop': "xixu-me/xdrop":
count: 1 count: 1
skills: skills:
- 'xdrop' - "xdrop"
'xixu-me/xget': "xixu-me/xget":
count: 1 count: 1
skills: skills:
- 'xget' - "xget"
+5
View File
@@ -16,7 +16,12 @@
"scripts": { "scripts": {
"backup": "bun run ./src/cli.ts backup", "backup": "bun run ./src/cli.ts backup",
"backup:dry-run": "bun run ./src/cli.ts backup --dry-run", "backup:dry-run": "bun run ./src/cli.ts backup --dry-run",
"format": "prettier --write \"package.json\" \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\" \"manifests/**/*.{yml,yaml}\"",
"format:check": "prettier --check \"package.json\" \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\" \"manifests/**/*.{yml,yaml}\"",
"restore": "bun run ./src/cli.ts restore", "restore": "bun run ./src/cli.ts restore",
"restore:dry-run": "bun run ./src/cli.ts restore --dry-run" "restore:dry-run": "bun run ./src/cli.ts restore --dry-run"
},
"devDependencies": {
"prettier": "^3.8.1"
} }
} }
+4 -1
View File
@@ -4,7 +4,10 @@ import {
defaultGlobalLockFilePath, defaultGlobalLockFilePath,
} from "../internal/paths/defaults"; } from "../internal/paths/defaults";
import { parseBackupArgs } from "../internal/args/parse-backup-args"; import { parseBackupArgs } from "../internal/args/parse-backup-args";
import { buildManifest, type LockFile } from "../internal/manifest/build-manifest"; import {
buildManifest,
type LockFile,
} from "../internal/manifest/build-manifest";
import { runBunx } from "../internal/process/run-bunx"; import { runBunx } from "../internal/process/run-bunx";
export type BackupRunResult = { export type BackupRunResult = {
+8 -2
View File
@@ -98,7 +98,9 @@ function selectSources(
return entries; return entries;
} }
const selected = entries.filter((entry) => onlySources.includes(entry.source)); const selected = entries.filter((entry) =>
onlySources.includes(entry.source),
);
const selectedSources = new Set(selected.map((entry) => entry.source)); const selectedSources = new Set(selected.map((entry) => entry.source));
const missing = onlySources.filter((source) => !selectedSources.has(source)); const missing = onlySources.filter((source) => !selectedSources.has(source));
@@ -157,7 +159,11 @@ async function runRestoreFromManifest(
for (const entry of entries) { for (const entry of entries) {
const preview = [ const preview = [
"bunx", "bunx",
...buildInstallCommand(entry.source, entry.skills, options.projectScope), ...buildInstallCommand(
entry.source,
entry.skills,
options.projectScope,
),
] ]
.map(encodeShellArg) .map(encodeShellArg)
.join(" "); .join(" ");
+1 -4
View File
@@ -64,10 +64,7 @@ export function parseBackupArgs(argv: string[]): BackupOptions {
return options; return options;
} }
if ( if (options.projectScope && !options.lockFileProvided) {
options.projectScope &&
!options.lockFileProvided
) {
throw new Error( throw new Error(
"--project-scope requires --lock-file because no project lock file could be auto-discovered in this workspace.", "--project-scope requires --lock-file because no project lock file could be auto-discovered in this workspace.",
); );
+1 -4
View File
@@ -11,10 +11,7 @@ export type RestoreOptions = {
help: boolean; help: boolean;
}; };
function parsePositiveIntegerOption( function parsePositiveIntegerOption(value: string, optionName: string): number {
value: string,
optionName: string,
): number {
if (!/^\d+$/.test(value)) { if (!/^\d+$/.test(value)) {
throw new Error(`${optionName} requires a positive integer`); throw new Error(`${optionName} requires a positive integer`);
} }
+1 -3
View File
@@ -59,9 +59,7 @@ export async function runWithConcurrency<T>(
} }
} }
await Promise.all( await Promise.all(Array.from({ length: workerCount }, () => runWorker()));
Array.from({ length: workerCount }, () => runWorker()),
);
if (!options.continueOnError && firstError !== null) { if (!options.continueOnError && firstError !== null) {
throw firstError; throw firstError;
+2 -5
View File
@@ -70,16 +70,13 @@ test("shows help before project-scope validation", async () => {
}); });
test("builds a grouped manifest with stable source and skill ordering", () => { test("builds a grouped manifest with stable source and skill ordering", () => {
const manifest = buildManifest( const manifest = buildManifest(["zulu", "alpha", "beta"], {
["zulu", "alpha", "beta"],
{
skills: { skills: {
alpha: { source: "beta/source" }, alpha: { source: "beta/source" },
beta: { source: "alpha/source" }, beta: { source: "alpha/source" },
zulu: { source: "beta/source" }, zulu: { source: "beta/source" },
}, },
}, });
);
expect(manifest.totalSources).toBe(2); expect(manifest.totalSources).toBe(2);
expect(manifest.totalSkills).toBe(3); expect(manifest.totalSkills).toBe(3);
+6 -11
View File
@@ -59,20 +59,14 @@ test("restores only missing skills during live execution", async () => {
); );
expect(commands).toEqual([ expect(commands).toEqual([
["skills", "add", "anthropics/skills", "-g", "-y", "--skill", "beta"], ["skills", "add", "anthropics/skills", "-g", "-y", "--skill", "beta"],
[ ["skills", "add", "github/awesome-copilot", "-g", "-y", "--skill", "gamma"],
"skills",
"add",
"github/awesome-copilot",
"-g",
"-y",
"--skill",
"gamma",
],
]); ]);
}); });
test("continues and returns success when continue-on-error is enabled", async () => { test("continues and returns success when continue-on-error is enabled", async () => {
const result = await runRestore(["--manifest", "ignored.yaml", "--continue-on-error"], { const result = await runRestore(
["--manifest", "ignored.yaml", "--continue-on-error"],
{
readManifest: () => sampleManifest, readManifest: () => sampleManifest,
getInstalledSkillNames: async () => new Set(), getInstalledSkillNames: async () => new Set(),
runBunx: async (args) => { runBunx: async (args) => {
@@ -82,7 +76,8 @@ test("continues and returns success when continue-on-error is enabled", async ()
return { exitCode: 0, stdout: "installed gamma", stderr: "" }; return { exitCode: 0, stdout: "installed gamma", stderr: "" };
}, },
}); },
);
expect(result.exitCode).toBe(0); expect(result.exitCode).toBe(0);
expect(result.stdout).toContain( expect(result.stdout).toContain(