Commit Graph
504 Commits
Author SHA1 Message Date
yunyingk 2210f0d2dc Merge pull request #186 from yunyingk/codex/contract-hygiene-perf-gates
Enforce CLI contracts: exit codes 13/14, safety gates, parser metadata, lazy dispatch, hygiene
2026-09-29 22:09:27 +08:00
gitea 8212ff8512 Remove the resolved September bug report from the repo root
bug-report-cli-ux-issues-20260920.md listed eight CLI issues; all eight are
fixed (six directly, the rest covered by the gates and tests in this branch)
and the report had no remaining references. Local legacy seal-home binaries
under dist/bin (gitignored, 465MB) were also dropped — they are rebuilt on
demand by build:binary.
2026-09-29 22:05:58 +08:00
gitea 8a822aa99a Add P0 regression tests for replay --sn and regression --webhook
Both P0s from the September bug report were fixed but had no regression
test guarding them:

- replay --sn ignored the argument and replayed the newest record. The new
  test feeds a two-record search and asserts the requested (older) record is
  replayed — and that a missing SN fails with a lookup error rather than
  falling back to the newest.
- regression demanded --webhook but honouring it did nothing. The new test
  runs the live path with two target channels: without a selector it exits 13
  with guidance, with --webhook the selector error disappears (mockApiFetch
  learns to serve the approval-style channel catalog).
2026-09-29 22:05:49 +08:00
gitea 7ceb200aac Adopt oxlint with a zero-warning CI gate
The repo had no linter: style and hygiene were convention-only, and the
dead-symbol cleanup needed for noUnusedLocals was invisible until tsc was
reconfigured. Pin oxlint 1.86.0 as a devDependency, add `bun run lint`, and
run it in CI right after the type check. The codebase is at zero warnings,
and AGENTS.md documents the new gate.
2026-09-29 22:05:39 +08:00
gitea 3d55ef7b4a Rebuild the MCP bundle for the contract and CLI changes
dist/mcp/server.js is a tracked build artifact gated by CI: regenerate it
after the exit-code, config-loader, gate, redaction, parser and lazy-dispatch
changes so the bundle gate passes. Text assets (skill cli.md) are embedded at
bundle time, which is why the contract updates land here too.
2026-09-29 22:05:29 +08:00
gitea 07b8ba8064 Turn on noUnusedLocals and noUnusedParameters
With the dead-symbol sweep landed (unused imports, unused params,
copy-pasted tool import prologues), flip the compiler switches so the
debt cannot return: `bun run check` now fails on any new unused local or
parameter. The 737 findings this would have reported are already gone.
2026-09-29 22:05:19 +08:00
gitea 9dc5652ad4 Load command handlers lazily so discovery commands meet the 50ms contract
runner.ts statically imported all 28 command modules, so `seal-use version`
paid for exceljs, archiver and the embedded skill bundle on every run:
measured 175ms against a 7ms bare-bun baseline.

Dispatch branches now load their handler with await import() on demand, and
compareSemVer/isNewerVersion move to a tiny core/semver.ts so the version
path no longer drags in the 1200-line updater. selectCorp and
createSealClient follow the same pattern. Measured after: version 37-45ms,
help 40ms, corps list 40ms. The performance contract in cli-protocol.md is
updated from an aspirational <10ms to a measured <50ms with the numbers.

update.ts's service-restart finally block is also restructured: throwing from
finally swallowed the original update error, and the previous catch/branch hid
a restart failure behind a log line.

the dead `args` parameter of handleMcpCommand goes with its caller here, so
the signature change and the call site land together.
2026-09-29 22:05:09 +08:00
gitea 68fd90dbda Add flag metadata to the argv parser: reject unknown flags, fix boolean/value ambiguity
parseArgs decided a flag's kind from whatever token followed it, so
`corps list --all now` fed "now" into --all and crashed with Invalid boolean,
a bare `--limit` was silently dropped (full dataset pull), and `--limitt` was
silently ignored with exit 0.

