77 "os"
88
99 "archcore-cli/internal/display"
10- "archcore-cli/internal/projectroot"
1110
1211 "github.com/spf13/cobra"
1312)
@@ -26,24 +25,12 @@ type hookOutput struct {
2625 SystemMessage string `json:"systemMessage,omitempty"`
2726}
2827
29- // resolveBaseDir returns the base directory for a hook, using the projectroot
30- // resolver. The hook input's CWD (set by the host MCP integration) is treated
31- // as an explicit signal and takes precedence over walk-up. ModeHooks lets us
32- // accept the host-supplied directory even if it lacks markers, since the host
33- // has explicitly chosen it.
34- func resolveBaseDir (cmd * cobra.Command , input * hookInput ) (string , error ) {
35- flagVal := baseDirFlag (cmd )
36- if flagVal == "" {
37- flagVal = input .CWD
28+ // resolveBaseDir returns the base directory from hook input, falling back to cwd.
29+ func resolveBaseDir (input * hookInput ) (string , error ) {
30+ if input .CWD != "" {
31+ return input .CWD , nil
3832 }
39- res , err := projectroot .Resolve (projectroot.Options {
40- Flag : flagVal ,
41- Mode : projectroot .ModeHooks ,
42- })
43- if err != nil {
44- return "" , err
45- }
46- return res .Path , nil
33+ return os .Getwd ()
4734}
4835
4936// readHookInput parses the hook input JSON from a reader.
@@ -87,7 +74,7 @@ func newSessionStartHookCmd(use, short, version string) *cobra.Command {
8774 if err != nil {
8875 return err
8976 }
90- baseDir , err := resolveBaseDir (cmd , input )
77+ baseDir , err := resolveBaseDir (input )
9178 if err != nil {
9279 return err
9380 }
0 commit comments