@hasna/instructions 0.5.6 → 0.6.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.
Files changed (230) hide show
  1. package/README.md +89 -21
  2. package/dist/chunks/apply-sfzja1f3.js +22 -0
  3. package/dist/chunks/apply-ynfn1av7.js +23 -0
  4. package/dist/chunks/index-1hpwskwd.js +12702 -0
  5. package/dist/chunks/index-35z65jsa.js +198 -0
  6. package/dist/chunks/index-85n5wnd8.js +625 -0
  7. package/dist/chunks/index-9p9gn7gh.js +627 -0
  8. package/dist/chunks/index-axhwg61p.js +523 -0
  9. package/dist/chunks/index-bsan4c16.js +48 -0
  10. package/dist/chunks/index-e9epbsvs.js +521 -0
  11. package/dist/chunks/index-ma2xmp6c.js +14 -0
  12. package/dist/chunks/index-nnwp92tk.js +19 -0
  13. package/dist/chunks/index-pkscjnj5.js +118 -0
  14. package/dist/chunks/index-v7dkb384.js +7248 -0
  15. package/dist/chunks/local-0d8qrc92.js +693 -0
  16. package/dist/chunks/local-a9nen65z.js +694 -0
  17. package/dist/chunks/package-manager-guard-x70xrwk2.js +391 -0
  18. package/dist/chunks/redact-hnq4sc4r.js +16 -0
  19. package/dist/chunks/sync-m46fc257.js +33 -0
  20. package/dist/chunks/sync-vy1yjvs6.js +34 -0
  21. package/dist/chunks/template-02wjvv05.js +16 -0
  22. package/dist/chunks/template-ke972qqe.js +16 -0
  23. package/dist/cli/index.js +775 -14212
  24. package/dist/data/config-store.d.ts +63 -34
  25. package/dist/data/config-store.d.ts.map +1 -1
  26. package/dist/db/database.d.ts +3 -5
  27. package/dist/db/database.d.ts.map +1 -1
  28. package/dist/db/local.d.ts +38 -0
  29. package/dist/db/local.d.ts.map +1 -0
  30. package/dist/generated/storage-kit/backend.d.ts +4 -4
  31. package/dist/generated/storage-kit/backend.d.ts.map +1 -1
  32. package/dist/generated/storage-kit/index.d.ts +1 -1
  33. package/dist/generated/storage-kit/index.d.ts.map +1 -1
  34. package/dist/generated/storage-kit/migrations.d.ts +21 -0
  35. package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
  36. package/dist/generated/storage-kit/pool.d.ts +2 -5
  37. package/dist/generated/storage-kit/pool.d.ts.map +1 -1
  38. package/dist/index.d.ts +6 -3
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +13030 -10744
  41. package/dist/lib/app-home.d.ts +9 -0
  42. package/dist/lib/app-home.d.ts.map +1 -1
  43. package/dist/lib/client-types.d.ts +130 -0
  44. package/dist/lib/client-types.d.ts.map +1 -0
  45. package/dist/lib/ids.d.ts +4 -0
  46. package/dist/lib/ids.d.ts.map +1 -0
  47. package/dist/lib/instruction-graph.d.ts.map +1 -1
  48. package/dist/lib/local-opt-in.d.ts +82 -0
  49. package/dist/lib/local-opt-in.d.ts.map +1 -0
  50. package/dist/lib/project-context.d.ts +14 -14
  51. package/dist/lib/project-context.d.ts.map +1 -1
  52. package/dist/lib/project-dashboard-standard.d.ts +1 -1
  53. package/dist/lib/project-dashboard-standard.d.ts.map +1 -1
  54. package/dist/lib/session-render-state.d.ts +9 -0
  55. package/dist/lib/session-render-state.d.ts.map +1 -1
  56. package/dist/lib/session-render.d.ts +3 -0
  57. package/dist/lib/session-render.d.ts.map +1 -1
  58. package/dist/lib/transport-resolver.d.ts +80 -0
  59. package/dist/lib/transport-resolver.d.ts.map +1 -0
  60. package/dist/mcp/index.d.ts.map +1 -1
  61. package/dist/mcp/index.js +76 -8232
  62. package/dist/mcp/server.d.ts.map +1 -1
  63. package/dist/sdk/index.d.ts +22 -0
  64. package/dist/sdk/index.d.ts.map +1 -0
  65. package/dist/sdk/index.js +1042 -0
  66. package/dist/sdk/resolve.d.ts +82 -0
  67. package/dist/sdk/resolve.d.ts.map +1 -0
  68. package/dist/sdk/v1.generated.d.ts +288 -0
  69. package/dist/sdk/v1.generated.d.ts.map +1 -0
  70. package/dist/server/cloud.d.ts.map +1 -1
  71. package/dist/server/index.d.ts.map +1 -1
  72. package/dist/server/index.js +7327 -7242
  73. package/dist/status.d.ts +12 -2
  74. package/dist/status.d.ts.map +1 -1
  75. package/package.json +20 -16
  76. package/dashboard/README.md +0 -37
  77. package/dist/cli/add-duplicate-target.test.d.ts +0 -2
  78. package/dist/cli/add-duplicate-target.test.d.ts.map +0 -1
  79. package/dist/cli/add-reference-update.test.d.ts +0 -2
  80. package/dist/cli/add-reference-update.test.d.ts.map +0 -1
  81. package/dist/cli/apply-unchanged-snapshot-bloat.test.d.ts +0 -2
  82. package/dist/cli/apply-unchanged-snapshot-bloat.test.d.ts.map +0 -1
  83. package/dist/cli/doctor-reference-duplicates.test.d.ts +0 -2
  84. package/dist/cli/doctor-reference-duplicates.test.d.ts.map +0 -1
  85. package/dist/cli/output.test.d.ts +0 -2
  86. package/dist/cli/output.test.d.ts.map +0 -1
  87. package/dist/cli/profile-binding.test.d.ts +0 -2
  88. package/dist/cli/profile-binding.test.d.ts.map +0 -1
  89. package/dist/cli/profile-reads.test.d.ts +0 -2
  90. package/dist/cli/profile-reads.test.d.ts.map +0 -1
  91. package/dist/cli/profile-update.test.d.ts +0 -2
  92. package/dist/cli/profile-update.test.d.ts.map +0 -1
  93. package/dist/cli/project-context.test.d.ts +0 -2
  94. package/dist/cli/project-context.test.d.ts.map +0 -1
  95. package/dist/cli/raw-store-root.test.d.ts +0 -2
  96. package/dist/cli/raw-store-root.test.d.ts.map +0 -1
  97. package/dist/cli/session-apply-managed-input-bound.test.d.ts +0 -2
  98. package/dist/cli/session-apply-managed-input-bound.test.d.ts.map +0 -1
  99. package/dist/cli/session.test.d.ts +0 -2
  100. package/dist/cli/session.test.d.ts.map +0 -1
  101. package/dist/cli/station-profile.test.d.ts +0 -2
  102. package/dist/cli/station-profile.test.d.ts.map +0 -1
  103. package/dist/data/config-store.test.d.ts +0 -2
  104. package/dist/data/config-store.test.d.ts.map +0 -1
  105. package/dist/db/configs.test.d.ts +0 -2
  106. package/dist/db/configs.test.d.ts.map +0 -1
  107. package/dist/db/database.test.d.ts +0 -2
  108. package/dist/db/database.test.d.ts.map +0 -1
  109. package/dist/db/machines.test.d.ts +0 -2
  110. package/dist/db/machines.test.d.ts.map +0 -1
  111. package/dist/db/profile-assets.test.d.ts +0 -2
  112. package/dist/db/profile-assets.test.d.ts.map +0 -1
  113. package/dist/db/profile-config-bindings.test.d.ts +0 -2
  114. package/dist/db/profile-config-bindings.test.d.ts.map +0 -1
  115. package/dist/db/profiles.test.d.ts +0 -2
  116. package/dist/db/profiles.test.d.ts.map +0 -1
  117. package/dist/db/snapshots.test.d.ts +0 -2
  118. package/dist/db/snapshots.test.d.ts.map +0 -1
  119. package/dist/lib/app-home.test.d.ts +0 -2
  120. package/dist/lib/app-home.test.d.ts.map +0 -1
  121. package/dist/lib/apply-batch.test.d.ts +0 -2
  122. package/dist/lib/apply-batch.test.d.ts.map +0 -1
  123. package/dist/lib/apply-dry-run-verdict.test.d.ts +0 -2
  124. package/dist/lib/apply-dry-run-verdict.test.d.ts.map +0 -1
  125. package/dist/lib/apply-secret-placeholder-guard.test.d.ts +0 -2
  126. package/dist/lib/apply-secret-placeholder-guard.test.d.ts.map +0 -1
  127. package/dist/lib/apply-text-format-credential-guard.test.d.ts +0 -2
  128. package/dist/lib/apply-text-format-credential-guard.test.d.ts.map +0 -1
  129. package/dist/lib/apply.test.d.ts +0 -2
  130. package/dist/lib/apply.test.d.ts.map +0 -1
  131. package/dist/lib/asset-plan.test.d.ts +0 -2
  132. package/dist/lib/asset-plan.test.d.ts.map +0 -1
  133. package/dist/lib/codewith-shared-todos-storage-standard.test.d.ts +0 -2
  134. package/dist/lib/codewith-shared-todos-storage-standard.test.d.ts.map +0 -1
  135. package/dist/lib/compact-output.test.d.ts +0 -2
  136. package/dist/lib/compact-output.test.d.ts.map +0 -1
  137. package/dist/lib/config-target-identity.test.d.ts +0 -2
  138. package/dist/lib/config-target-identity.test.d.ts.map +0 -1
  139. package/dist/lib/cursor-authority.test.d.ts +0 -2
  140. package/dist/lib/cursor-authority.test.d.ts.map +0 -1
  141. package/dist/lib/dangerous-operation-guard-standard.test.d.ts +0 -2
  142. package/dist/lib/dangerous-operation-guard-standard.test.d.ts.map +0 -1
  143. package/dist/lib/diff-redaction.test.d.ts +0 -2
  144. package/dist/lib/diff-redaction.test.d.ts.map +0 -1
  145. package/dist/lib/export-import.test.d.ts +0 -2
  146. package/dist/lib/export-import.test.d.ts.map +0 -1
  147. package/dist/lib/global-agent-rules-render-integration.test.d.ts +0 -2
  148. package/dist/lib/global-agent-rules-render-integration.test.d.ts.map +0 -1
  149. package/dist/lib/global-agent-rules-standard.test.d.ts +0 -2
  150. package/dist/lib/global-agent-rules-standard.test.d.ts.map +0 -1
  151. package/dist/lib/global-agent-rules-stored-content.test.d.ts +0 -2
  152. package/dist/lib/global-agent-rules-stored-content.test.d.ts.map +0 -1
  153. package/dist/lib/global-source-coverage.test.d.ts +0 -2
  154. package/dist/lib/global-source-coverage.test.d.ts.map +0 -1
  155. package/dist/lib/instruction-graph-apply.test.d.ts +0 -2
  156. package/dist/lib/instruction-graph-apply.test.d.ts.map +0 -1
  157. package/dist/lib/instruction-graph.test.d.ts +0 -2
  158. package/dist/lib/instruction-graph.test.d.ts.map +0 -1
  159. package/dist/lib/machine.test.d.ts +0 -2
  160. package/dist/lib/machine.test.d.ts.map +0 -1
  161. package/dist/lib/managed-skill-runtimes.test.d.ts +0 -2
  162. package/dist/lib/managed-skill-runtimes.test.d.ts.map +0 -1
  163. package/dist/lib/package-manager-guard.test.d.ts +0 -2
  164. package/dist/lib/package-manager-guard.test.d.ts.map +0 -1
  165. package/dist/lib/project-context-prepared-file.test.d.ts +0 -2
  166. package/dist/lib/project-context-prepared-file.test.d.ts.map +0 -1
  167. package/dist/lib/project-context.test.d.ts +0 -2
  168. package/dist/lib/project-context.test.d.ts.map +0 -1
  169. package/dist/lib/project-dashboard-standard.test.d.ts +0 -2
  170. package/dist/lib/project-dashboard-standard.test.d.ts.map +0 -1
  171. package/dist/lib/provider-assets-adapters.test.d.ts +0 -2
  172. package/dist/lib/provider-assets-adapters.test.d.ts.map +0 -1
  173. package/dist/lib/provider-context.test.d.ts +0 -2
  174. package/dist/lib/provider-context.test.d.ts.map +0 -1
  175. package/dist/lib/provider-version-adapters.test.d.ts +0 -2
  176. package/dist/lib/provider-version-adapters.test.d.ts.map +0 -1
  177. package/dist/lib/redact.test.d.ts +0 -2
  178. package/dist/lib/redact.test.d.ts.map +0 -1
  179. package/dist/lib/retired-storage-mode.d.ts +0 -8
  180. package/dist/lib/retired-storage-mode.d.ts.map +0 -1
  181. package/dist/lib/session-apply.test.d.ts +0 -2
  182. package/dist/lib/session-apply.test.d.ts.map +0 -1
  183. package/dist/lib/session-authority.test.d.ts +0 -2
  184. package/dist/lib/session-authority.test.d.ts.map +0 -1
  185. package/dist/lib/session-render-managed-output-bound.test.d.ts +0 -2
  186. package/dist/lib/session-render-managed-output-bound.test.d.ts.map +0 -1
  187. package/dist/lib/session-render-ownership.test.d.ts +0 -2
  188. package/dist/lib/session-render-ownership.test.d.ts.map +0 -1
  189. package/dist/lib/session-render-rule-currency-floor.test.d.ts +0 -2
  190. package/dist/lib/session-render-rule-currency-floor.test.d.ts.map +0 -1
  191. package/dist/lib/session-render-silent-source-drop.test.d.ts +0 -2
  192. package/dist/lib/session-render-silent-source-drop.test.d.ts.map +0 -1
  193. package/dist/lib/session-render-state.test.d.ts +0 -2
  194. package/dist/lib/session-render-state.test.d.ts.map +0 -1
  195. package/dist/lib/session-render.test.d.ts +0 -2
  196. package/dist/lib/session-render.test.d.ts.map +0 -1
  197. package/dist/lib/station-profile.test.d.ts +0 -2
  198. package/dist/lib/station-profile.test.d.ts.map +0 -1
  199. package/dist/lib/sync-dir.test.d.ts +0 -2
  200. package/dist/lib/sync-dir.test.d.ts.map +0 -1
  201. package/dist/lib/sync-dry-run-unchanged.test.d.ts +0 -2
  202. package/dist/lib/sync-dry-run-unchanged.test.d.ts.map +0 -1
  203. package/dist/lib/sync-known.test.d.ts +0 -2
  204. package/dist/lib/sync-known.test.d.ts.map +0 -1
  205. package/dist/lib/sync.test.d.ts +0 -2
  206. package/dist/lib/sync.test.d.ts.map +0 -1
  207. package/dist/lib/template.test.d.ts +0 -2
  208. package/dist/lib/template.test.d.ts.map +0 -1
  209. package/dist/lib/transforms.test.d.ts +0 -2
  210. package/dist/lib/transforms.test.d.ts.map +0 -1
  211. package/dist/mcp/create-config-target-guard.test.d.ts +0 -2
  212. package/dist/mcp/create-config-target-guard.test.d.ts.map +0 -1
  213. package/dist/mcp/early-args.test.d.ts +0 -2
  214. package/dist/mcp/early-args.test.d.ts.map +0 -1
  215. package/dist/mcp/http.test.d.ts +0 -2
  216. package/dist/mcp/http.test.d.ts.map +0 -1
  217. package/dist/mcp/mcp.test.d.ts +0 -2
  218. package/dist/mcp/mcp.test.d.ts.map +0 -1
  219. package/dist/server/cloud-auth.test.d.ts +0 -2
  220. package/dist/server/cloud-auth.test.d.ts.map +0 -1
  221. package/dist/server/cloud.test.d.ts +0 -2
  222. package/dist/server/cloud.test.d.ts.map +0 -1
  223. package/dist/server/early-args.test.d.ts +0 -2
  224. package/dist/server/early-args.test.d.ts.map +0 -1
  225. package/dist/server/profile-contract.test.d.ts +0 -2
  226. package/dist/server/profile-contract.test.d.ts.map +0 -1
  227. package/dist/status.test.d.ts +0 -2
  228. package/dist/status.test.d.ts.map +0 -1
  229. package/dist/storage/cloud-store.test.d.ts +0 -2
  230. package/dist/storage/cloud-store.test.d.ts.map +0 -1
