@holdpoint/types 0.1.0-alpha.1 → 0.1.0-alpha.10

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/dist/index.d.ts CHANGED
@@ -1,5 +1,31 @@
1
- /** Lifecycle hook that fires the check. Currently only "before_done". */
2
- type HookEvent = "before_done";
1
+ /**
2
+ * Lifecycle hook a check/action attaches to. `before_done` is the completion
3
+ * gate (default). The others let checks seed context or run earlier in the loop:
4
+ * - `session_start` — a fresh session or resume
5
+ * - `message_submit` — every user prompt
6
+ * - `before_tool` — immediately before a tool call (can block it)
7
+ * - `after_tool` — immediately after a tool call (advisory)
8
+ * - `session_end` — the session is ending (advisory)
9
+ * - `before_done` — the completion gate; blocks finishing on failure
10
+ *
11
+ * Engine support varies; engines honor what they can and skip the rest.
12
+ */
13
+ type HookEvent = "session_start" | "message_submit" | "before_tool" | "after_tool" | "session_end" | "before_done";
14
+ /** Ordered list of all hook events, earliest-to-latest in the agent loop. */
15
+ declare const HOOK_EVENTS: HookEvent[];
16
+ /**
17
+ * Context-seeding behavior: inject text, file contents, and/or the current
18
+ * datetime as agent context at the check's hook point. An alternative to
19
+ * `cmd` (command) and `prompt` (agent instruction).
20
+ */
21
+ interface InjectSpec {
22
+ /** Literal text injected as agent context. */
23
+ text?: string;
24
+ /** Repo-relative files whose contents are injected as context. */
25
+ files?: string[];
26
+ /** Inject the current date and time. */
27
+ datetime?: boolean;
28
+ }
3
29
  /** Named file-scope filter. Custom regexes are plain strings not in this union. */
4
30
  type WhenScope = "frontend" | "backend" | "socket" | "visual" | "python" | "go" | "rust" | "java" | "ruby" | "database" | "prisma" | "testing" | "infra" | "ci" | "docs" | "structural";
5
31
  type ConditionOperator = "file_exists" | "file_contains" | "env_var_set" | "shell_returns_0";
@@ -26,9 +52,16 @@ interface CheckDef {
26
52
  cmd?: string;
27
53
  /** Structured prompt/instruction the agent must read and act on before finishing */
28
54
  prompt?: string;
55
+ /** Context-seeding behavior — inject text/files/datetime at the hook point */
56
+ inject?: InjectSpec;
29
57
  /** Reference to a ConditionDef id */
30
58
  conditionId?: string;
31
59
  }
60
+ /** The effective hook of a check (`before_done` when unset). */
61
+ declare function checkHook(check: CheckDef): HookEvent;
62
+ /** A check's behavior kind, derived from which behavior field is set. */
63
+ type CheckBehavior = "cmd" | "prompt" | "inject";
64
+ declare function checkBehavior(check: CheckDef): CheckBehavior;
32
65
  interface HoldpointContext {
33
66
  guides: Record<string, string>;
34
67
  }
@@ -50,6 +83,27 @@ interface HoldpointConfig {
50
83
  * Paths are repo-root-relative. Useful for injecting MASTER_PROMPT.md, AGENT_CONTEXT.md, etc.
51
84
  */
52
85
  session_context_files?: string[];
86
+ /**
87
+ * Inject the current date and time into every prompt submission as `additionalContext`.
88
+ * Helps models avoid knowledge-cutoff confusion. Defaults to `true`; set to `false` to opt out.
89
+ */
90
+ inject_datetime?: boolean;
91
+ /**
92
+ * Per-engine overrides. Values here win over engine defaults — useful when the
93
+ * project IS the holdpoint repo and should invoke the local CLI instead of npx.
94
+ */
95
+ engines?: {
96
+ claude?: {
97
+ stop_command?: string;
98
+ live_command?: string;
99
+ };
100
+ codex?: {
101
+ stop_command?: string;
102
+ };
103
+ copilot?: {
104
+ check_command?: string;
105
+ };
106
+ };
53
107
  }
54
108
  type CheckStatus = "pass" | "fail" | "skip" | "pending";
