guardlink 1.4.1 → 1.4.2
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/CHANGELOG.md +30 -0
- package/README.md +15 -4
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +35 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/launcher.d.ts.map +1 -1
- package/dist/agents/launcher.js +5 -0
- package/dist/agents/launcher.js.map +1 -1
- package/dist/agents/prompts.d.ts +2 -1
- package/dist/agents/prompts.d.ts.map +1 -1
- package/dist/agents/prompts.js +66 -14
- package/dist/agents/prompts.js.map +1 -1
- package/dist/analyze/prompts.js +1 -1
- package/dist/cli/index.js +30 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/diff/git.js +3 -3
- package/dist/diff/git.js.map +1 -1
- package/dist/init/index.d.ts +7 -0
- package/dist/init/index.d.ts.map +1 -1
- package/dist/init/index.js +60 -24
- package/dist/init/index.js.map +1 -1
- package/dist/init/templates.js +5 -5
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +13 -8
- package/dist/mcp/server.js.map +1 -1
- package/dist/parser/clear.d.ts +2 -1
- package/dist/parser/clear.d.ts.map +1 -1
- package/dist/parser/clear.js +18 -28
- package/dist/parser/clear.js.map +1 -1
- package/dist/parser/comment-strip.d.ts +5 -0
- package/dist/parser/comment-strip.d.ts.map +1 -1
- package/dist/parser/comment-strip.js +8 -0
- package/dist/parser/comment-strip.js.map +1 -1
- package/dist/parser/parse-file.d.ts +1 -0
- package/dist/parser/parse-file.d.ts.map +1 -1
- package/dist/parser/parse-file.js +31 -8
- package/dist/parser/parse-file.js.map +1 -1
- package/dist/parser/parse-line.d.ts +6 -0
- package/dist/parser/parse-line.d.ts.map +1 -1
- package/dist/parser/parse-line.js +23 -5
- package/dist/parser/parse-line.js.map +1 -1
- package/dist/parser/parse-project.d.ts +1 -0
- package/dist/parser/parse-project.d.ts.map +1 -1
- package/dist/parser/parse-project.js +17 -2
- package/dist/parser/parse-project.js.map +1 -1
- package/dist/review/index.d.ts +3 -1
- package/dist/review/index.d.ts.map +1 -1
- package/dist/review/index.js +77 -35
- package/dist/review/index.js.map +1 -1
- package/dist/tui/commands.d.ts.map +1 -1
- package/dist/tui/commands.js +15 -8
- package/dist/tui/commands.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,36 @@ All notable changes to GuardLink CLI will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.2] — 2026-04-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **CLI**: `guardlink annotate --mode external` — generate annotations as standalone `.gal` files under `.guardlink/annotations/` that mirror the source tree, instead of as inline comments in source files. Source files remain unchanged. Useful for vendored code, audit-controlled repositories, and projects where modifying source files is politically expensive. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
13
|
+
- **CLI**: `guardlink annotate --stdout` — print the annotation prompt to stdout instead of launching an agent or copying to the clipboard. Useful for piping into custom harnesses and CI pipelines. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
14
|
+
- **Parser**: `@source file:<path> line:<n> [symbol:<name>]` directive — anchors annotations in a `.gal` file to a logical source-code location. The directive produces no annotation itself; it sets the location for subsequent annotations until the next `@source` or end of file.
|
|
15
|
+
- **Types**: `SourceLocation.origin_file` and `SourceLocation.origin_line` — physical location of an annotation (the `.gal` file path), preserved alongside the logical location (`file` / `line`) for dashboards, reports, and SARIF to surface provenance where useful while defaulting to the logical source location for developer-facing output.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **`guardlink init --mode external`**: contains GuardLink's entire footprint inside `.guardlink/` — no `CLAUDE.md` / `AGENTS.md` / `.cursor/rules/` files at the project root, no `.mcp.json` at the root, no `docs/GUARDLINK_REFERENCE.md`. The reference doc and MCP config template are placed inside `.guardlink/` instead.
|
|
20
|
+
- **Review writeback**: `@accepts` and `@audit` annotations generated via `guardlink review` are written to the annotation's physical location (the `.gal` file in external mode) rather than the logical source location, preserving external mode's "source files untouched" property through governance workflows.
|
|
21
|
+
- **Review writeback**: comment-style detection now correctly handles HTML (`<!-- ... -->`) and CSS (`/* ... */`) files. Previously these fell back to JavaScript-style `//` comments, producing invalid markup. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
22
|
+
- **Review exposure IDs**: composite `writeFile:writeLine:logicalFile:logicalLine:asset:threat` scheme replaces the previous `file:line` scheme. Prevents two `@exposes` annotations at the same source location from colliding on the MCP review identifier. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
23
|
+
- **Review insertion**: TypeScript and Python decorators starting with `@` are no longer mistaken for GuardLink annotations when walking the "coupled block" during writeback. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
24
|
+
- **Parser `**/*.gal`** discovery is now case-insensitive. Contributed by [@jordi-murgo](https://github.com/jordi-murgo) in [#6](https://github.com/Bugb-Technologies/guardlink/pull/6).
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **Agent prompts**: wrap the external-mode example annotation block in `@shield:begin` / `@shield:end` to prevent `guardlink validate` from parsing the JavaScript string literals inside `src/agents/prompts.ts` as real annotations (resolved four parse errors in the CI dogfood step after #6 merged).
|
|
29
|
+
- **Documentation**: correct `--mode inline|gal` references to `--mode inline|external` in `README.md` (two occurrences), `docs/GUARDLINK_REFERENCE.md` (three occurrences including the TUI `/annotate` slash-command help text). The flag value shipped as `external`; the docs referenced the prototype name `gal`.
|
|
30
|
+
- **Documentation**: document `--stdout` flag on the AI-agent flags cheat-sheet in `docs/GUARDLINK_REFERENCE.md`.
|
|
31
|
+
- **Documentation**: add `@source` convention note to the standalone `.gal` files section in `docs/GUARDLINK_REFERENCE.md` — annotations placed before the first `@source` directive fall back to the `.gal` file's own physical location, which is rarely what users want.
|
|
32
|
+
|
|
33
|
+
### Chore
|
|
34
|
+
|
|
35
|
+
- **Version**: bump from `1.4.1-gal` development tag (landed via #6) to `1.4.2` across `package.json`, `package-lock.json`, `src/cli/index.ts`, and `src/mcp/server.ts`.
|
|
36
|
+
- **Lockfiles**: remove committed `bun.lock` (landed via #6). This project standardizes on npm; `package-lock.json` is canonical. Added `bun.lock`, `yarn.lock`, and `pnpm-lock.yaml` to `.gitignore` so contributors using alternate package managers locally do not accidentally commit a second lockfile.
|
|
37
|
+
|
|
8
38
|
## [1.4.1] — 2026-03-12
|
|
9
39
|
|
|
10
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ To uninstall: `npm unlink -g guardlink`
|
|
|
60
60
|
guardlink init
|
|
61
61
|
|
|
62
62
|
# Let AI annotate your project - Launch a coding agent to add annotations
|
|
63
|
-
guardlink annotate [prompt]
|
|
63
|
+
guardlink annotate [prompt] [--mode inline|external]
|
|
64
64
|
|
|
65
65
|
# Let your AI coding agent annotate, or write annotations manually
|
|
66
66
|
# Then validate
|
|
@@ -149,7 +149,7 @@ GuardLink ships an MCP server and behavioral directives for AI coding agents. Af
|
|
|
149
149
|
| `guardlink_suggest` | Suggest annotations for a code snippet |
|
|
150
150
|
| `guardlink_lookup` | Query threats, controls, flows by keyword |
|
|
151
151
|
| `guardlink_threat_report` | AI threat report (STRIDE, DREAD, etc.) |
|
|
152
|
-
| `guardlink_annotate` | Build annotation prompt for the agent |
|
|
152
|
+
| `guardlink_annotate` | Build annotation prompt for the agent, with inline or `.gal` mode |
|
|
153
153
|
| `guardlink_report` | Generate markdown report |
|
|
154
154
|
| `guardlink_dashboard` | Generate HTML dashboard |
|
|
155
155
|
| `guardlink_sarif` | Export SARIF 2.1.0 |
|
|
@@ -165,7 +165,7 @@ GuardLink ships an MCP server and behavioral directives for AI coding agents. Af
|
|
|
165
165
|
| Command | Description |
|
|
166
166
|
|---------|-------------|
|
|
167
167
|
| `guardlink init [dir]` | Initialize project with definitions, config, and agent integration |
|
|
168
|
-
| `guardlink annotate [prompt]` | Launch a coding agent to add annotations |
|
|
168
|
+
| `guardlink annotate [prompt] [--mode inline\|external]` | Launch a coding agent to add inline annotations or associated `.gal` files |
|
|
169
169
|
| `guardlink parse [dir]` | Parse all annotations, output ThreatModel JSON |
|
|
170
170
|
| `guardlink status [dir]` | Coverage summary: assets, threats, mitigations, exposures |
|
|
171
171
|
| `guardlink validate [dir]` | Check for syntax errors, dangling refs, duplicate IDs |
|
|
@@ -195,7 +195,9 @@ GuardLink ships an MCP server and behavioral directives for AI coding agents. Af
|
|
|
195
195
|
|
|
196
196
|
## Annotation Reference
|
|
197
197
|
|
|
198
|
-
GuardLink annotations
|
|
198
|
+
GuardLink annotations can live in source comments in any language or in standalone `.gal` files. The parser supports `//`, `#`, `--`, `/* */`, `""" """`, and 25+ comment styles for inline annotations, plus raw GAL lines for externalized files.
|
|
199
|
+
|
|
200
|
+
> In standalone `.gal` files, drop the host-language comment prefix. `// @exposes ...` becomes `@exposes ...`. Keep definitions in `.guardlink/definitions.*`; use `.gal` files for externalized relationship annotations. Use `@source file:<path> line:<n> [symbol:<name>]` to point the following annotations at the real code location.
|
|
199
201
|
|
|
200
202
|
### Definitions (shared, in `.guardlink/definitions.js`)
|
|
201
203
|
|
|
@@ -214,6 +216,15 @@ GuardLink annotations go in comments in any language. The parser supports `//`,
|
|
|
214
216
|
# @transfers #sqli from #api to #database -- "DB handles untrusted input"
|
|
215
217
|
```
|
|
216
218
|
|
|
219
|
+
### Externalized relationships (in `.gal` files)
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
@source file:src/auth/login.ts line:42 symbol:authenticate
|
|
223
|
+
@exposes #api to #xss [P1] cwe:CWE-79 -- "User bio rendered without escaping"
|
|
224
|
+
@audit #api -- "Review sanitization before release"
|
|
225
|
+
@comment -- "Same GAL syntax as inline comments, but without // or # prefixes"
|
|
226
|
+
```
|
|
227
|
+
|
|
217
228
|
### Data Flow & Architecture
|
|
218
229
|
|
|
219
230
|
```go
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -14,12 +14,20 @@ export interface AgentEntry {
|
|
|
14
14
|
app: string | null;
|
|
15
15
|
flag: string;
|
|
16
16
|
}
|
|
17
|
+
export type AnnotationMode = 'inline' | 'external';
|
|
17
18
|
export declare const AGENTS: readonly AgentEntry[];
|
|
18
19
|
/** Parse --agent flags from a raw args string (TUI slash commands). */
|
|
19
20
|
export declare function parseAgentFlag(args: string): {
|
|
20
21
|
agent: AgentEntry | null;
|
|
21
22
|
cleanArgs: string;
|
|
22
23
|
};
|
|
24
|
+
/** Parse annotation placement mode from raw args (CLI/TUI). */
|
|
25
|
+
export declare function parseAnnotationModeFlag(args: string): {
|
|
26
|
+
mode: AnnotationMode;
|
|
27
|
+
cleanArgs: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function resolveAnnotationMode(mode: string | undefined): AnnotationMode;
|
|
23
31
|
/** Resolve agent from Commander option booleans (CLI commands). */
|
|
24
32
|
export declare function agentFromOpts(opts: Record<string, any>): AgentEntry | null;
|
|
25
33
|
export { launchAgentForeground, launchAgentIDE, launchAgent, launchAgentInline, copyToClipboard } from './launcher.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE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AAC;AACvH,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/agents/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export const AGENTS = [
|
|
|
14
14
|
{ id: 'codex', name: 'Codex CLI', cmd: 'codex', app: null, flag: '--codex' },
|
|
15
15
|
{ id: 'gemini', name: 'Gemini CLI', cmd: 'gemini', app: null, flag: '--gemini' },
|
|
16
16
|
{ id: 'clipboard', name: 'Clipboard', cmd: null, app: null, flag: '--clipboard' },
|
|
17
|
+
{ id: 'stdout', name: 'Stdout', cmd: null, app: null, flag: '--stdout' },
|
|
17
18
|
];
|
|
18
19
|
/** Parse --agent flags from a raw args string (TUI slash commands). */
|
|
19
20
|
export function parseAgentFlag(args) {
|
|
@@ -24,6 +25,38 @@ export function parseAgentFlag(args) {
|
|
|
24
25
|
}
|
|
25
26
|
return { agent: null, cleanArgs: args };
|
|
26
27
|
}
|
|
28
|
+
/** Parse annotation placement mode from raw args (CLI/TUI). */
|
|
29
|
+
export function parseAnnotationModeFlag(args) {
|
|
30
|
+
const eqMatch = args.match(/(?:^|\s)--mode=(inline|external)(?=\s|$)/);
|
|
31
|
+
if (eqMatch) {
|
|
32
|
+
return {
|
|
33
|
+
mode: eqMatch[1],
|
|
34
|
+
cleanArgs: args.replace(eqMatch[0], ' ').replace(/\s+/g, ' ').trim(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const spacedMatch = args.match(/(?:^|\s)--mode\s+(inline|external)(?=\s|$)/);
|
|
38
|
+
if (spacedMatch) {
|
|
39
|
+
return {
|
|
40
|
+
mode: spacedMatch[1],
|
|
41
|
+
cleanArgs: args.replace(spacedMatch[0], ' ').replace(/\s+/g, ' ').trim(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (/(?:^|\s)--mode(?:\s|=|$)/.test(args)) {
|
|
45
|
+
return {
|
|
46
|
+
mode: 'inline',
|
|
47
|
+
cleanArgs: args,
|
|
48
|
+
error: 'Invalid --mode value. Use --mode inline or --mode external.',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return { mode: 'inline', cleanArgs: args };
|
|
52
|
+
}
|
|
53
|
+
export function resolveAnnotationMode(mode) {
|
|
54
|
+
if (!mode || mode === 'inline')
|
|
55
|
+
return 'inline';
|
|
56
|
+
if (mode === 'external')
|
|
57
|
+
return 'external';
|
|
58
|
+
throw new Error(`Invalid annotation mode "${mode}". Use "inline" or "external".`);
|
|
59
|
+
}
|
|
27
60
|
/** Resolve agent from Commander option booleans (CLI commands). */
|
|
28
61
|
export function agentFromOpts(opts) {
|
|
29
62
|
if (opts.claudeCode)
|
|
@@ -38,6 +71,8 @@ export function agentFromOpts(opts) {
|
|
|
38
71
|
return AGENTS.find(a => a.id === 'gemini');
|
|
39
72
|
if (opts.clipboard)
|
|
40
73
|
return AGENTS.find(a => a.id === 'clipboard');
|
|
74
|
+
if (opts.stdout)
|
|
75
|
+
return AGENTS.find(a => a.id === 'stdout');
|
|
41
76
|
return null;
|
|
42
77
|
}
|
|
43
78
|
export { launchAgentForeground, launchAgentIDE, launchAgent, launchAgentInline, copyToClipboard } from './launcher.js';
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,CAAC,MAAM,MAAM,GAA0B;IAC3C,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAG,GAAG,EAAE,IAAI,EAAQ,IAAI,EAAE,eAAe,EAAE;IAClG,EAAE,EAAE,EAAE,QAAQ,EAAO,IAAI,EAAE,QAAQ,EAAO,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H,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAmBrD;AAID;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAyBA;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAwCA;AAID,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA0CD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAChC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAAC,YAAY,CAAC,CAmFvB;AAID,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CA+BxF"}
|
package/dist/agents/launcher.js
CHANGED
|
@@ -256,6 +256,11 @@ export async function launchAgentInline(agent, prompt, cwd, onChunk, opts) {
|
|
|
256
256
|
* For clipboard: copy only.
|
|
257
257
|
*/
|
|
258
258
|
export function launchAgent(agent, prompt, cwd) {
|
|
259
|
+
// stdout-only mode: write raw prompt to stdout, skip clipboard (keeps output pipeable)
|
|
260
|
+
if (agent.id === 'stdout') {
|
|
261
|
+
process.stdout.write(prompt);
|
|
262
|
+
return { launched: true, clipboardCopied: false };
|
|
263
|
+
}
|
|
259
264
|
// Step 1: Always copy to clipboard
|
|
260
265
|
const clipboardCopied = copyToClipboard(prompt);
|
|
261
266
|
// Step 2: clipboard-only mode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/agents/launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,wEAAwE;AAExE,8DAA8D;AAC9D,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,IAAI,GAAG,QAAQ,EAAE,KAAK,QAAQ;QAClC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACZ,CAAC,CAAC,QAAQ,EAAE,KAAK,OAAO;YACtB,CAAC,CAAC,CAAC,MAAM,CAAC;YACV,CAAC,CAAC,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC;IAEjE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,C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EAAE,EAAE,EAAE,CAAC;AACxF,CAAC"}
|
package/dist/agents/prompts.d.ts
CHANGED
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* @handles internal on #agent-launcher -- "Serializes threat model IDs and flows into prompt"
|
|
14
14
|
*/
|
|
15
15
|
import type { ThreatModel } from '../types/index.js';
|
|
16
|
+
export type AnnotationMode = 'inline' | 'external';
|
|
16
17
|
/**
|
|
17
18
|
* Build a prompt for annotation agents.
|
|
18
19
|
*
|
|
19
20
|
* Includes the GuardLink reference doc, current model summary with flows and exposures,
|
|
20
21
|
* flow-first threat modeling methodology, and precise GAL syntax rules.
|
|
21
22
|
*/
|
|
22
|
-
export declare function buildAnnotatePrompt(userPrompt: string, root: string, model: ThreatModel | null): string;
|
|
23
|
+
export declare function buildAnnotatePrompt(userPrompt: string, root: string, model: ThreatModel | null, annotationMode?: AnnotationMode): string;
|
|
23
24
|
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AA6BnD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,cAAc,GAAE,cAAyB,GACxC,MAAM,CAqWR"}
|
package/dist/agents/prompts.js
CHANGED
|
@@ -14,13 +14,37 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { existsSync, readFileSync } from 'node:fs';
|
|
16
16
|
import { resolve } from 'node:path';
|
|
17
|
+
function annotationModeLabel(mode) {
|
|
18
|
+
return mode === 'external' ? 'externalized .gal files' : 'inline source comments';
|
|
19
|
+
}
|
|
20
|
+
function annotationModeInstructions(mode) {
|
|
21
|
+
if (mode === 'external') {
|
|
22
|
+
return `## Annotation Placement Mode
|
|
23
|
+
You MUST write annotations into associated standalone \`.gal\` files, not inline in the source code.
|
|
24
|
+
|
|
25
|
+
- Keep definitions in \`.guardlink/definitions.*\`
|
|
26
|
+
- For each annotated source file, create or update an associated file under \`.guardlink/annotations/\`
|
|
27
|
+
- Mirror the source path in the annotation file path (example: \`src/auth/login.ts\` -> \`.guardlink/annotations/src/auth/login.ts.gal\`)
|
|
28
|
+
- Group annotations under \`@source file:<path> line:<n> [symbol:<name>]\` so each block points at the real code location
|
|
29
|
+
- In \`.gal\` files, write raw GAL lines without \`//\` or \`#\` prefixes
|
|
30
|
+
- Do NOT modify source files just to add comments when this mode is selected
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
return `## Annotation Placement Mode
|
|
34
|
+
You MUST write annotations inline in the source code comments.
|
|
35
|
+
|
|
36
|
+
- Place annotations in the file doc-block or directly above the security-relevant code
|
|
37
|
+
- Use the host language comment syntax (\`//\`, \`#\`, \`--\`, etc.)
|
|
38
|
+
- Do NOT externalize annotations into \`.gal\` files when this mode is selected
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
17
41
|
/**
|
|
18
42
|
* Build a prompt for annotation agents.
|
|
19
43
|
*
|
|
20
44
|
* Includes the GuardLink reference doc, current model summary with flows and exposures,
|
|
21
45
|
* flow-first threat modeling methodology, and precise GAL syntax rules.
|
|
22
46
|
*/
|
|
23
|
-
export function buildAnnotatePrompt(userPrompt, root, model) {
|
|
47
|
+
export function buildAnnotatePrompt(userPrompt, root, model, annotationMode = 'inline') {
|
|
24
48
|
// Read the reference doc if available
|
|
25
49
|
let refDoc = '';
|
|
26
50
|
const refPath = resolve(root, '.guardlink', 'GUARDLINK_REFERENCE.md');
|
|
@@ -85,6 +109,7 @@ export function buildAnnotatePrompt(userPrompt, root, model) {
|
|
|
85
109
|
}
|
|
86
110
|
return `You are an expert security engineer performing threat modeling as code.
|
|
87
111
|
Your job is to read this codebase deeply, understand how code flows between components, and annotate it with GuardLink (GAL) security annotations that accurately represent the security posture.
|
|
112
|
+
This run MUST produce annotations as ${annotationModeLabel(annotationMode)}.
|
|
88
113
|
|
|
89
114
|
This is NOT a vulnerability scanner. You are building a living threat model embedded in the code itself.
|
|
90
115
|
Annotations capture what COULD go wrong, what controls exist, and how data moves — not just confirmed bugs.
|
|
@@ -95,6 +120,8 @@ ${modelSummary}${existingIds}${existingFlows}${existingExposures}
|
|
|
95
120
|
## Your Task
|
|
96
121
|
${userPrompt}
|
|
97
122
|
|
|
123
|
+
${annotationModeInstructions(annotationMode)}
|
|
124
|
+
|
|
98
125
|
## HOW TO THINK — Flow-First Threat Modeling
|
|
99
126
|
|
|
100
127
|
Before writing ANY annotation, you MUST understand the code deeply:
|
|
@@ -197,19 +224,35 @@ Place @boundary annotations where trust level changes between two components:
|
|
|
197
224
|
\`\`\`
|
|
198
225
|
|
|
199
226
|
### Where to Place Annotations
|
|
200
|
-
|
|
227
|
+
${annotationMode === 'external'
|
|
228
|
+
? 'Annotations go in associated `.gal` files, grouped by `@source` blocks that point at the real code location:'
|
|
229
|
+
: "Annotations go in the file's top doc-block comment OR directly above the security-relevant code:"}
|
|
201
230
|
|
|
202
231
|
\`\`\`
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
232
|
+
${annotationMode === 'external'
|
|
233
|
+
? [
|
|
234
|
+
'@shield:begin -- "Externalized annotation examples, excluded from parsing"',
|
|
235
|
+
'@source file:src/auth/login.ts line:42 symbol:authenticate',
|
|
236
|
+
'@exposes #auth-api to #sqli [P1] cwe:CWE-89 -- "User-supplied email reaches query builder"',
|
|
237
|
+
'@mitigates #auth-api against #sqli using #input-validation -- "Zod schema validates email before query"',
|
|
238
|
+
'@comment -- "Externalized annotations for src/auth/login.ts"',
|
|
239
|
+
'',
|
|
240
|
+
'@source file:src/auth/session.ts line:88 symbol:issueToken',
|
|
241
|
+
'@handles secrets on #auth-api -- "Issues session token"',
|
|
242
|
+
'@shield:end',
|
|
243
|
+
].join('\n')
|
|
244
|
+
: [
|
|
245
|
+
'// @shield:begin -- "Placement examples, excluded from parsing"',
|
|
246
|
+
'//',
|
|
247
|
+
'// FILE-LEVEL (top doc-block) — for module-wide security properties:',
|
|
248
|
+
'// Place @exposes, @mitigates, @flows, @handles, @boundary that describe the module as a whole',
|
|
249
|
+
'//',
|
|
250
|
+
'// INLINE (above specific functions/methods) — for function-specific concerns:',
|
|
251
|
+
'// Place @exposes, @mitigates above the exact function where the risk or control lives',
|
|
252
|
+
'// Place @comment above tricky security-relevant code to explain intent',
|
|
253
|
+
'//',
|
|
254
|
+
'// @shield:end',
|
|
255
|
+
].join('\n')}
|
|
213
256
|
\`\`\`
|
|
214
257
|
|
|
215
258
|
### Severity — Be Honest, Not Alarmist
|
|
@@ -259,7 +302,7 @@ Adding @shield on your own initiative would actively harm the threat model by cr
|
|
|
259
302
|
|
|
260
303
|
## PRECISE GAL Syntax
|
|
261
304
|
|
|
262
|
-
Definitions go in .guardlink/definitions.{ts,js,py,rs}.
|
|
305
|
+
Definitions go in .guardlink/definitions.{ts,js,py,rs}. Relationship annotations can live in source comments or standalone .gal files.
|
|
263
306
|
|
|
264
307
|
### Definitions (in .guardlink/definitions file)
|
|
265
308
|
\`\`\`
|
|
@@ -288,6 +331,14 @@ Definitions go in .guardlink/definitions.{ts,js,py,rs}. Source files use only re
|
|
|
288
331
|
// @shield:end
|
|
289
332
|
\`\`\`
|
|
290
333
|
|
|
334
|
+
### Relationships (in standalone .gal files)
|
|
335
|
+
\`\`\`
|
|
336
|
+
@source file:src/auth/login.ts line:42 symbol:authenticate
|
|
337
|
+
@exposes #auth to #sqli [P0] cwe:CWE-89 owasp:A03:2021 -- "User input concatenated into query"
|
|
338
|
+
@mitigates #auth against #sqli using #prepared-stmts -- "Uses parameterized queries via sqlx"
|
|
339
|
+
@audit #auth -- "Timing attack risk — needs human review"
|
|
340
|
+
\`\`\`
|
|
341
|
+
|
|
291
342
|
## CRITICAL SYNTAX RULES (violations cause parse errors)
|
|
292
343
|
|
|
293
344
|
1. **@boundary requires TWO assets**: \`@boundary between #A and #B\` or \`@boundary #A | #B\`.
|
|
@@ -322,6 +373,7 @@ Definitions go in .guardlink/definitions.{ts,js,py,rs}. Source files use only re
|
|
|
322
373
|
A bare \`@comment\` without description is valid but useless. Always include context.
|
|
323
374
|
|
|
324
375
|
10. **One annotation per comment line.** Do NOT put two @verbs on the same line.
|
|
376
|
+
11. **In external mode, use \`@source\` before each block** so the annotations point at the intended file and line.
|
|
325
377
|
|
|
326
378
|
## Workflow
|
|
327
379
|
|
|
@@ -339,7 +391,7 @@ Definitions go in .guardlink/definitions.{ts,js,py,rs}. Source files use only re
|
|
|
339
391
|
Think: "what's the risk, what's the defense, how does data flow here, and what should the next developer know?"
|
|
340
392
|
NEVER write @accepts — that is a human-only governance decision. Use @audit to flag unmitigated risks for review.
|
|
341
393
|
|
|
342
|
-
5. **Use the
|
|
394
|
+
5. **Use the selected annotation mode consistently.** Inline mode writes source comments; external mode writes associated \`.gal\` files with \`@source\` blocks.
|
|
343
395
|
|
|
344
396
|
6. **Run validation** via guardlink_validate (MCP) or \`guardlink validate\` to check for errors.
|
|
345
397
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":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G9D,UAAU;;EAEV,0BAA0B,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwG1C,cAAc,KAAK,UAAU;QAC3B,CAAC,CAAC,8GAA8G;QAChH,CAAC,CAAC,kGAAkG;;;EAGtG,cAAc,KAAK,UAAU;QAC3B,CAAC,CAAC;YACE,4EAA4E;YAC5E,4DAA4D;YAC5D,4FAA4F;YAC5F,yGAAyG;YACzG,8DAA8D;YAC9D,EAAE;YACF,4DAA4D;YAC5D,yDAAyD;YACzD,aAAa;SACd,CAAC,IAAI,CAAC,IAAI,CAAC;QACd,CAAC,CAAC;YACE,iEAAiE;YACjE,IAAI;YACJ,sEAAsE;YACtE,gGAAgG;YAChG,IAAI;YACJ,gFAAgF;YAChF,wFAAwF;YACxF,yEAAyE;YACzE,IAAI;YACJ,gBAAgB;SACjB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJjB,CAAC;AACF,CAAC"}
|
package/dist/analyze/prompts.js
CHANGED
|
@@ -23,7 +23,7 @@ Your job is to **produce a complete, standalone threat model** for a real codeba
|
|
|
23
23
|
|
|
24
24
|
You will receive:
|
|
25
25
|
1. **Project context** — language/framework, dependencies, deployment signals (Dockerfile, CI config, etc.)
|
|
26
|
-
2. **Annotation graph** — structured security metadata extracted from source
|
|
26
|
+
2. **Annotation graph** — structured security metadata extracted from GuardLink annotations in source comments or standalone \`.gal\` files
|
|
27
27
|
3. **Code snippets** — the actual source lines surrounding each annotation, so you can validate what developers claimed
|
|
28
28
|
|
|
29
29
|
## How to use these inputs
|
package/dist/cli/index.js
CHANGED
|
@@ -45,7 +45,7 @@ import { generateSarif } from '../analyzer/index.js';
|
|
|
45
45
|
import { startStdioServer } from '../mcp/index.js';
|
|
46
46
|
import { generateThreatReport, listThreatReports, loadThreatReportsForDashboard, buildConfig, FRAMEWORK_LABELS, FRAMEWORK_PROMPTS, serializeModel, buildUserMessage } from '../analyze/index.js';
|
|
47
47
|
import { generateDashboardHTML } from '../dashboard/index.js';
|
|
48
|
-
import { AGENTS, agentFromOpts, launchAgent, launchAgentInline, buildAnnotatePrompt } from '../agents/index.js';
|
|
48
|
+
import { AGENTS, agentFromOpts, launchAgent, launchAgentInline, buildAnnotatePrompt, resolveAnnotationMode } from '../agents/index.js';
|
|
49
49
|
import { resolveConfig, saveProjectConfig, saveGlobalConfig, loadProjectConfig, loadGlobalConfig, maskKey, describeConfigSource } from '../agents/config.js';
|
|
50
50
|
import { getReviewableExposures, applyReviewAction, formatExposureForReview, summarizeReview } from '../review/index.js';
|
|
51
51
|
import { populateMetadata, mergeReports, formatMergeSummary, diffMergedReports, formatDiffSummary, linkProject, addToWorkspace, removeFromWorkspace } from '../workspace/index.js';
|
|
@@ -95,7 +95,7 @@ function detectProjectName(root, explicit) {
|
|
|
95
95
|
program
|
|
96
96
|
.name('guardlink')
|
|
97
97
|
.description('GuardLink — Security annotations for code. Threat modeling that lives in your codebase.')
|
|
98
|
-
.version('1.4.
|
|
98
|
+
.version('1.4.2')
|
|
99
99
|
.addHelpText('before', gradient(['#00ff41', '#00d4ff'])(ASCII_LOGO));
|
|
100
100
|
// ─── init ────────────────────────────────────────────────────────────
|
|
101
101
|
program
|
|
@@ -104,6 +104,7 @@ program
|
|
|
104
104
|
.argument('[dir]', 'Project directory', '.')
|
|
105
105
|
.option('-p, --project <n>', 'Override project name')
|
|
106
106
|
.option('-a, --agent <agents>', 'Agent(s) to create files for: claude,cursor,codex,copilot,windsurf,cline,none (comma-separated)')
|
|
107
|
+
.option('--mode <mode>', 'Annotation mode: inline (default) or external. external restricts all writes to .guardlink/ — no agent files, no .mcp.json at root', 'inline')
|
|
107
108
|
.option('--skip-agent-files', 'Only create .guardlink/, skip agent file updates')
|
|
108
109
|
.option('--force', 'Overwrite existing GuardLink config and instructions')
|
|
109
110
|
.option('--dry-run', 'Show what would be created without writing files')
|
|
@@ -140,6 +141,7 @@ program
|
|
|
140
141
|
const result = initProject({
|
|
141
142
|
root,
|
|
142
143
|
project: opts.project,
|
|
144
|
+
mode: resolveAnnotationMode(opts.mode),
|
|
143
145
|
skipAgentFiles: opts.skipAgentFiles,
|
|
144
146
|
force: opts.force,
|
|
145
147
|
dryRun: opts.dryRun,
|
|
@@ -586,15 +588,25 @@ program
|
|
|
586
588
|
.argument('<prompt>', 'Annotation instructions (e.g., "annotate auth endpoints for OWASP Top 10")')
|
|
587
589
|
.argument('[dir]', 'Project directory', '.')
|
|
588
590
|
.option('-p, --project <n>', 'Project name', 'unknown')
|
|
591
|
+
.option('--mode <mode>', 'Annotation placement mode: inline (default) or external (externalized .gal files)', 'inline')
|
|
589
592
|
.option('--claude-code', 'Launch Claude Code in foreground')
|
|
590
593
|
.option('--codex', 'Launch Codex CLI in foreground')
|
|
591
594
|
.option('--gemini', 'Launch Gemini CLI in foreground')
|
|
592
595
|
.option('--cursor', 'Open Cursor IDE with prompt on clipboard')
|
|
593
596
|
.option('--windsurf', 'Open Windsurf IDE with prompt on clipboard')
|
|
594
597
|
.option('--clipboard', 'Copy annotation prompt to clipboard only')
|
|
598
|
+
.option('--stdout', 'Print annotation prompt to stdout and exit (for piping)')
|
|
595
599
|
.action(async (prompt, dir, opts) => {
|
|
596
600
|
const root = resolve(dir);
|
|
597
601
|
const project = detectProjectName(root, opts.project);
|
|
602
|
+
let annotationMode;
|
|
603
|
+
try {
|
|
604
|
+
annotationMode = resolveAnnotationMode(opts.mode);
|
|
605
|
+
}
|
|
606
|
+
catch (err) {
|
|
607
|
+
console.error(err.message);
|
|
608
|
+
process.exit(1);
|
|
609
|
+
}
|
|
598
610
|
// Resolve agent
|
|
599
611
|
const agent = agentFromOpts(opts);
|
|
600
612
|
if (!agent) {
|
|
@@ -614,13 +626,18 @@ program
|
|
|
614
626
|
}
|
|
615
627
|
catch { /* no model yet — that's fine */ }
|
|
616
628
|
// Build prompt
|
|
617
|
-
const fullPrompt = buildAnnotatePrompt(prompt, root, model);
|
|
629
|
+
const fullPrompt = buildAnnotatePrompt(prompt, root, model, annotationMode);
|
|
618
630
|
// Launch agent
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
631
|
+
if (agent.id !== 'stdout') {
|
|
632
|
+
console.log(`Launching ${agent.name} for annotation...`);
|
|
633
|
+
if (agent.cmd) {
|
|
634
|
+
console.log(`${agent.name} will take over this terminal. Exit the agent to return.\n`);
|
|
635
|
+
}
|
|
622
636
|
}
|
|
623
637
|
const result = launchAgent(agent, fullPrompt, root);
|
|
638
|
+
// stdout mode: prompt already written to stdout — nothing else to do
|
|
639
|
+
if (agent.id === 'stdout')
|
|
640
|
+
return;
|
|
624
641
|
if (result.clipboardCopied) {
|
|
625
642
|
console.log(`✓ Prompt copied to clipboard (${fullPrompt.length.toLocaleString()} chars)`);
|
|
626
643
|
}
|
|
@@ -803,7 +820,7 @@ program
|
|
|
803
820
|
}
|
|
804
821
|
const result = await applyReviewAction(root, reviewable, { decision: 'accept', justification });
|
|
805
822
|
results.push(result);
|
|
806
|
-
console.error(` ✓ Accepted — ${result.linesInserted} line(s) written to ${
|
|
823
|
+
console.error(` ✓ Accepted — ${result.linesInserted} line(s) written to ${result.targetFile}\n`);
|
|
807
824
|
}
|
|
808
825
|
else if (choice === 'r') {
|
|
809
826
|
let note = '';
|
|
@@ -814,10 +831,10 @@ program
|
|
|
814
831
|
}
|
|
815
832
|
const result = await applyReviewAction(root, reviewable, { decision: 'remediate', justification: note });
|
|
816
833
|
results.push(result);
|
|
817
|
-
console.error(` ✓ Marked for remediation — ${result.linesInserted} line(s) written to ${
|
|
834
|
+
console.error(` ✓ Marked for remediation — ${result.linesInserted} line(s) written to ${result.targetFile}\n`);
|
|
818
835
|
}
|
|
819
836
|
else {
|
|
820
|
-
results.push({ exposure: reviewable, action: { decision: 'skip', justification: '' }, linesInserted: 0 });
|
|
837
|
+
results.push({ exposure: reviewable, action: { decision: 'skip', justification: '' }, linesInserted: 0, targetFile: reviewable.exposure.location.file });
|
|
821
838
|
console.error(' — Skipped\n');
|
|
822
839
|
}
|
|
823
840
|
}
|
|
@@ -1238,10 +1255,12 @@ program
|
|
|
1238
1255
|
console.log(H(' GAL — GuardLink Annotation Language'));
|
|
1239
1256
|
console.log(H(' ══════════════════════════════════════════════════════════'));
|
|
1240
1257
|
console.log('');
|
|
1241
|
-
console.log(D(' Annotations live in source
|
|
1242
|
-
console.log(D(' them
|
|
1258
|
+
console.log(D(' Annotations live in source comments or standalone .gal files.'));
|
|
1259
|
+
console.log(D(' GuardLink parses them into a live threat model for your codebase.'));
|
|
1243
1260
|
console.log('');
|
|
1244
1261
|
console.log(D(' Syntax: @verb subject [preposition object] [-- "description"]'));
|
|
1262
|
+
console.log(D(' Inline examples below use comment prefixes; raw .gal files use the same lines without // or #.'));
|
|
1263
|
+
console.log(D(' In .gal files, use @source file:<path> line:<n> [symbol:<name>] to anchor following annotations.'));
|
|
1245
1264
|
console.log('');
|
|
1246
1265
|
// ── DEFINITIONS ──
|
|
1247
1266
|
console.log(H(' ── Definitions ─────────────────────────────────────────────'));
|