@locusai/cli 0.1.7 → 0.2.1

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 (62) hide show
  1. package/README.md +0 -53
  2. package/bin/locus.js +31000 -1103
  3. package/package.json +16 -7
  4. package/bin/mcp.js +0 -19744
  5. package/bin/server.js +0 -36398
  6. package/index.ts +0 -260
  7. package/public/dashboard/404.html +0 -1
  8. package/public/dashboard/_next/static/D0NXe04ZCLNDckV_quc8g/_buildManifest.js +0 -1
  9. package/public/dashboard/_next/static/D0NXe04ZCLNDckV_quc8g/_ssgManifest.js +0 -1
  10. package/public/dashboard/_next/static/chunks/138.b98511c56423f8bb.js +0 -1
  11. package/public/dashboard/_next/static/chunks/146-34259952c594a3b0.js +0 -1
  12. package/public/dashboard/_next/static/chunks/337-d3bb75304d130513.js +0 -1
  13. package/public/dashboard/_next/static/chunks/477.1a6ecfe53375bd9c.js +0 -1
  14. package/public/dashboard/_next/static/chunks/487-1808785ba665f784.js +0 -1
  15. package/public/dashboard/_next/static/chunks/544.a9569941cc886e9d.js +0 -1
  16. package/public/dashboard/_next/static/chunks/87c73c54-1f4741035a95c140.js +0 -1
  17. package/public/dashboard/_next/static/chunks/902-d6926825a9fe8784.js +0 -1
  18. package/public/dashboard/_next/static/chunks/955-c8f8f6235ae8f8c6.js +0 -1
  19. package/public/dashboard/_next/static/chunks/996.e0a334e6ae90900e.js +0 -1
  20. package/public/dashboard/_next/static/chunks/app/_not-found/page-44b1804abb44a34d.js +0 -1
  21. package/public/dashboard/_next/static/chunks/app/backlog/page-dce1450769bfae8f.js +0 -1
  22. package/public/dashboard/_next/static/chunks/app/docs/page-1efee819f25492cb.js +0 -1
  23. package/public/dashboard/_next/static/chunks/app/layout-05f504c042b9f7ee.js +0 -1
  24. package/public/dashboard/_next/static/chunks/app/page-3fd91aaaa4776ced.js +0 -1
  25. package/public/dashboard/_next/static/chunks/app/settings/page-84e16c9638d657e4.js +0 -1
  26. package/public/dashboard/_next/static/chunks/framework-152a1bc8c81c7458.js +0 -1
  27. package/public/dashboard/_next/static/chunks/main-843ab130fc1be309.js +0 -1
  28. package/public/dashboard/_next/static/chunks/main-app-123e879c5a937a00.js +0 -1
  29. package/public/dashboard/_next/static/chunks/pages/_app-a050a8e6e4fb04cf.js +0 -1
  30. package/public/dashboard/_next/static/chunks/pages/_error-3e422ffd891594de.js +0 -1
  31. package/public/dashboard/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  32. package/public/dashboard/_next/static/chunks/webpack-99a10a055b5bb9c4.js +0 -1
  33. package/public/dashboard/_next/static/css/13e8617b72f9d3aa.css +0 -1
  34. package/public/dashboard/_next/static/css/8aea088cdc4338f0.css +0 -1
  35. package/public/dashboard/_next/static/css/b301ab0424111664.css +0 -1
  36. package/public/dashboard/_next/static/media/24c15609eaa28576-s.woff2 +0 -0
  37. package/public/dashboard/_next/static/media/2c07349e02a7b712-s.woff2 +0 -0
  38. package/public/dashboard/_next/static/media/456105d6ea6d39e0-s.woff2 +0 -0
  39. package/public/dashboard/_next/static/media/47cbc4e2adbc5db9-s.p.woff2 +0 -0
  40. package/public/dashboard/_next/static/media/4f77bef990aad698-s.woff2 +0 -0
  41. package/public/dashboard/_next/static/media/627d916fd739a539-s.woff2 +0 -0
  42. package/public/dashboard/_next/static/media/63b255f18bea0ca9-s.woff2 +0 -0
  43. package/public/dashboard/_next/static/media/70bd82ac89b4fa42-s.woff2 +0 -0
  44. package/public/dashboard/_next/static/media/84602850c8fd81c3-s.woff2 +0 -0
  45. package/public/dashboard/backlog.html +0 -1
  46. package/public/dashboard/backlog.txt +0 -25
  47. package/public/dashboard/docs.html +0 -1
  48. package/public/dashboard/docs.txt +0 -26
  49. package/public/dashboard/favicon.ico +0 -0
  50. package/public/dashboard/index.html +0 -1
  51. package/public/dashboard/index.txt +0 -25
  52. package/public/dashboard/logo.png +0 -0
  53. package/public/dashboard/settings.html +0 -1
  54. package/public/dashboard/settings.txt +0 -25
  55. package/src/constants.ts +0 -28
  56. package/src/generators/locus.ts +0 -134
  57. package/src/generators/root.ts +0 -244
  58. package/src/generators/server.ts +0 -135
  59. package/src/generators/shared.ts +0 -35
  60. package/src/generators/web.ts +0 -513
  61. package/src/types.ts +0 -6
  62. package/src/utils.ts +0 -13
