devflow-kit 3.0.1 → 3.2.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -1
  3. package/dist/agents/git.md +2 -2
  4. package/dist/cli/agents-view/index.js +1 -1
  5. package/dist/cli/agents-view/render.js +71 -17
  6. package/dist/cli/agents-view/state.js +42 -16
  7. package/dist/cli/agents-view/terminal.js +5 -5
  8. package/dist/cli/commands/agents.js +142 -51
  9. package/dist/cli/commands/ambient.js +1 -1
  10. package/dist/cli/commands/attribution-prompts.js +8 -8
  11. package/dist/cli/commands/capture.js +1 -1
  12. package/dist/cli/commands/compliance-prompts.js +8 -8
  13. package/dist/cli/commands/compliance.js +8 -7
  14. package/dist/cli/commands/flags.js +33 -31
  15. package/dist/cli/commands/hud.js +1 -1
  16. package/dist/cli/commands/init-seed.js +9 -9
  17. package/dist/cli/commands/init.js +162 -85
  18. package/dist/cli/commands/install-report.js +10 -10
  19. package/dist/cli/commands/learning.js +302 -136
  20. package/dist/cli/commands/memory.js +36 -15
  21. package/dist/cli/commands/proxy.js +23 -23
  22. package/dist/cli/commands/rules.js +6 -5
  23. package/dist/cli/commands/tracker-prompts.js +6 -6
  24. package/dist/cli/commands/tracker.js +9 -9
  25. package/dist/cli/commands/uninstall.js +183 -59
  26. package/dist/cli/flags-view/render.js +5 -5
  27. package/dist/cli/flags-view/state.js +9 -9
  28. package/dist/cli/flags-view/terminal.js +4 -4
  29. package/dist/cli/tui/cells.js +1 -1
  30. package/dist/cli/tui/terminal.js +6 -6
  31. package/dist/commands/code-review.md +0 -2
  32. package/dist/commands/debug.md +14 -11
  33. package/dist/commands/dynamic-build.md +51 -47
  34. package/dist/commands/dynamic-plan.md +27 -7
  35. package/dist/commands/dynamic-profile.md +17 -3
  36. package/dist/commands/dynamic-tickets.md +18 -4
  37. package/dist/commands/explore.md +9 -3
  38. package/dist/commands/implement.md +20 -16
  39. package/dist/commands/plan.md +13 -9
  40. package/dist/commands/release.md +23 -3
  41. package/dist/commands/research.md +9 -3
  42. package/dist/commands/resolve.md +9 -12
  43. package/dist/commands/self-review.md +0 -2
  44. package/dist/core/agent-frontmatter.js +28 -3
  45. package/dist/core/agent-models.js +204 -42
  46. package/dist/core/agent-state.js +28 -6
  47. package/dist/core/ansi.js +2 -2
  48. package/dist/core/assets.js +1 -1
  49. package/dist/core/cache.js +7 -8
  50. package/dist/core/codex-auth-inspect.js +4 -4
  51. package/dist/core/compliance-compose.js +3 -3
  52. package/dist/core/compliance.js +3 -4
  53. package/dist/core/evidence-policy.js +14 -13
  54. package/dist/core/external-models.js +1 -1
  55. package/dist/core/feature-config.js +71 -13
  56. package/dist/core/feature-switch.js +3 -3
  57. package/dist/core/flags.js +49 -25
  58. package/dist/core/fs-atomic.js +6 -7
  59. package/dist/core/learning-queue-cleanup.js +16 -81
  60. package/dist/core/learning-store.js +61 -0
  61. package/dist/core/linked-path.js +46 -0
  62. package/dist/core/manifest.js +5 -5
  63. package/dist/core/mds-variants.js +13 -13
  64. package/dist/core/model-discovery.js +8 -8
  65. package/dist/core/observations.js +17 -101
  66. package/dist/core/orphan-sweep.js +4 -4
  67. package/dist/core/plugins.js +13 -8
  68. package/dist/core/project-paths.js +9 -13
  69. package/dist/core/proxy-log.js +8 -8
  70. package/dist/core/proxy-state.js +3 -3
  71. package/dist/core/queue-drain.js +31 -0
  72. package/dist/core/reference-sweep.js +6 -6
  73. package/dist/core/teammate-mode-cleanup.js +1 -1
  74. package/dist/core/tracker.js +14 -14
  75. package/dist/hud/colors.js +2 -2
  76. package/dist/hud/components/learning-counts.js +54 -22
  77. package/dist/hud/components/version-badge.js +1 -1
  78. package/dist/skills/git/references/pr/resolve-review-threads.md +2 -2
  79. package/dist/skills/git/references/tracker/github/create-release.md +2 -2
  80. package/dist/skills/git/references/tracker/jira/create-release.md +2 -2
  81. package/dist/skills/git/references/tracker/linear/create-release.md +2 -2
  82. package/dist/targets/claude-code/compliance-install.js +17 -15
  83. package/dist/targets/claude-code/hooks.js +2 -2
  84. package/dist/targets/claude-code/installer.js +59 -32
  85. package/dist/targets/claude-code/legacy.js +1 -1
  86. package/dist/targets/claude-code/post-install.js +135 -45
  87. package/dist/targets/claude-code/tracker-install.js +2 -2
  88. package/package.json +1 -1
  89. package/src/assets/agents/code.md +15 -21
  90. package/src/assets/agents/design.md +4 -2
  91. package/src/assets/agents/diagnose.md +3 -1
  92. package/src/assets/agents/evaluate.md +4 -0
  93. package/src/assets/agents/git.mds +2 -2
  94. package/src/assets/agents/knowledge.md +5 -3
  95. package/src/assets/agents/learning.md +281 -196
  96. package/src/assets/agents/research.md +3 -1
  97. package/src/assets/agents/review.md +5 -3
  98. package/src/assets/agents/scrutinize.md +5 -1
  99. package/src/assets/agents/simplify.md +4 -0
  100. package/src/assets/agents/skim.md +4 -2
  101. package/src/assets/agents/synthesize.md +6 -0
  102. package/src/assets/agents/test.md +18 -10
  103. package/src/assets/agents/triage.md +11 -9
  104. package/src/assets/agents/validate.md +14 -10
  105. package/src/assets/commands/_partials/_decisions.mds +8 -3
  106. package/src/assets/commands/_partials/_docs_root.mds +3 -3
  107. package/src/assets/commands/_partials/_engine.mds +16 -32
  108. package/src/assets/commands/_partials/_knowledge.mds +0 -2
  109. package/src/assets/commands/_partials/_preamble.mds +6 -2
  110. package/src/assets/commands/_partials/_settings.mds +2 -2
  111. package/src/assets/commands/_partials/_tracker.mds +1 -1
  112. package/src/assets/commands/code-review.mds +0 -2
  113. package/src/assets/commands/debug.mds +13 -8
  114. package/src/assets/commands/dynamic-build.mds +18 -12
  115. package/src/assets/commands/dynamic-plan.mds +10 -4
  116. package/src/assets/commands/dynamic-profile.mds +1 -1
  117. package/src/assets/commands/dynamic-tickets.mds +2 -2
  118. package/src/assets/commands/explore.mds +9 -1
  119. package/src/assets/commands/implement.mds +19 -13
  120. package/src/assets/commands/plan.mds +12 -8
  121. package/src/assets/commands/release.md +23 -3
  122. package/src/assets/commands/research.mds +9 -3
  123. package/src/assets/commands/resolve.mds +9 -10
  124. package/src/assets/mds/git/_pr.mds +3 -3
  125. package/src/assets/mds/tracker/_common.mds +1 -1
  126. package/src/assets/mds/tracker/_github.mds +3 -3
  127. package/src/assets/mds/tracker/_jira.mds +3 -3
  128. package/src/assets/mds/tracker/_linear.mds +3 -3
  129. package/src/assets/mds/tracker/_mcp.mds +6 -5
  130. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -2
  131. package/src/assets/scripts/hooks/background-memory-update +97 -33
  132. package/src/assets/scripts/hooks/capture-prompt +4 -3
  133. package/src/assets/scripts/hooks/capture-question +4 -3
  134. package/src/assets/scripts/hooks/capture-turn +5 -20
  135. package/src/assets/scripts/hooks/ensure-devflow-init +14 -2
  136. package/src/assets/scripts/hooks/ensure-proxy +5 -6
  137. package/src/assets/scripts/hooks/ensure-root-gitignore +123 -11
  138. package/src/assets/scripts/hooks/git-marker +71 -0
  139. package/src/assets/scripts/hooks/is-hex-sha +1 -1
  140. package/src/assets/scripts/hooks/json-helper.cjs +345 -944
  141. package/src/assets/scripts/hooks/json-parse +25 -129
  142. package/src/assets/scripts/hooks/lib/decisions-format.cjs +205 -156
  143. package/src/assets/scripts/hooks/lib/learning-store.cjs +3207 -0
  144. package/src/assets/scripts/hooks/lib/mkdir-lock.cjs +7 -5
  145. package/src/assets/scripts/hooks/lib/project-paths.cjs +13 -19
  146. package/src/assets/scripts/hooks/lib/render-decisions.cjs +253 -226
  147. package/src/assets/scripts/hooks/memory-worker +10 -0
  148. package/src/assets/scripts/hooks/pre-compact-memory +66 -14
  149. package/src/assets/scripts/hooks/preamble +9 -1
  150. package/src/assets/scripts/hooks/queue-append +55 -23
  151. package/src/assets/scripts/hooks/resolve-project-root +3 -4
  152. package/src/assets/scripts/hooks/session-start-context +146 -45
  153. package/src/assets/scripts/hooks/session-start-memory +33 -11
  154. package/src/assets/scripts/lib/project-config.cjs +2 -2
  155. package/src/assets/scripts/pr-evidence.cjs +3 -3
  156. package/src/assets/scripts/redact-secrets.cjs +20 -20
  157. package/src/assets/scripts/release-trace.cjs +1 -1
  158. package/src/assets/scripts/resolve-evidence-policy.cjs +3 -3
  159. package/src/assets/scripts/resolve-settings.cjs +3 -3
  160. package/src/assets/scripts/verify-evidence.cjs +2 -2
  161. package/src/assets/skills/apply-decisions/SKILL.md +37 -17
  162. package/src/assets/skills/docs-framework/SKILL.md +2 -2
  163. package/src/assets/skills/feature-knowledge/SKILL.md +6 -5
  164. package/src/assets/skills/test-driven-development/SKILL.md +6 -4
  165. package/dist/core/observation-io.js +0 -50
  166. package/src/assets/scripts/hooks/decisions-usage-scan.cjs +0 -131
