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 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/configurators/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,gBAAgB,GAAG;IACvB,OAAO;IACP,WAAW;IACX,KAAK;IACL,SAAS;IACT,KAAK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cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AI_TOOLS } from "../types/ai-tools.js";
|
|
2
|
+
import { getConfigTemplate, getHooksConfig } from "../templates/codex/index.js";
|
|
3
|
+
import { resolvePlaceholders, resolveAllAsSkillsNeutral, resolveBundledSkills, collectSkillTemplates, collectSharedHooks, writeTemplateMap, } from "./shared.js";
|
|
4
|
+
export function collectCodexTemplates() {
|
|
5
|
+
const files = new Map();
|
|
6
|
+
const ctx = AI_TOOLS.codex.templateContext;
|
|
7
|
+
for (const [filePath, content] of collectSkillTemplates(".agents/skills", resolveAllAsSkillsNeutral(ctx), resolveBundledSkills(ctx))) {
|
|
8
|
+
files.set(filePath, content);
|
|
9
|
+
}
|
|
10
|
+
for (const [k, v] of collectSharedHooks(".codex/hooks", "codex")) {
|
|
11
|
+
files.set(k, v);
|
|
12
|
+
}
|
|
13
|
+
files.set(".codex/hooks.json", resolvePlaceholders(getHooksConfig()));
|
|
14
|
+
const config = getConfigTemplate();
|
|
15
|
+
files.set(`.codex/${config.targetPath}`, config.content);
|
|
16
|
+
return files;
|
|
17
|
+
}
|
|
18
|
+
export async function configureCodex(cwd) {
|
|
19
|
+
await writeTemplateMap(cwd, collectCodexTemplates());
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/configurators/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,qBAAqB;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;IAE3C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,qBAAqB,CACrD,gBAAgB,EAChB,yBAAyB,CAAC,GAAG,CAAC,EAC9B,oBAAoB,CAAC,GAAG,CAAC,CAC1B,EAAE,CAAC;QACF,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,EAAE,CAAC;QACjE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,KAAK,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,MAAM,gBAAgB,CAAC,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Registry — mini-trellis v1: claude, codex, opencode, pi.
|
|
3
|
+
*/
|
|
4
|
+
import { type AITool, type CliFlag } from "../types/ai-tools.js";
|
|
5
|
+
import { type PlatformConfigureOptions } from "./shared.js";
|
|
6
|
+
export declare const PLATFORM_IDS: AITool[];
|
|
7
|
+
export declare const CONFIG_DIRS: string[];
|
|
8
|
+
export declare const PLATFORM_MANAGED_DIRS: string[];
|
|
9
|
+
export declare const ALL_MANAGED_DIRS: string[];
|
|
10
|
+
export declare function getConfiguredPlatforms(cwd: string): Set<AITool>;
|
|
11
|
+
export declare function getPlatformsWithPythonHooks(): AITool[];
|
|
12
|
+
export declare function isManagedPath(dirPath: string): boolean;
|
|
13
|
+
export declare function isManagedRootDir(dirName: string): boolean;
|
|
14
|
+
export declare function getPlatformManagedPaths(platformId: AITool): string[];
|
|
15
|
+
export declare function configurePlatform(platformId: AITool, cwd: string, options?: PlatformConfigureOptions): Promise<void>;
|
|
16
|
+
export declare function collectPlatformTemplates(platformId: AITool): Map<string, string> | undefined;
|
|
17
|
+
export declare function getInitToolChoices(): {
|
|
18
|
+
key: CliFlag;
|
|
19
|
+
name: string;
|
|
20
|
+
defaultChecked: boolean;
|
|
21
|
+
platformId: AITool;
|
|
22
|
+
}[];
|
|
23
|
+
export declare function resolveCliFlag(flag: string): AITool | undefined;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configurators/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AA0B9E,eAAO,MAAM,YAAY,EAA4B,MAAM,EAAE,CAAC;AAE9D,eAAO,MAAM,WAAW,UAAmD,CAAC;AAE5E,eAAO,MAAM,qBAAqB,UAEjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAkD,CAAC;AAYhF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAS/D;AAED,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAKtD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpE;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEjC;AAED,wBAAgB,kBAAkB,IAAI;IACpC,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,EAAE,CAOF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Registry — mini-trellis v1: claude, codex, opencode, pi.
|
|
3
|
+
*/
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { AI_TOOLS, getManagedPaths, } from "../types/ai-tools.js";
|
|
7
|
+
import { collectClaudeTemplates, configureClaude } from "./claude.js";
|
|
8
|
+
import { collectOpenCodeTemplates } from "./opencode.js";
|
|
9
|
+
import { collectCodexTemplates, configureCodex } from "./codex.js";
|
|
10
|
+
import { collectPiTemplates } from "./pi.js";
|
|
11
|
+
import { writeTemplateMap } from "./shared.js";
|
|
12
|
+
function fromTemplates(collectTemplates) {
|
|
13
|
+
return {
|
|
14
|
+
configure: (cwd) => writeTemplateMap(cwd, collectTemplates()),
|
|
15
|
+
collectTemplates,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const PLATFORM_FUNCTIONS = {
|
|
19
|
+
"claude-code": {
|
|
20
|
+
configure: configureClaude,
|
|
21
|
+
collectTemplates: collectClaudeTemplates,
|
|
22
|
+
},
|
|
23
|
+
opencode: fromTemplates(collectOpenCodeTemplates),
|
|
24
|
+
codex: { configure: configureCodex, collectTemplates: collectCodexTemplates },
|
|
25
|
+
pi: fromTemplates(collectPiTemplates),
|
|
26
|
+
};
|
|
27
|
+
export const PLATFORM_IDS = Object.keys(AI_TOOLS);
|
|
28
|
+
export const CONFIG_DIRS = PLATFORM_IDS.map((id) => AI_TOOLS[id].configDir);
|
|
29
|
+
export const PLATFORM_MANAGED_DIRS = PLATFORM_IDS.flatMap((id) => getManagedPaths(id));
|
|
30
|
+
export const ALL_MANAGED_DIRS = [".trellis", ...new Set(PLATFORM_MANAGED_DIRS)];
|
|
31
|
+
const DETECT_FILES = {
|
|
32
|
+
"claude-code": [
|
|
33
|
+
".claude/hooks/session-start.py",
|
|
34
|
+
".claude/commands/mini-trellis/remember.md",
|
|
35
|
+
],
|
|
36
|
+
codex: [".codex/hooks.json", ".codex/hooks/session-start.py"],
|
|
37
|
+
opencode: [".opencode/plugins/session-start.js"],
|
|
38
|
+
pi: [".pi/extensions/mini-trellis/index.ts", ".pi/settings.json"],
|
|
39
|
+
};
|
|
40
|
+
export function getConfiguredPlatforms(cwd) {
|
|
41
|
+
const platforms = new Set();
|
|
42
|
+
for (const id of PLATFORM_IDS) {
|
|
43
|
+
const hits = DETECT_FILES[id];
|
|
44
|
+
if (hits.some((rel) => fs.existsSync(path.join(cwd, rel)))) {
|
|
45
|
+
platforms.add(id);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return platforms;
|
|
49
|
+
}
|
|
50
|
+
export function getPlatformsWithPythonHooks() {
|
|
51
|
+
return PLATFORM_IDS.filter((id) => AI_TOOLS[id].hasPythonHooks);
|
|
52
|
+
}
|
|
53
|
+
export function isManagedPath(dirPath) {
|
|
54
|
+
const normalized = dirPath.replace(/\\/g, "/");
|
|
55
|
+
return ALL_MANAGED_DIRS.some((d) => normalized.startsWith(d + "/") || normalized === d);
|
|
56
|
+
}
|
|
57
|
+
export function isManagedRootDir(dirName) {
|
|
58
|
+
return ALL_MANAGED_DIRS.includes(dirName);
|
|
59
|
+
}
|
|
60
|
+
export function getPlatformManagedPaths(platformId) {
|
|
61
|
+
return getManagedPaths(platformId);
|
|
62
|
+
}
|
|
63
|
+
export function configurePlatform(platformId, cwd, options) {
|
|
64
|
+
return PLATFORM_FUNCTIONS[platformId].configure(cwd, options);
|
|
65
|
+
}
|
|
66
|
+
export function collectPlatformTemplates(platformId) {
|
|
67
|
+
return PLATFORM_FUNCTIONS[platformId].collectTemplates?.();
|
|
68
|
+
}
|
|
69
|
+
export function getInitToolChoices() {
|
|
70
|
+
return PLATFORM_IDS.map((id) => ({
|
|
71
|
+
key: AI_TOOLS[id].cliFlag,
|
|
72
|
+
name: AI_TOOLS[id].name,
|
|
73
|
+
defaultChecked: AI_TOOLS[id].defaultChecked,
|
|
74
|
+
platformId: id,
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
export function resolveCliFlag(flag) {
|
|
78
|
+
return PLATFORM_IDS.find((id) => AI_TOOLS[id].cliFlag === flag);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configurators/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,S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AC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,UAAkB;IAElB,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,kBAAkB;IAMhC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/B,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO;QACzB,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI;QACvB,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,cAAc;QAC3C,UAAU,EAAE,EAAE;KACf,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/configurators/opencode.ts"],"names":[],"mappings":"AAqEA,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAc9D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { AI_TOOLS } from "../types/ai-tools.js";
|
|
4
|
+
import { getOpenCodeTemplatePath } from "../templates/extract.js";
|
|
5
|
+
import { toPosix } from "../utils/posix.js";
|
|
6
|
+
import { collectSkillTemplates, replacePythonCommandLiterals, resolveBundledSkills, resolveCommands, resolveSkills, } from "./shared.js";
|
|
7
|
+
const EXCLUDE_PATTERNS = [
|
|
8
|
+
".d.ts",
|
|
9
|
+
".d.ts.map",
|
|
10
|
+
".js.map",
|
|
11
|
+
"__pycache__",
|
|
12
|
+
"node_modules",
|
|
13
|
+
"bun.lock",
|
|
14
|
+
".gitignore",
|
|
15
|
+
];
|
|
16
|
+
function shouldExclude(filename) {
|
|
17
|
+
return EXCLUDE_PATTERNS.some((pattern) => filename.endsWith(pattern) || filename === pattern);
|
|
18
|
+
}
|
|
19
|
+
function walkOpenCodeTemplateDir() {
|
|
20
|
+
const files = new Map();
|
|
21
|
+
const sourcePath = getOpenCodeTemplatePath();
|
|
22
|
+
function walk(relDir) {
|
|
23
|
+
const absDir = path.join(sourcePath, relDir);
|
|
24
|
+
for (const entry of readdirSync(absDir)) {
|
|
25
|
+
if (shouldExclude(entry))
|
|
26
|
+
continue;
|
|
27
|
+
const absEntry = path.join(absDir, entry);
|
|
28
|
+
const relEntry = relDir ? path.join(relDir, entry) : entry;
|
|
29
|
+
const stat = statSync(absEntry);
|
|
30
|
+
if (stat.isDirectory()) {
|
|
31
|
+
if (relEntry === "commands" ||
|
|
32
|
+
relEntry === "agents" ||
|
|
33
|
+
relEntry === path.join("plugins", "inject-subagent-context.js")) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
walk(relEntry);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
if (relEntry.endsWith("inject-subagent-context.js") ||
|
|
40
|
+
relEntry.endsWith("inject-workflow-state.js")) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const content = readFileSync(absEntry, "utf-8");
|
|
44
|
+
files.set(toPosix(path.join(".opencode", relEntry)), replacePythonCommandLiterals(content));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
walk("");
|
|
49
|
+
return files;
|
|
50
|
+
}
|
|
51
|
+
export function collectOpenCodeTemplates() {
|
|
52
|
+
const files = walkOpenCodeTemplateDir();
|
|
53
|
+
const ctx = AI_TOOLS.opencode.templateContext;
|
|
54
|
+
for (const cmd of resolveCommands(ctx)) {
|
|
55
|
+
files.set(`.opencode/commands/mini-trellis/${cmd.name}.md`, cmd.content);
|
|
56
|
+
}
|
|
57
|
+
for (const [filePath, content] of collectSkillTemplates(".opencode/skills", resolveSkills(ctx), resolveBundledSkills(ctx))) {
|
|
58
|
+
files.set(filePath, content);
|
|
59
|
+
}
|
|
60
|
+
return files;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=opencode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/configurators/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,eAAe,EACf,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,MAAM,gBAAgB,GAAG;IACvB,OAAO;IACP,WAAW;IACX,SAAS;IACT,aAAa;IACb,cAAc;IACd,UAAU;IACV,YAAY;CACb,CAAC;AAEF,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,gBAAgB,CAAC,IAAI,CAC1B,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,KAAK,OAAO,CAChE,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB;IAC9B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,UAAU,GAAG,uBAAuB,EAAE,CAAC;IAE7C,SAAS,IAAI,CAAC,MAAc;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;Q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Ae,CAAC;IAC9C,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,KAAK,CAAC,GAAG,CAAC,mCAAmC,GAAG,CAAC,IAAI,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3E,CAAC;IACD,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,qBAAqB,CACrD,kBAAkB,EAClB,aAAa,CAAC,GAAG,CAAC,EAClB,oBAAoB,CAAC,GAAG,CAAC,CAC1B,EAAE,CAAC;QACF,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/configurators/pi.ts"],"names":[],"mappings":"AAaA,wBAAgB,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AI_TOOLS } from "../types/ai-tools.js";
|
|
2
|
+
import { collectSkillTemplates, resolveCommands, resolveBundledSkills, resolvePlaceholders, resolveSkillsNeutral, } from "./shared.js";
|
|
3
|
+
import { getExtensionTemplate, getSettingsTemplate, } from "../templates/pi/index.js";
|
|
4
|
+
export function collectPiTemplates() {
|
|
5
|
+
const files = new Map();
|
|
6
|
+
const ctx = AI_TOOLS.pi.templateContext;
|
|
7
|
+
for (const command of resolveCommands(ctx)) {
|
|
8
|
+
files.set(`.pi/prompts/mini-trellis-${command.name}.md`, command.content);
|
|
9
|
+
}
|
|
10
|
+
for (const [filePath, content] of collectSkillTemplates(".agents/skills", resolveSkillsNeutral(ctx), resolveBundledSkills(ctx))) {
|
|
11
|
+
files.set(filePath, content);
|
|
12
|
+
}
|
|
13
|
+
files.set(".pi/extensions/mini-trellis/index.ts", getExtensionTemplate());
|
|
14
|
+
const settings = getSettingsTemplate();
|
|
15
|
+
files.set(`.pi/${settings.targetPath}`, resolvePlaceholders(settings.content));
|
|
16
|
+
return files;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=pi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/configurators/pi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,eAAe,CAAC;IAExC,KAAK,MAAM,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,KAAK,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,IAAI,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,qBAAqB,CACrD,gBAAgB,EAChB,oBAAoB,CAAC,GAAG,CAAC,EACzB,oBAAoB,CAAC,GAAG,CAAC,CAC1B,EAAE,CAAC;QACF,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,sCAAsC,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAE1E,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,KAAK,CAAC,GAAG,CACP,OAAO,QAAQ,CAAC,UAAU,EAAE,EAC5B,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CACtC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for platform configurators.
|
|
3
|
+
*
|
|
4
|
+
* Extracted here to avoid circular dependencies (index.ts imports configurators,
|
|
5
|
+
* configurators cannot import from index.ts).
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateContext } from "../types/ai-tools.js";
|
|
8
|
+
/**
|
|
9
|
+
* Per-platform configure options threaded from `trellis init` flags.
|
|
10
|
+
* Defined here (not in index.ts) so configurators can reference it without
|
|
11
|
+
* a circular import.
|
|
12
|
+
*/
|
|
13
|
+
export type PlatformConfigureOptions = Record<string, never>;
|
|
14
|
+
export declare function setResolvedPythonCommand(cmd: string): void;
|
|
15
|
+
/** Test helper — clear the resolved cache between unit tests. */
|
|
16
|
+
export declare function resetResolvedPythonCommand(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the Python command for the host platform.
|
|
19
|
+
*
|
|
20
|
+
* Returns the resolved command if `setResolvedPythonCommand` has been called;
|
|
21
|
+
* otherwise the static platform default — Windows: `python`, others:
|
|
22
|
+
* `python3`. Pass an explicit `platform` arg only for unit tests (it bypasses
|
|
23
|
+
* the resolved cache).
|
|
24
|
+
*/
|
|
25
|
+
export declare function getPythonCommandForPlatform(platform?: NodeJS.Platform): string;
|
|
26
|
+
/**
|
|
27
|
+
* Replace literal `python3` with the resolved Python command, excluding
|
|
28
|
+
* shebang lines.
|
|
29
|
+
*
|
|
30
|
+
* Applied at init/update write time so that all file types (including .py,
|
|
31
|
+
* .md, .toml, .json) get the correct command for the host platform without
|
|
32
|
+
* template-level changes.
|
|
33
|
+
*
|
|
34
|
+
* No-op when the resolved command is `python3` (the template default).
|
|
35
|
+
* Idempotent: running it twice produces the same result.
|
|
36
|
+
*/
|
|
37
|
+
export declare function replacePythonCommandLiterals(content: string): string;
|
|
38
|
+
export declare function resolvePlaceholders(content: string, context?: TemplateContext): string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve placeholders for files written under `.agents/skills/` (the shared
|
|
41
|
+
* Agent Skills directory consumed by multiple platforms via the upstream
|
|
42
|
+
* `.agents/skills/` workspace alias — Codex, Gemini CLI 0.40+, etc.).
|
|
43
|
+
*
|
|
44
|
+
* Identical to {@link resolvePlaceholders} except that {@link CMD_REF} is
|
|
45
|
+
* rendered in a platform-neutral form (`` `name` (Trellis command) ``)
|
|
46
|
+
* instead of substituting a platform-specific prefix. This is the only
|
|
47
|
+
* placeholder that varies between platforms in the auto-triggered skill templates
|
|
48
|
+
* from `common/skills/`, so
|
|
49
|
+
* neutralizing it makes the rendered SKILL.md files byte-identical regardless
|
|
50
|
+
* of which Trellis configurator wrote them — eliminating the
|
|
51
|
+
* "last-writer-wins" collision when both Codex and Gemini target
|
|
52
|
+
* `.agents/skills/`.
|
|
53
|
+
*
|
|
54
|
+
* `{{CLI_FLAG}}`, `{{EXECUTOR_AI}}`, `{{USER_ACTION_LABEL}}`, conditionals,
|
|
55
|
+
* and `{{PYTHON_CMD}}` are still resolved from the platform context. The
|
|
56
|
+
* shared skills do not use those placeholders, so they remain platform-
|
|
57
|
+
* neutral. Codex-only skill files (e.g. `trellis-continue/SKILL.md`,
|
|
58
|
+
* `trellis-finish-work/SKILL.md` written via `resolveAllAsSkillsNeutral`) DO
|
|
59
|
+
* use `{{CLI_FLAG}}` / `{{PYTHON_CMD}}` and resolve to Codex-correct values
|
|
60
|
+
* — no other platform writes those files, so byte-identity is not required.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolvePlaceholdersNeutral(content: string, context?: TemplateContext): string;
|
|
63
|
+
/**
|
|
64
|
+
* Wrap resolved template content with YAML frontmatter for skill format.
|
|
65
|
+
* Used by platforms that use SKILL.md (Codex, Kiro, Qoder, etc.).
|
|
66
|
+
*/
|
|
67
|
+
export declare function wrapWithSkillFrontmatter(name: string, content: string): string;
|
|
68
|
+
/** Wrap resolved command content with YAML frontmatter (name + description). */
|
|
69
|
+
export declare function wrapWithCommandFrontmatter(name: string, content: string): string;
|
|
70
|
+
import { type SharedHookPlatform } from "../templates/shared-hooks/index.js";
|
|
71
|
+
/** A resolved template ready to be written to disk. */
|
|
72
|
+
export interface ResolvedTemplate {
|
|
73
|
+
name: string;
|
|
74
|
+
content: string;
|
|
75
|
+
}
|
|
76
|
+
/** A resolved file inside a multi-file skill directory. */
|
|
77
|
+
export interface ResolvedSkillFile {
|
|
78
|
+
/** POSIX path relative to the skills root, e.g. "trellis-meta/SKILL.md" */
|
|
79
|
+
relativePath: string;
|
|
80
|
+
content: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolve ALL templates as skills with trellis- prefix.
|
|
84
|
+
* Used by skill-only platforms (Kiro, Qoder, Codex) where everything is a skill.
|
|
85
|
+
*
|
|
86
|
+
* `start` is filtered out on agent-capable platforms — the session-start hook
|
|
87
|
+
* injects the workflow overview instead.
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveAllAsSkills(ctx: TemplateContext): ResolvedTemplate[];
|
|
90
|
+
/**
|
|
91
|
+
* Resolve command templates as plain commands (no wrapping).
|
|
92
|
+
* Used by "both" platforms for the user-ritual commands.
|
|
93
|
+
*
|
|
94
|
+
* `start` is filtered out on agent-capable platforms.
|
|
95
|
+
*/
|
|
96
|
+
export declare function resolveCommands(ctx: TemplateContext): ResolvedTemplate[];
|
|
97
|
+
/**
|
|
98
|
+
* Resolve the auto-triggered skill templates from `common/skills/` with trellis- prefix + SKILL.md frontmatter.
|
|
99
|
+
* Used by "both" platforms for the auto-triggered skills.
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolveSkills(ctx: TemplateContext): ResolvedTemplate[];
|
|
102
|
+
/**
|
|
103
|
+
* Same as {@link resolveSkills} but uses {@link resolvePlaceholdersNeutral}
|
|
104
|
+
* so the rendered SKILL.md files are byte-identical across any two platforms
|
|
105
|
+
* that target `.agents/skills/`. Use this for shared `.agents/skills/`
|
|
106
|
+
* writes (Gemini); platform-private skill roots should keep
|
|
107
|
+
* {@link resolveSkills}.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveSkillsNeutral(ctx: TemplateContext): ResolvedTemplate[];
|
|
110
|
+
/**
|
|
111
|
+
* Same as {@link resolveAllAsSkills} but uses
|
|
112
|
+
* {@link resolvePlaceholdersNeutral} for the shared common skills. The 2 command
|
|
113
|
+
* templates (continue, finish-work) folded into the skill set still resolve
|
|
114
|
+
* `{{CLI_FLAG}}` / `{{PYTHON_CMD}}` per platform — only Codex writes those
|
|
115
|
+
* files into `.agents/skills/`, so byte-identity isn't required there.
|
|
116
|
+
*/
|
|
117
|
+
export declare function resolveAllAsSkillsNeutral(ctx: TemplateContext): ResolvedTemplate[];
|
|
118
|
+
/**
|
|
119
|
+
* Resolve multi-file built-in skills.
|
|
120
|
+
*
|
|
121
|
+
* Unlike workflow skills, bundled skills already contain their own SKILL.md
|
|
122
|
+
* frontmatter and may include references/assets. They are still rendered
|
|
123
|
+
* through placeholder resolution so init and update get byte-identical output.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveBundledSkills(ctx: TemplateContext): ResolvedSkillFile[];
|
|
126
|
+
/** Collect skill files under a target root for update hash tracking. */
|
|
127
|
+
export declare function collectSkillTemplates(skillsRoot: string, skills: readonly {
|
|
128
|
+
name: string;
|
|
129
|
+
content: string;
|
|
130
|
+
}[], bundledSkills?: readonly ResolvedSkillFile[]): Map<string, string>;
|
|
131
|
+
/** Apply the python3 → python rewrite to every entry of a template map. */
|
|
132
|
+
export declare function renderTemplateMap(files: Map<string, string>): Map<string, string>;
|
|
133
|
+
/**
|
|
134
|
+
* Write a collected template map into `cwd`.
|
|
135
|
+
*
|
|
136
|
+
* Renders through {@link renderTemplateMap} first — the same rewrite
|
|
137
|
+
* `collectPlatformTemplates` applies on the update path — so a file's
|
|
138
|
+
* init-time bytes and its update-time expected bytes cannot drift.
|
|
139
|
+
*/
|
|
140
|
+
export declare function writeTemplateMap(cwd: string, files: Map<string, string>): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Collect the shared hook scripts that `platform` actually registers, keyed
|
|
143
|
+
* under `hooksPath`. Driven by SHARED_HOOKS_BY_PLATFORM so a platform's hook
|
|
144
|
+
* set is never restated per configurator.
|
|
145
|
+
*/
|
|
146
|
+
export declare function collectSharedHooks(hooksPath: string, platform: SharedHookPlatform): Map<string, string>;
|
|
147
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/configurators/shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAiB7D,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG1D;AAED,iEAAiE;AACjE,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,GACzB,MAAM,CAMR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASpE;AA2CD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CAoCR;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CAmCR;AAcD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,CAUR;AAUD,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,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