@ainova-systems/intelligence 0.11.0-rc.6 → 0.11.0-rc.8

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 (68) hide show
  1. package/README.md +15 -16
  2. package/cli/commands/adapter.sh +153 -0
  3. package/cli/commands/init.sh +113 -22
  4. package/cli/commands/package.sh +30 -0
  5. package/cli/commands/registry.sh +5 -2
  6. package/cli/commands/status.sh +12 -4
  7. package/cli/commands/sync.sh +8 -21
  8. package/cli/commands/update.sh +76 -61
  9. package/cli/engine-package.yaml +4 -4
  10. package/cli/intelligence +37 -27
  11. package/cli/{commands/doctor.sh → internal/check.sh} +32 -14
  12. package/cli/{commands/migrate.sh → internal/migrate-v1.sh} +161 -42
  13. package/cli/{commands/add.sh → internal/package-add.sh} +11 -10
  14. package/cli/{commands/list.sh → internal/package-list.sh} +9 -4
  15. package/cli/{commands/remove.sh → internal/package-remove.sh} +3 -3
  16. package/cli/{commands/search.sh → internal/package-search.sh} +4 -4
  17. package/cli/internal/package-update.sh +97 -0
  18. package/cli/{commands/install.sh → internal/restore.sh} +11 -4
  19. package/cli/internal/target-state.sh +57 -0
  20. package/cli/{commands/upgrade.sh → internal/upgrade-v2.sh} +48 -8
  21. package/cli/lib/cli-common.sh +167 -14
  22. package/cli/lib/lockfile.sh +15 -9
  23. package/cli/lib/manifest.sh +106 -1
  24. package/cli/lib/registry.sh +29 -15
  25. package/cli/lib/semver.sh +4 -2
  26. package/engine/ENGINE_SHA +1 -0
  27. package/engine/{scripts/adapters → adapters}/_template.sh +10 -9
  28. package/engine/{scripts/adapters → adapters}/agents.sh +20 -25
  29. package/engine/{scripts/adapters → adapters}/opencode.sh +1 -1
  30. package/engine/{scripts/lib → lib}/common.sh +29 -541
  31. package/engine/lib/contract.sh +120 -0
  32. package/engine/sync.sh +238 -0
  33. package/package.json +6 -5
  34. package/{engine → packages/sync}/agents/intelligence-architect.md +5 -3
  35. package/{engine → packages/sync}/agents/intelligence-operator.md +10 -13
  36. package/packages/sync/references/adapters.md +252 -0
  37. package/packages/sync/references/conventions.md +385 -0
  38. package/{engine → packages/sync}/rules/intelligence-authoring.md +6 -6
  39. package/{engine → packages/sync}/skills/intelligence-add-agent/SKILL.md +5 -5
  40. package/{engine → packages/sync}/skills/intelligence-add-rule/SKILL.md +3 -3
  41. package/{engine → packages/sync}/skills/intelligence-add-skill/SKILL.md +3 -3
  42. package/{engine → packages/sync}/skills/intelligence-extract-skill/SKILL.md +2 -2
  43. package/packages/sync/skills/intelligence-install-adapter/SKILL.md +38 -0
  44. package/{engine → packages/sync}/skills/intelligence-learn-from-context/SKILL.md +3 -3
  45. package/packages/sync/skills/intelligence-learn-from-repository/SKILL.md +55 -0
  46. package/{engine → packages/sync}/skills/intelligence-review-skills/SKILL.md +6 -6
  47. package/packages/sync/skills/intelligence-sync/SKILL.md +20 -0
  48. package/packages/sync/skills/intelligence-uninstall-adapter/SKILL.md +24 -0
  49. package/packages/sync/skills/intelligence-update/SKILL.md +43 -0
  50. package/engine/INIT.md +0 -500
  51. package/engine/docs/ADAPTERS.md +0 -214
  52. package/engine/docs/CLI.md +0 -90
  53. package/engine/docs/CONVENTIONS.md +0 -456
  54. package/engine/scripts/ENGINE_SHA +0 -1
  55. package/engine/scripts/lib/layout.sh +0 -51
  56. package/engine/scripts/lib/migrations.sh +0 -708
  57. package/engine/scripts/sync.sh +0 -311
  58. package/engine/scripts/update.sh +0 -237
  59. package/engine/skills/intelligence-install-adapter/SKILL.md +0 -31
  60. package/engine/skills/intelligence-sync/SKILL.md +0 -16
  61. package/engine/skills/intelligence-uninstall-adapter/SKILL.md +0 -42
  62. package/engine/skills/intelligence-update/SKILL.md +0 -165
  63. /package/engine/{scripts/VERSION → VERSION} +0 -0
  64. /package/engine/{scripts/adapters → adapters}/claude.sh +0 -0
  65. /package/engine/{scripts/adapters → adapters}/codex.sh +0 -0
  66. /package/engine/{scripts/adapters → adapters}/copilot.sh +0 -0
  67. /package/engine/{scripts/adapters → adapters}/cursor.sh +0 -0
  68. /package/engine/{scripts/adapters → adapters}/pi.sh +0 -0
