@contractspec/example.project-management-sync 1.57.0 → 1.58.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/.turbo/turbo-build.log +34 -33
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +13 -0
- package/dist/browser/docs/index.js +40 -0
- package/dist/browser/docs/project-management-sync.docblock.js +40 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/index.js +194 -0
- package/dist/browser/run.js +122 -0
- package/dist/browser/sync.js +122 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +41 -1
- package/dist/docs/project-management-sync.docblock.d.ts +2 -1
- package/dist/docs/project-management-sync.docblock.d.ts.map +1 -0
- package/dist/docs/project-management-sync.docblock.js +25 -30
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +32 -44
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +194 -4
- package/dist/node/docs/index.js +40 -0
- package/dist/node/docs/project-management-sync.docblock.js +40 -0
- package/dist/node/example.js +33 -0
- package/dist/node/index.js +194 -0
- package/dist/node/run.js +122 -0
- package/dist/node/sync.js +122 -0
- package/dist/run.d.ts +2 -1
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +119 -8
- package/dist/sync.d.ts +17 -21
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +107 -91
- package/package.json +69 -26
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -33
- package/dist/docs/project-management-sync.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/run.js.map +0 -1
- package/dist/sync.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
$ bun
|
|
2
|
-
$
|
|
3
|
-
$
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[34mℹ[39m target: [34mesnext[39m
|
|
8
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
-
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1msync.js[22m [2m3.95 kB[22m [2m│ gzip: 1.53 kB[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/project-management-sync.docblock.js[22m [2m1.60 kB[22m [2m│ gzip: 0.77 kB[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m1.04 kB[22m [2m│ gzip: 0.52 kB[22m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.41 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
14
|
-
[34mℹ[39m [2mdist/[22m[1mrun.js[22m [2m0.30 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
15
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.05 kB[22m [2m│ gzip: 0.07 kB[22m
|
|
16
|
-
[34mℹ[39m [2mdist/[22msync.js.map [2m7.29 kB[22m [2m│ gzip: 2.43 kB[22m
|
|
17
|
-
[34mℹ[39m [2mdist/[22mdocs/project-management-sync.docblock.js.map [2m2.12 kB[22m [2m│ gzip: 0.97 kB[22m
|
|
18
|
-
[34mℹ[39m [2mdist/[22mexample.js.map [2m1.51 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22msync.d.ts.map [2m0.57 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
20
|
-
[34mℹ[39m [2mdist/[22mrun.js.map [2m0.50 kB[22m [2m│ gzip: 0.34 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.13 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
22
|
-
[34mℹ[39m [2mdist/[22m[32m[1msync.d.ts[22m[39m [2m1.52 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
23
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.56 kB[22m [2m│ gzip: 0.19 kB[22m
|
|
24
|
-
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m0.25 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
25
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
26
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/project-management-sync.docblock.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
27
|
-
[34mℹ[39m [2mdist/[22m[32m[1mrun.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
28
|
-
[34mℹ[39m 18 files, total: 21.83 kB
|
|
29
|
-
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugins. Here is a breakdown:
|
|
30
|
-
- rolldown-plugin-dts:generate (50%)
|
|
31
|
-
- tsdown:external (50%)
|
|
32
|
-
See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
1
|
+
$ contractspec-bun-build prebuild
|
|
2
|
+
$ bun run prebuild && bun run build:bundle && bun run build:types
|
|
3
|
+
$ contractspec-bun-build prebuild
|
|
4
|
+
$ contractspec-bun-build transpile
|
|
5
|
+
[contractspec-bun-build] transpile target=bun root=src entries=6
|
|
6
|
+
Bundled 6 modules in 39ms
|
|
33
7
|
|
|
34
|
-
|
|
8
|
+
docs/index.js 1.60 KB (entry point)
|
|
9
|
+
./index.js 6.84 KB (entry point)
|
|
10
|
+
docs/project-management-sync.docblock.js 1.60 KB (entry point)
|
|
11
|
+
./example.js 1.0 KB (entry point)
|
|
12
|
+
./run.js 4.26 KB (entry point)
|
|
13
|
+
./sync.js 4.24 KB (entry point)
|
|
14
|
+
|
|
15
|
+
[contractspec-bun-build] transpile target=node root=src entries=6
|
|
16
|
+
Bundled 6 modules in 22ms
|
|
17
|
+
|
|
18
|
+
docs/index.js 1.59 KB (entry point)
|
|
19
|
+
./index.js 6.84 KB (entry point)
|
|
20
|
+
docs/project-management-sync.docblock.js 1.59 KB (entry point)
|
|
21
|
+
./example.js 1.0 KB (entry point)
|
|
22
|
+
./run.js 4.25 KB (entry point)
|
|
23
|
+
./sync.js 4.23 KB (entry point)
|
|
24
|
+
|
|
25
|
+
[contractspec-bun-build] transpile target=browser root=src entries=6
|
|
26
|
+
Bundled 6 modules in 19ms
|
|
27
|
+
|
|
28
|
+
docs/index.js 1.59 KB (entry point)
|
|
29
|
+
./index.js 6.84 KB (entry point)
|
|
30
|
+
docs/project-management-sync.docblock.js 1.59 KB (entry point)
|
|
31
|
+
./example.js 1.0 KB (entry point)
|
|
32
|
+
./run.js 4.25 KB (entry point)
|
|
33
|
+
./sync.js 4.23 KB (entry point)
|
|
34
|
+
|
|
35
|
+
$ contractspec-bun-build types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @contractspec/example.project-management-sync
|
|
2
2
|
|
|
3
|
+
## 1.58.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d1f0fd0: chore: Migrate non-app package builds from tsdown to shared Bun tooling, add `@contractspec/tool.bun`, and standardize `prebuild`/`build`/`typecheck` with platform-aware exports and `tsc` declaration emission into `dist`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d1f0fd0]
|
|
12
|
+
- Updated dependencies [4355a9e]
|
|
13
|
+
- @contractspec/integration.providers-impls@1.58.0
|
|
14
|
+
- @contractspec/lib.contracts@1.58.0
|
|
15
|
+
|
|
3
16
|
## 1.57.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/docs/project-management-sync.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.project-management-sync",
|
|
6
|
+
title: "Project Management Sync (example)",
|
|
7
|
+
summary: "Create a shared payload of work items and sync it to Linear, Jira Cloud, or Notion.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/project-management-sync",
|
|
11
|
+
tags: ["project-management", "linear", "jira", "notion", "example"],
|
|
12
|
+
body: `## What this example shows
|
|
13
|
+
- Build a provider-agnostic payload of work items.
|
|
14
|
+
- Resolve the target provider from environment variables.
|
|
15
|
+
- Run in dry-run mode for preview output.
|
|
16
|
+
|
|
17
|
+
## Guardrails
|
|
18
|
+
- Keep secrets in env or secret providers only.
|
|
19
|
+
- Use dry-run to validate payloads before writing.
|
|
20
|
+
- Start with a small batch of tasks to validate setup.`
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "docs.examples.project-management-sync.usage",
|
|
24
|
+
title: "Project Management Sync - Usage",
|
|
25
|
+
summary: "How to run the sync with env-driven provider settings.",
|
|
26
|
+
kind: "usage",
|
|
27
|
+
visibility: "public",
|
|
28
|
+
route: "/docs/examples/project-management-sync/usage",
|
|
29
|
+
tags: ["project-management", "usage"],
|
|
30
|
+
body: `## Usage
|
|
31
|
+
- Set CONTRACTSPEC_PM_PROVIDER to linear, jira, or notion.
|
|
32
|
+
- Set CONTRACTSPEC_PM_DRY_RUN=true to preview payloads.
|
|
33
|
+
- Provide provider-specific env vars (API keys, project IDs).
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
- Call runProjectManagementSyncFromEnv() from sync.ts or import it in your app.
|
|
37
|
+
- The helper builds a sample payload and calls the provider client.`
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/docs/project-management-sync.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.project-management-sync",
|
|
6
|
+
title: "Project Management Sync (example)",
|
|
7
|
+
summary: "Create a shared payload of work items and sync it to Linear, Jira Cloud, or Notion.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/project-management-sync",
|
|
11
|
+
tags: ["project-management", "linear", "jira", "notion", "example"],
|
|
12
|
+
body: `## What this example shows
|
|
13
|
+
- Build a provider-agnostic payload of work items.
|
|
14
|
+
- Resolve the target provider from environment variables.
|
|
15
|
+
- Run in dry-run mode for preview output.
|
|
16
|
+
|
|
17
|
+
## Guardrails
|
|
18
|
+
- Keep secrets in env or secret providers only.
|
|
19
|
+
- Use dry-run to validate payloads before writing.
|
|
20
|
+
- Start with a small batch of tasks to validate setup.`
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "docs.examples.project-management-sync.usage",
|
|
24
|
+
title: "Project Management Sync - Usage",
|
|
25
|
+
summary: "How to run the sync with env-driven provider settings.",
|
|
26
|
+
kind: "usage",
|
|
27
|
+
visibility: "public",
|
|
28
|
+
route: "/docs/examples/project-management-sync/usage",
|
|
29
|
+
tags: ["project-management", "usage"],
|
|
30
|
+
body: `## Usage
|
|
31
|
+
- Set CONTRACTSPEC_PM_PROVIDER to linear, jira, or notion.
|
|
32
|
+
- Set CONTRACTSPEC_PM_DRY_RUN=true to preview payloads.
|
|
33
|
+
- Provide provider-specific env vars (API keys, project IDs).
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
- Call runProjectManagementSyncFromEnv() from sync.ts or import it in your app.
|
|
37
|
+
- The helper builds a sample payload and calls the provider client.`
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/example.ts
|
|
2
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
3
|
+
var example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "project-management-sync",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "Project Management Sync",
|
|
8
|
+
description: "Create project-management work items in Linear, Jira Cloud, or Notion from a shared payload.",
|
|
9
|
+
kind: "integration",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
owners: ["@platform.integrations"],
|
|
13
|
+
tags: ["project-management", "linear", "jira", "notion", "integrations"]
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
rootDocId: "docs.examples.project-management-sync",
|
|
17
|
+
usageDocId: "docs.examples.project-management-sync.usage"
|
|
18
|
+
},
|
|
19
|
+
entrypoints: {
|
|
20
|
+
packageName: "@contractspec/example.project-management-sync",
|
|
21
|
+
docs: "./docs"
|
|
22
|
+
},
|
|
23
|
+
surfaces: {
|
|
24
|
+
templates: true,
|
|
25
|
+
sandbox: { enabled: true, modes: ["markdown", "specs"] },
|
|
26
|
+
studio: { enabled: true, installable: true },
|
|
27
|
+
mcp: { enabled: true }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var example_default = example;
|
|
31
|
+
export {
|
|
32
|
+
example_default as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// src/docs/project-management-sync.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.project-management-sync",
|
|
6
|
+
title: "Project Management Sync (example)",
|
|
7
|
+
summary: "Create a shared payload of work items and sync it to Linear, Jira Cloud, or Notion.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/project-management-sync",
|
|
11
|
+
tags: ["project-management", "linear", "jira", "notion", "example"],
|
|
12
|
+
body: `## What this example shows
|
|
13
|
+
- Build a provider-agnostic payload of work items.
|
|
14
|
+
- Resolve the target provider from environment variables.
|
|
15
|
+
- Run in dry-run mode for preview output.
|
|
16
|
+
|
|
17
|
+
## Guardrails
|
|
18
|
+
- Keep secrets in env or secret providers only.
|
|
19
|
+
- Use dry-run to validate payloads before writing.
|
|
20
|
+
- Start with a small batch of tasks to validate setup.`
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "docs.examples.project-management-sync.usage",
|
|
24
|
+
title: "Project Management Sync - Usage",
|
|
25
|
+
summary: "How to run the sync with env-driven provider settings.",
|
|
26
|
+
kind: "usage",
|
|
27
|
+
visibility: "public",
|
|
28
|
+
route: "/docs/examples/project-management-sync/usage",
|
|
29
|
+
tags: ["project-management", "usage"],
|
|
30
|
+
body: `## Usage
|
|
31
|
+
- Set CONTRACTSPEC_PM_PROVIDER to linear, jira, or notion.
|
|
32
|
+
- Set CONTRACTSPEC_PM_DRY_RUN=true to preview payloads.
|
|
33
|
+
- Provide provider-specific env vars (API keys, project IDs).
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
- Call runProjectManagementSyncFromEnv() from sync.ts or import it in your app.
|
|
37
|
+
- The helper builds a sample payload and calls the provider client.`
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
registerDocBlocks(blocks);
|
|
41
|
+
// src/example.ts
|
|
42
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
43
|
+
var example = defineExample({
|
|
44
|
+
meta: {
|
|
45
|
+
key: "project-management-sync",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
title: "Project Management Sync",
|
|
48
|
+
description: "Create project-management work items in Linear, Jira Cloud, or Notion from a shared payload.",
|
|
49
|
+
kind: "integration",
|
|
50
|
+
visibility: "public",
|
|
51
|
+
stability: "experimental",
|
|
52
|
+
owners: ["@platform.integrations"],
|
|
53
|
+
tags: ["project-management", "linear", "jira", "notion", "integrations"]
|
|
54
|
+
},
|
|
55
|
+
docs: {
|
|
56
|
+
rootDocId: "docs.examples.project-management-sync",
|
|
57
|
+
usageDocId: "docs.examples.project-management-sync.usage"
|
|
58
|
+
},
|
|
59
|
+
entrypoints: {
|
|
60
|
+
packageName: "@contractspec/example.project-management-sync",
|
|
61
|
+
docs: "./docs"
|
|
62
|
+
},
|
|
63
|
+
surfaces: {
|
|
64
|
+
templates: true,
|
|
65
|
+
sandbox: { enabled: true, modes: ["markdown", "specs"] },
|
|
66
|
+
studio: { enabled: true, installable: true },
|
|
67
|
+
mcp: { enabled: true }
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var example_default = example;
|
|
71
|
+
|
|
72
|
+
// src/sync.ts
|
|
73
|
+
import {
|
|
74
|
+
JiraProjectManagementProvider,
|
|
75
|
+
LinearProjectManagementProvider,
|
|
76
|
+
NotionProjectManagementProvider
|
|
77
|
+
} from "@contractspec/integration.providers-impls/impls";
|
|
78
|
+
async function syncProjectManagementWorkItems(input) {
|
|
79
|
+
const items = input.items ?? buildSampleWorkItems();
|
|
80
|
+
const summary = input.summary;
|
|
81
|
+
const dryRun = input.dryRun ?? false;
|
|
82
|
+
if (dryRun) {
|
|
83
|
+
return { summary, items };
|
|
84
|
+
}
|
|
85
|
+
const provider = input.providerClient ?? createProviderFromEnv(input.provider);
|
|
86
|
+
const createdSummary = summary ? await provider.createWorkItem(summary) : undefined;
|
|
87
|
+
const createdItems = await provider.createWorkItems(items);
|
|
88
|
+
return { summary: createdSummary, items: createdItems };
|
|
89
|
+
}
|
|
90
|
+
async function runProjectManagementSyncFromEnv() {
|
|
91
|
+
const provider = resolveProviderName();
|
|
92
|
+
const dryRun = process.env.CONTRACTSPEC_PM_DRY_RUN === "true";
|
|
93
|
+
const summary = provider === "notion" ? buildSampleSummary() : undefined;
|
|
94
|
+
return syncProjectManagementWorkItems({
|
|
95
|
+
provider,
|
|
96
|
+
summary,
|
|
97
|
+
dryRun
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function buildSampleWorkItems() {
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
title: "Review onboarding drop-off",
|
|
104
|
+
description: "Analyze activation funnel to identify the highest drop-off step and propose fixes.",
|
|
105
|
+
type: "task",
|
|
106
|
+
priority: "high",
|
|
107
|
+
tags: ["onboarding", "insights"]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: "Ship first-run checklist",
|
|
111
|
+
description: "Create a guided checklist with 3-5 steps to help new users reach first value.",
|
|
112
|
+
type: "task",
|
|
113
|
+
priority: "medium",
|
|
114
|
+
tags: ["activation", "ux"],
|
|
115
|
+
dueDate: new Date("2026-02-15")
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: "Define success metrics",
|
|
119
|
+
description: "Agree on activation success metrics and instrument key events.",
|
|
120
|
+
type: "task",
|
|
121
|
+
priority: "low",
|
|
122
|
+
tags: ["analytics", "tracking"]
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
function buildSampleSummary() {
|
|
127
|
+
return {
|
|
128
|
+
title: "Product Intent Summary",
|
|
129
|
+
description: "This summary aggregates the onboarding tasks and highlights the activation improvements to prioritize.",
|
|
130
|
+
type: "summary",
|
|
131
|
+
tags: ["product-intent", "summary"]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function createProviderFromEnv(provider) {
|
|
135
|
+
if (provider === "linear") {
|
|
136
|
+
return new LinearProjectManagementProvider({
|
|
137
|
+
apiKey: requireEnv("LINEAR_API_KEY"),
|
|
138
|
+
teamId: requireEnv("LINEAR_TEAM_ID"),
|
|
139
|
+
projectId: process.env.LINEAR_PROJECT_ID,
|
|
140
|
+
stateId: process.env.LINEAR_STATE_ID,
|
|
141
|
+
assigneeId: process.env.LINEAR_ASSIGNEE_ID,
|
|
142
|
+
labelIds: splitList(process.env.LINEAR_LABEL_IDS)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (provider === "jira") {
|
|
146
|
+
return new JiraProjectManagementProvider({
|
|
147
|
+
siteUrl: requireEnv("JIRA_SITE_URL"),
|
|
148
|
+
email: requireEnv("JIRA_EMAIL"),
|
|
149
|
+
apiToken: requireEnv("JIRA_API_TOKEN"),
|
|
150
|
+
projectKey: process.env.JIRA_PROJECT_KEY,
|
|
151
|
+
issueType: process.env.JIRA_ISSUE_TYPE,
|
|
152
|
+
defaultLabels: splitList(process.env.JIRA_DEFAULT_LABELS)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return new NotionProjectManagementProvider({
|
|
156
|
+
apiKey: requireEnv("NOTION_API_KEY"),
|
|
157
|
+
databaseId: process.env.NOTION_DATABASE_ID,
|
|
158
|
+
summaryParentPageId: process.env.NOTION_SUMMARY_PARENT_PAGE_ID,
|
|
159
|
+
titleProperty: process.env.NOTION_TITLE_PROPERTY,
|
|
160
|
+
statusProperty: process.env.NOTION_STATUS_PROPERTY,
|
|
161
|
+
priorityProperty: process.env.NOTION_PRIORITY_PROPERTY,
|
|
162
|
+
tagsProperty: process.env.NOTION_TAGS_PROPERTY,
|
|
163
|
+
dueDateProperty: process.env.NOTION_DUE_DATE_PROPERTY,
|
|
164
|
+
descriptionProperty: process.env.NOTION_DESCRIPTION_PROPERTY
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function resolveProviderName() {
|
|
168
|
+
const raw = (process.env.CONTRACTSPEC_PM_PROVIDER ?? "linear").toLowerCase();
|
|
169
|
+
if (raw === "linear" || raw === "jira" || raw === "notion")
|
|
170
|
+
return raw;
|
|
171
|
+
throw new Error(`Unsupported provider: ${raw}. Use one of: linear, jira, notion`);
|
|
172
|
+
}
|
|
173
|
+
function requireEnv(key) {
|
|
174
|
+
const value = process.env[key];
|
|
175
|
+
if (!value) {
|
|
176
|
+
throw new Error(`Missing required env var: ${key}`);
|
|
177
|
+
}
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
function splitList(value) {
|
|
181
|
+
if (!value)
|
|
182
|
+
return;
|
|
183
|
+
const items = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
184
|
+
return items.length > 0 ? items : undefined;
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
syncProjectManagementWorkItems,
|
|
188
|
+
runProjectManagementSyncFromEnv,
|
|
189
|
+
resolveProviderName,
|
|
190
|
+
example_default as example,
|
|
191
|
+
createProviderFromEnv,
|
|
192
|
+
buildSampleWorkItems,
|
|
193
|
+
buildSampleSummary
|
|
194
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// src/sync.ts
|
|
2
|
+
import {
|
|
3
|
+
JiraProjectManagementProvider,
|
|
4
|
+
LinearProjectManagementProvider,
|
|
5
|
+
NotionProjectManagementProvider
|
|
6
|
+
} from "@contractspec/integration.providers-impls/impls";
|
|
7
|
+
async function syncProjectManagementWorkItems(input) {
|
|
8
|
+
const items = input.items ?? buildSampleWorkItems();
|
|
9
|
+
const summary = input.summary;
|
|
10
|
+
const dryRun = input.dryRun ?? false;
|
|
11
|
+
if (dryRun) {
|
|
12
|
+
return { summary, items };
|
|
13
|
+
}
|
|
14
|
+
const provider = input.providerClient ?? createProviderFromEnv(input.provider);
|
|
15
|
+
const createdSummary = summary ? await provider.createWorkItem(summary) : undefined;
|
|
16
|
+
const createdItems = await provider.createWorkItems(items);
|
|
17
|
+
return { summary: createdSummary, items: createdItems };
|
|
18
|
+
}
|
|
19
|
+
async function runProjectManagementSyncFromEnv() {
|
|
20
|
+
const provider = resolveProviderName();
|
|
21
|
+
const dryRun = process.env.CONTRACTSPEC_PM_DRY_RUN === "true";
|
|
22
|
+
const summary = provider === "notion" ? buildSampleSummary() : undefined;
|
|
23
|
+
return syncProjectManagementWorkItems({
|
|
24
|
+
provider,
|
|
25
|
+
summary,
|
|
26
|
+
dryRun
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function buildSampleWorkItems() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
title: "Review onboarding drop-off",
|
|
33
|
+
description: "Analyze activation funnel to identify the highest drop-off step and propose fixes.",
|
|
34
|
+
type: "task",
|
|
35
|
+
priority: "high",
|
|
36
|
+
tags: ["onboarding", "insights"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Ship first-run checklist",
|
|
40
|
+
description: "Create a guided checklist with 3-5 steps to help new users reach first value.",
|
|
41
|
+
type: "task",
|
|
42
|
+
priority: "medium",
|
|
43
|
+
tags: ["activation", "ux"],
|
|
44
|
+
dueDate: new Date("2026-02-15")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "Define success metrics",
|
|
48
|
+
description: "Agree on activation success metrics and instrument key events.",
|
|
49
|
+
type: "task",
|
|
50
|
+
priority: "low",
|
|
51
|
+
tags: ["analytics", "tracking"]
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
function buildSampleSummary() {
|
|
56
|
+
return {
|
|
57
|
+
title: "Product Intent Summary",
|
|
58
|
+
description: "This summary aggregates the onboarding tasks and highlights the activation improvements to prioritize.",
|
|
59
|
+
type: "summary",
|
|
60
|
+
tags: ["product-intent", "summary"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createProviderFromEnv(provider) {
|
|
64
|
+
if (provider === "linear") {
|
|
65
|
+
return new LinearProjectManagementProvider({
|
|
66
|
+
apiKey: requireEnv("LINEAR_API_KEY"),
|
|
67
|
+
teamId: requireEnv("LINEAR_TEAM_ID"),
|
|
68
|
+
projectId: process.env.LINEAR_PROJECT_ID,
|
|
69
|
+
stateId: process.env.LINEAR_STATE_ID,
|
|
70
|
+
assigneeId: process.env.LINEAR_ASSIGNEE_ID,
|
|
71
|
+
labelIds: splitList(process.env.LINEAR_LABEL_IDS)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (provider === "jira") {
|
|
75
|
+
return new JiraProjectManagementProvider({
|
|
76
|
+
siteUrl: requireEnv("JIRA_SITE_URL"),
|
|
77
|
+
email: requireEnv("JIRA_EMAIL"),
|
|
78
|
+
apiToken: requireEnv("JIRA_API_TOKEN"),
|
|
79
|
+
projectKey: process.env.JIRA_PROJECT_KEY,
|
|
80
|
+
issueType: process.env.JIRA_ISSUE_TYPE,
|
|
81
|
+
defaultLabels: splitList(process.env.JIRA_DEFAULT_LABELS)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return new NotionProjectManagementProvider({
|
|
85
|
+
apiKey: requireEnv("NOTION_API_KEY"),
|
|
86
|
+
databaseId: process.env.NOTION_DATABASE_ID,
|
|
87
|
+
summaryParentPageId: process.env.NOTION_SUMMARY_PARENT_PAGE_ID,
|
|
88
|
+
titleProperty: process.env.NOTION_TITLE_PROPERTY,
|
|
89
|
+
statusProperty: process.env.NOTION_STATUS_PROPERTY,
|
|
90
|
+
priorityProperty: process.env.NOTION_PRIORITY_PROPERTY,
|
|
91
|
+
tagsProperty: process.env.NOTION_TAGS_PROPERTY,
|
|
92
|
+
dueDateProperty: process.env.NOTION_DUE_DATE_PROPERTY,
|
|
93
|
+
descriptionProperty: process.env.NOTION_DESCRIPTION_PROPERTY
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function resolveProviderName() {
|
|
97
|
+
const raw = (process.env.CONTRACTSPEC_PM_PROVIDER ?? "linear").toLowerCase();
|
|
98
|
+
if (raw === "linear" || raw === "jira" || raw === "notion")
|
|
99
|
+
return raw;
|
|
100
|
+
throw new Error(`Unsupported provider: ${raw}. Use one of: linear, jira, notion`);
|
|
101
|
+
}
|
|
102
|
+
function requireEnv(key) {
|
|
103
|
+
const value = process.env[key];
|
|
104
|
+
if (!value) {
|
|
105
|
+
throw new Error(`Missing required env var: ${key}`);
|
|
106
|
+
}
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
function splitList(value) {
|
|
110
|
+
if (!value)
|
|
111
|
+
return;
|
|
112
|
+
const items = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
113
|
+
return items.length > 0 ? items : undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/run.ts
|
|
117
|
+
runProjectManagementSyncFromEnv().then((result) => {
|
|
118
|
+
console.log(JSON.stringify(result, null, 2));
|
|
119
|
+
}).catch((error) => {
|
|
120
|
+
console.error(error);
|
|
121
|
+
process.exitCode = 1;
|
|
122
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// src/sync.ts
|
|
2
|
+
import {
|
|
3
|
+
JiraProjectManagementProvider,
|
|
4
|
+
LinearProjectManagementProvider,
|
|
5
|
+
NotionProjectManagementProvider
|
|
6
|
+
} from "@contractspec/integration.providers-impls/impls";
|
|
7
|
+
async function syncProjectManagementWorkItems(input) {
|
|
8
|
+
const items = input.items ?? buildSampleWorkItems();
|
|
9
|
+
const summary = input.summary;
|
|
10
|
+
const dryRun = input.dryRun ?? false;
|
|
11
|
+
if (dryRun) {
|
|
12
|
+
return { summary, items };
|
|
13
|
+
}
|
|
14
|
+
const provider = input.providerClient ?? createProviderFromEnv(input.provider);
|
|
15
|
+
const createdSummary = summary ? await provider.createWorkItem(summary) : undefined;
|
|
16
|
+
const createdItems = await provider.createWorkItems(items);
|
|
17
|
+
return { summary: createdSummary, items: createdItems };
|
|
18
|
+
}
|
|
19
|
+
async function runProjectManagementSyncFromEnv() {
|
|
20
|
+
const provider = resolveProviderName();
|
|
21
|
+
const dryRun = process.env.CONTRACTSPEC_PM_DRY_RUN === "true";
|
|
22
|
+
const summary = provider === "notion" ? buildSampleSummary() : undefined;
|
|
23
|
+
return syncProjectManagementWorkItems({
|
|
24
|
+
provider,
|
|
25
|
+
summary,
|
|
26
|
+
dryRun
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function buildSampleWorkItems() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
title: "Review onboarding drop-off",
|
|
33
|
+
description: "Analyze activation funnel to identify the highest drop-off step and propose fixes.",
|
|
34
|
+
type: "task",
|
|
35
|
+
priority: "high",
|
|
36
|
+
tags: ["onboarding", "insights"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Ship first-run checklist",
|
|
40
|
+
description: "Create a guided checklist with 3-5 steps to help new users reach first value.",
|
|
41
|
+
type: "task",
|
|
42
|
+
priority: "medium",
|
|
43
|
+
tags: ["activation", "ux"],
|
|
44
|
+
dueDate: new Date("2026-02-15")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "Define success metrics",
|
|
48
|
+
description: "Agree on activation success metrics and instrument key events.",
|
|
49
|
+
type: "task",
|
|
50
|
+
priority: "low",
|
|
51
|
+
tags: ["analytics", "tracking"]
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
function buildSampleSummary() {
|
|
56
|
+
return {
|
|
57
|
+
title: "Product Intent Summary",
|
|
58
|
+
description: "This summary aggregates the onboarding tasks and highlights the activation improvements to prioritize.",
|
|
59
|
+
type: "summary",
|
|
60
|
+
tags: ["product-intent", "summary"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createProviderFromEnv(provider) {
|
|
64
|
+
if (provider === "linear") {
|
|
65
|
+
return new LinearProjectManagementProvider({
|
|
66
|
+
apiKey: requireEnv("LINEAR_API_KEY"),
|
|
67
|
+
teamId: requireEnv("LINEAR_TEAM_ID"),
|
|
68
|
+
projectId: process.env.LINEAR_PROJECT_ID,
|
|
69
|
+
stateId: process.env.LINEAR_STATE_ID,
|
|
70
|
+
assigneeId: process.env.LINEAR_ASSIGNEE_ID,
|
|
71
|
+
labelIds: splitList(process.env.LINEAR_LABEL_IDS)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (provider === "jira") {
|
|
75
|
+
return new JiraProjectManagementProvider({
|
|
76
|
+
siteUrl: requireEnv("JIRA_SITE_URL"),
|
|
77
|
+
email: requireEnv("JIRA_EMAIL"),
|
|
78
|
+
apiToken: requireEnv("JIRA_API_TOKEN"),
|
|
79
|
+
projectKey: process.env.JIRA_PROJECT_KEY,
|
|
80
|
+
issueType: process.env.JIRA_ISSUE_TYPE,
|
|
81
|
+
defaultLabels: splitList(process.env.JIRA_DEFAULT_LABELS)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return new NotionProjectManagementProvider({
|
|
85
|
+
apiKey: requireEnv("NOTION_API_KEY"),
|
|
86
|
+
databaseId: process.env.NOTION_DATABASE_ID,
|
|
87
|
+
summaryParentPageId: process.env.NOTION_SUMMARY_PARENT_PAGE_ID,
|
|
88
|
+
titleProperty: process.env.NOTION_TITLE_PROPERTY,
|
|
89
|
+
statusProperty: process.env.NOTION_STATUS_PROPERTY,
|
|
90
|
+
priorityProperty: process.env.NOTION_PRIORITY_PROPERTY,
|
|
91
|
+
tagsProperty: process.env.NOTION_TAGS_PROPERTY,
|
|
92
|
+
dueDateProperty: process.env.NOTION_DUE_DATE_PROPERTY,
|
|
93
|
+
descriptionProperty: process.env.NOTION_DESCRIPTION_PROPERTY
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function resolveProviderName() {
|
|
97
|
+
const raw = (process.env.CONTRACTSPEC_PM_PROVIDER ?? "linear").toLowerCase();
|
|
98
|
+
if (raw === "linear" || raw === "jira" || raw === "notion")
|
|
99
|
+
return raw;
|
|
100
|
+
throw new Error(`Unsupported provider: ${raw}. Use one of: linear, jira, notion`);
|
|
101
|
+
}
|
|
102
|
+
function requireEnv(key) {
|
|
103
|
+
const value = process.env[key];
|
|
104
|
+
if (!value) {
|
|
105
|
+
throw new Error(`Missing required env var: ${key}`);
|
|
106
|
+
}
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
function splitList(value) {
|
|
110
|
+
if (!value)
|
|
111
|
+
return;
|
|
112
|
+
const items = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
113
|
+
return items.length > 0 ? items : undefined;
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
syncProjectManagementWorkItems,
|
|
117
|
+
runProjectManagementSyncFromEnv,
|
|
118
|
+
resolveProviderName,
|
|
119
|
+
createProviderFromEnv,
|
|
120
|
+
buildSampleWorkItems,
|
|
121
|
+
buildSampleSummary
|
|
122
|
+
};
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import './project-management-sync.docblock';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC"}
|