@hasna/instructions 0.5.2 → 0.5.3
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/dist/cli/index.js +12 -2
- package/dist/index.js +12 -2
- package/dist/lib/cursor-authority.d.ts +11 -2
- package/dist/lib/cursor-authority.d.ts.map +1 -1
- package/dist/mcp/index.js +19 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -10828,8 +10828,18 @@ function isCursorGlobalAuthorityPath(path) {
|
|
|
10828
10828
|
return resolve4(path) === resolve4(join6(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
|
|
10829
10829
|
}
|
|
10830
10830
|
function stampCursorGlobalAuthorityMarker(content) {
|
|
10831
|
-
|
|
10832
|
-
|
|
10831
|
+
const existing = content.match(CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN);
|
|
10832
|
+
if (existing) {
|
|
10833
|
+
const markerLine2 = existing[0];
|
|
10834
|
+
const index = existing.index ?? content.indexOf(markerLine2);
|
|
10835
|
+
const payload = markerPayload(content, markerLine2, index);
|
|
10836
|
+
if (sha2564(payload) === existing[1].slice("sha256:".length)) {
|
|
10837
|
+
return content;
|
|
10838
|
+
}
|
|
10839
|
+
const digest2 = sha2564(payload);
|
|
10840
|
+
const freshMarkerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest2} -->`;
|
|
10841
|
+
return content.slice(0, index) + freshMarkerLine + content.slice(index + markerLine2.length);
|
|
10842
|
+
}
|
|
10833
10843
|
const digest = sha2564(content);
|
|
10834
10844
|
const markerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest} -->`;
|
|
10835
10845
|
const frontmatter = content.match(CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN)?.[0];
|
package/dist/index.js
CHANGED
|
@@ -8773,8 +8773,18 @@ function isCursorGlobalAuthorityPath(path) {
|
|
|
8773
8773
|
return resolve4(path) === resolve4(join5(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
|
|
8774
8774
|
}
|
|
8775
8775
|
function stampCursorGlobalAuthorityMarker(content) {
|
|
8776
|
-
|
|
8777
|
-
|
|
8776
|
+
const existing = content.match(CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN);
|
|
8777
|
+
if (existing) {
|
|
8778
|
+
const markerLine2 = existing[0];
|
|
8779
|
+
const index = existing.index ?? content.indexOf(markerLine2);
|
|
8780
|
+
const payload = markerPayload(content, markerLine2, index);
|
|
8781
|
+
if (sha2564(payload) === existing[1].slice("sha256:".length)) {
|
|
8782
|
+
return content;
|
|
8783
|
+
}
|
|
8784
|
+
const digest2 = sha2564(payload);
|
|
8785
|
+
const freshMarkerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest2} -->`;
|
|
8786
|
+
return content.slice(0, index) + freshMarkerLine + content.slice(index + markerLine2.length);
|
|
8787
|
+
}
|
|
8778
8788
|
const digest = sha2564(content);
|
|
8779
8789
|
const markerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest} -->`;
|
|
8780
8790
|
const frontmatter = content.match(CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN)?.[0];
|
|
@@ -79,8 +79,17 @@ export declare function isCursorGlobalAuthorityPath(path: string): boolean;
|
|
|
79
79
|
* opens with a `---` frontmatter block is stamped AFTER the closing `---`,
|
|
80
80
|
* matching how the package's own session-render cursor files place their
|
|
81
81
|
* managed marker; plain content without frontmatter is stamped at the top.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
82
|
+
*
|
|
83
|
+
* Idempotency is hash-correctness-based, not presence-based: content whose
|
|
84
|
+
* existing marker's hash still matches its current payload is returned
|
|
85
|
+
* unchanged (re-apply no-op), while content carrying a STALE marker — the
|
|
86
|
+
* payload changed after stamping, e.g. a template re-render that expanded
|
|
87
|
+
* {{VAR}} placeholders — is re-stamped in place with the hash of the current
|
|
88
|
+
* payload. Presence-based idempotency propagated an invalid stamp forever:
|
|
89
|
+
* the observer recomputed the payload hash, reported
|
|
90
|
+
* marker-integrity-mismatch, and every re-apply reproduced the same invalid
|
|
91
|
+
* file, leaving the cursor project render blocked with no repair path
|
|
92
|
+
* (H-00154, station01 ~/.cursor/rules/hasna-global.mdc).
|
|
84
93
|
*/
|
|
85
94
|
export declare function stampCursorGlobalAuthorityMarker(content: string): string;
|
|
86
95
|
export declare function detectCursorAuthorityConflicts(observation?: CursorAuthorityObservation): CursorAuthorityConflict[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-authority.d.ts","sourceRoot":"","sources":["../../src/lib/cursor-authority.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qCAAqC,mCAAmC,CAAC;AACtF,eAAO,MAAM,iCAAiC,QAAa,CAAC;AAC5D,eAAO,MAAM,sCAAsC,sDAAsD,CAAC;AAQ1G,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAChG,MAAM,MAAM,gCAAgC,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAC9F,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,gBAAgB,GAChB,iBAAiB,GACjB,2BAA2B,GAC3B,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,OAAO,qCAAqC,CAAC;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,uBAAuB,CAAC;IAClC,MAAM,EAAE,gCAAgC,CAAC;IACzC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,I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E,2BAA2B,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY,CAAC;QACrB,SAAS,EAAE,WAAW,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,OAAO,CAAC,wBAAwB,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC;KAC5E,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoBxE;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,6BAAiC,GAC3C,uBAAuB,EAAE,CAsB3B"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -5709,12 +5709,28 @@ function sha256(content) {
|
|
|
5709
5709
|
function homeDir() {
|
|
5710
5710
|
return process.env["HOME"] || homedir3();
|
|
5711
5711
|
}
|
|
5712
|
+
function markerPayload(content, markerLine, markerIndex) {
|
|
5713
|
+
const index = markerIndex ?? content.indexOf(markerLine);
|
|
5714
|
+
if (index < 0)
|
|
5715
|
+
return content;
|
|
5716
|
+
return content.slice(0, index) + content.slice(index + markerLine.length).replace(/^\n/, "");
|
|
5717
|
+
}
|
|
5712
5718
|
function isCursorGlobalAuthorityPath(path) {
|
|
5713
5719
|
return resolve3(path) === resolve3(join6(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
|
|
5714
5720
|
}
|
|
5715
5721
|
function stampCursorGlobalAuthorityMarker(content) {
|
|
5716
|
-
|
|
5717
|
-
|
|
5722
|
+
const existing = content.match(CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN);
|
|
5723
|
+
if (existing) {
|
|
5724
|
+
const markerLine2 = existing[0];
|
|
5725
|
+
const index = existing.index ?? content.indexOf(markerLine2);
|
|
5726
|
+
const payload = markerPayload(content, markerLine2, index);
|
|
5727
|
+
if (sha256(payload) === existing[1].slice("sha256:".length)) {
|
|
5728
|
+
return content;
|
|
5729
|
+
}
|
|
5730
|
+
const digest2 = sha256(payload);
|
|
5731
|
+
const freshMarkerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest2} -->`;
|
|
5732
|
+
return content.slice(0, index) + freshMarkerLine + content.slice(index + markerLine2.length);
|
|
5733
|
+
}
|
|
5718
5734
|
const digest = sha256(content);
|
|
5719
5735
|
const markerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest} -->`;
|
|
5720
5736
|
const frontmatter = content.match(CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN)?.[0];
|
|
@@ -8062,7 +8078,7 @@ var init_sync_dir = __esm(() => {
|
|
|
8062
8078
|
var require_package = __commonJS((exports, module) => {
|
|
8063
8079
|
module.exports = {
|
|
8064
8080
|
name: "@hasna/instructions",
|
|
8065
|
-
version: "0.5.
|
|
8081
|
+
version: "0.5.3",
|
|
8066
8082
|
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.",
|
|
8067
8083
|
type: "module",
|
|
8068
8084
|
main: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/instructions",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
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",
|