@@ -1,10 +1,12 @@
1
1
  #!/bin/bash
2
2
 
3
- # JSON parsing helper — tries jq, falls back to node json-helper.js
3
+ # JSON parsing helper — tries jq, falls back to node json-helper.cjs
4
4
  # Usage: source "$SCRIPT_DIR/json-parse"
5
5
  #
6
6
  # After sourcing, check $_JSON_AVAILABLE before using json_* functions.
7
7
  # All functions read from stdin unless noted otherwise.
8
+ # Where a jq path discards stderr, its node fallback does too, so input that
9
+ # cannot be parsed fails silently on either backend.
8
10
 
9
11
  _SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
12
  _JSON_HELPER="$_SCRIPT_DIR/json-helper.cjs"
@@ -28,133 +30,42 @@ json_field() {
28
30
  if [ "$_HAS_JQ" = "true" ]; then
29
31
  jq -r ".$field // \"$default\"" 2>/dev/null
30
32
  else
31
- node "$_JSON_HELPER" get-field "$field" "$default"
33
+ node "$_JSON_HELPER" get-field "$field" "$default" 2>/dev/null
32
34
  fi
33
35
  }
34
36
 
35
37
  # Extract a field from a JSON file. Usage: json_field_file "/path/to/file.json" "field" "default"
