@devflow-tools/cli 0.8.9 → 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.
@@ -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
- python3 -c "
10
- import json, sys, urllib.request, time
11
-
12
- try:
13
- data = json.loads(sys.argv[1])
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
- # ── Original Enforcement Logic ──
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
- " <<< "$INPUT_JSON" 2>/dev/null || echo "")
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://localhost:13337/api/memory/process?rootPath=${CLAUDE_PROJECT_DIR:-$(pwd)}',
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
- # Stop Hook — DevFlow session cleanup
5
- # Cleans up receipt/override files and outputs violation summary.
4
+ HOOK_JS="${CLAUDE_PLUGIN_ROOT:-}/dist/hooks/stop.js"
6
5
 
7
- PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
8
- RECEIPT_DIR="${TMPDIR:-/tmp}/.devflow-receipts"
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,8 +1,7 @@
1
1
  {
2
2
  "name": "@devflow-tools/claude-code-plugin",
3
- "version": "0.8.8",
4
- "private": true,
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-tools/cli",
3
- "version": "0.8.9",
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.9",
16
- "@devflow-tools/benchmark": "^0.8.9",
17
- "@devflow-tools/context-engine": "^0.8.9",
18
- "@devflow-tools/database": "^0.8.9",
19
- "@devflow-tools/knowledge-engine": "^0.8.9",
20
- "@devflow-tools/mcp-server": "^0.8.9",
21
- "@devflow-tools/memory-engine": "^0.8.9",
22
- "@devflow-tools/plugin-animation": "^0.8.9",
23
- "@devflow-tools/plugin-css": "^0.8.9",
24
- "@devflow-tools/plugin-docker": "^0.8.9",
25
- "@devflow-tools/plugin-electron": "^0.8.9",
26
- "@devflow-tools/plugin-git": "^0.8.9",
27
- "@devflow-tools/plugin-graphql": "^0.8.9",
28
- "@devflow-tools/plugin-nest": "^0.8.9",
29
- "@devflow-tools/plugin-nextjs": "^0.8.9",
30
- "@devflow-tools/plugin-performance": "^0.8.9",
31
- "@devflow-tools/plugin-react": "^0.8.9",
32
- "@devflow-tools/plugin-tailwind": "^0.8.9",
33
- "@devflow-tools/plugin-taro": "^0.8.9",
34
- "@devflow-tools/plugin-ui-layout": "^0.8.9",
35
- "@devflow-tools/plugin-vue": "^0.8.9",
36
- "@devflow-tools/sdk": "^0.8.9",
37
- "@devflow-tools/server": "^0.8.9",
38
- "@devflow-tools/telemetry": "^0.8.9",
39
- "@devflow-tools/workflow-engine": "^0.8.9",
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": "5c9a804d3c2e6e6822b516fde67d5b789dbdb5b3"
52
+ "gitHead": "ac4f93d6a52fa40b4126b514e899eee581f8f46e"
53
53
  }