@ainova-systems/intelligence 0.11.6 → 0.11.7

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.
@@ -124,7 +124,9 @@ case "$IP_MODE" in
124
124
  if [ "$preview" -eq 1 ]; then
125
125
  check_version_compat "$IP_ROOT/intelligence.yaml"
126
126
  echo "project: Intelligence CLI at $IP_ROOT"
127
- if project_needs_upgrade "$IP_ROOT"; then
127
+ if project_stamped_ahead "$IP_ROOT"; then
128
+ echo " project schema $(read_schema_version "$IP_ROOT/intelligence.yaml") is ahead of engine $(bundled_engine_version) — left as is (update the CLI)"
129
+ elif project_needs_upgrade "$IP_ROOT"; then
128
130
  echo " would align project lifecycle with engine $(bundled_engine_version)"
129
131
  else
130
132
  echo " schema/content already match engine $(bundled_engine_version)"
@@ -48,7 +48,9 @@ fi
48
48
 
49
49
  echo ""
50
50
  echo "Project:"
51
- if project_needs_upgrade "$IP_ROOT"; then
51
+ if project_stamped_ahead "$IP_ROOT"; then
52
+ echo " schema $stamp is ahead of engine $eng — left as is; update the CLI to align it"
53
+ elif project_needs_upgrade "$IP_ROOT"; then
52
54
  echo " lifecycle alignment required (stamp ${stamp:-unstamped}, engine $eng)"
53
55
  project_change=1
54
56
  else
@@ -24,8 +24,10 @@ legacy_key_count="$(awk '/^sync_version:[[:space:]]*/ { n++ } END { print n + 0
24
24
  eng="$(bundled_engine_version)"
25
25
  [ "$schema_key_count" -le 1 ] || die "manifest has duplicate schema_version keys"
26
26
  [ "$legacy_key_count" -le 1 ] || die "manifest has duplicate sync_version keys"
27
+ # Alignment only ever moves a project UP to this engine. A project stamped
28
+ # ahead is never restamped downward, whatever the gap.
27
29
  if [ -n "$stamp" ] && _ver_gt "$stamp" "$eng"; then
28
- die "manifest schema $stamp is newer than this CLI's engine $eng — update the global CLI first"
30
+ die "manifest schema $stamp is newer than this CLI's engine $eng — refusing to align it downward; update the global CLI first"
29
31
  fi
30
32
  if [ -n "$legacy_stamp" ] && _ver_gt "$legacy_stamp" "$eng"; then
31
33
  die "manifest schema $legacy_stamp is newer than this CLI's engine $eng — update the global CLI first"
@@ -5,6 +5,7 @@ source "$CLI_DIR/lib/cli-common.sh"
5
5
 
6
6
  problems=0
7
7
  warn() { echo " ✗ $*"; problems=$((problems + 1)); }
8
+ note() { echo " ! $*"; }
8
9
  ok() { echo " ✓ $*"; }
9
10
 
10
11
  echo "environment:"
@@ -36,7 +37,11 @@ eng="$(bundled_engine_version)"
36
37
  if [ -z "$stamp" ]; then
37
38
  warn "manifest has no schema_version — run 'intelligence init'"
38
39
  elif _ver_gt "$stamp" "$eng"; then
39
- warn "manifest schema $stamp is newer than this CLI's engine $eng — update the CLI: npm i -g @ainova-systems/intelligence@latest"
40
+ if [ "$(_ver_major "$stamp")" -gt "$(_ver_major "$eng")" ]; then
41
+ warn "manifest schema $stamp is a newer major than this CLI's engine $eng — update the CLI: npm i -g @ainova-systems/intelligence@latest"
42
+ else
43
+ note "manifest schema $stamp is newer than this CLI's engine $eng — the project uses a newer CLI; update it: npm i -g @ainova-systems/intelligence@latest"
44
+ fi
40
45
  elif _ver_gt "$eng" "$stamp"; then
41
46
  warn "manifest schema $stamp behind engine $eng — run 'intelligence init'"
42
47
  else
