@ainova-systems/intelligence 0.11.0-rc.6 → 0.11.0-rc.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.
- package/README.md +2 -2
- package/cli/commands/add.sh +8 -7
- package/cli/commands/install.sh +8 -1
- package/cli/commands/migrate.sh +49 -19
- package/cli/commands/registry.sh +1 -0
- package/cli/commands/sync.sh +1 -1
- package/cli/commands/update.sh +12 -3
- package/cli/engine-package.yaml +2 -2
- package/cli/intelligence +27 -15
- package/cli/lib/cli-common.sh +34 -7
- package/cli/lib/lockfile.sh +14 -8
- package/cli/lib/manifest.sh +20 -1
- package/cli/lib/registry.sh +25 -11
- package/cli/lib/semver.sh +4 -2
- package/engine/ENGINE_SHA +1 -0
- package/engine/{scripts/adapters → adapters}/agents.sh +10 -15
- package/engine/{scripts/lib → lib}/common.sh +15 -519
- package/engine/lib/contract.sh +120 -0
- package/engine/sync.sh +233 -0
- package/package.json +6 -5
- package/engine/INIT.md +0 -500
- package/engine/docs/CLI.md +0 -90
- package/engine/scripts/ENGINE_SHA +0 -1
- package/engine/scripts/lib/layout.sh +0 -51
- package/engine/scripts/lib/migrations.sh +0 -708
- package/engine/scripts/sync.sh +0 -311
- package/engine/scripts/update.sh +0 -237
- /package/engine/{scripts/VERSION → VERSION} +0 -0
- /package/engine/{scripts/adapters → adapters}/_template.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/claude.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/codex.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/copilot.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/cursor.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/opencode.sh +0 -0
- /package/engine/{scripts/adapters → adapters}/pi.sh +0 -0
- /package/{engine → packages/sync}/agents/intelligence-architect.md +0 -0
- /package/{engine → packages/sync}/agents/intelligence-operator.md +0 -0
- /package/{engine → packages/sync}/docs/ADAPTERS.md +0 -0
- /package/{engine → packages/sync}/docs/CONVENTIONS.md +0 -0
- /package/{engine → packages/sync}/rules/intelligence-authoring.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-add-agent/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-add-rule/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-add-skill/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-extract-skill/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-install-adapter/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-learn-from-context/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-review-skills/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-sync/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-uninstall-adapter/SKILL.md +0 -0
- /package/{engine → packages/sync}/skills/intelligence-update/SKILL.md +0 -0
package/engine/INIT.md
DELETED
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
# intelligence-sync: Initialize Your Project
|
|
2
|
-
|
|
3
|
-
The sync engine is already installed in this directory's `scripts/` subfolder. Your job: analyze this codebase, ask the user targeted questions, and generate the project-specific configuration and content.
|
|
4
|
-
|
|
5
|
-
> **The intelligence CLI is the recommended setup for new projects.** If `intelligence --version` works on this machine (or `npm i -g @ainova-systems/intelligence` is acceptable), prefer `intelligence init` + `intelligence add <package>` over this document — it automates what this bootstrap does by hand and adds versioned packages with a lockfile (see `docs/CLI.md`). This document remains the authoritative bootstrap for the **vendored** setup, which stays fully supported; a vendored project can convert later with `intelligence migrate`.
|
|
6
|
-
|
|
7
|
-
**Execute phases sequentially. Do not skip or combine phases. Each phase has a gate — wait for it before proceeding.**
|
|
8
|
-
|
|
9
|
-
## Bootstrap: install the engine if it isn't here yet
|
|
10
|
-
|
|
11
|
-
You can reach this file two ways:
|
|
12
|
-
|
|
13
|
-
- **Already vendored in the project** (`intelligence/sync/INIT.md`) — the engine is installed. Skip straight to *Phase 0* below.
|
|
14
|
-
- **Fetched remotely** (a raw GitHub URL) — the engine is **not** installed yet. Install it first, then continue:
|
|
15
|
-
|
|
16
|
-
1. Check whether `intelligence/sync/scripts/sync.sh` exists at the project root. If it does, the engine is already installed — skip the rest of this section.
|
|
17
|
-
2. If it does not, clone upstream into a temp directory and copy the `intelligence/` folder into the project root (never clone into the project tree itself). Adapt the temp path to the platform:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
tmp="$(mktemp -d)"
|
|
21
|
-
git clone --depth=1 https://github.com/ainova-systems/intelligence-sync.git "$tmp"
|
|
22
|
-
cp -r "$tmp/intelligence" ./intelligence
|
|
23
|
-
rm -rf "$tmp"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
If the project already has an umbrella folder holding a `config.yaml` under a different name (see *Phase 0*), copy the `sync/` module into that existing folder instead of creating a second `intelligence/`.
|
|
27
|
-
3. From here on, work against the freshly copied, version-matched `intelligence/sync/INIT.md` and the rest of this document — that copy is authoritative.
|
|
28
|
-
|
|
29
|
-
## Phase 0: detect the source folder name
|
|
30
|
-
|
|
31
|
-
This document is read by an AI agent and contains many literal references to `intelligence/` (lowercase). The folder you are reading from may have been **renamed** by the user (e.g. `Intelligence/`, `prompts/`, a project codename). Before doing anything else:
|
|
32
|
-
|
|
33
|
-
1. Identify the directory that contains this `INIT.md` and a `scripts/sync.sh` file. Call its basename `<intel>`.
|
|
34
|
-
2. Throughout the rest of this document, every reference to `intelligence/` means `<intel>/` — substitute it consistently in every path you write (`config.yaml` `sources:`, `targets.agents.header` Markdown links, generated content, skill instructions).
|
|
35
|
-
3. Do NOT create a second folder named `intelligence/` if `<intel>` is already different. The sync engine is folder-name-agnostic — `bash <intel>/sync/scripts/sync.sh` works regardless of casing or naming.
|
|
36
|
-
|
|
37
|
-
If the user has not renamed it, `<intel>` is `intelligence` and the literal text below applies as-is.
|
|
38
|
-
|
|
39
|
-
## What You Will Generate
|
|
40
|
-
|
|
41
|
-
1. `intelligence/config.yaml` -- sync configuration
|
|
42
|
-
2. `intelligence/rules/` -- coding standards and conventions
|
|
43
|
-
3. `intelligence/agents/` -- specialized AI personas
|
|
44
|
-
4. `intelligence/skills/` -- reusable command sequences
|
|
45
|
-
5. `AGENTS.md` -- project documentation for LLMs (committed)
|
|
46
|
-
6. `CLAUDE.md` -- local user preferences (gitignored, if Claude enabled)
|
|
47
|
-
7. `.gitignore` updates
|
|
48
|
-
|
|
49
|
-
## Pre-check
|
|
50
|
-
|
|
51
|
-
Before starting, verify:
|
|
52
|
-
|
|
53
|
-
1. `intelligence/sync/scripts/sync.sh` exists
|
|
54
|
-
2. `intelligence/sync/scripts/lib/common.sh` exists
|
|
55
|
-
3. `intelligence/sync/scripts/adapters/claude.sh` exists
|
|
56
|
-
4. Check initialization state:
|
|
57
|
-
- **Already initialized** = `intelligence/config.yaml` exists AND `intelligence/rules/` contains at least one `.md` file
|
|
58
|
-
- **Partially initialized** = either exists but not both
|
|
59
|
-
- **Fresh** = neither exists
|
|
60
|
-
|
|
61
|
-
If files from steps 1-3 are missing, the engine isn't installed yet — go back to **Bootstrap** above and install it (clone upstream, copy `intelligence/` in), then re-run this Pre-check. Do not proceed to Phase 1 until they exist.
|
|
62
|
-
|
|
63
|
-
### Already initialized → offer sync-only path
|
|
64
|
-
|
|
65
|
-
If the project is **already initialized** (config + rules present), do NOT run the full bootstrap. Instead:
|
|
66
|
-
|
|
67
|
-
1. Check if local IDE output is missing or stale: for each enabled target in `config.yaml`, see whether the output path exists (e.g., `.claude/`, `.cursor/`, `AGENTS.md`). If any are missing, this is a new clone / new team member.
|
|
68
|
-
2. Tell the user: "This project is already initialized. I can just run `bash intelligence/sync/scripts/sync.sh` to generate your local IDE files from `intelligence/`."
|
|
69
|
-
3. Offer two options:
|
|
70
|
-
- **Sync** — run `intelligence/sync/scripts/sync.sh` and exit (do not touch rules/agents/skills/config)
|
|
71
|
-
- **Re-initialize** — wipe existing rules/agents/skills and regenerate (destructive; only if the user explicitly wants a fresh bootstrap)
|
|
72
|
-
4. Default to sync. Only proceed to Phase 1 if the user explicitly chooses re-initialize.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Phase 1: Discovery
|
|
77
|
-
|
|
78
|
-
Explore the codebase to detect:
|
|
79
|
-
|
|
80
|
-
**Language & Framework** (check for these markers):
|
|
81
|
-
|
|
82
|
-
| Marker files | Stack |
|
|
83
|
-
|---|---|
|
|
84
|
-
| `.sln`, `.csproj`, `global.json` | .NET / C# |
|
|
85
|
-
| `package.json` | Node.js -- inspect `dependencies` for framework: |
|
|
86
|
-
| -- `react`, `react-dom` | React |
|
|
87
|
-
| -- `next` | Next.js |
|
|
88
|
-
| -- `@angular/core` | Angular |
|
|
89
|
-
| -- `vue` | Vue |
|
|
90
|
-
| -- `svelte` | Svelte / SvelteKit |
|
|
91
|
-
| -- `nuxt` | Nuxt |
|
|
92
|
-
| -- `express`, `fastify`, `nestjs`, `hono` | Node.js backend |
|
|
93
|
-
| -- `electron` | Electron desktop app |
|
|
94
|
-
| -- `react-native`, `expo` | React Native mobile |
|
|
95
|
-
| `go.mod` | Go |
|
|
96
|
-
| `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile` | Python |
|
|
97
|
-
| -- `django` in deps | Django |
|
|
98
|
-
| -- `fastapi` in deps | FastAPI |
|
|
99
|
-
| -- `flask` in deps | Flask |
|
|
100
|
-
| `pom.xml` | Java (Maven) |
|
|
101
|
-
| `build.gradle`, `build.gradle.kts` | Java/Kotlin (Gradle) |
|
|
102
|
-
| `Cargo.toml` | Rust |
|
|
103
|
-
| `composer.json` | PHP |
|
|
104
|
-
| -- `laravel/framework` in deps | Laravel |
|
|
105
|
-
| `Gemfile` | Ruby |
|
|
106
|
-
| -- `rails` in deps | Ruby on Rails |
|
|
107
|
-
| `mix.exs` | Elixir / Phoenix |
|
|
108
|
-
| `pubspec.yaml` | Dart / Flutter |
|
|
109
|
-
| `Package.swift` | Swift |
|
|
110
|
-
| `*.xcodeproj`, `*.xcworkspace` | iOS / macOS (Xcode) |
|
|
111
|
-
| `CMakeLists.txt`, `Makefile` (with `.c`/`.cpp`) | C / C++ |
|
|
112
|
-
| `terraform/`, `*.tf` | Terraform (IaC) |
|
|
113
|
-
| `pulumi/`, `Pulumi.yaml` | Pulumi (IaC) |
|
|
114
|
-
| `helm/`, `Chart.yaml` | Helm charts |
|
|
115
|
-
| `docker-compose.yml`, `compose.yaml` | Docker Compose |
|
|
116
|
-
| `serverless.yml` | Serverless Framework |
|
|
117
|
-
| `deno.json`, `deno.jsonc` | Deno |
|
|
118
|
-
| `bun.lockb`, `bunfig.toml` | Bun |
|
|
119
|
-
|
|
120
|
-
**Project Components** -- identify what this project actually is:
|
|
121
|
-
|
|
122
|
-
Scan the directory tree and determine which components exist. A project may have one or several:
|
|
123
|
-
- Backend API, frontend app, BFF layer
|
|
124
|
-
- Infrastructure / deployment configs
|
|
125
|
-
- Shared libraries, CLI tools, workers
|
|
126
|
-
- Mobile app, documentation site
|
|
127
|
-
- Git submodules (check `.gitmodules`)
|
|
128
|
-
- Workspace tooling (`pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `turbo.json`)
|
|
129
|
-
|
|
130
|
-
Describe what you find naturally: "This is a .NET 8 API with a React frontend and Terraform infrastructure" -- not abstract labels.
|
|
131
|
-
|
|
132
|
-
**Build & Test:**
|
|
133
|
-
- Build tools: Makefile, Dockerfile, docker-compose, Taskfile.yml, justfile
|
|
134
|
-
- CI: `.github/workflows/`, `.gitlab-ci.yml`, `.circleci/`, `Jenkinsfile`
|
|
135
|
-
- Test frameworks, linters, formatters, package managers
|
|
136
|
-
|
|
137
|
-
**Existing AI Prompt Infrastructure** (CRITICAL -- check all):
|
|
138
|
-
- `AGENTS.md`, `CLAUDE.md`, `.cursorrules`
|
|
139
|
-
- `.github/copilot-instructions.md`
|
|
140
|
-
- `.claude/` directory (rules, agents, skills)
|
|
141
|
-
- `.cursor/` directory (rules, agents)
|
|
142
|
-
- `.pi/` directory (`settings.json`, `extensions/`, `prompts/`)
|
|
143
|
-
- `.opencode/` directory (`opencode.json`, `agents/`)
|
|
144
|
-
- `.claude/settings.json`, `.claude/settings.local.json`
|
|
145
|
-
- Any sync scripts (`sync.sh`, `sync-to-claude.sh`, etc.)
|
|
146
|
-
- `.gitignore` entries for `.claude`, `.cursor`, `.pi`, `.opencode`, `CLAUDE.md`
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Phase 2: Present Recommended Setup
|
|
151
|
-
|
|
152
|
-
Present everything in ONE summary. The user confirms once.
|
|
153
|
-
|
|
154
|
-
Include these sections:
|
|
155
|
-
|
|
156
|
-
1. **Components detected**: list with paths
|
|
157
|
-
2. **Rules recommended**: N component rules + 1 shared context
|
|
158
|
-
3. **Targets to enable**:
|
|
159
|
-
- `agents` is **always enabled** by default — it generates `AGENTS.md` (committed project index consumed by many LLM tools).
|
|
160
|
-
- At least **one IDE adapter** must be enabled. Detect which by scanning for existing tool markers:
|
|
161
|
-
- `.claude/`, `CLAUDE.md`, `.claude/settings.json` -> recommend `claude`
|
|
162
|
-
- `.cursor/`, `.cursorrules` (legacy single-file Cursor format) -> recommend `cursor`
|
|
163
|
-
- `.github/copilot-instructions.md` (legacy Copilot single-file), `.github/instructions/` -> recommend `copilot`
|
|
164
|
-
- `.codex/`, `.agents/` -> recommend `codex`
|
|
165
|
-
- `.pi/`, `.pi/settings.json`, `.pi/extensions/`, `.pi/prompts/` -> recommend `pi`
|
|
166
|
-
- `.opencode/`, `.opencode/opencode.json`, `.opencode/agents/` -> recommend `opencode`
|
|
167
|
-
- If nothing detected, default to `claude` (most common).
|
|
168
|
-
- If the user explicitly names a tool, honor that instead.
|
|
169
|
-
- Present as: "I detected [existing configs]. I will enable: `agents` + `<detected IDE>`. Other adapters (Claude, Cursor, Copilot, Codex, Pi, opencode) can be added any time via `/intelligence-install-adapter`."
|
|
170
|
-
4. **Agents recommended**: list with tier/access
|
|
171
|
-
5. **Skills recommended**: pre-installed + migrated + new suggestions (see Phase 3.5)
|
|
172
|
-
6. **Conventions detected**: key patterns from codebase
|
|
173
|
-
7. **Submodules** (if found): recommend excluding
|
|
174
|
-
8. **Migration** (only if existing AI infrastructure found): conflict report with file counts:
|
|
175
|
-
```
|
|
176
|
-
WILL BE OVERWRITTEN: .claude/rules/ (N files), .cursor/rules/ (N files), etc.
|
|
177
|
-
WILL BE PRESERVED: .claude/settings.local.json, .claude/settings.json
|
|
178
|
-
NEEDS MIGRATION: CLAUDE.md, .cursorrules, existing skills/commands
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
End with:
|
|
182
|
-
|
|
183
|
-
> **Accept** to proceed (backup + migrate + generate), or **Cancel** to stop.
|
|
184
|
-
|
|
185
|
-
If **Cancel** -- stop completely. intelligence-sync cannot coexist with manually managed IDE prompts.
|
|
186
|
-
|
|
187
|
-
If **Accept** -- execute migration (if needed), then generate.
|
|
188
|
-
|
|
189
|
-
### Migration (only if existing AI infrastructure found)
|
|
190
|
-
|
|
191
|
-
1. **Backup:** Create `intelligence/_backup/`, move (not copy) all existing AI files. Add `intelligence/_backup/` to `.gitignore`.
|
|
192
|
-
2. **Migrate** to tool-agnostic format:
|
|
193
|
-
- `.claude/rules/*.md` -- copy as-is
|
|
194
|
-
- `.cursor/rules/*.mdc` -- rename `.md`, `globs:` -> `paths:`, remove `alwaysApply:`
|
|
195
|
-
- `.github/copilot-instructions.md`, `.cursorrules` -- split by topic
|
|
196
|
-
- `.claude/agents/*.md` -- reverse: `model:` -> `tier:`, remove IDE fields, add `access:`
|
|
197
|
-
- `.cursor/agents/*.md` -- reverse: `model: fast` -> `tier: standard`, `readonly:` -> `access:`
|
|
198
|
-
- `.claude/skills/*/SKILL.md`, `.cursor/skills/*/SKILL.md`, `.claude/commands/*.md`, `.cursor/commands/*.md` -- copy as skills
|
|
199
|
-
3. **Cleanup:** `git rm` tracked files, `rm` untracked. Remove empty directories.
|
|
200
|
-
4. **Post-migration validation** (CRITICAL -- do not skip):
|
|
201
|
-
- Build a list of the paths that were removed/renamed (e.g., `dev/scripts/`, `dev/prompts/`, `.cursorrules`, `.claude/rules/`, old directory names).
|
|
202
|
-
- Run `git ls-files` to enumerate every tracked file in the repository (no whitelist -- references to old paths live in `README.md`, scripts, config files, wikis, workflow YAML, not just `docs/`).
|
|
203
|
-
- For each tracked file, grep for each removed path. Record findings.
|
|
204
|
-
- For unambiguous replacements (e.g., `dev/scripts/sync-to-claude.sh` -> `intelligence/sync/scripts/sync.sh`), patch the file automatically.
|
|
205
|
-
- For ambiguous references (path removed without a clear successor, references inside narrative prose, references to scripts that no longer exist), print them to the user grouped by file with line numbers and ask how to resolve.
|
|
206
|
-
- Do not proceed to Phase 3 generation until stale references are resolved or explicitly deferred by the user.
|
|
207
|
-
|
|
208
|
-
### Files we NEVER touch
|
|
209
|
-
|
|
210
|
-
- `.claude/settings.local.json`, `.claude/settings.json`
|
|
211
|
-
- `.git/`
|
|
212
|
-
- Anything outside AI prompt scope
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## Phase 3: Generate
|
|
217
|
-
|
|
218
|
-
**Principles:**
|
|
219
|
-
1. **Adopt, don't impose.** Use the repo's existing directory names and casing conventions.
|
|
220
|
-
2. **Derive from code, not general knowledge.** Read actual source files. Extract real patterns, real commands, real examples. Every FORBIDDEN/REQUIRED rule must be backed by something you observed in the codebase. Do not generate generic best-practice rules.
|
|
221
|
-
3. **Agents must reflect reality.** Read existing implementations to determine expertise, architecture patterns, and build commands. If you cannot verify a pattern exists in the code, do not include it.
|
|
222
|
-
|
|
223
|
-
### 3.1 `intelligence/config.yaml`
|
|
224
|
-
|
|
225
|
-
Set `sync_version` to the engine version — read it verbatim from
|
|
226
|
-
`intelligence/sync/scripts/VERSION`. This is a **managed contract key**: emit
|
|
227
|
-
it on first bootstrap and **preserve its existing value if `config.yaml`
|
|
228
|
-
already has one** when re-bootstrapping (never drop or guess it — the update
|
|
229
|
-
flow owns its value).
|
|
230
|
-
|
|
231
|
-
```yaml
|
|
232
|
-
project:
|
|
233
|
-
name: "project-name"
|
|
234
|
-
|
|
235
|
-
# Managed by intelligence-sync — applied schema version. Do not hand-edit;
|
|
236
|
-
# preserve on re-bootstrap. (Value = intelligence/sync/scripts/VERSION.)
|
|
237
|
-
sync_version: "0.11.0"
|
|
238
|
-
|
|
239
|
-
sources:
|
|
240
|
-
rules:
|
|
241
|
-
- "intelligence/rules"
|
|
242
|
-
- "intelligence/sync/rules" # engine-owned: intelligence-authoring
|
|
243
|
-
agents:
|
|
244
|
-
- "intelligence/agents"
|
|
245
|
-
- "intelligence/sync/agents" # engine-owned: intelligence-architect, intelligence-operator
|
|
246
|
-
skills:
|
|
247
|
-
- "intelligence/skills"
|
|
248
|
-
- "intelligence/sync/skills" # engine-owned: intelligence-* meta-skills
|
|
249
|
-
|
|
250
|
-
targets:
|
|
251
|
-
# agents: ALWAYS enabled — generates committed AGENTS.md as the
|
|
252
|
-
# canonical project doc. Always-on rules (no `paths:`) are inlined
|
|
253
|
-
# automatically; path-scoped rules stay in tool-specific channels
|
|
254
|
-
# (.cursor/rules/, .github/instructions/) for monorepo scoping.
|
|
255
|
-
agents:
|
|
256
|
-
enabled: true
|
|
257
|
-
output: "AGENTS.md"
|
|
258
|
-
header: |
|
|
259
|
-
# <Project Name>
|
|
260
|
-
|
|
261
|
-
<one-line stack summary — e.g., ".NET 8 API + React 19 | Azure | Phase: MVP">
|
|
262
|
-
|
|
263
|
-
**Full context**: [`intelligence/rules/context.md`](intelligence/rules/context.md)
|
|
264
|
-
# At least one IDE adapter — pick based on detection or user preference
|
|
265
|
-
claude: { enabled: true, output: ".claude" }
|
|
266
|
-
# Optional adapters: cursor, copilot, codex, pi, opencode
|
|
267
|
-
# pi: { enabled: false, output: ".pi" }
|
|
268
|
-
# opencode: { enabled: false, output: ".opencode" }
|
|
269
|
-
|
|
270
|
-
ignore:
|
|
271
|
-
- "node_modules"
|
|
272
|
-
- "vendor"
|
|
273
|
-
- "dist"
|
|
274
|
-
|
|
275
|
-
# Optional: override per-IDE tier -> model mappings. Defaults live in
|
|
276
|
-
# intelligence/sync/scripts/lib/common.sh. Add only the entries you want to
|
|
277
|
-
# pin; everything else uses the current default.
|
|
278
|
-
# Example:
|
|
279
|
-
# models:
|
|
280
|
-
# copilot:
|
|
281
|
-
# heavy: "gpt-5.6-sol"
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
The `agents.header` block is the only hand-authored part of `AGENTS.md`. Everything else (tables for agents/skills, list of rules) is regenerated from frontmatter on every sync. Keep the header to 3–5 lines: project name, one-liner stack summary, link to `context.md`.
|
|
285
|
-
|
|
286
|
-
Engine scripts (under `intelligence/sync/scripts/`):
|
|
287
|
-
|
|
288
|
-
- `sync.sh` — generate IDE outputs from `intelligence/`
|
|
289
|
-
- `update.sh` — pull latest scripts/INIT.md from upstream without touching project content
|
|
290
|
-
- `lib/common.sh` — shared helpers (`get_model`, `lint_frontmatter`, frontmatter parsers, etc.)
|
|
291
|
-
|
|
292
|
-
Built-in adapters:
|
|
293
|
-
|
|
294
|
-
| Target | Adapter | Output | Notes |
|
|
295
|
-
|--------|---------|--------|-------|
|
|
296
|
-
| `agents` | `agents.sh` | `AGENTS.md` | Committed; canonical project doc with inlined always-on rules |
|
|
297
|
-
| `claude` | `claude.sh` | `.claude/` | Full rule copy (Claude does not read AGENTS.md) |
|
|
298
|
-
| `cursor` | `cursor.sh` | `.cursor/` | Path-scoped rules only (always-on come from AGENTS.md) |
|
|
299
|
-
| `copilot` | `copilot.sh` | `.github/` | Path-scoped rules only; shares dir with workflows |
|
|
300
|
-
| `codex` | `codex.sh` | `.agents/skills/` + `.codex/agents/` | Reads AGENTS.md for context |
|
|
301
|
-
| `pi` | `pi.sh` | `.pi/` + `.agents/skills/` | Reads AGENTS.md for always-on context; generated extension surfaces scoped rules; agents become prompt templates |
|
|
302
|
-
| `opencode` | `opencode.sh` | `.opencode/` + `.agents/skills/` | Reads AGENTS.md natively; agents become markdown subagents (`.opencode/agents/<name>.md`); skills via `.agents/skills/`; no scoped-rules emission (users may opt in via `instructions:` globs in `opencode.json`) |
|
|
303
|
-
|
|
304
|
-
Need a target with no built-in adapter? Write it as `<intel>/adapters/<name>.sh` — beside `config.yaml`, using the folder name detected in *Phase 0*, and **never** inside `<intel>/sync/scripts/adapters/`, which `update.sh` replaces wholesale (an adapter written there is deleted by the next engine update). `sync.sh` scans both locations; a project adapter overrides a built-in of the same name. See `/intelligence-install-adapter` and `<intel>/sync/docs/ADAPTERS.md`.
|
|
305
|
-
|
|
306
|
-
### 3.2 `intelligence/rules/context.md`
|
|
307
|
-
|
|
308
|
-
Always-loaded context (no `paths:` in frontmatter):
|
|
309
|
-
- Project name and description
|
|
310
|
-
- Repository structure
|
|
311
|
-
- Build and test commands
|
|
312
|
-
- Global rules (naming, formatting, forbidden patterns)
|
|
313
|
-
|
|
314
|
-
### 3.3 Component-specific rules
|
|
315
|
-
|
|
316
|
-
One rule per component, scoped with `paths:` frontmatter:
|
|
317
|
-
- REQUIRED patterns (positive defaults — what to do, judgment calls)
|
|
318
|
-
- Invariants (true must-nots: safety, output format, security — never judgment calls)
|
|
319
|
-
- Architecture patterns
|
|
320
|
-
- Component-specific build/test commands
|
|
321
|
-
- Code examples from the actual codebase
|
|
322
|
-
- Patterns to recognize and replace (optional — anti-patterns documented as reference with positive replacements; documentation, not LLM instruction)
|
|
323
|
-
|
|
324
|
-
### 3.4 Agents
|
|
325
|
-
|
|
326
|
-
**Developer agents** (tier: heavy, access: full) -- one per distinct stack:
|
|
327
|
-
- Expertise based on detected patterns; boundaries (where the agent stops); build/verify commands
|
|
328
|
-
- **Never instruct an agent to read the rules.** Rules load on their own — Claude Code loads `.claude/rules/` into every custom subagent's startup context, and Cursor / Copilot / Codex / Pi / opencode get always-on rules inlined in `AGENTS.md`. A "read `intelligence/rules/<domain>.md` first" line duplicates content the agent already has and drifts from the rule it copied.
|
|
329
|
-
- Link relevant skills via `skills:` in frontmatter
|
|
330
|
-
|
|
331
|
-
**Code reviewer** (tier: standard, access: readonly):
|
|
332
|
-
- Review criteria per component, output format
|
|
333
|
-
- Link review skills if created (e.g., `<domain>-review-` skills)
|
|
334
|
-
|
|
335
|
-
### 3.5 Skills
|
|
336
|
-
|
|
337
|
-
Pre-installed by the engine — never recreate these, and never use the reserved `intelligence-` prefix for a project skill:
|
|
338
|
-
- `/intelligence-sync` — sync to all enabled IDE targets
|
|
339
|
-
- `/intelligence-update` — update or migrate the engine
|
|
340
|
-
- `/intelligence-install-adapter` / `/intelligence-uninstall-adapter` — turn an IDE channel on or off
|
|
341
|
-
- `/intelligence-add-rule`, `/intelligence-add-agent`, `/intelligence-add-skill` — author an artifact with the conventions applied
|
|
342
|
-
- `/intelligence-extract-skill`, `/intelligence-learn-from-context`, `/intelligence-review-skills` — turn observed work into artifacts, and audit the layer
|
|
343
|
-
|
|
344
|
-
The engine also ships the `intelligence-authoring` rule (authoring discipline, scoped to `<intel>/`) and two agents: `intelligence-architect` (designs and prunes this layer) and `intelligence-operator` (runs the sync, update, and adapter-install/removal flows). They are upstream-owned and arrive via `sources` — do not copy or rewrite them into project content.
|
|
345
|
-
|
|
346
|
-
**Derive skills from this repository. Do not pick them from a catalogue.** A list of plausible skill names ("add-entity", "add-endpoint", "run-tests") is a trap: every one of them sounds right for every project, so working from such a list produces a registry that describes software in general rather than *this* codebase — and every entry costs context budget forever, whether or not anyone invokes it.
|
|
347
|
-
|
|
348
|
-
A candidate skill has to clear all four bars:
|
|
349
|
-
|
|
350
|
-
1. **Repeated.** The operation has demonstrably been done more than once. Evidence: near-identical sibling files, a "how to add X" section in `README`/`CONTRIBUTING`, the same multi-file shape appearing across git history. Not "a project like this usually needs it".
|
|
351
|
-
2. **Multi-step and mechanical.** 3+ concrete steps in a predictable pattern, usually across more than one file. If it is one edit, the model does not need a procedure.
|
|
352
|
-
3. **Verifiable.** It ends in a command or check that proves it worked (build, test, lint, migration, sync). **If there is nothing to verify at the end, it is not a skill** — it is a note, or just work.
|
|
353
|
-
4. **Stable.** It describes the project *as it is meant to work*. A procedure that only exists to route around a current bug is not a skill — that belongs in a single rule that records known breakage, so it disappears when the bug is fixed instead of becoming permanent.
|
|
354
|
-
|
|
355
|
-
**Show your evidence.** For every skill you propose, name the files it would touch and the concrete instance in the repo you derived it from. If you cannot point at one, do not propose it.
|
|
356
|
-
|
|
357
|
-
**Start small: 0–3 skills at bootstrap.** Zero is a legitimate answer for a young or simple repository — say so plainly rather than padding. Skills can be added at any time with `/intelligence-add-skill`, and one added later, from a pattern the team actually hit twice, is worth more than five guessed today.
|
|
358
|
-
|
|
359
|
-
Naming (details in `<intel>/sync/docs/CONVENTIONS.md`): `<domain>-<verb>-<noun>`, domain prefix taken from the set already in use. Two verbs are told apart by what already exists — **`add-` puts one new member into a set that is already there**, and **`create-` brings into existence the container nothing hosted before**; neither describes how the skill is factored inside. Other verbs (`run-`, `review-`, `update-`, `extract-`) read fine; prefer a verb already in use over a new synonym for the same thing. `intelligence-` is reserved for the engine's meta-skills.
|
|
360
|
-
|
|
361
|
-
Present the shortlist with its evidence and let the user choose. Then create only what they pick.
|
|
362
|
-
|
|
363
|
-
### 3.6 `.gitignore`
|
|
364
|
-
|
|
365
|
-
Add (if not present):
|
|
366
|
-
```
|
|
367
|
-
# AI IDE tools (generated by intelligence-sync)
|
|
368
|
-
CLAUDE.md
|
|
369
|
-
.cursorrules
|
|
370
|
-
.agents/
|
|
371
|
-
.codex/
|
|
372
|
-
|
|
373
|
-
# Pi: generated prompt templates, scoped-rule extension, and copied rule files.
|
|
374
|
-
# Keep .pi/settings.json and any hand-authored extensions/prompts outside these
|
|
375
|
-
# paths tracked if you want to share them.
|
|
376
|
-
.pi/intelligence-sync/
|
|
377
|
-
.pi/extensions/intelligence-sync-rules.ts
|
|
378
|
-
.pi/prompts/intelligence-agent-*.md
|
|
379
|
-
|
|
380
|
-
# opencode: only the generated subagents and slash commands are owned by the adapter.
|
|
381
|
-
# Keep .opencode/opencode.json (and any hand-authored config) tracked.
|
|
382
|
-
.opencode/agents/
|
|
383
|
-
.opencode/commands/
|
|
384
|
-
|
|
385
|
-
# Claude Code: ignore everything except project-shared settings.
|
|
386
|
-
# This catches generated subdirs (rules/, skills/, agents/) plus any
|
|
387
|
-
# per-machine state Claude writes (settings.local.json, *.lock,
|
|
388
|
-
# scheduled_tasks.*, sessions/, cache/, etc.) without us having to
|
|
389
|
-
# enumerate every filename Claude may add in the future.
|
|
390
|
-
.claude/*
|
|
391
|
-
!.claude/settings.json
|
|
392
|
-
|
|
393
|
-
# Cursor: same pattern.
|
|
394
|
-
.cursor/*
|
|
395
|
-
!.cursor/settings.json
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
Notes:
|
|
399
|
-
- `.github/` and `AGENTS.md` are intentionally NOT gitignored — they contain shared content.
|
|
400
|
-
- Only `.claude/settings.json` and `.cursor/settings.json` are tracked by default — they hold project-shared IDE settings (allowed bash commands, tool permissions). Everything else under those directories is either generated by sync or per-user state.
|
|
401
|
-
- The Pi adapter writes only three generated paths: `.pi/intelligence-sync/`, `.pi/extensions/intelligence-sync-rules.ts`, and `.pi/prompts/intelligence-agent-*.md`. It does NOT own `.pi/settings.json` or any other `.pi/extensions/*.ts` / `.pi/prompts/*.md` files.
|
|
402
|
-
- The opencode adapter writes only `.opencode/agents/` (one markdown subagent per source agent) and `.opencode/commands/` (one slash command per source skill, mirroring Claude Code's skill-as-command UX). It does NOT own `.opencode/opencode.json` or any other `.opencode/*` files — those remain hand-authored and tracked. Generated command files carry an `<!-- Generated by intelligence-sync. Do not edit manually. -->` marker; only marker-bearing files are removed on re-sync, so any hand-authored command in `.opencode/commands/` survives.
|
|
403
|
-
- If you need to track another file under `.claude/` or `.cursor/` (e.g., `.claude/commands/<name>.md` for a hand-authored command), add another `!path` un-ignore line below.
|
|
404
|
-
|
|
405
|
-
### 3.7 `AGENTS.md` (auto-generated by `agents.sh`)
|
|
406
|
-
|
|
407
|
-
`AGENTS.md` is produced by the `agents` adapter on every sync. It is NOT hand-authored. Do not create this file yourself in Phase 3 -- it will be generated in Phase 4 by `intelligence/sync/scripts/sync.sh`.
|
|
408
|
-
|
|
409
|
-
Your job in Phase 3 is to fill `targets.agents.header` in `config.yaml` (see 3.1) with a 3-5 line project summary: title, stack one-liner, link to `intelligence/rules/context.md`. The adapter appends auto-built tables for agents/skills and a list of rules after the header.
|
|
410
|
-
|
|
411
|
-
The file is committed (not gitignored) but carries a `<!-- Generated ... do not edit manually -->` marker. All regeneration happens via `bash intelligence/sync/scripts/sync.sh`.
|
|
412
|
-
|
|
413
|
-
### 3.8 `CLAUDE.md` (if Claude enabled)
|
|
414
|
-
|
|
415
|
-
Gitignored user preferences:
|
|
416
|
-
- Response language
|
|
417
|
-
- Setup: `intelligence/sync/scripts/sync.sh`
|
|
418
|
-
- Helper scripts, git commit rules
|
|
419
|
-
|
|
420
|
-
---
|
|
421
|
-
|
|
422
|
-
## Phase 4: Verify
|
|
423
|
-
|
|
424
|
-
1. Run `intelligence/sync/scripts/sync.sh`
|
|
425
|
-
2. If sync fails -- read the error, fix the cause (usually missing directory or malformed frontmatter), retry
|
|
426
|
-
3. Verify output counts match expectations
|
|
427
|
-
4. Report to user:
|
|
428
|
-
- Files created (rules, agents, skills)
|
|
429
|
-
- Sync results per target
|
|
430
|
-
- **Enabled targets**: list what was configured (e.g., "claude, cursor, copilot")
|
|
431
|
-
- **Available but not enabled**: list remaining adapters (e.g., "codex, pi, opencode — enable via `/intelligence-install-adapter <name>`")
|
|
432
|
-
- **Available skills**: list all (pre-installed + generated)
|
|
433
|
-
- "To add rules/agents/skills: `/intelligence-add-rule`, `/intelligence-add-agent`, `/intelligence-add-skill`"
|
|
434
|
-
- "After manual edits: `/intelligence-sync` to re-sync"
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
## Reference
|
|
439
|
-
|
|
440
|
-
### Frontmatter
|
|
441
|
-
|
|
442
|
-
**YAML safety (required):** **always wrap `description` and any other free-text string field in double quotes**, even when no special characters are present. Codex CLI uses strict YAML — an unquoted colon, hyphen, or word that parses as boolean (`yes`, `no`) silently breaks the file. Quoting unconditionally removes a whole class of bugs and makes lint trivial. If the value itself contains a double quote, escape it as `\"` or wrap the value in single quotes — an unescaped inner quote terminates the scalar early. The sync engine auto-escapes inner quotes when it quotes a value, as a backstop.
|
|
443
|
-
|
|
444
|
-
**Agent:**
|
|
445
|
-
```yaml
|
|
446
|
-
---
|
|
447
|
-
name: agent-name
|
|
448
|
-
description: "When to use this agent"
|
|
449
|
-
tier: heavy|standard|light # heavy=opus, standard=sonnet, light=haiku
|
|
450
|
-
access: full|readonly # full=all tools, readonly=no write/edit
|
|
451
|
-
skills: # optional: skills this agent can invoke
|
|
452
|
-
- domain-add-something
|
|
453
|
-
- domain-run-tests
|
|
454
|
-
---
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
**Rule:**
|
|
458
|
-
```yaml
|
|
459
|
-
---
|
|
460
|
-
paths: # omit for always-loaded rules
|
|
461
|
-
- "src/backend/**"
|
|
462
|
-
---
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
**Skill:**
|
|
466
|
-
```yaml
|
|
467
|
-
---
|
|
468
|
-
name: domain-verb-noun
|
|
469
|
-
description: "What the skill does"
|
|
470
|
-
argument-hint: <arg1> [arg2] # optional
|
|
471
|
-
agent: agent-name # optional: which agent executes this skill
|
|
472
|
-
---
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
### Content structure
|
|
476
|
-
|
|
477
|
-
**Rule body:** REQUIRED -> Invariants -> Architecture -> Build & Test -> Examples (from actual codebase) -> Patterns to recognize and replace (optional reference section)
|
|
478
|
-
|
|
479
|
-
- Lead with REQUIRED (positive defaults / judgment calls)
|
|
480
|
-
- Reserve **Invariants** for true must-nots — safety, output format, security
|
|
481
|
-
- **Patterns to recognize and replace** is reference documentation of anti-patterns with their positive replacement, not LLM instructions
|
|
482
|
-
|
|
483
|
-
**Agent body:** Expertise -> Boundaries (where it stops) -> Build & Verify. An agent is thin — rules reach it automatically, so it never lists rules to read.
|
|
484
|
-
|
|
485
|
-
**Skill body:** Steps (numbered, concrete, with verification at the end). A skill that dispatches to other skills names them and never restates their content.
|
|
486
|
-
|
|
487
|
-
### Skill naming
|
|
488
|
-
|
|
489
|
-
Prefix with domain: `backend-`, `frontend-`, `devops-`, `intelligence-`, etc.
|
|
490
|
-
|
|
491
|
-
| Prefix | Type |
|
|
492
|
-
|--------|------|
|
|
493
|
-
| `<domain>-add-` | Adds one member to a set that already exists |
|
|
494
|
-
| `<domain>-create-` | Brings into existence a container nothing hosted before |
|
|
495
|
-
| `<domain>-run-` | Runs an operation |
|
|
496
|
-
| `<domain>-review-` | Analyzes without changes |
|
|
497
|
-
|
|
498
|
-
---
|
|
499
|
-
|
|
500
|
-
intelligence-sync is created by [Ainova Systems](https://www.ainovasystems.com). MIT License.
|
package/engine/docs/CLI.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# The intelligence CLI
|
|
2
|
-
|
|
3
|
-
The product interface: one command owning the whole lifecycle of a project's AI intelligence. Installed from npm (`npm i -g @ainova-systems/intelligence`); implemented in bash (`cli/` in this repo) behind a small Node launcher, reusing the sync engine unchanged underneath.
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
cd your-project
|
|
7
|
-
intelligence init
|
|
8
|
-
intelligence add @ainova-systems/core
|
|
9
|
-
intelligence sync
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## The CLI (v2) project layout
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
project/
|
|
16
|
-
├── intelligence.yaml # manifest, at the repo root (like package.json)
|
|
17
|
-
├── intelligence.lock # resolved package state — commit it
|
|
18
|
-
├── intelligence/ # the project's own rules/ agents/ skills/
|
|
19
|
-
├── .intelligence/ # gitignored store: packages/<name>/, backup/
|
|
20
|
-
├── .claude/ .cursor/ … # generated by sync
|
|
21
|
-
└── AGENTS.md
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
No engine code lives in the project. The engine's *scripts* ship inside the npm package; the engine's *content* — the authoring rule, both engine agents, every `intelligence-*` meta-skill and the docs — is the package **`@ainova-systems/sync`**: auto-added by `init` (opt out with `--bare`), visible in `list`/`search`, pinned exactly to the bundled engine version, and materialized from the npm bundle without network whenever the pin matches (only a cross-version install reaches git). `intelligence update` never moves it — `intelligence upgrade` does, together with the schema stamp. Removing it (`remove @ainova-systems/sync --force`) drops the meta-content from the outputs while the sync engine itself keeps working. After a fresh clone, `intelligence install` restores the whole store from the lock.
|
|
25
|
-
|
|
26
|
-
## Commands
|
|
27
|
-
|
|
28
|
-
| Command | Does |
|
|
29
|
-
|---|---|
|
|
30
|
-
| `init [--targets a,b] [--dir d] [--bare] [--no-sync]` | Enable `agents` (the tool-neutral AGENTS.md) plus every tool DETECTED by repo markers (`.claude`/`CLAUDE.md`, `.cursor`, `.codex`, `.pi`, `.opencode`, `.github/instructions`) or named via `--targets` — a tool is never invented. Writes a minimal self-documenting root manifest, `.gitignore`s the store, installs `@ainova-systems/sync` (unless `--bare`), first sync. No dirs are created. |
|
|
31
|
-
| `add <spec> [--name @s/n] [--no-sync]` | Resolve → fetch → wire sources → manifest entry → lock → sync. Specs: `@scope/name[@range]`, `github:org/repo[#path]`, `git+<url>[@ref][#path]`. |
|
|
32
|
-
| `remove <name> [--force]` | Inverse of add: manifest, sources, lock, store. |
|
|
33
|
-
| `install [--frozen] [--force]` | Restore the store exactly from the lock; resolve manifest packages the lock lacks (`--frozen` refuses instead, and fails on sha drift). |
|
|
34
|
-
| `update [name]` | Re-resolve ranges, refetch what moved, rewrite the lock. `ref:`-pinned packages never move here. |
|
|
35
|
-
| `upgrade` | Bring the project to this CLI's engine: apply v2 schema migrations, move the `@ainova-systems/sync` pin to the bundled version and reinstall it, restamp `sync_version`, sync. |
|
|
36
|
-
| `sync [target]` | Run the bundled engine against the manifest. In a vendored (v1) project it delegates to that project's own engine. |
|
|
37
|
-
| `list` / `status` / `doctor` | Inspect; doctor exits 1 on inconsistencies (unlocked packages, missing store, stale stamp, dead sources). |
|
|
38
|
-
| `registry <list\|add <url> [--force]\|remove <url>>` | Manage the trust list of registries — rare, once per organization. `add` fails closed on a URL with no `index.yaml` (`--force` records it anyway). |
|
|
39
|
-
| `migrate [--dry-run] [--force]` | Convert a vendored setup to the CLI setup. Transactional; see below. |
|
|
40
|
-
|
|
41
|
-
## Packages
|
|
42
|
-
|
|
43
|
-
**A package's name is its identity everywhere**: the `packages:` key in the manifest, the store directory (`.intelligence/packages/@scope/name/` — npm's nesting), and the lock key. What a package provides is a convention: whichever of `rules/`, `agents/`, `skills/` exist at its top level get wired into the matching `sources:` sections by `add`.
|
|
44
|
-
|
|
45
|
-
**Names are global.** The name is the trust anchor a developer reasons with — the same `@scope/name` means the same package in every project, every lock and every conversation. A registry never renames anything, and two versions of one name cannot coexist in a project: intelligence artifacts land in each tool's flat namespace (`.claude/skills/<name>/`, the `AGENTS.md` tables), so duplicates would collide file-by-file. Need pieces of two versions? That is a different package — fork it under a different name. Need to override one artifact? Put a same-named file in your own content dir; project sources are listed after package sources.
|
|
46
|
-
|
|
47
|
-
**Name → repo resolution: the trust list is the ONLY resolver.** `registries:` in the manifest holds registry repos (git repos with an `index.yaml`), consulted in order — the first to declare the name wins. There is deliberately **no built-in catalog and no `@org/name` → github guessing**: the CLI core knows no vendor, and a name nobody explicitly trusted never turns into an install from an invented URL. A name no trusted registry declares is refused with suggestions. Installs without a registry are always **explicit sources**: `github:org/repo`, `git+<url>[@ref][#path]`. Vendor defaults exist only as lines `init` seeds into the manifest — visible, reviewable, deletable (`doctor` still flags a name whose current resolution url no longer matches the lock).
|
|
48
|
-
|
|
49
|
-
**Versions are git tags.** Ranges (`^1.2.0`, `~1.2.0`, exact, `latest`) match stable `x.y.z` tags (optional `v` prefix) listed via `git ls-remote` — no clone to resolve. `add` without a range picks the highest stable tag and records `^that`. A branch or commit pin is `ref:`, the escape hatch that ranges never touch. Prerelease-suffixed tags are invisible to ranges by design.
|
|
50
|
-
|
|
51
|
-
**The lock is the resolved truth.** Per package: requested range, url, path, resolved tag, commit sha. `install` never consults an index or re-resolves a range — offline restore and reproducibility come from the lock alone; `--frozen` makes any divergence fatal (CI).
|
|
52
|
-
|
|
53
|
-
## Manifest shapes and ownership
|
|
54
|
-
|
|
55
|
-
The engine reads what it always read (`project:`, `sync_version:`, `sources:`, `targets:`, `models:`, `ignore:`, `submodules:`) through its own parsers. Two blocks are **CLI-owned** and never touched by the engine — their keys are full quoted package names, which engine parsers deliberately cannot read:
|
|
56
|
-
|
|
57
|
-
```yaml
|
|
58
|
-
packages:
|
|
59
|
-
"@ainova-systems/core":
|
|
60
|
-
version: "^0.3.0" # or: ref: main / url: + path: (direct git specs)
|
|
61
|
-
registries:
|
|
62
|
-
- "https://github.com/acme/intelligence-registry.git"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`project.intelligence_dir` names the content dir when it is not `intelligence/`. `sync_version` stays the frozen schema-contract key, stamped by the CLI with the bundled engine version — an npm prerelease suffix never reaches it.
|
|
66
|
-
|
|
67
|
-
## How the CLI drives the engine
|
|
68
|
-
|
|
69
|
-
The engine's CLI mode is an env contract, set by the dispatcher and honored only when `IS_CLI=1` (with every variable unset the engine is byte-identical to the vendored one — CI's `legacy-golden` job proves that on every push):
|
|
70
|
-
|
|
71
|
-
| Variable | Value in CLI mode |
|
|
72
|
-
|---|---|
|
|
73
|
-
| `CONFIG_FILE` | `<root>/intelligence.yaml` |
|
|
74
|
-
| `REPO_ROOT` | the project root |
|
|
75
|
-
| `IS_UMBRELLA_REL` | content dir (`intelligence`) |
|
|
76
|
-
| `IS_MODULE_REL` | `.intelligence/packages/@ainova-systems/sync` |
|
|
77
|
-
| `IS_MANIFEST_NAME` | `intelligence.yaml` (feeds the `<manifest>` token; vendored default `config.yaml`) |
|
|
78
|
-
| `IS_SYNC_CMD` | `intelligence sync` (expanded for the `<sync-cmd>` token) |
|
|
79
|
-
| `IS_PROTECTED_DIRS` | `<content-dir>:.intelligence` — restores output-path protection for a root manifest |
|
|
80
|
-
| `IS_SUPPRESS_CLI_NOTE` | set to silence the vendored-flow recommendation note |
|
|
81
|
-
|
|
82
|
-
## migrate: vendored (v1) → CLI (v2)
|
|
83
|
-
|
|
84
|
-
Fail-closed preconditions (clean worktree unless `--force`; no half-migrated state; project schema not newer than the engine; an older schema is first brought up by the engine's own migration chain). Then **stage** — the manifest is `config.yaml` transformed comment-preservingly (module sources → the `@ainova-systems/sync` package store, `@pack/sub` references → store paths, `packs:` → `packages:` entries keeping their `ref:` pins), mirrored packs are *copied* from their mirrors (network untouched, sha carried from the `.pack` stamp), transient packs fetched — **verify** (staged sources exist; per-adapter `enabled`/`output` equality against the old config) — **commit**: store and manifest move in, a real sync must report `IS_STATUS=ok`, and only then are the vendored module, `config.yaml` (backed up to `.intelligence/backup/`) and the mirrors removed. Any earlier failure rolls back to an untouched project. `--dry-run` stages, verifies, prints, writes nothing.
|
|
85
|
-
|
|
86
|
-
## Developing and releasing the CLI
|
|
87
|
-
|
|
88
|
-
- `bash cli/tests/e2e-packages.sh` and `bash cli/tests/e2e-lifecycle.sh` — the hermetic suites CI runs (file:// fixtures).
|
|
89
|
-
- `bash npm/build.sh [version]` assembles `npm/dist/` from the repo (cli + engine + registry index).
|
|
90
|
-
- The `release-npm` workflow (manual dispatch) publishes `<engine>-rc.N` to dist-tag `next` from any ref, and the stable `<engine>` version to `latest` only when dispatched from the matching `v<engine>` tag. Requires the `NPM_TOKEN` secret.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3a5cd174c73bd3918ac0a01df8d54a6f3d98b485
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# shellcheck disable=SC2034 # LS_* are this lib's public API, consumed by the scripts that source it
|
|
3
|
-
# intelligence-sync: layout detection
|
|
4
|
-
# Source this file — never execute directly.
|
|
5
|
-
#
|
|
6
|
-
# The intelligence umbrella folder name is NOT hardcoded. It is whatever
|
|
7
|
-
# directory holds config.yaml — `intelligence/`, `Intelligence/`, `prompts/`,
|
|
8
|
-
# anything. The only fixed name is the module's own subfolder (`sync`), which
|
|
9
|
-
# is the module's identity, not the project's choice.
|
|
10
|
-
#
|
|
11
|
-
# Two layouts exist during the 0.3.x transition:
|
|
12
|
-
# legacy : <umbrella>/scripts/ (config.yaml at <umbrella>/config.yaml)
|
|
13
|
-
# modular : <umbrella>/sync/scripts/ (config.yaml at <umbrella>/config.yaml)
|
|
14
|
-
#
|
|
15
|
-
# detect_layout sets these globals:
|
|
16
|
-
# LS_LAYOUT legacy | modular | unknown
|
|
17
|
-
# LS_MODULE_DIR dir that contains scripts/ (legacy: == umbrella; modular: <umbrella>/<module>)
|
|
18
|
-
# LS_MODULE_NAME basename of LS_MODULE_DIR — messages only, never branched on
|
|
19
|
-
# LS_UMBRELLA_DIR dir that holds (or will hold) config.yaml + project content
|
|
20
|
-
# LS_CONFIG_FILE absolute path to config.yaml, or "" if none found yet
|
|
21
|
-
|
|
22
|
-
# detect_layout <scripts_dir>
|
|
23
|
-
detect_layout() {
|
|
24
|
-
local scripts_dir="$1"
|
|
25
|
-
local module_dir
|
|
26
|
-
module_dir="$(cd "$scripts_dir/.." && pwd)"
|
|
27
|
-
|
|
28
|
-
if [ -f "$module_dir/../config.yaml" ]; then
|
|
29
|
-
# <umbrella>/<module>/scripts — umbrella is two levels up.
|
|
30
|
-
LS_LAYOUT="modular"
|
|
31
|
-
LS_UMBRELLA_DIR="$(cd "$module_dir/.." && pwd)"
|
|
32
|
-
elif [ -f "$module_dir/config.yaml" ]; then
|
|
33
|
-
# <umbrella>/scripts — flat pre-0.3.1 layout.
|
|
34
|
-
LS_LAYOUT="legacy"
|
|
35
|
-
LS_UMBRELLA_DIR="$module_dir"
|
|
36
|
-
else
|
|
37
|
-
# No config.yaml yet (upstream repo template, or pre-bootstrap).
|
|
38
|
-
# Assume the umbrella is the module's parent; callers that need a
|
|
39
|
-
# config will error out with their own message.
|
|
40
|
-
LS_LAYOUT="unknown"
|
|
41
|
-
LS_UMBRELLA_DIR="$(cd "$module_dir/.." && pwd)"
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
LS_MODULE_DIR="$module_dir"
|
|
45
|
-
LS_MODULE_NAME="$(basename "$module_dir")" # messages only
|
|
46
|
-
if [ -f "$LS_UMBRELLA_DIR/config.yaml" ]; then
|
|
47
|
-
LS_CONFIG_FILE="$LS_UMBRELLA_DIR/config.yaml"
|
|
48
|
-
else
|
|
49
|
-
LS_CONFIG_FILE=""
|
|
50
|
-
fi
|
|
51
|
-
}
|