55
109
  interface CheckResult {
@@ -70,21 +124,41 @@ interface ValidationResult {
70
124
  valid: boolean;
71
125
  errors: ValidationError[];
72
126
  }
73
- type AgentType = "copilot" | "claude" | "cursor" | "unknown";
74
- type StackType = "typescript" | "python" | "go" | "nextjs" | "fullstack" | "unknown";
75
- type NodeKind = "trigger" | "filter" | "task" | "prompt" | "condition";
76
- interface CanvasNodeData {
77
- [key: string]: unknown;
78
- kind: NodeKind;
127
+ type AgentType = "copilot" | "claude" | "cursor" | "codex" | "unknown";
128
+ /** Result of a single check within a run (cmd or prompt). */
129
+ interface CheckRunResult {
130
+ id: string;
79
131
  label: string;
80
- /** Lifecycle hook on the trigger node */
81
- on?: HookEvent;
82
- /** File filter on the trigger node */
83
- when?: string;
84
- cmd?: string;
85
- prompt?: string;
86
- condition?: ConditionDef;
87
- conditionId?: string;
132
+ /** "cmd" for automated checks, "prompt" for manual agent checks */
133
+ kind: "cmd" | "prompt";
134
+ /** "pass" | "fail" | "skip" for cmd checks; "shown" for prompt checks displayed to agent */
135
+ status: "pass" | "fail" | "skip" | "shown";
136
+ output?: string;
137
+ exitCode?: number;
138
+ skipReason?: string;
139
+ }
140
+ /** A single holdpoint check run recorded after `holdpoint check` completes. */
141
+ interface CheckRun {
142
+ /** Full HEAD commit SHA, or null if not in a git repo / no commits. */
143
+ sha: string | null;
144
+ /** First 8 chars of sha, or null. */
145
+ shortSha: string | null;
146
+ /** ISO 8601 timestamp. */
147
+ timestamp: string;
148
+ /** Changed files used for trigger matching. Empty array means "all checks ran". */
149
+ files: string[];
150
+ results: CheckRunResult[];
151
+ summary: {
152
+ passed: number;
153
+ failed: number;
154
+ skipped: number;
155
+ shown: number;
156
+ };
157
+ }
158
+ /** Contents of `.holdpoint/check-reports.json` — list of recent check runs. */
159
+ interface CheckReports {
160
+ /** Runs ordered newest-first. Capped at 50 entries. */
161
+ runs: CheckRun[];
88
162
  }
89
163
 
90
- export type { AgentType, CanvasNodeData, CheckDef, CheckResult, CheckStatus, ConditionDef, ConditionOperator, HoldpointConfig, HoldpointContext, HookEvent, NodeKind, StackType, ValidationError, ValidationResult, WhenScope };
164
+ export { type AgentType, type CheckBehavior, type CheckDef, type CheckReports, type CheckResult, type CheckRun, type CheckRunResult, type CheckStatus, type ConditionDef, type ConditionOperator, HOOK_EVENTS, type HoldpointConfig, type HoldpointContext, type HookEvent, type InjectSpec, type ValidationError, type ValidationResult, type WhenScope, checkBehavior, checkHook };
package/dist/index.js CHANGED
@@ -1 +1,23 @@
1
+ // src/index.ts
2
+ var HOOK_EVENTS = [
3
+ "session_start",
4
+ "message_submit",
5
+ "before_tool",
6
+ "after_tool",
7
+ "session_end",
8
+ "before_done"
9
+ ];
10
+ function checkHook(check) {
11
+ return check.on ?? "before_done";
12
+ }
13
+ function checkBehavior(check) {
14
+ if (check.cmd !== void 0) return "cmd";
15
+ if (check.inject !== void 0) return "inject";
16
+ return "prompt";
17
+ }
18
+ export {
19
+ HOOK_EVENTS,
20
+ checkBehavior,
21
+ checkHook
22
+ };
1
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ─── Hook & when types ───────────────────────────────────────────────────────\n\n/**\n * Lifecycle hook a check/action attaches to. `before_done` is the completion\n * gate (default). The others let checks seed context or run earlier in the loop:\n * - `session_start` — a fresh session or resume\n * - `message_submit` — every user prompt\n * - `before_tool` — immediately before a tool call (can block it)\n * - `after_tool` — immediately after a tool call (advisory)\n * - `session_end` — the session is ending (advisory)\n * - `before_done` — the completion gate; blocks finishing on failure\n *\n * Engine support varies; engines honor what they can and skip the rest.\n */\nexport type HookEvent =\n | \"session_start\"\n | \"message_submit\"\n | \"before_tool\"\n | \"after_tool\"\n | \"session_end\"\n | \"before_done\";\n\n/** Ordered list of all hook events, earliest-to-latest in the agent loop. */\nexport const HOOK_EVENTS: HookEvent[] = [\n \"session_start\",\n \"message_submit\",\n \"before_tool\",\n \"after_tool\",\n \"session_end\",\n \"before_done\",\n];\n\n/**\n * Context-seeding behavior: inject text, file contents, and/or the current\n * datetime as agent context at the check's hook point. An alternative to\n * `cmd` (command) and `prompt` (agent instruction).\n */\nexport interface InjectSpec {\n /** Literal text injected as agent context. */\n text?: string;\n /** Repo-relative files whose contents are injected as context. */\n files?: string[];\n /** Inject the current date and time. */\n datetime?: boolean;\n}\n\n/** Named file-scope filter. Custom regexes are plain strings not in this union. */\nexport type WhenScope =\n // Web / app layers\n | \"frontend\"\n | \"backend\"\n | \"socket\"\n | \"visual\"\n // Languages\n | \"python\"\n | \"go\"\n | \"rust\"\n | \"java\"\n | \"ruby\"\n // Cross-cutting concerns\n | \"database\"\n | \"prisma\"\n | \"testing\"\n | \"infra\"\n | \"ci\"\n | \"docs\"\n // Project structure / dependency manifests\n | \"structural\";\n\n// ─── Condition types ─────────────────────────────────────────────────────────\n\nexport type ConditionOperator = \"file_exists\" | \"file_contains\" | \"env_var_set\" | \"shell_returns_0\";\n\nexport interface ConditionDef {\n id: string;\n operator: ConditionOperator;\n /** Path glob for file_exists / file_contains */\n path?: string;\n /** Substring to look for in file_contains */\n contains?: string;\n /** Env var name for env_var_set */\n envVar?: string;\n /** Shell command for shell_returns_0 */\n cmd?: string;\n}\n\n// ─── Check types ─────────────────────────────────────────────────────────────\n\nexport interface CheckDef {\n id: string;\n label: string;\n /** Lifecycle hook — defaults to \"before_done\" when absent */\n on?: HookEvent;\n /** File filter: a named WhenScope or a regex string. Absent = run always. */\n when?: string;\n /** Shell command — task (runs automatically) */\n cmd?: string;\n /** Structured prompt/instruction the agent must read and act on before finishing */\n prompt?: string;\n /** Context-seeding behavior — inject text/files/datetime at the hook point */\n inject?: InjectSpec;\n /** Reference to a ConditionDef id */\n conditionId?: string;\n}\n\n/** The effective hook of a check (`before_done` when unset). */\nexport function checkHook(check: CheckDef): HookEvent {\n return check.on ?? \"before_done\";\n}\n\n/** A check's behavior kind, derived from which behavior field is set. */\nexport type CheckBehavior = \"cmd\" | \"prompt\" | \"inject\";\n\nexport function checkBehavior(check: CheckDef): CheckBehavior {\n if (check.cmd !== undefined) return \"cmd\";\n if (check.inject !== undefined) return \"inject\";\n return \"prompt\";\n}\n\n// ─── Top-level config ─────────────────────────────────────────────────────────\n\nexport interface HoldpointContext {\n guides: Record<string, string>;\n}\n\nexport interface HoldpointConfig {\n version: number;\n context: HoldpointContext;\n conditions: ConditionDef[];\n /** All checks — each has `on`, optional `when`, and either `cmd` (task) or `prompt` (agent instruction). */\n checks: CheckDef[];\n /**\n * Named regex patterns for use in `when:` fields.\n * Keys are human-readable names (e.g. \"checks-file\", \"api-routes\").\n * Values are regex strings matched against changed file paths.\n * Built-in scope names (frontend, backend, structural, etc.) cannot be overridden here.\n */\n patterns?: Record<string, string>;\n /**\n * Files to inject as `additionalContext` at the start of every agent session.\n * Paths are repo-root-relative. Useful for injecting MASTER_PROMPT.md, AGENT_CONTEXT.md, etc.\n */\n session_context_files?: string[];\n /**\n * Inject the current date and time into every prompt submission as `additionalContext`.\n * Helps models avoid knowledge-cutoff confusion. Defaults to `true`; set to `false` to opt out.\n */\n inject_datetime?: boolean;\n /**\n * Per-engine overrides. Values here win over engine defaults — useful when the\n * project IS the holdpoint repo and should invoke the local CLI instead of npx.\n */\n engines?: {\n claude?: { stop_command?: string; live_command?: string };\n codex?: { stop_command?: string };\n copilot?: { check_command?: string };\n };\n}\n\n// ─── Runtime result types ────────────────────────────────────────────────────\n\nexport type CheckStatus = \"pass\" | \"fail\" | \"skip\" | \"pending\";\n\nexport interface CheckResult {\n check: CheckDef;\n status: CheckStatus;\n /** stdout/stderr from a deterministic check */\n output?: string;\n /** Exit code from a deterministic check */\n exitCode?: number;\n /** Human-readable reason for skip */\n skipReason?: string;\n}\n\nexport interface ValidationError {\n path: string;\n message: string;\n}\n\nexport interface ValidationResult {\n valid: boolean;\n errors: ValidationError[];\n}\n\n// ─── Agent detection ─────────────────────────────────────────────────────────\n\nexport type AgentType = \"copilot\" | \"claude\" | \"cursor\" | \"codex\" | \"unknown\";\n\n// ─── Check run report types ────────────────────────────────────────────────────\n\n/** Result of a single check within a run (cmd or prompt). */\nexport interface CheckRunResult {\n id: string;\n label: string;\n /** \"cmd\" for automated checks, \"prompt\" for manual agent checks */\n kind: \"cmd\" | \"prompt\";\n /** \"pass\" | \"fail\" | \"skip\" for cmd checks; \"shown\" for prompt checks displayed to agent */\n status: \"pass\" | \"fail\" | \"skip\" | \"shown\";\n output?: string;\n exitCode?: number;\n skipReason?: string;\n}\n\n/** A single holdpoint check run recorded after `holdpoint check` completes. */\nexport interface CheckRun {\n /** Full HEAD commit SHA, or null if not in a git repo / no commits. */\n sha: string | null;\n /** First 8 chars of sha, or null. */\n shortSha: string | null;\n /** ISO 8601 timestamp. */\n timestamp: string;\n /** Changed files used for trigger matching. Empty array means \"all checks ran\". */\n files: string[];\n results: CheckRunResult[];\n summary: { passed: number; failed: number; skipped: number; shown: number };\n}\n\n/** Contents of `.holdpoint/check-reports.json` — list of recent check runs. */\nexport interface CheckReports {\n /** Runs ordered newest-first. Capped at 50 entries. */\n runs: CheckRun[];\n}\n"],"mappings":";AAuBO,IAAM,cAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA4EO,SAAS,UAAU,OAA4B;AACpD,SAAO,MAAM,MAAM;AACrB;AAKO,SAAS,cAAc,OAAgC;AAC5D,MAAI,MAAM,QAAQ,OAAW,QAAO;AACpC,MAAI,MAAM,WAAW,OAAW,QAAO;AACvC,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@holdpoint/types",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.10",
4
4
  "publishConfig": {
5
- "access": "public",
6
- "tag": "alpha"
5
+ "access": "public"
7
6
  },
8
7
  "description": "Shared TypeScript types for Holdpoint",
9
8
  "homepage": "https://holdpoint.dev",
@@ -44,7 +43,7 @@
44
43
  ],
45
44
  "devDependencies": {
46
45
  "tsup": "^8.3.5",
47
- "typescript": "^5.7.2"
46
+ "typescript": "^6.0.3"
48
47
  },
49
48
  "scripts": {
50
49
  "build": "tsup",