@cat-factory/prompt-fragments 0.10.26 → 0.11.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.
@@ -0,0 +1,3 @@
1
+ import type { PromptFragment } from '@cat-factory/contracts';
2
+ export declare const migrationFragments: PromptFragment[];
3
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/collections/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAsB5D,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAyD9C,CAAA"}
@@ -0,0 +1,75 @@
1
+ // Best-practice fragments for a TECHNOLOGICAL MIGRATION — swapping a load-bearing
2
+ // technology (a database engine, a framework major, a language runtime, a core
3
+ // library) behind a behaviour-preservation safety net. These are the default
4
+ // fragments the `preset_tech_migration` initiative preset applies to the coding,
5
+ // testing and document agents it spawns, so each body is written to steer WHATEVER
6
+ // agent carries out a slice of a migration — hence the deliberately broad `appliesTo`
7
+ // (a migration touches services, APIs, databases and libraries alike).
8
+ //
9
+ // Three concerns, one fragment each:
10
+ // - `migration.discipline` — the invariant methodology (blast zone →
11
+ // coverage → transition → delivery → decommission; coverage BEFORE delivery).
12
+ // - `migration.behaviour-preservation` — how to pin observable behaviour so the
13
+ // swap is provably behaviour-neutral (outcomes at a seam, never internals).
14
+ // - `migration.confidence-case` — the authoring standard for the
15
+ // evidence-backed coverage/confidence proof a human audits before delivery.
16
+ //
17
+ // The deep, phase-by-phase methodology (what a blast-zone report must enumerate, item
18
+ // granularity) lives code-side in the preset's `promptAdditions`, NOT here — these are
19
+ // the durable standards an agent follows while doing the work.
20
+ export const migrationFragments = [
21
+ {
22
+ id: 'migration.discipline',
23
+ version: '1.0.0',
24
+ title: 'Migration discipline',
25
+ category: 'Migration',
26
+ summary: 'Know the blast zone, pin behaviour before the swap, deliver incrementally, then remove the old path.',
27
+ body: [
28
+ 'Technological-migration discipline:',
29
+ '- What makes a migration safe is the discipline around it, not the code change: know the blast zone, pin behaviour, then swap — in that order.',
30
+ '- Establish the full blast zone before touching anything: every directly affected touchpoint AND its transitive reach (callers of callers, config, scheduled jobs, ops tooling, CI).',
31
+ '- Pin observable behaviour with tests BEFORE the swap. Coverage comes before delivery — never migrate code whose behaviour is not already characterised and green on the current technology.',
32
+ '- Decide the degree of backwards compatibility deliberately (big-bang vs dual-run vs adapter layer) and state it; do not let it emerge by accident.',
33
+ '- Deliver in small increments grouped by area, keeping the behaviour suite green on both the old and the new technology throughout — a red suite halts the migration.',
34
+ '- Finish the job: prove parity on the new target, flip the defaults, and REMOVE the old path. A migration that leaves the legacy code and its dependencies behind is not done.',
35
+ '- Record every non-obvious choice (a strategy per object, a retained legacy path, a compat posture) as an explicit decision, not a silent edit.',
36
+ ].join('\n'),
37
+ appliesTo: { agentKinds: ['spec-writer', 'architect', 'coder', 'tester', 'doc-writer'] },
38
+ },
39
+ {
40
+ id: 'migration.behaviour-preservation',
41
+ version: '1.0.0',
42
+ title: 'Behaviour preservation',
43
+ category: 'Migration',
44
+ summary: 'Pin observable outcomes at a seam above the swapped layer — never assert internals or vendor mechanics.',
45
+ body: [
46
+ 'Behaviour-preservation standards for a migration:',
47
+ '- Write characterization tests at a seam ABOVE the layer being swapped (the API / service / repository boundary) so they survive the swap unchanged and prove the new technology behaves identically.',
48
+ '- Assert observable OUTCOMES, never internals or mechanisms: do not assert raw vendor error codes, implicit result ordering, or locking/isolation mechanics — assert the outcome a caller sees (the mapped error, an explicitly ordered result, the final committed state).',
49
+ '- Preserve the edge-case semantics that silently differ between technologies: NULL vs empty string, numeric/datetime precision and rounding, string collation and case/trailing-space comparison, pagination stability, and any identity/sequence values that leak into responses.',
50
+ '- Keep set-based work set-based. When replacing a set-based operation (a bulk statement, a set-based stored procedure) with application code, express it as one batched operation — NEVER an app-side per-row loop, which is an N+1 regression the old path did not have.',
51
+ '- Establish the baseline first: the behaviour suite must be green on the CURRENT technology before any migration code lands, so a later failure unambiguously means the swap changed behaviour.',
52
+ '- Be additive and traceable: add tests for behaviour that lacks coverage, name each test after the behaviour it pins, and never weaken or delete an existing assertion to make the new target pass.',
53
+ ].join('\n'),
54
+ appliesTo: { agentKinds: ['spec-writer', 'coder', 'tester', 'playwright'] },
55
+ },
56
+ {
57
+ id: 'migration.confidence-case',
58
+ version: '1.0.0',
59
+ title: 'Confidence-case authoring',
60
+ category: 'Migration',
61
+ summary: 'Author the coverage proof as evidence a human audits: per-touchpoint named tests, justified gaps, safety nets.',
62
+ body: [
63
+ 'Confidence-case authoring standard:',
64
+ 'The confidence case is an evidence-backed proof that coverage is sufficient for delivery — a human reviews and challenges it, they do not re-derive the sweep. Every claim must be grounded; hand-waving is grounds for rejection, not a passing case. Structure it as:',
65
+ '1. Expected blast zone — recap the touchpoint inventory and call out any deltas discovered since it was written.',
66
+ '2. Coverage grounding — a per-touchpoint map: each inventory row to the NAMED tests that cover it and WHAT observable behaviour each test pins. Cite real test names and real touchpoints; a row with no evidence is a gap, not covered.',
67
+ '3. Gaps and waivers — every uncovered or partially-covered touchpoint, each with an explicit justification, bounded by the stated coverage bar (strict = every touchpoint has a named covering test; pragmatic = waivers allowed, each justified).',
68
+ '4. Risk mitigations — what was done to reduce the migration risk (staged rollout, seam isolation, rehearsal).',
69
+ '5. Safety nets and safeguards — the dual-target test harness, the CI legs, the rollback / compatibility posture, and the gated delivery batches.',
70
+ '- Be the single writer of the confidence-case document: append to it, never fork a parallel copy, and keep it the one source of the safety argument.',
71
+ ].join('\n'),
72
+ appliesTo: { agentKinds: ['coder', 'doc-writer'] },
73
+ },
74
+ ];
75
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/collections/migration.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,+EAA+E;AAC/E,6EAA6E;AAC7E,iFAAiF;AACjF,mFAAmF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YACrC,yQAAyQ;YACzQ,kHAAkH;YAClH,0OAA0O;YAC1O,oPAAoP;YACpP,+GAA+G;YAC/G,kJAAkJ;YAClJ,sJAAsJ;SACvJ,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;KACnD;CACF,CAAA"}
@@ -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;AAgB5D,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,eAAO,MAAM,SAAS,EAAE,cAAc,EAMrC,CAAA;AAID,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAA;AAE5E,uEAAuE;AACvE,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAE/D,CAAA;AAYD,mGAAmG;AACnG,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAErE;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAEjF;AAED,oFAAoF;AACpF,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAMrD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAElE"}
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;AAID,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAA;AAE5E,uEAAuE;AACvE,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAE/D,CAAA;AAYD,mGAAmG;AACnG,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAErE;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAEjF;AAED,oFAAoF;AACpF,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAMrD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAElE"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { acceptanceFragments } from './collections/acceptance.js';
2
2
  import { designFragments } from './collections/design.js';
