ai-lens 0.8.85 → 0.8.86
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/.commithash +1 -1
- package/CHANGELOG.md +3 -0
- package/cli/import/claude-code.js +27 -4
- package/cli/import.js +1 -1
- package/package.json +1 -1
package/.commithash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a628f26
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
History of changes to the `ai-lens` CLI package on npm. New entries go on top. Format: `## X.Y.Z — YYYY-MM-DD`, followed by user-facing bullets.
|
|
4
4
|
|
|
5
|
+
## 0.8.86 — 2026-06-11
|
|
6
|
+
- fix: `ai-lens import claude-code` now respects your configured projects filter (`AI_LENS_PROJECTS` / the `projects` setting) by default, the same way live capture does — previously, without an explicit `--projects` flag it imported your entire local history. Pass `--projects all` to deliberately import everything, or `--projects A,B` to use a different list. The import offer inside `ai-lens init` follows the same rule.
|
|
7
|
+
|
|
5
8
|
## 0.8.85 — 2026-06-09
|
|
6
9
|
- feat: manage your own data from the CLI. `ai-lens list-sessions` lists your sessions, `ai-lens find-session <query>` finds one by id / project / source, and `ai-lens delete-sessions` removes your own sessions — by id (the short id shown by `list-sessions` works) or by `--from`/`--to` date range. Delete is a dry-run by default and only acts with `--yes`; it can only ever touch your own data, and a mistyped or ambiguous id is reported rather than silently ignored.
|
|
7
10
|
- feat: `ai-lens import claude-code --from <date> --to <date>` imports a precise date window (events outside it are left out). Re-running an import over a window you've already imported is safe — it adds zero duplicates (every event has a stable id the server de-duplicates on), so you can re-seed a lost day without fear of doubling your history.
|
|
@@ -28,7 +28,7 @@ import { spawn } from 'node:child_process';
|
|
|
28
28
|
import { fileURLToPath } from 'node:url';
|
|
29
29
|
|
|
30
30
|
import { writeToSpool, canonicalizeProjectPath, deterministicEventId } from '../../client/capture.js';
|
|
31
|
-
import { PENDING_DIR, SENDING_DIR, DATA_DIR, ensureDataDir, getGitIdentity, getGitMetadata, getServerUrl, getAuthToken } from '../../client/config.js';
|
|
31
|
+
import { PENDING_DIR, SENDING_DIR, DATA_DIR, ensureDataDir, getGitIdentity, getGitMetadata, getServerUrl, getAuthToken, getMonitoredProjects } from '../../client/config.js';
|
|
32
32
|
import { mapTranscript } from './transcript-map.js';
|
|
33
33
|
import { info, success, warn, error, heading, detail, blank } from '../logger.js';
|
|
34
34
|
|
|
@@ -125,6 +125,27 @@ function normalizeProjectArg(p) {
|
|
|
125
125
|
return canonicalizeProjectPath(real) || real;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Resolve the effective project filter, mirroring live capture by default:
|
|
130
|
+
* --projects A,B → explicit list (each entry ~-expanded + git-root canonicalized)
|
|
131
|
+
* --projects all → no filter, even when one is configured (explicit override)
|
|
132
|
+
* (no flag) → the live-capture filter (AI_LENS_PROJECTS / config
|
|
133
|
+
* `projects`), so import never ships history that live
|
|
134
|
+
* capture would have dropped via project_filter.
|
|
135
|
+
* `monitored` is getMonitoredProjects() output: normalized absolute paths or
|
|
136
|
+
* null. Matching semantics are identical to live capture's pathContains
|
|
137
|
+
* (entry === path || path inside entry), so no extra canonicalization needed.
|
|
138
|
+
* Returns { filter: string[]|null, source: 'flag'|'config'|null }.
|
|
139
|
+
*/
|
|
140
|
+
export function resolveProjectFilter(projectsFlag, monitored) {
|
|
141
|
+
if (typeof projectsFlag === 'string' && projectsFlag.trim()) {
|
|
142
|
+
if (projectsFlag.trim().toLowerCase() === 'all') return { filter: null, source: null };
|
|
143
|
+
return { filter: projectsFlag.split(',').map(normalizeProjectArg).filter(Boolean), source: 'flag' };
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(monitored) && monitored.length > 0) return { filter: monitored, source: 'config' };
|
|
146
|
+
return { filter: null, source: null };
|
|
147
|
+
}
|
|
148
|
+
|
|
128
149
|
/** Path-boundary match (so /repo does NOT match /repo2). */
|
|
129
150
|
export function projectMatches(projectPath, filters) {
|
|
130
151
|
if (!filters) return true;
|
|
@@ -299,9 +320,11 @@ export default async function importClaudeCode(flags) {
|
|
|
299
320
|
const cutoff = (rangeMode && lower == null)
|
|
300
321
|
? new Date(0).toISOString()
|
|
301
322
|
: resolveCutoff({ days, since, from });
|
|
302
|
-
const projectFilter = projects
|
|
303
|
-
|
|
304
|
-
:
|
|
323
|
+
const { filter: projectFilter, source: filterSource } = resolveProjectFilter(projects, getMonitoredProjects());
|
|
324
|
+
if (filterSource === 'config') {
|
|
325
|
+
info(`Project filter from config (AI_LENS_PROJECTS / ~/.ai-lens/config): ${projectFilter.join(', ')}`);
|
|
326
|
+
detail('Pass --projects all to import everything, or --projects A,B to override.');
|
|
327
|
+
}
|
|
305
328
|
ensureDataDir();
|
|
306
329
|
const ledger = loadLedger();
|
|
307
330
|
// Human-readable window label for the progress lines.
|
package/cli/import.js
CHANGED
|
@@ -44,7 +44,7 @@ export default async function importCmd() {
|
|
|
44
44
|
|
|
45
45
|
if (errors.length) {
|
|
46
46
|
errors.forEach((e) => error(e));
|
|
47
|
-
info('Usage: ai-lens import claude-code [--days N | --since YYYY-MM-DD | --from YYYY-MM-DD --to YYYY-MM-DD] [--projects A,B] [--dry-run] [--no-redact]');
|
|
47
|
+
info('Usage: ai-lens import claude-code [--days N | --since YYYY-MM-DD | --from YYYY-MM-DD --to YYYY-MM-DD] [--projects A,B | --projects all] [--dry-run] [--no-redact]');
|
|
48
48
|
process.exitCode = 1;
|
|
49
49
|
return;
|
|
50
50
|
}
|