@smartsoft001/claude-plugins 2.108.0 → 2.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
# @smartsoft001/claude-plugins
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
 
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
`npm i @smartsoft001/claude-plugins`
|
|
8
|
+
|
|
9
|
+
## Marketplace
|
|
4
10
|
|
|
5
11
|
To add Claude plugins from the local marketplace:
|
|
12
|
+
|
|
6
13
|
```bash
|
|
7
14
|
claude plugin marketplace add ./node_modules/@smartsoft001/claude-plugins
|
|
8
15
|
```
|
|
16
|
+
|
|
17
|
+
## Plugins
|
|
18
|
+
|
|
19
|
+
### smart
|
|
20
|
+
|
|
21
|
+
Hooks for skill activation, safety validation, formatting, and audit logging.
|
|
22
|
+
|
|
23
|
+
| Documentation | Description |
|
|
24
|
+
|---------------|-------------|
|
|
25
|
+
| [README](./src/plugins/smart/hooks/README.md) | Overview of available hooks |
|
|
26
|
+
| [CONFIG](./src/plugins/smart/hooks/CONFIG.md) | Configuration and customization guide |
|
|
27
|
+
|
|
28
|
+
## Contributing
|
|
29
|
+
|
|
30
|
+
Contributions are welcome!
|
|
31
|
+
|
|
32
|
+
1. Fork the repository.
|
|
33
|
+
2. Create a feature branch: git checkout -b feature/my-new-feature.
|
|
34
|
+
3. Commit your changes: git commit -m 'Add some feature'.
|
|
35
|
+
4. Push to the branch: git push origin feature/my-new-feature.
|
|
36
|
+
5. Submit a pull request.
|
|
37
|
+
|
|
38
|
+
For more details, see our [Contributing Guidelines](../../../CONTRIBUTING.md).
|
|
39
|
+
|
|
40
|
+
## Changelog
|
|
41
|
+
|
|
42
|
+
All notable changes to this project will be documented in the [CHANGELOG](../../../CHANGELOG.md).
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
This project is licensed under the MIT License.
|
package/package.json
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Smart Plugin for Claude Code
|
|
2
|
+
|
|
3
|
+
Smartsoft integration - safety validation, audit logging, and auto-formatting hooks.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
| Feature | Description |
|
|
8
|
+
|---------|-------------|
|
|
9
|
+
| Safety validation | Blocks destructive bash commands (`rm -rf /`, etc.) |
|
|
10
|
+
| Sensitive file protection | Blocks access to `.env`, credentials, secrets |
|
|
11
|
+
| Audit logging | Logs all Claude actions to `.claude/audit_logs/` |
|
|
12
|
+
| Skill validation | Validates skill file structure (soft warnings) |
|
|
13
|
+
| Auto-formatting | Formats files after Write/Edit operations |
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### 1. Enable plugin in project's `.claude/settings.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"enabledPlugins": {
|
|
22
|
+
"smart@smartsoft": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Merge settings from template
|
|
28
|
+
|
|
29
|
+
**Quick merge script:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node node_modules/@smartsoft001/claude-plugins/plugins/smart/.claude-plugin/merge-permissions.js
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This will:
|
|
36
|
+
- Add required permissions (source, nvm, npm run format, jq)
|
|
37
|
+
- Configure all hooks (PreToolUse, PostToolUse, UserPromptSubmit)
|
|
38
|
+
- Enable the plugin
|
|
39
|
+
|
|
40
|
+
## Hooks
|
|
41
|
+
|
|
42
|
+
### PreToolUse Hooks
|
|
43
|
+
|
|
44
|
+
| Hook | Matcher | Purpose |
|
|
45
|
+
|------|---------|---------|
|
|
46
|
+
| `safety_validator.py` | Bash\|Write\|Edit | Blocks destructive commands |
|
|
47
|
+
| Sensitive file blocker | Read\|Edit\|Write | Blocks `.env`, secrets, credentials |
|
|
48
|
+
| `audit_logger.py` | * | Logs all events |
|
|
49
|
+
| `skill_validator.py` | Write\|Edit | Validates skill files |
|
|
50
|
+
|
|
51
|
+
### PostToolUse Hooks
|
|
52
|
+
|
|
53
|
+
| Hook | Matcher | Purpose |
|
|
54
|
+
|------|---------|---------|
|
|
55
|
+
| Auto-format | Write\|Edit | `npm run format` after file changes |
|
|
56
|
+
| `audit_logger.py` | * | Logs all events |
|
|
57
|
+
|
|
58
|
+
### UserPromptSubmit Hooks
|
|
59
|
+
|
|
60
|
+
| Hook | Purpose |
|
|
61
|
+
|------|---------|
|
|
62
|
+
| `audit_logger.py` | Logs user prompts |
|
|
63
|
+
|
|
64
|
+
## Permissions
|
|
65
|
+
|
|
66
|
+
The plugin requires these permissions to function:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"allow": [
|
|
71
|
+
"Bash(source:*)",
|
|
72
|
+
"Bash(nvm use:*)",
|
|
73
|
+
"Bash(npm run format:*)",
|
|
74
|
+
"Bash(jq:*)"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Audit Logs
|
|
80
|
+
|
|
81
|
+
Logs are stored in `.claude/audit_logs/YYYYMMDD_audit.jsonl`:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{"timestamp": "2024-01-15T10:30:00Z", "event": "PreToolUse", "tool": "Bash", "input": {...}}
|
|
85
|
+
{"timestamp": "2024-01-15T10:30:01Z", "event": "PostToolUse", "tool": "Bash", "success": true}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Customization
|
|
89
|
+
|
|
90
|
+
See `hooks/CONFIG.md` for:
|
|
91
|
+
- Adding custom blocked patterns
|
|
92
|
+
- Changing log location
|
|
93
|
+
- Creating new hooks
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Merge smart plugin settings into project's .claude/settings.json
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx @smartsoft001/claude-plugins smart:merge-permissions
|
|
7
|
+
*
|
|
8
|
+
* Or directly:
|
|
9
|
+
* node node_modules/@smartsoft001/claude-plugins/plugins/smart/.claude-plugin/merge-permissions.js
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const SETTINGS_PATH = path.join(process.cwd(), '.claude', 'settings.json');
|
|
16
|
+
const TEMPLATE_PATH = path.join(__dirname, 'settings.template.json');
|
|
17
|
+
|
|
18
|
+
function loadJson(filePath) {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function mergeArrays(existing, template) {
|
|
27
|
+
return [...new Set([...existing, ...template])];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function mergeHooks(existing, template) {
|
|
31
|
+
if (!template) return existing;
|
|
32
|
+
if (!existing) return template;
|
|
33
|
+
|
|
34
|
+
const merged = { ...existing };
|
|
35
|
+
|
|
36
|
+
for (const [event, hooks] of Object.entries(template)) {
|
|
37
|
+
if (!merged[event]) {
|
|
38
|
+
merged[event] = hooks;
|
|
39
|
+
} else {
|
|
40
|
+
// Merge by checking _description to avoid duplicates
|
|
41
|
+
const existingDescriptions = merged[event].map(h => h._description).filter(Boolean);
|
|
42
|
+
for (const hook of hooks) {
|
|
43
|
+
if (hook._description && !existingDescriptions.includes(hook._description)) {
|
|
44
|
+
merged[event].push(hook);
|
|
45
|
+
} else if (!hook._description) {
|
|
46
|
+
merged[event].push(hook);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return merged;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function main() {
|
|
56
|
+
console.log('Smart Plugin - Merge Settings\n');
|
|
57
|
+
|
|
58
|
+
// Load template
|
|
59
|
+
const template = loadJson(TEMPLATE_PATH);
|
|
60
|
+
if (!template) {
|
|
61
|
+
console.error('ERROR: Could not load template from:', TEMPLATE_PATH);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Load or create settings
|
|
66
|
+
let settings = loadJson(SETTINGS_PATH);
|
|
67
|
+
if (!settings) {
|
|
68
|
+
console.log('Creating new .claude/settings.json...');
|
|
69
|
+
fs.mkdirSync(path.dirname(SETTINGS_PATH), { recursive: true });
|
|
70
|
+
settings = { permissions: { allow: [], deny: [], ask: [] }, hooks: {} };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Ensure structures exist
|
|
74
|
+
settings.permissions = settings.permissions || { allow: [], deny: [], ask: [] };
|
|
75
|
+
settings.permissions.allow = settings.permissions.allow || [];
|
|
76
|
+
settings.permissions.ask = settings.permissions.ask || [];
|
|
77
|
+
settings.permissions.deny = settings.permissions.deny || [];
|
|
78
|
+
settings.hooks = settings.hooks || {};
|
|
79
|
+
|
|
80
|
+
// Count before
|
|
81
|
+
const beforeAllow = settings.permissions.allow.length;
|
|
82
|
+
const beforeHooks = Object.keys(settings.hooks).length;
|
|
83
|
+
|
|
84
|
+
// Merge permissions
|
|
85
|
+
settings.permissions.allow = mergeArrays(settings.permissions.allow, template.permissions.allow);
|
|
86
|
+
|
|
87
|
+
// Merge hooks
|
|
88
|
+
settings.hooks = mergeHooks(settings.hooks, template.hooks);
|
|
89
|
+
|
|
90
|
+
// Enable plugin
|
|
91
|
+
settings.enabledPlugins = settings.enabledPlugins || {};
|
|
92
|
+
settings.enabledPlugins['smart@smartsoft'] = true;
|
|
93
|
+
|
|
94
|
+
// Write back
|
|
95
|
+
fs.writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2) + '\n');
|
|
96
|
+
|
|
97
|
+
// Report
|
|
98
|
+
const addedAllow = settings.permissions.allow.length - beforeAllow;
|
|
99
|
+
const afterHooks = Object.keys(settings.hooks).length;
|
|
100
|
+
|
|
101
|
+
console.log('Settings merged successfully!\n');
|
|
102
|
+
console.log(` permissions.allow: ${beforeAllow} -> ${settings.permissions.allow.length} (+${addedAllow})`);
|
|
103
|
+
console.log(` hooks events: ${beforeHooks} -> ${afterHooks}`);
|
|
104
|
+
console.log(`\nPlugin enabled: smart@smartsoft`);
|
|
105
|
+
console.log(`\nFile updated: ${SETTINGS_PATH}`);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
main();
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart",
|
|
3
|
-
"description": "Smartsoft integration",
|
|
4
|
-
"version": "2.
|
|
3
|
+
"description": "Smartsoft integration - safety validation, audit logging, and auto-formatting hooks",
|
|
4
|
+
"version": "2.111.0",
|
|
5
|
+
"settingsTemplate": "settings.template.json",
|
|
6
|
+
"hooks": [
|
|
7
|
+
"safety_validator.py",
|
|
8
|
+
"audit_logger.py",
|
|
9
|
+
"skill_validator.py"
|
|
10
|
+
],
|
|
11
|
+
"features": [
|
|
12
|
+
"Safety validation (blocks destructive commands)",
|
|
13
|
+
"Sensitive file protection",
|
|
14
|
+
"Audit logging (all events)",
|
|
15
|
+
"Skill file validation",
|
|
16
|
+
"Auto-formatting (PostToolUse)"
|
|
17
|
+
]
|
|
5
18
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/anthropics/claude-code/main/schemas/settings.schema.json",
|
|
3
|
+
"_description": "Template settings for smart@smartsoft plugin. Merge these into your project's .claude/settings.json",
|
|
4
|
+
"permissions": {
|
|
5
|
+
"allow": [
|
|
6
|
+
"Bash(source:*)",
|
|
7
|
+
"Bash(nvm use:*)",
|
|
8
|
+
"Bash(npm run format:*)",
|
|
9
|
+
"Bash(jq:*)"
|
|
10
|
+
],
|
|
11
|
+
"ask": [],
|
|
12
|
+
"deny": []
|
|
13
|
+
},
|
|
14
|
+
"hooks": {
|
|
15
|
+
"PreToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"_description": "Safety gate: blocks destructive bash commands",
|
|
18
|
+
"matcher": "Bash|Write|Edit",
|
|
19
|
+
"hooks": [
|
|
20
|
+
{
|
|
21
|
+
"type": "command",
|
|
22
|
+
"command": "node_modules/@smartsoft001/claude-plugins/plugins/smart/hooks/safety_validator.py"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"_description": "Block sensitive files with detailed error message",
|
|
28
|
+
"matcher": "Read|Edit|Write",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "FILE=$(jq -r '.tool_input.file_path // empty'); echo \"$FILE\" | grep -qE '(\\.env|secrets|credentials)' && { echo \"BLOCKED: Access denied to sensitive file: $FILE\" >&2; exit 2; } || exit 0"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"_description": "Audit trail: logs all PreToolUse events",
|
|
38
|
+
"matcher": "",
|
|
39
|
+
"hooks": [
|
|
40
|
+
{
|
|
41
|
+
"type": "command",
|
|
42
|
+
"command": "node_modules/@smartsoft001/claude-plugins/plugins/smart/hooks/audit_logger.py"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"_description": "Skill validator: soft enforcement warnings for skill files",
|
|
48
|
+
"matcher": "Write|Edit",
|
|
49
|
+
"hooks": [
|
|
50
|
+
{
|
|
51
|
+
"type": "command",
|
|
52
|
+
"command": "node_modules/@smartsoft001/claude-plugins/plugins/smart/hooks/skill_validator.py"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"PostToolUse": [
|
|
58
|
+
{
|
|
59
|
+
"_description": "Auto-format files after Write/Edit",
|
|
60
|
+
"matcher": "Write|Edit",
|
|
61
|
+
"hooks": [
|
|
62
|
+
{
|
|
63
|
+
"type": "command",
|
|
64
|
+
"command": "source ~/.nvm/nvm.sh && nvm use 24 && npm run format"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"_description": "Audit trail: logs all PostToolUse events",
|
|
70
|
+
"matcher": "",
|
|
71
|
+
"hooks": [
|
|
72
|
+
{
|
|
73
|
+
"type": "command",
|
|
74
|
+
"command": "node_modules/@smartsoft001/claude-plugins/plugins/smart/hooks/audit_logger.py"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"UserPromptSubmit": [
|
|
80
|
+
{
|
|
81
|
+
"_description": "Audit trail: logs all user prompt submissions",
|
|
82
|
+
"hooks": [
|
|
83
|
+
{
|
|
84
|
+
"type": "command",
|
|
85
|
+
"command": "node_modules/@smartsoft001/claude-plugins/plugins/smart/hooks/audit_logger.py"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"enabledPlugins": {
|
|
92
|
+
"smart@smartsoft": true
|
|
93
|
+
}
|
|
94
|
+
}
|