@proletariat/cli 0.3.9 → 0.3.11

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 (152) hide show
  1. package/README.md +25 -0
  2. package/bin/dev.js +0 -0
  3. package/dist/commands/action/index.js +1 -1
  4. package/dist/commands/action/run.js +8 -12
  5. package/dist/commands/agent/auth.d.ts +30 -0
  6. package/dist/commands/agent/auth.js +172 -0
  7. package/dist/commands/agent/discover.d.ts +9 -0
  8. package/dist/commands/agent/discover.js +67 -0
  9. package/dist/commands/agent/index.js +47 -12
  10. package/dist/commands/agent/list.d.ts +4 -1
  11. package/dist/commands/agent/list.js +78 -16
  12. package/dist/commands/agent/login.js +35 -31
  13. package/dist/commands/agent/restart.js +2 -0
  14. package/dist/commands/agent/shell.js +78 -19
  15. package/dist/commands/agent/staff/add.js +1 -12
  16. package/dist/commands/agent/staff/remove.js +9 -7
  17. package/dist/commands/agent/status.js +17 -4
  18. package/dist/commands/agent/temp/cleanup.js +7 -3
  19. package/dist/commands/agent/themes/index.js +4 -5
  20. package/dist/commands/agent/themes/list.js +5 -5
  21. package/dist/commands/agent/visit.js +17 -4
  22. package/dist/commands/branch/create.d.ts +4 -0
  23. package/dist/commands/branch/create.js +16 -8
  24. package/dist/commands/branch/index.js +1 -1
  25. package/dist/commands/branch/where.js +1 -0
  26. package/dist/commands/claude.d.ts +38 -0
  27. package/dist/commands/claude.js +899 -0
  28. package/dist/commands/commit.js +1 -1
  29. package/dist/commands/config/index.d.ts +12 -0
  30. package/dist/commands/config/index.js +271 -0
  31. package/dist/commands/docker/clean.js +2 -2
  32. package/dist/commands/docker/index.js +2 -2
  33. package/dist/commands/docker/list.js +3 -8
  34. package/dist/commands/docker/logs.js +2 -2
  35. package/dist/commands/docker/prune.js +1 -1
  36. package/dist/commands/docker/restart.js +2 -2
  37. package/dist/commands/docker/shell.js +2 -2
  38. package/dist/commands/docker/start.js +2 -2
  39. package/dist/commands/docker/status.js +1 -1
  40. package/dist/commands/docker/stop.js +2 -2
  41. package/dist/commands/docker/sync.js +2 -2
  42. package/dist/commands/epic/index.js +1 -1
  43. package/dist/commands/epic/link/index.js +25 -14
  44. package/dist/commands/epic/link/remove.js +2 -0
  45. package/dist/commands/epic/list.js +5 -5
  46. package/dist/commands/epic/progress.js +10 -4
  47. package/dist/commands/epic/spec.js +2 -0
  48. package/dist/commands/epic/ticket.js +3 -0
  49. package/dist/commands/execution/stop.js +1 -0
  50. package/dist/commands/init.js +4 -4
  51. package/dist/commands/project/index.js +1 -1
  52. package/dist/commands/project/spec.js +7 -0
  53. package/dist/commands/repo/add.js +1 -0
  54. package/dist/commands/repo/remove.js +1 -0
  55. package/dist/commands/roadmap/add-project.d.ts +18 -0
  56. package/dist/commands/roadmap/add-project.js +135 -0
  57. package/dist/commands/roadmap/create.d.ts +22 -0
  58. package/dist/commands/roadmap/create.js +156 -0
  59. package/dist/commands/roadmap/delete.d.ts +17 -0
  60. package/dist/commands/roadmap/delete.js +104 -0
  61. package/dist/commands/roadmap/generate.d.ts +22 -0
  62. package/dist/commands/roadmap/generate.js +201 -0
  63. package/dist/commands/roadmap/index.d.ts +13 -0
  64. package/dist/commands/roadmap/index.js +61 -0
  65. package/dist/commands/roadmap/list.d.ts +12 -0
  66. package/dist/commands/roadmap/list.js +42 -0
  67. package/dist/commands/roadmap/remove-project.d.ts +18 -0
  68. package/dist/commands/roadmap/remove-project.js +147 -0
  69. package/dist/commands/roadmap/reorder.d.ts +17 -0
  70. package/dist/commands/roadmap/reorder.js +157 -0
  71. package/dist/commands/roadmap/update.d.ts +19 -0
  72. package/dist/commands/roadmap/update.js +136 -0
  73. package/dist/commands/roadmap/view.d.ts +16 -0
  74. package/dist/commands/roadmap/view.js +103 -0
  75. package/dist/commands/spec/index.js +1 -1
  76. package/dist/commands/spec/link/index.js +24 -13
  77. package/dist/commands/spec/link/remove.js +2 -0
  78. package/dist/commands/status/index.js +1 -1
  79. package/dist/commands/status/list.js +0 -8
  80. package/dist/commands/template/delete.js +2 -0
  81. package/dist/commands/terminal/title.d.ts +12 -0
  82. package/dist/commands/terminal/title.js +48 -0
  83. package/dist/commands/ticket/complete.js +2 -0
  84. package/dist/commands/ticket/create.js +4 -2
  85. package/dist/commands/ticket/delete.js +2 -0
  86. package/dist/commands/ticket/edit.js +8 -2
  87. package/dist/commands/ticket/link/index.js +17 -3
  88. package/dist/commands/ticket/link/remove.js +2 -0
  89. package/dist/commands/ticket/list.js +1 -2
  90. package/dist/commands/ticket/move.js +2 -0
  91. package/dist/commands/ticket/project.js +3 -1
  92. package/dist/commands/ticket/reassign.js +2 -0
  93. package/dist/commands/ticket/spec.js +4 -2
  94. package/dist/commands/ticket/template/apply.js +4 -3
  95. package/dist/commands/ticket/template/create.js +2 -0
  96. package/dist/commands/ticket/template/index.js +1 -1
  97. package/dist/commands/ticket/update.js +2 -0
  98. package/dist/commands/work/index.js +1 -1
  99. package/dist/commands/work/revise.js +7 -1
  100. package/dist/commands/work/spawn.d.ts +2 -1
  101. package/dist/commands/work/spawn.js +131 -36
  102. package/dist/commands/work/start.d.ts +2 -1
  103. package/dist/commands/work/start.js +349 -69
  104. package/dist/commands/work/watch.js +10 -2
  105. package/dist/commands/workflow/create.js +3 -3
  106. package/dist/commands/workflow/switch.js +2 -1
  107. package/dist/commands/workspace/remove.js +0 -8
  108. package/dist/commands/workspace/use.js +1 -9
  109. package/dist/lib/agents/commands.js +18 -13
  110. package/dist/lib/database/index.d.ts +19 -12
  111. package/dist/lib/database/index.js +158 -42
  112. package/dist/lib/docker/resolve.js +1 -1
  113. package/dist/lib/execution/config.d.ts +6 -0
  114. package/dist/lib/execution/config.js +15 -2
  115. package/dist/lib/execution/devcontainer.d.ts +2 -0
  116. package/dist/lib/execution/devcontainer.js +41 -9
  117. package/dist/lib/execution/runners.d.ts +85 -3
  118. package/dist/lib/execution/runners.js +925 -228
  119. package/dist/lib/execution/spawner.d.ts +2 -2
  120. package/dist/lib/execution/spawner.js +4 -3
  121. package/dist/lib/execution/storage.d.ts +2 -1
  122. package/dist/lib/execution/storage.js +9 -13
  123. package/dist/lib/execution/types.d.ts +10 -1
  124. package/dist/lib/execution/types.js +3 -1
  125. package/dist/lib/init/index.js +1 -0
  126. package/dist/lib/machine-config.js +1 -1
  127. package/dist/lib/pmo/base-command.js +5 -9
  128. package/dist/lib/pmo/index.js +2 -0
  129. package/dist/lib/pmo/schema.d.ts +6 -0
  130. package/dist/lib/pmo/schema.js +36 -0
  131. package/dist/lib/pmo/storage/base.js +3 -3
  132. package/dist/lib/pmo/storage/index.d.ts +16 -1
  133. package/dist/lib/pmo/storage/index.js +45 -0
  134. package/dist/lib/pmo/storage/roadmaps.d.ts +62 -0
  135. package/dist/lib/pmo/storage/roadmaps.js +301 -0
  136. package/dist/lib/pmo/storage/specs.js +2 -0
  137. package/dist/lib/pmo/storage/types.d.ts +14 -0
  138. package/dist/lib/pmo/sync-manager.d.ts +1 -1
  139. package/dist/lib/pmo/sync-manager.js +1 -1
  140. package/dist/lib/pmo/types.d.ts +41 -0
  141. package/dist/lib/pmo/utils.d.ts +2 -0
  142. package/dist/lib/pmo/utils.js +22 -1
  143. package/dist/lib/repos/index.js +7 -1
  144. package/dist/lib/terminal.d.ts +31 -0
  145. package/dist/lib/terminal.js +48 -0
  146. package/dist/lib/themes.d.ts +21 -3
  147. package/dist/lib/themes.js +80 -23
  148. package/dist/lib/workspace-config.d.ts +80 -0
  149. package/dist/lib/workspace-config.js +100 -0
  150. package/oclif.manifest.json +4065 -3225
  151. package/package.json +10 -6
  152. package/LICENSE +0 -21
