{"id":42360,"library":"zhi-github-middleware","title":"zhi-github-middleware","description":"A middleware library for interacting with the GitHub API. Version 0.5.4 is the current stable release. It provides a CommonGithubClient class that wraps @octokit/core for common GitHub operations like fetching page tree nodes. The package includes TypeScript definitions and uses js-base64 for encoding. Release cadence is irregular. Key differentiator: simplifies GitHub API calls for blog workflows (e.g., Hexo) with a lightweight abstraction.","status":"active","version":"0.5.4","language":"javascript","source_language":"en","source_url":"https://github.com/terwer/zhi","tags":["javascript","zhi","lib","github","api","typescript"],"install":[{"cmd":"npm install zhi-github-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add zhi-github-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add zhi-github-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core GitHub API client for all requests","package":"@octokit/core","optional":false},{"reason":"Base64 encoding for file contents","package":"js-base64","optional":false}],"imports":[{"note":"The export is a named export, not default. CommonJS: const { CommonGithubClient } = require('zhi-github-middleware');","wrong":"import CommonGithubClient from 'zhi-github-middleware';","symbol":"CommonGithubClient","correct":"import { CommonGithubClient } from 'zhi-github-middleware';"},{"note":"Also a named export. In TypeScript, you may need to import the type separately if using isolatedModules.","wrong":"const GithubConfig = require('zhi-github-middleware').GithubConfig;","symbol":"GithubConfig","correct":"import { GithubConfig } from 'zhi-github-middleware';"},{"note":"IGithubConfig is a TypeScript interface, should be imported with `type` to avoid runtime errors.","wrong":"import { IGithubConfig } from 'zhi-github-middleware';","symbol":"IGithubConfig","correct":"import type { IGithubConfig } from 'zhi-github-middleware';"}],"quickstart":{"code":"import { CommonGithubClient, GithubConfig } from 'zhi-github-middleware';\n\nconst config = new GithubConfig('owner', 'repo', 'token');\nconst client = new CommonGithubClient(config);\n\nasync function main() {\n  const result = await client.getGithubPageTreeNode('path/to/file.md');\n  console.log(result);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Create a GithubConfig with owner, repo, and token, then instantiate CommonGithubClient to fetch a page tree node."},"warnings":[{"fix":"Pin to exact version and test before upgrading.","message":"Class names and API may change between patch versions without notice","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Always provide a valid GitHub token. For public repos, use a minimal token or PAT.","message":"Passing empty token string causes silent authentication failure","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check the changelog or use the latest method name.","message":"getGithubPageTreeNode might be renamed in future versions","severity":"deprecated","affected_versions":">=0.5.0"}],"env_vars":null,"search_vec":"'0.5.4':15 'abstract':68 'api':13,58,73 'base64':47 'blog':61 'cadenc':51 'call':59 'class':25 'common':30 'commongithubcli':24 'current':18 'definit':42 'differenti':55 'e.g':63 'encod':49 'fetch':34 'github':3,12,31,57,72 'hexo':64 'includ':40 'interact':9 'irregular':53 'javascript':69 'js':46 'js-base64':45 'key':54 'lib':71 'librari':7 'lightweight':67 'like':33 'middlewar':4,6 'node':37 'octokit/core':28 'oper':32 'packag':39 'page':35 'provid':22 'releas':20,50 'simplifi':56 'stabl':19 'tree':36 'typescript':41,74 'use':44 'version':14 'workflow':62 'wrap':27 'zhi':2,70 'zhi-github-middlewar':1","created_at":"2026-06-04T18:56:52.901974+00:00","updated_at":"2026-06-04T18:56:52.901974+00:00","problems":[{"fix":"Use import { GithubConfig } from 'zhi-github-middleware';","cause":"Importing GithubConfig as a default export instead of named export.","error":"TypeError: GithubConfig is not a constructor"},{"fix":"Ensure tsconfig.json has 'moduleResolution': 'node' and install the package with npm.","cause":"Missing TypeScript type declarations or incorrect module resolution.","error":"Cannot find module 'zhi-github-middleware' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/terwer/zhi/tree/main/libs/zhi-github-middleware","github":"https://github.com/terwer/zhi","docs":null,"changelog":null,"pypi":null,"npm":"zhi-github-middleware","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}