@sunasteriskrnd/takumi 1.0.0-preview.1 → 1.0.0-preview.2
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.js +29 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19855,7 +19855,7 @@ var package_default;
|
|
|
19855
19855
|
var init_package = __esm(() => {
|
|
19856
19856
|
package_default = {
|
|
19857
19857
|
name: "@sunasteriskrnd/takumi",
|
|
19858
|
-
version: "1.0.0-preview.
|
|
19858
|
+
version: "1.0.0-preview.2",
|
|
19859
19859
|
description: "CLI tool for bootstrapping and managing Takumi projects",
|
|
19860
19860
|
type: "module",
|
|
19861
19861
|
repository: {
|
|
@@ -77970,15 +77970,15 @@ import { existsSync as existsSync67 } from "node:fs";
|
|
|
77970
77970
|
import { lstatSync as lstatSync3, realpathSync as realpathSync3 } from "node:fs";
|
|
77971
77971
|
import { homedir as homedir33 } from "node:os";
|
|
77972
77972
|
import { join as join127 } from "node:path";
|
|
77973
|
-
function rawPath(agent, global3) {
|
|
77974
|
-
const root = global3 ? homedir33() : process.cwd();
|
|
77973
|
+
function rawPath(agent, global3, projectDir) {
|
|
77974
|
+
const root = global3 ? homedir33() : projectDir ?? process.cwd();
|
|
77975
77975
|
if (agent === "claude") {
|
|
77976
77976
|
return join127(root, ".claude", "settings.json");
|
|
77977
77977
|
}
|
|
77978
77978
|
return join127(root, ".codex", "hooks.json");
|
|
77979
77979
|
}
|
|
77980
77980
|
function resolveSettingsPath(agent, options2 = {}) {
|
|
77981
|
-
const originalPath = rawPath(agent, Boolean(options2.global));
|
|
77981
|
+
const originalPath = rawPath(agent, Boolean(options2.global), options2.projectDir);
|
|
77982
77982
|
let wasSymlink = false;
|
|
77983
77983
|
let realPath = originalPath;
|
|
77984
77984
|
try {
|
|
@@ -78172,10 +78172,23 @@ function supersededBasenamesFor(handlers3) {
|
|
|
78172
78172
|
}
|
|
78173
78173
|
return out;
|
|
78174
78174
|
}
|
|
78175
|
-
function
|
|
78176
|
-
|
|
78177
|
-
|
|
78178
|
-
|
|
78175
|
+
function entryStrings(entry) {
|
|
78176
|
+
const out = [];
|
|
78177
|
+
if (typeof entry.command === "string")
|
|
78178
|
+
out.push(entry.command);
|
|
78179
|
+
if (Array.isArray(entry.args)) {
|
|
78180
|
+
for (const a3 of entry.args)
|
|
78181
|
+
if (typeof a3 === "string")
|
|
78182
|
+
out.push(a3);
|
|
78183
|
+
}
|
|
78184
|
+
return out;
|
|
78185
|
+
}
|
|
78186
|
+
function isSupersededCjs(entry, basenames) {
|
|
78187
|
+
for (const value of entryStrings(entry)) {
|
|
78188
|
+
for (const base of basenames) {
|
|
78189
|
+
if (value.includes(`hooks/${base}.cjs`))
|
|
78190
|
+
return true;
|
|
78191
|
+
}
|
|
78179
78192
|
}
|
|
78180
78193
|
return false;
|
|
78181
78194
|
}
|
|
@@ -78188,8 +78201,7 @@ function pruneSupersededCjs(hooks, basenames) {
|
|
|
78188
78201
|
const remaining = [];
|
|
78189
78202
|
for (const group of groups) {
|
|
78190
78203
|
const kept = group.hooks.filter((entry) => {
|
|
78191
|
-
|
|
78192
|
-
if (isSupersededCjs(command, basenames)) {
|
|
78204
|
+
if (isSupersededCjs(entry, basenames)) {
|
|
78193
78205
|
removed++;
|
|
78194
78206
|
return false;
|
|
78195
78207
|
}
|
|
@@ -78350,7 +78362,10 @@ function eventsSummary(section) {
|
|
|
78350
78362
|
return Object.keys(section).join(", ");
|
|
78351
78363
|
}
|
|
78352
78364
|
async function installForAgent(agent, options2, interactive, useStepUI, claudeTeamHooksSupported) {
|
|
78353
|
-
const location2 = resolveSettingsPath(agent, {
|
|
78365
|
+
const location2 = resolveSettingsPath(agent, {
|
|
78366
|
+
global: options2.global,
|
|
78367
|
+
projectDir: options2.projectDir
|
|
78368
|
+
});
|
|
78354
78369
|
const handlers3 = selectHandlersForInstall(options2.categories);
|
|
78355
78370
|
const section = buildHookSection(agent, options2.bin, {
|
|
78356
78371
|
noDetach: options2.noDetach,
|
|
@@ -87040,6 +87055,7 @@ async function installTkmHooksForAgents(targetAgents2, options2) {
|
|
|
87040
87055
|
await installHook({
|
|
87041
87056
|
agent: hookAgent,
|
|
87042
87057
|
global: options2.global,
|
|
87058
|
+
projectDir: options2.projectDir,
|
|
87043
87059
|
dryRun: options2.dryRun,
|
|
87044
87060
|
categories,
|
|
87045
87061
|
pruneSupersededFiles: fullSet,
|
|
@@ -87165,7 +87181,8 @@ async function executeInit(options2, prompts) {
|
|
|
87165
87181
|
global: Boolean(ctx.options.global),
|
|
87166
87182
|
dryRun: Boolean(ctx.options.dryRun),
|
|
87167
87183
|
installHooks: Boolean(ctx.options.installHooks),
|
|
87168
|
-
gated
|
|
87184
|
+
gated,
|
|
87185
|
+
projectDir: ctx.resolvedDir
|
|
87169
87186
|
});
|
|
87170
87187
|
}
|
|
87171
87188
|
if (targetAgents2.length > 1) {
|