@@ -7,6 +7,7 @@
7
7
  import * as fs from 'node:fs';
8
8
  import * as path from 'node:path';
9
9
  import { DEFAULT_EXECUTION_CONFIG } from './types.js';
10
+ import { parseChannel } from '../workspace-config.js';
10
11
  /**
11
12
  * Generate default devcontainer.json content
12
13
  *
@@ -16,13 +17,28 @@ import { DEFAULT_EXECUTION_CONFIG } from './types.js';
16
17
  */
17
18
  export function generateDevcontainerJson(options, config) {
18
19
  const cfg = config || DEFAULT_EXECUTION_CONFIG;
20
+ // Parse the channel to determine registry and version
21
+ const channel = parseChannel(options.prltChannel || 'npm');
22
+ const useMount = channel.registry === 'mount';
23
+ // Build args for Dockerfile
24
+ const buildArgs = {
25
+ TZ: options.timezone || 'America/Los_Angeles',
26
+ };
27
+ // Pass registry and version to Dockerfile
28
+ // For mount mode, we pass PRLT_REGISTRY=mount so Dockerfile skips npm install
29
+ buildArgs.PRLT_REGISTRY = channel.registry;
30
+ if (!useMount) {
31
+ buildArgs.PRLT_VERSION = channel.version || 'latest';
32
+ }
33
+ // For GitHub Packages, pass GITHUB_TOKEN as build arg
34
+ if (channel.registry === 'gh') {
35
+ buildArgs.GITHUB_TOKEN = '${localEnv:GITHUB_TOKEN}';
36
+ }
19
37
  const devcontainerJson = {
20
38
  name: `Agent: ${options.agentName}`,
21
39
  build: {
22
40
  dockerfile: 'Dockerfile',
23
- args: {
24
- TZ: options.timezone || 'America/Los_Angeles',
25
- },
41
+ args: buildArgs,
26
42
  },
27
43
  customizations: {
28
44
  vscode: {
@@ -49,6 +65,8 @@ export function generateDevcontainerJson(options, config) {
49
65
  'source=claude-credentials,target=/home/node/.claude,type=volume',
50
66
  // NOTE: ~/.claude.json is COPIED (not mounted) to /workspace/.claude.json
51
67
  // to avoid corruption from concurrent writes by multiple containers
68
+ // NOTE: SSH agent socket mounting doesn't work reliably on Docker Desktop for Mac
69
+ // So we use HTTPS + token approach instead. The token is fetched fresh at spawn time.
52
70
  'source=${localEnv:PRLT_HQ_PATH}/.proletariat,target=/hq/.proletariat,type=bind',
53
71
  // PMO path can be anywhere (e.g., /hq/pmo or /hq/repos/myrepo/pmo)
54
72
  // Use PRLT_PMO_PATH env var to mount the actual location to /hq/pmo
@@ -57,6 +75,9 @@ export function generateDevcontainerJson(options, config) {
57
75
  // Worktree .git files reference paths like /Users/.../repos/{repoName}/.git/worktrees/name
58
76
  // These mounts make those paths accessible inside the container at /hq/repos/{repoName}
59
77
  ...(options.repoWorktrees || []).map(repoName => `source=\${localEnv:PRLT_HQ_PATH}/repos/${repoName},target=/hq/repos/${repoName},type=bind`),
78
+ // If using "mount" channel, mount local prlt build from PRLT_REPO_PATH
79
+ // The setup-prlt.sh script will detect /opt/prlt and configure the wrapper
80
+ ...(useMount ? ['source=${localEnv:PRLT_REPO_PATH},target=/opt/prlt,type=bind,readonly'] : []),
60
81
  ],
61
82
  containerEnv: {
62
83
  DEVCONTAINER: 'true',
@@ -129,8 +150,17 @@ USER node
129
150
  RUN npm install -g pnpm && npm install -g @anthropic-ai/claude-code
130
151
  USER root
131
152
 
132
- # Install prlt CLI from npm
133
- RUN npm install -g @proletariat/cli
153
+ # Install prlt CLI from public npm
154
+ # PRLT_REGISTRY: "npm" (install from npmjs.com) or "mount" (use host mount)
155
+ # PRLT_VERSION: version/tag like "latest", "dev", "next", or "1.2.3"
156
+ ARG PRLT_REGISTRY=npm
157
+ ARG PRLT_VERSION=latest
158
+ RUN if [ "\${PRLT_REGISTRY}" = "npm" ] || [ "\${PRLT_REGISTRY}" = "gh" ]; then \\
159
+ echo "Installing @proletariat/cli@\${PRLT_VERSION} from npm..." && \\
160
+ npm install -g @proletariat/cli@\${PRLT_VERSION}; \\
161
+ else \\
162
+ echo "prlt will be mounted from host (mount mode)"; \\
163
+ fi
134
164
 
135
165
  # Copy and set up scripts
136
166
  COPY init-firewall.sh /usr/local/bin/init-firewall.sh
@@ -365,8 +395,8 @@ if [ -f "/workspace/.claude.json" ]; then
365
395
  echo "Claude credentials copied"
366
396
  fi
367
397
 
368
- # Configure git to use GitHub token for authentication
369
- # Check for token in environment or get from gh CLI
398
+ # Configure git authentication using GitHub token
399
+ # Token is passed via GITHUB_TOKEN env var (set fresh at spawn time by runners.ts)
370
400
  TOKEN=""
371
401
  if [ -n "$GITHUB_TOKEN" ]; then
372
402
  TOKEN="$GITHUB_TOKEN"
@@ -398,7 +428,7 @@ if [ -n "$TOKEN" ]; then
398
428
 
399
429
  echo "Git configured for GitHub push via HTTPS"
400
430
  else
401
- echo "Warning: No GitHub token found, push to GitHub will require manual auth"
431
+ echo "Warning: No GitHub token found, git push will require manual auth"
402
432
  fi
403
433
 
404
434
  # Check if prlt is already installed globally (via npm from GitHub Packages)
@@ -456,7 +486,9 @@ LOADER_EOF
456
486
  NODE_NO_WARNINGS=1 exec node --experimental-loader /home/node/.prlt-local/loader.mjs /opt/prlt/apps/cli/bin/run.js "$@"
457
487
  WRAPPER_EOF
458
488
  chmod +x "$WRAPPER"
459
- echo "prlt wrapper ready at $WRAPPER"
489
+ # Create prltdev symlink for consistency with dev environment
490
+ ln -sf "$WRAPPER" /home/node/.npm-global/bin/prltdev
491
+ echo "prlt wrapper ready at $WRAPPER (also available as prltdev)"
460
492
  else
461
493
  echo "No mounted prlt found, skipping setup"
462
494
  fi
@@ -10,6 +10,54 @@ import { ExecutionEnvironment, DisplayMode, SessionManager, ExecutorType, Execut
10
10
  * Example: "TKT-347-implement-altman"
11
11
  */
12
12
  export declare function buildSessionName(context: ExecutionContext): string;
13
+ import type { TerminalApp } from './types.js';
14
+ /**
15
+ * Check if tmux control mode (-CC) should be used.
16
+ * Control mode is only used with iTerm when controlMode is enabled in config.
17
+ *
18
+ * When control mode is active:
19
+ * - iTerm handles scrolling, selection, and gestures natively
20
+ * - tmux mouse mode should be disabled to avoid conflicts
21
+ */
22
+ export declare function shouldUseControlMode(terminalApp: TerminalApp, controlModeEnabled: boolean): boolean;
23
+ /**
24
+ * Build the tmux mouse option string for session creation.
25
+ * Enables mouse mode for scroll support in tmux.
26
+ * To select text or switch tabs, hold Shift or Option to bypass tmux.
27
+ */
28
+ export declare function buildTmuxMouseOption(_useControlMode: boolean): string;
29
+ /**
30
+ * Build the tmux attach command based on control mode.
31
+ * Uses -u -CC flags for iTerm control mode (native scrolling/selection).
32
+ * -u forces UTF-8 mode which is required for proper iTerm integration.
33
+ * Uses regular attach otherwise.
34
+ */
35
+ export declare function buildTmuxAttachCommand(useControlMode: boolean, includeUnicodeFlag?: boolean): string;
36
+ /**
37
+ * Configure iTerm tmux preferences for control mode.
38
+ * - windowMode: whether tmux -CC opens windows as tabs or new windows
39
+ * - autoHide: automatically bury/hide the control session (the terminal where -CC was run)
40
+ * @param mode - 'tab' for tabs in current window, 'window' for new windows
41
+ */
42
+ export declare function configureITermTmuxPreferences(mode: 'tab' | 'window'): void;
43
+ export declare function configureITermTmuxWindowMode(mode: 'tab' | 'window'): void;
44
+ /**
45
+ * Check if the claude-credentials Docker volume exists.
46
+ */
47
+ export declare function credentialsVolumeExists(): boolean;
48
+ /**
49
+ * Check if valid Claude credentials exist in the Docker volume.
50
+ * Returns true if credentials exist and are not expired.
51
+ */
52
+ export declare function dockerCredentialsExist(): boolean;
53
+ /**
54
+ * Get Docker credential info for display.
55
+ * Returns expiration date and subscription type if available.
56
+ */
57
+ export declare function getDockerCredentialInfo(): {
58
+ expiresAt: Date;
59
+ subscriptionType?: string;
60
+ } | null;
13
61
  export interface RunnerResult {
14
62
  success: boolean;
15
63
  pid?: string;
@@ -29,6 +77,17 @@ export type Runner = (context: ExecutionContext, executor: ExecutorType, config:
29
77
  * - User can reattach with `prlt session attach` if tab is closed
30
78
  */
31
79
  export declare function runHost(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, displayMode?: DisplayMode): Promise<RunnerResult>;
80
+ /**
81
+ * Check if GitHub token is available for git push operations.
82
+ * Checks environment variables first, then tries gh auth token.
83
+ * Returns the token if available, null otherwise.
84
+ */
85
+ export declare function getGitHubToken(): string | null;
86
+ /**
87
+ * Check if GitHub token is available.
88
+ * Returns true if token is available via env vars or gh CLI.
89
+ */
90
+ export declare function isGitHubTokenAvailable(): boolean;
32
91
  /**
33
92
  * Check if Docker daemon is running.
34
93
  * Returns true if Docker is available and responsive.
@@ -36,9 +95,32 @@ export declare function runHost(context: ExecutionContext, executor: ExecutorTyp
36
95
  */
37
96
  export declare function isDockerRunning(): boolean;
38
97
  /**
39
- * Run command inside a devcontainer.
40
- * Uses the devcontainer CLI to start/exec in a VS Code devcontainer.
41
- * Provides filesystem isolation - agent can only access mounted worktrees.
98
+ * Check if the devcontainer CLI is installed.
99
+ * Returns true if the CLI is available, false otherwise.
100
+ * @deprecated No longer required - we use raw Docker commands now
101
+ */
102
+ export declare function isDevcontainerCliInstalled(): boolean;
103
+ /**
104
+ * Get the container name for an agent.
105
+ * Format: prlt-agent-{agentName}
106
+ */
107
+ export declare function getAgentContainerName(agentName: string): string;
108
+ /**
109
+ * Check if a Docker container exists (running or stopped).
110
+ */
111
+ export declare function containerExists(containerName: string): boolean;
112
+ /**
113
+ * Check if a Docker container is running.
114
+ */
115
+ export declare function isContainerRunning(containerName: string): boolean;
116
+ /**
117
+ * Get the container ID for a running container.
118
+ */
119
+ export declare function getContainerId(containerName: string): string | null;
120
+ /**
121
+ * Run command inside a Docker container.
122
+ * Uses raw Docker commands for filesystem isolation - no devcontainer CLI required.
123
+ * Agent can only access mounted worktrees and configured paths.
42
124
  *
43
125
  * @param displayMode - How to display output (terminal, foreground, background, tmux)
44
126
  * @param sessionManager - How to manage the session inside the container (tmux, direct)