diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2015 Matthew Hall
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/gitdo.cabal b/gitdo.cabal
new file mode 100644
--- /dev/null
+++ b/gitdo.cabal
@@ -0,0 +1,81 @@
+-- Initial gitdo.cabal generated by cabal init.  For further documentation,
+--  see http://haskell.org/cabal/users-guide/
+
+-- The name of the package.
+name:                gitdo
+
+-- The package version.  See the Haskell package versioning policy (PVP) 
+-- for standards guiding when and how versions should be incremented.
+-- http://www.haskell.org/haskellwiki/Package_versioning_policy
+-- PVP summary:      +-+------- breaking API changes
+--                   | | +----- non-breaking API additions
+--                   | | | +--- code changes with no API change
+version:             0.1.0.0
+
+homepage:            https://github.com/mattyhall/gitdo
+
+-- A short (one-line) description of the package.
+synopsis:            Create Github issues out of TODO comments in code
+
+-- A longer description of the package.
+-- description:         
+
+-- The license under which the package is released.
+license:             MIT
+
+-- The file containing the license text.
+license-file:        LICENSE
+
+-- The package author(s).
+author:              Matthew Hall
+
+-- An email address to which users can send suggestions, bug reports, and 
+-- patches.
+maintainer:          matthew@quickbeam.me.uk
+
+-- A copyright notice.
+-- copyright:           
+
+-- category:            
+
+build-type:          Simple
+
+-- Extra files to be distributed with the package, such as examples or a 
+-- README.
+-- extra-source-files:  
+
+-- Constraint on the version of Cabal needed to build this package.
+cabal-version:       >=1.10
+
+
+executable gitdo
+  -- .hs or .lhs file containing the Main module.
+  main-is:             Main.hs
+  
+  -- Modules included in this executable, other than Main.
+  -- other-modules:       
+  
+  -- LANGUAGE extensions used by modules in this package.
+  -- other-extensions:    
+  
+  -- Other library packages from which modules are imported.
+  build-depends:       aeson
+                     , aeson-lens
+                     , base >=4.7 && <4.8
+                     , bytestring >= 0.10.4.0
+                     , foldl >= 1.0.7
+                     , lens >= 4.7
+                     , mtl >= 2.1.3.1
+                     , optparse-applicative
+                     , sqlite-simple
+                     , system-filepath >= 0.4.13.2
+                     , text >= 1.2.0.4
+                     , turtle
+                     , wreq
+
+  -- Directories containing source files.
+  hs-source-dirs:      src
+  
+  -- Base language which the package is written in.
+  default-language:    Haskell2010
+  
diff --git a/src/Main.hs b/src/Main.hs
new file mode 100644
--- /dev/null
+++ b/src/Main.hs
@@ -0,0 +1,92 @@
+{-# LANGUAGE OverloadedStrings #-}
+import Data.Monoid ((<>))
+import Turtle
+import qualified Data.Text as T
+import Database.SQLite.Simple
+import Options.Applicative
+import Shared
+import Commit
+import Push
+
+createTable :: IO ()
+createTable = do
+  conn <- liftIO $ open dbPath
+  execute conn ("CREATE TABLE todos " <>
+    "(file TEXT, line INT, todo TEXT, status TEXT, number INT);") ()
+
+data Command = AddHooks
+             | Commit
+             | Reset
+             | Push PushOpts
+             deriving (Show, Eq)
+
+txtOption :: Mod OptionFields String -> Parser T.Text
+txtOption opts = T.pack <$> strOption opts
+
+pushOpts :: Parser Command
+pushOpts = Push <$>
+  (PushOpts <$> txtOption
+                 (  long "iuser"
+                 <> short 'i'
+                 <> metavar "ISSUE_USER"
+                 <> help "User that will create the issue")
+           <*> txtOption
+                 (  long "password"
+                 <> short 'p'
+                 <> metavar "ISSUE_PSWD"
+                 <> help "Password of ISSUE_USER")
+           <*> txtOption
+                 (  long "user"
+                 <> short 'u'
+                 <> metavar "USER"
+                 <> help "The user who owns the repo")
+           <*> txtOption
+                 (  long "repo"
+                 <> short 'r'
+                 <> metavar "REPO"
+                 <> help "The repo to create the issues in")
+           <*> switch
+                 (  long "close"
+                 <> short 'c'
+                 <> help "Close issues for todos that have been deleted"))
+
+opts :: Parser Command
+opts = subparser $
+  command "add-hooks"
+          (info (helper <*> pure AddHooks)
+            (progDesc "Add scripts to .git/hooks"))
+  <>
+  command "commit"
+          (info (helper <*> pure Commit)
+            (progDesc "Commit hook. Adds todos to database"))
+  <>
+  command "reset"
+          (info (helper <*> pure Reset)
+            (progDesc "Delete new todos"))
+  <>
+  command "push"
+          (info (helper <*> pushOpts)
+            (progDesc "Create/update issues on github"))
+
+run :: Command -> IO ()
+run (AddHooks) = do
+  output ".git/hooks/post-commit" "#!/bin/bash\ngitdo commit"
+  shell "chmod +x .git/hooks/post-commit" empty
+  putStrLn "Created post-commit hook"
+  output ".git/hooks/pre-push"
+         "#!/bin/bash\ngitdo push -i IUSER -p PSWD -u USER -r REPO"
+  shell "chmod +x .git/hooks/pre-push" empty
+  putStrLn "Created pre-push hook"
+  createTable
+  putStrLn "Created database"
+
+run (Commit) = commit
+run (Push opts) = push opts
+run (Reset) = do
+  conn <- open dbPath
+  execute conn "DELETE FROM todos WHERE status=?" (Only "new" :: Only String)
+  putStrLn "Deleted new todos"
+
+main  :: IO ()
+main = execParser (info (helper <*> opts) $ progDesc "Todo comments to issues")
+       >>= run
