@contractspec/module.lifecycle-advisor 2.4.0 → 2.5.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.
@@ -8,5 +8,9 @@ export interface LibraryRecommendation {
8
8
  export declare class ContractSpecLibraryRecommender {
9
9
  private readonly mapping;
10
10
  constructor(overrides?: LibraryStageEntry[]);
11
- recommend(stage: LifecycleStage, limit?: number): LibraryRecommendation[];
11
+ /**
12
+ * Recommend libraries for a lifecycle stage.
13
+ * When `locale` is provided, library descriptions are translated.
14
+ */
15
+ recommend(stage: LifecycleStage, limit?: number, locale?: string): LibraryRecommendation[];
12
16
  }
@@ -4,6 +4,8 @@ type StagePlaybook = StagePlaybookData;
4
4
  export interface RecommendationOptions {
5
5
  limit?: number;
6
6
  upcomingMilestones?: LifecycleMilestone[];
7
+ /** Locale for translated action titles, descriptions, and ceremony copy. */
8
+ locale?: string;
7
9
  }
8
10
  export declare class LifecycleRecommendationEngine {
9
11
  private readonly playbooks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/module.lifecycle-advisor",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "AI-powered lifecycle recommendations and guidance",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -33,12 +33,13 @@
33
33
  "typecheck": "tsc --noEmit"
34
34
  },
35
35
  "dependencies": {
36
- "@contractspec/lib.lifecycle": "2.4.0"
36
+ "@contractspec/lib.lifecycle": "2.5.0",
37
+ "@contractspec/lib.contracts-spec": "2.5.0"
37
38
  },
38
39
  "devDependencies": {
39
- "@contractspec/tool.typescript": "2.4.0",
40
+ "@contractspec/tool.typescript": "2.5.0",
40
41
  "typescript": "^5.9.3",
41
- "@contractspec/tool.bun": "2.4.0"
42
+ "@contractspec/tool.bun": "2.5.0"
42
43
  },
43
44
  "exports": {
44
45
  ".": {
@@ -1,12 +1,30 @@
1
1
  import type { LifecycleStage } from '@contractspec/lib.lifecycle';
2
2
  import type { LibraryRecommendation } from '../recommendations/library-recommender';
3
+ import { createLifecycleAdvisorI18n } from '../i18n/messages';
3
4
 
4
5
  export interface LibraryStageEntry {
5
6
  stage: LifecycleStage;
6
7
  items: LibraryRecommendation[];
7
8
  }
8
9
 
9
- const libraryStageMap: LibraryStageEntry[] = [
10
+ /**
11
+ * Return the library-stage map with translated descriptions for the given locale.
12
+ * Falls back to English when locale is omitted or unsupported.
13
+ */
14
+ export function getLocalizedLibraryStageMap(
15
+ locale?: string
16
+ ): LibraryStageEntry[] {
17
+ const i18n = createLifecycleAdvisorI18n(locale);
18
+ return staticLibraryStageMap.map((entry, stageIdx) => ({
19
+ ...entry,
20
+ items: entry.items.map((item, itemIdx) => ({
21
+ ...item,
22
+ description: i18n.t(`library.stage${stageIdx}.item${itemIdx}`),
23
+ })),
24
+ }));
25
+ }
26
+
27
+ const staticLibraryStageMap: LibraryStageEntry[] = [
10
28
  {
11
29
  stage: 0 as LifecycleStage,
12
30
  items: [
@@ -114,4 +132,6 @@ const libraryStageMap: LibraryStageEntry[] = [
114
132
  },
115
133
  ];
116
134
 
135
+ /** Backward-compatible static export (English defaults). */
136
+ const libraryStageMap: LibraryStageEntry[] = staticLibraryStageMap;
117
137
  export default libraryStageMap;
@@ -3,6 +3,7 @@ import type {
3
3
  LifecycleRecommendation,
4
4
  } from '@contractspec/lib.lifecycle';
5
5
  import { LifecycleStage } from '@contractspec/lib.lifecycle';
6
+ import { createLifecycleAdvisorI18n } from '../i18n/messages';
6
7
 
7
8
  export interface StagePlaybookData {
8
9
  stage: LifecycleStage;
@@ -11,7 +12,37 @@ export interface StagePlaybookData {
11
12
  ceremony?: LifecycleRecommendation['ceremony'];
12
13
  }
13
14
 
14
- const stagePlaybooks: StagePlaybookData[] = [
15
+ /**
16
+ * Return stage playbooks with translated strings for the given locale.
17
+ * Falls back to English when locale is omitted or unsupported.
18
+ */
19
+ export function getLocalizedStagePlaybooks(
20
+ locale?: string
21
+ ): StagePlaybookData[] {
22
+ const i18n = createLifecycleAdvisorI18n(locale);
23
+ return staticPlaybooks.map((playbook, stageIdx) => ({
24
+ ...playbook,
25
+ focusAreas: playbook.focusAreas.map((_, focusIdx) =>
26
+ i18n.t(`playbook.stage${stageIdx}.focus.${focusIdx}`)
27
+ ),
28
+ actions: playbook.actions.map((action, actionIdx) => ({
29
+ ...action,
30
+ title: i18n.t(`playbook.stage${stageIdx}.action${actionIdx}.title`),
31
+ description: i18n.t(
32
+ `playbook.stage${stageIdx}.action${actionIdx}.description`
33
+ ),
34
+ })),
35
+ ceremony: playbook.ceremony
36
+ ? {
37
+ ...playbook.ceremony,
38
+ title: i18n.t(`ceremony.stage${stageIdx}.title`),
39
+ copy: i18n.t(`ceremony.stage${stageIdx}.copy`),
40
+ }
41
+ : undefined,
42
+ }));
43
+ }
44
+
45
+ const staticPlaybooks: StagePlaybookData[] = [
15
46
  {
16
47
  stage: LifecycleStage.Exploration,
17
48
  focusAreas: ['Discovery', 'Problem clarity', 'Persona'],
@@ -251,4 +282,6 @@ const stagePlaybooks: StagePlaybookData[] = [
251
282
  },
252
283
  ];
253
284
 
285
+ /** Backward-compatible static export (English defaults). */
286
+ const stagePlaybooks: StagePlaybookData[] = staticPlaybooks;
254
287
  export default stagePlaybooks;