t3code-session-manager 0.0.0-stage → 0.4.1

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 (172) hide show
  1. package/.claude-plugin/marketplace.json +21 -0
  2. package/.claude-plugin/plugin.json +19 -0
  3. package/CHANGELOG.md +149 -0
  4. package/LICENSE +21 -0
  5. package/README.md +661 -2
  6. package/README.pt.md +617 -0
  7. package/bin/entry.d.mts +2 -0
  8. package/bin/entry.mjs +19 -0
  9. package/bin/t3sm.mjs +44 -0
  10. package/commands/import.md +30 -0
  11. package/commands/organize.md +36 -0
  12. package/commands/status.md +24 -0
  13. package/commands/sync.md +26 -0
  14. package/dist/apply/apply.js +993 -0
  15. package/dist/apply/claudeWriter.js +168 -0
  16. package/dist/apply/copyTranscript.js +116 -0
  17. package/dist/apply/importer.js +697 -0
  18. package/dist/apply/materialize.js +335 -0
  19. package/dist/apply/waves.js +108 -0
  20. package/dist/assistant/core.js +295 -0
  21. package/dist/assistant/deps.js +256 -0
  22. package/dist/assistant/i18n.js +38 -0
  23. package/dist/assistant/messages.en.js +494 -0
  24. package/dist/assistant/messages.pt.js +495 -0
  25. package/dist/assistant/runner.js +64 -0
  26. package/dist/assistant/steps.js +1362 -0
  27. package/dist/build.json +1 -0
  28. package/dist/cli/applyScreen.js +158 -0
  29. package/dist/cli/commands/accounts.js +254 -0
  30. package/dist/cli/commands/apply.js +199 -0
  31. package/dist/cli/commands/changelog.js +61 -0
  32. package/dist/cli/commands/doctor.js +105 -0
  33. package/dist/cli/commands/help.js +158 -0
  34. package/dist/cli/commands/merge.js +224 -0
  35. package/dist/cli/commands/organize.js +872 -0
  36. package/dist/cli/commands/plan.js +161 -0
  37. package/dist/cli/commands/projects.js +430 -0
  38. package/dist/cli/commands/quarantine.js +203 -0
  39. package/dist/cli/commands/recover.js +230 -0
  40. package/dist/cli/commands/rollback.js +281 -0
  41. package/dist/cli/commands/scan.js +117 -0
  42. package/dist/cli/commands/schedule.js +288 -0
  43. package/dist/cli/commands/start.js +45 -0
  44. package/dist/cli/commands/status.js +615 -0
  45. package/dist/cli/commands/sync.js +336 -0
  46. package/dist/cli/commands/update.js +398 -0
  47. package/dist/cli/errors.js +53 -0
  48. package/dist/cli/failures.js +91 -0
  49. package/dist/cli/flags.js +53 -0
  50. package/dist/cli/help.en.js +549 -0
  51. package/dist/cli/help.pt.js +566 -0
  52. package/dist/cli/helpText.js +211 -0
  53. package/dist/cli/helpTopics.js +58 -0
  54. package/dist/cli/locked.js +12 -0
  55. package/dist/cli/main.js +155 -0
  56. package/dist/cli/screen.js +3 -0
  57. package/dist/cli/ui.js +111 -0
  58. package/dist/cli/words.js +2 -0
  59. package/dist/core/activity.js +16 -0
  60. package/dist/core/changelog.js +47 -0
  61. package/dist/core/config.js +530 -0
  62. package/dist/core/fsutil.js +171 -0
  63. package/dist/core/glob.js +34 -0
  64. package/dist/core/history.js +32 -0
  65. package/dist/core/journal.js +274 -0
  66. package/dist/core/lock.js +337 -0
  67. package/dist/core/mask.js +31 -0
  68. package/dist/core/paths.js +68 -0
  69. package/dist/core/pid.js +101 -0
  70. package/dist/core/run.js +4 -0
  71. package/dist/core/semver.js +18 -0
  72. package/dist/core/sysroot.js +29 -0
  73. package/dist/core/types.js +229 -0
  74. package/dist/core/uuid.js +29 -0
  75. package/dist/core/version.js +72 -0
  76. package/dist/help/convert.md +20 -0
  77. package/dist/help/convert.pt.md +21 -0
  78. package/dist/help/cwd-unreadable.md +22 -0
  79. package/dist/help/cwd-unreadable.pt.md +22 -0
  80. package/dist/help/decisions.md +20 -0
  81. package/dist/help/decisions.pt.md +20 -0
  82. package/dist/help/errors.md +20 -0
  83. package/dist/help/errors.pt.md +22 -0
  84. package/dist/help/held.md +20 -0
  85. package/dist/help/held.pt.md +20 -0
  86. package/dist/help/history.md +27 -0
  87. package/dist/help/history.pt.md +29 -0
  88. package/dist/help/instance-unavailable.md +18 -0
  89. package/dist/help/instance-unavailable.pt.md +19 -0
  90. package/dist/help/not-imported.md +19 -0
  91. package/dist/help/not-imported.pt.md +19 -0
  92. package/dist/help/orphaned.md +19 -0
  93. package/dist/help/orphaned.pt.md +19 -0
  94. package/dist/help/project-mismatch.md +15 -0
  95. package/dist/help/project-mismatch.pt.md +15 -0
  96. package/dist/help/t3-native.md +22 -0
  97. package/dist/help/t3-native.pt.md +22 -0
  98. package/dist/help/updates.md +26 -0
  99. package/dist/help/updates.pt.md +28 -0
  100. package/dist/help/watcher.md +24 -0
  101. package/dist/help/watcher.pt.md +25 -0
  102. package/dist/i18n/cli.js +41 -0
  103. package/dist/i18n/lang.js +55 -0
  104. package/dist/i18n/messages.en.js +1140 -0
  105. package/dist/i18n/messages.pt.js +1149 -0
  106. package/dist/i18n/words.js +12 -0
  107. package/dist/ops/accounts.js +170 -0
  108. package/dist/ops/autoUpdate.js +223 -0
  109. package/dist/ops/discoverAccounts.js +343 -0
  110. package/dist/ops/doctor.js +811 -0
  111. package/dist/ops/elevated.js +47 -0
  112. package/dist/ops/errorCodes.js +39 -0
  113. package/dist/ops/follow.js +558 -0
  114. package/dist/ops/merge.js +830 -0
  115. package/dist/ops/notify.js +249 -0
  116. package/dist/ops/plugin.js +92 -0
  117. package/dist/ops/projects.js +113 -0
  118. package/dist/ops/quarantine.js +415 -0
  119. package/dist/ops/rollback.js +868 -0
  120. package/dist/ops/schedule.js +464 -0
  121. package/dist/ops/successor.js +51 -0
  122. package/dist/ops/sync.js +859 -0
  123. package/dist/ops/syncStatus.js +290 -0
  124. package/dist/ops/update.js +273 -0
  125. package/dist/ops/updater.js +641 -0
  126. package/dist/ops/watch.js +676 -0
  127. package/dist/ops/watcherControl.js +212 -0
  128. package/dist/ops/watcherHealth.js +75 -0
  129. package/dist/organize/apply.js +495 -0
  130. package/dist/organize/history.js +192 -0
  131. package/dist/organize/plan.js +283 -0
  132. package/dist/organize/rename.js +58 -0
  133. package/dist/organize/sessions.js +100 -0
  134. package/dist/organize/titles.js +70 -0
  135. package/dist/organize/types.js +73 -0
  136. package/dist/plan/categories.js +104 -0
  137. package/dist/plan/dedupe.js +137 -0
  138. package/dist/plan/folders.js +82 -0
  139. package/dist/plan/names.js +93 -0
  140. package/dist/plan/ownership.js +316 -0
  141. package/dist/plan/planner.js +669 -0
  142. package/dist/plan/rehome.js +101 -0
  143. package/dist/plan/report.js +407 -0
  144. package/dist/sources/cache.js +89 -0
  145. package/dist/sources/claude.js +297 -0
  146. package/dist/sources/codex.js +496 -0
  147. package/dist/sources/flatten.js +23 -0
  148. package/dist/sources/jsonl.js +169 -0
  149. package/dist/sources/native.js +233 -0
  150. package/dist/sources/opencode.js +483 -0
  151. package/dist/sources/pi.js +133 -0
  152. package/dist/sources/registry.js +67 -0
  153. package/dist/sources/types.js +80 -0
  154. package/dist/t3/api.js +492 -0
  155. package/dist/t3/auth.js +248 -0
  156. package/dist/t3/compat.js +62 -0
  157. package/dist/t3/decode.js +408 -0
  158. package/dist/t3/errors.js +185 -0
  159. package/dist/t3/rpc.js +185 -0
  160. package/dist/t3/runtime.js +80 -0
  161. package/dist/ui/caps.js +56 -0
  162. package/dist/ui/components.js +202 -0
  163. package/dist/ui/layout.js +205 -0
  164. package/dist/ui/list.js +423 -0
  165. package/dist/ui/locale.js +73 -0
  166. package/dist/ui/organizePreview.js +72 -0
  167. package/dist/ui/progress.js +237 -0
  168. package/dist/ui/style.js +32 -0
  169. package/dist/ui/terminal.js +126 -0
  170. package/dist/ui/text.js +186 -0
  171. package/package.json +58 -4
  172. package/skills/t3code-sessions/SKILL.md +183 -0
