@workskills/getskill 1.1.9 → 1.2.0

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/verify.js DELETED
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const fs_1 = __importDefault(require("fs"));
40
- const path_1 = __importDefault(require("path"));
41
- const child_process_1 = require("child_process");
42
- const exported = __importStar(require("./main"));
43
- const projectRoot = __dirname;
44
- const candidateProjectRoots = [projectRoot, path_1.default.resolve(projectRoot, '..')];
45
- function findFirstExistingPath(relativePath) {
46
- for (const root of candidateProjectRoots) {
47
- const candidate = path_1.default.join(root, relativePath);
48
- if (fs_1.default.existsSync(candidate)) {
49
- return candidate;
50
- }
51
- }
52
- return path_1.default.join(projectRoot, relativePath);
53
- }
54
- const tsconfigPath = findFirstExistingPath('tsconfig.json');
55
- const packageJsonPath = findFirstExistingPath('package.json');
56
- function assert(condition, message) {
57
- if (!condition) {
58
- throw new Error(message);
59
- }
60
- }
61
- function run() {
62
- (0, child_process_1.execFileSync)(process.execPath, [require.resolve('typescript/bin/tsc'), '--noEmit', '-p', tsconfigPath], {
63
- cwd: projectRoot,
64
- stdio: 'inherit'
65
- });
66
- const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
67
- assert(typeof exported.searchSkills === 'function', 'searchSkills 导出缺失');
68
- assert(typeof exported.downloadSkill === 'function', 'downloadSkill 导出缺失');
69
- assert(typeof exported.updateSkill === 'function', 'updateSkill 导出缺失');
70
- assert(typeof exported.listLocalSkills === 'function', 'listLocalSkills 导出缺失');
71
- assert(typeof exported.getSkillsDirectory === 'function', 'getSkillsDirectory 导出缺失');
72
- assert(typeof exported.getSkillsCacheDirectory === 'function', 'getSkillsCacheDirectory 导出缺失');
73
- assert(typeof exported.publishSkill === 'function', 'publishSkill 导出缺失');
74
- const originalLog = console.log;
75
- const logLines = [];
76
- console.log = (...args) => {
77
- logLines.push(args.map((arg) => String(arg)).join(' '));
78
- };
79
- try {
80
- exported.printHelp();
81
- }
82
- finally {
83
- console.log = originalLog;
84
- }
85
- const helpOutput = logLines.join('\n');
86
- assert(helpOutput.includes('getskill --help'), '帮助输出缺少 --help');
87
- assert(helpOutput.includes('getskill --version'), '帮助输出缺少 --version');
88
- assert(helpOutput.includes('getskill install <技能名称>'), '帮助输出缺少 install 用法');
89
- assert(helpOutput.includes('--version <tag>'), '帮助输出缺少 install/update --version 用法');
90
- assert(helpOutput.includes('getskill update <技能名称>'), '帮助输出缺少 update 用法');
91
- assert(helpOutput.includes('getskill update --all'), '帮助输出缺少 update --all 用法');
92
- assert(helpOutput.includes('getskill uninstall <技能名称>'), '帮助输出缺少 uninstall 用法');
93
- assert(helpOutput.includes('getskill inspect <技能名称>'), '帮助输出缺少 inspect 用法');
94
- assert(helpOutput.includes('getskill search <关键词> --json'), '帮助输出缺少 search --json 用法');
95
- assert(helpOutput.includes('getskill publish <目录>'), '帮助输出缺少 publish 用法');
96
- assert(helpOutput.includes('--name <repo-name>'), '帮助输出缺少 publish 仓库名参数');
97
- const versionOutput = exported.getCliVersion();
98
- assert(versionOutput === packageJson.version, `--version 输出异常: expected ${packageJson.version}, got ${versionOutput}`);
99
- console.log('verify passed');
100
- }
101
- try {
102
- run();
103
- }
104
- catch (error) {
105
- const message = error instanceof Error ? error.message : String(error);
106
- console.error('verify failed:', message);
107
- process.exit(1);
108
- }
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("vitest/config");
4
- exports.default = (0, config_1.defineConfig)({
5
- test: {
6
- environment: 'node',
7
- globals: true,
8
- include: ['tests/**/*.test.ts'],
9
- coverage: {
10
- provider: 'v8',
11
- reporter: ['text', 'html'],
12
- thresholds: {
13
- lines: 60,
14
- functions: 60,
15
- branches: 50,
16
- statements: 60
17
- },
18
- include: ['main.ts', 'lib/**/*.ts']
19
- }
20
- }
21
- });