create-akan-workspace 3.1.1 → 3.1.2-rc.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.
package/README.ko.md CHANGED
@@ -12,10 +12,11 @@ bunx create-akan-workspace@latest
12
12
  이 명령은 다음을 합니다.
13
13
 
14
14
  1. 워크스페이스 이름과 앱 이름을 묻습니다. 미리 넘겼다면 묻지 않습니다.
15
- 2. `./<workspace>`를 만들고 의존성을 설치합니다.
16
- 3. 샘플 `task` 모듈과 페이지가 들어 있는 첫 앱을 만듭니다.
15
+ 2. `./<workspace>`를 만들고 의존성을 설치합니다. 이름이 `.`이면 현재 폴더를 그대로 씁니다.
16
+ 3. 샘플 `task` 모듈과 페이지가 들어 있는 첫 앱을 만듭니다. `--sample false`면 샘플을 빼고 만듭니다.
17
17
  4. `AGENTS.md`, `CLAUDE.md`, Cursor 규칙을 쓰고, Claude Code·Codex·Cursor에 Akan MCP 서버를 등록합니다.
18
- 5. 첫 git 커밋을 만듭니다.
18
+ 5. 첫 git 커밋을 만듭니다. git에 사용자 정보가 없으면 `Akan.js <noreply@akanjs.com>`으로 커밋합니다. 다른 git
19
+ 저장소가 추적하는 폴더라면 커밋하지 않고, 새 파일을 그 저장소에서 직접 커밋하도록 남겨 둡니다.
19
20
 
20
21
  그다음 앱을 실행하면 `http://localhost:8282`에서 열립니다.
21
22
 
@@ -36,15 +37,28 @@ bunx create-akan-workspace@latest my-company --app web
36
37
  확인하고, 이 명령을 실행하고, 앱까지 띄웁니다. 끝나면 새 워크스페이스 안에서 에이전트를 다시 여세요. MCP 서버와
37
38
  규칙은 거기서 로드됩니다.
38
39
 
40
+ ## 기존 폴더에 만들기
41
+
42
+ 워크스페이스 이름을 `.`으로 주면 하위 폴더를 새로 만들지 않고 현재 폴더나 `--dir` 폴더에 바로 만듭니다. 워크스페이스
43
+ 이름은 그 폴더 이름을 따릅니다. 폴더에는 `.git`이나 메모처럼 워크스페이스가 쓰지 않는 파일이 있어도 됩니다.
44
+ `package.json`이나 `README.md`처럼 덮어쓸 파일이 있으면 아무것도 쓰지 않고, 옮겨야 할 파일을 알려 줍니다.
45
+
46
+ ```bash
47
+ bunx create-akan-workspace@latest . --app web # 현재 폴더
48
+ bunx create-akan-workspace@latest . --app web --dir app # ./app
49
+ bunx create-akan-workspace@latest my-company --app web --sample false # 샘플 모듈과 페이지 없이
50
+ ```
51
+
39
52
  ## 옵션
40
53
 
41
54
  | 옵션 | 설명 | 기본값 |
42
55
  | --- | --- | --- |
43
- | `[org]` | 워크스페이스(조직) 이름 | 물어봄 |
56
+ | `[org]` | 워크스페이스(조직) 이름. `.`이면 `--dir` 폴더 자체 | 물어봄 |
44
57
  | `-a, --app <name>` | 첫 애플리케이션 이름 | 물어봄 |
45
- | `-d, --dir <path>` | 워크스페이스를 만들 디렉터리 | `.` |
58
+ | `-d, --dir <path>` | 워크스페이스를 만들 디렉터리(`<dir>/<org>`) | `.` |
46
59
  | `-l, --libs <boolean>` | `shared`, `util` 라이브러리(관리자, 사용자, 파일 등)도 설치 | `false` |
47
60
  | `-i, --init <boolean>` | 워크스페이스 의존성 설치 | `true` |
61
+ | `-s, --sample <boolean>` | 첫 앱에 샘플 `task` 모듈, 페이지, 헬퍼를 생성 | `true` |
48
62
  | `-r, --registry <url>` | Akan 패키지를 받을 npm 레지스트리(또는 `AKAN_NPM_REGISTRY`) | npmjs |
49
63
  | `-o, --owner <name>` | 워크스페이스 소유자 | — |
50
64
 
