@stainless-code/codemap 0.1.2 → 0.1.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @stainless-code/codemap
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6](https://github.com/stainless-code/codemap/pull/6) [`ad29694`](https://github.com/stainless-code/codemap/commit/ad2969481d4bd4e60d4f29818e4f1e64986216f9) Thanks [@SutuSebastian](https://github.com/SutuSebastian)! - Align shipped agent templates with the published CLI (`codemap`, `npx @stainless-code/codemap`, …). Keep this repository’s `.agents/` rule and skill dev-oriented (`bun src/index.ts`). Remove the redundant `agents-first-convention` template. Document the dev vs `templates/agents/` split in `templates/agents/README.md` and `docs/agents.md`.
|
|
8
|
+
|
|
3
9
|
## 0.1.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/version.ts
|
|
10
10
|
/** Package version from `package.json` (inlined at build time). */
|
|
11
|
-
const CODEMAP_VERSION = "0.1.
|
|
11
|
+
const CODEMAP_VERSION = "0.1.3";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/cli/bootstrap.ts
|
|
14
14
|
/** Printed for `codemap --help` / `-h` (must run before config or DB access). */
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Bundled agent templates
|
|
2
2
|
|
|
3
|
-
These files
|
|
3
|
+
These files ship with **`@stainless-code/codemap`** for **`codemap agents init`** — written for **npm consumers** ( **`codemap`**, **`npx @stainless-code/codemap`**, etc.).
|
|
4
|
+
|
|
5
|
+
In **this** repository, **`.agents/`** (and **`.cursor/`** symlinks) are **maintainer / dev** copies: examples use **`bun src/index.ts`** where that matters. **`templates/agents/`** is the **published** agent surface and is **not** required to match **`.agents/`** byte-for-byte (the **codemap** rule and skill intentionally differ).
|
|
4
6
|
|
|
5
7
|
**Documentation:** [docs/agents.md](../../docs/agents.md) — interactive setup, **`.gitignore`**, and optional IDE wiring (Cursor, Copilot, …).
|
|
6
8
|
|
|
7
|
-
After running the command, **edit**
|
|
9
|
+
After running the command in **your** project, **edit** **`.agents/`** there (paths, SQL, team conventions). Treat updates here as a reference when refreshing your copy.
|
|
@@ -8,24 +8,33 @@ alwaysApply: true
|
|
|
8
8
|
|
|
9
9
|
A local database (default **`.codemap.db`**) indexes structure: symbols, imports, exports, components, dependencies, markers, CSS variables, CSS classes, CSS keyframes.
|
|
10
10
|
|
|
11
|
-
**Generic defaults:** This rule is **project-agnostic**. After
|
|
11
|
+
**Generic defaults:** This rule is **project-agnostic**. After **`codemap agents init`** (or copying these files into **`.agents/`**), **edit your copy** to add app-specific triggers and SQL — upstream text is only a baseline.
|
|
12
12
|
|
|
13
|
-
## CLI (
|
|
13
|
+
## CLI (npm package **`@stainless-code/codemap`**)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
| ------- | ----------------- | ----- |
|
|
17
|
-
| Developing in this repo | `bun src/index.ts` | `bun src/index.ts query "<SQL>"` |
|
|
18
|
-
| After `bun link` / global `codemap` | `codemap` | `codemap query "<SQL>"` |
|
|
19
|
-
| Published package (when available) | `bunx @stainless-code/codemap` | `bunx @stainless-code/codemap query "<SQL>"` |
|
|
15
|
+
Install **[@stainless-code/codemap](https://www.npmjs.com/package/@stainless-code/codemap)** from npm. The executable name is **`codemap`**.
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
**Run without a global install:** **`npx @stainless-code/codemap`** (npm), **`pnpm dlx @stainless-code/codemap`** (pnpm), **`yarn dlx @stainless-code/codemap`** (Yarn 2+), or **`bunx @stainless-code/codemap`** (Bun) — same flags everywhere. With a **local** devDependency, **`npx codemap`** / **`pnpm exec codemap`**. With a **global** install, **`codemap`** on your **`PATH`**.
|
|
18
|
+
|
|
19
|
+
**Examples below use `codemap`** — prefix with **`npx @stainless-code/codemap`** (or **`pnpm dlx`**, **`yarn dlx`**, **`bunx`**) when the CLI is not on your **`PATH`**.
|
|
20
|
+
|
|
21
|
+
| Action | Command |
|
|
22
|
+
| ------ | ------- |
|
|
23
|
+
| Incremental index | `codemap` |
|
|
24
|
+
| Query | `codemap query "<SQL>"` |
|
|
25
|
+
|
|
26
|
+
**Bundled rules/skills:** **`codemap agents init`** writes **`.agents/`** from the package (see [docs/agents.md](../../../docs/agents.md)).
|
|
27
|
+
|
|
28
|
+
Index another project: **`--root /path/to/repo`**, or set **`CODEMAP_ROOT`** or **`CODEMAP_TEST_BENCH`** (e.g. in **`.env`** — see [docs/benchmark.md § Indexing another project](../../../docs/benchmark.md#indexing-another-project)). Full rebuild: **`--full`**. Targeted re-index: **`--files path/to/a.ts path/to/b.tsx`**.
|
|
29
|
+
|
|
30
|
+
**Developing the Codemap repo itself:** from a clone, **`bun src/index.ts`** matches **`codemap`** (same flags); see the repository README.
|
|
22
31
|
|
|
23
32
|
## Session start (do this ONCE per conversation)
|
|
24
33
|
|
|
25
34
|
Run incremental indexing to catch changes made outside this session:
|
|
26
35
|
|
|
27
36
|
```bash
|
|
28
|
-
|
|
37
|
+
codemap
|
|
29
38
|
```
|
|
30
39
|
|
|
31
40
|
## Pre-flight check (do this EVERY time before searching)
|
|
@@ -62,7 +71,7 @@ If the question looks like any of these → use the index:
|
|
|
62
71
|
## How to query
|
|
63
72
|
|
|
64
73
|
```bash
|
|
65
|
-
|
|
74
|
+
codemap query "<SQL>"
|
|
66
75
|
```
|
|
67
76
|
|
|
68
77
|
## Quick reference queries
|
|
@@ -94,13 +103,13 @@ For the full schema, advanced query patterns, and troubleshooting, read the skil
|
|
|
94
103
|
|
|
95
104
|
```bash
|
|
96
105
|
# Targeted — re-index only the files you just touched
|
|
97
|
-
|
|
106
|
+
codemap --files path/to/file1.tsx path/to/file2.ts
|
|
98
107
|
|
|
99
108
|
# Incremental — auto-detects changed files via git
|
|
100
|
-
|
|
109
|
+
codemap
|
|
101
110
|
|
|
102
111
|
# Full rebuild — after rebase, branch switch, or stale index
|
|
103
|
-
|
|
112
|
+
codemap --full
|
|
104
113
|
```
|
|
105
114
|
|
|
106
115
|
### When to re-index
|
|
@@ -6,15 +6,15 @@ Query codebase structure via SQLite instead of scanning files. Use when explorin
|
|
|
6
6
|
|
|
7
7
|
Examples below use **placeholders** (`'...'`, `getConfig`, `~/lib/api`, etc.) — not a real product tree. **Shipped skill and rules stay generic** so they apply to any repo.
|
|
8
8
|
|
|
9
|
-
**In your project:**
|
|
9
|
+
**In your project:** run **`codemap agents init`** (ships **`.agents/`** from **[@stainless-code/codemap](https://www.npmjs.com/package/@stainless-code/codemap)**), or copy/symlink rules and skills manually (see your repo’s contributor docs). Then **edit your copy** to add your team’s tsconfig aliases, directory conventions, and SQL snippets you reuse. Treat upstream updates as a reference; merge deliberately.
|
|
10
10
|
|
|
11
|
-
**Run queries**
|
|
11
|
+
**Run queries** (same CLI everywhere — use **`npx @stainless-code/codemap`**, **`pnpm dlx @stainless-code/codemap`**, **`yarn dlx @stainless-code/codemap`**, or **`bunx @stainless-code/codemap`** if **`codemap`** is not on your **`PATH`**):
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
|
|
14
|
+
codemap query "<SQL>"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Use **`codemap --root /path/to/project`** (or **`CODEMAP_ROOT`**) to index another tree.
|
|
18
18
|
|
|
19
19
|
## Schema
|
|
20
20
|
|
|
@@ -282,31 +282,31 @@ SELECT kind, COUNT(*) as count FROM markers GROUP BY kind;
|
|
|
282
282
|
|
|
283
283
|
## Maintenance
|
|
284
284
|
|
|
285
|
-
From
|
|
285
|
+
From the **[@stainless-code/codemap](https://www.npmjs.com/package/@stainless-code/codemap)** CLI (see the **codemap** rule for **`npx` / `pnpm dlx` / `yarn dlx` / `bunx`** invocations):
|
|
286
286
|
|
|
287
287
|
```bash
|
|
288
288
|
# Targeted — re-index only specific files you just modified
|
|
289
|
-
|
|
289
|
+
codemap --files path/to/file.tsx path/to/other.ts
|
|
290
290
|
|
|
291
291
|
# Incremental — auto-detects changes via git
|
|
292
|
-
|
|
292
|
+
codemap
|
|
293
293
|
|
|
294
294
|
# Full rebuild — after rebase, branch switch, or stale index
|
|
295
|
-
|
|
295
|
+
codemap --full
|
|
296
296
|
|
|
297
297
|
# Check index freshness
|
|
298
|
-
|
|
298
|
+
codemap query "SELECT key, value FROM meta"
|
|
299
299
|
```
|
|
300
300
|
|
|
301
301
|
**Prefer `--files`** when you know which files you changed — it skips git diff and filesystem scanning for the rest of the tree. Deleted files passed to `--files` are auto-removed from the index.
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
Same flags as **`npx @stainless-code/codemap`**, **`pnpm dlx @stainless-code/codemap`**, etc. **`codemap --root /path/to/project`** indexes another working tree.
|
|
304
304
|
|
|
305
305
|
## Troubleshooting
|
|
306
306
|
|
|
307
|
-
| Problem | Solution
|
|
308
|
-
| -------------------------- |
|
|
309
|
-
| Stale results after rebase | Run
|
|
310
|
-
| Missing file in results | Check exclude / include globs in **`codemap.config.ts`**, **`codemap.config.json`**, or
|
|
311
|
-
| `resolved_path` is NULL | Import is an external package (not in project)
|
|
312
|
-
| Resolver errors | Verify `tsconfig.json` paths (or **`tsconfigPath`** in config) when resolving aliases
|
|
307
|
+
| Problem | Solution |
|
|
308
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
309
|
+
| Stale results after rebase | Run **`codemap --full`** (see **`npx @stainless-code/codemap`** / **`pnpm dlx`** / … above if needed) |
|
|
310
|
+
| Missing file in results | Check exclude / include globs in **`codemap.config.ts`**, **`codemap.config.json`**, or **`codemap --help`** defaults |
|
|
311
|
+
| `resolved_path` is NULL | Import is an external package (not in project) |
|
|
312
|
+
| Resolver errors | Verify `tsconfig.json` paths (or **`tsconfigPath`** in config) when resolving aliases |
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: When creating or moving rules/skills, always store the source file in .agents/ and symlink from .cursor/
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Agents-First File Convention
|
|
7
|
-
|
|
8
|
-
When creating **any** new rule or skill, follow this convention:
|
|
9
|
-
|
|
10
|
-
## Rules (`.mdc` files)
|
|
11
|
-
|
|
12
|
-
1. Create the file in `.agents/rules/<name>.mdc`
|
|
13
|
-
2. Create a symlink in `.cursor/rules/`:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ln -s ../../.agents/rules/<name>.mdc .cursor/rules/<name>.mdc
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Skills (`SKILL.md` files)
|
|
20
|
-
|
|
21
|
-
1. Create the directory and file in `.agents/skills/<name>/SKILL.md`
|
|
22
|
-
2. Create a symlink in `.cursor/skills/`:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
ln -s ../../.agents/skills/<name> .cursor/skills/<name>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Why
|
|
29
|
-
|
|
30
|
-
- `.agents/` is the **source of truth** — it is IDE-agnostic and works across different AI coding tools.
|
|
31
|
-
- `.cursor/` only contains **symlinks** pointing back to `.agents/`.
|
|
32
|
-
- This keeps configuration portable and avoids duplication.
|
|
33
|
-
|
|
34
|
-
## Never
|
|
35
|
-
|
|
36
|
-
- Never place original rule/skill content directly in `.cursor/rules/` or `.cursor/skills/`.
|
|
37
|
-
- Never create a rule or skill without both the `.agents/` file and the `.cursor/` symlink.
|