@meistrari/tela-cli 0.7.0 → 0.7.5

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 (59) hide show
  1. package/README.md +56 -106
  2. package/dist/commands/auth.d.ts +2 -0
  3. package/dist/commands/context.d.ts +2 -0
  4. package/dist/commands/doctor-auth.d.ts +2 -0
  5. package/dist/commands/env.d.ts +2 -0
  6. package/dist/credentials.d.ts +2 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +7027 -0
  9. package/dist/output.d.ts +13 -0
  10. package/dist/program.d.ts +2 -0
  11. package/package.json +17 -24
  12. package/scripts/install-skills.cjs +127 -0
  13. package/skills/tela-cli/SKILL.md +20 -0
  14. package/skills/tela-cli/references/agent.md +111 -0
  15. package/cli.ts +0 -25
  16. package/postinstall.sh +0 -19
  17. package/src/agent-api.ts +0 -300
  18. package/src/assets.d.ts +0 -4
  19. package/src/auth.ts +0 -432
  20. package/src/claude.ts +0 -101
  21. package/src/commands/doctor.ts +0 -35
  22. package/src/commands/feedback.ts +0 -701
  23. package/src/commands/metadata.ts +0 -242
  24. package/src/commands/push.ts +0 -208
  25. package/src/commands/run.ts +0 -1699
  26. package/src/commands/status.ts +0 -109
  27. package/src/commands/sync.ts +0 -245
  28. package/src/commit-message.ts +0 -69
  29. package/src/config.ts +0 -799
  30. package/src/diagnostics.ts +0 -813
  31. package/src/errors.ts +0 -122
  32. package/src/forgejo.ts +0 -233
  33. package/src/git.ts +0 -457
  34. package/src/ink/assets/160092__jorickhoofd__dog-bark-1.mp3 +0 -0
  35. package/src/ink/bark.tsx +0 -241
  36. package/src/ink/components.tsx +0 -178
  37. package/src/ink/runtime.tsx +0 -90
  38. package/src/ink/screens/feedback-screen.tsx +0 -395
  39. package/src/ink/screens/push-screen.tsx +0 -232
  40. package/src/ink/screens/run-screen.tsx +0 -292
  41. package/src/ink/screens/setup/breadcrumb.tsx +0 -24
  42. package/src/ink/screens/setup/setup-screen.tsx +0 -612
  43. package/src/ink/screens/setup/step-frame.tsx +0 -31
  44. package/src/ink/screens/setup/steps/done-step.tsx +0 -29
  45. package/src/ink/screens/setup/steps/environment-step.tsx +0 -23
  46. package/src/ink/screens/setup/steps/organization-step.tsx +0 -35
  47. package/src/ink/screens/setup/steps/review-step.tsx +0 -78
  48. package/src/ink/screens/setup/steps/running-step.tsx +0 -37
  49. package/src/ink/screens/setup/steps/ssh-key-step.tsx +0 -48
  50. package/src/ink/screens/setup/steps/text-field-step.tsx +0 -18
  51. package/src/ink/screens/setup/steps.ts +0 -156
  52. package/src/ink/screens/setup/types.ts +0 -65
  53. package/src/ink/screens/sync-screen.tsx +0 -283
  54. package/src/process.ts +0 -251
  55. package/src/program.ts +0 -2105
  56. package/src/runtime.ts +0 -147
  57. package/src/types.ts +0 -165
  58. package/src/ui.ts +0 -295
  59. package/src/version.ts +0 -3
