@aigis-ai/cli 1.0.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +53 -0
- package/SKILL.md +20 -55
- package/bin/aigis.js +446 -59
- package/cli-python/LICENSE +21 -0
- package/cli-python/README.md +32 -0
- package/cli-python/aigis_cli/SKILL.md +70 -0
- package/cli-python/aigis_cli/__init__.py +3 -0
- package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/annotate.py +45 -0
- package/cli-python/aigis_cli/auto_verify.py +518 -0
- package/cli-python/aigis_cli/build.py +470 -0
- package/cli-python/aigis_cli/checksum.py +22 -0
- package/cli-python/aigis_cli/classify.py +192 -0
- package/cli-python/aigis_cli/cli.py +618 -0
- package/cli-python/aigis_cli/content/index/audit-scan.md +217 -0
- package/cli-python/aigis_cli/content/index/auto-verify-rules.json +439 -0
- package/cli-python/aigis_cli/content/index/context-rules.json +90 -0
- package/cli-python/aigis_cli/content/index/frameworks.md +82 -0
- package/cli-python/aigis_cli/content/index/guardrails.json +23 -0
- package/cli-python/aigis_cli/content/index/taxonomy.md +81 -0
- package/cli-python/aigis_cli/content/resolvers/triggers.json +229 -0
- package/{content/implement → cli-python/aigis_cli/content/skills/areas}/audit-logging.md +5 -0
- package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +200 -0
- package/cli-python/aigis_cli/content/skills/areas/input-validation.md +380 -0
- package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +189 -0
- package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +246 -0
- package/cli-python/aigis_cli/content/skills/core.md +62 -0
- package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +202 -0
- package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +169 -0
- package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +167 -0
- package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +86 -0
- package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +54 -0
- package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +39 -0
- package/cli-python/aigis_cli/content/templates/risk-characterization.md +34 -0
- package/cli-python/aigis_cli/content/templates/third-party-assessment.md +41 -0
- package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +12 -0
- package/cli-python/aigis_cli/content/verify/checklist-explainability.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +14 -0
- package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +16 -0
- package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +14 -0
- package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +14 -0
- package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +12 -0
- package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +13 -0
- package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +13 -0
- package/cli-python/aigis_cli/fetch.py +232 -0
- package/cli-python/aigis_cli/init_ide.py +159 -0
- package/cli-python/aigis_cli/keywords.py +73 -0
- package/cli-python/aigis_cli/search.py +69 -0
- package/cli-python/aigis_cli.egg-info/PKG-INFO +59 -0
- package/cli-python/aigis_cli.egg-info/SOURCES.txt +56 -0
- package/cli-python/aigis_cli.egg-info/dependency_links.txt +1 -0
- package/cli-python/aigis_cli.egg-info/entry_points.txt +2 -0
- package/cli-python/aigis_cli.egg-info/requires.txt +6 -0
- package/cli-python/aigis_cli.egg-info/top_level.txt +1 -0
- package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
- package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
- package/cli-python/pyproject.toml +49 -0
- package/content/index/audit-scan.md +21 -207
- package/content/index/auto-verify-rules.json +439 -0
- package/content/index/context-rules.json +90 -0
- package/content/resolvers/triggers.json +229 -0
- package/content/skills/areas/audit-logging.md +176 -0
- package/content/skills/areas/bias-monitoring.md +172 -0
- package/content/skills/areas/confidence-scoring.md +180 -0
- package/content/skills/areas/data-integrity.md +257 -0
- package/content/skills/areas/explainability.md +174 -0
- package/content/skills/areas/fallback-patterns.md +200 -0
- package/content/skills/areas/human-oversight.md +220 -0
- package/content/skills/areas/input-validation.md +380 -0
- package/content/skills/areas/monitoring.md +207 -0
- package/content/skills/areas/output-sanitization.md +183 -0
- package/content/skills/areas/pii-handling.md +189 -0
- package/content/skills/areas/prompt-security.md +153 -0
- package/content/skills/areas/rag-security.md +230 -0
- package/content/skills/areas/rate-limiting.md +246 -0
- package/content/skills/areas/supply-chain.md +193 -0
- package/content/skills/core.md +62 -0
- package/content/skills/infrastructure/logging.md +202 -0
- package/content/skills/infrastructure/rate-limiting.md +169 -0
- package/content/skills/infrastructure/secrets.md +167 -0
- package/content/skills/workflows/fastapi-llm.md +86 -0
- package/docs/resolvers.md +114 -0
- package/lib/auto-verify.js +378 -0
- package/lib/build.js +629 -0
- package/lib/checksum.js +39 -0
- package/lib/fetch.js +164 -9
- package/lib/init.js +141 -93
- package/lib/keywords.js +92 -130
- package/lib/special-recognizers.js +370 -0
- package/package.json +6 -2
- package/scripts/baseline-cursorrules.snapshot.txt +30 -0
- package/scripts/bootstrap-step-6-bench.js +85 -0
- package/scripts/check-content-sync.js +91 -0
- package/scripts/triggers.schema.json +50 -0
- package/scripts/validate-triggers.js +176 -0
- package/content/implement/fallback-patterns.md +0 -190
- package/content/implement/input-validation.md +0 -212
- package/content/implement/pii-handling.md +0 -207
- package/content/implement/rate-limiting.md +0 -217
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/bias-monitoring.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/confidence-scoring.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/data-integrity.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/explainability.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/human-oversight.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/monitoring.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/output-sanitization.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/prompt-security.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/rag-security.md +0 -0
- /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/supply-chain.md +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ai-impact-assessment
|
|
3
|
+
title: AI Impact Assessment Template
|
|
4
|
+
framework: ISO 42001 Clause 6.1.4 / Clause 8.4
|
|
5
|
+
required_when: risk_tier=HIGH OR jurisdiction-eu OR influences-decisions
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AI Impact Assessment
|
|
9
|
+
|
|
10
|
+
> The agent fills in each section based on the system being built. This document maps to ISO/IEC 42001:2023 Clause 8.4 (AI System Impact Assessment).
|
|
11
|
+
|
|
12
|
+
## 1. System identification
|
|
13
|
+
- **System name:** [Extract the name from the task description or code module name. Example: "Claims Severity Assessment API"]
|
|
14
|
+
- **Version:** [Use semantic versioning: 0.1.0 for first deployment]
|
|
15
|
+
- **Date:** [Use semantic versioning: 0.1.0 for first deployment]
|
|
16
|
+
- **Assessment author:** AI-assisted (review required by [role])
|
|
17
|
+
|
|
18
|
+
## 2. Intended purpose
|
|
19
|
+
- **What does this system do?** [Summarize in 1-2 sentences what the system does, not how it works technically. Example: "Assesses insurance claim severity using NLP to recommend routing to fast-track, standard, or escalated review"]
|
|
20
|
+
- **Who are the intended users?** [List the user roles who interact with the system directly. Example: "Claims processing staff (800 users across 6 offices)"]
|
|
21
|
+
- **What decisions does it support or make?** [Describe the specific decisions this output influences. Example: "Determines initial routing of insurance claims, affecting speed of resolution and adjuster workload"]
|
|
22
|
+
|
|
23
|
+
## 3. Affected populations
|
|
24
|
+
- **Who is directly affected by this system's output?** [Describe the specific decisions this output influences. Example: "Determines initial routing of insurance claims, affecting speed of resolution and adjuster workload"]
|
|
25
|
+
- **Are any vulnerable populations affected?** (minors, elderly, economically disadvantaged) [check traits]
|
|
26
|
+
- **Estimated number of affected individuals:** [inferred from scale]
|
|
27
|
+
|
|
28
|
+
## 4. Potential negative impacts
|
|
29
|
+
| Impact | Likelihood | Severity | Affected group | Mitigation |
|
|
30
|
+
|--------|-----------|----------|----------------|------------|
|
|
31
|
+
| [For each risk, describe: what goes wrong, who is harmed, how severely. Example: "High-severity claim under-assessed → customer experiences delayed payout and potential financial hardship"] | Low/Med/High | Low/Med/High | [group] | [Reference the specific implement file and pattern number. Example: "Input sanitization (input-validation.md P1-P3), PII redaction (pii-handling.md P1)"] |
|
|
32
|
+
|
|
33
|
+
## 5. Controls implemented
|
|
34
|
+
| Control | Implementation | Framework reference |
|
|
35
|
+
|---------|---------------|-------------------|
|
|
36
|
+
| [List each implement file used, the specific patterns applied, and the function/module that implements them] | [Reference the exact function name and file location. Example: "sanitize_input() in app/middleware/validation.py"] | [Copy the control IDs from the implement file frontmatter. Example: "OWASP LLM01, NIST MEASURE-2.7, ISO Cl.8.2"] |
|
|
37
|
+
|
|
38
|
+
## 6. Residual risks
|
|
39
|
+
- [List risks that controls cannot fully eliminate. For each: describe the risk, why it persists, and why the residual level is acceptable. Example: "Novel prompt injection techniques may bypass pattern detection. Residual risk accepted because output schema validation (P4) limits damage, and human oversight catches anomalies."]
|
|
40
|
+
|
|
41
|
+
## 7. Human oversight mechanism
|
|
42
|
+
- **Override available:** Yes/No
|
|
43
|
+
- **Escalation path:** [Describe the specific override mechanism implemented: endpoint URL, who can trigger it, what happens when triggered]
|
|
44
|
+
- **Kill switch:** [Describe the kill switch: where the config lives, who has access, what disabling looks like, recovery process]
|
|
45
|
+
|
|
46
|
+
## 8. Monitoring plan
|
|
47
|
+
- **Metrics tracked:** [List the specific metrics from monitoring.md Pattern 1 that are being tracked for this system]
|
|
48
|
+
- **Review frequency:** [HIGH: weekly metric review, monthly bias audit, quarterly red-team. MEDIUM: monthly metric review, quarterly bias check. LOW: quarterly metric review]
|
|
49
|
+
- **Responsible party:** [role, not auto-filled — requires human input]
|
|
50
|
+
|
|
51
|
+
## 9. Review and approval
|
|
52
|
+
- **Assessment reviewed by:** _________________ (required: human reviewer)
|
|
53
|
+
- **Date:** _________________
|
|
54
|
+
- **Approved for deployment:** Yes / No / Conditional
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: intended-purpose-doc
|
|
3
|
+
title: Intended Purpose Documentation
|
|
4
|
+
framework: NIST MAP 1.1
|
|
5
|
+
required_when: risk_tier=HIGH OR risk_tier=MEDIUM
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Intended purpose documentation
|
|
9
|
+
|
|
10
|
+
> Maps to NIST AI RMF MAP 1.1. The agent generates this alongside code for medium and high-risk systems.
|
|
11
|
+
|
|
12
|
+
## System purpose
|
|
13
|
+
- **Primary function:** [Summarize in 1-2 sentences. Focus on WHAT the system does and WHY, not HOW. Example: "Routes insurance claims to appropriate handling tracks based on AI-assessed severity to reduce triage time from 4 hours to under 5 minutes"]
|
|
14
|
+
- **Problem it solves:** [Describe the business problem in user terms, not technical terms. Example: "Manual claim triage is slow and inconsistent across adjusters, causing delays for customers and uneven workloads"]
|
|
15
|
+
- **What it does NOT do:** [limitations, inferred from system type]
|
|
16
|
+
|
|
17
|
+
## Intended users
|
|
18
|
+
- **Primary users:** [List specific roles, their expertise level, and how they interact with the system. Example: "Claims processors (non-technical, 2+ years claims experience) view AI recommendations in the claims management UI"]
|
|
19
|
+
- **User expertise level:** [Describe the business problem in user terms, not technical terms. Example: "Manual claim triage is slow and inconsistent across adjusters, causing delays for customers and uneven workloads"]
|
|
20
|
+
- **Training required:** [recommended based on system complexity]
|
|
21
|
+
|
|
22
|
+
## Deployment context
|
|
23
|
+
- **Environment:** [production/staging/internal]
|
|
24
|
+
- **Access scope:** [internal-only / customer-facing / public]
|
|
25
|
+
- **Geographic scope:** [List countries/regions based on jurisdiction traits. If jurisdiction-eu: list EU member states served. If jurisdiction-global: list all regions]
|
|
26
|
+
- **Expected volume:** [If is-high-volume: estimate requests/day and concurrent users. Otherwise: state "Low volume, <1000 requests/day"]
|
|
27
|
+
|
|
28
|
+
## Known limitations
|
|
29
|
+
- [List 3-5 concrete limitations. Reference known limitations from the model provider. Example: "Cannot verify factual claims in claim descriptions", "Performance degrades below 20-word inputs"]
|
|
30
|
+
- The system should NOT be used for: [generated]
|
|
31
|
+
|
|
32
|
+
## Legal and regulatory context
|
|
33
|
+
- **Applicable regulations:** [List countries/regions based on jurisdiction traits. If jurisdiction-eu: list EU member states served. If jurisdiction-global: list all regions]
|
|
34
|
+
- **Compliance requirements:** [list of applicable frameworks]
|
|
35
|
+
|
|
36
|
+
## Stakeholder expectations
|
|
37
|
+
- **Organization:** [alignment with organizational mission — requires human input]
|
|
38
|
+
- **Users:** [what users expect from the system]
|
|
39
|
+
- **Affected individuals:** [what people affected by decisions expect]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: risk-characterization
|
|
3
|
+
title: Risk Characterization Template
|
|
4
|
+
framework: NIST MAP 5.1
|
|
5
|
+
required_when: risk_tier=HIGH
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Risk characterization
|
|
9
|
+
|
|
10
|
+
> Maps to NIST AI RMF MAP 5.1. Documents likelihood and magnitude of identified impacts.
|
|
11
|
+
|
|
12
|
+
## Identified risks
|
|
13
|
+
|
|
14
|
+
| # | Risk description | Likelihood | Magnitude | Risk score | Mitigation | Residual risk |
|
|
15
|
+
|---|-----------------|-----------|-----------|------------|------------|---------------|
|
|
16
|
+
| 1 | [Describe one specific failure scenario per row. Be concrete: "LLM assigns severity 2 to a claim that should be 8, causing a legitimate high-severity claim to be fast-tracked instead of escalated"] | 1-5 | 1-5 | L×M | [control reference] | [after mitigation] |
|
|
17
|
+
|
|
18
|
+
## Risk categories assessed
|
|
19
|
+
- **Accuracy/reliability risks:** [Describe specific ways the system could produce wrong outputs. Example: "Severity score miscalibration on multi-incident claims leads to under-assessment"]
|
|
20
|
+
- **Bias/fairness risks:** [Describe how different groups might receive different outcomes. Example: "Claims written in informal language may receive lower severity scores, correlating with demographic patterns"]
|
|
21
|
+
- **Security risks:** [Describe attack vectors specific to this system. Reference relevant OWASP LLM IDs. Example: "Prompt injection via crafted claim descriptions (LLM01) could manipulate severity scores"]
|
|
22
|
+
- **Privacy risks:** [Describe how sensitive data could be exposed. Example: "Claim descriptions containing medical details could be leaked via LLM output or logs"]
|
|
23
|
+
- **Safety risks:** [Describe how system failures could cause harm. Example: "Under-assessed high-severity claims delay critical payouts, causing financial hardship"]
|
|
24
|
+
- **Transparency risks:** [Describe situations where decisions cannot be explained. Example: "LLM scoring rationale is opaque — adjusters cannot explain to customers why a score was assigned"]
|
|
25
|
+
|
|
26
|
+
## Impact assessment
|
|
27
|
+
- **Individual impact:** [Describe the concrete harm to one person if the system fails. Example: "A customer with a legitimate $50K claim experiences a 2-week delay and financial stress because the AI routed it to fast-track instead of escalation"]
|
|
28
|
+
- **Group impact:** [Describe how a class of people could be systematically affected. Example: "Non-native English speakers may consistently receive lower severity scores due to writing style bias in the LLM"]
|
|
29
|
+
- **Organizational impact:** [Describe business consequences. Example: "Systematic under-assessment could trigger regulatory investigation, class-action litigation, and reputational damage estimated at $X"]
|
|
30
|
+
- **Societal impact:** [Describe broader effects if this system's pattern were widespread. Example: "Algorithmic bias in insurance claim assessment could deepen existing inequities in financial services access"]
|
|
31
|
+
|
|
32
|
+
## Risk tolerance
|
|
33
|
+
- **Acceptable risk level:** [This requires human input — state the organization's risk appetite. Example: "False negative rate (under-assessed severe claims) must be below 2%. False positive rate (over-escalated minor claims) acceptable up to 15%."]
|
|
34
|
+
- **Go/no-go recommendation:** [Based on the residual risk analysis above: recommend proceed, proceed with conditions, or do not proceed. State the specific conditions if conditional. Example: "Proceed with conditions: mandatory human review for all claims over $25K, quarterly bias audit, 90-day pilot before full rollout"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: third-party-assessment
|
|
3
|
+
title: Third-Party AI Assessment
|
|
4
|
+
framework: NIST GOVERN 6 / OWASP LLM03
|
|
5
|
+
required_when: uses-thirdparty-api AND (risk_tier=HIGH OR risk_tier=MEDIUM)
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Third-party AI assessment
|
|
9
|
+
|
|
10
|
+
> Maps to NIST GOVERN 6.1/6.2 and OWASP LLM03. Documents risks of third-party AI dependencies.
|
|
11
|
+
|
|
12
|
+
## Provider information
|
|
13
|
+
- **Provider:** [Extract from the import statements or API client initialization in the code. Example: "Anthropic (Claude API)"]
|
|
14
|
+
- **Model:** [Extract from the model parameter in the API call. Example: "claude-sonnet-4-20250514"]
|
|
15
|
+
- **API version:** [auto-fill]
|
|
16
|
+
- **Client library version:** [Read from the dependency file. Example: "anthropic==0.39.0 (from requirements.txt)"]
|
|
17
|
+
|
|
18
|
+
## Dependency risks
|
|
19
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
20
|
+
|------|-----------|--------|------------|
|
|
21
|
+
| Model behavior changes on update | Medium | High | Version pinning (supply-chain.md P1) |
|
|
22
|
+
| Provider outage | Low | High | Fallback provider (supply-chain.md P4) |
|
|
23
|
+
| Terms of service change | Low | Medium | Contract review, alternative evaluation |
|
|
24
|
+
| Data residency non-compliance | [check] | High | Verify provider data routing |
|
|
25
|
+
| Model deprecation | Medium | Medium | Migration plan, regression test suite |
|
|
26
|
+
|
|
27
|
+
## Data handling
|
|
28
|
+
- **Data sent to provider:** [Enumerate every field included in the messages array. Example: "claim_description (redacted), claim_type, date_filed. No PII sent — redacted by pii-handling.md P1"]
|
|
29
|
+
- **PII sent:** Yes/No [should be No — see pii-handling.md]
|
|
30
|
+
- **Data retention by provider:** [Look up the provider's data retention policy. Example: "Anthropic: zero retention on API by default. OpenAI: 30-day retention unless opted out via API"]
|
|
31
|
+
- **Provider's data used for training:** Yes/No [check provider's terms]
|
|
32
|
+
|
|
33
|
+
## Contingency plan
|
|
34
|
+
- **Fallback provider:** [from supply-chain.md P4]
|
|
35
|
+
- **Fallback behavior:** [from fallback-patterns.md]
|
|
36
|
+
- **Maximum acceptable downtime:** [requires human input]
|
|
37
|
+
- **Migration estimated effort:** [days/weeks]
|
|
38
|
+
|
|
39
|
+
## Review schedule
|
|
40
|
+
- **Next review date:** [quarterly recommended for high-risk]
|
|
41
|
+
- **Trigger for immediate review:** provider update, incident, terms change
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-audit-logging
|
|
3
|
+
implements: audit-logging
|
|
4
|
+
---
|
|
5
|
+
# Verification: Audit logging
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Does every LLM interaction produce a structured log entry with trace ID? | MANAGE-4.1/P1 | [ ] | |
|
|
10
|
+
| V2 | Is the trace ID propagated across all system components? | MANAGE-4.1/P2 | [ ] | |
|
|
11
|
+
| V3 | Are AI-influenced decisions logged with full context? | MANAGE-4.1/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: no raw PII in log entries. | Anti-pattern | [ ] | |
|
|
13
|
+
| V5 | Confirm: all interactions logged, not just errors. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-bias-monitoring
|
|
3
|
+
implements: bias-monitoring
|
|
4
|
+
---
|
|
5
|
+
# Verification: Bias monitoring
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Does the logging schema include fairness-enabling metadata fields? | MEASURE-2.11/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there output distribution monitoring across demographic segments? | MEASURE-2.11/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there a periodic fairness report generation mechanism? | MEASURE-2.11/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: protected characteristics are NOT collected directly. | Anti-pattern | [ ] | |
|
|
13
|
+
| V5 | Are human override patterns analyzed for bias signals? | Edge case | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-confidence-scoring
|
|
3
|
+
implements: confidence-scoring
|
|
4
|
+
---
|
|
5
|
+
# Verification: Confidence scoring
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Does every AI response include structured confidence metadata? | LLM09/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there a grounding verification step for RAG-based responses? | LLM09/P2 | [ ] | |
|
|
11
|
+
| V3 | Is AI output framed as recommendation (not fact) in user-facing displays? | LLM09/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: no "The AI determined..." framing. Uses "suggests" or "recommends". | Anti-pattern | [ ] | |
|
|
13
|
+
| V5 | Are low-confidence outputs flagged for human review? | Edge case | [ ] | |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-data-integrity
|
|
3
|
+
implements: data-integrity
|
|
4
|
+
---
|
|
5
|
+
# Verification: Data integrity
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is data provenance tracked (source, checksum, ingestion date)? | LLM04/P1 | [ ] | |
|
|
10
|
+
| V2 | Is data validated before entering the vector store / training pipeline? | LLM04/P2 | [ ] | |
|
|
11
|
+
| V3 | Are training/fine-tuning datasets checksummed and versioned? | LLM04/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: no unverified external data sources ingested without validation. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-explainability
|
|
3
|
+
implements: explainability
|
|
4
|
+
---
|
|
5
|
+
# Verification: Explainability
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Does the system generate human-readable explanations for decisions? | MEASURE-2.9/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there a model card documenting purpose, limitations, and performance? | MEASURE-2.9/P2 | [ ] | |
|
|
11
|
+
| V3 | Are decision records stored in an audit-friendly format? | Clause-9.1/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: explanations use plain language, not technical jargon. | Anti-pattern | [ ] | |
|
|
13
|
+
| V5 | Is appeal/review information included in decision outputs? | Edge case | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-fallback-patterns
|
|
3
|
+
implements: fallback-patterns
|
|
4
|
+
---
|
|
5
|
+
# Verification: Fallback patterns
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is there a defined default safe response for LLM failures? | MEASURE-2.6/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there a circuit breaker that trips on repeated failures? | MANAGE-2.4/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there a kill switch that can be toggled without code deployment? | MANAGE-2.4/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: no crashes on LLM errors (all exceptions caught). | Anti-pattern | [ ] | |
|
|
13
|
+
| V5 | Is there a defined recovery process after kill switch activation? | Edge case | [ ] | |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-human-oversight
|
|
3
|
+
implements: human-oversight
|
|
4
|
+
---
|
|
5
|
+
# Verification: Human oversight
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Are LLM tools defined as an explicit allowlist (not blocklist)? | LLM06/P1 | [ ] | |
|
|
10
|
+
| V2 | Do write/mutating operations require human approval? | LLM06/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there action rate limiting for LLM-initiated actions? | LLM06/P3 | [ ] | |
|
|
12
|
+
| V4 | Does every AI-influenced response include an override mechanism? | LLM06/P4 | [ ] | |
|
|
13
|
+
| V5 | Is there an audit trail for every LLM-initiated action? | Anti-pattern | [ ] | |
|
|
14
|
+
| V6 | For low-confidence outputs, is human review required? | Edge case | [ ] | |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-input-validation
|
|
3
|
+
implements: input-validation
|
|
4
|
+
---
|
|
5
|
+
# Verification: Input validation
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is there a maximum input length check (characters and/or tokens) before the LLM call? | LLM01/P1 | [ ] | |
|
|
10
|
+
| V2 | Does the code use API native role separation (system vs user messages), not string concatenation? | LLM01/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there a sanitization function stripping control characters and zero-width Unicode before the LLM call? | LLM01/P3 | [ ] | |
|
|
12
|
+
| V4 | Is LLM output validated against a defined schema before downstream use? | LLM01/P4 | [ ] | |
|
|
13
|
+
| V5 | Is there an injection pattern detection layer (even if advisory/logging-only)? | LLM01/P5 | [ ] | |
|
|
14
|
+
| V6 | Confirm: no string concatenation or f-strings used to build prompts. | Anti-pattern | [ ] | |
|
|
15
|
+
| V7 | Confirm: input exceeding length limits returns an error, not silent truncation. | Anti-pattern | [ ] | |
|
|
16
|
+
| V8 | If system processes documents/files: is extracted text sanitized with same pipeline as direct input? | Edge case | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-monitoring
|
|
3
|
+
implements: monitoring
|
|
4
|
+
---
|
|
5
|
+
# Verification: Monitoring
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Are key metrics (latency, error rate, override rate, cost) tracked? | MANAGE-4.1/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there output drift detection comparing recent to baseline? | MANAGE-4.1/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there a user feedback mechanism (agree/disagree/escalate)? | MANAGE-4.2/P3 | [ ] | |
|
|
12
|
+
| V4 | Is there structured incident logging? | MANAGE-4.3/P4 | [ ] | |
|
|
13
|
+
| V5 | Confirm: monitoring is active from day one, not added later. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-output-sanitization
|
|
3
|
+
implements: output-sanitization
|
|
4
|
+
---
|
|
5
|
+
# Verification: Output sanitization
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is LLM output encoded/escaped before rendering in HTML? | LLM05/P2 | [ ] | |
|
|
10
|
+
| V2 | Are database operations using parameterized queries, not string interpolation with LLM output? | LLM05/P3 | [ ] | |
|
|
11
|
+
| V3 | If LLM generates code for execution, is it sandboxed? | LLM05/P4 | [ ] | |
|
|
12
|
+
| V4 | Is LLM output content type validated before use? | LLM05/P5 | [ ] | |
|
|
13
|
+
| V5 | Confirm: no eval() or exec() on raw LLM output. | Anti-pattern | [ ] | |
|
|
14
|
+
| V6 | If rendering LLM markdown as HTML, is a sanitizing parser used? | Edge case | [ ] | |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-pii-handling
|
|
3
|
+
implements: pii-handling
|
|
4
|
+
---
|
|
5
|
+
# Verification: PII handling
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is PII detected and redacted before being sent to the LLM? | LLM02/P1 | [ ] | |
|
|
10
|
+
| V2 | Does the system send only necessary fields to the LLM (data minimization)? | LLM02/P2 | [ ] | |
|
|
11
|
+
| V3 | Is LLM output scanned for PII before returning to the user? | LLM02/P3 | [ ] | |
|
|
12
|
+
| V4 | Are PII-containing records stored separately from LLM-accessible data? | LLM02/P4 | [ ] | |
|
|
13
|
+
| V5 | Are logs written with redacted content, never raw PII? | LLM02/P5 | [ ] | |
|
|
14
|
+
| V6 | Confirm: no full database records sent to the LLM. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-prompt-security
|
|
3
|
+
implements: prompt-security
|
|
4
|
+
---
|
|
5
|
+
# Verification: Prompt security
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Confirm: no API keys, passwords, or tokens in system prompts. | LLM07/P1 | [ ] | |
|
|
10
|
+
| V2 | Is the system prompt minimal (behavior only, no implementation details)? | LLM07/P2 | [ ] | |
|
|
11
|
+
| V3 | Is there a leakage detection check on LLM output? | LLM07/P3 | [ ] | |
|
|
12
|
+
| V4 | Are business rules enforced in code, not just in prompts? | LLM07/P4 | [ ] | |
|
|
13
|
+
| V5 | Confirm: system prompt does not contain "do not reveal these instructions" as sole protection. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-rag-security
|
|
3
|
+
implements: rag-security
|
|
4
|
+
---
|
|
5
|
+
# Verification: RAG security
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Are access controls applied to vector database queries? | LLM08/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there tenant isolation in multi-tenant RAG systems? | LLM08/P2 | [ ] | |
|
|
11
|
+
| V3 | Are retrieved results validated (relevance threshold, injection scan)? | LLM08/P3 | [ ] | |
|
|
12
|
+
| V4 | Confirm: no cross-tenant data leakage possible. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checklist-rate-limiting
|
|
3
|
+
implements: rate-limiting
|
|
4
|
+
---
|
|
5
|
+
# Verification: Rate limiting
|
|
6
|
+
|
|
7
|
+
| # | Check | Control | Status | Evidence |
|
|
8
|
+
|---|-------|---------|--------|----------|
|
|
9
|
+
| V1 | Is there per-user rate limiting on LLM endpoints? | LLM10/P1 | [ ] | |
|
|
10
|
+
| V2 | Is there a token budget with daily and per-request limits? | LLM10/P2 | [ ] | |
|
|
11
|
+
| V3 | Is cost monitoring with alerting implemented? | LLM10/P3 | [ ] | |
|
|
12
|
+
| V4 | Are LLM calls wrapped with a timeout? | LLM10/P4 | [ ] | |
|
|
13
|
+
| V5 | Confirm: rate limits are per API key, not just per IP. | Anti-pattern | [ ] | |
|
|
@@ -0,0 +1,13 @@
|
|
|
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 | [ ] | |
|
|
@@ -0,0 +1,232 @@
|
|
|
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)
|