@contentful/experience-design-system-cli 2.26.1-dev-build-a852362.0 → 2.26.1-dev-build-f03f014.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/dist/package.json +14 -10
- package/dist/src/index.js +34937 -9
- package/dist/src/lib/cli-path.d.ts +4 -0
- package/dist/src/runs/export-helpers.d.ts +1 -12
- package/dist/src/runs/push-helpers.d.ts +1 -6
- package/package.json +12 -7
- package/skills/generate-components.md +427 -0
- package/skills/generate-tokens.md +194 -0
- package/skills/select-components.md +224 -0
- package/dist/src/analytics/apply.js +0 -30
- package/dist/src/analytics/client.js +0 -81
- package/dist/src/analytics/constants.js +0 -4
- package/dist/src/analytics/env.js +0 -14
- package/dist/src/analytics/exit.js +0 -24
- package/dist/src/analytics/index.js +0 -9
- package/dist/src/analytics/normalize.js +0 -18
- package/dist/src/analytics/os.js +0 -13
- package/dist/src/analytics/session.js +0 -15
- package/dist/src/analytics/tracker.js +0 -126
- package/dist/src/analytics/types.js +0 -1
- package/dist/src/analyze/build-analyze-view-rows.js +0 -63
- package/dist/src/analyze/command.js +0 -599
- package/dist/src/analyze/composite-closure.js +0 -0
- package/dist/src/analyze/composition/agent-parser/author-prompt.js +0 -22
- package/dist/src/analyze/composition/agent-parser/extract-parser.js +0 -44
- package/dist/src/analyze/composition/agent-parser/load-prompt.js +0 -31
- package/dist/src/analyze/composition/agent-parser/resolve-via-parser.js +0 -88
- package/dist/src/analyze/composition/agent-parser/sandbox.js +0 -187
- package/dist/src/analyze/composition/apply-mapping.js +0 -67
- package/dist/src/analyze/composition/candidate-critic-agent.js +0 -39
- package/dist/src/analyze/composition/candidate-critic.js +0 -63
- package/dist/src/analyze/composition/candidate-files.js +0 -131
- package/dist/src/analyze/composition/composition-cache-key.js +0 -19
- package/dist/src/analyze/composition/interchange-schema.js +0 -61
- package/dist/src/analyze/composition/manifest-doc-evidence.js +0 -136
- package/dist/src/analyze/composition/merge-edges.js +0 -70
- package/dist/src/analyze/composition/parse-map-edges.js +0 -55
- package/dist/src/analyze/composition/resolve-mapping-cli.js +0 -29
- package/dist/src/analyze/composition/resolve-mapping.js +0 -111
- package/dist/src/analyze/cycle-detection.js +0 -234
- package/dist/src/analyze/cycle-view.js +0 -28
- package/dist/src/analyze/fuzzy-search.js +0 -55
- package/dist/src/analyze/issue-inheritance.js +0 -108
- package/dist/src/analyze/lineage.js +0 -0
- package/dist/src/analyze/scope-gate-cascade.js +0 -170
- package/dist/src/analyze/search-neighborhood.js +0 -56
- package/dist/src/analyze/select/command.js +0 -484
- package/dist/src/analyze/select/index.js +0 -5
- package/dist/src/analyze/select/parser.js +0 -53
- package/dist/src/analyze/select/persistence.js +0 -80
- package/dist/src/analyze/select/preview-annotations.js +0 -62
- package/dist/src/analyze/select/stdout.js +0 -3
- package/dist/src/analyze/select/tui/App.js +0 -483
- package/dist/src/analyze/select/tui/components/ComponentDetail.js +0 -48
- package/dist/src/analyze/select/tui/components/ComponentRationalePanel.js +0 -125
- package/dist/src/analyze/select/tui/components/FieldEditor.js +0 -1131
- package/dist/src/analyze/select/tui/components/FinalizeDialog.js +0 -36
- package/dist/src/analyze/select/tui/components/GotoBanner.js +0 -30
- package/dist/src/analyze/select/tui/components/GroupedSidebar.js +0 -517
- package/dist/src/analyze/select/tui/components/HelpOverlay.js +0 -17
- package/dist/src/analyze/select/tui/components/JsonEditor.js +0 -131
- package/dist/src/analyze/select/tui/components/JsonPanel.js +0 -66
- package/dist/src/analyze/select/tui/components/LineagePanel.js +0 -22
- package/dist/src/analyze/select/tui/components/PreviewSummaryBar.js +0 -29
- package/dist/src/analyze/select/tui/components/QuitDialog.js +0 -14
- package/dist/src/analyze/select/tui/components/RationalePanel.js +0 -80
- package/dist/src/analyze/select/tui/components/Sidebar.js +0 -92
- package/dist/src/analyze/select/tui/components/SourcePanel.js +0 -52
- package/dist/src/analyze/select/tui/components/StatusBar.js +0 -7
- package/dist/src/analyze/select/tui/components/TopBar.js +0 -10
- package/dist/src/analyze/select/tui/components/removed-components-text.js +0 -11
- package/dist/src/analyze/select/tui/hooks/scroll-offset.js +0 -26
- package/dist/src/analyze/select/tui/hooks/useImmediateInput.js +0 -66
- package/dist/src/analyze/select/tui/hooks/useKeymap.js +0 -67
- package/dist/src/analyze/select/tui/hooks/useSession.js +0 -52
- package/dist/src/analyze/select/tui/hooks/useUndo.js +0 -26
- package/dist/src/analyze/select/tui/theme.js +0 -28
- package/dist/src/analyze/select/types.js +0 -39
- package/dist/src/analyze/select-agent/command.js +0 -558
- package/dist/src/analyze/select-agent/context-builder.js +0 -197
- package/dist/src/analyze/select-agent/show-rationale.js +0 -92
- package/dist/src/analyze/selection-cascade.js +0 -19
- package/dist/src/analyze/slot-graph.js +0 -17
- package/dist/src/analyze/tui/AnalyzeView.js +0 -64
- package/dist/src/apply/api-client.js +0 -440
- package/dist/src/apply/command.js +0 -845
- package/dist/src/apply/manifest.js +0 -1
- package/dist/src/apply/preview-utils.js +0 -26
- package/dist/src/apply/tui/SelectView.js +0 -34
- package/dist/src/apply/tui/ServerApplyView.js +0 -49
- package/dist/src/apply/tui/ServerPreviewView.js +0 -23
- package/dist/src/credentials-store.js +0 -74
- package/dist/src/generate/command.js +0 -597
- package/dist/src/generate/edit/command.js +0 -127
- package/dist/src/generate/tui/GenerateView.js +0 -10
- package/dist/src/host-utils.js +0 -26
- package/dist/src/import/agent-model-resolve.js +0 -35
- package/dist/src/import/auto-filter-resolve.js +0 -16
- package/dist/src/import/command.js +0 -380
- package/dist/src/import/cycle-auto-reject.js +0 -14
- package/dist/src/import/orchestrator.js +0 -603
- package/dist/src/import/path-utils.js +0 -30
- package/dist/src/import/picker-dispatch.js +0 -44
- package/dist/src/import/print-prompt.js +0 -31
- package/dist/src/import/strip-allowed-components.js +0 -22
- package/dist/src/import/tui/CustomPromptBanner.js +0 -8
- package/dist/src/import/tui/WizardApp.js +0 -1670
- package/dist/src/import/tui/ai-flag.js +0 -6
- package/dist/src/import/tui/auto-filter-error.js +0 -29
- package/dist/src/import/tui/autocomplete.js +0 -32
- package/dist/src/import/tui/components/AutoFilterBanner.js +0 -19
- package/dist/src/import/tui/components/CounterStrip.js +0 -12
- package/dist/src/import/tui/components/LegendEntry.js +0 -6
- package/dist/src/import/tui/cycle-panel-scroll.js +0 -33
- package/dist/src/import/tui/final-review-host.js +0 -25
- package/dist/src/import/tui/group-collapse.js +0 -11
- package/dist/src/import/tui/history.js +0 -53
- package/dist/src/import/tui/hooks/useLineage.js +0 -50
- package/dist/src/import/tui/hooks/useOverlayPanel.js +0 -27
- package/dist/src/import/tui/lineage-layout.js +0 -82
- package/dist/src/import/tui/merge-ai-decisions.js +0 -22
- package/dist/src/import/tui/push-decision-gate-helpers.js +0 -8
- package/dist/src/import/tui/push-progress.js +0 -1
- package/dist/src/import/tui/run-print-files-helpers.js +0 -8
- package/dist/src/import/tui/run-teaser.js +0 -9
- package/dist/src/import/tui/runLivePreview.js +0 -82
- package/dist/src/import/tui/runScopeGate.js +0 -28
- package/dist/src/import/tui/scope-gate-columns.js +0 -94
- package/dist/src/import/tui/scope-gate-host.js +0 -28
- package/dist/src/import/tui/sidebar-width.js +0 -3
- package/dist/src/import/tui/spawn-generate.js +0 -53
- package/dist/src/import/tui/step-filters.js +0 -42
- package/dist/src/import/tui/steps/AtomicGenerateReviewStep.js +0 -726
- package/dist/src/import/tui/steps/AtomicScopeGateStep.js +0 -210
- package/dist/src/import/tui/steps/CredentialsStep.js +0 -108
- package/dist/src/import/tui/steps/DoneStep.js +0 -24
- package/dist/src/import/tui/steps/ErrorStep.js +0 -16
- package/dist/src/import/tui/steps/GateStep.js +0 -22
- package/dist/src/import/tui/steps/GenerateReviewStep.js +0 -1618
- package/dist/src/import/tui/steps/PathValidationStep.js +0 -152
- package/dist/src/import/tui/steps/PreviewStep.js +0 -37
- package/dist/src/import/tui/steps/PreviewValidationErrorStep.js +0 -23
- package/dist/src/import/tui/steps/PushDecisionGateStep.js +0 -73
- package/dist/src/import/tui/steps/PushingStep.js +0 -24
- package/dist/src/import/tui/steps/RunningStep.js +0 -21
- package/dist/src/import/tui/steps/ScopeGateStep.js +0 -907
- package/dist/src/import/tui/steps/TokenInputStep.js +0 -88
- package/dist/src/import/tui/steps/WelcomeStep.js +0 -34
- package/dist/src/import/tui/steps/WizardPreviewStep.js +0 -169
- package/dist/src/import/tui/steps/auto-reject-decision.js +0 -9
- package/dist/src/import/tui/steps/breaking-change-format.js +0 -24
- package/dist/src/import/tui/steps/enumerate-cycle-breaks.js +0 -0
- package/dist/src/import/tui/steps/preview-diff.js +0 -175
- package/dist/src/import/tui/useFinalizePreview.js +0 -0
- package/dist/src/import/tui/useLivePreview.js +0 -122
- package/dist/src/import/tui/wizard-422-helpers.js +0 -60
- package/dist/src/import/tui/wizard-generate-progress.js +0 -25
- package/dist/src/import/tui/wizard-save-flow.js +0 -20
- package/dist/src/import/tui/wizard-state-transitions.js +0 -32
- package/dist/src/lib/agent-model-options.js +0 -15
- package/dist/src/lib/command-options.js +0 -30
- package/dist/src/lib/composition-mode.js +0 -39
- package/dist/src/lib/contentful-urls.js +0 -27
- package/dist/src/lib/debug-logger.js +0 -229
- package/dist/src/lib/debug-preamble.js +0 -33
- package/dist/src/lib/error-parser.js +0 -269
- package/dist/src/lib/prompt-overrides.js +0 -69
- package/dist/src/lib/terminal-capabilities.js +0 -51
- package/dist/src/lib/user-agent.js +0 -29
- package/dist/src/output/format.js +0 -110
- package/dist/src/print/command.js +0 -221
- package/dist/src/print/validate/tui/ValidateView.js +0 -37
- package/dist/src/print/validate/validators/cdf-validator.js +0 -104
- package/dist/src/print/validate/validators/dtcg-validator.js +0 -110
- package/dist/src/print/validate/validators/format-errors.js +0 -18
- package/dist/src/program.js +0 -105
- package/dist/src/runs/export-helpers.js +0 -59
- package/dist/src/runs/fingerprint.js +0 -75
- package/dist/src/runs/ls-command.js +0 -137
- package/dist/src/runs/modify-launcher.js +0 -42
- package/dist/src/runs/path-prompt.js +0 -72
- package/dist/src/runs/push-creds-prompt.js +0 -39
- package/dist/src/runs/push-helpers.js +0 -72
- package/dist/src/runs/push-launcher.js +0 -77
- package/dist/src/runs/replay-helpers.js +0 -164
- package/dist/src/runs/resolve-run-target.js +0 -45
- package/dist/src/runs/run-picker-mount.js +0 -72
- package/dist/src/runs/run-picker.js +0 -129
- package/dist/src/runs/save-conflict.js +0 -56
- package/dist/src/runs/save-path-resolver.js +0 -75
- package/dist/src/runs/staleness.js +0 -140
- package/dist/src/runs/store.js +0 -136
- package/dist/src/session/cache-keys.js +0 -44
- package/dist/src/session/command.js +0 -261
- package/dist/src/session/db.js +0 -1538
- package/dist/src/session/migration.js +0 -117
- package/dist/src/session/session-id.js +0 -212
- package/dist/src/session/stats.js +0 -89
- package/dist/src/setup/analytics-prompt.js +0 -24
- package/dist/src/setup/auto-filter-prompt.js +0 -24
- package/dist/src/setup/command.js +0 -966
- package/dist/src/setup/composition-mode-prompt.js +0 -37
- package/dist/src/setup/debug-mode-prompt.js +0 -22
- package/dist/src/types.js +0 -1
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { readdirSync, readFileSync, renameSync, statSync } from 'node:fs';
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
|
-
import { join, resolve } from 'node:path';
|
|
5
|
-
import { homedir } from 'node:os';
|
|
6
|
-
import { generateSessionId } from './session-id.js';
|
|
7
|
-
const MIGRATION_NAME = 'v1_import_and_reviews';
|
|
8
|
-
export function getReviewsDir() {
|
|
9
|
-
if (process.env.EDS_REVIEW_ARTIFACTS_DIR) {
|
|
10
|
-
return resolve(process.env.EDS_REVIEW_ARTIFACTS_DIR);
|
|
11
|
-
}
|
|
12
|
-
return resolve(homedir(), '.contentful', 'experience-design-system-cli', 'reviews');
|
|
13
|
-
}
|
|
14
|
-
export function getLegacyImportDbPath() {
|
|
15
|
-
if (process.env.EDS_IMPORT_DB_PATH) {
|
|
16
|
-
return resolve(process.env.EDS_IMPORT_DB_PATH);
|
|
17
|
-
}
|
|
18
|
-
return resolve(homedir(), '.contentful', 'experience-design-system-cli', 'import.db');
|
|
19
|
-
}
|
|
20
|
-
export function runMigrationIfNeeded(db) {
|
|
21
|
-
const alreadyRan = db.prepare('SELECT name FROM migrations WHERE name = ?').get(MIGRATION_NAME);
|
|
22
|
-
if (alreadyRan)
|
|
23
|
-
return;
|
|
24
|
-
const now = new Date().toISOString();
|
|
25
|
-
db.exec('BEGIN');
|
|
26
|
-
try {
|
|
27
|
-
migrateReviewSessions(db, now);
|
|
28
|
-
migrateImportDb(db, now);
|
|
29
|
-
db.prepare('INSERT INTO migrations (name, applied_at) VALUES (?, ?)').run(MIGRATION_NAME, now);
|
|
30
|
-
db.exec('COMMIT');
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
db.exec('ROLLBACK');
|
|
34
|
-
process.stderr.write(`Warning: pipeline session migration failed — continuing without migrated data.\n${e instanceof Error ? e.message : String(e)}\n`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function migrateReviewSessions(db, _now) {
|
|
38
|
-
const reviewsDir = getReviewsDir();
|
|
39
|
-
let entries;
|
|
40
|
-
try {
|
|
41
|
-
entries = readdirSync(reviewsDir);
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
for (const entry of entries) {
|
|
47
|
-
if (entry.endsWith('.migrated'))
|
|
48
|
-
continue;
|
|
49
|
-
const sessionDir = join(reviewsDir, entry);
|
|
50
|
-
try {
|
|
51
|
-
if (!statSync(sessionDir).isDirectory())
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const stateFile = join(sessionDir, 'current-review-state.json');
|
|
58
|
-
let snapshot;
|
|
59
|
-
try {
|
|
60
|
-
snapshot = JSON.parse(readFileSync(stateFile, 'utf8'));
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
process.stderr.write(`Warning: skipping migration of review session ${entry} — cannot read state file.\n`);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const sessionId = generateSessionId();
|
|
67
|
-
const mtime = statSync(stateFile).mtime.toISOString();
|
|
68
|
-
db.prepare('INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, NULL, ?, ?)').run(sessionId, mtime, mtime);
|
|
69
|
-
db.prepare(`INSERT INTO steps (session_id, command, status, started_at, completed_at, inputs, outputs, updated_at)
|
|
70
|
-
VALUES (?, 'generate refine', 'interrupted', ?, ?, ?, '{}', ?)`).run(sessionId, mtime, mtime, JSON.stringify({ rawComponents: snapshot.inputPath ?? '' }), mtime);
|
|
71
|
-
try {
|
|
72
|
-
renameSync(sessionDir, `${sessionDir}.migrated`);
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
// non-fatal
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function migrateImportDb(db, _now) {
|
|
80
|
-
const importDbPath = getLegacyImportDbPath();
|
|
81
|
-
if (!existsSync(importDbPath))
|
|
82
|
-
return;
|
|
83
|
-
let importDb;
|
|
84
|
-
try {
|
|
85
|
-
importDb = new DatabaseSync(importDbPath, { readOnly: true });
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const importSessions = importDb
|
|
92
|
-
.prepare('SELECT space_id, environment_id, started_at, updated_at FROM sessions')
|
|
93
|
-
.all();
|
|
94
|
-
for (const s of importSessions) {
|
|
95
|
-
const sessionId = generateSessionId();
|
|
96
|
-
const sessionName = `import:${s.space_id}:${s.environment_id}`;
|
|
97
|
-
db.prepare('INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)').run(sessionId, sessionName, s.started_at, s.updated_at);
|
|
98
|
-
// import_items is no longer in the pipeline schema — legacy push history is not migrated
|
|
99
|
-
}
|
|
100
|
-
importDb.close();
|
|
101
|
-
try {
|
|
102
|
-
renameSync(importDbPath, `${importDbPath}.migrated`);
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
// non-fatal
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (e) {
|
|
109
|
-
try {
|
|
110
|
-
importDb.close();
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// ignore
|
|
114
|
-
}
|
|
115
|
-
throw e;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { randomBytes } from 'node:crypto';
|
|
2
|
-
const ADJECTIVES = [
|
|
3
|
-
'aged',
|
|
4
|
-
'amber',
|
|
5
|
-
'bare',
|
|
6
|
-
'bold',
|
|
7
|
-
'bright',
|
|
8
|
-
'calm',
|
|
9
|
-
'clear',
|
|
10
|
-
'cold',
|
|
11
|
-
'cool',
|
|
12
|
-
'dark',
|
|
13
|
-
'deep',
|
|
14
|
-
'dim',
|
|
15
|
-
'dry',
|
|
16
|
-
'dusk',
|
|
17
|
-
'dust',
|
|
18
|
-
'early',
|
|
19
|
-
'far',
|
|
20
|
-
'fast',
|
|
21
|
-
'fine',
|
|
22
|
-
'flat',
|
|
23
|
-
'free',
|
|
24
|
-
'fresh',
|
|
25
|
-
'full',
|
|
26
|
-
'faint',
|
|
27
|
-
'gold',
|
|
28
|
-
'gray',
|
|
29
|
-
'great',
|
|
30
|
-
'green',
|
|
31
|
-
'hard',
|
|
32
|
-
'high',
|
|
33
|
-
'hollow',
|
|
34
|
-
'icy',
|
|
35
|
-
'idle',
|
|
36
|
-
'iron',
|
|
37
|
-
'jade',
|
|
38
|
-
'keen',
|
|
39
|
-
'large',
|
|
40
|
-
'lean',
|
|
41
|
-
'light',
|
|
42
|
-
'lone',
|
|
43
|
-
'long',
|
|
44
|
-
'low',
|
|
45
|
-
'lunar',
|
|
46
|
-
'mild',
|
|
47
|
-
'misty',
|
|
48
|
-
'muted',
|
|
49
|
-
'neat',
|
|
50
|
-
'new',
|
|
51
|
-
'noble',
|
|
52
|
-
'north',
|
|
53
|
-
'oak',
|
|
54
|
-
'odd',
|
|
55
|
-
'old',
|
|
56
|
-
'open',
|
|
57
|
-
'pale',
|
|
58
|
-
'plain',
|
|
59
|
-
'proud',
|
|
60
|
-
'pure',
|
|
61
|
-
'quiet',
|
|
62
|
-
'rapid',
|
|
63
|
-
'raw',
|
|
64
|
-
'red',
|
|
65
|
-
'rich',
|
|
66
|
-
'rigid',
|
|
67
|
-
'ripe',
|
|
68
|
-
'round',
|
|
69
|
-
'royal',
|
|
70
|
-
'rust',
|
|
71
|
-
'sage',
|
|
72
|
-
'salt',
|
|
73
|
-
'sandy',
|
|
74
|
-
'sharp',
|
|
75
|
-
'short',
|
|
76
|
-
'shy',
|
|
77
|
-
'silent',
|
|
78
|
-
'slim',
|
|
79
|
-
'slow',
|
|
80
|
-
'small',
|
|
81
|
-
'soft',
|
|
82
|
-
'solar',
|
|
83
|
-
'solid',
|
|
84
|
-
'stark',
|
|
85
|
-
'steel',
|
|
86
|
-
'stern',
|
|
87
|
-
'still',
|
|
88
|
-
'stone',
|
|
89
|
-
'strong',
|
|
90
|
-
'sweet',
|
|
91
|
-
'tall',
|
|
92
|
-
'teal',
|
|
93
|
-
'thin',
|
|
94
|
-
'thorn',
|
|
95
|
-
'tidy',
|
|
96
|
-
'true',
|
|
97
|
-
'vast',
|
|
98
|
-
'warm',
|
|
99
|
-
'wide',
|
|
100
|
-
'wild',
|
|
101
|
-
'wise',
|
|
102
|
-
'young',
|
|
103
|
-
];
|
|
104
|
-
const NOUNS = [
|
|
105
|
-
'arch',
|
|
106
|
-
'ash',
|
|
107
|
-
'bay',
|
|
108
|
-
'beam',
|
|
109
|
-
'birch',
|
|
110
|
-
'blade',
|
|
111
|
-
'bloom',
|
|
112
|
-
'bluff',
|
|
113
|
-
'bolt',
|
|
114
|
-
'brook',
|
|
115
|
-
'bud',
|
|
116
|
-
'cape',
|
|
117
|
-
'cave',
|
|
118
|
-
'cedar',
|
|
119
|
-
'cliff',
|
|
120
|
-
'cloud',
|
|
121
|
-
'coast',
|
|
122
|
-
'cove',
|
|
123
|
-
'creek',
|
|
124
|
-
'crest',
|
|
125
|
-
'dale',
|
|
126
|
-
'dawn',
|
|
127
|
-
'delta',
|
|
128
|
-
'dew',
|
|
129
|
-
'drift',
|
|
130
|
-
'dune',
|
|
131
|
-
'dust',
|
|
132
|
-
'echo',
|
|
133
|
-
'edge',
|
|
134
|
-
'elk',
|
|
135
|
-
'ember',
|
|
136
|
-
'fen',
|
|
137
|
-
'fern',
|
|
138
|
-
'field',
|
|
139
|
-
'flare',
|
|
140
|
-
'flash',
|
|
141
|
-
'flint',
|
|
142
|
-
'flood',
|
|
143
|
-
'floor',
|
|
144
|
-
'flume',
|
|
145
|
-
'fog',
|
|
146
|
-
'ford',
|
|
147
|
-
'forge',
|
|
148
|
-
'forth',
|
|
149
|
-
'frost',
|
|
150
|
-
'gale',
|
|
151
|
-
'glade',
|
|
152
|
-
'glen',
|
|
153
|
-
'glow',
|
|
154
|
-
'grove',
|
|
155
|
-
'gulf',
|
|
156
|
-
'heath',
|
|
157
|
-
'hill',
|
|
158
|
-
'hollow',
|
|
159
|
-
'hull',
|
|
160
|
-
'isle',
|
|
161
|
-
'jade',
|
|
162
|
-
'knoll',
|
|
163
|
-
'lake',
|
|
164
|
-
'leaf',
|
|
165
|
-
'ledge',
|
|
166
|
-
'light',
|
|
167
|
-
'loch',
|
|
168
|
-
'maple',
|
|
169
|
-
'marsh',
|
|
170
|
-
'mead',
|
|
171
|
-
'mesa',
|
|
172
|
-
'mist',
|
|
173
|
-
'moon',
|
|
174
|
-
'moor',
|
|
175
|
-
'moss',
|
|
176
|
-
'mount',
|
|
177
|
-
'pass',
|
|
178
|
-
'peak',
|
|
179
|
-
'pine',
|
|
180
|
-
'plain',
|
|
181
|
-
'pool',
|
|
182
|
-
'ridge',
|
|
183
|
-
'rift',
|
|
184
|
-
'rim',
|
|
185
|
-
'rise',
|
|
186
|
-
'river',
|
|
187
|
-
'rock',
|
|
188
|
-
'root',
|
|
189
|
-
'rush',
|
|
190
|
-
'sand',
|
|
191
|
-
'shore',
|
|
192
|
-
'slope',
|
|
193
|
-
'snow',
|
|
194
|
-
'spark',
|
|
195
|
-
'spring',
|
|
196
|
-
'star',
|
|
197
|
-
'storm',
|
|
198
|
-
'stream',
|
|
199
|
-
'tide',
|
|
200
|
-
'vale',
|
|
201
|
-
'vapor',
|
|
202
|
-
'wake',
|
|
203
|
-
'wave',
|
|
204
|
-
'wind',
|
|
205
|
-
];
|
|
206
|
-
export function generateSessionId() {
|
|
207
|
-
const buf = randomBytes(4);
|
|
208
|
-
const adjIdx = buf[0] % ADJECTIVES.length;
|
|
209
|
-
const nounIdx = buf[1] % NOUNS.length;
|
|
210
|
-
const hex = (((buf[2] << 8) | buf[3]) & 0xffff).toString(16).padStart(4, '0');
|
|
211
|
-
return `${ADJECTIVES[adjIdx]}-${NOUNS[nounIdx]}-${hex}`;
|
|
212
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { statSync } from 'node:fs';
|
|
2
|
-
export function getStats(db, dbPath) {
|
|
3
|
-
const pageCountRow = db.prepare('PRAGMA page_count').get();
|
|
4
|
-
const pageSizeRow = db.prepare('PRAGMA page_size').get();
|
|
5
|
-
const dbBytes = pageCountRow.page_count * pageSizeRow.page_size;
|
|
6
|
-
let walBytes = 0;
|
|
7
|
-
try {
|
|
8
|
-
walBytes = statSync(`${dbPath}-wal`).size;
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
// WAL file doesn't exist
|
|
12
|
-
}
|
|
13
|
-
// Session counts by status of last step
|
|
14
|
-
const sessionTotal = db.prepare('SELECT COUNT(*) AS n FROM sessions').get().n;
|
|
15
|
-
const statusCounts = db
|
|
16
|
-
.prepare(`SELECT last_status, COUNT(*) AS n
|
|
17
|
-
FROM (
|
|
18
|
-
SELECT session_id,
|
|
19
|
-
status AS last_status,
|
|
20
|
-
ROW_NUMBER() OVER (PARTITION BY session_id ORDER BY started_at DESC, id DESC) AS rn
|
|
21
|
-
FROM steps
|
|
22
|
-
)
|
|
23
|
-
WHERE rn = 1
|
|
24
|
-
GROUP BY last_status`)
|
|
25
|
-
.all();
|
|
26
|
-
const byStatus = {};
|
|
27
|
-
for (const row of statusCounts) {
|
|
28
|
-
byStatus[row.last_status] = row.n;
|
|
29
|
-
}
|
|
30
|
-
// Sessions with no steps at all count as in-progress
|
|
31
|
-
const sessionsWithSteps = statusCounts.reduce((a, r) => a + r.n, 0);
|
|
32
|
-
const sessionsWithNoSteps = sessionTotal - sessionsWithSteps;
|
|
33
|
-
const stepsTotal = db.prepare('SELECT COUNT(*) AS n FROM steps').get().n;
|
|
34
|
-
const rawComponents = db.prepare('SELECT COUNT(*) AS n FROM raw_components').get().n;
|
|
35
|
-
const oldest = db.prepare('SELECT id, updated_at FROM sessions ORDER BY updated_at ASC LIMIT 1').get();
|
|
36
|
-
const newest = db.prepare('SELECT id, updated_at FROM sessions ORDER BY updated_at DESC LIMIT 1').get();
|
|
37
|
-
return {
|
|
38
|
-
dbPath,
|
|
39
|
-
dbBytes,
|
|
40
|
-
walBytes,
|
|
41
|
-
totalBytes: dbBytes + walBytes,
|
|
42
|
-
sessions: {
|
|
43
|
-
total: sessionTotal,
|
|
44
|
-
complete: byStatus['complete'] ?? 0,
|
|
45
|
-
inProgress: (byStatus['pending'] ?? 0) + sessionsWithNoSteps,
|
|
46
|
-
failed: byStatus['failed'] ?? 0,
|
|
47
|
-
interrupted: byStatus['interrupted'] ?? 0,
|
|
48
|
-
},
|
|
49
|
-
steps: stepsTotal,
|
|
50
|
-
rawComponents,
|
|
51
|
-
oldestSession: oldest ? { id: oldest.id, updatedAt: oldest.updated_at } : null,
|
|
52
|
-
newestSession: newest ? { id: newest.id, updatedAt: newest.updated_at } : null,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export function formatBytes(bytes) {
|
|
56
|
-
if (bytes < 1024)
|
|
57
|
-
return `${bytes} B`;
|
|
58
|
-
if (bytes < 1024 * 1024)
|
|
59
|
-
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
60
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
61
|
-
}
|
|
62
|
-
export function formatStatsText(stats) {
|
|
63
|
-
const lines = [
|
|
64
|
-
`Pipeline DB: ${stats.dbPath}`,
|
|
65
|
-
``,
|
|
66
|
-
` Database size ${formatBytes(stats.dbBytes).padStart(10)}`,
|
|
67
|
-
` WAL file size ${formatBytes(stats.walBytes).padStart(10)}`,
|
|
68
|
-
` Total on disk ${formatBytes(stats.totalBytes).padStart(10)}`,
|
|
69
|
-
``,
|
|
70
|
-
` Sessions ${String(stats.sessions.total).padStart(10)}`,
|
|
71
|
-
` complete ${String(stats.sessions.complete).padStart(10)}`,
|
|
72
|
-
` in-progress ${String(stats.sessions.inProgress).padStart(10)}`,
|
|
73
|
-
` failed ${String(stats.sessions.failed).padStart(10)}`,
|
|
74
|
-
` interrupted ${String(stats.sessions.interrupted).padStart(10)}`,
|
|
75
|
-
``,
|
|
76
|
-
` Steps ${String(stats.steps).padStart(10)}`,
|
|
77
|
-
` Raw components ${String(stats.rawComponents).padStart(10)}`,
|
|
78
|
-
];
|
|
79
|
-
if (stats.oldestSession) {
|
|
80
|
-
const date = stats.oldestSession.updatedAt.slice(0, 10);
|
|
81
|
-
lines.push(``, ` Oldest session ${date} (${stats.oldestSession.id})`);
|
|
82
|
-
}
|
|
83
|
-
if (stats.newestSession && stats.newestSession.id !== stats.oldestSession?.id) {
|
|
84
|
-
const date = stats.newestSession.updatedAt.slice(0, 10);
|
|
85
|
-
lines.push(` Newest session ${date} (${stats.newestSession.id})`);
|
|
86
|
-
}
|
|
87
|
-
lines.push(``, `Run \`session prune --older-than <age>\` to free space.`);
|
|
88
|
-
return lines.join('\n');
|
|
89
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ask the operator whether to persist an opt-out of anonymous usage analytics.
|
|
3
|
-
*
|
|
4
|
-
* The helper is injectable so it can be unit-tested without a TTY. The caller
|
|
5
|
-
* provides an `ask` function that yields one line of input per call.
|
|
6
|
-
*
|
|
7
|
-
* Behavior:
|
|
8
|
-
* - Empty input returns `current` if defined, else `false` (default: enabled).
|
|
9
|
-
* - Input starting with 'y' or 'Y' returns `true` (disabled).
|
|
10
|
-
* - Input starting with 'n' or 'N' returns `false` (enabled).
|
|
11
|
-
* - Any other input falls back to the same rule as empty input.
|
|
12
|
-
*/
|
|
13
|
-
export async function promptAnalyticsPreference(ask, current) {
|
|
14
|
-
const defaultValue = current ?? false;
|
|
15
|
-
const hint = defaultValue ? '[Y/n]' : '[y/N]';
|
|
16
|
-
const answer = (await ask(` Disable anonymous usage analytics? ${hint} `)).trim().toLowerCase();
|
|
17
|
-
if (answer === '')
|
|
18
|
-
return defaultValue;
|
|
19
|
-
if (answer.startsWith('y'))
|
|
20
|
-
return true;
|
|
21
|
-
if (answer.startsWith('n'))
|
|
22
|
-
return false;
|
|
23
|
-
return defaultValue;
|
|
24
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ask the operator whether to enable the AI auto-filter by default.
|
|
3
|
-
*
|
|
4
|
-
* The helper is injectable so it can be unit-tested without a TTY. The caller
|
|
5
|
-
* provides an `ask` function that yields one line of input per call.
|
|
6
|
-
*
|
|
7
|
-
* Behavior:
|
|
8
|
-
* - Empty input returns `current` if defined, else `true` (default ON).
|
|
9
|
-
* - Input starting with 'y' or 'Y' returns `true`.
|
|
10
|
-
* - Input starting with 'n' or 'N' returns `false`.
|
|
11
|
-
* - Any other input falls back to the same rule as empty input.
|
|
12
|
-
*/
|
|
13
|
-
export async function promptAutoFilterPreference(ask, current) {
|
|
14
|
-
const defaultValue = current ?? true;
|
|
15
|
-
const hint = defaultValue ? '[Y/n]' : '[y/N]';
|
|
16
|
-
const answer = (await ask(` Enable AI auto-filter by default? ${hint} `)).trim().toLowerCase();
|
|
17
|
-
if (answer === '')
|
|
18
|
-
return defaultValue;
|
|
19
|
-
if (answer.startsWith('y'))
|
|
20
|
-
return true;
|
|
21
|
-
if (answer.startsWith('n'))
|
|
22
|
-
return false;
|
|
23
|
-
return defaultValue;
|
|
24
|
-
}
|