@hasna/instructions 0.4.34 → 0.4.36

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
@@ -62,7 +62,7 @@ envelope. Its top-level fields are `configs`, `profiles`, `drift`, `secrets`,
62
62
 
63
63
  `instructions package-manager-scan` blocks package-manager credential ingress without
64
64
  printing credential values. It scans repo `.npmrc` files, home `.npmrc`, Bun
65
- config, lockfiles, and shell profiles, then reports only path, line, rule,
65
+ config, lockfiles, and shell profiles, then reports only the path, line, rule,
66
66
  surface, and tracked status.
67
67
 
68
68
  Use it in CI or pre-commit hooks:
package/dist/cli/index.js CHANGED
@@ -10563,15 +10563,11 @@ function sha2564(content) {
10563
10563
  function homeDir() {
10564
10564
  return process.env["HOME"] || homedir3();
10565
10565
  }
10566
- function markerPayload(content, markerLine) {
10567
- const withTrailingNewline = `${markerLine}
10568
- `;
10569
- if (content.startsWith(withTrailingNewline))
10570
- return content.slice(withTrailingNewline.length);
10571
- if (content.startsWith(markerLine))
10572
- return content.slice(markerLine.length).replace(/^\n/, "");
10573
- return content.replace(`${markerLine}
10574
- `, "").replace(markerLine, "");
10566
+ function markerPayload(content, markerLine, markerIndex) {
10567
+ const index = markerIndex ?? content.indexOf(markerLine);
10568
+ if (index < 0)
10569
+ return content;
10570
+ return content.slice(0, index) + content.slice(index + markerLine.length).replace(/^\n/, "");
10575
10571
  }
10576
10572
  function baseObservation(path) {
10577
10573
  return {
@@ -10698,7 +10694,7 @@ function observeCursorGlobalAuthorityPath(authorityPath, readFile2) {
10698
10694
  };
10699
10695
  }
10700
10696
  const markerLine = markerMatch[0];
10701
- const payloadSha256 = sha2564(markerPayload(content, markerLine));
10697
+ const payloadSha256 = sha2564(markerPayload(content, markerLine, markerMatch.index ?? -1));
10702
10698
  if (payloadSha256 !== markerSha256) {
10703
10699
  return {
10704
10700
  ...base,
package/dist/index.js CHANGED
@@ -8520,15 +8520,11 @@ function sha2564(content) {
8520
8520
  function homeDir() {
8521
8521
  return process.env["HOME"] || homedir2();
8522
8522
  }
8523
- function markerPayload(content, markerLine) {
8524
- const withTrailingNewline = `${markerLine}
8525
- `;
8526
- if (content.startsWith(withTrailingNewline))
8527
- return content.slice(withTrailingNewline.length);
8528
- if (content.startsWith(markerLine))
8529
- return content.slice(markerLine.length).replace(/^\n/, "");
8530
- return content.replace(`${markerLine}
8531
- `, "").replace(markerLine, "");
8523
+ function markerPayload(content, markerLine, markerIndex) {
8524
+ const index = markerIndex ?? content.indexOf(markerLine);
8525
+ if (index < 0)
8526
+ return content;
8527
+ return content.slice(0, index) + content.slice(index + markerLine.length).replace(/^\n/, "");
8532
8528
  }
8533
8529
  function baseObservation(path) {
8534
8530
  return {
@@ -8655,7 +8651,7 @@ function observeCursorGlobalAuthorityPath(authorityPath, readFile) {
8655
8651
  };
8656
8652
  }
8657
8653
  const markerLine = markerMatch[0];
8658
- const payloadSha256 = sha2564(markerPayload(content, markerLine));
8654
+ const payloadSha256 = sha2564(markerPayload(content, markerLine, markerMatch.index ?? -1));
8659
8655
  if (payloadSha256 !== markerSha256) {
8660
8656
  return {
8661
8657
  ...base,
@@ -40,6 +40,16 @@ export interface CursorAuthorityObservationOptions {
40
40
  home?: string;
41
41
  readFile?: (path: string) => string;
42
42
  }
43
+ /**
44
+ * Reconstruct the pre-stamp payload from a stamped file: the content with the
45
+ * marker line removed at its actual position, together with the single
46
+ * trailing newline the stamp writes after the marker. `markerIndex` is the
47
+ * position of the matched marker line (its `RegExpMatchArray.index`); the
48
+ * observer passes it so a marker quoted elsewhere in the content cannot shift
49
+ * the removal. `markerIndex` defaults to the first occurrence for standalone
50
+ * use.
51
+ */
52
+ export declare function markerPayload(content: string, markerLine: string, markerIndex?: number): string;
43
53
  /**
44
54
  * Cursor reads this fixed global rule before project-scoped `.cursor/rules`
45
55
  * files. The session renderer owns only the project-scoped files, so an
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-authority.d.ts","sourceRoot":"","sources":["../../src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;CACrC;AAUD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAI/F;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,iCAAsC,GAC9C,0BAA0B,CAI5B;AAED,wBAAgB,kCAAkC,CAChD,aAAa,EAAE,MAAM,GACpB,0BAA0B,CAK5B;AAoKD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASxE;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,6BAAiC,GAC3C,uBAAuB,EAAE,CAsB3B"}
package/dist/mcp/index.js CHANGED
@@ -7977,7 +7977,7 @@ var init_sync_dir = __esm(() => {
7977
7977
  var require_package = __commonJS((exports, module) => {
7978
7978
  module.exports = {
7979
7979
  name: "@hasna/instructions",
7980
- version: "0.4.34",
7980
+ version: "0.4.36",
7981
7981
  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.",
7982
7982
  type: "module",
7983
7983
  main: "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "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.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",