cli: --interview needs no transport, and a test
check_usage demanded a transport before the ack/interview paths ran, so '--no-config --interview' failed with 'no transport' even though neither path runs a model. Exempt the ack and interview modes. tests/test_interview.sh pipes six answers through the real binary, checks the English catalogue prompts, the skipped marker and the written profile. README notes that the questions follow the locale.
This commit is contained in:
1 parent
68b2888334
commit
6d9c74e3b1
7 files changed
+44
-4
No files matched your search
@@ -218,6 +218,7 @@ check: $(LIB) $(BIN) $(PLUGIN) $(TESTS)
|
||||
export LD_LIBRARY_PATH=.; \
|
||||
for t in $(TESTS); do echo "== $$t"; ./$$t; done; \
|
||||
echo "== tests/test_delegate_cli.sh"; sh tests/test_delegate_cli.sh; \
|
||||
echo "== tests/test_interview.sh"; sh tests/test_interview.sh; \
|
||||
echo "== tests/test_gateway.sh"; sh tests/test_gateway.sh; \
|
||||
echo "== tests/test_a2a.sh"; sh tests/test_a2a.sh; \
|
||||
echo "== tests/test_a2a_ui.sh"; sh tests/test_a2a_ui.sh; \
|
||||
|
||||
@@ -254,7 +254,9 @@ processes that share a working directory — not A2A, and not a network protocol
|
||||
splinter --interview
|
||||
|
||||
Six questions - language, who you are, stack, answering style, what never to
|
||||
do, which paths are sacred - written to `~/.splinter/profile/<user>.md`. Enter
|
||||
do, which paths are sacred - written to `~/.splinter/profile/<user>.md`. The
|
||||
questions come from the catalogue: the default is English, `locale = de` (or
|
||||
`SPLINTER_LOCALE`) makes them German. Enter
|
||||
skips a question and the skip is recorded as such: an empty line would be a lie.
|
||||
Starting the chat without a profile prints a hint, once.
|
||||
|
||||
|
||||
@@ -605,6 +605,9 @@ run_delegate_cli(const struct sp_registry *reg, const char *id,
|
||||
static int
|
||||
check_usage(const struct opts *o)
|
||||
{
|
||||
/* these answer files or ask questions; none of them runs a model */
|
||||
if (o->ack_id > 0 || o->acklist || o->interview)
|
||||
return 0;
|
||||
if ((o->endpoint != NULL) + (o->script != NULL) +
|
||||
(o->transport != NULL) > 1) {
|
||||
fprintf(stderr, "splinter: choose one transport\n");
|
||||
|
||||
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">An agent harness you own: chat in the terminal, tools with authorization classes, plugins, any model that speaks OpenAI — built by us so we can change it, instead of getting used to how somebody else's client behaves.</p>
|
||||
|
||||
<p class="meta"><b>24430</b> lines of C99/POSIX ·
|
||||
<p class="meta"><b>24433</b> lines of C99/POSIX ·
|
||||
<b>23</b> tools · <b>31</b> test programs ·
|
||||
<b>16</b> plugins · <b>42</b> palettes · BSD-3-Clause</p>
|
||||
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">Ein Agent-Harness, das dir gehoert: Chat im Terminal, Werkzeuge mit Autorisierungsklassen, Plugins, jedes Modell das OpenAI spricht — von uns gebaut, damit wir es umbauen koennen, statt uns an das Verhalten eines fremden Clients zu gewoehnen.</p>
|
||||
|
||||
<p class="meta"><b>24430</b> Zeilen C99/POSIX ·
|
||||
<p class="meta"><b>24433</b> Zeilen C99/POSIX ·
|
||||
<b>23</b> Werkzeuge · <b>31</b> Test-Programme ·
|
||||
<b>16</b> Plugins · <b>42</b> Farbschemata · BSD-3-Clause</p>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">Um harness de agente que e seu: chat no terminal, ferramentas com classes de autorizacao, plugins, qualquer modelo que fale OpenAI - escrito por nos para poder mudar-lo, em vez de nos acostumar com o comportamento de um cliente alheio.</p>
|
||||
|
||||
<p class="meta"><b>24430</b> linhas C99/POSIX ·
|
||||
<p class="meta"><b>24433</b> linhas C99/POSIX ·
|
||||
<b>23</b> ferramentas · <b>31</b> programas de teste ·
|
||||
<b>16</b> plugins · <b>42</b> paletas · BSD-3-Clause</p>
|
||||
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# splinter -- the first-run interview from the terminal.
|
||||
#
|
||||
# No transport is needed; the questions come from the catalogue (English here),
|
||||
# and the answers are written to profile/<user>.md. The six answers also prove
|
||||
# that a skipped question (the empty line) is recorded as such.
|
||||
set -u
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
D=$(mktemp -d "${TMPDIR:-/var/tmp}/splinter-iv-XXXXXX") || exit 1
|
||||
cleanup() { rm -rf "$D"; }
|
||||
trap cleanup EXIT
|
||||
fails=0
|
||||
check() { # $1 = description, $2.. = command
|
||||
d=$1; shift
|
||||
if "$@"; then :; else echo "FAIL $d"; fails=$((fails + 1)); fi
|
||||
}
|
||||
|
||||
out=$(printf 'english\nabout me\nC99\n\nno commits\n/home/carol\n' | \
|
||||
HOME="$D" SPLINTER_LOCALE=en ./splinter --no-config \
|
||||
--session "$D/sess" --interview 2>&1)
|
||||
check "the interview needs no transport" test $? -eq 0
|
||||
echo "$out" | grep -q 'First conversation'
|
||||
check "the questions are in the process language" test $? -eq 0
|
||||
echo "$out" | grep -q 'Which language should I speak'
|
||||
check "the language question is English" test $? -eq 0
|
||||
|
||||
prof=$(ls "$D/sess/profile/"*.md 2>/dev/null | head -1)
|
||||
check "the profile was written" test -n "$prof"
|
||||
check "the first answer is in the profile" grep -q 'english' "$prof"
|
||||
check "the skipped question is not a lie" grep -q '(not answered)' "$prof"
|
||||
check "the last section is in the profile" grep -q '## paths' "$prof"
|
||||
|
||||
if [ "$fails" -eq 0 ]; then echo "test_interview: ok"; exit 0; fi
|
||||
exit 1
|
||||
Reference in new issue
Block a user