@ironbee-ai/cli 0.6.2 → 0.7.0
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 +6 -0
- package/README.md +167 -39
- package/dist/analysis/code-changes.js.map +1 -1
- package/dist/analysis/cross-session.js.map +1 -1
- package/dist/analysis/fix-effectiveness.js.map +1 -1
- package/dist/analysis/time-analysis.js.map +1 -1
- package/dist/analysis/verdict-details.js.map +1 -1
- package/dist/analysis/verification-quality.js.map +1 -1
- package/dist/analytics/classifier.d.ts +99 -0
- package/dist/analytics/classifier.d.ts.map +1 -0
- package/dist/analytics/classifier.js +380 -0
- package/dist/analytics/classifier.js.map +1 -0
- package/dist/analytics/emit.d.ts +67 -0
- package/dist/analytics/emit.d.ts.map +1 -0
- package/dist/analytics/emit.js +901 -0
- package/dist/analytics/emit.js.map +1 -0
- package/dist/analytics/errors.d.ts +33 -0
- package/dist/analytics/errors.d.ts.map +1 -0
- package/dist/analytics/errors.js +93 -0
- package/dist/analytics/errors.js.map +1 -0
- package/dist/analytics/hook-trigger.d.ts +39 -0
- package/dist/analytics/hook-trigger.d.ts.map +1 -0
- package/dist/analytics/hook-trigger.js +127 -0
- package/dist/analytics/hook-trigger.js.map +1 -0
- package/dist/analytics/log.d.ts +44 -0
- package/dist/analytics/log.d.ts.map +1 -0
- package/dist/analytics/log.js +158 -0
- package/dist/analytics/log.js.map +1 -0
- package/dist/analytics/merge.d.ts +40 -0
- package/dist/analytics/merge.d.ts.map +1 -0
- package/dist/analytics/merge.js +527 -0
- package/dist/analytics/merge.js.map +1 -0
- package/dist/analytics/pricing.d.ts +149 -0
- package/dist/analytics/pricing.d.ts.map +1 -0
- package/dist/analytics/pricing.js +179 -0
- package/dist/analytics/pricing.js.map +1 -0
- package/dist/analytics/projection.d.ts +356 -0
- package/dist/analytics/projection.d.ts.map +1 -0
- package/dist/analytics/projection.js +2281 -0
- package/dist/analytics/projection.js.map +1 -0
- package/dist/analytics/spawn.d.ts +28 -0
- package/dist/analytics/spawn.d.ts.map +1 -0
- package/dist/analytics/spawn.js +57 -0
- package/dist/analytics/spawn.js.map +1 -0
- package/dist/analytics/state.d.ts +58 -0
- package/dist/analytics/state.d.ts.map +1 -0
- package/dist/analytics/state.js +329 -0
- package/dist/analytics/state.js.map +1 -0
- package/dist/analytics/transcript.d.ts +150 -0
- package/dist/analytics/transcript.d.ts.map +1 -0
- package/dist/analytics/transcript.js +276 -0
- package/dist/analytics/transcript.js.map +1 -0
- package/dist/analytics/types.d.ts +875 -0
- package/dist/analytics/types.d.ts.map +1 -0
- package/dist/analytics/types.js +31 -0
- package/dist/analytics/types.js.map +1 -0
- package/dist/clients/base.d.ts +21 -2
- package/dist/clients/base.d.ts.map +1 -1
- package/dist/clients/claude/commands/ironbee-verify.md +15 -7
- package/dist/clients/claude/fragments/command-verify.node.md +33 -0
- package/dist/clients/claude/fragments/rule.node.md +29 -0
- package/dist/clients/claude/fragments/skill.node.md +77 -0
- package/dist/clients/claude/hooks/activity-end.d.ts +13 -0
- package/dist/clients/claude/hooks/activity-end.d.ts.map +1 -0
- package/dist/clients/claude/hooks/activity-end.js +42 -0
- package/dist/clients/claude/hooks/activity-end.js.map +1 -0
- package/dist/clients/claude/hooks/require-verdict.d.ts +3 -2
- package/dist/clients/claude/hooks/require-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verdict.js +6 -5
- package/dist/clients/claude/hooks/require-verdict.js.map +1 -1
- package/dist/clients/claude/hooks/require-verification.d.ts +7 -4
- package/dist/clients/claude/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verification.js +44 -22
- package/dist/clients/claude/hooks/require-verification.js.map +1 -1
- package/dist/clients/claude/hooks/session-end.d.ts.map +1 -1
- package/dist/clients/claude/hooks/session-end.js +17 -2
- package/dist/clients/claude/hooks/session-end.js.map +1 -1
- package/dist/clients/claude/hooks/session-start.d.ts.map +1 -1
- package/dist/clients/claude/hooks/session-start.js +2 -1
- package/dist/clients/claude/hooks/session-start.js.map +1 -1
- package/dist/clients/claude/hooks/track-action-monitor.d.ts +27 -0
- package/dist/clients/claude/hooks/track-action-monitor.d.ts.map +1 -0
- package/dist/clients/claude/hooks/track-action-monitor.js +126 -0
- package/dist/clients/claude/hooks/track-action-monitor.js.map +1 -0
- package/dist/clients/claude/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/claude/hooks/track-action.js +29 -20
- package/dist/clients/claude/hooks/track-action.js.map +1 -1
- package/dist/clients/claude/hooks/verify-gate.d.ts.map +1 -1
- package/dist/clients/claude/hooks/verify-gate.js +18 -1
- package/dist/clients/claude/hooks/verify-gate.js.map +1 -1
- package/dist/clients/claude/index.d.ts +4 -1
- package/dist/clients/claude/index.d.ts.map +1 -1
- package/dist/clients/claude/index.js +171 -94
- package/dist/clients/claude/index.js.map +1 -1
- package/dist/clients/claude/rules/ironbee-verification.md +41 -33
- package/dist/clients/claude/skills/ironbee-verification.md +93 -76
- package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +18 -10
- package/dist/clients/cursor/fragments/command-verify.node.md +33 -0
- package/dist/clients/cursor/fragments/rule.node.md +29 -0
- package/dist/clients/cursor/fragments/skill.node.md +77 -0
- package/dist/clients/cursor/hooks/activity-end.d.ts +14 -0
- package/dist/clients/cursor/hooks/activity-end.d.ts.map +1 -0
- package/dist/clients/cursor/hooks/activity-end.js +45 -0
- package/dist/clients/cursor/hooks/activity-end.js.map +1 -0
- package/dist/clients/cursor/hooks/require-verdict.d.ts +1 -1
- package/dist/clients/cursor/hooks/require-verdict.js +4 -4
- package/dist/clients/cursor/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/require-verification.js +42 -16
- package/dist/clients/cursor/hooks/require-verification.js.map +1 -1
- package/dist/clients/cursor/hooks/session-end.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/session-end.js +18 -2
- package/dist/clients/cursor/hooks/session-end.js.map +1 -1
- package/dist/clients/cursor/hooks/session-start.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/session-start.js +2 -1
- package/dist/clients/cursor/hooks/session-start.js.map +1 -1
- package/dist/clients/cursor/hooks/track-action-monitor.d.ts +27 -0
- package/dist/clients/cursor/hooks/track-action-monitor.d.ts.map +1 -0
- package/dist/clients/cursor/hooks/track-action-monitor.js +133 -0
- package/dist/clients/cursor/hooks/track-action-monitor.js.map +1 -0
- package/dist/clients/cursor/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/track-action.js +51 -23
- package/dist/clients/cursor/hooks/track-action.js.map +1 -1
- package/dist/clients/cursor/hooks/verify-gate.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/verify-gate.js +14 -1
- package/dist/clients/cursor/hooks/verify-gate.js.map +1 -1
- package/dist/clients/cursor/index.d.ts +4 -1
- package/dist/clients/cursor/index.d.ts.map +1 -1
- package/dist/clients/cursor/index.js +117 -71
- package/dist/clients/cursor/index.js.map +1 -1
- package/dist/clients/cursor/rules/ironbee-verification.mdc +37 -29
- package/dist/clients/cursor/skills/ironbee-verification.md +93 -76
- package/dist/clients/registry.d.ts +14 -0
- package/dist/clients/registry.d.ts.map +1 -1
- package/dist/clients/registry.js +34 -0
- package/dist/clients/registry.js.map +1 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +40 -0
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/backend-toggle.d.ts +45 -0
- package/dist/commands/backend-toggle.d.ts.map +1 -0
- package/dist/commands/backend-toggle.js +192 -0
- package/dist/commands/backend-toggle.js.map +1 -0
- package/dist/commands/disable-backend.d.ts +14 -0
- package/dist/commands/disable-backend.d.ts.map +1 -0
- package/dist/commands/disable-backend.js +34 -0
- package/dist/commands/disable-backend.js.map +1 -0
- package/dist/commands/disable-verification.d.ts +16 -0
- package/dist/commands/disable-verification.d.ts.map +1 -0
- package/dist/commands/disable-verification.js +36 -0
- package/dist/commands/disable-verification.js.map +1 -0
- package/dist/commands/enable-backend.d.ts +15 -0
- package/dist/commands/enable-backend.d.ts.map +1 -0
- package/dist/commands/enable-backend.js +35 -0
- package/dist/commands/enable-backend.js.map +1 -0
- package/dist/commands/enable-verification.d.ts +14 -0
- package/dist/commands/enable-verification.d.ts.map +1 -0
- package/dist/commands/enable-verification.js +34 -0
- package/dist/commands/enable-verification.js.map +1 -0
- package/dist/commands/hook.d.ts.map +1 -1
- package/dist/commands/hook.js +60 -0
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/import.d.ts +39 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +369 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +15 -20
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/process-analytics.d.ts +18 -0
- package/dist/commands/process-analytics.d.ts.map +1 -0
- package/dist/commands/process-analytics.js +57 -0
- package/dist/commands/process-analytics.js.map +1 -0
- package/dist/commands/queue.d.ts +2 -3
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +2 -3
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +29 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/verification-toggle.d.ts +47 -0
- package/dist/commands/verification-toggle.d.ts.map +1 -0
- package/dist/commands/verification-toggle.js +113 -0
- package/dist/commands/verification-toggle.js.map +1 -0
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +28 -0
- package/dist/commands/verify.js.map +1 -1
- package/dist/hooks/core/actions.d.ts +64 -67
- package/dist/hooks/core/actions.d.ts.map +1 -1
- package/dist/hooks/core/actions.js +39 -24
- package/dist/hooks/core/actions.js.map +1 -1
- package/dist/hooks/core/activity-end.d.ts +20 -0
- package/dist/hooks/core/activity-end.d.ts.map +1 -0
- package/dist/hooks/core/activity-end.js +23 -0
- package/dist/hooks/core/activity-end.js.map +1 -0
- package/dist/hooks/core/required-tools.d.ts +30 -0
- package/dist/hooks/core/required-tools.d.ts.map +1 -0
- package/dist/hooks/core/required-tools.js +70 -0
- package/dist/hooks/core/required-tools.js.map +1 -0
- package/dist/hooks/core/session-state.d.ts +12 -3
- package/dist/hooks/core/session-state.d.ts.map +1 -1
- package/dist/hooks/core/session-state.js +59 -0
- package/dist/hooks/core/session-state.js.map +1 -1
- package/dist/hooks/core/submit-verdict.d.ts.map +1 -1
- package/dist/hooks/core/submit-verdict.js +16 -12
- package/dist/hooks/core/submit-verdict.js.map +1 -1
- package/dist/hooks/core/verify-gate.d.ts +17 -3
- package/dist/hooks/core/verify-gate.d.ts.map +1 -1
- package/dist/hooks/core/verify-gate.js +312 -116
- package/dist/hooks/core/verify-gate.js.map +1 -1
- package/dist/import/claude/analytics-runner.d.ts +42 -0
- package/dist/import/claude/analytics-runner.d.ts.map +1 -0
- package/dist/import/claude/analytics-runner.js +213 -0
- package/dist/import/claude/analytics-runner.js.map +1 -0
- package/dist/import/claude/discovery.d.ts +22 -0
- package/dist/import/claude/discovery.d.ts.map +1 -0
- package/dist/import/claude/discovery.js +197 -0
- package/dist/import/claude/discovery.js.map +1 -0
- package/dist/import/claude/encoding.d.ts +50 -0
- package/dist/import/claude/encoding.d.ts.map +1 -0
- package/dist/import/claude/encoding.js +110 -0
- package/dist/import/claude/encoding.js.map +1 -0
- package/dist/import/claude/events/file-change.d.ts +28 -0
- package/dist/import/claude/events/file-change.d.ts.map +1 -0
- package/dist/import/claude/events/file-change.js +112 -0
- package/dist/import/claude/events/file-change.js.map +1 -0
- package/dist/import/claude/events/tool-call.d.ts +61 -0
- package/dist/import/claude/events/tool-call.d.ts.map +1 -0
- package/dist/import/claude/events/tool-call.js +119 -0
- package/dist/import/claude/events/tool-call.js.map +1 -0
- package/dist/import/claude/runner.d.ts +31 -0
- package/dist/import/claude/runner.d.ts.map +1 -0
- package/dist/import/claude/runner.js +280 -0
- package/dist/import/claude/runner.js.map +1 -0
- package/dist/import/claude/summary.d.ts +23 -0
- package/dist/import/claude/summary.d.ts.map +1 -0
- package/dist/import/claude/summary.js +186 -0
- package/dist/import/claude/summary.js.map +1 -0
- package/dist/import/claude/transcript-walk.d.ts +52 -0
- package/dist/import/claude/transcript-walk.d.ts.map +1 -0
- package/dist/import/claude/transcript-walk.js +187 -0
- package/dist/import/claude/transcript-walk.js.map +1 -0
- package/dist/import/concurrent-pool.d.ts +45 -0
- package/dist/import/concurrent-pool.d.ts.map +1 -0
- package/dist/import/concurrent-pool.js +95 -0
- package/dist/import/concurrent-pool.js.map +1 -0
- package/dist/import/emitter.d.ts +29 -0
- package/dist/import/emitter.d.ts.map +1 -0
- package/dist/import/emitter.js +66 -0
- package/dist/import/emitter.js.map +1 -0
- package/dist/import/events/activity.d.ts +23 -0
- package/dist/import/events/activity.d.ts.map +1 -0
- package/dist/import/events/activity.js +45 -0
- package/dist/import/events/activity.js.map +1 -0
- package/dist/import/events/session.d.ts +24 -0
- package/dist/import/events/session.d.ts.map +1 -0
- package/dist/import/events/session.js +47 -0
- package/dist/import/events/session.js.map +1 -0
- package/dist/import/filter.d.ts +47 -0
- package/dist/import/filter.d.ts.map +1 -0
- package/dist/import/filter.js +90 -0
- package/dist/import/filter.js.map +1 -0
- package/dist/import/ids.d.ts +56 -0
- package/dist/import/ids.d.ts.map +1 -0
- package/dist/import/ids.js +87 -0
- package/dist/import/ids.js.map +1 -0
- package/dist/import/index.d.ts +29 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +52 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/marker.d.ts +20 -0
- package/dist/import/marker.d.ts.map +1 -0
- package/dist/import/marker.js +71 -0
- package/dist/import/marker.js.map +1 -0
- package/dist/import/pipeline.d.ts +41 -0
- package/dist/import/pipeline.d.ts.map +1 -0
- package/dist/import/pipeline.js +47 -0
- package/dist/import/pipeline.js.map +1 -0
- package/dist/import/progress.d.ts +20 -0
- package/dist/import/progress.d.ts.map +1 -0
- package/dist/import/progress.js +69 -0
- package/dist/import/progress.js.map +1 -0
- package/dist/import/skip.d.ts +13 -0
- package/dist/import/skip.d.ts.map +1 -0
- package/dist/import/skip.js +24 -0
- package/dist/import/skip.js.map +1 -0
- package/dist/import/types.d.ts +125 -0
- package/dist/import/types.d.ts.map +1 -0
- package/dist/import/types.js +28 -0
- package/dist/import/types.js.map +1 -0
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/collector.d.ts +29 -3
- package/dist/lib/collector.d.ts.map +1 -1
- package/dist/lib/collector.js +118 -8
- package/dist/lib/collector.js.map +1 -1
- package/dist/lib/config.d.ts +240 -83
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +482 -89
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/event.d.ts +72 -0
- package/dist/lib/event.d.ts.map +1 -0
- package/dist/lib/event.js +42 -0
- package/dist/lib/event.js.map +1 -0
- package/dist/lib/gitignore.d.ts +21 -0
- package/dist/lib/gitignore.d.ts.map +1 -0
- package/dist/lib/gitignore.js +54 -0
- package/dist/lib/gitignore.js.map +1 -0
- package/dist/lib/runtime-section.d.ts +118 -0
- package/dist/lib/runtime-section.d.ts.map +1 -0
- package/dist/lib/runtime-section.js +256 -0
- package/dist/lib/runtime-section.js.map +1 -0
- package/dist/lib/telemetry.d.ts +1 -1
- package/dist/lib/telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry.js +4 -1
- package/dist/lib/telemetry.js.map +1 -1
- package/dist/queue/dead-letter.d.ts +5 -1
- package/dist/queue/dead-letter.d.ts.map +1 -1
- package/dist/queue/dead-letter.js +5 -1
- package/dist/queue/dead-letter.js.map +1 -1
- package/dist/queue/drain.d.ts +3 -2
- package/dist/queue/drain.d.ts.map +1 -1
- package/dist/queue/drain.js +3 -2
- package/dist/queue/drain.js.map +1 -1
- package/dist/queue/flush.d.ts +28 -12
- package/dist/queue/flush.d.ts.map +1 -1
- package/dist/queue/flush.js +43 -18
- package/dist/queue/flush.js.map +1 -1
- package/dist/queue/handlers/send-event.d.ts.map +1 -1
- package/dist/queue/handlers/send-event.js.map +1 -1
- package/dist/queue/index.d.ts +1 -2
- package/dist/queue/index.d.ts.map +1 -1
- package/dist/queue/index.js +2 -2
- package/dist/queue/index.js.map +1 -1
- package/dist/queue/paths.d.ts +4 -2
- package/dist/queue/paths.d.ts.map +1 -1
- package/dist/queue/paths.js +4 -2
- package/dist/queue/paths.js.map +1 -1
- package/dist/queue/process-file.d.ts +5 -1
- package/dist/queue/process-file.d.ts.map +1 -1
- package/dist/queue/process-file.js +5 -1
- package/dist/queue/process-file.js.map +1 -1
- package/dist/queue/snapshot.d.ts +4 -1
- package/dist/queue/snapshot.d.ts.map +1 -1
- package/dist/queue/snapshot.js +4 -1
- package/dist/queue/snapshot.js.map +1 -1
- package/dist/queue/spawn.d.ts +1 -3
- package/dist/queue/spawn.d.ts.map +1 -1
- package/dist/queue/spawn.js +1 -3
- package/dist/queue/spawn.js.map +1 -1
- package/dist/queue/submit.d.ts +6 -1
- package/dist/queue/submit.d.ts.map +1 -1
- package/dist/queue/submit.js +6 -1
- package/dist/queue/submit.js.map +1 -1
- package/dist/queue/types.d.ts +5 -1
- package/dist/queue/types.d.ts.map +1 -1
- package/dist/queue/types.js +5 -1
- package/dist/queue/types.js.map +1 -1
- package/dist/queue/worker-log.d.ts +3 -1
- package/dist/queue/worker-log.d.ts.map +1 -1
- package/dist/queue/worker-log.js +3 -1
- package/dist/queue/worker-log.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Time-Range Filter
|
|
3
|
+
*
|
|
4
|
+
* Two-pass filter:
|
|
5
|
+
* 1. mtime — drop transcripts whose `mtimeMs` falls outside [from, to].
|
|
6
|
+
* Already filtered at discovery time (statSync), so no extra I/O here.
|
|
7
|
+
* 2. session-start timestamp — drop transcripts whose first-line
|
|
8
|
+
* `timestamp` is outside the window. Already on the target (read at
|
|
9
|
+
* discovery time), so this step is also pure logic.
|
|
10
|
+
*
|
|
11
|
+
* Also exports `parseSinceDuration` for `--since 30d` / `2w` / `6m` style
|
|
12
|
+
* inputs, and `parseIsoDate` for `--from` / `--to`.
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
import { ImportTarget, ImportTimeRange } from "./types";
|
|
17
|
+
/**
|
|
18
|
+
* Apply both passes. Targets whose mtime AND first-line timestamp both fall
|
|
19
|
+
* inside the window survive. Empty range (`null`) → no filter, all pass.
|
|
20
|
+
*
|
|
21
|
+
* The mtime check is the **outer** gate (we'd discover sessions whose mtime
|
|
22
|
+
* is in-range but whose start is out-of-range — those still pass mtime, fail
|
|
23
|
+
* start-timestamp). The start-timestamp check is the **inner** gate that
|
|
24
|
+
* makes `--from / --to` strict.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyTimeRange(targets: ImportTarget[], range: ImportTimeRange | null): ImportTarget[];
|
|
27
|
+
/**
|
|
28
|
+
* Parse `--since 30d` / `2w` / `6m` / `12h` into ms. Returns `null` when the
|
|
29
|
+
* input is malformed or zero/negative.
|
|
30
|
+
*
|
|
31
|
+
* Suffixes: `h` (hour), `d` (day), `w` (7-day week), `m` (30-day month).
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseSinceDuration(input: string): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Parse an ISO date string (`2025-04-15` or `2025-04-15T12:00:00Z`).
|
|
36
|
+
* Returns `null` when unparseable. Date-only inputs resolve to local
|
|
37
|
+
* midnight (matches the analytics `messages_by_date` convention).
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseIsoDate(input: string): number | null;
|
|
40
|
+
/** Build an `ImportTimeRange` from `--since` / `--from / --to` flags. */
|
|
41
|
+
export declare function buildTimeRange(opts: {
|
|
42
|
+
sinceMs?: number;
|
|
43
|
+
fromMs?: number;
|
|
44
|
+
toMs?: number;
|
|
45
|
+
nowMs: number;
|
|
46
|
+
}): ImportTimeRange | null;
|
|
47
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/import/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAExD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,YAAY,EAAE,CAarG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB/D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGzD;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,GAAG,eAAe,GAAG,IAAI,CAQzB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IronBee CLI — Import Module Time-Range Filter
|
|
4
|
+
*
|
|
5
|
+
* Two-pass filter:
|
|
6
|
+
* 1. mtime — drop transcripts whose `mtimeMs` falls outside [from, to].
|
|
7
|
+
* Already filtered at discovery time (statSync), so no extra I/O here.
|
|
8
|
+
* 2. session-start timestamp — drop transcripts whose first-line
|
|
9
|
+
* `timestamp` is outside the window. Already on the target (read at
|
|
10
|
+
* discovery time), so this step is also pure logic.
|
|
11
|
+
*
|
|
12
|
+
* Also exports `parseSinceDuration` for `--since 30d` / `2w` / `6m` style
|
|
13
|
+
* inputs, and `parseIsoDate` for `--from` / `--to`.
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.applyTimeRange = applyTimeRange;
|
|
19
|
+
exports.parseSinceDuration = parseSinceDuration;
|
|
20
|
+
exports.parseIsoDate = parseIsoDate;
|
|
21
|
+
exports.buildTimeRange = buildTimeRange;
|
|
22
|
+
/**
|
|
23
|
+
* Apply both passes. Targets whose mtime AND first-line timestamp both fall
|
|
24
|
+
* inside the window survive. Empty range (`null`) → no filter, all pass.
|
|
25
|
+
*
|
|
26
|
+
* The mtime check is the **outer** gate (we'd discover sessions whose mtime
|
|
27
|
+
* is in-range but whose start is out-of-range — those still pass mtime, fail
|
|
28
|
+
* start-timestamp). The start-timestamp check is the **inner** gate that
|
|
29
|
+
* makes `--from / --to` strict.
|
|
30
|
+
*/
|
|
31
|
+
function applyTimeRange(targets, range) {
|
|
32
|
+
if (range === null) {
|
|
33
|
+
return targets;
|
|
34
|
+
}
|
|
35
|
+
return targets.filter((t) => {
|
|
36
|
+
if (t.mtimeMs < range.fromMs || t.mtimeMs > range.toMs) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (t.sessionStartMs < range.fromMs || t.sessionStartMs > range.toMs) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse `--since 30d` / `2w` / `6m` / `12h` into ms. Returns `null` when the
|
|
47
|
+
* input is malformed or zero/negative.
|
|
48
|
+
*
|
|
49
|
+
* Suffixes: `h` (hour), `d` (day), `w` (7-day week), `m` (30-day month).
|
|
50
|
+
*/
|
|
51
|
+
function parseSinceDuration(input) {
|
|
52
|
+
const m = input.match(/^(\d+)([hdwm])$/);
|
|
53
|
+
if (m === null) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const value = parseInt(m[1], 10);
|
|
57
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const unit = m[2];
|
|
61
|
+
const HOUR_MS = 60 * 60 * 1000;
|
|
62
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
63
|
+
switch (unit) {
|
|
64
|
+
case "h": return value * HOUR_MS;
|
|
65
|
+
case "d": return value * DAY_MS;
|
|
66
|
+
case "w": return value * 7 * DAY_MS;
|
|
67
|
+
case "m": return value * 30 * DAY_MS;
|
|
68
|
+
default: return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse an ISO date string (`2025-04-15` or `2025-04-15T12:00:00Z`).
|
|
73
|
+
* Returns `null` when unparseable. Date-only inputs resolve to local
|
|
74
|
+
* midnight (matches the analytics `messages_by_date` convention).
|
|
75
|
+
*/
|
|
76
|
+
function parseIsoDate(input) {
|
|
77
|
+
const ts = Date.parse(input);
|
|
78
|
+
return Number.isFinite(ts) ? ts : null;
|
|
79
|
+
}
|
|
80
|
+
/** Build an `ImportTimeRange` from `--since` / `--from / --to` flags. */
|
|
81
|
+
function buildTimeRange(opts) {
|
|
82
|
+
if (opts.sinceMs !== undefined) {
|
|
83
|
+
return { fromMs: opts.nowMs - opts.sinceMs, toMs: opts.nowMs };
|
|
84
|
+
}
|
|
85
|
+
if (opts.fromMs !== undefined) {
|
|
86
|
+
return { fromMs: opts.fromMs, toMs: opts.toMs ?? opts.nowMs };
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/import/filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAaH,wCAaC;AAQD,gDAmBC;AAOD,oCAGC;AAGD,wCAaC;AA3ED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,OAAuB,EAAE,KAA6B;IACjF,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAe,EAAW,EAAE;QAC/C,IAAI,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YACrD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YACnE,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAa;IAC5C,MAAM,CAAC,GAA4B,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,KAAK,GAAW,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,IAAI,GAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAW,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACvC,MAAM,MAAM,GAAW,EAAE,GAAG,OAAO,CAAC;IACpC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,GAAG,OAAO,CAAC;QACjC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,GAAG,MAAM,CAAC;QAChC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC;QACpC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,CAAC;QACrC,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC;IACzB,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,MAAM,EAAE,GAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED,yEAAyE;AACzE,SAAgB,cAAc,CAAC,IAK9B;IACG,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACnE,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Deterministic UUID Derivers
|
|
3
|
+
*
|
|
4
|
+
* Every event emitted by `ironbee import` carries a UUID-shaped `id` derived
|
|
5
|
+
* deterministically from the transcript content (session_id + per-event
|
|
6
|
+
* positional key). Re-running import on the same transcript produces the
|
|
7
|
+
* same ids, so collector-side dedup on `(session_id, id)` collapses
|
|
8
|
+
* duplicates without coordination.
|
|
9
|
+
*
|
|
10
|
+
* Analytics events have their own deriver in `src/analytics/projection.ts`
|
|
11
|
+
* (`deriveSessionAnalyticsEventId`, `deriveTurnEventId`, `deriveStepEventId`).
|
|
12
|
+
* This module covers the non-analytics import-emitted events: session,
|
|
13
|
+
* activity, tool_call, file_change.
|
|
14
|
+
*
|
|
15
|
+
* All formulas: `formatHexAsUuid(sha256("<event_type>:" + session_id + ":"
|
|
16
|
+
* + <positional_key>))` — positional key is `turn_index` for activity ids
|
|
17
|
+
* and `tool_use.id` for tool_call / file_change. Same `(transcript content,
|
|
18
|
+
* session_id)` always produces the same UUID.
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveSessionStartEventId(sessionId: string): string;
|
|
21
|
+
export declare function deriveSessionEndEventId(sessionId: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Activity (turn) ids. `turnIndex` is the analytics-side `turn_index` (1-based,
|
|
24
|
+
* positional in the transcript). Activity is one-per-user-turn: host_inject
|
|
25
|
+
* continuation turns are filtered out before we ever derive an id, so there
|
|
26
|
+
* are no gaps from the import emitter's perspective.
|
|
27
|
+
*/
|
|
28
|
+
export declare function deriveActivityStartEventId(sessionId: string, turnIndex: number): string;
|
|
29
|
+
export declare function deriveActivityEndEventId(sessionId: string, turnIndex: number): string;
|
|
30
|
+
/**
|
|
31
|
+
/**
|
|
32
|
+
* Activity-id (the `activity_id` foreign key carried by child events).
|
|
33
|
+
*
|
|
34
|
+
* Format: UUID-shaped (8-4-4-4-12) — matches what live mode emits (live
|
|
35
|
+
* uses `randomUUID()` at the SessionStart hook, baked into `state.json`,
|
|
36
|
+
* then read by every PreToolUse). Backends that store `activity_id` as a
|
|
37
|
+
* UUID column accept both live and import values uniformly.
|
|
38
|
+
*
|
|
39
|
+
* Determinism: same `(session_id, turn_index, start_time)` tuple always
|
|
40
|
+
* produces the same UUID, so re-imports collide cleanly. Independent of
|
|
41
|
+
* `session_turn_analytics.turn_id` (which keeps its 16-char hex form per
|
|
42
|
+
* analytics spec) — they're separate identifiers for related-but-distinct
|
|
43
|
+
* concepts (hook-runtime activity vs. analytics-projection turn).
|
|
44
|
+
*/
|
|
45
|
+
export declare function deriveActivityId(sessionId: string, turnIndex: number, startTime: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Default tool_call event id when `_metadata.toolCallId` is absent (transcript
|
|
48
|
+
* predates the `_metadata.toolCallId` convention). Falls back to a
|
|
49
|
+
* deterministic derivation from the host's `tool_use.id`. For transcripts
|
|
50
|
+
* that DO carry `_metadata.toolCallId`, the import emitter uses that
|
|
51
|
+
* UUID verbatim instead — collapses cleanly with the live MCP-shipped
|
|
52
|
+
* event id on the collector.
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveToolCallEventIdFromToolUseId(sessionId: string, toolUseId: string): string;
|
|
55
|
+
export declare function deriveFileChangeEventId(sessionId: string, toolUseId: string): string;
|
|
56
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/import/ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGhG;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/F;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IronBee CLI — Import Module Deterministic UUID Derivers
|
|
4
|
+
*
|
|
5
|
+
* Every event emitted by `ironbee import` carries a UUID-shaped `id` derived
|
|
6
|
+
* deterministically from the transcript content (session_id + per-event
|
|
7
|
+
* positional key). Re-running import on the same transcript produces the
|
|
8
|
+
* same ids, so collector-side dedup on `(session_id, id)` collapses
|
|
9
|
+
* duplicates without coordination.
|
|
10
|
+
*
|
|
11
|
+
* Analytics events have their own deriver in `src/analytics/projection.ts`
|
|
12
|
+
* (`deriveSessionAnalyticsEventId`, `deriveTurnEventId`, `deriveStepEventId`).
|
|
13
|
+
* This module covers the non-analytics import-emitted events: session,
|
|
14
|
+
* activity, tool_call, file_change.
|
|
15
|
+
*
|
|
16
|
+
* All formulas: `formatHexAsUuid(sha256("<event_type>:" + session_id + ":"
|
|
17
|
+
* + <positional_key>))` — positional key is `turn_index` for activity ids
|
|
18
|
+
* and `tool_use.id` for tool_call / file_change. Same `(transcript content,
|
|
19
|
+
* session_id)` always produces the same UUID.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.deriveSessionStartEventId = deriveSessionStartEventId;
|
|
23
|
+
exports.deriveSessionEndEventId = deriveSessionEndEventId;
|
|
24
|
+
exports.deriveActivityStartEventId = deriveActivityStartEventId;
|
|
25
|
+
exports.deriveActivityEndEventId = deriveActivityEndEventId;
|
|
26
|
+
exports.deriveActivityId = deriveActivityId;
|
|
27
|
+
exports.deriveToolCallEventIdFromToolUseId = deriveToolCallEventIdFromToolUseId;
|
|
28
|
+
exports.deriveFileChangeEventId = deriveFileChangeEventId;
|
|
29
|
+
const crypto_1 = require("crypto");
|
|
30
|
+
const projection_1 = require("../analytics/projection");
|
|
31
|
+
/** SHA-256 the input and format the first 32 hex chars as a UUID. */
|
|
32
|
+
function sha256Uuid(input) {
|
|
33
|
+
const hex32 = (0, crypto_1.createHash)("sha256").update(input).digest("hex").slice(0, 32);
|
|
34
|
+
return (0, projection_1.formatHexAsUuid)(hex32);
|
|
35
|
+
}
|
|
36
|
+
function deriveSessionStartEventId(sessionId) {
|
|
37
|
+
return sha256Uuid(`session_start:${sessionId}`);
|
|
38
|
+
}
|
|
39
|
+
function deriveSessionEndEventId(sessionId) {
|
|
40
|
+
return sha256Uuid(`session_end:${sessionId}`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Activity (turn) ids. `turnIndex` is the analytics-side `turn_index` (1-based,
|
|
44
|
+
* positional in the transcript). Activity is one-per-user-turn: host_inject
|
|
45
|
+
* continuation turns are filtered out before we ever derive an id, so there
|
|
46
|
+
* are no gaps from the import emitter's perspective.
|
|
47
|
+
*/
|
|
48
|
+
function deriveActivityStartEventId(sessionId, turnIndex) {
|
|
49
|
+
return sha256Uuid(`activity_start:${sessionId}:${turnIndex}`);
|
|
50
|
+
}
|
|
51
|
+
function deriveActivityEndEventId(sessionId, turnIndex) {
|
|
52
|
+
return sha256Uuid(`activity_end:${sessionId}:${turnIndex}`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
/**
|
|
56
|
+
* Activity-id (the `activity_id` foreign key carried by child events).
|
|
57
|
+
*
|
|
58
|
+
* Format: UUID-shaped (8-4-4-4-12) — matches what live mode emits (live
|
|
59
|
+
* uses `randomUUID()` at the SessionStart hook, baked into `state.json`,
|
|
60
|
+
* then read by every PreToolUse). Backends that store `activity_id` as a
|
|
61
|
+
* UUID column accept both live and import values uniformly.
|
|
62
|
+
*
|
|
63
|
+
* Determinism: same `(session_id, turn_index, start_time)` tuple always
|
|
64
|
+
* produces the same UUID, so re-imports collide cleanly. Independent of
|
|
65
|
+
* `session_turn_analytics.turn_id` (which keeps its 16-char hex form per
|
|
66
|
+
* analytics spec) — they're separate identifiers for related-but-distinct
|
|
67
|
+
* concepts (hook-runtime activity vs. analytics-projection turn).
|
|
68
|
+
*/
|
|
69
|
+
function deriveActivityId(sessionId, turnIndex, startTime) {
|
|
70
|
+
const hex32 = (0, crypto_1.createHash)("sha256").update(`${sessionId}|${turnIndex}|${startTime}`).digest("hex").slice(0, 32);
|
|
71
|
+
return (0, projection_1.formatHexAsUuid)(hex32);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Default tool_call event id when `_metadata.toolCallId` is absent (transcript
|
|
75
|
+
* predates the `_metadata.toolCallId` convention). Falls back to a
|
|
76
|
+
* deterministic derivation from the host's `tool_use.id`. For transcripts
|
|
77
|
+
* that DO carry `_metadata.toolCallId`, the import emitter uses that
|
|
78
|
+
* UUID verbatim instead — collapses cleanly with the live MCP-shipped
|
|
79
|
+
* event id on the collector.
|
|
80
|
+
*/
|
|
81
|
+
function deriveToolCallEventIdFromToolUseId(sessionId, toolUseId) {
|
|
82
|
+
return sha256Uuid(`tool_call:${sessionId}:${toolUseId}`);
|
|
83
|
+
}
|
|
84
|
+
function deriveFileChangeEventId(sessionId, toolUseId) {
|
|
85
|
+
return sha256Uuid(`file_change:${sessionId}:${toolUseId}`);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/import/ids.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAWH,8DAEC;AAED,0DAEC;AAQD,gEAEC;AAED,4DAEC;AAiBD,4CAGC;AAUD,gFAEC;AAED,0DAEC;AAjED,mCAAoC;AACpC,wDAA0D;AAE1D,qEAAqE;AACrE,SAAS,UAAU,CAAC,KAAa;IAC7B,MAAM,KAAK,GAAW,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpF,OAAO,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,yBAAyB,CAAC,SAAiB;IACvD,OAAO,UAAU,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,uBAAuB,CAAC,SAAiB;IACrD,OAAO,UAAU,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,SAAiB,EAAE,SAAiB;IAC3E,OAAO,UAAU,CAAC,kBAAkB,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;AAClE,CAAC;AAED,SAAgB,wBAAwB,CAAC,SAAiB,EAAE,SAAiB;IACzE,OAAO,UAAU,CAAC,gBAAgB,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,gBAAgB,CAAC,SAAiB,EAAE,SAAiB,EAAE,SAAiB;IACpF,MAAM,KAAK,GAAW,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvH,OAAO,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kCAAkC,CAAC,SAAiB,EAAE,SAAiB;IACnF,OAAO,UAAU,CAAC,aAAa,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,uBAAuB,CAAC,SAAiB,EAAE,SAAiB;IACxE,OAAO,UAAU,CAAC,eAAe,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Public Barrel
|
|
3
|
+
*
|
|
4
|
+
* Exposes ONLY the client-agnostic API. Client-specific modules
|
|
5
|
+
* (`claude/**`, future `cursor/**`) are NOT re-exported here —
|
|
6
|
+
* `commands/import.ts` and any other consumer must go through the
|
|
7
|
+
* generic dispatcher in `pipeline.ts` so adding a new client never
|
|
8
|
+
* forces a CLI change.
|
|
9
|
+
*
|
|
10
|
+
* Public surface:
|
|
11
|
+
* - findTranscripts(scope) — discovery (dispatched per client)
|
|
12
|
+
* - estimateImport(opts) — dry-run estimator (dispatched per client)
|
|
13
|
+
* - importSession(opts) — per-session driver (dispatched per client)
|
|
14
|
+
* - applyTimeRange / parseSinceDuration / parseIsoDate / buildTimeRange — generic
|
|
15
|
+
* - shouldSkip — generic skip rule
|
|
16
|
+
* - writeImportMarker / readImportMarker — generic marker file R/W
|
|
17
|
+
* - postEvents — generic collector POST helper
|
|
18
|
+
* - ProgressReporter — generic progress UI
|
|
19
|
+
* - All `Import*` types
|
|
20
|
+
*/
|
|
21
|
+
export { findTranscripts, estimateImport, importSession, ImportSessionOpts, EstimateOpts } from "./pipeline";
|
|
22
|
+
export { runConcurrentPool, ConcurrentPoolOpts } from "./concurrent-pool";
|
|
23
|
+
export { applyTimeRange, parseSinceDuration, parseIsoDate, buildTimeRange } from "./filter";
|
|
24
|
+
export { shouldSkip } from "./skip";
|
|
25
|
+
export { writeImportMarker, readImportMarker, MARKER_SCHEMA_VERSION, markerPath } from "./marker";
|
|
26
|
+
export { postEvents, EmitterOpts } from "./emitter";
|
|
27
|
+
export { ProgressReporter } from "./progress";
|
|
28
|
+
export { ImportEventCounts, ImportMarker, ImportOptions, ImportProjectSummary, ImportResult, ImportScope, ImportSummary, ImportTarget, ImportTimeRange, DerivedEvent, emptyEventCounts, } from "./types";
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG7G,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IronBee CLI — Import Module Public Barrel
|
|
4
|
+
*
|
|
5
|
+
* Exposes ONLY the client-agnostic API. Client-specific modules
|
|
6
|
+
* (`claude/**`, future `cursor/**`) are NOT re-exported here —
|
|
7
|
+
* `commands/import.ts` and any other consumer must go through the
|
|
8
|
+
* generic dispatcher in `pipeline.ts` so adding a new client never
|
|
9
|
+
* forces a CLI change.
|
|
10
|
+
*
|
|
11
|
+
* Public surface:
|
|
12
|
+
* - findTranscripts(scope) — discovery (dispatched per client)
|
|
13
|
+
* - estimateImport(opts) — dry-run estimator (dispatched per client)
|
|
14
|
+
* - importSession(opts) — per-session driver (dispatched per client)
|
|
15
|
+
* - applyTimeRange / parseSinceDuration / parseIsoDate / buildTimeRange — generic
|
|
16
|
+
* - shouldSkip — generic skip rule
|
|
17
|
+
* - writeImportMarker / readImportMarker — generic marker file R/W
|
|
18
|
+
* - postEvents — generic collector POST helper
|
|
19
|
+
* - ProgressReporter — generic progress UI
|
|
20
|
+
* - All `Import*` types
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.emptyEventCounts = exports.ProgressReporter = exports.postEvents = exports.markerPath = exports.MARKER_SCHEMA_VERSION = exports.readImportMarker = exports.writeImportMarker = exports.shouldSkip = exports.buildTimeRange = exports.parseIsoDate = exports.parseSinceDuration = exports.applyTimeRange = exports.runConcurrentPool = exports.importSession = exports.estimateImport = exports.findTranscripts = void 0;
|
|
24
|
+
// Generic dispatcher (the one entry point that knows about clients).
|
|
25
|
+
var pipeline_1 = require("./pipeline");
|
|
26
|
+
Object.defineProperty(exports, "findTranscripts", { enumerable: true, get: function () { return pipeline_1.findTranscripts; } });
|
|
27
|
+
Object.defineProperty(exports, "estimateImport", { enumerable: true, get: function () { return pipeline_1.estimateImport; } });
|
|
28
|
+
Object.defineProperty(exports, "importSession", { enumerable: true, get: function () { return pipeline_1.importSession; } });
|
|
29
|
+
// Generic bounded-concurrency pool (used by the CLI command, exposed for testability).
|
|
30
|
+
var concurrent_pool_1 = require("./concurrent-pool");
|
|
31
|
+
Object.defineProperty(exports, "runConcurrentPool", { enumerable: true, get: function () { return concurrent_pool_1.runConcurrentPool; } });
|
|
32
|
+
// Generic helpers — no client-specific logic.
|
|
33
|
+
var filter_1 = require("./filter");
|
|
34
|
+
Object.defineProperty(exports, "applyTimeRange", { enumerable: true, get: function () { return filter_1.applyTimeRange; } });
|
|
35
|
+
Object.defineProperty(exports, "parseSinceDuration", { enumerable: true, get: function () { return filter_1.parseSinceDuration; } });
|
|
36
|
+
Object.defineProperty(exports, "parseIsoDate", { enumerable: true, get: function () { return filter_1.parseIsoDate; } });
|
|
37
|
+
Object.defineProperty(exports, "buildTimeRange", { enumerable: true, get: function () { return filter_1.buildTimeRange; } });
|
|
38
|
+
var skip_1 = require("./skip");
|
|
39
|
+
Object.defineProperty(exports, "shouldSkip", { enumerable: true, get: function () { return skip_1.shouldSkip; } });
|
|
40
|
+
var marker_1 = require("./marker");
|
|
41
|
+
Object.defineProperty(exports, "writeImportMarker", { enumerable: true, get: function () { return marker_1.writeImportMarker; } });
|
|
42
|
+
Object.defineProperty(exports, "readImportMarker", { enumerable: true, get: function () { return marker_1.readImportMarker; } });
|
|
43
|
+
Object.defineProperty(exports, "MARKER_SCHEMA_VERSION", { enumerable: true, get: function () { return marker_1.MARKER_SCHEMA_VERSION; } });
|
|
44
|
+
Object.defineProperty(exports, "markerPath", { enumerable: true, get: function () { return marker_1.markerPath; } });
|
|
45
|
+
var emitter_1 = require("./emitter");
|
|
46
|
+
Object.defineProperty(exports, "postEvents", { enumerable: true, get: function () { return emitter_1.postEvents; } });
|
|
47
|
+
var progress_1 = require("./progress");
|
|
48
|
+
Object.defineProperty(exports, "ProgressReporter", { enumerable: true, get: function () { return progress_1.ProgressReporter; } });
|
|
49
|
+
// Types.
|
|
50
|
+
var types_1 = require("./types");
|
|
51
|
+
Object.defineProperty(exports, "emptyEventCounts", { enumerable: true, get: function () { return types_1.emptyEventCounts; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/import/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qEAAqE;AACrE,uCAA6G;AAApG,2GAAA,eAAe,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,yGAAA,aAAa,OAAA;AAEvD,uFAAuF;AACvF,qDAA0E;AAAjE,oHAAA,iBAAiB,OAAA;AAE1B,8CAA8C;AAC9C,mCAA4F;AAAnF,wGAAA,cAAc,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,wGAAA,cAAc,OAAA;AACzE,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,mCAAkG;AAAzF,2GAAA,iBAAiB,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,+GAAA,qBAAqB,OAAA;AAAE,oGAAA,UAAU,OAAA;AAC/E,qCAAoD;AAA3C,qGAAA,UAAU,OAAA;AACnB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AAEzB,SAAS;AACT,iCAYiB;AADb,yGAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Marker File
|
|
3
|
+
*
|
|
4
|
+
* Written to `<projectDir>/.ironbee/sessions/<session_id>/imported.json`
|
|
5
|
+
* after every event for the session has been POSTed successfully. Together
|
|
6
|
+
* with the skip rule, the marker is what makes import idempotent across
|
|
7
|
+
* re-runs ().
|
|
8
|
+
*
|
|
9
|
+
* If `projectDir` does not exist on disk (synthetic projectDir from
|
|
10
|
+
* undecoded `--all-projects` folder), the marker write is a no-op with a
|
|
11
|
+
* debug log — re-runs would re-emit, accepted trade-off.
|
|
12
|
+
*/
|
|
13
|
+
import { ImportEventCounts, ImportMarker } from "./types";
|
|
14
|
+
export declare const MARKER_SCHEMA_VERSION: string;
|
|
15
|
+
export declare function markerPath(projectDir: string, sessionId: string): string;
|
|
16
|
+
/** Persist the marker. Returns `false` when the parent project doesn't exist. */
|
|
17
|
+
export declare function writeImportMarker(projectDir: string, sessionId: string, transcriptPath: string, transcriptOffset: number, eventsSent: ImportEventCounts): boolean;
|
|
18
|
+
/** Read an existing marker. Returns `null` when missing or unreadable. */
|
|
19
|
+
export declare function readImportMarker(projectDir: string, sessionId: string): ImportMarker | null;
|
|
20
|
+
//# sourceMappingURL=marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../src/import/marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,qBAAqB,EAAE,MAAc,CAAC;AAEnD,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,iBAAiB,GAC9B,OAAO,CA0BT;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAY3F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IronBee CLI — Import Module Marker File
|
|
4
|
+
*
|
|
5
|
+
* Written to `<projectDir>/.ironbee/sessions/<session_id>/imported.json`
|
|
6
|
+
* after every event for the session has been POSTed successfully. Together
|
|
7
|
+
* with the skip rule, the marker is what makes import idempotent across
|
|
8
|
+
* re-runs ().
|
|
9
|
+
*
|
|
10
|
+
* If `projectDir` does not exist on disk (synthetic projectDir from
|
|
11
|
+
* undecoded `--all-projects` folder), the marker write is a no-op with a
|
|
12
|
+
* debug log — re-runs would re-emit, accepted trade-off.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MARKER_SCHEMA_VERSION = void 0;
|
|
16
|
+
exports.markerPath = markerPath;
|
|
17
|
+
exports.writeImportMarker = writeImportMarker;
|
|
18
|
+
exports.readImportMarker = readImportMarker;
|
|
19
|
+
const fs_1 = require("fs");
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const logger_1 = require("../lib/logger");
|
|
22
|
+
const gitignore_1 = require("../lib/gitignore");
|
|
23
|
+
exports.MARKER_SCHEMA_VERSION = "1.0";
|
|
24
|
+
function markerPath(projectDir, sessionId) {
|
|
25
|
+
return (0, path_1.join)(projectDir, ".ironbee", "sessions", sessionId, "imported.json");
|
|
26
|
+
}
|
|
27
|
+
/** Persist the marker. Returns `false` when the parent project doesn't exist. */
|
|
28
|
+
function writeImportMarker(projectDir, sessionId, transcriptPath, transcriptOffset, eventsSent) {
|
|
29
|
+
if (!(0, fs_1.existsSync)(projectDir)) {
|
|
30
|
+
logger_1.logger.debug(`import marker: projectDir ${projectDir} does not exist — skipping marker write`);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Idempotently ensure `.ironbee/sessions/` is gitignored. Operators
|
|
34
|
+
// who skip `ironbee install` (import-only flows) wouldn't otherwise
|
|
35
|
+
// get the gitignore entry, and the marker file we're about to write
|
|
36
|
+
// would surface in `git status`. No-op when already present.
|
|
37
|
+
(0, gitignore_1.ensureIronBeeGitignored)(projectDir);
|
|
38
|
+
const target = markerPath(projectDir, sessionId);
|
|
39
|
+
const marker = {
|
|
40
|
+
imported_at: new Date().toISOString(),
|
|
41
|
+
transcript_path: transcriptPath,
|
|
42
|
+
transcript_offset: transcriptOffset,
|
|
43
|
+
events_sent: eventsSent,
|
|
44
|
+
schema_version: exports.MARKER_SCHEMA_VERSION,
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(target), { recursive: true });
|
|
48
|
+
(0, fs_1.writeFileSync)(target, JSON.stringify(marker, null, 2) + "\n");
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
logger_1.logger.debug(`import marker: write ${target} failed: ${e instanceof Error ? e.message : e}`);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Read an existing marker. Returns `null` when missing or unreadable. */
|
|
57
|
+
function readImportMarker(projectDir, sessionId) {
|
|
58
|
+
const target = markerPath(projectDir, sessionId);
|
|
59
|
+
if (!(0, fs_1.existsSync)(target)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const text = (0, fs_1.readFileSync)(target, "utf-8");
|
|
64
|
+
return JSON.parse(text);
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
logger_1.logger.debug(`import marker: read ${target} failed: ${e instanceof Error ? e.message : e}`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../src/import/marker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAUH,gCAEC;AAGD,8CAgCC;AAGD,4CAYC;AA5DD,2BAAwE;AACxE,+BAAqC;AACrC,0CAAuC;AACvC,gDAA2D;AAG9C,QAAA,qBAAqB,GAAW,KAAK,CAAC;AAEnD,SAAgB,UAAU,CAAC,UAAkB,EAAE,SAAiB;IAC5D,OAAO,IAAA,WAAI,EAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAChF,CAAC;AAED,iFAAiF;AACjF,SAAgB,iBAAiB,CAC7B,UAAkB,EAClB,SAAiB,EACjB,cAAsB,EACtB,gBAAwB,EACxB,UAA6B;IAE7B,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,eAAM,CAAC,KAAK,CAAC,6BAA6B,UAAU,yCAAyC,CAAC,CAAC;QAC/F,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,6DAA6D;IAC7D,IAAA,mCAAuB,EAAC,UAAU,CAAC,CAAC;IACpC,MAAM,MAAM,GAAW,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,MAAM,GAAiB;QACzB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,eAAe,EAAE,cAAc;QAC/B,iBAAiB,EAAE,gBAAgB;QACnC,WAAW,EAAE,UAAU;QACvB,cAAc,EAAE,6BAAqB;KACxC,CAAC;IACF,IAAI,CAAC;QACD,IAAA,cAAS,EAAC,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,IAAA,kBAAa,EAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,wBAAwB,MAAM,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7F,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,0EAA0E;AAC1E,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IAClE,MAAM,MAAM,GAAW,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACzD,IAAI,CAAC,IAAA,eAAU,EAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,GAAW,IAAA,iBAAY,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC;IAC5C,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,uBAAuB,MAAM,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Generic Pipeline Dispatcher
|
|
3
|
+
*
|
|
4
|
+
* The single point that knows about client-specific runners. v1 only
|
|
5
|
+
* ships Claude; when Cursor support lands, every function here gains a
|
|
6
|
+
* branch on `scope.client` (or per-target discriminator) that dispatches
|
|
7
|
+
* to `cursor/{discovery,summary,runner}` — but no other file in the
|
|
8
|
+
* import tree changes. This is the contract that lets `commands/import.ts`
|
|
9
|
+
* stay client-agnostic.
|
|
10
|
+
*
|
|
11
|
+
* Isolation principle: Claude/Cursor logic stays separated
|
|
12
|
+
* by file. The CLI command depends on this dispatcher, NOT on any
|
|
13
|
+
* `claude/*` module directly.
|
|
14
|
+
*/
|
|
15
|
+
import { ImportResult, ImportScope, ImportSummary, ImportTarget, ImportTimeRange } from "./types";
|
|
16
|
+
export interface ImportSessionOpts {
|
|
17
|
+
target: ImportTarget;
|
|
18
|
+
force: boolean;
|
|
19
|
+
/** Events per collector POST; null = use target/default. */
|
|
20
|
+
batchSize?: number | null;
|
|
21
|
+
}
|
|
22
|
+
export interface EstimateOpts {
|
|
23
|
+
targets: ImportTarget[];
|
|
24
|
+
timeRange: ImportTimeRange | null;
|
|
25
|
+
concurrency: number;
|
|
26
|
+
force: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Discover candidate transcripts on disk. v1 always routes through Claude;
|
|
30
|
+
* when Cursor lands, this branches on `scope` (or a separate `--client`
|
|
31
|
+
* flag) and dispatches to `cursor/discovery`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findTranscripts(scope: ImportScope): ImportTarget[];
|
|
34
|
+
/**
|
|
35
|
+
* Pre-pass estimate for the dry-run summary. Same dispatch shape as
|
|
36
|
+
* `findTranscripts` — currently Claude-only.
|
|
37
|
+
*/
|
|
38
|
+
export declare function estimateImport(opts: EstimateOpts): ImportSummary;
|
|
39
|
+
/** Per-session entry point. */
|
|
40
|
+
export declare function importSession(opts: ImportSessionOpts): Promise<ImportResult>;
|
|
41
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/import/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKlG,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,EAAE,CAElE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAOhE;AAED,+BAA+B;AAC/B,wBAAsB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAElF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IronBee CLI — Import Module Generic Pipeline Dispatcher
|
|
4
|
+
*
|
|
5
|
+
* The single point that knows about client-specific runners. v1 only
|
|
6
|
+
* ships Claude; when Cursor support lands, every function here gains a
|
|
7
|
+
* branch on `scope.client` (or per-target discriminator) that dispatches
|
|
8
|
+
* to `cursor/{discovery,summary,runner}` — but no other file in the
|
|
9
|
+
* import tree changes. This is the contract that lets `commands/import.ts`
|
|
10
|
+
* stay client-agnostic.
|
|
11
|
+
*
|
|
12
|
+
* Isolation principle: Claude/Cursor logic stays separated
|
|
13
|
+
* by file. The CLI command depends on this dispatcher, NOT on any
|
|
14
|
+
* `claude/*` module directly.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.findTranscripts = findTranscripts;
|
|
18
|
+
exports.estimateImport = estimateImport;
|
|
19
|
+
exports.importSession = importSession;
|
|
20
|
+
const discovery_1 = require("./claude/discovery");
|
|
21
|
+
const summary_1 = require("./claude/summary");
|
|
22
|
+
const runner_1 = require("./claude/runner");
|
|
23
|
+
/**
|
|
24
|
+
* Discover candidate transcripts on disk. v1 always routes through Claude;
|
|
25
|
+
* when Cursor lands, this branches on `scope` (or a separate `--client`
|
|
26
|
+
* flag) and dispatches to `cursor/discovery`.
|
|
27
|
+
*/
|
|
28
|
+
function findTranscripts(scope) {
|
|
29
|
+
return (0, discovery_1.findClaudeTranscripts)(scope);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Pre-pass estimate for the dry-run summary. Same dispatch shape as
|
|
33
|
+
* `findTranscripts` — currently Claude-only.
|
|
34
|
+
*/
|
|
35
|
+
function estimateImport(opts) {
|
|
36
|
+
return (0, summary_1.estimateClaudeImport)({
|
|
37
|
+
targets: opts.targets,
|
|
38
|
+
timeRange: opts.timeRange,
|
|
39
|
+
concurrency: opts.concurrency,
|
|
40
|
+
force: opts.force,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Per-session entry point. */
|
|
44
|
+
async function importSession(opts) {
|
|
45
|
+
return (0, runner_1.importClaudeSession)({ target: opts.target, force: opts.force, batchSize: opts.batchSize ?? null });
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/import/pipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AA0BH,0CAEC;AAMD,wCAOC;AAGD,sCAEC;AA3CD,kDAA6E;AAC7E,8CAAwD;AACxD,4CAAsD;AAgBtD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,KAAkB;IAC9C,OAAO,IAAA,iCAAc,EAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,IAAkB;IAC7C,OAAO,IAAA,8BAAoB,EAAC;QACxB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;KACpB,CAAC,CAAC;AACP,CAAC;AAED,+BAA+B;AACxB,KAAK,UAAU,aAAa,CAAC,IAAuB;IACvD,OAAO,IAAA,4BAAmB,EAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Import Module Progress Reporter
|
|
3
|
+
*
|
|
4
|
+
* Thin stdout-write helper for per-session progress lines + final summary.
|
|
5
|
+
* Stays out of `pipeline.ts` so the pipeline core is free of formatting
|
|
6
|
+
* concerns and easy to unit-test.
|
|
7
|
+
*/
|
|
8
|
+
import { ImportResult } from "./types";
|
|
9
|
+
export declare class ProgressReporter {
|
|
10
|
+
private importedCount;
|
|
11
|
+
private skippedCount;
|
|
12
|
+
private failedCount;
|
|
13
|
+
private startedAtMs;
|
|
14
|
+
private totalSessions;
|
|
15
|
+
constructor(totalSessions: number);
|
|
16
|
+
onSessionStart(sessionId: string, idx: number): void;
|
|
17
|
+
onSessionComplete(result: ImportResult, idx: number): void;
|
|
18
|
+
finalSummary(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/import/progress.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,gBAAgB;IACzB,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,aAAa,CAAa;gBAEtB,aAAa,EAAE,MAAM;IAIjC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAKpD,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAgB1D,YAAY,IAAI,IAAI;CAavB"}
|