@semacode/cli 4.1.3 → 4.2.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.
- package/dist/agentBootstrap.d.ts +4 -0
- package/dist/agentBootstrap.js +44 -0
- package/dist/agentContext.d.ts +1 -1
- package/dist/agentContext.js +5 -5
- package/dist/agentContextPack.js +22 -31
- package/dist/agentEntryPoints.d.ts +1 -3
- package/dist/agentEntryPoints.js +16 -262
- package/dist/cliArgs.js +1 -0
- package/dist/cliGrammar.js +7 -3
- package/dist/cliHelpTexto.js +2 -2
- package/dist/comandoSessao.d.ts +0 -33
- package/dist/comandoSessao.js +71 -70
- package/dist/contextBudget.d.ts +15 -0
- package/dist/contextBudget.js +64 -0
- package/dist/docs.part01.js +0 -1
- package/dist/docs.part02.js +11 -23
- package/dist/docsRelations.d.ts +2 -0
- package/dist/docsRelations.js +83 -0
- package/dist/index.part08.js +1 -1
- package/dist/indexPack.d.ts +1 -0
- package/dist/indexPack.js +1 -1
- package/dist/initCommand.d.ts +1 -0
- package/dist/initCommand.js +10 -1
- package/dist/sessionContext.d.ts +13 -0
- package/dist/sessionContext.js +41 -0
- package/docs/ai-integration.md +5 -13
- package/docs/ai-workflow.md +8 -6
- package/docs/commands.md +1 -1
- package/docs/documentation.md +33 -0
- package/exemplos/python_verificacao.sema +68 -68
- package/node_modules/@sema/gerador-python/dist/runtime.js +65 -65
- package/package.json +1 -1
- package/skills/sema/SKILL.md +82 -169
package/skills/sema/SKILL.md
CHANGED
|
@@ -1,199 +1,112 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sema
|
|
3
|
-
description:
|
|
3
|
+
description: Install, update or repair the local Sema CLI, or adopt Sema in a project. Separate distribution work from workspace adoption. In an existing Sema project, delegate to AGENTS.md and the local CLI with progressive context.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Sema Bootstrap
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Install or update the global distribution
|
|
33
|
-
|
|
34
|
-
When the user explicitly requests a global install or update:
|
|
35
|
-
|
|
36
|
-
1. Accept only an exact SemVer requested by the user or the literal `latest`.
|
|
37
|
-
Treat an omitted version as `latest`. For `latest`, resolve the registry tag
|
|
38
|
-
before installation:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm view @semacode/cli@latest version --json
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Require the result to be one JSON string containing an exact SemVer: no
|
|
45
|
-
leading `v`, tag, range, whitespace, command syntax, or array. Stop if npm
|
|
46
|
-
fails or the result is not an exact SemVer. For an exact user request, use
|
|
47
|
-
that already-validated version. In both cases install only the resulting
|
|
48
|
-
exact version; substitute it and never pass the placeholder literally:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm install --global @semacode/cli@<resolved-exact-semver>
|
|
52
|
-
```
|
|
53
|
-
|
|
8
|
+
The local CLI is the source of truth for Codex and compatible coding agents,
|
|
9
|
+
including Harness, OpenCode and Bionic. In an existing Sema workspace, read
|
|
10
|
+
`AGENTS.md` and `SEMA_BOOT.md`, then use its session navigation. Do not preload
|
|
11
|
+
`SEMA_INDEX.json`, `AGENT_CONTEXT_PACK.json`, all contracts or the whole project.
|
|
12
|
+
This skill only bridges the absence of that protocol during first contact;
|
|
13
|
+
installation and repair use the separate flows below.
|
|
14
|
+
|
|
15
|
+
## Choose the authorized scope
|
|
16
|
+
|
|
17
|
+
Never treat a request to install, update, or repair the global distribution as
|
|
18
|
+
permission to adopt the current workspace. Informational use does not mutate
|
|
19
|
+
it. Explicit adoption already authorizes bootstrap; do not ask again. Clarify
|
|
20
|
+
only an unresolved scope. Preserve existing files and never add `--force`
|
|
21
|
+
without an explicit human overwrite decision.
|
|
22
|
+
|
|
23
|
+
## Install or update globally
|
|
24
|
+
|
|
25
|
+
1. Accept an exact SemVer, or resolve an omitted version / `latest` once:
|
|
26
|
+
`npm view @semacode/cli@latest version --json`.
|
|
27
|
+
Require one exact SemVer JSON string; stop on failure, range or malformed
|
|
28
|
+
output. Freeze that version before installing:
|
|
29
|
+
`npm install --global @semacode/cli@<resolved-exact-semver>`.
|
|
30
|
+
Substitute the validated version; never pass the placeholder literally.
|
|
54
31
|
2. Run that `npm install --global` even when an older `sema --version` already
|
|
55
|
-
works.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
4. Run `sema skill status --json`, validate its public result envelope, and
|
|
64
|
-
unwrap `payload`. If any managed component in that command payload is not
|
|
65
|
-
`READY`, run `sema skill sync --json`, validate and unwrap its result, then
|
|
66
|
-
run status again. Require a final `READY` state; do not report a successful
|
|
67
|
-
install or update from npm's exit code alone.
|
|
32
|
+
works. Synchronizing a skill does not upgrade the package.
|
|
33
|
+
3. Probe both CLI candidates below. Require the selected candidate to report
|
|
34
|
+
the exact installed version and support the skill status command.
|
|
35
|
+
4. Run `sema skill status --json`. If a managed component is not `READY`, run
|
|
36
|
+
`sema skill sync --json`, then status again. Require the final `READY`
|
|
37
|
+
state and version match; npm exit code alone is insufficient proof.
|
|
38
|
+
5. Report the installed version. Existing chats may need a skill reload or
|
|
39
|
+
a new chat. Do not initialize a workspace unless adoption was also requested.
|
|
68
40
|
|
|
69
|
-
|
|
70
|
-
also requested explicitly. Report that an already-open agent may need the
|
|
71
|
-
host's skill reload action or a new task to load changed skill files.
|
|
41
|
+
## Resolve the CLI and its results
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
project root:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
sema --version
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Also probe the PATH-independent managed fallback. On Windows PowerShell:
|
|
43
|
+
Probe `sema --version` and `sema skill status --json` from the workspace root.
|
|
44
|
+
Also probe the PATH-independent fallback with the same two arguments.
|
|
45
|
+
Windows PowerShell fallback:
|
|
83
46
|
|
|
84
47
|
```powershell
|
|
85
48
|
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
86
49
|
```
|
|
87
50
|
|
|
88
|
-
|
|
89
|
-
`sema.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
On macOS or Linux:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
"$HOME/.sema/bin/sema" --version
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
For each candidate, run `--version` and the read-only `skill status --json`
|
|
99
|
-
probe. During install or update, a candidate is valid only when its version
|
|
100
|
-
equals the exact version installed. During repair or bootstrap, if both are
|
|
101
|
-
valid but report different versions, prefer the managed candidate. Also prefer
|
|
102
|
-
the managed candidate when the regular command from `PATH` is stale, fails, or
|
|
103
|
-
does not support `sema skill status --json`. Use the selected invocation for
|
|
104
|
-
every remaining command.
|
|
105
|
-
|
|
106
|
-
Interpret Sema CLI output as follows:
|
|
107
|
-
|
|
108
|
-
- Treat `--version` as plain exact SemVer text, never as a JSON envelope.
|
|
109
|
-
- For help or a command-control failure with `--json`, accept only the exact
|
|
110
|
-
six-field `sema.cli.control/v1` envelope.
|
|
111
|
-
- For every syntactically valid command with `--json`, accept only the exact
|
|
112
|
-
eight-field `sema.cli.result/v1` envelope containing `schemaVersion`, `ok`,
|
|
113
|
-
`kind`, `command`, `code`, `message`, `exitCode`, and `payload`.
|
|
114
|
-
- Unwrap `payload` before reading command-specific state. Do not accept `data`
|
|
115
|
-
as an alias, do not read domain fields from the envelope top level, and do
|
|
116
|
-
not treat transport `ok` as a replacement for `payload.sucesso` or another
|
|
117
|
-
command-specific verdict.
|
|
51
|
+
On macOS/Linux: `"$HOME/.sema/bin/sema" --version`.
|
|
52
|
+
Windows PATH uses `sema.ps1` in PowerShell and `sema.cmd` in cmd.exe. Do not
|
|
53
|
+
invoke the batch shim as the absolute PowerShell fallback.
|
|
118
54
|
|
|
55
|
+
If valid candidates disagree, prefer the managed candidate. Use it when PATH
|
|
56
|
+
is stale, fails, or does not support `sema skill status --json`. During an
|
|
57
|
+
update, any selected candidate must match the installed exact version.
|
|
119
58
|
Do not declare Sema unavailable until both candidates have failed validation.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
If neither invocation works, stop. For a bootstrap request, ask the user to
|
|
124
|
-
authorize a global CLI install explicitly, then follow the install flow above:
|
|
125
|
-
resolve `latest` to an exact SemVer and install that immutable version. Do not
|
|
126
|
-
issue a direct install against the mutable `latest` tag.
|
|
59
|
+
If unavailable, stop before governed edits; install only within an authorized
|
|
60
|
+
global install/update request. Repair alone does not authorize a new version.
|
|
127
61
|
|
|
128
|
-
|
|
129
|
-
|
|
62
|
+
`--version` is plain SemVer. JSON help/control failures use the six-field
|
|
63
|
+
`sema.cli.control/v1` envelope. Valid commands use the eight-field
|
|
64
|
+
`sema.cli.result/v1`: schemaVersion, ok, kind, command, code, message, exitCode,
|
|
65
|
+
payload. Read domain state inside `payload`; `data` is not an alias and `ok`
|
|
66
|
+
does not replace `payload.sucesso` or another domain verdict.
|
|
130
67
|
|
|
131
|
-
## Repair
|
|
68
|
+
## Repair without upgrading
|
|
132
69
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
the result with a second status call. Repair may synchronize the current
|
|
137
|
-
launcher and skill, but must not run `npm install`, select another version, or
|
|
70
|
+
Resolve the current CLI, inspect status, and synchronize only non-READY
|
|
71
|
+
managed components. Prove the result with status again. Repair may synchronize the current
|
|
72
|
+
launcher and skill, but must not run `npm install`, choose a new version or
|
|
138
73
|
mutate the workspace.
|
|
139
74
|
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
1. If the project already has a generated Sema `AGENTS.md`, read it and
|
|
143
|
-
`SEMA_BOOT.md`, then delegate project work to that protocol. Do not run
|
|
144
|
-
`sema iniciar` or `sema sync-codex` merely because this skill was invoked or
|
|
145
|
-
because global distribution work completed.
|
|
146
|
-
|
|
147
|
-
2. If the project has no Sema contract and no generated Sema `AGENTS.md`, do
|
|
148
|
-
not treat invocation of this skill as permission to mutate the workspace:
|
|
149
|
-
|
|
150
|
-
- for an informational request, answer without initializing Sema;
|
|
151
|
-
- before implementing or changing the project, ask for explicit adoption
|
|
152
|
-
authorization and stop until it is granted;
|
|
153
|
-
- an explicit request to introduce, initialize, or adopt Sema in this
|
|
154
|
-
project is that authorization;
|
|
155
|
-
- global install, update, repair, or skill synchronization authorizes
|
|
156
|
-
distribution changes only and must not initialize the current workspace.
|
|
157
|
-
|
|
158
|
-
3. After adoption is explicitly authorized, inspect the official adoption
|
|
159
|
-
flow and then initialize the project:
|
|
75
|
+
## Adopt a workspace with a bounded context
|
|
160
76
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
```
|
|
77
|
+
If no contract/protocol exists, obtain explicit adoption authorization before
|
|
78
|
+
implementation. A request to adopt or initialize this project already grants
|
|
79
|
+
it. After authorization, inspect the official flow:
|
|
165
80
|
|
|
166
|
-
|
|
167
|
-
automatically; an overwrite must be an explicit user decision.
|
|
81
|
+
`sema descobrir explicar flow.project-adoption --json`
|
|
168
82
|
|
|
169
|
-
|
|
170
|
-
|
|
83
|
+
Before creating files, obtain the model's **effective configured context
|
|
84
|
+
window in tokens** from the client or user. Model size, advertised capacity
|
|
85
|
+
and names such as 9B do not prove that value. Do not invent a default.
|
|
86
|
+
Initialize with the confirmed value:
|
|
171
87
|
|
|
172
|
-
|
|
173
|
-
sema sync-codex --json
|
|
174
|
-
```
|
|
88
|
+
`sema iniciar --template base --janela-contexto <tokens>`
|
|
175
89
|
|
|
176
|
-
|
|
177
|
-
|
|
90
|
+
Then run `sema sync-codex --json`. Read the generated `AGENTS.md` and
|
|
91
|
+
`SEMA_BOOT.md`, and delegate the governed workflow to them. For an existing
|
|
92
|
+
workspace, the session requests a missing profile; persist it only when
|
|
93
|
+
requested with `--salvar-perfil`, and reconfigure after changing models.
|
|
94
|
+
The context budget estimates a session response, not the entire conversation
|
|
95
|
+
or exact tokenizer usage. Expand through the selected contract and declared
|
|
96
|
+
links, leaving recommended documents available on demand. A stale index or
|
|
97
|
+
ambiguous target requires correction or refinement before acting.
|
|
178
98
|
|
|
179
|
-
##
|
|
99
|
+
## Distribution boundaries
|
|
180
100
|
|
|
181
|
-
- The CLI is the engine and source of truth.
|
|
182
101
|
- `AGENTS.md` is the automatic, continuous workspace protocol for Codex.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
- Never write into a host-managed plugin cache or
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
escapes; it must never choose overwrite on the user's behalf.
|
|
194
|
-
- Do not introduce runtime access gates for executing the local CLI: no Sema
|
|
195
|
-
login, product-license check, activation key, token, credits, billing panel,
|
|
196
|
-
or remote workspace mirror. This runtime rule does not waive explicit human
|
|
102
|
+
Compatible clients follow the same local protocol; do not duplicate it here.
|
|
103
|
+
- Launchers are managed at `~/.sema/bin`. The canonical skill is managed at
|
|
104
|
+
`~/.agents/skills/sema`; the mirror at `~/.claude/skills/sema` is managed
|
|
105
|
+
when Claude is detected. Client-specific copies require an explicit request
|
|
106
|
+
and the client's supported discovery location; preserve unrelated skills.
|
|
107
|
+
- Never write into a host-managed plugin cache or overwrite an unmanaged or
|
|
108
|
+
modified skill silently. Preserve files and stop on symlink/junction escapes.
|
|
109
|
+
- Do not introduce runtime access gates: no Sema login, activation key,
|
|
110
|
+
license check, tokens, credits, billing or remote workspace mirror. This
|
|
111
|
+
does not waive explicit human
|
|
197
112
|
authorization for workspace adoption or overwrite.
|
|
198
|
-
- Do not continue with a second copy of the governed workflow after
|
|
199
|
-
`AGENTS.md` exists.
|