@aigis-ai/cli 2.0.1 → 2.1.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 (111) hide show
  1. package/README.md +97 -178
  2. package/bin/aigis.js +139 -8
  3. package/content/resolvers/triggers.json +363 -41
  4. package/content/skills/areas/audit-logging.md +33 -0
  5. package/content/skills/areas/bias-monitoring.md +34 -0
  6. package/content/skills/areas/confidence-scoring.md +23 -0
  7. package/content/skills/areas/data-integrity.md +25 -0
  8. package/content/skills/areas/eu-ai-act-art-13-deployer-transparency.md +133 -0
  9. package/content/skills/areas/eu-ai-act-art-50-transparency-disclosure.md +134 -0
  10. package/content/skills/areas/eu-ai-act-art-73-incident-reporting.md +149 -0
  11. package/content/skills/areas/eu-ai-act-art-9-risk-management.md +141 -0
  12. package/content/skills/areas/fallback-patterns.md +28 -0
  13. package/content/skills/areas/human-oversight.md +38 -0
  14. package/content/skills/areas/input-validation.md +27 -0
  15. package/content/skills/areas/monitoring.md +29 -0
  16. package/content/skills/areas/prompt-security.md +29 -0
  17. package/content/templates/eu-ai-act-annex-iv.md +193 -0
  18. package/docs/frontmatter-schema.md +75 -0
  19. package/docs/screenshots/README.md +17 -0
  20. package/docs/screenshots/agent-flow.png +0 -0
  21. package/docs/screenshots/setup.png +0 -0
  22. package/docs/screenshots/verify.png +0 -0
  23. package/lib/auto-verify.js +70 -1
  24. package/lib/build.js +101 -12
  25. package/lib/classify.js +8 -2
  26. package/lib/init.js +269 -5
  27. package/lib/jurisdiction.js +137 -0
  28. package/lib/report.js +331 -0
  29. package/package.json +1 -1
  30. package/scripts/area-controls-baseline.json +188 -0
  31. package/scripts/area-frontmatter.schema.json +61 -0
  32. package/scripts/validate-area-frontmatter.js +228 -0
  33. package/cli-python/LICENSE +0 -21
  34. package/cli-python/README.md +0 -32
  35. package/cli-python/aigis_cli/SKILL.md +0 -70
  36. package/cli-python/aigis_cli/__init__.py +0 -3
  37. package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
  38. package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
  39. package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
  40. package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
  41. package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
  42. package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
  43. package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
  44. package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
  45. package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
  46. package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
  47. package/cli-python/aigis_cli/annotate.py +0 -45
  48. package/cli-python/aigis_cli/auto_verify.py +0 -518
  49. package/cli-python/aigis_cli/build.py +0 -470
  50. package/cli-python/aigis_cli/checksum.py +0 -22
  51. package/cli-python/aigis_cli/classify.py +0 -192
  52. package/cli-python/aigis_cli/cli.py +0 -618
  53. package/cli-python/aigis_cli/content/index/audit-scan.md +0 -217
  54. package/cli-python/aigis_cli/content/index/auto-verify-rules.json +0 -439
  55. package/cli-python/aigis_cli/content/index/context-rules.json +0 -90
  56. package/cli-python/aigis_cli/content/index/frameworks.md +0 -82
  57. package/cli-python/aigis_cli/content/index/guardrails.json +0 -23
  58. package/cli-python/aigis_cli/content/index/taxonomy.md +0 -81
  59. package/cli-python/aigis_cli/content/resolvers/triggers.json +0 -229
  60. package/cli-python/aigis_cli/content/skills/areas/audit-logging.md +0 -176
  61. package/cli-python/aigis_cli/content/skills/areas/bias-monitoring.md +0 -172
  62. package/cli-python/aigis_cli/content/skills/areas/confidence-scoring.md +0 -180
  63. package/cli-python/aigis_cli/content/skills/areas/data-integrity.md +0 -257
  64. package/cli-python/aigis_cli/content/skills/areas/explainability.md +0 -174
  65. package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +0 -200
  66. package/cli-python/aigis_cli/content/skills/areas/human-oversight.md +0 -220
  67. package/cli-python/aigis_cli/content/skills/areas/input-validation.md +0 -380
  68. package/cli-python/aigis_cli/content/skills/areas/monitoring.md +0 -207
  69. package/cli-python/aigis_cli/content/skills/areas/output-sanitization.md +0 -183
  70. package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +0 -189
  71. package/cli-python/aigis_cli/content/skills/areas/prompt-security.md +0 -153
  72. package/cli-python/aigis_cli/content/skills/areas/rag-security.md +0 -230
  73. package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +0 -246
  74. package/cli-python/aigis_cli/content/skills/areas/supply-chain.md +0 -193
  75. package/cli-python/aigis_cli/content/skills/core.md +0 -62
  76. package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +0 -202
  77. package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -169
  78. package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +0 -167
  79. package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -86
  80. package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +0 -54
  81. package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +0 -39
  82. package/cli-python/aigis_cli/content/templates/risk-characterization.md +0 -34
  83. package/cli-python/aigis_cli/content/templates/third-party-assessment.md +0 -41
  84. package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +0 -13
  85. package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -13
  86. package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -13
  87. package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +0 -12
  88. package/cli-python/aigis_cli/content/verify/checklist-explainability.md +0 -13
  89. package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -13
  90. package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +0 -14
  91. package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +0 -16
  92. package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +0 -13
  93. package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +0 -14
  94. package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +0 -14
  95. package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +0 -13
  96. package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +0 -12
  97. package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +0 -13
  98. package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +0 -13
  99. package/cli-python/aigis_cli/fetch.py +0 -232
  100. package/cli-python/aigis_cli/init_ide.py +0 -159
  101. package/cli-python/aigis_cli/keywords.py +0 -73
  102. package/cli-python/aigis_cli/search.py +0 -69
  103. package/cli-python/aigis_cli.egg-info/PKG-INFO +0 -59
  104. package/cli-python/aigis_cli.egg-info/SOURCES.txt +0 -56
  105. package/cli-python/aigis_cli.egg-info/dependency_links.txt +0 -1
  106. package/cli-python/aigis_cli.egg-info/entry_points.txt +0 -2
  107. package/cli-python/aigis_cli.egg-info/requires.txt +0 -6
  108. package/cli-python/aigis_cli.egg-info/top_level.txt +0 -1
  109. package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
  110. package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
  111. package/cli-python/pyproject.toml +0 -49
