@cat-factory/prompt-fragments 0.15.78 → 0.16.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/collections/design.d.ts +25 -0
- package/dist/collections/design.d.ts.map +1 -1
- package/dist/collections/design.js +36 -2
- package/dist/collections/design.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,28 @@
|
|
|
1
1
|
import type { PromptFragment } from '@cat-factory/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The one fragment that tells an agent how to consume materialised design context.
|
|
4
|
+
*
|
|
5
|
+
* Named as a constant because the ENGINE folds it by presence rather than by selection: a run whose
|
|
6
|
+
* resolved context carries a design-origin document gets it automatically
|
|
7
|
+
* ({@link withDesignContextFragment}). Before that it was auto-selected by nothing — the `appliesTo`
|
|
8
|
+
* selector below is a management-surface hint the run path never drove, the fragment is in no seed pin
|
|
9
|
+
* set, and basic mode hides the per-task fragment picker — so the standard case (a designer links a
|
|
10
|
+
* Figma frame and starts a run) executed with a design context file on disk and no instruction
|
|
11
|
+
* anywhere to honour it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DESIGN_CONTEXT_FRAGMENT_ID = "design.context";
|
|
14
|
+
/**
|
|
15
|
+
* The applicable fragment ids for a run, plus `design.context` when that run actually carries a
|
|
16
|
+
* design document. PURE, and the ONLY place the presence rule lives.
|
|
17
|
+
*
|
|
18
|
+
* A deterministic presence rule at prompt assembly, deliberately NOT a revival of the retired
|
|
19
|
+
* `appliesTo` run-path selector: the trigger is the design document the run resolved, so it cannot
|
|
20
|
+
* drift from what is on disk — whereas a `blockTypes: ['frontend']` selector both misses a design
|
|
21
|
+
* linked to an unlabelled task and fires on a frontend task with no design at all.
|
|
22
|
+
*
|
|
23
|
+
* Appended LAST and only when not already present, so a workspace that pins the fragment explicitly
|
|
24
|
+
* (or overrides it in its own catalog) keeps its position and its single entry.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withDesignContextFragment(ids: readonly string[], hasDesignContext: boolean): string[];
|
|
2
27
|
export declare const designFragments: PromptFragment[];
|
|
3
28
|
//# sourceMappingURL=design.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/collections/design.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,eAAO,MAAM,eAAe,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/collections/design.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,mBAAmB,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,gBAAgB,EAAE,OAAO,GACxB,MAAM,EAAE,CAGV;AAED,eAAO,MAAM,eAAe,EAAE,cAAc,EA+B3C,CAAA"}
|
|
@@ -3,9 +3,38 @@
|
|
|
3
3
|
// inventory and design tokens into `.cat-context/*.md` in the SAME shape (`## <block>`
|
|
4
4
|
// blocks, a global `### Components`, `### Design tokens`, optional `### References`), so
|
|
5
5
|
// one fragment serves them all — the agent doesn't need to know which tool authored it.
|
|
6
|
+
/**
|
|
7
|
+
* The one fragment that tells an agent how to consume materialised design context.
|
|
8
|
+
*
|
|
9
|
+
* Named as a constant because the ENGINE folds it by presence rather than by selection: a run whose
|
|
10
|
+
* resolved context carries a design-origin document gets it automatically
|
|
11
|
+
* ({@link withDesignContextFragment}). Before that it was auto-selected by nothing — the `appliesTo`
|
|
12
|
+
* selector below is a management-surface hint the run path never drove, the fragment is in no seed pin
|
|
13
|
+
* set, and basic mode hides the per-task fragment picker — so the standard case (a designer links a
|
|
14
|
+
* Figma frame and starts a run) executed with a design context file on disk and no instruction
|
|
15
|
+
* anywhere to honour it.
|
|
16
|
+
*/
|
|
17
|
+
export const DESIGN_CONTEXT_FRAGMENT_ID = 'design.context';
|
|
18
|
+
/**
|
|
19
|
+
* The applicable fragment ids for a run, plus `design.context` when that run actually carries a
|
|
20
|
+
* design document. PURE, and the ONLY place the presence rule lives.
|
|
21
|
+
*
|
|
22
|
+
* A deterministic presence rule at prompt assembly, deliberately NOT a revival of the retired
|
|
23
|
+
* `appliesTo` run-path selector: the trigger is the design document the run resolved, so it cannot
|
|
24
|
+
* drift from what is on disk — whereas a `blockTypes: ['frontend']` selector both misses a design
|
|
25
|
+
* linked to an unlabelled task and fires on a frontend task with no design at all.
|
|
26
|
+
*
|
|
27
|
+
* Appended LAST and only when not already present, so a workspace that pins the fragment explicitly
|
|
28
|
+
* (or overrides it in its own catalog) keeps its position and its single entry.
|
|
29
|
+
*/
|
|
30
|
+
export function withDesignContextFragment(ids, hasDesignContext) {
|
|
31
|
+
if (!hasDesignContext || ids.includes(DESIGN_CONTEXT_FRAGMENT_ID))
|
|
32
|
+
return [...ids];
|
|
33
|
+
return [...ids, DESIGN_CONTEXT_FRAGMENT_ID];
|
|
34
|
+
}
|
|
6
35
|
export const designFragments = [
|
|
7
36
|
{
|
|
8
|
-
id:
|
|
37
|
+
id: DESIGN_CONTEXT_FRAGMENT_ID,
|
|
9
38
|
version: '1.0.0',
|
|
10
39
|
title: 'Design context',
|
|
11
40
|
category: 'Design',
|
|
@@ -25,7 +54,12 @@ export const designFragments = [
|
|
|
25
54
|
' textual layout/text/tokens above are the authoritative description.',
|
|
26
55
|
].join('\n'),
|
|
27
56
|
brief: 'Design context: build UI from the `.cat-context/` design — follow each block’s `### Layout` for structure; reuse an existing repo component before creating one from the `### Components` inventory; honour `### Design tokens` via the project’s theme system instead of ad-hoc values; `### Text content` is copy, not markup; `### References` URLs are reference-only.',
|
|
28
|
-
appliesTo
|
|
57
|
+
// No `appliesTo`. The selector this fragment used to carry (`blockTypes: ['frontend']`) was
|
|
58
|
+
// wrong in both directions (it missed a design linked to an unlabelled task and fired on a
|
|
59
|
+
// frontend task with no design), and {@link withDesignContextFragment} replaced it. Leaving it
|
|
60
|
+
// beside the presence rule would keep the old behaviour alive wherever `appliesTo` is still
|
|
61
|
+
// read (the deterministic selector, the catalog gate, the management surface, which would go on
|
|
62
|
+
// labelling this frontend-only while the engine folds it for any block type carrying a design).
|
|
29
63
|
},
|
|
30
64
|
];
|
|
31
65
|
//# sourceMappingURL=design.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.js","sourceRoot":"","sources":["../../src/collections/design.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,uFAAuF;AACvF,uFAAuF;AACvF,yFAAyF;AACzF,wFAAwF;AAExF,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"design.js","sourceRoot":"","sources":["../../src/collections/design.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,uFAAuF;AACvF,uFAAuF;AACvF,yFAAyF;AACzF,wFAAwF;AAExF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CACvC,GAAsB,EACtB,gBAAyB;IAEzB,IAAI,CAAC,gBAAgB,IAAI,GAAG,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAAE,OAAO,CAAC,GAAG,GAAG,CAAC,CAAA;IAClF,OAAO,CAAC,GAAG,GAAG,EAAE,0BAA0B,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,EAAE,EAAE,0BAA0B;QAC9B,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EACL,yGAAyG;QAC3G,IAAI,EAAE;YACJ,8FAA8F;YAC9F,2FAA2F;YAC3F,oGAAoG;YACpG,kCAAkC;YAClC,+GAA+G;YAC/G,6GAA6G;YAC7G,4FAA4F;YAC5F,sGAAsG;YACtG,mFAAmF;YACnF,iFAAiF;YACjF,4GAA4G;YAC5G,uEAAuE;SACxE,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EACH,4WAA4W;QAC9W,4FAA4F;QAC5F,2FAA2F;QAC3F,+FAA+F;QAC/F,4FAA4F;QAC5F,gGAAgG;QAChG,gGAAgG;KACjG;CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const FRAGMENTS: PromptFragment[];
|
|
|
4
4
|
export { styleFragments, DEFAULT_DOCUMENT_STYLE_FRAGMENT_IDS } from './collections/style.js';
|
|
5
5
|
export { registerTaskTypeDefaultFragments, clearRegisteredTaskTypeDefaultFragments, defaultFragmentIdsForTaskType, } from './task-type-defaults.js';
|
|
6
6
|
export { MIGRATION_FRAGMENT_IDS, migrationFragmentIdsFor } from './collections/migration.js';
|
|
7
|
+
export { DESIGN_CONTEXT_FRAGMENT_ID, withDesignContextFragment } from './collections/design.js';
|
|
7
8
|
/** Fragments keyed by id for O(1) lookup during prompt composition. */
|
|
8
9
|
export declare const FRAGMENTS_BY_ID: ReadonlyMap<string, PromptFragment>;
|
|
9
10
|
/** Register a custom prompt fragment into the universal pool. Re-registering an id replaces it. */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAiB5D,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,eAAO,MAAM,SAAS,EAAE,cAAc,EAOrC,CAAA;AAKD,OAAO,EAAE,cAAc,EAAE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eDefaultFragments, clearRegisteredTaskTypeDefaultFragmen
|
|
|
25
25
|
// (T8's descriptor `defaultFragmentIds`) + `migrationFragmentIdsFor` (T7's `seedMigrationPlan`,
|
|
26
26
|
// which stamps the per-agent-kind subset that respects each fragment's `appliesTo`).
|
|
27
27
|
export { MIGRATION_FRAGMENT_IDS, migrationFragmentIdsFor } from './collections/migration.js';
|
|
28
|
+
// The design-context fragment's id + the engine's presence rule for folding it: a run whose resolved
|
|
29
|
+
// context carries a design-origin document reads the guidance automatically, rather than depending on
|
|
30
|
+
// a human having ticked it in a picker basic mode does not show.
|
|
31
|
+
export { DESIGN_CONTEXT_FRAGMENT_ID, withDesignContextFragment } from './collections/design.js';
|
|
28
32
|
/** Fragments keyed by id for O(1) lookup during prompt composition. */
|
|
29
33
|
export const FRAGMENTS_BY_ID = new Map(FRAGMENTS.map((fragment) => [fragment.id, fragment]));
|
|
30
34
|
// Installation-level extension point for the universal fragment pool, mirroring the
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAavD,MAAM,CAAC,MAAM,SAAS,GAAqB;IACzC,GAAG,aAAa;IAChB,GAAG,cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,eAAe;IAClB,GAAG,cAAc;IACjB,GAAG,kBAAkB;CACtB,CAAA;AAED,+FAA+F;AAC/F,8FAA8F;AAC9F,8FAA8F;AAC9F,OAAO,E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AC3E,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/prompt-fragments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Curated, versioned best-practice prompt fragments injected into agent system prompts.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cat-factory/contracts": "0.
|
|
27
|
+
"@cat-factory/contracts": "0.253.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"typescript": "7.0.2",
|