@primitive.ai/prim 0.1.0-alpha.9 → 0.1.0-alpha.91
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/README.md +303 -37
- package/SKILL.md +269 -0
- package/dist/chunk-4GLVJLEQ.js +55 -0
- package/dist/chunk-5AFRMOPX.js +209 -0
- package/dist/chunk-5GYQ4J3D.js +126 -0
- package/dist/chunk-67VNLLBN.js +789 -0
- package/dist/chunk-BTNNEH2W.js +79 -0
- package/dist/chunk-EWZMDD44.js +1474 -0
- package/dist/chunk-EZXEWFDG.js +210 -0
- package/dist/chunk-FBAYCS3X.js +327 -0
- package/dist/chunk-FKXFUUWJ.js +36 -0
- package/dist/chunk-FOLKHXLJ.js +1529 -0
- package/dist/chunk-H4UNYFUC.js +196 -0
- package/dist/chunk-HU4PW6I6.js +264 -0
- package/dist/chunk-KFXF2V5G.js +155 -0
- package/dist/chunk-LFFLHSQO.js +78 -0
- package/dist/chunk-M6RIJVRE.js +18358 -0
- package/dist/chunk-NAHHFSLH.js +258 -0
- package/dist/chunk-OAAP2MY6.js +262 -0
- package/dist/chunk-PCVGBE5B.js +659 -0
- package/dist/chunk-VW3FDYRT.js +517 -0
- package/dist/chunk-WX52U7Z2.js +112 -0
- package/dist/chunk-ZB4F75SZ.js +843 -0
- package/dist/daemon/server.js +21633 -0
- package/dist/hook-runtime/daemon/server.js +21633 -0
- package/dist/hook-runtime/hooks/post-commit.js +19258 -0
- package/dist/hook-runtime/hooks/post-rewrite.js +19273 -0
- package/dist/hook-runtime/hooks/post-tool-use.js +26365 -0
- package/dist/hook-runtime/hooks/pre-commit.js +1314 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +25832 -0
- package/dist/hook-runtime/hooks/prim-hook.js +26386 -0
- package/dist/hook-runtime/hooks/session-end.js +1078 -0
- package/dist/hook-runtime/hooks/session-start.js +28779 -0
- package/dist/hook-runtime/index.js +50987 -0
- package/dist/hook-runtime/statusline-main.js +809 -0
- package/dist/hooks/post-commit.js +190 -0
- package/dist/hooks/post-rewrite.js +203 -0
- package/dist/hooks/post-tool-use.js +288 -0
- package/dist/hooks/pre-commit.js +16 -101
- package/dist/hooks/pre-tool-use.js +369 -0
- package/dist/hooks/prim-hook.js +229 -0
- package/dist/hooks/session-end.js +59 -0
- package/dist/hooks/session-start.js +316 -0
- package/dist/index.js +8875 -429
- package/dist/statusline-main.js +809 -0
- package/package.json +35 -13
- package/dist/chunk-3APLWTLB.js +0 -165
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
terminalSafeLine
|
|
3
|
+
} from "./chunk-PCVGBE5B.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/ansi.ts
|
|
6
|
+
var ANSI_CODES = {
|
|
7
|
+
yellow: "\x1B[33m",
|
|
8
|
+
magenta: "\x1B[35m",
|
|
9
|
+
blue: "\x1B[34m",
|
|
10
|
+
cyan: "\x1B[36m",
|
|
11
|
+
green: "\x1B[32m",
|
|
12
|
+
red: "\x1B[31m",
|
|
13
|
+
// 256-color approximation of the orange trigger marker (xterm 208).
|
|
14
|
+
orange: "\x1B[38;5;208m",
|
|
15
|
+
gray: "\x1B[90m"
|
|
16
|
+
};
|
|
17
|
+
var ANSI_RESET = "\x1B[0m";
|
|
18
|
+
var ANSI_DIM = "\x1B[2m";
|
|
19
|
+
var ANSI_BOLD = "\x1B[1m";
|
|
20
|
+
function supportsColor() {
|
|
21
|
+
if (process.env.NO_COLOR !== void 0 && process.env.NO_COLOR !== "") {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return process.stderr.isTTY === true;
|
|
25
|
+
}
|
|
26
|
+
function color(text, c) {
|
|
27
|
+
if (!supportsColor()) {
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
return `${ANSI_CODES[c]}${text}${ANSI_RESET}`;
|
|
31
|
+
}
|
|
32
|
+
function dim(text) {
|
|
33
|
+
if (!supportsColor()) {
|
|
34
|
+
return text;
|
|
35
|
+
}
|
|
36
|
+
return `${ANSI_DIM}${text}${ANSI_RESET}`;
|
|
37
|
+
}
|
|
38
|
+
function bold(text) {
|
|
39
|
+
if (!supportsColor()) {
|
|
40
|
+
return text;
|
|
41
|
+
}
|
|
42
|
+
return `${ANSI_BOLD}${text}${ANSI_RESET}`;
|
|
43
|
+
}
|
|
44
|
+
var AREA_COLORS = {
|
|
45
|
+
auth: "yellow",
|
|
46
|
+
data: "magenta",
|
|
47
|
+
mobile: "blue",
|
|
48
|
+
infra: "cyan",
|
|
49
|
+
ui: "green",
|
|
50
|
+
billing: "orange",
|
|
51
|
+
api: "blue",
|
|
52
|
+
docs: "gray",
|
|
53
|
+
testing: "gray"
|
|
54
|
+
};
|
|
55
|
+
function colorForArea(area) {
|
|
56
|
+
if (!area) {
|
|
57
|
+
return "gray";
|
|
58
|
+
}
|
|
59
|
+
return AREA_COLORS[area] ?? "gray";
|
|
60
|
+
}
|
|
61
|
+
var MAX_HEALTH_ERROR_LENGTH = 240;
|
|
62
|
+
function boundedHealthError(value) {
|
|
63
|
+
if (!value) return void 0;
|
|
64
|
+
const clean = terminalSafeLine(value);
|
|
65
|
+
if (!clean) return void 0;
|
|
66
|
+
return clean.length <= MAX_HEALTH_ERROR_LENGTH ? clean : `${clean.slice(0, MAX_HEALTH_ERROR_LENGTH - 1)}\u2026`;
|
|
67
|
+
}
|
|
68
|
+
function stripAnsi(text) {
|
|
69
|
+
return text.replace(/\u001b\[[0-9;]*m/g, "");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
color,
|
|
74
|
+
dim,
|
|
75
|
+
bold,
|
|
76
|
+
colorForArea,
|
|
77
|
+
boundedHealthError,
|
|
78
|
+
stripAnsi
|
|
79
|
+
};
|