@contentful/experience-design-system-cli 2.35.1-dev-build-8636eead.0 → 2.35.1-dev-build-a2149178.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/bin/cli.js +1 -1
- package/dist/app.js +39 -35
- package/dist/index.js +41 -90
- package/dist/package.json +5 -1
- package/dist/src/tui/home/home.d.ts +1 -0
- package/dist/src/tui/home/home.theme.d.ts +11 -0
- package/dist/src/tui/settings/utils/v1-store.d.ts +2 -3
- package/legacy/bin/cli.js +19 -23
- package/legacy/dist/src/analyze/composition/interchange-schema.d.ts +7 -1
- package/legacy/dist/src/analyze/composition/resolve-mapping.d.ts +11 -34
- package/legacy/dist/src/analyze/composition/source-call-site-evidence.d.ts +30 -0
- package/legacy/dist/src/analyze/extract-command.d.ts +0 -4
- package/legacy/dist/src/import/tui/WizardApp.d.ts +1 -7
- package/legacy/dist/src/import/tui/ai-flag.d.ts +0 -1
- package/legacy/dist/src/import/tui/run-selection-agent.d.ts +0 -1
- package/legacy/dist/src/import/tui/steps/ScopeGateStep.d.ts +0 -1
- package/legacy/dist/src/import/tui/wizard-state-transitions.d.ts +0 -3
- package/legacy/dist/src/index.js +16354 -17491
- package/legacy/dist/src/map-tokens/tui/MapTokensView.d.ts +0 -1
- package/legacy/dist/src/runs/store.d.ts +2 -2
- package/legacy/dist/src/session/db.d.ts +4 -73
- package/legacy/package.json +5 -1
- package/legacy/skills/debate-select.md +23 -0
- package/legacy/skills/select-components.md +43 -8
- package/package.json +7 -3
- package/dist/src/config/migrate.d.ts +0 -1
- package/legacy/dist/src/analyze/composition/candidate-files.d.ts +0 -34
- package/legacy/dist/src/analyze/composition/composition-cache-key.d.ts +0 -18
- package/legacy/dist/src/analyze/composition/parse-map-edges.d.ts +0 -16
- package/legacy/dist/src/analyze/composition/prompt-loader.d.ts +0 -3
- package/legacy/dist/src/analyze/composition/resolve-mapping-cli.d.ts +0 -10
- package/legacy/dist/src/session/cache-keys.d.ts +0 -22
- package/legacy/dist/src/session/core/components/hash-component-shape.d.ts +0 -5
- package/legacy/dist/src/session/core/tokens/hash-token-content.d.ts +0 -1
- package/legacy/prompts/composition-edges.md +0 -11
package/bin/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
await import(
|
|
2
|
+
await import('../dist/index.js');
|
package/dist/app.js
CHANGED
|
@@ -496,54 +496,43 @@ import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
|
496
496
|
import { existsSync as existsSync3, readdirSync } from "node:fs";
|
|
497
497
|
import { join as join5 } from "node:path";
|
|
498
498
|
|
|
499
|
-
// packages/experience-design-system-
|
|
500
|
-
import {
|
|
501
|
-
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
502
|
-
import { homedir as homedir2 } from "node:os";
|
|
499
|
+
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
500
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
503
501
|
import { dirname as dirname2, join as join4 } from "node:path";
|
|
504
|
-
|
|
505
|
-
|
|
502
|
+
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
503
|
+
var DEFAULT_DEBUG_MODE_SETTING = {
|
|
504
|
+
enabled: true
|
|
505
|
+
};
|
|
506
|
+
function debugModeSettingPath() {
|
|
507
|
+
return join4(findPackageRoot(import.meta.url, PACKAGE_NAME3), ".contentful", "config", "debug_mode.json");
|
|
506
508
|
}
|
|
507
|
-
|
|
508
|
-
var debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
|
|
509
|
-
async function readSettings() {
|
|
509
|
+
async function readDebugModeSetting() {
|
|
510
510
|
try {
|
|
511
|
-
|
|
511
|
+
const raw = await readFile(debugModeSettingPath(), "utf8");
|
|
512
|
+
const parsed = JSON.parse(raw);
|
|
513
|
+
return { ...DEFAULT_DEBUG_MODE_SETTING, ...parsed };
|
|
512
514
|
} catch {
|
|
513
|
-
return {};
|
|
515
|
+
return { ...DEFAULT_DEBUG_MODE_SETTING };
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
|
-
async function
|
|
517
|
-
const path =
|
|
518
|
+
async function writeDebugModeSetting(setting) {
|
|
519
|
+
const path = debugModeSettingPath();
|
|
518
520
|
await mkdir(dirname2(path), { recursive: true });
|
|
519
|
-
|
|
520
|
-
await writeFile(tmp, `${JSON.stringify(settings, null, 2)}
|
|
521
|
+
await writeFile(path, `${JSON.stringify(setting, null, 2)}
|
|
521
522
|
`, { mode: 384 });
|
|
522
|
-
await rename(tmp, path);
|
|
523
|
-
}
|
|
524
|
-
async function updateSettings(patch) {
|
|
525
|
-
await writeSettings({ ...await readSettings(), ...patch });
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
529
|
-
var DEFAULT_DEBUG_MODE_SETTING = {
|
|
530
|
-
enabled: true
|
|
531
|
-
};
|
|
532
|
-
async function readDebugModeSetting() {
|
|
533
|
-
const { debugMode } = await readSettings();
|
|
534
|
-
return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
|
|
535
|
-
}
|
|
536
|
-
async function writeDebugModeSetting(setting) {
|
|
537
|
-
await updateSettings({ debugMode: setting });
|
|
538
523
|
}
|
|
539
524
|
|
|
540
525
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
526
|
+
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
541
527
|
var pendingRun;
|
|
542
528
|
function generateRunId() {
|
|
543
529
|
const now = /* @__PURE__ */ new Date();
|
|
544
530
|
const pad = (n) => String(n).padStart(2, "0");
|
|
545
531
|
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
546
532
|
}
|
|
533
|
+
function sessionsRootDir() {
|
|
534
|
+
return join5(findPackageRoot(import.meta.url, PACKAGE_NAME4), ".contentful", "debug", "sessions");
|
|
535
|
+
}
|
|
547
536
|
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
548
537
|
const pad = (n) => String(n).padStart(2, "0");
|
|
549
538
|
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
@@ -553,7 +542,7 @@ function slugify(value) {
|
|
|
553
542
|
}
|
|
554
543
|
function generateSessionId() {
|
|
555
544
|
const today = datePrefix();
|
|
556
|
-
const root =
|
|
545
|
+
const root = sessionsRootDir();
|
|
557
546
|
const existing = existsSync3(root) ? readdirSync(root) : [];
|
|
558
547
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
559
548
|
const maxSeq = existing.reduce((max, entry) => {
|
|
@@ -564,7 +553,7 @@ function generateSessionId() {
|
|
|
564
553
|
}
|
|
565
554
|
var SESSION_ID = generateSessionId();
|
|
566
555
|
function sessionDebugDir() {
|
|
567
|
-
return join5(
|
|
556
|
+
return join5(sessionsRootDir(), SESSION_ID);
|
|
568
557
|
}
|
|
569
558
|
void isDebugModeEnabled().then((enabled) => {
|
|
570
559
|
if (!enabled) return void 0;
|
|
@@ -753,8 +742,23 @@ import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
|
753
742
|
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
754
743
|
|
|
755
744
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
756
|
-
|
|
757
|
-
|
|
745
|
+
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
746
|
+
import { join as join6 } from "node:path";
|
|
747
|
+
import { homedir as homedir2 } from "node:os";
|
|
748
|
+
var V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
|
|
749
|
+
async function readV1Store() {
|
|
750
|
+
try {
|
|
751
|
+
const raw = await readFile2(V1_STORE_PATH, "utf8");
|
|
752
|
+
return JSON.parse(raw);
|
|
753
|
+
} catch {
|
|
754
|
+
return {};
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
async function writeV1Store(data) {
|
|
758
|
+
await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
|
|
759
|
+
await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
|
|
760
|
+
`, { mode: 384 });
|
|
761
|
+
}
|
|
758
762
|
|
|
759
763
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
760
764
|
async function readCredentials() {
|
package/dist/index.js
CHANGED
|
@@ -593,56 +593,33 @@ var init_terminal_input = __esm({
|
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
595
|
|
|
596
|
-
// packages/experience-design-system-
|
|
597
|
-
import {
|
|
598
|
-
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
599
|
-
import { homedir as homedir2 } from "node:os";
|
|
596
|
+
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
597
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
600
598
|
import { dirname as dirname2, join as join4 } from "node:path";
|
|
601
|
-
function
|
|
602
|
-
return
|
|
599
|
+
function debugModeSettingPath() {
|
|
600
|
+
return join4(findPackageRoot(import.meta.url, PACKAGE_NAME3), ".contentful", "config", "debug_mode.json");
|
|
603
601
|
}
|
|
604
|
-
async function
|
|
602
|
+
async function readDebugModeSetting() {
|
|
605
603
|
try {
|
|
606
|
-
|
|
604
|
+
const raw = await readFile(debugModeSettingPath(), "utf8");
|
|
605
|
+
const parsed = JSON.parse(raw);
|
|
606
|
+
return { ...DEFAULT_DEBUG_MODE_SETTING, ...parsed };
|
|
607
607
|
} catch {
|
|
608
|
-
return {};
|
|
608
|
+
return { ...DEFAULT_DEBUG_MODE_SETTING };
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
async function
|
|
612
|
-
const path =
|
|
611
|
+
async function writeDebugModeSetting(setting) {
|
|
612
|
+
const path = debugModeSettingPath();
|
|
613
613
|
await mkdir(dirname2(path), { recursive: true });
|
|
614
|
-
|
|
615
|
-
await writeFile(tmp, `${JSON.stringify(settings, null, 2)}
|
|
614
|
+
await writeFile(path, `${JSON.stringify(setting, null, 2)}
|
|
616
615
|
`, { mode: 384 });
|
|
617
|
-
await rename(tmp, path);
|
|
618
616
|
}
|
|
619
|
-
|
|
620
|
-
await writeSettings({ ...await readSettings(), ...patch });
|
|
621
|
-
}
|
|
622
|
-
var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
|
|
623
|
-
var init_config = __esm({
|
|
624
|
-
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
625
|
-
"use strict";
|
|
626
|
-
configFilePath = () => join4(configRoot(), "config.json");
|
|
627
|
-
runsFilePath = () => join4(configRoot(), "state", "runs.json");
|
|
628
|
-
debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
|
|
629
|
-
oldConfigDir = () => join4(homedir2(), ".config", "experiences");
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
634
|
-
async function readDebugModeSetting() {
|
|
635
|
-
const { debugMode } = await readSettings();
|
|
636
|
-
return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
|
|
637
|
-
}
|
|
638
|
-
async function writeDebugModeSetting(setting) {
|
|
639
|
-
await updateSettings({ debugMode: setting });
|
|
640
|
-
}
|
|
641
|
-
var DEFAULT_DEBUG_MODE_SETTING;
|
|
617
|
+
var PACKAGE_NAME3, DEFAULT_DEBUG_MODE_SETTING;
|
|
642
618
|
var init_debug_mode_store = __esm({
|
|
643
619
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
|
|
644
620
|
"use strict";
|
|
645
|
-
|
|
621
|
+
init_package_root();
|
|
622
|
+
PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
646
623
|
DEFAULT_DEBUG_MODE_SETTING = {
|
|
647
624
|
enabled: true
|
|
648
625
|
};
|
|
@@ -658,6 +635,9 @@ function generateRunId() {
|
|
|
658
635
|
const pad = (n) => String(n).padStart(2, "0");
|
|
659
636
|
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
660
637
|
}
|
|
638
|
+
function sessionsRootDir() {
|
|
639
|
+
return join5(findPackageRoot(import.meta.url, PACKAGE_NAME4), ".contentful", "debug", "sessions");
|
|
640
|
+
}
|
|
661
641
|
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
662
642
|
const pad = (n) => String(n).padStart(2, "0");
|
|
663
643
|
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
@@ -667,7 +647,7 @@ function slugify(value) {
|
|
|
667
647
|
}
|
|
668
648
|
function generateSessionId() {
|
|
669
649
|
const today = datePrefix();
|
|
670
|
-
const root =
|
|
650
|
+
const root = sessionsRootDir();
|
|
671
651
|
const existing = existsSync3(root) ? readdirSync(root) : [];
|
|
672
652
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
673
653
|
const maxSeq = existing.reduce((max, entry) => {
|
|
@@ -677,7 +657,7 @@ function generateSessionId() {
|
|
|
677
657
|
return `${today}-session-${maxSeq + 1}`;
|
|
678
658
|
}
|
|
679
659
|
function sessionDebugDir() {
|
|
680
|
-
return join5(
|
|
660
|
+
return join5(sessionsRootDir(), SESSION_ID);
|
|
681
661
|
}
|
|
682
662
|
async function isDebugModeEnabled() {
|
|
683
663
|
try {
|
|
@@ -766,13 +746,14 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
766
746
|
function handleCrash() {
|
|
767
747
|
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
768
748
|
}
|
|
769
|
-
var pendingRun, SESSION_ID;
|
|
749
|
+
var PACKAGE_NAME4, pendingRun, SESSION_ID;
|
|
770
750
|
var init_debug_store = __esm({
|
|
771
751
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
772
752
|
"use strict";
|
|
773
|
-
|
|
753
|
+
init_package_root();
|
|
774
754
|
init_version();
|
|
775
755
|
init_debug_mode_store();
|
|
756
|
+
PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
776
757
|
SESSION_ID = generateSessionId();
|
|
777
758
|
void isDebugModeEnabled().then((enabled) => {
|
|
778
759
|
if (!enabled) return void 0;
|
|
@@ -885,13 +866,27 @@ var init_PageContainer3 = __esm({
|
|
|
885
866
|
});
|
|
886
867
|
|
|
887
868
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
888
|
-
|
|
869
|
+
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
870
|
+
import { join as join6 } from "node:path";
|
|
871
|
+
import { homedir as homedir2 } from "node:os";
|
|
872
|
+
async function readV1Store() {
|
|
873
|
+
try {
|
|
874
|
+
const raw = await readFile2(V1_STORE_PATH, "utf8");
|
|
875
|
+
return JSON.parse(raw);
|
|
876
|
+
} catch {
|
|
877
|
+
return {};
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
async function writeV1Store(data) {
|
|
881
|
+
await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
|
|
882
|
+
await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
|
|
883
|
+
`, { mode: 384 });
|
|
884
|
+
}
|
|
885
|
+
var V1_STORE_PATH;
|
|
889
886
|
var init_v1_store = __esm({
|
|
890
887
|
"packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
|
|
891
888
|
"use strict";
|
|
892
|
-
|
|
893
|
-
readV1Store = readSettings;
|
|
894
|
-
writeV1Store = writeSettings;
|
|
889
|
+
V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
|
|
895
890
|
}
|
|
896
891
|
});
|
|
897
892
|
|
|
@@ -1456,51 +1451,7 @@ function createProgram() {
|
|
|
1456
1451
|
return program;
|
|
1457
1452
|
}
|
|
1458
1453
|
|
|
1459
|
-
// packages/experience-design-system-cli/src/config/migrate.ts
|
|
1460
|
-
init_config();
|
|
1461
|
-
init_package_root();
|
|
1462
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
1463
|
-
import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
1464
|
-
import { dirname as dirname3, join as join6 } from "node:path";
|
|
1465
|
-
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
1466
|
-
async function readJson(path) {
|
|
1467
|
-
try {
|
|
1468
|
-
return JSON.parse(await readFile2(path, "utf8"));
|
|
1469
|
-
} catch {
|
|
1470
|
-
return void 0;
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
async function migrateOldConfig() {
|
|
1474
|
-
try {
|
|
1475
|
-
const oldCredentials = join6(oldConfigDir(), "credentials.json");
|
|
1476
|
-
const oldRuns = join6(oldConfigDir(), "runs.json");
|
|
1477
|
-
const oldDebugMode = join6(
|
|
1478
|
-
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
1479
|
-
".contentful",
|
|
1480
|
-
"config",
|
|
1481
|
-
"debug_mode.json"
|
|
1482
|
-
);
|
|
1483
|
-
const migrated = {};
|
|
1484
|
-
const debugMode = await readJson(oldDebugMode);
|
|
1485
|
-
if (debugMode) migrated["debugMode"] = debugMode;
|
|
1486
|
-
Object.assign(migrated, await readJson(oldCredentials));
|
|
1487
|
-
if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
|
|
1488
|
-
if (existsSync4(oldRuns)) {
|
|
1489
|
-
if (!existsSync4(runsFilePath())) {
|
|
1490
|
-
await mkdir3(dirname3(runsFilePath()), { recursive: true });
|
|
1491
|
-
await rename2(oldRuns, runsFilePath());
|
|
1492
|
-
} else {
|
|
1493
|
-
await unlink(oldRuns);
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
await Promise.all([oldCredentials, oldDebugMode].map((f) => unlink(f).catch(() => void 0)));
|
|
1497
|
-
await rmdir(oldConfigDir()).catch(() => void 0);
|
|
1498
|
-
} catch {
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
1454
|
// packages/experience-design-system-cli/index.ts
|
|
1503
|
-
await migrateOldConfig();
|
|
1504
1455
|
createProgram().parseAsync().catch((err) => {
|
|
1505
1456
|
process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}
|
|
1506
1457
|
`);
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.35.1-dev-build-
|
|
3
|
+
"version": "2.35.1-dev-build-a2149178.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,6 +53,9 @@
|
|
|
53
53
|
"typescript": "^5.9.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@contentful/experience-design-system-agents": "workspace:*",
|
|
57
|
+
"@contentful/experience-design-system-extraction": "workspace:*",
|
|
58
|
+
"@contentful/experience-design-system-generation": "workspace:*",
|
|
56
59
|
"@tsconfig/node24": "^24.0.4",
|
|
57
60
|
"@types/node": "^24.0.3",
|
|
58
61
|
"@types/react": "^18.3.24",
|
|
@@ -60,6 +63,7 @@
|
|
|
60
63
|
"eslint": "^9.39.5",
|
|
61
64
|
"eslint-config-prettier": "^10.1.8",
|
|
62
65
|
"eslint-plugin-prettier": "^5.5.6",
|
|
66
|
+
"ink-testing-library": "^4.0.0",
|
|
63
67
|
"typescript-eslint": "^8.67.0",
|
|
64
68
|
"vitest": "^4.0.16"
|
|
65
69
|
},
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
export declare const BRAND: {
|
|
2
|
+
readonly blue: "#1773EB";
|
|
3
|
+
readonly green: "#00C459";
|
|
4
|
+
readonly orange: "#E44F20";
|
|
5
|
+
readonly yellow: "#FFDA00";
|
|
6
|
+
readonly white: "#FFFFFF";
|
|
7
|
+
readonly slate: "#A6B5C7";
|
|
8
|
+
readonly steel: "#C4D1DE";
|
|
9
|
+
readonly mist: "#DDE5EC";
|
|
10
|
+
readonly fog: "#EFF2F6";
|
|
11
|
+
};
|
|
1
12
|
export declare const PALETTE: {
|
|
2
13
|
readonly accent: "#1773EB";
|
|
3
14
|
readonly heading: "#FFFFFF";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
export declare const writeV1Store: typeof writeSettings;
|
|
1
|
+
export declare function readV1Store(): Promise<Record<string, unknown>>;
|
|
2
|
+
export declare function writeV1Store(data: Record<string, unknown>): Promise<void>;
|
package/legacy/bin/cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Suppress the SQLite ExperimentalWarning before any modules load.
|
|
3
3
|
// Must use dynamic import so this handler registers before sqlite is imported.
|
|
4
|
-
process.removeAllListeners(
|
|
5
|
-
process.on(
|
|
6
|
-
if (w.name ===
|
|
4
|
+
process.removeAllListeners('warning');
|
|
5
|
+
process.on('warning', (w) => {
|
|
6
|
+
if (w.name === 'ExperimentalWarning' && w.message.includes('SQLite')) return;
|
|
7
7
|
process.stderr.write(`${w.name}: ${w.message}\n`);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
// Auto-rebuild when running from source (dev mode only).
|
|
11
11
|
// Skipped when src/ doesn't exist (e.g. npm-installed users).
|
|
12
|
-
import { existsSync, statSync, readdirSync } from
|
|
13
|
-
import { execFileSync } from
|
|
14
|
-
import { fileURLToPath } from
|
|
15
|
-
import { dirname, resolve, join } from
|
|
12
|
+
import { existsSync, statSync, readdirSync } from 'node:fs';
|
|
13
|
+
import { execFileSync } from 'node:child_process';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { dirname, resolve, join } from 'node:path';
|
|
16
16
|
|
|
17
17
|
function newestMtime(dir, depth = 0) {
|
|
18
18
|
if (depth > 10) return 0;
|
|
@@ -22,7 +22,7 @@ function newestMtime(dir, depth = 0) {
|
|
|
22
22
|
const full = join(dir, entry.name);
|
|
23
23
|
if (entry.isDirectory()) {
|
|
24
24
|
max = Math.max(max, newestMtime(full, depth + 1));
|
|
25
|
-
} else if (entry.name.endsWith(
|
|
25
|
+
} else if (entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')) {
|
|
26
26
|
max = Math.max(max, statSync(full).mtimeMs);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -30,29 +30,25 @@ function newestMtime(dir, depth = 0) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
33
|
-
const pkgRoot = resolve(__dirname,
|
|
34
|
-
const srcDir = join(pkgRoot,
|
|
35
|
-
const distEntry = join(pkgRoot,
|
|
33
|
+
const pkgRoot = resolve(__dirname, '..');
|
|
34
|
+
const srcDir = join(pkgRoot, 'src');
|
|
35
|
+
const distEntry = join(pkgRoot, 'dist', 'src', 'index.js');
|
|
36
36
|
|
|
37
|
-
if (
|
|
38
|
-
existsSync(srcDir) &&
|
|
39
|
-
existsSync(distEntry) &&
|
|
40
|
-
process.env.NODE_ENV !== "test"
|
|
41
|
-
) {
|
|
37
|
+
if (existsSync(srcDir) && existsSync(distEntry) && process.env.NODE_ENV !== 'test') {
|
|
42
38
|
const distMtime = statSync(distEntry).mtimeMs;
|
|
43
39
|
if (newestMtime(srcDir) > distMtime) {
|
|
44
|
-
process.stderr.write(
|
|
45
|
-
const tsc = join(pkgRoot,
|
|
40
|
+
process.stderr.write('⚙ Source changed — rebuilding...\n');
|
|
41
|
+
const tsc = join(pkgRoot, 'node_modules', '.bin', 'tsc');
|
|
46
42
|
try {
|
|
47
|
-
execFileSync(tsc, [
|
|
48
|
-
stdio: [
|
|
43
|
+
execFileSync(tsc, ['-p', join(pkgRoot, 'tsconfig.build.json')], {
|
|
44
|
+
stdio: ['ignore', 'ignore', 'inherit'],
|
|
49
45
|
cwd: pkgRoot,
|
|
50
46
|
});
|
|
51
|
-
process.stderr.write(
|
|
47
|
+
process.stderr.write('✓ Build complete\n');
|
|
52
48
|
} catch {
|
|
53
|
-
process.stderr.write(
|
|
49
|
+
process.stderr.write('✗ Build failed — running with existing dist\n');
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
await import(
|
|
54
|
+
await import('../dist/src/index.js');
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* parent→child relationship, carrying optional `slot` (T7), `confidence`,
|
|
6
6
|
* and `provenance`. It is easier to merge and dedupe across sources (T2).
|
|
7
7
|
*/
|
|
8
|
-
export type EdgeProvenance = 'typed-slot' | 'structural' | 'manifest' | 'doc' | `adapter:${string}
|
|
8
|
+
export type EdgeProvenance = 'typed-slot' | 'structural' | 'call-site' | 'manifest' | 'doc' | `adapter:${string}`;
|
|
9
9
|
export type CompositionEdge = {
|
|
10
10
|
parent: string;
|
|
11
11
|
child: string;
|
|
@@ -13,5 +13,11 @@ export type CompositionEdge = {
|
|
|
13
13
|
slot?: string;
|
|
14
14
|
/** 1–5 scale, same as select/reject agent tools. */
|
|
15
15
|
confidence?: number;
|
|
16
|
+
citation?: CompositionCitation;
|
|
16
17
|
provenance: EdgeProvenance;
|
|
17
18
|
};
|
|
19
|
+
export type CompositionCitation = {
|
|
20
|
+
sourcePath: string;
|
|
21
|
+
startLine: number;
|
|
22
|
+
endLine: number;
|
|
23
|
+
};
|
|
@@ -1,59 +1,36 @@
|
|
|
1
1
|
import type { RawComponentDefinition } from '../../types.js';
|
|
2
2
|
import type { CompositionEdge } from './interchange-schema.js';
|
|
3
3
|
import { type EdgeConflict } from './merge-edges.js';
|
|
4
|
+
import type { SourceCallSiteEvidence, SourceCallSiteRejection } from './source-call-site-evidence.js';
|
|
4
5
|
export type ResolveMappingResult = {
|
|
5
6
|
components: RawComponentDefinition[];
|
|
6
7
|
edges: CompositionEdge[];
|
|
7
8
|
conflicts: EdgeConflict[];
|
|
8
9
|
warnings: string[];
|
|
10
|
+
sourceCallSiteEvidence: SourceCallSiteEvidence[];
|
|
11
|
+
sourceCallSiteRejections: SourceCallSiteRejection[];
|
|
9
12
|
};
|
|
10
13
|
/**
|
|
11
14
|
* Orchestrate composition-edge acquisition and enrichment.
|
|
12
15
|
*
|
|
13
|
-
* Sources by rank: typed-slot / "code slots" (
|
|
14
|
-
* (3) > manifest (4) > doc (5) > adapter-resolved
|
|
15
|
-
*
|
|
16
|
+
* Sources by rank: typed-slot / "code slots" (1) > structural usage evidence
|
|
17
|
+
* (2) > cited source call sites (3) > manifest (4) > doc (5) > adapter-resolved
|
|
18
|
+
* / extraEdges (6). Manifest/doc edges are computed deterministically outside
|
|
16
19
|
* this function (see manifest-doc-evidence.ts) and joined via `extraEdges`.
|
|
17
20
|
* ALL sources — including the code slots already on the incoming components —
|
|
18
21
|
* are fed into one ranked merge and unioned; non-conflicting edges from every
|
|
19
22
|
* source survive, and on a conflict (same parent+child, different slot) the
|
|
20
|
-
* higher-rank source wins and the loser is recorded.
|
|
21
|
-
*
|
|
22
|
-
* didn't cover (routing/cost optimization) — `forceAgent` bypasses that
|
|
23
|
-
* suppression but never changes rank.
|
|
24
|
-
*
|
|
25
|
-
* `runAgentFn` is injected (returns the agent's raw stdout) so this is
|
|
26
|
-
* testable without spawning a subprocess.
|
|
23
|
+
* higher-rank source wins and the loser is recorded. No agent contributes
|
|
24
|
+
* edges: every edge is backed by code, a manifest or documentation.
|
|
27
25
|
*/
|
|
28
26
|
export declare function resolveMapping(input: {
|
|
29
27
|
components: RawComponentDefinition[];
|
|
30
|
-
forceAgent?: boolean;
|
|
31
|
-
files: Array<{
|
|
32
|
-
path: string;
|
|
33
|
-
content: string;
|
|
34
|
-
}>;
|
|
35
|
-
runAgentFn: (opts: {
|
|
36
|
-
prompt: string;
|
|
37
|
-
files: Array<{
|
|
38
|
-
path: string;
|
|
39
|
-
content: string;
|
|
40
|
-
}>;
|
|
41
|
-
}) => Promise<string>;
|
|
42
|
-
buildPrompt?: (files: Array<{
|
|
43
|
-
path: string;
|
|
44
|
-
content: string;
|
|
45
|
-
}>, componentNames: string[]) => string;
|
|
46
|
-
/**
|
|
47
|
-
* Custom instruction preamble (from `--prompt composition=...`). Replaces the
|
|
48
|
-
* default guidance line ONLY; the machine-readable output contract + the
|
|
49
|
-
* component-name allowlist + candidate files are always appended so the
|
|
50
|
-
* JSONL parser keeps working regardless of the override.
|
|
51
|
-
*/
|
|
52
|
-
promptOverride?: string;
|
|
53
28
|
/**
|
|
54
29
|
* Pre-resolved edges from an external source (e.g. manifest or documentation)
|
|
55
30
|
* path). They join the ranked merge at their own provenance rank alongside
|
|
56
31
|
* code slots and other automatic mapping sources.
|
|
57
32
|
*/
|
|
58
33
|
extraEdges?: CompositionEdge[];
|
|
59
|
-
|
|
34
|
+
sourceCallSiteEvidence?: SourceCallSiteEvidence[];
|
|
35
|
+
sourceCallSiteRejections?: SourceCallSiteRejection[];
|
|
36
|
+
}): ResolveMappingResult;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
+
export type SourceCallSiteEvidence = {
|
|
3
|
+
parent: string;
|
|
4
|
+
child: string;
|
|
5
|
+
slot?: string;
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
startLine: number;
|
|
8
|
+
endLine: number;
|
|
9
|
+
excerpt: string;
|
|
10
|
+
kind: 'jsx-render';
|
|
11
|
+
};
|
|
12
|
+
export type SourceCallSiteRejection = {
|
|
13
|
+
parent: string;
|
|
14
|
+
candidate: string;
|
|
15
|
+
sourcePath: string;
|
|
16
|
+
startLine?: number;
|
|
17
|
+
endLine?: number;
|
|
18
|
+
excerpt?: string;
|
|
19
|
+
reason: 'unknown-component' | 'unbound-component' | 'text-only-child' | 'no-call-site';
|
|
20
|
+
};
|
|
21
|
+
export type SourceCallSiteEvidenceResult = {
|
|
22
|
+
accepted: SourceCallSiteEvidence[];
|
|
23
|
+
rejected: SourceCallSiteRejection[];
|
|
24
|
+
};
|
|
25
|
+
type SourceFileInput = {
|
|
26
|
+
path: string;
|
|
27
|
+
content: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function collectSourceCallSiteEvidence(files: readonly SourceFileInput[], components: readonly RawComponentDefinition[]): SourceCallSiteEvidenceResult;
|
|
30
|
+
export {};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
export declare function resolveExtractNoCache(opts: {
|
|
3
|
-
cache?: boolean;
|
|
4
|
-
noCache?: boolean;
|
|
5
|
-
}): boolean;
|
|
6
2
|
export declare function collectSourceFiles(directory: string, onProgress?: (scannedCount: number) => void): Promise<string[]>;
|
|
7
3
|
export declare function registerInternalExtractCommand(program: Command): void;
|
|
@@ -7,26 +7,21 @@ export declare function buildGenerateComponentsArgs(opts: {
|
|
|
7
7
|
agent: string;
|
|
8
8
|
model?: string;
|
|
9
9
|
bedrock?: boolean;
|
|
10
|
-
noCache?: boolean;
|
|
11
10
|
generatePromptPath?: string;
|
|
12
11
|
promptOverrides?: string[];
|
|
13
12
|
existingEntitiesPath?: string;
|
|
14
|
-
restoreCache?: boolean;
|
|
15
|
-
cachedComponents?: string[];
|
|
16
13
|
}): string[];
|
|
17
14
|
export declare function buildGenerateTokensArgs(opts: {
|
|
18
15
|
rawTokensPath: string;
|
|
19
16
|
agent: string;
|
|
20
17
|
model?: string;
|
|
21
18
|
bedrock?: boolean;
|
|
22
|
-
noCache?: boolean;
|
|
23
19
|
promptOverrides?: string[];
|
|
24
20
|
}): string[];
|
|
25
21
|
export declare function buildMapTokensArgs(opts: {
|
|
26
22
|
sessionId: string;
|
|
27
23
|
agent: string;
|
|
28
24
|
model?: string;
|
|
29
|
-
noCache?: boolean;
|
|
30
25
|
skipAgent?: boolean;
|
|
31
26
|
promptOverrides?: string[];
|
|
32
27
|
existingEntitiesPath?: string;
|
|
@@ -57,11 +52,10 @@ export type WizardAppProps = {
|
|
|
57
52
|
initialProjectPath?: string;
|
|
58
53
|
host?: string;
|
|
59
54
|
promptOverrides?: string[];
|
|
60
|
-
noCache?: boolean;
|
|
61
55
|
livePreview?: boolean;
|
|
62
56
|
generatePromptPath?: string;
|
|
63
57
|
skipMapTokens?: boolean;
|
|
64
58
|
initialRawTokensPath?: string;
|
|
65
59
|
initialAgentAuth?: Promise<AgentAuthStatus>;
|
|
66
60
|
};
|
|
67
|
-
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides,
|
|
61
|
+
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, initialAgentAuth, }?: WizardAppProps): React.ReactElement;
|