@@ -1,165 +0,0 @@
1
- ---
2
- name: intelligence-update
3
- description: "Update or migrate intelligence-sync: discover engine, read changelog, run migration chain, verify"
4
- argument-hint: "[--yes]"
5
- agent: intelligence-operator
6
- ---
7
-
8
- # Update intelligence-sync
9
-
10
- You are the **intelligent driver** of an update. The bash engine is
11
- deterministic and fail-closed — it never guesses; on any state it cannot
12
- resolve it prints `IS_STATUS=<code>` and stops. Your job: discover the engine,
13
- understand what is changing (read the CHANGELOG across the version gap), run
14
- the migration chain, branch on the status, and **verify afterward**. Ask the
15
- user only when genuinely ambiguous.
16
-
17
- Trigger: the user says something like *"update / migrate intelligence-sync"*.
18
- They never run shell commands by hand — you do.
19
-
20
- ## Key facts
21
-
22
- - **Umbrella** = whatever directory holds `config.yaml` (`intelligence/`,
23
- `Intelligence/`, …). Never assume the name — find it.
24
- - **Engine = a module discovered by ROLE, not by name**: a directory under
25
- the umbrella whose `scripts/sync.sh` **and** `scripts/VERSION` both exist
26
- (conventionally `sync/`, but never assume the folder name).
27
- - **Applied schema version** is the frozen contract key
28
- `sync_version` in `config.yaml` (a permanent top-level scalar;
29
- absent ⇒ pre-0.3.1). **Engine version** is `<module>/scripts/VERSION`.
30
- The gap between them is the set of breaking changes to apply.
31
- - Pre-0.3.1 projects have the engine flat at `<umbrella>/scripts/` and **no**
32
- `sync_version` key. Their frozen `update.sh` fails closed
33
- against the modular upstream (changes nothing) — you bootstrap the first hop.
34
- - The `intelligence-` skill prefix is **reserved** for upstream meta-skills.
35
-
36
- ## Steps
37
-
38
- ### 0. Vendored setups only
39
- If the project has a root `intelligence.yaml` (a CLI setup), **stop** — this
40
- flow is vendored-only. There the engine ships inside the CLI package: run
41
- `npm i -g @ainova-systems/intelligence@latest`, then `intelligence upgrade`,
42
- and verify with `intelligence doctor`.
43
-
44
- ### 1. Locate the umbrella & discover the engine
45
- Find the dir containing `config.yaml` → `<umbrella>`. Then find the engine by
46
- role: search `<umbrella>` (one level deep) for a directory `<M>` with both
47
- `<M>/scripts/sync.sh` and `<M>/scripts/VERSION`.
48
-
49
- - Several candidates → pick the one with the highest `scripts/VERSION`.
50
- - A module engine exists → use it; **never** fall back to a flat
51
- `<umbrella>/scripts/` even if present (that's stale legacy).
52
- - No module engine, only flat `<umbrella>/scripts/` (or nothing) → this is a
53
- pre-0.3.1 / un-bootstrapped project; go to step 2's bootstrap.
54
- - No `config.yaml` at all → not bootstrapped; point the user at upstream
55
- `INIT.md` and stop.
56
-
57
- ### 2. Fetch upstream (read-only) — do NOT write into the project yet
58
- Clone upstream into a temp dir (default
59
- `https://github.com/ainova-systems/intelligence-sync`, or the user's
60
- `REPO_URL`/fork). The upstream module is always `intelligence/sync/`.
61
-
62
- ```
63
- git clone --depth=1 <repo> <tmp>
64
- ```
65
-
66
- **Make no changes to the project before step 3's confirmation.** In
67
- particular do not copy anything into `<umbrella>/sync` yet — that would
68
- modify (and could downgrade) an already-modular project even if the user then
69
- declines. The temp clone is only for reading the CHANGELOG and as the source
70
- for the eventual write.
71
-
72
- ### 3. Understand what is changing (changelog-aware)
73
- Determine the project's current version = the `sync_version`
74
- value in `config.yaml`, or `0.0.0` if the key is absent (pre-0.3.1). The
75
- engine version = `<tmp>/intelligence/sync/scripts/VERSION`.
76
-
77
- Read `<tmp>/CHANGELOG.md`. For every release in the range
78
- **`current < release <= engine`** (inclusive of the target release — its
79
- entry holds the destination's breaking post-conditions), read its entry. Pay
80
- special attention to any **`### Breaking`** subsection (the
81
- machine-distinguishable marker). Build a short list of breaking items, new
82
- migrations, and anything to verify afterward. Surface it to the user; without
83
- `--yes`, let them confirm before any write.
84
-
85
- ### 3a. Ensure the engine to run (only now, post-confirmation)
86
- - **Modular project** (a module engine was discovered in step 1): run *its*
87
- `update.sh` — at the discovered module dir, whatever its name. `update.sh`
88
- re-clones upstream internally, shows the diff, and is authoritative; do not
89
- hand-copy over the module.
90
- - **No module engine** (pre-0.3.1 flat or un-bootstrapped): only here create
91
- the module from the temp clone, and only after confirmation:
92
- ```
93
- mkdir -p <umbrella>/sync
94
- cp -r <tmp>/intelligence/sync/. <umbrella>/sync/
95
- ```
96
- then run `<umbrella>/sync/scripts/update.sh`.
97
-
98
- ### 4. Run the engine
99
- Run the `update.sh` of the engine determined in 3a — the **discovered module
100
- dir** for a modular project (whatever its name), or the just-created
101
- `<umbrella>/sync` for the legacy bootstrap path:
102
-
103
- ```
104
- bash <engine-module>/scripts/update.sh --yes # omit --yes to confirm the diff
105
- ```
106
- Capture stdout; find the last `IS_STATUS=<code> [IS_DETAIL=...]` line.
107
-
108
- ### 5. Branch on `IS_STATUS`
109
-
110
- | Code | Meaning | Action |
111
- |---|---|---|
112
- | `ok` | Already current | Go to step 6. |
113
- | `migrated` | Migration chain applied | Go to step 6; note the relocation/changes. |
114
- | `aborted-incomplete` | Staged module incomplete; legacy intact (safe) | Re-run step 2–4 once (clone hiccup). Persists → show output, stop, don't hand-fix. |
115
- | `ahead-of-engine` | Project schema newer than this engine | Do **not** downgrade. Point `REPO_URL` at the correct/newer upstream, or accept it's already ahead. Stop. |
116
- | `needs-update` | Pending breaking changes (sync refused) | Expected pre-migration; proceed — `update.sh` is the migrator. If it persists *after* update, investigate. |
117
- | `config-missing` | No `config.yaml` | Not bootstrapped — direct user to `<umbrella>/sync/INIT.md`. Stop. |
118
- | `error` | Engine couldn't proceed | Show message; check `REPO_URL`. Stop. |
119
- | *(no status)* | Engine crashed before contract | Show full output; don't modify the tree. Stop. |
120
-
121
- On any failure code, first re-read the upstream `CHANGELOG.md` entries for `current < release <= engine` (esp. `### Breaking`) — the breaking change usually explains the error and what the user must do — before retrying or escalating.
122
-
123
- Genuinely **ambiguous** tree (e.g. both a legacy flat `<umbrella>/scripts/`
124
- and a populated module, no clear `sync_version`): inspect both,
125
- summarize the difference, ask the user which is authoritative, apply their
126
- choice. Never guess.
127
-
128
- ### 6. Verify (always, after `ok`/`migrated`)
129
-
130
- Structural — always:
131
- - No `intelligence-*` directory directly under `<umbrella>/skills/`
132
- (meta-skills live only in the module's `skills/`).
133
- - Project content intact: `<umbrella>/{rules,agents}/` and any
134
- non-`intelligence-` skills untouched.
135
- - `config.yaml` has `sync_version` equal to the engine
136
- `scripts/VERSION`, and `sources.skills` includes the module skills path
137
- exactly once.
138
-
139
- Changelog-driven — per release crossed:
140
- - For each **`### Breaking`** item in the crossed range, verify its stated
141
- post-condition actually holds (e.g. a removed/renamed file is gone, a
142
- config-schema change is reflected). If a breaking item has no verifiable
143
- post-condition, state that you could not auto-verify it.
144
-
145
- Then regenerate IDE outputs:
146
- ```
147
- bash <umbrella>/sync/scripts/sync.sh
148
- ```
149
- Relay any model-drift report. Finally summarize: versions before→after, the
150
- breaking changes applied, verification result, anything the user must act on.
151
- Clean up the temp clone.
152
-
153
- ## Notes
154
-
155
- - Everything is **idempotent**. Re-running on a current project is a safe
156
- no-op (`IS_STATUS=ok`).
157
- - Correctness rests on the engine's idempotent structural preconditions, not
158
- on the version stamp — a missing/wrong `sync_version` cannot
159
- cause a needed migration to be skipped; it only weakens the
160
- `ahead-of-engine` guard until re-stamped.
161
- - Never touch `config.yaml` beyond what the engine does (the idempotent
162
- `sources.skills` line and the `sync_version` key). Never
163
- move/delete project skills, rules, or agents.
164
- - Sibling modules beside the engine module are independent — only operate on
165
- the discovered engine module.
File without changes
File without changes
File without changes
File without changes
File without changes