@semacode/cli 3.8.0 → 3.8.2

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.
@@ -1,199 +1,199 @@
1
- ---
2
- name: sema
3
- description: Required Sema bootstrap for Codex and compatible coding agents when a local project does not yet contain its generated AGENTS.md protocol. Use when the user asks to install, update, repair, introduce, initialize, or adopt Sema, or mentions Sema in a workspace without that protocol. Treat global install or update, distribution repair, informational use, and explicit workspace adoption as separate intents; never infer adoption from distribution work. Resolve the managed PATH-independent launcher before declaring the CLI unavailable; after AGENTS.md exists, read it and delegate project governance to it and the local CLI.
4
- ---
5
-
6
- # Sema Bootstrap
7
-
8
- This skill is required for the first contact, before a project can explain Sema
9
- to Codex through `AGENTS.md`. It does not replace or duplicate workspace
10
- governance.
11
-
12
- ## Classify the request
13
-
14
- Separate these intents before running a command:
15
-
16
- - **Install or update the global distribution**: install a requested exact
17
- version, or `latest` when no version is specified. This changes the global
18
- package, launcher, and managed skill only.
19
- - **Repair the current distribution**: diagnose and synchronize the launcher
20
- and managed skill without selecting or installing another package version.
21
- - **Adopt the current workspace**: introduce Sema governance into this project.
22
- Require an explicit request to introduce, initialize, or adopt Sema here.
23
- - **Informational use**: explain or inspect without initializing the workspace.
24
-
25
- Never treat a request to install, update, or repair the global CLI or skill as
26
- permission to adopt the current workspace. If a request explicitly asks for
27
- both distribution work and workspace adoption, execute them as two distinct
28
- authorized intents. If wording such as "install Sema in this project" leaves
29
- the workspace scope ambiguous, ask one scoped question before mutating the
30
- workspace.
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
-
54
- 2. Run that `npm install --global` even when an older `sema --version` already
55
- works. Never run `npm install ...@latest`; the mutable tag is resolved and
56
- frozen first. `sema skill sync` repairs files from the installed package; it
57
- does not install the version the user requested.
58
-
59
- 3. Probe both CLI candidates as described below. Require the selected candidate
60
- to report the exact installed version and support `sema skill status --json`.
61
- A stale command found through `PATH` must not hide a valid managed launcher.
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.
68
-
69
- 5. Stop without touching the current workspace unless workspace adoption was
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.
72
-
73
- ## Resolve the installed CLI
74
-
75
- For install, repair, or workspace bootstrap, probe the regular command from the
76
- project root:
77
-
78
- ```bash
79
- sema --version
80
- ```
81
-
82
- Also probe the PATH-independent managed fallback. On Windows PowerShell:
83
-
84
- ```powershell
85
- & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
86
- ```
87
-
88
- PowerShell resolves `sema.ps1` for a normal `sema` lookup; `cmd.exe` resolves
89
- `sema.cmd`. Do not invoke the batch entrypoint with PowerShell's call operator
90
- as the absolute fallback. `sema-managed.ps1` is the managed fallback.
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.
118
-
119
- Do not declare Sema unavailable until both candidates have failed validation.
120
- Do not treat a missing npm shim, stale `PATH`, or an old command without the
121
- `skill` subcommand as proof that Sema is absent.
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.
127
-
128
- For a repair-only request, explain that synchronization requires a working
129
- installed CLI. Do not silently choose `latest` or another version as a repair.
130
-
131
- ## Repair the current distribution
132
-
133
- When the user explicitly requests repair without an update, resolve the CLI by
134
- probing both candidates above. Run `sema skill sync --json` only when the
135
- selected candidate reports a managed component that is not `READY`, then prove
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
138
- mutate the workspace.
139
-
140
- ## Follow or create workspace governance
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:
160
-
161
- ```bash
162
- sema descobrir explicar flow.project-adoption --json
163
- sema iniciar --template base
164
- ```
165
-
166
- This command preserves existing project files. Never add `--force`
167
- automatically; an overwrite must be an explicit user decision.
168
-
169
- 4. Generate the official Codex handshake for the newly initialized or adopted
170
- workspace:
171
-
172
- ```bash
173
- sema sync-codex --json
174
- ```
175
-
176
- 5. Read the generated `AGENTS.md` and `SEMA_BOOT.md`. From this point onward,
177
- follow those workspace instructions and execute the local CLI directly.
178
-
179
- ## Boundary
180
-
181
- - The CLI is the engine and source of truth.
182
- - `AGENTS.md` is the automatic, continuous workspace protocol for Codex.
183
- - The launchers are managed only at `~/.sema/bin`; on Windows, `sema.ps1` is
184
- the PowerShell PATH entrypoint, `sema.cmd` is the cmd.exe entrypoint, and
185
- `sema-managed.ps1` is the absolute fallback. The canonical skill copy is
186
- managed only at `~/.agents/skills/sema`; a Claude mirror is managed only at
187
- `~/.claude/skills/sema` when Claude is already detected.
188
- - Never write into a host-managed plugin cache or create duplicate copies in
189
- every vendor-specific skill directory.
190
- - This skill is mandatory while that protocol is absent.
191
- - This skill only bridges the absence of that protocol during first contact.
192
- - Bootstrap must preserve existing files and stop on symlink or junction
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
197
- authorization for workspace adoption or overwrite.
198
- - Do not continue with a second copy of the governed workflow after
199
- `AGENTS.md` exists.
1
+ ---
2
+ name: sema
3
+ description: Required Sema bootstrap for Codex and compatible coding agents when a local project does not yet contain its generated AGENTS.md protocol. Use when the user asks to install, update, repair, introduce, initialize, or adopt Sema, or mentions Sema in a workspace without that protocol. Treat global install or update, distribution repair, informational use, and explicit workspace adoption as separate intents; never infer adoption from distribution work. Resolve the managed PATH-independent launcher before declaring the CLI unavailable; after AGENTS.md exists, read it and delegate project governance to it and the local CLI.
4
+ ---
5
+
6
+ # Sema Bootstrap
7
+
8
+ This skill is required for the first contact, before a project can explain Sema
9
+ to Codex through `AGENTS.md`. It does not replace or duplicate workspace
10
+ governance.
11
+
12
+ ## Classify the request
13
+
14
+ Separate these intents before running a command:
15
+
16
+ - **Install or update the global distribution**: install a requested exact
17
+ version, or `latest` when no version is specified. This changes the global
18
+ package, launcher, and managed skill only.
19
+ - **Repair the current distribution**: diagnose and synchronize the launcher
20
+ and managed skill without selecting or installing another package version.
21
+ - **Adopt the current workspace**: introduce Sema governance into this project.
22
+ Require an explicit request to introduce, initialize, or adopt Sema here.
23
+ - **Informational use**: explain or inspect without initializing the workspace.
24
+
25
+ Never treat a request to install, update, or repair the global CLI or skill as
26
+ permission to adopt the current workspace. If a request explicitly asks for
27
+ both distribution work and workspace adoption, execute them as two distinct
28
+ authorized intents. If wording such as "install Sema in this project" leaves
29
+ the workspace scope ambiguous, ask one scoped question before mutating the
30
+ workspace.
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
+
54
+ 2. Run that `npm install --global` even when an older `sema --version` already
55
+ works. Never run `npm install ...@latest`; the mutable tag is resolved and
56
+ frozen first. `sema skill sync` repairs files from the installed package; it
57
+ does not install the version the user requested.
58
+
59
+ 3. Probe both CLI candidates as described below. Require the selected candidate
60
+ to report the exact installed version and support `sema skill status --json`.
61
+ A stale command found through `PATH` must not hide a valid managed launcher.
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.
68
+
69
+ 5. Stop without touching the current workspace unless workspace adoption was
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.
72
+
73
+ ## Resolve the installed CLI
74
+
75
+ For install, repair, or workspace bootstrap, probe the regular command from the
76
+ project root:
77
+
78
+ ```bash
79
+ sema --version
80
+ ```
81
+
82
+ Also probe the PATH-independent managed fallback. On Windows PowerShell:
83
+
84
+ ```powershell
85
+ & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
86
+ ```
87
+
88
+ PowerShell resolves `sema.ps1` for a normal `sema` lookup; `cmd.exe` resolves
89
+ `sema.cmd`. Do not invoke the batch entrypoint with PowerShell's call operator
90
+ as the absolute fallback. `sema-managed.ps1` is the managed fallback.
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.
118
+
119
+ Do not declare Sema unavailable until both candidates have failed validation.
120
+ Do not treat a missing npm shim, stale `PATH`, or an old command without the
121
+ `skill` subcommand as proof that Sema is absent.
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.
127
+
128
+ For a repair-only request, explain that synchronization requires a working
129
+ installed CLI. Do not silently choose `latest` or another version as a repair.
130
+
131
+ ## Repair the current distribution
132
+
133
+ When the user explicitly requests repair without an update, resolve the CLI by
134
+ probing both candidates above. Run `sema skill sync --json` only when the
135
+ selected candidate reports a managed component that is not `READY`, then prove
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
138
+ mutate the workspace.
139
+
140
+ ## Follow or create workspace governance
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:
160
+
161
+ ```bash
162
+ sema descobrir explicar flow.project-adoption --json
163
+ sema iniciar --template base
164
+ ```
165
+
166
+ This command preserves existing project files. Never add `--force`
167
+ automatically; an overwrite must be an explicit user decision.
168
+
169
+ 4. Generate the official Codex handshake for the newly initialized or adopted
170
+ workspace:
171
+
172
+ ```bash
173
+ sema sync-codex --json
174
+ ```
175
+
176
+ 5. Read the generated `AGENTS.md` and `SEMA_BOOT.md`. From this point onward,
177
+ follow those workspace instructions and execute the local CLI directly.
178
+
179
+ ## Boundary
180
+
181
+ - The CLI is the engine and source of truth.
182
+ - `AGENTS.md` is the automatic, continuous workspace protocol for Codex.
183
+ - The launchers are managed only at `~/.sema/bin`; on Windows, `sema.ps1` is
184
+ the PowerShell PATH entrypoint, `sema.cmd` is the cmd.exe entrypoint, and
185
+ `sema-managed.ps1` is the absolute fallback. The canonical skill copy is
186
+ managed only at `~/.agents/skills/sema`; a Claude mirror is managed only at
187
+ `~/.claude/skills/sema` when Claude is already detected.
188
+ - Never write into a host-managed plugin cache or create duplicate copies in
189
+ every vendor-specific skill directory.
190
+ - This skill is mandatory while that protocol is absent.
191
+ - This skill only bridges the absence of that protocol during first contact.
192
+ - Bootstrap must preserve existing files and stop on symlink or junction
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
197
+ authorization for workspace adoption or overwrite.
198
+ - Do not continue with a second copy of the governed workflow after
199
+ `AGENTS.md` exists.