@@ -49,6 +54,8 @@ sync_locked="$(qmap_field "$lock" "packages" "$SYNC_PKG_NAME" "resolved")"
49
54
  if [ -n "$sync_locked" ]; then
50
55
  if [ "${sync_locked#v}" = "$eng" ]; then
51
56
  ok "$SYNC_PKG_NAME at $sync_locked (matches the engine)"
57
+ elif [ "${sync_locked#v}" = "$stamp" ] && _ver_gt "$stamp" "$eng"; then
58
+ note "$SYNC_PKG_NAME at $sync_locked (matches the project schema; the engine is $eng)"
52
59
  else
53
60
  warn "$SYNC_PKG_NAME locked at $sync_locked but the engine is $eng — run 'intelligence init'"
54
61
  fi
@@ -239,12 +239,26 @@ assert_safe_content_dir() {
239
239
  done
240
240
  }
241
241
 
242
+ # project_stamped_ahead <root> — the manifest is stamped newer than this CLI's
243
+ # engine, at any SemVer level. Every caller runs check_version_compat first,
244
+ # which has already refused a newer major, so what reaches this predicate is
245
+ # the admitted minor/patch gap; the predicate itself does not re-judge the gap.
246
+ project_stamped_ahead() {
247
+ local stamp
248
+ stamp="$(read_schema_version "$1/intelligence.yaml")"
249
+ [ -n "$stamp" ] && _ver_gt "$stamp" "$(bundled_engine_version)"
250
+ }
251
+
242
252
  project_needs_upgrade() {
243
253
  local root="$1" manifest="$1/intelligence.yaml" stamp eng pinned locked name
244
254
  [ -f "$manifest" ] || return 1
245
255
  stamp="$(read_schema_version "$manifest")"
246
256
  eng="$(bundled_engine_version)"
247
257
  [ -z "$stamp" ] && return 0
258
+ # A project stamped ahead belongs to a newer CLI. Aligning it here would
259
+ # restamp the schema and re-pin the engine content DOWNWARD, and the next
260
+ # teammate on the current CLI would move both back: leave it as found.
261
+ project_stamped_ahead "$root" && return 1
248
262
  [ -n "$(top_scalar "$manifest" "sync_version")" ] && return 0
249
263
  _ver_gt "$eng" "$stamp" && return 0
250
264
  [ -d "$root/.intelligence/engine" ] && return 0
package/engine/ENGINE_SHA CHANGED
@@ -1 +1 @@
1
- 512d06382f43fa910c32ccc275a5fc286500d4e2
1
+ 00308bfbdcd92ebf37924bb1083cee142e655fd7
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.6
1
+ 0.11.7
@@ -100,21 +100,41 @@ _ver_gt() {
100
100
  return 1
101
101
  }
102
102
 
103
- # check_version_compat <config_file> — refuse to operate on a project whose
104
- # config schema is stamped newer than this engine knows (a stale engine must
105
- # never rewrite/sync a newer schema). Emits status + returns IS_RC_AHEAD on
106
- # conflict, else 0.
103
+ # _ver_major V → the leading numeric field of a version ("0.11.6" → 0).
104
+ _ver_major() {
105
+ local m="${1%%.*}"
106
+ m="${m//[!0-9]/}"
107
+ printf '%s' "$((10#${m:-0}))"
108
+ }
109
+
110
+ # check_version_compat <config_file> — a stale engine on a project stamped
111
+ # NEWER than itself. The gap decides:
112
+ # * a newer MAJOR is refused: the manifest may carry shapes this engine
113
+ # cannot read, and rendering or rewriting it would destroy them. Emits
114
+ # status + returns IS_RC_AHEAD;
115
+ # * a newer minor or patch within the same major warns once and returns 0:
116
+ # the schema is additive there, so an older engine renders what it
117
+ # understands. It never restamps the project — the CLI's preflight leaves
118
+ # a project stamped ahead exactly as it found it (project_needs_upgrade).
107
119
  check_version_compat() {
108
120
  local cf="$1" stamp eng
109
121
  stamp="$(read_schema_version "$cf")"
110
122
  [ -n "$stamp" ] || return 0
111
123
  eng="$(engine_version)"
112
124
  [ -n "$eng" ] || return 0
113
- if _ver_gt "$stamp" "$eng"; then
125
+ _ver_gt "$stamp" "$eng" || return 0
126
+ if [ "$(_ver_major "$stamp")" -gt "$(_ver_major "$eng")" ]; then
114
127
  is_status ahead-of-engine "stamp=$stamp engine=$eng"
115
- echo " ERROR: project stamped $stamp but this engine is $eng — refusing." >&2
128
+ echo " ERROR: project stamped $stamp but this engine is $eng — a newer major schema; refusing." >&2
116
129
  echo " Update the CLI first: npm i -g @ainova-systems/intelligence@latest" >&2
117
130
  return "$IS_RC_AHEAD"
118
131
  fi
132
+ # One warning per command, however many processes re-check on the way to
133
+ # the engine (CLI preflight first, then the engine itself). The line has
134
+ # no indent on purpose: `sync --compact` keeps `WARNING:` lines.
135
+ if [ "${IS_SCHEMA_AHEAD_WARNED:-}" != "$stamp" ]; then
136
+ echo "WARNING: project schema $stamp is newer than this CLI's engine $eng — the project uses a newer CLI; update it: npm i -g @ainova-systems/intelligence@latest" >&2
137
+ export IS_SCHEMA_AHEAD_WARNED="$stamp"
138
+ fi
119
139
  return 0
120
140
  }
package/engine/sync.sh CHANGED
@@ -31,7 +31,8 @@ fi
31
31
  # Schema version lives in the manifest (the frozen contract key).
32
32
  _cf="$CONFIG_FILE"
33
33
 
34
- # Stale engine vs project schema stamped NEWER (ahead-of-engine) → refuse.
34
+ # Stale engine vs project schema stamped NEWER (ahead-of-engine): a newer
35
+ # major refuses, a newer minor/patch warns and renders (see contract.sh).
35
36
  _vc_rc=0
36
37
  check_version_compat "$_cf" || _vc_rc=$?
37
38
  if [ "$_vc_rc" -ne 0 ]; then exit "$_vc_rc"; fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainova-systems/intelligence",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
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"
@@ -391,7 +391,7 @@ The public lifecycle is deliberately compact:
391
391
  - `intelligence adapter list|create|enable|disable|remove` owns adapter inventory and target state.
392
392
  - `intelligence status [--check]` reports state; `--check` runs deep consistency checks.
393
393
 
394
- Implement Intelligence schema changes as idempotent structural checks. Stage and verify replacement state before deleting or replacing prior state. A stale engine refuses a manifest whose `schema_version` is newer; normal project entry points close a behind-project gap through lifecycle preflight.
394
+ Implement Intelligence schema changes as idempotent structural checks. Stage and verify replacement state before deleting or replacing prior state. A stale engine refuses a manifest whose `schema_version` is a newer major; a newer minor or patch within the same major warns once and proceeds without restamping the project. Normal project entry points close a behind-project gap through lifecycle preflight.
395
395
 
396
396
  Breaking changelog entries use a `### Breaking` checklist of verifiable post-conditions. The update skill reads every release across the version gap, chooses the package/CLI/project command sequence and verifies those conditions after the deterministic command completes.
397
397
 
@@ -406,7 +406,7 @@ The engine emits one machine-readable line, `IS_STATUS=<code> [IS_DETAIL=...]`,
406
406
  | `error` | 1 | Generic failure |
407
407
  | `config-missing` | 2 | Required manifest is absent |
408
408
  | `ambiguous` | 3 | Conflicting state requiring agent/human judgment; reserved |
409
- | `ahead-of-engine` | 4 | Manifest schema is newer than the engine |
409
+ | `ahead-of-engine` | 4 | Manifest schema is a newer major than the engine (a newer minor or patch warns and continues) |
410
410
  | `aborted-incomplete` | 5 | Staged replacement was incomplete; prior state remains |
411
411
  | `needs-update` | 6 | Project schema is behind the engine; rerun through a public lifecycle command |
412
412