@meistrari/tela-cli 0.6.0 → 0.7.4

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 -240
  36. package/src/ink/components.tsx +0 -177
  37. package/src/ink/runtime.tsx +0 -89
  38. package/src/ink/screens/feedback-screen.tsx +0 -394
  39. package/src/ink/screens/push-screen.tsx +0 -231
  40. package/src/ink/screens/run-screen.tsx +0 -291
  41. package/src/ink/screens/setup/breadcrumb.tsx +0 -23
  42. package/src/ink/screens/setup/setup-screen.tsx +0 -611
  43. package/src/ink/screens/setup/step-frame.tsx +0 -30
  44. package/src/ink/screens/setup/steps/done-step.tsx +0 -28
  45. package/src/ink/screens/setup/steps/environment-step.tsx +0 -22
  46. package/src/ink/screens/setup/steps/organization-step.tsx +0 -34
  47. package/src/ink/screens/setup/steps/review-step.tsx +0 -77
  48. package/src/ink/screens/setup/steps/running-step.tsx +0 -36
  49. package/src/ink/screens/setup/steps/ssh-key-step.tsx +0 -47
  50. package/src/ink/screens/setup/steps/text-field-step.tsx +0 -17
  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 -282
  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,34 +0,0 @@
1
- import React from 'react'
2
- import { Text } from 'ink'
3
- import { AppFrame, Section, SelectList } from '../../../components.tsx'
4
- import type { TelaCliAuthState, TelaCliForgejoOrganization } from '../../../../types.ts'
5
-
6
- export function OrganizationStep(props: {
7
- auth: TelaCliAuthState
8
- organizations: TelaCliForgejoOrganization[]
9
- currentIndex: number
10
- preferredOrganizationId?: string
11
- }): React.ReactElement {
12
- return (
13
- <AppFrame
14
- title="Setup"
15
- subtitle="Choose the workspace organization for Forgejo access."
16
- footer="↑/↓ choose · Enter continue · Esc back"
17
- >
18
- <Section title="Authenticated">
19
- <Text>User: {props.auth.user.email}</Text>
20
- <Text>Workspace: {props.auth.workspace.title}</Text>
21
- </Section>
22
- <Section title="Forgejo organization">
23
- <SelectList
24
- items={props.organizations.map(organization => ({
25
- key: organization.id,
26
- label: organization.name,
27
- hint: organization.id === props.preferredOrganizationId ? 'saved from previous setup' : undefined,
28
- }))}
29
- currentIndex={props.currentIndex}
30
- />
31
- </Section>
32
- </AppFrame>
33
- )
34
- }
@@ -1,77 +0,0 @@
1
- import React from 'react'
2
- import { Text } from 'ink'
3
- import { DEVICE_FLOW_BROWSER_HELP } from '../../../../config.ts'
4
- import type { SelectedSshPublicKey } from '../../../../forgejo.ts'
5
- import type { TelaCliAuthState, TelaCliForgejoOrganization } from '../../../../types.ts'
6
- import { AppFrame, Callout, Section } from '../../../components.tsx'
7
- import { getEnvironmentLabel } from '../steps.ts'
8
- import type { SetupFormValues } from '../types.ts'
9
-
10
- export interface ResolvedReviewConfig {
11
- agentApiUrl: string
12
- authApiUrl: string
13
- authDashboardUrl: string
14
- telaApiUrl: string
15
- requesterApplicationId: string
16
- targetApplicationId: string
17
- }
18
-
19
- export function ReviewStep(props: {
20
- values: SetupFormValues
21
- resolvedConfig: ResolvedReviewConfig
22
- auth: TelaCliAuthState | null
23
- selectedOrganization: TelaCliForgejoOrganization | null
24
- selectedSshKey: SelectedSshPublicKey | undefined
25
- cloneRootState: { exists: boolean, isDirectory: boolean }
26
- createCloneRoot: boolean
27
- }): React.ReactElement {
28
- const awaitingAuthentication = !props.auth || !props.selectedOrganization
29
-
30
- return (
31
- <AppFrame
32
- title="Setup"
33
- subtitle={awaitingAuthentication
34
- ? 'Review your configuration before signing in.'
35
- : 'Review the resolved workspace access before Forgejo provisioning.'}
36
- footer={awaitingAuthentication
37
- ? 'Enter start sign-in · Space toggle clone-root creation · Esc back'
38
- : 'Enter provision Forgejo · Space toggle clone-root creation · Esc back'}
39
- >
40
- <Section title="Review">
41
- <Text>Environment: {getEnvironmentLabel(props.values.environment)}</Text>
42
- <Text>Agent API origin: {props.resolvedConfig.agentApiUrl}</Text>
43
- <Text>Auth API URL: {props.resolvedConfig.authApiUrl}</Text>
44
- <Text>Auth dashboard URL: {props.resolvedConfig.authDashboardUrl}</Text>
45
- <Text>Tela API URL: {props.resolvedConfig.telaApiUrl}</Text>
46
- <Text>Requester app: {props.resolvedConfig.requesterApplicationId}</Text>
47
- <Text>Target app: {props.resolvedConfig.targetApplicationId}</Text>
48
- <Text>Clone root: {props.values.cloneRoot}</Text>
49
- <Text>User: {props.auth?.user.email ?? '<pending sign-in>'}</Text>
50
- <Text>Workspace: {props.auth?.workspace.title ?? '<pending sign-in>'}</Text>
51
- <Text>Organization: {props.selectedOrganization?.name ?? '<resolve after sign-in>'}</Text>
52
- <Text>Forgejo provisioning: yes</Text>
53
- <Text>
54
- SSH key:
55
- {' '}
56
- {props.selectedSshKey
57
- ? `${props.selectedSshKey.title} (${props.selectedSshKey.path})`
58
- : '<missing>'}
59
- </Text>
60
- <Text>SSH private key: {props.values.sshPrivateKeyPath || '<missing>'}</Text>
61
- <Text>
62
- Clone root state:
63
- {' '}
64
- {props.cloneRootState.exists
65
- ? (props.cloneRootState.isDirectory ? 'existing directory' : 'existing non-directory path')
66
- : 'missing'}
67
- </Text>
68
- {!props.cloneRootState.exists ? (
69
- <Text>Create clone root if missing: {props.createCloneRoot ? 'yes' : 'no'}</Text>
70
- ) : null}
71
- </Section>
72
- {awaitingAuthentication ? (
73
- <Callout tone="info">{DEVICE_FLOW_BROWSER_HELP}</Callout>
74
- ) : null}
75
- </AppFrame>
76
- )
77
- }
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
- import { Text } from 'ink'
3
- import { DEVICE_FLOW_BROWSER_HELP } from '../../../../config.ts'
4
- import { AppFrame, Callout, Section, SpinnerText } from '../../../components.tsx'
5
-
6
- export function RunningStep(props: {
7
- stage: 'auth' | 'provision'
8
- organizationName?: string
9
- verificationUrl: string | null
10
- userCode: string | null
11
- progressLines: string[]
12
- }): React.ReactElement {
13
- const provisioning = props.stage === 'provision'
14
-
15
- return (
16
- <AppFrame
17
- title="Setup"
18
- subtitle={provisioning
19
- ? 'Provisioning Forgejo access for the selected workspace organization.'
20
- : 'Authenticating your Tela workspace.'}
21
- status={provisioning
22
- ? `Provisioning Forgejo access${props.organizationName ? ` for ${props.organizationName}` : ''}`
23
- : 'Waiting for browser-based authorization'}
24
- >
25
- <Section title={provisioning ? 'Provisioning' : 'Authentication'}>
26
- <SpinnerText label={provisioning ? 'Provisioning Forgejo access' : 'Polling auth approval'} />
27
- {!provisioning && props.verificationUrl ? <Text>Verification URL: {props.verificationUrl}</Text> : null}
28
- {!provisioning && props.userCode ? <Text>User code: {props.userCode}</Text> : null}
29
- {props.progressLines.map((line, index) => (
30
- <Text key={`${index}-${line}`}>{line}</Text>
31
- ))}
32
- </Section>
33
- {!provisioning ? <Callout tone="info">{DEVICE_FLOW_BROWSER_HELP}</Callout> : null}
34
- </AppFrame>
35
- )
36
- }
@@ -1,47 +0,0 @@
1
- import React from 'react'
2
- import { Callout, SelectList } from '../../../components.tsx'
3
- import type { SelectedSshPublicKey } from '../../../../forgejo.ts'
4
- import { CUSTOM_SSH_KEY_OPTION } from '../types.ts'
5
-
6
- export interface SshKeyOption {
7
- key: string
8
- label: string
9
- hint?: string
10
- }
11
-
12
- export function buildSshKeyOptions(sshPublicKeys: SelectedSshPublicKey[]): SshKeyOption[] {
13
- return [
14
- ...sshPublicKeys.map(key => ({
15
- key: key.path,
16
- label: key.title,
17
- hint: key.path,
18
- })),
19
- {
20
- key: CUSTOM_SSH_KEY_OPTION,
21
- label: 'Custom path…',
22
- hint: 'Load another public key file',
23
- },
24
- ]
25
- }
26
-
27
- export function SshKeyStep(props: {
28
- options: SshKeyOption[]
29
- selection: string
30
- hasDiscoveredKeys: boolean
31
- }): React.ReactElement {
32
- const currentIndex = Math.max(
33
- props.options.findIndex(option => option.key === props.selection),
34
- 0,
35
- )
36
-
37
- return (
38
- <>
39
- <SelectList items={props.options} currentIndex={currentIndex} />
40
- {!props.hasDiscoveredKeys ? (
41
- <Callout tone="info">
42
- No `~/.ssh/*.pub` keys were found. Use Custom path… to continue.
43
- </Callout>
44
- ) : null}
45
- </>
46
- )
47
- }
@@ -1,17 +0,0 @@
1
- import React from 'react'
2
- import { TextEntry } from '../../../components.tsx'
3
-
4
- export function TextFieldStep(props: {
5
- value: string
6
- placeholder?: string
7
- error?: string
8
- }): React.ReactElement {
9
- return (
10
- <TextEntry
11
- label=""
12
- value={props.value}
13
- placeholder={props.placeholder}
14
- error={props.error}
15
- />
16
- )
17
- }
@@ -1,156 +0,0 @@
1
- import { ENVIRONMENT_PRESET_OPTIONS } from '../../../config.ts'
2
- import { CUSTOM_SSH_KEY_OPTION, type SetupFormValues } from './types.ts'
3
-
4
- export type SetupStepId =
5
- | 'environment'
6
- | 'agentApiUrl'
7
- | 'authApiUrl'
8
- | 'authDashboardUrl'
9
- | 'telaApiUrl'
10
- | 'requesterApplicationId'
11
- | 'targetApplicationId'
12
- | 'cloneRoot'
13
- | 'sshKey'
14
- | 'sshKeyPath'
15
- | 'sshPrivateKeyPath'
16
-
17
- export type SetupStepKind = 'select-environment' | 'select-ssh-key' | 'text'
18
-
19
- export interface SetupStepDescriptor {
20
- id: SetupStepId
21
- label: string
22
- question: string
23
- kind: SetupStepKind
24
- placeholder?: string
25
- visible: (values: SetupFormValues) => boolean
26
- }
27
-
28
- export const EDIT_STEPS: readonly SetupStepDescriptor[] = [
29
- {
30
- id: 'environment',
31
- label: 'Environment',
32
- question: 'Which Tela environment do you want to use?',
33
- kind: 'select-environment',
34
- visible: () => true,
35
- },
36
- {
37
- id: 'agentApiUrl',
38
- label: 'Agent API URL',
39
- question: 'Custom Agent API origin URL',
40
- kind: 'text',
41
- placeholder: 'https://agent-api.example.com',
42
- visible: values => values.environment === 'custom',
43
- },
44
- {
45
- id: 'authApiUrl',
46
- label: 'Auth API URL',
47
- question: 'Custom Auth API URL',
48
- kind: 'text',
49
- placeholder: 'https://auth.example.com',
50
- visible: values => values.environment === 'custom',
51
- },
52
- {
53
- id: 'authDashboardUrl',
54
- label: 'Auth Dashboard URL',
55
- question: 'Custom Auth dashboard URL',
56
- kind: 'text',
57
- placeholder: 'https://accounts.example.com',
58
- visible: values => values.environment === 'custom',
59
- },
60
- {
61
- id: 'telaApiUrl',
62
- label: 'Tela API URL',
63
- question: 'Custom Tela API URL',
64
- kind: 'text',
65
- placeholder: 'https://api.example.com',
66
- visible: values => values.environment === 'custom',
67
- },
68
- {
69
- id: 'requesterApplicationId',
70
- label: 'Requester App ID',
71
- question: 'Requester application ID',
72
- kind: 'text',
73
- placeholder: '00000000-0000-0000-0000-000000000000',
74
- visible: values => values.environment === 'custom',
75
- },
76
- {
77
- id: 'targetApplicationId',
78
- label: 'Target App ID',
79
- question: 'Target application ID',
80
- kind: 'text',
81
- placeholder: '00000000-0000-0000-0000-000000000000',
82
- visible: values => values.environment === 'custom',
83
- },
84
- {
85
- id: 'cloneRoot',
86
- label: 'Clone Root',
87
- question: 'Clone root directory',
88
- kind: 'text',
89
- placeholder: '/path/to/Code/Tela',
90
- visible: () => true,
91
- },
92
- {
93
- id: 'sshKey',
94
- label: 'SSH Key',
95
- question: 'Pick an SSH public key for Forgejo provisioning',
96
- kind: 'select-ssh-key',
97
- visible: () => true,
98
- },
99
- {
100
- id: 'sshKeyPath',
101
- label: 'SSH Key Path',
102
- question: 'Path to your SSH public key',
103
- kind: 'text',
104
- placeholder: '~/.ssh/id_ed25519.pub',
105
- visible: values => values.sshKeySelection === CUSTOM_SSH_KEY_OPTION,
106
- },
107
- {
108
- id: 'sshPrivateKeyPath',
109
- label: 'Private Key Path',
110
- question: 'Path to your SSH private key',
111
- kind: 'text',
112
- placeholder: '~/.ssh/id_ed25519',
113
- visible: () => true,
114
- },
115
- ]
116
-
117
- export function getVisibleEditSteps(values: SetupFormValues): SetupStepDescriptor[] {
118
- return EDIT_STEPS.filter(step => step.visible(values))
119
- }
120
-
121
- export function getEnvironmentLabel(value: string): string {
122
- return ENVIRONMENT_PRESET_OPTIONS.find(option => option.value === value)?.label ?? value
123
- }
124
-
125
- export function summarizeStep(
126
- step: SetupStepDescriptor,
127
- values: SetupFormValues,
128
- sshKeyTitle: string | undefined,
129
- ): string {
130
- switch (step.id) {
131
- case 'environment':
132
- return getEnvironmentLabel(values.environment)
133
- case 'agentApiUrl':
134
- return values.agentApiUrl
135
- case 'authApiUrl':
136
- return values.authApiUrl
137
- case 'authDashboardUrl':
138
- return values.authDashboardUrl
139
- case 'telaApiUrl':
140
- return values.telaApiUrl
141
- case 'requesterApplicationId':
142
- return values.requesterApplicationId
143
- case 'targetApplicationId':
144
- return values.targetApplicationId
145
- case 'cloneRoot':
146
- return values.cloneRoot
147
- case 'sshKey':
148
- return values.sshKeySelection === CUSTOM_SSH_KEY_OPTION
149
- ? 'Custom path…'
150
- : (sshKeyTitle ?? values.sshKeySelection)
151
- case 'sshKeyPath':
152
- return values.sshKeyPath
153
- case 'sshPrivateKeyPath':
154
- return values.sshPrivateKeyPath
155
- }
156
- }
@@ -1,65 +0,0 @@
1
- import type { SetupAuthEvent } from '../../../auth.ts'
2
- import type { SetupConfigInput } from '../../../config.ts'
3
- import type { SelectedSshPublicKey } from '../../../forgejo.ts'
4
- import type {
5
- TelaCliAuthState,
6
- TelaCliConfig,
7
- TelaCliForgejoOrganization,
8
- } from '../../../types.ts'
9
- import type { CommandScreenController } from '../../runtime.tsx'
10
-
11
- export const CUSTOM_SSH_KEY_OPTION = '__custom__'
12
-
13
- export type SetupFormValues = SetupConfigInput & {
14
- sshKeySelection: string
15
- sshKeyPath: string
16
- sshPrivateKeyPath: string
17
- }
18
-
19
- export interface SetupScreenResult {
20
- ok: true
21
- config: TelaCliConfig
22
- warnings: string[]
23
- nextActions: string[]
24
- checks: Array<{ label: string, status: string, detail: string }>
25
- }
26
-
27
- export interface SetupScreenProps {
28
- controller: CommandScreenController<SetupScreenResult>
29
- currentConfigSummary: string[]
30
- defaults: SetupConfigInput & {
31
- forgejoOrganization: TelaCliForgejoOrganization | null
32
- forgejoUserRegistered: boolean
33
- }
34
- sshPublicKeys: SelectedSshPublicKey[]
35
- validateAgentApiUrl: (value: string) => string | undefined
36
- validateAuthApiUrl: (value: string) => string | undefined
37
- validateAuthDashboardUrl: (value: string) => string | undefined
38
- validateTelaApiUrl: (value: string) => string | undefined
39
- validateApplicationId: (value: string, label?: string) => string | undefined
40
- validateCloneRoot: (value: string) => string | undefined
41
- inspectCloneRoot: (path: string) => {
42
- exists: boolean
43
- isDirectory: boolean
44
- }
45
- authenticate: (
46
- input: SetupConfigInput,
47
- onEvent: (event: SetupAuthEvent) => void,
48
- ) => Promise<TelaCliAuthState>
49
- resolveOrganizations: (
50
- input: SetupConfigInput & { auth: TelaCliAuthState },
51
- ) => Promise<{
52
- organizations: TelaCliForgejoOrganization[]
53
- preferredOrganization: TelaCliForgejoOrganization | null
54
- }>
55
- execute: (
56
- input: SetupConfigInput & {
57
- createCloneRoot: boolean
58
- sshKey: SelectedSshPublicKey
59
- sshPrivateKeyPath: string
60
- auth: TelaCliAuthState
61
- organization: TelaCliForgejoOrganization
62
- },
63
- onEvent: (event: Pick<SetupAuthEvent, 'message' | 'title'>) => void,
64
- ) => Promise<SetupScreenResult>
65
- }