@ainova-systems/intelligence 0.11.0-rc.7 → 0.11.0-rc.9
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.
- package/README.md +19 -16
- package/cli/commands/adapter.sh +153 -0
- package/cli/commands/init.sh +113 -22
- package/cli/commands/package.sh +30 -0
- package/cli/commands/registry.sh +4 -2
- package/cli/commands/status.sh +12 -4
- package/cli/commands/sync.sh +7 -20
- package/cli/commands/update.sh +76 -70
- package/cli/engine-package.yaml +2 -2
- package/cli/intelligence +10 -12
- package/cli/{commands/doctor.sh → internal/check.sh} +30 -23
- package/cli/{commands/migrate.sh → internal/migrate-v1.sh} +117 -30
- package/cli/{commands/add.sh → internal/package-add.sh} +11 -16
- package/cli/{commands/list.sh → internal/package-list.sh} +9 -4
- package/cli/{commands/remove.sh → internal/package-remove.sh} +3 -3
- package/cli/{commands/search.sh → internal/package-search.sh} +4 -4
- package/cli/internal/package-update.sh +103 -0
- package/cli/{commands/install.sh → internal/restore.sh} +7 -18
- package/cli/internal/target-state.sh +57 -0
- package/cli/internal/upgrade-v2.sh +133 -0
- package/cli/lib/cli-common.sh +142 -12
- package/cli/lib/lockfile.sh +1 -1
- package/cli/lib/manifest.sh +109 -0
- package/cli/lib/registry.sh +4 -4
- package/engine/ENGINE_SHA +1 -1
- package/engine/adapters/_template.sh +10 -9
- package/engine/adapters/agents.sh +11 -11
- package/engine/adapters/opencode.sh +1 -1
- package/engine/lib/common.sh +14 -22
- package/engine/lib/contract.sh +14 -14
- package/engine/sync.sh +25 -20
- package/package.json +1 -1
- package/packages/sync/agents/intelligence-architect.md +5 -3
- package/packages/sync/agents/intelligence-operator.md +10 -13
- package/packages/sync/references/adapters.md +252 -0
- package/packages/sync/references/conventions.md +385 -0
- package/packages/sync/rules/intelligence-authoring.md +6 -6
- package/packages/sync/skills/intelligence-add-agent/SKILL.md +5 -5
- package/packages/sync/skills/intelligence-add-rule/SKILL.md +3 -3
- package/packages/sync/skills/intelligence-add-skill/SKILL.md +3 -3
- package/packages/sync/skills/intelligence-extract-skill/SKILL.md +2 -2
- package/packages/sync/skills/intelligence-install-adapter/SKILL.md +29 -22
- package/packages/sync/skills/intelligence-learn-from-context/SKILL.md +3 -3
- package/packages/sync/skills/intelligence-learn-from-repository/SKILL.md +55 -0
- package/packages/sync/skills/intelligence-review-skills/SKILL.md +6 -6
- package/packages/sync/skills/intelligence-sync/SKILL.md +13 -9
- package/packages/sync/skills/intelligence-uninstall-adapter/SKILL.md +19 -37
- package/packages/sync/skills/intelligence-update/SKILL.md +34 -156
- package/cli/commands/upgrade.sh +0 -68
- package/packages/sync/docs/ADAPTERS.md +0 -214
- package/packages/sync/docs/CONVENTIONS.md +0 -456
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intelligence-learn-from-repository
|
|
3
|
+
description: "Tailor Intelligence to an initialized repository"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Learn from Repository
|
|
7
|
+
|
|
8
|
+
Use after `intelligence init` creates or converts a project. The CLI owns the
|
|
9
|
+
mechanical setup; this skill adds only repository-specific judgement.
|
|
10
|
+
|
|
11
|
+
## Analyze
|
|
12
|
+
|
|
13
|
+
1. Run `intelligence status --check`. If setup is missing or incomplete, stop
|
|
14
|
+
and ask the user to run `intelligence init`; do not reproduce CLI mechanics.
|
|
15
|
+
2. Read `<manifest>` and resolve `<content-dir>` and the configured source
|
|
16
|
+
directories. Load `<module>/references/conventions.md` and the bundled
|
|
17
|
+
`intelligence-add-rule`, `intelligence-add-skill`, and
|
|
18
|
+
`intelligence-add-agent` skills before proposing authored content.
|
|
19
|
+
3. Inspect repository evidence: its README and contributor instructions,
|
|
20
|
+
language and package manifests, build and test entry points, source layout,
|
|
21
|
+
CI, existing agent instructions, and existing project-owned rules, agents,
|
|
22
|
+
and skills. Treat documentation as a claim and verify important behavior in
|
|
23
|
+
code or executable configuration.
|
|
24
|
+
4. Inventory what initialization already preserved or installed. Do not
|
|
25
|
+
recreate package-owned content, duplicate existing instructions, or convert
|
|
26
|
+
generated target output into source content.
|
|
27
|
+
5. Propose the smallest useful project-owned layer. Prefer updating an existing
|
|
28
|
+
artifact over creating a sibling. Each proposal must state:
|
|
29
|
+
- `CREATE`, `UPDATE`, or `KEEP`;
|
|
30
|
+
- the source path;
|
|
31
|
+
- the repository evidence supporting it;
|
|
32
|
+
- the concise content or responsibility it would add.
|
|
33
|
+
|
|
34
|
+
Analysis is read-only. Present the proposal and request approval per change.
|
|
35
|
+
It is valid to recommend no new artifacts when the repository already explains
|
|
36
|
+
itself well.
|
|
37
|
+
|
|
38
|
+
## Apply after approval
|
|
39
|
+
|
|
40
|
+
6. Apply only accepted proposals. Delegate new artifacts to
|
|
41
|
+
`intelligence-add-rule`, `intelligence-add-skill`, or
|
|
42
|
+
`intelligence-add-agent`; update an existing project-owned artifact directly
|
|
43
|
+
when that is the smaller change. Never edit installed package content or
|
|
44
|
+
generated tool output.
|
|
45
|
+
7. Run `intelligence sync`, then `intelligence status --check`. Completion
|
|
46
|
+
requires `IS_STATUS=ok` and a clean consistency check.
|
|
47
|
+
8. Report what was created, updated, or deliberately left unchanged. Remind the
|
|
48
|
+
user to review and commit generated and source changes according to project
|
|
49
|
+
policy.
|
|
50
|
+
|
|
51
|
+
## Related skill
|
|
52
|
+
|
|
53
|
+
Use `intelligence-learn-from-context` later to preserve a lesson learned during
|
|
54
|
+
a working session. This skill learns the repository's existing structure and
|
|
55
|
+
workflow during onboarding.
|
|
@@ -9,15 +9,15 @@ agent: intelligence-architect
|
|
|
9
9
|
|
|
10
10
|
Read-only audit of the project's rules, agents and skills, ending in a punch-list. This skill owns the **generic** audit — everything true of any repository. A project that adds laws of its own layers a thin project audit on top and invokes this one; it never re-implements these checks.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
The name uses "skills" as shorthand for all AI artifacts (rules, agents, and skills).
|
|
13
13
|
|
|
14
14
|
## Scope: what to read, and what to leave alone
|
|
15
15
|
|
|
16
|
-
1. **Resolve the layout — never assume folder names.** `<
|
|
16
|
+
1. **Resolve the layout — never assume folder names.** `<content-dir>/` is the project content directory, `<module>/` the installed sync package, `<manifest>` the root manifest — all localized to this project at sync time. Read authoring conventions from `<module>/references/conventions.md` and the `intelligence-authoring` rule.
|
|
17
17
|
|
|
18
|
-
2. **Enumerate from `<manifest>`, not from a guessed path.** The artifacts are exactly the directories listed under `sources.rules`, `sources.agents` and `sources.skills` — there may be several groups
|
|
18
|
+
2. **Enumerate from `<manifest>`, not from a guessed path.** The artifacts are exactly the directories listed under `sources.rules`, `sources.agents` and `sources.skills` — there may be several groups, they may be nested, and installed packages live under `.intelligence/packages/`. Take the list from the manifest; a literal `intelligence/rules/` is wrong in any project that named things differently.
|
|
19
19
|
|
|
20
|
-
3. **Skip
|
|
20
|
+
3. **Skip installed package sources.** Sources under `<module>/` (`<module>/rules`, `<module>/agents`, `<module>/skills/intelligence-*`) are package-owned and restored by CLI lifecycle operations, so a local "fix" is not durable. Never propose a project-local edit to them. If one is wrong, make an upstream proposal instead.
|
|
21
21
|
|
|
22
22
|
4. **Never read or edit generated output** (`.claude/`, `.cursor/`, `.github/`, `.codex/`, `.agents/`, `.pi/`, `.opencode/`, `AGENTS.md`). Sync owns those entirely; the finding always belongs to the source.
|
|
23
23
|
|
|
@@ -36,9 +36,9 @@ Name reflects the umbrella usage of "skills" for all AI artifacts (rules + agent
|
|
|
36
36
|
| **Machine facts in a rule** | OS, shell, editor or a local absolute path (`R2`) | `MOVE` — these belong in a personal, gitignored `CLAUDE.md`; a rule is committed and read by everyone, including whoever is on another platform |
|
|
37
37
|
| **Literal path or command in a skill** | A path *outside the skill's own folder* baked into a procedure (`R3`) | `PARAMETERIZE` — a skill is *executed*, so a literal path breaks the moment the layout moves; resolve it from a rule or from `<manifest>`. **Exempt:** the skill's own bundle (`references/`, `scripts/`, `assets/` — content is co-located with its skill by default); rules and agents (describing the repository is their job); an example inside an output-format block; the resolution step itself |
|
|
38
38
|
| **Skill with no verification** | Nothing at the end proves the procedure worked (`R4`) | `FLAG` — a procedure that proves nothing is a note, or just the work: give it a verification, or delete it |
|
|
39
|
-
| **Reserved prefix** | A project artifact named `intelligence-*` | `RENAME` — the prefix belongs to the
|
|
39
|
+
| **Reserved prefix** | A project artifact named `intelligence-*` | `RENAME` — the prefix belongs to the sync package and collides in generated output |
|
|
40
40
|
| **Naming** | A skill that is not `<domain>-<verb>-<noun>`, or a domain invented rather than reused | `RENAME` — or introduce the new domain deliberately |
|
|
41
|
-
| **Stale** | No edits in 6+ months and nothing cross-references it | `ARCHIVE` — move to `<
|
|
41
|
+
| **Stale** | No edits in 6+ months and nothing cross-references it | `ARCHIVE` — move to `<content-dir>/_archive/` |
|
|
42
42
|
| **Negative-framed judgement call** | "Never do X" where a positive default fits, outside safety / security / output-format | `REWRITE` — state the default; reserve NEVER for true must-nots |
|
|
43
43
|
| **Unbacked reason** | A rule asserts a *why* — a number, a measurement, a tool's behaviour — that nothing in the repo or in that tool's documentation supports | `FLAG` — an invented reason is worse than none: it sounds like evidence. Surface it with a draft; never rewrite the meaning yourself |
|
|
44
44
|
| **Always-on rule that should be scoped** | A concern that only matters in one area, loaded into every session and inlined into `AGENTS.md` | `SCOPE` — add `paths:`, or justify the cost out loud |
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: intelligence-sync
|
|
3
|
-
description: "Sync intelligence to enabled
|
|
3
|
+
description: "Sync intelligence to enabled adapters"
|
|
4
4
|
agent: intelligence-operator
|
|
5
5
|
context: fork
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Sync intelligence
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
3.
|
|
10
|
+
1. Run `intelligence sync` (or `intelligence sync <adapter>` when one adapter
|
|
11
|
+
was requested). For v2, this command first aligns project schema/content
|
|
12
|
+
with the installed CLI and restores a missing package store strictly from
|
|
13
|
+
`intelligence.lock`.
|
|
14
|
+
2. Require final `IS_STATUS=ok`; relay per-adapter counts and any model-drift
|
|
15
|
+
or unsynced-source warnings.
|
|
16
|
+
3. In CI, a required tracked project upgrade is intentionally refused. Report
|
|
17
|
+
the instruction to run `intelligence init --apply` locally, review and
|
|
18
|
+
commit its diff; never bypass the gate. A frozen restore refusal means the
|
|
19
|
+
manifest and lock disagree or a pinned ref moved—report it without
|
|
20
|
+
hand-copying package content.
|
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: intelligence-uninstall-adapter
|
|
3
|
-
description: "Disable
|
|
4
|
-
argument-hint: <
|
|
3
|
+
description: "Disable an adapter and assess its generated output"
|
|
4
|
+
argument-hint: <adapter-name>
|
|
5
5
|
agent: intelligence-operator
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Uninstall
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| `opencode` | `.opencode/agents/`, and only the files in `.opencode/commands/` carrying the `<!-- Generated by intelligence-sync. Do not edit manually. -->` marker | `.opencode/opencode.json`, hand-authored commands |
|
|
26
|
-
| `agents` | `AGENTS.md` — only if the user confirms; it is a committed project doc | — |
|
|
27
|
-
|
|
28
|
-
`.agents/skills/` is **shared** by `codex`, `pi` and `opencode`. Remove it only when none of those three remains enabled.
|
|
29
|
-
|
|
30
|
-
For an adapter not in this table (a project adapter under `<umbrella>/adapters/`), read its `sync_to_<name>()` cleanup block: whatever it deletes on every re-sync is exactly what it owns.
|
|
31
|
-
|
|
32
|
-
3. Remove the adapter's paths from `.gitignore` if nothing else needs them.
|
|
33
|
-
|
|
34
|
-
4. Run `/intelligence-sync` to regenerate the remaining targets.
|
|
35
|
-
|
|
36
|
-
5. **Verify** — an uninstall that removed the wrong thing must not pass quietly:
|
|
37
|
-
- sync reports `IS_STATUS=ok`;
|
|
38
|
-
- every path listed under *Remove* for this target is gone;
|
|
39
|
-
- every path listed under *Keep* still exists, with its content intact (`.github/workflows/`, `.claude/settings.json`, `.opencode/opencode.json`, hand-authored commands);
|
|
40
|
-
- the other enabled targets still produce their output.
|
|
41
|
-
|
|
42
|
-
6. Report: adapter disabled, which paths were removed, which were deliberately kept, and the verification result.
|
|
8
|
+
# Uninstall an adapter
|
|
9
|
+
|
|
10
|
+
1. Run `intelligence adapter list`, then
|
|
11
|
+
`intelligence adapter disable $ARGUMENTS`. Disabling changes target state
|
|
12
|
+
and deliberately keeps generated output.
|
|
13
|
+
2. If generated files should also be removed, inspect the adapter's cleanup
|
|
14
|
+
block to identify exactly what it owns. Show that list and obtain approval
|
|
15
|
+
before deleting it; never delete a shared output root.
|
|
16
|
+
3. For a project adapter that should be deleted, run
|
|
17
|
+
`intelligence adapter remove $ARGUMENTS` after it is disabled. This prompts
|
|
18
|
+
by default (`--apply` is the explicit non-interactive form) and also keeps
|
|
19
|
+
generated output. Built-in adapter source cannot be removed.
|
|
20
|
+
4. Remove obsolete `.gitignore` entries only when no remaining adapter needs
|
|
21
|
+
them. Sync the remaining enabled adapters when any exist.
|
|
22
|
+
5. Verify with `intelligence adapter list` and `intelligence status --check`:
|
|
23
|
+
the adapter is disabled or removed as requested, retained files are intact,
|
|
24
|
+
and only approved adapter-owned output was deleted.
|
|
@@ -1,165 +1,43 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: intelligence-update
|
|
3
|
-
description: "
|
|
4
|
-
argument-hint: "[
|
|
3
|
+
description: "Interpret an update plan and verify breaking post-conditions"
|
|
4
|
+
argument-hint: "[@scope/name]"
|
|
5
5
|
agent: intelligence-operator
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Update intelligence
|
|
8
|
+
# Update intelligence
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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.
|
|
10
|
+
The CLI owns planning and application. This skill interprets the plan, reads
|
|
11
|
+
the changelog across an engine-version gap, obtains approval, and verifies the
|
|
12
|
+
result.
|
|
35
13
|
|
|
36
14
|
## Steps
|
|
37
15
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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.
|
|
16
|
+
1. Run `intelligence update --preview` (or
|
|
17
|
+
`intelligence update $ARGUMENTS --preview` for one named package). Use its
|
|
18
|
+
CLI, project, and package sections as the complete plan; do not re-resolve
|
|
19
|
+
versions independently.
|
|
20
|
+
|
|
21
|
+
2. If the CLI or project engine version would change, read the authoritative
|
|
22
|
+
`CHANGELOG.md` at `https://github.com/ainova-systems/intelligence` for every
|
|
23
|
+
release in **`current < release <= target`**. If it is unavailable, stop
|
|
24
|
+
before changing versions. Turn every crossed `### Breaking` item into a
|
|
25
|
+
post-condition to verify.
|
|
26
|
+
|
|
27
|
+
3. Show the plan and breaking checklist to the user. The command without a
|
|
28
|
+
mode also shows the plan and prompts; after approval, use `--apply` for an
|
|
29
|
+
unambiguous non-interactive execution.
|
|
30
|
+
|
|
31
|
+
4. If the plan reports a newer global CLI, run exactly the npm command it
|
|
32
|
+
prints after approval, then rerun `intelligence update --preview` with the
|
|
33
|
+
new executable. Apply the resulting plan with `intelligence update --apply`,
|
|
34
|
+
or `intelligence update $ARGUMENTS --apply` when one package was requested.
|
|
35
|
+
|
|
36
|
+
5. An applied update that renders must finish with `IS_STATUS=ok`; preserve and
|
|
37
|
+
stop on any other status. Then run `intelligence status --check`. Do not run
|
|
38
|
+
a duplicate sync after `update --apply`. Verify every crossed breaking
|
|
39
|
+
post-condition directly and report any item that cannot be machine-verified.
|
|
40
|
+
|
|
41
|
+
Report versions before and after, the applied plan, post-condition results,
|
|
42
|
+
and any remaining action. On a refusal, preserve the full error and stop
|
|
43
|
+
instead of invoking hidden lifecycle operations.
|
package/cli/commands/upgrade.sh
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# intelligence upgrade — bring the project to this CLI's engine: apply v2
|
|
3
|
-
# schema migrations, align the engine-content package to the bundled version,
|
|
4
|
-
# restamp sync_version, sync.
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
source "$CLI_DIR/lib/cli-common.sh"
|
|
7
|
-
|
|
8
|
-
require_v2
|
|
9
|
-
manifest="$IP_ROOT/intelligence.yaml"
|
|
10
|
-
|
|
11
|
-
stamp="$(read_engine_stamp "$manifest")"
|
|
12
|
-
eng="$(bundled_engine_version)"
|
|
13
|
-
if [ -n "$stamp" ] && _ver_gt "$stamp" "$eng"; then
|
|
14
|
-
die "manifest schema $stamp is newer than this CLI's engine $eng — update the CLI first: npm i -g @ainova-systems/intelligence@latest"
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
# --- v2 schema migrations -------------------------------------------------
|
|
18
|
-
# The engine's own chain owns vendored layouts; this one owns the manifest.
|
|
19
|
-
# Same discipline: ascending, append-only, each migration self-detects and
|
|
20
|
-
# no-ops when already applied.
|
|
21
|
-
|
|
22
|
-
# v2 migration 1: staged engine content -> the @ainova-systems/sync package.
|
|
23
|
-
# Pre-package manifests listed `.intelligence/engine/{rules,agents,skills}`
|
|
24
|
-
# as sources fed by a CLI-staged copy; that copy is now an ordinary package
|
|
25
|
-
# entry seeded from the bundle. Post-condition: no `.intelligence/engine`
|
|
26
|
-
# source entries, the package present in manifest+lock+store, stale dir gone.
|
|
27
|
-
migrated=0
|
|
28
|
-
for section in rules agents skills; do
|
|
29
|
-
while IFS= read -r src; do
|
|
30
|
-
case "$src" in
|
|
31
|
-
.intelligence/engine/*)
|
|
32
|
-
sources_remove_entry "$manifest" "$section" "$src"
|
|
33
|
-
migrated=1
|
|
34
|
-
;;
|
|
35
|
-
esac
|
|
36
|
-
done < <(read_yaml_list "$manifest" "$section")
|
|
37
|
-
done
|
|
38
|
-
if [ "$migrated" -eq 1 ]; then
|
|
39
|
-
echo " migrating: staged engine content -> $SYNC_PKG_NAME package"
|
|
40
|
-
rm -rf "$IP_ROOT/.intelligence/engine"
|
|
41
|
-
sync_pkg_entry "$manifest"
|
|
42
|
-
sync_pkg_install "$IP_ROOT"
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# --- steady state ---------------------------------------------------------
|
|
46
|
-
# Align the engine-content package with the bundled engine. Only a manifest
|
|
47
|
-
# that HAS the entry is touched — a --bare project opted out, and upgrade
|
|
48
|
-
# respects that.
|
|
49
|
-
have_pkg=0
|
|
50
|
-
while IFS= read -r name; do
|
|
51
|
-
[ "$name" = "$SYNC_PKG_NAME" ] && have_pkg=1
|
|
52
|
-
done < <(qmap_keys "$manifest" "packages")
|
|
53
|
-
if [ "$have_pkg" -eq 1 ] && [ "$migrated" -eq 0 ]; then
|
|
54
|
-
pinned="$(qmap_field "$manifest" "packages" "$SYNC_PKG_NAME" "version")"
|
|
55
|
-
if [ "$pinned" != "$eng" ]; then
|
|
56
|
-
echo " $SYNC_PKG_NAME: $pinned -> $eng"
|
|
57
|
-
fi
|
|
58
|
-
sync_pkg_entry "$manifest"
|
|
59
|
-
sync_pkg_install "$IP_ROOT"
|
|
60
|
-
fi
|
|
61
|
-
if [ "$have_pkg" -eq 0 ] && [ "$migrated" -eq 0 ]; then
|
|
62
|
-
echo " NOTE: $SYNC_PKG_NAME is not in this manifest (bare setup) — engine meta-skills stay uninstalled; 'intelligence add $SYNC_PKG_NAME' opts back in." >&2
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
stamp_version "$manifest" "$eng"
|
|
66
|
-
echo " sync_version -> $eng"
|
|
67
|
-
|
|
68
|
-
exec bash "$CLI_DIR/commands/sync.sh"
|