Add BOOLEAN_FLAGS / VALUE_FLAGS / KNOWN_FLAGS registries derived from how the
code reads each flag (booleanOption vs stringOption/numberOption). Booleans
never consume the next token, value flags must receive one, unknown flags
fail with a did-you-mean suggestion, and the three dual-use flags (f, h,
version) keep the legacy heuristic. parser.test.ts — previously zero tests on
the entry point — locks all of it plus a help.ts cross-check.
2026-09-29 22:04:58 +08:00
gitea 935ca015b1 Mask signKey in diagnostic output and fix the JSON redaction replacement
deploy hosecloud status/list/get masked apiKey and apiSecret but printed
signKey in clear — yet signKey rides in the outbound callback URL as
config_id, so it behaves like a credential (redactSensitiveText already
carried it in its error-path pattern). Add it to redactIntegrationSecrets;
operators still get it from the stderr Next-action guidance when they need
it for `sync <signKey>`.

Also fixes a latent bug in redactSensitiveText: the JSON-field pattern used
$3 but only captured two groups, so redacted JSON came out malformed
(`"signKey":"<redacted>$3`). New redact.test.ts locks the query-string,
Bearer, JSON and field-list behaviour.
2026-09-29 22:04:47 +08:00
gitea 4922daf4e7 Require --yes for user deletion, password reset, and batch cleanup
rules delete / documents delete / webhook delete all gate behind --yes, but
users delete, users reset-password and simulation clean reached the API with
no confirmation at all — a bare invocation deleted live data. Add the same
confirmationRequired gate (exit 10, no API call) the other destructive
commands use, and update the help registry plus the skill reference so the
usage lines show --yes.
2026-09-29 22:04:35 +08:00
gitea b5d1bbda15 Isolate malformed enterprise config files instead of failing every command
loadCorpConfigs parsed every file with a bare Schema.parse, so one hand-
edited JSON aborted the whole directory: every corps/rules/webhook command
died with a raw parse error and no hint which file was at fault.

Each file now parses inside its own try/catch — bad files are skipped and
reported once per process on stderr with the offending path; the remaining
enterprises stay usable. loadGlobalConfig falls back to defaults (warning on
stderr) so config paths / corps list keep working for diagnosis. doctor gains
a config_parseability check that names unparseable files.
2026-09-29 22:04:24 +08:00
gitea 66eb81f3d1 Add exit codes 13 and 14 for config validation and safety blocks
The classifier only matched English usage wording, so every Chinese-language
usage error, every enterprise-selection failure, and every Zod/SyntaxError
fell through to exit 1 ("upstream failure"), while environment safety guards
were reported as exit 2 or 1. Add two semantic codes:

- 13 (validationError): well-formed command, unusable value — missing --corp,
  unparseable enterprise JSON, missing required parameter, ambiguous webhook
  channel selection.
- 14 (safetyBlocked): the target environment forbids the action — replaying
  into production, regression outside a test tenant.

