mini-trellis 0.1.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/COPYRIGHT +20 -0
- package/LICENSE +235 -0
- package/README.md +66 -0
- package/bin/mini-trellis.js +3 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +153 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/init.d.ts +19 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +401 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mem.d.ts +30 -0
- package/dist/commands/mem.d.ts.map +1 -0
- package/dist/commands/mem.js +412 -0
- package/dist/commands/mem.js.map +1 -0
- package/dist/commands/migrate.d.ts +40 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +272 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/uninstall.d.ts +11 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +135 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/upgrade.d.ts +28 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +84 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/configurators/claude.d.ts +3 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +62 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/codex.d.ts +3 -0
- package/dist/configurators/codex.d.ts.map +1 -0
- package/dist/configurators/codex.js +21 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/index.d.ts +24 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +80 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/opencode.d.ts +2 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +62 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/pi.d.ts +2 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +18 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/shared.d.ts +147 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +377 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/workflow.d.ts +15 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +46 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +74 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +83 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/claude/index.d.ts +11 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +17 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +40 -0
- package/dist/templates/codex/config.toml +39 -0
- package/dist/templates/codex/hooks.json +15 -0
- package/dist/templates/codex/index.d.ts +11 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +22 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/common/bundled-skills/mini-trellis-session-insight/SKILL.md +37 -0
- package/dist/templates/common/bundled-skills/mini-trellis-session-insight/references/cli-quick-reference.md +36 -0
- package/dist/templates/common/bundled-skills/mini-trellis-session-insight/references/triggering-patterns.md +93 -0
- package/dist/templates/common/commands/remember.md +22 -0
- package/dist/templates/common/index.d.ts +48 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +104 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/skills/update-spec.md +16 -0
- package/dist/templates/extract.d.ts +40 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +106 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/markdown/agents.md +15 -0
- package/dist/templates/markdown/index.d.ts +10 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +18 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/research-readme.md +9 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +5 -0
- package/dist/templates/markdown/spec/guides/mini-memory.md.txt +30 -0
- package/dist/templates/markdown/workspace-index.md +23 -0
- package/dist/templates/opencode/lib/context-visibility.js +148 -0
- package/dist/templates/opencode/lib/session-utils.js +394 -0
- package/dist/templates/opencode/lib/trellis-context.js +627 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugins/session-start.js +65 -0
- package/dist/templates/pi/extensions/mini-trellis/index.ts.txt +170 -0
- package/dist/templates/pi/index.d.ts +4 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +9 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +9 -0
- package/dist/templates/shared-hooks/index.d.ts +13 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +26 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/session-start.py +676 -0
- package/dist/templates/template-utils.d.ts +26 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +64 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/templates/trellis/config.yaml +34 -0
- package/dist/templates/trellis/gitattributes.txt +9 -0
- package/dist/templates/trellis/gitignore.txt +32 -0
- package/dist/templates/trellis/index.d.ts +8 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +16 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +1545 -0
- package/dist/templates/trellis/scripts/common/__init__.py +94 -0
- package/dist/templates/trellis/scripts/common/active_task.py +855 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +950 -0
- package/dist/templates/trellis/scripts/common/config.py +482 -0
- package/dist/templates/trellis/scripts/common/developer.py +192 -0
- package/dist/templates/trellis/scripts/common/git.py +203 -0
- package/dist/templates/trellis/scripts/common/git_context.py +106 -0
- package/dist/templates/trellis/scripts/common/io.py +160 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
- package/dist/templates/trellis/scripts/common/paths.py +543 -0
- package/dist/templates/trellis/scripts/common/safe_commit.py +322 -0
- package/dist/templates/trellis/scripts/common/session_context.py +708 -0
- package/dist/templates/trellis/scripts/common/task_context.py +470 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
- package/dist/templates/trellis/scripts/common/task_store.py +1930 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +498 -0
- package/dist/templates/trellis/scripts/common/tasks.py +122 -0
- package/dist/templates/trellis/scripts/common/trellis_config.py +239 -0
- package/dist/templates/trellis/scripts/common/types.py +110 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +242 -0
- package/dist/templates/trellis/scripts/get_context.py +16 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/types/ai-tools.d.ts +30 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +89 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/utils/atomic-write.d.ts +12 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +30 -0
- package/dist/utils/atomic-write.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +204 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/managed-paths.d.ts +5 -0
- package/dist/utils/managed-paths.d.ts.map +1 -0
- package/dist/utils/managed-paths.js +51 -0
- package/dist/utils/managed-paths.js.map +1 -0
- package/dist/utils/managed-removal.d.ts +42 -0
- package/dist/utils/managed-removal.d.ts.map +1 -0
- package/dist/utils/managed-removal.js +223 -0
- package/dist/utils/managed-removal.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +66 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +417 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
|
|
5
|
+
type JsonObject = Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
interface PiExtensionContext {
|
|
8
|
+
ui?: {
|
|
9
|
+
notify?: (msg: string, type?: "info" | "warning" | "error") => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function exists(p: string): boolean {
|
|
14
|
+
try {
|
|
15
|
+
return existsSync(p);
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function findRoot(start: string): string {
|
|
22
|
+
let dir = start;
|
|
23
|
+
for (let i = 0; i < 12; i++) {
|
|
24
|
+
if (exists(join(dir, ".trellis"))) return dir;
|
|
25
|
+
const parent = dirname(dir);
|
|
26
|
+
if (parent === dir) break;
|
|
27
|
+
dir = parent;
|
|
28
|
+
}
|
|
29
|
+
return start;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function collectResearchTopics(root: string): string[] {
|
|
33
|
+
const researchDir = join(root, ".trellis", "research");
|
|
34
|
+
if (!exists(researchDir)) return [];
|
|
35
|
+
try {
|
|
36
|
+
return readdirSync(researchDir)
|
|
37
|
+
.filter((name) => {
|
|
38
|
+
if (name.startsWith(".") || name.toLowerCase() === "readme.md") return false;
|
|
39
|
+
try {
|
|
40
|
+
return statSync(join(researchDir, name)).isFile() && name.toLowerCase().endsWith(".md");
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
.sort()
|
|
46
|
+
.map((name) => `.trellis/research/${name}`);
|
|
47
|
+
} catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function collectSpecIndexPaths(root: string): string[] {
|
|
53
|
+
const specDir = join(root, ".trellis", "spec");
|
|
54
|
+
const paths: string[] = [];
|
|
55
|
+
const guidesIndex = join(specDir, "guides", "index.md");
|
|
56
|
+
if (exists(guidesIndex)) paths.push(".trellis/spec/guides/index.md");
|
|
57
|
+
if (!exists(specDir)) return paths;
|
|
58
|
+
try {
|
|
59
|
+
for (const sub of readdirSync(specDir).sort()) {
|
|
60
|
+
if (sub.startsWith(".") || sub === "guides") continue;
|
|
61
|
+
const indexFile = join(specDir, sub, "index.md");
|
|
62
|
+
if (exists(indexFile)) paths.push(`.trellis/spec/${sub}/index.md`);
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
// ignore
|
|
66
|
+
}
|
|
67
|
+
return paths;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readDeveloper(root: string): string | null {
|
|
71
|
+
try {
|
|
72
|
+
const p = join(root, ".trellis", ".developer");
|
|
73
|
+
if (!exists(p)) return null;
|
|
74
|
+
const name = readFileSync(p, "utf-8").trim();
|
|
75
|
+
return name || null;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function activeJournal(root: string): string | null {
|
|
82
|
+
const developer = readDeveloper(root);
|
|
83
|
+
if (!developer) return null;
|
|
84
|
+
const workspaceDir = join(root, ".trellis", "workspace", developer);
|
|
85
|
+
if (!exists(workspaceDir)) return null;
|
|
86
|
+
try {
|
|
87
|
+
const journals = readdirSync(workspaceDir)
|
|
88
|
+
.filter((name) => /^journal-\d+\.md$/.test(name))
|
|
89
|
+
.sort(
|
|
90
|
+
(a, b) =>
|
|
91
|
+
Number(a.match(/\d+/)?.[0] || 0) - Number(b.match(/\d+/)?.[0] || 0),
|
|
92
|
+
);
|
|
93
|
+
const journal = journals[journals.length - 1];
|
|
94
|
+
return journal ? `.trellis/workspace/${developer}/${journal}` : null;
|
|
95
|
+
} catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function buildStartupContext(root: string): string {
|
|
101
|
+
const spec = collectSpecIndexPaths(root);
|
|
102
|
+
const research = collectResearchTopics(root);
|
|
103
|
+
const journal = activeJournal(root);
|
|
104
|
+
const lines: string[] = [
|
|
105
|
+
"<session-context>",
|
|
106
|
+
"mini-trellis SessionStart context. Orient from journal, spec, and research.",
|
|
107
|
+
"</session-context>",
|
|
108
|
+
"",
|
|
109
|
+
"<current-state>",
|
|
110
|
+
];
|
|
111
|
+
if (journal) lines.push(`Journal: ${journal}`);
|
|
112
|
+
if (spec.length) lines.push(`Spec indexes: ${spec.length} available.`);
|
|
113
|
+
lines.push(
|
|
114
|
+
research.length
|
|
115
|
+
? `Research notes: ${research.length} in .trellis/research/.`
|
|
116
|
+
: "Research notes: none yet. Write .trellis/research/<topic>.md.",
|
|
117
|
+
);
|
|
118
|
+
lines.push("</current-state>", "", "<guidelines>");
|
|
119
|
+
lines.push(
|
|
120
|
+
"Memory: journal is git-durable session notes (`/mini-trellis-remember` or `python3 ./.trellis/scripts/add_session.py`). Cross-session dialogue is `mini-trellis mem list|search|context|extract`.",
|
|
121
|
+
"Research lives in `.trellis/research/<topic>.md`; promote durable boundaries into `.trellis/spec/` as short markdown.",
|
|
122
|
+
);
|
|
123
|
+
if (spec.length) {
|
|
124
|
+
lines.push("", "## Spec indexes (read on demand)");
|
|
125
|
+
for (const p of spec) lines.push(`- ${p}`);
|
|
126
|
+
}
|
|
127
|
+
if (research.length) {
|
|
128
|
+
lines.push("", "## Research notes (read on demand)");
|
|
129
|
+
for (const p of research) lines.push(`- ${p}`);
|
|
130
|
+
}
|
|
131
|
+
lines.push(
|
|
132
|
+
"</guidelines>",
|
|
133
|
+
"",
|
|
134
|
+
"<ready>",
|
|
135
|
+
"Context loaded. Use journal, spec, research, and `mini-trellis mem` on demand. Remember at session end or after compact.",
|
|
136
|
+
"</ready>",
|
|
137
|
+
);
|
|
138
|
+
return lines.join("\n");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default function trellisExtension(pi: {
|
|
142
|
+
on?: (
|
|
143
|
+
event: string,
|
|
144
|
+
handler: (event: unknown, ctx?: PiExtensionContext) => unknown,
|
|
145
|
+
) => void;
|
|
146
|
+
}): void {
|
|
147
|
+
if (process.env.TRELLIS_SUBAGENT_CHILD === "1") return;
|
|
148
|
+
const root = findRoot(process.cwd() || homedir());
|
|
149
|
+
const startup = buildStartupContext(root);
|
|
150
|
+
|
|
151
|
+
pi.on?.("session_start", (_event, ctx) => {
|
|
152
|
+
ctx?.ui?.notify?.(
|
|
153
|
+
"mini-trellis context is available. Use /mini-trellis-remember to persist journal notes.",
|
|
154
|
+
"info",
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
pi.on?.("before_agent_start", (event) => {
|
|
159
|
+
const cur = (event as { systemPrompt?: string }).systemPrompt ?? "";
|
|
160
|
+
return {
|
|
161
|
+
systemPrompt: [cur, startup].filter(Boolean).join("\n\n"),
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
pi.on?.("context", () => {
|
|
166
|
+
// keep extension loaded; no extra injection
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
void (0 as unknown as JsonObject);
|
|
170
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/pi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI/E,wBAAgB,mBAAmB,IAAI,YAAY,CAElD;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createTemplateReader } from "../template-utils.js";
|
|
2
|
+
const { getSettings, readTemplate } = createTemplateReader(import.meta.url);
|
|
3
|
+
export function getSettingsTemplate() {
|
|
4
|
+
return getSettings();
|
|
5
|
+
}
|
|
6
|
+
export function getExtensionTemplate() {
|
|
7
|
+
return readTemplate("extensions/mini-trellis/index.ts.txt");
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/pi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;AAE/E,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5E,MAAM,UAAU,mBAAmB;IACjC,OAAO,WAAW,EAAE,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,YAAY,CAAC,sCAAsC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared hook templates — SessionStart only for mini-trellis v1.
|
|
3
|
+
*/
|
|
4
|
+
export interface HookScript {
|
|
5
|
+
name: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
export type SharedHookName = "session-start.py";
|
|
9
|
+
export type SharedHookPlatform = "claude" | "codex";
|
|
10
|
+
export declare const SHARED_HOOKS_BY_PLATFORM: Record<SharedHookPlatform, readonly SharedHookName[]>;
|
|
11
|
+
export declare function getSharedHookScripts(): HookScript[];
|
|
12
|
+
export declare function getSharedHookScriptsForPlatform(platform: SharedHookPlatform): HookScript[];
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,kBAAkB,EAClB,SAAS,cAAc,EAAE,CAI1B,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAKnD;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAGd"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared hook templates — SessionStart only for mini-trellis v1.
|
|
3
|
+
*/
|
|
4
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
function readTemplate(relativePath) {
|
|
10
|
+
return readFileSync(join(__dirname, relativePath), "utf-8");
|
|
11
|
+
}
|
|
12
|
+
export const SHARED_HOOKS_BY_PLATFORM = {
|
|
13
|
+
claude: ["session-start.py"],
|
|
14
|
+
codex: ["session-start.py"],
|
|
15
|
+
};
|
|
16
|
+
export function getSharedHookScripts() {
|
|
17
|
+
return readdirSync(__dirname)
|
|
18
|
+
.filter((f) => f.endsWith(".py"))
|
|
19
|
+
.sort()
|
|
20
|
+
.map((file) => ({ name: file, content: readTemplate(file) }));
|
|
21
|
+
}
|
|
22
|
+
export function getSharedHookScriptsForPlatform(platform) {
|
|
23
|
+
const allowed = new Set(SHARED_HOOKS_BY_PLATFORM[platform]);
|
|
24
|
+
return getSharedHookScripts().filter((h) => allowed.has(h.name));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAWD,MAAM,CAAC,MAAM,wBAAwB,GAGjC;IACF,MAAM,EAAE,CAAC,kBAAkB,CAAC;IAC5B,KAAK,EAAE,CAAC,kBAAkB,CAAC;CAC5B,CAAC;AAEF,MAAM,UAAU,oBAAoB;IAClC,OAAO,WAAW,CAAC,SAAS,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,QAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|