@ainova-systems/intelligence 0.12.0 → 0.12.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.
@@ -15,34 +15,60 @@ gitignore_path_is_ignored() {
15
15
  git -C "$root" check-ignore -q --no-index -- "$path"
16
16
  }
17
17
 
18
- # Git cannot re-include a child of an excluded directory. Add explicit parent
19
- # reinclusions, then make sure both parent and child negations occur after any
20
- # pre-existing rule that still wins. The check-ignore probe also catches broad
21
- # patterns such as an old `.claude/` or `.cursor/**`, not just exact matches.
18
+ # True when the file's last lines are exactly these, in order.
19
+ gitignore_tail_is() {
20
+ local file="$1"; shift
21
+ [ -f "$file" ] || return 1
22
+ local want tail_lines
23
+ want="$(printf '%s\n' "$@")"
24
+ tail_lines="$(tail -n "$#" -- "$file")"
25
+ [ "$tail_lines" = "$want" ]
26
+ }
27
+
28
+ # Git cannot re-include a child of an excluded directory, so an include needs an
29
+ # explicit negation for every parent. A negation only wins when it comes after
30
+ # the rule excluding the parent, and the only repair an append can make is to
31
+ # move the whole chain last — so the repair runs when, and only when, the chain
32
+ # is not already there.
33
+ #
34
+ # Probe the include TARGET, never a parent with a trailing slash: `dir/*` — the
35
+ # ignore this very policy writes — matches `dir/` because `*` matches the empty
36
+ # string, so a parent probe answers "still ignored" in the healthy end state.
37
+ # Keyed on that, the repair re-appended a line already last, which cannot change
38
+ # the answer, and the file grew by one line on every run.
22
39
  gitignore_add_effective_include() {
23
- local root="$1" value="${2#./}" dir parent="" part rc
40
+ local root="$1" value="${2#./}" dir parent="" part line rc
41
+ local -a negations=()
24
42
  dir="${value%/*}"
25
43
  if [ "$dir" != "$value" ]; then
26
44
  while IFS= read -r part; do
27
45
  [ -n "$part" ] || continue
28
46
  if [ -n "$parent" ]; then parent="$parent/$part"; else parent="$part"; fi
29
- gitignore_add_line "$root" "!$parent/"
30
- if gitignore_path_is_ignored "$root" "$parent/"; then
31
- printf '!%s/\n' "$parent" >> "$root/.gitignore"
32
- else
33
- rc=$?
34
- [ "$rc" -eq 1 ] || [ "$rc" -eq 2 ] || return "$rc"
35
- fi
47
+ negations+=("!$parent/")
36
48
  done < <(printf '%s\n' "$dir" | tr '/' '\n')
37
49
  fi
50
+ negations+=("!$value")
38
51
 
39
- gitignore_add_line "$root" "!$value"
40
- if gitignore_path_is_ignored "$root" "$value"; then
41
- printf '!%s\n' "$value" >> "$root/.gitignore"
42
- else
43
- rc=$?
44
- [ "$rc" -eq 1 ] || [ "$rc" -eq 2 ] || return "$rc"
45
- fi
52
+ for line in "${negations[@]}"; do
53
+ gitignore_add_line "$root" "$line"
54
+ done
55
+
56
+ # `|| rc=$?` keeps the probe out of `set -e`'s reach: its honest "not
57
+ # ignored" is exit 1, and a bare call would abort the whole command there.
58
+ rc=0
59
+ gitignore_path_is_ignored "$root" "$value" || rc=$?
60
+ case "$rc" in
61
+ 0) ;;
62
+ 1|2) return 0 ;;
63
+ *) return "$rc" ;;
64
+ esac
65
+
66
+ # Still ignored: an earlier negation is shadowed by a later rule. Move the
67
+ # chain last. Already last means appending cannot help — leave it, and let
68
+ # `status --check` report the re-inclusion this policy could not make
69
+ # effective rather than growing the file forever.
70
+ gitignore_tail_is "$root/.gitignore" "${negations[@]}" && return 0
71
+ printf '%s\n' "${negations[@]}" >> "$root/.gitignore"
46
72
  }
47
73
 
48
74
  ensure_gitignore_header() {
package/engine/ENGINE_SHA CHANGED
@@ -1 +1 @@
1
- b1242a74527d0295e9017fcd6b13ebfe00892710
1
+ 9a4af90d8c755b5486a4a67af7c53c1be23f4641
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.0
1
+ 0.12.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainova-systems/intelligence",
3
- "version": "0.12.0",
3
+ "version": "0.12.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"