guardlink 1.0.0

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 (172) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +344 -0
  4. package/dist/agents/config.d.ts +46 -0
  5. package/dist/agents/config.d.ts.map +1 -0
  6. package/dist/agents/config.js +189 -0
  7. package/dist/agents/config.js.map +1 -0
  8. package/dist/agents/index.d.ts +24 -0
  9. package/dist/agents/index.d.ts.map +1 -0
  10. package/dist/agents/index.js +42 -0
  11. package/dist/agents/index.js.map +1 -0
  12. package/dist/agents/launcher.d.ts +54 -0
  13. package/dist/agents/launcher.d.ts.map +1 -0
  14. package/dist/agents/launcher.js +152 -0
  15. package/dist/agents/launcher.js.map +1 -0
  16. package/dist/agents/prompts.d.ts +14 -0
  17. package/dist/agents/prompts.d.ts.map +1 -0
  18. package/dist/agents/prompts.js +120 -0
  19. package/dist/agents/prompts.js.map +1 -0
  20. package/dist/analyze/index.d.ts +80 -0
  21. package/dist/analyze/index.d.ts.map +1 -0
  22. package/dist/analyze/index.js +306 -0
  23. package/dist/analyze/index.js.map +1 -0
  24. package/dist/analyze/llm.d.ts +52 -0
  25. package/dist/analyze/llm.d.ts.map +1 -0
  26. package/dist/analyze/llm.js +295 -0
  27. package/dist/analyze/llm.js.map +1 -0
  28. package/dist/analyze/prompts.d.ts +14 -0
  29. package/dist/analyze/prompts.d.ts.map +1 -0
  30. package/dist/analyze/prompts.js +205 -0
  31. package/dist/analyze/prompts.js.map +1 -0
  32. package/dist/analyzer/index.d.ts +5 -0
  33. package/dist/analyzer/index.d.ts.map +1 -0
  34. package/dist/analyzer/index.js +5 -0
  35. package/dist/analyzer/index.js.map +1 -0
  36. package/dist/analyzer/sarif.d.ts +84 -0
  37. package/dist/analyzer/sarif.d.ts.map +1 -0
  38. package/dist/analyzer/sarif.js +149 -0
  39. package/dist/analyzer/sarif.js.map +1 -0
  40. package/dist/cli/index.d.ts +25 -0
  41. package/dist/cli/index.d.ts.map +1 -0
  42. package/dist/cli/index.js +821 -0
  43. package/dist/cli/index.js.map +1 -0
  44. package/dist/dashboard/data.d.ts +52 -0
  45. package/dist/dashboard/data.d.ts.map +1 -0
  46. package/dist/dashboard/data.js +93 -0
  47. package/dist/dashboard/data.js.map +1 -0
  48. package/dist/dashboard/diagrams.d.ts +25 -0
  49. package/dist/dashboard/diagrams.d.ts.map +1 -0
  50. package/dist/dashboard/diagrams.js +243 -0
  51. package/dist/dashboard/diagrams.js.map +1 -0
  52. package/dist/dashboard/generate.d.ts +17 -0
  53. package/dist/dashboard/generate.d.ts.map +1 -0
  54. package/dist/dashboard/generate.js +1258 -0
  55. package/dist/dashboard/generate.js.map +1 -0
  56. package/dist/dashboard/index.d.ts +7 -0
  57. package/dist/dashboard/index.d.ts.map +1 -0
  58. package/dist/dashboard/index.js +7 -0
  59. package/dist/dashboard/index.js.map +1 -0
  60. package/dist/diff/engine.d.ts +51 -0
  61. package/dist/diff/engine.d.ts.map +1 -0
  62. package/dist/diff/engine.js +153 -0
  63. package/dist/diff/engine.js.map +1 -0
  64. package/dist/diff/format.d.ts +10 -0
  65. package/dist/diff/format.d.ts.map +1 -0
  66. package/dist/diff/format.js +111 -0
  67. package/dist/diff/format.js.map +1 -0
  68. package/dist/diff/git.d.ts +24 -0
  69. package/dist/diff/git.d.ts.map +1 -0
  70. package/dist/diff/git.js +85 -0
  71. package/dist/diff/git.js.map +1 -0
  72. package/dist/diff/index.d.ts +7 -0
  73. package/dist/diff/index.d.ts.map +1 -0
  74. package/dist/diff/index.js +7 -0
  75. package/dist/diff/index.js.map +1 -0
  76. package/dist/index.d.ts +20 -0
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +17 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/init/detect.d.ts +42 -0
  81. package/dist/init/detect.d.ts.map +1 -0
  82. package/dist/init/detect.js +185 -0
  83. package/dist/init/detect.js.map +1 -0
  84. package/dist/init/index.d.ts +39 -0
  85. package/dist/init/index.d.ts.map +1 -0
  86. package/dist/init/index.js +228 -0
  87. package/dist/init/index.js.map +1 -0
  88. package/dist/init/picker.d.ts +32 -0
  89. package/dist/init/picker.d.ts.map +1 -0
  90. package/dist/init/picker.js +105 -0
  91. package/dist/init/picker.js.map +1 -0
  92. package/dist/init/templates.d.ts +25 -0
  93. package/dist/init/templates.d.ts.map +1 -0
  94. package/dist/init/templates.js +263 -0
  95. package/dist/init/templates.js.map +1 -0
  96. package/dist/mcp/index.d.ts +12 -0
  97. package/dist/mcp/index.d.ts.map +1 -0
  98. package/dist/mcp/index.js +18 -0
  99. package/dist/mcp/index.js.map +1 -0
  100. package/dist/mcp/lookup.d.ts +27 -0
  101. package/dist/mcp/lookup.d.ts.map +1 -0
  102. package/dist/mcp/lookup.js +282 -0
  103. package/dist/mcp/lookup.js.map +1 -0
  104. package/dist/mcp/server.d.ts +41 -0
  105. package/dist/mcp/server.d.ts.map +1 -0
  106. package/dist/mcp/server.js +388 -0
  107. package/dist/mcp/server.js.map +1 -0
  108. package/dist/mcp/suggest.d.ts +35 -0
  109. package/dist/mcp/suggest.d.ts.map +1 -0
  110. package/dist/mcp/suggest.js +268 -0
  111. package/dist/mcp/suggest.js.map +1 -0
  112. package/dist/parser/comment-strip.d.ts +15 -0
  113. package/dist/parser/comment-strip.d.ts.map +1 -0
  114. package/dist/parser/comment-strip.js +76 -0
  115. package/dist/parser/comment-strip.js.map +1 -0
  116. package/dist/parser/index.d.ts +10 -0
  117. package/dist/parser/index.d.ts.map +1 -0
  118. package/dist/parser/index.js +9 -0
  119. package/dist/parser/index.js.map +1 -0
  120. package/dist/parser/normalize.d.ts +22 -0
  121. package/dist/parser/normalize.d.ts.map +1 -0
  122. package/dist/parser/normalize.js +42 -0
  123. package/dist/parser/normalize.js.map +1 -0
  124. package/dist/parser/parse-file.d.ts +18 -0
  125. package/dist/parser/parse-file.d.ts.map +1 -0
  126. package/dist/parser/parse-file.js +68 -0
  127. package/dist/parser/parse-file.js.map +1 -0
  128. package/dist/parser/parse-line.d.ts +21 -0
  129. package/dist/parser/parse-line.d.ts.map +1 -0
  130. package/dist/parser/parse-line.js +230 -0
  131. package/dist/parser/parse-line.js.map +1 -0
  132. package/dist/parser/parse-project.d.ts +31 -0
  133. package/dist/parser/parse-project.d.ts.map +1 -0
  134. package/dist/parser/parse-project.js +281 -0
  135. package/dist/parser/parse-project.js.map +1 -0
  136. package/dist/report/index.d.ts +6 -0
  137. package/dist/report/index.d.ts.map +1 -0
  138. package/dist/report/index.js +6 -0
  139. package/dist/report/index.js.map +1 -0
  140. package/dist/report/mermaid.d.ts +15 -0
  141. package/dist/report/mermaid.d.ts.map +1 -0
  142. package/dist/report/mermaid.js +260 -0
  143. package/dist/report/mermaid.js.map +1 -0
  144. package/dist/report/report.d.ts +16 -0
  145. package/dist/report/report.d.ts.map +1 -0
  146. package/dist/report/report.js +211 -0
  147. package/dist/report/report.js.map +1 -0
  148. package/dist/tui/commands.d.ts +42 -0
  149. package/dist/tui/commands.d.ts.map +1 -0
  150. package/dist/tui/commands.js +1216 -0
  151. package/dist/tui/commands.js.map +1 -0
  152. package/dist/tui/config.d.ts +27 -0
  153. package/dist/tui/config.d.ts.map +1 -0
  154. package/dist/tui/config.js +27 -0
  155. package/dist/tui/config.js.map +1 -0
  156. package/dist/tui/format.d.ts +63 -0
  157. package/dist/tui/format.d.ts.map +1 -0
  158. package/dist/tui/format.js +253 -0
  159. package/dist/tui/format.js.map +1 -0
  160. package/dist/tui/index.d.ts +18 -0
  161. package/dist/tui/index.d.ts.map +1 -0
  162. package/dist/tui/index.js +470 -0
  163. package/dist/tui/index.js.map +1 -0
  164. package/dist/tui/input.d.ts +63 -0
  165. package/dist/tui/input.d.ts.map +1 -0
  166. package/dist/tui/input.js +454 -0
  167. package/dist/tui/input.js.map +1 -0
  168. package/dist/types/index.d.ts +254 -0
  169. package/dist/types/index.d.ts.map +1 -0
  170. package/dist/types/index.js +6 -0
  171. package/dist/types/index.js.map +1 -0
  172. package/package.json +97 -0