@@ -1,13 +0,0 @@
1
- ---
2
- id: checklist-supply-chain
3
- implements: supply-chain
4
- ---
5
- # Verification: Supply chain
6
-
7
- | # | Check | Control | Status | Evidence |
8
- |---|-------|---------|--------|----------|
9
- | V1 | Is the model version pinned to a specific identifier (not "latest")? | LLM03/P1 | [ ] | |
10
- | V2 | Is model version tracked in every response/log entry? | LLM03/P2 | [ ] | |
11
- | V3 | Is there a regression test suite for model version upgrades? | LLM03/P3 | [ ] | |
12
- | V4 | Is there a fallback provider or degradation path for outages? | LLM03/P4 | [ ] | |
13
- | V5 | Confirm: client library versions are also pinned. | Anti-pattern | [ ] | |
@@ -1,232 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import json
4
- import re
5
- from pathlib import Path
6
-
7
- import frontmatter
8
-
9
- from .annotate import get_annotations
10
-
11
- CONTENT_DIR = Path(__file__).resolve().parent / "content"
12
-
13
- SEPARATOR = "\n\n---\n\n"
14
-
15
- # Language canonicalization — mirrors lib/fetch.js.
16
- _LANG_ALIASES = {
17
- "py": "python", "python": "python",
18
- "js": "javascript", "javascript": "javascript", "node": "javascript",
19
- "ts": "typescript", "typescript": "typescript",
20
- "go": "go", "golang": "go",
21
- "rust": "rust", "rs": "rust",
22
- }
23
- _LANG_FENCE_KEEPS = {
24
- "python": {"python", "py"},
25
- "javascript": {"javascript", "js", "node"},
26
- "typescript": {"typescript", "ts", "javascript", "js"},
27
- "go": {"go"},
28
- "rust": {"rust", "rs"},
29
- }
30
- _ALL_LANG_FENCES = {"python", "py", "javascript", "js", "node", "typescript", "ts", "go", "rust", "rs"}
31
-
32
- _VALID_CONTEXTS = {"web", "agentic", "rag", "batch"}
33
- _context_rules_cache: dict | None = None
34
-
35
-
36
- def read_file(directory: str, file_id: str) -> str:
37
- filepath = CONTENT_DIR / directory / f"{file_id}.md"
38
- if not filepath.exists():
39
- raise FileNotFoundError(f"File not found: {directory}/{file_id}.md")
40
- return filepath.read_text(encoding="utf-8")
41
-
42
-
43
- def list_dir(directory: str) -> list[str]:
44
- dirpath = CONTENT_DIR / directory
45
- if not dirpath.exists():
46
- return []
47
- return sorted(
48
- p.stem for p in dirpath.iterdir() if p.suffix == ".md"
49
- )
50
-
51
-
52
- def strip_frontmatter(content: str) -> str:
53
- parsed = frontmatter.loads(content)
54
- return parsed.content.strip()
55
-
56
-
57
- def _canonicalize_lang(lang: str | None) -> str | None:
58
- if not lang:
59
- return None
60
- normalized = lang.lower()
61
- canonical = _LANG_ALIASES.get(normalized)
62
- if not canonical:
63
- raise ValueError(
64
- f'Unknown language "{lang}". Known: py, python, js, javascript, ts, typescript, go, rust.'
65
- )
66
- return canonical
67
-
68
-
69
- def filter_language(content: str, lang: str | None) -> str:
70
- canonical = _canonicalize_lang(lang)
71
- if not canonical:
72
- return content
73
- keep_set = _LANG_FENCE_KEEPS[canonical]
74
-
75
- block_re = re.compile(r"^```([A-Za-z0-9_+-]*)\s*\n[\s\S]*?^```\s*$\n?", re.MULTILINE)
76
-
77
- def _sub(m: re.Match[str]) -> str:
78
- tag = (m.group(1) or "").lower()
79
- if tag not in _ALL_LANG_FENCES:
80
- return m.group(0)
81
- return m.group(0) if tag in keep_set else ""
82
-
83
- out = block_re.sub(_sub, content)
84
- return re.sub(r"\n{3,}", "\n\n", out)
85
-
86
-
87
- def _load_context_rules() -> dict:
88
- global _context_rules_cache
89
- if _context_rules_cache is not None:
90
- return _context_rules_cache
91
- rules_path = CONTENT_DIR / "index" / "context-rules.json"
92
- if not rules_path.exists():
93
- _context_rules_cache = {"rules": []}
94
- return _context_rules_cache
95
- _context_rules_cache = json.loads(rules_path.read_text(encoding="utf-8"))
96
- return _context_rules_cache
97
-
98
-
99
- def _canonicalize_context(context: str | None) -> str | None:
100
- if not context:
101
- return None
102
- normalized = context.lower()
103
- if normalized not in _VALID_CONTEXTS:
104
- raise ValueError(
105
- f'Unknown context "{context}". Known: web, agentic, rag, batch.'
106
- )
107
- return normalized
108
-
109
-
110
- def filter_context(content: str, context: str | None, file_id: str) -> str:
111
- canonical = _canonicalize_context(context)
112
- if not canonical:
113
- return content
114
-
115
- rules = _load_context_rules().get("rules", [])
116
- file_rules = [r for r in rules if r.get("file") == file_id]
117
- if not file_rules:
118
- return content
119
-
120
- lines = content.split("\n")
121
- keep = [True] * len(lines)
122
- for rule in file_rules:
123
- if canonical in rule["contexts"]:
124
- continue # pattern applies to this context; keep
125
- prefix = re.escape(rule["pattern_heading_prefix"])
126
- header_re = re.compile(r"^###\s+" + prefix + r"\b")
127
- i = 0
128
- while i < len(lines):
129
- if header_re.match(lines[i]):
130
- j = i
131
- while j < len(lines):
132
- if j > i and re.match(r"^(##\s|###\s)", lines[j]):
133
- break
134
- keep[j] = False
135
- j += 1
136
- i = j
137
- continue
138
- i += 1
139
-
140
- filtered = "\n".join(ln for ln, k in zip(lines, keep) if k)
141
- return re.sub(r"\n{3,}", "\n\n", filtered)
142
-
143
-
144
- def append_annotations(content: str, file_id: str) -> str:
145
- annotations = get_annotations(file_id)
146
- if not annotations:
147
- return content
148
- block = "\n\n---\n## Local annotations\n\n"
149
- for a in annotations:
150
- block += f'- {a["note"]} _({a["date"]})_\n'
151
- return content + block
152
-
153
-
154
- def get(file_ids: list[str] | None, *, all_files: bool = False,
155
- strip_fm: bool = True, lang: str | None = None,
156
- context: str | None = None) -> str:
157
- if all_files:
158
- file_ids = list_dir("skills/areas")
159
-
160
- if not file_ids:
161
- raise ValueError('Provide file IDs or use --all. Run "aigis search --list" to see available files.')
162
-
163
- outputs: list[str] = []
164
- for fid in file_ids:
165
- content = read_file("skills/areas", fid)
166
- if not strip_fm:
167
- content = strip_frontmatter(content)
168
- if lang:
169
- content = filter_language(content, lang)
170
- if context:
171
- content = filter_context(content, context, fid)
172
- content = append_annotations(content, fid)
173
- outputs.append(content)
174
-
175
- return SEPARATOR.join(outputs)
176
-
177
-
178
- def verify(file_ids: list[str]) -> str:
179
- if not file_ids:
180
- raise ValueError("Provide file IDs to verify.")
181
-
182
- outputs: list[str] = []
183
- for fid in file_ids:
184
- content = read_file("verify", f"checklist-{fid}")
185
- outputs.append(content)
186
-
187
- return SEPARATOR.join(outputs)
188
-
189
-
190
- def get_template(template_ids: list[str]) -> str:
191
- if not template_ids:
192
- raise ValueError("Provide template IDs.")
193
-
194
- outputs: list[str] = []
195
- for tid in template_ids:
196
- content = read_file("templates", tid)
197
- outputs.append(content)
198
-
199
- return SEPARATOR.join(outputs)
200
-
201
-
202
- def get_audit_scan() -> str:
203
- return read_file("index", "audit-scan")
204
-
205
-
206
- def get_core() -> str:
207
- return read_file("skills", "core")
208
-
209
-
210
- def get_workflow(type_: str) -> str:
211
- if not type_:
212
- raise ValueError(
213
- 'Provide a workflow type. Run "aigis workflow --list" to see available workflows.'
214
- )
215
- return read_file("skills/workflows", type_)
216
-
217
-
218
- def list_workflows() -> list[str]:
219
- return list_dir("skills/workflows")
220
-
221
-
222
- def get_infra(area: str) -> str:
223
- if not area:
224
- raise ValueError(
225
- 'Provide an infrastructure area. Run "aigis infra --list" to see available areas.'
226
- )
227
- return read_file("skills/infrastructure", area)
228
-
229
-
230
- def list_infras() -> list[str]:
231
- # Sort case-insensitively so output is stable regardless of filesystem order.
232
- return sorted(list_dir("skills/infrastructure"), key=str.lower)
@@ -1,159 +0,0 @@
1
- """Mirror of lib/init.js — embeds core skill + resolver block into IDE rules files."""
2
-
3
- from __future__ import annotations
4
-
5
- import re
6
- import sys
7
- from pathlib import Path
8
-
9
- from rich.console import Console
10
-
11
- from .checksum import compute_file_checksum
12
- from .fetch import get_core
13
- from .keywords import TRIGGERS_PATH, load_triggers
14
-
15
- console = Console(highlight=False)
16
-
17
- HEADER = (
18
- "# Aigis core skill — installed by `aigis init`\n"
19
- "# Re-run `aigis init <ide>` to refresh this file when Aigis updates.\n"
20
- "# Area + workflow skills load on demand via the aigis CLI; they are NOT in this file.\n\n"
21
- )
22
-
23
- RESOLVER_BLOCK_RE = re.compile(
24
- r"# --- AIGIS RESOLVER BLOCK START \(checksum: ([a-f0-9]+)\) ---[\s\S]*?# --- AIGIS RESOLVER BLOCK END ---",
25
- re.MULTILINE,
26
- )
27
-
28
-
29
- IDE_DESTINATIONS: dict[str, dict] = {
30
- "cursor": {"file": ".cursorrules", "instruction": "Cursor will read these instructions on every interaction in this project."},
31
- "windsurf": {"file": ".windsurfrules", "instruction": "Windsurf will read these instructions on every interaction in this project."},
32
- "copilot": {"file": ".github/copilot-instructions.md", "instruction": "Copilot will read these instructions for this repository."},
33
- "claude-code": {"file": None, "instruction": "Claude Code will read this skill file. Restart Claude Code for it to take effect."},
34
- }
35
-
36
-
37
- def _short_question(prompt: str) -> str:
38
- m = re.match(r"^You mentioned [^.]+\.\s*(.+?)\s*\(yes / no / unsure\)\s*$", prompt)
39
- return m.group(1) if m else prompt
40
-
41
-
42
- def render_resolver_block(checksum: str) -> str:
43
- triggers = load_triggers()
44
- lines: list[str] = []
45
- lines.append(f"# --- AIGIS RESOLVER BLOCK START (checksum: {checksum}) ---")
46
- lines.append(f"# Generated by `aigis init` from content/resolvers/triggers.json (version {triggers['version']}).")
47
- lines.append("# Do not edit manually. Run `aigis init <ide> --refresh` to regenerate after Aigis updates.")
48
- lines.append("#")
49
- lines.append("# When the user describes their project in natural language, scan the description")
50
- lines.append("# for the phrases below.")
51
- lines.append("#")
52
- lines.append("# HIGH-CONFIDENCE: apply the listed traits directly.")
53
- lines.append("# LOW-CONFIDENCE: ask the user the listed clarifying question; apply the trait")
54
- lines.append("# only if they confirm \"yes\". Default to \"no\" if the user is")
55
- lines.append("# unsure. Record \"unsure\" answers distinctly from \"no\" so future")
56
- lines.append("# iterations can ask again.")
57
- lines.append("")
58
- lines.append("## High-confidence triggers (auto-apply)")
59
- lines.append("")
60
-
61
- hi = triggers["high_confidence"]
62
- hi_keys = list(hi.keys())
63
- pw = max(6, *(len(k) for k in hi_keys))
64
- tw = max(6, *(len(", ".join(hi[k]["traits"])) for k in hi_keys))
65
- lines.append(f"| {'Phrase'.ljust(pw)} | {'Traits'.ljust(tw)} |")
66
- lines.append(f"|{'-' * (pw + 2)}|{'-' * (tw + 2)}|")
67
- for k in hi_keys:
68
- lines.append(f"| {k.ljust(pw)} | {', '.join(hi[k]['traits']).ljust(tw)} |")
69
-
70
- lines.append("")
71
- lines.append("## Low-confidence triggers (confirm with user before applying)")
72
- lines.append("")
73
-
74
- lo = triggers["low_confidence"]
75
- lo_keys = list(lo.keys())
76
- lpw = max(6, *(len(k) for k in lo_keys))
77
- ltw = max(6, *(len(", ".join(lo[k]["traits"])) for k in lo_keys))
78
- askw = max(6, *(len(_short_question(lo[k]["confirmation_prompt"])) for k in lo_keys))
79
- lines.append(f"| {'Phrase'.ljust(lpw)} | {'Traits'.ljust(ltw)} | {'Ask the user'.ljust(askw)} |")
80
- lines.append(f"|{'-' * (lpw + 2)}|{'-' * (ltw + 2)}|{'-' * (askw + 2)}|")
81
- for k in lo_keys:
82
- e = lo[k]
83
- lines.append(f"| {k.ljust(lpw)} | {', '.join(e['traits']).ljust(ltw)} | {_short_question(e['confirmation_prompt']).ljust(askw)} |")
84
-
85
- lines.append("")
86
- lines.append("# --- AIGIS RESOLVER BLOCK END ---")
87
- return "\n".join(lines)
88
-
89
-
90
- def _build_full_content() -> tuple[str, str]:
91
- checksum = compute_file_checksum(TRIGGERS_PATH)
92
- block = render_resolver_block(checksum)
93
- return HEADER + get_core() + "\n\n" + block + "\n", checksum
94
-
95
-
96
- def _write_or_refresh(target: Path, content: str, expected: str, refresh: bool, instruction: str, ide_name: str, display: str) -> None:
97
- if not target.exists():
98
- target.write_text(content, encoding="utf-8")
99
- console.print(f"\n[green]✓ Created {display}[/green]\n")
100
- console.print(f"[dim]{instruction}\n[/dim]")
101
- return
102
-
103
- existing = target.read_text(encoding="utf-8")
104
- match = RESOLVER_BLOCK_RE.search(existing)
105
- has_core = "aigis-core" in existing
106
-
107
- if not has_core and not match:
108
- with target.open("a", encoding="utf-8") as f:
109
- f.write("\n\n" + content)
110
- console.print(f"\n[green]✓ Appended aigis core + resolver block to {display}[/green]\n")
111
- console.print(f"[dim]Your existing rules are preserved.[/dim]")
112
- console.print(f"[dim]{instruction}\n[/dim]")
113
- return
114
-
115
- if refresh:
116
- target.write_text(content, encoding="utf-8")
117
- console.print(f"\n[green]✓ Refreshed {display} (resolver checksum: {expected[:12]}...)[/green]\n")
118
- console.print(f"[dim]{instruction}\n[/dim]")
119
- return
120
-
121
- if match and match.group(1) == expected:
122
- console.print(f"\n[dim]{display} is up to date (resolver checksum matches).[/dim]\n")
123
- return
124
-
125
- console.print(f"\n[yellow]⚠ {display} already contains an aigis section.[/yellow]")
126
- if match:
127
- console.print(f"[dim] Existing block checksum: {match.group(1)[:12]}...[/dim]")
128
- console.print(f"[dim] Current triggers.json: {expected[:12]}...[/dim]")
129
- console.print("[dim] These differ — your aigis content is out of date or has been edited.[/dim]")
130
- else:
131
- console.print("[dim] No resolver block detected, but core marker present.[/dim]")
132
- console.print("")
133
- console.print("Options:")
134
- console.print(f" [green]aigis init {ide_name} --refresh[/green] overwrite the file with the current Aigis core + resolver block")
135
- console.print(f" manually remove the existing aigis section, then re-run [green]aigis init {ide_name}[/green]")
136
- console.print("")
137
- sys.exit(1)
138
-
139
-
140
- def init(ide: str, refresh: bool = False) -> None:
141
- ide_lower = ide.lower()
142
- dest = IDE_DESTINATIONS.get(ide_lower)
143
- if not dest:
144
- console.print(f"[red]Unknown IDE: {ide}[/red]")
145
- console.print("[dim]Available: cursor, claude-code, windsurf, copilot\n[/dim]")
146
- sys.exit(1)
147
-
148
- content, checksum = _build_full_content()
149
-
150
- if ide_lower == "claude-code":
151
- skill_dir = Path.home() / ".claude" / "skills" / "aigis"
152
- skill_file = skill_dir / "SKILL.md"
153
- skill_dir.mkdir(parents=True, exist_ok=True)
154
- _write_or_refresh(skill_file, content, checksum, refresh, dest["instruction"], ide_lower, str(skill_file))
155
- return
156
-
157
- target = Path.cwd() / dest["file"]
158
- target.parent.mkdir(parents=True, exist_ok=True)
159
- _write_or_refresh(target, content, checksum, refresh, dest["instruction"], ide_lower, dest["file"])
@@ -1,73 +0,0 @@
1
- """Mirror of lib/keywords.js — the resolver.
2
-
3
- Loads content/resolvers/triggers.json and provides:
4
- - detect_traits_from_text(text): returns high/low matches + auto-applied traits
5
- - apply_confirmations(detection, decisions): merges low-confidence yes answers
6
-
7
- The two-tier match logic is identical to the JS implementation.
8
- """
9
-
10
- from __future__ import annotations
11
-
12
- import json
13
- from pathlib import Path
14
-
15
- CONTENT_DIR = Path(__file__).resolve().parent / "content"
16
- TRIGGERS_PATH = CONTENT_DIR / "resolvers" / "triggers.json"
17
-
18
- _cache: dict | None = None
19
-
20
-
21
- def load_triggers() -> dict:
22
- global _cache
23
- if _cache is None:
24
- _cache = json.loads(TRIGGERS_PATH.read_text(encoding="utf-8"))
25
- return _cache
26
-
27
-
28
- def detect_traits_from_text(text: str) -> dict:
29
- triggers = load_triggers()
30
- text_lower = text.lower()
31
-
32
- high_matches = []
33
- auto_traits: set[str] = set()
34
- for phrase, entry in triggers["high_confidence"].items():
35
- if phrase.lower() in text_lower:
36
- high_matches.append({"phrase": phrase, "traits": list(entry["traits"])})
37
- for t in entry["traits"]:
38
- auto_traits.add(t)
39
-
40
- low_matches = []
41
- next_id = 1
42
- for phrase, entry in triggers["low_confidence"].items():
43
- if phrase.lower() in text_lower:
44
- low_matches.append({
45
- "id": str(next_id),
46
- "phrase": phrase,
47
- "traits": list(entry["traits"]),
48
- "confirmation_prompt": entry["confirmation_prompt"],
49
- "notes": entry["notes"],
50
- })
51
- next_id += 1
52
-
53
- return {
54
- "high_confidence_matches": high_matches,
55
- "low_confidence_matches": low_matches,
56
- "traits_auto_applied": list(auto_traits),
57
- }
58
-
59
-
60
- def apply_confirmations(detection: dict, decisions: dict | None = None) -> dict:
61
- decisions = decisions or {}
62
- final = set(detection["traits_auto_applied"])
63
- user_decisions = []
64
- for sug in detection["low_confidence_matches"]:
65
- decision = (decisions.get(sug["id"], "no") or "no").lower()
66
- user_decisions.append({**sug, "user_decision": decision})
67
- if decision in ("yes", "y"):
68
- for t in sug["traits"]:
69
- final.add(t)
70
- return {
71
- "final_traits": sorted(final),
72
- "low_confidence_decisions": user_decisions,
73
- }
@@ -1,69 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pathlib import Path
4
-
5
- import frontmatter
6
-
7
- CONTENT_DIR = Path(__file__).resolve().parent / "content"
8
-
9
-
10
- def _load_file_meta(directory: str) -> list[dict]:
11
- dirpath = CONTENT_DIR / directory
12
- if not dirpath.exists():
13
- return []
14
-
15
- results: list[dict] = []
16
- for filepath in sorted(dirpath.iterdir()):
17
- if filepath.suffix != ".md":
18
- continue
19
- raw = filepath.read_text(encoding="utf-8")
20
- parsed = frontmatter.loads(raw)
21
- basename = filepath.stem
22
- results.append({
23
- "id": parsed.metadata.get("id", basename),
24
- "title": parsed.metadata.get("title", basename),
25
- "controls": parsed.metadata.get("controls", {}),
26
- "dir": directory,
27
- "filename": filepath.name,
28
- "content": raw.lower(),
29
- })
30
- return results
31
-
32
-
33
- def search(query: str) -> list[dict]:
34
- query_lower = query.lower()
35
- results: list[dict] = []
36
-
37
- all_files = _load_file_meta("implement") + _load_file_meta("templates")
38
-
39
- for f in all_files:
40
- matched_controls: list[str] = []
41
-
42
- title_match = query_lower in f["title"].lower()
43
-
44
- if f["controls"]:
45
- for framework, ids in f["controls"].items():
46
- for cid in (ids or []):
47
- if query_lower in cid.lower():
48
- matched_controls.append(f"{framework}:{cid}")
49
-
50
- content_match = query_lower in f["content"]
51
-
52
- if title_match or matched_controls or content_match:
53
- results.append({
54
- "id": f["id"],
55
- "title": f["title"],
56
- "dir": f["dir"],
57
- "matched_controls": matched_controls,
58
- "relevance": (3 if title_match else 0) + (len(matched_controls) * 2) + (1 if content_match else 0),
59
- })
60
-
61
- results.sort(key=lambda r: r["relevance"], reverse=True)
62
- return results
63
-
64
-
65
- def list_all() -> dict[str, list[dict]]:
66
- return {
67
- "implement": [{"id": f["id"], "title": f["title"]} for f in _load_file_meta("implement")],
68
- "templates": [{"id": f["id"], "title": f["title"]} for f in _load_file_meta("templates")],
69
- }
@@ -1,59 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: aigis-cli
3
- Version: 1.0.3
4
- Summary: AI governance guardrails for coding agents. Framework-aligned security and compliance patterns from NIST AI RMF, OWASP Top 10 for LLMs, and ISO/IEC 42001.
5
- License-Expression: MIT
6
- Project-URL: Homepage, https://github.com/NayanKanaparthi/aigis
7
- Project-URL: Repository, https://github.com/NayanKanaparthi/aigis
8
- Keywords: ai,governance,security,compliance,llm,owasp,nist,iso42001,guardrails,coding-agent
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Topic :: Security
17
- Classifier: Topic :: Software Development :: Quality Assurance
18
- Requires-Python: >=3.9
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: click>=8.0
22
- Requires-Dist: rich>=13.0
23
- Requires-Dist: python-frontmatter>=1.0
24
- Provides-Extra: dev
25
- Requires-Dist: build>=1.0; extra == "dev"
26
- Dynamic: license-file
27
-
28
- # aigis-cli (Python)
29
-
30
- AI governance guardrails for coding agents. Python port of the [@aigis-ai/cli](https://www.npmjs.com/package/@aigis-ai/cli) npm package.
31
-
32
- Curated, agent-consumable security and compliance patterns from NIST AI RMF, OWASP Top 10 for LLMs, and ISO/IEC 42001.
33
-
34
- ## Install
35
-
36
- ```bash
37
- pip install aigis-cli
38
- ```
39
-
40
- ## Quick start
41
-
42
- ```bash
43
- aigis classify --traits uses-llm,processes-pii,accepts-user-input
44
- aigis get input-validation pii-handling
45
- aigis verify input-validation pii-handling
46
- aigis template ai-impact-assessment
47
- aigis audit --scan
48
- aigis search pii
49
- aigis traits
50
- aigis init cursor
51
- ```
52
-
53
- ## Documentation
54
-
55
- See the full documentation at [github.com/NayanKanaparthi/aigis](https://github.com/NayanKanaparthi/aigis).
56
-
57
- ## License
58
-
59
- [MIT](LICENSE)
@@ -1,56 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- aigis_cli/SKILL.md
5
- aigis_cli/__init__.py
6
- aigis_cli/annotate.py
7
- aigis_cli/classify.py
8
- aigis_cli/cli.py
9
- aigis_cli/fetch.py
10
- aigis_cli/init_ide.py
11
- aigis_cli/keywords.py
12
- aigis_cli/search.py
13
- aigis_cli.egg-info/PKG-INFO
14
- aigis_cli.egg-info/SOURCES.txt
15
- aigis_cli.egg-info/dependency_links.txt
16
- aigis_cli.egg-info/entry_points.txt
17
- aigis_cli.egg-info/requires.txt
18
- aigis_cli.egg-info/top_level.txt
19
- aigis_cli/content/implement/audit-logging.md
20
- aigis_cli/content/implement/bias-monitoring.md
21
- aigis_cli/content/implement/confidence-scoring.md
22
- aigis_cli/content/implement/data-integrity.md
23
- aigis_cli/content/implement/explainability.md
24
- aigis_cli/content/implement/fallback-patterns.md
25
- aigis_cli/content/implement/human-oversight.md
26
- aigis_cli/content/implement/input-validation.md
27
- aigis_cli/content/implement/monitoring.md
28
- aigis_cli/content/implement/output-sanitization.md
29
- aigis_cli/content/implement/pii-handling.md
30
- aigis_cli/content/implement/prompt-security.md
31
- aigis_cli/content/implement/rag-security.md
32
- aigis_cli/content/implement/rate-limiting.md
33
- aigis_cli/content/implement/supply-chain.md
34
- aigis_cli/content/index/audit-scan.md
35
- aigis_cli/content/index/frameworks.md
36
- aigis_cli/content/index/guardrails.json
37
- aigis_cli/content/index/taxonomy.md
38
- aigis_cli/content/templates/ai-impact-assessment.md
39
- aigis_cli/content/templates/intended-purpose-doc.md
40
- aigis_cli/content/templates/risk-characterization.md
41
- aigis_cli/content/templates/third-party-assessment.md
42
- aigis_cli/content/verify/checklist-audit-logging.md
43
- aigis_cli/content/verify/checklist-bias-monitoring.md
44
- aigis_cli/content/verify/checklist-confidence-scoring.md
45
- aigis_cli/content/verify/checklist-data-integrity.md
46
- aigis_cli/content/verify/checklist-explainability.md
47
- aigis_cli/content/verify/checklist-fallback-patterns.md
48
- aigis_cli/content/verify/checklist-human-oversight.md
49
- aigis_cli/content/verify/checklist-input-validation.md
50
- aigis_cli/content/verify/checklist-monitoring.md
51
- aigis_cli/content/verify/checklist-output-sanitization.md
52
- aigis_cli/content/verify/checklist-pii-handling.md
53
- aigis_cli/content/verify/checklist-prompt-security.md
54
- aigis_cli/content/verify/checklist-rag-security.md
55
- aigis_cli/content/verify/checklist-rate-limiting.md
56
- aigis_cli/content/verify/checklist-supply-chain.md
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- aigis = aigis_cli.cli:cli
@@ -1,6 +0,0 @@
1
- click>=8.0
2
- rich>=13.0
3
- python-frontmatter>=1.0
4
-
5
- [dev]
6
- build>=1.0
@@ -1 +0,0 @@
1
- aigis_cli