@vectorplane/ctrl-cli 0.1.9 → 0.1.10

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.md CHANGED
@@ -17,6 +17,8 @@ vp login
17
17
  vp logout
18
18
  vp status
19
19
  vp sync
20
+ vp context --workspace <workspace> --delivery
21
+ vp session check-in --workspace <workspace> --agent codex --type codex --client openai-codex --feature feature-key --task task-key --owning-path "src/core,src/ui" --need "api-contract" --provide "implementation" --status "starting implementation"
20
22
  vp draft create --type progress --title "Entrega concluída" --content "Resumo da mudança"
21
23
  ```
22
24
 
@@ -53,6 +55,12 @@ vp draft create --type progress --title "Entrega concluída" --content "Resumo d
53
55
  - suporta `ui`, `ux`, `project_skeleton`, `template_engineering`, `patterns`, `progress`, `decisions` e `architecture`
54
56
  - aceita `--no-impact` para registrar explicitamente quando uma lane não foi afetada
55
57
 
58
+ ### `vp session`
59
+
60
+ - suporta `check-in`, `heartbeat` e `check-out`
61
+ - permite declarar `feature`, `task`, `component`, `role`, `owning-path`, `need`, `provide` e `status`
62
+ - deve ser usado em conjunto com `vp context --delivery` para reduzir conflito entre agentes ativos
63
+
56
64
  ### Comandos adicionais já implementados
57
65
 
58
66
  - `vp whoami`
@@ -1,4 +1,4 @@
1
- import { getStringOption, parseArgs } from "../core/cli.js";
1
+ import { getStringListOption, getStringOption, parseArgs } from "../core/cli.js";
2
2
  import { ensureSessionAvailable, getProfileState, updateProfileState } from "../core/config.js";
3
3
  import { collectGitContext } from "../core/git.js";
4
4
  import { collectMachineContext, collectRuntimeContext } from "../core/machine.js";
@@ -7,6 +7,25 @@ import { ensureFreshSession, resolveWorkspaceSlug } from "../core/session.js";
7
7
  import { VectorPlaneApiClient } from "../core/api.js";
8
8
  import { deriveClientInstanceId, getBoundWorkspace, resolveWorkspaceRoot } from "../core/workspace-binding.js";
9
9
  import { ValidationError } from "../core/errors.js";
10
+ function readCollaborationMetadata(parsed, rootPath) {
11
+ const owningPaths = getStringListOption(parsed, "owning-path");
12
+ const needs = getStringListOption(parsed, "need");
13
+ const provides = getStringListOption(parsed, "provide");
14
+ const relatedWorkspaceIds = getStringListOption(parsed, "related-workspace");
15
+ return {
16
+ source: "vp-cli",
17
+ rootPath,
18
+ featureKey: getStringOption(parsed, "feature"),
19
+ taskKey: getStringOption(parsed, "task"),
20
+ component: getStringOption(parsed, "component"),
21
+ role: getStringOption(parsed, "role"),
22
+ statusSummary: getStringOption(parsed, "status"),
23
+ owningPaths: owningPaths.length > 0 ? owningPaths : undefined,
24
+ needs: needs.length > 0 ? needs : undefined,
25
+ provides: provides.length > 0 ? provides : undefined,
26
+ relatedWorkspaceIds: relatedWorkspaceIds.length > 0 ? relatedWorkspaceIds : undefined,
27
+ };
28
+ }
10
29
  export async function runSessionCommand(cliVersion, args) {
11
30
  const parsed = parseArgs(args);
12
31
  const [subcommand] = parsed.positionals;
@@ -38,6 +57,7 @@ export async function runSessionCommand(cliVersion, args) {
38
57
  throw new ValidationError("Nenhum workspace resolvido para a sessão.");
39
58
  }
40
59
  const clientInstanceId = getStringOption(parsed, "client-instance-id") ?? deriveClientInstanceId(runtime.device.machineId, rootPath, git);
60
+ const metadata = readCollaborationMetadata(parsed, rootPath);
41
61
  if (subcommand === "check-in") {
42
62
  const response = await apiClient.checkInAgent(freshSession.accessToken, {
43
63
  workspaceId: workspace,
@@ -48,10 +68,7 @@ export async function runSessionCommand(cliVersion, args) {
48
68
  repoUrl: git.remoteOrigin ?? undefined,
49
69
  branch: git.branch,
50
70
  commitSha: git.commitHash,
51
- metadata: {
52
- source: "vp-cli",
53
- rootPath,
54
- },
71
+ metadata,
55
72
  });
56
73
  const sessionId = String(response.id ?? response.sessionId ?? "");
57
74
  await updateProfileState(runtime.profile.name, {
@@ -62,6 +79,12 @@ export async function runSessionCommand(cliVersion, args) {
62
79
  });
63
80
  process.stdout.write(`Session ID: ${sessionId || "não retornado"}\n`);
64
81
  process.stdout.write(`Client Instance ID: ${clientInstanceId}\n`);
82
+ if (metadata.featureKey) {
83
+ process.stdout.write(`Feature: ${metadata.featureKey}\n`);
84
+ }
85
+ if (metadata.taskKey) {
86
+ process.stdout.write(`Task: ${metadata.taskKey}\n`);
87
+ }
65
88
  return 0;
66
89
  }
67
90
  if (subcommand === "heartbeat") {
@@ -74,16 +97,16 @@ export async function runSessionCommand(cliVersion, args) {
74
97
  clientInstanceId,
75
98
  branch: git.branch,
76
99
  commitSha: git.commitHash,
77
- metadata: {
78
- source: "vp-cli",
79
- rootPath,
80
- },
100
+ metadata,
81
101
  });
82
102
  await updateProfileState(runtime.profile.name, {
83
103
  lastCommand: "session:heartbeat",
84
104
  lastError: null,
85
105
  });
86
106
  process.stdout.write(`Heartbeat enviado para ${sessionId}\n`);
107
+ if (metadata.statusSummary) {
108
+ process.stdout.write(`Status: ${metadata.statusSummary}\n`);
109
+ }
87
110
  return 0;
88
111
  }
89
112
  if (subcommand === "check-out") {
@@ -95,6 +118,9 @@ export async function runSessionCommand(cliVersion, args) {
95
118
  sessionId,
96
119
  metadata: {
97
120
  source: "vp-cli",
121
+ featureKey: metadata.featureKey,
122
+ taskKey: metadata.taskKey,
123
+ statusSummary: metadata.statusSummary,
98
124
  },
99
125
  });
100
126
  await updateProfileState(runtime.profile.name, {
@@ -5,5 +5,6 @@ export interface ParsedArgs {
5
5
  export declare function parseArgs(args: string[]): ParsedArgs;
6
6
  export declare function getStringOption(parsed: ParsedArgs, key: string): string | undefined;
7
7
  export declare function getBooleanOption(parsed: ParsedArgs, key: string): boolean;
8
+ export declare function getStringListOption(parsed: ParsedArgs, key: string): string[];
8
9
  export declare function requirePositional(parsed: ParsedArgs, index: number, message: string): string;
9
10
  export declare function parseJsonOption(value: string | undefined, fallback?: Record<string, unknown>): Record<string, unknown>;
package/dist/core/cli.js CHANGED
@@ -38,6 +38,16 @@ export function getBooleanOption(parsed, key) {
38
38
  }
39
39
  return false;
40
40
  }
41
+ export function getStringListOption(parsed, key) {
42
+ const value = getStringOption(parsed, key);
43
+ if (!value) {
44
+ return [];
45
+ }
46
+ return [...new Set(value
47
+ .split(",")
48
+ .map((item) => item.trim())
49
+ .filter(Boolean))];
50
+ }
41
51
  export function requirePositional(parsed, index, message) {
42
52
  const value = parsed.positionals[index];
43
53
  if (!value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorplane/ctrl-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Official VectorPlane CLI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",