polymath-society 0.2.4
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 +52 -0
- package/README.md +311 -0
- package/dist/DATA-MAP.md +109 -0
- package/dist/cli.js +24136 -0
- package/dist/engine/closing-rubric.md +50 -0
- package/dist/engine/exp-allfacets.js +16832 -0
- package/dist/engine/exp-person.js +16922 -0
- package/dist/engine/exp-pipeline.js +16700 -0
- package/dist/engine/feel-seen-rubric.md +192 -0
- package/dist/engine/ingest-export.js +1423 -0
- package/dist/engine/peak-demos.js +16752 -0
- package/dist/engine/person-dimension-summary.js +16744 -0
- package/dist/engine/person-facet-lines.js +16784 -0
- package/dist/engine/person-headline.js +16733 -0
- package/dist/engine/person-report.js +16845 -0
- package/dist/engine/person-self-image.js +16689 -0
- package/dist/engine/public-report-guidelines.md +80 -0
- package/dist/engine/public-report.js +17284 -0
- package/dist/engine/run-analysis.js +16035 -0
- package/dist/engine/run-tagger.js +16092 -0
- package/dist/engine/top-companies.md +41 -0
- package/dist/engine/writing-well.md +56 -0
- package/dist/index.js +22021 -0
- package/dist/pipeline/TECHNIQUES.md +406 -0
- package/dist/pipeline/WRITING.md +48 -0
- package/dist/pipeline/coding-agglomerate.js +15876 -0
- package/dist/pipeline/coding-aggregate.js +440 -0
- package/dist/pipeline/coding-build.js +1168 -0
- package/dist/pipeline/coding-coaching.js +16893 -0
- package/dist/pipeline/coding-day-digest.js +15869 -0
- package/dist/pipeline/coding-delegation.js +16292 -0
- package/dist/pipeline/coding-expertise.js +15925 -0
- package/dist/pipeline/coding-flow.js +313 -0
- package/dist/pipeline/coding-frontier-detail.js +15878 -0
- package/dist/pipeline/coding-frontier.js +51 -0
- package/dist/pipeline/coding-gap-dist.js +293 -0
- package/dist/pipeline/coding-gap.js +17108 -0
- package/dist/pipeline/coding-grade.js +16195 -0
- package/dist/pipeline/coding-nutshell.js +15725 -0
- package/dist/pipeline/coding-projects.js +104 -0
- package/dist/pipeline/coding-walkthrough.js +15947 -0
- package/dist/web/app.js +12024 -0
- package/dist/web/index.html +1 -0
- package/dist/web/styles.css +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import{createRequire as __cr}from'module';const require=__cr(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// ../../scripts/coding-projects.mts
|
|
4
|
+
import { promises as fs } from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
var CODING = ".data/coding";
|
|
8
|
+
var TZ = "America/Los_Angeles";
|
|
9
|
+
var day = (iso) => iso ? new Date(Date.parse(iso)).toLocaleDateString("en-CA", { timeZone: TZ }) : "";
|
|
10
|
+
var base = (p) => (p || "?").split("/").filter(Boolean).pop() || "?";
|
|
11
|
+
var pretty = (b) => b.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
12
|
+
var remoteCache = /* @__PURE__ */ new Map();
|
|
13
|
+
function gitRemote(cwd) {
|
|
14
|
+
if (remoteCache.has(cwd)) return remoteCache.get(cwd);
|
|
15
|
+
let url = null;
|
|
16
|
+
try {
|
|
17
|
+
url = execFileSync("git", ["-C", cwd, "remote", "get-url", "origin"], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim() || null;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
remoteCache.set(cwd, url);
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
function repoName(url) {
|
|
24
|
+
const m = url.replace(/\.git$/, "").replace(/\/$/, "").match(/[/:]([^/]+)$/);
|
|
25
|
+
return m ? m[1] : url;
|
|
26
|
+
}
|
|
27
|
+
async function main() {
|
|
28
|
+
const ss = JSON.parse(await fs.readFile(path.join(CODING, "sessions.json"), "utf8")).filter((s) => s.klass === "interactive");
|
|
29
|
+
const flow = await fs.readFile(path.join(CODING, "flow.json"), "utf8").then(JSON.parse).catch(() => ({ days: [] }));
|
|
30
|
+
const flowActive = {};
|
|
31
|
+
for (const d of flow.days || []) flowActive[d.date] = Math.round(((d.flowMin || 0) + (d.pauseMin || 0)) / 60 * 10) / 10;
|
|
32
|
+
const repos = [];
|
|
33
|
+
const repoIdx = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const s of ss) {
|
|
35
|
+
const cwd = s.project || "";
|
|
36
|
+
if (!cwd) continue;
|
|
37
|
+
const remote = gitRemote(cwd);
|
|
38
|
+
if (!remote) continue;
|
|
39
|
+
const t = Date.parse(s.start || "") || 0;
|
|
40
|
+
let r = repoIdx.get(cwd);
|
|
41
|
+
if (!r) {
|
|
42
|
+
r = { cwd, name: pretty(repoName(remote)), min: t || Number.MAX_SAFE_INTEGER, max: t, mins: 0 };
|
|
43
|
+
repoIdx.set(cwd, r);
|
|
44
|
+
repos.push(r);
|
|
45
|
+
}
|
|
46
|
+
if (t) {
|
|
47
|
+
r.min = Math.min(r.min, t);
|
|
48
|
+
r.max = Math.max(r.max, t);
|
|
49
|
+
}
|
|
50
|
+
r.mins += s.activeMin || 0;
|
|
51
|
+
}
|
|
52
|
+
const resolveName = (s) => {
|
|
53
|
+
const cwd = s.project || "";
|
|
54
|
+
const own = gitRemote(cwd);
|
|
55
|
+
if (own) return pretty(repoName(own));
|
|
56
|
+
const pref = cwd.endsWith("/") ? cwd : cwd + "/";
|
|
57
|
+
const desc = repos.filter((r) => r.cwd.startsWith(pref));
|
|
58
|
+
if (!desc.length) return pretty(base(cwd));
|
|
59
|
+
const t = Date.parse(s.start || "") || 0;
|
|
60
|
+
const dist = (r) => t < r.min ? r.min - t : t > r.max ? t - r.max : 0;
|
|
61
|
+
return desc.slice().sort((a, b) => dist(a) - dist(b) || b.mins - a.mins)[0].name;
|
|
62
|
+
};
|
|
63
|
+
const dayProj = {};
|
|
64
|
+
for (const s of ss) {
|
|
65
|
+
const d = day(s.start);
|
|
66
|
+
if (!d) continue;
|
|
67
|
+
const p = resolveName(s);
|
|
68
|
+
(dayProj[d] = dayProj[d] || {})[p] = (dayProj[d][p] || 0) + (s.activeMin || 0);
|
|
69
|
+
}
|
|
70
|
+
const byDay = {};
|
|
71
|
+
const projAgg = {};
|
|
72
|
+
for (const d of Object.keys(dayProj)) {
|
|
73
|
+
const ps = dayProj[d];
|
|
74
|
+
const entries = Object.entries(ps).sort((a, b) => b[1] - a[1]);
|
|
75
|
+
const dominant = entries[0][0];
|
|
76
|
+
const totalMin = entries.reduce((a, [, m]) => a + m, 0) || 1;
|
|
77
|
+
const split = entries.map(([project, m]) => ({ project, frac: Math.round(m / totalMin * 1e3) / 1e3 }));
|
|
78
|
+
const hours = flowActive[d] ?? Math.round(totalMin / 60 * 10) / 10;
|
|
79
|
+
byDay[d] = { hours, project: dominant, split };
|
|
80
|
+
const pa = projAgg[dominant] = projAgg[dominant] || { days: 0, hours: 0, first: d, last: d };
|
|
81
|
+
pa.days++;
|
|
82
|
+
pa.hours += hours;
|
|
83
|
+
if (d < pa.first) pa.first = d;
|
|
84
|
+
if (d > pa.last) pa.last = d;
|
|
85
|
+
}
|
|
86
|
+
const dates = Object.keys(byDay).sort();
|
|
87
|
+
const projects = Object.entries(projAgg).map(([project, v]) => ({ project, days: v.days, hours: Math.round(v.hours * 10) / 10, hoursPerDay: v.days ? Math.round(v.hours / v.days * 10) / 10 : 0, first: v.first, last: v.last })).sort((a, b) => b.days - a.days);
|
|
88
|
+
const out = {
|
|
89
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
90
|
+
from: dates[0] || "",
|
|
91
|
+
to: dates[dates.length - 1] || "",
|
|
92
|
+
byDay,
|
|
93
|
+
projects,
|
|
94
|
+
totalActiveDays: dates.length,
|
|
95
|
+
totalHours: Math.round(dates.reduce((a, d) => a + byDay[d].hours, 0) * 10) / 10
|
|
96
|
+
};
|
|
97
|
+
await fs.writeFile(path.join(CODING, "projects.json"), JSON.stringify(out, null, 2));
|
|
98
|
+
console.log(`projects.json \u2014 ${projects.length} projects \xB7 ${out.totalActiveDays} active days \xB7 ${out.totalHours}h \xB7 ${out.from}\u2192${out.to}`);
|
|
99
|
+
projects.forEach((p) => console.log(` ${p.days}d \xB7 ${p.hours}h (${p.hoursPerDay}/day) \xB7 ${p.first}\u2192${p.last} \xB7 ${p.project}`));
|
|
100
|
+
}
|
|
101
|
+
main().catch((e) => {
|
|
102
|
+
console.error(e);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
});
|