tenhaw 0.0.0-bootstrap

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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE-CONTENT +15 -0
  3. package/README.md +52 -0
  4. package/dist/chunk-BKPOQVTM.js +74 -0
  5. package/dist/chunk-ZIEK7SCN.js +73 -0
  6. package/dist/index.d.ts +24 -0
  7. package/dist/index.js +319 -0
  8. package/dist/scaffold.d.ts +14 -0
  9. package/dist/scaffold.js +8 -0
  10. package/instructions/ai-readiness-assessment/AGENTS.md +9 -0
  11. package/instructions/ai-roi-business-case/AGENTS.md +9 -0
  12. package/instructions/ai-usecase-register/AGENTS.md +9 -0
  13. package/instructions/build-ai-adoption-dashboard/AGENTS.md +9 -0
  14. package/instructions/delivery-metrics-dora/AGENTS.md +9 -0
  15. package/instructions/portfolio-tracking/AGENTS.md +9 -0
  16. package/instructions/product-operating-model/AGENTS.md +9 -0
  17. package/package.json +58 -0
  18. package/templates/ai-adoption-dashboard/AGENTS.md +22 -0
  19. package/templates/ai-adoption-dashboard/CLAUDE.md +22 -0
  20. package/templates/ai-adoption-dashboard/LICENSE +21 -0
  21. package/templates/ai-adoption-dashboard/LICENSE-CONTENT +15 -0
  22. package/templates/ai-adoption-dashboard/README.md +56 -0
  23. package/templates/ai-adoption-dashboard/app/globals.css +2 -0
  24. package/templates/ai-adoption-dashboard/app/layout.tsx +4 -0
  25. package/templates/ai-adoption-dashboard/app/page.tsx +14 -0
  26. package/templates/ai-adoption-dashboard/e2e/app.spec.ts +27 -0
  27. package/templates/ai-adoption-dashboard/lib/io.ts +42 -0
  28. package/templates/ai-adoption-dashboard/lib/model.test.ts +4 -0
  29. package/templates/ai-adoption-dashboard/lib/model.ts +9 -0
  30. package/templates/ai-adoption-dashboard/lib/workspace.tsx +49 -0
  31. package/templates/ai-adoption-dashboard/next-env.d.ts +7 -0
  32. package/templates/ai-adoption-dashboard/next.config.mjs +2 -0
  33. package/templates/ai-adoption-dashboard/package.json +31 -0
  34. package/templates/ai-adoption-dashboard/playwright.config.ts +2 -0
  35. package/templates/ai-adoption-dashboard/public/example.csv +5 -0
  36. package/templates/ai-adoption-dashboard/public/example.json +34 -0
  37. package/templates/ai-adoption-dashboard/public/llms.txt +6 -0
  38. package/templates/ai-adoption-dashboard/tsconfig.json +36 -0
  39. package/templates/ai-adoption-dashboard/vitest.config.ts +2 -0
  40. package/templates/ai-readiness-assessment/AGENTS.md +22 -0
  41. package/templates/ai-readiness-assessment/CLAUDE.md +22 -0
  42. package/templates/ai-readiness-assessment/LICENSE +21 -0
  43. package/templates/ai-readiness-assessment/LICENSE-CONTENT +15 -0
  44. package/templates/ai-readiness-assessment/README.md +56 -0
  45. package/templates/ai-readiness-assessment/app/globals.css +2 -0
  46. package/templates/ai-readiness-assessment/app/layout.tsx +4 -0
  47. package/templates/ai-readiness-assessment/app/page.tsx +11 -0
  48. package/templates/ai-readiness-assessment/e2e/app.spec.ts +27 -0
  49. package/templates/ai-readiness-assessment/lib/io.ts +42 -0
  50. package/templates/ai-readiness-assessment/lib/model.test.ts +5 -0
  51. package/templates/ai-readiness-assessment/lib/model.ts +5 -0
  52. package/templates/ai-readiness-assessment/lib/workspace.tsx +49 -0
  53. package/templates/ai-readiness-assessment/next-env.d.ts +7 -0
  54. package/templates/ai-readiness-assessment/next.config.mjs +2 -0
  55. package/templates/ai-readiness-assessment/package.json +32 -0
  56. package/templates/ai-readiness-assessment/playwright.config.ts +2 -0
  57. package/templates/ai-readiness-assessment/public/example.json +154 -0
  58. package/templates/ai-readiness-assessment/public/llms.txt +6 -0
  59. package/templates/ai-readiness-assessment/tsconfig.json +36 -0
  60. package/templates/ai-readiness-assessment/vitest.config.ts +2 -0
  61. package/templates/ai-usecase-register/AGENTS.md +22 -0
  62. package/templates/ai-usecase-register/CLAUDE.md +22 -0
  63. package/templates/ai-usecase-register/LICENSE +21 -0
  64. package/templates/ai-usecase-register/LICENSE-CONTENT +15 -0
  65. package/templates/ai-usecase-register/README.md +56 -0
  66. package/templates/ai-usecase-register/app/globals.css +2 -0
  67. package/templates/ai-usecase-register/app/layout.tsx +4 -0
  68. package/templates/ai-usecase-register/app/page.tsx +16 -0
  69. package/templates/ai-usecase-register/e2e/app.spec.ts +27 -0
  70. package/templates/ai-usecase-register/lib/io.ts +42 -0
  71. package/templates/ai-usecase-register/lib/model.test.ts +7 -0
  72. package/templates/ai-usecase-register/lib/model.ts +9 -0
  73. package/templates/ai-usecase-register/lib/workspace.tsx +49 -0
  74. package/templates/ai-usecase-register/next-env.d.ts +7 -0
  75. package/templates/ai-usecase-register/next.config.mjs +2 -0
  76. package/templates/ai-usecase-register/package.json +33 -0
  77. package/templates/ai-usecase-register/playwright.config.ts +2 -0
  78. package/templates/ai-usecase-register/public/example.json +41 -0
  79. package/templates/ai-usecase-register/public/llms.txt +6 -0
  80. package/templates/ai-usecase-register/tsconfig.json +36 -0
  81. package/templates/ai-usecase-register/vitest.config.ts +2 -0
  82. package/templates/delivery-metrics-dashboard/AGENTS.md +22 -0
  83. package/templates/delivery-metrics-dashboard/CLAUDE.md +22 -0
  84. package/templates/delivery-metrics-dashboard/LICENSE +21 -0
  85. package/templates/delivery-metrics-dashboard/LICENSE-CONTENT +15 -0
  86. package/templates/delivery-metrics-dashboard/README.md +56 -0
  87. package/templates/delivery-metrics-dashboard/app/globals.css +2 -0
  88. package/templates/delivery-metrics-dashboard/app/layout.tsx +4 -0
  89. package/templates/delivery-metrics-dashboard/app/page.tsx +13 -0
  90. package/templates/delivery-metrics-dashboard/e2e/app.spec.ts +27 -0
  91. package/templates/delivery-metrics-dashboard/lib/io.ts +42 -0
  92. package/templates/delivery-metrics-dashboard/lib/model.test.ts +5 -0
  93. package/templates/delivery-metrics-dashboard/lib/model.ts +19 -0
  94. package/templates/delivery-metrics-dashboard/lib/workspace.tsx +49 -0
  95. package/templates/delivery-metrics-dashboard/next-env.d.ts +7 -0
  96. package/templates/delivery-metrics-dashboard/next.config.mjs +2 -0
  97. package/templates/delivery-metrics-dashboard/package.json +32 -0
  98. package/templates/delivery-metrics-dashboard/playwright.config.ts +2 -0
  99. package/templates/delivery-metrics-dashboard/public/example.json +98 -0
  100. package/templates/delivery-metrics-dashboard/public/llms.txt +6 -0
  101. package/templates/delivery-metrics-dashboard/tsconfig.json +36 -0
  102. package/templates/delivery-metrics-dashboard/vitest.config.ts +2 -0
  103. package/templates/product-operating-model/AGENTS.md +22 -0
  104. package/templates/product-operating-model/CLAUDE.md +22 -0
  105. package/templates/product-operating-model/LICENSE +21 -0
  106. package/templates/product-operating-model/LICENSE-CONTENT +15 -0
  107. package/templates/product-operating-model/README.md +56 -0
  108. package/templates/product-operating-model/app/globals.css +2 -0
  109. package/templates/product-operating-model/app/layout.tsx +4 -0
  110. package/templates/product-operating-model/app/page.tsx +11 -0
  111. package/templates/product-operating-model/e2e/app.spec.ts +27 -0
  112. package/templates/product-operating-model/lib/io.ts +42 -0
  113. package/templates/product-operating-model/lib/model.test.ts +6 -0
  114. package/templates/product-operating-model/lib/model.ts +4 -0
  115. package/templates/product-operating-model/lib/workspace.tsx +49 -0
  116. package/templates/product-operating-model/next-env.d.ts +7 -0
  117. package/templates/product-operating-model/next.config.mjs +2 -0
  118. package/templates/product-operating-model/package.json +32 -0
  119. package/templates/product-operating-model/playwright.config.ts +2 -0
  120. package/templates/product-operating-model/public/example.json +119 -0
  121. package/templates/product-operating-model/public/llms.txt +6 -0
  122. package/templates/product-operating-model/tsconfig.json +36 -0
  123. package/templates/product-operating-model/vitest.config.ts +2 -0
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.
@@ -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 ADDED
@@ -0,0 +1,52 @@
1
+ > Setup prerelease: `0.0.0-bootstrap`, intended for the `bootstrap` dist-tag.
2
+ > This package contains the actual built Tenhaw Kit code and establishes npm ownership before trusted publishing is configured. Use a verified stable release for regular installation. Hosted endpoints and stable release verification are separate setup steps.
3
+
4
+ # tenhaw
5
+
6
+ An agent-friendly CLI for building internal portfolio, product delivery and AI transformation tools with Tenhaw Kit.
7
+
8
+ ## When to use
9
+
10
+ - Scaffold an adoption dashboard, delivery dashboard, use-case register, operating model or readiness assessment.
11
+ - Produce deterministic readiness, delivery and ROI reports from local JSON.
12
+ - Add project instructions or print MCP installation settings for a coding agent.
13
+
14
+ ## Install
15
+
16
+ Release instructions target **1.0.0**. Verify that exact version has been published before running them. Requires Node.js 22.14 or later.
17
+
18
+ ```sh
19
+ npm install --global tenhaw@1.0.0
20
+ ```
21
+
22
+ ## Quick start
23
+
24
+ ```sh
25
+ tenhaw readiness --questionnaire --json
26
+ tenhaw init product-operating-model my-workspace --yes --json
27
+ cd my-workspace
28
+ pnpm install
29
+ pnpm build
30
+ ```
31
+
32
+ The starter includes synthetic examples and browser-local storage. Add authentication and authorisation before implementing shared persistence or hosted collectors.
33
+
34
+ ## Commands and agent behaviour
35
+
36
+ Use `readiness`, `delivery-metrics`, `roi`, `roi cost`, `usecases`, `opmodel`, `init`, `mcp`, `agents` and `doctor`. Run `tenhaw --help` for flags and template names.
37
+
38
+ ```sh
39
+ tenhaw readiness --input answers.json --json --no-attribution
40
+ tenhaw delivery-metrics --from-file events.json --since 2026-01-01T00:00:00Z --until 2026-02-01T00:00:00Z --json
41
+ tenhaw roi --input roi.json --format html --out new-report.html
42
+ ```
43
+
44
+ CI, non-TTY input and `--yes` disable prompts, so supply required inputs explicitly. `--json` writes machine-readable output to stdout; diagnostics use stderr. Exit codes: `0` success, `1` usage, `2` validation, `3` upstream API, `4` missing authentication. Existing scaffold targets, output files and agent instruction files are preserved.
45
+
46
+ GitHub/Jira collection runs locally with environment credentials. `doctor --network` lists permitted hosts without printing token values. There is no package telemetry. `--no-attribution` or `TENHAW_NO_ATTRIBUTION=1` suppresses the marketing footer; applicable framework credits remain.
47
+
48
+ ## Source and licences
49
+
50
+ [Source](https://github.com/Tenhaw/tenhaw-kit/tree/main/packages/cli). Code is [MIT](https://github.com/Tenhaw/tenhaw-kit/blob/main/LICENSE); authored framework content is [CC BY 4.0](https://github.com/Tenhaw/tenhaw-kit/blob/main/LICENSE-CONTENT). Reports state methodology, coverage and limitations; readiness scoring is a self-assessment, not certification or legal advice.
51
+
52
+ Built by Tenhaw. [Get help applying the tools](https://tenhaw.com/contact?utm_source=npm&utm_medium=readme&utm_campaign=tenhaw-kit&utm_content=cli#book).
@@ -0,0 +1,74 @@
1
+ // src/scaffold.ts
2
+ import { cp, lstat, mkdir, readFile, readdir, realpath, rename, rm, writeFile } from "fs/promises";
3
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
4
+ import { fileURLToPath } from "url";
5
+ var templates = ["ai-adoption-dashboard", "delivery-metrics-dashboard", "ai-usecase-register", "product-operating-model", "ai-readiness-assessment"];
6
+ async function scaffold(template, directory, options = {}) {
7
+ if (!templates.includes(template)) throw new Error(`Unknown template. Choose: ${templates.join(", ")}`);
8
+ if (!directory.trim() || directory === "." || directory === "..") throw new Error("Choose a new project directory.");
9
+ const target = resolve(directory);
10
+ try {
11
+ await lstat(target);
12
+ throw new Error("Target already exists. Choose a new directory; existing files are never overwritten.");
13
+ } catch (error) {
14
+ if (error.code !== "ENOENT") throw error;
15
+ }
16
+ const packaged = fileURLToPath(new URL("../templates/", import.meta.url));
17
+ const root = options.templateRoot ?? packaged;
18
+ const source = join(root, template);
19
+ await assertSourceTree(source);
20
+ await mkdir(dirname(target), { recursive: true });
21
+ const staging = `${target}.tenhaw-${process.pid}-${Date.now()}`;
22
+ try {
23
+ await cp(source, staging, {
24
+ recursive: true,
25
+ errorOnExist: true,
26
+ force: false,
27
+ filter: (path) => !relative(source, path).split(sep).some((p) => ["node_modules", ".next", "out", ".vercel", ".git"].includes(p) || p.startsWith(".env") && p !== ".env.example")
28
+ });
29
+ const manifestPath = join(staging, "package.json");
30
+ const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
31
+ manifest.name = target.split(sep).at(-1)?.toLowerCase().replace(/[^a-z0-9-]/g, "-") || "tenhaw-internal-tool";
32
+ delete manifest.packageManager;
33
+ for (const group of ["dependencies", "devDependencies"]) {
34
+ for (const [name, version] of Object.entries(manifest[group] ?? {})) {
35
+ if (String(version).startsWith("workspace:")) manifest[group][name] = "0.0.0-bootstrap";
36
+ }
37
+ }
38
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
39
+ `);
40
+ await mkdir(target);
41
+ for (const entry of await readdir(staging)) await rename(join(staging, entry), join(target, entry));
42
+ await rm(staging, { recursive: true });
43
+ } catch (error) {
44
+ await rm(staging, { recursive: true, force: true });
45
+ throw error;
46
+ }
47
+ const quotedTarget = `'${target.replaceAll("'", `'"'"'`)}'`;
48
+ return {
49
+ template,
50
+ directory: target,
51
+ nextSteps: [`cd ${quotedTarget}`, "pnpm install", "pnpm dev"],
52
+ dataMode: "browser-local",
53
+ authentication: "Required before adding shared storage or server-side real-data routes."
54
+ };
55
+ }
56
+ async function assertSourceTree(root) {
57
+ const base = await realpath(root);
58
+ async function visit(path) {
59
+ const stat = await lstat(path);
60
+ if (stat.isSymbolicLink()) throw new Error("Template source contains a symbolic link.");
61
+ const rel = relative(base, path);
62
+ if (rel.startsWith("..") || isAbsolute(rel)) throw new Error("Invalid template path.");
63
+ if (stat.isDirectory()) for (const entry of await readdir(path)) {
64
+ if (["node_modules", ".next", "out", ".git", ".vercel"].includes(entry)) continue;
65
+ await visit(join(path, entry));
66
+ }
67
+ }
68
+ await visit(base);
69
+ }
70
+
71
+ export {
72
+ templates,
73
+ scaffold
74
+ };
@@ -0,0 +1,73 @@
1
+ // src/scaffold.ts
2
+ import { cp, lstat, mkdir, readFile, readdir, realpath, rename, rm, writeFile } from "fs/promises";
3
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
4
+ import { fileURLToPath } from "url";
5
+ var templates = ["ai-adoption-dashboard", "delivery-metrics-dashboard", "ai-usecase-register", "product-operating-model", "ai-readiness-assessment"];
6
+ async function scaffold(template, directory, options = {}) {
7
+ if (!templates.includes(template)) throw new Error(`Unknown template. Choose: ${templates.join(", ")}`);
8
+ if (!directory.trim() || directory === "." || directory === "..") throw new Error("Choose a new project directory.");
9
+ const target = resolve(directory);
10
+ try {
11
+ await lstat(target);
12
+ throw new Error("Target already exists. Choose a new directory; existing files are never overwritten.");
13
+ } catch (error) {
14
+ if (error.code !== "ENOENT") throw error;
15
+ }
16
+ const packaged = fileURLToPath(new URL("../templates/", import.meta.url));
17
+ const root = options.templateRoot ?? packaged;
18
+ const source = join(root, template);
19
+ await assertSourceTree(source);
20
+ await mkdir(dirname(target), { recursive: true });
21
+ const staging = `${target}.tenhaw-${process.pid}-${Date.now()}`;
22
+ try {
23
+ await cp(source, staging, {
24
+ recursive: true,
25
+ errorOnExist: true,
26
+ force: false,
27
+ filter: (path) => !relative(source, path).split(sep).some((p) => ["node_modules", ".next", "out", ".vercel", ".git", ".env", ".env.local"].includes(p))
28
+ });
29
+ const manifestPath = join(staging, "package.json");
30
+ const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
31
+ manifest.name = target.split(sep).at(-1)?.toLowerCase().replace(/[^a-z0-9-]/g, "-") || "tenhaw-internal-tool";
32
+ delete manifest.packageManager;
33
+ for (const group of ["dependencies", "devDependencies"]) {
34
+ for (const [name, version] of Object.entries(manifest[group] ?? {})) {
35
+ if (String(version).startsWith("workspace:")) manifest[group][name] = "0.0.0-bootstrap";
36
+ }
37
+ }
38
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
39
+ `);
40
+ await mkdir(target);
41
+ for (const entry of await readdir(staging)) await rename(join(staging, entry), join(target, entry));
42
+ await rm(staging, { recursive: true });
43
+ } catch (error) {
44
+ await rm(staging, { recursive: true, force: true });
45
+ throw error;
46
+ }
47
+ return {
48
+ template,
49
+ directory: target,
50
+ nextSteps: [`cd ${JSON.stringify(target)}`, "pnpm install", "pnpm dev"],
51
+ dataMode: "browser-local",
52
+ authentication: "Required before adding shared storage or server-side real-data routes."
53
+ };
54
+ }
55
+ async function assertSourceTree(root) {
56
+ const base = await realpath(root);
57
+ async function visit(path) {
58
+ const stat = await lstat(path);
59
+ if (stat.isSymbolicLink()) throw new Error("Template source contains a symbolic link.");
60
+ const rel = relative(base, path);
61
+ if (rel.startsWith("..") || isAbsolute(rel)) throw new Error("Invalid template path.");
62
+ if (stat.isDirectory()) for (const entry of await readdir(path)) {
63
+ if (["node_modules", ".next", "out", ".git", ".vercel"].includes(entry)) continue;
64
+ await visit(join(path, entry));
65
+ }
66
+ }
67
+ await visit(base);
68
+ }
69
+
70
+ export {
71
+ templates,
72
+ scaffold
73
+ };
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ type Flags = Record<string, string | boolean>;
3
+ declare function parseArgs(argv: string[]): {
4
+ args: string[];
5
+ flags: Flags;
6
+ };
7
+ declare function installation(): {
8
+ claude: string[];
9
+ claudeMcp: string;
10
+ codex: string;
11
+ gemini: string;
12
+ cursor: string;
13
+ vscode: string;
14
+ remote: string;
15
+ publication: string;
16
+ };
17
+ declare function writeAgentInstructions(directory?: string): Promise<{
18
+ written: string[];
19
+ existing: string[];
20
+ nextStep: string;
21
+ }>;
22
+ declare function main(argv?: string[]): Promise<void>;
23
+
24
+ export { installation, main, parseArgs, writeAgentInstructions };
package/dist/index.js ADDED
@@ -0,0 +1,319 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ scaffold,
4
+ templates
5
+ } from "./chunk-BKPOQVTM.js";
6
+
7
+ // src/index.ts
8
+ import { readFile, writeFile, mkdir, lstat, realpath } from "fs/promises";
9
+ import { dirname, resolve, relative, isAbsolute } from "path";
10
+ import { pathToFileURL } from "url";
11
+ import { realpathSync } from "fs";
12
+ import { createInterface } from "readline/promises";
13
+ import * as core from "@tenhaw/core";
14
+ import { loadFramework, scoreReadiness } from "@tenhaw/ai-readiness";
15
+ import { calculateRoi, estimateProjectCost } from "@tenhaw/ai-roi";
16
+ import { computeMetrics } from "@tenhaw/delivery-metrics";
17
+ import { collectGithub, collectJira, CollectorError } from "@tenhaw/delivery-metrics/collectors";
18
+ import * as registers from "@tenhaw/usecase-register";
19
+ import * as opmodel from "@tenhaw/opmodel";
20
+ var valueFlags = /* @__PURE__ */ new Set(["input", "from-file", "out", "format", "github", "jira", "since", "until", "config", "stage", "store", "template"]);
21
+ var boolFlags = /* @__PURE__ */ new Set(["yes", "json", "quiet", "no-attribution", "no-cache", "network", "help", "version", "questionnaire"]);
22
+ var UsageError = class extends Error {
23
+ };
24
+ function parseArgs(argv) {
25
+ const flags = {}, args = [];
26
+ for (let i = 0; i < argv.length; i++) {
27
+ const token = argv[i];
28
+ if (token === "--") {
29
+ args.push(...argv.slice(i + 1));
30
+ break;
31
+ }
32
+ if (!token.startsWith("-")) {
33
+ args.push(token);
34
+ continue;
35
+ }
36
+ const normal = { "-y": "--yes", "-h": "--help", "-v": "--version" }[token] ?? token;
37
+ const [name, inline] = normal.slice(2).split(/=(.*)/s);
38
+ if (boolFlags.has(name)) {
39
+ if (inline !== void 0) throw new UsageError(`--${name} takes no value.`);
40
+ flags[name] = true;
41
+ } else if (valueFlags.has(name)) {
42
+ const value = inline ?? argv[++i];
43
+ if (!value || value.startsWith("--")) throw new UsageError(`--${name} requires a value.`);
44
+ flags[name] = value;
45
+ } else throw new UsageError(`Unknown option ${token}. Run tenhaw --help.`);
46
+ }
47
+ return { args, flags };
48
+ }
49
+ var help = `Tenhaw Kit 0.0.0-bootstrap: building blocks for internal product, portfolio and transformation tools
50
+
51
+ tenhaw init <template> <new-dir> Scaffold an internal tool
52
+ tenhaw readiness --input answers.json Score evidence and response coverage
53
+ tenhaw readiness --questionnaire Print the versioned questionnaire
54
+ tenhaw delivery-metrics --from-file events.json --since <ISO> --until <ISO>
55
+ tenhaw delivery-metrics --github owner/repo --since 90d [--jira <JQL>]
56
+ tenhaw roi --input roi.json Capacity, cash flow, NPV and payback
57
+ tenhaw roi cost --stage poc|pilot|production [--input costs.json]
58
+ tenhaw usecases new|list|prioritise|export [--input cases.json] [--store path]
59
+ tenhaw opmodel validate|diagram --input model.json
60
+ tenhaw mcp Agent installation snippets
61
+ tenhaw agents Add non-overwriting project instructions
62
+ tenhaw doctor [--network] Runtime, token names and network allowlist
63
+
64
+ Templates: ${templates.join(", ")}
65
+ Options: --json --format md|html|json --out path --no-attribution --quiet --yes
66
+ Exit codes: 0 success, 1 usage, 2 validation, 3 upstream API, 4 missing authentication
67
+ In CI/non-TTY mode all inputs must be explicit. Logs and errors use stderr.
68
+ `;
69
+ async function jsonFile(path) {
70
+ if (typeof path !== "string") throw new UsageError("Supply --input <file.json>.");
71
+ try {
72
+ return JSON.parse(await readFile(path, "utf8"));
73
+ } catch {
74
+ throw new Error("Input is not a readable JSON file.");
75
+ }
76
+ }
77
+ async function interactiveReadiness() {
78
+ const framework = loadFramework();
79
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
80
+ const answers = [];
81
+ try {
82
+ for (const dimension of framework.dimensions) for (const question of dimension.questions) {
83
+ const prompt = question.text;
84
+ let score;
85
+ do {
86
+ score = Number(await rl.question(`${prompt} (1-5, blank to skip): `));
87
+ } while (score !== 0 && (!Number.isInteger(score) || score < 1 || score > 5));
88
+ if (score) answers.push({ questionId: question.id, score });
89
+ }
90
+ } finally {
91
+ rl.close();
92
+ }
93
+ return { answers };
94
+ }
95
+ async function interactiveRoi() {
96
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
97
+ try {
98
+ const number = async (label, fallback) => {
99
+ const input = await rl.question(`${label} [${fallback}]: `);
100
+ return input.trim() ? Number(input) : fallback;
101
+ };
102
+ return {
103
+ useCase: await rl.question("Use case: "),
104
+ users: await number("Users", 10),
105
+ minutesPerTask: await number("Baseline minutes/task", 20),
106
+ tasksPerUserPerMonth: await number("Tasks/user/month", 20),
107
+ savings: { low: await number("Low saving fraction", 0.1), base: await number("Base saving fraction", 0.2), high: await number("High saving fraction", 0.3) },
108
+ hourlyCost: await number("Loaded hourly cost GBP", 50),
109
+ buildCost: await number("Build cost GBP", 1e3),
110
+ monthlyRunCost: await number("Monthly run cost GBP", 100),
111
+ cashRealisation: await number("Share of capacity actually removed from cash cost lines (0-1)", 0),
112
+ adoptionMonths: await number("Months to adoption", 3),
113
+ horizonMonths: await number("Horizon months", 12),
114
+ annualDiscountRate: await number("Annual discount fraction", 0.1),
115
+ currency: "GBP"
116
+ };
117
+ } finally {
118
+ rl.close();
119
+ }
120
+ }
121
+ function installation() {
122
+ return {
123
+ claude: ["claude plugin marketplace add Tenhaw/tenhaw-kit", "claude plugin install tenhaw@tenhaw-kit"],
124
+ claudeMcp: "claude mcp add tenhaw -- npx -y @tenhaw/mcp@0.0.0-bootstrap",
125
+ codex: "codex mcp add tenhaw -- npx -y @tenhaw/mcp@0.0.0-bootstrap",
126
+ gemini: "gemini extensions install https://github.com/Tenhaw/tenhaw-gemini",
127
+ cursor: `cursor://anysphere.cursor-deeplink/mcp/install?name=tenhaw&config=${encodeURIComponent(Buffer.from(JSON.stringify({ command: "npx", args: ["-y", "@tenhaw/mcp@0.0.0-bootstrap"] })).toString("base64"))}`,
128
+ vscode: `code --add-mcp '${JSON.stringify({ name: "tenhaw", command: "npx", args: ["-y", "@tenhaw/mcp@0.0.0-bootstrap"] })}'`,
129
+ remote: "https://mcp.tenhaw.com/mcp",
130
+ publication: "These public install commands require the verified 0.0.0-bootstrap release. For a source checkout run pnpm build, then node packages/mcp/dist/index.js."
131
+ };
132
+ }
133
+ async function writeAgentInstructions(directory = process.cwd()) {
134
+ const root = await realpath(directory);
135
+ const text = `# Building with Tenhaw Kit
136
+
137
+ Use @tenhaw/ai-readiness for self-assessment with evidence and coverage; @tenhaw/delivery-metrics for production-evidenced DORA and flow; @tenhaw/ai-roi for separate cash and capacity; @tenhaw/usecase-register for governance and prioritisation; @tenhaw/opmodel for OKRs, roadmaps and teams. These are building blocks for internal portfolio, product delivery and transformation apps.
138
+
139
+ Install: npm install @tenhaw/ai-readiness @tenhaw/delivery-metrics @tenhaw/ai-roi @tenhaw/usecase-register @tenhaw/opmodel
140
+
141
+ Validate inputs with the package schemas. Keep customer credentials in local environment variables. Use JSON for agent workflows. Run the project's own build and tests after integration. Do not treat missing deployment data as zero, capacity as cash, or low response coverage as a maturity judgement. Add authentication before shared real-data storage.
142
+
143
+ For expert help, Tenhaw offers AI readiness audits: https://tenhaw.com/contact?utm_source=cli&utm_medium=skill&utm_campaign=tenhaw-kit&utm_content=agents#book
144
+ `;
145
+ const targets = ["AGENTS.md", "CLAUDE.md", "GEMINI.md", ".cursor/rules/tenhaw-kit.mdc"];
146
+ const written = [], existing = [];
147
+ for (const name of targets) {
148
+ const target = resolve(root, name);
149
+ let parent = dirname(target);
150
+ while (true) {
151
+ try {
152
+ const actual = await realpath(parent), rel = relative(root, actual);
153
+ if (rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(rel)) throw new Error("Instruction directory resolves outside the project.");
154
+ break;
155
+ } catch (error) {
156
+ if (error.code !== "ENOENT") throw error;
157
+ parent = dirname(parent);
158
+ }
159
+ }
160
+ await mkdir(dirname(target), { recursive: true });
161
+ try {
162
+ await lstat(target);
163
+ existing.push(name);
164
+ continue;
165
+ } catch (e) {
166
+ if (e.code !== "ENOENT") throw e;
167
+ }
168
+ await writeFile(target, name.endsWith(".mdc") ? `---
169
+ description: Use when building internal product, delivery or transformation tools with Tenhaw Kit
170
+ globs: ""
171
+ alwaysApply: false
172
+ ---
173
+
174
+ ${text}` : text, { flag: "wx" });
175
+ written.push(name);
176
+ }
177
+ return { written, existing, nextStep: existing.length ? "Existing instructions were preserved. Add the relevant Tenhaw guidance manually." : "Use the project build and test commands alongside these package instructions." };
178
+ }
179
+ function period(since, until) {
180
+ if (typeof until === "string") core.validateDateTime(until, "/until");
181
+ if (typeof since === "string" && !/^\d+d$/.test(since)) core.validateDateTime(since, "/since");
182
+ const end = typeof until === "string" ? new Date(until) : /* @__PURE__ */ new Date();
183
+ const start = typeof since === "string" && /^\d+d$/.test(since) ? new Date(end.valueOf() - Number(since.slice(0, -1)) * 864e5) : new Date(typeof since === "string" ? since : end.valueOf() - 90 * 864e5);
184
+ if (!Number.isFinite(start.valueOf()) || !Number.isFinite(end.valueOf()) || start >= end) throw new Error("Use a valid --since before --until (ISO timestamps or --since 90d).");
185
+ return { since: start.toISOString(), until: end.toISOString() };
186
+ }
187
+ async function usecases(action, flags) {
188
+ const store = typeof flags.store === "string" ? flags.store : ".tenhaw/usecases.json";
189
+ let input;
190
+ if (flags.input) input = await jsonFile(flags.input);
191
+ else {
192
+ try {
193
+ input = JSON.parse(await readFile(store, "utf8"));
194
+ } catch (e) {
195
+ if (e.code === "ENOENT") input = { useCases: [] };
196
+ else throw new Error("Use-case store is not valid JSON.");
197
+ }
198
+ }
199
+ if (action === "new") {
200
+ if (!flags.input) throw new UsageError("usecases new requires --input case.json.");
201
+ let existing = { useCases: [] };
202
+ try {
203
+ existing = JSON.parse(await readFile(store, "utf8"));
204
+ } catch (e) {
205
+ if (e.code !== "ENOENT") throw e;
206
+ }
207
+ const added = input.useCases ?? [input];
208
+ const combined = core.validateInput("usecase-register", { useCases: [...existing.useCases, ...added] });
209
+ const result = registers.prioritiseUseCases(combined);
210
+ await mkdir(dirname(resolve(store)), { recursive: true });
211
+ await writeFile(store, `${JSON.stringify({ useCases: [...existing.useCases, ...added] }, null, 2)}
212
+ `);
213
+ return result;
214
+ }
215
+ if (!["list", "prioritise", "export"].includes(action)) throw new UsageError("Choose usecases new, list, prioritise or export.");
216
+ const register = registers.prioritiseUseCases(core.validateInput("usecase-register", input));
217
+ if (action === "export" && flags.format === "csv") return registers.exportRegister(register, "csv");
218
+ return register;
219
+ }
220
+ async function main(argv = process.argv.slice(2)) {
221
+ const { args, flags } = parseArgs(argv);
222
+ if (flags.version) {
223
+ process.stdout.write("0.0.0-bootstrap\n");
224
+ return;
225
+ }
226
+ if (flags.help || !args.length) {
227
+ process.stdout.write(help);
228
+ return;
229
+ }
230
+ const [command, subcommand, third] = args;
231
+ const interactive = Boolean(process.stdin.isTTY && !process.env.CI && !flags.yes);
232
+ let report;
233
+ switch (command) {
234
+ case "init": {
235
+ let template = subcommand ?? flags.template, directory = third;
236
+ if ((!template || !directory) && interactive) {
237
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
238
+ try {
239
+ template ??= await rl.question(`Template (${templates.join(", ")}): `);
240
+ directory ??= await rl.question("New directory: ");
241
+ } finally {
242
+ rl.close();
243
+ }
244
+ }
245
+ if (typeof template !== "string" || !directory) throw new UsageError("Use tenhaw init <template> <new-directory>.");
246
+ report = await scaffold(template, directory);
247
+ break;
248
+ }
249
+ case "readiness":
250
+ report = flags.questionnaire ? loadFramework() : scoreReadiness(flags.input ? await jsonFile(flags.input) : interactive ? await interactiveReadiness() : (() => {
251
+ throw new UsageError("Use --input answers.json or --questionnaire.");
252
+ })());
253
+ break;
254
+ case "roi":
255
+ report = subcommand === "cost" ? estimateProjectCost({ ...flags.input ? await jsonFile(flags.input) : {}, ...flags.stage ? { stage: flags.stage } : {} }) : calculateRoi(flags.input ? await jsonFile(flags.input) : interactive ? await interactiveRoi() : (() => {
256
+ throw new UsageError("Use roi --input roi.json.");
257
+ })());
258
+ break;
259
+ case "delivery-metrics": {
260
+ const dates = period(flags.since, flags.until);
261
+ const config = flags.config ? await jsonFile(flags.config) : {};
262
+ let events;
263
+ if (flags["from-file"] || flags.input) {
264
+ const file = await jsonFile(flags["from-file"] || flags.input);
265
+ events = Array.isArray(file) ? file : file.events;
266
+ } else {
267
+ if (!flags.github && !flags.jira) throw new UsageError("Use --from-file events.json or --github owner/repo and/or --jira JQL.");
268
+ events = [...typeof flags.github === "string" ? await collectGithub({ repos: flags.github.split(","), ...dates, noCache: Boolean(flags["no-cache"]) }) : [], ...typeof flags.jira === "string" ? await collectJira({ jql: flags.jira, ...dates, config, noCache: Boolean(flags["no-cache"]) }) : []];
269
+ }
270
+ report = computeMetrics(events, { ...config, ...dates });
271
+ break;
272
+ }
273
+ case "usecases":
274
+ report = await usecases(subcommand ?? "list", flags);
275
+ break;
276
+ case "opmodel": {
277
+ if (!["validate", "diagram"].includes(subcommand)) throw new UsageError("Choose opmodel validate or diagram.");
278
+ const model = opmodel.generateOperatingModel(await jsonFile(flags.input || args[2]));
279
+ report = subcommand === "diagram" ? opmodel.renderMermaid(model) : model;
280
+ break;
281
+ }
282
+ case "mcp":
283
+ report = installation();
284
+ break;
285
+ case "agents":
286
+ report = await writeAgentInstructions();
287
+ break;
288
+ case "doctor":
289
+ report = { node: process.version, supported: Number(process.versions.node.split(".")[0]) >= 22, tokens: Object.fromEntries(["GITHUB_TOKEN", "JIRA_BASE_URL", "JIRA_EMAIL", "JIRA_API_TOKEN"].map((name) => [name, process.env[name] ? "set" : "not set"])), ...flags.network ? { hosts: ["api.github.com", "<configured-tenant>.atlassian.net"], networkPolicy: "Only explicitly requested GitHub/Jira collection makes network calls. Installation uses the package manager; pure scoring and scaffolding are offline. Remote MCP is a separately selected client transport." } : {} };
290
+ break;
291
+ default:
292
+ throw new UsageError(`Unknown command ${command}. Run tenhaw --help.`);
293
+ }
294
+ const format = flags.json ? "json" : flags.format ?? "md";
295
+ if (!["json", "md", "html", "csv", "mermaid"].includes(String(format))) throw new UsageError("Format must be json, md, html, csv or mermaid.");
296
+ const options = { source: "cli", medium: "report", content: command, attribution: !flags["no-attribution"] && process.env.TENHAW_NO_ATTRIBUTION !== "1" };
297
+ const output = format === "json" ? core.renderJson(report, options) : typeof report === "string" ? report : format === "html" ? core.renderHtml(report, options) : core.renderMarkdown(report, options);
298
+ if (typeof flags.out === "string") await writeFile(flags.out, `${output}
299
+ `, { flag: "wx" });
300
+ else if (!flags.quiet) process.stdout.write(`${output}
301
+ `);
302
+ }
303
+ if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(resolve(process.argv[1]))).href) {
304
+ main().catch((error) => {
305
+ const exit = error instanceof UsageError ? 1 : error instanceof CollectorError ? error.exitCode : 2;
306
+ const message = error instanceof Error ? error.message : "Command failed.";
307
+ const redacted = ["GITHUB_TOKEN", "JIRA_API_TOKEN", "JIRA_EMAIL"].reduce((value, name) => process.env[name] ? value.split(process.env[name]).join("[redacted]") : value, message);
308
+ const safe = redacted.replace(/(?:gh[pousr]_[\w]+|github_pat_[\w]+|Bearer\s+\S+|Basic\s+\S+)/gi, "[redacted]");
309
+ process.stderr.write(`${JSON.stringify({ error: safe, exitCode: exit })}
310
+ `);
311
+ process.exitCode = exit;
312
+ });
313
+ }
314
+ export {
315
+ installation,
316
+ main,
317
+ parseArgs,
318
+ writeAgentInstructions
319
+ };
@@ -0,0 +1,14 @@
1
+ declare const templates: readonly ["ai-adoption-dashboard", "delivery-metrics-dashboard", "ai-usecase-register", "product-operating-model", "ai-readiness-assessment"];
2
+ type Template = typeof templates[number];
3
+ /** Copy only bundled source. Never download scripts, overwrite a project, or follow symlinks. */
4
+ declare function scaffold(template: string, directory: string, options?: {
5
+ templateRoot?: string;
6
+ }): Promise<{
7
+ template: string;
8
+ directory: string;
9
+ nextSteps: string[];
10
+ dataMode: string;
11
+ authentication: string;
12
+ }>;
13
+
14
+ export { type Template, scaffold, templates };
@@ -0,0 +1,8 @@
1
+ import {
2
+ scaffold,
3
+ templates
4
+ } from "./chunk-BKPOQVTM.js";
5
+ export {
6
+ scaffold,
7
+ templates
8
+ };
@@ -0,0 +1,9 @@
1
+ # Tenhaw Kit: ai readiness assessment
2
+
3
+ Fetch the questionnaire with `npx -y tenhaw@1.0.0 readiness --questionnaire --json`. Record explicit question IDs, scores and optional evidence in `{ "answers": [...] }`. Ask for missing evidence; never infer unanswered scores. Run the assessment and return the structured report. Show coverage beside every score and withhold maturity bands below 80% coverage. This framework supports internal self-assessment; the advisory audit separately examines real workflows.
4
+
5
+ Command: `npx -y tenhaw@1.0.0 readiness --input answers.json --json`
6
+
7
+ Use package schemas to validate the host data model; run the host repository’s documented build, test and lint commands. No command here replaces existing repository instructions.
8
+
9
+ For expert help: https://tenhaw.com/contact?utm_source=github&utm_medium=skill&utm_campaign=tenhaw-kit&utm_content=ai-readiness-assessment#book
@@ -0,0 +1,9 @@
1
+ # Tenhaw Kit: ai roi business case
2
+
3
+ Collect useCase, users, minutesPerTask, tasksPerUserPerMonth, savings low/base/high fractions, hourlyCost, buildCost, monthlyRunCost, adoptionMonths, horizonMonths, annualDiscountRate, cashRealisation and currency. Make cashRealisation explicit: retained staff capacity is not automatically cash. Report low/base/high cases, recovered capacity, cash benefits, NPV and payback separately. Defaults are editable assumptions, never quotes. Use `roi cost --stage poc --json` for a transparent project-cost range.
4
+
5
+ Command: `npx -y tenhaw@1.0.0 roi --input roi.json --json`
6
+
7
+ Use package schemas to validate the host data model; run the host repository’s documented build, test and lint commands. No command here replaces existing repository instructions.
8
+
9
+ For expert help: https://tenhaw.com/contact?utm_source=github&utm_medium=skill&utm_campaign=tenhaw-kit&utm_content=ai-roi-business-case#book
@@ -0,0 +1,9 @@
1
+ # Tenhaw Kit: ai usecase register
2
+
3
+ Prepare `{ "useCases": [...] }` using the shared schema. Include accountable owner roles, problem, business unit, value and feasibility (0-5), status and an indicative risk tier. Add dependencies and outcome KPIs when known. Prioritise with governance gates ahead of numeric value-times-feasibility. Prohibited items remain blocked, high and unknown risk require review. Risk labels are indicative, not legal advice. Export with `usecases export --input usecases.json --format csv` when needed.
4
+
5
+ Command: `npx -y tenhaw@1.0.0 usecases prioritise --input usecases.json --json`
6
+
7
+ Use package schemas to validate the host data model; run the host repository’s documented build, test and lint commands. No command here replaces existing repository instructions.
8
+
9
+ For expert help: https://tenhaw.com/contact?utm_source=github&utm_medium=skill&utm_campaign=tenhaw-kit&utm_content=ai-usecase-register#book
@@ -0,0 +1,9 @@
1
+ # Tenhaw Kit: build ai adoption dashboard
2
+
3
+ Choose a new directory. Scaffolding preserves every existing path and never runs install scripts itself. Install dependencies with the user’s package manager, then run the project build and tests. The starter includes clearly synthetic examples and browser-local CSV/JSON data. Add authentication before introducing shared persistence or any server-side real-data routes. Explain the source and period of each metric. Never invent vendor usage data or add telemetry.
4
+
5
+ Command: `npx -y tenhaw@1.0.0 init ai-adoption-dashboard internal-adoption --yes --json`
6
+
7
+ Use package schemas to validate the host data model; run the host repository’s documented build, test and lint commands. No command here replaces existing repository instructions.
8
+
9
+ For expert help: https://tenhaw.com/contact?utm_source=github&utm_medium=skill&utm_campaign=tenhaw-kit&utm_content=build-ai-adoption-dashboard#book