wile 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +18 -1
  2. package/dist/cli.js +59 -32
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -23,10 +23,13 @@ This creates:
23
23
  - `.wile/.gitignore` to ignore `secrets/`, `screenshots/`, and `logs/`
24
24
  - `.wile/prd.json` (empty) and `.wile/prd.json.example`
25
25
 
26
+ Set `WILE_REPO_SOURCE=local` in `.wile/secrets/.env` to run against the current directory without GitHub.
27
+ When `WILE_REPO_SOURCE=local`, GitHub credentials are optional.
28
+
26
29
  ## Run Wile
27
30
 
28
31
  ```bash
29
- bunx wile run --branch main
32
+ bunx wile run
30
33
  ```
31
34
 
32
35
  Optional flags:
@@ -38,3 +41,17 @@ Optional flags:
38
41
  ## Logs
39
42
 
40
43
  Each run writes a session log to `.wile/logs/run-YYYYMMDD_HHMMSS.log`.
44
+
45
+ ## Publish
46
+
47
+ Release (bump version + build):
48
+
49
+ ```bash
50
+ ./scripts/release-cli.sh patch
51
+ ```
52
+
53
+ Publish:
54
+
55
+ ```bash
56
+ ./scripts/publish-cli.sh
57
+ ```
package/dist/cli.js CHANGED
@@ -7451,7 +7451,6 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
7451
7451
  import { existsSync } from "node:fs";
7452
7452
  import { join } from "node:path";
