@ainova-systems/intelligence 0.18.1 → 0.19.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 (35) hide show
  1. package/cli/commands/init.sh +6 -1
  2. package/cli/commands/package.sh +8 -3
  3. package/cli/commands/source.sh +55 -16
  4. package/cli/intelligence +1 -1
  5. package/cli/internal/check.sh +64 -13
  6. package/cli/internal/package-add.sh +25 -4
  7. package/cli/internal/package-alias.sh +51 -0
  8. package/cli/internal/package-list.sh +16 -2
  9. package/cli/internal/package-remove.sh +3 -1
  10. package/cli/internal/package-update.sh +12 -4
  11. package/cli/lib/adapter-lifecycle.sh +5 -2
  12. package/cli/lib/cli-common.sh +4 -1
  13. package/cli/lib/gitignore.sh +128 -34
  14. package/cli/lib/manifest.sh +168 -20
  15. package/cli/lib/registry.sh +18 -13
  16. package/engine/ENGINE_SHA +1 -1
  17. package/engine/VERSION +1 -1
  18. package/engine/adapters/_template.sh +6 -2
  19. package/engine/adapters/agents.sh +3 -0
  20. package/engine/adapters/claude.sh +21 -10
  21. package/engine/adapters/codex.sh +8 -12
  22. package/engine/adapters/copilot.sh +46 -2
  23. package/engine/adapters/cursor.sh +6 -1
  24. package/engine/lib/adapter-contract.sh +17 -6
  25. package/engine/lib/common.sh +418 -50
  26. package/engine/sync.sh +9 -0
  27. package/package.json +1 -1
  28. package/packages/sync/references/adapters.md +39 -9
  29. package/packages/sync/references/conventions.md +44 -7
  30. package/packages/sync/references/onboarding-migration.md +3 -3
  31. package/packages/sync/skills/intelligence-learn-from-repository/SKILL.md +3 -2
  32. package/packages/sync/skills/intelligence-review-context/SKILL.md +2 -1
  33. package/packages/sync/skills/intelligence-update-context/SKILL.md +4 -2
  34. package/packages/sync/skills/intelligence-update-context/references/agents.md +7 -3
  35. package/packages/sync/skills/intelligence-update-context/references/skills.md +3 -1
@@ -9,7 +9,9 @@
9
9
  # Skills: copy skill directories in full to .agents/skills/{name}/ (Codex
10
10
  # reads from $REPO_ROOT/.agents/skills exclusively per official docs)
11
11
  # Agents: -> .codex/agents/{name}.toml (name, description, model,
12
- # model_reasoning_effort, sandbox_mode, developer_instructions)
12
+ # model_reasoning_effort, sandbox_mode, developer_instructions).
13
+ # model_reasoning_effort comes from `effort:` alone — never from the tier —
14
+ # and is omitted without one, so Codex's own setting applies.
13
15
  #
14
16
  # Every per-file loop batches its work into one awk process (see the batched
15
17
  # helpers in lib/common.sh): process spawns dominate sync time on Windows.
@@ -97,18 +99,12 @@ sync_codex_agents() {
97
99
  if [ "${#files[@]}" -gt 0 ]; then
98
100
  load_model_tiers "$config_file" "codex"
99
101
 
100
- local path tier access description name effort sandbox spec="" report="" LS=$'\x1e'
101
- while IFS=$'\x1f' read -r path tier access description; do
102
+ local path tier access description effort name sandbox spec="" report="" LS=$'\x1e'
103
+ while IFS=$'\x1f' read -r path tier access description effort; do
102
104
  [ -n "$path" ] || continue
103
105
  name="${path##*/}"; name="${name%.md}"
104
106
  resolve_model_var "$tier"
105
- case "$tier" in
106
- frontier) effort="xhigh" ;;
107
- heavy|"") effort="high" ;;
108
- standard) effort="medium" ;;
109
- light) effort="low" ;;
110
- *) effort="medium" ;;
111
- esac
107
+ map_effort_var codex "$effort"
112
108
  case "$access" in
