@semacode/cli 3.8.1 → 3.8.3
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/LICENSE +39 -39
- package/README.md +119 -119
- package/dist/driftEscopo.js +35 -0
- package/dist/iaPrompts.js +11 -11
- package/dist/index.part02.js +21 -21
- package/dist/index.part07.js +24 -24
- package/dist/initCommand.js +1 -1
- package/dist/initTemplatesBase.js +84 -84
- package/docs/README.md +15 -15
- package/docs/ai-onboarding.md +81 -81
- package/docs/cli.md +197 -197
- package/docs/deploy.md +54 -54
- package/docs/documentation.md +11 -11
- package/docs/drift-cache.md +108 -108
- package/docs/getting-started.md +82 -82
- package/docs/repositories.md +60 -60
- package/docs/rollback.md +38 -38
- package/docs/security.md +54 -54
- package/docs/sistemas-interativos.md +27 -27
- package/docs/support.md +8 -8
- package/docs/testing.md +123 -123
- package/docs/vocabulary.md +29 -29
- package/exemplos/express_crud.sema +139 -139
- package/exemplos/fastify_crud.sema +146 -146
- package/exemplos/koa_crud.sema +95 -95
- package/package.json +4 -4
- package/scripts/postinstall.mjs +148 -148
- package/skills/sema/SKILL.md +199 -199
package/LICENSE
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
Sema Public Non-Commercial License
|
|
2
|
-
Version 1.0
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2026 Sema
|
|
5
|
-
|
|
6
|
-
Official support: suporte@otimitare.
|
|
7
|
-
|
|
8
|
-
Permission is granted, free of charge, to use, copy, study, modify, and
|
|
9
|
-
distribute this software and its documentation for personal, educational,
|
|
10
|
-
research, internal business, and non-commercial purposes, subject to the terms
|
|
11
|
-
below.
|
|
12
|
-
|
|
13
|
-
You may:
|
|
14
|
-
|
|
15
|
-
1. Use Sema locally as a CLI in your own projects.
|
|
16
|
-
2. Study and modify the source code.
|
|
17
|
-
3. Share unmodified or modified copies for non-commercial purposes.
|
|
18
|
-
4. Publish patches, examples, documentation, and integrations that do not sell
|
|
19
|
-
Sema itself as a product or commercial replacement.
|
|
20
|
-
|
|
21
|
-
You may not, without prior written permission from OtimiTare:
|
|
22
|
-
|
|
23
|
-
1. Sell Sema, a modified Sema, or a substantially similar rebranded copy.
|
|
24
|
-
2. Offer Sema, a modified Sema, or a substantially similar implementation as a
|
|
25
|
-
commercial replica or paid replacement.
|
|
26
|
-
3. Bundle Sema into a paid product in a way that makes Sema itself a material
|
|
27
|
-
commercial feature.
|
|
28
|
-
4. Use Sema's name, marks, documentation, or public repository to imply
|
|
29
|
-
endorsement by Sema or OtimiTare.
|
|
30
|
-
5. Remove this license or the copyright notice from distributed copies.
|
|
31
|
-
|
|
32
|
-
Commercial licensing, resale permission, or commercial replica permission
|
|
33
|
-
requires written approval. Contact suporte@otimitare.
|
|
34
|
-
|
|
35
|
-
This software is provided "as is", without warranty of any kind, express or
|
|
36
|
-
implied, including but not limited to warranties of merchantability, fitness for
|
|
37
|
-
a particular purpose, and non-infringement. In no event shall the authors or
|
|
38
|
-
copyright holders be liable for any claim, damages, or other liability arising
|
|
39
|
-
from the software or its use.
|
|
1
|
+
Sema Public Non-Commercial License
|
|
2
|
+
Version 1.0
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Sema
|
|
5
|
+
|
|
6
|
+
Official support: suporte@otimitare.com
|
|
7
|
+
|
|
8
|
+
Permission is granted, free of charge, to use, copy, study, modify, and
|
|
9
|
+
distribute this software and its documentation for personal, educational,
|
|
10
|
+
research, internal business, and non-commercial purposes, subject to the terms
|
|
11
|
+
below.
|
|
12
|
+
|
|
13
|
+
You may:
|
|
14
|
+
|
|
15
|
+
1. Use Sema locally as a CLI in your own projects.
|
|
16
|
+
2. Study and modify the source code.
|
|
17
|
+
3. Share unmodified or modified copies for non-commercial purposes.
|
|
18
|
+
4. Publish patches, examples, documentation, and integrations that do not sell
|
|
19
|
+
Sema itself as a product or commercial replacement.
|
|
20
|
+
|
|
21
|
+
You may not, without prior written permission from OtimiTare:
|
|
22
|
+
|
|
23
|
+
1. Sell Sema, a modified Sema, or a substantially similar rebranded copy.
|
|
24
|
+
2. Offer Sema, a modified Sema, or a substantially similar implementation as a
|
|
25
|
+
commercial replica or paid replacement.
|
|
26
|
+
3. Bundle Sema into a paid product in a way that makes Sema itself a material
|
|
27
|
+
commercial feature.
|
|
28
|
+
4. Use Sema's name, marks, documentation, or public repository to imply
|
|
29
|
+
endorsement by Sema or OtimiTare.
|
|
30
|
+
5. Remove this license or the copyright notice from distributed copies.
|
|
31
|
+
|
|
32
|
+
Commercial licensing, resale permission, or commercial replica permission
|
|
33
|
+
requires written approval. Contact suporte@otimitare.com.
|
|
34
|
+
|
|
35
|
+
This software is provided "as is", without warranty of any kind, express or
|
|
36
|
+
implied, including but not limited to warranties of merchantability, fitness for
|
|
37
|
+
a particular purpose, and non-infringement. In no event shall the authors or
|
|
38
|
+
copyright holders be liable for any claim, damages, or other liability arising
|
|
39
|
+
from the software or its use.
|
package/README.md
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
# @semacode/cli
|
|
2
2
|
|
|
3
|
-
`@semacode/cli` is the public
|
|
4
|
-
governance.
|
|
3
|
+
`@semacode/cli` is the public local-first CLI for Sema semantic
|
|
4
|
+
governance, proven with Claude, Codex, zCode (GLM) and Kimi.
|
|
5
5
|
|
|
6
6
|
It validates `.sema` contracts, checks semantic drift, maps impact, enforces
|
|
7
7
|
documentation gates, generates starter code, and prepares contract-first
|
|
8
|
-
context for
|
|
8
|
+
contract-first context for coding agents inside a local project folder.
|
|
9
9
|
|
|
10
10
|
Sema is an independent product and is not affiliated with or endorsed by
|
|
11
|
-
OpenAI.
|
|
12
|
-
|
|
11
|
+
OpenAI. Proven compatibility with Claude, Codex, zCode (GLM) and Kimi
|
|
12
|
+
describes Sema's product direction, not an official OpenAI program.
|
|
13
13
|
|
|
14
|
-
Official support: [suporte@otimitare.
|
|
14
|
+
Official support: [suporte@otimitare.com](mailto:suporte@otimitare.com)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install -g @semacode/cli
|
|
20
|
-
sema skill status --json
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
The global package installs a stable launcher under `~/.sema/bin` and
|
|
24
|
-
synchronizes the bundled skill to `~/.agents/skills/sema`. If Claude is already
|
|
25
|
-
configured, it also maintains `~/.claude/skills/sema`. Open a new task after an
|
|
26
|
-
install or update because existing tasks do not reload their skill catalog.
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @semacode/cli
|
|
20
|
+
sema skill status --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The global package installs a stable launcher under `~/.sema/bin` and
|
|
24
|
+
synchronizes the bundled skill to `~/.agents/skills/sema`. If Claude is already
|
|
25
|
+
configured, it also maintains `~/.claude/skills/sema`. Open a new task after an
|
|
26
|
+
install or update because existing tasks do not reload their skill catalog.
|
|
27
27
|
|
|
28
28
|
## First Run
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
sema --version
|
|
32
|
-
sema resumo . --curto --drift none
|
|
32
|
+
sema resumo . --curto --drift none
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Public Sema is local-only. The CLI runs directly without a Sema login, user
|
|
36
|
-
authorization, product-license check, activation key, token, credits, billing
|
|
37
|
-
service, control panel, or external service credentials. The license governs
|
|
38
|
-
use and redistribution; it is not a runtime activation gate.
|
|
39
|
-
|
|
40
|
-
## Side-Effect-Free Help And JSON Results
|
|
41
|
-
|
|
42
|
-
`--help` and `-h` short-circuit before the operational runtime or handlers are
|
|
43
|
-
imported wherever they appear. Help exits with status `0` without inspecting or mutating the workspace, home,
|
|
44
|
-
user cache, or plugin cache, and without starting subprocesses or network
|
|
45
|
-
calls.
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
sema iniciar --help
|
|
49
|
-
sema dev --help --json
|
|
50
|
-
sema skill sync --help
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
When `--json` is present, help and command-control failures emit exactly one
|
|
54
|
-
`sema.cli.control/v1` document on stdout with empty stderr. Its only fields are
|
|
55
|
-
`schemaVersion`, `ok`, `kind`, `code`, `message`, and `exitCode`. Failures are
|
|
56
|
-
redacted and never expose a stack, absolute path, or raw argv.
|
|
57
|
-
|
|
58
|
-
Every syntactically valid command invoked with `--json` in 3.0.0 emits exactly
|
|
59
|
-
one `sema.cli.result/v1` document. Its only fields are `schemaVersion`, `ok`,
|
|
60
|
-
`kind`, `command`, `code`, `message`, `exitCode`, and `payload`. `SUCCESS` uses
|
|
61
|
-
`ok: true`, `CLI_SUCCESS`, `message: null`, and exit code `0`;
|
|
62
|
-
`DOMAIN_ERROR` uses `ok: false`, `CLI_DOMAIN_ERROR`, a safe public message, and
|
|
63
|
-
a positive exit code. `payload` is always present, may contain any JSON value,
|
|
64
|
-
and is the only location for the command-specific result; `data` is not an
|
|
65
|
-
alias.
|
|
66
|
-
|
|
67
|
-
Envelope `ok` classifies the CLI result path and does not replace domain fields
|
|
68
|
-
inside `payload`. Consumers must unwrap the payload before reading values such
|
|
69
|
-
as `sucesso`, `aprovado`, or `bloqueado`. `sema --version` remains plain exact
|
|
70
|
-
SemVer text rather than a JSON envelope.
|
|
71
|
-
|
|
72
|
-
The package separates execution from imports: `bin.sema` points to
|
|
73
|
-
`dist/bin.js`, while `main` and the root export remain `dist/index.js`.
|
|
74
|
-
Unknown commands/subcommands, missing or invalid CLI syntax, and uncaught
|
|
75
|
-
runtime exceptions use the control envelope; structured domain-level failures
|
|
76
|
-
after valid dispatch use `sema.cli.result/v1` with `kind: "DOMAIN_ERROR"`.
|
|
77
|
-
|
|
78
|
-
## Codex Setup
|
|
35
|
+
Public Sema is local-only. The CLI runs directly without a Sema login, user
|
|
36
|
+
authorization, product-license check, activation key, token, credits, billing
|
|
37
|
+
service, control panel, or external service credentials. The license governs
|
|
38
|
+
use and redistribution; it is not a runtime activation gate.
|
|
39
|
+
|
|
40
|
+
## Side-Effect-Free Help And JSON Results
|
|
41
|
+
|
|
42
|
+
`--help` and `-h` short-circuit before the operational runtime or handlers are
|
|
43
|
+
imported wherever they appear. Help exits with status `0` without inspecting or mutating the workspace, home,
|
|
44
|
+
user cache, or plugin cache, and without starting subprocesses or network
|
|
45
|
+
calls.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
sema iniciar --help
|
|
49
|
+
sema dev --help --json
|
|
50
|
+
sema skill sync --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
When `--json` is present, help and command-control failures emit exactly one
|
|
54
|
+
`sema.cli.control/v1` document on stdout with empty stderr. Its only fields are
|
|
55
|
+
`schemaVersion`, `ok`, `kind`, `code`, `message`, and `exitCode`. Failures are
|
|
56
|
+
redacted and never expose a stack, absolute path, or raw argv.
|
|
57
|
+
|
|
58
|
+
Every syntactically valid command invoked with `--json` in 3.0.0 emits exactly
|
|
59
|
+
one `sema.cli.result/v1` document. Its only fields are `schemaVersion`, `ok`,
|
|
60
|
+
`kind`, `command`, `code`, `message`, `exitCode`, and `payload`. `SUCCESS` uses
|
|
61
|
+
`ok: true`, `CLI_SUCCESS`, `message: null`, and exit code `0`;
|
|
62
|
+
`DOMAIN_ERROR` uses `ok: false`, `CLI_DOMAIN_ERROR`, a safe public message, and
|
|
63
|
+
a positive exit code. `payload` is always present, may contain any JSON value,
|
|
64
|
+
and is the only location for the command-specific result; `data` is not an
|
|
65
|
+
alias.
|
|
66
|
+
|
|
67
|
+
Envelope `ok` classifies the CLI result path and does not replace domain fields
|
|
68
|
+
inside `payload`. Consumers must unwrap the payload before reading values such
|
|
69
|
+
as `sucesso`, `aprovado`, or `bloqueado`. `sema --version` remains plain exact
|
|
70
|
+
SemVer text rather than a JSON envelope.
|
|
71
|
+
|
|
72
|
+
The package separates execution from imports: `bin.sema` points to
|
|
73
|
+
`dist/bin.js`, while `main` and the root export remain `dist/index.js`.
|
|
74
|
+
Unknown commands/subcommands, missing or invalid CLI syntax, and uncaught
|
|
75
|
+
runtime exceptions use the control envelope; structured domain-level failures
|
|
76
|
+
after valid dispatch use `sema.cli.result/v1` with `kind: "DOMAIN_ERROR"`.
|
|
77
|
+
|
|
78
|
+
## Codex Setup
|
|
79
79
|
|
|
80
80
|
`AGENTS.md` is the official Sema entrypoint for Codex:
|
|
81
81
|
|
|
@@ -86,26 +86,26 @@ sema sync-codex --json
|
|
|
86
86
|
Codex automatically loads `AGENTS.md` as durable repository guidance. See the
|
|
87
87
|
[Codex `AGENTS.md` documentation](https://learn.chatgpt.com/docs/agent-configuration/agents-md).
|
|
88
88
|
|
|
89
|
-
The CLI is the engine and source of truth; `AGENTS.md` is the automatic
|
|
90
|
-
workspace protocol. The Sema skill bootstraps a project that does not have Sema
|
|
91
|
-
yet and then delegates to the generated `AGENTS.md`. The npm lifecycle updates
|
|
92
|
-
only Sema-managed launcher and skill roots; it never writes into plugin caches,
|
|
93
|
-
credentials, the workspace, or `CODEX_HOME`.
|
|
94
|
-
|
|
95
|
-
Use `sema skill status --json` for a read-only diagnosis and `sema skill sync
|
|
96
|
-
--json` to repair the launcher and skill after `npm install --ignore-scripts`.
|
|
97
|
-
If a shell still cannot resolve `sema`, invoke the managed launcher directly:
|
|
98
|
-
|
|
99
|
-
```powershell
|
|
100
|
-
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
"$HOME/.sema/bin/sema" --version
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
On Windows, PowerShell resolves `sema.ps1` from `PATH`, `cmd.exe` resolves
|
|
108
|
-
`sema.cmd`, and `sema-managed.ps1` is the PATH-independent fallback.
|
|
89
|
+
The CLI is the engine and source of truth; `AGENTS.md` is the automatic
|
|
90
|
+
workspace protocol. The Sema skill bootstraps a project that does not have Sema
|
|
91
|
+
yet and then delegates to the generated `AGENTS.md`. The npm lifecycle updates
|
|
92
|
+
only Sema-managed launcher and skill roots; it never writes into plugin caches,
|
|
93
|
+
credentials, the workspace, or `CODEX_HOME`.
|
|
94
|
+
|
|
95
|
+
Use `sema skill status --json` for a read-only diagnosis and `sema skill sync
|
|
96
|
+
--json` to repair the launcher and skill after `npm install --ignore-scripts`.
|
|
97
|
+
If a shell still cannot resolve `sema`, invoke the managed launcher directly:
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
"$HOME/.sema/bin/sema" --version
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
On Windows, PowerShell resolves `sema.ps1` from `PATH`, `cmd.exe` resolves
|
|
108
|
+
`sema.cmd`, and `sema-managed.ps1` is the PATH-independent fallback.
|
|
109
109
|
|
|
110
110
|
## Codex-Native Architecture
|
|
111
111
|
|
|
@@ -114,38 +114,38 @@ On Windows, PowerShell resolves `sema.ps1` from `PATH`, `cmd.exe` resolves
|
|
|
114
114
|
- Agent Context Pack consumers use schema version 7, including the deterministic
|
|
115
115
|
discovery summary and the fields `entrypointCodex`, `codexNativo`, and
|
|
116
116
|
`cliLocalSemAutorizacao`.
|
|
117
|
-
- The bundled Sema skill handles first contact. Its canonical shared copy is
|
|
118
|
-
`~/.agents/skills/sema`; Claude gets a managed mirror only when detected. It
|
|
119
|
-
asks for adoption authorization before implementation and does not duplicate
|
|
120
|
-
governance after handing off to `AGENTS.md`. Installing or updating the
|
|
121
|
-
global CLI authorizes distribution changes only, not workspace adoption.
|
|
117
|
+
- The bundled Sema skill handles first contact. Its canonical shared copy is
|
|
118
|
+
`~/.agents/skills/sema`; Claude gets a managed mirror only when detected. It
|
|
119
|
+
asks for adoption authorization before implementation and does not duplicate
|
|
120
|
+
governance after handing off to `AGENTS.md`. Installing or updating the
|
|
121
|
+
global CLI authorizes distribution changes only, not workspace adoption.
|
|
122
122
|
|
|
123
123
|
## Local Workflow
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
126
|
sema docs-impacto --intencao "describe the change" --arquivo contratos/app.sema --json
|
|
127
|
-
sema inspecionar contratos/app.sema --drift none --json
|
|
128
|
-
sema drift contratos/app.sema --escopo modulo --cache fresh --json
|
|
129
|
-
sema impacto contratos/app.sema --alvo app.modulo --mudanca "describe the change" --json
|
|
130
|
-
sema finalizar-mudanca --intencao "describe the change" --doc-lida README.md --json
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
`resumo` and `inspecionar` default to `--drift none`; unobserved score,
|
|
134
|
-
confidence, implementation, and route evidence inside the result `payload`
|
|
135
|
-
stays `null`. Use `--drift cache|fresh` to request analysis. Direct `sema drift`
|
|
136
|
-
accepts `--cache none|cache|fresh` and defaults to `fresh`. Persistent objects are stored in the
|
|
137
|
-
operating system's user-cache directory outside the workspace. They reuse only
|
|
138
|
-
validated extraction data; the final drift decision is always recalculated.
|
|
139
|
-
|
|
140
|
-
If the project has no `.sema` contract, an informational request must remain
|
|
141
|
-
read-only. Before implementing behavior, obtain explicit adoption authorization,
|
|
142
|
-
then inspect the official flow and initialize:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
sema descobrir explicar flow.project-adoption --json
|
|
146
|
-
sema iniciar --template base
|
|
147
|
-
sema sync-codex --json
|
|
148
|
-
```
|
|
127
|
+
sema inspecionar contratos/app.sema --drift none --json
|
|
128
|
+
sema drift contratos/app.sema --escopo modulo --cache fresh --json
|
|
129
|
+
sema impacto contratos/app.sema --alvo app.modulo --mudanca "describe the change" --json
|
|
130
|
+
sema finalizar-mudanca --intencao "describe the change" --doc-lida README.md --json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`resumo` and `inspecionar` default to `--drift none`; unobserved score,
|
|
134
|
+
confidence, implementation, and route evidence inside the result `payload`
|
|
135
|
+
stays `null`. Use `--drift cache|fresh` to request analysis. Direct `sema drift`
|
|
136
|
+
accepts `--cache none|cache|fresh` and defaults to `fresh`. Persistent objects are stored in the
|
|
137
|
+
operating system's user-cache directory outside the workspace. They reuse only
|
|
138
|
+
validated extraction data; the final drift decision is always recalculated.
|
|
139
|
+
|
|
140
|
+
If the project has no `.sema` contract, an informational request must remain
|
|
141
|
+
read-only. Before implementing behavior, obtain explicit adoption authorization,
|
|
142
|
+
then inspect the official flow and initialize:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
sema descobrir explicar flow.project-adoption --json
|
|
146
|
+
sema iniciar --template base
|
|
147
|
+
sema sync-codex --json
|
|
148
|
+
```
|
|
149
149
|
|
|
150
150
|
Initialization preserves existing files and rejects symlink or junction
|
|
151
151
|
escapes. Use `--force` only when overwriting the template destinations is an
|
|
@@ -276,17 +276,17 @@ blocked, and importing the package never parses CLI arguments or exits the host
|
|
|
276
276
|
process. Programmatic validators and planners preserve the same read-only,
|
|
277
277
|
non-authoritative boundary as their CLI equivalents.
|
|
278
278
|
|
|
279
|
-
## Public Boundary
|
|
280
|
-
|
|
281
|
-
The npm package is local-only: its CLI and programmatic API do not depend on a
|
|
282
|
-
hosted Sema service. It must not contain private or sensitive operational
|
|
283
|
-
material.
|
|
284
|
-
|
|
285
|
-
Contributors must create the tarball through `npm run cli:empacotar-publica`
|
|
286
|
-
from the repository root. Direct `npm pack` in this source package is blocked:
|
|
287
|
-
the official factory uses an isolated per-run stage and is the only supported
|
|
288
|
-
path that bundles runtime packages, examples, documentation, the launcher, and
|
|
289
|
-
the Sema skill.
|
|
279
|
+
## Public Boundary
|
|
280
|
+
|
|
281
|
+
The npm package is local-only: its CLI and programmatic API do not depend on a
|
|
282
|
+
hosted Sema service. It must not contain private or sensitive operational
|
|
283
|
+
material.
|
|
284
|
+
|
|
285
|
+
Contributors must create the tarball through `npm run cli:empacotar-publica`
|
|
286
|
+
from the repository root. Direct `npm pack` in this source package is blocked:
|
|
287
|
+
the official factory uses an isolated per-run stage and is the only supported
|
|
288
|
+
path that bundles runtime packages, examples, documentation, the launcher, and
|
|
289
|
+
the Sema skill.
|
|
290
290
|
|
|
291
291
|
## Commercial Use
|
|
292
292
|
|
|
@@ -296,4 +296,4 @@ from OtimiTare.
|
|
|
296
296
|
|
|
297
297
|
## Support
|
|
298
298
|
|
|
299
|
-
Use [suporte@otimitare.
|
|
299
|
+
Use [suporte@otimitare.com](mailto:suporte@otimitare.com) for support.
|
package/dist/driftEscopo.js
CHANGED
|
@@ -277,6 +277,40 @@ function candidatosRotasDeterministicos(contexto, irs, diretoriosCodigo) {
|
|
|
277
277
|
}
|
|
278
278
|
return [...candidatos.values()];
|
|
279
279
|
}
|
|
280
|
+
function candidatosRotasNextDeterministicos(contexto, irs, diretoriosCodigo) {
|
|
281
|
+
const candidatos = new Map();
|
|
282
|
+
const extensoes = [".ts", ".tsx", ".js", ".jsx"];
|
|
283
|
+
for (const ir of irs) {
|
|
284
|
+
for (const rota of ir.routes) {
|
|
285
|
+
const caminho = (rota.caminho ?? "").trim();
|
|
286
|
+
if (!caminho.startsWith("/")) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const segmentos = caminho.split("/").filter(Boolean).map((segmento) => segmento.replace(/^\{(.+)\}$/u, "[$1]").replace(/^:(.+)$/u, "[$1]"));
|
|
290
|
+
if (segmentos.length === 0) {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
const ultimo = segmentos.at(-1);
|
|
294
|
+
const intermediarios = segmentos.slice(0, -1);
|
|
295
|
+
const segmentosApi = segmentos[0] === "api" ? segmentos.slice(1) : segmentos;
|
|
296
|
+
const ultimoApi = segmentosApi.length > 0 ? segmentosApi.at(-1) : undefined;
|
|
297
|
+
const intermediariosApi = segmentosApi.length > 0 ? segmentosApi.slice(0, -1) : [];
|
|
298
|
+
for (const raiz of diretoriosCodigo) {
|
|
299
|
+
for (const extensao of extensoes) {
|
|
300
|
+
// Next.js App Router: src/app/<caminho>/route.ts e app/<caminho>/route.ts
|
|
301
|
+
adicionarCandidatoPreservandoForma(candidatos, contexto.baseProjeto, path.resolve(raiz, "src", "app", ...segmentos, `route${extensao}`));
|
|
302
|
+
adicionarCandidatoPreservandoForma(candidatos, contexto.baseProjeto, path.resolve(raiz, "app", ...segmentos, `route${extensao}`));
|
|
303
|
+
// Next.js Pages Router API: src/pages/api/<caminho>.ts e pages/api/<caminho>.ts
|
|
304
|
+
if (ultimoApi !== undefined) {
|
|
305
|
+
adicionarCandidatoPreservandoForma(candidatos, contexto.baseProjeto, path.resolve(raiz, "src", "pages", "api", ...intermediariosApi, `${ultimoApi}${extensao}`));
|
|
306
|
+
adicionarCandidatoPreservandoForma(candidatos, contexto.baseProjeto, path.resolve(raiz, "pages", "api", ...intermediariosApi, `${ultimoApi}${extensao}`));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return [...candidatos.values()];
|
|
313
|
+
}
|
|
280
314
|
function candidatosConvencionaisEscopo(contexto, irs, diretoriosCodigo) {
|
|
281
315
|
const candidatos = new Map();
|
|
282
316
|
const adicionar = (caminho) => {
|
|
@@ -414,6 +448,7 @@ export async function planejarEscopoDrift(contexto, configuracao) {
|
|
|
414
448
|
const candidatosDeterministicos = [
|
|
415
449
|
...candidatosConsumerDeterministicos(contexto, irs, configuracao.termosEscopo, raizesAncoradas),
|
|
416
450
|
...candidatosRotasDeterministicos(contexto, irs, raizesAncoradas),
|
|
451
|
+
...candidatosRotasNextDeterministicos(contexto, irs, raizesAncoradas),
|
|
417
452
|
...candidatosConvencionaisEscopo(contexto, irs, raizesAncoradas),
|
|
418
453
|
];
|
|
419
454
|
const sondagensDeterministicas = await sondarArquivosRegularesContidos(candidatosDeterministicos, raizReal);
|
package/dist/iaPrompts.js
CHANGED
|
@@ -28,7 +28,7 @@ Regras:
|
|
|
28
28
|
- nao invente sintaxe fora da gramatica e dos exemplos oficiais
|
|
29
29
|
- antes de qualquer acao, crie, edite ou remova o contrato .sema aplicavel; isso vale para Software, Author, Workflow, Ops, Game, Legal e Research
|
|
30
30
|
- se a IA for fraca, nao tente abrir tudo de uma vez
|
|
31
|
-
- use \`sema resumo <arquivo> --micro --drift none --json\` pelo stdout antes de subir para o pacote completo; score, confiança e implementação ficam não avaliados
|
|
31
|
+
- use \`sema resumo <arquivo> --micro --drift none --json\` pelo stdout antes de subir para o pacote completo; score, confiança e implementação ficam não avaliados
|
|
32
32
|
- se \`sema resumo . --micro\` estourar timeout local, repita com timeout maior ou escopo menor; nao avance com codigo
|
|
33
33
|
- trate \`ir --json\` como fonte de verdade semantica
|
|
34
34
|
- trate \`briefing.json\` como plano de intervencao antes de editar projeto vivo
|
|
@@ -38,10 +38,10 @@ Regras:
|
|
|
38
38
|
- nao cobre da Sema adivinhacao de negocio que nao esta no contrato nem no codigo
|
|
39
39
|
|
|
40
40
|
Comandos essenciais:
|
|
41
|
-
- resumo compacto por capacidade: \`sema resumo <arquivo-ou-pasta> [--micro|--curto|--medio] [--para <resumo|onboarding|review|mudanca|bug|arquitetura>] [--drift <none|cache|fresh>]\` (padrão: none, sem evidência derivada)
|
|
41
|
+
- resumo compacto por capacidade: \`sema resumo <arquivo-ou-pasta> [--micro|--curto|--medio] [--para <resumo|onboarding|review|mudanca|bug|arquitetura>] [--drift <none|cache|fresh>]\` (padrão: none, sem evidência derivada)
|
|
42
42
|
- prompt curto para IA fraca: \`sema prompt-curto <arquivo-ou-pasta> [--micro|--curto|--medio] [--para <resumo|onboarding|review|mudanca|bug|arquitetura>]\`
|
|
43
|
-
- descoberta do projeto: \`sema inspecionar [arquivo-ou-pasta] [--drift <none|cache|fresh>] --json\` (padrão: none)
|
|
44
|
-
- auditoria do contrato vivo: \`sema drift <arquivo-ou-pasta> [--escopo <arquivo|modulo|projeto>] [--cache <none|cache|fresh>] [--json]\` (padrão: fresh; none ainda executa sem cache persistente)
|
|
43
|
+
- descoberta do projeto: \`sema inspecionar [arquivo-ou-pasta] [--drift <none|cache|fresh>] --json\` (padrão: none)
|
|
44
|
+
- auditoria do contrato vivo: \`sema drift <arquivo-ou-pasta> [--escopo <arquivo|modulo|projeto>] [--cache <none|cache|fresh>] [--json]\` (padrão: fresh; none ainda executa sem cache persistente)
|
|
45
45
|
- mapa de impacto: \`sema impacto <arquivo-ou-pasta> --alvo <token> [--mudanca <descricao>] [--json]\`
|
|
46
46
|
- renomeacao assistida: \`sema renomear-semantico <arquivo-ou-pasta> --de <nome-atual> --para <nome-novo> [--json]\`
|
|
47
47
|
- contexto completo do modulo: \`sema contexto-ia <arquivo.sema>\`
|
|
@@ -53,14 +53,14 @@ Comandos essenciais:
|
|
|
53
53
|
- importacao assistida de legado: \`sema importar <nestjs|fastapi|flask|nextjs|nextjs-consumer|react-vite-consumer|angular-consumer|flutter-consumer|firebase|dotnet|java|go|rust|cpp|php|typescript|python|dart> <diretorio> --saida <diretorio>\`
|
|
54
54
|
- exemplos oficiais no projeto: \`sema instalar-exemplos\`
|
|
55
55
|
- geracao de codigo: \`sema compilar <arquivo-ou-pasta> --alvo <typescript|python|php|dart|lua|javascript|html|css|dotnet|cpp> --saida <diretorio>\`
|
|
56
|
-
- verificacao final: \`sema verificar <arquivo-ou-pasta> [--json]\`
|
|
57
|
-
- distribuição global: \`sema skill status --json\` diagnostica sem alterar; \`sema skill sync --json\` repara launcher e skill; no Windows, PowerShell usa \`sema.ps1\` no PATH, cmd.exe usa \`sema.cmd\`, e \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\` é o fallback absoluto
|
|
56
|
+
- verificacao final: \`sema verificar <arquivo-ou-pasta> [--json]\`
|
|
57
|
+
- distribuição global: \`sema skill status --json\` diagnostica sem alterar; \`sema skill sync --json\` repara launcher e skill; no Windows, PowerShell usa \`sema.ps1\` no PATH, cmd.exe usa \`sema.cmd\`, e \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\` é o fallback absoluto
|
|
58
58
|
|
|
59
59
|
Antes de editar:
|
|
60
60
|
1. leia README, docs de IA e um exemplo oficial parecido
|
|
61
|
-
2. se a IA for fraca, rode \`sema resumo <arquivo> --micro --drift none --json\` e use o stdout compacto sem inventar evidência de implementação
|
|
61
|
+
2. se a IA for fraca, rode \`sema resumo <arquivo> --micro --drift none --json\` e use o stdout compacto sem inventar evidência de implementação
|
|
62
62
|
- se timeout local estourar, aumente o timeout e tente de novo; timeout nao significa Sema inativo
|
|
63
|
-
3. se a IA aguentar mais, rode \`sema drift --cache fresh\` para medir impls, vinculos, rotas, score e lacunas com evidência recalculada
|
|
63
|
+
3. se a IA aguentar mais, rode \`sema drift --cache fresh\` para medir impls, vinculos, rotas, score e lacunas com evidência recalculada
|
|
64
64
|
4. se a tarefa for pesada, rode \`sema contexto-ia\` e leia \`briefing.json\`
|
|
65
65
|
5. consulte AST e IR do modulo alvo so quando a capacidade realmente aguentar
|
|
66
66
|
|
|
@@ -68,7 +68,7 @@ Depois de editar:
|
|
|
68
68
|
1. rode \`sema formatar\`
|
|
69
69
|
2. rode \`sema validar --json\`
|
|
70
70
|
3. se houver falha, use \`diagnosticos --json\`
|
|
71
|
-
4. rode \`sema drift --cache fresh\` de novo quando mexer em codigo vivo
|
|
71
|
+
4. rode \`sema drift --cache fresh\` de novo quando mexer em codigo vivo
|
|
72
72
|
5. se a tarefa pedir codigo derivado, rode \`sema compilar\`
|
|
73
73
|
6. feche com \`sema verificar <arquivo-ou-pasta> --json\`
|
|
74
74
|
|
|
@@ -106,7 +106,7 @@ Fontes de verdade, em ordem:
|
|
|
106
106
|
6. README do projeto
|
|
107
107
|
7. gramatica e documentacao de sintaxe da Sema
|
|
108
108
|
8. exemplos oficiais, com prioridade para o vertical de pagamento
|
|
109
|
-
9. \`sema resumo <arquivo> --micro --drift none --json\` e o stdout compacto quando a IA for fraca; campos derivados nulos significam não avaliados
|
|
109
|
+
9. \`sema resumo <arquivo> --micro --drift none --json\` e o stdout compacto quando a IA for fraca; campos derivados nulos significam não avaliados
|
|
110
110
|
10. AST, IR e diagnosticos exportados pela CLI em JSON quando a capacidade aguentar
|
|
111
111
|
|
|
112
112
|
Regras de operacao:
|
|
@@ -309,7 +309,7 @@ Comandos uteis da CLI para esse fluxo:
|
|
|
309
309
|
- \`sema descobrir catalogo --json\`
|
|
310
310
|
- \`sema descobrir recomendar --intencao "<objetivo>" --json\`
|
|
311
311
|
- \`sema interativo pipelines --json\`
|
|
312
|
-
- \`sema resumo <arquivo-ou-pasta> --drift none\`
|
|
312
|
+
- \`sema resumo <arquivo-ou-pasta> --drift none\`
|
|
313
313
|
- \`sema prompt-curto <arquivo-ou-pasta>\`
|
|
314
314
|
- \`sema prompt-ia\`
|
|
315
315
|
- \`sema prompt-ia-ui\`
|
package/dist/index.part02.js
CHANGED
|
@@ -334,27 +334,27 @@ export function criarBriefingMinimo(resumo, modo, tamanho) {
|
|
|
334
334
|
}
|
|
335
335
|
export function criarPromptCurtoModulo(resumo, modo, tamanho, capacidade) {
|
|
336
336
|
const resumoTexto = renderizarResumoModuloTexto(resumo, tamanho, modo).trim();
|
|
337
|
-
return `Você está operando Sema em modo IA-first.
|
|
338
|
-
|
|
339
|
-
Esta linguagem existe para traduzir intenção operacional em contrato consumível por IA. Humanos aprovam; agentes operam.
|
|
340
|
-
|
|
341
|
-
Capacidade alvo: ${capacidade}
|
|
342
|
-
Modo da tarefa: ${modo}
|
|
343
|
-
|
|
344
|
-
Regras:
|
|
345
|
-
- não invente sintaxe nem bloco fora da gramática oficial
|
|
346
|
-
- preserve a intenção do contrato
|
|
347
|
-
- use este resumo como fonte compacta inicial
|
|
348
|
-
- se a tarefa pedir mais contexto, rode \`sema contexto-ia <arquivo.sema> --saida <diretorio> --json\` e então abra \`briefing.min.json\`, \`drift.json\` e \`ir.json\` nessa saída
|
|
349
|
-
- não saia editando software vivo sem olhar risco, lacuna e checks sugeridos
|
|
350
|
-
- se abrir código com \`SEMA-GOVERNED\`, volte ao contrato e chame Sema antes de editar
|
|
351
|
-
- não crie nem conclua código governado acima de ${LIMITE_BLOQUEIO_LINHAS_CODIGO_GOVERNADO} linhas; acima de ${LIMITE_AVISO_LINHAS_CODIGO_GOVERNADO}, planeje divisão; documentação Markdown não entra nesse limite de código
|
|
352
|
-
- não crie nem edite contrato .sema acima de ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} linhas; acima de ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA}, planeje split por domínio/capacidade, nunca parte_1/parte_2
|
|
353
|
-
- vários contratos .sema podem governar o mesmo arquivo por vinculos; Sema Código deve preservar essa rastreabilidade
|
|
354
|
-
${resumo.consumerFramework ? "- se for tarefa visual consumer, priorize `appRoutes`, `consumerSurfaces` e `consumerBridges` antes de abrir arquivos aleatórios" : ""}
|
|
355
|
-
|
|
356
|
-
Contexto compacto:
|
|
357
|
-
${resumoTexto}
|
|
337
|
+
return `Você está operando Sema em modo IA-first.
|
|
338
|
+
|
|
339
|
+
Esta linguagem existe para traduzir intenção operacional em contrato consumível por IA. Humanos aprovam; agentes operam.
|
|
340
|
+
|
|
341
|
+
Capacidade alvo: ${capacidade}
|
|
342
|
+
Modo da tarefa: ${modo}
|
|
343
|
+
|
|
344
|
+
Regras:
|
|
345
|
+
- não invente sintaxe nem bloco fora da gramática oficial
|
|
346
|
+
- preserve a intenção do contrato
|
|
347
|
+
- use este resumo como fonte compacta inicial
|
|
348
|
+
- se a tarefa pedir mais contexto, rode \`sema contexto-ia <arquivo.sema> --saida <diretorio> --json\` e então abra \`briefing.min.json\`, \`drift.json\` e \`ir.json\` nessa saída
|
|
349
|
+
- não saia editando software vivo sem olhar risco, lacuna e checks sugeridos
|
|
350
|
+
- se abrir código com \`SEMA-GOVERNED\`, volte ao contrato e chame Sema antes de editar
|
|
351
|
+
- não crie nem conclua código governado acima de ${LIMITE_BLOQUEIO_LINHAS_CODIGO_GOVERNADO} linhas; acima de ${LIMITE_AVISO_LINHAS_CODIGO_GOVERNADO}, planeje divisão; documentação Markdown não entra nesse limite de código
|
|
352
|
+
- não crie nem edite contrato .sema acima de ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} linhas; acima de ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA}, planeje split por domínio/capacidade, nunca parte_1/parte_2
|
|
353
|
+
- vários contratos .sema podem governar o mesmo arquivo por vinculos; Sema Código deve preservar essa rastreabilidade
|
|
354
|
+
${resumo.consumerFramework ? "- se for tarefa visual consumer, priorize `appRoutes`, `consumerSurfaces` e `consumerBridges` antes de abrir arquivos aleatórios" : ""}
|
|
355
|
+
|
|
356
|
+
Contexto compacto:
|
|
357
|
+
${resumoTexto}
|
|
358
358
|
`;
|
|
359
359
|
}
|
|
360
360
|
//# sourceMappingURL=index.part02.js.map
|
package/dist/index.part07.js
CHANGED
|
@@ -96,30 +96,30 @@ export async function comandoPromptCurto(entrada, args, emJson) {
|
|
|
96
96
|
: "SEMA_BRIEF.md";
|
|
97
97
|
const contextoProjeto = await readFile(path.join(resumoProjeto.pastaSaida, arquivoResumo), "utf8");
|
|
98
98
|
const capacidade = tamanho === "micro" ? "fraca" : tamanho === "curto" ? "media" : "forte";
|
|
99
|
-
const prompt = `⚠️ REGRA OBRIGATÓRIA DE GOVERNANÇA:
|
|
100
|
-
|
|
101
|
-
ANTES DE QUALQUER AÇÃO (editar, criar, deletar, executar, consultar ou modificar):
|
|
102
|
-
1. Rode \`sema docs-impacto --intencao "<ação>" --json\` com sua intenção declarada.
|
|
103
|
-
2. Aguarde a resposta com as docs obrigatórias.
|
|
104
|
-
3. Leia as docs antes de agir.
|
|
105
|
-
4. Antes de concluir, rode \`sema finalizar-mudanca --intencao "<ação>" --doc-lida <arquivo> --json\` com todas as docs lidas.
|
|
106
|
-
|
|
107
|
-
Você está operando Sema em modo IA-first.
|
|
108
|
-
|
|
109
|
-
Isto é contexto comprimido para IA operar contrato semântico antes de tocar código vivo.
|
|
110
|
-
|
|
111
|
-
Capacidade alvo: ${capacidade}
|
|
112
|
-
Modo da tarefa: ${modo}
|
|
113
|
-
|
|
114
|
-
Regras:
|
|
115
|
-
- ANTES DE TUDO: rode \`sema docs-impacto --intencao "<ação>" --json\`.
|
|
116
|
-
- Comece pelo resumo compacto abaixo.
|
|
117
|
-
- Se a tarefa pedir mais contexto, abra \`AGENT_CONTEXT_PACK.json\` e depois \`SEMA_INDEX.json\`.
|
|
118
|
-
- Não tente ler o repositório inteiro se o resumo já disser onde tocar.
|
|
119
|
-
- Preserve contrato, risco, lacuna e checks sugeridos.
|
|
120
|
-
|
|
121
|
-
Contexto do projeto:
|
|
122
|
-
${contextoProjeto.trim()}
|
|
99
|
+
const prompt = `⚠️ REGRA OBRIGATÓRIA DE GOVERNANÇA:
|
|
100
|
+
|
|
101
|
+
ANTES DE QUALQUER AÇÃO (editar, criar, deletar, executar, consultar ou modificar):
|
|
102
|
+
1. Rode \`sema docs-impacto --intencao "<ação>" --json\` com sua intenção declarada.
|
|
103
|
+
2. Aguarde a resposta com as docs obrigatórias.
|
|
104
|
+
3. Leia as docs antes de agir.
|
|
105
|
+
4. Antes de concluir, rode \`sema finalizar-mudanca --intencao "<ação>" --doc-lida <arquivo> --json\` com todas as docs lidas.
|
|
106
|
+
|
|
107
|
+
Você está operando Sema em modo IA-first.
|
|
108
|
+
|
|
109
|
+
Isto é contexto comprimido para IA operar contrato semântico antes de tocar código vivo.
|
|
110
|
+
|
|
111
|
+
Capacidade alvo: ${capacidade}
|
|
112
|
+
Modo da tarefa: ${modo}
|
|
113
|
+
|
|
114
|
+
Regras:
|
|
115
|
+
- ANTES DE TUDO: rode \`sema docs-impacto --intencao "<ação>" --json\`.
|
|
116
|
+
- Comece pelo resumo compacto abaixo.
|
|
117
|
+
- Se a tarefa pedir mais contexto, abra \`AGENT_CONTEXT_PACK.json\` e depois \`SEMA_INDEX.json\`.
|
|
118
|
+
- Não tente ler o repositório inteiro se o resumo já disser onde tocar.
|
|
119
|
+
- Preserve contrato, risco, lacuna e checks sugeridos.
|
|
120
|
+
|
|
121
|
+
Contexto do projeto:
|
|
122
|
+
${contextoProjeto.trim()}
|
|
123
123
|
`;
|
|
124
124
|
if (emJson) {
|
|
125
125
|
console.log(JSON.stringify({
|
package/dist/initCommand.js
CHANGED
|
@@ -79,7 +79,7 @@ export async function comandoIniciar(cwd, template, opcoes = {}) {
|
|
|
79
79
|
if (!opcoes.exemplosCompletos) {
|
|
80
80
|
console.log("Starter de exemplos instalado; rode sema instalar-exemplos ou sema iniciar --com-exemplos para o pacote completo.");
|
|
81
81
|
}
|
|
82
|
-
console.log(`Kit IA
|
|
82
|
+
console.log(`Kit IA multi-agente sincronizado (${kitIa.artefatos.length} artefatos; entrypoint ${kitIa.codex.entrypointCodex}; ${kitIa.codex.criados.length} criados, ${kitIa.codex.atualizados.length} atualizados, ${kitIa.codex.preservados.length} preservados).`);
|
|
83
83
|
return 0;
|
|
84
84
|
}
|
|
85
85
|
export async function comandoInstalarExemplos(emJson) {
|