@cspeach/cli 0.6.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/LICENSE +8 -0
- package/README.md +108 -0
- package/dist/agent/anthropic-provider.js +59 -0
- package/dist/agent/llm-provider.js +1 -0
- package/dist/agent/loop.js +709 -0
- package/dist/agent/maybe-build-project-context.js +126 -0
- package/dist/agent/providers/ai-hub-provider.js +58 -0
- package/dist/agent/providers/byok-provider.js +53 -0
- package/dist/agent/providers/factory.js +13 -0
- package/dist/agent/providers/local-provider.js +125 -0
- package/dist/agent/repair-partial.js +31 -0
- package/dist/agent/retry-key.js +58 -0
- package/dist/agent/retry.js +17 -0
- package/dist/agent/sap-connection-adapter.js +82 -0
- package/dist/agent/skill-checkpoint.js +119 -0
- package/dist/agent/tool-dispatch.js +47 -0
- package/dist/agent/turn-assistant-text.js +49 -0
- package/dist/agent/turn-error-ux.js +126 -0
- package/dist/agent/turn-stream.js +79 -0
- package/dist/agent/turn-watchdog.js +71 -0
- package/dist/approvals/advisory-prompt.js +40 -0
- package/dist/approvals/advisory-render.js +38 -0
- package/dist/approvals/approval-prompt.js +100 -0
- package/dist/approvals/jwt.js +33 -0
- package/dist/approvals/render.js +211 -0
- package/dist/approvals/risk-floor.js +26 -0
- package/dist/auth/api-key.js +40 -0
- package/dist/auth/auth-file.js +59 -0
- package/dist/auth/device.js +8 -0
- package/dist/auth/me.js +19 -0
- package/dist/classifier/client.js +58 -0
- package/dist/cli-args.js +38 -0
- package/dist/cli.js +148 -0
- package/dist/commands/config-set.js +245 -0
- package/dist/commands/config-show.js +159 -0
- package/dist/commands/help.js +93 -0
- package/dist/commands/login.js +122 -0
- package/dist/commands/logout.js +17 -0
- package/dist/commands/project-context-impact.js +215 -0
- package/dist/commands/reroute.js +60 -0
- package/dist/commands/spec-gap-status.js +52 -0
- package/dist/commands/whoami.js +35 -0
- package/dist/config/loader.js +67 -0
- package/dist/config/paths.js +20 -0
- package/dist/doctor/checks/_http-probe.js +56 -0
- package/dist/doctor/checks/auth.js +15 -0
- package/dist/doctor/checks/cert.js +24 -0
- package/dist/doctor/checks/forge-rules.js +102 -0
- package/dist/doctor/checks/keychain-fallback.js +14 -0
- package/dist/doctor/checks/keychain.js +23 -0
- package/dist/doctor/checks/llm-mode.js +27 -0
- package/dist/doctor/checks/proxy.js +13 -0
- package/dist/doctor/checks/sap.js +33 -0
- package/dist/doctor/checks/skill.js +24 -0
- package/dist/doctor/checks/write-mode.js +34 -0
- package/dist/doctor/checks/zcspeach.js +76 -0
- package/dist/doctor/run.js +46 -0
- package/dist/errors/codes.js +12 -0
- package/dist/index.js +6 -0
- package/dist/lock-contention.js +22 -0
- package/dist/one-shot.js +104 -0
- package/dist/project-context/conventions.js +309 -0
- package/dist/project-context/detect.js +250 -0
- package/dist/project-context/domain/abap-cloud.js +26 -0
- package/dist/project-context/domain/abapgit.js +177 -0
- package/dist/project-context/domain/cap.js +164 -0
- package/dist/project-context/domain/fiori.js +326 -0
- package/dist/project-context/git.js +115 -0
- package/dist/project-context/index-files.js +235 -0
- package/dist/project-context/index.js +117 -0
- package/dist/project-context/render.js +308 -0
- package/dist/project-context/types.js +14 -0
- package/dist/projects/build.js +20 -0
- package/dist/projects/canonicalize.js +39 -0
- package/dist/projects/email-template.js +54 -0
- package/dist/projects/extract-cca.js +139 -0
- package/dist/projects/extract-design.js +107 -0
- package/dist/projects/extract-estimate.js +93 -0
- package/dist/projects/extract-modernize.js +130 -0
- package/dist/projects/extract-spec-gap.js +101 -0
- package/dist/projects/extract-test-coverage.js +137 -0
- package/dist/projects/extract-upgrade.js +230 -0
- package/dist/projects/filename.js +18 -0
- package/dist/projects/index.js +8 -0
- package/dist/projects/migration.js +111 -0
- package/dist/projects/promote-command.js +96 -0
- package/dist/projects/promote.js +107 -0
- package/dist/projects/save-command.js +124 -0
- package/dist/projects/save.js +21 -0
- package/dist/projects/status.js +170 -0
- package/dist/projects/types.js +1 -0
- package/dist/projects/validate.js +146 -0
- package/dist/projects/workspace.js +478 -0
- package/dist/renderer/abap-inline.js +121 -0
- package/dist/renderer/banners.js +39 -0
- package/dist/renderer/highlighters/abap.js +126 -0
- package/dist/renderer/highlighters/bdef.js +81 -0
- package/dist/renderer/highlighters/cds.js +91 -0
- package/dist/renderer/markdown.js +291 -0
- package/dist/renderer/pipeline.js +201 -0
- package/dist/renderer/progress-chatter.js +237 -0
- package/dist/renderer/question-normalizer.js +306 -0
- package/dist/renderer/severity.js +61 -0
- package/dist/renderer/status-footer.js +50 -0
- package/dist/renderer/syntax.js +58 -0
- package/dist/renderer/tables.js +55 -0
- package/dist/renderer/thinking-heartbeat.js +70 -0
- package/dist/renderer/tool-widget.js +199 -0
- package/dist/renderer/tty.js +66 -0
- package/dist/renderer/widget-extractor.js +87 -0
- package/dist/renderer/widget-fallback.js +78 -0
- package/dist/renderer/widget-schemas.js +43 -0
- package/dist/repl/at-completer.js +64 -0
- package/dist/repl/at-picker.js +122 -0
- package/dist/repl/bracketed-paste.js +284 -0
- package/dist/repl/current-transport.js +46 -0
- package/dist/repl/diff-display.js +41 -0
- package/dist/repl/file-picker.js +219 -0
- package/dist/repl/inquirer-guard.js +130 -0
- package/dist/repl/inquirer-theme.js +41 -0
- package/dist/repl/rule8-detector.js +99 -0
- package/dist/repl/safety-confirm.js +106 -0
- package/dist/repl/safety-mode-state.js +36 -0
- package/dist/repl/slash-completer.js +59 -0
- package/dist/repl/slash-picker.js +124 -0
- package/dist/repl/update-method-preview-hook.js +45 -0
- package/dist/repl.js +1383 -0
- package/dist/router/classifier.js +38 -0
- package/dist/router/intent-extractor.js +140 -0
- package/dist/router/routing-decision.js +19 -0
- package/dist/sap/connection-manager.js +52 -0
- package/dist/sap/onboarding.js +178 -0
- package/dist/sap/system-info.js +515 -0
- package/dist/session/awaiting-answer.js +73 -0
- package/dist/session/gc.js +28 -0
- package/dist/session/pending.js +37 -0
- package/dist/session/resume.js +77 -0
- package/dist/session/schema.js +20 -0
- package/dist/session/store.js +147 -0
- package/dist/session/time-ago.js +41 -0
- package/dist/skill-catalog.js +222 -0
- package/dist/skills/bundled-skills.js +1 -0
- package/dist/skills/canonical.js +12 -0
- package/dist/skills/manifest-client.js +93 -0
- package/dist/skills/promotion-dispatch.js +24 -0
- package/dist/skills/signing-public-key.js +4 -0
- package/dist/skills/source-bundled.js +20 -0
- package/dist/skills/source-managed.js +26 -0
- package/dist/skills/source-manifest.js +26 -0
- package/dist/tools/_command-shared.js +110 -0
- package/dist/tools/_filesystem-shared.js +81 -0
- package/dist/tools/_flag.js +39 -0
- package/dist/tools/approval.js +228 -0
- package/dist/tools/ask-question.js +205 -0
- package/dist/tools/dispatch-skill.js +81 -0
- package/dist/tools/filesystem/file-edit.js +140 -0
- package/dist/tools/filesystem/file-read.js +89 -0
- package/dist/tools/filesystem/file-write.js +128 -0
- package/dist/tools/filesystem/glob.js +177 -0
- package/dist/tools/filesystem/grep.js +163 -0
- package/dist/tools/index.js +32 -0
- package/dist/tools/project/convention_get.js +91 -0
- package/dist/tools/project/playbook_get.js +132 -0
- package/dist/tools/project/project_context_get.js +101 -0
- package/dist/tools/sap-read.js +454 -0
- package/dist/tools/sap-write.js +746 -0
- package/dist/tools/shell/shell_exec.js +209 -0
- package/dist/tools/snapshot.js +107 -0
- package/dist/tools/subagent/_background-shared.js +133 -0
- package/dist/tools/subagent/agent_run.js +186 -0
- package/dist/tools/subagent/background_run.js +143 -0
- package/dist/tools/subagent/monitor_emit.js +65 -0
- package/dist/tools/subagent/schedule_create.js +131 -0
- package/dist/tools/transport.js +233 -0
- package/dist/tools/update-method-intercept.js +119 -0
- package/dist/tools/verify.js +39 -0
- package/dist/tools/web/_web-shared.js +251 -0
- package/dist/tools/web/web_fetch.js +257 -0
- package/dist/tools/web/web_search.js +195 -0
- package/dist/tools/write-mode.js +22 -0
- package/dist/ui/app.js +95 -0
- package/dist/ui/approval-emitter.js +10 -0
- package/dist/ui/approval-modal.js +53 -0
- package/dist/ui/ascii-chars.js +6 -0
- package/dist/ui/body.js +102 -0
- package/dist/ui/coaching-picker-classic.js +36 -0
- package/dist/ui/coaching-picker-emitter.js +27 -0
- package/dist/ui/command-palette.js +34 -0
- package/dist/ui/error-emitter.js +21 -0
- package/dist/ui/footer.js +103 -0
- package/dist/ui/header.js +17 -0
- package/dist/ui/ink-classifier-route.js +19 -0
- package/dist/ui/login-banner.js +72 -0
- package/dist/ui/rich-error-box.js +9 -0
- package/dist/ui/sap-state-store.js +65 -0
- package/dist/ui/session-timeline.js +31 -0
- package/dist/ui/sidebar.js +10 -0
- package/dist/ui/skill-picker.js +50 -0
- package/dist/ui/status-row.js +12 -0
- package/dist/ui/widget-control.js +4 -0
- package/dist/ui/widgets/bar-chart.js +15 -0
- package/dist/ui/widgets/coaching-picker.js +41 -0
- package/dist/ui/widgets/component-registry.js +12 -0
- package/dist/ui/widgets/dep-graph.js +9 -0
- package/dist/ui/widgets/diff-viewer.js +11 -0
- package/dist/ui/widgets/question-card.js +11 -0
- package/dist/ui/widgets/stack-frames.js +5 -0
- package/dist/upgrade-check.js +28 -0
- package/dist/upgrade.js +13 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2026 Cremencing Solutions.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
This software is proprietary and confidential. Unauthorized copying,
|
|
5
|
+
distribution, modification, or use of this software, via any medium,
|
|
6
|
+
is strictly prohibited.
|
|
7
|
+
|
|
8
|
+
For licensing inquiries, contact: laeeq@cremencing.com
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CSPeach
|
|
2
|
+
|
|
3
|
+
AI-assisted ABAP development CLI. 34 skills, direct SAP access, safety
|
|
4
|
+
gates the model cannot bypass.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @cspeach/cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Requires Node.js 20+. After install:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
cspeach login # opens browser, authorizes this machine
|
|
16
|
+
cspeach config add-sap
|
|
17
|
+
cspeach # interactive REPL
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What it does
|
|
21
|
+
|
|
22
|
+
CSPeach runs an AI consultant against your own SAP. Pick a skill (or type a
|
|
23
|
+
prompt — the classifier picks one for you):
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
/abap-spec-gap find missing questions before any code is written
|
|
27
|
+
/abap-design object list + dependency DAG
|
|
28
|
+
/abap-estimate component-level hours with optimistic / realistic /
|
|
29
|
+
pessimistic ranges
|
|
30
|
+
/abap-cca estate-wide custom-code analysis for S/4HANA
|
|
31
|
+
/abap-upgrade-scan baseline scan against the readiness variant
|
|
32
|
+
/abap-upgrade-fix interactive fix loop with per-object approval
|
|
33
|
+
/abap-incident short dump → fix → verify → handover
|
|
34
|
+
cspeach --help full skill list (34 total)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Every turn runs locally on your machine. SAP source and SAP data flow through
|
|
38
|
+
`api.cspeach.dev` to the LLM. The proxy logs request metadata (skill, model,
|
|
39
|
+
token counts, latency) for billing; the message body is forwarded to
|
|
40
|
+
Anthropic and not stored on the proxy. SAP credentials never leave your
|
|
41
|
+
machine.
|
|
42
|
+
|
|
43
|
+
## Safety
|
|
44
|
+
|
|
45
|
+
- **Snapshot gate** — every write auto-snapshots first
|
|
46
|
+
- **Approval gate** — mutating tools require a single-use JWT bound to
|
|
47
|
+
(object, operation); the model sees a plan, you see each change
|
|
48
|
+
- **Verify gate** — every write is syntax-checked; activation blocked on errors
|
|
49
|
+
- **Transport discipline** — all writes land in your session transport; `$TMP`
|
|
50
|
+
is opt-in
|
|
51
|
+
|
|
52
|
+
Ten Forge Rules are non-negotiable. Full philosophy in the `CSPeach Principles`
|
|
53
|
+
preamble shown to the model every turn.
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
`~/.cspeach/config.toml` is created on first `cspeach config add-sap`:
|
|
58
|
+
|
|
59
|
+
```toml
|
|
60
|
+
proxy_url = "https://api.cspeach.dev"
|
|
61
|
+
default_model = "claude-opus-4-7"
|
|
62
|
+
|
|
63
|
+
[sap.S4H-DEV]
|
|
64
|
+
host = "sap-dev.company.com"
|
|
65
|
+
port = 44300
|
|
66
|
+
client = "100"
|
|
67
|
+
useSsl = true
|
|
68
|
+
username = "S.LAEEQ"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
SAP passwords are stored in your OS keychain.
|
|
72
|
+
|
|
73
|
+
## Common commands
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
cspeach login sign in to api.cspeach.dev
|
|
77
|
+
cspeach whoami show signed-in identity + plan/trial
|
|
78
|
+
cspeach logout clear local auth
|
|
79
|
+
cspeach config add-sap add a SAP system
|
|
80
|
+
cspeach doctor diagnose install + connectivity
|
|
81
|
+
cspeach --resume resume a prior session
|
|
82
|
+
cspeach --upgrade pull the latest CLI release
|
|
83
|
+
cspeach --version
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Troubleshooting
|
|
87
|
+
|
|
88
|
+
If `cspeach doctor` fails:
|
|
89
|
+
|
|
90
|
+
- **`auth`** — run `cspeach login` again
|
|
91
|
+
- **`keychain`** — Windows Credential Manager / libsecret missing; CSPeach
|
|
92
|
+
falls back to per-session prompts, slower but functional
|
|
93
|
+
- **`sap`** — host unreachable; check VPN + the host/port in config
|
|
94
|
+
|
|
95
|
+
If the REPL hangs on first prompt, check `https://api.cspeach.dev/health`.
|
|
96
|
+
|
|
97
|
+
## Links
|
|
98
|
+
|
|
99
|
+
- **Landing**: https://cspeach.dev
|
|
100
|
+
- **Contact**: laeeq@cremencing.com
|
|
101
|
+
- **LinkedIn**: @laeeqsiddique
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
Proprietary. Copyright (c) 2026 Cremencing Solutions. All rights reserved.
|
|
106
|
+
Free to use under your active [CSPeach plan](https://cspeach.dev); not free
|
|
107
|
+
to redistribute, fork, or sublicense. Commercial / OEM licensing:
|
|
108
|
+
laeeq@cremencing.com.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnthropicProvider — wraps the Anthropic SDK for streaming messages.
|
|
3
|
+
*
|
|
4
|
+
* Per coordination doc:
|
|
5
|
+
* §3: device fingerprint + User-Agent sent on every request via defaultHeaders.
|
|
6
|
+
* §4: CLI sends anthropic-beta: compact-2026-01-12.
|
|
7
|
+
* §1: X-CSForge-Skill forwarded via per-call options.headers.
|
|
8
|
+
*/
|
|
9
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
10
|
+
import { getDeviceFingerprint } from '../auth/device.js';
|
|
11
|
+
import { createManagedSkillSource } from '../skills/source-managed.js';
|
|
12
|
+
export function createManagedProvider(cfg, getBearer) {
|
|
13
|
+
const skillSource = createManagedSkillSource(cfg, getBearer);
|
|
14
|
+
return {
|
|
15
|
+
name: 'anthropic-managed',
|
|
16
|
+
mode: 'managed',
|
|
17
|
+
skillSource,
|
|
18
|
+
async createStream(params, options = {}) {
|
|
19
|
+
const bearer = await getBearer();
|
|
20
|
+
const device = await getDeviceFingerprint();
|
|
21
|
+
const cliVersion = process.env['npm_package_version'] ?? '0.5.0';
|
|
22
|
+
const sdk = new Anthropic({
|
|
23
|
+
apiKey: 'proxy-bearer-auth', // ignored by our proxy; SDK requires non-empty
|
|
24
|
+
baseURL: cfg.proxy_url.replace(/\/$/, '') + '/',
|
|
25
|
+
defaultHeaders: {
|
|
26
|
+
'authorization': `Bearer ${bearer}`,
|
|
27
|
+
'anthropic-beta': 'compact-2026-01-12',
|
|
28
|
+
'x-device-machine-id': device.machineId,
|
|
29
|
+
'x-device-hostname': device.hostname,
|
|
30
|
+
'User-Agent': `cspeach/${cliVersion}`,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
// Per-call headers (e.g. X-CSForge-Skill) passed as second argument to the SDK.
|
|
34
|
+
// The SDK forwards them alongside defaultHeaders on this specific request.
|
|
35
|
+
// v0.6 — also forward AbortSignal for hard-interrupt support.
|
|
36
|
+
const sdkOptions = {};
|
|
37
|
+
if (options.headers)
|
|
38
|
+
sdkOptions.headers = options.headers;
|
|
39
|
+
if (options.signal)
|
|
40
|
+
sdkOptions.signal = options.signal;
|
|
41
|
+
return sdk.messages.stream(params, Object.keys(sdkOptions).length > 0 ? sdkOptions : undefined);
|
|
42
|
+
},
|
|
43
|
+
async healthCheck() {
|
|
44
|
+
try {
|
|
45
|
+
const bearer = await getBearer();
|
|
46
|
+
const r = await fetch(`${cfg.proxy_url.replace(/\/$/, '')}/health`, {
|
|
47
|
+
headers: { Authorization: `Bearer ${bearer}` },
|
|
48
|
+
signal: AbortSignal.timeout(5000),
|
|
49
|
+
});
|
|
50
|
+
if (r.ok)
|
|
51
|
+
return { ok: true, message: 'managed proxy reachable, bearer valid' };
|
|
52
|
+
return { ok: false, message: `HTTP ${r.status} from ${cfg.proxy_url}/health`, hint: 'Check proxy URL and bearer token' };
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
return { ok: false, message: `Managed proxy unreachable: ${e.message}`, hint: 'Check network + proxy_url' };
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|