@ainova-systems/intelligence 0.17.0 → 0.17.1

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.
@@ -1,9 +1,15 @@
1
1
  #!/bin/bash
2
2
  # intelligence sync [target] [--compact] [--force] - render intelligence to enabled tools.
3
3
  set -euo pipefail
4
- source "$CLI_DIR/lib/cli-common.sh"
5
4
 
5
+ # Print before library loading and lifecycle checks so a content verification
6
+ # never looks idle. Compact output remains a buffered machine-readable report.
6
7
  compact=0
8
+ for argument in "$@"; do
9
+ [ "$argument" != --compact ] || compact=1
10
+ done
11
+ [ "$compact" -ne 0 ] || echo 'Checking project...'
12
+ source "$CLI_DIR/lib/cli-common.sh"
7
13
  force=0
8
14
  target=""
9
15
  while [ $# -gt 0 ]; do
@@ -16,6 +16,8 @@ sync_cache_safe_path() {
16
16
  # One checked enumeration and one batch hash, including names, directory/file
17
17
  # types and executable bits. Timestamps cannot prove content is unchanged.
18
18
  # Unsupported paths/types are a cache miss, never an incomplete fingerprint.
19
+ # Keep list descriptors open across the walk; reopening each line is expensive
20
+ # on Windows and provides no additional content verification.
19
21
  sync_cache_fingerprint() (
20
22
  local work="$1" path kind executable seen=$'\n'
21
23
  local -a existing
@@ -48,14 +50,14 @@ sync_cache_fingerprint() (
48
50
  if [ -f "$path" ]; then
49
51
  kind='file'
50
52
  [ ! -x "$path" ] || executable=1
51
- printf '%s\n' "$path" >> "$work/files" || return 1
53
+ printf '%s\n' "$path" >&4 || return 1
52
54
  elif [ -d "$path" ]; then
53
55
  kind=directory
54
56
  else
55
57
  return 1
56
58
  fi
57
- printf '%s\t%s\t%s\n' "$kind" "$executable" "$path" >> "$work/entries" || return 1
58
- done < "$work/list"
59
+ printf '%s\t%s\t%s\n' "$kind" "$executable" "$path" >&3 || return 1
60
+ done < "$work/list" 3>> "$work/entries" 4> "$work/files" || return 1
59
61
  # find order need not be stable. Sort both streams; preserve path-to-hash
60
62
  # association by feeding the sorted file list into a single git process.
61
63
  LC_ALL=C sort -u "$work/entries" > "$work/sorted" || return 1
@@ -161,15 +163,19 @@ sync_with_cache() (
161
163
  local target="$1" force="$2" work before after outputs report_hash rc=0 cacheable=0
162
164
  work="$(mktemp -d -t intelligence-cache-XXXXXX)" || return 1
163
165
  trap 'rm -rf "$work"' EXIT
166
+ echo "Checking source files..."
164
167
  if sync_cache_dependencies && sync_cache_directory; then
165
168
  before="$(sync_cache_input_hash "$work" "$target")" || before=""
166
169
  [ -z "$before" ] || cacheable=1
167
170
  fi
168
171
  if [ "$cacheable" = 1 ] && [ "$force" = 0 ]; then
172
+ echo "Checking generated files..."
169
173
  outputs="$(sync_cache_fingerprint "$work" "${SC_OUTPUTS[@]}")" || outputs=""
170
174
  if [ -n "$outputs" ] && sync_cache_read "$SC_DIRECTORY/state" "$before" "$outputs" "$work"; then
171
- echo ' Unchanged: verified sources and generated output; skipped rendering (use --force to refresh discovery).'
175
+ echo 'Unchanged: generated files are up to date.'
176
+ printf '\n'
172
177
  cat "$work/report"
178
+ printf '\n=== Unchanged: no files needed updating ===\n'
173
179
  return 0
174
180
  fi
175
181
  fi
@@ -177,26 +183,37 @@ sync_with_cache() (
177
183
  if [ "$cacheable" = 1 ]; then
178
184
  rm -f "$SC_DIRECTORY/state" || cacheable=0
179
185
  fi
180
- # Buffer once so success diagnostics can be replayed without asking the
181
- # engine to know about persistent CLI state. Preserve the engine exit code.
182
- bash "$IS_ENGINE_DIR/sync.sh" "$target" > "$work/log" 2>&1 || rc=$?
183
- cat "$work/log"
184
- [ "$rc" = 0 ] || return "$rc"
185
- [ "$cacheable" = 1 ] || return 0
186
- after="$(sync_cache_input_hash "$work" "$target")" || return 0
187
- [ "$before" = "$after" ] || return 0
188
- outputs="$(sync_cache_fingerprint "$work" "${SC_OUTPUTS[@]}")" || return 0
189
- sync_cache_report "$work/log" > "$work/report" || return 0
190
- report_hash="$(git hash-object --stdin < "$work/report")" || return 0
191
- # Recheck containment before publishing. mktemp+rename avoids following a
192
- # pre-existing state-file link, and readers see only complete records.
193
- sync_cache_directory create || return 0
194
- local staged
195
- staged="$(mktemp "$SC_DIRECTORY/state-XXXXXX")" || return 0
196
- if { printf 'intelligence-sync-cache-v1 %s %s %s\n' "$after" "$outputs" "$report_hash"; cat "$work/report"; } > "$staged"; then
197
- mv -f "$staged" "$SC_DIRECTORY/state" || rm -f "$staged"
186
+ # Stream progress while retaining diagnostics for the next cache hit. Check
187
+ # both processes: a failed capture must never publish a success record.
188
+ local -a pipeline_status
189
+ if bash "$IS_ENGINE_DIR/sync.sh" "$target" 2>&1 | tee "$work/log"; then
190
+ pipeline_status=("${PIPESTATUS[@]}")
198
191
  else
199
- rm -f "$staged"
192
+ pipeline_status=("${PIPESTATUS[@]}")
193
+ fi
194
+ rc="${pipeline_status[0]}"
195
+ [ "$rc" = 0 ] || return "$rc"
196
+ [ "${pipeline_status[1]}" = 0 ] || return "${pipeline_status[1]}"
197
+ if [ "$cacheable" = 1 ]; then
198
+ (
199
+ echo "Checking sync results..."
200
+ after="$(sync_cache_input_hash "$work" "$target")" || return 0
201
+ [ "$before" = "$after" ] || return 0
202
+ outputs="$(sync_cache_fingerprint "$work" "${SC_OUTPUTS[@]}")" || return 0
203
+ sync_cache_report "$work/log" > "$work/report" || return 0
204
+ report_hash="$(git hash-object --stdin < "$work/report")" || return 0
205
+ # Recheck containment before publishing. mktemp+rename avoids following a
206
+ # pre-existing state-file link, and readers see only complete records.
207
+ sync_cache_directory create || return 0
208
+ local staged
209
+ staged="$(mktemp "$SC_DIRECTORY/state-XXXXXX")" || return 0
210
+ if { printf 'intelligence-sync-cache-v1 %s %s %s\n' "$after" "$outputs" "$report_hash"; cat "$work/report"; } > "$staged"; then
211
+ mv -f "$staged" "$SC_DIRECTORY/state" || rm -f "$staged"
212
+ else
213
+ rm -f "$staged"
214
+ fi
215
+ )
200
216
  fi
217
+ echo "=== Sync complete ==="
201
218
  return 0
202
219
  )
package/engine/ENGINE_SHA CHANGED
@@ -1 +1 @@
1
- f23e407da080869b07481730d81b6ebce73a1d2e
1
+ 3580413cb402a47d3defc33afbdd190ef23cc430
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0
1
+ 0.17.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainova-systems/intelligence",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Build, version and distribute AI agent intelligence across your organization — one CLI, versioned Intelligence Packages, and a sync engine for Claude Code, Cursor, Copilot, Codex, Pi and OpenCode.",
5
5
  "bin": {
6
6
  "intelligence": "bin/intelligence.js"