3
+ import { migrationFragments } from './collections/migration.js';
3
4
  import { nodeFragments } from './collections/node.js';
4
5
  import { reactFragments } from './collections/react.js';
5
6
  import { styleFragments } from './collections/style.js';
@@ -9,6 +10,7 @@ export const FRAGMENTS = [
9
10
  ...acceptanceFragments,
10
11
  ...designFragments,
11
12
  ...styleFragments,
13
+ ...migrationFragments,
12
14
  ];
13
15
  // Re-export the document-task style defaults so the board service can seed a new document
14
16
  // task's fragment selection from the same source of truth the catalog is built from.
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,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,cAA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": "0.10.26",
3
+ "version": "0.11.0",
4
4
  "description": "Curated, versioned best-practice prompt fragments injected into agent system prompts.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,13 +24,16 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@cat-factory/contracts": "0.117.0"
27
+ "@cat-factory/contracts": "0.118.0"
28
28
  },
29
29
  "devDependencies": {
30
- "typescript": "7.0.1-rc"
30
+ "typescript": "7.0.1-rc",
31
+ "vitest": "^4.1.9"
31
32
  },
32
33
  "scripts": {
33
34
  "build": "tsc -b tsconfig.build.json",
34
- "typecheck": "tsc -p tsconfig.json --noEmit"
35
+ "typecheck": "tsc -p tsconfig.json --noEmit",
36
+ "test": "vitest",
37
+ "test:run": "vitest run"
35
38
  }
36
39
  }