Initial commit.
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cc69f5b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+.buildlog
+.DS_Store
+.idea
+.pub/
+.project
+.settings
+build/
+packages
+pubspec.lock
\ No newline at end of file
diff --git a/.status b/.status
new file mode 100644
index 0000000..59f3573
--- /dev/null
+++ b/.status
@@ -0,0 +1,3 @@
+# Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..7a6d1d9
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,6 @@
+# Below is a list of people and organizations that have contributed
+# to the cli_util project. Names should be added to the list like so:
+#
+#   Name/Organization <email address>
+
+Google Inc.
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..2a2d63c
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## 0.0.1
+
+- Initial version
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..6f5e0ea
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,33 @@
+Want to contribute? Great! First, read this page (including the small print at
+the end).
+
+### Before you contribute
+Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
+(CLA), which you can do online. The CLA is necessary mainly because you own the
+copyright to your changes, even after your contribution becomes part of our
+codebase, so we need your permission to use and distribute your code. We also
+need to be sure of various other things—for instance that you'll tell us if you
+know that your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+
+Before you start working on a larger contribution, you should get in touch with
+us first through the issue tracker with your idea so that we can help out and
+possibly guide you. Coordinating up front makes it much easier to avoid
+frustration later on.
+
+### Code reviews
+All submissions, including submissions by project members, require review.
+
+### File headers
+All files in the project must start with the following header.
+
+    // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+    // for details. All rights reserved. Use of this source code is governed by a
+    // BSD-style license that can be found in the LICENSE file.
+
+### The small print
+Contributions made by corporations are covered by a different agreement than the
+one above, the
+[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..de31e1a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,26 @@
+Copyright 2015, the Dart project authors. All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of Google Inc. nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..bcee2fd
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# cli_util
+
+A micro framework for building commandline apps.
+
+## Features and bugs
+
+Please file feature requests and bugs at the [issue tracker][tracker].
+
+[tracker]: https://github.com/dart-lang/cli_util/issues
diff --git a/codereview.settings b/codereview.settings
new file mode 100644
index 0000000..2b2da2d
--- /dev/null
+++ b/codereview.settings
@@ -0,0 +1,3 @@
+CODE_REVIEW_SERVER: https://chromiumcodereview.appspot.com/
+VIEW_VC: https://github.com/dart-lang/cli_util/commit/
+CC_LIST: reviews@dartlang.org
diff --git a/lib/cli_util.dart b/lib/cli_util.dart
new file mode 100644
index 0000000..a997c43
--- /dev/null
+++ b/lib/cli_util.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library cli_util;
+
+import 'dart:io';
+
+import 'package:which/which.dart';
+
+/// Return the path to the current Dart SDK. This will return `null` if we are
+/// unable to locate the Dart SDK.
+Directory getSdkDir([List<String> cliArgs]) {
+  // Look for --dart-sdk on the command line.
+  if (cliArgs != null) {
+    int index = cliArgs.indexOf('--dart-sdk');
+
+    if (index != -1 && (index + 1 < cliArgs.length)) {
+      return new Directory(cliArgs[index + 1]);
+    }
+
+    for (String arg in cliArgs) {
+      if (arg.startsWith('--dart-sdk=')) {
+        return new Directory(arg.substring('--dart-sdk='.length));
+      }
+    }
+  }
+
+  // Look in env['DART_SDK']
+  if (Platform.environment['DART_SDK'] != null) {
+    return new Directory(Platform.environment['DART_SDK']);
+  }
+
+  // Look relative to the dart executable.
+  Directory sdkDirectory = new File(Platform.executable).parent.parent;
+  if (_isSdkDir(sdkDirectory)) return sdkDirectory;
+
+  // Try and locate the VM using 'which'.
+  String executable = whichSync('dart', orElse: () => null);
+
+  // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links.
+  Link link = new Link(executable);
+  if (link.existsSync()) {
+    executable = link.resolveSymbolicLinksSync();
+  }
+
+  File dartVm = new File(executable);
+  Directory dir = dartVm.parent.parent;
+  if (_isSdkDir(dir)) return dir;
+
+  return null;
+}
+
+bool _isSdkDir(Directory dir) => _joinFile(dir, ['version']).existsSync();
+
+File _joinFile(Directory dir, List<String> files) {
+  String pathFragment = files.join(Platform.pathSeparator);
+  return new File("${dir.path}${Platform.pathSeparator}${pathFragment}");
+}
diff --git a/pubspec.yaml b/pubspec.yaml
new file mode 100644
index 0000000..99c3b0d
--- /dev/null
+++ b/pubspec.yaml
@@ -0,0 +1,9 @@
+name: cli_util
+version: 0.0.1
+author: Dart Team <misc@dartlang.org>
+description: A micro framework for building commandline apps.
+homepage: https://github.com/dart-lang/cli_util
+environment:
+  sdk: '>=1.0.0 <2.0.0'
+dependencies:
+  which: '>=0.1.2 <0.2.0'