113
109
  readonly) sandbox="read-only" ;;
114
110
  *) sandbox="workspace-write" ;;
@@ -121,7 +117,7 @@ sync_codex_agents() {
121
117
  header="${LS}name = \"$name_escaped\""
122
118
  header+="${LS}description = \"$description_escaped\""
123
119
  header+="${LS}model = \"$IS_MODEL\""
124
- header+="${LS}model_reasoning_effort = \"$effort\""
120
+ [ -z "$IS_EFFORT" ] || header+="${LS}model_reasoning_effort = \"$IS_EFFORT\""
125
121
  header+="${LS}sandbox_mode = \"$sandbox\""
126
122
  header+="${LS}"
127
123
  header+="${LS}developer_instructions = \"\"\""
@@ -129,7 +125,7 @@ sync_codex_agents() {
129
125
  spec+="$path"$'\x1f'"$output_dir/$name.toml"$'\x1f'"fence"$'\x1f'"1"$'\x1f'"toml"$'\x1f'"$header"$'\x1f'"${LS}\"\"\""$'\n'
130
126
  report+=" agent: $name.toml"$'\n'
131
127
  count=$((count + 1))
132
- done < <(frontmatter_index "tier,access,description" "${files[@]}")
128
+ done < <(frontmatter_index "tier,access,description,effort" "${files[@]}")
133
129
 
134
130
  emit_wrapped_bodies "$spec"
135
131
  printf '%s' "$report"
@@ -12,13 +12,20 @@
12
12
  # Skills: copy skill directories in full to .github/skills/{name}/
13
13
  # Agents: -> .github/agents/{name}.agent.md (description, tools, model)
14
14
  #
15
+ # Git policy (decision 0020): generated output is ignored by default, as it is
16
+ # for Cursor and Claude Code — Copilot in the editor reads it from disk after
17
+ # sync. GitHub's cloud Copilot (code review, the coding agent) reads the
18
+ # repository instead, so `targets.copilot.commit_output: true` keeps the output
19
+ # tracked. Only the generated subdirectories are named, never `.github/`
20
+ # itself: workflows, templates and hand-written files there stay tracked.
21
+ #
15
22
  # Every per-file loop batches its work into one awk process (see the batched
16
23
  # helpers in lib/common.sh): process spawns dominate sync time on Windows.
17
24
 
18
25
  source "$(dirname "${BASH_SOURCE[0]}")/../lib/common.sh"
19
26
 
20
27
  adapter_contract_copilot() {
21
- local output="${1%/}"
28
+ local output="${1%/}" record=adapter_contract_ignore sub
22
29
  adapter_contract_version 1
23
30
  adapter_contract_requires agents
24
31
  adapter_contract_owned "$output/instructions"
@@ -26,6 +33,37 @@ adapter_contract_copilot() {
26
33
  adapter_contract_owned "$output/agents"
27
34
  adapter_contract_owned "$output/skills"
28
35
  adapter_contract_legacy "$output/copilot-instructions.md"
36
+ # A malformed value declares the default here; sync refuses it with the
37
+ # reason, so the policy never rests on a guess.
38
+ if copilot_commit_output_var "${2:-}" && [ "$IS_COPILOT_COMMIT_OUTPUT" = 1 ]; then
39
+ record=adapter_contract_unignore
40
+ fi
41
+ # The same four paths the contract owns: every sync rewrites them, so the
42
+ # ignore covers generated output only.
43
+ for sub in instructions prompts agents skills; do
44
+ "$record" "$output/$sub/"
45
+ done
46
+ # The root instructions file onboarding quarantines, like CLAUDE.md and
47
+ # .cursorrules: its content migrates into project rules, and a copy left
48
+ # behind makes Copilot ignore AGENTS.md (copilot-cli#489).
49
+ "$record" "$output/copilot-instructions.md"
50
+ }
51
+
52
+ # copilot_commit_output_var <manifest> — the one reader of
53
+ # targets.copilot.commit_output. Sets IS_COPILOT_COMMIT_OUTPUT to 1 when the
54
+ # project commits generated output and 0 for the default; returns 1 for any
55
+ # value other than true or false. No manifest — a caller reading ownership
56
+ # only — is the default.
57
+ copilot_commit_output_var() {
58
+ local manifest="$1" setting
59
+ IS_COPILOT_COMMIT_OUTPUT=0
60
+ [ -n "$manifest" ] && [ -f "$manifest" ] || return 0
61
+ setting="$(get_target_field "$manifest" "copilot" "commit_output")"
62
+ case "$setting" in
63
+ ''|false) ;;
64
+ true) IS_COPILOT_COMMIT_OUTPUT=1 ;;
65
+ *) return 1 ;;
66
+ esac
29
67
  }