36
38
  # Note: uses if/then/else to preserve boolean false (jq // operator would replace false with default)
39
+ # The node fallback reads the file on stdin: json-helper takes no file path.
40
+ # Both paths are silent on stderr: an unparseable or missing file yields empty
41
+ # output and a failing status, as jq does with its errors discarded. The node
42
+ # path redirects stderr BEFORE stdin, so the shell's own error for a `< "$file"`
43
+ # that cannot open is discarded too.
37
44
  json_field_file() {
38
45
  local file="$1" field="$2" default="${3:-}"
39
46
  if [ "$_HAS_JQ" = "true" ]; then
40
47
  jq -r "if (.$field | type) == \"null\" then \"$default\" else (.$field | tostring) end" "$file" 2>/dev/null
41
48
  else
42
- node "$_JSON_HELPER" get-field-file "$file" "$field" "$default"
49
+ node "$_JSON_HELPER" get-field "$field" "$default" 2>/dev/null < "$file"
43
50
  fi
44
51
  }
45
52
 
46
- # --- Validation ---
47
-
48
- # Validate stdin as JSON (exit code 0/1). Usage: echo '{}' | json_valid
49
- json_valid() {
50
- if [ "$_HAS_JQ" = "true" ]; then
51
- jq -e . >/dev/null 2>&1
52
- else
53
- node "$_JSON_HELPER" validate
54
- fi
55
- }
56
-
57
- # --- Compact ---
58
-
59
- # Compact stdin JSON to single line. Usage: echo '{ "k": "v" }' | json_compact
60
- json_compact() {
61
- if [ "$_HAS_JQ" = "true" ]; then
62
- jq -c '.' 2>/dev/null
63
- else
64
- node "$_JSON_HELPER" compact
65
- fi
66
- }
67
-
68
- # --- Construction ---
69
-
70
- # Build a JSON object from --arg/--argjson pairs.
71
- # Usage: json_construct --arg key1 val1 --arg key2 val2
72
- json_construct() {
73
- if [ "$_HAS_JQ" = "true" ]; then
74
- # Build jq expression from args
75
- local jq_args=()
76
- local fields=""
77
- local i=0
78
- while [ $i -lt $# ]; do
79
- local flag="${!((i+1))}"
80
- if [ "$flag" = "--arg" ]; then
81
- local name="${!((i+2))}"
82
- local val="${!((i+3))}"
83
- jq_args+=(--arg "$name" "$val")
84
- if [ -n "$fields" ]; then fields="$fields, "; fi
85
- fields="${fields}${name}: \$${name}"
86
- i=$((i + 3))
87
- elif [ "$flag" = "--argjson" ]; then
88
- local name="${!((i+2))}"
89
- local val="${!((i+3))}"
90
- jq_args+=(--argjson "$name" "$val")
91
- if [ -n "$fields" ]; then fields="$fields, "; fi
92
- fields="${fields}${name}: \$${name}"
93
- i=$((i + 3))
94
- else
95
- i=$((i + 1))
96
- fi
97
- done
98
- jq -n -c "${jq_args[@]}" "{$fields}" 2>/dev/null
99
- else
100
- node "$_JSON_HELPER" construct "$@"
101
- fi
102
- }
103
-
104
- # --- Field updates ---
105
-
106
- # Update a field on stdin JSON. Usage: echo '{"k":"v"}' | json_update_field "k" "new_v"
107
- json_update_field() {
108
- local field="$1" value="$2"
109
- if [ "$_HAS_JQ" = "true" ]; then
110
- jq -c --arg v "$value" ".$field = \$v" 2>/dev/null
111
- else
112
- node "$_JSON_HELPER" update-field "$field" "$value"
113
- fi
114
- }
115
-
116
- # Update a field with a JSON value. Usage: echo '{}' | json_update_field_json "k" '42'
117
- json_update_field_json() {
118
- local field="$1" value="$2"
53
+ # The typed read of a field from a JSON file. Usage: json_string_field_file "/path/to/file.json" "field"
54
+ # json_field_file stringifies, so the number 42 and the string "42" read the same;
55
+ # this prints the field only when it is a JSON string, and nothing for any other
56
+ # type (a number, boolean, object, array or null), an absent field, or a string
57
+ # holding a NUL, which no shell variable can carry. The string is printed
58
+ # byte-exact with no newline added, so a caller that must see the value's own
59
+ # trailing newline appends a sentinel before the command substitution strips it:
60
+ # v=$(json_string_field_file "$file" "k"; printf x); v=${v%x}
61
+ # Silent on stderr and failing on an unparseable or missing file, as json_field_file
62
+ # is, and read the same way on both backends (the node path reads the file on stdin).
63
+ json_string_field_file() {
64
+ local file="$1" field="$2"
119
65
  if [ "$_HAS_JQ" = "true" ]; then
120
- jq -c --argjson v "$value" ".$field = \$v" 2>/dev/null
66
+ jq -j ".$field | select(type == \"string\" and all(explode[]; . != 0))" "$file" 2>/dev/null
121
67
  else
122
- node "$_JSON_HELPER" update-field "$field" "$value" --json
123
- fi
124
- }
125
-
126
- # --- Slurp operations ---
127
-
128
- # Slurp JSONL file, sort by field desc, output as JSONL (one line per entry).
129
- # Usage: json_slurp_cap "file.jsonl" "confidence" 100
130
- json_slurp_cap() {
131
- local file="$1" field="$2" limit="${3:-100}"
132
- if [ "$_HAS_JQ" = "true" ]; then
133
- jq -c '.' "$file" | jq -s "sort_by(.$field) | reverse | .[0:$limit][]" 2>/dev/null
134
- else
135
- node "$_JSON_HELPER" slurp-cap "$file" "$field" "$limit"
136
- fi
137
- }
138
-
139
- # --- Array operations ---
140
-
141
- # Get length of array at path. Usage: echo '{"obs":[1,2]}' | json_array_length "observations"
142
- json_array_length() {
143
- local path="$1"
144
- if [ "$_HAS_JQ" = "true" ]; then
145
- jq ".$path | length" 2>/dev/null
146
- else
147
- node "$_JSON_HELPER" array-length "$path"
148
- fi
149
- }
150
-
151
- # Get item at index from array. Usage: echo '{"obs":[{},{}]}' | json_array_item "observations" 0
152
- json_array_item() {
153
- local path="$1" index="$2"
154
- if [ "$_HAS_JQ" = "true" ]; then
155
- jq -c ".${path}[$index]" 2>/dev/null
156
- else
157
- node "$_JSON_HELPER" array-item "$path" "$index"
68
+ node "$_JSON_HELPER" get-string-field "$field" 2>/dev/null < "$file"
158
69
  fi
159
70
  }
160
71
 
@@ -175,7 +86,7 @@ json_extract_cwd_field() {
175
86
  if [ "$_HAS_JQ" = "true" ]; then
176
87
  jq -r --arg f "$field" '(.cwd // "") + "\u0001" + (.[$f] // "")' 2>/dev/null
177
88
  else
178
- node "$_JSON_HELPER" extract-cwd-field "$field"
89
+ node "$_JSON_HELPER" extract-cwd-field "$field" 2>/dev/null
179
90
  fi
180
91
  }
181
92
 
@@ -185,21 +96,6 @@ json_extract_cwd_prompt() {
185
96
  json_extract_cwd_field "prompt"
186
97
  }
187
98
 
188
- # --- Transcript extraction ---
189
-
190
- # Extract text messages from Claude message JSON. Usage: printf '%s\n' '{"message":...}' | json_extract_messages
191
- json_extract_messages() {
192
- if [ "$_HAS_JQ" = "true" ]; then
193
- jq -r 'if .message.content then
194
- if (.message.content | type) == "string" then .message.content
195
- else [.message.content[] | select(.type == "text") | .text] | join("\n")
196
- end
197
- else "" end' 2>/dev/null
198
- else
199
- node "$_JSON_HELPER" extract-text-messages
200
- fi
201
- }
202
-
203
99
  # --- Hook output envelopes ---
204
100
 
205
101
  # Build SessionStart output. Usage: json_session_output "$CONTEXT"