@carrieros/cli-staging 0.0.0-stage → 0.4.0

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 (136) hide show
  1. package/README.md +6 -2
  2. package/dist/commands/attach.js +45 -0
  3. package/dist/commands/auth.js +60 -0
  4. package/dist/commands/btw.js +78 -0
  5. package/dist/commands/changes.js +167 -0
  6. package/dist/commands/chat.js +182 -0
  7. package/dist/commands/context.js +200 -0
  8. package/dist/commands/doctor.js +119 -0
  9. package/dist/commands/files.js +94 -0
  10. package/dist/commands/help.js +37 -0
  11. package/dist/commands/history.js +112 -0
  12. package/dist/commands/login.js +62 -0
  13. package/dist/commands/logout.js +25 -0
  14. package/dist/commands/memory.js +162 -0
  15. package/dist/commands/mode-model.js +64 -0
  16. package/dist/commands/models.js +28 -0
  17. package/dist/commands/modes.js +30 -0
  18. package/dist/commands/permissions.js +77 -0
  19. package/dist/commands/project.js +106 -0
  20. package/dist/commands/repo.js +146 -0
  21. package/dist/commands/repos.js +61 -0
  22. package/dist/commands/review.js +92 -0
  23. package/dist/commands/scope.js +155 -0
  24. package/dist/commands/search.js +92 -0
  25. package/dist/commands/sessions.js +282 -0
  26. package/dist/commands/settings.js +100 -0
  27. package/dist/commands/update.js +229 -0
  28. package/dist/commands/upload.js +223 -0
  29. package/dist/commands/usage.js +227 -0
  30. package/dist/commands/version.js +26 -0
  31. package/dist/commands/whoami.js +44 -0
  32. package/dist/ide/editor-context.js +275 -0
  33. package/dist/ide/ide-session.js +360 -0
  34. package/dist/ide/tool-host.js +109 -0
  35. package/dist/main.js +126 -0
  36. package/dist/services/api.js +439 -0
  37. package/dist/services/auth-origin.js +20 -0
  38. package/dist/services/chat-stream.js +168 -0
  39. package/dist/services/checkpoints.js +278 -0
  40. package/dist/services/client-tools.js +356 -0
  41. package/dist/services/code-intel.js +243 -0
  42. package/dist/services/code-symbols.js +94 -0
  43. package/dist/services/coding-workflow.js +554 -0
  44. package/dist/services/command-coordinator.js +273 -0
  45. package/dist/services/command-policy.js +434 -0
  46. package/dist/services/config.js +383 -0
  47. package/dist/services/container-runner.js +254 -0
  48. package/dist/services/container-supervisor.js +38 -0
  49. package/dist/services/context.js +371 -0
  50. package/dist/services/device-auth.js +286 -0
  51. package/dist/services/diff.js +196 -0
  52. package/dist/services/env-policy.js +108 -0
  53. package/dist/services/execution-platform.js +30 -0
  54. package/dist/services/file-detect.js +104 -0
  55. package/dist/services/file-resolver.js +199 -0
  56. package/dist/services/file-upload.js +126 -0
  57. package/dist/services/folder-key.js +22 -0
  58. package/dist/services/git-tools.js +429 -0
  59. package/dist/services/glob-match.js +164 -0
  60. package/dist/services/helper-bin.js +85 -0
  61. package/dist/services/ignore-rules.js +189 -0
  62. package/dist/services/instruction-resolver.js +54 -0
  63. package/dist/services/job-helper.js +328 -0
  64. package/dist/services/local-files.js +639 -0
  65. package/dist/services/local-tools.js +937 -0
  66. package/dist/services/login-flow.js +156 -0
  67. package/dist/services/meta.js +15 -0
  68. package/dist/services/mutation-coordinator.js +327 -0
  69. package/dist/services/mutation-groups.js +309 -0
  70. package/dist/services/mutation-recovery.js +159 -0
  71. package/dist/services/mutations.js +679 -0
  72. package/dist/services/open-url.js +68 -0
  73. package/dist/services/output.js +62 -0
  74. package/dist/services/packaged-update.js +403 -0
  75. package/dist/services/packaged.js +39 -0
  76. package/dist/services/permission-mode.js +78 -0
  77. package/dist/services/process-runner.js +412 -0
  78. package/dist/services/project-context.js +298 -0
  79. package/dist/services/redaction.js +201 -0
  80. package/dist/services/result-reconciliation.js +49 -0
  81. package/dist/services/secure-store.js +217 -0
  82. package/dist/services/session-resolver.js +113 -0
  83. package/dist/services/sia.js +51 -0
  84. package/dist/services/spinner.js +40 -0
  85. package/dist/services/supported-runtime.js +59 -0
  86. package/dist/services/task-context.js +212 -0
  87. package/dist/services/task-snapshot.js +38 -0
  88. package/dist/services/tool-result-outbox.js +195 -0
  89. package/dist/services/update.js +311 -0
  90. package/dist/services/workspace-registry.js +310 -0
  91. package/dist/services/workspace.js +580 -0
  92. package/dist/shell/shell-chat.js +1619 -0
  93. package/dist/shell/shell-commands.js +411 -0
  94. package/dist/shell/shell-prompt.js +110 -0
  95. package/dist/shell/shell-renderer.js +51 -0
  96. package/dist/shell/shell-router.js +37 -0
  97. package/dist/shell/shell.js +389 -0
  98. package/dist/shell/task-context-view.js +40 -0
  99. package/dist/staging.js +5 -0
  100. package/dist/types/index.js +6 -0
  101. package/dist/ui/agent-cards.js +111 -0
  102. package/dist/ui/agent-presentation.js +131 -0
  103. package/dist/ui/approval.js +111 -0
  104. package/dist/ui/banner.js +56 -0
  105. package/dist/ui/btw-overlay.js +230 -0
  106. package/dist/ui/change-review.js +334 -0
  107. package/dist/ui/chat-renderer.js +463 -0
  108. package/dist/ui/code-block.js +52 -0
  109. package/dist/ui/color-picker.js +100 -0
  110. package/dist/ui/colors.js +55 -0
  111. package/dist/ui/command-details.js +11 -0
  112. package/dist/ui/command-filter.js +92 -0
  113. package/dist/ui/command-item.js +6 -0
  114. package/dist/ui/command-palette.js +383 -0
  115. package/dist/ui/command-registry.js +128 -0
  116. package/dist/ui/command-renderer.js +55 -0
  117. package/dist/ui/command-review.js +187 -0
  118. package/dist/ui/composer-layout.js +74 -0
  119. package/dist/ui/conversation.js +450 -0
  120. package/dist/ui/interrupt.js +35 -0
  121. package/dist/ui/live.js +141 -0
  122. package/dist/ui/logo.js +58 -0
  123. package/dist/ui/markdown.js +205 -0
  124. package/dist/ui/message.js +21 -0
  125. package/dist/ui/screen-prompt.js +181 -0
  126. package/dist/ui/screen.js +297 -0
  127. package/dist/ui/select.js +284 -0
  128. package/dist/ui/sia-qa.js +213 -0
  129. package/dist/ui/spinner.js +23 -0
  130. package/dist/ui/sticky-stream.js +64 -0
  131. package/dist/ui/task-context-card.js +99 -0
  132. package/dist/ui/text-prompt.js +74 -0
  133. package/dist/ui/theme.js +80 -0
  134. package/dist/ui/trust.js +88 -0
  135. package/dist/ui/ui.js +101 -0
  136. package/package.json +33 -4