7453
7453
  var prdExample = {
7454
- branchName: "main",
7455
7454
  userStories: [
7456
7455
  {
7457
7456
  id: "US-001",
@@ -7544,7 +7543,8 @@ var prdExample = {
7544
7543
  };
7545
7544
  var tips = {
7546
7545
  oauth: "Tip: run 'claude setup-token' on your machine to generate an OAuth token (uses Pro/Max subscription).",
7547
- apiKey: "Tip: create an Anthropic API key in the console (uses API credits)."
7546
+ apiKey: "Tip: create an Anthropic API key in the console (uses API credits).",
7547
+ github: "Tip: use a GitHub Personal Access Token (fine-grained recommended). Create at https://github.com/settings/tokens?type=beta with Contents (read/write) and Metadata (read)."
7548
7548
  };
7549
7549
  var readEnvFile = async (path) => {
7550
7550
  if (!existsSync(path)) {
@@ -7660,18 +7660,34 @@ var runConfig = async () => {
7660
7660
  ],
7661
7661
  initial: existingEnv.CC_CLAUDE_MODEL === "opus" ? 1 : 0
7662
7662
  });
7663
- const githubTokenResponse = await prompt({
7663
+ const repoSourceResponse = await prompt({
7664
+ type: "select",
7665
+ name: "repoSource",
7666
+ message: "Repo source",
7667
+ choices: [
7668
+ { title: "GitHub (remote)", value: "github" },
7669
+ { title: "Local directory (no GitHub)", value: "local" }
7670
+ ],
7671
+ initial: existingEnv.WILE_REPO_SOURCE === "local" ? 1 : 0
7672
+ });
7673
+ const repoSource = repoSourceResponse.repoSource;
7674
+ if (repoSource === "github") {
7675
+ console.log("");
7676
+ console.log(tips.github);
7677
+ console.log("");
7678
+ }
7679
+ const githubTokenResponse = repoSource === "github" ? await prompt({
7664
7680
  type: "password",
7665
7681
  name: "githubToken",
7666
7682
  message: "GitHub token (press enter to keep existing)",
7667
7683
  initial: existingEnv.GITHUB_TOKEN ?? ""
7668
- });
7669
- const repoResponse = await prompt({
7684
+ }) : { githubToken: undefined };
7685
+ const repoResponse = repoSource === "github" ? await prompt({
7670
7686
  type: "text",
7671
7687
  name: "repoUrl",
7672
7688
  message: "GitHub repo URL",
7673
7689
  initial: existingEnv.GITHUB_REPO_URL ?? ""
7674
- });
7690
+ }) : { repoUrl: undefined };
7675
7691
  const branchResponse = await prompt({
7676
7692
  type: "text",
7677
7693
  name: "branchName",
@@ -7680,11 +7696,12 @@ var runConfig = async () => {
7680
7696
  });
7681
7697
  const authFallback = authMethod === "oauth" ? existingEnv.CC_CLAUDE_CODE_OAUTH_TOKEN : existingEnv.CC_ANTHROPIC_API_KEY;
7682
7698
  const authValue = coalesceValue(authValueResponse.authValue, authFallback);
7683
- const githubToken = coalesceValue(githubTokenResponse.githubToken, existingEnv.GITHUB_TOKEN);
7684
- const repoUrl = coalesceValue(repoResponse.repoUrl, existingEnv.GITHUB_REPO_URL);
7699
+ const githubToken = repoSource === "github" ? coalesceValue(githubTokenResponse.githubToken, existingEnv.GITHUB_TOKEN) : existingEnv.GITHUB_TOKEN;
7700
+ const repoUrl = repoSource === "github" ? coalesceValue(repoResponse.repoUrl, existingEnv.GITHUB_REPO_URL) : existingEnv.GITHUB_REPO_URL;
7685
7701
  const branchName = coalesceValue(branchResponse.branchName, existingEnv.BRANCH_NAME ?? "main");
7686
7702
  const envLines = [
7687
7703
  "CODING_AGENT=CC",
7704
+ `WILE_REPO_SOURCE=${repoSource}`,
7688
7705
  `GITHUB_TOKEN=${githubToken ?? ""}`,
7689
7706
  `GITHUB_REPO_URL=${repoUrl ?? ""}`,
7690
7707
  `BRANCH_NAME=${branchName ?? "main"}`,
@@ -7702,7 +7719,7 @@ var runConfig = async () => {
7702
7719
  await writeIfMissing(envProjectPath, `# Add env vars here to forward into the container
7703
7720
  `);
7704
7721
  if (!existsSync(prdPath)) {
7705
- const prdContents = JSON.stringify({ branchName: branchName ?? "main", userStories: [] }, null, 2);
7722
+ const prdContents = JSON.stringify({ userStories: [] }, null, 2);
7706
7723
  await writeFile(prdPath, prdContents + `
7707
7724
  `);
7708
7725
  }
@@ -7755,11 +7772,14 @@ var readWileConfig = (options = {}) => {
7755
7772
  }
7756
7773
  const env = parseEnvFile(paths.envPath);
7757
7774
  const envProject = parseEnvFile(paths.envProjectPath);
7775
+ const repoSource = env.WILE_REPO_SOURCE || "github";
7758
7776
  if (validate) {
7759
7777
  ensureRequired(env.CODING_AGENT === "CC", "CODING_AGENT must be set to CC in .wile/secrets/.env. Run 'bunx wile config'.");
7760
- ensureRequired(Boolean(env.GITHUB_TOKEN), "GITHUB_TOKEN is required in .wile/secrets/.env. Run 'bunx wile config'.");
7761
- ensureRequired(Boolean(env.GITHUB_REPO_URL), "GITHUB_REPO_URL is required in .wile/secrets/.env. Run 'bunx wile config'.");
7762
- ensureRequired(Boolean(env.BRANCH_NAME), "BRANCH_NAME is required in .wile/secrets/.env. Run 'bunx wile config'.");
7778
+ if (repoSource === "github") {
7779
+ ensureRequired(Boolean(env.GITHUB_TOKEN), "GITHUB_TOKEN is required in .wile/secrets/.env. Run 'bunx wile config'.");
7780
+ ensureRequired(Boolean(env.GITHUB_REPO_URL), "GITHUB_REPO_URL is required in .wile/secrets/.env. Run 'bunx wile config'.");
7781
+ ensureRequired(Boolean(env.BRANCH_NAME), "BRANCH_NAME is required in .wile/secrets/.env. Run 'bunx wile config'.");
7782
+ }
7763
7783
  ensureRequired(Boolean(env.CC_CLAUDE_CODE_OAUTH_TOKEN || env.CC_ANTHROPIC_API_KEY), "Either CC_CLAUDE_CODE_OAUTH_TOKEN or CC_ANTHROPIC_API_KEY is required in .wile/secrets/.env.");
7764
7784
  }
7765
7785
  return {
@@ -7769,6 +7789,7 @@ var readWileConfig = (options = {}) => {
7769
7789
  githubToken: env.GITHUB_TOKEN ?? "",
7770
7790
  githubRepoUrl: env.GITHUB_REPO_URL ?? "",
7771
7791
  branchName: env.BRANCH_NAME ?? "",
7792
+ repoSource,
7772
7793
  ccClaudeModel: env.CC_CLAUDE_MODEL,
7773
7794
  ccClaudeCodeOauthToken: env.CC_CLAUDE_CODE_OAUTH_TOKEN,
7774
7795
  ccAnthropicApiKey: env.CC_ANTHROPIC_API_KEY,
@@ -7852,6 +7873,30 @@ var runDockerWithLogging = (args, logPath) => {
7852
7873
  throw new Error("Docker run failed.");
7853
7874
  }
7854
7875
  };
7876
+ var buildDockerArgs = (options, config, paths, cwd) => {
7877
+ const dockerArgs = ["run", "--rm"];
7878
+ if (options.test) {
7879
+ dockerArgs.push("-e", "WILE_TEST=true", "-e", "WILE_TEST_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7880
+ }
7881
+ if (options.maxIterations) {
7882
+ dockerArgs.push("-e", `MAX_ITERATIONS=${options.maxIterations}`);
7883
+ }
7884
+ const repoSource = options.test || options.repo ? "github" : config.repoSource ?? "github";
7885
+ if (repoSource === "local") {
7886
+ dockerArgs.push("-e", "WILE_REPO_SOURCE=local", "-e", "WILE_LOCAL_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7887
+ } else {
7888
+ const repoValue = options.repo ?? config.githubRepoUrl;
7889
+ if (repoValue) {
7890
+ dockerArgs.push("-e", `GITHUB_REPO_URL=${repoValue}`);
7891
+ }
7892
+ }
7893
+ const envFiles = [paths.envPath, paths.envProjectPath].filter((path) => existsSync3(path));
7894
+ for (const envFile of envFiles) {
7895
+ dockerArgs.push("--env-file", envFile);
7896
+ }
7897
+ dockerArgs.push("wile-agent:local");
7898
+ return dockerArgs;
7899
+ };
7855
7900
  var runWile = (options) => {
7856
7901
  const cwd = process.cwd();
7857
7902
  let paths;
@@ -7881,25 +7926,7 @@ var runWile = (options) => {
7881
7926
  }
7882
7927
  const agentDir = resolveAgentDir();
7883
7928
  buildAgentImage(agentDir);
7884
- const dockerArgs = ["run", "--rm"];
7885
- if (options.test) {
7886
- dockerArgs.push("-e", "WILE_TEST=true", "-e", "WILE_TEST_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7887
- }
7888
- if (options.maxIterations) {
7889
- dockerArgs.push("-e", `MAX_ITERATIONS=${options.maxIterations}`);
7890
- }
7891
- const repoValue = options.repo ?? config.githubRepoUrl;
7892
- if (repoValue) {
7893
- dockerArgs.push("-e", `GITHUB_REPO_URL=${repoValue}`);
7894
- }
7895
- if (options.branch) {
7896
- dockerArgs.push("-e", `BRANCH_NAME=${options.branch}`);
7897
- }
7898
- const envFiles = [paths.envPath, paths.envProjectPath].filter((path) => existsSync3(path));
7899
- for (const envFile of envFiles) {
7900
- dockerArgs.push("--env-file", envFile);
7901
- }
7902
- dockerArgs.push("wile-agent:local");
7929
+ const dockerArgs = buildDockerArgs(options, config, paths, cwd);
7903
7930
  const logsDir = join3(paths.wileDir, "logs");
7904
7931
  mkdirSync(logsDir, { recursive: true });
7905
7932
  const logPath = join3(logsDir, `run-${getTimestamp()}.log`);
@@ -7924,7 +7951,7 @@ program2.name("wile").description("Autonomous AI coding agent that ships feature
7924
7951
  program2.command("config").description("Configure the current project for Wile").action(async () => {
7925
7952
  await runConfig();
7926
7953
  });
7927
- program2.command("run").description("Run Wile on a repository").requiredOption("--branch <branch>", "Branch to work on").option("--repo <repo>", "Repository URL or local path").option("--max-iterations <count>", "Maximum iterations", "25").option("--test", "Run in test mode").action((options) => {
7954
+ program2.command("run").description("Run Wile on a repository").option("--repo <repo>", "Repository URL or local path").option("--max-iterations <count>", "Maximum iterations", "25").option("--test", "Run in test mode").action((options) => {
7928
7955
  runWile(options);
7929
7956
  });
7930
7957
  program2.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wile",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Autonomous AI coding agent that ships features while you sleep",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,8 @@
14
14
  "scripts": {
15
15
  "build": "bun build ./src/cli.ts --outdir ./dist --target node",
16
16
  "dev": "bun run ./src/cli.ts",
17
- "prepublishOnly": "./build.sh"
17
+ "prepublishOnly": "./build.sh",
18
+ "test": "bun test"
18
19
  },
19
20
  "dependencies": {
20
21
  "commander": "^14.0.2",