mcoda 0.1.19 → 0.1.21

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 (27) hide show
  1. package/dist/commands/backlog/OrderTasksCommand.d.ts +2 -0
  2. package/dist/commands/backlog/OrderTasksCommand.d.ts.map +1 -1
  3. package/dist/commands/backlog/OrderTasksCommand.js +38 -2
  4. package/dist/commands/docs/DocsCommands.d.ts.map +1 -1
  5. package/dist/commands/docs/DocsCommands.js +11 -11
  6. package/dist/commands/estimate/EstimateCommands.d.ts.map +1 -1
  7. package/dist/commands/estimate/EstimateCommands.js +28 -27
  8. package/dist/commands/openapi/OpenapiCommands.d.ts +1 -0
  9. package/dist/commands/openapi/OpenapiCommands.d.ts.map +1 -1
  10. package/dist/commands/openapi/OpenapiCommands.js +11 -1
  11. package/dist/commands/planning/CreateTasksCommand.d.ts.map +1 -1
  12. package/dist/commands/planning/CreateTasksCommand.js +18 -12
  13. package/dist/commands/planning/QaTasksCommand.d.ts +14 -0
  14. package/dist/commands/planning/QaTasksCommand.d.ts.map +1 -1
  15. package/dist/commands/planning/QaTasksCommand.js +89 -7
  16. package/dist/commands/review/CodeReviewCommand.d.ts +14 -0
  17. package/dist/commands/review/CodeReviewCommand.d.ts.map +1 -1
  18. package/dist/commands/review/CodeReviewCommand.js +133 -4
  19. package/dist/commands/work/WorkOnTasksCommand.d.ts +15 -1
  20. package/dist/commands/work/WorkOnTasksCommand.d.ts.map +1 -1
  21. package/dist/commands/work/WorkOnTasksCommand.js +140 -8
  22. package/dist/commands/workspace/ProjectGuidanceCommand.d.ts +1 -0
  23. package/dist/commands/workspace/ProjectGuidanceCommand.d.ts.map +1 -1
  24. package/dist/commands/workspace/ProjectGuidanceCommand.js +81 -1
  25. package/dist/commands/workspace/SetWorkspaceCommand.d.ts.map +1 -1
  26. package/dist/commands/workspace/SetWorkspaceCommand.js +37 -1
  27. package/package.json +5 -5
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import os from "node:os";
4
4
  import { promises as fs } from "node:fs";
5
5
  import { createRequire } from "node:module";
6
- import { WorkspaceResolver } from "@mcoda/core";
6
+ import { WorkspaceResolver, ensureProjectGuidance } from "@mcoda/core";
7
7
  import { WorkspaceRepository } from "@mcoda/db";
8
8
  const USAGE = "Usage: mcoda set-workspace [--workspace-root <path>] [--no-git] [--no-docdex] [--codex-no-sandbox[=true|false]]";
9
9
  const DOCDEX_ENV_URLS = ["MCODA_DOCDEX_URL", "DOCDEX_URL"];
@@ -1402,6 +1402,23 @@ const ensureDocsDirs = async (mcodaDir) => {
1402
1402
  await fs.mkdir(path.join(mcodaDir, "docs", "sds"), { recursive: true });
1403
1403
  await fs.mkdir(path.join(mcodaDir, "jobs"), { recursive: true });
1404
1404
  };
1405
+ const listWorkspaceProjects = async (workspaceRoot) => {
1406
+ const repo = await WorkspaceRepository.create(workspaceRoot);
1407
+ try {
1408
+ const rows = await repo
1409
+ .getDb()
1410
+ .all(`SELECT key, created_at FROM projects ORDER BY created_at ASC, key ASC`);
1411
+ return rows
1412
+ .map((row) => ({ key: String(row.key), createdAt: row.created_at ?? null }))
1413
+ .filter((row) => row.key.trim().length > 0);
1414
+ }
1415
+ catch {
1416
+ return [];
1417
+ }
1418
+ finally {
1419
+ await repo.close();
1420
+ }
1421
+ };
1405
1422
  const ensureGitRepo = async (workspaceRoot) => {
1406
1423
  try {
1407
1424
  await fs.access(path.join(workspaceRoot, ".git"));
@@ -1496,8 +1513,27 @@ export class SetWorkspaceCommand {
1496
1513
  const config = await readWorkspaceConfig(resolution.mcodaDir);
1497
1514
  await writeWorkspaceConfig(resolution.mcodaDir, { ...config, codexNoSandbox: parsed.codexNoSandbox });
1498
1515
  }
1516
+ const configuredProjectKey = typeof resolution.config?.projectKey === "string" && resolution.config.projectKey.trim().length > 0
1517
+ ? resolution.config.projectKey.trim()
1518
+ : undefined;
1519
+ const existingProjects = configuredProjectKey ? [] : await listWorkspaceProjects(resolution.workspaceRoot);
1520
+ const bootstrapProjectKey = configuredProjectKey ?? existingProjects[0]?.key;
1499
1521
  await ensureDocsDirs(resolution.mcodaDir);
1500
1522
  await (await WorkspaceRepository.create(resolution.workspaceRoot)).close();
1523
+ try {
1524
+ const guidance = await ensureProjectGuidance(resolution.workspaceRoot, {
1525
+ mcodaDir: resolution.mcodaDir,
1526
+ projectKey: bootstrapProjectKey,
1527
+ });
1528
+ if (guidance.status !== "existing") {
1529
+ // eslint-disable-next-line no-console
1530
+ console.log(`Project guidance ${guidance.status}: ${guidance.path}`);
1531
+ }
1532
+ }
1533
+ catch (error) {
1534
+ // eslint-disable-next-line no-console
1535
+ console.warn(`Project guidance bootstrap failed: ${error instanceof Error ? error.message : String(error)}`);
1536
+ }
1501
1537
  await ensureDocdexUrl(resolution.mcodaDir, resolution.workspaceRoot);
1502
1538
  let gitInited = false;
1503
1539
  if (parsed.git) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcoda",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Local-first CLI for planning, documentation, and execution workflows with agent assistance.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "yaml": "^2.4.2",
48
- "@mcoda/core": "0.1.19",
49
- "@mcoda/shared": "0.1.19"
48
+ "@mcoda/core": "0.1.21",
49
+ "@mcoda/shared": "0.1.21"
50
50
  },
51
51
  "devDependencies": {
52
- "@mcoda/db": "0.1.19",
53
- "@mcoda/integrations": "0.1.19"
52
+ "@mcoda/db": "0.1.21",
53
+ "@mcoda/integrations": "0.1.21"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -p tsconfig.json",