@wthek/error-handling 1.0.0-beta.1 → 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.
package/README.md CHANGED
@@ -4,13 +4,14 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
5
  [![GitHub Workflow](https://img.shields.io/github/actions/workflow/status/Skillnter/wthek-error-handling/main.yml?branch=main)](https://github.com/Skillnter/wthek-error-handling/actions)
6
6
  [![Socket](https://socket.dev/api/badge/npm/package/@wthek/error-handling)](https://socket.dev/npm/package/@wthek/error-handling)
7
- [![Socket Badge](https://socket.dev/api/badge/npm/package/@wthek/error-handling/1.0.0-beta.1)](https://socket.dev/npm/package/@wthek/error-handling/overview/1.0.0-beta.1)
8
7
  [![Skills](https://skills.sh/b/Skillnter/wthek-error-handling)](https://skills.sh/Skillnter/wthek-error-handling)
9
- ![Antigravity Plugin](https://img.shields.io/badge/Antigravity-Plugin-4285F4?logo=google&logoColor=white)
10
- ![Agent Skills](https://img.shields.io/badge/Agent_Skills-Compatible-0F766E?logo=githubcopilot&logoColor=white)
11
- ![MCP](https://img.shields.io/badge/MCP-Compatible-2563EB?logo=protocols.io&logoColor=white)
8
+ ![Antigravity Plugin](https://img.shields.io/badge/Antigravity-Plugin_Included-4285F4?logo=google&logoColor=white)
9
+ ![Agent Skills](https://img.shields.io/badge/Agent_Skills-Format-0F766E?logo=githubcopilot&logoColor=white)
10
+ ![MCP](https://img.shields.io/badge/MCP-Error_Handling-2563EB?logo=protocols.io&logoColor=white)
12
11
 
13
- An AI agent skill and Antigravity plugin for implementing consistent **HTTP and Model Context Protocol (MCP) error handling** across Node.js applications and AI tools.
12
+ An AI agent skill and Antigravity plugin that helps developers and AI coding assistants implement consistent **HHTTP and MCP error handling**H across Node.js applications.
13
+
14
+ Includes framework-specific instructions, integration examples, and best practices for RFC 7807 / RFC 9457 Problem Details, HTTP status codes (RFC 9110), validation error handling, and MCP error responses.
14
15
 
15
16
  It provides instructions, recipes, and best practices for RFC 7807 / RFC 9457 Problem Details, standard HTTP status codes (RFC 9110), validation error transformations, and standardized MCP error responses using `@wthek`, [`http-error-kit`](https://www.npmjs.com/package/http-error-kit), and [`http-response-status-code`](https://www.npmjs.com/package/http-response-status-code).
16
17
 
@@ -101,9 +102,8 @@ Install the package as a development dependency:
101
102
  npm install -D @wthek/error-handling
102
103
  ```
103
104
 
104
- > **Automated Setup**: The package includes a `postinstall` script that automatically copies the skill into `.agents/skills/wthek-error-handling` (and `.github/skills/` if a `.github` folder exists), making it immediately active for your AI agents with zero manual steps.
105
+ Then run the bundled CLI to install the skill into your workspace:
105
106
 
106
- You can also run the CLI installer manually at any time:
107
107
  ```bash
108
108
  npx wthek-error-handling
109
109
  ```
@@ -218,7 +218,7 @@ npx @wthek/error-handling [command] [options]
218
218
 
219
219
  ---
220
220
 
221
- ## People
221
+ ## Author
222
222
 
223
223
  The original author of the project is [Himanshu Bansal][skillnter]
224
224
 
package/dist/bin.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAY/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,IAyB5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,eAe1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,KAAG,IA0CtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAO,IAgCzB,CAAC"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAY/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,IAwB5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,eAe1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,KAAG,IA0CtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAO,IAkBzB,CAAC"}
package/dist/bin.js CHANGED
@@ -63,7 +63,7 @@ exports.outputToTerminal = outputToTerminal;
63
63
  * @returns {void} No return value.
64
64
  */
65
65
  var printHelp = function () {
66
- (0, exports.outputToTerminal)("\n@wthek/error-handling Installer\n--------------------------------\nInstalls the WTHek Error Handling skill/plugin into your workspace or global Antigravity config.\n\nUsage:\n npx @wthek/error-handling [command] [options]\n\nCommands:\n install (default) Installs the skill into target location\n\nOptions:\n --workspace, -w Install to local workspace (.agents/skills/wthek-error-handling) [default]\n --global, -g Install to global Antigravity config (~/.gemini/config/plugins/wthek-error-handling)\n --github Install to GitHub workflows folder (.github/skills/wthek-error-handling)\n --dest <path> Install to a custom directory path\n --postinstall Internal flag invoked during npm postinstall lifecycle\n --help, -h Display this help message\n\nExamples:\n npx @wthek/error-handling\n npx @wthek/error-handling --global\n npx @wthek/error-handling --dest ./my-skills/wthek-error-handling\n");
66
+ (0, exports.outputToTerminal)("\n@wthek/error-handling Installer\n--------------------------------\nInstalls the WTHek Error Handling skill/plugin into your workspace or global Antigravity config.\n\nUsage:\n npx @wthek/error-handling [command] [options]\n\nCommands:\n install (default) Installs the skill into target location\n\nOptions:\n --workspace, -w Install to local workspace (.agents/skills/wthek-error-handling) [default]\n --global, -g Install to global Antigravity config (~/.gemini/config/plugins/wthek-error-handling)\n --github Install to GitHub workflows folder (.github/skills/wthek-error-handling)\n --dest <path> Install to a custom directory path\n --help, -h Display this help message\n\nExamples:\n npx @wthek/error-handling\n npx @wthek/error-handling --global\n npx @wthek/error-handling --dest ./my-skills/wthek-error-handling\n");
67
67
  };
68
68
  exports.printHelp = printHelp;
69
69
  /**
@@ -105,18 +105,6 @@ exports.printSuccessBanner = printSuccessBanner;
105
105
  */
106
106
  var runCli = function () {
107
107
  var args = process.argv.slice(2);
108
- if (args.includes("--postinstall")) {
109
- var result = (0, installer_1.handlePostinstall)();
110
- if (result.installed) {
111
- (0, exports.printSuccessBanner)(result.targets);
112
- }
113
- else {
114
- (0, exports.outputToTerminal)("\n[WTHek] Postinstall notice: ".concat(result.reason || "Skipped installation.", "\n") +
115
- " Run manually: npx @wthek/error-handling\n" +
116
- " Sponsor / Support: https://github.com/sponsors/Skillnter\n");
117
- }
118
- return;
119
- }
120
108
  if (args.includes("--help") || args.includes("-h")) {
121
109
  (0, exports.printHelp)();
122
110
  return;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { installSkill, handlePostinstall } from "./installer";
2
- import { IWthekPluginManifest, IInstallOptions, IPostinstallResult } from "./types";
3
- export type { IWthekPluginManifest, IInstallOptions, IPostinstallResult };
4
- export { installSkill, handlePostinstall };
1
+ import { installSkill } from "./installer";
2
+ import { IWthekPluginManifest, IInstallOptions } from "./types";
3
+ export type { IWthekPluginManifest, IInstallOptions };
4
+ export { installSkill };
5
5
  /**
6
6
  * Returns absolute path to bundled wthek-error-handling skill folder.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEpF,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,MAE/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAExC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,oBAGpC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEhE,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,MAE/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAExC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,oBAGpC,CAAC"}
package/dist/index.js CHANGED
@@ -33,11 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getPluginManifest = exports.getPluginManifestPath = exports.getSkillPath = exports.handlePostinstall = exports.installSkill = void 0;
36
+ exports.getPluginManifest = exports.getPluginManifestPath = exports.getSkillPath = exports.installSkill = void 0;
37
37
  var fs = __importStar(require("fs"));
38
38
  var installer_1 = require("./installer");
39
39
  Object.defineProperty(exports, "installSkill", { enumerable: true, get: function () { return installer_1.installSkill; } });
40
- Object.defineProperty(exports, "handlePostinstall", { enumerable: true, get: function () { return installer_1.handlePostinstall; } });
41
40
  /**
42
41
  * Returns absolute path to bundled wthek-error-handling skill folder.
43
42
  *
@@ -1,4 +1,4 @@
1
- import { IInstallOptions, IPostinstallResult } from "./types";
1
+ import { IInstallOptions } from "./types";
2
2
  /**
3
3
  * Path to package root directory.
4
4
  */
@@ -33,11 +33,4 @@ export declare const resolveTargetDir: (options?: IInstallOptions) => string;
33
33
  * @returns {string} Absolute path where skill files were installed.
34
34
  */
35
35
  export declare const installSkill: (options?: IInstallOptions) => string;
36
- /**
37
- * Executes postinstall script logic when installed as a package dependency.
38
- *
39
- * @param {string} [targetRoot] - Optional root directory override for testing or manual invocation.
40
- * @returns {IPostinstallResult} Result object indicating status, installed targets, or skip reason.
41
- */
42
- export declare const handlePostinstall: (targetRoot?: string) => IPostinstallResult;
43
36
  //# sourceMappingURL=installer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAsC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAI9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAA2C,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,IAiB5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,eAAe,KAAG,MAiB5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,eAAe,KAAG,MAexD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,kBAgCvD,CAAC"}
1
+ {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAsC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAI9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAA2C,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,IAiB5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,eAAe,KAAG,MAiB5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,eAAe,KAAG,MAexD,CAAC"}
package/dist/installer.js CHANGED
@@ -44,7 +44,7 @@ var __values = (this && this.__values) || function(o) {
44
44
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
45
45
  };
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.handlePostinstall = exports.installSkill = exports.resolveTargetDir = exports.copyDirRecursive = exports.SOURCE_PLUGIN_JSON = exports.SOURCE_SKILL_DIR = exports.PKG_ROOT = void 0;
47
+ exports.installSkill = exports.resolveTargetDir = exports.copyDirRecursive = exports.SOURCE_PLUGIN_JSON = exports.SOURCE_SKILL_DIR = exports.PKG_ROOT = void 0;
48
48
  var fs = __importStar(require("fs"));
49
49
  var path = __importStar(require("path"));
50
50
  var os = __importStar(require("os"));
@@ -137,41 +137,3 @@ var installSkill = function (options) {
137
137
  return targetDir;
138
138
  };
139
139
  exports.installSkill = installSkill;
140
- /**
141
- * Executes postinstall script logic when installed as a package dependency.
142
- *
143
- * @param {string} [targetRoot] - Optional root directory override for testing or manual invocation.
144
- * @returns {IPostinstallResult} Result object indicating status, installed targets, or skip reason.
145
- */
146
- var handlePostinstall = function (targetRoot) {
147
- var initCwd = targetRoot || process.env.INIT_CWD;
148
- if (!initCwd) {
149
- return {
150
- installed: false,
151
- targets: [],
152
- reason: "INIT_CWD environment variable is not defined",
153
- };
154
- }
155
- if (path.resolve(initCwd) === path.resolve(exports.PKG_ROOT)) {
156
- return {
157
- installed: false,
158
- targets: [],
159
- reason: "In-repo package development detected",
160
- };
161
- }
162
- var targets = [];
163
- var agentsTarget = path.join(initCwd, ".agents", "skills", "wthek-error-handling");
164
- (0, exports.copyDirRecursive)(exports.SOURCE_SKILL_DIR, agentsTarget);
165
- targets.push(agentsTarget);
166
- var githubDir = path.join(initCwd, ".github");
167
- if (fs.existsSync(githubDir)) {
168
- var githubSkillsTarget = path.join(githubDir, "skills", "wthek-error-handling");
169
- (0, exports.copyDirRecursive)(exports.SOURCE_SKILL_DIR, githubSkillsTarget);
170
- targets.push(githubSkillsTarget);
171
- }
172
- return {
173
- installed: true,
174
- targets: targets,
175
- };
176
- };
177
- exports.handlePostinstall = handlePostinstall;
package/dist/types.d.ts CHANGED
@@ -22,15 +22,4 @@ export interface IInstallOptions {
22
22
  github?: boolean;
23
23
  dest?: string;
24
24
  }
25
- /**
26
- * @typedef {Object} IPostinstallResult
27
- * @property {boolean} installed - Whether skill files were installed.
28
- * @property {string[]} targets - Target directory paths where skills were placed.
29
- * @property {string} [reason] - Reason description if postinstall was skipped.
30
- */
31
- export interface IPostinstallResult {
32
- installed: boolean;
33
- targets: string[];
34
- reason?: string;
35
- }
36
25
  //# sourceMappingURL=types.d.ts.map
@@ -1 +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;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wthek/error-handling",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
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
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,6 @@
22
22
  "build": "tsc --build",
23
23
  "test": "jest --config jest.config.ts",
24
24
  "coverage": "jest --coverage --config jest.config.ts",
25
- "postinstall": "node -e \"const fs = require('fs'); if (fs.existsSync('./dist/bin.js')) { require('child_process').spawnSync(process.execPath, ['./dist/bin.js', '--postinstall'], { stdio: 'inherit' }); }\"",
26
25
  "prepublishOnly": "npm run build && npm run test"
27
26
  },
28
27
  "files": [