@@ -0,0 +1,391 @@
1
+ // @bun
2
+ import"./index-bsan4c16.js";
3
+
4
+ // src/lib/package-manager-guard.ts
5
+ import { execFileSync } from "child_process";
6
+ import { existsSync, lstatSync, readdirSync, readFileSync } from "fs";
7
+ import { homedir } from "os";
8
+ import { basename, dirname, isAbsolute, join, relative, resolve } from "path";
9
+ var SKIP_DIRS = new Set([
10
+ ".git",
11
+ "node_modules",
12
+ "dist",
13
+ "build",
14
+ "coverage",
15
+ ".next",
16
+ ".turbo",
17
+ ".cache"
18
+ ]);
19
+ var LOCKFILE_NAMES = new Set([
20
+ "bun.lock",
21
+ "package-lock.json",
22
+ "npm-shrinkwrap.json",
23
+ "pnpm-lock.yaml",
24
+ "yarn.lock"
25
+ ]);
26
+ var HOME_FILES = [
27
+ ".npmrc",
28
+ ".bunfig.toml",
29
+ "bunfig.toml",
30
+ ".bashrc",
31
+ ".bash_profile",
32
+ ".zshrc",
33
+ ".zprofile",
34
+ ".profile"
35
+ ];
36
+ var TOKEN_VALUE_PATTERNS = [
37
+ { re: /npm_[A-Za-z0-9]{36,}/, rule: "literal-npm-token", detail: "literal npm token-like value" },
38
+ { re: /gh[pousr]_[A-Za-z0-9_]{36,}/, rule: "literal-github-token", detail: "literal GitHub token-like value" },
39
+ { re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, rule: "literal-anthropic-key", detail: "literal Anthropic key-like value" },
40
+ { re: /sk-[A-Za-z0-9]{48,}/, rule: "literal-openai-key", detail: "literal OpenAI key-like value" },
41
+ { re: /AKIA[0-9A-Z]{16}/, rule: "literal-aws-access-key", detail: "literal AWS access-key-like value" },
42
+ { re: /xoxb-[0-9]+-[A-Za-z0-9-]+/, rule: "literal-slack-token", detail: "literal Slack token-like value" }
43
+ ];
44
+ function scanPackageManagerSecrets(options = {}) {
45
+ const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
46
+ const roots = (options.roots && options.roots.length > 0 ? options.roots : [cwd]).map((root) => resolve(cwd, root));
47
+ const findings = [];
48
+ let scannedFiles = 0;
49
+ for (const root of roots) {
50
+ if (!existsSync(root))
51
+ continue;
52
+ const stat = lstatSync(root);
53
+ if (stat.isFile()) {
54
+ if (!shouldScanRepoFile(root))
55
+ continue;
56
+ const text = readTextFile(root);
57
+ if (text === null)
58
+ continue;
59
+ scannedFiles++;
60
+ findings.push(...scanFile(root, text, classifyRepoFile(root), isTrackedFile(root), dirname(root)));
61
+ continue;
62
+ }
63
+ if (!stat.isDirectory())
64
+ continue;
65
+ const tracked = trackedFiles(root);
66
+ for (const file of collectRepoFiles(root)) {
67
+ const rel = toPosix(relative(root, file));
68
+ const isTracked = tracked.has(rel);
69
+ const text = readTextFile(file);
70
+ if (text === null)
71
+ continue;
72
+ scannedFiles++;
73
+ findings.push(...scanFile(file, text, classifyRepoFile(file), isTracked, root));
74
+ }
75
+ }
76
+ if (options.includeHome) {
77
+ const home = homedir();
78
+ for (const name of HOME_FILES) {
79
+ const file = join(home, name);
80
+ if (!existsSync(file))
81
+ continue;
82
+ const text = readTextFile(file);
83
+ if (text === null)
84
+ continue;
85
+ scannedFiles++;
86
+ findings.push(...scanFile(file, text, classifyHomeFile(name), false, home));
87
+ }
88
+ }
89
+ findings.sort((a, b) => a.path.localeCompare(b.path) || a.line - b.line || a.rule.localeCompare(b.rule));
90
+ return {
91
+ clean: findings.length === 0,
92
+ scannedFiles,
93
+ scannedRoots: roots,
94
+ findings
95
+ };
96
+ }
97
+ function collectRepoFiles(root) {
98
+ const out = [];
99
+ const visit = (dir) => {
100
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
101
+ if (entry.isDirectory()) {
102
+ if (SKIP_DIRS.has(entry.name))
103
+ continue;
104
+ visit(join(dir, entry.name));
105
+ continue;
106
+ }
107
+ if (!entry.isFile())
108
+ continue;
109
+ const file = join(dir, entry.name);
110
+ if (shouldScanRepoFile(file))
111
+ out.push(file);
112
+ }
113
+ };
114
+ visit(root);
115
+ return out;
116
+ }
117
+ function shouldScanRepoFile(file) {
118
+ const name = basename(file);
119
+ return isNpmrcName(name) || isBunConfigName(name) || LOCKFILE_NAMES.has(name);
120
+ }
121
+ function classifyRepoFile(file) {
122
+ const name = basename(file);
123
+ if (isNpmrcName(name))
124
+ return "repo-npmrc";
125
+ if (isBunConfigName(name))
126
+ return "bun-config";
127
+ return "lockfile";
128
+ }
129
+ function classifyHomeFile(name) {
130
+ if (name === ".npmrc")
131
+ return "home-npmrc";
132
+ if (isBunConfigName(name))
133
+ return "bun-config";
134
+ return "shell-profile";
135
+ }
136
+ function isBunConfigName(name) {
137
+ return name === "bunfig.toml" || name === ".bunfig.toml";
138
+ }
139
+ function isNpmrcName(name) {
140
+ return name === ".npmrc" || name.startsWith(".npmrc.") || name.endsWith(".npmrc");
141
+ }
142
+ function readTextFile(file) {
143
+ try {
144
+ const stat = lstatSync(file);
145
+ if (!stat.isFile() || stat.size > 5000000)
146
+ return null;
147
+ const buf = readFileSync(file);
148
+ if (buf.includes(0))
149
+ return null;
150
+ return buf.toString("utf-8");
151
+ } catch {
152
+ return null;
153
+ }
154
+ }
155
+ function scanFile(file, text, surface, tracked, root) {
156
+ const findings = [];
157
+ const path = displayPath(file, root);
158
+ if (surface === "bun-config")
159
+ return scanBunConfigFile(text, path, tracked);
160
+ const lines = text.split(/\r?\n/);
161
+ for (let i = 0;i < lines.length; i++) {
162
+ const line = lines[i];
163
+ const lineNo = i + 1;
164
+ if (surface === "repo-npmrc" || surface === "home-npmrc") {
165
+ findings.push(...scanNpmrcLine(line, path, lineNo, surface, tracked));
166
+ } else if (surface === "shell-profile") {
167
+ findings.push(...scanShellProfileLine(line, path, lineNo, tracked));
168
+ } else {
169
+ findings.push(...scanLockfileLine(line, path, lineNo, tracked));
170
+ }
171
+ }
172
+ return findings;
173
+ }
174
+ function scanNpmrcLine(lineText, path, line, surface, tracked) {
175
+ const findings = [];
176
+ const stripped = lineText.trim();
177
+ if (stripped === "" || stripped.startsWith("#") || stripped.startsWith(";"))
178
+ return findings;
179
+ const auth = stripped.match(/(?:^|:)(_[A-Za-z]*(?:auth|password)[A-Za-z]*|password)\s*=\s*(.+)$/i);
180
+ if (auth) {
181
+ const value = stripQuotes(stripInlineComment(auth[2].trim()));
182
+ if (value && !isSafeReference(value)) {
183
+ findings.push({
184
+ path,
185
+ line,
186
+ rule: "npmrc-literal-auth",
187
+ surface,
188
+ severity: "error",
189
+ tracked,
190
+ detail: tracked ? "tracked npm auth entry uses a literal value" : "npm auth entry uses a literal value"
191
+ });
192
+ }
193
+ }
194
+ findings.push(...scanCredentialedUrl(stripped, path, line, surface, tracked));
195
+ findings.push(...scanKnownTokenPatterns(stripped, path, line, surface, tracked));
196
+ return findings;
197
+ }
198
+ function scanBunConfigFile(text, path, tracked) {
199
+ const findings = [];
200
+ const lines = text.split(/\r?\n/);
201
+ let inReleaseAgeExcludes = false;
202
+ let hasMinimumReleaseAge = false;
203
+ for (let i = 0;i < lines.length; i++) {
204
+ const lineText = lines[i];
205
+ const line = i + 1;
206
+ const stripped = lineText.trim();
207
+ if (stripped === "" || stripped.startsWith("#"))
208
+ continue;
209
+ const releaseAge = stripped.match(/^minimumReleaseAge\s*=\s*(?:"([^"]+)"|'([^']+)'|([0-9]+))\s*(?:#.*)?$/i);
210
+ if (releaseAge) {
211
+ hasMinimumReleaseAge = true;
212
+ const rawValue = releaseAge[1] ?? releaseAge[2] ?? releaseAge[3] ?? "";
213
+ const value = Number(rawValue);
214
+ if (!Number.isFinite(value) || value <= 0) {
215
+ findings.push({
216
+ path,
217
+ line,
218
+ rule: "bun-release-age-disabled",
219
+ surface: "bun-config",
220
+ severity: "error",
221
+ tracked,
222
+ detail: "Bun release-age quarantine is disabled"
223
+ });
224
+ }
225
+ }
226
+ const startsReleaseAgeExcludes = /minimumReleaseAgeExcludes/i.test(stripped);
227
+ const scanExcludes = startsReleaseAgeExcludes || inReleaseAgeExcludes;
228
+ if (scanExcludes) {
229
+ const quoted = [...stripped.matchAll(/["']([^"']+)["']/g)].map((m) => m[1]);
230
+ for (const item of quoted) {
231
+ if (!isExactHasnaPackageName(item)) {
232
+ findings.push({
233
+ path,
234
+ line,
235
+ rule: "bun-release-age-broad-exclude",
236
+ surface: "bun-config",
237
+ severity: "error",
238
+ tracked,
239
+ detail: "Bun release-age exclude must be an exact @hasna package name"
240
+ });
241
+ }
242
+ }
243
+ }
244
+ inReleaseAgeExcludes = startsReleaseAgeExcludes ? stripped.includes("[") && !stripped.includes("]") : inReleaseAgeExcludes && !stripped.includes("]");
245
+ findings.push(...scanKnownTokenPatterns(stripped, path, line, "bun-config", tracked));
246
+ }
247
+ if (!hasMinimumReleaseAge) {
248
+ findings.push({
249
+ path,
250
+ line: 1,
251
+ rule: "bun-release-age-missing",
252
+ surface: "bun-config",
253
+ severity: "error",
254
+ tracked,
255
+ detail: "Bun release-age quarantine must be configured with a positive minimumReleaseAge"
256
+ });
257
+ }
258
+ return findings;
259
+ }
260
+ function scanShellProfileLine(lineText, path, line, tracked) {
261
+ const findings = [];
262
+ const stripped = lineText.trim();
263
+ if (stripped === "" || stripped.startsWith("#"))
264
+ return findings;
265
+ const assignment = stripped.match(/^(?:export\s+)?(NPM(?:_CONFIG)?_[A-Z0-9_]*TOKEN|NODE_AUTH_TOKEN|NPM_TOKEN)\s*=\s*(.+)$/);
266
+ if (assignment) {
267
+ const value = stripQuotes(stripInlineComment(assignment[2].trim()));
268
+ if (value && !isSafeReference(value)) {
269
+ findings.push({
270
+ path,
271
+ line,
272
+ rule: "shell-literal-package-token",
273
+ surface: "shell-profile",
274
+ severity: "error",
275
+ tracked,
276
+ detail: "shell profile package-manager token uses a literal value"
277
+ });
278
+ }
279
+ }
280
+ findings.push(...scanKnownTokenPatterns(stripped, path, line, "shell-profile", tracked));
281
+ return findings;
282
+ }
283
+ function scanLockfileLine(lineText, path, line, tracked) {
284
+ const findings = scanKnownTokenPatterns(lineText, path, line, "lockfile", tracked);
285
+ if (/(?:^|:)_authToken\s*=\s*/i.test(lineText) && !/\$\{[A-Z0-9_]+\}|\{\{[A-Z0-9_]+\}\}/.test(lineText)) {
286
+ findings.push({
287
+ path,
288
+ line,
289
+ rule: "lockfile-auth-token",
290
+ surface: "lockfile",
291
+ severity: "error",
292
+ tracked,
293
+ detail: "lockfile contains package-manager auth token material"
294
+ });
295
+ }
296
+ return findings;
297
+ }
298
+ function scanKnownTokenPatterns(lineText, path, line, surface, tracked) {
299
+ const findings = [];
300
+ for (const pattern of TOKEN_VALUE_PATTERNS) {
301
+ if (pattern.re.test(lineText)) {
302
+ findings.push({
303
+ path,
304
+ line,
305
+ rule: pattern.rule,
306
+ surface,
307
+ severity: "error",
308
+ tracked,
309
+ detail: pattern.detail
310
+ });
311
+ }
312
+ }
313
+ return findings;
314
+ }
315
+ function scanCredentialedUrl(lineText, path, line, surface, tracked) {
316
+ const findings = [];
317
+ for (const match of lineText.matchAll(/\bhttps?:\/\/([^/\s#;]+)@/gi)) {
318
+ const userInfo = match[1];
319
+ const credentialPart = userInfo.includes(":") ? userInfo.split(":").slice(1).join(":") : userInfo;
320
+ if (credentialPart && !isSafeReference(credentialPart)) {
321
+ findings.push({
322
+ path,
323
+ line,
324
+ rule: "package-manager-url-credentials",
325
+ surface,
326
+ severity: "error",
327
+ tracked,
328
+ detail: "package-manager URL embeds literal credentials"
329
+ });
330
+ }
331
+ }
332
+ return findings;
333
+ }
334
+ function trackedFiles(root) {
335
+ try {
336
+ const output = execFileSync("git", ["-C", root, "ls-files", "-z"], {
337
+ encoding: "utf-8",
338
+ stdio: ["ignore", "pipe", "ignore"]
339
+ });
340
+ return new Set(output.split("\x00").filter(Boolean).map(toPosix));
341
+ } catch {
342
+ return new Set;
343
+ }
344
+ }
345
+ function isTrackedFile(file) {
346
+ try {
347
+ const repoRoot = execFileSync("git", ["-C", dirname(file), "rev-parse", "--show-toplevel"], {
348
+ encoding: "utf-8",
349
+ stdio: ["ignore", "pipe", "ignore"]
350
+ }).trim();
351
+ const rel = toPosix(relative(repoRoot, file));
352
+ execFileSync("git", ["-C", repoRoot, "ls-files", "--error-unmatch", "--", rel], {
353
+ stdio: ["ignore", "ignore", "ignore"]
354
+ });
355
+ return true;
356
+ } catch {
357
+ return false;
358
+ }
359
+ }
360
+ function isExactHasnaPackageName(item) {
361
+ return /^@hasna\/[a-z0-9][a-z0-9._-]*$/.test(item);
362
+ }
363
+ function isSafeReference(value) {
364
+ const trimmed = stripQuotes(value.trim());
365
+ return /^\$\{[A-Z][A-Z0-9_]*\}$/.test(trimmed) || /^\$[A-Z][A-Z0-9_]*$/.test(trimmed) || /^\{\{[A-Z][A-Z0-9_]*\}\}$/.test(trimmed) || /^%[A-Z][A-Z0-9_]*%$/.test(trimmed);
366
+ }
367
+ function stripQuotes(value) {
368
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
369
+ return value.slice(1, -1);
370
+ }
371
+ return value;
372
+ }
373
+ function stripInlineComment(value) {
374
+ return value.replace(/\s[#;].*$/, "").trim();
375
+ }
376
+ function displayPath(file, root) {
377
+ const home = homedir();
378
+ if (root === home && (file === home || file.startsWith(home + "/")))
379
+ return "~/" + toPosix(relative(home, file));
380
+ if (isAbsolute(root) && file.startsWith(root + "/"))
381
+ return toPosix(relative(root, file));
382
+ if (file === home || file.startsWith(home + "/"))
383
+ return "~/" + toPosix(relative(home, file));
384
+ return file;
385
+ }
386
+ function toPosix(path) {
387
+ return path.split("\\").join("/");
388
+ }
389
+ export {
390
+ scanPackageManagerSecrets
391
+ };
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ hasSecrets,
4
+ isSecretVarName,
5
+ redactContent,
6
+ redactFormatForTarget,
7
+ scanSecrets
8
+ } from "./index-35z65jsa.js";
9
+ import"./index-nnwp92tk.js";
10
+ export {
11
+ scanSecrets,
12
+ redactFormatForTarget,
13
+ redactContent,
14
+ isSecretVarName,
15
+ hasSecrets
16
+ };
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ import {
3
+ CLAUDE_PROMPT_OUTPUTS,
4
+ KNOWN_CONFIGS,
5
+ PROJECT_CONFIG_FILES,
6
+ detectAgent,
7
+ detectCategory,
8
+ detectFormat,
9
+ diffConfig,
10
+ syncFromDir,
11
+ syncKnown,
12
+ syncProject,
13
+ syncToDir,
14
+ syncToDisk
15
+ } from "./index-85n5wnd8.js";
16
+ import"./index-e9epbsvs.js";
17
+ import"./index-1hpwskwd.js";
18
+ import"./index-pkscjnj5.js";
19
+ import"./index-bsan4c16.js";
20
+ export {
21
+ syncToDisk,
22
+ syncToDir,
23
+ syncProject,
24
+ syncKnown,
25
+ syncFromDir,
26
+ diffConfig,
27
+ detectFormat,
28
+ detectCategory,
29
+ detectAgent,
30
+ PROJECT_CONFIG_FILES,
31
+ KNOWN_CONFIGS,
32
+ CLAUDE_PROMPT_OUTPUTS
33
+ };
@@ -0,0 +1,34 @@
1
+ // @bun
2
+ import {
3
+ CLAUDE_PROMPT_OUTPUTS,
4
+ KNOWN_CONFIGS,
5
+ PROJECT_CONFIG_FILES,
6
+ detectAgent,
7
+ detectCategory,
8
+ detectFormat,
9
+ diffConfig,
10
+ syncFromDir,
11
+ syncKnown,
12
+ syncProject,
13
+ syncToDir,
14
+ syncToDisk
15
+ } from "./index-9p9gn7gh.js";
16
+ import"./index-axhwg61p.js";
17
+ import"./index-v7dkb384.js";
18
+ import"./index-35z65jsa.js";
19
+ import"./index-pkscjnj5.js";
20
+ import"./index-nnwp92tk.js";
21
+ export {
22
+ syncToDisk,
23
+ syncToDir,
24
+ syncProject,
25
+ syncKnown,
26
+ syncFromDir,
27
+ diffConfig,
28
+ detectFormat,
29
+ detectCategory,
30
+ detectAgent,
31
+ PROJECT_CONFIG_FILES,
32
+ KNOWN_CONFIGS,
33
+ CLAUDE_PROMPT_OUTPUTS
34
+ };
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ extractTemplateVars,
4
+ isTemplate,
5
+ parseTemplateVars,
6
+ renderTemplate,
7
+ renderTemplatePreview
8
+ } from "./index-pkscjnj5.js";
9
+ import"./index-nnwp92tk.js";
10
+ export {
11
+ renderTemplatePreview,
12
+ renderTemplate,
13
+ parseTemplateVars,
14
+ isTemplate,
15
+ extractTemplateVars
16
+ };
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ extractTemplateVars,
4
+ isTemplate,
5
+ parseTemplateVars,
6
+ renderTemplate,
7
+ renderTemplatePreview
8
+ } from "./index-pkscjnj5.js";
9
+ import"./index-bsan4c16.js";
10
+ export {
11
+ renderTemplatePreview,
12
+ renderTemplate,
13
+ parseTemplateVars,
14
+ isTemplate,
15
+ extractTemplateVars
16
+ };