@contractspec/example.product-intent 3.7.6 → 3.7.10

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,4 @@
1
+ export declare const ProductIntentDiscoverySpec: import("@contractspec/lib.contracts-spec/product-intent/spec").ProductIntentSpec<{
2
+ evidenceRoot: string;
3
+ analyticsProvider: string;
4
+ }>;
@@ -0,0 +1,76 @@
1
+ // @bun
2
+ // src/product-intent.discovery.ts
3
+ import {
4
+ OwnersEnum,
5
+ StabilityEnum
6
+ } from "@contractspec/lib.contracts-spec/ownership";
7
+ import { defineProductIntentSpec } from "@contractspec/lib.contracts-spec/product-intent/spec";
8
+ var ProductIntentDiscoverySpec = defineProductIntentSpec({
9
+ id: "product-intent.discovery.activation",
10
+ meta: {
11
+ key: "product-intent.discovery.activation",
12
+ version: "1.0.0",
13
+ title: "Product Intent Discovery",
14
+ description: "Discovery contract for activation friction using transcripts, analytics signals, and generated tasks.",
15
+ domain: "product",
16
+ owners: [OwnersEnum.PlatformCore],
17
+ tags: ["product-intent", "discovery", "activation", "analytics"],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Prioritize the next activation improvement with grounded evidence.",
20
+ context: "Evidence is collected from interview transcripts, support tickets, and PostHog funnels before turning into task-ready outputs."
21
+ },
22
+ question: "Which activation and onboarding friction should we prioritize next?",
23
+ runtimeContext: {
24
+ evidenceRoot: "packages/examples/product-intent/evidence",
25
+ analyticsProvider: "posthog"
26
+ },
27
+ tickets: {
28
+ tickets: [
29
+ {
30
+ ticketId: "PI-101",
31
+ title: "Add a guided onboarding checklist",
32
+ summary: "Give new users an explicit checklist after signup so they can see the next activation milestone.",
33
+ evidenceIds: ["INT-002", "INT-014", "PH-dropoff-checkout"],
34
+ acceptanceCriteria: [
35
+ "Users see a checklist within the first session.",
36
+ "Checklist completion is tracked in analytics."
37
+ ],
38
+ priority: "high",
39
+ tags: ["activation", "onboarding"]
40
+ }
41
+ ]
42
+ },
43
+ tasks: {
44
+ packId: "product-intent.discovery.activation.tasks",
45
+ patchId: "product-intent.discovery.activation.patch",
46
+ overview: "Introduce a checklist-driven onboarding path and instrument it for activation measurement.",
47
+ tasks: [
48
+ {
49
+ id: "task-ui-checklist",
50
+ title: "Model the onboarding checklist surface",
51
+ surface: ["ui", "docs"],
52
+ why: "The product intent needs a visible activation guide and matching contract docs.",
53
+ acceptance: [
54
+ "A checklist surface is defined in contracts.",
55
+ "Documentation explains the activation milestone mapping."
56
+ ],
57
+ agentPrompt: "Add the onboarding checklist contract surface and document the milestone states."
58
+ },
59
+ {
60
+ id: "task-analytics-checklist",
61
+ title: "Track checklist completion events",
62
+ surface: ["api", "tests"],
63
+ why: "Success must be measurable after rollout.",
64
+ acceptance: [
65
+ "Checklist completion emits analytics events.",
66
+ "Tests cover the event contract and payload shape."
67
+ ],
68
+ agentPrompt: "Emit activation checklist events and add test coverage for the telemetry payloads.",
69
+ dependsOn: ["task-ui-checklist"]
70
+ }
71
+ ]
72
+ }
73
+ });
74
+ export {
75
+ ProductIntentDiscoverySpec
76
+ };
package/dist/script.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/posthog-signals.ts
3
- import { FunnelAnalyzer } from "@contractspec/lib.analytics/funnel";
4
3
  import { PosthogAnalyticsProvider } from "@contractspec/integration.providers-impls/impls/posthog";