@@ -0,0 +1,105 @@
1
+ /**
2
+ * GuardLink init — Interactive agent picker.
3
+ *
4
+ * Shows a detection-aware prompt:
5
+ * - Always-created files (reference doc, AGENTS.md, .mcp.json)
6
+ * - Auto-detected agents (directories found on disk)
7
+ * - Optional agents the user can additionally select
8
+ */
9
+ import { createInterface } from 'node:readline';
10
+ import { getDetectedPlatforms } from './detect.js';
11
+ export const AGENT_CHOICES = [
12
+ { id: 'claude', label: 'Claude Code', file: 'CLAUDE.md', platform: 'claude' },
13
+ { id: 'cursor', label: 'Cursor', file: '.cursor/rules/guardlink.mdc', platform: 'cursor' },
14
+ { id: 'codex', label: 'Codex', file: 'AGENTS.md', platform: 'codex' },
15
+ { id: 'copilot', label: 'GitHub Copilot', file: '.github/copilot-instructions.md', platform: 'copilot' },
16
+ { id: 'windsurf', label: 'Windsurf', file: '.windsurfrules', platform: 'windsurf' },
17
+ { id: 'cline', label: 'Cline', file: '.clinerules', platform: 'cline' },
18
+ { id: 'gemini', label: 'Gemini', file: '.gemini/GEMINI.md', platform: 'gemini' },
19
+ ];
20
+ /** Files that are always created regardless of agent selection. */
21
+ export const ALWAYS_FILES = [
22
+ 'docs/GUARDLINK_REFERENCE.md',
23
+ '.mcp.json',
24
+ ];
25
+ /**
26
+ * Show detection-aware prompt. Displays:
27
+ * 1. Always-created files
28
+ * 2. Auto-detected agents (from directory presence)
29
+ * 3. Optional agents user can add
30
+ *
31
+ * Returns combined list of agent IDs (detected + user-selected).
32
+ */
33
+ export async function promptAgentSelection(agentFiles) {
34
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
35
+ const ask = (q) => new Promise(resolve => rl.question(q, resolve));
36
+ const detected = getDetectedPlatforms(agentFiles);
37
+ // Partition choices into detected vs optional
38
+ const detectedChoices = [];
39
+ const optionalChoices = [];
40
+ for (const choice of AGENT_CHOICES) {
41
+ const reason = detected.get(choice.platform);
42
+ if (reason) {
43
+ detectedChoices.push({ ...choice, reason });
44
+ }
45
+ else {
46
+ optionalChoices.push(choice);
47
+ }
48
+ }
49
+ // ── Display ──
50
+ console.error('\n GuardLink will create:\n');
51
+ // Always files
52
+ console.error(' Always:');
53
+ for (const f of ALWAYS_FILES) {
54
+ console.error(` ✓ ${f}`);
55
+ }
56
+ // Detected agents
57
+ if (detectedChoices.length > 0) {
58
+ console.error('\n Auto-detected:');
59
+ for (const c of detectedChoices) {
60
+ console.error(` ✓ ${c.file.padEnd(38)} (${c.reason})`);
61
+ }
62
+ }
63
+ // Optional agents
64
+ if (optionalChoices.length > 0) {
65
+ console.error('\n Also add instructions for? (comma-separated numbers, Enter to skip)\n');
66
+ for (let i = 0; i < optionalChoices.length; i++) {
67
+ const c = optionalChoices[i];
68
+ console.error(` ${i + 1}. ${c.label.padEnd(18)} → ${c.file}`);
69
+ }
70
+ console.error('');
71
+ }
72
+ // Collect selection
73
+ const detectedIds = detectedChoices.map(c => c.id);
74
+ if (optionalChoices.length === 0) {
75
+ // Nothing to ask — all agents detected
76
+ console.error(' All known agents detected. No additional selection needed.\n');
77
+ rl.close();
78
+ return detectedIds;
79
+ }
80
+ const answer = await ask(' Selection [Enter to skip]: ');
81
+ rl.close();
82
+ const selectedIds = [...detectedIds];
83
+ if (answer.trim()) {
84
+ const nums = answer.split(/[,\s]+/).map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n));
85
+ for (const n of nums) {
86
+ if (n >= 1 && n <= optionalChoices.length) {
87
+ selectedIds.push(optionalChoices[n - 1].id);
88
+ }
89
+ }
90
+ }
91
+ // Always include claude if nothing was detected or selected
92
+ if (selectedIds.length === 0) {
93
+ selectedIds.push('claude');
94
+ }
95
+ return selectedIds;
96
+ }
97
+ /**
98
+ * Resolve agent IDs (from picker or flags) to file paths.
99
+ */
100
+ export function resolveAgentFiles(agentIds) {
101
+ return agentIds
102
+ .map(id => AGENT_CHOICES.find(c => c.id === id))
103
+ .filter((c) => c !== undefined);
104
+ }
105
+ //# sourceMappingURL=pic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C,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,MAAM,EAAE,CAAC;gBAC1C,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED,4DAA4D;IAC5D,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,OAAO,QAAQ;SACZ,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;SAC/C,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * GuardLink init — Template content for generated files.
3
+ */
4
+ import type { ProjectInfo } from './detect.js';
5
+ /**
6
+ * docs/GUARDLINK_REFERENCE.md — the single source of truth for annotation syntax.
7
+ * All agent instruction files point here instead of duplicating the full reference.
8
+ */
9
+ export declare function referenceDocContent(project: ProjectInfo): string;
10
+ /**
11
+ * Compact GuardLink instruction block injected into agent files.
12
+ * Points to docs/GUARDLINK_REFERENCE.md for full syntax.
13
+ */
14
+ export declare function agentInstructions(project: ProjectInfo): string;
15
+ export declare function cursorRulesContent(project: ProjectInfo): string;
16
+ export declare function cursorMdcContent(project: ProjectInfo): string;
17
+ export declare function definitionsContent(project: ProjectInfo): string;
18
+ export declare function configContent(project: ProjectInfo): string;
19
+ export declare const GITIGNORE_ENTRY = "\n# GuardLink\n.guardlink/*.json\n!.guardlink/config.json\n";
20
+ /**
21
+ * Generate .mcp.json for Claude Code auto-configuration.
22
+ * When committed to repo, Claude Code automatically connects to the MCP server.
23
+ */
24
+ export declare function mcpConfig(): string;
25
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/init/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAgFhE;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA2B9D;AAID,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA2B/D;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAQ7D;AAID,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA8B/D;AAID,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAY1D;AAID,eAAO,MAAM,eAAe,gEAI3B,CAAC;AA2CF;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CASlC"}
@@ -0,0 +1,263 @@
1
+ /**
2
+ * GuardLink init — Template content for generated files.
3
+ */
4
+ // ─── Canonical reference document ────────────────────────────────────
5
+ /**
6
+ * docs/GUARDLINK_REFERENCE.md — the single source of truth for annotation syntax.
7
+ * All agent instruction files point here instead of duplicating the full reference.
8
+ */
9
+ export function referenceDocContent(project) {
10
+ return `# GuardLink — Annotation Reference
11
+
12
+ > Canonical reference for **${project.name}**. All agent instruction files point here.
13
+ > Full specification: [docs/SPEC.md](https://github.com/Bugb-Technologies/guardlink/blob/main/docs/SPEC.md)
14
+
15
+ ## Quick Reference
16
+
17
+ \`\`\`
18
+ DEFINE @asset <Component.Path> (#id) -- "description"
19
+ @threat <Name> (#id) [severity] cwe:CWE-NNN -- "description"
20
+ @control <Name> (#id) -- "description"
21
+
22
+ RELATE @mitigates <Asset> against <#threat> using <#control> -- "how"
23
+ @exposes <Asset> to <#threat> [severity] cwe:CWE-NNN -- "what's wrong"
24
+ @accepts <#threat> on <Asset> -- "why acceptable"
25
+ @transfers <#threat> from <Source> to <Target> -- "who handles it"
26
+
27
+ FLOW @flows <Source> -> <Target> via <mechanism> -- "details"
28
+ @boundary <AssetA> | <AssetB> (#id) -- "trust boundary"
29
+ @boundary between <AssetA> and <AssetB> (#id) -- "trust boundary"
30
+
31
+ LIFECYCLE
32
+ @validates <#control> for <Asset> -- "test evidence"
33
+ @audit <Asset> -- "what needs review"
34
+ @owns <team-id> for <Asset> -- "responsible team"
35
+ @handles <pii|phi|financial|secrets|internal|public> on <Asset>
36
+ @assumes <Asset> -- "unverified assumption"
37
+
38
+ COMMENT @comment -- "security-relevant developer note"
39
+
40
+ PROTECT @shield -- "reason"
41
+ @shield:begin -- "reason" ... code ... @shield:end
42
+ \`\`\`
43
+
44
+ ## Severity
45
+
46
+ \`[P0]\` = critical, \`[P1]\` = high, \`[P2]\` = medium, \`[P3]\` = low
47
+
48
+ ## External References
49
+
50
+ Append after severity: \`cwe:CWE-89\`, \`owasp:A03:2021\`, \`capec:CAPEC-66\`, \`attack:T1190\`
51
+
52
+ ## Rules
53
+
54
+ 1. **Define once, reference everywhere.** \`@asset\`, \`@threat\`, \`@control\` with \`(#id)\` go in \`.guardlink/definitions${project.definitionsExt}\`. Source files use relationship verbs only (\`@mitigates\`, \`@exposes\`, etc.).
55
+ 2. **Read definitions before adding.** Check for existing IDs first — avoid duplicates.
56
+ 3. **Every \`@exposes\` needs a plan.** Match with \`@mitigates\` (fix exists), \`@accepts\` (risk acknowledged), or TODO.
57
+ 4. **Always annotate security-relevant code.** At minimum, add \`@comment\` to document intent.
58
+ 5. **Use the full verb set.** \`@flows\` for data movement, \`@handles\` for data classification, \`@boundary\` for trust boundaries.
59
+
60
+ ## When Writing Code
61
+
62
+ | Situation | Annotation |
63
+ |-----------|------------|
64
+ | New service/component | \`@asset\` in definitions, then reference in source |
65
+ | Security gap exists | \`@exposes Asset to #threat\` |
66
+ | Implementing a fix | \`@mitigates Asset against #threat using #control\` |
67
+ | Processing sensitive data | \`@handles pii on Asset\` |
68
+ | Proprietary algorithm | \`@shield:begin\` ... \`@shield:end\` |
69
+ | Unsure which annotation | \`@comment -- "describe what you see"\` |
70
+
71
+ ## Commands
72
+
73
+ \`\`\`bash
74
+ guardlink validate . # Check for errors
75
+ guardlink report . # Generate threat-model.md
76
+ guardlink status . # Coverage summary
77
+ guardlink suggest <file> # Get annotation suggestions
78
+ \`\`\`
79
+
80
+ ## MCP Tools
81
+
82
+ When connected via \`.mcp.json\`, use:
83
+ - \`guardlink_parse\` — parse annotations, return threat model
84
+ - \`guardlink_lookup\` — query threats, controls, exposures by ID
85
+ - \`guardlink_suggest\` — get annotation suggestions for a file
86
+ - \`guardlink_validate\` — check for syntax errors
87
+ - \`guardlink_status\` — coverage stats
88
+ `;
89
+ }
90
+ // ─── Agent instruction content (compact — points to reference doc) ───
91
+ /**
92
+ * Compact GuardLink instruction block injected into agent files.
93
+ * Points to docs/GUARDLINK_REFERENCE.md for full syntax.
94
+ */
95
+ export function agentInstructions(project) {
96
+ return `
97
+ ## GuardLink — Security Annotations (Required)
98
+
99
+ This project uses [GuardLink](https://guardlink.bugb.io) annotations in source code comments.
100
+ **Full reference: \`docs/GUARDLINK_REFERENCE.md\`**
101
+
102
+ ### Key Rules
103
+
104
+ 1. Definitions (\`@asset\`, \`@threat\`, \`@control\` with \`#id\`) go in \`.guardlink/definitions${project.definitionsExt}\` — read it before adding new ones.
105
+ 2. Source files use relationship verbs only: \`@mitigates\`, \`@exposes\`, \`@accepts\`, \`@flows\`, \`@handles\`, \`@boundary\`, \`@comment\`.
106
+ 3. Every \`@exposes\` needs a matching \`@mitigates\` or \`@accepts\`.
107
+ 4. Always add at least \`@comment\` on security-relevant code.
108
+ 5. Run \`guardlink validate .\` after making changes.
109
+
110
+ ### MCP Tools Available
111
+
112
+ Use \`guardlink_lookup\` to check existing definitions. Use \`guardlink_validate\` after annotating. Use \`guardlink_suggest <file>\` for recommendations.
113
+
114
+ ### Quick Syntax
115
+
116
+ \`\`\`
117
+ @exposes Asset to #threat [P0] cwe:CWE-89 -- "description"
118
+ @mitigates Asset against #threat using #control -- "how"
119
+ @comment -- "security-relevant note"
120
+ \`\`\`
121
+ `.trimStart();
122
+ }
123
+ // ─── Cursor-specific format ──────────────────────────────────────────
124
+ export function cursorRulesContent(project) {
125
+ // .cursorrules uses a flatter format without markdown headers
126
+ return `
127
+ # GuardLink Security Annotations
128
+
129
+ This project uses GuardLink annotations in source code comments.
130
+
131
+ ## Annotation Syntax
132
+ - @asset <Component.Path> (#id) -- "description"
133
+ - @threat <Name> (#id) [P0|P1|P2|P3] cwe:CWE-NNN -- "description"
134
+ - @control <Name> (#id) -- "description"
135
+ - @mitigates <Asset> against <#threat> using <#control> -- "how"
136
+ - @exposes <Asset> to <#threat> [severity] cwe:CWE-NNN -- "what"
137
+ - @accepts <#threat> on <Asset> -- "why"
138
+ - @flows <Source> -> <Target> via <mechanism> -- "details"
139
+ - @boundary between <A> and <B> (#id) -- "trust boundary"
140
+ - @handles <pii|phi|financial|secrets> on <Asset>
141
+ - @shield:begin -- "reason" ... @shield:end
142
+
143
+ ## Rules
144
+ - All @asset, @threat, @control with (#id) go in .guardlink/definitions${project.definitionsExt}. Source files use only relationship verbs (@mitigates, @exposes, @accepts, @flows, etc).
145
+ - Read definitions file before adding — check for existing IDs first.
146
+ - Severity: P0=critical, P1=high, P2=medium, P3=low. Only P0-P3.
147
+ - External refs: cwe:CWE-89, owasp:A03:2021, capec:CAPEC-66
148
+ - Every @exposes needs a matching @mitigates or @accepts.
149
+ - Run \`guardlink validate .\` to check annotations.
150
+ `.trimStart();
151
+ }
152
+ // ─── Cursor .mdc format ──────────────────────────────────────────────
153
+ export function cursorMdcContent(project) {
154
+ return `---
155
+ description: GuardLink security annotation rules
156
+ globs:
157
+ alwaysApply: true
158
+ ---
159
+
160
+ ${cursorRulesContent(project)}`;
161
+ }
162
+ // ─── Shared definitions file ─────────────────────────────────────────
163
+ export function definitionsContent(project) {
164
+ const c = project.commentPrefix;
165
+ return `${c} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
166
+ ${c} GuardLink Shared Definitions — ${project.name}
167
+ ${c}
168
+ ${c} ALL @asset, @threat, and @control declarations live here.
169
+ ${c} Source files reference by #id only (e.g. @mitigates X against #sqli).
170
+ ${c} Never redeclare an ID that exists in this file.
171
+ ${c} Before adding: read this file to check for duplicates.
172
+ ${c}
173
+ ${c} Run: guardlink validate .
174
+ ${c} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
+
176
+ ${c} ─── Examples (uncomment and customize for your project) ────────
177
+ ${c}
178
+ ${c} ${c} @asset App.API (#api) -- "Main REST endpoint"
179
+ ${c} ${c} @asset App.Database (#db) -- "Primary data store"
180
+ ${c}
181
+ ${c} ${c} @threat SQL_Injection (#sqli) [critical] cwe:CWE-89 -- "Unsanitized input reaches SQL query"
182
+ ${c} ${c} @threat Cross_Site_Scripting (#xss) [high] cwe:CWE-79 -- "Unsanitized input rendered in browser"
183
+ ${c} ${c} @threat Broken_Access_Control (#bac) [critical] cwe:CWE-284 -- "Missing or bypassable authorization"
184
+ ${c}
185
+ ${c} ${c} @control Parameterized_Queries (#prepared-stmts) -- "SQL queries use bound parameters"
186
+ ${c} ${c} @control Input_Validation (#input-validation) -- "Input validated against schema/allowlist"
187
+ ${c} ${c} @control RBAC (#rbac) -- "Role-based access control"
188
+ ${c}
189
+ ${c} ─── Your Definitions ──────────────────────────────────────────
190
+
191
+ `;
192
+ }
193
+ // ─── Config file ─────────────────────────────────────────────────────
194
+ export function configContent(project) {
195
+ return JSON.stringify({
196
+ version: '1.0.0',
197
+ project: project.name,
198
+ language: project.language,
199
+ definitions: `definitions${project.definitionsExt}`,
200
+ include: defaultIncludeForLanguage(project.language),
201
+ exclude: [
202
+ 'node_modules', 'dist', 'build', '.git',
203
+ '__pycache__', 'target', 'vendor', '.next',
204
+ ],
205
+ }, null, 2) + '\n';
206
+ }
207
+ // ─── .gitignore addition ─────────────────────────────────────────────
208
+ export const GITIGNORE_ENTRY = `
209
+ # GuardLink
210
+ .guardlink/*.json
211
+ !.guardlink/config.json
212
+ `;
213
+ // ─── Helpers ─────────────────────────────────────────────────────────
214
+ function toPascalCase(s) {
215
+ return s
216
+ .replace(/[-_./]/g, ' ')
217
+ .split(/\s+/)
218
+ .map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
219
+ .join('');
220
+ }
221
+ function defaultIncludeForLanguage(lang) {
222
+ switch (lang) {
223
+ case 'typescript':
224
+ case 'javascript':
225
+ return ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'];
226
+ case 'python':
227
+ return ['**/*.py'];
228
+ case 'go':
229
+ return ['**/*.go'];
230
+ case 'rust':
231
+ return ['**/*.rs'];
232
+ case 'java':
233
+ return ['**/*.java'];
234
+ case 'csharp':
235
+ return ['**/*.cs'];
236
+ case 'ruby':
237
+ return ['**/*.rb'];
238
+ case 'swift':
239
+ return ['**/*.swift'];
240
+ case 'kotlin':
241
+ return ['**/*.kt', '**/*.kts'];
242
+ case 'terraform':
243
+ return ['**/*.tf', '**/*.hcl'];
244
+ default:
245
+ return ['**/*.ts', '**/*.js', '**/*.py', '**/*.go', '**/*.rs', '**/*.java'];
246
+ }
247
+ }
248
+ // ─── MCP configuration ──────────────────────────────────────────────
249
+ /**
250
+ * Generate .mcp.json for Claude Code auto-configuration.
251
+ * When committed to repo, Claude Code automatically connects to the MCP server.
252
+ */
253
+ export function mcpConfig() {
254
+ return JSON.stringify({
255
+ mcpServers: {
256
+ guardlink: {
257
+ command: 'guardlink',
258
+ args: ['mcp'],
259
+ },
260
+ },
261
+ }, null, 2) + '\n';
262
+ }
263
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/init/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wEAAwE;AAExE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAoB;IACtD,OAAO;;8BAEqB,OAAO,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+HA0CqF,OAAO,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCpJ,CAAC;AACF,CAAC;AAED,wEAAwE;AAExE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAoB;IACpD,OAAO;;;;;;;;oGAQ2F,OAAO,CAAC,cAAc;;;;;;;;;;;;;;;;;CAiBzH,CAAC,SAAS,EAAE,CAAC;AACd,CAAC;AAED,wEAAwE;AAExE,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,8DAA8D;IAC9D,OAAO;;;;;;;;;;;;;;;;;;yEAkBgE,OAAO,CAAC,cAAc;;;;;;CAM9F,CAAC,SAAS,EAAE,CAAC;AACd,CAAC;AAED,wEAAwE;AAExE,MAAM,UAAU,gBAAgB,CAAC,OAAoB;IACnD,OAAO;;;;;;EAMP,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;AAChC,CAAC;AAED,wEAAwE;AAExE,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAEhC,OAAO,GAAG,CAAC;EACX,CAAC,mCAAmC,OAAO,CAAC,IAAI;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AC,CAAC;AACd,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAY;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY;YACf,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QACxD,KAAK,QAAQ;YACX,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,CAAC,WAAW,CAAC,CAAC;QACvB,KAAK,QAAQ;YACX,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,OAAO;YACV,OAAO,CAAC,YAAY,CAAC,CAAC;QACxB,KAAK,QAAQ;YACX,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjC,KAAK,WAAW;YACd,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjC;YACE,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAGD,uEAAuE;AAEvE;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,CAAC,KAAK,CAAC;aACd;SACF;KACF,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * GuardLink MCP Server — exports and stdio entry point.
3
+ */
4
+ export { createServer } from './server.js';
5
+ export { lookup, type LookupResult } from './lookup.js';
6
+ export { suggestAnnotations, type Suggestion, type SuggestOptions } from './suggest.js';
7
+ /**
8
+ * Start the MCP server on stdio transport.
9
+ * Called from CLI: `guardlink mcp`
10
+ */
11
+ export declare function startStdioServer(): Promise<void>;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAKxF;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAItD"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * GuardLink MCP Server — exports and stdio entry point.
3
+ */
4
+ export { createServer } from './server.js';
5
+ export { lookup } from './lookup.js';
6
+ export { suggestAnnotations } from './suggest.js';
7
+ import { createServer } from './server.js';
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ /**
10
+ * Start the MCP server on stdio transport.
11
+ * Called from CLI: `guardlink mcp`
12
+ */
13
+ export async function startStdioServer() {
14
+ const server = createServer();
15
+ const transport = new StdioServerTransport();
16
+ await server.connect(transport);
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAwC,MAAM,cAAc,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * GuardLink Lookup — Query the threat model graph.
3
+ *
4
+ * Supports structured queries:
5
+ * - "asset #config" or "asset Config" → find asset by ID or path
6
+ * - "threat #sqli" → find threat by ID
7
+ * - "control #rbac" → find control by ID
8
+ * - "threats for #auth" → threats targeting an asset (via exposures)
9
+ * - "controls for #auth" → controls protecting an asset (via mitigations)
10
+ * - "flows into #engine" → data flows with target = engine
11
+ * - "flows from #config" → data flows with source = config
12
+ * - "unmitigated" → all unmitigated exposures
13
+ * - "boundary #config" → boundaries involving asset
14
+ * - Free text → fuzzy match across assets, threats, controls
15
+ */
16
+ import type { ThreatModel } from '../types/index.js';
17
+ export interface LookupResult {
18
+ query: string;
19
+ type: string;
20
+ count: number;
21
+ results: any[];
22
+ }
23
+ export interface LookupQuery {
24
+ raw: string;
25
+ }
26
+ export declare function lookup(model: ThreatModel, query: string): LookupResult;
27
+ //# sourceMappingURL=lookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/mcp/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CA4EtE"}