@@ -1,242 +0,0 @@
1
- export interface CommandExample {
2
- command: string
3
- description: string
4
- }
5
-
6
- export interface CommandMetadata {
7
- name: string
8
- summary: string
9
- argumentHint?: string
10
- aliases?: string[]
11
- whenToUse: string
12
- examples: CommandExample[]
13
- supportsJson: boolean
14
- relatedCommands: string[]
15
- }
16
-
17
- const COMMANDS: CommandMetadata[] = [
18
- {
19
- name: 'setup',
20
- summary: 'Configure Tela CLI, sign in with device flow, choose the workspace organization, provision Forgejo access, and verify the local environment',
21
- whenToUse: 'Run this first on a new machine, or any time your environment target, clone root, Tela session, or SSH key changes.',
22
- examples: [
23
- {
24
- command: 'tela setup',
25
- description: 'Choose production, staging, or a custom environment, complete browser-based sign-in, select the workspace organization, and provision Forgejo access with an SSH key',
26
- },
27
- ],
28
- supportsJson: false,
29
- relatedCommands: ['status', 'doctor', 'sync'],
30
- },
31
- {
32
- name: 'sync',
33
- summary: 'Clone or update a Tela repository, or refresh the current checkout',
34
- argumentHint: '[repo]',
35
- whenToUse: 'Use this before coding to get a clean local checkout, or to refresh every repository under the configured clone root. SSH-backed sync automatically accepts first-seen host keys during clone and update flows.',
36
- examples: [
37
- {
38
- command: 'tela sync agent-api',
39
- description: 'Clone or update a specific repository under the clone root',
40
- },
41
- {
42
- command: 'tela sync --current',
43
- description: 'Sync the repository for the current working directory',
44
- },
45
- {
46
- command: 'tela sync --all',
47
- description: 'Refresh every repository directly under the clone root',
48
- },
49
- ],
50
- supportsJson: true,
51
- relatedCommands: ['setup', 'status', 'doctor', 'run', 'push'],
52
- },
53
- {
54
- name: 'run',
55
- summary: 'Run the local agent repository with project-scoped Claude',
56
- whenToUse: 'Use this from inside an agent repository when you want Claude to follow the repo-local contract files, ignore user/global Claude config by default, show its progress live, and produce the expected result artifact.',
57
- examples: [
58
- {
59
- command: 'tela run',
60
- description: 'Run the current agent repository with project-scoped Claude and the live viewer',
61
- },
62
- {
63
- command: 'tela run --plain',
64
- description: 'Force project-scoped execution with scrollback-first text output',
65
- },
66
- {
67
- command: 'tela run --json',
68
- description: 'Emit the final project-scoped execution and artifact envelope as JSON',
69
- },
70
- ],
71
- supportsJson: true,
72
- relatedCommands: ['sync', 'status', 'doctor'],
73
- },
74
- {
75
- name: 'push',
76
- summary: 'Preview, commit, and push the current repository',
77
- whenToUse: 'Use this after reviewing local changes when you want Tela to stage everything, produce a commit message, and push the branch.',
78
- examples: [
79
- {
80
- command: 'tela push',
81
- description: 'Choose the commit-message flow interactively',
82
- },
83
- {
84
- command: 'tela push --claude',
85
- description: 'Generate a commit message from the current worktree',
86
- },
87
- {
88
- command: 'tela push --message "Update feedback flow"',
89
- description: 'Skip prompts and use an explicit commit message',
90
- },
91
- ],
92
- supportsJson: true,
93
- relatedCommands: ['run', 'status', 'feedback', 'doctor'],
94
- },
95
- {
96
- name: 'feedback',
97
- summary: 'Guided review of commit feedback with optional Claude handoff',
98
- whenToUse: 'Use this after pushing or after a feedback-producing commit when you want a guided review of the feedback, a prompt preview before launch, and an outcome summary after Claude exits.',
99
- examples: [
100
- {
101
- command: 'tela feedback --list',
102
- description: 'Open the guided review flow without launching Claude',
103
- },
104
- {
105
- command: 'tela feedback --apply all',
106
- description: 'Preview and launch Claude against every actionable suggestion',
107
- },
108
- {
109
- command: 'tela feedback --apply select',
110
- description: 'Choose specific actionable suggestions before launching Claude',
111
- },
112
- ],
113
- supportsJson: true,
114
- relatedCommands: ['push', 'status', 'doctor'],
115
- },
116
- {
117
- name: 'status',
118
- summary: 'Show Tela config, session state, tool availability, repo state, and Agent API reachability',
119
- whenToUse: 'Use this for a quick snapshot of whether the local environment is ready before running mutating commands.',
120
- examples: [
121
- {
122
- command: 'tela status',
123
- description: 'Render a human-readable environment summary',
124
- },
125
- {
126
- command: 'tela status --json',
127
- description: 'Emit a machine-readable status report',
128
- },
129
- ],
130
- supportsJson: true,
131
- relatedCommands: ['setup', 'doctor', 'sync', 'run', 'push', 'feedback'],
132
- },
133
- {
134
- name: 'doctor',
135
- summary: 'Diagnose config, auth session, tools, filesystem state, repo health, and Agent API reachability',
136
- aliases: ['diag'],
137
- whenToUse: 'Use this when Tela fails or behaves unexpectedly and you need exact remediation steps.',
138
- examples: [
139
- {
140
- command: 'tela doctor',
141
- description: 'Run the full diagnostic suite with remediation guidance',
142
- },
143
- {
144
- command: 'tela doctor --json',
145
- description: 'Emit structured diagnostic output for scripts',
146
- },
147
- ],
148
- supportsJson: true,
149
- relatedCommands: ['status', 'setup', 'sync', 'run'],
150
- },
151
- ]
152
-
153
- export function getCommandMetadata(name: string): CommandMetadata | undefined {
154
- return COMMANDS.find(command => command.name === name)
155
- }
156
-
157
- export function listCommandMetadata(): CommandMetadata[] {
158
- return [...COMMANDS]
159
- }
160
-
161
- export function renderReadmeMarkdown(): string {
162
- const lines = [
163
- '# Tela CLI',
164
- '',
165
- 'Tela CLI is a one-shot terminal tool for syncing Tela repositories, running local agents, preparing pushes, and applying commit feedback with Claude.',
166
- '',
167
- '## Installation',
168
- '',
169
- '```bash',
170
- 'bun install -g @meistrari/tela-cli',
171
- '```',
172
- '',
173
- 'This installs the package globally and adds a `tela` alias to your `~/.zshrc`. After installing, either open a new terminal or run:',
174
- '',
175
- '```bash',
176
- 'source ~/.zshrc',
177
- '```',
178
- '',
179
- '## Default command',
180
- '',
181
- '### `tela`',
182
- '',
183
- 'List workspace repositories that are available to sync locally.',
184
- '',
185
- 'When to use: Run this with no subcommand when you want to see which workspace repositories are available before using `tela sync <repo>`.',
186
- '',
187
- 'Examples:',
188
- '- `tela` — Render the available repositories in a human-readable table',
189
- '- `tela --json` — Emit the available repositories as JSON',
190
- '',
191
- '## Version',
192
- '',
193
- 'Examples:',
194
- '- `tela --version` — Print the current Tela CLI version',
195
- '- `tela -v` — Print the current Tela CLI version',
196
- '',
197
- '## Commands',
198
- '',
199
- ]
200
-
201
- for (const command of COMMANDS) {
202
- lines.push(`### \`${command.name}${command.argumentHint ? ` ${command.argumentHint}` : ''}\``)
203
- lines.push('')
204
- lines.push(command.summary)
205
- lines.push('')
206
- lines.push(`When to use: ${command.whenToUse}`)
207
- lines.push('')
208
-
209
- if (command.aliases?.length) {
210
- lines.push(`Aliases: ${command.aliases.map(alias => `\`${alias}\``).join(', ')}`)
211
- lines.push('')
212
- }
213
-
214
- lines.push('Examples:')
215
- for (const example of command.examples) {
216
- lines.push(`- \`${example.command}\` — ${example.description}`)
217
- }
218
- lines.push('')
219
- }
220
-
221
- lines.push('## Output modes')
222
- lines.push('')
223
- lines.push('- Human output is structured for terminal use with grouped summaries and next actions.')
224
- lines.push('- `--json` is available on read-heavy flows and on `tela run` for the final execution envelope.')
225
- lines.push('')
226
- lines.push('## `tela run` scope')
227
- lines.push('')
228
- lines.push('- `tela run` loads project-scoped Claude settings by default and excludes user/global Claude config.')
229
- lines.push('- Remaining external inputs are explicit: Claude\'s built-in system prompt, managed enterprise settings, auth/provider credentials, minimal shell runtime environment, and the default model when `agent.config.json` does not set one.')
230
- lines.push('')
231
- lines.push('## First run')
232
- lines.push('')
233
- lines.push('1. `tela setup`')
234
- lines.push('2. `tela status`')
235
- lines.push('3. `tela sync <repo>` or `tela sync --current`')
236
- lines.push('4. `tela run`')
237
- lines.push('5. `tela push`')
238
- lines.push('6. `tela feedback --list`')
239
- lines.push('')
240
-
241
- return `${lines.join('\n').trimEnd()}\n`
242
- }
@@ -1,208 +0,0 @@
1
- import type { ClaudeCommitContext } from '../commit-message.ts'
2
- import {
3
- fallbackCommitMessageFromFiles,
4
- generateCommitMessageWithClaude,
5
- } from '../commit-message.ts'
6
- import {
7
- buildFallbackCommitMessage,
8
- commitWithMessage,
9
- getChangedFilesAgainstHead,
10
- getCurrentBranch,
11
- getDiffAgainstHead,
12
- getRecentLog,
13
- getRepositoryRoot,
14
- getHeadShortSha,
15
- getShortStatus,
16
- getStatusCounts,
17
- getStagedDiff,
18
- getStagedFiles,
19
- getUpstreamBranch,
20
- pushBranch,
21
- stageAll,
22
- } from '../git.ts'
23
- import { CommandError } from '../process.ts'
24
- import type { PushResult } from '../types.ts'
25
-
26
- export interface PushRepositoryOptions {
27
- cwd?: string
28
- mode: 'manual' | 'claude'
29
- manualMessage?: string
30
- generateCommitMessage?: (context: ClaudeCommitContext) => Promise<string>
31
- resolvedMessage?: ResolvedCommitMessage
32
- }
33
-
34
- export interface ResolvedCommitMessage {
35
- message: string
36
- source: 'manual' | 'claude' | 'fallback'
37
- fallbackReason?: string
38
- }
39
-
40
- export interface PushPreview {
41
- repoRoot: string
42
- branch?: string
43
- upstream?: string | null
44
- detached: boolean
45
- hasChanges: boolean
46
- worktreeStatus: string
47
- statusCounts: {
48
- staged: number
49
- unstaged: number
50
- untracked: number
51
- total: number
52
- }
53
- suggestedMessage?: string
54
- messageSource?: ResolvedCommitMessage['source']
55
- fallbackReason?: string
56
- }
57
-
58
- function shouldRetryCommit(error: unknown): boolean {
59
- if (!(error instanceof CommandError)) {
60
- return false
61
- }
62
-
63
- const details = `${error.result.stdout}\n${error.result.stderr}`.toLowerCase()
64
- return details.includes('hook')
65
- || details.includes('pre-commit')
66
- || details.includes('modified')
67
- || details.includes('stashed changes conflicted')
68
- }
69
-
70
- async function resolveCommitMessage(
71
- repoRoot: string,
72
- options: PushRepositoryOptions,
73
- mode: 'staged' | 'worktree' = 'staged',
74
- ): Promise<ResolvedCommitMessage> {
75
- if (options.mode === 'manual' && options.manualMessage?.trim()) {
76
- return {
77
- message: options.manualMessage.trim(),
78
- source: 'manual',
79
- }
80
- }
81
-
82
- const [status, diff, log, files] = await Promise.all([
83
- getShortStatus(repoRoot),
84
- mode === 'staged' ? getStagedDiff(repoRoot) : getDiffAgainstHead(repoRoot),
85
- getRecentLog(repoRoot),
86
- mode === 'staged' ? getStagedFiles(repoRoot) : getChangedFilesAgainstHead(repoRoot),
87
- ])
88
-
89
- const generateCommitMessage = options.generateCommitMessage ?? generateCommitMessageWithClaude
90
-
91
- try {
92
- const generatedMessage = await generateCommitMessage({ status, diff, log })
93
- if (generatedMessage.trim()) {
94
- return {
95
- message: generatedMessage.trim(),
96
- source: 'claude',
97
- }
98
- }
99
- }
100
- catch (error) {
101
- const fallbackMessage = fallbackCommitMessageFromFiles(files) || buildFallbackCommitMessage(files)
102
- return {
103
- message: fallbackMessage,
104
- source: 'fallback',
105
- fallbackReason: error instanceof Error ? error.message : String(error),
106
- }
107
- }
108
-
109
- return {
110
- message: fallbackCommitMessageFromFiles(files) || buildFallbackCommitMessage(files),
111
- source: 'fallback',
112
- fallbackReason: 'Claude returned an empty commit message.',
113
- }
114
- }
115
-
116
- function isDetachedHeadError(error: unknown): boolean {
117
- return error instanceof Error && error.message.includes('Detached HEAD')
118
- }
119
-
120
- export async function previewPush(options: PushRepositoryOptions): Promise<PushPreview> {
121
- const repoRoot = await getRepositoryRoot(options.cwd ?? process.cwd())
122
- const [worktreeStatus, statusCounts] = await Promise.all([
123
- getShortStatus(repoRoot),
124
- getStatusCounts(repoRoot),
125
- ])
126
-
127
- let branch: string | undefined
128
- let detached = false
129
- try {
130
- branch = await getCurrentBranch(repoRoot)
131
- }
132
- catch (error) {
133
- if (!isDetachedHeadError(error)) {
134
- throw error
135
- }
136
-
137
- detached = true
138
- }
139
-
140
- const upstream = detached ? null : await getUpstreamBranch(repoRoot)
141
- const hasChanges = Boolean(worktreeStatus.trim())
142
-
143
- let suggestedMessage: string | undefined
144
- let messageSource: ResolvedCommitMessage['source'] | undefined
145
- let fallbackReason: string | undefined
146
- if (hasChanges) {
147
- const resolved = await resolveCommitMessage(repoRoot, options, 'worktree')
148
- suggestedMessage = resolved.message
149
- messageSource = resolved.source
150
- fallbackReason = resolved.fallbackReason
151
- }
152
-
153
- return {
154
- repoRoot,
155
- branch,
156
- upstream,
157
- detached,
158
- hasChanges,
159
- worktreeStatus: worktreeStatus.trim(),
160
- statusCounts,
161
- suggestedMessage,
162
- messageSource,
163
- fallbackReason,
164
- }
165
- }
166
-
167
- export async function pushRepository(options: PushRepositoryOptions): Promise<PushResult> {
168
- const repoRoot = await getRepositoryRoot(options.cwd ?? process.cwd())
169
- const worktreeStatus = await getShortStatus(repoRoot)
170
- if (!worktreeStatus.trim()) {
171
- throw new Error('No changes to push.')
172
- }
173
-
174
- await stageAll(repoRoot)
175
-
176
- const resolvedMessage = options.resolvedMessage ?? await resolveCommitMessage(repoRoot, options)
177
- const message = resolvedMessage.message
178
-
179
- let retriedCommit = false
180
- try {
181
- await commitWithMessage(repoRoot, message)
182
- }
183
- catch (error) {
184
- if (!shouldRetryCommit(error)) {
185
- throw error
186
- }
187
-
188
- retriedCommit = true
189
- await stageAll(repoRoot)
190
- await commitWithMessage(repoRoot, message)
191
- }
192
-
193
- const branch = await getCurrentBranch(repoRoot)
194
- const upstream = await getUpstreamBranch(repoRoot)
195
-
196
- await pushBranch(repoRoot, branch, !upstream)
197
-
198
- return {
199
- repoRoot,
200
- branch,
201
- message,
202
- retriedCommit,
203
- commitSha: await getHeadShortSha(repoRoot),
204
- upstream: await getUpstreamBranch(repoRoot),
205
- messageSource: resolvedMessage.source,
206
- fallbackReason: resolvedMessage.fallbackReason,
207
- }
208
- }