kastell 2.1.0 → 2.2.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/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +39 -0
- package/CHANGELOG.md +1266 -1216
- package/LICENSE +201 -201
- package/NOTICE +5 -5
- package/README.md +1 -1
- package/README.tr.md +1 -1
- package/bin/kastell +2 -2
- package/bin/kastell-mcp +5 -5
- package/dist/adapters/coolify.js +92 -92
- package/dist/adapters/dokploy.js +99 -99
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/shared.js +4 -2
- package/dist/adapters/shared.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +6 -9
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +12 -12
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +23 -8
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/evidence.d.ts.map +1 -1
- package/dist/commands/evidence.js +8 -9
- package/dist/commands/evidence.js.map +1 -1
- package/dist/commands/fix.d.ts +1 -0
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +24 -5
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/interactive/backup-maintenance.d.ts +8 -0
- package/dist/commands/interactive/backup-maintenance.d.ts.map +1 -0
- package/dist/commands/interactive/backup-maintenance.js +120 -0
- package/dist/commands/interactive/backup-maintenance.js.map +1 -0
- package/dist/commands/interactive/index.d.ts +4 -0
- package/dist/commands/interactive/index.d.ts.map +1 -0
- package/dist/commands/interactive/index.js +94 -0
- package/dist/commands/interactive/index.js.map +1 -0
- package/dist/commands/interactive/menu.d.ts +23 -0
- package/dist/commands/interactive/menu.d.ts.map +1 -0
- package/dist/commands/interactive/menu.js +121 -0
- package/dist/commands/interactive/menu.js.map +1 -0
- package/dist/commands/interactive/monitoring.d.ts +5 -0
- package/dist/commands/interactive/monitoring.d.ts.map +1 -0
- package/dist/commands/interactive/monitoring.js +96 -0
- package/dist/commands/interactive/monitoring.js.map +1 -0
- package/dist/commands/interactive/plugins.d.ts +2 -0
- package/dist/commands/interactive/plugins.d.ts.map +1 -0
- package/dist/commands/interactive/plugins.js +30 -0
- package/dist/commands/interactive/plugins.js.map +1 -0
- package/dist/commands/interactive/security.d.ts +9 -0
- package/dist/commands/interactive/security.d.ts.map +1 -0
- package/dist/commands/interactive/security.js +535 -0
- package/dist/commands/interactive/security.js.map +1 -0
- package/dist/commands/interactive/server-management.d.ts +5 -0
- package/dist/commands/interactive/server-management.d.ts.map +1 -0
- package/dist/commands/interactive/server-management.js +79 -0
- package/dist/commands/interactive/server-management.js.map +1 -0
- package/dist/commands/interactive/shared.d.ts +12 -0
- package/dist/commands/interactive/shared.d.ts.map +1 -0
- package/dist/commands/interactive/shared.js +30 -0
- package/dist/commands/interactive/shared.js.map +1 -0
- package/dist/commands/interactive.d.ts.map +1 -1
- package/dist/commands/interactive.js +29 -0
- package/dist/commands/interactive.js.map +1 -1
- package/dist/commands/lock.js +1 -1
- package/dist/commands/lock.js.map +1 -1
- package/dist/commands/plugin.d.ts +8 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +87 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/regression.d.ts.map +1 -1
- package/dist/commands/regression.js +1 -2
- package/dist/commands/regression.js.map +1 -1
- package/dist/commands/restart.d.ts.map +1 -1
- package/dist/commands/restart.js +3 -2
- package/dist/commands/restart.js.map +1 -1
- package/dist/commands/schedule.js +2 -2
- package/dist/commands/schedule.js.map +1 -1
- package/dist/core/audit/checkIds.d.ts +516 -0
- package/dist/core/audit/checkIds.d.ts.map +1 -0
- package/dist/core/audit/checkIds.js +515 -0
- package/dist/core/audit/checkIds.js.map +1 -0
- package/dist/core/audit/checks/accounts.d.ts.map +1 -1
- package/dist/core/audit/checks/accounts.js +23 -22
- package/dist/core/audit/checks/accounts.js.map +1 -1
- package/dist/core/audit/checks/auth.d.ts.map +1 -1
- package/dist/core/audit/checks/auth.js +23 -22
- package/dist/core/audit/checks/auth.js.map +1 -1
- package/dist/core/audit/checks/backup.d.ts.map +1 -1
- package/dist/core/audit/checks/backup.js +9 -8
- package/dist/core/audit/checks/backup.js.map +1 -1
- package/dist/core/audit/checks/banners.d.ts.map +1 -1
- package/dist/core/audit/checks/banners.js +7 -6
- package/dist/core/audit/checks/banners.js.map +1 -1
- package/dist/core/audit/checks/boot.d.ts.map +1 -1
- package/dist/core/audit/checks/boot.js +12 -11
- package/dist/core/audit/checks/boot.js.map +1 -1
- package/dist/core/audit/checks/cloudmeta.d.ts.map +1 -1
- package/dist/core/audit/checks/cloudmeta.js +7 -6
- package/dist/core/audit/checks/cloudmeta.js.map +1 -1
- package/dist/core/audit/checks/crypto.d.ts +0 -5
- package/dist/core/audit/checks/crypto.d.ts.map +1 -1
- package/dist/core/audit/checks/crypto.js +20 -19
- package/dist/core/audit/checks/crypto.js.map +1 -1
- package/dist/core/audit/checks/ddos.d.ts.map +1 -1
- package/dist/core/audit/checks/ddos.js +9 -8
- package/dist/core/audit/checks/ddos.js.map +1 -1
- package/dist/core/audit/checks/dns.d.ts.map +1 -1
- package/dist/core/audit/checks/dns.js +9 -8
- package/dist/core/audit/checks/dns.js.map +1 -1
- package/dist/core/audit/checks/docker.d.ts.map +1 -1
- package/dist/core/audit/checks/docker.js +65 -64
- package/dist/core/audit/checks/docker.js.map +1 -1
- package/dist/core/audit/checks/fileintegrity.d.ts.map +1 -1
- package/dist/core/audit/checks/fileintegrity.js +11 -10
- package/dist/core/audit/checks/fileintegrity.js.map +1 -1
- package/dist/core/audit/checks/filesystem.d.ts.map +1 -1
- package/dist/core/audit/checks/filesystem.js +21 -20
- package/dist/core/audit/checks/filesystem.js.map +1 -1
- package/dist/core/audit/checks/firewall.d.ts.map +1 -1
- package/dist/core/audit/checks/firewall.js +18 -17
- package/dist/core/audit/checks/firewall.js.map +1 -1
- package/dist/core/audit/checks/httpHeaders.d.ts.map +1 -1
- package/dist/core/audit/checks/httpHeaders.js +7 -6
- package/dist/core/audit/checks/httpHeaders.js.map +1 -1
- package/dist/core/audit/checks/incidentready.d.ts.map +1 -1
- package/dist/core/audit/checks/incidentready.js +13 -12
- package/dist/core/audit/checks/incidentready.js.map +1 -1
- package/dist/core/audit/checks/kernel.d.ts.map +1 -1
- package/dist/core/audit/checks/kernel.js +32 -31
- package/dist/core/audit/checks/kernel.js.map +1 -1
- package/dist/core/audit/checks/logging.d.ts.map +1 -1
- package/dist/core/audit/checks/logging.js +21 -20
- package/dist/core/audit/checks/logging.js.map +1 -1
- package/dist/core/audit/checks/mac.d.ts.map +1 -1
- package/dist/core/audit/checks/mac.js +11 -10
- package/dist/core/audit/checks/mac.js.map +1 -1
- package/dist/core/audit/checks/malware.d.ts.map +1 -1
- package/dist/core/audit/checks/malware.js +12 -11
- package/dist/core/audit/checks/malware.js.map +1 -1
- package/dist/core/audit/checks/memory.d.ts.map +1 -1
- package/dist/core/audit/checks/memory.js +12 -11
- package/dist/core/audit/checks/memory.js.map +1 -1
- package/dist/core/audit/checks/network.d.ts.map +1 -1
- package/dist/core/audit/checks/network.js +22 -21
- package/dist/core/audit/checks/network.js.map +1 -1
- package/dist/core/audit/checks/nginx.d.ts.map +1 -1
- package/dist/core/audit/checks/nginx.js +17 -16
- package/dist/core/audit/checks/nginx.js.map +1 -1
- package/dist/core/audit/checks/resourcelimits.d.ts.map +1 -1
- package/dist/core/audit/checks/resourcelimits.js +9 -8
- package/dist/core/audit/checks/resourcelimits.js.map +1 -1
- package/dist/core/audit/checks/scheduling.d.ts.map +1 -1
- package/dist/core/audit/checks/scheduling.js +13 -12
- package/dist/core/audit/checks/scheduling.js.map +1 -1
- package/dist/core/audit/checks/secrets.d.ts.map +1 -1
- package/dist/core/audit/checks/secrets.js +16 -15
- package/dist/core/audit/checks/secrets.js.map +1 -1
- package/dist/core/audit/checks/services.d.ts.map +1 -1
- package/dist/core/audit/checks/services.js +26 -25
- package/dist/core/audit/checks/services.js.map +1 -1
- package/dist/core/audit/checks/ssh.d.ts.map +1 -1
- package/dist/core/audit/checks/ssh.js +23 -22
- package/dist/core/audit/checks/ssh.js.map +1 -1
- package/dist/core/audit/checks/supplychain.d.ts.map +1 -1
- package/dist/core/audit/checks/supplychain.js +13 -12
- package/dist/core/audit/checks/supplychain.js.map +1 -1
- package/dist/core/audit/checks/time.d.ts.map +1 -1
- package/dist/core/audit/checks/time.js +10 -9
- package/dist/core/audit/checks/time.js.map +1 -1
- package/dist/core/audit/checks/tls.d.ts.map +1 -1
- package/dist/core/audit/checks/tls.js +9 -8
- package/dist/core/audit/checks/tls.js.map +1 -1
- package/dist/core/audit/checks/updates.d.ts.map +1 -1
- package/dist/core/audit/checks/updates.js +12 -11
- package/dist/core/audit/checks/updates.js.map +1 -1
- package/dist/core/audit/compliance/categories/index.d.ts +3 -0
- package/dist/core/audit/compliance/categories/index.d.ts.map +1 -0
- package/dist/core/audit/compliance/categories/index.js +737 -0
- package/dist/core/audit/compliance/categories/index.js.map +1 -0
- package/dist/core/audit/compliance/helpers.d.ts +17 -0
- package/dist/core/audit/compliance/helpers.d.ts.map +1 -0
- package/dist/core/audit/compliance/helpers.js +40 -0
- package/dist/core/audit/compliance/helpers.js.map +1 -0
- package/dist/core/audit/compliance/mapper.d.ts +4 -16
- package/dist/core/audit/compliance/mapper.d.ts.map +1 -1
- package/dist/core/audit/compliance/mapper.js +3 -776
- package/dist/core/audit/compliance/mapper.js.map +1 -1
- package/dist/core/audit/fix-history.d.ts +16 -7
- package/dist/core/audit/fix-history.d.ts.map +1 -1
- package/dist/core/audit/fix-history.js +25 -2
- package/dist/core/audit/fix-history.js.map +1 -1
- package/dist/core/audit/fix.d.ts +17 -2
- package/dist/core/audit/fix.d.ts.map +1 -1
- package/dist/core/audit/fix.js +115 -42
- package/dist/core/audit/fix.js.map +1 -1
- package/dist/core/audit/formatters/badge.js +20 -20
- package/dist/core/audit/index.d.ts.map +1 -1
- package/dist/core/audit/index.js +3 -2
- package/dist/core/audit/index.js.map +1 -1
- package/dist/core/audit/snapshot.d.ts.map +1 -1
- package/dist/core/audit/snapshot.js +6 -2
- package/dist/core/audit/snapshot.js.map +1 -1
- package/dist/core/audit/types.d.ts +11 -1
- package/dist/core/audit/types.d.ts.map +1 -1
- package/dist/core/audit/watch.d.ts.map +1 -1
- package/dist/core/audit/watch.js +3 -2
- package/dist/core/audit/watch.js.map +1 -1
- package/dist/core/backup.d.ts.map +1 -1
- package/dist/core/backup.js +10 -5
- package/dist/core/backup.js.map +1 -1
- package/dist/core/bot/handlers.d.ts.map +1 -1
- package/dist/core/bot/handlers.js +2 -17
- package/dist/core/bot/handlers.js.map +1 -1
- package/dist/core/completions.d.ts.map +1 -1
- package/dist/core/completions.js +632 -610
- package/dist/core/completions.js.map +1 -1
- package/dist/core/deploy.d.ts.map +1 -1
- package/dist/core/deploy.js +7 -4
- package/dist/core/deploy.js.map +1 -1
- package/dist/core/doctor-fix.d.ts +1 -1
- package/dist/core/doctor-fix.d.ts.map +1 -1
- package/dist/core/doctor-fix.js +17 -2
- package/dist/core/doctor-fix.js.map +1 -1
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +2 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/firewall.d.ts +0 -1
- package/dist/core/firewall.d.ts.map +1 -1
- package/dist/core/firewall.js +2 -13
- package/dist/core/firewall.js.map +1 -1
- package/dist/core/lock/auth.d.ts +7 -0
- package/dist/core/lock/auth.d.ts.map +1 -0
- package/dist/core/lock/auth.js +59 -0
- package/dist/core/lock/auth.js.map +1 -0
- package/dist/core/lock/docker.d.ts +4 -0
- package/dist/core/lock/docker.d.ts.map +1 -0
- package/dist/core/lock/docker.js +28 -0
- package/dist/core/lock/docker.js.map +1 -0
- package/dist/core/lock/index.d.ts +11 -0
- package/dist/core/lock/index.d.ts.map +1 -0
- package/dist/core/lock/index.js +247 -0
- package/dist/core/lock/index.js.map +1 -0
- package/dist/core/lock/monitoring.d.ts +4 -0
- package/dist/core/lock/monitoring.d.ts.map +1 -0
- package/dist/core/lock/monitoring.js +55 -0
- package/dist/core/lock/monitoring.js.map +1 -0
- package/dist/core/lock/network.d.ts +6 -0
- package/dist/core/lock/network.d.ts.map +1 -0
- package/dist/core/lock/network.js +59 -0
- package/dist/core/lock/network.js.map +1 -0
- package/dist/core/lock/ssh.d.ts +5 -0
- package/dist/core/lock/ssh.d.ts.map +1 -0
- package/dist/core/lock/ssh.js +49 -0
- package/dist/core/lock/ssh.js.map +1 -0
- package/dist/core/lock/system.d.ts +9 -0
- package/dist/core/lock/system.d.ts.map +1 -0
- package/dist/core/lock/system.js +80 -0
- package/dist/core/lock/system.js.map +1 -0
- package/dist/core/lock/types.d.ts +41 -0
- package/dist/core/lock/types.d.ts.map +1 -0
- package/dist/core/lock/types.js +2 -0
- package/dist/core/lock/types.js.map +1 -0
- package/dist/core/maintain.d.ts.map +1 -1
- package/dist/core/maintain.js +3 -1
- package/dist/core/maintain.js.map +1 -1
- package/dist/core/manage.d.ts.map +1 -1
- package/dist/core/manage.js +7 -4
- package/dist/core/manage.js.map +1 -1
- package/dist/core/notify.d.ts.map +1 -1
- package/dist/core/notify.js +2 -1
- package/dist/core/notify.js.map +1 -1
- package/dist/core/notifyStore.d.ts.map +1 -1
- package/dist/core/notifyStore.js +3 -1
- package/dist/core/notifyStore.js.map +1 -1
- package/dist/core/plugin.d.ts +23 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +107 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/provision.d.ts.map +1 -1
- package/dist/core/provision.js +9 -4
- package/dist/core/provision.js.map +1 -1
- package/dist/core/scheduleManager.d.ts +2 -1
- package/dist/core/scheduleManager.d.ts.map +1 -1
- package/dist/core/scheduleManager.js +13 -7
- package/dist/core/scheduleManager.js.map +1 -1
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +5 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/schemas/audit.d.ts +34 -0
- package/dist/mcp/schemas/audit.d.ts.map +1 -0
- package/dist/mcp/schemas/audit.js +23 -0
- package/dist/mcp/schemas/audit.js.map +1 -0
- package/dist/mcp/schemas/common.d.ts +16 -0
- package/dist/mcp/schemas/common.d.ts.map +1 -0
- package/dist/mcp/schemas/common.js +14 -0
- package/dist/mcp/schemas/common.js.map +1 -0
- package/dist/mcp/schemas/health.d.ts +14 -0
- package/dist/mcp/schemas/health.d.ts.map +1 -0
- package/dist/mcp/schemas/health.js +13 -0
- package/dist/mcp/schemas/health.js.map +1 -0
- package/dist/mcp/schemas/index.d.ts +5 -0
- package/dist/mcp/schemas/index.d.ts.map +1 -0
- package/dist/mcp/schemas/index.js +5 -0
- package/dist/mcp/schemas/index.js.map +1 -0
- package/dist/mcp/schemas/server.d.ts +18 -0
- package/dist/mcp/schemas/server.d.ts.map +1 -0
- package/dist/mcp/schemas/server.js +16 -0
- package/dist/mcp/schemas/server.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +71 -40
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/serverAudit.d.ts +63 -1
- package/dist/mcp/tools/serverAudit.d.ts.map +1 -1
- package/dist/mcp/tools/serverAudit.js +63 -6
- package/dist/mcp/tools/serverAudit.js.map +1 -1
- package/dist/mcp/tools/serverBackup.d.ts +100 -2
- package/dist/mcp/tools/serverBackup.d.ts.map +1 -1
- package/dist/mcp/tools/serverBackup.handlers.d.ts.map +1 -1
- package/dist/mcp/tools/serverBackup.handlers.js +9 -0
- package/dist/mcp/tools/serverBackup.handlers.js.map +1 -1
- package/dist/mcp/tools/serverBackup.js +74 -0
- package/dist/mcp/tools/serverBackup.js.map +1 -1
- package/dist/mcp/tools/serverCompare.d.ts +33 -0
- package/dist/mcp/tools/serverCompare.d.ts.map +1 -1
- package/dist/mcp/tools/serverCompare.js +45 -2
- package/dist/mcp/tools/serverCompare.js.map +1 -1
- package/dist/mcp/tools/serverDoctor.d.ts +14 -0
- package/dist/mcp/tools/serverDoctor.d.ts.map +1 -1
- package/dist/mcp/tools/serverDoctor.js +16 -1
- package/dist/mcp/tools/serverDoctor.js.map +1 -1
- package/dist/mcp/tools/serverEvidence.d.ts +13 -0
- package/dist/mcp/tools/serverEvidence.d.ts.map +1 -1
- package/dist/mcp/tools/serverEvidence.js +17 -2
- package/dist/mcp/tools/serverEvidence.js.map +1 -1
- package/dist/mcp/tools/serverExplain.d.ts +17 -0
- package/dist/mcp/tools/serverExplain.d.ts.map +1 -1
- package/dist/mcp/tools/serverExplain.js +33 -1
- package/dist/mcp/tools/serverExplain.js.map +1 -1
- package/dist/mcp/tools/serverFix.d.ts +78 -0
- package/dist/mcp/tools/serverFix.d.ts.map +1 -1
- package/dist/mcp/tools/serverFix.js +87 -0
- package/dist/mcp/tools/serverFix.js.map +1 -1
- package/dist/mcp/tools/serverFleet.d.ts +24 -1
- package/dist/mcp/tools/serverFleet.d.ts.map +1 -1
- package/dist/mcp/tools/serverFleet.js +24 -1
- package/dist/mcp/tools/serverFleet.js.map +1 -1
- package/dist/mcp/tools/serverGuard.d.ts +12 -0
- package/dist/mcp/tools/serverGuard.d.ts.map +1 -1
- package/dist/mcp/tools/serverGuard.js +16 -0
- package/dist/mcp/tools/serverGuard.js.map +1 -1
- package/dist/mcp/tools/serverInfo.d.ts +77 -1
- package/dist/mcp/tools/serverInfo.d.ts.map +1 -1
- package/dist/mcp/tools/serverInfo.js +77 -4
- package/dist/mcp/tools/serverInfo.js.map +1 -1
- package/dist/mcp/tools/serverLock.d.ts +10 -0
- package/dist/mcp/tools/serverLock.d.ts.map +1 -1
- package/dist/mcp/tools/serverLock.js +15 -3
- package/dist/mcp/tools/serverLock.js.map +1 -1
- package/dist/mcp/tools/serverLogs.d.ts +43 -0
- package/dist/mcp/tools/serverLogs.d.ts.map +1 -1
- package/dist/mcp/tools/serverLogs.js +28 -0
- package/dist/mcp/tools/serverLogs.js.map +1 -1
- package/dist/mcp/tools/serverMaintain.d.ts +47 -0
- package/dist/mcp/tools/serverMaintain.d.ts.map +1 -1
- package/dist/mcp/tools/serverMaintain.js +75 -41
- package/dist/mcp/tools/serverMaintain.js.map +1 -1
- package/dist/mcp/tools/serverManage.d.ts +50 -0
- package/dist/mcp/tools/serverManage.d.ts.map +1 -1
- package/dist/mcp/tools/serverManage.js +49 -0
- package/dist/mcp/tools/serverManage.js.map +1 -1
- package/dist/mcp/tools/serverPlugin.d.ts +30 -0
- package/dist/mcp/tools/serverPlugin.d.ts.map +1 -0
- package/dist/mcp/tools/serverPlugin.js +47 -0
- package/dist/mcp/tools/serverPlugin.js.map +1 -0
- package/dist/mcp/tools/serverProvision.d.ts +22 -0
- package/dist/mcp/tools/serverProvision.d.ts.map +1 -1
- package/dist/mcp/tools/serverProvision.js +22 -2
- package/dist/mcp/tools/serverProvision.js.map +1 -1
- package/dist/mcp/tools/serverSecure.d.ts +120 -0
- package/dist/mcp/tools/serverSecure.d.ts.map +1 -1
- package/dist/mcp/tools/serverSecure.handlers.d.ts.map +1 -1
- package/dist/mcp/tools/serverSecure.handlers.js +39 -98
- package/dist/mcp/tools/serverSecure.handlers.js.map +1 -1
- package/dist/mcp/tools/serverSecure.js +101 -0
- package/dist/mcp/tools/serverSecure.js.map +1 -1
- package/dist/mcp/utils.d.ts +1 -0
- package/dist/mcp/utils.d.ts.map +1 -1
- package/dist/mcp/utils.js +5 -1
- package/dist/mcp/utils.js.map +1 -1
- package/dist/plugin/loader.d.ts +10 -0
- package/dist/plugin/loader.d.ts.map +1 -0
- package/dist/plugin/loader.js +88 -0
- package/dist/plugin/loader.js.map +1 -0
- package/dist/plugin/registry.d.ts +16 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/registry.js +101 -0
- package/dist/plugin/registry.js.map +1 -0
- package/dist/plugin/sdk/constants.d.ts +3 -0
- package/dist/plugin/sdk/constants.d.ts.map +1 -0
- package/dist/plugin/sdk/constants.js +3 -0
- package/dist/plugin/sdk/constants.js.map +1 -0
- package/dist/plugin/sdk/types.d.ts +29 -0
- package/dist/plugin/sdk/types.d.ts.map +1 -0
- package/dist/plugin/sdk/types.js +2 -0
- package/dist/plugin/sdk/types.js.map +1 -0
- package/dist/plugin/validate.d.ts +3 -0
- package/dist/plugin/validate.d.ts.map +1 -0
- package/dist/plugin/validate.js +31 -0
- package/dist/plugin/validate.js.map +1 -0
- package/dist/providers/base.d.ts.map +1 -1
- package/dist/providers/base.js +2 -1
- package/dist/providers/base.js.map +1 -1
- package/dist/providers/linode.d.ts +1 -0
- package/dist/providers/linode.d.ts.map +1 -1
- package/dist/providers/linode.js +4 -0
- package/dist/providers/linode.js.map +1 -1
- package/dist/utils/cloudInit.js +58 -58
- package/dist/utils/config.d.ts +3 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +11 -6
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/encryption.d.ts.map +1 -1
- package/dist/utils/encryption.js +4 -1
- package/dist/utils/encryption.js.map +1 -1
- package/dist/utils/errorMapper.d.ts.map +1 -1
- package/dist/utils/errorMapper.js +2 -1
- package/dist/utils/errorMapper.js.map +1 -1
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +3 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/migration.d.ts.map +1 -1
- package/dist/utils/migration.js +25 -14
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/paths.d.ts +4 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +4 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/safeMode.d.ts.map +1 -1
- package/dist/utils/safeMode.js +3 -2
- package/dist/utils/safeMode.js.map +1 -1
- package/dist/utils/secureWrite.d.ts.map +1 -1
- package/dist/utils/secureWrite.js +2 -1
- package/dist/utils/secureWrite.js.map +1 -1
- package/dist/utils/securityLogger.d.ts.map +1 -1
- package/dist/utils/securityLogger.js +7 -3
- package/dist/utils/securityLogger.js.map +1 -1
- package/dist/utils/version.d.ts +4 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +22 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/utils/yamlConfig.d.ts.map +1 -1
- package/dist/utils/yamlConfig.js +3 -2
- package/dist/utils/yamlConfig.js.map +1 -1
- package/kastell-plugin/.claude-plugin/plugin.json +20 -0
- package/kastell-plugin/.mcp.json +8 -0
- package/kastell-plugin/README.md +113 -0
- package/kastell-plugin/agents/.gitkeep +0 -0
- package/kastell-plugin/agents/kastell-auditor.md +77 -0
- package/kastell-plugin/agents/scripts/bucket_mapper.sh +101 -0
- package/kastell-plugin/agents/scripts/trend_report.sh +91 -0
- package/kastell-plugin/hooks/destroy-block.cjs +31 -0
- package/kastell-plugin/hooks/hooks.json +57 -0
- package/kastell-plugin/hooks/pre-commit-audit-guard.cjs +75 -0
- package/kastell-plugin/hooks/session-audit.cjs +86 -0
- package/kastell-plugin/hooks/session-log.cjs +56 -0
- package/kastell-plugin/hooks/stop-quality-check.cjs +72 -0
- package/kastell-plugin/skills/.gitkeep +0 -0
- package/kastell-plugin/skills/kastell-careful/SKILL.md +64 -0
- package/kastell-plugin/skills/kastell-ops/SKILL.md +139 -0
- package/kastell-plugin/skills/kastell-ops/references/commands.md +45 -0
- package/kastell-plugin/skills/kastell-ops/references/mcp-tools.md +50 -0
- package/kastell-plugin/skills/kastell-ops/references/patterns.md +145 -0
- package/kastell-plugin/skills/kastell-ops/references/pitfalls.md +136 -0
- package/kastell-plugin/skills/kastell-ops/scripts/check_coverage.sh +101 -0
- package/kastell-plugin/skills/kastell-ops/scripts/fleet_report.sh +73 -0
- package/kastell-plugin/skills/kastell-ops/scripts/parse_audit.sh +76 -0
- package/kastell-plugin/skills/kastell-research/SKILL.md +90 -0
- package/kastell-plugin/skills/kastell-scaffold/SKILL.md +104 -0
- package/kastell-plugin/skills/kastell-scaffold/references/template-audit-check.md +150 -0
- package/kastell-plugin/skills/kastell-scaffold/references/template-command.md +80 -0
- package/kastell-plugin/skills/kastell-scaffold/references/template-mcp-tool.md +72 -0
- package/kastell-plugin/skills/kastell-scaffold/references/template-provider.md +67 -0
- package/kastell-plugin/skills/kastell-scaffold/scripts/scaffold.sh +180 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/check-test.ts.tpl +27 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/check.ts.tpl +50 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/command-core.ts.tpl +18 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/command-test.ts.tpl +17 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/command.ts.tpl +25 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/mcp-tool-test.ts.tpl +30 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/mcp-tool.ts.tpl +29 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/provider-test.ts.tpl +34 -0
- package/kastell-plugin/skills/kastell-scaffold/templates/provider.ts.tpl +32 -0
- package/package.json +122 -113
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Kastell
|
|
2
|
+
|
|
3
|
+
Autonomous server security and infrastructure management for Claude Code.
|
|
4
|
+
|
|
5
|
+
## What You Get
|
|
6
|
+
|
|
7
|
+
The Kastell plugin bundles 13 MCP tools, 4 skills, 1 agent, and 5 hooks that give Claude Code
|
|
8
|
+
full control over your self-hosted server infrastructure. Use it to provision cloud servers,
|
|
9
|
+
run 457-check security audits across 30 categories, apply 24-step hardening, manage backups,
|
|
10
|
+
and operate entire fleets — all from natural language in Claude Code.
|
|
11
|
+
|
|
12
|
+
Supported providers: Hetzner Cloud, DigitalOcean, Vultr, Linode.
|
|
13
|
+
Supported platforms: Coolify, Dokploy.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- `npm install -g kastell` — the Kastell CLI must be installed globally
|
|
18
|
+
- At least one cloud provider API token (Hetzner, DigitalOcean, Vultr, or Linode)
|
|
19
|
+
- `kastell setup` — run once to configure your API tokens and default provider
|
|
20
|
+
|
|
21
|
+
## Skills
|
|
22
|
+
|
|
23
|
+
| Skill | Invocation | Purpose |
|
|
24
|
+
|-------|------------|---------|
|
|
25
|
+
| kastell-ops | Auto-loaded (background) | Architecture reference, patterns, anti-patterns, and decision trees for working in the Kastell codebase or managing Kastell-provisioned servers |
|
|
26
|
+
| kastell-scaffold | `/kastell:scaffold` | Generate new CLI commands, MCP tools, cloud providers, and audit checks following Kastell conventions |
|
|
27
|
+
| kastell-careful | `/kastell:careful` | Intercepts `kastell destroy` and `kastell restore` commands and requires explicit confirmation before proceeding |
|
|
28
|
+
| kastell-research | `/kastell:research` | Read-only codebase exploration with full architecture context — for understanding behavior without making changes |
|
|
29
|
+
|
|
30
|
+
**kastell-ops** loads automatically as background context whenever you work with the Kastell
|
|
31
|
+
codebase or ask about server provisioning, audit, hardening, or provider management. It does
|
|
32
|
+
not appear in the slash-command menu.
|
|
33
|
+
|
|
34
|
+
## Agents
|
|
35
|
+
|
|
36
|
+
**`/agent:kastell-auditor`** — Parallel audit analyzer that groups all 30 audit categories into
|
|
37
|
+
five analysis buckets (critical config, network exposure, access control, monitoring, compliance),
|
|
38
|
+
produces structured findings with severity ratings, and remembers previous audit context across
|
|
39
|
+
sessions using user-scoped memory.
|
|
40
|
+
|
|
41
|
+
Invoke it with: "Analyze my last audit report" or "Which findings should I fix first?"
|
|
42
|
+
|
|
43
|
+
Note: `kastell-fixer` is a project-scope agent, not bundled in this plugin. It requires
|
|
44
|
+
`isolation: worktree` which only works when installed at project scope (`.claude/agents/`).
|
|
45
|
+
Install kastell-fixer separately inside your Kastell project directory.
|
|
46
|
+
|
|
47
|
+
## Hooks
|
|
48
|
+
|
|
49
|
+
| Hook | Trigger | What It Does |
|
|
50
|
+
|------|---------|--------------|
|
|
51
|
+
| stop-quality-check | Stop | Checks for TypeScript compilation errors, missing CHANGELOG entries, and stale README before ending the session |
|
|
52
|
+
| session-log | PostToolUse (Bash) | Records Bash command outputs to `session.log` for audit trail |
|
|
53
|
+
| session-audit | SessionStart | Runs `kastell audit --silent` on session start and surfaces the current security score |
|
|
54
|
+
| pre-commit-audit-guard | PreToolUse (git commit) | Blocks the commit if the current audit score has dropped below the recorded baseline |
|
|
55
|
+
| destroy-block | PreToolUse (Bash) | Blocks `kastell destroy` and `kastell restore` operations through Claude Code |
|
|
56
|
+
|
|
57
|
+
## MCP Tools
|
|
58
|
+
|
|
59
|
+
All 13 tools are available in Claude Code once the plugin is installed. The MCP server starts
|
|
60
|
+
automatically via the bundled `.mcp.json` configuration.
|
|
61
|
+
|
|
62
|
+
| Tool | Description |
|
|
63
|
+
|------|-------------|
|
|
64
|
+
| server_info | List servers, check status, health, and available sizes |
|
|
65
|
+
| server_logs | Fetch logs and system metrics from servers via SSH |
|
|
66
|
+
| server_manage | Add, remove, or destroy servers |
|
|
67
|
+
| server_maintain | Update platform, restart, or run full maintenance |
|
|
68
|
+
| server_secure | SSH hardening, firewall management, and domain configuration |
|
|
69
|
+
| server_backup | Create backups and manage cloud snapshots |
|
|
70
|
+
| server_provision | Provision new cloud servers on Hetzner, DigitalOcean, Vultr, or Linode |
|
|
71
|
+
| server_audit | Run the full 457-check security audit across 30 categories |
|
|
72
|
+
| server_evidence | Collect forensic evidence packages from servers |
|
|
73
|
+
| server_guard | Manage the autonomous security monitoring daemon |
|
|
74
|
+
| server_doctor | Proactive health analysis with remediation recommendations |
|
|
75
|
+
| server_lock | Apply the 24-step production hardening sequence |
|
|
76
|
+
| server_fleet | Fleet-wide health and security posture overview |
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Install kastell globally
|
|
82
|
+
npm install -g kastell
|
|
83
|
+
|
|
84
|
+
# Configure your cloud provider
|
|
85
|
+
kastell setup
|
|
86
|
+
|
|
87
|
+
# In Claude Code, the plugin auto-starts the MCP server.
|
|
88
|
+
# Try natural language commands like:
|
|
89
|
+
# "Provision a new Hetzner server in Nuremberg with 2 CPUs"
|
|
90
|
+
# "Run a security audit on my server at 1.2.3.4"
|
|
91
|
+
# "Apply full hardening to my production server"
|
|
92
|
+
# "Show me all my servers"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
After installation, the `kastell-ops` skill loads automatically in any session where you
|
|
96
|
+
work with Kastell. Use `/kastell:scaffold` to generate new CLI commands or MCP tools,
|
|
97
|
+
and `/agent:kastell-auditor` to get prioritized remediation guidance from audit results.
|
|
98
|
+
|
|
99
|
+
## Supported Providers
|
|
100
|
+
|
|
101
|
+
| Provider | Regions | Notes |
|
|
102
|
+
|----------|---------|-------|
|
|
103
|
+
| Hetzner Cloud | EU (FSN, NBG, HEL), US (ASH, HIL) | Default recommended provider |
|
|
104
|
+
| DigitalOcean | Global (NYC, SFO, AMS, SGP, LON, FRA, TOR, BLR, SYD) | |
|
|
105
|
+
| Vultr | 25+ global locations | |
|
|
106
|
+
| Linode (Akamai) | 11 global locations | |
|
|
107
|
+
|
|
108
|
+
## Links
|
|
109
|
+
|
|
110
|
+
- Website: https://kastell.dev
|
|
111
|
+
- GitHub: https://github.com/kastelldev/kastell
|
|
112
|
+
- npm: https://www.npmjs.com/package/kastell
|
|
113
|
+
- Docs: https://kastell.dev/docs
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kastell-auditor
|
|
3
|
+
description: "Security audit analyzer for Kastell servers. Runs kastell audit, maps results across 5 security domains (perimeter, authentication, runtime, internals, compliance), tracks score trends across sessions. Use when running kastell audit, analyzing server security posture, investigating audit findings, or generating security reports."
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: inherit
|
|
6
|
+
effort: high
|
|
7
|
+
memory: user
|
|
8
|
+
maxTurns: 25
|
|
9
|
+
skills:
|
|
10
|
+
- kastell-ops
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Role
|
|
14
|
+
|
|
15
|
+
## Live Context
|
|
16
|
+
|
|
17
|
+
**Last audit score:** !`node -e "import('fs').then(f=>{try{const h=JSON.parse(f.readFileSync(process.env.HOME+'/.kastell/audit-history.json','utf8'));const last=h.sort((a,b)=>new Date(b.timestamp)-new Date(a.timestamp))[0];if(last)console.log(last.overallScore+'/100 ('+last.serverName+', '+last.timestamp.split('T')[0]+')');else console.log('No audit history yet')}catch(e){console.log('No audit history yet')}}).catch(()=>console.log('No audit history yet'))" 2>/dev/null || echo "No audit history yet"`
|
|
18
|
+
|
|
19
|
+
You are a security audit analyst for Kastell-managed servers. Your purpose is to run `kastell audit`, organize findings into 5 security domains, identify critical failures and quick wins, and track score trends across sessions.
|
|
20
|
+
|
|
21
|
+
# Workflow
|
|
22
|
+
|
|
23
|
+
1. **Identify target server** — ask user if not provided; verify with `kastell list`
|
|
24
|
+
2. **Run audit** — `kastell audit <server> --json` to get structured output
|
|
25
|
+
3. **Analyze by bucket** — pipe JSON through `bash scripts/bucket_mapper.sh` for instant 5-domain mapping
|
|
26
|
+
4. **Check memory** — run `bash scripts/trend_report.sh <server>` for score history; or load `audit-history.json` directly
|
|
27
|
+
5. **Report** — per-bucket summary + overall score + trend (if memory available)
|
|
28
|
+
|
|
29
|
+
## Scripts (Deterministic)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Map audit JSON to 5 security buckets
|
|
33
|
+
kastell audit --server <name> --json | bash scripts/bucket_mapper.sh
|
|
34
|
+
|
|
35
|
+
# Show audit score trend for a server
|
|
36
|
+
bash scripts/trend_report.sh <server-name>
|
|
37
|
+
bash scripts/trend_report.sh --all
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
# Bucket Map
|
|
41
|
+
|
|
42
|
+
| Bucket | Categories | Focus |
|
|
43
|
+
|--------|-----------|-------|
|
|
44
|
+
| 1 Perimeter | Network, Firewall, DNS Security | External attack surface |
|
|
45
|
+
| 2 Authentication | SSH, Auth, Crypto, Accounts | Identity controls |
|
|
46
|
+
| 3 Runtime | Docker, Services, Boot, Scheduling | Service exposure |
|
|
47
|
+
| 4 Internals | Filesystem, Logging, Kernel, Memory | System hardening |
|
|
48
|
+
| 5 Compliance | Updates, File Integrity, Malware, MAC, Secrets, Cloud Metadata, Supply Chain, Backup Hygiene, Resource Limits, Incident Readiness, Banners, Time | Hygiene and compliance |
|
|
49
|
+
|
|
50
|
+
# Output Format
|
|
51
|
+
|
|
52
|
+
For each bucket:
|
|
53
|
+
- **Score:** X/Y checks passed
|
|
54
|
+
- **Critical findings** (up to 3): `[FAIL] check-name -- one-line impact`
|
|
55
|
+
- **Quick win:** one actionable fix
|
|
56
|
+
|
|
57
|
+
After all buckets:
|
|
58
|
+
- **Overall score:** X/100
|
|
59
|
+
- **Trend** (when memory has prior data): "Last audit: Y -- Delta: +/-Z -- [N] new failures in [bucket]"
|
|
60
|
+
|
|
61
|
+
# Memory
|
|
62
|
+
|
|
63
|
+
Manage a single file `audit-history.json` in your agent memory directory. Store per server:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{ "server": "string", "date": "string", "score": 0, "bucketScores": { "perimeter": 0, "authentication": 0, "runtime": 0, "internals": 0, "compliance": 0 }, "failedChecks": [] }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
On each run: load prior record, compute delta, store new record. Discard entries for servers no longer in `kastell list` output.
|
|
70
|
+
|
|
71
|
+
# Rules
|
|
72
|
+
|
|
73
|
+
- Read-only operations only: `server_audit`, `server_doctor`, `server_fleet`
|
|
74
|
+
- Never run `kastell lock`, `kastell secure`, or any write operation
|
|
75
|
+
- Recommend fixes but do not apply them — suggest `/agent:kastell-fixer` for implementation
|
|
76
|
+
- If multiple servers requested, analyze each sequentially
|
|
77
|
+
- English output for analysis structure; follow user's language for explanatory text
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# bucket_mapper.sh — Map kastell audit JSON checks to 5 security buckets.
|
|
3
|
+
# Usage: kastell audit --server <name> --json | bash bucket_mapper.sh
|
|
4
|
+
# OR: bash bucket_mapper.sh < audit-output.json
|
|
5
|
+
# OR: bash bucket_mapper.sh audit-output.json
|
|
6
|
+
#
|
|
7
|
+
# Output: Per-bucket check list with pass/fail status and severity.
|
|
8
|
+
# Used by kastell-auditor agent for structured analysis.
|
|
9
|
+
#
|
|
10
|
+
# Requires: node
|
|
11
|
+
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
|
|
14
|
+
if [[ -n "${1:-}" && -f "$1" ]]; then
|
|
15
|
+
INPUT=$(cat "$1")
|
|
16
|
+
elif [[ ! -t 0 ]]; then
|
|
17
|
+
INPUT=$(cat)
|
|
18
|
+
else
|
|
19
|
+
echo "Usage: kastell audit --server <name> --json | bash bucket_mapper.sh" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
node -e "
|
|
24
|
+
const data = JSON.parse(process.argv[1]);
|
|
25
|
+
const checks = data.checks || data.results || [];
|
|
26
|
+
|
|
27
|
+
const BUCKETS = {
|
|
28
|
+
'1_Perimeter': {
|
|
29
|
+
match: ['network', 'firewall', 'dns'],
|
|
30
|
+
checks: []
|
|
31
|
+
},
|
|
32
|
+
'2_Authentication': {
|
|
33
|
+
match: ['ssh', 'auth', 'crypto', 'accounts'],
|
|
34
|
+
checks: []
|
|
35
|
+
},
|
|
36
|
+
'3_Runtime': {
|
|
37
|
+
match: ['docker', 'services', 'boot', 'scheduling'],
|
|
38
|
+
checks: []
|
|
39
|
+
},
|
|
40
|
+
'4_Internals': {
|
|
41
|
+
match: ['filesystem', 'logging', 'kernel', 'memory'],
|
|
42
|
+
checks: []
|
|
43
|
+
},
|
|
44
|
+
'5_Compliance': {
|
|
45
|
+
match: [], // catchall
|
|
46
|
+
checks: []
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function getBucket(category) {
|
|
51
|
+
const cat = (category || '').toLowerCase();
|
|
52
|
+
for (const [name, bucket] of Object.entries(BUCKETS)) {
|
|
53
|
+
if (name === '5_Compliance') continue;
|
|
54
|
+
if (bucket.match.some(m => cat.includes(m))) return name;
|
|
55
|
+
}
|
|
56
|
+
return '5_Compliance';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Map checks to buckets
|
|
60
|
+
for (const c of checks) {
|
|
61
|
+
const bucket = getBucket(c.category);
|
|
62
|
+
BUCKETS[bucket].checks.push({
|
|
63
|
+
id: c.id || 'unknown',
|
|
64
|
+
name: c.name || '',
|
|
65
|
+
severity: c.severity || 'info',
|
|
66
|
+
passed: !!c.passed,
|
|
67
|
+
category: c.category || ''
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Output
|
|
72
|
+
const score = data.score ?? data.overallScore ?? 'N/A';
|
|
73
|
+
console.log('Score: ' + score + '/100');
|
|
74
|
+
console.log('Total checks: ' + checks.length);
|
|
75
|
+
console.log('');
|
|
76
|
+
|
|
77
|
+
for (const [name, bucket] of Object.entries(BUCKETS)) {
|
|
78
|
+
const label = name.replace(/^[0-9]_/, '');
|
|
79
|
+
const passed = bucket.checks.filter(c => c.passed).length;
|
|
80
|
+
const total = bucket.checks.length;
|
|
81
|
+
const critFail = bucket.checks.filter(c => !c.passed && c.severity === 'critical');
|
|
82
|
+
|
|
83
|
+
console.log('--- ' + label + ' (' + passed + '/' + total + ') ---');
|
|
84
|
+
|
|
85
|
+
// Show failed checks (critical first, then warning)
|
|
86
|
+
const failed = bucket.checks
|
|
87
|
+
.filter(c => !c.passed)
|
|
88
|
+
.sort((a, b) => {
|
|
89
|
+
const sev = { critical: 0, warning: 1, info: 2 };
|
|
90
|
+
return (sev[a.severity] ?? 3) - (sev[b.severity] ?? 3);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
for (const c of failed.slice(0, 5)) {
|
|
94
|
+
const icon = c.severity === 'critical' ? '!!' : c.severity === 'warning' ? '! ' : ' ';
|
|
95
|
+
console.log(' [FAIL] ' + icon + c.id + ' — ' + c.name);
|
|
96
|
+
}
|
|
97
|
+
if (failed.length > 5) console.log(' ... and ' + (failed.length - 5) + ' more');
|
|
98
|
+
if (failed.length === 0) console.log(' All checks passed');
|
|
99
|
+
console.log('');
|
|
100
|
+
}
|
|
101
|
+
" "$INPUT"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# trend_report.sh — Generate audit score trend from audit-history.json.
|
|
3
|
+
# Usage: bash trend_report.sh [server-name]
|
|
4
|
+
# OR: bash trend_report.sh --all
|
|
5
|
+
#
|
|
6
|
+
# Reads ~/.kastell/audit-history.json (maintained by kastell-auditor agent).
|
|
7
|
+
# Shows score over time with delta indicators.
|
|
8
|
+
#
|
|
9
|
+
# Requires: node
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
HISTORY_FILE="${KASTELL_HOME:-$HOME/.kastell}/audit-history.json"
|
|
14
|
+
SERVER="${1:-}"
|
|
15
|
+
|
|
16
|
+
if [[ ! -f "$HISTORY_FILE" ]]; then
|
|
17
|
+
echo "No audit history found at: $HISTORY_FILE"
|
|
18
|
+
echo "Run 'kastell audit --server <name>' to generate data."
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
node -e "
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
25
|
+
const server = process.argv[2] || '';
|
|
26
|
+
const showAll = server === '--all';
|
|
27
|
+
|
|
28
|
+
if (!Array.isArray(data) || data.length === 0) {
|
|
29
|
+
console.log('No audit history entries found.');
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Filter by server if specified
|
|
34
|
+
let entries = showAll ? data : server
|
|
35
|
+
? data.filter(e => e.serverName === server || e.server === server)
|
|
36
|
+
: data;
|
|
37
|
+
|
|
38
|
+
if (entries.length === 0) {
|
|
39
|
+
console.log('No audit history for server: ' + server);
|
|
40
|
+
console.log('Available servers: ' + [...new Set(data.map(e => e.serverName || e.server))].join(', '));
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Sort by date
|
|
45
|
+
entries.sort((a, b) => new Date(a.timestamp || a.date) - new Date(b.timestamp || b.date));
|
|
46
|
+
|
|
47
|
+
// Group by server
|
|
48
|
+
const byServer = {};
|
|
49
|
+
for (const e of entries) {
|
|
50
|
+
const name = e.serverName || e.server || 'unknown';
|
|
51
|
+
if (!byServer[name]) byServer[name] = [];
|
|
52
|
+
byServer[name].push(e);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log('=== Audit Score Trend ===');
|
|
56
|
+
console.log('');
|
|
57
|
+
|
|
58
|
+
for (const [name, history] of Object.entries(byServer)) {
|
|
59
|
+
console.log('Server: ' + name);
|
|
60
|
+
console.log('-'.repeat(50));
|
|
61
|
+
|
|
62
|
+
let prev = null;
|
|
63
|
+
for (const e of history) {
|
|
64
|
+
const score = e.overallScore ?? e.score ?? 0;
|
|
65
|
+
const date = (e.timestamp || e.date || '').split('T')[0];
|
|
66
|
+
let delta = '';
|
|
67
|
+
if (prev !== null) {
|
|
68
|
+
const diff = score - prev;
|
|
69
|
+
delta = diff > 0 ? ' (+' + diff + ')' : diff < 0 ? ' (' + diff + ')' : ' (=)';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Visual bar
|
|
73
|
+
const filled = Math.round(score / 5);
|
|
74
|
+
const bar = '█'.repeat(filled) + '░'.repeat(20 - filled);
|
|
75
|
+
|
|
76
|
+
console.log(' ' + date + ' ' + String(score).padStart(3) + '/100 ' + bar + delta);
|
|
77
|
+
prev = score;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Latest bucket scores if available
|
|
81
|
+
const latest = history[history.length - 1];
|
|
82
|
+
if (latest.bucketScores) {
|
|
83
|
+
console.log('');
|
|
84
|
+
console.log(' Latest bucket breakdown:');
|
|
85
|
+
for (const [bucket, score] of Object.entries(latest.bucketScores)) {
|
|
86
|
+
console.log(' ' + bucket.padEnd(15) + ': ' + score);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
console.log('');
|
|
90
|
+
}
|
|
91
|
+
" "$HISTORY_FILE" "$SERVER"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PreToolUse hook: Block kastell destroy / server-delete commands (hard block)
|
|
3
|
+
|
|
4
|
+
// MANDATORY stdin guard — exit silently if stdin unavailable (e.g. after /clear)
|
|
5
|
+
if (!process.stdin || process.stdin.destroyed || !process.stdin.readable) {
|
|
6
|
+
process.exit(0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let input = '';
|
|
10
|
+
const stdinTimeout = setTimeout(() => process.exit(0), 1500);
|
|
11
|
+
process.stdin.setEncoding('utf8');
|
|
12
|
+
process.stdin.on('error', () => process.exit(0));
|
|
13
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
14
|
+
process.stdin.on('end', () => {
|
|
15
|
+
clearTimeout(stdinTimeout);
|
|
16
|
+
try {
|
|
17
|
+
const data = JSON.parse(input);
|
|
18
|
+
const cmd = (data.tool_input && data.tool_input.command) || '';
|
|
19
|
+
|
|
20
|
+
if (/\bkastell\s+(destroy|server-delete)\b/.test(cmd)) {
|
|
21
|
+
process.stdout.write(JSON.stringify({
|
|
22
|
+
decision: 'block',
|
|
23
|
+
reason: 'Destructive kastell operation detected. Use kastell destroy with --force flag directly in terminal, not through Claude Code.',
|
|
24
|
+
}));
|
|
25
|
+
process.exit(2);
|
|
26
|
+
}
|
|
27
|
+
} catch {}
|
|
28
|
+
|
|
29
|
+
// Not destructive or parse error — allow
|
|
30
|
+
process.exit(0);
|
|
31
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Bash",
|
|
6
|
+
"if": "Bash(*kastell*)",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"type": "command",
|
|
10
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/destroy-block.cjs"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"matcher": "Bash",
|
|
16
|
+
"if": "Bash(*git commit*)",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/pre-commit-audit-guard.cjs"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"PostToolUse": [
|
|
26
|
+
{
|
|
27
|
+
"matcher": "Bash",
|
|
28
|
+
"hooks": [
|
|
29
|
+
{
|
|
30
|
+
"type": "command",
|
|
31
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/session-log.cjs"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"SessionStart": [
|
|
37
|
+
{
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/session-audit.cjs"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"Stop": [
|
|
47
|
+
{
|
|
48
|
+
"hooks": [
|
|
49
|
+
{
|
|
50
|
+
"type": "command",
|
|
51
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/stop-quality-check.cjs"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PreToolUse hook: Block git commit if audit score dropped since previous audit run
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
const HISTORY_FILE = path.join(os.homedir(), '.kastell', 'audit-history.json');
|
|
9
|
+
|
|
10
|
+
// MANDATORY stdin guard — exit silently if stdin unavailable
|
|
11
|
+
if (!process.stdin || process.stdin.destroyed || !process.stdin.readable) {
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let input = '';
|
|
16
|
+
const stdinTimeout = setTimeout(() => process.exit(0), 1500);
|
|
17
|
+
process.stdin.setEncoding('utf8');
|
|
18
|
+
process.stdin.on('error', () => process.exit(0));
|
|
19
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
20
|
+
process.stdin.on('end', () => {
|
|
21
|
+
clearTimeout(stdinTimeout);
|
|
22
|
+
try {
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
|
|
25
|
+
// Kastell project guard (two-phase: directory structure + package.json name)
|
|
26
|
+
const isKastell = fs.existsSync(path.join(cwd, 'src', 'mcp')) &&
|
|
27
|
+
fs.existsSync(path.join(cwd, 'package.json'));
|
|
28
|
+
if (!isKastell) {
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
31
|
+
if (pkg.name !== 'kastell') process.exit(0);
|
|
32
|
+
} catch { process.exit(0); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Parse tool input — only act on git commit commands
|
|
36
|
+
const data = JSON.parse(input);
|
|
37
|
+
const cmd = (data.tool_input && data.tool_input.command) || '';
|
|
38
|
+
|
|
39
|
+
if (!/\bgit\s+commit\b/.test(cmd)) {
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Read audit history — fail-open if unavailable
|
|
44
|
+
let history;
|
|
45
|
+
try {
|
|
46
|
+
history = JSON.parse(fs.readFileSync(HISTORY_FILE, 'utf8'));
|
|
47
|
+
} catch {
|
|
48
|
+
// History missing or unreadable — allow commit
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Check each server for score regression between last two audit runs
|
|
53
|
+
for (const serverIp of Object.keys(history)) {
|
|
54
|
+
const entries = history[serverIp];
|
|
55
|
+
if (!Array.isArray(entries) || entries.length < 2) continue;
|
|
56
|
+
|
|
57
|
+
const current = entries[entries.length - 1].overallScore;
|
|
58
|
+
const previous = entries[entries.length - 2].overallScore;
|
|
59
|
+
|
|
60
|
+
if (typeof current !== 'number' || typeof previous !== 'number') continue;
|
|
61
|
+
if (current < previous) {
|
|
62
|
+
process.stdout.write(JSON.stringify({
|
|
63
|
+
decision: 'block',
|
|
64
|
+
reason: `Audit score dropped: ${previous} -> ${current} (${entries[entries.length - 1].serverName}). Run \`kastell audit\` to investigate before committing.`,
|
|
65
|
+
}));
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// No score drop detected — allow commit
|
|
71
|
+
} catch {}
|
|
72
|
+
|
|
73
|
+
// Fail-open: any unexpected error allows the commit through
|
|
74
|
+
process.exit(0);
|
|
75
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SessionStart hook: Show last audit score from cache (no SSH, instant)
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
const HISTORY_FILE = path.join(os.homedir(), '.kastell', 'audit-history.json');
|
|
9
|
+
|
|
10
|
+
// MANDATORY stdin guard — exit silently if stdin unavailable (e.g. after /clear)
|
|
11
|
+
if (!process.stdin || process.stdin.destroyed || !process.stdin.readable) {
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let input = '';
|
|
16
|
+
const stdinTimeout = setTimeout(() => process.exit(0), 1500);
|
|
17
|
+
process.stdin.setEncoding('utf8');
|
|
18
|
+
process.stdin.on('error', () => process.exit(0));
|
|
19
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
20
|
+
process.stdin.on('end', () => {
|
|
21
|
+
clearTimeout(stdinTimeout);
|
|
22
|
+
try {
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
|
|
25
|
+
// Kastell project guard
|
|
26
|
+
const isKastell = fs.existsSync(path.join(cwd, 'src', 'mcp')) &&
|
|
27
|
+
fs.existsSync(path.join(cwd, 'package.json'));
|
|
28
|
+
if (!isKastell) {
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
31
|
+
if (pkg.name !== 'kastell') process.exit(0);
|
|
32
|
+
} catch { process.exit(0); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Read audit history from cache — no SSH needed
|
|
36
|
+
let history;
|
|
37
|
+
try {
|
|
38
|
+
history = JSON.parse(fs.readFileSync(HISTORY_FILE, 'utf8'));
|
|
39
|
+
} catch {
|
|
40
|
+
// No history file — exit silently
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Find the most recent audit entry across all servers
|
|
45
|
+
let latest = null;
|
|
46
|
+
let latestTime = 0;
|
|
47
|
+
|
|
48
|
+
if (typeof history === 'object' && !Array.isArray(history)) {
|
|
49
|
+
// Format: { "ip": [ { overallScore, serverName, timestamp } ] }
|
|
50
|
+
for (const entries of Object.values(history)) {
|
|
51
|
+
if (!Array.isArray(entries)) continue;
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
const ts = new Date(entry.timestamp || entry.date || 0).getTime();
|
|
54
|
+
if (ts > latestTime) {
|
|
55
|
+
latestTime = ts;
|
|
56
|
+
latest = entry;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} else if (Array.isArray(history)) {
|
|
61
|
+
// Format: [ { overallScore, serverName, timestamp } ]
|
|
62
|
+
for (const entry of history) {
|
|
63
|
+
const ts = new Date(entry.timestamp || entry.date || 0).getTime();
|
|
64
|
+
if (ts > latestTime) {
|
|
65
|
+
latestTime = ts;
|
|
66
|
+
latest = entry;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (latest && typeof latest.overallScore === 'number') {
|
|
72
|
+
const serverName = latest.serverName || latest.server || 'unknown';
|
|
73
|
+
const date = (latest.timestamp || latest.date || '').split('T')[0];
|
|
74
|
+
const ageMs = Date.now() - latestTime;
|
|
75
|
+
const ageDays = Math.floor(ageMs / (1000 * 60 * 60 * 24));
|
|
76
|
+
const stale = ageDays > 7 ? ` (${ageDays} days ago — consider re-running)` : '';
|
|
77
|
+
|
|
78
|
+
process.stdout.write(JSON.stringify({
|
|
79
|
+
hookSpecificOutput: `[Kastell Audit] Last score: ${latest.overallScore}/100 (${serverName}, ${date})${stale}`,
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
} catch {}
|
|
83
|
+
|
|
84
|
+
// Always exit 0 — SessionStart MUST NOT fail
|
|
85
|
+
process.exit(0);
|
|
86
|
+
});
|