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
+273 -212

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
**Files:**
- Create: `src/cli.ts`
- Create: `test/cli.test.ts`
- 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
**Files:**
- Create: `src/commands/backup.ts`
- Create: `src/internal/args/parse-backup-args.ts`
- Create: `src/internal/manifest/build-manifest.ts`
@@ -158,7 +160,11 @@ Expected: FAIL because `../src/commands/backup` does not exist yet.
```ts
// src/internal/process/run-bunx.ts
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([
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
@@ -173,7 +179,9 @@ export async function runBunx(args: string[]) {
```ts
export async function runBackup(argv: string[]) {
const options = parseBackupArgs(argv);
const installedSkillNames = await getInstalledSkillNames(options.projectScope);
const installedSkillNames = await getInstalledSkillNames(
options.projectScope,
);
const manifest = buildManifest(installedSkillNames, options.lockFilePath);
return options.dryRun
? { 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
**Files:**
- Create: `src/internal/install/resolve-install-concurrency.ts`
- Create: `src/internal/install/run-with-concurrency.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";
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
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
}
```
@@ -253,6 +269,7 @@ git commit -m "refactor(restore): isolate install concurrency helpers"
## Task 4: Move Restore Into Command and Manifest Modules
**Files:**
- Create: `src/commands/restore.ts`
- Create: `src/internal/args/parse-restore-args.ts`
- Create: `src/internal/manifest/parse-manifest.ts`
@@ -286,7 +303,9 @@ export async function runRestore(argv: string[]) {
const options = parseRestoreArgs(argv);
const manifest = parseManifest(options.manifestPath);
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
**Files:**
- Create: `README.md`
- Modify: `package.json`
- Delete: `scripts/backup.ts`
+165 -166
View File
@@ -2,240 +2,239 @@ total_sources: 24
total_skills: 141
sources:
'anthropics/skills':
"anthropics/skills":
count: 11
skills:
- 'algorithmic-art'
- 'canvas-design'
- 'doc-coauthoring'
- 'docx'
- 'mcp-builder'
- 'pdf'
- 'skill-creator'
- 'slack-gif-creator'
- 'theme-factory'
- 'webapp-testing'
- 'xlsx'
- "algorithmic-art"
- "canvas-design"
- "doc-coauthoring"
- "docx"
- "mcp-builder"
- "pdf"
- "skill-creator"
- "slack-gif-creator"
- "theme-factory"
- "webapp-testing"
- "xlsx"
'blader/humanizer':
"blader/humanizer":
count: 1
skills:
- 'humanizer'
- "humanizer"
'callstackincubator/agent-skills':
"callstackincubator/agent-skills":
count: 5
skills:
- 'github'
- 'react-native-best-practices'
- 'react-native-brownfield-migration'
- 'upgrading-react-native'
- 'validate-skills'
- "github"
- "react-native-best-practices"
- "react-native-brownfield-migration"
- "upgrading-react-native"
- "validate-skills"
'chromedevtools/chrome-devtools-mcp':
"chromedevtools/chrome-devtools-mcp":
count: 4
skills:
- 'a11y-debugging'
- 'chrome-devtools'
- 'debug-optimize-lcp'
- 'troubleshooting'
- "a11y-debugging"
- "chrome-devtools"
- "debug-optimize-lcp"
- "troubleshooting"
'cloudflare/skills':
"cloudflare/skills":
count: 8
skills:
- 'agents-sdk'
- 'building-mcp-server-on-cloudflare'
- 'cloudflare'
- 'durable-objects'
- 'sandbox-sdk'
- 'web-perf'
- 'workers-best-practices'
- 'wrangler'
- "agents-sdk"
- "building-mcp-server-on-cloudflare"
- "cloudflare"
- "durable-objects"
- "sandbox-sdk"
- "web-perf"
- "workers-best-practices"
- "wrangler"
'coderabbitai/skills':
"coderabbitai/skills":
count: 1
skills:
- 'autofix'
- "autofix"
'github/awesome-copilot':
"github/awesome-copilot":
count: 21
skills:
- 'agent-governance'
- 'agentic-eval'
- 'automate-this'
- 'cloud-design-patterns'
- 'codeql'
- 'create-agentsmd'
- 'create-architectural-decision-record'
- 'create-github-action-workflow-specification'
- 'create-readme'
- 'dependabot'
- 'documentation-writer'
- 'doublecheck'
- 'editorconfig'
- 'git-commit'
- 'github-issues'
- 'make-repo-contribution'
- 'mcp-cli'
- 'publish-to-pages'
- 'python-mcp-server-generator'
- 'refactor'
- 'secret-scanning'
- "agent-governance"
- "agentic-eval"
- "automate-this"
- "cloud-design-patterns"
- "codeql"
- "create-agentsmd"
- "create-architectural-decision-record"
- "create-github-action-workflow-specification"
- "create-readme"
- "dependabot"
- "documentation-writer"
- "doublecheck"
- "editorconfig"
- "git-commit"
- "github-issues"
- "make-repo-contribution"
- "mcp-cli"
- "publish-to-pages"
- "python-mcp-server-generator"
- "refactor"
- "secret-scanning"
'huggingface/skills':
"huggingface/skills":
count: 11
skills:
- 'hf-cli'
- 'huggingface-community-evals'
- 'huggingface-datasets'
- 'huggingface-gradio'
- 'huggingface-jobs'
- 'huggingface-llm-trainer'
- 'huggingface-paper-publisher'
- 'huggingface-papers'
- 'huggingface-trackio'
- 'huggingface-vision-trainer'
- 'transformers-js'
- "hf-cli"
- "huggingface-community-evals"
- "huggingface-datasets"
- "huggingface-gradio"
- "huggingface-jobs"
- "huggingface-llm-trainer"
- "huggingface-paper-publisher"
- "huggingface-papers"
- "huggingface-trackio"
- "huggingface-vision-trainer"
- "transformers-js"
'langchain-ai/langchain-skills':
"langchain-ai/langchain-skills":
count: 11
skills:
- 'deep-agents-core'
- 'deep-agents-memory'
- 'deep-agents-orchestration'
- 'framework-selection'
- 'langchain-dependencies'
- 'langchain-fundamentals'
- 'langchain-middleware'
- 'langchain-rag'
- 'langgraph-fundamentals'
- 'langgraph-human-in-the-loop'
- 'langgraph-persistence'
- "deep-agents-core"
- "deep-agents-memory"
- "deep-agents-orchestration"
- "framework-selection"
- "langchain-dependencies"
- "langchain-fundamentals"
- "langchain-middleware"
- "langchain-rag"
- "langgraph-fundamentals"
- "langgraph-human-in-the-loop"
- "langgraph-persistence"
'makenotion/skills':
"makenotion/skills":
count: 1
skills:
- 'notion-cli'
- "notion-cli"
'mastra-ai/skills':
"mastra-ai/skills":
count: 1
skills:
- 'mastra'
- "mastra"
'microsoft/playwright-cli':
"microsoft/playwright-cli":
count: 1
skills:
- 'playwright-cli'
- "playwright-cli"
'obra/superpowers':
"obra/superpowers":
count: 14
skills:
- 'brainstorming'
- 'dispatching-parallel-agents'
- 'executing-plans'
- 'finishing-a-development-branch'
- 'receiving-code-review'
- 'requesting-code-review'
- 'subagent-driven-development'
- 'systematic-debugging'
- 'test-driven-development'
- 'using-git-worktrees'
- 'using-superpowers'
- 'verification-before-completion'
- 'writing-plans'
- 'writing-skills'
- "brainstorming"
- "dispatching-parallel-agents"
- "executing-plans"
- "finishing-a-development-branch"
- "receiving-code-review"
- "requesting-code-review"
- "subagent-driven-development"
- "systematic-debugging"
- "test-driven-development"
- "using-git-worktrees"
- "using-superpowers"
- "verification-before-completion"
- "writing-plans"
- "writing-skills"
'openai/skills':
"openai/skills":
count: 27
skills:
- 'aspnet-core'
- 'chatgpt-apps'
- 'develop-web-game'
- 'figma'
- 'frontend-skill'
- 'gh-address-comments'
- 'gh-fix-ci'
- 'imagegen'
- 'jupyter-notebook'
- 'linear'
- 'netlify-deploy'
- 'notion-knowledge-capture'
- 'notion-meeting-intelligence'
- 'notion-research-documentation'
- 'notion-spec-to-implementation'
- 'openai-docs'
- 'playwright-interactive'
- 'render-deploy'
- 'screenshot'
- 'security-ownership-map'
- 'security-threat-model'
- 'sentry'
- 'slides'
- 'sora'
- 'speech'
- 'transcribe'
- 'winui-app'
- "aspnet-core"
- "chatgpt-apps"
- "develop-web-game"
- "figma"
- "frontend-skill"
- "gh-address-comments"
- "gh-fix-ci"
- "imagegen"
- "jupyter-notebook"
- "linear"
- "netlify-deploy"
- "notion-knowledge-capture"
- "notion-meeting-intelligence"
- "notion-research-documentation"
- "notion-spec-to-implementation"
- "openai-docs"
- "playwright-interactive"
- "render-deploy"
- "screenshot"
- "security-ownership-map"
- "security-threat-model"
- "sentry"
- "slides"
- "sora"
- "speech"
- "transcribe"
- "winui-app"
'redis/agent-skills':
"redis/agent-skills":
count: 1
skills:
- 'redis-development'
- "redis-development"
'remotion-dev/skills':
"remotion-dev/skills":
count: 1
skills:
- 'remotion-best-practices'
- "remotion-best-practices"
'resciencelab/opc-skills':
"resciencelab/opc-skills":
count: 10
skills:
- 'archive'
- 'banner-creator'
- 'domain-hunter'
- 'logo-creator'
- 'nanobanana'
- 'producthunt'
- 'reddit'
- 'requesthunt'
- 'seo-geo'
- 'twitter'
- "archive"
- "banner-creator"
- "domain-hunter"
- "logo-creator"
- "nanobanana"
- "producthunt"
- "reddit"
- "requesthunt"
- "seo-geo"
- "twitter"
'semgrep/skills':
"semgrep/skills":
count: 3
skills:
- 'code-security'
- 'llm-security'
- 'semgrep'
- "code-security"
- "llm-security"
- "semgrep"
'supabase/agent-skills':
"supabase/agent-skills":
count: 1
skills:
- 'supabase-postgres-best-practices'
- "supabase-postgres-best-practices"
'upstash/context7':
"upstash/context7":
count: 1
skills:
- 'context7-mcp'
- "context7-mcp"
'vercel-labs/agent-skills':
"vercel-labs/agent-skills":
count: 4
skills:
- 'deploy-to-vercel'
- 'vercel-composition-patterns'
- 'vercel-react-best-practices'
- 'web-design-guidelines'
- "deploy-to-vercel"
- "vercel-composition-patterns"
- "vercel-react-best-practices"
- "web-design-guidelines"
'vercel-labs/skills':
"vercel-labs/skills":
count: 1
skills:
- 'find-skills'
- "find-skills"
'xixu-me/xdrop':
"xixu-me/xdrop":
count: 1
skills:
- 'xdrop'
- "xdrop"
'xixu-me/xget':
"xixu-me/xget":
count: 1
skills:
- 'xget'
- "xget"
+5
View File
@@ -16,7 +16,12 @@
"scripts": {
"backup": "bun run ./src/cli.ts backup",
"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: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,
} from "../internal/paths/defaults";
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";
export type BackupRunResult = {
+8 -2
View File
@@ -98,7 +98,9 @@ function selectSources(
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 missing = onlySources.filter((source) => !selectedSources.has(source));
@@ -157,7 +159,11 @@ async function runRestoreFromManifest(
for (const entry of entries) {
const preview = [
"bunx",
...buildInstallCommand(entry.source, entry.skills, options.projectScope),
...buildInstallCommand(
entry.source,
entry.skills,
options.projectScope,
),
]
.map(encodeShellArg)
.join(" ");
+1 -4
View File
@@ -64,10 +64,7 @@ export function parseBackupArgs(argv: string[]): BackupOptions {
return options;
}
if (
options.projectScope &&
!options.lockFileProvided
) {
if (options.projectScope && !options.lockFileProvided) {
throw new Error(
"--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;
};
function parsePositiveIntegerOption(
value: string,
optionName: string,
): number {
function parsePositiveIntegerOption(value: string, optionName: string): number {
if (!/^\d+$/.test(value)) {
throw new Error(`${optionName} requires a positive integer`);
}
+1 -3
View File
@@ -59,9 +59,7 @@ export async function runWithConcurrency<T>(
}
}
await Promise.all(
Array.from({ length: workerCount }, () => runWorker()),
);
await Promise.all(Array.from({ length: workerCount }, () => runWorker()));
if (!options.continueOnError && firstError !== null) {
throw firstError;
+6 -9
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", () => {
const manifest = buildManifest(
["zulu", "alpha", "beta"],
{
skills: {
alpha: { source: "beta/source" },
beta: { source: "alpha/source" },
zulu: { source: "beta/source" },
},
const manifest = buildManifest(["zulu", "alpha", "beta"], {
skills: {
alpha: { source: "beta/source" },
beta: { source: "alpha/source" },
zulu: { source: "beta/source" },
},
);
});
expect(manifest.totalSources).toBe(2);
expect(manifest.totalSkills).toBe(3);
+13 -18
View File
@@ -59,30 +59,25 @@ test("restores only missing skills during live execution", async () => {
);
expect(commands).toEqual([
["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 () => {
const result = await runRestore(["--manifest", "ignored.yaml", "--continue-on-error"], {
readManifest: () => sampleManifest,
getInstalledSkillNames: async () => new Set(),
runBunx: async (args) => {
if (args[2] === "anthropics/skills") {
return { exitCode: 1, stdout: "", stderr: "source failed" };
}
const result = await runRestore(
["--manifest", "ignored.yaml", "--continue-on-error"],
{
readManifest: () => sampleManifest,
getInstalledSkillNames: async () => new Set(),
runBunx: async (args) => {
if (args[2] === "anthropics/skills") {
return { exitCode: 1, stdout: "", stderr: "source failed" };
}
return { exitCode: 0, stdout: "installed gamma", stderr: "" };
return { exitCode: 0, stdout: "installed gamma", stderr: "" };
},
},
});
);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain(