arch-insight-cli 0.4.0__tar.gz → 0.4.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.
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/PKG-INFO +1 -1
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_cli/__init__.py +1 -1
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_cli/main.py +17 -1
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_cli/work.py +57 -36
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/PKG-INFO +1 -1
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/pyproject.toml +1 -1
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/tests/test_work.py +47 -8
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/README.md +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_cli/auth.py +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_cli/comms.py +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/SOURCES.txt +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/dependency_links.txt +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/entry_points.txt +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/requires.txt +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/top_level.txt +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/setup.cfg +0 -0
- {arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/tests/test_comms.py +0 -0
|
@@ -478,13 +478,23 @@ def document_create(args):
|
|
|
478
478
|
def task_update(args):
|
|
479
479
|
body = {k: v for k, v in (("status", args.status), ("priority", args.priority),
|
|
480
480
|
("due_date", args.due_date), ("title", args.title)) if v is not None}
|
|
481
|
+
if args.description_file:
|
|
482
|
+
body["description"] = comms.read_text(args.description_file)
|
|
483
|
+
elif args.description is not None:
|
|
484
|
+
body["description"] = args.description
|
|
481
485
|
if args.assignee:
|
|
482
486
|
body["assignees"] = args.assignee
|
|
483
487
|
if not body:
|
|
484
|
-
raise CliError("Nothing to change: pass --status, --assignee, --due-date, --priority
|
|
488
|
+
raise CliError("Nothing to change: pass --status, --assignee, --due-date, --priority, "
|
|
489
|
+
"--title or --description.")
|
|
485
490
|
emit(request(args, "PUT", f"/api/agile/tasks/{args.task_id}", body))
|
|
486
491
|
|
|
487
492
|
|
|
493
|
+
def task_delete(args):
|
|
494
|
+
request(args, "DELETE", f"/api/agile/tasks/{args.task_id}")
|
|
495
|
+
emit({"deleted": args.task_id})
|
|
496
|
+
|
|
497
|
+
|
|
488
498
|
def ticket_list(args):
|
|
489
499
|
page = request(args, "GET", "/api/tickets")
|
|
490
500
|
emit([{k: r.get(k) for k in ("id", "title", "status", "priority", "due_date")}
|
|
@@ -690,7 +700,13 @@ def build_parser():
|
|
|
690
700
|
tu.add_argument("--due-date")
|
|
691
701
|
tu.add_argument("--title")
|
|
692
702
|
tu.add_argument("--assignee", action="append")
|
|
703
|
+
tu.add_argument("--description")
|
|
704
|
+
tu.add_argument("--description-file")
|
|
693
705
|
tu.set_defaults(func=task_update)
|
|
706
|
+
td = [a for a in areas.choices["task"]._subparsers._group_actions][0].add_parser(
|
|
707
|
+
"delete", help="Delete a task")
|
|
708
|
+
td.add_argument("task_id", type=int)
|
|
709
|
+
td.set_defaults(func=task_delete)
|
|
694
710
|
return parser
|
|
695
711
|
|
|
696
712
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Projects, tasks and helpdesk tickets from the command line.
|
|
2
2
|
|
|
3
3
|
`arch project import` takes a whole plan in one JSON file -- projects, their
|
|
4
|
-
tasks, and a status log kept
|
|
5
|
-
(a OneNote page, a spreadsheet) comes over in one command instead of
|
|
6
|
-
hundreds of clicks. It is
|
|
7
|
-
|
|
4
|
+
tasks, and a dated status log kept on the project -- so a list kept somewhere
|
|
5
|
+
else (a OneNote page, a spreadsheet) comes over in one command instead of
|
|
6
|
+
hundreds of clicks. It is quiet (no notification per task, nothing filed in
|
|
7
|
+
the helpdesk) and resumable: run it again and it adds only what is missing.
|
|
8
8
|
|
|
9
9
|
{"projects": [{
|
|
10
10
|
"name": "Webshop", "priority": "high", "status": "active",
|
|
@@ -12,8 +12,7 @@ is reported and left alone, so a second run creates nothing twice.
|
|
|
12
12
|
"tasks": [{"title": "Release Stripe production account",
|
|
13
13
|
"assignees": ["someone@example.com"], "due_date": "2026-09-14",
|
|
14
14
|
"status": "done", "priority": "medium", "description": "..."}],
|
|
15
|
-
"log": {"
|
|
16
|
-
"entries": ["2026-09-05: URL redirected by nginx ...", "..."]}
|
|
15
|
+
"log": {"entries": ["2026-09-05: URL redirected by nginx ...", "..."]}
|
|
17
16
|
}],
|
|
18
17
|
"documents": [{"title": "CCB 2026-10-05", "folder": "Change Control Board",
|
|
19
18
|
"body": "# Markdown ...", "project": "Webshop"}]}
|
|
@@ -86,49 +85,71 @@ def import_documents(request, args, docs: list[dict], dry_run: bool) -> dict:
|
|
|
86
85
|
return {"documents_created": made, "documents_skipped": skipped}
|
|
87
86
|
|
|
88
87
|
|
|
88
|
+
LOG_HEADING = "## Status log"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _description(spec: dict) -> str:
|
|
92
|
+
"""The project description, with the dated status log under its own
|
|
93
|
+
heading. The log used to become a helpdesk ticket: an internal running
|
|
94
|
+
note filed in the support queue, which notified every helpdesk member
|
|
95
|
+
once per project. It is part of the project, so it lives on it."""
|
|
96
|
+
text = (spec.get("description") or "").rstrip()
|
|
97
|
+
entries = [str(e).strip() for e in ((spec.get("log") or {}).get("entries") or []) if str(e).strip()]
|
|
98
|
+
if entries:
|
|
99
|
+
text += ("\n\n" if text else "") + LOG_HEADING + "\n\n" + "\n".join(f"- {e}" for e in entries)
|
|
100
|
+
return text
|
|
101
|
+
|
|
102
|
+
|
|
89
103
|
def import_plan(request, args, projects: list[dict], dry_run: bool) -> dict:
|
|
90
|
-
"""Create what does not exist yet; return what was done.
|
|
104
|
+
"""Create what does not exist yet; return what was done.
|
|
105
|
+
|
|
106
|
+
Quiet by design: tasks are created with notify=false, and nothing is
|
|
107
|
+
filed in the helpdesk. Moving a list in is one event for the people on
|
|
108
|
+
it, not one e-mail per line -- whoever imports tells them once.
|
|
109
|
+
|
|
110
|
+
Re-runnable and resumable: a project that exists by name gets the tasks
|
|
111
|
+
it is missing (by title) and its description brought up to date, so an
|
|
112
|
+
import stopped half-way is finished by running it again.
|
|
113
|
+
"""
|
|
91
114
|
existing = {(p.get("name") or "").strip().casefold(): p
|
|
92
115
|
for p in request(args, "GET", "/api/projects")}
|
|
93
|
-
report = {"projects_created": 0, "
|
|
94
|
-
"
|
|
116
|
+
report = {"projects_created": 0, "projects_resumed": [], "tasks_created": 0,
|
|
117
|
+
"tasks_already_there": 0, "log_entries": 0}
|
|
95
118
|
for spec in projects:
|
|
96
119
|
name = spec["name"].strip()
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
120
|
+
description = _description(spec)
|
|
121
|
+
report["log_entries"] += len((spec.get("log") or {}).get("entries") or [])
|
|
122
|
+
project = existing.get(name.casefold())
|
|
123
|
+
have: set[str] = set()
|
|
124
|
+
if project:
|
|
125
|
+
report["projects_resumed"].append(name)
|
|
126
|
+
have = {(t.get("title") or "").strip().casefold()
|
|
127
|
+
for t in request(args, "GET", f"/api/agile/tasks?project_id={project['id']}")}
|
|
128
|
+
if not dry_run and (project.get("description") or "") != description:
|
|
129
|
+
request(args, "PUT", f"/api/projects/{project['id']}", {**project, "description": description})
|
|
130
|
+
elif dry_run:
|
|
101
131
|
report["projects_created"] += 1
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
entries = [e for e in (log.get("entries") or []) if str(e).strip()]
|
|
107
|
-
if entries:
|
|
108
|
-
ticket = request(args, "POST", "/api/tickets", {
|
|
109
|
-
"title": log.get("title") or f"{name} - status log",
|
|
110
|
-
"message": entries[0],
|
|
132
|
+
else:
|
|
133
|
+
project = request(args, "POST", "/api/projects", {
|
|
134
|
+
"name": name,
|
|
135
|
+
"status": spec.get("status") or "active",
|
|
111
136
|
"priority": spec.get("priority") or "medium",
|
|
137
|
+
"description": description,
|
|
112
138
|
})
|
|
113
|
-
|
|
114
|
-
request(args, "POST", f"/api/tickets/{ticket['id']}/reply", {"message": entry})
|
|
115
|
-
report["tickets_created"] += 1
|
|
116
|
-
report["log_entries"] += len(entries)
|
|
117
|
-
ticket_note = f"\n\nStatus log: helpdesk ticket #{ticket['id']}."
|
|
118
|
-
project = request(args, "POST", "/api/projects", {
|
|
119
|
-
"name": name,
|
|
120
|
-
"status": spec.get("status") or "active",
|
|
121
|
-
"priority": spec.get("priority") or "medium",
|
|
122
|
-
"description": (spec.get("description") or "") + ticket_note,
|
|
123
|
-
})
|
|
124
|
-
report["projects_created"] += 1
|
|
139
|
+
report["projects_created"] += 1
|
|
125
140
|
for t in spec.get("tasks") or []:
|
|
141
|
+
if t["title"].strip().casefold() in have:
|
|
142
|
+
report["tasks_already_there"] += 1
|
|
143
|
+
continue
|
|
144
|
+
report["tasks_created"] += 1
|
|
145
|
+
if dry_run:
|
|
146
|
+
continue
|
|
126
147
|
body = {"title": t["title"], "project_id": project["id"],
|
|
127
148
|
"status": t.get("status") or "todo",
|
|
128
|
-
"priority": t.get("priority") or spec.get("priority") or "medium"
|
|
149
|
+
"priority": t.get("priority") or spec.get("priority") or "medium",
|
|
150
|
+
"notify": False}
|
|
129
151
|
for key in ("description", "due_date", "assignees"):
|
|
130
152
|
if t.get(key):
|
|
131
153
|
body[key] = t[key]
|
|
132
154
|
request(args, "POST", "/api/agile/tasks", body)
|
|
133
|
-
report["tasks_created"] += 1
|
|
134
155
|
return report
|
|
@@ -17,7 +17,9 @@ PLAN = {"projects": [{"name": "Webshop", "priority": "high",
|
|
|
17
17
|
|
|
18
18
|
def fake_server():
|
|
19
19
|
calls = []
|
|
20
|
-
state = {"projects": [{"id": 1, "name": "Existing"
|
|
20
|
+
state = {"projects": [{"id": 1, "name": "Existing", "description": "old: helpdesk ticket #5"}],
|
|
21
|
+
"tasks": {1: [{"title": "Already here"}]},
|
|
22
|
+
"docs": [{"title": "Old", "folder": "CCB"}]}
|
|
21
23
|
|
|
22
24
|
def request(args, method, path, body=None, **kw):
|
|
23
25
|
calls.append((method, path, body))
|
|
@@ -25,29 +27,53 @@ def fake_server():
|
|
|
25
27
|
return state["projects"]
|
|
26
28
|
if (method, path) == ("GET", "/api/docs/requirements"):
|
|
27
29
|
return state["docs"]
|
|
30
|
+
if method == "GET" and path.startswith("/api/agile/tasks?project_id="):
|
|
31
|
+
return state["tasks"].get(int(path.rsplit("=", 1)[1]), [])
|
|
28
32
|
if (method, path) == ("POST", "/api/projects"):
|
|
29
33
|
row = {"id": 10 + len(state["projects"]), **body}
|
|
30
34
|
state["projects"].append(row)
|
|
31
35
|
return row
|
|
32
|
-
if (method, path) == ("POST", "/api/tickets"):
|
|
33
|
-
return {"id": 77}
|
|
34
36
|
return {}
|
|
35
37
|
return request, calls
|
|
36
38
|
|
|
37
39
|
|
|
38
|
-
def
|
|
40
|
+
def test_a_plan_creates_projects_and_tasks_quietly_with_the_log_on_the_project(tmp_path):
|
|
39
41
|
f = tmp_path / "plan.json"
|
|
40
42
|
f.write_text(json.dumps(PLAN), encoding="utf-8")
|
|
41
43
|
request, calls = fake_server()
|
|
42
44
|
report = work.import_plan(request, SimpleNamespace(), work.load_plan(str(f)), dry_run=False)
|
|
43
|
-
assert report
|
|
44
|
-
"tickets_created": 1, "log_entries": 2}
|
|
45
|
+
assert report["projects_created"] == 1 and report["tasks_created"] == 2
|
|
45
46
|
tasks = [b for m, p, b in calls if (m, p) == ("POST", "/api/agile/tasks")]
|
|
46
47
|
assert tasks[0]["assignees"] == ["st@x.com"] and tasks[0]["due_date"] == "2026-09-14"
|
|
47
48
|
assert tasks[1]["status"] == "done"
|
|
49
|
+
# Nobody is notified per task, and nothing goes to the helpdesk.
|
|
50
|
+
assert all(b["notify"] is False for b in tasks)
|
|
51
|
+
assert not [p for m, p, b in calls if p.startswith("/api/tickets")]
|
|
48
52
|
project = next(b for m, p, b in calls if (m, p) == ("POST", "/api/projects"))
|
|
49
|
-
assert "
|
|
50
|
-
assert
|
|
53
|
+
assert "## Status log" in project["description"]
|
|
54
|
+
assert "- 2026-09-14: terms updated" in project["description"]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_a_stopped_import_is_finished_by_running_it_again(tmp_path):
|
|
58
|
+
plan = {"projects": [{"name": "Existing", "tasks": [{"title": "Already here"}, {"title": "New one"}],
|
|
59
|
+
"log": {"entries": ["2026-10-01: started"]}}]}
|
|
60
|
+
f = tmp_path / "plan.json"
|
|
61
|
+
f.write_text(json.dumps(plan), encoding="utf-8")
|
|
62
|
+
request, calls = fake_server()
|
|
63
|
+
report = work.import_plan(request, SimpleNamespace(), work.load_plan(str(f)), dry_run=False)
|
|
64
|
+
assert report["projects_resumed"] == ["Existing"]
|
|
65
|
+
assert report["tasks_created"] == 1 and report["tasks_already_there"] == 1
|
|
66
|
+
put = next(b for m, p, b in calls if (m, p) == ("PUT", "/api/projects/1"))
|
|
67
|
+
assert "helpdesk ticket" not in put["description"] and "2026-10-01: started" in put["description"]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_a_dry_run_counts_the_same_and_writes_nothing(tmp_path):
|
|
71
|
+
f = tmp_path / "plan.json"
|
|
72
|
+
f.write_text(json.dumps(PLAN), encoding="utf-8")
|
|
73
|
+
request, calls = fake_server()
|
|
74
|
+
report = work.import_plan(request, SimpleNamespace(), work.load_plan(str(f)), dry_run=True)
|
|
75
|
+
assert report["projects_created"] == 1 and report["tasks_created"] == 2 and report["log_entries"] == 2
|
|
76
|
+
assert not [c for c in calls if c[0] != "GET"]
|
|
51
77
|
|
|
52
78
|
|
|
53
79
|
def test_documents_are_notes_and_not_created_twice(tmp_path):
|
|
@@ -101,3 +127,16 @@ def test_org_show_leaves_out_billing_identifiers(monkeypatch):
|
|
|
101
127
|
text = str(shown[0])
|
|
102
128
|
assert "cus_1" not in text and "tok" not in text and "'J'" not in text
|
|
103
129
|
assert shown[0]["members"] == [{"name": "a", "email": "a@x", "roles": ["Admin"]}]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def test_task_description_and_delete(monkeypatch, tmp_path):
|
|
133
|
+
sent = []
|
|
134
|
+
monkeypatch.setattr(main, "request", lambda args, method, path, body=None, **kw: sent.append((method, path, body)) or {})
|
|
135
|
+
monkeypatch.setattr(main, "emit", lambda value: None)
|
|
136
|
+
f = tmp_path / "d.md"
|
|
137
|
+
f.write_text("line one\n- detail", encoding="utf-8")
|
|
138
|
+
for argv in (["task", "update", "5", "--description-file", str(f)], ["task", "delete", "6"]):
|
|
139
|
+
args = main.build_parser().parse_args(argv)
|
|
140
|
+
args.func(args)
|
|
141
|
+
assert sent == [("PUT", "/api/agile/tasks/5", {"description": "line one\n- detail"}),
|
|
142
|
+
("DELETE", "/api/agile/tasks/6", None)]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{arch_insight_cli-0.4.0 → arch_insight_cli-0.4.2}/arch_insight_cli.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|