classifyCliError now recognises Chinese usage wording, enterprise-selection
phrasing, local file problems, Zod issue lists (structural, not textual) and
SyntaxError; English Usage:/Unknown-command stays 2, domain failures and
quality gates stay 1. Docs (AGENTS, cli-protocol, skill cli.md) and the exit
code assertions follow.
2026-09-29 22:04:12 +08:00
gitea 5f4906758e Enable strict unused-symbol checks and remove dead code
Turn on noUnusedLocals/noUnusedParameters so the compiler keeps flagging
dead symbols, then clear the 737 findings it reports: unused imports across
src/, unused parameters, unreachable locals, and the copy-pasted 135-line
import prologues in the seal tool modules (each tool file now imports only
what it uses). Also applies the equivalent-safe lint rewrites (Array.from
instead of new Array(n).fill, non-null assertions in tests after toBeDefined,
simplified spreads, unused catch params) that oxlint will gate in a later
commit.
2026-09-29 22:04:01 +08:00
yunyingk 661babd4f4 Merge pull request #185 from yunyingk/codex/add-workspace-hygiene-rule
Add workspace hygiene rule for cleanup and release review
2026-09-28 16:34:27 +08:00
gitea cf711ad5bd Add workspace hygiene rule for branch cleanup and release review 2026-09-28 16:32:06 +08:00
yunyingk b23d257658 Merge pull request #184 from yunyingk/codex/simulation-create-idempotent-reuse
Add idempotent reuse to simulation create to prevent double billing
2026-09-28 14:41:28 +08:00
gitea fffa0cf2e4 Add idempotent reuse to simulation create to prevent double billing 2026-09-28 14:39:38 +08:00
yunyingk b8fd304f0d Merge pull request #183 from yunyingk/codex/release-v0.10.40
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
Release v0.10.40: Unify CLI and config timestamps to Beijing ISO 8601 (+08:00)
v0.10.40
2026-09-28 13:14:14 +08:00
gitea 44882418c0 Release v0.10.40: Unify CLI and config timestamps to Beijing ISO 8601 (+08:00) 2026-09-28 13:13:00 +08:00
yunyingk 465ec1e9c3 Merge pull request #182 from yunyingk/codex/remove-legacy-home-push
Remove legacy git push home from release scripts and docs
2026-09-28 11:59:23 +08:00
gitea 381e7abd46 Remove legacy git push home from release scripts and docs 2026-09-28 11:58:29 +08:00
yunyingk 6e86f8b5f3 Merge pull request #181 from yunyingk/codex/release-v0.10.39
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
Release v0.10.39: Standardize 0-based 00xx rule codes, draft-default rules CLI, and documents domain
v0.10.39
2026-09-28 11:51:04 +08:00
gitea 69fe2415a1 Release v0.10.39: Standardize 0-based 00xx rule codes, draft-default rules CLI, and documents domain 2026-09-28 11:49:31 +08:00
yunyingk f8e083f3b2 Fix security scan findings: confirm gate, exit codes, redaction, CI tag env (#180)
- Gate rules push behind --yes at CLI and domain layers (fail-closed on
  dryRun=false without confirm)
- Raise webhook replay partial failure as CliError so exit 1 survives
  cli.ts exitCode overwrite; route webhook stdout through printJson for
  exit-12 protection and --output-file support
- Narrow MCP read-only allowlist: drop config mode/lint (write forms are
  indistinguishable under token-prefix matching; config get covers reads)
- Extract redactSensitiveText to core, extend credential patterns, apply
  to HTTP sendError/500 and domain error messages
- Pass release TAG_NAME via env instead of inline ${{ }} interpolation
  to close script injection through crafted tag names
- Track .zcodeignore so enterprise credential exclusions travel with the
  repo
- Add .agents/rules/security-posture.md documenting usability-first
  accepted risks (loopback adapter auth, update verification, mutation
  command gates, skill dump stdout); register skill dump as a documented
  stdout Markdown exception in AGENTS.md and cli-protocol.md
- Rebuild dist/mcp/server.js
2026-09-24 22:02:24 +08:00
yunyingk 3d9df01c31 Merge pull request #179 from yunyingk/codex/skill-design-fixes
Refine skill docs: redact signKey, split webhook reference, align exit codes
2026-09-23 14:12:26 +08:00
gitea e3ba7aeea5 Refine skill docs: redact signKey, split webhook reference, align exit codes
- Replace a real-looking signKey example with a placeholder in
  hose-enterprise-deploy.md and rebuild embedded bundles so no
  residual value ships in dist/mcp/server.js.
- Document exit codes 11 (auth missing/invalid) and 12 (output
  protection) in AGENTS.md and .agents/rules/cli-protocol.md so
  they match src/core/errors.ts and references/cli.md.
- Split the Webhook resource-pack workflow out of references/cli.md
  into references/webhook-resource-pack.md (cli.md 50KB -> 39KB) and
  add a routing row in SKILL.md; all 14 references stay covered.
2026-09-23 14:08:50 +08:00
yunyingk 28c3001758 Merge pull request #178 from yunyingk/codex/scp-workspace-backups
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Use portable file copies for ops backups
2026-09-23 11:03:46 +08:00
gitea e26c640f8a Use scp for cross-host ops backups 2026-09-23 11:02:37 +08:00
yunyingk 1c66dc1b12 Merge pull request #177 from yunyingk/codex/portable-workspace-backups
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Keep workspace backups portable across macOS and Linux
2026-09-23 11:01:47 +08:00
gitea 5ce0dca009 Avoid AppleDouble files in workspace backups 2026-09-23 11:00:40 +08:00
yunyingk 22c7674a1a Merge pull request #176 from yunyingk/codex/infra-workspace-backups
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Back up infra scripts in global workspaces
2026-09-23 10:57:08 +08:00
gitea 9ac4158479 Back up infrastructure scripts to machine workspaces 2026-09-23 10:55:40 +08:00
yunyingk 134555d90e Merge pull request #175 from yunyingk/codex/improve-update-feedback
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Route release sync through local WSL mihomo
2026-09-23 10:29:26 +08:00
gitea 74ad1967fa Run release sync through local WSL mihomo 2026-09-23 10:28:05 +08:00
yunyingk 0977fb4057 Merge pull request #174 from yunyingk/codex/improve-update-feedback
Check release sync health
2026-09-23 09:53:25 +08:00
gitea 8b538c628e Check release sync health 2026-09-23 09:52:02 +08:00
yunyingk 1785e89ae4 Merge pull request #173 from yunyingk/codex/improve-update-feedback
Refine release promotion infrastructure
2026-09-23 09:47:45 +08:00
gitea 93bbe12b69 Fix version cache test isolation 2026-09-23 09:46:22 +08:00
gitea 51fe71b17b Refine release promotion infrastructure 2026-09-23 09:43:52 +08:00
yunyingk 5a116956c7 Merge pull request #172 from yunyingk/codex/p0-architecture-improvements
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Refactor seal tools into modular domains and fix layer inversions
2026-09-22 16:38:06 +08:00
gitea ab9b9965e9 Refactor seal tools into modular domains and fix layer inversions
- Split monolithic tools.ts (4,257 lines) into 11 domain-specific modules in src/domains/seal/tools/
- Extract helpers.ts containing 71 helper functions and shared tool types
- Retain tools.ts as thin re-export for complete backward compatibility
- Fix layer inversions: sink CliError to core/errors.ts, extract linter paths to core/paths.ts, move tenant-diagnose to domain
- Eliminate null as any in runner.ts by widening signatures and adding proper runtime guards
- Rebuild dist/mcp/server.js to satisfy pre-push bundle gate
2026-09-22 16:36:37 +08:00
yunyingk d868a29c5d Merge pull request #171 from yunyingk/codex/release-v0.10.38
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
🚀 Release / 🍺 Update Homebrew Tap (push) Has been cancelled
Release v0.10.38: Automated release bump
v0.10.38
2026-09-22 15:29:44 +08:00
gitea 95705b3602 Release v0.10.38: Automated release bump 2026-09-22 15:28:21 +08:00
yunyingk 979eb0214f Merge pull request #170 from yunyingk/codex/improve-update-feedback
Refine skill routing and silent CLI compatibility
2026-09-22 15:26:48 +08:00
gitea 61fa63bbe1 Refine skill routing and silent CLI compatibility 2026-09-22 15:25:16 +08:00
yunyingk c6d0f3e82c Merge pull request #169 from yunyingk/codex/improve-update-feedback
Move enterprise workflows into domains
2026-09-22 15:11:24 +08:00
gitea 9094f4907a Move enterprise workflows into domains 2026-09-22 15:10:04 +08:00
gitea f5be38d112 Split corps command by domain 2026-09-22 14:25:06 +08:00
gitea 1987b45336 Fix Hose web-session source persistence 2026-09-22 14:15:40 +08:00
gitea 2e941f0842 Remove legacy direct enterprise source 2026-09-22 14:06:13 +08:00