@@ -1,134 +0,0 @@
1
- import { Database } from "bun:sqlite";
2
- import { existsSync } from "node:fs";
3
- import { writeFile } from "node:fs/promises";
4
- import { join, resolve } from "node:path";
5
- import type { ProjectConfig } from "../types.js";
6
- import { ensureDir, writeJson } from "../utils.js";
7
-
8
- export async function initializeLocus(config: ProjectConfig) {
9
- console.log("Initializing Locus workspace...");
10
- const { projectPath, locusDir, projectName } = config;
11
-
12
- await ensureDir(locusDir);
13
-
14
- // workspace.config.json
15
- const workspaceConfig = {
16
- repoPath: projectPath,
17
- docsPath: join(locusDir, "docs"),
18
- ciPresetsPath: join(locusDir, "ci-presets.json"),
19
- projectName,
20
- };
21
- await writeJson(join(locusDir, "workspace.config.json"), workspaceConfig);
22
-
23
- // ci-presets.json
24
- const ciPresets = {
25
- quick: ["bun run lint", "bun run typecheck"],
26
- full: ["bun run lint", "bun run typecheck", "bun run build"],
27
- };
28
- await writeJson(join(locusDir, "ci-presets.json"), ciPresets);
29
-
30
- // Database
31
- const dbPath = join(locusDir, "db.sqlite");
32
- const db = new Database(dbPath);
33
- db.run(`
34
- CREATE TABLE IF NOT EXISTS tasks (
35
- id INTEGER PRIMARY KEY AUTOINCREMENT,
36
- title TEXT NOT NULL,
37
- description TEXT,
38
- status TEXT NOT NULL,
39
- priority TEXT NOT NULL DEFAULT 'MEDIUM',
40
- labels TEXT,
41
- assigneeRole TEXT,
42
- parentId INTEGER,
43
- lockedBy TEXT,
44
- lockExpiresAt INTEGER,
45
- acceptanceChecklist TEXT,
46
- createdAt INTEGER NOT NULL,
47
- updatedAt INTEGER NOT NULL,
48
- FOREIGN KEY(parentId) REFERENCES tasks(id)
49
- );`);
50
-
51
- db.run(`
52
- CREATE TABLE IF NOT EXISTS comments (
53
- id INTEGER PRIMARY KEY AUTOINCREMENT,
54
- taskId INTEGER NOT NULL,
55
- author TEXT NOT NULL,
56
- text TEXT NOT NULL,
57
- createdAt INTEGER NOT NULL,
58
- FOREIGN KEY(taskId) REFERENCES tasks(id)
59
- );`);
60
-
61
- db.run(`
62
- CREATE TABLE IF NOT EXISTS artifacts (
63
- id INTEGER PRIMARY KEY AUTOINCREMENT,
64
- taskId INTEGER NOT NULL,
65
- type TEXT NOT NULL,
66
- title TEXT NOT NULL,
67
- contentText TEXT,
68
- filePath TEXT,
69
- createdBy TEXT NOT NULL,
70
- createdAt INTEGER NOT NULL,
71
- FOREIGN KEY(taskId) REFERENCES tasks(id)
72
- );`);
73
-
74
- db.run(`
75
- CREATE TABLE IF NOT EXISTS events (
76
- id INTEGER PRIMARY KEY AUTOINCREMENT,
77
- taskId INTEGER NOT NULL,
78
- type TEXT NOT NULL,
79
- payload TEXT,
80
- createdAt INTEGER NOT NULL,
81
- FOREIGN KEY(taskId) REFERENCES tasks(id)
82
- );`);
83
-
84
- if (!existsSync(join(projectPath, "README.md"))) {
85
- await writeFile(
86
- join(projectPath, "README.md"),
87
- `# ${projectName}\n\nManaged by Locus.\n`
88
- );
89
- }
90
- }
91
-
92
- export async function logMcpConfig(config: ProjectConfig) {
93
- const { projectPath, projectName } = config;
94
-
95
- // Detect for bundled vs source mode
96
- const scriptDir = import.meta.dir;
97
- const isBundled = scriptDir.endsWith("/bin") || scriptDir.endsWith("\\bin");
98
-
99
- // In source mode, scriptDir is packages/cli/src/generators
100
- // In bundled mode, scriptDir is packages/cli/bin
101
- const locusRoot = isBundled
102
- ? resolve(scriptDir, "../")
103
- : resolve(scriptDir, "../../../../");
104
-
105
- const mcpSourcePath = join(locusRoot, "apps/mcp/src/index.ts");
106
- const mcpBundledPath = isBundled
107
- ? join(scriptDir, "mcp.js")
108
- : join(locusRoot, "packages/cli/bin/mcp.js");
109
-
110
- const mcpExecPath = existsSync(mcpSourcePath)
111
- ? mcpSourcePath
112
- : mcpBundledPath;
113
-
114
- const mcpConfig = {
115
- mcpServers: {
116
- [projectName]: {
117
- command: "bun",
118
- args: ["run", mcpExecPath, "--project", join(projectPath, ".locus")],
119
- env: {},
120
- },
121
- },
122
- };
123
-
124
- console.log("\nProject created successfully!");
125
- console.log("\nNext steps:");
126
- console.log(` cd ${projectName}`);
127
- console.log(" bun install");
128
- console.log(" bun run dev");
129
- console.log(
130
- "\nMCP Configuration (add to your IDE or Claude Desktop config):"
131
- );
132
- console.log(JSON.stringify(mcpConfig, null, 2));
133
- console.log("\n");
134
- }
@@ -1,244 +0,0 @@
1
- import { chmod, writeFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { VERSIONS } from "../constants.js";
4
- import type { ProjectConfig } from "../types.js";
5
- import { ensureDir, writeJson } from "../utils.js";
6
-
7
- export async function setupStructure(config: ProjectConfig) {
8
- console.log("Setting up monorepo structure...");
9
- const { projectPath, locusDir } = config;
10
- await ensureDir(projectPath);
11
- await ensureDir(join(projectPath, "apps/web/src"));
12
- await ensureDir(join(projectPath, "apps/server/src"));
13
- await ensureDir(join(projectPath, "packages/shared/src"));
14
- await ensureDir(join(locusDir, "artifacts"));
15
- await ensureDir(join(locusDir, "logs"));
16
- await ensureDir(join(locusDir, "docs"));
17
- await ensureDir(join(projectPath, ".husky"));
18
- await ensureDir(join(projectPath, ".vscode"));
19
- }
20
-
21
- export async function generateRootConfigs(config: ProjectConfig) {
22
- console.log("Generating root configurations...");
23
- const { projectPath, projectName, scopedName } = config;
24
-
25
- // package.json
26
- await writeJson(join(projectPath, "package.json"), {
27
- name: projectName,
28
- version: "0.1.0",
29
- private: true,
30
- type: "module",
31
- workspaces: ["apps/*", "packages/*"],
32
- engines: {
33
- node: `>=${VERSIONS.node}`,
34
- bun: `>=${VERSIONS.bun}`,
35
- },
36
- scripts: {
37
- dev: 'bun run --filter "*" dev',
38
- build: 'bun run --filter "*" build',
39
- lint: "biome lint .",
40
- format: "biome check --write .",
41
- typecheck: "tsc -b --noEmit",
42
- syncpack: "syncpack list",
43
- "syncpack:fix": "syncpack fix",
44
- prepare: "husky",
45
- },
46
- devDependencies: {
47
- "@biomejs/biome": VERSIONS.biome,
48
- typescript: VERSIONS.typescript,
49
- "@types/node": VERSIONS.typesNode,
50
- syncpack: VERSIONS.syncpack,
51
- husky: VERSIONS.husky,
52
- "@commitlint/cli": VERSIONS.commitlint,
53
- "@commitlint/config-conventional": VERSIONS.commitlintConfig,
54
- "@types/bun": VERSIONS.typesBun,
55
- },
56
- });
57
-
58
- // tsconfig.base.json
59
- await writeJson(join(projectPath, "tsconfig.base.json"), {
60
- compilerOptions: {
61
- target: "ESNext",
62
- module: "ESNext",
63
- moduleResolution: "bundler",
64
- strict: true,
65
- skipLibCheck: true,
66
- esModuleInterop: true,
67
- isolatedModules: true,
68
- resolveJsonModule: true,
69
- declaration: true,
70
- declarationMap: true,
71
- composite: true,
72
- incremental: true,
73
- lib: ["ESNext", "DOM", "DOM.Iterable"],
74
- types: ["bun-types"],
75
- },
76
- });
77
-
78
- // tsconfig.json (Solution-style)
79
- await writeJson(join(projectPath, "tsconfig.json"), {
80
- files: [],
81
- references: [
82
- { path: "./packages/shared" },
83
- { path: "./apps/web" },
84
- { path: "./apps/server" },
85
- ],
86
- });
87
-
88
- // biome.json
89
- await writeJson(join(projectPath, "biome.json"), {
90
- $schema: `https://biomejs.dev/schemas/${VERSIONS.biome}/schema.json`,
91
- vcs: { enabled: true, clientKind: "git", useIgnoreFile: true },
92
- files: {
93
- ignoreUnknown: false,
94
- includes: [
95
- "**",
96
- "!**/node_modules",
97
- "!**/dist",
98
- "!**/build",
99
- "!**/coverage",
100
- ],
101
- },
102
- formatter: {
103
- enabled: true,
104
- formatWithErrors: false,
105
- indentStyle: "space",
106
- indentWidth: 2,
107
- lineEnding: "lf",
108
- lineWidth: 80,
109
- attributePosition: "auto",
110
- },
111
- assist: { actions: { source: { organizeImports: "on" } } },
112
- linter: {
113
- enabled: true,
114
- rules: {
115
- recommended: true,
116
- complexity: {
117
- noExtraBooleanCast: "error",
118
- noUselessCatch: "error",
119
- noUselessTypeConstraint: "error",
120
- },
121
- correctness: {
122
- noConstAssign: "error",
123
- noEmptyPattern: "error",
124
- noUnusedImports: "error",
125
- noUnusedVariables: "error",
126
- useValidTypeof: "error",
127
- },
128
- style: {
129
- noNamespace: "error",
130
- useAsConstAssertion: "error",
131
- noParameterAssign: "error",
132
- noNonNullAssertion: "error",
133
- useImportType: "off",
134
- },
135
- suspicious: {
136
- noAsyncPromiseExecutor: "error",
137
- noCatchAssign: "error",
138
- noDebugger: "error",
139
- noDuplicateObjectKeys: "error",
140
- noExplicitAny: "error",
141
- },
142
- },
143
- },
144
- javascript: {
145
- globals: ["React", "JSX", "Bun"],
146
- formatter: {
147
- quoteStyle: "double",
148
- jsxQuoteStyle: "double",
149
- trailingCommas: "es5",
150
- semicolons: "always",
151
- arrowParentheses: "always",
152
- bracketSpacing: true,
153
- },
154
- },
155
- css: {
156
- parser: {
157
- tailwindDirectives: true,
158
- },
159
- },
160
- });
161
-
162
- // .syncpackrc
163
- await writeJson(join(projectPath, ".syncpackrc"), {
164
- dependencyTypes: ["dev", "prod"],
165
- semverGroups: [{ range: "", dependencies: ["**"] }],
166
- versionGroups: [
167
- {
168
- label: "Internal packages use workspace protocols",
169
- dependencies: [`${scopedName}/*`],
170
- dependencyTypes: ["prod", "dev"],
171
- pinVersion: "workspace:*",
172
- },
173
- ],
174
- });
175
-
176
- // commitlint.config.js
177
- await writeFile(
178
- join(projectPath, "commitlint.config.js"),
179
- "export default { extends: ['@commitlint/config-conventional'] };\n"
180
- );
181
-
182
- // .husky/pre-commit
183
- const preCommit = `#!/usr/bin/env bash
184
- . "$(dirname -- "$0")/_/husky.sh"
185
-
186
- bun run lint
187
- `;
188
- await writeFile(join(projectPath, ".husky/pre-commit"), preCommit);
189
- await chmod(join(projectPath, ".husky/pre-commit"), 0o755);
190
-
191
- // .gitignore
192
- const gitignore = `node_modules
193
- .next
194
- dist
195
- .locus/db.sqlite
196
- .locus/logs
197
- .locus/artifacts
198
- .DS_Store
199
- *.log
200
- .env
201
- .env.local
202
- .turbo
203
- `;
204
- await writeFile(join(projectPath, ".gitignore"), gitignore);
205
-
206
- // .nvmrc
207
- await writeFile(join(projectPath, ".nvmrc"), `${VERSIONS.node}\n`);
208
-
209
- // .vscode/settings.json
210
- await writeJson(join(projectPath, ".vscode/settings.json"), {
211
- "editor.defaultFormatter": "biomejs.biome",
212
- "editor.formatOnSave": true,
213
- "editor.codeActionsOnSave": {
214
- "source.organizeImports.biome": "explicit",
215
- },
216
- "[javascript]": {
217
- "editor.defaultFormatter": "biomejs.biome",
218
- },
219
- "[javascriptreact]": {
220
- "editor.defaultFormatter": "biomejs.biome",
221
- },
222
- "[typescript]": {
223
- "editor.defaultFormatter": "biomejs.biome",
224
- },
225
- "[typescriptreact]": {
226
- "editor.defaultFormatter": "biomejs.biome",
227
- },
228
- "[json]": {
229
- "editor.defaultFormatter": "biomejs.biome",
230
- },
231
- "[jsonc]": {
232
- "editor.defaultFormatter": "biomejs.biome",
233
- },
234
- "files.associations": {
235
- "*.css": "tailwindcss",
236
- "*.scss": "tailwindcss",
237
- },
238
- });
239
-
240
- // .vscode/extensions.json
241
- await writeJson(join(projectPath, ".vscode/extensions.json"), {
242
- recommendations: ["biomejs.biome"],
243
- });
244
- }
@@ -1,135 +0,0 @@
1
- import { writeFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { VERSIONS } from "../constants.js";
4
- import type { ProjectConfig } from "../types.js";
5
- import { ensureDir, writeJson } from "../utils.js";
6
-
7
- export async function generateAppServer(config: ProjectConfig) {
8
- const { projectPath, scopedName } = config;
9
- const appDir = join(projectPath, "apps/server");
10
- const srcDir = join(appDir, "src");
11
-
12
- await ensureDir(srcDir);
13
-
14
- await writeJson(join(appDir, "package.json"), {
15
- name: `${scopedName}/server`,
16
- version: "0.1.0",
17
- private: true,
18
- type: "module",
19
- scripts: {
20
- dev: "nest start --watch",
21
- build: "nest build",
22
- start: "nest start",
23
- },
24
- dependencies: {
25
- "@nestjs/common": VERSIONS.nestjs,
26
- "@nestjs/core": VERSIONS.nestjs,
27
- "@nestjs/platform-express": VERSIONS.nestjs,
28
- "reflect-metadata": "^0.2.0",
29
- rxjs: "^7.8.0",
30
- [`${scopedName}/shared`]: "workspace:*",
31
- },
32
- devDependencies: {
33
- "@nestjs/cli": VERSIONS.nestjs,
34
- "@nestjs/schematics": VERSIONS.nestjs,
35
- "@types/node": VERSIONS.typesNode,
36
- typescript: VERSIONS.typescript,
37
- },
38
- });
39
-
40
- await writeJson(join(appDir, "tsconfig.json"), {
41
- extends: "../../tsconfig.base.json",
42
- compilerOptions: {
43
- removeComments: true,
44
- emitDecoratorMetadata: true,
45
- experimentalDecorators: true,
46
- allowSyntheticDefaultImports: true,
47
- target: "ESNext",
48
- sourceMap: true,
49
- outDir: "./dist",
50
- baseUrl: "./",
51
- incremental: true,
52
- skipLibCheck: true,
53
- strictNullChecks: false,
54
- noImplicitAny: false,
55
- strictBindCallApply: false,
56
- forceConsistentCasingInFileNames: false,
57
- noFallthroughCasesInSwitch: false,
58
- },
59
- include: ["src"],
60
- });
61
-
62
- await writeFile(join(appDir, ".env.example"), "PORT=8000\n");
63
- await writeFile(join(appDir, ".env"), "PORT=8000\n");
64
-
65
- // nest-cli.json
66
- await writeJson(join(appDir, "nest-cli.json"), {
67
- $schema: "https://json.schemastore.org/nest-cli",
68
- collection: "@nestjs/schematics",
69
- sourceRoot: "src",
70
- compilerOptions: {
71
- deleteOutDir: true,
72
- },
73
- });
74
-
75
- await writeFile(
76
- join(srcDir, "main.ts"),
77
- `import { NestFactory } from '@nestjs/core';
78
- import { AppModule } from './app.module.js';
79
-
80
- async function bootstrap() {
81
- const app = await NestFactory.create(AppModule);
82
- app.enableCors();
83
- const port = process.env.PORT || 8000;
84
- await app.listen(port);
85
- console.log(\`Application is running on: http://localhost:\${port}\`);
86
- }
87
- bootstrap();
88
- `
89
- );
90
-
91
- await writeFile(
92
- join(srcDir, "app.module.ts"),
93
- `import { Module } from '@nestjs/common';
94
- import { AppController } from './app.controller.js';
95
- import { AppService } from './app.service.js';
96
-
97
- @Module({
98
- imports: [],
99
- controllers: [AppController],
100
- providers: [AppService],
101
- })
102
- export class AppModule {}
103
- `
104
- );
105
-
106
- await writeFile(
107
- join(srcDir, "app.controller.ts"),
108
- `import { Controller, Get } from '@nestjs/common';
109
- import { AppService } from './app.service.js';
110
-
111
- @Controller()
112
- export class AppController {
113
- constructor(private readonly appService: AppService) {}
114
-
115
- @Get()
116
- getHello(): string {
117
- return this.appService.getHello();
118
- }
119
- }
120
- `
121
- );
122
-
123
- await writeFile(
124
- join(srcDir, "app.service.ts"),
125
- `import { Injectable } from '@nestjs/common';
126
-
127
- @Injectable()
128
- export class AppService {
129
- getHello(): string {
130
- return 'Hello World!';
131
- }
132
- }
133
- `
134
- );
135
- }
@@ -1,35 +0,0 @@
1
- import { writeFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { VERSIONS } from "../constants.js";
4
- import type { ProjectConfig } from "../types.js";
5
- import { writeJson } from "../utils.js";
6
-
7
- export async function generatePackageShared(config: ProjectConfig) {
8
- const { projectPath, scopedName } = config;
9
- const pkgDir = join(projectPath, "packages/shared");
10
-
11
- await writeJson(join(pkgDir, "package.json"), {
12
- name: `${scopedName}/shared`,
13
- version: "0.1.0",
14
- private: true,
15
- type: "module",
16
- main: "./src/index.ts",
17
- types: "./src/index.ts",
18
- scripts: {
19
- build: "tsc",
20
- },
21
- devDependencies: {
22
- typescript: VERSIONS.typescript,
23
- },
24
- });
25
-
26
- await writeJson(join(pkgDir, "tsconfig.json"), {
27
- extends: "../../tsconfig.base.json",
28
- include: ["src"],
29
- });
30
-
31
- await writeFile(
32
- join(pkgDir, "src/index.ts"),
33
- `export const VERSION = '0.1.0';\n`
34
- );
35
- }