package/README.md CHANGED
@@ -12,11 +12,12 @@ It installs the `akan` CLI (`@akanjs/cli`, at this package's own version) global
12
12
  `akan create-workspace`, which:
13
13
 
14
14
  1. asks for a workspace name and an app name, unless you passed them,
15
- 2. creates `./<workspace>` and installs its dependencies,
16
- 3. generates the first app with a sample `task` module and pages,
15
+ 2. creates `./<workspace>`, or fills the current folder when the name is `.`, and installs its dependencies,
16
+ 3. generates the first app with a sample `task` module and pages, unless you pass `--sample false`,
17
17
  4. writes `AGENTS.md`, `CLAUDE.md` and Cursor rules, and registers the Akan MCP server for Claude Code, Codex and
18
18
  Cursor,
19
- 5. makes the first git commit.
19
+ 5. makes the first git commit, as `Akan.js <noreply@akanjs.com>` when git has no identity configured. In a folder
20
+ another git repository tracks, it commits nothing and leaves the new files for you to commit there.
20
21
 
21
22
  Then start the app. It opens on `http://localhost:8282`.
22
23
 
@@ -37,15 +38,29 @@ The [quick start](https://akanjs.com/docs/intro/quickstart) has a prompt to past
37
38
  checks Bun, runs this, and starts the app. Reopen the agent inside the new workspace afterwards: its MCP server and
38
39
  rules load from there.
39
40
 
41
+ ## In an Existing Folder
42
+
43
+ Name the workspace `.` to create it in the current folder, or in `--dir` itself, instead of a new subfolder. The
44
+ workspace takes the folder's name. The folder may already hold files the workspace does not write, such as `.git` or
45
+ notes. When it holds one the workspace would overwrite, such as `package.json` or `README.md`, nothing is written and
46
+ the command names the files to move away.
47
+
48
+ ```bash
49
+ bunx create-akan-workspace@latest . --app web # the current folder
50
+ bunx create-akan-workspace@latest . --app web --dir app # ./app
51
+ bunx create-akan-workspace@latest my-company --app web --sample false # no sample module or pages
52
+ ```
53
+
40
54
  ## Options
41
55
 
42
56
  | Option | Description | Default |
43
57
  | --- | --- | --- |
44
- | `[org]` | Workspace (organization) name | asked |
58
+ | `[org]` | Workspace (organization) name, or `.` for `--dir` itself | asked |
45
59
  | `-a, --app <name>` | First application name | asked |
46
- | `-d, --dir <path>` | Directory to create the workspace in | `.` |
60
+ | `-d, --dir <path>` | Directory to create the workspace in, as `<dir>/<org>` | `.` |
47
61
  | `-l, --libs <boolean>` | Also install the `shared` and `util` libraries (admin, user, file, and more) | `false` |
48
62
  | `-i, --init <boolean>` | Install the workspace's dependencies | `true` |
63
+ | `-s, --sample <boolean>` | Generate the sample `task` module, pages and helpers in the first app | `true` |
49
64
  | `-r, --registry <url>` | npm registry for the Akan packages (or `AKAN_NPM_REGISTRY`) | npmjs |
50
65
  | `-o, --owner <name>` | Owner of the workspace | — |
51
66
 
package/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  // pkgs/create-akan-workspace/run.ts
5
5
  import { spawn } from "child_process";
6
+ import { existsSync, readFileSync } from "fs";
7
+ import path2, { delimiter } from "path";
6
8
 
7
9
  // node_modules/.bun/commander@15.0.0/node_modules/commander/lib/error.js
8
10
  class CommanderError extends Error {
@@ -2056,6 +2058,7 @@ var engines = {
2056
2058
  var spawnProcess = (spawnCommand, command, args, options = {}) => {
2057
2059
  const proc = spawnCommand(command, args, { cwd: process.cwd(), stdio: "inherit", ...options });
2058
2060
  return new Promise((resolve, reject) => {
2061
+ proc.on("error", reject);
2059
2062
  proc.on("exit", (code, signal) => {
2060
2063
  if (code || signal)
2061
2064
  reject({ code, signal });
@@ -2064,6 +2067,20 @@ var spawnProcess = (spawnCommand, command, args, options = {}) => {
2064
2067
  });
2065
2068
  });
2066
2069
  };
2070
+ var readGlobalBinDir = () => {
2071
+ const result = Bun.spawnSync(["bun", "pm", "bin", "-g"], { stdout: "pipe", stderr: "ignore" });
2072
+ const binDir = result.stdout.toString().trim();
2073
+ return result.success && binDir ? binDir : undefined;
2074
+ };
2075
+ var getPathKey = (env) => Object.keys(env).find((key) => key.toUpperCase() === "PATH") ?? "PATH";
2076
+ var isOnPath = (env, dir) => (env[getPathKey(env)] ?? "").split(delimiter).includes(dir);
2077
+ var prependToPath = (env, dir) => {
2078
+ if (!dir || isOnPath(env, dir))
2079
+ return env;
2080
+ const pathKey = getPathKey(env);
2081
+ const current = env[pathKey];
2082
+ return { ...env, [pathKey]: current ? `${dir}${delimiter}${current}` : dir };
2083
+ };
2067
2084
  var getPackageVersion = async () => {
2068
2085
  const packageJson = await Bun.file(new URL("./package.json", import.meta.url)).json();
2069
2086
  if (!packageJson.version)
@@ -2071,10 +2088,32 @@ var getPackageVersion = async () => {
2071
2088
  return packageJson.version;
2072
2089
  };
2073
2090
  var normalizeRegistryUrl = (registryUrl) => registryUrl.replace(/\/+$/, "");
2091
+ var dotenvFiles = [
2092
+ ".env",
2093
+ ".env.local",
2094
+ ".env.development",
2095
+ ".env.development.local",
2096
+ ".env.production",
2097
+ ".env.production.local",
2098
+ ".env.test",
2099
+ ".env.test.local"
2100
+ ];
2101
+ var registryLine = /^\s*(?:export\s+)?AKAN_NPM_REGISTRY\s*[=:]/m;
2102
+ var registryFromShell = () => {
2103
+ const file = dotenvFiles.find((name) => {
2104
+ const filePath = path2.join(process.cwd(), name);
2105
+ return existsSync(filePath) && registryLine.test(readFileSync(filePath, "utf8"));
2106
+ });
2107
+ if (!file)
2108
+ return process.env.AKAN_NPM_REGISTRY;
2109
+ console.warn(`AKAN_NPM_REGISTRY is set in ${file}, which the repository controls, so it is ignored. Export it in your shell instead.`);
2110
+ return;
2111
+ };
2074
2112
  var run = async ({
2075
2113
  argv = process.argv,
2076
2114
  spawnCommand = spawn,
2077
- bunVersion = Bun.version
2115
+ bunVersion = Bun.version,
2116
+ getGlobalBinDir = readGlobalBinDir
2078
2117
  } = {}) => {
2079
2118
  if (!Bun.semver.satisfies(bunVersion.replace(/-.*$/, ""), engines.bun)) {
2080
2119
  console.error(`create-akan-workspace requires Bun ${engines.bun}, but this is Bun ${bunVersion}. Run \`bun upgrade\`, then try again.`);
@@ -2082,15 +2121,18 @@ var run = async ({
2082
2121
  return;
2083
2122
  }
2084
2123
  const program = new Command().name("create-akan-workspace");
2085
- program.argument("[org]", "organization name").option("-a, --app <string>", "application name").option("-d, --dir <string>", "directory").option("-l, --libs <boolean>", "install shared and util libraries", false).option("-i, --init <boolean>", "install dependencies and initialize git", true).option("-r, --registry <string>", "npm registry URL for installing Akan packages").option("-o, --owner <string>", "owner of the workspace").action(async (org, options) => {
2124
+ program.argument("[org]", 'organization name, or "." to create the workspace in --dir itself').option("-a, --app <string>", "application name").option("-d, --dir <string>", 'directory the workspace is created in, as <dir>/<org>, or <dir> itself for "."').option("-l, --libs <boolean>", "install shared and util libraries", false).option("-i, --init <boolean>", "install dependencies and initialize git", true).option("-s, --sample <boolean>", "generate the sample task module, pages and helpers", true).option("-r, --registry <string>", "npm registry URL for installing Akan packages").option("-o, --owner <string>", "owner of the workspace").action(async (org, options) => {
2086
2125
  const packageVersion = await getPackageVersion();
2087
- const registry = options.registry ?? process.env.AKAN_NPM_REGISTRY;
2126
+ const registry = options.registry ?? registryFromShell();
2088
2127
  const registryUrl = registry ? normalizeRegistryUrl(registry) : undefined;
2089
2128
  const registryArgs = registryUrl ? ["--registry", registryUrl] : [];
2090
- const spawnOptions = registryUrl ? { env: { ...process.env, AKAN_NPM_REGISTRY: registryUrl, NPM_CONFIG_REGISTRY: registryUrl } } : {};
2129
+ const env = registryUrl ? { ...process.env, AKAN_NPM_REGISTRY: registryUrl, NPM_CONFIG_REGISTRY: registryUrl } : process.env;
2130
+ const spawnOptions = registryUrl ? { env } : {};
2091
2131
  await spawnProcess(spawnCommand, "bun", ["install", "-g", `@akanjs/cli@${packageVersion}`, ...registryArgs], spawnOptions);
2092
2132
  const libs = options.libs === true || options.libs === "true";
2093
2133
  const init = options.init === undefined || options.init === true || options.init === "true";
2134
+ const sample = options.sample === undefined || options.sample === true || options.sample === "true";
2135
+ const globalBinDir = getGlobalBinDir();
2094
2136
  await spawnProcess(spawnCommand, "akan", [
2095
2137
  "create-workspace",
2096
2138
  ...org ? [org] : [],
@@ -2098,9 +2140,13 @@ var run = async ({
2098
2140
  ...options.dir ? [`--dir=${options.dir}`] : [],
2099
2141
  `--libs=${libs}`,
2100
2142
  `--init=${init}`,
2143
+ `--sample=${sample}`,
2101
2144
  ...registryUrl ? [`--registry=${registryUrl}`] : [],
2102
2145
  ...options.owner ? [`--owner=${options.owner}`] : []
2103
- ], spawnOptions);
2146
+ ], { env: prependToPath(env, globalBinDir) });
2147
+ if (globalBinDir && !isOnPath(process.env, globalBinDir))
2148
+ console.warn(`
2149
+ The \`akan\` command was installed to ${globalBinDir}, which is not on your PATH. Add that directory to PATH to run \`akan\` from the workspace.`);
2104
2150
  });
2105
2151
  await program.parseAsync(argv);
2106
2152
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sourceType": "module",
3
3
  "name": "create-akan-workspace",
4
- "version": "3.1.1",
4
+ "version": "3.1.2-rc.0",
5
5
  "bin": {
6
6
  "create-akan-workspace": "index.js"
7
7
  },