@@ -0,0 +1,19 @@
1
+ # Conta desligada: a conta da conversa não está utilizável no T3 Code
2
+
3
+ ## O que quer dizer
4
+
5
+ A conversa pertence a uma conta (ou a um agente como o Codex ou o Pi) cuja instância no T3 Code tem a sessão
6
+ terminada, está desligada ou não existe, por isso o T3 Code não a consegue importar.
7
+
8
+ ## Porque acontece
9
+
10
+ - A sessão da conta expirou no T3 Code.
11
+ - A instância, ou o agente, está desligada nas definições do T3 Code (Providers).
12
+ - A conta ainda não tem instância no T3 Code.
13
+
14
+ ## O que fazer
15
+
16
+ 1. `t3sm accounts` mostra cada conta, a instância dela e se tem a sessão iniciada.
17
+ 2. Inicia a sessão no T3 Code, ou liga o agente nas definições (Providers). Uma instância que falta:
18
+ `t3sm accounts --apply`.
19
+ 3. Depois corre `t3sm apply` outra vez.
@@ -0,0 +1,19 @@
1
+ # Not imported: T3 Code did not take a conversation
2
+
3
+ ## What it means
4
+
5
+ t3sm asked T3 Code to import the conversation, checked twice, and it is not in T3 Code. Nothing was lost: the
6
+ session file is where it was, and t3sm put every file time back.
7
+
8
+ ## Why it happens
9
+
10
+ - The folder recorded in the conversation does not match the project T3 Code opened (a renamed or moved folder).
11
+ - The conversation has no message from you that T3 Code can read (only tool output or a summary).
12
+ - T3 Code logged an error for it (see its logs in `~/.t3/userdata/logs/`).
13
+
14
+ ## What to do
15
+
16
+ 1. Run `t3sm apply` again: it tries the failed conversations once more.
17
+ 2. If it fails again, run `t3sm plan` and read `plan.md`: a folder that moved can be mapped with `remap` in
18
+ config.json.
19
+ 3. `t3sm runs` lists every run and what it imported; the conversation stays retryable.
@@ -0,0 +1,19 @@
1
+ # Não importada: o T3 Code não aceitou uma conversa
2
+
3
+ ## O que quer dizer
4
+
5
+ O t3sm pediu ao T3 Code para importar a conversa, verificou duas vezes e ela não está no T3 Code. Não se perdeu nada:
6
+ o ficheiro da sessão está onde estava e o t3sm repôs todas as datas dos ficheiros.
7
+
8
+ ## Porque acontece
9
+
10
+ - A pasta registada na conversa não é a do projeto que o T3 Code abriu (uma pasta que mudou de nome ou de sítio).
11
+ - A conversa não tem nenhuma mensagem tua que o T3 Code consiga ler (só resultados de ferramentas ou um resumo).
12
+ - O T3 Code registou um erro para ela (vê os registos em `~/.t3/userdata/logs/`).
13
+
14
+ ## O que fazer
15
+
16
+ 1. Corre `t3sm apply` outra vez: tenta mais uma vez as conversas que falharam.
17
+ 2. Se voltar a falhar, corre `t3sm plan` e lê o `plan.md`: uma pasta que mudou de sítio pode ser mapeada com `remap`
18
+ no config.json.
19
+ 3. `t3sm runs` lista cada execução e o que importou; a conversa continua a poder ser tentada outra vez.
@@ -0,0 +1,19 @@
1
+ # Deleted in T3 Code: conversations that come back as copies
2
+
3
+ ## What it means
4
+
5
+ These conversations were started in T3 Code, and you deleted their threads there. Their session files are still on
6
+ this machine. By default t3sm brings each one back as a copy, once you said yes to that question in `t3sm start`
7
+ (the setting `organize.sessions.orphaned` is `"copy"`). Until the question is answered, they wait.
8
+
9
+ ## Why one is left out
10
+
11
+ You answered no in `t3sm start`, or set `organize.sessions.orphaned` to `"skip"` in config.json: a conversation you
12
+ deleted is then never copied back behind your back.
13
+
14
+ ## What to do
15
+
16
+ - Nothing, if you meant to delete them.
17
+ - To bring them back, set `organize.sessions.orphaned` to `"copy"` in config.json (or answer yes in `t3sm start`),
18
+ then run `t3sm plan` and `t3sm apply`.
19
+ - `t3sm status` lists the ones left out under Worth knowing.
@@ -0,0 +1,19 @@
1
+ # Apagadas no T3 Code: conversas que voltam como cópias
2
+
3
+ ## O que quer dizer
4
+
5
+ Estas conversas foram começadas no T3 Code e apagaste lá as threads delas. Os ficheiros das sessões continuam nesta
6
+ máquina. Por omissão o t3sm traz cada uma de volta como cópia, depois de dizeres que sim a essa pergunta no
7
+ `t3sm start` (a definição `organize.sessions.orphaned` é `"copy"`). Enquanto a pergunta não tiver resposta, esperam.
8
+
9
+ ## Porque fica uma de fora
10
+
11
+ Respondeste que não no `t3sm start`, ou puseste `organize.sessions.orphaned` a `"skip"` no config.json: uma conversa
12
+ que apagaste nunca é então copiada de volta sem saberes.
13
+
14
+ ## O que fazer
15
+
16
+ - Nada, se querias mesmo apagá-las.
17
+ - Para as trazer de volta, põe `organize.sessions.orphaned` a `"copy"` no config.json (ou responde que sim no
18
+ `t3sm start`) e depois corre `t3sm plan` e `t3sm apply`.
19
+ - O `t3sm status` lista as que ficaram de fora em Bom saber.
@@ -0,0 +1,15 @@
1
+ # Project mismatch: T3 Code filed a conversation elsewhere
2
+
3
+ ## What it means
4
+
5
+ The conversation was imported, but into another project than the one in the plan, so t3sm reports it instead of
6
+ calling it done.
7
+
8
+ ## Why it happens
9
+
10
+ The project was renamed, moved or created again in T3 Code after the plan was made.
11
+
12
+ ## What to do
13
+
14
+ 1. Check the conversation in T3 Code: it is there, in another project.
15
+ 2. Run `t3sm plan` and `t3sm apply` again: a fresh plan sees T3 Code as it is now.
@@ -0,0 +1,15 @@
1
+ # Projeto diferente: o T3 Code pôs uma conversa noutro sítio
2
+
3
+ ## O que quer dizer
4
+
5
+ A conversa foi importada, mas para outro projeto que não o do plano, por isso o t3sm indica-a em vez de a dar como
6
+ feita.
7
+
8
+ ## Porque acontece
9
+
10
+ O projeto mudou de nome, de sítio ou foi criado outra vez no T3 Code depois de o plano ser feito.
11
+
12
+ ## O que fazer
13
+
14
+ 1. Vê a conversa no T3 Code: está lá, noutro projeto.
15
+ 2. Corre `t3sm plan` e `t3sm apply` outra vez: um plano novo vê o T3 Code como ele está agora.
@@ -0,0 +1,22 @@
1
+ # Started in T3 Code: conversations t3sm leaves out
2
+
3
+ ## What it means
4
+
5
+ These conversations were started inside T3 Code, but T3 Code no longer reports a thread t3sm can match them to.
6
+ t3sm never copies a conversation that belongs to T3 Code itself on its own, so they stay as they are until you say
7
+ otherwise.
8
+
9
+ ## Why it happens
10
+
11
+ - The thread was removed in T3 Code, or T3 Code was reinstalled and lost its own list.
12
+ - The session file was copied from another machine.
13
+
14
+ ## What to do
15
+
16
+ - If T3 Code still shows the conversation, there is nothing to do.
17
+ - If it does not (you deleted its thread, for example), bring it back with `t3sm recover <session id>`: a faithful
18
+ copy with a new id, imported into its project. Try `t3sm recover <session id> --dry-run` first. t3sm cannot see
19
+ whether the thread still exists, so if it does, this makes a duplicate. Undo with
20
+ `t3sm rollback --run <id> --archive-threads`.
21
+ - You can also continue it in a terminal: `claude --resume <session id>` (the id is the file's name).
22
+ - `t3sm status` lists them under Worth knowing.
@@ -0,0 +1,22 @@
1
+ # Começadas no T3 Code: conversas que o t3sm deixa de fora
2
+
3
+ ## O que quer dizer
4
+
5
+ Estas conversas foram começadas dentro do T3 Code, mas o T3 Code já não indica uma thread a que o t3sm as possa
6
+ associar. O t3sm nunca copia por iniciativa própria uma conversa que pertence ao próprio T3 Code, por isso ficam como
7
+ estão até dizeres o contrário.
8
+
9
+ ## Porque acontece
10
+
11
+ - A thread foi removida no T3 Code, ou o T3 Code foi reinstalado e perdeu a sua própria lista.
12
+ - O ficheiro da sessão foi copiado de outra máquina.
13
+
14
+ ## O que fazer
15
+
16
+ - Se o T3 Code ainda mostra a conversa, não há nada a fazer.
17
+ - Se não mostra (apagaste a thread, por exemplo), trá-la de volta com `t3sm recover <id da sessão>`: uma cópia fiel
18
+ com um id novo, importada para o seu projeto. Experimenta primeiro `t3sm recover <id da sessão> --dry-run`. O t3sm
19
+ não consegue ver se a thread ainda existe, por isso, se existir, isto cria um duplicado. Desfaz-se com
20
+ `t3sm rollback --run <id> --archive-threads`.
21
+ - Também a podes continuar num terminal: `claude --resume <id da sessão>` (o id é o nome do ficheiro).
22
+ - O `t3sm status` lista-as em Bom saber.
@@ -0,0 +1,26 @@
1
+ # Updates: how t3sm updates itself, and when it fails
2
+
3
+ ## What it means
4
+
5
+ Once a day the background watcher looks for a newer t3sm. A patch or minor release is installed by itself; a major
6
+ release is only announced. After an install, the watcher must start on the new version within 2 minutes, or the
7
+ previous version is put back. t3sm never downgrades.
8
+
9
+ It updates from where it was installed: the npm registry for `npm install -g t3code-session-manager`, GitHub's release
10
+ tags for an install from GitHub, or a checkout on this computer after `t3sm update --from <folder>`.
11
+
12
+ ## Why it fails
13
+
14
+ - No network, a proxy, or git and npm missing: the check is skipped and tried again later.
15
+ - The new version did not start properly: it was rolled back, so the previous version runs again. `t3sm status`
16
+ shows this as worth knowing, not as a need; the automatic check skips that version, and `t3sm update` can still
17
+ install it on purpose.
18
+ - The computer slept or restarted during the update: it was interrupted.
19
+
20
+ ## What to do
21
+
22
+ - `t3sm update --check` shows the installed and the newest version, the last check, and how to go back after an
23
+ interrupted update.
24
+ - `t3sm update` installs the newest release after showing what is new; `t3sm changelog` shows what changed.
25
+ - `t3sm update --auto off` stops automatic updates (`--auto on` turns them back on).
26
+ - `t3sm update --source npm` moves an install from GitHub to the npm registry; `--source github` goes back.
@@ -0,0 +1,28 @@
1
+ # Atualizações: como o t3sm se atualiza, e quando falha
2
+
3
+ ## O que quer dizer
4
+
5
+ Uma vez por dia o vigilante em segundo plano procura um t3sm mais recente. Uma versão de correção ou menor é
6
+ instalada sozinha; uma versão maior só é anunciada. Depois de instalar, o vigilante tem de arrancar na versão nova em
7
+ 2 minutos, senão volta a versão anterior. O t3sm nunca volta a uma versão mais antiga.
8
+
9
+ Atualiza-se a partir de onde foi instalado: o registo do npm para `npm install -g t3code-session-manager`, as
10
+ etiquetas de versão do GitHub para uma instalação a partir do GitHub, ou uma cópia do código neste computador depois de
11
+ `t3sm update --from <pasta>`.
12
+
13
+ ## Porque falha
14
+
15
+ - Sem rede, com um proxy, ou sem git e npm: a procura fica para mais tarde.
16
+ - A versão nova não arrancou bem: a atualização foi desfeita e a versão anterior voltou a correr. O `t3sm status`
17
+ mostra-o em "Bom saber", não como algo que precisa de ti; a procura automática passa a saltar essa versão, e o
18
+ `t3sm update` ainda a pode instalar de propósito.
19
+ - O computador adormeceu ou reiniciou durante a atualização: ficou interrompida.
20
+
21
+ ## O que fazer
22
+
23
+ - `t3sm update --check` mostra a versão instalada e a mais recente, a última procura e como voltar atrás depois de
24
+ uma atualização interrompida.
25
+ - `t3sm update` instala a versão mais recente depois de mostrar o que há de novo; `t3sm changelog` mostra o que
26
+ mudou.
27
+ - `t3sm update --auto off` desliga as atualizações automáticas (`--auto on` volta a ligá-las).
28
+ - `t3sm update --source npm` passa uma instalação do GitHub para o registo do npm; `--source github` volta atrás.
@@ -0,0 +1,24 @@
1
+ # The watcher: background sync that is not running or late
2
+
3
+ ## What it means
4
+
5
+ The watcher is the background sync (`t3sm schedule install --watch`): it imports new conversations a few minutes
6
+ after they go idle. `t3sm status` says when it is not running, runs an older t3sm, or its cycles stopped.
7
+
8
+ ## Why it happens
9
+
10
+ - It was stopped, or it ended without a clean stop (the computer slept, the process was ended).
11
+ - t3sm was updated and the watcher did not restart into the new version.
12
+ - It stops at start-up (`config.json` cannot be used, or, on Linux and macOS, its socket directory is not safe):
13
+ `logs/sync.log` says `startup-error` or `socket-dir-unsafe`.
14
+ - Its cycles keep failing (T3 Code incompatible, an account signed out).
15
+
16
+ ## What to do
17
+
18
+ - `t3sm schedule restart` stops it safely and starts it again.
19
+ - `t3sm schedule status` shows the scheduler entry, the watcher's heartbeat and the last logged cycle.
20
+ - Nothing installed yet: `t3sm schedule install --watch`. A watcher you started by hand comes back with
21
+ `t3sm sync --watch`.
22
+ - It stops at start-up, or its cycles keep failing: `t3sm doctor` says why.
23
+ - "Another t3sm run is in progress": a sync is in the middle of its work; the schedule commands stop the watcher only
24
+ between runs, so try again in a moment.
@@ -0,0 +1,25 @@
1
+ # O vigilante: a sincronização em segundo plano parada ou atrasada
2
+
3
+ ## O que quer dizer
4
+
5
+ O vigilante é a sincronização em segundo plano (`t3sm schedule install --watch`): importa as conversas novas uns
6
+ minutos depois de acalmarem. O `t3sm status` diz quando ele não está a correr, corre um t3sm antigo, ou os ciclos dele
7
+ pararam.
8
+
9
+ ## Porque acontece
10
+
11
+ - Foi parado, ou terminou sem uma paragem limpa (o computador adormeceu, o processo foi terminado).
12
+ - O t3sm foi atualizado e o vigilante não reiniciou na versão nova.
13
+ - Para no arranque (o `config.json` não pode ser usado, ou, em Linux e macOS, a pasta do seu socket não é segura): o
14
+ `logs/sync.log` diz `startup-error` ou `socket-dir-unsafe`.
15
+ - Os ciclos dele continuam a falhar (T3 Code incompatível, uma conta com a sessão terminada).
16
+
17
+ ## O que fazer
18
+
19
+ - `t3sm schedule restart` para-o em segurança e arranca-o outra vez.
20
+ - `t3sm schedule status` mostra a entrada do agendador, o sinal de vida do vigilante e o último ciclo registado.
21
+ - Ainda nada instalado: `t3sm schedule install --watch`. Um vigilante que arrancou à mão volta com
22
+ `t3sm sync --watch`.
23
+ - Para no arranque, ou os ciclos continuam a falhar: o `t3sm doctor` diz porquê.
24
+ - "Another t3sm run is in progress": uma sincronização está a meio do seu trabalho; os comandos de agendamento só param
25
+ o vigilante entre execuções, por isso tenta outra vez daqui a pouco.
@@ -0,0 +1,41 @@
1
+ // The commands' catalogues and the one lookup into them, in a module of their own: ops/, plan/ and the notifications
2
+ // word things in the user's language without importing the CLI (src/cli/ui.ts re-exports all of this for the commands).
3
+ // The guided assistant keeps its own catalogue (src/assistant/i18n.ts); both share src/i18n/lang.ts.
4
+
5
+ import { fmt, } from "./lang.js";
6
+
7
+ import { makeFmt, } from "../ui/locale.js";
8
+ import { makeStyle, } from "../ui/style.js";
9
+ import { en } from "./messages.en.js";
10
+ import { pt } from "./messages.pt.js";
11
+
12
+
13
+
14
+
15
+ export const CLI_CATALOGUES = { en, pt };
16
+
17
+ /** The catalogue lookup alone, for code that has a language but no Io. */
18
+ export function cliT(lang , key , vars = {}) {
19
+ return fmt(CLI_CATALOGUES[lang][key], vars);
20
+ }
21
+
22
+ /** Whether `key` is a key of the catalogues (for keys built at runtime, such as a doctor check's id and state). */
23
+ export function isCliKey(key ) {
24
+ return Object.hasOwn(en, key);
25
+ }
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ /** A CliUi from capabilities and a language directly (the screen registry renders every screen this way). */
38
+ export function makeCliUi(caps , lang , now = Date.now) {
39
+ const m = CLI_CATALOGUES[lang];
40
+ return { s: makeStyle(caps), f: makeFmt(lang, now), lang, m, width: caps.columns || 80, t: (key, vars = {}) => fmt(m[key], vars) };
41
+ }
@@ -0,0 +1,55 @@
1
+ // The language t3sm speaks (English, the primary one, or European Portuguese, chosen by --lang or the locale) and the
2
+ // one placeholder filler every catalogue uses. Shared by the commands (src/i18n/cli.ts) and the guided assistant
3
+ // (src/assistant/i18n.ts, which re-exports this), without either depending on the other.
4
+
5
+
6
+ export function isLang(v ) {
7
+ return v === "en" || v === "pt";
8
+ }
9
+
10
+ let intlLocaleCache ;
11
+ /** The OS locale as Node sees it (on Windows, where no LANG is set, this is the only OS signal). Read once. */
12
+ function systemIntlLocale() {
13
+ if (intlLocaleCache === undefined) {
14
+ try { intlLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; } catch { intlLocaleCache = ""; }
15
+ }
16
+ return intlLocaleCache;
17
+ }
18
+
19
+ /** A language tag ("pt_PT.UTF-8", "pt-BR", "en") gives "pt" for Portuguese and "en" otherwise; empty, "C", "POSIX" or unparsable gives null (skip). */
20
+ function langOfLocale(raw ) {
21
+ const v = raw?.trim().toLowerCase();
22
+ if (!v || v === "c" || v === "posix" || /^(c|posix)[.@]/.test(v)) return null;
23
+ const m = /^([a-z]{2,3})(?:[-_.@]|$)/.exec(v);
24
+ if (!m) return null;
25
+ return m[1] === "pt" ? "pt" : "en";
26
+ }
27
+
28
+ /**
29
+ * `--lang` > env T3SM_LANG > config.json "language" > LC_ALL > LC_MESSAGES > LANG > the OS locale from Intl > "en". A
30
+ * Portuguese tag (pt, pt_PT.UTF-8, pt-BR) gives "pt", any other parsable tag "en"; empty, "C" and "POSIX" values are
31
+ * skipped. An unknown T3SM_LANG is ignored. The OS locale is read (approved 0.3 spec, section 5.4; this supersedes the
32
+ * 2026-11-11 decision never to read it) because Windows sets no LANG. `intlLocale` is injectable for tests.
33
+ */
34
+ export function resolveLang(flag , env , configLang , intlLocale ) {
35
+ if (flag) return flag;
36
+ const e = env["T3SM_LANG"]?.trim().toLowerCase();
37
+ if (isLang(e)) return e;
38
+ if (isLang(configLang)) return configLang;
39
+ for (const k of ["LC_ALL", "LC_MESSAGES", "LANG"]) {
40
+ const l = langOfLocale(env[k]);
41
+ if (l) return l;
42
+ }
43
+ return langOfLocale(intlLocale ?? systemIntlLocale()) ?? "en";
44
+ }
45
+
46
+ /**
47
+ * `{name}` placeholders replaced by `vars` (unknown placeholders are left as they are). `{name|one|many}` picks a form by
48
+ * the number in `name`: `one` when it is 1, `many` otherwise ("{n} {n|file|files}"); a placeholder with no value stays.
49
+ */
50
+ export function fmt(template , vars = {}) {
51
+ const plural = template.replace(/\{([a-zA-Z0-9_-]+)\|([^|}]*)\|([^}]*)\}/g, (m, k , one , many ) =>
52
+ (Object.hasOwn(vars, k) ? (Number(vars[k]) === 1 ? one : many) : m));
53
+ return plural.replace(/\{([a-zA-Z0-9_-]+)\}/g, (m, k ) => (Object.hasOwn(vars, k) ? String(vars[k]) : m));
54
+ }
55
+