30
68
 
31
69
  # copilot_paths_rows <file>... — batch form of the old per-file `paths:`
@@ -143,7 +181,8 @@ sync_copilot_skills() {
143
181
 
144
182
  local count=0
145
183
  if [ "${#skill_dirs[@]}" -gt 0 ]; then
146
- copy_skill_bundle_dirs "$output_dir/skills" "${skill_dirs[@]}"
184
+ # Copilot has no effort field: the copy carries no `effort:`.
185
+ copy_skill_bundle_dirs_for copilot "$output_dir/skills" "${skill_dirs[@]}"
147
186
  for d in "${skill_dirs[@]}"; do
148
187
  skill_name="${d%/}"
149
188
  count=$((count + 1))
@@ -221,6 +260,11 @@ sync_to_copilot() {
221
260
 
222
261
  echo "=== GitHub Copilot ==="
223
262
 
263
+ copilot_commit_output_var "$config_file" || {
264
+ echo "ERROR: targets.copilot.commit_output must be true or false: true keeps generated Copilot output tracked, false or omission ignores it." >&2
265
+ return 1
266
+ }
267
+
224
268
  # Clean generated content (preserve workflows, etc.)
225
269
  rm -rf "$output_dir/instructions" "$output_dir/prompts"
226
270
  if [ -d "$output_dir/skills" ]; then
@@ -10,6 +10,8 @@
10
10
  # same rules would cause double-loading and burn the context window.
11
11
  # Skills: copy skill directories in full (SKILL.md + bundled resources)
12
12
  # Agents: strip tier/access/tools/disallowedTools, add model + readonly:true
13
+ # Cursor has no per-agent or per-skill effort field (its effort is part of a
14
+ # model ID), so `effort:` is stripped from both.
13
15
  #
14
16
  # Every per-file loop batches its work into one awk process (see the batched
15
17
  # helpers in lib/common.sh): process spawns dominate sync time on Windows.
@@ -113,7 +115,7 @@ sync_cursor_skills() {
113
115
  done
114
116
  done <<< "$list"
115
117
  [ "${#skill_dirs[@]}" -gt 0 ] || return 0
116
- copy_skill_bundle_dirs "$output_dir/skills" "${skill_dirs[@]}"
118
+ copy_skill_bundle_dirs_for cursor "$output_dir/skills" "${skill_dirs[@]}"
117
119
  for d in "${skill_dirs[@]}"; do
118
120
  skill_name="${d%/}"
119
121
  echo " skill: ${skill_name##*/}"
@@ -170,13 +172,16 @@ sync_cursor_agents() {
170
172
  if (out != "") close(out)
171
173
  out = dst "/" base_name(FILENAME)
172
174
  count = 0
175
+ fm = 0
173
176
  }
174
177
  /^tier:/ { next }
175
178
  /^access:/ { next }
176
179
  /^tools:/ { next }
177
180
  /^disallowedTools:/ { next }
178
181
  { sub(/\r$/, "") }
182
+ FNR == 1 && $0 == "---" { fm = 1 }
179
183
  /^---$/ { count++ }
184
+ fm && count == 1 && substr($0, 1, 7) == "effort:" { next }
180
185
  count == 2 && /^---$/ {
181
186
  print fin_line("model: " MODEL[FILENAME]) > out
182
187
  if (RO[FILENAME] != "") print fin_line(RO[FILENAME]) > out
@@ -1,10 +1,17 @@
1
1
  #!/bin/bash
2
2
  # Declarative adapter ownership contract shared by the engine and CLI.
3
3
  #
4
- # Every adapter exposes adapter_contract_<name> <configured-output>. The
5
- # function emits tab-separated records through the helpers below. Keeping the
4
+ # Every adapter exposes adapter_contract_<name> <configured-output> [manifest].
5
+ # The function emits tab-separated records through the helpers below. Keeping the
6
6
  # declaration beside sync_to_<name>() makes backup, rollback, git policy and
7
7
  # lifecycle checks consume the same ownership model as the writer itself.
8
+ #
9
+ # The manifest argument exists for Git policy alone: a target field may choose
10
+ # whether generated output is ignored (targets.copilot.commit_output). Ownership
11
+ # never depends on it, so the engine and the sync cache, which read ownership
12
+ # only, pass none and spare every sync the extra read; a contract given none
13
+ # declares its default policy. Every caller that applies or checks Git policy
14
+ # passes the manifest.
8
15
 
9
16
  adapter_contract_version() { printf 'version\t%s\n' "$1"; }
10
17
  adapter_contract_requires() { printf 'requires\t%s\n' "$1"; }
@@ -14,6 +21,10 @@ adapter_contract_legacy() { printf 'legacy\t%s\n' "$1"; }
14
21
  adapter_contract_preserve() { printf 'preserve\t%s\n' "$1"; }
15
22
  adapter_contract_ignore() { printf 'ignore\t%s\n' "$1"; }
16
23
  adapter_contract_include() { printf 'include\t%s\n' "$1"; }
24
+ # An ignore line the policy must not hold: the writer takes it back out of the
25
+ # region it manages. It is how a configuration that keeps output tracked undoes
26
+ # the default ignore an earlier alignment already wrote.
27
+ adapter_contract_unignore() { printf 'unignore\t%s\n' "$1"; }
17
28
 
18
29
  # --- cross-adapter ownership -------------------------------------------------
19
30
  #
@@ -106,12 +117,12 @@ adapter_contract_safe_concrete_path() {
106
117
  esac
107
118
  }
108
119
 
109
- # adapter_contract_records <adapter-name> <adapter-file> <configured-output>
120
+ # adapter_contract_records <adapter-name> <adapter-file> <configured-output> [manifest]
110
121
  # Source and query in a subshell so a project adapter cannot leak shell state
111
122
  # into the caller. Project adapters are trusted executable code during sync;
112
123
  # the isolation here is for correctness, not a security boundary.
113
124
  adapter_contract_records() (
114
- local name="$1" file="$2" output="$3" fn line kind value saw_version=0
125
+ local name="$1" file="$2" output="$3" manifest="${4:-}" fn line kind value saw_version=0
115
126
  # shellcheck source=/dev/null
116
127
  source "$file"
117
128
  printf -v fn 'adapter_contract_%s' "$name"
@@ -149,7 +160,7 @@ adapter_contract_records() (
149
160
  return 1
150
161
  }
151
162
  ;;
152
- ignore|include)
163
+ ignore|include|unignore)
153
164
  adapter_contract_safe_path "$value" || {
154
165
  echo "ERROR: adapter '$name' declares unsafe $kind path '$value'" >&2
155
166
  return 1
@@ -161,7 +172,7 @@ adapter_contract_records() (
161
172
  ;;
162
173
  esac
163
174
  printf '%s\n' "$line"
164
- done < <("$fn" "$output")
175
+ done < <("$fn" "$output" "$manifest")
165
176
  [ "$saw_version" -eq 1 ] || {
166
177
  echo "ERROR: adapter '$name' contract did not declare version 1" >&2
167
178
  return 1