@tenhaw/opmodel 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/LICENSE-CONTENT +15 -0
- package/README.md +33 -2
- package/dist/index.d.ts +83 -0
- package/dist/index.js +40 -0
- package/package.json +39 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tenhaw
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE-CONTENT
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Tenhaw AI Readiness Framework and authored framework content in spec/content
|
|
2
|
+
are licensed under the Creative Commons Attribution 4.0 International licence.
|
|
3
|
+
Copyright (c) 2026 Tenhaw.
|
|
4
|
+
|
|
5
|
+
Licence: https://creativecommons.org/licenses/by/4.0/
|
|
6
|
+
Legal code: https://creativecommons.org/licenses/by/4.0/legalcode.en
|
|
7
|
+
|
|
8
|
+
When sharing or adapting this content, provide appropriate credit, a licence
|
|
9
|
+
link, and an indication of changes. A suitable credit is:
|
|
10
|
+
"Tenhaw AI Readiness Framework, CC BY 4.0, https://tenhaw.com."
|
|
11
|
+
|
|
12
|
+
Numerical results and user-supplied evidence remain the user's material.
|
|
13
|
+
The optional audit promotion can be suppressed independently of applicable
|
|
14
|
+
framework-content credits. Code is MIT; third-party sources retain their own
|
|
15
|
+
rights and are summarised with links rather than relicensed here.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tenhaw/opmodel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Validate teams, OKRs, roadmaps and interactions for internal operating-model tools.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- Use this when building an outcome roadmap, OKR register or team topology map.
|
|
8
|
+
- Do not use this for automatically prescribing organisational design or claiming affiliation with Team Topologies.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @tenhaw/opmodel
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { generateOperatingModel, renderMermaid } from '@tenhaw/opmodel';
|
|
20
|
+
const report = generateOperatingModel({ teams: [] });
|
|
21
|
+
console.log(renderMermaid(report)); // flowchart LR
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
`generateOperatingModel({teams,okrs?,roadmap?,interactions?,products?})`, `renderMermaid(report)`. Team, OKR, roadmap and interaction schemas are bundled with `@tenhaw/core`. References to missing teams, objectives or platform dependencies fail validation.
|
|
27
|
+
|
|
28
|
+
## Methodology and sources
|
|
29
|
+
|
|
30
|
+
Key-result progress is `(current-baseline)/(target-baseline)`, supporting decreasing targets. Identical baseline and target are rejected. Progress is not clamped, so overachievement stays visible. Warnings identify teams over nine people, missing platform support declarations, unowned OKRs and missing roadmap outcomes/owners. These support a conversation and are not prescriptions. Team Topologies source: https://teamtopologies.com/key-concepts. Mermaid uses generated node IDs and escapes labels.
|
|
31
|
+
|
|
32
|
+
## Built by Tenhaw
|
|
33
|
+
|
|
34
|
+
Tenhaw is a founder-led UK AI consultancy and venture studio. For expert help applying this, [book an AI readiness audit](https://tenhaw.com/contact?utm_source=npm&utm_medium=readme&utm_campaign=tenhaw-kit&utm_content=opmodel#book).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
type Team = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'stream-aligned' | 'platform' | 'enabling' | 'complicated-subsystem';
|
|
5
|
+
size: number;
|
|
6
|
+
cognitiveLoad?: 'low' | 'medium' | 'high';
|
|
7
|
+
platformDependencies?: string[];
|
|
8
|
+
};
|
|
9
|
+
type Okr = {
|
|
10
|
+
id: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
teamId?: string;
|
|
13
|
+
keyResults: {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string;
|
|
16
|
+
baseline: number;
|
|
17
|
+
target: number;
|
|
18
|
+
current: number;
|
|
19
|
+
confidence: number;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
type RoadmapItem = {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
horizon: 'now' | 'next' | 'later';
|
|
26
|
+
outcome?: string;
|
|
27
|
+
teamId?: string;
|
|
28
|
+
okrId?: string;
|
|
29
|
+
};
|
|
30
|
+
type OperatingModelInput = {
|
|
31
|
+
teams: Team[];
|
|
32
|
+
okrs?: Okr[];
|
|
33
|
+
roadmap?: RoadmapItem[];
|
|
34
|
+
interactions?: {
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
mode: 'collaboration' | 'X-as-a-Service' | 'facilitating';
|
|
38
|
+
}[];
|
|
39
|
+
products?: {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
declare function generateOperatingModel(input: OperatingModelInput): {
|
|
45
|
+
model: {
|
|
46
|
+
teams: Team[];
|
|
47
|
+
okrs: {
|
|
48
|
+
keyResults: {
|
|
49
|
+
progress: number;
|
|
50
|
+
id: string;
|
|
51
|
+
description: string;
|
|
52
|
+
baseline: number;
|
|
53
|
+
target: number;
|
|
54
|
+
current: number;
|
|
55
|
+
confidence: number;
|
|
56
|
+
}[];
|
|
57
|
+
id: string;
|
|
58
|
+
objective: string;
|
|
59
|
+
teamId?: string;
|
|
60
|
+
}[];
|
|
61
|
+
roadmap: RoadmapItem[];
|
|
62
|
+
interactions: {
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
mode: "collaboration" | "X-as-a-Service" | "facilitating";
|
|
66
|
+
}[];
|
|
67
|
+
products: {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
checks: {
|
|
73
|
+
code: string;
|
|
74
|
+
entityId: string;
|
|
75
|
+
message: string;
|
|
76
|
+
}[];
|
|
77
|
+
limitations: string[];
|
|
78
|
+
sources: string[];
|
|
79
|
+
};
|
|
80
|
+
type OperatingModel = ReturnType<typeof generateOperatingModel>;
|
|
81
|
+
declare function renderMermaid(report: OperatingModel): string;
|
|
82
|
+
|
|
83
|
+
export { type Okr, type OperatingModel, type OperatingModelInput, type RoadmapItem, type Team, generateOperatingModel, renderMermaid };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { invariant, round, validateInput } from "@tenhaw/core";
|
|
3
|
+
function generateOperatingModel(input) {
|
|
4
|
+
const valid = validateInput("opmodel", input);
|
|
5
|
+
const teams = [...valid.teams].sort((a, b) => a.id.localeCompare(b.id)), okrs = [...valid.okrs ?? []].sort((a, b) => a.id.localeCompare(b.id)), roadmap = [...valid.roadmap ?? []].sort((a, b) => a.id.localeCompare(b.id)), interactions = [...valid.interactions ?? []].sort((a, b) => (a.from + a.to + a.mode).localeCompare(b.from + b.to + b.mode));
|
|
6
|
+
const teamIds = new Set(teams.map((t) => t.id)), okrIds = new Set(okrs.map((o) => o.id));
|
|
7
|
+
invariant(teamIds.size === teams.length, "/teams", "Team IDs must be unique");
|
|
8
|
+
invariant(okrIds.size === okrs.length, "/okrs", "OKR IDs must be unique");
|
|
9
|
+
invariant(new Set(roadmap.map((r) => r.id)).size === roadmap.length, "/roadmap", "Roadmap IDs must be unique");
|
|
10
|
+
const checks = [];
|
|
11
|
+
for (const t of teams) {
|
|
12
|
+
if (t.size > 9) checks.push({ code: "team-size", entityId: t.id, message: "Review whether this team can maintain clear collaboration and ownership." });
|
|
13
|
+
if (t.type === "stream-aligned" && !t.platformDependencies?.length) checks.push({ code: "platform-dependency", entityId: t.id, message: "Confirm whether this stream-aligned team needs platform support." });
|
|
14
|
+
for (const id of t.platformDependencies ?? []) invariant(teamIds.has(id) && teams.find((x) => x.id === id)?.type === "platform", `/teams/${t.id}/platformDependencies`, "Reference an existing platform team");
|
|
15
|
+
}
|
|
16
|
+
for (const o of okrs) {
|
|
17
|
+
if (!o.teamId) checks.push({ code: "okr-owner", entityId: o.id, message: "Assign an accountable team to this objective." });
|
|
18
|
+
else invariant(teamIds.has(o.teamId), `/okrs/${o.id}/teamId`, "Unknown owning team");
|
|
19
|
+
invariant(new Set(o.keyResults.map((k) => k.id)).size === o.keyResults.length, `/okrs/${o.id}/keyResults`, "Key result IDs must be unique");
|
|
20
|
+
for (const k of o.keyResults) invariant(k.target !== k.baseline, `/okrs/${o.id}/keyResults/${k.id}/target`, "Target must differ from baseline");
|
|
21
|
+
}
|
|
22
|
+
for (const r of roadmap) {
|
|
23
|
+
if (!r.outcome?.trim()) checks.push({ code: "roadmap-outcome", entityId: r.id, message: "State the outcome this item should change." });
|
|
24
|
+
if (!r.teamId) checks.push({ code: "roadmap-owner", entityId: r.id, message: "Assign an accountable team to this roadmap item." });
|
|
25
|
+
else invariant(teamIds.has(r.teamId), `/roadmap/${r.id}/teamId`, "Unknown owning team");
|
|
26
|
+
if (r.okrId) invariant(okrIds.has(r.okrId), `/roadmap/${r.id}/okrId`, "Unknown linked OKR");
|
|
27
|
+
}
|
|
28
|
+
for (const i of interactions) invariant(teamIds.has(i.from) && teamIds.has(i.to) && i.from !== i.to, "/interactions", "Interactions must link two distinct known teams");
|
|
29
|
+
const model = { teams, okrs: okrs.map((o) => ({ ...o, keyResults: o.keyResults.map((k) => ({ ...k, progress: round((k.current - k.baseline) / (k.target - k.baseline)) })) })), roadmap, interactions, products: [...valid.products ?? []].sort((a, b) => a.id.localeCompare(b.id)) };
|
|
30
|
+
return { model, checks, limitations: ["Team Topologies is a cited public model; no affiliation is implied.", "Checks support a design conversation and are not organisational prescriptions."], sources: ["https://teamtopologies.com/key-concepts"] };
|
|
31
|
+
}
|
|
32
|
+
function renderMermaid(report) {
|
|
33
|
+
const ids = new Map(report.model.teams.map((t, i) => [t.id, `team${i}`]));
|
|
34
|
+
const safe = (text) => text.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">").replace(/[\r\n]/g, " ");
|
|
35
|
+
return ["flowchart LR", ...report.model.teams.map((t) => ` ${ids.get(t.id)}["${safe(t.name)}"]`), ...report.model.interactions.map((i) => ` ${ids.get(i.from)} -->|"${safe(i.mode)}"| ${ids.get(i.to)}`)].join("\n") + "\n";
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
generateOperatingModel,
|
|
39
|
+
renderMermaid
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenhaw/opmodel",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Validated teams, OKRs, roadmaps and team interactions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"LICENSE-CONTENT"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@tenhaw/core": "1.0.0"
|
|
22
|
+
},
|
|
23
|
+
"author": "Tenhaw (https://tenhaw.com)",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/Tenhaw/tenhaw-kit.git",
|
|
28
|
+
"directory": "packages/opmodel"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://kit.tenhaw.com/tools/opmodel",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
39
|
+
"test": "vitest run --passWithNoTests",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
}
|
|
6
42
|
}
|