@hasna/instructions 0.4.15 → 0.4.16

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 CHANGED
@@ -7529,6 +7529,14 @@ function reasonFor(key, value) {
7529
7529
  function isReferenceValue(value) {
7530
7530
  return /^\{\{[A-Z][A-Z0-9_]*\}\}$/.test(value) || /^\$\{[A-Z][A-Z0-9_]*\}$/.test(value) || /^\$[A-Z][A-Z0-9_]*$/.test(value) || /^%[A-Z][A-Z0-9_]*%$/.test(value);
7531
7531
  }
7532
+ function redactFormatForTarget(targetPath, storedFormat) {
7533
+ const p = targetPath.toLowerCase();
7534
+ if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
7535
+ return "shell";
7536
+ if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
7537
+ return "ini";
7538
+ return storedFormat;
7539
+ }
7532
7540
  function redactContent(content, format) {
7533
7541
  switch (format) {
7534
7542
  case "shell":
@@ -11633,7 +11641,7 @@ function wouldDestroyACredential(targetPath, renderedContent, format) {
11633
11641
  }
11634
11642
  if (current === renderedContent)
11635
11643
  return [];
11636
- if (scanSecrets(current, format).length > 0)
11644
+ if (scanSecrets(current, redactFormatForTarget(targetPath, format)).length > 0)
11637
11645
  return secretTokens;
11638
11646
  return secretTokens.filter((name) => countPlaceholder(current, name) < countPlaceholder(renderedContent, name));
11639
11647
  }
@@ -12354,14 +12362,6 @@ function redactionPlaceholders(storedLine) {
12354
12362
  }
12355
12363
  return found;
12356
12364
  }
12357
- function redactFormatForTarget(targetPath, storedFormat) {
12358
- const p = targetPath.toLowerCase();
12359
- if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
12360
- return "shell";
12361
- if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
12362
- return "ini";
12363
- return storedFormat;
12364
- }
12365
12365
  function storedPlaceholderIsLiteralOnDisk(storedLine, diskLine) {
12366
12366
  return redactionPlaceholders(storedLine).some((p) => !diskLine.includes(p));
12367
12367
  }
package/dist/index.js CHANGED
@@ -5494,6 +5494,14 @@ function reasonFor(key, value) {
5494
5494
  function isReferenceValue(value) {
5495
5495
  return /^\{\{[A-Z][A-Z0-9_]*\}\}$/.test(value) || /^\$\{[A-Z][A-Z0-9_]*\}$/.test(value) || /^\$[A-Z][A-Z0-9_]*$/.test(value) || /^%[A-Z][A-Z0-9_]*%$/.test(value);
5496
5496
  }
5497
+ function redactFormatForTarget(targetPath, storedFormat) {
5498
+ const p = targetPath.toLowerCase();
5499
+ if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
5500
+ return "shell";
5501
+ if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
5502
+ return "ini";
5503
+ return storedFormat;
5504
+ }
5497
5505
  function redactContent(content, format) {
5498
5506
  switch (format) {
5499
5507
  case "shell":
@@ -9650,7 +9658,7 @@ function wouldDestroyACredential(targetPath, renderedContent, format) {
9650
9658
  }
9651
9659
  if (current === renderedContent)
9652
9660
  return [];
9653
- if (scanSecrets(current, format).length > 0)
9661
+ if (scanSecrets(current, redactFormatForTarget(targetPath, format)).length > 0)
9654
9662
  return secretTokens;
9655
9663
  return secretTokens.filter((name) => countPlaceholder(current, name) < countPlaceholder(renderedContent, name));
9656
9664
  }
@@ -11749,14 +11757,6 @@ function redactionPlaceholders(storedLine) {
11749
11757
  }
11750
11758
  return found;
11751
11759
  }
11752
- function redactFormatForTarget(targetPath, storedFormat) {
11753
- const p = targetPath.toLowerCase();
11754
- if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
11755
- return "shell";
11756
- if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
11757
- return "ini";
11758
- return storedFormat;
11759
- }
11760
11760
  function storedPlaceholderIsLiteralOnDisk(storedLine, diskLine) {
11761
11761
  return redactionPlaceholders(storedLine).some((p) => !diskLine.includes(p));
11762
11762
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apply-text-format-credential-guard.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-text-format-credential-guard.test.d.ts","sourceRoot":"","sources":["../../src/lib/apply-text-format-credential-guard.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/lib/apply.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAA8B,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,OAAO,EAGL,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAM7B,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK5C;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBrD;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,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AAkB,CAAC,CAiC7B;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,GAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAM,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAE7B"}
@@ -21,6 +21,30 @@ export interface RedactedVar {
21
21
  reason: string;
22
22
  }
23
23
  export type RedactFormat = "shell" | "json" | "toml" | "ini" | "markdown" | "text" | "yaml";
24
+ /**
25
+ * Pick the redaction dialect for the file actually being read, from its PATH.
26
+ *
27
+ * `ConfigFormat` — what a stored row declares — is
28
+ * `text | json | toml | yaml | markdown | ini` and has NO `shell` member, while
29
+ * `RedactFormat` does. `detectFormat` returns `text` for any extensionless path,
30
+ * so `~/.zshrc`, `~/.bashrc` and `~/.npmrc` are all stored as `text`, and `text`
31
+ * routes to `redactGeneric` — which matches token SHAPES only and never key
32
+ * names. A credential whose key is secret-class but whose value has no
33
+ * recognisable shape is therefore invisible on exactly the files most likely to
34
+ * hold one.
35
+ *
36
+ * Resolving the dialect from the path closes that. It is deliberately
37
+ * PATH-KEYED rather than a widening of `ConfigFormat`: `.md` still resolves to
38
+ * `markdown`, so a rules file documenting `NPM_TOKEN=...` in prose is not
39
+ * mistaken for a shell assignment and frozen from ever shipping an edit.
40
+ *
41
+ * Exported so every caller that must choose a dialect shares ONE definition.
42
+ * Two surfaces need it and they must not drift: `diff`, the last read before a
43
+ * value reaches a transcript, and the `apply` guard, the last check before a
44
+ * value is overwritten. A per-surface copy is how one of them silently keeps the
45
+ * gap (todos e4d9c22e).
46
+ */
47
+ export declare function redactFormatForTarget(targetPath: string, storedFormat: RedactFormat): RedactFormat;
24
48
  export declare function redactContent(content: string, format: RedactFormat): RedactResult;
25
49
  /** Detect secrets without modifying content. Returns list of findings. */
26
50
  export declare function scanSecrets(content: string, format: RedactFormat): RedactedVar[];
@@ -1 +1 @@
1
- {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"m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,6 +5166,7 @@ var init_zod = __esm(() => {
5166
5166
  var exports_redact = {};
5167
5167
  __export(exports_redact, {
5168
5168
  scanSecrets: () => scanSecrets,
5169
+ redactFormatForTarget: () => redactFormatForTarget,
5169
5170
  redactContent: () => redactContent,
5170
5171
  isSecretVarName: () => isSecretVarName,
5171
5172
  hasSecrets: () => hasSecrets
@@ -5320,6 +5321,14 @@ function reasonFor(key, value) {
5320
5321
  function isReferenceValue(value) {
5321
5322
  return /^\{\{[A-Z][A-Z0-9_]*\}\}$/.test(value) || /^\$\{[A-Z][A-Z0-9_]*\}$/.test(value) || /^\$[A-Z][A-Z0-9_]*$/.test(value) || /^%[A-Z][A-Z0-9_]*%$/.test(value);
5322
5323
  }
5324
+ function redactFormatForTarget(targetPath, storedFormat) {
5325
+ const p = targetPath.toLowerCase();
5326
+ if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
5327
+ return "shell";
5328
+ if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
5329
+ return "ini";
5330
+ return storedFormat;
5331
+ }
5323
5332
  function redactContent(content, format) {
5324
5333
  switch (format) {
5325
5334
  case "shell":
@@ -5950,7 +5959,7 @@ function wouldDestroyACredential(targetPath, renderedContent, format) {
5950
5959
  }
5951
5960
  if (current === renderedContent)
5952
5961
  return [];
5953
- if (scanSecrets(current, format).length > 0)
5962
+ if (scanSecrets(current, redactFormatForTarget(targetPath, format)).length > 0)
5954
5963
  return secretTokens;
5955
5964
  return secretTokens.filter((name) => countPlaceholder(current, name) < countPlaceholder(renderedContent, name));
5956
5965
  }
@@ -6581,14 +6590,6 @@ function redactionPlaceholders(storedLine) {
6581
6590
  }
6582
6591
  return found;
6583
6592
  }
6584
- function redactFormatForTarget(targetPath, storedFormat) {
6585
- const p = targetPath.toLowerCase();
6586
- if (/(^|\/)\.(zshrc|zprofile|bashrc|bash_profile|profile|zshenv|env)$/.test(p) || p.endsWith(".env"))
6587
- return "shell";
6588
- if (/(^|\/)\.(npmrc|yarnrc|curlrc|netrc)$/.test(p))
6589
- return "ini";
6590
- return storedFormat;
6591
- }
6592
6593
  function storedPlaceholderIsLiteralOnDisk(storedLine, diskLine) {
6593
6594
  return redactionPlaceholders(storedLine).some((p) => !diskLine.includes(p));
6594
6595
  }
@@ -6908,7 +6909,7 @@ var init_sync_dir = __esm(() => {
6908
6909
  var require_package = __commonJS((exports, module) => {
6909
6910
  module.exports = {
6910
6911
  name: "@hasna/instructions",
6911
- version: "0.4.15",
6912
+ version: "0.4.16",
6912
6913
  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.",
6913
6914
  type: "module",
6914
6915
  main: "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
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",