package/dist/ui/ui.js ADDED
@@ -0,0 +1,101 @@
1
+ import { c } from "./colors.js";
2
+ /**
3
+ * Reusable, cross-platform UI primitives built on the design system. Pure
4
+ * Unicode + Chalk — nothing terminal-specific — so everything renders the same
5
+ * in Windows Terminal, PowerShell, CMD, Git Bash, WSL, macOS and Linux.
6
+ */
7
+ /** Consistent status icons (never emojis). */
8
+ export const icon = {
9
+ ok: c.ok("✓"),
10
+ warn: c.warn("!"),
11
+ // Informational lines are context, not status — a muted corner-down-right
12
+ // reads as "and then this happened" instead of competing with ✓ / ! / ✕ for
13
+ // attention. U+21B3 is in the base arrows block, so it renders everywhere.
14
+ info: c.dim("↳"),
15
+ err: c.err("✕"),
16
+ bullet: c.accent("•"),
17
+ arrow: c.dim("›"),
18
+ active: c.brand("►")
19
+ };
20
+ /** Current terminal width (columns), with a sane fallback. */
21
+ export function termWidth(fallback = 80) {
22
+ const w = process.stdout.columns;
23
+ return w && w > 0 ? w : fallback;
24
+ }
25
+ const UNITS = [[1e9, "B"], [1e6, "M"], [1e3, "K"]];
26
+ /**
27
+ * A large number the way dashboards show it: 12.47K, 1.25M — at most two
28
+ * decimals, trailing zeros dropped. Below 1,000, `small` formats it.
29
+ */
30
+ export function compactNumber(n, small) {
31
+ for (const [size, unit] of UNITS) {
32
+ // 999.996 rounds to 1,000.00 — that is "1K", not "1,000.00".
33
+ if (Math.abs(n) >= size * 0.999995)
34
+ return (n / size).toLocaleString("en-US", { maximumFractionDigits: 2 }) + unit;
35
+ }
36
+ return small(n);
37
+ }
38
+ /**
39
+ * A credit amount, everywhere credits appear: compact from 1,000 up (12.47K,
40
+ * 1.25M) and two decimals below it (23.67). A non-zero amount too small to
41
+ * show reads "<0.01" rather than a misleading "0.00".
42
+ */
43
+ export function formatCredits(n) {
44
+ if (n !== 0 && Math.abs(n) < 0.005)
45
+ return "<0.01";
46
+ return compactNumber(n, (v) => v.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }));
47
+ }
48
+ /** Visible length of a string, ignoring ANSI color codes. */
49
+ export function visibleLen(s) {
50
+ // eslint-disable-next-line no-control-regex
51
+ return [...s.replace(/\[[0-9;]*m/g, "")].length;
52
+ }
53
+ /** A section header: ── Chat ─────────────────── (width-aware). */
54
+ export function sectionHeader(title) {
55
+ const width = Math.min(termWidth(), 66);
56
+ const left = "── ";
57
+ const used = left.length + [...title].length + 1;
58
+ const fill = "─".repeat(Math.max(2, width - used));
59
+ return c.rule(left) + c.title(title) + " " + c.rule(fill);
60
+ }
61
+ /**
62
+ * Two aligned columns (e.g. command → description). Pads the left column to the
63
+ * widest entry BEFORE coloring, so alignment is never thrown off by ANSI codes.
64
+ */
65
+ export function twoCol(pairs, left = c.cmd, right = c.dim, gap = 2, indent = " ") {
66
+ const w = Math.max(0, ...pairs.map(([l]) => [...l].length));
67
+ return pairs.map(([l, r]) => indent + left(l.padEnd(w)) + " ".repeat(gap) + right(r));
68
+ }
69
+ /** A premium empty state: a dim title and an optional hint with a command. */
70
+ export function emptyState(title, hint, cmd) {
71
+ const lines = ["", " " + c.dim(title)];
72
+ if (hint && cmd)
73
+ lines.push(" " + c.dim(hint + " ") + c.cmd(cmd));
74
+ else if (hint)
75
+ lines.push(" " + c.dim(hint));
76
+ lines.push("");
77
+ return lines;
78
+ }
79
+ /** A determinate progress bar, e.g. ████████░░░░░░ 60%. */
80
+ export function progressBar(fraction, width = 24) {
81
+ const f = Math.max(0, Math.min(1, fraction));
82
+ const filled = Math.round(f * width);
83
+ return (c.brand("█".repeat(filled)) +
84
+ c.dim("░".repeat(width - filled)) +
85
+ " " +
86
+ c.dim(`${Math.round(f * 100)}%`));
87
+ }
88
+ /**
89
+ * Colorize a slash-command line for echoing: the command in cyan, and its
90
+ * argument colored by kind (files yellow, other values green).
91
+ */
92
+ export function colorizeCommand(input) {
93
+ const [cmd, ...rest] = input.split(/\s+/);
94
+ if (!cmd.startsWith("/"))
95
+ return input;
96
+ const arg = rest.join(" ");
97
+ if (!arg)
98
+ return c.cmd(cmd);
99
+ const isFile = /[./\\]/.test(arg) && /\.[a-z0-9]+$/i.test(arg);
100
+ return c.cmd(cmd) + " " + (isFile ? c.file(arg) : c.arg(arg));
101
+ }
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@carrieros/cli-staging",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "Carrier OS CLI for the Carrier OS staging environment",
5
+ "type": "module",
6
+ "bin": {
7
+ "cos-staging": "dist/staging.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "dependencies": {
17
+ "@inquirer/prompts": "^7.2.0",
18
+ "axios": "^1.7.9",
19
+ "chalk": "^5.3.0",
20
+ "commander": "^12.1.0",
21
+ "form-data": "^4.0.1",
22
+ "ora": "^8.1.1",
23
+ "string-width": "7.2.0"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/carrieros-ai/carrieros-cli.git"
28
+ },
29
+ "author": "Carrier OS",
30
+ "license": "UNLICENSED",
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "tag": "staging"
34
+ }
35
+ }