kastell 2.2.4 → 2.2.6
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 -18
- package/.claude-plugin/plugin.json +45 -38
- package/CHANGELOG.md +1313 -1266
- 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/commands/fix.d.ts +2 -0
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +26 -1
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/interactive/plugins.d.ts.map +1 -1
- package/dist/commands/interactive/plugins.js +26 -2
- package/dist/commands/interactive/plugins.js.map +1 -1
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +6 -2
- package/dist/commands/plugin.js.map +1 -1
- package/dist/core/audit/commands.d.ts +13 -2
- package/dist/core/audit/commands.d.ts.map +1 -1
- package/dist/core/audit/commands.js +39 -2
- package/dist/core/audit/commands.js.map +1 -1
- package/dist/core/audit/explainCheck.d.ts +1 -0
- package/dist/core/audit/explainCheck.d.ts.map +1 -1
- package/dist/core/audit/explainCheck.js +1 -1
- package/dist/core/audit/explainCheck.js.map +1 -1
- package/dist/core/audit/fix-history.d.ts +3 -1
- package/dist/core/audit/fix-history.d.ts.map +1 -1
- package/dist/core/audit/fix-history.js +6 -2
- package/dist/core/audit/fix-history.js.map +1 -1
- package/dist/core/audit/fix.d.ts.map +1 -1
- package/dist/core/audit/fix.js +22 -0
- 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 +12 -3
- package/dist/core/audit/index.js.map +1 -1
- package/dist/core/audit/listChecks.d.ts.map +1 -1
- package/dist/core/audit/listChecks.js +24 -0
- package/dist/core/audit/listChecks.js.map +1 -1
- package/dist/core/audit/pluginAudit.d.ts +8 -0
- package/dist/core/audit/pluginAudit.d.ts.map +1 -0
- package/dist/core/audit/pluginAudit.js +134 -0
- package/dist/core/audit/pluginAudit.js.map +1 -0
- package/dist/core/audit/pluginFix.d.ts +19 -0
- package/dist/core/audit/pluginFix.d.ts.map +1 -0
- package/dist/core/audit/pluginFix.js +122 -0
- package/dist/core/audit/pluginFix.js.map +1 -0
- package/dist/core/audit/snapshot.d.ts +4 -4
- package/dist/core/audit/types.d.ts +2 -1
- package/dist/core/audit/types.d.ts.map +1 -1
- package/dist/core/completions.js +631 -631
- package/dist/core/plugin.d.ts +6 -0
- package/dist/core/plugin.d.ts.map +1 -1
- package/dist/core/plugin.js +2 -0
- package/dist/core/plugin.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/pluginTools.d.ts +5 -0
- package/dist/mcp/pluginTools.d.ts.map +1 -0
- package/dist/mcp/pluginTools.js +54 -0
- package/dist/mcp/pluginTools.js.map +1 -0
- package/dist/mcp/prompts/workflows.d.ts +17 -0
- package/dist/mcp/prompts/workflows.d.ts.map +1 -0
- package/dist/mcp/prompts/workflows.js +73 -0
- package/dist/mcp/prompts/workflows.js.map +1 -0
- package/dist/mcp/resources/checks.d.ts +4 -0
- package/dist/mcp/resources/checks.d.ts.map +1 -0
- package/dist/mcp/resources/checks.js +49 -0
- package/dist/mcp/resources/checks.js.map +1 -0
- package/dist/mcp/resources/servers.d.ts +4 -0
- package/dist/mcp/resources/servers.d.ts.map +1 -0
- package/dist/mcp/resources/servers.js +59 -0
- package/dist/mcp/resources/servers.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +68 -35
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/serverAudit.d.ts +1 -1
- package/dist/mcp/tools/serverExplain.d.ts.map +1 -1
- package/dist/mcp/tools/serverExplain.js.map +1 -1
- package/dist/mcp/tools/serverFix.d.ts.map +1 -1
- package/dist/mcp/tools/serverFix.js +7 -1
- package/dist/mcp/tools/serverFix.js.map +1 -1
- package/dist/mcp/tools/serverFleet.d.ts.map +1 -1
- package/dist/mcp/tools/serverFleet.js.map +1 -1
- package/dist/mcp/tools/serverInfo.d.ts +1 -1
- package/dist/mcp/tools/serverInfo.js +1 -1
- package/dist/mcp/tools/serverManage.d.ts +2 -1
- package/dist/mcp/tools/serverManage.d.ts.map +1 -1
- package/dist/mcp/tools/serverManage.js +50 -5
- package/dist/mcp/tools/serverManage.js.map +1 -1
- package/dist/mcp/tools/serverPlugin.d.ts +3 -0
- package/dist/mcp/tools/serverPlugin.d.ts.map +1 -1
- package/dist/mcp/tools/serverPlugin.js +11 -1
- package/dist/mcp/tools/serverPlugin.js.map +1 -1
- package/dist/mcp/tools/serverProvision.d.ts +5 -5
- package/dist/mcp/tools/serverProvision.d.ts.map +1 -1
- package/dist/mcp/tools/serverProvision.js +31 -9
- package/dist/mcp/tools/serverProvision.js.map +1 -1
- package/dist/mcp/tools/serverSecure.d.ts.map +1 -1
- package/dist/mcp/tools/serverSecure.js +30 -1
- package/dist/mcp/tools/serverSecure.js.map +1 -1
- package/dist/mcp/utils.d.ts +25 -0
- package/dist/mcp/utils.d.ts.map +1 -1
- package/dist/mcp/utils.js +36 -0
- package/dist/mcp/utils.js.map +1 -1
- package/dist/mcp-bundle.mjs +102301 -0
- package/dist/plugin/handlerResolver.d.ts +2 -0
- package/dist/plugin/handlerResolver.d.ts.map +1 -0
- package/dist/plugin/handlerResolver.js +16 -0
- package/dist/plugin/handlerResolver.js.map +1 -0
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +41 -4
- package/dist/plugin/loader.js.map +1 -1
- package/dist/plugin/registerCommands.d.ts +4 -0
- package/dist/plugin/registerCommands.d.ts.map +1 -0
- package/dist/plugin/registerCommands.js +45 -0
- package/dist/plugin/registerCommands.js.map +1 -0
- package/dist/plugin/registry.d.ts +20 -1
- package/dist/plugin/registry.d.ts.map +1 -1
- package/dist/plugin/registry.js +51 -1
- package/dist/plugin/registry.js.map +1 -1
- package/dist/plugin/sdk/constants.d.ts +2 -0
- package/dist/plugin/sdk/constants.d.ts.map +1 -1
- package/dist/plugin/sdk/constants.js +2 -0
- package/dist/plugin/sdk/constants.js.map +1 -1
- package/dist/plugin/sdk/types.d.ts +74 -1
- package/dist/plugin/sdk/types.d.ts.map +1 -1
- package/dist/plugin/validate.d.ts +2 -1
- package/dist/plugin/validate.d.ts.map +1 -1
- package/dist/plugin/validate.js +106 -1
- package/dist/plugin/validate.js.map +1 -1
- package/dist/utils/cloudInit.js +58 -58
- package/dist/utils/fileLock.d.ts +5 -1
- package/dist/utils/fileLock.d.ts.map +1 -1
- package/dist/utils/fileLock.js +70 -15
- package/dist/utils/fileLock.js.map +1 -1
- package/dist/utils/paths.d.ts +0 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +1 -2
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/secureWrite.d.ts.map +1 -1
- package/dist/utils/secureWrite.js +3 -38
- package/dist/utils/secureWrite.js.map +1 -1
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +19 -4
- package/dist/utils/version.js.map +1 -1
- package/kastell-plugin/.claude-plugin/plugin.json +20 -20
- package/kastell-plugin/.mcp.json +15 -8
- package/kastell-plugin/README.md +113 -113
- package/kastell-plugin/agents/kastell-auditor.md +77 -77
- package/kastell-plugin/agents/scripts/bucket_mapper.sh +101 -101
- package/kastell-plugin/agents/scripts/trend_report.sh +91 -91
- package/kastell-plugin/hooks/destroy-block.cjs +31 -31
- package/kastell-plugin/hooks/hooks.json +57 -57
- package/kastell-plugin/hooks/pre-commit-audit-guard.cjs +75 -75
- package/kastell-plugin/hooks/session-audit.cjs +86 -86
- package/kastell-plugin/hooks/session-log.cjs +56 -56
- package/kastell-plugin/hooks/stop-quality-check.cjs +72 -72
- package/kastell-plugin/skills/kastell-careful/SKILL.md +64 -64
- package/kastell-plugin/skills/kastell-ops/SKILL.md +139 -139
- package/kastell-plugin/skills/kastell-ops/references/commands.md +45 -45
- package/kastell-plugin/skills/kastell-ops/references/mcp-tools.md +50 -50
- package/kastell-plugin/skills/kastell-ops/references/patterns.md +145 -145
- package/kastell-plugin/skills/kastell-ops/references/pitfalls.md +136 -136
- package/kastell-plugin/skills/kastell-ops/scripts/check_coverage.sh +101 -101
- package/kastell-plugin/skills/kastell-ops/scripts/fleet_report.sh +73 -73
- package/kastell-plugin/skills/kastell-ops/scripts/parse_audit.sh +76 -76
- package/kastell-plugin/skills/kastell-research/SKILL.md +90 -90
- package/kastell-plugin/skills/kastell-scaffold/SKILL.md +104 -104
- package/kastell-plugin/skills/kastell-scaffold/references/template-audit-check.md +150 -150
- package/kastell-plugin/skills/kastell-scaffold/references/template-command.md +80 -80
- package/kastell-plugin/skills/kastell-scaffold/references/template-mcp-tool.md +72 -72
- package/kastell-plugin/skills/kastell-scaffold/references/template-provider.md +67 -67
- package/kastell-plugin/skills/kastell-scaffold/scripts/scaffold.sh +180 -180
- package/kastell-plugin/skills/kastell-scaffold/templates/check-test.ts.tpl +27 -27
- package/kastell-plugin/skills/kastell-scaffold/templates/check.ts.tpl +50 -50
- package/kastell-plugin/skills/kastell-scaffold/templates/command-core.ts.tpl +18 -18
- package/kastell-plugin/skills/kastell-scaffold/templates/command-test.ts.tpl +17 -17
- package/kastell-plugin/skills/kastell-scaffold/templates/command.ts.tpl +25 -25
- package/kastell-plugin/skills/kastell-scaffold/templates/mcp-tool-test.ts.tpl +30 -30
- package/kastell-plugin/skills/kastell-scaffold/templates/mcp-tool.ts.tpl +29 -29
- package/kastell-plugin/skills/kastell-scaffold/templates/provider-test.ts.tpl +34 -34
- package/kastell-plugin/skills/kastell-scaffold/templates/provider.ts.tpl +32 -32
- package/package.json +125 -122
- package/dist/commands/interactive.d.ts +0 -11
- package/dist/commands/interactive.d.ts.map +0 -1
- package/dist/commands/interactive.js +0 -1079
- package/dist/commands/interactive.js.map +0 -1
- package/dist/core/lock.d.ts +0 -66
- package/dist/core/lock.d.ts.map +0 -1
- package/dist/core/lock.js +0 -556
- package/dist/core/lock.js.map +0 -1
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: kastell-research
|
|
3
|
-
description: Read-only Kastell codebase exploration. Use when tracing a bug across files, mapping callsites before refactoring, or exploring unfamiliar subsystems. Runs in isolated context with Explore agent.
|
|
4
|
-
context: fork
|
|
5
|
-
agent: Explore
|
|
6
|
-
allowed-tools: Read, Grep, Glob
|
|
7
|
-
effort: medium
|
|
8
|
-
memory: project
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Kastell Research
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
Explore the Kastell codebase using read-only tools (Read, Grep, Glob). Runs in a forked Explore agent with Kastell architecture knowledge inlined.
|
|
16
|
-
|
|
17
|
-
## When to Use
|
|
18
|
-
|
|
19
|
-
- **Bug investigation:** Trace a bug from CLI command through core logic to adapters/providers. Start at the command file, follow imports to core, check utils and adapters.
|
|
20
|
-
- **Feature mapping:** Map all callsites of a function, trace the import chain, understand how subsystems connect before making changes.
|
|
21
|
-
- **Architecture question:** Understand how audit categories work, how the adapter dispatch flows, or how lock hardening steps are structured.
|
|
22
|
-
|
|
23
|
-
## Live Codebase
|
|
24
|
-
|
|
25
|
-
**Commands:**
|
|
26
|
-
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/commands').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('commands dir not found'))"`
|
|
27
|
-
**Provider registry:**
|
|
28
|
-
!`node -e "import('fs').then(f=>{const c=f.readFileSync('src/constants.ts','utf8');const m=c.match(/PROVIDER_REGISTRY[\s\S]{0,200}/);console.log(m?m[0].split('\n').slice(0,4).join('\n'):'not found')}).catch(()=>console.log('constants.ts not found'))"`
|
|
29
|
-
|
|
30
|
-
## Architecture Map
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
src/
|
|
34
|
-
commands/ # 31 thin CLI wrappers (parse args + delegate only)
|
|
35
|
-
core/ # Business logic (ALL computation here)
|
|
36
|
-
audit/ # 30 audit categories, 457+ checks
|
|
37
|
-
lock/ # 24-step server hardening
|
|
38
|
-
providers/ # Cloud API: hetzner, digitalocean, vultr, linode
|
|
39
|
-
adapters/ # Platform abstraction: coolify, dokploy
|
|
40
|
-
factory.ts # getAdapter(platform) — entry point
|
|
41
|
-
mcp/
|
|
42
|
-
server.ts # 13 tool registrations
|
|
43
|
-
tools/ # Handler files
|
|
44
|
-
utils/ # ssh, config, cloudInit, modeGuard
|
|
45
|
-
types/ # ServerMode, ServerRecord, Platform
|
|
46
|
-
constants.ts # PROVIDER_REGISTRY
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Layer Flow
|
|
50
|
-
|
|
51
|
-
Commands (parse args) --> Core (business logic) --> Providers (cloud API) / Adapters (platform ops). MCP tools also delegate to Core.
|
|
52
|
-
|
|
53
|
-
## Research Workflows
|
|
54
|
-
|
|
55
|
-
**Bug investigation:**
|
|
56
|
-
1. Find the command file (`src/commands/<name>.ts`)
|
|
57
|
-
2. Follow the core import (`src/core/<name>.ts`)
|
|
58
|
-
3. Check adapter/provider calls
|
|
59
|
-
4. Check utils (ssh, config)
|
|
60
|
-
|
|
61
|
-
**Feature mapping:**
|
|
62
|
-
1. Grep for the function name
|
|
63
|
-
2. Follow import chain
|
|
64
|
-
3. Map all callsites
|
|
65
|
-
4. Check test coverage in `__tests__/`
|
|
66
|
-
|
|
67
|
-
**Architecture question:**
|
|
68
|
-
1. Read the Architecture Map above
|
|
69
|
-
2. Read `kastell-plugin/skills/kastell-ops/SKILL.md` for full detail (adapter contract, provider registry, layer rules)
|
|
70
|
-
3. Trace specific files
|
|
71
|
-
|
|
72
|
-
## Debug by Symptom
|
|
73
|
-
|
|
74
|
-
Common failure patterns and where to look first:
|
|
75
|
-
|
|
76
|
-
| Symptom | Start Here | Then Check |
|
|
77
|
-
|---------|-----------|------------|
|
|
78
|
-
| SSH auth failure | `src/utils/ssh.ts` → `sshExec()` | `assertValidIp()`, server config `~/.kastell/servers.json`, banner parsing |
|
|
79
|
-
| Provider API error | `src/providers/<name>.ts` | `withProviderErrorHandling()` in `src/utils/retry.ts`, API token config |
|
|
80
|
-
| Audit check false positive | `src/core/audit/checks/<category>.ts` | SSH command output parsing, regex pattern, `sshExec` mock in test |
|
|
81
|
-
| Fix rejected (SAFE tier) | `src/core/fix.ts` → `resolveTier()` | `FORBIDDEN_PATTERNS`, shell redirect/pipe in fixCommand string |
|
|
82
|
-
| MCP tool error | `src/mcp/tools/<name>.ts` | Handler → core delegation, Zod schema validation, `result.content` format |
|
|
83
|
-
| Lock step failure | `src/core/lock.ts` | Step's SSH command, `sshExec` stderr, cloud-init completion |
|
|
84
|
-
| Config not found | `src/utils/config.ts` | `~/.kastell/` dir existence, `servers.json` format, migration from `~/.quicklify/` |
|
|
85
|
-
|
|
86
|
-
**Known pitfalls:** See `kastell-plugin/skills/kastell-ops/references/pitfalls.md`
|
|
87
|
-
|
|
88
|
-
## ARGUMENTS
|
|
89
|
-
|
|
90
|
-
$ARGUMENTS
|
|
1
|
+
---
|
|
2
|
+
name: kastell-research
|
|
3
|
+
description: Read-only Kastell codebase exploration. Use when tracing a bug across files, mapping callsites before refactoring, or exploring unfamiliar subsystems. Runs in isolated context with Explore agent.
|
|
4
|
+
context: fork
|
|
5
|
+
agent: Explore
|
|
6
|
+
allowed-tools: Read, Grep, Glob
|
|
7
|
+
effort: medium
|
|
8
|
+
memory: project
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Kastell Research
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Explore the Kastell codebase using read-only tools (Read, Grep, Glob). Runs in a forked Explore agent with Kastell architecture knowledge inlined.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- **Bug investigation:** Trace a bug from CLI command through core logic to adapters/providers. Start at the command file, follow imports to core, check utils and adapters.
|
|
20
|
+
- **Feature mapping:** Map all callsites of a function, trace the import chain, understand how subsystems connect before making changes.
|
|
21
|
+
- **Architecture question:** Understand how audit categories work, how the adapter dispatch flows, or how lock hardening steps are structured.
|
|
22
|
+
|
|
23
|
+
## Live Codebase
|
|
24
|
+
|
|
25
|
+
**Commands:**
|
|
26
|
+
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/commands').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('commands dir not found'))"`
|
|
27
|
+
**Provider registry:**
|
|
28
|
+
!`node -e "import('fs').then(f=>{const c=f.readFileSync('src/constants.ts','utf8');const m=c.match(/PROVIDER_REGISTRY[\s\S]{0,200}/);console.log(m?m[0].split('\n').slice(0,4).join('\n'):'not found')}).catch(()=>console.log('constants.ts not found'))"`
|
|
29
|
+
|
|
30
|
+
## Architecture Map
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
src/
|
|
34
|
+
commands/ # 31 thin CLI wrappers (parse args + delegate only)
|
|
35
|
+
core/ # Business logic (ALL computation here)
|
|
36
|
+
audit/ # 30 audit categories, 457+ checks
|
|
37
|
+
lock/ # 24-step server hardening
|
|
38
|
+
providers/ # Cloud API: hetzner, digitalocean, vultr, linode
|
|
39
|
+
adapters/ # Platform abstraction: coolify, dokploy
|
|
40
|
+
factory.ts # getAdapter(platform) — entry point
|
|
41
|
+
mcp/
|
|
42
|
+
server.ts # 13 tool registrations
|
|
43
|
+
tools/ # Handler files
|
|
44
|
+
utils/ # ssh, config, cloudInit, modeGuard
|
|
45
|
+
types/ # ServerMode, ServerRecord, Platform
|
|
46
|
+
constants.ts # PROVIDER_REGISTRY
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Layer Flow
|
|
50
|
+
|
|
51
|
+
Commands (parse args) --> Core (business logic) --> Providers (cloud API) / Adapters (platform ops). MCP tools also delegate to Core.
|
|
52
|
+
|
|
53
|
+
## Research Workflows
|
|
54
|
+
|
|
55
|
+
**Bug investigation:**
|
|
56
|
+
1. Find the command file (`src/commands/<name>.ts`)
|
|
57
|
+
2. Follow the core import (`src/core/<name>.ts`)
|
|
58
|
+
3. Check adapter/provider calls
|
|
59
|
+
4. Check utils (ssh, config)
|
|
60
|
+
|
|
61
|
+
**Feature mapping:**
|
|
62
|
+
1. Grep for the function name
|
|
63
|
+
2. Follow import chain
|
|
64
|
+
3. Map all callsites
|
|
65
|
+
4. Check test coverage in `__tests__/`
|
|
66
|
+
|
|
67
|
+
**Architecture question:**
|
|
68
|
+
1. Read the Architecture Map above
|
|
69
|
+
2. Read `kastell-plugin/skills/kastell-ops/SKILL.md` for full detail (adapter contract, provider registry, layer rules)
|
|
70
|
+
3. Trace specific files
|
|
71
|
+
|
|
72
|
+
## Debug by Symptom
|
|
73
|
+
|
|
74
|
+
Common failure patterns and where to look first:
|
|
75
|
+
|
|
76
|
+
| Symptom | Start Here | Then Check |
|
|
77
|
+
|---------|-----------|------------|
|
|
78
|
+
| SSH auth failure | `src/utils/ssh.ts` → `sshExec()` | `assertValidIp()`, server config `~/.kastell/servers.json`, banner parsing |
|
|
79
|
+
| Provider API error | `src/providers/<name>.ts` | `withProviderErrorHandling()` in `src/utils/retry.ts`, API token config |
|
|
80
|
+
| Audit check false positive | `src/core/audit/checks/<category>.ts` | SSH command output parsing, regex pattern, `sshExec` mock in test |
|
|
81
|
+
| Fix rejected (SAFE tier) | `src/core/fix.ts` → `resolveTier()` | `FORBIDDEN_PATTERNS`, shell redirect/pipe in fixCommand string |
|
|
82
|
+
| MCP tool error | `src/mcp/tools/<name>.ts` | Handler → core delegation, Zod schema validation, `result.content` format |
|
|
83
|
+
| Lock step failure | `src/core/lock.ts` | Step's SSH command, `sshExec` stderr, cloud-init completion |
|
|
84
|
+
| Config not found | `src/utils/config.ts` | `~/.kastell/` dir existence, `servers.json` format, migration from `~/.quicklify/` |
|
|
85
|
+
|
|
86
|
+
**Known pitfalls:** See `kastell-plugin/skills/kastell-ops/references/pitfalls.md`
|
|
87
|
+
|
|
88
|
+
## ARGUMENTS
|
|
89
|
+
|
|
90
|
+
$ARGUMENTS
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: kastell-scaffold
|
|
3
|
-
description: Generate new Kastell components from templates. Creates boilerplate for CLI commands, audit checks, providers, and MCP tools following current architecture (commands thin, core fat, adapters dispatch).
|
|
4
|
-
context: fork
|
|
5
|
-
disable-model-invocation: true
|
|
6
|
-
effort: medium
|
|
7
|
-
allowed-tools: Read, Edit, Write, Bash, Glob, Grep
|
|
8
|
-
argument-hint: "[check|command|provider|mcp-tool] [name]"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Kastell Scaffold
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
Generate boilerplate files for new Kastell components. Each template follows the post-P63/P64 architecture: commands are thin wrappers, business logic lives in core/, providers handle cloud API, adapters abstract platform ops.
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
/kastell:scaffold command server-migrate # creates command + core + test files
|
|
21
|
-
/kastell:scaffold check filesystem-perms # creates audit check + catalog update
|
|
22
|
-
/kastell:scaffold provider ovhcloud # creates provider + registry entry + test
|
|
23
|
-
/kastell:scaffold mcp-tool server_migrate # creates MCP tool + registration + test
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
`$ARGUMENTS[0]` is the component type. `$ARGUMENTS[1]` is the component name.
|
|
27
|
-
|
|
28
|
-
## Architecture Rules
|
|
29
|
-
|
|
30
|
-
These rules apply in every generated file. The forked subagent does not automatically have kastell-ops context — enforce these rules explicitly.
|
|
31
|
-
|
|
32
|
-
| Layer | Path | Rule |
|
|
33
|
-
|----------|-------------------|--------------------------------------------------------------|
|
|
34
|
-
| Commands | src/commands/ | Parse args + delegate. ZERO business logic. |
|
|
35
|
-
| Core | src/core/ | ALL business logic. No chalk/ora/UI imports. |
|
|
36
|
-
| Providers| src/providers/ | Cloud API per provider. Extends BaseProvider. |
|
|
37
|
-
| Adapters | src/adapters/ | Platform ops via PlatformAdapter. Access via getAdapter(). |
|
|
38
|
-
| MCP | src/mcp/tools/ | Zod schema + handler. Delegates to core. |
|
|
39
|
-
|
|
40
|
-
**Critical:** Never import CoolifyAdapter or DokployAdapter directly. Always use `getAdapter(platform)` from `src/adapters/factory.ts`.
|
|
41
|
-
|
|
42
|
-
**ESM:** `"type": "module"` — use `import`, not `require`. All imports use `.js` extension.
|
|
43
|
-
|
|
44
|
-
## Existing Components
|
|
45
|
-
|
|
46
|
-
**Commands:**
|
|
47
|
-
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/commands').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('commands dir not found'))"`
|
|
48
|
-
**Providers:**
|
|
49
|
-
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/providers').filter(x=>x.endsWith('.ts')&&x!=='base.ts').map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('providers dir not found'))"`
|
|
50
|
-
**MCP tools:**
|
|
51
|
-
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/mcp/tools').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('mcp/tools dir not found'))"`
|
|
52
|
-
**Audit categories:**
|
|
53
|
-
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/core/audit',{withFileTypes:true}).filter(d=>d.isDirectory()).map(d=>d.name).join(', '))).catch(()=>console.log('audit dir not found'))"`
|
|
54
|
-
|
|
55
|
-
## Script (Deterministic)
|
|
56
|
-
|
|
57
|
-
Run the scaffold script to generate boilerplate files:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
bash scripts/scaffold.sh $ARGUMENTS[0] $ARGUMENTS[1]
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The script reads `.tpl` templates from `templates/`, replaces `__NAME__`/`__NAME_PASCAL__`/`__NAME_CAMEL__`/`__NAME_UPPER__` placeholders, and creates files in the project. Add `--dry-run` to preview without writing.
|
|
64
|
-
|
|
65
|
-
**Files generated per type:**
|
|
66
|
-
- `command` → 3 files: `src/commands/`, `src/core/`, `src/__tests__/core/`
|
|
67
|
-
- `check` → 2 files: `src/core/audit/checks/`, `src/__tests__/core/audit/checks/`
|
|
68
|
-
- `provider` → 2 files: `src/providers/`, `src/__tests__/providers/`
|
|
69
|
-
- `mcp-tool` → 2 files: `src/mcp/tools/`, `src/__tests__/mcp/`
|
|
70
|
-
|
|
71
|
-
## Template Reference (Context for LLM)
|
|
72
|
-
|
|
73
|
-
After running the script, read the matching reference for registration details:
|
|
74
|
-
|
|
75
|
-
| Type | Reference File |
|
|
76
|
-
|------------|------------------------------------------------|
|
|
77
|
-
| `command` | references/template-command.md |
|
|
78
|
-
| `check` | references/template-audit-check.md |
|
|
79
|
-
| `provider` | references/template-provider.md |
|
|
80
|
-
| `mcp-tool` | references/template-mcp-tool.md |
|
|
81
|
-
|
|
82
|
-
## After Generation
|
|
83
|
-
|
|
84
|
-
Perform these steps after creating the boilerplate files:
|
|
85
|
-
|
|
86
|
-
- [ ] Write tests first (TDD preferred — test core, not command)
|
|
87
|
-
- [ ] Register the component:
|
|
88
|
-
- Commands: add import in `src/index.ts`
|
|
89
|
-
- MCP tools: `registerTool()` in `src/mcp/server.ts`
|
|
90
|
-
- Providers: add to `PROVIDER_REGISTRY` in `src/constants.ts`
|
|
91
|
-
- Audit checks: add entry to `src/core/audit/catalog.ts`
|
|
92
|
-
- [ ] Run `npm run build && npm test && npm run lint`
|
|
93
|
-
- [ ] Update README.md
|
|
94
|
-
|
|
95
|
-
## Skill/Agent Oluşturma Kuralları (Yeni skill/agent scaffold ediliyorsa)
|
|
96
|
-
|
|
97
|
-
Yeni skill veya agent oluşturulurken aşağıdaki koşullar ZORUNLU:
|
|
98
|
-
- [ ] **Ersin kriteri:** scripts/ klasörü oluştur — deterministik iş LLM'e bırakılmayacak
|
|
99
|
-
- [ ] **Progressive disclosure:** SKILL.md < 500 satır, detaylar references/ klasöründe
|
|
100
|
-
- [ ] **Frontmatter:** `effort` + `allowed-tools` ekle (minimum zorunlu)
|
|
101
|
-
- [ ] **Yan etki varsa:** `disable-model-invocation: true` ekle
|
|
102
|
-
- [ ] **Agent ise:** `maxTurns` belirle, `memory` scope tanımla
|
|
103
|
-
- [ ] **Script dili:** Shell (sh/bash) tercih et — Node.js ekosistemiyle uyumlu
|
|
104
|
-
- [ ] **Evaluation:** Gerçek task'ta test et, struggle noktalarını gözlemle
|
|
1
|
+
---
|
|
2
|
+
name: kastell-scaffold
|
|
3
|
+
description: Generate new Kastell components from templates. Creates boilerplate for CLI commands, audit checks, providers, and MCP tools following current architecture (commands thin, core fat, adapters dispatch).
|
|
4
|
+
context: fork
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
effort: medium
|
|
7
|
+
allowed-tools: Read, Edit, Write, Bash, Glob, Grep
|
|
8
|
+
argument-hint: "[check|command|provider|mcp-tool] [name]"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Kastell Scaffold
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Generate boilerplate files for new Kastell components. Each template follows the post-P63/P64 architecture: commands are thin wrappers, business logic lives in core/, providers handle cloud API, adapters abstract platform ops.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/kastell:scaffold command server-migrate # creates command + core + test files
|
|
21
|
+
/kastell:scaffold check filesystem-perms # creates audit check + catalog update
|
|
22
|
+
/kastell:scaffold provider ovhcloud # creates provider + registry entry + test
|
|
23
|
+
/kastell:scaffold mcp-tool server_migrate # creates MCP tool + registration + test
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`$ARGUMENTS[0]` is the component type. `$ARGUMENTS[1]` is the component name.
|
|
27
|
+
|
|
28
|
+
## Architecture Rules
|
|
29
|
+
|
|
30
|
+
These rules apply in every generated file. The forked subagent does not automatically have kastell-ops context — enforce these rules explicitly.
|
|
31
|
+
|
|
32
|
+
| Layer | Path | Rule |
|
|
33
|
+
|----------|-------------------|--------------------------------------------------------------|
|
|
34
|
+
| Commands | src/commands/ | Parse args + delegate. ZERO business logic. |
|
|
35
|
+
| Core | src/core/ | ALL business logic. No chalk/ora/UI imports. |
|
|
36
|
+
| Providers| src/providers/ | Cloud API per provider. Extends BaseProvider. |
|
|
37
|
+
| Adapters | src/adapters/ | Platform ops via PlatformAdapter. Access via getAdapter(). |
|
|
38
|
+
| MCP | src/mcp/tools/ | Zod schema + handler. Delegates to core. |
|
|
39
|
+
|
|
40
|
+
**Critical:** Never import CoolifyAdapter or DokployAdapter directly. Always use `getAdapter(platform)` from `src/adapters/factory.ts`.
|
|
41
|
+
|
|
42
|
+
**ESM:** `"type": "module"` — use `import`, not `require`. All imports use `.js` extension.
|
|
43
|
+
|
|
44
|
+
## Existing Components
|
|
45
|
+
|
|
46
|
+
**Commands:**
|
|
47
|
+
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/commands').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('commands dir not found'))"`
|
|
48
|
+
**Providers:**
|
|
49
|
+
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/providers').filter(x=>x.endsWith('.ts')&&x!=='base.ts').map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('providers dir not found'))"`
|
|
50
|
+
**MCP tools:**
|
|
51
|
+
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/mcp/tools').filter(x=>x.endsWith('.ts')).map(x=>x.replace('.ts','')).join(', '))).catch(()=>console.log('mcp/tools dir not found'))"`
|
|
52
|
+
**Audit categories:**
|
|
53
|
+
!`node -e "import('fs').then(f=>console.log(f.readdirSync('src/core/audit',{withFileTypes:true}).filter(d=>d.isDirectory()).map(d=>d.name).join(', '))).catch(()=>console.log('audit dir not found'))"`
|
|
54
|
+
|
|
55
|
+
## Script (Deterministic)
|
|
56
|
+
|
|
57
|
+
Run the scaffold script to generate boilerplate files:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bash scripts/scaffold.sh $ARGUMENTS[0] $ARGUMENTS[1]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The script reads `.tpl` templates from `templates/`, replaces `__NAME__`/`__NAME_PASCAL__`/`__NAME_CAMEL__`/`__NAME_UPPER__` placeholders, and creates files in the project. Add `--dry-run` to preview without writing.
|
|
64
|
+
|
|
65
|
+
**Files generated per type:**
|
|
66
|
+
- `command` → 3 files: `src/commands/`, `src/core/`, `src/__tests__/core/`
|
|
67
|
+
- `check` → 2 files: `src/core/audit/checks/`, `src/__tests__/core/audit/checks/`
|
|
68
|
+
- `provider` → 2 files: `src/providers/`, `src/__tests__/providers/`
|
|
69
|
+
- `mcp-tool` → 2 files: `src/mcp/tools/`, `src/__tests__/mcp/`
|
|
70
|
+
|
|
71
|
+
## Template Reference (Context for LLM)
|
|
72
|
+
|
|
73
|
+
After running the script, read the matching reference for registration details:
|
|
74
|
+
|
|
75
|
+
| Type | Reference File |
|
|
76
|
+
|------------|------------------------------------------------|
|
|
77
|
+
| `command` | references/template-command.md |
|
|
78
|
+
| `check` | references/template-audit-check.md |
|
|
79
|
+
| `provider` | references/template-provider.md |
|
|
80
|
+
| `mcp-tool` | references/template-mcp-tool.md |
|
|
81
|
+
|
|
82
|
+
## After Generation
|
|
83
|
+
|
|
84
|
+
Perform these steps after creating the boilerplate files:
|
|
85
|
+
|
|
86
|
+
- [ ] Write tests first (TDD preferred — test core, not command)
|
|
87
|
+
- [ ] Register the component:
|
|
88
|
+
- Commands: add import in `src/index.ts`
|
|
89
|
+
- MCP tools: `registerTool()` in `src/mcp/server.ts`
|
|
90
|
+
- Providers: add to `PROVIDER_REGISTRY` in `src/constants.ts`
|
|
91
|
+
- Audit checks: add entry to `src/core/audit/catalog.ts`
|
|
92
|
+
- [ ] Run `npm run build && npm test && npm run lint`
|
|
93
|
+
- [ ] Update README.md
|
|
94
|
+
|
|
95
|
+
## Skill/Agent Oluşturma Kuralları (Yeni skill/agent scaffold ediliyorsa)
|
|
96
|
+
|
|
97
|
+
Yeni skill veya agent oluşturulurken aşağıdaki koşullar ZORUNLU:
|
|
98
|
+
- [ ] **Ersin kriteri:** scripts/ klasörü oluştur — deterministik iş LLM'e bırakılmayacak
|
|
99
|
+
- [ ] **Progressive disclosure:** SKILL.md < 500 satır, detaylar references/ klasöründe
|
|
100
|
+
- [ ] **Frontmatter:** `effort` + `allowed-tools` ekle (minimum zorunlu)
|
|
101
|
+
- [ ] **Yan etki varsa:** `disable-model-invocation: true` ekle
|
|
102
|
+
- [ ] **Agent ise:** `maxTurns` belirle, `memory` scope tanımla
|
|
103
|
+
- [ ] **Script dili:** Shell (sh/bash) tercih et — Node.js ekosistemiyle uyumlu
|
|
104
|
+
- [ ] **Evaluation:** Gerçek task'ta test et, struggle noktalarını gözlemle
|