@devflow-tools/cli 0.8.8 → 0.8.10
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/dist/commands/benchmark-cmd.d.ts +1 -1
- package/dist/commands/benchmark-cmd.d.ts.map +1 -1
- package/dist/commands/benchmark-cmd.js +9 -30
- package/dist/commands/benchmark-cmd.js.map +1 -1
- package/dist/plugin-files/hooks/post-tool-use +8 -36
- package/dist/plugin-files/hooks/session-start +39 -1
- package/dist/plugin-files/hooks/stop +3 -24
- package/dist/plugin-files/package.json +3 -4
- package/package.json +27 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/benchmark-cmd.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAChC,
|
|
1
|
+
{"version":3,"file":"benchmark-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/benchmark-cmd.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -1,39 +1,18 @@
|
|
|
1
1
|
import { BenchmarkEngine } from "@devflow-tools/benchmark";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
export async function runBenchmark(
|
|
3
|
+
export async function runBenchmark(_target, _opts) {
|
|
4
4
|
const engine = new BenchmarkEngine();
|
|
5
5
|
const tasks = engine.getTasks();
|
|
6
|
-
const iterations = opts.iterations ?? 5;
|
|
7
|
-
// Simple measurement: run each task with a no-op runner to measure engine overhead
|
|
8
|
-
const start = performance.now();
|
|
9
|
-
for (let i = 0; i < iterations; i++) {
|
|
10
|
-
for (const task of tasks) {
|
|
11
|
-
try {
|
|
12
|
-
await engine.runOne(task.id, async (t) => ({
|
|
13
|
-
taskId: t.id,
|
|
14
|
-
baseline: { tokens: 100, time: 10, correct: false },
|
|
15
|
-
experiment: { tokens: 70, time: 7, correct: true },
|
|
16
|
-
delta: { tokenReduction: 0.3, timeSaved: 0.25, accuracy: 0.15 },
|
|
17
|
-
status: "pass",
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// Skip tasks that fail in benchmark
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const elapsed = performance.now() - start;
|
|
26
6
|
const lines = [
|
|
27
7
|
chalk.blue("◉ DevFlow Benchmark"),
|
|
28
8
|
"───────────────────────────────",
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return lines;
|
|
9
|
+
`Available tasks: ${tasks.length}`,
|
|
10
|
+
"",
|
|
11
|
+
"Benchmark requires a real runner implementation.",
|
|
12
|
+
"No fake data or estimated scores are shown.",
|
|
13
|
+
"",
|
|
14
|
+
"Setup: devflow benchmark --runner <path-to-runner>",
|
|
15
|
+
];
|
|
16
|
+
return lines.join("\n");
|
|
38
17
|
}
|
|
39
18
|
//# sourceMappingURL=benchmark-cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark-cmd.js","sourceRoot":"","sources":["../../src/commands/benchmark-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,
|
|
1
|
+
{"version":3,"file":"benchmark-cmd.js","sourceRoot":"","sources":["../../src/commands/benchmark-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAe,EACf,KAA+C;IAE/C,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG;QACZ,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC;QACjC,iCAAiC;QACjC,oBAAoB,KAAK,CAAC,MAAM,EAAE;QAClC,EAAE;QACF,kDAAkD;QAClD,6CAA6C;QAC7C,EAAE;QACF,oDAAoD;KACrD,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -2,51 +2,23 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
INPUT_JSON=$(cat)
|
|
5
|
-
|
|
6
|
-
# ── Event Recording (best-effort, never blocks hook) ──
|
|
7
5
|
PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
except:
|
|
15
|
-
sys.exit(0)
|
|
16
|
-
|
|
17
|
-
tool_name = data.get('tool_name', '')
|
|
18
|
-
session_id = data.get('session_id', '')
|
|
19
|
-
tool_input = data.get('tool_input', {})
|
|
20
|
-
|
|
21
|
-
evt = {
|
|
22
|
-
'id': 'evt_{}_{}'.format(int(time.time()), __import__('random').randint(1000, 9999)),
|
|
23
|
-
'sessionId': session_id,
|
|
24
|
-
'tool': tool_name,
|
|
25
|
-
'command': tool_input.get('command', '') if isinstance(tool_input, dict) else '',
|
|
26
|
-
'createdAt': int(time.time() * 1000),
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
try:
|
|
30
|
-
req = urllib.request.Request(
|
|
31
|
-
'http://localhost:13337/api/memory/events?rootPath=' + sys.argv[2],
|
|
32
|
-
data=json.dumps(evt).encode(),
|
|
33
|
-
headers={'Content-Type': 'application/json', 'X-API-Key': 'dev-key-000000'},
|
|
34
|
-
method='POST',
|
|
35
|
-
)
|
|
36
|
-
urllib.request.urlopen(req, timeout=3)
|
|
37
|
-
except:
|
|
38
|
-
pass
|
|
39
|
-
" "$INPUT_JSON" "$PROJECT_ROOT" 2>/dev/null || true
|
|
7
|
+
# ── Event Recording via Node.js (best-effort, never blocks hook) ──
|
|
8
|
+
HOOK_JS="${CLAUDE_PLUGIN_ROOT:-}/dist/hooks/post-tool-use.js"
|
|
9
|
+
if [ -f "$HOOK_JS" ]; then
|
|
10
|
+
node "$HOOK_JS" "$INPUT_JSON" 2>/dev/null || true
|
|
11
|
+
fi
|
|
40
12
|
|
|
41
|
-
# ──
|
|
42
|
-
TOOL_NAME=$(python3 -c "
|
|
13
|
+
# ── Enforcement Logic ──
|
|
14
|
+
TOOL_NAME=$(echo "$INPUT_JSON" | python3 -c "
|
|
43
15
|
import sys, json
|
|
44
16
|
try:
|
|
45
17
|
data = json.load(sys.stdin)
|
|
46
18
|
print(data.get('tool_name', ''))
|
|
47
19
|
except:
|
|
48
20
|
print('')
|
|
49
|
-
"
|
|
21
|
+
" 2>/dev/null || echo "")
|
|
50
22
|
|
|
51
23
|
case "$TOOL_NAME" in
|
|
52
24
|
Agent|Bash|Glob|Grep|WebSearch|WebFetch)
|
|
@@ -46,6 +46,44 @@ RECEIPT_FILE="$RECEIPT_DIR/${SESSION_ID}.json"
|
|
|
46
46
|
OVERRIDE_FILE="$RECEIPT_DIR/${SESSION_ID}.override"
|
|
47
47
|
rm -f "$RECEIPT_FILE" "$OVERRIDE_FILE" 2>/dev/null || true
|
|
48
48
|
|
|
49
|
+
# ── Clean up stale execution from previous session (if stop hook didn't fire) ──
|
|
50
|
+
EXEC_FILE="${HOME}/.devflow/current-execution-id"
|
|
51
|
+
SKILL_FILE="${HOME}/.devflow/current-skill.json"
|
|
52
|
+
if [ -f "$EXEC_FILE" ]; then
|
|
53
|
+
EXEC_ID=$(cat "$EXEC_FILE" 2>/dev/null || echo "")
|
|
54
|
+
if [ -n "$EXEC_ID" ]; then
|
|
55
|
+
NOW_MS="$(date +%s)000"
|
|
56
|
+
python3 -c "
|
|
57
|
+
import urllib.request, json
|
|
58
|
+
try:
|
|
59
|
+
payload = json.dumps({
|
|
60
|
+
'executionId': '${EXEC_ID}',
|
|
61
|
+
'finishedAt': ${NOW_MS},
|
|
62
|
+
'status': 'completed',
|
|
63
|
+
'summary': {
|
|
64
|
+
'totalToolCalls': 0,
|
|
65
|
+
'mcpToolCalls': 0,
|
|
66
|
+
'directToolCalls': 0,
|
|
67
|
+
'subagentCount': 0,
|
|
68
|
+
'totalTokens': 0,
|
|
69
|
+
'totalDuration': 0,
|
|
70
|
+
'mcpComplianceRate': 0
|
|
71
|
+
}
|
|
72
|
+
}).encode()
|
|
73
|
+
req = urllib.request.Request(
|
|
74
|
+
'http://127.0.0.1:13337/api/telemetry/skill-execution/complete',
|
|
75
|
+
data=payload,
|
|
76
|
+
headers={'Content-Type': 'application/json', 'X-API-Key': 'dev-key-000000'},
|
|
77
|
+
method='POST'
|
|
78
|
+
)
|
|
79
|
+
urllib.request.urlopen(req, timeout=5)
|
|
80
|
+
except:
|
|
81
|
+
pass
|
|
82
|
+
" 2>/dev/null || true
|
|
83
|
+
fi
|
|
84
|
+
rm -f "$EXEC_FILE" "$SKILL_FILE" 2>/dev/null || true
|
|
85
|
+
fi
|
|
86
|
+
|
|
49
87
|
# Determine plugin root directory (same way as superpowers)
|
|
50
88
|
if [ -z "${CLAUDE_PLUGIN_ROOT:-}" ]; then
|
|
51
89
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
@@ -98,7 +136,7 @@ fi
|
|
|
98
136
|
import urllib.request, json, sys
|
|
99
137
|
try:
|
|
100
138
|
req = urllib.request.Request(
|
|
101
|
-
'http://
|
|
139
|
+
'http://127.0.0.1:13337/api/memory/process?rootPath=${CLAUDE_PROJECT_DIR:-$(pwd)}',
|
|
102
140
|
data=b'{}',
|
|
103
141
|
headers={'Content-Type': 'application/json', 'X-API-Key': 'dev-key-000000'},
|
|
104
142
|
method='POST',
|
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
# Cleans up receipt/override files and outputs violation summary.
|
|
4
|
+
HOOK_JS="${CLAUDE_PLUGIN_ROOT:-}/dist/hooks/stop.js"
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
SESSION_ID=$(echo -n "$PROJECT_ROOT" | shasum -a 256 2>/dev/null | cut -c1-16 || echo "default")
|
|
10
|
-
RECEIPT_FILE="$RECEIPT_DIR/${SESSION_ID}.json"
|
|
11
|
-
OVERRIDE_FILE="$RECEIPT_DIR/${SESSION_ID}.override"
|
|
12
|
-
|
|
13
|
-
if [ -f "$RECEIPT_FILE" ]; then
|
|
14
|
-
# Read and output summary
|
|
15
|
-
python3 -c "
|
|
16
|
-
import json
|
|
17
|
-
with open('$RECEIPT_FILE') as f:
|
|
18
|
-
d = json.load(f)
|
|
19
|
-
bypass = d.get('bypassCount', 0)
|
|
20
|
-
print(f'会话违规统计: {bypass}/3')
|
|
21
|
-
if bypass > 0:
|
|
22
|
-
print(f'最后一次拦截: {d.get(\"lastAttempt\", \"N/A\")}')
|
|
23
|
-
" 2>/dev/null || true
|
|
24
|
-
|
|
25
|
-
# Cleanup
|
|
26
|
-
rm -f "$RECEIPT_FILE"
|
|
6
|
+
if [ -f "$HOOK_JS" ]; then
|
|
7
|
+
node "$HOOK_JS" 2>/dev/null || true
|
|
27
8
|
fi
|
|
28
9
|
|
|
29
|
-
rm -f "$OVERRIDE_FILE"
|
|
30
|
-
|
|
31
10
|
exit 0
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devflow-tools/claude-code-plugin",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"
|
|
5
|
-
"description": "DevFlow — Developer Intelligence Platform for Claude Code",
|
|
3
|
+
"version": "0.8.9",
|
|
4
|
+
"description": "DevFlow \u2014 Developer Intelligence Platform for Claude Code",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"build": "npx tsx scripts/inject-gates.ts",
|
|
9
8
|
"deploy": "npx tsx scripts/inject-gates.ts --deploy"
|
|
10
9
|
},
|
|
11
10
|
"devDependencies": {
|
|
12
|
-
"@devflow-tools/mcp-server": "^0.8.
|
|
11
|
+
"@devflow-tools/mcp-server": "^0.8.9"
|
|
13
12
|
},
|
|
14
13
|
"keywords": [
|
|
15
14
|
"pi-package",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devflow-tools/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@colbymchenry/codegraph": "^1.1.1",
|
|
15
|
-
"@devflow-tools/adapters": "^0.8.
|
|
16
|
-
"@devflow-tools/benchmark": "^0.8.
|
|
17
|
-
"@devflow-tools/context-engine": "^0.8.
|
|
18
|
-
"@devflow-tools/database": "^0.8.
|
|
19
|
-
"@devflow-tools/knowledge-engine": "^0.8.
|
|
20
|
-
"@devflow-tools/mcp-server": "^0.8.
|
|
21
|
-
"@devflow-tools/memory-engine": "^0.8.
|
|
22
|
-
"@devflow-tools/plugin-animation": "^0.8.
|
|
23
|
-
"@devflow-tools/plugin-css": "^0.8.
|
|
24
|
-
"@devflow-tools/plugin-docker": "^0.8.
|
|
25
|
-
"@devflow-tools/plugin-electron": "^0.8.
|
|
26
|
-
"@devflow-tools/plugin-git": "^0.8.
|
|
27
|
-
"@devflow-tools/plugin-graphql": "^0.8.
|
|
28
|
-
"@devflow-tools/plugin-nest": "^0.8.
|
|
29
|
-
"@devflow-tools/plugin-nextjs": "^0.8.
|
|
30
|
-
"@devflow-tools/plugin-performance": "^0.8.
|
|
31
|
-
"@devflow-tools/plugin-react": "^0.8.
|
|
32
|
-
"@devflow-tools/plugin-tailwind": "^0.8.
|
|
33
|
-
"@devflow-tools/plugin-taro": "^0.8.
|
|
34
|
-
"@devflow-tools/plugin-ui-layout": "^0.8.
|
|
35
|
-
"@devflow-tools/plugin-vue": "^0.8.
|
|
36
|
-
"@devflow-tools/sdk": "^0.8.
|
|
37
|
-
"@devflow-tools/server": "^0.8.
|
|
38
|
-
"@devflow-tools/telemetry": "^0.8.
|
|
39
|
-
"@devflow-tools/workflow-engine": "^0.8.
|
|
15
|
+
"@devflow-tools/adapters": "^0.8.10",
|
|
16
|
+
"@devflow-tools/benchmark": "^0.8.10",
|
|
17
|
+
"@devflow-tools/context-engine": "^0.8.10",
|
|
18
|
+
"@devflow-tools/database": "^0.8.10",
|
|
19
|
+
"@devflow-tools/knowledge-engine": "^0.8.10",
|
|
20
|
+
"@devflow-tools/mcp-server": "^0.8.10",
|
|
21
|
+
"@devflow-tools/memory-engine": "^0.8.10",
|
|
22
|
+
"@devflow-tools/plugin-animation": "^0.8.10",
|
|
23
|
+
"@devflow-tools/plugin-css": "^0.8.10",
|
|
24
|
+
"@devflow-tools/plugin-docker": "^0.8.10",
|
|
25
|
+
"@devflow-tools/plugin-electron": "^0.8.10",
|
|
26
|
+
"@devflow-tools/plugin-git": "^0.8.10",
|
|
27
|
+
"@devflow-tools/plugin-graphql": "^0.8.10",
|
|
28
|
+
"@devflow-tools/plugin-nest": "^0.8.10",
|
|
29
|
+
"@devflow-tools/plugin-nextjs": "^0.8.10",
|
|
30
|
+
"@devflow-tools/plugin-performance": "^0.8.10",
|
|
31
|
+
"@devflow-tools/plugin-react": "^0.8.10",
|
|
32
|
+
"@devflow-tools/plugin-tailwind": "^0.8.10",
|
|
33
|
+
"@devflow-tools/plugin-taro": "^0.8.10",
|
|
34
|
+
"@devflow-tools/plugin-ui-layout": "^0.8.10",
|
|
35
|
+
"@devflow-tools/plugin-vue": "^0.8.10",
|
|
36
|
+
"@devflow-tools/sdk": "^0.8.10",
|
|
37
|
+
"@devflow-tools/server": "^0.8.10",
|
|
38
|
+
"@devflow-tools/telemetry": "^0.8.10",
|
|
39
|
+
"@devflow-tools/workflow-engine": "^0.8.10",
|
|
40
40
|
"@inquirer/prompts": "^7.10.1",
|
|
41
41
|
"chalk": "^5.3.0",
|
|
42
42
|
"commander": "^12.0.0"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"dist",
|
|
50
50
|
"bin"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ac4f93d6a52fa40b4126b514e899eee581f8f46e"
|
|
53
53
|
}
|