@wthek/error-handling 0.0.0-stage → 1.0.0-beta.2

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.
Files changed (35) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +246 -2
  3. package/dist/bin.d.ts +36 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +127 -0
  6. package/dist/index.d.ts +23 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +67 -0
  9. package/dist/installer.d.ts +36 -0
  10. package/dist/installer.d.ts.map +1 -0
  11. package/dist/installer.js +139 -0
  12. package/dist/types.d.ts +25 -0
  13. package/dist/types.d.ts.map +1 -0
  14. package/dist/types.js +2 -0
  15. package/package.json +101 -3
  16. package/plugin.json +11 -0
  17. package/skills/wthek-error-handling/SKILL.md +711 -0
  18. package/skills/wthek-error-handling/examples/express-zod.js +44 -0
  19. package/skills/wthek-error-handling/examples/express-zod.ts +51 -0
  20. package/skills/wthek-error-handling/examples/fastify-zod.js +40 -0
  21. package/skills/wthek-error-handling/examples/fastify-zod.ts +45 -0
  22. package/skills/wthek-error-handling/examples/hono-valibot.ts +42 -0
  23. package/skills/wthek-error-handling/examples/koa-typebox.ts +54 -0
  24. package/skills/wthek-error-handling/references/express.md +73 -0
  25. package/skills/wthek-error-handling/references/fastify.md +81 -0
  26. package/skills/wthek-error-handling/references/formatters.md +241 -0
  27. package/skills/wthek-error-handling/references/hono.md +151 -0
  28. package/skills/wthek-error-handling/references/koa.md +62 -0
  29. package/skills/wthek-error-handling/references/mcp.md +148 -0
  30. package/skills/wthek-error-handling/references/nestjs.md +84 -0
  31. package/skills/wthek-error-handling/references/restify.md +68 -0
  32. package/skills/wthek-error-handling/references/status-codes.md +181 -0
  33. package/skills/wthek-error-handling/references/typebox.md +74 -0
  34. package/skills/wthek-error-handling/references/valibot.md +202 -0
  35. package/skills/wthek-error-handling/references/zod.md +113 -0
