recala-cli 0.6.6__tar.gz → 0.6.8__tar.gz
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.
- {recala_cli-0.6.6 → recala_cli-0.6.8}/CHANGELOG.md +9 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/PKG-INFO +1 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/pyproject.toml +1 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/__init__.py +1 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/article_runs.py +36 -9
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/org.py +15 -6
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/onboarding.py +5 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/polling.py +8 -6
- recala_cli-0.6.8/src/recala_cli/stages.py +73 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/ui.py +28 -12
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/views.py +2 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_release.py +1 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_credits.py +15 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_dogfood_fixes.py +3 -4
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_failed_scan_ends_softly.py +13 -1
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_org_describe.py +20 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_org_readable.py +1 -1
- recala_cli-0.6.8/tests/test_stages.py +201 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/.gitignore +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/README.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/scripts/check-dogfood.sh +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/scripts/publish_pypi.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/scripts/release.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/__main__.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/analytics.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/auth.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/client.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/__init__.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/article.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/auth.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/billing.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/bing.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/cadence.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/connect.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/credits.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/export.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/faithful_translations.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/gsc.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/index.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/keys.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/knowledge.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/languages.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/monthly_report.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/notifications.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/onboard.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/profile.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/questions.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/reads.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/refresh.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/refusals.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/schema.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/shell.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/skills.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/slot_topic.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/status.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/commands/topics.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/config.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/confirm.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/display.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/endpoints.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/errors.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/human.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/ids.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/labels.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/main.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/organizations.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/output.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/parallel.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/prompts.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/runtime.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/search_numbers.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/SKILL.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/apply-revision-notes.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/article-signoff.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/connect-search-console.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/first-hand-evidence.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/onboard.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/plan-month.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/recala-cli-contract.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/schedule-approved.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/skills/recala/references/weekly-authority-report.md +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/stop_next_steps.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/src/recala_cli/updates.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/conftest.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/distribution/test_public_install.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/fixtures/hold_text_json.json +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/fixtures/human_output_pass1_json.json +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/fixtures/machine_contract_main.json +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_agent_error_next_steps.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_agent_onboarding.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_analytics.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_analytics_security.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_approve_read_receipt.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_approve_reconfirm.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_article_cover.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_article_export.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_article_id_output.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_article_portal_link.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_billing_invoices.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_billing_link.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_billing_top_up.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_bing.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_blank_author.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_c2_onboarding.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_cadence.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_calendar_matches_plan.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_calendar_slots.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_cms_skip.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_company_name_in_prompts.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_confirm.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_connect_and_status.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_content_commands.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_errors.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_root.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_short_ids.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_speed.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_core_status_speed.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_declined_setup_is_not_an_error.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_dogfood_status.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_edit_link_warnings.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_empty_scan_next.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_empty_scan_replay.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_errors.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_faithful_translation_settings.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_free_article_tries.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_free_company_topics_step.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_free_plan_wording.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_free_scout_refusal.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_free_topics.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_gsc.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_help_listing.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_hold_finding_sentences.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_hold_text.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_human_output_pass1.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_human_readable.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_index.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_keys.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_knowledge_admit.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_knowledge_show_ideas.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_languages.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_login.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_login_json_org.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_machine_contract.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_monthly_report.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_no_endings_say_what_is_true.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_notifications.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_onboard_defaults.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_onboard_free_plan.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_onboarding_channel.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_onboarding_commands.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_org.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_poll_pacing.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_profile.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_publish_commands.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_publish_pypi.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_questions.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_questions_in_words.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_recheck_findings.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_refresh.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_rerun_refusal.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_review_hardening.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_review_round3.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_run_progress.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_scan_reports_what_was_found.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_scene.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_scout_count.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_search_numbers.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_second_company_and_refused_details.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_short_id_selectors.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_signed_in_writes.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_skills.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_slot_topic.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_stop_next_steps.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_submit_review_state.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_times_in_company_zone.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_topics.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_topics_add.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_topics_one_call.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_ui.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_view_surface.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_whoami.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_will_retry.py +0 -0
- {recala_cli-0.6.6 → recala_cli-0.6.8}/tests/test_write_flags.py +0 -0
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# CLI changes
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.6.8
|
|
4
|
+
|
|
5
|
+
- `recala article create` names four stages while it writes (Researching, Drafting, Checking, Saving), says once that a good article takes about 10 minutes, and ends with "The light found you." A raw server step name is no longer shown. `--json` output and exit codes are unchanged.
|
|
6
|
+
|
|
7
|
+
## 0.6.7
|
|
8
|
+
|
|
9
|
+
- `recala credits` says when the owner's email has already used its free article.
|
|
10
|
+
- A failed company scan names `recala company describe` as the way forward.
|
|
11
|
+
- `recala onboard` counts a saved company description as the scan step.
|
|
4
12
|
|
|
5
13
|
## 0.6.6
|
|
6
14
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"""Short status reads and actionable outcomes for article work that outlives a request."""
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
|
+
import sys
|
|
4
5
|
from datetime import UTC, datetime, timedelta
|
|
5
6
|
from shlex import quote
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import click
|
|
9
|
+
|
|
10
|
+
from recala_cli import config, ui
|
|
8
11
|
from recala_cli.display import display_name
|
|
9
12
|
from recala_cli.endpoints import ARTICLE_SHOW, GENERATION_STATUS, CADENCE_SHOW
|
|
10
13
|
from recala_cli.errors import CliError, ExitCode
|
|
11
14
|
from recala_cli.human import describe_fields, finding_sentences, recheck_findings
|
|
12
15
|
from recala_cli.polling import poll_until
|
|
16
|
+
from recala_cli.stages import WAITING_LINE, StageTracker, finish_headline, stage_line
|
|
13
17
|
from recala_cli.stop_next_steps import needs_input_message
|
|
14
18
|
from recala_cli.views import company_timezone, moment_in
|
|
15
19
|
|
|
@@ -229,6 +233,15 @@ def wait_for_article(ctx, client, identifier, *, regeneration=False, regenerate_
|
|
|
229
233
|
return result
|
|
230
234
|
|
|
231
235
|
retry_reads: list[bool] = []
|
|
236
|
+
stages = StageTracker()
|
|
237
|
+
|
|
238
|
+
def describe(run):
|
|
239
|
+
title = run.get("title") or run.get("topic") or "Article"
|
|
240
|
+
if run.get("state") == "failed" and run.get("will_retry"):
|
|
241
|
+
return f"{title}: taking another careful pass"
|
|
242
|
+
if regeneration: # read from the article row: it has a state and no node
|
|
243
|
+
return f"{title}: {run.get('state')}"
|
|
244
|
+
return stages.observe(run)
|
|
232
245
|
|
|
233
246
|
def finished(result):
|
|
234
247
|
state = result.get("state")
|
|
@@ -250,6 +263,9 @@ def wait_for_article(ctx, client, identifier, *, regeneration=False, regenerate_
|
|
|
250
263
|
"running",
|
|
251
264
|
}
|
|
252
265
|
|
|
266
|
+
watched_by_a_person = not regeneration and not ctx.find_root().obj.get("as_json")
|
|
267
|
+
if watched_by_a_person:
|
|
268
|
+
click.echo(WAITING_LINE, err=True)
|
|
253
269
|
try:
|
|
254
270
|
result = poll_until(
|
|
255
271
|
ctx,
|
|
@@ -257,11 +273,8 @@ def wait_for_article(ctx, client, identifier, *, regeneration=False, regenerate_
|
|
|
257
273
|
finished,
|
|
258
274
|
label="Waiting for article",
|
|
259
275
|
timeout_seconds=7200,
|
|
260
|
-
describe=
|
|
261
|
-
|
|
262
|
-
+ ("taking another careful pass" if r.get("state") == "failed" and r.get("will_retry")
|
|
263
|
-
else r.get("current_node") or r.get("state"))
|
|
264
|
-
),
|
|
276
|
+
describe=describe,
|
|
277
|
+
announce=None if regeneration else stage_line,
|
|
265
278
|
heartbeat=None if regeneration else _still_writing,
|
|
266
279
|
scene=True,
|
|
267
280
|
)
|
|
@@ -291,7 +304,15 @@ def wait_for_article(ctx, client, identifier, *, regeneration=False, regenerate_
|
|
|
291
304
|
)
|
|
292
305
|
if regeneration:
|
|
293
306
|
ensure_rerun_ran(result, regenerate_id, ctx=ctx)
|
|
294
|
-
|
|
307
|
+
outcome = ensure_outcome(result, client, ctx=ctx)
|
|
308
|
+
if watched_by_a_person:
|
|
309
|
+
say_finish()
|
|
310
|
+
return outcome
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def say_finish():
|
|
314
|
+
"""On stderr, where the wait was shown, before stdout names the article."""
|
|
315
|
+
click.echo(finish_headline(ui.Style.for_stream(sys.stderr)), err=True)
|
|
295
316
|
|
|
296
317
|
|
|
297
318
|
def failed_rerun(recovery):
|
|
@@ -390,11 +411,17 @@ def portal_link(result, ctx=None):
|
|
|
390
411
|
"""The article's page in the portal, where its cover and signer are checked; nothing for a run with no article.
|
|
391
412
|
|
|
392
413
|
The portal opens the person's oldest company unless the link names one, so the link carries the run's company."""
|
|
414
|
+
url = portal_url(result, ctx)
|
|
415
|
+
return f"\nOpen it in the portal: {url}" if url else ""
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def portal_url(result, ctx=None):
|
|
419
|
+
"""The address of the article's portal page, or None for a run with no article."""
|
|
393
420
|
if not result.get("article_id"):
|
|
394
|
-
return
|
|
421
|
+
return None
|
|
395
422
|
org_id = getattr((ctx.meta.get("org_client") if ctx else None), "org_id", None)
|
|
396
423
|
scope = f"?org={org_id}" if org_id else ""
|
|
397
|
-
return f"
|
|
424
|
+
return f"{config.web_url()}/portal/article/{result['article_id']}{scope}"
|
|
398
425
|
|
|
399
426
|
|
|
400
427
|
def review_next_step(result):
|
|
@@ -436,6 +436,15 @@ def _end_after_a_failed_read(client: RecalaClient, scan: dict[str, Any], address
|
|
|
436
436
|
"command": command}
|
|
437
437
|
|
|
438
438
|
|
|
439
|
+
def _scan_failed_error(client: RecalaClient, reason: str | None) -> CliError:
|
|
440
|
+
"""A read that gave nothing ends with the way forward: say in your own words what the company does."""
|
|
441
|
+
command = f'recala company describe "<what the company does and who it is for>" --org {client.org_id}'
|
|
442
|
+
what = "Say in one or two sentences what the company does and who it is for; articles are written as that."
|
|
443
|
+
return CliError(ExitCode.CONFLICT, "scrape_thin", f"{empty_scan_sentence(reason)} Next: {command}",
|
|
444
|
+
details={**({"reason": reason} if reason else {}),
|
|
445
|
+
"next": {"command": command, "human_action": {"what": what, "where": "the company owner"}}})
|
|
446
|
+
|
|
447
|
+
|
|
439
448
|
def scan_website(ctx: click.Context, client: RecalaClient, *, website: str | None) -> dict[str, Any]:
|
|
440
449
|
org = (client.call(ORG_SHOW, path={"org_id": str(client.org_id)}) or {}).get("org") or {}
|
|
441
450
|
address = website or org.get("website_url")
|
|
@@ -449,8 +458,7 @@ def scan_website(ctx: click.Context, client: RecalaClient, *, website: str | Non
|
|
|
449
458
|
break
|
|
450
459
|
if not is_interactive(ctx):
|
|
451
460
|
reason = scan.get("reason")
|
|
452
|
-
raise
|
|
453
|
-
details={"reason": reason} if reason else None)
|
|
461
|
+
raise _scan_failed_error(client, reason)
|
|
454
462
|
other = _another_address(ctx)
|
|
455
463
|
if other is None:
|
|
456
464
|
return _end_after_a_failed_read(client, scan, address, org)
|
|
@@ -515,8 +523,9 @@ def describe(ctx: click.Context, org_flag: str | None, text: str) -> dict[str, A
|
|
|
515
523
|
confirm(ctx, client, "Save this as what the company does. Every article is written as it.")
|
|
516
524
|
saved: dict[str, Any] = client.call(PROFILE_POSITIONING_UPDATE, json={"who_we_are": text.strip()})
|
|
517
525
|
progress = config.onboarding_progress(str(client.org_id))
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
526
|
+
# A saved description satisfies the scan step. If a failed read left the offer to read the address again, it ends
|
|
527
|
+
# too: onboard would force the scan step and a no there stops the journey. The company now has material to seed
|
|
528
|
+
# a first topic from.
|
|
529
|
+
config.save_onboarding_progress(str(client.org_id), {**progress, "described": True, "scan_found_nothing": False,
|
|
530
|
+
"scan_failed_address": None})
|
|
522
531
|
return saved
|
|
@@ -157,7 +157,11 @@ def _scan(f: Facts) -> tuple[bool, str]:
|
|
|
157
157
|
done = bool(f.progress.get("scanned") or (f.org.get("core_description") and f.org.get("niche")))
|
|
158
158
|
if done and f.progress.get("scan_found_nothing"):
|
|
159
159
|
return True, empty_scan_sentence(f.progress.get("scan_empty_reason")).rstrip(".")
|
|
160
|
-
|
|
160
|
+
if done:
|
|
161
|
+
return True, "read and confirmed"
|
|
162
|
+
if f.progress.get("described"):
|
|
163
|
+
return True, "described by you (the site was not read)"
|
|
164
|
+
return False, ""
|
|
161
165
|
|
|
162
166
|
|
|
163
167
|
COMPANY_SIGNS_NOTE = "signed by the company (name an author later: recala author add)"
|
|
@@ -40,12 +40,13 @@ def next_wait(interval_seconds: int, read_seconds: float, now: float, *, outside
|
|
|
40
40
|
return wait
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def indicator(ctx: click.Context, label: str, *, tty_only: bool = False, scene: bool = False
|
|
43
|
+
def indicator(ctx: click.Context, label: str, *, tty_only: bool = False, scene: bool = False,
|
|
44
|
+
bookends: bool = True) -> Any:
|
|
44
45
|
"""A Spinner for people, nothing for --json. ``tty_only`` also draws nothing on a pipe or in a log;
|
|
45
46
|
``scene`` is for waits of minutes: a colour terminal also gets the harbour (lighthouse, ship, sea)."""
|
|
46
47
|
if (ctx.find_root().obj or {}).get("as_json"):
|
|
47
48
|
return contextlib.nullcontext(None)
|
|
48
|
-
return ui.Spinner(label, tty_only=tty_only, scene=scene)
|
|
49
|
+
return ui.Spinner(label, tty_only=tty_only, scene=scene, bookends=bookends)
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
def open_in_browser(ctx: click.Context, url: str, *, why: str) -> None:
|
|
@@ -69,9 +70,10 @@ def poll_until(ctx: click.Context, read: Callable[[], T], finished: Callable[[T]
|
|
|
69
70
|
timeout_seconds: int, interval_seconds: int = JOB_POLL_SECONDS, outside_ticks: bool = True,
|
|
70
71
|
describe: Callable[[T], str] | None = None, done: Callable[[T], str] | None = None,
|
|
71
72
|
heartbeat: Callable[[int], str] | None = None, scene: bool = False,
|
|
72
|
-
on_timeout: Callable[[T], str] | None = None) -> T:
|
|
73
|
+
announce: Callable[[str], str | None] | None = None, on_timeout: Callable[[T], str] | None = None) -> T:
|
|
73
74
|
"""Read until ``finished``. With ``heartbeat`` (seconds waited so far -> a line), every wait is cut into pieces of at
|
|
74
|
-
most a minute and each ends with that line: on the spinner for a person, on stderr under --json (stdout stays JSON).
|
|
75
|
+
most a minute and each ends with that line: on the spinner for a person, on stderr under --json (stdout stays JSON).
|
|
76
|
+
``announce`` turns a new ``describe`` label into the line that stays on screen for it (None: no line); with it the wait prints no opening or closing line, only those."""
|
|
75
77
|
seams = ctx.find_root().obj
|
|
76
78
|
sleep, clock = seams["sleep"], seams["clock"]
|
|
77
79
|
waited, shown, misses = 0.0, label, 0
|
|
@@ -94,7 +96,7 @@ def poll_until(ctx: click.Context, read: Callable[[], T], finished: Callable[[T]
|
|
|
94
96
|
else:
|
|
95
97
|
spinner.update(f"{shown}: {line}")
|
|
96
98
|
|
|
97
|
-
with indicator(ctx, label, scene=scene) as spinner:
|
|
99
|
+
with indicator(ctx, label, scene=scene, bookends=announce is None) as spinner:
|
|
98
100
|
while True:
|
|
99
101
|
started = clock()
|
|
100
102
|
try:
|
|
@@ -120,5 +122,5 @@ def poll_until(ctx: click.Context, read: Callable[[], T], finished: Callable[[T]
|
|
|
120
122
|
"to keep waiting; nothing was lost.")
|
|
121
123
|
if spinner is not None and describe is not None and describe(value) != shown:
|
|
122
124
|
shown = describe(value)
|
|
123
|
-
spinner.update(shown)
|
|
125
|
+
spinner.update(shown, announce(shown) if announce else None)
|
|
124
126
|
pause(started)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""The four stages of writing an article, as the terminal says them: the same four the web wizard shows.
|
|
2
|
+
|
|
3
|
+
The server reports raw node names (apps/api GET /api/v1/runs/{id}); this module is the one place that turns them
|
|
4
|
+
into Researching, Drafting, Checking and Saving. The mapping mirrors the wizard's STAGE_OF_NODE
|
|
5
|
+
(apps/web/src/lib/voyage/onboardingFlow.ts): change the two together.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from recala_cli import ui
|
|
13
|
+
|
|
14
|
+
STAGES = ("Researching", "Drafting", "Checking", "Saving")
|
|
15
|
+
|
|
16
|
+
#: One true sentence per stage, short enough that "Stage: sentence" fits a 40-column window.
|
|
17
|
+
_SENTENCES = {
|
|
18
|
+
"Researching": "Reading about your field.",
|
|
19
|
+
"Drafting": "Writing it in your voice.",
|
|
20
|
+
"Checking": "Matching facts to sources.",
|
|
21
|
+
"Saving": "Adding a cover and saving.",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#: Measured on five live first-article runs (23 Nov 2026): 7 to 14 minutes. Said once, when the wait starts.
|
|
25
|
+
WAITING_LINE = "A good article takes about 10 minutes."
|
|
26
|
+
|
|
27
|
+
_NODES_OF_STAGE = {
|
|
28
|
+
"Researching": ("search",),
|
|
29
|
+
"Drafting": ("generate", "gap_analysis", "serp_analysis", "strategy", "manager_plan", "citation_injector",
|
|
30
|
+
"validate_citations", "rewrite", "premium_editor", "section_auditor", "generate_targeted"),
|
|
31
|
+
"Checking": ("fact_check", "verify", "visual_strategy", "thumbnail", "infographic", "parallel_visuals",
|
|
32
|
+
"visual_qa", "proof_gate", "evaluate", "manager_review"),
|
|
33
|
+
"Saving": ("post_approval", "linkedin_post", "embed_knowledge", "extract_entities", "publish_cms"),
|
|
34
|
+
}
|
|
35
|
+
_STAGE_OF_NODE = {node: STAGES.index(stage) for stage, nodes in _NODES_OF_STAGE.items() for node in nodes}
|
|
36
|
+
#: Nodes that end their stage: once one has finished, the next stage is under way.
|
|
37
|
+
_LAST_NODES = {"search", "generate", "evaluate"}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def stage_line(label: str) -> str | None:
|
|
41
|
+
""""Drafting: Writing it in your voice." for a stage name; None for any other label."""
|
|
42
|
+
return f"{label}: {_SENTENCES[label]}" if label in _SENTENCES else None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class StageTracker:
|
|
46
|
+
"""Reads run states in order and answers with the stage reached: never raw, never earlier than one already shown."""
|
|
47
|
+
|
|
48
|
+
def __init__(self) -> None:
|
|
49
|
+
self._reached = 0
|
|
50
|
+
|
|
51
|
+
def observe(self, run: dict[str, Any]) -> str:
|
|
52
|
+
self._reached = max(self._reached, *self._stages_in(run))
|
|
53
|
+
return STAGES[self._reached]
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
def _stages_in(run: dict[str, Any]) -> list[int]:
|
|
57
|
+
running = _STAGE_OF_NODE.get(run.get("current_node") or "", 0)
|
|
58
|
+
finished = [_after(entry.get("node_name")) for entry in run.get("timeline") or []
|
|
59
|
+
if isinstance(entry, dict) and entry.get("status") == "completed"]
|
|
60
|
+
return [running, *finished]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _after(node: str | None) -> int:
|
|
64
|
+
"""The stage a finished node leaves the run in; 0 (no news) for a node this table does not know."""
|
|
65
|
+
stage = _STAGE_OF_NODE.get(node or "")
|
|
66
|
+
if stage is None:
|
|
67
|
+
return 0
|
|
68
|
+
return min(stage + 1, len(STAGES) - 1) if node in _LAST_NODES else stage
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def finish_headline(style: ui.Style) -> str:
|
|
72
|
+
"""The line that marks the end of a wait that ended with an article; stdout then says which."""
|
|
73
|
+
return style.bold(style.accent("The light found you."))
|
|
@@ -239,17 +239,19 @@ class Spinner:
|
|
|
239
239
|
"""
|
|
240
240
|
|
|
241
241
|
def __init__(self, label: str, *, stream: IO[str] | None = None, style: Style | None = None,
|
|
242
|
-
columns: Callable[[], int | None] | None = None, tty_only: bool = False, scene: bool = False) -> None:
|
|
242
|
+
columns: Callable[[], int | None] | None = None, tty_only: bool = False, scene: bool = False, bookends: bool = True) -> None:
|
|
243
243
|
self.label = label
|
|
244
244
|
self._scene_wanted = scene # a long wait: draw the harbour over the status line, on a colour terminal only
|
|
245
245
|
self._scene = False
|
|
246
246
|
self._scene_drawn = False
|
|
247
|
+
self._bookends = bookends # False: off a terminal, no opening line and no closing line, only what update() is given
|
|
247
248
|
self._tty_only = tty_only # on a pipe or in a log: no progress lines at all
|
|
248
249
|
self._stream = sys.stderr if stream is None else stream
|
|
249
250
|
self._style = style or Style.for_stream(self._stream)
|
|
250
251
|
self._columns = columns or (lambda: terminal_columns(self._stream))
|
|
251
252
|
self._animate = False
|
|
252
253
|
self._finished = False
|
|
254
|
+
self._lock = threading.Lock() # a frame and a permanent line never interleave
|
|
253
255
|
self._stop = threading.Event()
|
|
254
256
|
self._thread: threading.Thread | None = None
|
|
255
257
|
self._started = time.monotonic()
|
|
@@ -261,17 +263,28 @@ class Spinner:
|
|
|
261
263
|
if self._animate:
|
|
262
264
|
self._thread = threading.Thread(target=self._spin, daemon=True)
|
|
263
265
|
self._thread.start()
|
|
264
|
-
elif not self._tty_only:
|
|
266
|
+
elif not self._tty_only and self._bookends:
|
|
265
267
|
self._write(f"{self.label} ...\n")
|
|
266
268
|
return self
|
|
267
269
|
|
|
268
|
-
def update(self, label: str) -> None:
|
|
270
|
+
def update(self, label: str, note: str | None = None) -> None:
|
|
271
|
+
"""The live label changes. ``note`` is the line that stays in the scrollback: one per call, in every mode."""
|
|
269
272
|
self.label = label
|
|
270
|
-
if not self._animate
|
|
271
|
-
self.
|
|
273
|
+
if not self._animate:
|
|
274
|
+
if not self._tty_only:
|
|
275
|
+
self._write(f"{note or label}\n")
|
|
276
|
+
elif note:
|
|
277
|
+
self._leave_line(note)
|
|
278
|
+
|
|
279
|
+
def _leave_line(self, note: str) -> None:
|
|
280
|
+
"""Erase the live rows, print ``note`` where they were; the next frame draws below it."""
|
|
281
|
+
with self._lock:
|
|
282
|
+
self._write(self._clear_scene() if self._scene_drawn else "\r\x1b[K")
|
|
283
|
+
self._scene_drawn = False
|
|
284
|
+
self._write(f"{note}\n")
|
|
272
285
|
|
|
273
286
|
def done(self, message: str) -> None:
|
|
274
|
-
self._finish(f" {self._style.mark('done')} {message}" if self._animate else message)
|
|
287
|
+
self._finish(f" {self._style.mark('done')} {message}" if self._animate else message if self._bookends else None)
|
|
275
288
|
|
|
276
289
|
def fail(self, message: str) -> None:
|
|
277
290
|
self._finish(f" {self._style.mark('fail')} {message}" if self._animate else message)
|
|
@@ -283,7 +296,7 @@ class Spinner:
|
|
|
283
296
|
else:
|
|
284
297
|
self.fail(f"{self.label}: stopped")
|
|
285
298
|
|
|
286
|
-
def _finish(self, line: str) -> None:
|
|
299
|
+
def _finish(self, line: str | None) -> None:
|
|
287
300
|
self._finished = True
|
|
288
301
|
if self._tty_only and not self._animate:
|
|
289
302
|
return
|
|
@@ -293,7 +306,8 @@ class Spinner:
|
|
|
293
306
|
self._write(self._clear_scene() if self._scene_drawn else "\r\x1b[K")
|
|
294
307
|
if self._scene:
|
|
295
308
|
self._write("\x1b[?25h") # the cursor comes back
|
|
296
|
-
|
|
309
|
+
if line is not None:
|
|
310
|
+
self._write(f"{line}\n")
|
|
297
311
|
|
|
298
312
|
def _clear_scene(self) -> str:
|
|
299
313
|
return f"\x1b[{SCENE_ROWS + 1}A\r\x1b[J"
|
|
@@ -308,9 +322,10 @@ class Spinner:
|
|
|
308
322
|
elapsed = int(time.monotonic() - self._started)
|
|
309
323
|
status = status_line(frames[tick % len(frames)], self.label, elapsed, columns=columns, style=self._style)
|
|
310
324
|
rows = [*scene_rows(tick, width=columns, style=self._style), status]
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
325
|
+
with self._lock:
|
|
326
|
+
back = f"\x1b[{SCENE_ROWS + 1}A" if self._scene_drawn else ""
|
|
327
|
+
self._write(back + "".join(f"\r\x1b[K{row}\n" for row in rows))
|
|
328
|
+
self._scene_drawn = True
|
|
314
329
|
tick += 1
|
|
315
330
|
self._stop.wait(_FRAME_SECONDS)
|
|
316
331
|
|
|
@@ -326,7 +341,8 @@ class Spinner:
|
|
|
326
341
|
elapsed = int(time.monotonic() - self._started)
|
|
327
342
|
frame = frames[index % len(frames)]
|
|
328
343
|
line = status_line(frame, self.label, elapsed, columns=columns, style=self._style)
|
|
329
|
-
self.
|
|
344
|
+
with self._lock:
|
|
345
|
+
self._write(f"\r\x1b[K{line}")
|
|
330
346
|
index += 1
|
|
331
347
|
self._stop.wait(_FRAME_SECONDS)
|
|
332
348
|
|
|
@@ -196,6 +196,8 @@ def credit_lines(summary: dict[str, Any], entitlements: dict[str, Any] | None, m
|
|
|
196
196
|
f"period ({renews} {_day(period.get('ends_at'), zone)})")
|
|
197
197
|
else:
|
|
198
198
|
lines.append(free_plan_line(float(summary.get("free_left") or 0)))
|
|
199
|
+
if summary.get("free_article_email_used") and summary.get("free_article_note"):
|
|
200
|
+
lines.append(str(summary["free_article_note"]))
|
|
199
201
|
if float(summary.get("extra_left") or 0) > 0:
|
|
200
202
|
lines.append(f"Extra articles: {_count(summary.get('extra_left'))}")
|
|
201
203
|
lines.extend(_cap_lines(entitlements, show_question_cap=show_question_cap))
|
|
@@ -12,7 +12,7 @@ PROJECT = tomllib.loads((CLI / "pyproject.toml").read_text())["project"]
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def test_the_version_is_065_in_the_package_and_in_pyproject():
|
|
15
|
-
assert __version__ == PROJECT["version"] == "0.6.
|
|
15
|
+
assert __version__ == PROJECT["version"] == "0.6.8"
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def test_pypi_metadata_is_complete():
|
|
@@ -99,7 +99,21 @@ def test_a_free_account_names_the_pay_link_step(api, run, signed_in, summary):
|
|
|
99
99
|
assert "Recala billing" not in result.stdout
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
EMAIL_USED = {"plan": "free", "available": 0, "free_left": 0, "period": None, "free_article_email_used": True,
|
|
103
|
+
"free_article_note": "The free article was already used by this owner's email on another company."}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def test_a_free_article_used_by_the_owners_email_says_so_in_words_and_keeps_the_machine_field(api, run, signed_in):
|
|
107
|
+
script_billing(api, summary=EMAIL_USED, managed={"managed": False})
|
|
108
|
+
|
|
109
|
+
human = run("credits", "--org", ORG_ID)
|
|
110
|
+
machine = json.loads(run("credits", "--org", ORG_ID, "--json").stdout)
|
|
111
|
+
|
|
112
|
+
assert "already used by this owner's email on another company" in human.stdout
|
|
113
|
+
assert machine["summary"]["free_article_email_used"] is True
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_the_pay_link_hint_names_the_company_chosen_with_org_when_it_is_not_the_active_one_when_it_is_not_the_active_one(api, run, signed_in, isolated_config):
|
|
103
117
|
from recala_cli import config
|
|
104
118
|
config.set_active_org("11111111-1111-4111-8111-111111111111")
|
|
105
119
|
script_billing(api, summary={"plan": "free", "available": 1, "free_left": 1, "period": None}, managed={"managed": False})
|
|
@@ -858,7 +858,7 @@ def test_create_shows_server_progress_steps(api, run, granted):
|
|
|
858
858
|
{"run_id": TOPIC_ID, "state": "processing"},
|
|
859
859
|
202,
|
|
860
860
|
)
|
|
861
|
-
for node in ["
|
|
861
|
+
for node in ["search", "generate"]:
|
|
862
862
|
api.json(
|
|
863
863
|
"GET",
|
|
864
864
|
f"/api/v1/runs/{TOPIC_ID}",
|
|
@@ -876,9 +876,8 @@ def test_create_shows_server_progress_steps(api, run, granted):
|
|
|
876
876
|
)
|
|
877
877
|
result = run("article", "create", "--topic", TOPIC_ID, "--org", ORG_ID)
|
|
878
878
|
assert result.exit_code == 6
|
|
879
|
-
assert
|
|
880
|
-
|
|
881
|
-
)
|
|
879
|
+
assert "Researching: " in result.stderr and "Drafting: " in result.stderr # the stages, never the server's node names
|
|
880
|
+
assert ": search" not in result.stderr and ": generate" not in result.stderr
|
|
882
881
|
|
|
883
882
|
|
|
884
883
|
def test_calendar_combines_slots_and_appointments_chronologically():
|
|
@@ -151,10 +151,22 @@ def test_json_callers_keep_a_machine_readable_failure_with_the_reason_and_exit_6
|
|
|
151
151
|
|
|
152
152
|
assert result.exit_code == 6, result.stderr
|
|
153
153
|
error = error_of(result)
|
|
154
|
-
assert error["code"] == "scrape_thin" and error["details"]
|
|
154
|
+
assert error["code"] == "scrape_thin" and error["details"]["reason"] == "site_unreachable", error
|
|
155
155
|
assert saves(api) == []
|
|
156
156
|
|
|
157
157
|
|
|
158
|
+
@pytest.mark.parametrize("scan", [UNREACHABLE, FAILED])
|
|
159
|
+
def test_a_failed_scan_names_company_describe_as_the_way_forward_in_words_and_in_a_field(api, run, granted, scan):
|
|
160
|
+
failing_company(api, scan)
|
|
161
|
+
|
|
162
|
+
result = run("company", "scan", "--org", ORG_ID, "--json")
|
|
163
|
+
|
|
164
|
+
error = error_of(result)
|
|
165
|
+
assert 'recala company describe "' in error["message"], error
|
|
166
|
+
assert error["details"]["next"]["command"].startswith('recala company describe "'), error
|
|
167
|
+
assert error["details"]["next"]["human_action"]["what"], error
|
|
168
|
+
|
|
169
|
+
|
|
158
170
|
def test_company_scan_with_a_website_ends_the_same_way_in_a_terminal(api, run, granted):
|
|
159
171
|
failing_company(api, UNREACHABLE)
|
|
160
172
|
|
|
@@ -19,6 +19,26 @@ def test_the_answer_is_saved_as_who_we_are(api, run, signed_in):
|
|
|
19
19
|
assert "Next: recala article create" in result.stdout
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def test_a_saved_description_satisfies_the_scan_step_and_onboarding_moves_on(api, run, signed_in):
|
|
23
|
+
from test_agent_onboarding import ready_facts
|
|
24
|
+
|
|
25
|
+
from recala_cli import config
|
|
26
|
+
from recala_cli.commands.onboard import _report
|
|
27
|
+
|
|
28
|
+
api.json("PATCH", POSITIONING, {"success": True, "who_we_are": ANSWER, "positioning_version": 2})
|
|
29
|
+
unscanned_org = {"id": ORG_ID, "name": "Tallow Lane Planning", "website_url": "https://tallow-lane.test"}
|
|
30
|
+
before = _report(ready_facts(org=unscanned_org, topics={}), agent=True)
|
|
31
|
+
assert before["next"]["key"] == "scan"
|
|
32
|
+
|
|
33
|
+
assert run("company", "describe", ANSWER, "--org", ORG_ID).exit_code == 0
|
|
34
|
+
|
|
35
|
+
facts = ready_facts(org=unscanned_org, topics={}, progress=config.onboarding_progress(ORG_ID))
|
|
36
|
+
report = _report(facts, agent=True)
|
|
37
|
+
scan = next(row for row in report["steps"] if row["key"] == "scan")
|
|
38
|
+
assert scan["done"] is True and "described" in scan["detail"], scan
|
|
39
|
+
assert report["next"]["key"] != "scan"
|
|
40
|
+
|
|
41
|
+
|
|
22
42
|
def test_json_is_the_apis_own_answer(api, run, signed_in):
|
|
23
43
|
body = {"success": True, "who_we_are": ANSWER, "positioning_version": 2}
|
|
24
44
|
api.json("PATCH", POSITIONING, body)
|
|
@@ -260,4 +260,4 @@ def test_every_org_option_help_describes_names_slugs_and_ids(run):
|
|
|
260
260
|
|
|
261
261
|
def test_cli_version_is_065_and_matches_package_metadata():
|
|
262
262
|
pyproject = Path(__file__).parents[1] / "pyproject.toml"
|
|
263
|
-
assert __version__ == tomllib.loads(pyproject.read_text())["project"]["version"] == "0.6.
|
|
263
|
+
assert __version__ == tomllib.loads(pyproject.read_text())["project"]["version"] == "0.6.8"
|