@hasna/instructions 0.3.0 → 0.3.1

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.
@@ -8137,7 +8137,7 @@ var require_dist = __commonJS((exports, module) => {
8137
8137
  var require_package = __commonJS((exports, module) => {
8138
8138
  module.exports = {
8139
8139
  name: "@hasna/instructions",
8140
- version: "0.3.0",
8140
+ version: "0.3.1",
8141
8141
  description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
8142
8142
  type: "module",
8143
8143
  main: "dist/index.js",
@@ -8213,7 +8213,7 @@ var require_package = __commonJS((exports, module) => {
8213
8213
  author: "Andrei Hasna <andrei@hasna.com>",
8214
8214
  license: "Apache-2.0",
8215
8215
  dependencies: {
8216
- "@hasna/contracts": "^0.4.1",
8216
+ "@hasna/contracts": "0.4.2",
8217
8217
  "@hasna/events": "^0.1.6",
8218
8218
  "@modelcontextprotocol/sdk": "^1.12.1",
8219
8219
  chalk: "^5.4.1",
@@ -8233,7 +8233,7 @@ var require_package = __commonJS((exports, module) => {
8233
8233
  };
8234
8234
  });
8235
8235
 
8236
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/compose.js
8236
+ // node_modules/hono/dist/compose.js
8237
8237
  var compose = (middleware, onError, onNotFound) => {
8238
8238
  return (context, next) => {
8239
8239
  let index = -1;
@@ -8277,10 +8277,10 @@ var compose = (middleware, onError, onNotFound) => {
8277
8277
  };
8278
8278
  };
8279
8279
 
8280
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/request/constants.js
8280
+ // node_modules/hono/dist/request/constants.js
8281
8281
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
8282
8282
 
8283
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/body.js
8283
+ // node_modules/hono/dist/utils/body.js
8284
8284
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
8285
8285
  const { all = false, dot = false } = options;
8286
8286
  const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
@@ -8351,7 +8351,7 @@ var handleParsingNestedValues = (form, key, value) => {
8351
8351
  });
8352
8352
  };
8353
8353
 
8354
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/url.js
8354
+ // node_modules/hono/dist/utils/url.js
8355
8355
  var splitPath = (path) => {
8356
8356
  const paths = path.split("/");
8357
8357
  if (paths[0] === "") {
@@ -8551,7 +8551,7 @@ var getQueryParams = (url, key) => {
8551
8551
  };
8552
8552
  var decodeURIComponent_ = decodeURIComponent;
8553
8553
 
8554
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/request.js
8554
+ // node_modules/hono/dist/request.js
8555
8555
  var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
8556
8556
  var HonoRequest = class {
8557
8557
  raw;
@@ -8633,9 +8633,6 @@ var HonoRequest = class {
8633
8633
  arrayBuffer() {
8634
8634
  return this.#cachedBody("arrayBuffer");
8635
8635
  }
8636
- bytes() {
8637
- return this.#cachedBody("arrayBuffer").then((buffer) => new Uint8Array(buffer));
8638
- }
8639
8636
  blob() {
8640
8637
  return this.#cachedBody("blob");
8641
8638
  }
@@ -8665,7 +8662,7 @@ var HonoRequest = class {
8665
8662
  }
8666
8663
  };
8667
8664
 
8668
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/html.js
8665
+ // node_modules/hono/dist/utils/html.js
8669
8666
  var HtmlEscapedCallbackPhase = {
8670
8667
  Stringify: 1,
8671
8668
  BeforeStream: 2,
@@ -8703,7 +8700,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
8703
8700
  }
8704
8701
  };
8705
8702
 
8706
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/context.js
8703
+ // node_modules/hono/dist/context.js
8707
8704
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
8708
8705
  var setDefaultContentType = (contentType, headers) => {
8709
8706
  return {
@@ -8870,7 +8867,7 @@ var Context = class {
8870
8867
  };
8871
8868
  };
8872
8869
 
8873
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router.js
8870
+ // node_modules/hono/dist/router.js
8874
8871
  var METHOD_NAME_ALL = "ALL";
8875
8872
  var METHOD_NAME_ALL_LOWERCASE = "all";
8876
8873
  var METHODS = ["get", "post", "put", "delete", "options", "patch"];
@@ -8878,10 +8875,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
8878
8875
  var UnsupportedPathError = class extends Error {
8879
8876
  };
8880
8877
 
8881
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/constants.js
8878
+ // node_modules/hono/dist/utils/constants.js
8882
8879
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
8883
8880
 
8884
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/hono-base.js
8881
+ // node_modules/hono/dist/hono-base.js
8885
8882
  var notFoundHandler = (c) => {
8886
8883
  return c.text("404 Not Found", 404);
8887
8884
  };
@@ -8972,7 +8969,7 @@ var Hono = class _Hono {
8972
8969
  handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;
8973
8970
  handler[COMPOSED_HANDLER] = r.handler;
8974
8971
  }
8975
- subApp.#addRoute(r.method, r.path, handler, r.basePath);
8972
+ subApp.#addRoute(r.method, r.path, handler);
8976
8973
  });
8977
8974
  return this;
8978
8975
  }
@@ -9019,7 +9016,7 @@ var Hono = class _Hono {
9019
9016
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
9020
9017
  return (request) => {
9021
9018
  const url = new URL(request.url);
9022
- url.pathname = this.getPath(request).slice(pathPrefixLength) || "/";
9019
+ url.pathname = url.pathname.slice(pathPrefixLength) || "/";
9023
9020
  return new Request(url, request);
9024
9021
  };
9025
9022
  })();
@@ -9033,15 +9030,10 @@ var Hono = class _Hono {
9033
9030
  this.#addRoute(METHOD_NAME_ALL, mergePath(path, "*"), handler);
9034
9031
  return this;
9035
9032
  }
9036
- #addRoute(method, path, handler, baseRoutePath) {
9033
+ #addRoute(method, path, handler) {
9037
9034
  method = method.toUpperCase();
9038
9035
  path = mergePath(this._basePath, path);
9039
- const r = {
9040
- basePath: baseRoutePath !== undefined ? mergePath(this._basePath, baseRoutePath) : this._basePath,
9041
- path,
9042
- method,
9043
- handler
9044
- };
9036
+ const r = { basePath: this._basePath, path, method, handler };
9045
9037
  this.router.add(method, path, [handler, r]);
9046
9038
  this.routes.push(r);
9047
9039
  }
@@ -9105,7 +9097,7 @@ var Hono = class _Hono {
9105
9097
  };
9106
9098
  };
9107
9099
 
9108
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/matcher.js
9100
+ // node_modules/hono/dist/router/reg-exp-router/matcher.js
9109
9101
  var emptyParam = [];
9110
9102
  function match(method, path) {
9111
9103
  const matchers = this.buildAllMatchers();
@@ -9126,7 +9118,7 @@ function match(method, path) {
9126
9118
  return match2(method, path);
9127
9119
  }
9128
9120
 
9129
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/node.js
9121
+ // node_modules/hono/dist/router/reg-exp-router/node.js
9130
9122
  var LABEL_REG_EXP_STR = "[^/]+";
9131
9123
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
9132
9124
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -9230,7 +9222,7 @@ var Node = class _Node {
9230
9222
  }
9231
9223
  };
9232
9224
 
9233
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/trie.js
9225
+ // node_modules/hono/dist/router/reg-exp-router/trie.js
9234
9226
  var Trie = class {
9235
9227
  #context = { varIndex: 0 };
9236
9228
  #root = new Node;
@@ -9286,7 +9278,7 @@ var Trie = class {
9286
9278
  }
9287
9279
  };
9288
9280
 
9289
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/router.js
9281
+ // node_modules/hono/dist/router/reg-exp-router/router.js
9290
9282
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
9291
9283
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
9292
9284
  function buildWildcardRegExp(path) {
@@ -9451,7 +9443,7 @@ var RegExpRouter = class {
9451
9443
  }
9452
9444
  };
9453
9445
 
9454
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
9446
+ // node_modules/hono/dist/router/reg-exp-router/prepared-router.js
9455
9447
  var PreparedRegExpRouter = class {
9456
9448
  name = "PreparedRegExpRouter";
9457
9449
  #matchers;
@@ -9523,7 +9515,7 @@ var PreparedRegExpRouter = class {
9523
9515
  match = match;
9524
9516
  };
9525
9517
 
9526
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/smart-router/router.js
9518
+ // node_modules/hono/dist/router/smart-router/router.js
9527
9519
  var SmartRouter = class {
9528
9520
  name = "SmartRouter";
9529
9521
  #routers = [];
@@ -9578,7 +9570,7 @@ var SmartRouter = class {
9578
9570
  }
9579
9571
  };
9580
9572
 
9581
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/trie-router/node.js
9573
+ // node_modules/hono/dist/router/trie-router/node.js
9582
9574
  var emptyParams = /* @__PURE__ */ Object.create(null);
9583
9575
  var hasChildren = (children) => {
9584
9576
  for (const _ in children) {
@@ -9747,7 +9739,7 @@ var Node2 = class _Node2 {
9747
9739
  }
9748
9740
  };
9749
9741
 
9750
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/trie-router/router.js
9742
+ // node_modules/hono/dist/router/trie-router/router.js
9751
9743
  var TrieRouter = class {
9752
9744
  name = "TrieRouter";
9753
9745
  #node;
@@ -9769,7 +9761,7 @@ var TrieRouter = class {
9769
9761
  }
9770
9762
  };
9771
9763
 
9772
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/hono.js
9764
+ // node_modules/hono/dist/hono.js
9773
9765
  var Hono2 = class extends Hono {
9774
9766
  constructor(options = {}) {
9775
9767
  super(options);
@@ -9779,18 +9771,24 @@ var Hono2 = class extends Hono {
9779
9771
  }
9780
9772
  };
9781
9773
 
9782
- // node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/middleware/cors/index.js
9774
+ // node_modules/hono/dist/middleware/cors/index.js
9783
9775
  var cors = (options) => {
9784
- const opts = {
9776
+ const defaults = {
9785
9777
  origin: "*",
9786
9778
  allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"],
9787
9779
  allowHeaders: [],
9788
- exposeHeaders: [],
9780
+ exposeHeaders: []
9781
+ };
9782
+ const opts = {
9783
+ ...defaults,
9789
9784
  ...options
9790
9785
  };
9791
9786
  const findAllowOrigin = ((optsOrigin) => {
9792
9787
  if (typeof optsOrigin === "string") {
9793
9788
  if (optsOrigin === "*") {
9789
+ if (opts.credentials) {
9790
+ return (origin) => origin || null;
9791
+ }
9794
9792
  return () => optsOrigin;
9795
9793
  } else {
9796
9794
  return (origin) => optsOrigin === origin ? origin : null;
@@ -9825,7 +9823,7 @@ var cors = (options) => {
9825
9823
  set("Access-Control-Expose-Headers", opts.exposeHeaders.join(","));
9826
9824
  }
9827
9825
  if (c.req.method === "OPTIONS") {
9828
- if (opts.origin !== "*") {
9826
+ if (opts.origin !== "*" || opts.credentials) {
9829
9827
  set("Vary", "Origin");
9830
9828
  }
9831
9829
  if (opts.maxAge != null) {
@@ -9855,7 +9853,7 @@ var cors = (options) => {
9855
9853
  });
9856
9854
  }
9857
9855
  await next();
9858
- if (opts.origin !== "*") {
9856
+ if (opts.origin !== "*" || opts.credentials) {
9859
9857
  c.header("Vary", "Origin", { append: true });
9860
9858
  }
9861
9859
  };
@@ -17364,7 +17362,7 @@ function getPackageVersion() {
17364
17362
  // src/server/v1.ts
17365
17363
  init_types();
17366
17364
 
17367
- // node_modules/.pnpm/@hasna+contracts@0.4.1/node_modules/@hasna/contracts/dist/auth/index.js
17365
+ // node_modules/@hasna/contracts/dist/auth/index.js
17368
17366
  import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
17369
17367
  var API_KEY_TOKEN_VERSION = 1;
17370
17368
  var API_KEY_NAMESPACE = "hasna";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "AI coding agent instruction & configuration manager — store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -76,7 +76,7 @@
76
76
  "author": "Andrei Hasna <andrei@hasna.com>",
77
77
  "license": "Apache-2.0",
78
78
  "dependencies": {
79
- "@hasna/contracts": "^0.4.1",
79
+ "@hasna/contracts": "0.4.2",
80
80
  "@hasna/events": "^0.1.6",
81
81
  "@modelcontextprotocol/sdk": "^1.12.1",
82
82
  "chalk": "^5.4.1",