4
+ import { FunnelAnalyzer } from "@contractspec/lib.analytics/funnel";
5
5
  async function loadPosthogEvidenceChunks(options) {
6
6
  const chunks = [];
7
7
  const range = resolveRange(options.dateRange);
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/posthog-signals.ts
3
- import { FunnelAnalyzer } from "@contractspec/lib.analytics/funnel";
4
3
  import { PosthogAnalyticsProvider } from "@contractspec/integration.providers-impls/impls/posthog";
4
+ import { FunnelAnalyzer } from "@contractspec/lib.analytics/funnel";
5
5
  async function loadPosthogEvidenceChunks(options) {
6
6
  const chunks = [];
7
7
  const range = resolveRange(options.dateRange);
@@ -307,6 +307,9 @@ async function loadEvidenceChunksWithSignals(options = {}) {
307
307
  }
308
308
 
309
309
  // src/sync-actions.ts
310
+ import { JiraProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/jira";
311
+ import { LinearProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/linear";
312
+ import { NotionProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/notion";
310
313
  import { createAgentJsonRunner } from "@contractspec/lib.ai-agent/agent/json-runner";
311
314
  import {
312
315
  buildProjectManagementSyncPayload,
@@ -316,9 +319,6 @@ import {
316
319
  impactEngine,
317
320
  suggestPatch
318
321
  } from "@contractspec/lib.product-intent-utils";
319
- import { LinearProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/linear";
320
- import { JiraProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/jira";
321
- import { NotionProjectManagementProvider } from "@contractspec/integration.providers-impls/impls/notion";
322
322
  var QUESTION = "Which activation and onboarding friction should we prioritize next?";
323
323
  function resolveProvider() {
324
324
  const raw = (process.env.CONTRACTSPEC_PM_PROVIDER ?? "").toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/example.product-intent",
3
- "version": "3.7.6",
3
+ "version": "3.7.10",
4
4
  "description": "Product intent example: evidence ingestion and prompt-ready outputs.",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -48,6 +48,12 @@
48
48
  "node": "./dist/node/posthog-signals.js",
49
49
  "default": "./dist/posthog-signals.js"
50
50
  },
51
+ "./product-intent.discovery": {
52
+ "types": "./dist/product-intent.discovery.d.ts",
53
+ "bun": "./dist/product-intent.discovery.js",
54
+ "node": "./dist/node/product-intent.discovery.js",
55
+ "default": "./dist/product-intent.discovery.js"
56
+ },
51
57
  "./product-intent.feature": {
52
58
  "types": "./dist/product-intent.feature.d.ts",
53
59
  "bun": "./dist/product-intent.feature.js",
@@ -76,23 +82,24 @@
76
82
  "dev": "contractspec-bun-build dev",
77
83
  "clean": "rimraf dist .turbo",
78
84
  "lint": "bun lint:fix",
79
- "lint:fix": "eslint src --fix",
80
- "lint:check": "eslint src",
85
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
86
+ "lint:check": "biome check .",
81
87
  "test": "bun test",
82
88
  "prebuild": "contractspec-bun-build prebuild",
83
89
  "typecheck": "tsc --noEmit"
84
90
  },
85
91
  "dependencies": {
86
- "@contractspec/lib.contracts-spec": "3.7.6",
87
- "@contractspec/lib.contracts-integrations": "3.7.6",
88
- "@contractspec/lib.ai-agent": "7.0.6",
89
- "@contractspec/lib.product-intent-utils": "3.7.6",
90
- "@contractspec/integration.providers-impls": "3.7.6"
92
+ "@contractspec/lib.analytics": "3.7.10",
93
+ "@contractspec/lib.contracts-spec": "4.1.2",
94
+ "@contractspec/lib.contracts-integrations": "3.8.2",
95
+ "@contractspec/lib.ai-agent": "7.0.10",
96
+ "@contractspec/lib.product-intent-utils": "3.7.10",
97
+ "@contractspec/integration.providers-impls": "3.8.2"
91
98
  },
92
99
  "devDependencies": {
93
- "@contractspec/tool.typescript": "3.7.6",
100
+ "@contractspec/tool.typescript": "3.7.8",
94
101
  "typescript": "^5.9.3",
95
- "@contractspec/tool.bun": "3.7.6"
102
+ "@contractspec/tool.bun": "3.7.8"
96
103
  },
97
104
  "publishConfig": {
98
105
  "access": "public",
@@ -133,6 +140,12 @@
133
140
  "node": "./dist/node/posthog-signals.js",
134
141
  "default": "./dist/posthog-signals.js"
135
142
  },
143
+ "./product-intent.discovery": {
144
+ "types": "./dist/product-intent.discovery.d.ts",
145
+ "bun": "./dist/product-intent.discovery.js",
146
+ "node": "./dist/node/product-intent.discovery.js",
147
+ "default": "./dist/product-intent.discovery.js"
148
+ },
136
149
  "./product-intent.feature": {
137
150
  "types": "./dist/product-intent.feature.d.ts",
138
151
  "bun": "./dist/product-intent.feature.js",
@@ -0,0 +1,14 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { ProductIntentDiscoverySpec, ProductIntentFeature } from './index';
3
+
4
+ describe('@contractspec/example.product-intent', () => {
5
+ test('exports the canonical product intent spec', () => {
6
+ expect(ProductIntentDiscoverySpec.meta.key).toBe(
7
+ 'product-intent.discovery.activation'
8
+ );
9
+ expect(ProductIntentDiscoverySpec.question).toContain('activation');
10
+ expect(ProductIntentDiscoverySpec.tickets?.tickets).toHaveLength(1);
11
+ expect(ProductIntentDiscoverySpec.tasks?.tasks).toHaveLength(2);
12
+ expect(ProductIntentFeature.meta.key).toBe('product-intent');
13
+ });
14
+ });
@@ -2,36 +2,36 @@ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
2
2
  import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
3
3
 
4
4
  const blocks: DocBlock[] = [
5
- {
6
- id: 'docs.examples.product-intent',
7
- title: 'Product Intent Discovery',
8
- summary:
9
- 'Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.',
10
- kind: 'reference',
11
- visibility: 'public',
12
- route: '/docs/examples/product-intent',
13
- tags: ['product-intent', 'discovery', 'evidence', 'example'],
14
- body: `## Included assets
5
+ {
6
+ id: 'docs.examples.product-intent',
7
+ title: 'Product Intent Discovery',
8
+ summary:
9
+ 'Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.',
10
+ kind: 'reference',
11
+ visibility: 'public',
12
+ route: '/docs/examples/product-intent',
13
+ tags: ['product-intent', 'discovery', 'evidence', 'example'],
14
+ body: `## Included assets
15
15
  - Product-intent feature and example manifest.
16
16
  - Evidence loading helpers and PostHog signal ingestion.
17
17
  - Sync actions and script entrypoints for discovery workflows.
18
18
 
19
19
  ## Use case
20
20
  Use this example when you need a lightweight pattern for evidence-backed product discovery before it becomes a larger workflow or template.`,
21
- },
22
- {
23
- id: 'docs.examples.product-intent.usage',
24
- title: 'Product Intent Usage',
25
- summary: 'How to use the product-intent example for evidence ingestion.',
26
- kind: 'usage',
27
- visibility: 'public',
28
- route: '/docs/examples/product-intent/usage',
29
- tags: ['product-intent', 'usage'],
30
- body: `## Usage
21
+ },
22
+ {
23
+ id: 'docs.examples.product-intent.usage',
24
+ title: 'Product Intent Usage',
25
+ summary: 'How to use the product-intent example for evidence ingestion.',
26
+ kind: 'usage',
27
+ visibility: 'public',
28
+ route: '/docs/examples/product-intent/usage',
29
+ tags: ['product-intent', 'usage'],
30
+ body: `## Usage
31
31
  1. Load evidence sources with the helpers in this package.
32
32
  2. Transform product signals into the product-intent workflow inputs.
33
33
  3. Export the resulting discovery outputs into the next planning step or agent prompt.`,
34
- },
34
+ },
35
35
  ];
36
36
 
37
37
  registerDocBlocks(blocks);
package/src/example.ts CHANGED
@@ -1,32 +1,32 @@
1
1
  import { defineExample } from '@contractspec/lib.contracts-spec/examples';
2
2
 
3
3
  const example = defineExample({
4
- meta: {
5
- key: 'product-intent',
6
- version: '1.0.0',
7
- title: 'Product Intent Discovery',
8
- description:
9
- 'Evidence ingestion and product-intent workflow for PM discovery.',
10
- kind: 'script',
11
- visibility: 'public',
12
- stability: 'experimental',
13
- owners: ['@platform.core'],
14
- tags: ['product-intent', 'discovery', 'pm', 'evidence', 'llm'],
15
- },
16
- docs: {
17
- rootDocId: 'docs.examples.product-intent',
18
- usageDocId: 'docs.examples.product-intent.usage',
19
- },
20
- entrypoints: {
21
- packageName: '@contractspec/example.product-intent',
22
- docs: './docs',
23
- },
24
- surfaces: {
25
- templates: false,
26
- sandbox: { enabled: false, modes: [] },
27
- studio: { enabled: false, installable: false },
28
- mcp: { enabled: false },
29
- },
4
+ meta: {
5
+ key: 'product-intent',
6
+ version: '1.0.0',
7
+ title: 'Product Intent Discovery',
8
+ description:
9
+ 'Evidence ingestion and product-intent workflow for PM discovery.',
10
+ kind: 'script',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['product-intent', 'discovery', 'pm', 'evidence', 'llm'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.product-intent',
18
+ usageDocId: 'docs.examples.product-intent.usage',
19
+ },
20
+ entrypoints: {
21
+ packageName: '@contractspec/example.product-intent',
22
+ docs: './docs',
23
+ },
24
+ surfaces: {
25
+ templates: false,
26
+ sandbox: { enabled: false, modes: [] },
27
+ studio: { enabled: false, installable: false },
28
+ mcp: { enabled: false },
29
+ },
30
30
  });
31
31
 
32
32
  export default example;
package/src/index.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  export { default as example } from './example';
2
- export {
3
- DEFAULT_CHUNK_SIZE,
4
- DEFAULT_EVIDENCE_ROOT,
5
- DEFAULT_TRANSCRIPT_DIRS,
6
- loadEvidenceChunks,
7
- loadEvidenceChunksWithSignals,
8
- } from './load-evidence';
9
2
  export type {
10
- EvidenceLoadOptions,
11
- EvidenceLoadWithSignalsOptions,
3
+ EvidenceLoadOptions,
4
+ EvidenceLoadWithSignalsOptions,
12
5
  } from './load-evidence';
13
6
  export {
14
- loadPosthogEvidenceChunks,
15
- resolvePosthogEvidenceOptionsFromEnv,
16
- } from './posthog-signals';
7
+ DEFAULT_CHUNK_SIZE,
8
+ DEFAULT_EVIDENCE_ROOT,
9
+ DEFAULT_TRANSCRIPT_DIRS,
10
+ loadEvidenceChunks,
11
+ loadEvidenceChunksWithSignals,
12
+ } from './load-evidence';
17
13
  export type { PosthogEvidenceOptions } from './posthog-signals';
14
+ export {
15
+ loadPosthogEvidenceChunks,
16
+ resolvePosthogEvidenceOptionsFromEnv,
17
+ } from './posthog-signals';
18
+ export * from './product-intent.discovery';
18
19
  export * from './product-intent.feature';
@@ -6,11 +6,11 @@ import { loadEvidenceChunks } from './load-evidence';
6
6
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
7
7
 
8
8
  describe('loadEvidenceChunks', () => {
9
- it('loads evidence chunks from the example dataset', () => {
10
- const evidenceRoot = path.join(moduleDir, '../evidence');
11
- const chunks = loadEvidenceChunks({ evidenceRoot, chunkSize: 2000 });
9
+ it('loads evidence chunks from the example dataset', () => {
10
+ const evidenceRoot = path.join(moduleDir, '../evidence');
11
+ const chunks = loadEvidenceChunks({ evidenceRoot, chunkSize: 2000 });
12
12
 
13
- expect(chunks.length).toBeGreaterThan(0);
14
- expect(chunks.some((chunk) => chunk.chunkId.startsWith('INT-'))).toBe(true);
15
- });
13
+ expect(chunks.length).toBeGreaterThan(0);
14
+ expect(chunks.some((chunk) => chunk.chunkId.startsWith('INT-'))).toBe(true);
15
+ });
16
16
  });
@@ -12,13 +12,13 @@ export const DEFAULT_TRANSCRIPT_DIRS = ['interviews', 'tickets', 'public'];
12
12
  export const DEFAULT_CHUNK_SIZE = 800;
13
13
 
14
14
  export interface EvidenceLoadOptions {
15
- evidenceRoot?: string;
16
- transcriptDirs?: string[];
17
- chunkSize?: number;
15
+ evidenceRoot?: string;
16
+ transcriptDirs?: string[];
17
+ chunkSize?: number;
18
18
  }
19
19
 
20
20
  export interface EvidenceLoadWithSignalsOptions extends EvidenceLoadOptions {
21
- posthog?: PosthogEvidenceOptions;
21
+ posthog?: PosthogEvidenceOptions;
22
22
  }
23
23
 
24
24
  /**
@@ -26,33 +26,33 @@ export interface EvidenceLoadWithSignalsOptions extends EvidenceLoadOptions {
26
26
  * files include a YAML header delimited by triple dashes.
27
27
  */
28
28
  function stripYamlFrontMatter(contents: string): string {
29
- const start = contents.indexOf('---');
30
- if (start === -1) return contents;
31
- const end = contents.indexOf('---', start + 3);
32
- if (end === -1) return contents;
33
- return contents.slice(end + 3).trimStart();
29
+ const start = contents.indexOf('---');
30
+ if (start === -1) return contents;
31
+ const end = contents.indexOf('---', start + 3);
32
+ if (end === -1) return contents;
33
+ return contents.slice(end + 3).trimStart();
34
34
  }
35
35
 
36
36
  /**
37
37
  * Split a transcript into fixed-size chunks.
38
38
  */
39
39
  function chunkTranscript(
40
- fileId: string,
41
- text: string,
42
- chunkSize: number
40
+ fileId: string,
41
+ text: string,
42
+ chunkSize: number
43
43
  ): EvidenceChunk[] {
44
- const chunks: EvidenceChunk[] = [];
45
- const clean = text.trim();
46
- for (let offset = 0, idx = 0; offset < clean.length; idx += 1) {
47
- const slice = clean.slice(offset, offset + chunkSize);
48
- chunks.push({
49
- chunkId: `${fileId}#c_${String(idx).padStart(2, '0')}`,
50
- text: slice,
51
- meta: { source: fileId },
52
- });
53
- offset += chunkSize;
54
- }
55
- return chunks;
44
+ const chunks: EvidenceChunk[] = [];
45
+ const clean = text.trim();
46
+ for (let offset = 0, idx = 0; offset < clean.length; idx += 1) {
47
+ const slice = clean.slice(offset, offset + chunkSize);
48
+ chunks.push({
49
+ chunkId: `${fileId}#c_${String(idx).padStart(2, '0')}`,
50
+ text: slice,
51
+ meta: { source: fileId },
52
+ });
53
+ offset += chunkSize;
54
+ }
55
+ return chunks;
56
56
  }
57
57
 
58
58
  /**
@@ -60,35 +60,35 @@ function chunkTranscript(
60
60
  * EvidenceChunk objects ready for prompt formatting.
61
61
  */
62
62
  export function loadEvidenceChunks(
63
- options: EvidenceLoadOptions = {}
63
+ options: EvidenceLoadOptions = {}
64
64
  ): EvidenceChunk[] {
65
- const evidenceRoot = options.evidenceRoot ?? DEFAULT_EVIDENCE_ROOT;
66
- const transcriptDirs = options.transcriptDirs ?? DEFAULT_TRANSCRIPT_DIRS;
67
- const chunkSize = options.chunkSize ?? DEFAULT_CHUNK_SIZE;
65
+ const evidenceRoot = options.evidenceRoot ?? DEFAULT_EVIDENCE_ROOT;
66
+ const transcriptDirs = options.transcriptDirs ?? DEFAULT_TRANSCRIPT_DIRS;
67
+ const chunkSize = options.chunkSize ?? DEFAULT_CHUNK_SIZE;
68
68
 
69
- const chunks: EvidenceChunk[] = [];
70
- for (const dir of transcriptDirs) {
71
- const fullDir = path.join(evidenceRoot, dir);
72
- if (!fs.existsSync(fullDir)) continue;
73
- for (const fileName of fs.readdirSync(fullDir)) {
74
- const ext = path.extname(fileName).toLowerCase();
75
- if (ext !== '.md') continue;
76
- const filePath = path.join(fullDir, fileName);
77
- const raw = fs.readFileSync(filePath, 'utf8');
78
- const withoutFrontMatter = stripYamlFrontMatter(raw);
79
- const baseId = path.parse(fileName).name;
80
- const fileChunks = chunkTranscript(baseId, withoutFrontMatter, chunkSize);
81
- chunks.push(...fileChunks);
82
- }
83
- }
84
- return chunks;
69
+ const chunks: EvidenceChunk[] = [];
70
+ for (const dir of transcriptDirs) {
71
+ const fullDir = path.join(evidenceRoot, dir);
72
+ if (!fs.existsSync(fullDir)) continue;
73
+ for (const fileName of fs.readdirSync(fullDir)) {
74
+ const ext = path.extname(fileName).toLowerCase();
75
+ if (ext !== '.md') continue;
76
+ const filePath = path.join(fullDir, fileName);
77
+ const raw = fs.readFileSync(filePath, 'utf8');
78
+ const withoutFrontMatter = stripYamlFrontMatter(raw);
79
+ const baseId = path.parse(fileName).name;
80
+ const fileChunks = chunkTranscript(baseId, withoutFrontMatter, chunkSize);
81
+ chunks.push(...fileChunks);
82
+ }
83
+ }
84
+ return chunks;
85
85
  }
86
86
 
87
87
  export async function loadEvidenceChunksWithSignals(
88
- options: EvidenceLoadWithSignalsOptions = {}
88
+ options: EvidenceLoadWithSignalsOptions = {}
89
89
  ): Promise<EvidenceChunk[]> {
90
- const baseChunks = loadEvidenceChunks(options);
91
- if (!options.posthog) return baseChunks;
92
- const posthogChunks = await loadPosthogEvidenceChunks(options.posthog);
93
- return [...baseChunks, ...posthogChunks];
90
+ const baseChunks = loadEvidenceChunks(options);
91
+ if (!options.posthog) return baseChunks;
92
+ const posthogChunks = await loadPosthogEvidenceChunks(options.posthog);
93
+ return [...baseChunks, ...posthogChunks];
94
94
  }