formist-cli 0.2.0__tar.gz → 0.2.2__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.
- {formist_cli-0.2.0 → formist_cli-0.2.2}/PKG-INFO +51 -1
- {formist_cli-0.2.0 → formist_cli-0.2.2}/README.ar.md +49 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/README.fr.md +53 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/README.md +50 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/README.zh-CN.md +45 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/pyproject.toml +1 -1
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/api.py +16 -1
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/tasks.py +66 -1
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/uploads.py +46 -5
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_cli.py +115 -0
- formist_cli-0.2.2/tests/test_upload_timeouts.py +171 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/uv.lock +1 -1
- {formist_cli-0.2.0 → formist_cli-0.2.2}/.claude-plugin/plugin.json +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/.github/workflows/release.yml +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/.github/workflows/test.yml +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/.gitignore +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/LICENSE +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/docs/screenshot.png +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/docs/screenshot.svg +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/hooks/hooks.json +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/monitors/monitors.json +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/scripts/render_screenshot.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/__init__.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/__main__.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/airtable.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/alerts.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/chat.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/chats.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/cli.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/cli_support.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/connectors.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/context.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/diff.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/doctor.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/export.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/files.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/importer.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/kb.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/login.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/logs.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/meetings.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/messages.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/participants.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/plugin_hooks.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/prefs.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/privileges.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/projects.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/resolve.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/settings.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/skill_library.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/skills.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/space_plan.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/spaces.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/targets.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_archive.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_assignee.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_attach.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_check.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_cloud.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_duration.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_filter.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_format.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_fuzzy_date.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_identity.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_import.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_intake.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_json.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_lock.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_mirror.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_model.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_monitor.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_parse.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_paths.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_project.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_questions.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_queue.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_ref.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_search.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_serialize.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_sessions.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_status.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_store.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_title.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_views.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_width.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/task_yaml.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/textnorm.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/tokens.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/update.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/usage_tokens.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/users.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/whatsapp.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/workflow_corpus.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/src/formist_cli/workflow_golden.json +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/1-plain-task-example.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/10-title-with-colon-and.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/2-decision-with-two-op.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/4-a-brief-for-ai.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/6-a-milestone.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/7-node-with-sub-questi.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/8-needs-acceptance.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/active/9-dependent-node.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/archived/3-fyi-entry.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/fixtures/task_decisions/archived/5-for-the-owner.md +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_admin_flag_gate.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_airtable.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_alerts.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_api_and_tokens.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_api_uploads_transport.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_audit_log_shows_the_newest.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_chat.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_chat_group.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_chat_message.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_chats.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_cli_registration_is_unique.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_connector_group.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_connector_ops.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_connectors.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_context.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_diff.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_doctor.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_export.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_files.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_files_download.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_files_merge.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_grants_render.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_help_matches_the_write_guard.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_importer.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_kb.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_login.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_logs.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_meetings.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_messages.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_moved_to_fmdev.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_participants.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_plugin_hooks.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_plugin_manifest.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_prefs.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_privileges.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_projects.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_proposals.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_render_screenshot.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_report_provenance.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_resolve.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_settings.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_skill_group.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_skill_library_install.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_skills.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_space_plan.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_spaces.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_spaces_set_logo.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_stream_transport.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_targets.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_archive_read_only.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_check.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_cloud.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_fuzzy_date.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_import.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_import_archive.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_mirror.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_monitor.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_nod_interop.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_parse_serialize.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_ref.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_sessions.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_store.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_views.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_workflow_parity.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_task_yaml.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_update.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_upload_dir.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_uploads.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_usage_tokens.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_users.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_users_writes.py +0 -0
- {formist_cli-0.2.0 → formist_cli-0.2.2}/tests/test_whatsapp.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: formist-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Command-line client for Formist and Evane deployments
|
|
5
5
|
Project-URL: Homepage, https://formist.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/WeCarbon/formist-cli
|
|
@@ -131,6 +131,56 @@ needs no login, `fm doctor` rolls health up across every deployment, and the res
|
|
|
131
131
|
`skill-library-install`, `meeting`, `project`, `connector`, `skills-add`, `skills-update`,
|
|
132
132
|
`proposals`, `audit-log`, `connectors`, `files`, read or write your own space the same way.
|
|
133
133
|
|
|
134
|
+
### Tasks (`fm task`)
|
|
135
|
+
|
|
136
|
+
`fm task` is a built-in port of [`nod`](https://github.com/wecarbon/noddit)'s task-and-decision
|
|
137
|
+
tracker: a node is one piece of work, a task when an AI can just do it, a decision when the
|
|
138
|
+
owner has to rule on it. It runs in one of two modes:
|
|
139
|
+
|
|
140
|
+
- **Logged out**, in any project: `fm task init` creates a `decisions/` folder, and every
|
|
141
|
+
command below finds it by walking up from the current directory, the same way `git` finds
|
|
142
|
+
`.git`. Nothing leaves the machine.
|
|
143
|
+
- **Logged in**, with `fm login`: `fm task --host <deployment>` (or a remembered `fm use` host
|
|
144
|
+
with a stored credential) talks to that space's node API instead, so a team shares one
|
|
145
|
+
tracker through Formist/Evane rather than a per-clone folder. Not every verb has a server
|
|
146
|
+
route yet; one that doesn't says so rather than guessing.
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
fm task init # creates decisions/ here
|
|
150
|
+
fm task add "Write the onboarding doc" --task # a new node
|
|
151
|
+
fm task start X1 # to do -> in progress
|
|
152
|
+
fm task note X1 "found last year's draft" # progress, without closing it
|
|
153
|
+
fm task show active # every open node (bare `show` lists only ones needing a decision)
|
|
154
|
+
fm task done X1 --note "doc is up" # -> done
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
A decision looks the same, just with options instead of `--task`:
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
fm task add "Which domain for staging" -o 1="api-staging.example.com" -o 2="staging-api.example.com"
|
|
161
|
+
fm task push X2 1 --note "matches the cert" # the owner's answer, recorded on the node
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Every write needs an author: pass `--author "<you> · <doing what>"` or export `NODDIT_AUTHOR`
|
|
165
|
+
once per session. `fm task whoami` reports who a write would sign as: the signed-in account and
|
|
166
|
+
space once `fm login`/`--host` resolves to cloud mode, otherwise the local identity stamped on
|
|
167
|
+
each note. `fm task briefs` lists work the owner filed that nobody has picked up yet;
|
|
168
|
+
`fm task claim <ref>` takes one. Run `fm task --help` for the full verb list and `fm task <verb>
|
|
169
|
+
--help` for its flags.
|
|
170
|
+
|
|
171
|
+
#### Claude Code plugin
|
|
172
|
+
|
|
173
|
+
The git repo, not the `pipx` package, is also a Claude Code plugin: `hooks/hooks.json` injects
|
|
174
|
+
the `fm task` usage rules and the project's open nodes at the start of a session, and
|
|
175
|
+
`monitors/monitors.json` starts `fm task monitor --here` so the owner's replies reach the agent
|
|
176
|
+
without it polling. It isn't published to a marketplace, so load it from a clone instead of the
|
|
177
|
+
installed package:
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
git clone https://github.com/WeCarbon/formist-cli
|
|
181
|
+
claude --plugin-dir formist-cli
|
|
182
|
+
```
|
|
183
|
+
|
|
134
184
|
## FAQ
|
|
135
185
|
|
|
136
186
|
**Do I need platform-admin access to use this?**
|
|
@@ -121,6 +121,55 @@ fm kb search "venue contract" --space <space-id>
|
|
|
121
121
|
`project`، `connector`، `skills-add`، `skills-update`، `proposals`،
|
|
122
122
|
`audit-log`، `connectors`، `files`، تقرأ أو تكتب مساحتك بنفس الطريقة.
|
|
123
123
|
|
|
124
|
+
### المهام (`fm task`)
|
|
125
|
+
|
|
126
|
+
يضمّ `fm task` نسخة مدمجة من أداة تتبع المهام والقرارات في
|
|
127
|
+
[`nod`](https://github.com/wecarbon/noddit): العقدة هي وحدة عمل واحدة، مهمة إذا كان الوكيل
|
|
128
|
+
يستطيع تنفيذها مباشرة، وقرار إذا احتاجت رأي المسؤول أولًا. تعمل بإحدى طريقتين:
|
|
129
|
+
|
|
130
|
+
- **بلا تسجيل دخول**، في أي مشروع: يُنشئ `fm task init` مجلد `decisions/`، وكل أمر أدناه يجده
|
|
131
|
+
بالصعود من المجلد الحالي، بالطريقة نفسها التي يجد بها `git` مجلد `.git`. لا يُرسَل شيء إلى أي
|
|
132
|
+
مكان.
|
|
133
|
+
- **مع تسجيل الدخول**، عبر `fm login`: يتوجّه `fm task --host <النشرة>` (أو نشرة حفظها
|
|
134
|
+
`fm use` مع بيانات اعتماد مخزّنة) إلى واجهة عُقد تلك المساحة بدلًا من ذلك، فيشترك فريق في
|
|
135
|
+
أداة تتبع واحدة عبر Formist/Evane بدل مجلد لكل نسخة محلية. ليس لكل أمر فرعي مسار على الخادم
|
|
136
|
+
بعد؛ ما لا يملك مسارًا يقول ذلك مباشرة بدل التخمين.
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
fm task init # creates decisions/ here
|
|
140
|
+
fm task add "Write the onboarding doc" --task # a new node
|
|
141
|
+
fm task start X1 # to do -> in progress
|
|
142
|
+
fm task note X1 "found last year's draft" # progress, without closing it
|
|
143
|
+
fm task show active # every open node (bare `show` lists only ones needing a decision)
|
|
144
|
+
fm task done X1 --note "doc is up" # -> done
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
يبدو القرار بالشكل نفسه، باستبدال `--task` بخيارات:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
fm task add "Which domain for staging" -o 1="api-staging.example.com" -o 2="staging-api.example.com"
|
|
151
|
+
fm task push X2 1 --note "matches the cert" # the owner's answer, recorded on the node
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
تحتاج كل عملية كتابة مؤلّفًا: مرّر `--author "<اسمك> · ما تفعله"`، أو صدّر `NODDIT_AUTHOR` مرة
|
|
155
|
+
واحدة لكل جلسة. يوضّح `fm task whoami` باسم من تُسجَّل الكتابة: الحساب والمساحة المتصلة متى
|
|
156
|
+
حلّ `fm login`/`--host` الوضع السحابي، وإلا فالهوية المحلية المطبوعة على كل ملاحظة. يسرد
|
|
157
|
+
`fm task briefs` الأعمال التي ملفها المسؤول ولم يأخذها أحد بعد؛ ويأخذ `fm task claim <ref>`
|
|
158
|
+
واحدة منها. شغّل `fm task --help` لقائمة الأوامر كاملة، و`fm task <command> --help` لخيارات
|
|
159
|
+
كل أمر.
|
|
160
|
+
|
|
161
|
+
#### إضافة Claude Code
|
|
162
|
+
|
|
163
|
+
مستودع git نفسه، لا حزمة `pipx`، هو أيضًا إضافة لـ Claude Code: يحقن `hooks/hooks.json` قواعد
|
|
164
|
+
استخدام `fm task` وعُقد المشروع غير المكتملة في بداية كل جلسة، ويشغّل `monitors/monitors.json`
|
|
165
|
+
أمر `fm task monitor --here` حتى تصل ردود المسؤول إلى الوكيل دون أن يستطلعها بنفسه. لم تُنشر
|
|
166
|
+
هذه الإضافة في أي سوق إضافات، فحمّلها من نسخة مستودع بدلًا من الحزمة المثبَّتة:
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
git clone https://github.com/WeCarbon/formist-cli
|
|
170
|
+
claude --plugin-dir formist-cli
|
|
171
|
+
```
|
|
172
|
+
|
|
124
173
|
## الأسئلة الشائعة
|
|
125
174
|
|
|
126
175
|
**هل أحتاج صلاحية إدارة المنصة لاستخدام هذه الأداة؟**
|
|
@@ -126,6 +126,59 @@ l'état de santé sur chaque déploiement, et le reste, `chats`, `chat`, `kb`, `
|
|
|
126
126
|
`meeting`, `project`, `connector`, `skills-add`, `skills-update`, `proposals`, `audit-log`,
|
|
127
127
|
`connectors`, `files`, lit ou écrit votre propre espace de la même façon.
|
|
128
128
|
|
|
129
|
+
### Tâches (`fm task`)
|
|
130
|
+
|
|
131
|
+
`fm task` est un portage intégré du suivi des tâches et décisions de
|
|
132
|
+
[`nod`](https://github.com/wecarbon/noddit) : un nœud est une unité de travail, une tâche quand
|
|
133
|
+
un agent peut simplement la faire, une décision quand le responsable doit d'abord trancher. Il
|
|
134
|
+
fonctionne selon deux modes :
|
|
135
|
+
|
|
136
|
+
- **Déconnecté**, dans n'importe quel projet : `fm task init` crée un dossier `decisions/`, et
|
|
137
|
+
chaque commande ci-dessous le retrouve en remontant depuis le répertoire courant, comme `git`
|
|
138
|
+
retrouve `.git`. Rien ne quitte la machine.
|
|
139
|
+
- **Connecté**, avec `fm login` : `fm task --host <déploiement>` (ou un déploiement mémorisé par
|
|
140
|
+
`fm use` avec un identifiant stocké) s'adresse à l'API de nœuds de cet espace à la place, pour
|
|
141
|
+
qu'une équipe partage un seul suivi via Formist/Evane plutôt qu'un dossier par clone. Toutes
|
|
142
|
+
les commandes n'ont pas encore de route côté serveur ; celles qui n'en ont pas le disent
|
|
143
|
+
plutôt que de deviner.
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
fm task init # creates decisions/ here
|
|
147
|
+
fm task add "Write the onboarding doc" --task # a new node
|
|
148
|
+
fm task start X1 # to do -> in progress
|
|
149
|
+
fm task note X1 "found last year's draft" # progress, without closing it
|
|
150
|
+
fm task show active # every open node (bare `show` lists only ones needing a decision)
|
|
151
|
+
fm task done X1 --note "doc is up" # -> done
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Une décision ressemble à la même chose, avec des options à la place de `--task` :
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
fm task add "Which domain for staging" -o 1="api-staging.example.com" -o 2="staging-api.example.com"
|
|
158
|
+
fm task push X2 1 --note "matches the cert" # the owner's answer, recorded on the node
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Chaque écriture a besoin d'un auteur : passez `--author "<vous> · <ce que vous faites>"`, ou
|
|
162
|
+
exportez `NODDIT_AUTHOR` une fois par session. `fm task whoami` indique sous quelle identité une
|
|
163
|
+
écriture signerait : le compte et l'espace connectés une fois que `fm login`/`--host` résout le
|
|
164
|
+
mode distant, sinon l'identité locale apposée sur chaque note. `fm task briefs` liste le travail
|
|
165
|
+
déposé par le responsable que personne n'a encore pris ; `fm task claim <ref>` en prend un.
|
|
166
|
+
Lancez `fm task --help` pour la liste complète des commandes et `fm task <commande> --help` pour
|
|
167
|
+
ses options.
|
|
168
|
+
|
|
169
|
+
#### Plugin Claude Code
|
|
170
|
+
|
|
171
|
+
Le dépôt git, pas le paquet `pipx`, est aussi un plugin Claude Code : `hooks/hooks.json` injecte
|
|
172
|
+
les règles d'usage de `fm task` et les nœuds encore ouverts du projet au début d'une session, et
|
|
173
|
+
`monitors/monitors.json` démarre `fm task monitor --here` pour que les réponses du responsable
|
|
174
|
+
atteignent l'agent sans qu'il ait à interroger en boucle. Il n'est pas publié sur un
|
|
175
|
+
marketplace, donc chargez-le depuis un clone plutôt que depuis le paquet installé :
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
git clone https://github.com/WeCarbon/formist-cli
|
|
179
|
+
claude --plugin-dir formist-cli
|
|
180
|
+
```
|
|
181
|
+
|
|
129
182
|
## FAQ
|
|
130
183
|
|
|
131
184
|
**Ai-je besoin des droits d'administration de la plateforme pour utiliser cet outil ?**
|
|
@@ -114,6 +114,56 @@ needs no login, `fm doctor` rolls health up across every deployment, and the res
|
|
|
114
114
|
`skill-library-install`, `meeting`, `project`, `connector`, `skills-add`, `skills-update`,
|
|
115
115
|
`proposals`, `audit-log`, `connectors`, `files`, read or write your own space the same way.
|
|
116
116
|
|
|
117
|
+
### Tasks (`fm task`)
|
|
118
|
+
|
|
119
|
+
`fm task` is a built-in port of [`nod`](https://github.com/wecarbon/noddit)'s task-and-decision
|
|
120
|
+
tracker: a node is one piece of work, a task when an AI can just do it, a decision when the
|
|
121
|
+
owner has to rule on it. It runs in one of two modes:
|
|
122
|
+
|
|
123
|
+
- **Logged out**, in any project: `fm task init` creates a `decisions/` folder, and every
|
|
124
|
+
command below finds it by walking up from the current directory, the same way `git` finds
|
|
125
|
+
`.git`. Nothing leaves the machine.
|
|
126
|
+
- **Logged in**, with `fm login`: `fm task --host <deployment>` (or a remembered `fm use` host
|
|
127
|
+
with a stored credential) talks to that space's node API instead, so a team shares one
|
|
128
|
+
tracker through Formist/Evane rather than a per-clone folder. Not every verb has a server
|
|
129
|
+
route yet; one that doesn't says so rather than guessing.
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
fm task init # creates decisions/ here
|
|
133
|
+
fm task add "Write the onboarding doc" --task # a new node
|
|
134
|
+
fm task start X1 # to do -> in progress
|
|
135
|
+
fm task note X1 "found last year's draft" # progress, without closing it
|
|
136
|
+
fm task show active # every open node (bare `show` lists only ones needing a decision)
|
|
137
|
+
fm task done X1 --note "doc is up" # -> done
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
A decision looks the same, just with options instead of `--task`:
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
fm task add "Which domain for staging" -o 1="api-staging.example.com" -o 2="staging-api.example.com"
|
|
144
|
+
fm task push X2 1 --note "matches the cert" # the owner's answer, recorded on the node
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Every write needs an author: pass `--author "<you> · <doing what>"` or export `NODDIT_AUTHOR`
|
|
148
|
+
once per session. `fm task whoami` reports who a write would sign as: the signed-in account and
|
|
149
|
+
space once `fm login`/`--host` resolves to cloud mode, otherwise the local identity stamped on
|
|
150
|
+
each note. `fm task briefs` lists work the owner filed that nobody has picked up yet;
|
|
151
|
+
`fm task claim <ref>` takes one. Run `fm task --help` for the full verb list and `fm task <verb>
|
|
152
|
+
--help` for its flags.
|
|
153
|
+
|
|
154
|
+
#### Claude Code plugin
|
|
155
|
+
|
|
156
|
+
The git repo, not the `pipx` package, is also a Claude Code plugin: `hooks/hooks.json` injects
|
|
157
|
+
the `fm task` usage rules and the project's open nodes at the start of a session, and
|
|
158
|
+
`monitors/monitors.json` starts `fm task monitor --here` so the owner's replies reach the agent
|
|
159
|
+
without it polling. It isn't published to a marketplace, so load it from a clone instead of the
|
|
160
|
+
installed package:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
git clone https://github.com/WeCarbon/formist-cli
|
|
164
|
+
claude --plugin-dir formist-cli
|
|
165
|
+
```
|
|
166
|
+
|
|
117
167
|
## FAQ
|
|
118
168
|
|
|
119
169
|
**Do I need platform-admin access to use this?**
|
|
@@ -113,6 +113,51 @@ fm kb search "venue contract" --space <space-id>
|
|
|
113
113
|
`meeting`、`project`、`connector`、`skills-add`、`skills-update`、`proposals`、
|
|
114
114
|
`audit-log`、`connectors`、`files`,也都是以同样的方式读写你自己的空间。
|
|
115
115
|
|
|
116
|
+
### 任务(`fm task`)
|
|
117
|
+
|
|
118
|
+
`fm task` 内置了 [`nod`](https://github.com/wecarbon/noddit) 那套任务与决策跟踪器:一个节点就是
|
|
119
|
+
一件事,AI 能直接做的是任务,需要负责人先拍板的是决策。它有两种模式:
|
|
120
|
+
|
|
121
|
+
- **未登录**,在任意项目里:`fm task init` 会建一个 `decisions/` 文件夹,下面每条命令都从当前
|
|
122
|
+
目录往上找它,和 `git` 找 `.git` 的方式一样。什么都不会发出去。
|
|
123
|
+
- **已登录**,配合 `fm login`:`fm task --host <部署>`(或者 `fm use` 记住的、带凭证的 host)会
|
|
124
|
+
改成调用那个空间的节点接口,这样一个团队就能通过 Formist/Evane 共用一套跟踪器,而不是各自
|
|
125
|
+
一份本地文件夹。不是每个子命令在云端都已经接通,没接通的会直接说明,不会瞎猜。
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
fm task init # creates decisions/ here
|
|
129
|
+
fm task add "Write the onboarding doc" --task # a new node
|
|
130
|
+
fm task start X1 # to do -> in progress
|
|
131
|
+
fm task note X1 "found last year's draft" # progress, without closing it
|
|
132
|
+
fm task show active # every open node (bare `show` lists only ones needing a decision)
|
|
133
|
+
fm task done X1 --note "doc is up" # -> done
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
决策用的是同一套命令,只是把 `--task` 换成几个选项:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
fm task add "Which domain for staging" -o 1="api-staging.example.com" -o 2="staging-api.example.com"
|
|
140
|
+
fm task push X2 1 --note "matches the cert" # the owner's answer, recorded on the node
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
每次写操作都要有作者:传 `--author "<你> · 在做什么"`,或者整个会话提前导出一次
|
|
144
|
+
`NODDIT_AUTHOR`。`fm task whoami` 会报出一次写操作会签成谁:云端模式下是登录账号和空间,
|
|
145
|
+
本地模式下就是写进每条笔记里的那个身份。`fm task briefs` 列出负责人派过、但还没人接手的活;
|
|
146
|
+
`fm task claim <节点>` 接下一个。完整子命令列表看 `fm task --help`,每个子命令的参数看
|
|
147
|
+
`fm task <子命令> --help`。
|
|
148
|
+
|
|
149
|
+
#### Claude Code 插件
|
|
150
|
+
|
|
151
|
+
这个 git 仓库本身(不是 `pipx` 装的那个包)同时也是一个 Claude Code 插件:`hooks/hooks.json`
|
|
152
|
+
会在每个会话开始时注入 `fm task` 的用法规则和项目里还没完成的节点,`monitors/monitors.json`
|
|
153
|
+
会起 `fm task monitor --here`,让负责人的答复能传到 AI 那里,不用它自己去轮询。这个插件还没
|
|
154
|
+
发布到插件市场,所以要从仓库的副本里加载,而不是已安装的包:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
git clone https://github.com/WeCarbon/formist-cli
|
|
158
|
+
claude --plugin-dir formist-cli
|
|
159
|
+
```
|
|
160
|
+
|
|
116
161
|
## 常见问题
|
|
117
162
|
|
|
118
163
|
**用这个工具需要平台管理员权限吗?**
|
|
@@ -42,6 +42,12 @@ DEFAULT_TIMEOUT = 30
|
|
|
42
42
|
#: failure.
|
|
43
43
|
UPLOAD_TIMEOUT = 600
|
|
44
44
|
|
|
45
|
+
#: Timeout for ONE resumable-upload chunk PUT (1 MiB by default). Not
|
|
46
|
+
#: :data:`DEFAULT_TIMEOUT`: a busy server can take longer than 30 s to answer
|
|
47
|
+
#: a chunk, and a 30 s limit killed whole upload batches on the spot. Long enough to ride out a busy server, short
|
|
48
|
+
#: enough that a dead connection is retried well inside the session's TTL.
|
|
49
|
+
CHUNK_TIMEOUT = 120
|
|
50
|
+
|
|
45
51
|
|
|
46
52
|
class ApiError(Exception):
|
|
47
53
|
"""An API call that failed, phrased for whoever has to fix it."""
|
|
@@ -702,6 +708,15 @@ def _send(
|
|
|
702
708
|
raise _translate_body(exc, payload, target, path) from None
|
|
703
709
|
except urllib.error.URLError as exc:
|
|
704
710
|
raise ApiError(_unreachable(target, exc)) from None
|
|
711
|
+
except (TimeoutError, OSError) as exc:
|
|
712
|
+
# A read timeout AFTER the request was sent, or a connection reset
|
|
713
|
+
# mid-response, is a bare TimeoutError / OSError, never wrapped in
|
|
714
|
+
# URLError. Uncaught it bypassed every retry and per-file FAILED line
|
|
715
|
+
# and killed a whole `fm upload DIR` batch.
|
|
716
|
+
# status=None: a transport failure, which callers may retry.
|
|
717
|
+
raise ApiError(
|
|
718
|
+
f"no answer from {target.api_base}{path} ({type(exc).__name__}: {exc or 'timed out'})"
|
|
719
|
+
) from None
|
|
705
720
|
|
|
706
721
|
if not raw:
|
|
707
722
|
return None
|
|
@@ -938,7 +953,7 @@ def put_bytes(
|
|
|
938
953
|
*,
|
|
939
954
|
token: str | None = None,
|
|
940
955
|
content_type: str = "application/octet-stream",
|
|
941
|
-
timeout: int =
|
|
956
|
+
timeout: int = CHUNK_TIMEOUT,
|
|
942
957
|
) -> object:
|
|
943
958
|
"""PUT raw bytes to ``path`` and return the decoded JSON body.
|
|
944
959
|
|
|
@@ -680,10 +680,75 @@ def _cmd_config(args) -> int:
|
|
|
680
680
|
return 0
|
|
681
681
|
|
|
682
682
|
|
|
683
|
+
def _cloud_whoami(args) -> dict | None:
|
|
684
|
+
"""The signed-in cloud identity for ``fm task whoami``'s ``--host``
|
|
685
|
+
(or ``fm use``'s remembered host, the same cloud-intent rule
|
|
686
|
+
:func:`resolve_mode` applies, via
|
|
687
|
+
:func:`_use_remembered_host_with_credential`) — or ``None`` when that
|
|
688
|
+
intent resolves to no stored credential, so the caller falls back to
|
|
689
|
+
the local, no-login identity (today's behaviour) instead of raising.
|
|
690
|
+
|
|
691
|
+
Unlike every other ``fm task`` verb, whoami must always answer
|
|
692
|
+
SOMETHING, logged in or not: before C1180 it printed the local
|
|
693
|
+
session uuid even after ``fm login``, which read as "not logged in"
|
|
694
|
+
when it was — the token was there, nothing here ever looked at it.
|
|
695
|
+
"""
|
|
696
|
+
host = getattr(args, "host", None)
|
|
697
|
+
if not (host or _use_remembered_host_with_credential()):
|
|
698
|
+
return None
|
|
699
|
+
|
|
700
|
+
from formist_cli import context, prefs
|
|
701
|
+
|
|
702
|
+
try:
|
|
703
|
+
ctx = context.resolve(args, for_write=False, need_space=False, need_token=False)
|
|
704
|
+
except prefs.PrefsError:
|
|
705
|
+
return None
|
|
706
|
+
if not ctx.token:
|
|
707
|
+
return None
|
|
708
|
+
|
|
709
|
+
from formist_cli import api, login as login_mod
|
|
710
|
+
from formist_cli.api import ApiError
|
|
711
|
+
from formist_cli.targets import TargetError
|
|
712
|
+
|
|
713
|
+
email = None
|
|
714
|
+
user_id = None
|
|
715
|
+
try:
|
|
716
|
+
me = api.get(login_mod.auth_target(ctx.target), "/auth/me", token=ctx.token)
|
|
717
|
+
except (ApiError, TargetError, OSError):
|
|
718
|
+
me = None
|
|
719
|
+
if isinstance(me, dict):
|
|
720
|
+
email = me.get("email")
|
|
721
|
+
user_id = me.get("id")
|
|
722
|
+
|
|
723
|
+
return {
|
|
724
|
+
"host": ctx.target.name,
|
|
725
|
+
"email": email,
|
|
726
|
+
"user_id": user_id,
|
|
727
|
+
"space": ctx.space,
|
|
728
|
+
"space_source": ctx.space_source if ctx.space else None,
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
|
|
683
732
|
def _cmd_whoami(args) -> int:
|
|
733
|
+
as_json = getattr(args, "json", False)
|
|
734
|
+
cloud = _cloud_whoami(args)
|
|
735
|
+
if cloud is not None:
|
|
736
|
+
session = task_identity.current_session()
|
|
737
|
+
if as_json:
|
|
738
|
+
print(json.dumps({"mode": "cloud", "session": session, **cloud}, indent=2))
|
|
739
|
+
else:
|
|
740
|
+
who = cloud["email"] or cloud["user_id"] or "(signed in, but the server did not say who)"
|
|
741
|
+
print(f"{who} ({cloud['host']})")
|
|
742
|
+
if cloud["space"]:
|
|
743
|
+
print(f" space {cloud['space']} [space: {cloud['space_source']}]")
|
|
744
|
+
if session:
|
|
745
|
+
print(f" local session: {session}")
|
|
746
|
+
return 0
|
|
747
|
+
|
|
684
748
|
identity = task_identity.current_identity()
|
|
685
|
-
if
|
|
749
|
+
if as_json:
|
|
686
750
|
print(json.dumps({
|
|
751
|
+
"mode": "local",
|
|
687
752
|
"identity": identity, "author": task_identity.current_author(),
|
|
688
753
|
"session": task_identity.current_session(),
|
|
689
754
|
}, indent=2))
|
|
@@ -226,15 +226,56 @@ def _put_chunk_with_retry(
|
|
|
226
226
|
raise UploadError(f"chunk {index} failed after {retries} attempts: {last}") from last
|
|
227
227
|
|
|
228
228
|
|
|
229
|
+
#: How many times a completion is re-asked on the SAME session.
|
|
230
|
+
DEFAULT_COMPLETE_ATTEMPTS = 6
|
|
231
|
+
_COMPLETE_BACKOFF_SECONDS = 5.0
|
|
232
|
+
|
|
233
|
+
|
|
229
234
|
def complete_session(
|
|
230
|
-
target: Target,
|
|
235
|
+
target: Target,
|
|
236
|
+
space: str,
|
|
237
|
+
upload_id: str,
|
|
238
|
+
*,
|
|
239
|
+
token: str | None,
|
|
240
|
+
post: Caller | None = None,
|
|
241
|
+
attempts: int = DEFAULT_COMPLETE_ATTEMPTS,
|
|
231
242
|
) -> dict:
|
|
243
|
+
"""Finish ``upload_id`` and return ``{"item": <File>, ...}``.
|
|
244
|
+
|
|
245
|
+
Completion is where the server assembles the file AND converts it to
|
|
246
|
+
markdown, so it can take minutes on a busy server; it gets the long
|
|
247
|
+
:data:`api.UPLOAD_TIMEOUT`, not the 30 s default.
|
|
248
|
+
|
|
249
|
+
It is retried ON THIS SESSION, never by starting a new upload: the server's
|
|
250
|
+
completion is idempotent (a session that already produced a File returns
|
|
251
|
+
that File) and answers 409 while a first attempt is still assembling. A
|
|
252
|
+
caller that instead re-sent the whole file opened a second session for the
|
|
253
|
+
same bytes, and the server converted and stored the file twice while still
|
|
254
|
+
finishing the first. Retried: a transport failure (status None) and that 409. Anything
|
|
255
|
+
else is a verdict and raises at once.
|
|
256
|
+
"""
|
|
257
|
+
# The real module for the constant and the exception type; `_api()` (which
|
|
258
|
+
# tests replace with a fake transport) only for the call itself.
|
|
259
|
+
from formist_cli import api
|
|
260
|
+
|
|
232
261
|
post = post or _api().post
|
|
233
262
|
path = f"{_upload_prefix(space)}/sessions/{upload_id}/complete"
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
263
|
+
last: Exception | None = None
|
|
264
|
+
for attempt in range(max(1, attempts)):
|
|
265
|
+
try:
|
|
266
|
+
result = post(target, path, {}, token=token, timeout=api.UPLOAD_TIMEOUT)
|
|
267
|
+
except api.ApiError as exc:
|
|
268
|
+
status = getattr(exc, "status", None)
|
|
269
|
+
if status is not None and status != 409:
|
|
270
|
+
raise
|
|
271
|
+
last = exc
|
|
272
|
+
if attempt + 1 < attempts:
|
|
273
|
+
time.sleep(_COMPLETE_BACKOFF_SECONDS * (attempt + 1))
|
|
274
|
+
continue
|
|
275
|
+
if not isinstance(result, dict) or not isinstance(result.get("item"), dict):
|
|
276
|
+
raise UploadError(f"complete returned an unexpected shape: {result!r}")
|
|
277
|
+
return result
|
|
278
|
+
raise UploadError(f"complete did not finish after {attempts} attempts: {last}") from last
|
|
238
279
|
|
|
239
280
|
|
|
240
281
|
def abort_session(
|
|
@@ -722,3 +722,118 @@ def test_changes_through_cli_prefers_note_kind_for_a_note_row(cloud, capsys):
|
|
|
722
722
|
assert code == 0
|
|
723
723
|
assert "ask" in out
|
|
724
724
|
assert calls[0][1].endswith("/nodes/changes")
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
# ===========================================================================
|
|
728
|
+
# whoami: cloud identity vs the local, no-login fallback (C1180)
|
|
729
|
+
#
|
|
730
|
+
# Before the fix, `_cmd_whoami` never looked at `--host`/the stored token at
|
|
731
|
+
# all, so a logged-in operator still saw the bare local session uuid, which
|
|
732
|
+
# read as "not logged in" when it wasn't. Each test below stores a REAL
|
|
733
|
+
# token file (through `login.store_payload`, not a stubbed `context.resolve`
|
|
734
|
+
# like the `cloud` fixture above) so the whole chain --host -> target ->
|
|
735
|
+
# stored credential -> /auth/me is exercised, matching how the bug was
|
|
736
|
+
# actually reproduced (`fm login --host <h>` then `fm task whoami --host
|
|
737
|
+
# <h>`).
|
|
738
|
+
# ===========================================================================
|
|
739
|
+
def _store_token(monkeypatch, tmp_path, *, env="formist", email="user@example.com", user_id="u-1"):
|
|
740
|
+
from formist_cli import login, tokens
|
|
741
|
+
|
|
742
|
+
monkeypatch.setenv("FORMIST_CONFIG_DIR", str(tmp_path / "fm-config"))
|
|
743
|
+
monkeypatch.delenv(tokens.ENV_TOKEN_VAR, raising=False)
|
|
744
|
+
login.store_payload(
|
|
745
|
+
env,
|
|
746
|
+
{"access_token": "crst_at_x", "refresh_token": "crst_rt_x", "scope": "", "expires_in": 3600},
|
|
747
|
+
client_id="cid-x",
|
|
748
|
+
)
|
|
749
|
+
return {"email": email, "id": user_id}
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
def test_whoami_in_cloud_mode_shows_the_signed_in_email(tmp_path, monkeypatch, capsys):
|
|
753
|
+
from formist_cli import api
|
|
754
|
+
|
|
755
|
+
me = _store_token(monkeypatch, tmp_path)
|
|
756
|
+
monkeypatch.setattr(api, "get", lambda *a, **k: me)
|
|
757
|
+
|
|
758
|
+
code, out, _err = _run(capsys, "whoami", "--host", "formist")
|
|
759
|
+
assert code == 0
|
|
760
|
+
assert "user@example.com" in out
|
|
761
|
+
assert "formist" in out
|
|
762
|
+
# the old bug: the local session uuid used to be the ONLY thing printed
|
|
763
|
+
assert "no identity" not in out
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
def test_whoami_in_cloud_mode_json_includes_email_and_space(tmp_path, monkeypatch, capsys):
|
|
767
|
+
from formist_cli import api
|
|
768
|
+
|
|
769
|
+
me = _store_token(monkeypatch, tmp_path)
|
|
770
|
+
monkeypatch.setattr(api, "get", lambda *a, **k: me)
|
|
771
|
+
|
|
772
|
+
code, out, _err = _run(capsys, "whoami", "--host", "formist", "--space", SPACE, "--json")
|
|
773
|
+
assert code == 0
|
|
774
|
+
payload = json.loads(out)
|
|
775
|
+
assert payload["mode"] == "cloud"
|
|
776
|
+
assert payload["email"] == "user@example.com"
|
|
777
|
+
assert payload["space"] == SPACE
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
def test_whoami_in_cloud_mode_without_a_bound_space_omits_the_space_line(tmp_path, monkeypatch, capsys):
|
|
781
|
+
from formist_cli import api
|
|
782
|
+
|
|
783
|
+
me = _store_token(monkeypatch, tmp_path)
|
|
784
|
+
monkeypatch.setattr(api, "get", lambda *a, **k: me)
|
|
785
|
+
|
|
786
|
+
code, out, _err = _run(capsys, "whoami", "--host", "formist")
|
|
787
|
+
assert code == 0
|
|
788
|
+
assert "space" not in out
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
def test_whoami_in_cloud_mode_falls_back_to_the_host_when_auth_me_fails(tmp_path, monkeypatch, capsys):
|
|
792
|
+
"""A stored-but-dead/expired token must not make whoami crash or lie —
|
|
793
|
+
it says it is signed in to the host and that the server would not say
|
|
794
|
+
who, instead of silently reverting to the local identity (which would
|
|
795
|
+
look like `fm login` never happened)."""
|
|
796
|
+
from formist_cli import api
|
|
797
|
+
from formist_cli.api import ApiError
|
|
798
|
+
|
|
799
|
+
_store_token(monkeypatch, tmp_path)
|
|
800
|
+
|
|
801
|
+
def _boom(*a, **k):
|
|
802
|
+
raise ApiError("401")
|
|
803
|
+
|
|
804
|
+
monkeypatch.setattr(api, "get", _boom)
|
|
805
|
+
|
|
806
|
+
code, out, _err = _run(capsys, "whoami", "--host", "formist")
|
|
807
|
+
assert code == 0
|
|
808
|
+
assert "formist" in out
|
|
809
|
+
assert "did not say who" in out
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def test_whoami_stays_in_local_mode_when_logged_out(tmp_path, monkeypatch, capsys):
|
|
813
|
+
"""`--host` alone, with no stored credential for it, is "logged out":
|
|
814
|
+
whoami keeps today's behaviour (the local identity) rather than
|
|
815
|
+
refusing — unlike every other `fm task` cloud verb."""
|
|
816
|
+
monkeypatch.setenv("FORMIST_CONFIG_DIR", str(tmp_path / "fm-config"))
|
|
817
|
+
monkeypatch.setenv("NODDIT_IDENTITY", "agent#local-session-uuid")
|
|
818
|
+
|
|
819
|
+
code, out, _err = _run(capsys, "whoami", "--host", "formist")
|
|
820
|
+
assert code == 0
|
|
821
|
+
assert out.strip() == "agent#local-session-uuid"
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
def test_whoami_cloud_mode_reached_through_a_remembered_host_without_host_flag(tmp_path, monkeypatch, capsys):
|
|
825
|
+
"""The same cloud-intent rule `resolve_mode` uses (contract §6.3): an
|
|
826
|
+
`fm use` default with a stored credential is enough to reach cloud
|
|
827
|
+
mode even with no `--host` on the whoami call itself."""
|
|
828
|
+
from formist_cli import api, prefs
|
|
829
|
+
|
|
830
|
+
me = _store_token(monkeypatch, tmp_path, env="formist")
|
|
831
|
+
monkeypatch.setattr(api, "get", lambda *a, **k: me)
|
|
832
|
+
monkeypatch.setattr(
|
|
833
|
+
prefs, "load",
|
|
834
|
+
lambda: prefs.Prefs(space=SPACE, env="formist", space_region=None, set_at=None),
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
code, out, _err = _run(capsys, "whoami")
|
|
838
|
+
assert code == 0
|
|
839
|
+
assert "user@example.com" in out
|