wile 0.1.1 → 0.3.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 +3 -0
  2. package/dist/cli.js +70 -32
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -23,6 +23,9 @@ 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
package/dist/cli.js CHANGED
@@ -7620,6 +7620,7 @@ var runConfig = async () => {
7620
7620
  const gitignorePath = join(wileDir, ".gitignore");
7621
7621
  const prdPath = join(wileDir, "prd.json");
7622
7622
  const prdExamplePath = join(wileDir, "prd.json.example");
7623
+ const additionalInstructionsPath = join(wileDir, "additional-instructions.md");
7623
7624
  await mkdir(secretsDir, { recursive: true });
7624
7625
  const existingEnv = await readEnvFile(envPath);
7625
7626
  await prompt({
@@ -7660,21 +7661,34 @@ var runConfig = async () => {
7660
7661
  ],
7661
7662
  initial: existingEnv.CC_CLAUDE_MODEL === "opus" ? 1 : 0
7662
7663
  });
7663
- console.log("");
7664
- console.log(tips.github);
7665
- console.log("");
7666
- const githubTokenResponse = await prompt({
7664
+ const repoSourceResponse = await prompt({
7665
+ type: "select",
7666
+ name: "repoSource",
7667
+ message: "Repo source",
7668
+ choices: [
7669
+ { title: "GitHub (remote)", value: "github" },
7670
+ { title: "Local directory (no GitHub)", value: "local" }
7671
+ ],
7672
+ initial: existingEnv.WILE_REPO_SOURCE === "local" ? 1 : 0
7673
+ });
7674
+ const repoSource = repoSourceResponse.repoSource;
7675
+ if (repoSource === "github") {
7676
+ console.log("");
7677
+ console.log(tips.github);
7678
+ console.log("");
7679
+ }
7680
+ const githubTokenResponse = repoSource === "github" ? await prompt({
7667
7681
  type: "password",
7668
7682
  name: "githubToken",
7669
7683
  message: "GitHub token (press enter to keep existing)",
7670
7684
  initial: existingEnv.GITHUB_TOKEN ?? ""
7671
- });
7672
- const repoResponse = await prompt({
7685
+ }) : { githubToken: undefined };
7686
+ const repoResponse = repoSource === "github" ? await prompt({
7673
7687
  type: "text",
7674
7688
  name: "repoUrl",
7675
7689
  message: "GitHub repo URL",
7676
7690
  initial: existingEnv.GITHUB_REPO_URL ?? ""
7677
- });
7691
+ }) : { repoUrl: undefined };
7678
7692
  const branchResponse = await prompt({
7679
7693
  type: "text",
7680
7694
  name: "branchName",
@@ -7683,11 +7697,12 @@ var runConfig = async () => {
7683
7697
  });
7684
7698
  const authFallback = authMethod === "oauth" ? existingEnv.CC_CLAUDE_CODE_OAUTH_TOKEN : existingEnv.CC_ANTHROPIC_API_KEY;
7685
7699
  const authValue = coalesceValue(authValueResponse.authValue, authFallback);
7686
- const githubToken = coalesceValue(githubTokenResponse.githubToken, existingEnv.GITHUB_TOKEN);
7687
- const repoUrl = coalesceValue(repoResponse.repoUrl, existingEnv.GITHUB_REPO_URL);
7700
+ const githubToken = repoSource === "github" ? coalesceValue(githubTokenResponse.githubToken, existingEnv.GITHUB_TOKEN) : existingEnv.GITHUB_TOKEN;
7701
+ const repoUrl = repoSource === "github" ? coalesceValue(repoResponse.repoUrl, existingEnv.GITHUB_REPO_URL) : existingEnv.GITHUB_REPO_URL;
7688
7702
  const branchName = coalesceValue(branchResponse.branchName, existingEnv.BRANCH_NAME ?? "main");
7689
7703
  const envLines = [
7690
7704
  "CODING_AGENT=CC",
7705
+ `WILE_REPO_SOURCE=${repoSource}`,
7691
7706
  `GITHUB_TOKEN=${githubToken ?? ""}`,
7692
7707
  `GITHUB_REPO_URL=${repoUrl ?? ""}`,
7693
7708
  `BRANCH_NAME=${branchName ?? "main"}`,
@@ -7710,10 +7725,18 @@ var runConfig = async () => {
7710
7725
  `);
7711
7726
  }
7712
7727
  await writeIfMissing(prdExamplePath, JSON.stringify(prdExample, null, 2) + `
7728
+ `);
7729
+ const hadAdditionalInstructions = existsSync(additionalInstructionsPath);
7730
+ await writeIfMissing(additionalInstructionsPath, `# Additional Instructions
7731
+
7732
+ Add project-specific guidance for the agent here.
7713
7733
  `);
7714
7734
  console.log(`
7715
7735
  Wile config complete.`);
7716
7736
  console.log("Add project env vars to .wile/secrets/.env.project when needed.");
7737
+ if (!hadAdditionalInstructions) {
7738
+ console.log("Created .wile/additional-instructions.md for extra agent guidance (optional).");
7739
+ }
7717
7740
  };
7718
7741
 
7719
7742
  // src/commands/run.ts
@@ -7758,11 +7781,14 @@ var readWileConfig = (options = {}) => {
7758
7781
  }
7759
7782
  const env = parseEnvFile(paths.envPath);
7760
7783
  const envProject = parseEnvFile(paths.envProjectPath);
7784
+ const repoSource = env.WILE_REPO_SOURCE || "github";
7761
7785
  if (validate) {
7762
7786
  ensureRequired(env.CODING_AGENT === "CC", "CODING_AGENT must be set to CC in .wile/secrets/.env. Run 'bunx wile config'.");
7763
- ensureRequired(Boolean(env.GITHUB_TOKEN), "GITHUB_TOKEN is required in .wile/secrets/.env. Run 'bunx wile config'.");
7764
- ensureRequired(Boolean(env.GITHUB_REPO_URL), "GITHUB_REPO_URL is required in .wile/secrets/.env. Run 'bunx wile config'.");
7765
- ensureRequired(Boolean(env.BRANCH_NAME), "BRANCH_NAME is required in .wile/secrets/.env. Run 'bunx wile config'.");
7787
+ if (repoSource === "github") {
7788
+ ensureRequired(Boolean(env.GITHUB_TOKEN), "GITHUB_TOKEN is required in .wile/secrets/.env. Run 'bunx wile config'.");
7789
+ ensureRequired(Boolean(env.GITHUB_REPO_URL), "GITHUB_REPO_URL is required in .wile/secrets/.env. Run 'bunx wile config'.");
7790
+ ensureRequired(Boolean(env.BRANCH_NAME), "BRANCH_NAME is required in .wile/secrets/.env. Run 'bunx wile config'.");
7791
+ }
7766
7792
  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.");
7767
7793
  }
7768
7794
  return {
@@ -7772,6 +7798,7 @@ var readWileConfig = (options = {}) => {
7772
7798
  githubToken: env.GITHUB_TOKEN ?? "",
7773
7799
  githubRepoUrl: env.GITHUB_REPO_URL ?? "",
7774
7800
  branchName: env.BRANCH_NAME ?? "",
7801
+ repoSource,
7775
7802
  ccClaudeModel: env.CC_CLAUDE_MODEL,
7776
7803
  ccClaudeCodeOauthToken: env.CC_CLAUDE_CODE_OAUTH_TOKEN,
7777
7804
  ccAnthropicApiKey: env.CC_ANTHROPIC_API_KEY,
@@ -7855,6 +7882,35 @@ var runDockerWithLogging = (args, logPath) => {
7855
7882
  throw new Error("Docker run failed.");
7856
7883
  }
7857
7884
  };
7885
+ var buildDockerArgs = (options, config, paths, cwd) => {
7886
+ const dockerArgs = ["run", "--rm"];
7887
+ if (options.test) {
7888
+ dockerArgs.push("-e", "WILE_TEST=true", "-e", "WILE_TEST_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7889
+ }
7890
+ if (options.maxIterations) {
7891
+ dockerArgs.push("-e", `MAX_ITERATIONS=${options.maxIterations}`);
7892
+ }
7893
+ const repoSource = options.test || options.repo ? "github" : config.repoSource ?? "github";
7894
+ if (repoSource === "local") {
7895
+ dockerArgs.push("-e", "WILE_REPO_SOURCE=local", "-e", "WILE_LOCAL_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7896
+ } else {
7897
+ const repoValue = options.repo ?? config.githubRepoUrl;
7898
+ if (repoValue) {
7899
+ dockerArgs.push("-e", `GITHUB_REPO_URL=${repoValue}`);
7900
+ }
7901
+ }
7902
+ const envFiles = [paths.envPath, paths.envProjectPath].filter((path) => existsSync3(path));
7903
+ for (const envFile of envFiles) {
7904
+ dockerArgs.push("--env-file", envFile);
7905
+ }
7906
+ const additionalInstructionsPath = join3(paths.wileDir, "additional-instructions.md");
7907
+ if (existsSync3(additionalInstructionsPath)) {
7908
+ dockerArgs.push("-e", `WILE_ADDITIONAL_INSTRUCTIONS=${additionalInstructionsPath}`);
7909
+ dockerArgs.push("-v", `${additionalInstructionsPath}:${additionalInstructionsPath}`);
7910
+ }
7911
+ dockerArgs.push("wile-agent:local");
7912
+ return dockerArgs;
7913
+ };
7858
7914
  var runWile = (options) => {
7859
7915
  const cwd = process.cwd();
7860
7916
  let paths;
@@ -7884,25 +7940,7 @@ var runWile = (options) => {
7884
7940
  }
7885
7941
  const agentDir = resolveAgentDir();
7886
7942
  buildAgentImage(agentDir);
7887
- const dockerArgs = ["run", "--rm"];
7888
- if (options.test) {
7889
- dockerArgs.push("-e", "WILE_TEST=true", "-e", "WILE_TEST_REPO_PATH=/home/wile/workspace/repo", "-v", `${cwd}:/home/wile/workspace/repo`);
7890
- }
7891
- if (options.maxIterations) {
7892
- dockerArgs.push("-e", `MAX_ITERATIONS=${options.maxIterations}`);
7893
- }
7894
- const repoValue = options.repo ?? config.githubRepoUrl;
7895
- if (repoValue) {
7896
- dockerArgs.push("-e", `GITHUB_REPO_URL=${repoValue}`);
7897
- }
7898
- if (options.branch) {
7899
- dockerArgs.push("-e", `BRANCH_NAME=${options.branch}`);
7900
- }
7901
- const envFiles = [paths.envPath, paths.envProjectPath].filter((path) => existsSync3(path));
7902
- for (const envFile of envFiles) {
7903
- dockerArgs.push("--env-file", envFile);
7904
- }
7905
- dockerArgs.push("wile-agent:local");
7943
+ const dockerArgs = buildDockerArgs(options, config, paths, cwd);
7906
7944
  const logsDir = join3(paths.wileDir, "logs");
7907
7945
  mkdirSync(logsDir, { recursive: true });
7908
7946
  const logPath = join3(logsDir, `run-${getTimestamp()}.log`);
@@ -7927,7 +7965,7 @@ program2.name("wile").description("Autonomous AI coding agent that ships feature
7927
7965
  program2.command("config").description("Configure the current project for Wile").action(async () => {
7928
7966
  await runConfig();
7929
7967
  });
7930
- program2.command("run").description("Run Wile on a repository").option("--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) => {
7968
+ 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) => {
7931
7969
  runWile(options);
7932
7970
  });
7933
7971
  program2.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wile",
3
- "version": "0.1.1",
3
+ "version": "0.3.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",