@@ -0,0 +1,139 @@
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 __values = (this && this.__values) || function(o) {
36
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
37
+ if (m) return m.call(o);
38
+ if (o && typeof o.length === "number") return {
39
+ next: function () {
40
+ if (o && i >= o.length) o = void 0;
41
+ return { value: o && o[i++], done: !o };
42
+ }
43
+ };
44
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.installSkill = exports.resolveTargetDir = exports.copyDirRecursive = exports.SOURCE_PLUGIN_JSON = exports.SOURCE_SKILL_DIR = exports.PKG_ROOT = void 0;
48
+ var fs = __importStar(require("fs"));
49
+ var path = __importStar(require("path"));
50
+ var os = __importStar(require("os"));
51
+ /**
52
+ * Path to package root directory.
53
+ */
54
+ exports.PKG_ROOT = path.resolve(__dirname, "..");
55
+ /**
56
+ * Path to source skill directory inside package.
57
+ */
58
+ exports.SOURCE_SKILL_DIR = path.join(exports.PKG_ROOT, "skills", "wthek-error-handling");
59
+ /**
60
+ * Path to plugin.json manifest inside package.
61
+ */
62
+ exports.SOURCE_PLUGIN_JSON = path.join(exports.PKG_ROOT, "plugin.json");
63
+ /**
64
+ * Recursively copies a directory and its contents from source to destination.
65
+ *
66
+ * @param {string} src - Source directory path to copy from.
67
+ * @param {string} dest - Destination directory path to copy into.
68
+ * @returns {void} No return value.
69
+ */
70
+ var copyDirRecursive = function (src, dest) {
71
+ var e_1, _a;
72
+ if (!fs.existsSync(src)) {
73
+ return;
74
+ }
75
+ fs.mkdirSync(dest, { recursive: true });
76
+ var entries = fs.readdirSync(src, { withFileTypes: true });
77
+ try {
78
+ for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
79
+ var entry = entries_1_1.value;
80
+ var srcPath = path.join(src, entry.name);
81
+ var destPath = path.join(dest, entry.name);
82
+ if (entry.isDirectory()) {
83
+ (0, exports.copyDirRecursive)(srcPath, destPath);
84
+ }
85
+ else {
86
+ fs.copyFileSync(srcPath, destPath);
87
+ }
88
+ }
89
+ }
90
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
+ finally {
92
+ try {
93
+ if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);
94
+ }
95
+ finally { if (e_1) throw e_1.error; }
96
+ }
97
+ };
98
+ exports.copyDirRecursive = copyDirRecursive;
99
+ /**
100
+ * Resolves destination directory for installation based on provided options.
101
+ *
102
+ * @param {IInstallOptions} [options] - Configuration options determining installation target.
103
+ * @returns {string} Absolute path to resolved target installation directory.
104
+ */
105
+ var resolveTargetDir = function (options) {
106
+ if (options === null || options === void 0 ? void 0 : options.dest) {
107
+ return path.resolve(process.cwd(), options.dest);
108
+ }
109
+ if (options === null || options === void 0 ? void 0 : options.global) {
110
+ return path.join(os.homedir(), ".gemini", "config", "plugins", "wthek-error-handling");
111
+ }
112
+ if (options === null || options === void 0 ? void 0 : options.github) {
113
+ return path.join(process.cwd(), ".github", "skills", "wthek-error-handling");
114
+ }
115
+ return path.join(process.cwd(), ".agents", "skills", "wthek-error-handling");
116
+ };
117
+ exports.resolveTargetDir = resolveTargetDir;
118
+ /**
119
+ * Installs skill files and plugin manifest to target directory.
120
+ *
121
+ * @param {IInstallOptions} [options] - Optional settings controlling target directory location.
122
+ * @returns {string} Absolute path where skill files were installed.
123
+ */
124
+ var installSkill = function (options) {
125
+ var targetDir = (0, exports.resolveTargetDir)(options);
126
+ if (options === null || options === void 0 ? void 0 : options.global) {
127
+ fs.mkdirSync(targetDir, { recursive: true });
128
+ if (fs.existsSync(exports.SOURCE_PLUGIN_JSON)) {
129
+ fs.copyFileSync(exports.SOURCE_PLUGIN_JSON, path.join(targetDir, "plugin.json"));
130
+ }
131
+ var pluginSkillDir = path.join(targetDir, "skills", "wthek-error-handling");
132
+ (0, exports.copyDirRecursive)(exports.SOURCE_SKILL_DIR, pluginSkillDir);
133
+ }
134
+ else {
135
+ (0, exports.copyDirRecursive)(exports.SOURCE_SKILL_DIR, targetDir);
136
+ }
137
+ return targetDir;
138
+ };
139
+ exports.installSkill = installSkill;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @typedef {Object} IWthekPluginManifest
3
+ * @property {string} name - Unique identifier of the plugin.
4
+ * @property {string} displayName - Human-friendly label for presentation in UI.
5
+ * @property {string} description - Brief summary of what the plugin does.
6
+ * @property {string[]} suggestedPrompts - Starter prompts suggested for UI card layouts.
7
+ */
8
+ export interface IWthekPluginManifest {
9
+ name: string;
10
+ displayName: string;
11
+ description: string;
12
+ suggestedPrompts: string[];
13
+ }
14
+ /**
15
+ * @typedef {Object} IInstallOptions
16
+ * @property {boolean} [global] - Whether to install into global Antigravity config directory.
17
+ * @property {boolean} [github] - Whether to install into the workspace .github/skills directory.
18
+ * @property {string} [dest] - Custom destination directory path for the installation.
19
+ */
20
+ export interface IInstallOptions {
21
+ global?: boolean;
22
+ github?: boolean;
23
+ dest?: string;
24
+ }
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,104 @@
1
1
  {
2
2
  "name": "@wthek/error-handling",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-beta.2",
4
+ "description": "Antigravity skill and AI agent instruction bundle for standardized HTTP error handling, RFC-7807/9457 Problem Details, status codes, and validation pipelines using @wthek and http-error-kit.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "wthek-error-handling": "./dist/bin.js"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "sideEffects": false,
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc --build",
23
+ "test": "jest --config jest.config.ts",
24
+ "coverage": "jest --coverage --config jest.config.ts",
25
+ "prepublishOnly": "npm run build && npm run test"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "skills",
30
+ "plugin.json",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/Skillnter/wthek-error-handling.git"
37
+ },
38
+ "keywords": [
39
+ "antigravity",
40
+ "antigravity-skill",
41
+ "antigravity-plugin",
42
+ "agent-skill",
43
+ "ai-agent",
44
+ "error-handling",
45
+ "http-error-kit",
46
+ "wthek",
47
+ "http-errors",
48
+ "http-status-codes",
49
+ "express",
50
+ "fastify",
51
+ "hono",
52
+ "koa",
53
+ "nestjs",
54
+ "restify",
55
+ "zod",
56
+ "valibot",
57
+ "typebox",
58
+ "rfc-7807",
59
+ "rfc-9457",
60
+ "mcp",
61
+ "model-context-protocol",
62
+ "skillnter"
63
+ ],
64
+ "author": "Himanshu Bansal <skillhimanshubansal@gmail.com>",
65
+ "license": "MIT",
66
+ "bugs": {
67
+ "url": "https://github.com/Skillnter/wthek-error-handling/issues"
68
+ },
69
+ "homepage": "https://github.com/Skillnter/wthek-error-handling#readme",
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "funding": [
74
+ {
75
+ "type": "github",
76
+ "url": "https://github.com/sponsors/Skillnter"
77
+ },
78
+ {
79
+ "type": "patreon",
80
+ "url": "https://www.patreon.com/skillnter"
81
+ },
82
+ {
83
+ "type": "open_collective",
84
+ "url": "https://opencollective.com/skillnter"
85
+ },
86
+ {
87
+ "type": "buy_me_a_coffee",
88
+ "url": "https://buymeacoffee.com/skillnter"
89
+ },
90
+ {
91
+ "type": "paypal",
92
+ "url": "https://www.paypal.com/paypalme/skillnter"
93
+ }
94
+ ],
95
+ "devDependencies": {
96
+ "@types/jest": "^29.5.14",
97
+ "@types/node": "^22.13.4",
98
+ "jest": "^29.7.0",
99
+ "ts-jest": "^29.2.5",
100
+ "ts-node": "^10.9.2",
101
+ "tslib": "^2.8.1",
102
+ "typescript": "^5.7.3"
103
+ }
6
104
  }
package/plugin.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "wthek-error-handling",
3
+ "displayName": "WTHek Error Handling",
4
+ "description": "Standardized HTTP error handling, RFC-7807/9457 Problem Details, status codes, and validation error pipelines (Zod, Valibot, TypeBox) for Express, Fastify, Hono, Koa, NestJS, and MCP.",
5
+ "suggestedPrompts": [
6
+ "Add standardized error handling to my Express API",
7
+ "Configure RFC-7807 problem details in Hono",
8
+ "Transform TypeBox validation errors with http-error-kit"
9
+ ]
10
+ }
11
+