@ryuenn3123/agentic-senior-core 6.2.4 → 6.4.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/.agents/plugins/agentic-senior-core/hooks/constants.cjs +31 -3
- package/.agents/plugins/agentic-senior-core/hooks/dedup-gate.js +45 -28
- package/.agents/plugins/agentic-senior-core/hooks/ladder-pulse.js +8 -1
- package/.agents/plugins/agentic-senior-core/hooks/lib/known-security-patterns.json +67 -4
- package/.agents/plugins/agentic-senior-core/hooks/post-edit-enforce.js +9 -2
- package/.agents/plugins/agentic-senior-core/hooks/pre-compact-pin.js +37 -0
- package/.agents/plugins/agentic-senior-core/hooks/pre-tool-dependency-gate.js +9 -2
- package/.agents/plugins/agentic-senior-core/hooks.json +11 -2
- package/.agents/plugins/agentic-senior-core/plugin.json +1 -1
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +8 -4
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-adapter/SKILL.md +3 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-audit/SKILL.md +18 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-bootstrap/SKILL.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-dedup/SKILL.md +4 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +1 -1
- package/.agents/rules/agentic-senior-core.md +1 -0
- package/AGENTS.md +8 -4
- package/bin/agentic-senior-core.js +15 -8
- package/gemini-extension.json +1 -1
- package/lib/cli/commands/adapter.mjs +9 -1
- package/lib/cli/commands/git-hook-generator.mjs +273 -0
- package/lib/cli/commands/git-hook.mjs +24 -0
- package/lib/cli/commands/global.mjs +23 -1
- package/lib/cli/commands/uninstall.mjs +51 -1
- package/lib/core/adaptive-preferences.mjs +178 -0
- package/lib/core/bootstrap-wizard.mjs +64 -0
- package/lib/core/revert-detector.mjs +35 -0
- package/lib/core/rule-compiler.mjs +105 -0
- package/package.json +3 -9
- package/plugin.yaml +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Detects recent git file rollbacks or reverts in the workspace to trigger signal denoising.
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {string} [options.cwd] Working directory.
|
|
7
|
+
* @returns {{ hasReverts: boolean, revertedFiles: Array<string>, prompt: string }} Denoising status payload.
|
|
8
|
+
*/
|
|
9
|
+
export function detectRevertedFiles({ cwd = process.cwd() } = {}) {
|
|
10
|
+
try {
|
|
11
|
+
// Check unstaged or staged diffs showing file deletions/rollbacks
|
|
12
|
+
const statusOutput = execSync('git status --porcelain', { cwd, encoding: 'utf8' });
|
|
13
|
+
const lines = statusOutput.split('\n').map(l => l.trim()).filter(Boolean);
|
|
14
|
+
|
|
15
|
+
// Filter modified or deleted files
|
|
16
|
+
const modifiedOrDeleted = lines
|
|
17
|
+
.filter(line => line.startsWith(' M') || line.startsWith(' D') || line.startsWith('D '))
|
|
18
|
+
.map(line => line.substring(3).trim());
|
|
19
|
+
|
|
20
|
+
if (modifiedOrDeleted.length === 0) {
|
|
21
|
+
return { hasReverts: false, revertedFiles: [], prompt: '' };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const firstFile = modifiedOrDeleted[0];
|
|
25
|
+
const prompt = `[ASC Signal Denoising] Revert/edit detected on ${firstFile}. Was this caused by a specific UI/code slop pattern? (Run /asc-learn to log or press Enter to skip)`;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
hasReverts: true,
|
|
29
|
+
revertedFiles: modifiedOrDeleted,
|
|
30
|
+
prompt
|
|
31
|
+
};
|
|
32
|
+
} catch (err) {
|
|
33
|
+
return { hasReverts: false, revertedFiles: [], prompt: '' };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolveActiveRules } from './adaptive-preferences.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Compiles active syntactic preference rules into a standalone Node.js validator script string.
|
|
7
|
+
* @param {Object} options
|
|
8
|
+
* @param {string} [options.cwd] Working directory.
|
|
9
|
+
* @returns {string} Executable Node.js script code.
|
|
10
|
+
*/
|
|
11
|
+
export function generateValidatorScript({ cwd = process.cwd() } = {}) {
|
|
12
|
+
const { syntactic } = resolveActiveRules({ cwd });
|
|
13
|
+
|
|
14
|
+
const rulesJson = JSON.stringify(syntactic, null, 2);
|
|
15
|
+
|
|
16
|
+
return `#!/usr/bin/env node
|
|
17
|
+
// # Agentic Senior Core -- Compiled Pre-Commit Validator
|
|
18
|
+
// Auto-generated by Agentic Senior Core (ASC) Adaptive Preference Compiler
|
|
19
|
+
// DO NOT EDIT DIRECTLY. Compiled from Track A Syntactic Rules.
|
|
20
|
+
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const { execSync } = require('child_process');
|
|
24
|
+
|
|
25
|
+
const ACTIVE_SYNTACTIC_RULES = ${rulesJson};
|
|
26
|
+
|
|
27
|
+
function getStagedFiles() {
|
|
28
|
+
try {
|
|
29
|
+
const output = execSync('git diff --cached --name-only --diff-filter=ACM', { encoding: 'utf8' });
|
|
30
|
+
return output.split('\\n').map(f => f.trim()).filter(Boolean);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function runValidation() {
|
|
37
|
+
if (ACTIVE_SYNTACTIC_RULES.length === 0) {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const stagedFiles = getStagedFiles();
|
|
42
|
+
if (stagedFiles.length === 0) {
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let violationFound = false;
|
|
47
|
+
|
|
48
|
+
for (const filePath of stagedFiles) {
|
|
49
|
+
if (!fs.existsSync(filePath)) continue;
|
|
50
|
+
// Skip binary / non-text files
|
|
51
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
52
|
+
if (['.png', '.jpg', '.jpeg', '.gif', '.ico', '.pdf', '.zip'].includes(ext)) continue;
|
|
53
|
+
|
|
54
|
+
let content;
|
|
55
|
+
try {
|
|
56
|
+
content = fs.readFileSync(filePath, 'utf8');
|
|
57
|
+
} catch (e) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
for (const rule of ACTIVE_SYNTACTIC_RULES) {
|
|
62
|
+
if (!rule.pattern) continue;
|
|
63
|
+
try {
|
|
64
|
+
const regex = new RegExp(rule.pattern, 'i');
|
|
65
|
+
if (regex.test(content)) {
|
|
66
|
+
console.error(\`\\x1b[31m[ASC Rule Violation]\\x1b[0m File \${filePath} violates active syntactic rule:\`);
|
|
67
|
+
console.error(\` Pattern: \${rule.pattern}\`);
|
|
68
|
+
console.error(\` Reason: \${rule.reason || 'Banned pattern'}\`);
|
|
69
|
+
violationFound = true;
|
|
70
|
+
}
|
|
71
|
+
} catch (err) {
|
|
72
|
+
// Invalid regex ignore
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (violationFound) {
|
|
78
|
+
console.error('\\x1b[31m[ASC Gate Abort]\\x1b[0m Commit blocked by ASC compiled syntactic preference check.');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
runValidation();
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Writes the compiled validator script to disk.
|
|
91
|
+
* @param {Object} options
|
|
92
|
+
* @param {string} [options.cwd] Working directory.
|
|
93
|
+
* @returns {string} Absolute path to compiled script.
|
|
94
|
+
*/
|
|
95
|
+
export function compileAndSaveValidator({ cwd = process.cwd() } = {}) {
|
|
96
|
+
const ascDir = path.join(cwd, '.asc', 'hooks');
|
|
97
|
+
if (!fs.existsSync(ascDir)) {
|
|
98
|
+
fs.mkdirSync(ascDir, { recursive: true });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const scriptContent = generateValidatorScript({ cwd });
|
|
102
|
+
const scriptPath = path.join(ascDir, 'pre-commit-validator.cjs');
|
|
103
|
+
fs.writeFileSync(scriptPath, scriptContent, { encoding: 'utf8', mode: 0o755 });
|
|
104
|
+
return scriptPath;
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryuenn3123/agentic-senior-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agentic Senior Core: Universal AI coding rules and workflows. Write code like a staff engineer, not a junior.",
|
|
6
6
|
"bin": {
|
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
".asc/",
|
|
13
13
|
"bin/",
|
|
14
|
-
"lib/
|
|
15
|
-
"lib/cli/commands/global.mjs",
|
|
16
|
-
"lib/cli/commands/clean.mjs",
|
|
17
|
-
"lib/cli/commands/uninstall.mjs",
|
|
18
|
-
"lib/cli/commands/status.mjs",
|
|
19
|
-
"lib/cli/commands/mcp.mjs",
|
|
20
|
-
"lib/cli/ascx/",
|
|
14
|
+
"lib/",
|
|
21
15
|
".agents/",
|
|
22
16
|
"CONVENTIONS.md",
|
|
23
17
|
"gemini-extension.json",
|
|
@@ -69,6 +63,6 @@
|
|
|
69
63
|
"agentic"
|
|
70
64
|
],
|
|
71
65
|
"scripts": {
|
|
72
|
-
"test": "node --test ./tests
|
|
66
|
+
"test": "node --test ./tests/*.test.mjs"
|
|
73
67
|
}
|
|
74
68
|
}
|
package/plugin.yaml
CHANGED