@contentful/experience-design-system-cli 2.25.2-dev-build-7edb0e3.0 → 2.25.2
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
CHANGED
|
@@ -3,10 +3,7 @@ import { Analytics } from '@segment/analytics-node';
|
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
const pkg = require('../../package.json');
|
|
5
5
|
// Anonymous usage telemetry for the CLI. Disabled when DISABLE_ANALYTICS is set
|
|
6
|
-
// or when
|
|
7
|
-
// Public write key scoped to data source. Grants write-only event ingest; a
|
|
8
|
-
// distributed CLI cannot hold a secret, so this ships in source by design.
|
|
9
|
-
const DEFAULT_WRITE_KEY = '6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N';
|
|
6
|
+
// or when no write key is configured. Never blocks command execution.
|
|
10
7
|
let analyticsClient = null;
|
|
11
8
|
let persistedDisabled = false;
|
|
12
9
|
export function cliVersion() {
|
|
@@ -19,13 +16,11 @@ export function setPersistedAnalyticsDisabled(disabled) {
|
|
|
19
16
|
persistedDisabled = disabled;
|
|
20
17
|
}
|
|
21
18
|
export function analyticsEnabled() {
|
|
22
|
-
return !persistedDisabled && !process.env.DISABLE_ANALYTICS;
|
|
19
|
+
return !persistedDisabled && !process.env.DISABLE_ANALYTICS && Boolean(resolveWriteKey());
|
|
23
20
|
}
|
|
24
|
-
// SEGMENT_WRITE_KEY overrides the default so engineers can point a local run at
|
|
25
|
-
// their own staging connection.
|
|
26
21
|
function resolveWriteKey() {
|
|
27
22
|
const key = (process.env.SEGMENT_WRITE_KEY ?? '').trim();
|
|
28
|
-
return key.length > 0 ? key :
|
|
23
|
+
return key.length > 0 ? key : undefined;
|
|
29
24
|
}
|
|
30
25
|
function getClient() {
|
|
31
26
|
if (!analyticsEnabled())
|
|
@@ -204,7 +204,7 @@ async function selectAllComponents(agent, model, components, verbose, skillPathO
|
|
|
204
204
|
let cliVersion = '';
|
|
205
205
|
if (!cacheConfig.noCache) {
|
|
206
206
|
try {
|
|
207
|
-
promptHash = await hashPromptForSkill('select', skillPathOverride);
|
|
207
|
+
promptHash = await hashPromptForSkill('select', agent, model, skillPathOverride);
|
|
208
208
|
cliVersion = await getCliCacheVersion();
|
|
209
209
|
const db = openPipelineDb(cacheConfig.dbPath);
|
|
210
210
|
try {
|
|
@@ -415,7 +415,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
415
415
|
const db = openPipelineDb();
|
|
416
416
|
let componentResults;
|
|
417
417
|
try {
|
|
418
|
-
const promptHash = await hashPromptForSkill('components', generatePromptPath);
|
|
418
|
+
const promptHash = await hashPromptForSkill('components', agent, model, generatePromptPath);
|
|
419
419
|
componentResults = await runAllComponents(agent, model, db, sessionId, allComponents, tokensInline, tokenMapInline, verbose, opts.cache === false || process.env.EDS_NO_CACHE === '1', generatePromptPath, promptHash);
|
|
420
420
|
}
|
|
421
421
|
finally {
|
|
@@ -477,7 +477,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
477
477
|
}
|
|
478
478
|
sessionId = resolvedSessionId;
|
|
479
479
|
await bindAnalyticsSessionId(resolvedSessionId);
|
|
480
|
-
const tokenPromptHash = await hashPromptForSkill('tokens');
|
|
480
|
+
const tokenPromptHash = await hashPromptForSkill('tokens', agent, model);
|
|
481
481
|
// Check cache before invoking agent
|
|
482
482
|
if (!noCache) {
|
|
483
483
|
const tokenCached = lookupCache(db, tokenInputHash, 'token_set', '__tokens__', tokenPromptHash);
|
|
@@ -9,7 +9,14 @@ export declare function hashFile(filePath: string): Promise<string>;
|
|
|
9
9
|
* generation_cache so cache entries invalidate when the prompt itself changes
|
|
10
10
|
* (including bundled-skill updates across CLI versions).
|
|
11
11
|
*
|
|
12
|
+
* Also folds in the resolved agent and model: a cache hit must not stand in
|
|
13
|
+
* for an agent run that was never made with the currently requested
|
|
14
|
+
* agent/model, or `--agent`/`--model` overrides would appear to be ignored
|
|
15
|
+
* whenever a prior cache entry already exists for the same input/prompt.
|
|
16
|
+
*
|
|
12
17
|
* @param skill — which skill (matches resolveSkillPath in prompt-builder)
|
|
18
|
+
* @param agent — resolved agent name for this run
|
|
19
|
+
* @param model — resolved model for this run (undefined resolves to the agent's default)
|
|
13
20
|
* @param skillPathOverride — optional absolute/relative path to a custom prompt
|
|
14
21
|
*/
|
|
15
|
-
export declare function hashPromptForSkill(skill: Skill, skillPathOverride?: string): Promise<string>;
|
|
22
|
+
export declare function hashPromptForSkill(skill: Skill, agent: string, model: string | undefined, skillPathOverride?: string): Promise<string>;
|
|
@@ -26,13 +26,19 @@ export async function hashFile(filePath) {
|
|
|
26
26
|
* generation_cache so cache entries invalidate when the prompt itself changes
|
|
27
27
|
* (including bundled-skill updates across CLI versions).
|
|
28
28
|
*
|
|
29
|
+
* Also folds in the resolved agent and model: a cache hit must not stand in
|
|
30
|
+
* for an agent run that was never made with the currently requested
|
|
31
|
+
* agent/model, or `--agent`/`--model` overrides would appear to be ignored
|
|
32
|
+
* whenever a prior cache entry already exists for the same input/prompt.
|
|
33
|
+
*
|
|
29
34
|
* @param skill — which skill (matches resolveSkillPath in prompt-builder)
|
|
35
|
+
* @param agent — resolved agent name for this run
|
|
36
|
+
* @param model — resolved model for this run (undefined resolves to the agent's default)
|
|
30
37
|
* @param skillPathOverride — optional absolute/relative path to a custom prompt
|
|
31
38
|
*/
|
|
32
|
-
export async function hashPromptForSkill(skill, skillPathOverride) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return hashFile(bundled);
|
|
39
|
+
export async function hashPromptForSkill(skill, agent, model, skillPathOverride) {
|
|
40
|
+
const promptHash = skillPathOverride
|
|
41
|
+
? await hashFile(resolve(skillPathOverride))
|
|
42
|
+
: await hashFile(resolveSkillPath(skill));
|
|
43
|
+
return hashContent(`${promptHash}|${agent}|${model ?? ''}`);
|
|
38
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.25.2
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"react": "^18.3.1",
|
|
35
35
|
"react-devtools-core": "^4.19.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
|
-
"@contentful/experience-design-system-
|
|
38
|
-
"@contentful/experience-design-system-
|
|
39
|
-
"@contentful/experience-design-system-
|
|
40
|
-
"@contentful/experience-design-system-types": "2.25.2
|
|
37
|
+
"@contentful/experience-design-system-client": "2.25.2",
|
|
38
|
+
"@contentful/experience-design-system-generation": "2.25.2",
|
|
39
|
+
"@contentful/experience-design-system-extraction": "2.25.2",
|
|
40
|
+
"@contentful/experience-design-system-types": "2.25.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@tsconfig/node24": "^24.0.4",
|